Fix mixin crashes on 1.16.5
This commit is contained in:
+4
@@ -8,4 +8,8 @@ public interface IMixinServerPlayer
|
||||
@Nullable
|
||||
ServerLevel distantHorizons$getDimensionChangeDestination();
|
||||
|
||||
#if MC_VER == MC_1_16_5
|
||||
void distantHorizons$setDimensionChangeDestination(ServerLevel dimensionChangeDestination);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
+1
-1
Submodule coreSubProjects updated: 840b0a7fe2...f7bf05b62f
@@ -0,0 +1,38 @@
|
||||
#if MC_VER == MC_1_16_5
|
||||
package com.seibel.distanthorizons.fabric.mixins.server;
|
||||
|
||||
import com.seibel.distanthorizons.common.wrappers.misc.IMixinServerPlayer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.Level;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(Entity.class)
|
||||
public class MixinEntity
|
||||
{
|
||||
@Inject(at = @At("TAIL"), method = "setLevel")
|
||||
public void setLevel(Level level, CallbackInfo ci)
|
||||
{
|
||||
if (this instanceof IMixinServerPlayer)
|
||||
{
|
||||
((IMixinServerPlayer) this).distantHorizons$setDimensionChangeDestination((ServerLevel) level);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
package com.seibel.distanthorizons.fabric.mixins.server;
|
||||
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@Mixin(Entity.class)
|
||||
public class MixinEntity
|
||||
{
|
||||
}
|
||||
#endif
|
||||
+9
-2
@@ -48,6 +48,12 @@ public class MixinServerPlayer implements IMixinServerPlayer
|
||||
public ServerLevel distantHorizons$getDimensionChangeDestination()
|
||||
{ return this.dimensionChangeDestination; }
|
||||
|
||||
#if MC_VER == MC_1_16_5
|
||||
@Override
|
||||
public void distantHorizons$setDimensionChangeDestination(ServerLevel dimensionChangeDestination)
|
||||
{ this.dimensionChangeDestination = dimensionChangeDestination; }
|
||||
#endif
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "changeDimension")
|
||||
#if MC_VER >= MC_1_21_1
|
||||
public void changeDimension(DimensionTransition dimensionTransition, CallbackInfoReturnable<Entity> cir)
|
||||
@@ -60,10 +66,11 @@ public class MixinServerPlayer implements IMixinServerPlayer
|
||||
#if MC_VER >= MC_1_20_1
|
||||
@Inject(at = @At("RETURN"), method = "setServerLevel")
|
||||
public void setServerLevel(ServerLevel level, CallbackInfo ci)
|
||||
#else
|
||||
{ this.dimensionChangeDestination = null; }
|
||||
#elif MC_VER >= MC_1_17_1
|
||||
@Inject(at = @At("RETURN"), method = "setLevel")
|
||||
public void setLevel(ServerLevel level, CallbackInfo ci)
|
||||
#endif
|
||||
{ this.dimensionChangeDestination = null; }
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -6,7 +6,8 @@
|
||||
"server.MixinChunkGenerator",
|
||||
"server.MixinChunkMap",
|
||||
"server.MixinUtilBackgroundThread",
|
||||
"server.MixinServerPlayer"
|
||||
"server.MixinServerPlayer",
|
||||
"server.MixinEntity"
|
||||
],
|
||||
"client": [
|
||||
"client.MixinClientLevel",
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#if MC_VER == MC_1_16_5
|
||||
|
||||
package com.seibel.distanthorizons.forge.mixins.server;
|
||||
|
||||
import com.seibel.distanthorizons.common.wrappers.misc.IMixinServerPlayer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.Level;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(Entity.class)
|
||||
public class MixinEntity
|
||||
{
|
||||
@Inject(at = @At("TAIL"), method = "setLevel")
|
||||
public void setLevel(Level level, CallbackInfo ci)
|
||||
{
|
||||
if (this instanceof IMixinServerPlayer)
|
||||
{
|
||||
((IMixinServerPlayer) this).distantHorizons$setDimensionChangeDestination((ServerLevel) level);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
package com.seibel.distanthorizons.forge.mixins.server;
|
||||
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@Mixin(Entity.class)
|
||||
public class MixinEntity
|
||||
{
|
||||
}
|
||||
#endif
|
||||
+9
-2
@@ -45,6 +45,12 @@ public class MixinServerPlayer implements IMixinServerPlayer
|
||||
public ServerLevel distantHorizons$getDimensionChangeDestination()
|
||||
{ return this.distantHorizons$dimensionChangeDestination; }
|
||||
|
||||
#if MC_VER == MC_1_16_5
|
||||
@Override
|
||||
public void distantHorizons$setDimensionChangeDestination(ServerLevel dimensionChangeDestination)
|
||||
{ this.distantHorizons$dimensionChangeDestination = dimensionChangeDestination; }
|
||||
#endif
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "changeDimension", remap = false)
|
||||
public void changeDimension(ServerLevel destination, ITeleporter teleporter, CallbackInfoReturnable<Entity> cir)
|
||||
{ this.distantHorizons$dimensionChangeDestination = destination; }
|
||||
@@ -52,10 +58,11 @@ public class MixinServerPlayer implements IMixinServerPlayer
|
||||
#if MC_VER >= MC_1_20_1
|
||||
@Inject(at = @At("RETURN"), method = "setServerLevel")
|
||||
public void setServerLevel(ServerLevel level, CallbackInfo ci)
|
||||
#else
|
||||
{ this.distantHorizons$dimensionChangeDestination = null; }
|
||||
#elif MC_VER >= MC_1_17_1
|
||||
@Inject(at = @At("RETURN"), method = "setLevel")
|
||||
public void setLevel(ServerLevel level, CallbackInfo ci)
|
||||
#endif
|
||||
{ this.distantHorizons$dimensionChangeDestination = null; }
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -7,7 +7,8 @@
|
||||
"server.MixinChunkGenerator",
|
||||
"server.MixinTFChunkGenerator",
|
||||
"server.MixinChunkMap",
|
||||
"server.MixinServerPlayer"
|
||||
"server.MixinServerPlayer",
|
||||
"server.MixinEntity"
|
||||
],
|
||||
"client": [
|
||||
"client.MixinClientPacketListener",
|
||||
|
||||
Reference in New Issue
Block a user