From cf84a11b574515ef0e87e755390de1a2020543be Mon Sep 17 00:00:00 2001 From: CleverNucleus Date: Wed, 22 Sep 2021 17:22:18 +0100 Subject: [PATCH] Added safety mechanism +Added safety mechanism that stops the initial value of an attribute being set to below it's minimum value when being added to an entity's attribute container. *Incremented version --- gradle.properties | 2 +- .../github/clevernucleus/dataattributes/DataAttributes.java | 2 +- .../dataattributes/impl/attribute/EntityTypeObject.java | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index f1f2de7c..9d65d78a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G loader_version=0.11.6 # Mod Properties - mod_version = 1.0.4 + mod_version = 1.0.5 maven_group = com.github.clevernucleus archives_base_name = dataattributes diff --git a/src/main/java/com/github/clevernucleus/dataattributes/DataAttributes.java b/src/main/java/com/github/clevernucleus/dataattributes/DataAttributes.java index f20d1705..cab751f6 100644 --- a/src/main/java/com/github/clevernucleus/dataattributes/DataAttributes.java +++ b/src/main/java/com/github/clevernucleus/dataattributes/DataAttributes.java @@ -30,7 +30,7 @@ public final class DataAttributes implements ModInitializer { public static final LoaderJsonManager MANAGER = new LoaderJsonManager(); public static final Identifier SYNC = new Identifier(API.MODID, "sync"); /** Manual; ugh, I know. */ - public static final String VERSION = "1.0.4"; + public static final String VERSION = "1.0.5"; private static void loginQueryStart(ServerLoginNetworkHandler handler, MinecraftServer server, PacketSender sender, ServerLoginNetworking.LoginSynchronizer synchronizer) { PacketByteBuf buf = PacketByteBufs.create(); diff --git a/src/main/java/com/github/clevernucleus/dataattributes/impl/attribute/EntityTypeObject.java b/src/main/java/com/github/clevernucleus/dataattributes/impl/attribute/EntityTypeObject.java index 5f32aa13..a1519122 100644 --- a/src/main/java/com/github/clevernucleus/dataattributes/impl/attribute/EntityTypeObject.java +++ b/src/main/java/com/github/clevernucleus/dataattributes/impl/attribute/EntityTypeObject.java @@ -31,8 +31,9 @@ public void buildContainer(DefaultAttributeContainer.Builder builderIn, DefaultA if(attribute == null) continue; double value = this.attributes.get(identifier); + double clamp = attribute.clamp(value); - builderIn.add(attribute, value); + builderIn.add(attribute, clamp); } }