From 10b01dfc6ddd9cb0b521c261cbe0e6de3f9c6c13 Mon Sep 17 00:00:00 2001 From: CleverNucleus Date: Sun, 24 Jan 2021 19:46:54 +0000 Subject: [PATCH] Small Update Bugfixes -Reduced Limit#maxValue for Dexterity from 4.0 to 2.0. *Attack Speed gained from Dexterity is now diminishing. *Fixed Modifiers from MAINHAND equipment not syncing to the client. *Fixed NullPointerException for LootingEvent. +Incremented version to 1.1.6 --- gradle.properties | 2 +- .../playerex/api/attribute/PlayerAttributes.java | 2 +- .../com/github/clevernucleus/playerex/init/EventHandler.java | 4 +--- .../java/com/github/clevernucleus/playerex/init/Registry.java | 4 ++-- src/main/resources/META-INF/mods.toml | 2 +- src/main/resources/assets/playerex/lang/en_us.json | 4 ++-- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/gradle.properties b/gradle.properties index 496af167..6047d276 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false -mod_version=1.1.5 +mod_version=1.1.6 mod_group=com.github.clevernucleus mod_name=playerex mod_author=CleverNucleus \ No newline at end of file diff --git a/src/main/java/com/github/clevernucleus/playerex/api/attribute/PlayerAttributes.java b/src/main/java/com/github/clevernucleus/playerex/api/attribute/PlayerAttributes.java index 180e084f..524a0785 100644 --- a/src/main/java/com/github/clevernucleus/playerex/api/attribute/PlayerAttributes.java +++ b/src/main/java/com/github/clevernucleus/playerex/api/attribute/PlayerAttributes.java @@ -59,7 +59,7 @@ public class PlayerAttributes { public static final IPlayerAttribute MELEE_DAMAGE = registerAttribute(new ResourceLocation("melee_damage"), UUID.fromString("608ce27e-c0ad-41c0-af72-0e14bdef431b"), Limit.hold(0.25D, 0.25D, 4D, 0.5D), IPlayerAttribute.Type.GAME, () -> Attributes.ATTACK_DAMAGE); public static final IPlayerAttribute MELEE_CRIT_DAMAGE = registerAttribute(new ResourceLocation(ExAPI.MODID, "melee_crit_damage"), UUID.fromString("6ac065ba-47d0-4393-9053-4ebfa232ebbc"), Limit.hold(0.05D, 0.05D, 0.3D, 0.4D), IPlayerAttribute.Type.ALL, () -> (new RangedAttribute("attribute.name.playerex.melee_crit_damage", 0D, 0D, Integer.MAX_VALUE)).setShouldWatch(true)); public static final IPlayerAttribute MELEE_CRIT_CHANCE = registerAttribute(new ResourceLocation(ExAPI.MODID, "melee_crit_chance"), UUID.fromString("e0a8db40-8680-4b66-a81c-44dfa7520d8a"), Limit.hold(0.01D, 0.01D, 0.25D, 0.3D), IPlayerAttribute.Type.ALL, () -> (new RangedAttribute("attribute.name.playerex.melee_crit_chance", 0D, 0D, 1D)).setShouldWatch(true)); - public static final IPlayerAttribute ATTACK_SPEED = registerAttribute(new ResourceLocation("attack_speed"), UUID.fromString("a27f0fc8-e975-4220-bd0a-4f045933fc13"), Limit.hold(0.25D, 0.25D, 4D, 0.6D), IPlayerAttribute.Type.GAME, () -> Attributes.ATTACK_SPEED); + public static final IPlayerAttribute ATTACK_SPEED = registerAttribute(new ResourceLocation("attack_speed"), UUID.fromString("a27f0fc8-e975-4220-bd0a-4f045933fc13"), Limit.hold(0.25D, 0.25D, 2D, 0.6D), IPlayerAttribute.Type.GAME, () -> Attributes.ATTACK_SPEED); public static final IPlayerAttribute GRAVITY = registerAttribute(new ResourceLocation("forge", "gravity"), UUID.fromString("1c1e3b0c-665f-462a-a38d-205e61003ec1"), Limit.hold(0.002D, 0.002D, 0.06D, 0.05D), IPlayerAttribute.Type.GAME, ForgeMod.ENTITY_GRAVITY); public static final IPlayerAttribute EVASION = registerAttribute(new ResourceLocation(ExAPI.MODID, "evasion"), UUID.fromString("6618d0f3-9312-4399-8aa1-6829202685e9"), Limit.hold(0.01D, 0.01D, 0.5D, 0.3D), IPlayerAttribute.Type.ALL, () -> (new RangedAttribute("attribute.name.playerex.evasion", 0D, 0D, 1D)).setShouldWatch(true)); public static final IPlayerAttribute RANGED_DAMAGE = registerAttribute(new ResourceLocation(ExAPI.MODID, "ranged_damage"), UUID.fromString("a5e9b729-49c8-4f26-b37b-782e581edae3"), Limit.hold(0.25D, 0.25D, 4D, 0.5D), IPlayerAttribute.Type.ALL, () -> (new RangedAttribute("attribute.name.playerex.ranged_damage", 0D, 0D, Integer.MAX_VALUE)).setShouldWatch(true)); diff --git a/src/main/java/com/github/clevernucleus/playerex/init/EventHandler.java b/src/main/java/com/github/clevernucleus/playerex/init/EventHandler.java index 959508f1..5f5ce89a 100644 --- a/src/main/java/com/github/clevernucleus/playerex/init/EventHandler.java +++ b/src/main/java/com/github/clevernucleus/playerex/init/EventHandler.java @@ -174,7 +174,6 @@ public static void onPlayerLoggedOut(final net.minecraftforge.event.entity.playe @SubscribeEvent public static void onPlayerEquippedItems(final net.minecraftforge.event.entity.living.LivingEquipmentChangeEvent par0) { if(!(par0.getEntityLiving() instanceof PlayerEntity)) return; - if(par0.getSlot() == EquipmentSlotType.MAINHAND) return; PlayerEntity var0 = (PlayerEntity)par0.getEntityLiving(); ExAPI.playerAttributes(var0).ifPresent(var -> ((AttributesCapability)var).putEquipment(par0.getSlot(), par0.getFrom())); @@ -196,8 +195,6 @@ public static void onPlayerTick(final net.minecraftforge.event.TickEvent.PlayerT AttributesCapability var1 = (AttributesCapability)var; for(EquipmentSlotType var2 : EquipmentSlotType.values()) { - if(var2 == EquipmentSlotType.MAINHAND) continue; - ItemStack var3 = var0.getItemStackFromSlot(var2); ItemStack var4 = var1.getEquipment(var2); @@ -363,6 +360,7 @@ public static void onLivingLoot(final net.minecraftforge.event.entity.living.Loo if(par0.getDamageSource().getTrueSource() instanceof PlayerEntity) { PlayerEntity var0 = (PlayerEntity)par0.getDamageSource().getTrueSource(); + if(var0 == null) return; if(var0.world.isRemote) return; ExAPI.playerAttributes(var0).ifPresent(var -> { diff --git a/src/main/java/com/github/clevernucleus/playerex/init/Registry.java b/src/main/java/com/github/clevernucleus/playerex/init/Registry.java index c5fd257a..ed5cdf7e 100644 --- a/src/main/java/com/github/clevernucleus/playerex/init/Registry.java +++ b/src/main/java/com/github/clevernucleus/playerex/init/Registry.java @@ -85,8 +85,8 @@ public void readNBT(Capability par0, IPlayerAttributes par1, Util.add(var1, var0, PlayerAttributes.ARMOR, var2 * 0.25D, 100D); }); PlayerAttributes.registerAdder(PlayerAttributes.DEXTERITY.registryName(), (var0, var1, var2) -> { - var1.add(var0, PlayerAttributes.ATTACK_SPEED, var2 * 0.1D); var1.add(var0, PlayerAttributes.RANGED_DAMAGE, var2 * 0.25D); + Util.add(var1, var0, PlayerAttributes.ATTACK_SPEED, var2 * 0.1D, 8.0D); Util.add(var1, var0, PlayerAttributes.MOVEMENT_SPEED, var2 * 0.004D, 1.0D); Util.add(var1, var0, PlayerAttributes.MELEE_CRIT_DAMAGE, var2 * 0.05D, 10.0D); }); @@ -117,7 +117,7 @@ public void readNBT(Capability par0, IPlayerAttributes par1, }); PlayerAttributes.registerModifier(PlayerAttributes.DEXTERITY.registryName(), (var0, var1, var2) -> { Util.apply(var1, var0, PlayerAttributes.RANGED_DAMAGE, var2, 0.25D); - Util.apply(var1, var0, PlayerAttributes.ATTACK_SPEED, var2, 0.1D); + Util.apply(var1, var0, PlayerAttributes.ATTACK_SPEED, var2, 0.1D, 8.0D); Util.apply(var1, var0, PlayerAttributes.MOVEMENT_SPEED, var2, 0.004D, 1.0D); Util.apply(var1, var0, PlayerAttributes.MELEE_CRIT_DAMAGE, var2, 0.05D, 10.0D); }); diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 205ce4a5..45e51a0f 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -4,7 +4,7 @@ license="MIT License" [[mods]] modId="playerex" -version="1.1.5" +version="1.1.6" displayName="Player Ex" displayURL="https://github.com/CleverNucleus/PlayerEx" logoFile="logo.png" diff --git a/src/main/resources/assets/playerex/lang/en_us.json b/src/main/resources/assets/playerex/lang/en_us.json index be2e7109..969824b2 100644 --- a/src/main/resources/assets/playerex/lang/en_us.json +++ b/src/main/resources/assets/playerex/lang/en_us.json @@ -48,8 +48,8 @@ "playerex.attribute.strength.alt2": "+0.25 to Armor (diminishing).", "playerex.attribute.dexterity": "Dexterity: +%s", "playerex.attribute.dexterity.alt0": "+0.08 Blocks/s to Movement Speed (diminishing).", - "playerex.attribute.dexterity.alt1": "+5%% to Melee Critical Damage. (diminishing).", - "playerex.attribute.dexterity.alt2": "+0.1 to Melee Attack Speed.", + "playerex.attribute.dexterity.alt1": "+5%% to Melee Critical Damage (diminishing).", + "playerex.attribute.dexterity.alt2": "+0.1 to Melee Attack Speed (diminishing).", "playerex.attribute.dexterity.alt3": "+0.25 to Ranged Attack Damage.", "playerex.attribute.intelligence": "Intelligence: +%s", "playerex.attribute.intelligence.alt0": "+5%% to Ranged Critical Damage (diminishing).",