diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2020-04-26 20:59:51 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2020-04-26 20:59:51 +0200 |
commit | 55fb59b40e286bcb84016e8e5de1416852c77f80 (patch) | |
tree | 8ca9889342c3bedf791438fb4b742f2986a93537 /src | |
parent | b8c42fb7a7f8f9aee699005ccd15996693f66b68 (diff) | |
download | parquet-55fb59b40e286bcb84016e8e5de1416852c77f80.tar.gz |
Bugfix for CameraMode
Reset location was stored with reset dimension set to the dimension on
logout, not the stored one. Used Raw Dimension ID for storage instead if
keeping a refernce.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/re/jag/parquet/mixin/ServerPlayerEntityMixin.java | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/main/java/re/jag/parquet/mixin/ServerPlayerEntityMixin.java b/src/main/java/re/jag/parquet/mixin/ServerPlayerEntityMixin.java index 0cb1827..aed4919 100644 --- a/src/main/java/re/jag/parquet/mixin/ServerPlayerEntityMixin.java +++ b/src/main/java/re/jag/parquet/mixin/ServerPlayerEntityMixin.java @@ -27,7 +27,7 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntity implements Ca } private double saved_x, saved_y, saved_z; - private DimensionType saved_dimension; + private int saved_dimension; private boolean save_active = false; @Shadow @@ -39,7 +39,7 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntity implements Ca @Inject(method="writeCustomDataToTag", at = @At("RETURN")) private void onWriteCustomDataToTag(CompoundTag arg, CallbackInfo ci) { arg.put("ParquetSavedPos", (Tag)toListTag(new double[] { saved_x, saved_y, saved_z })); - arg.putInt("ParquetSavedDimension", this.dimension.getRawId()); + arg.putInt("ParquetSavedDimension", saved_dimension); arg.putBoolean("ParquetSaveActive", save_active); } @@ -47,7 +47,7 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntity implements Ca private void onReadCustomDataFromTag(CompoundTag arg, CallbackInfo ci) { ListTag lv = arg.getList("ParquetSavedPos", 6); - int dim_raw_id = arg.getInt("ParquetSavedDimension"); + this.saved_dimension = arg.getInt("ParquetSavedDimension"); this.save_active = arg.getBoolean("ParquetSaveActive"); @@ -56,8 +56,6 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntity implements Ca this.saved_y = lv.getDouble(1); this.saved_z = lv.getDouble(2); } - - this.saved_dimension = DimensionType.byRawId(dim_raw_id); } //INTERFACE CameraModeData @@ -67,7 +65,7 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntity implements Ca this.saved_y = getY(); this.saved_z = getZ(); - this.saved_dimension = this.dimension; + this.saved_dimension = this.dimension.getRawId(); this.save_active = true; @@ -78,7 +76,7 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntity implements Ca public boolean restoreCameraPosition() { if (this.save_active) { - this.teleport(server.getWorld(saved_dimension), saved_x, saved_y, saved_z, 0,0); + this.teleport(server.getWorld(DimensionType.byRawId(saved_dimension)), saved_x, saved_y, saved_z, 0,0); this.save_active = false; |