This commit is contained in:
gnembon committed 2020-05-21 14:23:04 -03:00
1 parent 42ba5a9f03
commit cf817c2e39
25 files changed
+91 -92

No files matched your search

@@ -3,7 +3,6 @@ package carpet.mixins;
import carpet.fakes.EntityInterface;
import carpet.script.EntityEventsGroup;
import com.mojang.authlib.GameProfile;
import net.minecraft.class_5321;
import net.minecraft.entity.Entity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.player.PlayerEntity;
@@ -13,6 +12,7 @@ import net.minecraft.stat.Stat;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import org.spongepowered.asm.mixin.Mixin;
@@ -89,23 +89,23 @@ public abstract class ServerPlayerEntity_scarpetEventMixin extends PlayerEntity
}
private Vec3d previousLocation;
private class_5321<DimensionType> previousDimension;
private RegistryKey<DimensionType> previousDimension;
@Inject(method = "changeDimension", at = @At("HEAD"))
private void logPreviousCoordinates(class_5321<DimensionType> newDimension, CallbackInfoReturnable<Entity> cir)
private void logPreviousCoordinates(RegistryKey<DimensionType> newDimension, CallbackInfoReturnable<Entity> cir)
{
previousLocation = getPos();
previousDimension = world.method_27983(); //dimension type
}
@Inject(method = "changeDimension", at = @At("RETURN"))
private void atChangeDimension(class_5321<DimensionType> newDimension, CallbackInfoReturnable<Entity> cir)
private void atChangeDimension(RegistryKey<DimensionType> newDimension, CallbackInfoReturnable<Entity> cir)
{
if (PLAYER_CHANGES_DIMENSION.isNeeded())
{
ServerPlayerEntity player = (ServerPlayerEntity) (Object)this;
Vec3d to = null;
if (!notInAnyWorld || previousDimension != DimensionType.field_24755 || newDimension != DimensionType.field_24753) // end ow
if (!notInAnyWorld || previousDimension != DimensionType.THE_END_REGISTRY_KEY || newDimension != DimensionType.OVERWORLD_REGISTRY_KEY) // end ow
{
to = getPos();
}