diff --git a/common/src/main/java/net/merchantpug/apugli/integration/pehkui/ApoliScaleModifier.java b/common/src/main/java/net/merchantpug/apugli/integration/pehkui/ApoliScaleModifier.java index 5029ad1e..86044aa2 100644 --- a/common/src/main/java/net/merchantpug/apugli/integration/pehkui/ApoliScaleModifier.java +++ b/common/src/main/java/net/merchantpug/apugli/integration/pehkui/ApoliScaleModifier.java @@ -17,7 +17,6 @@ import virtuoel.pehkui.api.ScaleRegistries; import virtuoel.pehkui.api.ScaleType; -import java.net.IDN; import java.util.List; import java.util.Map; import java.util.Set; @@ -34,7 +33,7 @@ public class ApoliScaleModifier

extends ScaleModifier { private final Set scalesToUpdate = Sets.newHashSet(); protected final Set cachedScaleIds; protected boolean hasLoggedWarn = false; - protected boolean addedScales = false; + private boolean addedScales = false; public ApoliScaleModifier(P power, List modifiers, Set cachedScaleIds) { this(-128.0F, power, modifiers, cachedScaleIds); diff --git a/common/src/main/java/net/merchantpug/apugli/integration/pehkui/LerpedApoliScaleModifier.java b/common/src/main/java/net/merchantpug/apugli/integration/pehkui/LerpedApoliScaleModifier.java index b6e11da0..1427d4b8 100644 --- a/common/src/main/java/net/merchantpug/apugli/integration/pehkui/LerpedApoliScaleModifier.java +++ b/common/src/main/java/net/merchantpug/apugli/integration/pehkui/LerpedApoliScaleModifier.java @@ -4,7 +4,6 @@ import com.google.common.collect.Sets; import it.unimi.dsi.fastutil.floats.Float2FloatFunction; import net.merchantpug.apugli.Apugli; -import net.merchantpug.apugli.network.s2c.integration.pehkui.MarkLerpedScaleReadyPacket; import net.merchantpug.apugli.network.c2s.integration.pehkui.ResetScaleCheckPacket; import net.merchantpug.apugli.platform.Services; import net.minecraft.nbt.CompoundTag; @@ -78,8 +77,6 @@ public CompoundTag serialize(CompoundTag tag) { super.serialize(tag); tag.putInt("Ticks", this.getTicks()); tag.putBoolean("ShouldTickDown", this.shouldTickDown); - if (!Float.isNaN(this.scaleCheckValue)) - tag.putFloat("ScaleCheckValue", this.scaleCheckValue); if (!this.lowerBoundScales.isEmpty()) { ListTag cachedMaxScaleTag = new ListTag(); for (Map.Entry entry : this.lowerBoundScales.entrySet()) { @@ -108,8 +105,6 @@ public void deserialize(CompoundTag tag) { super.deserialize(tag); this.setTicks(tag.getInt("Ticks")); this.shouldTickDown = tag.getBoolean("ShouldTickDown"); - if (tag.contains("ScaleCheckValue", Tag.TAG_FLOAT)) - this.scaleCheckValue = tag.getFloat("ScaleCheckValue"); if (tag.contains("LowerBoundScales", Tag.TAG_LIST)) { ListTag lowerBoundScalesTag = tag.getList("LowerBoundScales", Tag.TAG_COMPOUND); for (int i = 0; i < lowerBoundScalesTag.size(); ++i) { @@ -174,13 +169,7 @@ public void tick(LivingEntity entity, boolean calledFromNbt) { if (hasResetScale || calledFromNbt) continue; - if (!entity.level().isClientSide() && !this.readyScales.contains(scaleTypeId)) { - this.readyScales.add(scaleTypeId); - if (!hasSentReadyPacket) { - Services.PLATFORM.sendS2CTrackingAndSelf(new MarkLerpedScaleReadyPacket(entity.getId(), this.getId()), entity); - hasSentReadyPacket = true; - } - } + this.readyScales.add(scaleTypeId); } if (!this.readyScales.isEmpty() && !entity.level().isClientSide()) { diff --git a/common/src/main/java/net/merchantpug/apugli/integration/pehkui/PehkuiUtil.java b/common/src/main/java/net/merchantpug/apugli/integration/pehkui/PehkuiUtil.java index 80e142ad..52edd2f3 100644 --- a/common/src/main/java/net/merchantpug/apugli/integration/pehkui/PehkuiUtil.java +++ b/common/src/main/java/net/merchantpug/apugli/integration/pehkui/PehkuiUtil.java @@ -48,7 +48,7 @@ public static

void tickScalePowers(LivingEntity entity) { modifier.addScales(entity, ApugliPowers.MODIFY_SCALE.get().getCachedScaleIds(power, entity).stream().toList()); - if (!entity.level().isClientSide()) continue; + if (entity.level().isClientSide()) continue; modifier.tick(entity, false); } diff --git a/common/src/main/java/net/merchantpug/apugli/network/s2c/integration/pehkui/MarkLerpedScaleReadyPacket.java b/common/src/main/java/net/merchantpug/apugli/network/s2c/integration/pehkui/MarkLerpedScaleReadyPacket.java deleted file mode 100644 index 3f9768a9..00000000 --- a/common/src/main/java/net/merchantpug/apugli/network/s2c/integration/pehkui/MarkLerpedScaleReadyPacket.java +++ /dev/null @@ -1,66 +0,0 @@ -package net.merchantpug.apugli.network.s2c.integration.pehkui; - -import com.google.common.collect.Maps; -import net.merchantpug.apugli.Apugli; -import net.merchantpug.apugli.integration.pehkui.LerpedApoliScaleModifier; -import net.merchantpug.apugli.network.s2c.ApugliPacketS2C; -import net.merchantpug.apugli.platform.Services; -import net.merchantpug.apugli.registry.power.ApugliPowers; -import net.minecraft.client.Minecraft; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.Entity; -import virtuoel.pehkui.api.ScaleRegistries; - -import java.util.Map; - -public record MarkLerpedScaleReadyPacket(int entityId, - ResourceLocation powerId) implements ApugliPacketS2C { - public static final ResourceLocation ID = Apugli.asResource("mark_lerped_scale_ready"); - - @Override - public void encode(FriendlyByteBuf buf) { - buf.writeInt(this.entityId()); - buf.writeResourceLocation(this.powerId()); - } - - public static MarkLerpedScaleReadyPacket decode(FriendlyByteBuf buf) { - int entityId = buf.readInt(); - ResourceLocation powerId = buf.readResourceLocation(); - - return new MarkLerpedScaleReadyPacket(entityId, powerId); - } - - @Override - public ResourceLocation getFabricId() { - return ID; - } - - @Override - public void handle() { - // The lambda implementation of this Runnable breaks Forge servers. - Minecraft.getInstance().execute(new Runnable() { - @Override - public void run() { - if (!Services.PLATFORM.isModLoaded("pehkui")) { - Apugli.LOG.warn("Attempted loading UpdateLerpedScalePacket without Pehkui."); - return; - } - - Entity entity = Minecraft.getInstance().level.getEntity(entityId()); - - Object apoliModifier = ApugliPowers.MODIFY_SCALE.get().getApoliScaleModifier(powerId(), entity); - - if (!(apoliModifier instanceof LerpedApoliScaleModifier lerpedApoliModifier)) { - Apugli.LOG.warn("Tried updating non-existent or non LerpedApoliScaleModifier."); - return; - } - - for (ResourceLocation id : lerpedApoliModifier.getCachedScaleIds()) { - lerpedApoliModifier.setReady(id); - } - } - }); - - } -} diff --git a/fabric/src/main/java/net/merchantpug/apugli/network/ApugliPackets.java b/fabric/src/main/java/net/merchantpug/apugli/network/ApugliPackets.java index 8330d1f1..975302d3 100644 --- a/fabric/src/main/java/net/merchantpug/apugli/network/ApugliPackets.java +++ b/fabric/src/main/java/net/merchantpug/apugli/network/ApugliPackets.java @@ -34,7 +34,6 @@ of this software and associated documentation files (the "Software"), to deal import net.merchantpug.apugli.network.c2s.UpdateKeysPressedPacket; import net.merchantpug.apugli.network.c2s.integration.pehkui.ResetScaleCheckPacket; import net.merchantpug.apugli.network.s2c.*; -import net.merchantpug.apugli.network.s2c.integration.pehkui.MarkLerpedScaleReadyPacket; import net.merchantpug.apugli.network.s2c.integration.pehkui.SyncScalePacket; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.MinecraftServer; @@ -57,7 +56,6 @@ public static void registerS2C() { ClientPlayNetworking.registerReceiver(ExecuteEntityActionClientPacket.ID, createS2CHandler(ExecuteEntityActionClientPacket::decode, ExecuteEntityActionClientPacket::handle)); ClientPlayNetworking.registerReceiver(ExecuteBiEntityActionClientPacket.ID, createS2CHandler(ExecuteBiEntityActionClientPacket::decode, ExecuteBiEntityActionClientPacket::handle)); ClientPlayNetworking.registerReceiver(SyncScalePacket.ID, createS2CHandler(SyncScalePacket::decode, SyncScalePacket::handle)); - ClientPlayNetworking.registerReceiver(MarkLerpedScaleReadyPacket.ID, createS2CHandler(MarkLerpedScaleReadyPacket::decode, MarkLerpedScaleReadyPacket::handle)); }); } diff --git a/neoforge/src/main/java/net/merchantpug/apugli/network/ApugliPacketHandler.java b/neoforge/src/main/java/net/merchantpug/apugli/network/ApugliPacketHandler.java index 928d25b7..3ebe77f4 100644 --- a/neoforge/src/main/java/net/merchantpug/apugli/network/ApugliPacketHandler.java +++ b/neoforge/src/main/java/net/merchantpug/apugli/network/ApugliPacketHandler.java @@ -19,7 +19,6 @@ import net.merchantpug.apugli.network.s2c.SyncKeyPressCapabilityPacket; import net.merchantpug.apugli.network.s2c.SyncKeysLessenedPacket; import net.merchantpug.apugli.network.s2c.UpdateUrlTexturesPacket; -import net.merchantpug.apugli.network.s2c.integration.pehkui.MarkLerpedScaleReadyPacket; import net.merchantpug.apugli.network.s2c.integration.pehkui.SyncScalePacket; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; @@ -60,7 +59,6 @@ public static void register() { INSTANCE.registerMessage(i++, ExecuteBiEntityActionServerPacket.class, ExecuteBiEntityActionServerPacket::encode, ExecuteBiEntityActionServerPacket::decode, ApugliPacketHandler.createC2SHandler(ExecuteBiEntityActionServerPacket::handle)); INSTANCE.registerMessage(i++, ForcePlayerPosePacket.class, ForcePlayerPosePacket::encode, ForcePlayerPosePacket::decode, ApugliPacketHandler.createS2CHandler(ForcePlayerPosePacket::handle)); INSTANCE.registerMessage(i++, SyncScalePacket.class, SyncScalePacket::encode, SyncScalePacket::decode, ApugliPacketHandler.createS2CHandler(SyncScalePacket::handle)); - INSTANCE.registerMessage(i++, MarkLerpedScaleReadyPacket.class, MarkLerpedScaleReadyPacket::encode, MarkLerpedScaleReadyPacket::decode, ApugliPacketHandler.createS2CHandler(MarkLerpedScaleReadyPacket::handle)); INSTANCE.registerMessage(i++, ModifyEnchantmentLevelPacket.class, ModifyEnchantmentLevelPacket::encode, ModifyEnchantmentLevelPacket::decode, ApugliPacketHandler.createS2CHandler(ModifyEnchantmentLevelPacket::handle)); INSTANCE.registerMessage(i++, ResetScaleCheckPacket.class, ResetScaleCheckPacket::encode, ResetScaleCheckPacket::decode, ApugliPacketHandler.createC2SHandler(ResetScaleCheckPacket::handle)); }