Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 1.20.4 #13

Merged
merged 4 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ org.gradle.parallel=true


# Fabric Properties
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.4
loader_version=0.15.9
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.10

# Mod Properties
mod_version=3.0
mod_version=3.1
maven_group=com.github.thedeathlycow
archives_base_name=thermoo

#Fabric api
fabric_version=0.91.6+1.20.2
fabric_version=0.96.11+1.20.4

# Cardinal components
cca_version=5.3.0
cca_version=5.4.0
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.thedeathlycow.thermoo.api;

import com.github.thedeathlycow.thermoo.mixin.common.accesor.EntityAttributeModiferAccessor;
import com.mojang.datafixers.util.Either;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
Expand All @@ -10,13 +11,14 @@
import org.jetbrains.annotations.ApiStatus;

/**
* Helpful codecs used by Thermoo.
* Helpful codecs used by Thermoo. May be changed between MC versions as equivalent vanilla codecs are added.
* <p>
* Exposed in API for the convenience of API users.
*/
@ApiStatus.Experimental
public class ThermooCodecs {


public static final Codec<EntityAttributeModifier> ATTRIBUTE_MODIFIER_CODEC = RecordCodecBuilder.create(
instance -> instance.group(
Uuids.STRING_CODEC
Expand All @@ -25,7 +27,7 @@ public class ThermooCodecs {
.forGetter(EntityAttributeModifier::getId),
Codec.STRING
.fieldOf("name")
.forGetter(EntityAttributeModifier::getName),
.forGetter(modifier -> ((EntityAttributeModiferAccessor) modifier).thermoo$name()),
Codec.DOUBLE
.fieldOf("value")
.forGetter(EntityAttributeModifier::getValue),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
import net.minecraft.loot.context.LootContextParameters;
import net.minecraft.predicate.NumberRange;

/**
* Loot condition used to test the soaking values of an entity in a predicate. Only works for entities that implement
* {@link Soakable}, which by default is only {@link net.minecraft.entity.LivingEntity}. All other entities will return
* always false.
*
* @param value The {@linkplain Soakable#thermoo$getWetTicks() soaking value}
* @param scale The {@linkplain Soakable#thermoo$getSoakedScale() soaking scale}
*/
public record SoakedLootCondition(
NumberRange.IntRange value,
NumberRange.DoubleRange scale
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.thedeathlycow.thermoo.api.predicate;

import com.github.thedeathlycow.thermoo.api.temperature.Soakable;
import com.github.thedeathlycow.thermoo.api.temperature.TemperatureAware;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
Expand All @@ -10,6 +11,14 @@
import net.minecraft.loot.context.LootContextParameters;
import net.minecraft.predicate.NumberRange;

/**
* Loot condition used to test the soaking values of an entity in a predicate. Only works for entities that implement
* {@link TemperatureAware}, which by default is only {@link net.minecraft.entity.LivingEntity}. All other entities will
* always return false.
*
* @param value The {@linkplain TemperatureAware#thermoo$getTemperature() temperature value}
* @param scale The {@linkplain TemperatureAware#thermoo$getTemperatureScale() temperature scale}
*/
public record TemperatureLootCondition(
NumberRange.IntRange value,
NumberRange.DoubleRange scale
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@

import net.minecraft.loot.condition.LootConditionType;

/**
* Custom {@linkplain LootConditionType loot condition types} provided by Thermoo
*/
public class ThermooLootConditionTypes {


/**
* Tests the temperature of an entity
*/
public static final LootConditionType TEMPERATURE = new LootConditionType(TemperatureLootCondition.CODEC);

/**
* Tests the soaking value of an entity
*/
public static final LootConditionType SOAKED = new LootConditionType(SoakedLootCondition.CODEC);

private ThermooLootConditionTypes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
@Mixin(PlayerEntity.class)
public abstract class PlayerTemperatureTickMixin {

@Shadow protected abstract void collideWithEntity(Entity entity);

@Inject(
method = "tick",
at = @At(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.github.thedeathlycow.thermoo.mixin.common.accesor;

import net.minecraft.entity.attribute.EntityAttributeModifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

@Mixin(EntityAttributeModifier.class)
public interface EntityAttributeModiferAccessor {

@Accessor("name")
String thermoo$name();

}
6 changes: 3 additions & 3 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
}
],
"depends": {
"fabricloader": ">=0.15.7",
"fabric-api": ">=0.91.6",
"minecraft": "1.20.2",
"fabricloader": ">=0.15.10",
"fabric-api": ">=0.96.11",
"minecraft": "1.20.4",
"java": ">=17"
},
"suggests": {
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/thermoo.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"LivingEntityAttributeMixin",
"LivingEntityEnvironmentTickMixin",
"PlayerTemperatureTickMixin",
"TemperatureEffectTickerMixin"
"TemperatureEffectTickerMixin",
"accesor.EntityAttributeModiferAccessor"
],
"injectors": {
"defaultRequire": 1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"condition": "thermoo:temperature",
"scale": {
"min": 1.0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"type": "thermoo:scaling_attribute_modifier",
"entity_type": "minecraft:player",
"temperature_scale_range": {
"min": 0.5
},
"config": {
"scale": 0.05,
"modifier_uuid": "ea305030-b7fa-4782-9682-9d55a0319236",
"name": "Warming slow",
"attribute_type": "minecraft:generic.movement_speed",
"operation": "addition"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"type": "thermoo:damage",
"entity_type": "minecraft:player",
"entity": {
"condition": "minecraft:reference",
"name": "thermoo-test:is_warm"
},
"config": {
"amount": 1.0,
"damage_interval": 20,
"damage_type": "minecraft:in_fire"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "thermoo:empty",
"config": {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,31 @@
"config": {
"children": [
{
"type": "thermoo:damage",
"type": "thermoo:scaling_attribute_modifier",
"entity_type": "minecraft:player",
"temperature_scale_range": {
"min": 0.5
},
"config": {
"amount": 1,
"damage_interval": 20,
"damage_type": "minecraft:in_fire"
"scale": 0.05,
"modifier_uuid": "ea305030-b7fa-4782-9682-9d55a1319236",
"name": "Warming health",
"attribute_type": "minecraft:generic.max_health",
"operation": "addition"
}
},
{
"type": "thermoo:status_effect",
"entity": {
"condition": "minecraft:reference",
"name": "thermoo-test:is_cold"
"name": "thermoo-test:is_hot"
},
"config": {
"effects": [
{
"amplifier": 0,
"duration": 200,
"effect": "minecraft:speed"
"effect": "minecraft:regeneration"
}
]
}
Expand Down
Loading