diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemLens.java b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemLens.java index 1f0265dc..29aa56fe 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemLens.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemLens.java @@ -85,7 +85,7 @@ public class ItemLens extends Item implements Wearable { private static final Map> comparatorDataMap = new WeakHashMap<>(); private void sendComparatorDataToClient(ServerPlayer player) { - double reachAttribute = player.getAttribute(IXplatAbstractions.INSTANCE.getReachDistance()).getValue(); + double reachAttribute = IXplatAbstractions.INSTANCE.getReachDistance(player); double distance = player.isCreative() ? reachAttribute : reachAttribute - 0.5; var hitResult = player.pick(distance, 0, false); if (hitResult.getType() == HitResult.Type.BLOCK) { diff --git a/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java b/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java index f7d0d20f..c9af39ef 100644 --- a/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java +++ b/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java @@ -19,7 +19,6 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.npc.VillagerProfession; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.CreativeModeTab; @@ -61,7 +60,7 @@ public interface IXplatAbstractions { // https://github.com/VazkiiMods/Botania/blob/13b7bcd9cbb6b1a418b0afe455662d29b46f1a7f/Xplat/src/main/java/vazkii/botania/xplat/IXplatAbstractions.java#L157 Packet toVanillaClientboundPacket(IMessage message); - Attribute getReachDistance(); + double getReachDistance(Player player); // Things that used to be caps diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java index dec835b7..02a68844 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java @@ -41,7 +41,6 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.npc.Villager; import net.minecraft.world.entity.npc.VillagerProfession; import net.minecraft.world.entity.player.Player; @@ -90,8 +89,8 @@ public class FabricXplatImpl implements IXplatAbstractions { } @Override - public Attribute getReachDistance() { - return ReachEntityAttributes.REACH; + public double getReachDistance(Player player) { + return ReachEntityAttributes.getReachDistance(player, 5.0); } @Override diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java b/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java index b3af4339..2e8be57f 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java @@ -42,7 +42,6 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.npc.Villager; import net.minecraft.world.entity.npc.VillagerProfession; import net.minecraft.world.entity.player.Player; @@ -101,8 +100,8 @@ public class ForgeXplatImpl implements IXplatAbstractions { } @Override - public Attribute getReachDistance() { - return ForgeMod.REACH_DISTANCE.get(); + public double getReachDistance(Player player) { + return player.getAttributeValue(ForgeMod.REACH_DISTANCE.get()); } @Override