1.16-pre3
This commit is contained in:
1 parent
9e80222338
commit
441676a1e5
5 files changed
+14
-13
No files matched your search
@@ -2,10 +2,9 @@ package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -22,7 +21,7 @@ public abstract class Entity_portalSuffocationMixin
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/entity/Entity;getLastNetherPortalDirection()Lnet/minecraft/util/math/Direction;"
|
||||
))
|
||||
private void registerEntityDimensionChange(RegistryKey<DimensionType> newDimension, CallbackInfoReturnable<Entity> cir)
|
||||
private void registerEntityDimensionChange(ServerWorld serverWorld, CallbackInfoReturnable<Entity> cir)
|
||||
{
|
||||
if (CarpetSettings.portalSuffocationFix)
|
||||
{
|
||||
@@ -44,7 +43,7 @@ public abstract class Entity_portalSuffocationMixin
|
||||
}
|
||||
|
||||
@Inject(method = "changeDimension", at = @At("RETURN"))
|
||||
private void removeEntity(RegistryKey<DimensionType> newDimension, CallbackInfoReturnable<Entity> cir)
|
||||
private void removeEntity(ServerWorld serverWorld, CallbackInfoReturnable<Entity> cir)
|
||||
{
|
||||
CarpetSettings.currentTelepotingEntityBox = null;
|
||||
CarpetSettings.fixedPosition = null;
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.entity.damage.DamageSource;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.stat.Stat;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -92,24 +93,24 @@ public abstract class ServerPlayerEntity_scarpetEventMixin extends PlayerEntity
|
||||
private RegistryKey<World> previousDimension;
|
||||
|
||||
@Inject(method = "changeDimension", at = @At("HEAD"))
|
||||
private void logPreviousCoordinates(RegistryKey<DimensionType> newDimension, CallbackInfoReturnable<Entity> cir)
|
||||
private void logPreviousCoordinates(ServerWorld serverWorld, CallbackInfoReturnable<Entity> cir)
|
||||
{
|
||||
previousLocation = getPos();
|
||||
previousDimension = world.getRegistryKey(); //dimension type
|
||||
}
|
||||
|
||||
@Inject(method = "changeDimension", at = @At("RETURN"))
|
||||
private void atChangeDimension(RegistryKey<World> newDimension, CallbackInfoReturnable<Entity> cir)
|
||||
private void atChangeDimension(ServerWorld newWorld, CallbackInfoReturnable<Entity> cir)
|
||||
{
|
||||
if (PLAYER_CHANGES_DIMENSION.isNeeded())
|
||||
{
|
||||
ServerPlayerEntity player = (ServerPlayerEntity) (Object)this;
|
||||
Vec3d to = null;
|
||||
if (!notInAnyWorld || previousDimension != World.END || newDimension != World.OVERWORLD) // end ow
|
||||
if (!notInAnyWorld || previousDimension != World.END || newWorld.getRegistryKey() != World.OVERWORLD) // end ow
|
||||
{
|
||||
to = getPos();
|
||||
}
|
||||
PLAYER_CHANGES_DIMENSION.onDimensionChange(player, previousLocation, to, previousDimension, newDimension);
|
||||
PLAYER_CHANGES_DIMENSION.onDimensionChange(player, previousLocation, to, previousDimension, newWorld.getRegistryKey());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user