diff --git a/src/main/java/mod/acgaming/universaltweaks/UniversalTweaks.java b/src/main/java/mod/acgaming/universaltweaks/UniversalTweaks.java index 51b9b8ba..99a5b84e 100644 --- a/src/main/java/mod/acgaming/universaltweaks/UniversalTweaks.java +++ b/src/main/java/mod/acgaming/universaltweaks/UniversalTweaks.java @@ -2,7 +2,6 @@ import mod.acgaming.universaltweaks.bugfixes.blocks.blockoverlay.UTBlockOverlayLists; import mod.acgaming.universaltweaks.bugfixes.entities.desync.UTEntityDesync; -import mod.acgaming.universaltweaks.bugfixes.entities.dimensionchange.UTDimensionChangeEvents; import mod.acgaming.universaltweaks.bugfixes.misc.help.UTHelp; import mod.acgaming.universaltweaks.config.UTConfigBugfixes; import mod.acgaming.universaltweaks.config.UTConfigGeneral; @@ -46,7 +45,6 @@ import mod.acgaming.universaltweaks.tweaks.performance.autosave.UTAutoSaveOFCompat; import mod.acgaming.universaltweaks.tweaks.performance.craftingcache.UTCraftingCache; import mod.acgaming.universaltweaks.tweaks.performance.entityradiuscheck.UTEntityRadiusCheck; -import mod.acgaming.universaltweaks.tweaks.world.voidfog.UTVoidFog; import mod.acgaming.universaltweaks.util.UTKeybindings; import mod.acgaming.universaltweaks.util.UTPacketHandler; import mod.acgaming.universaltweaks.util.UTReflectionUtil; @@ -152,7 +150,6 @@ public void preInit(FMLPreInitializationEvent event) @Mod.EventHandler public void init(FMLInitializationEvent event) { - if (UTConfigBugfixes.ENTITIES.utDimensionChangeToggle) MinecraftForge.EVENT_BUS.register(new UTDimensionChangeEvents()); if (UTConfigTweaks.MISC.ARMOR_CURVE.utArmorCurveToggle) UTArmorCurve.initExpressions(); if (Loader.isModLoaded("abyssalcraft") && UTConfigMods.ABYSSALCRAFT.utOptimizedItemTransferToggle) MinecraftForge.EVENT_BUS.register(new UTAbyssalCraftEvents()); if (Loader.isModLoaded("arcanearchives") && UTConfigMods.ARCANE_ARCHIVES.utDuplicationFixesToggle) MinecraftForge.EVENT_BUS.register(new UTArcaneArchivesEvents()); diff --git a/src/main/java/mod/acgaming/universaltweaks/bugfixes/entities/dimensionchange/UTDimensionChangeEvents.java b/src/main/java/mod/acgaming/universaltweaks/bugfixes/entities/dimensionchange/UTDimensionChangeEvents.java deleted file mode 100644 index 9b7d8987..00000000 --- a/src/main/java/mod/acgaming/universaltweaks/bugfixes/entities/dimensionchange/UTDimensionChangeEvents.java +++ /dev/null @@ -1,27 +0,0 @@ -package mod.acgaming.universaltweaks.bugfixes.entities.dimensionchange; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.PlayerEvent; - -import mod.acgaming.universaltweaks.UniversalTweaks; -import mod.acgaming.universaltweaks.config.UTConfigBugfixes; -import mod.acgaming.universaltweaks.config.UTConfigGeneral; - -// Courtesy of MacTso -public class UTDimensionChangeEvents -{ - @SubscribeEvent - public void utDimensionChange(PlayerEvent.PlayerChangedDimensionEvent event) - { - if (!UTConfigBugfixes.ENTITIES.utDimensionChangeToggle) return; - if (UTConfigGeneral.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTDimensionChangeEvents ::: Change dimension"); - EntityPlayer ep = event.player; - if (ep instanceof EntityPlayerMP) - { - EntityPlayerMP player = (EntityPlayerMP) ep; - player.addExperienceLevel(0); - } - } -} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/universaltweaks/bugfixes/entities/dimensionchange/mixin/UTDimensionChangeMixin.java b/src/main/java/mod/acgaming/universaltweaks/bugfixes/entities/dimensionchange/mixin/UTDimensionChangeMixin.java index 01bb2587..1efdb9d1 100644 --- a/src/main/java/mod/acgaming/universaltweaks/bugfixes/entities/dimensionchange/mixin/UTDimensionChangeMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/bugfixes/entities/dimensionchange/mixin/UTDimensionChangeMixin.java @@ -1,21 +1,18 @@ package mod.acgaming.universaltweaks.bugfixes.entities.dimensionchange.mixin; +import com.mojang.authlib.GameProfile; +import mod.acgaming.universaltweaks.UniversalTweaks; +import mod.acgaming.universaltweaks.config.UTConfigBugfixes; +import mod.acgaming.universaltweaks.config.UTConfigGeneral; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.play.server.SPacketEntityEffect; import net.minecraft.network.play.server.SPacketPlayerAbilities; -import net.minecraft.network.play.server.SPacketSetExperience; -import net.minecraft.network.play.server.SPacketUpdateHealth; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; import net.minecraftforge.common.util.ITeleporter; - -import com.mojang.authlib.GameProfile; -import mod.acgaming.universaltweaks.UniversalTweaks; -import mod.acgaming.universaltweaks.config.UTConfigBugfixes; -import mod.acgaming.universaltweaks.config.UTConfigGeneral; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -24,28 +21,32 @@ // MC-124177 // https://bugs.mojang.com/browse/MC-124177 +// Courtesy of FxMorin @Mixin(EntityPlayerMP.class) public abstract class UTDimensionChangeMixin extends EntityPlayer { - @Shadow - public NetHandlerPlayServer connection; + @Shadow public NetHandlerPlayServer connection; + + @Shadow private int lastExperience; + + @Shadow private float lastHealth; + + @Shadow private int lastFoodLevel; protected UTDimensionChangeMixin(World worldIn, GameProfile gameProfileIn) { super(worldIn, gameProfileIn); } - @Inject(method = "changeDimension", at = @At(value = "HEAD"), remap = false) + @Inject(method = "changeDimension", at = @At(value = "TAIL"), remap = false) public void utChangeDimension(int dimensionIn, ITeleporter teleporter, CallbackInfoReturnable cir) { if (!UTConfigBugfixes.ENTITIES.utDimensionChangeToggle) return; if (UTConfigGeneral.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTDimensionChange ::: Change dimension"); - this.connection.sendPacket(new SPacketUpdateHealth(this.getHealth(), this.foodStats.getFoodLevel(), this.foodStats.getSaturationLevel())); - this.connection.sendPacket(new SPacketSetExperience(this.experience, this.experienceTotal, this.experienceLevel)); this.connection.sendPacket(new SPacketPlayerAbilities(this.capabilities)); - for (PotionEffect effect : getActivePotionEffects()) - { - this.connection.sendPacket(new SPacketEntityEffect(this.getEntityId(), effect)); - } + for (PotionEffect effect : this.getActivePotionEffects()) this.connection.sendPacket(new SPacketEntityEffect(this.getEntityId(), effect)); + this.lastExperience = -1; + this.lastHealth = -1.0F; + this.lastFoodLevel = -1; } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/universaltweaks/bugfixes/entities/dimensionchange/mixin/UTDimensionChangePlayerListMixin.java b/src/main/java/mod/acgaming/universaltweaks/bugfixes/entities/dimensionchange/mixin/UTDimensionChangePlayerListMixin.java index 0eee7d68..d2b7b492 100644 --- a/src/main/java/mod/acgaming/universaltweaks/bugfixes/entities/dimensionchange/mixin/UTDimensionChangePlayerListMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/bugfixes/entities/dimensionchange/mixin/UTDimensionChangePlayerListMixin.java @@ -1,14 +1,13 @@ package mod.acgaming.universaltweaks.bugfixes.entities.dimensionchange.mixin; +import mod.acgaming.universaltweaks.UniversalTweaks; +import mod.acgaming.universaltweaks.config.UTConfigBugfixes; +import mod.acgaming.universaltweaks.config.UTConfigGeneral; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.play.server.SPacketServerDifficulty; import net.minecraft.server.MinecraftServer; import net.minecraft.server.management.PlayerList; import net.minecraftforge.common.util.ITeleporter; - -import mod.acgaming.universaltweaks.UniversalTweaks; -import mod.acgaming.universaltweaks.config.UTConfigBugfixes; -import mod.acgaming.universaltweaks.config.UTConfigGeneral; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow;