mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 06:42:56 +00:00
Merge pull request #256 from Thorfusion/172-bug-crash-when-opening-turbine-statistics2
fix #172 npe crash with teleporter
This commit is contained in:
2 files changed
+13
-2
No files matched your search
+1
-1
@@ -1,7 +1,7 @@
|
||||
minecraft_version=1.12.2
|
||||
mappings_version=stable_39
|
||||
forge_version=14.23.5.2847
|
||||
mod_version=9.12.13
|
||||
mod_version=9.12.14
|
||||
|
||||
mcmp_version=2.5.3
|
||||
jei_version=4.15.0.289
|
||||
|
||||
@@ -90,7 +90,17 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
upgradeComponent.setSupported(Upgrade.ANCHOR);
|
||||
}
|
||||
|
||||
private static void clearRideState(Entity entity) {
|
||||
if (entity.isRiding()) {
|
||||
entity.dismountRidingEntity();
|
||||
}
|
||||
if (entity.isBeingRidden()) {
|
||||
entity.removePassengers();
|
||||
}
|
||||
}
|
||||
|
||||
public static void teleportPlayerTo(EntityPlayerMP player, Coord4D coord, TileEntityTeleporter teleporter) {
|
||||
clearRideState(player);
|
||||
if (player.dimension != coord.dimensionId) {
|
||||
player.changeDimension(coord.dimensionId, (world, entity, yaw) -> entity.setPositionAndUpdate(coord.x + 0.5, coord.y + 1, coord.z + 0.5));
|
||||
} else {
|
||||
@@ -328,6 +338,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
}
|
||||
|
||||
public void teleportEntityTo(Entity entity, Coord4D coord, TileEntityTeleporter teleporter) {
|
||||
clearRideState(entity);
|
||||
if (entity.world.provider.getDimension() != coord.dimensionId) {
|
||||
entity.changeDimension(coord.dimensionId, (world, entity2, yaw) -> entity2.setPositionAndUpdate(coord.x + 0.5, coord.y + 1, coord.z + 0.5));
|
||||
} else {
|
||||
@@ -561,4 +572,4 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
public int getRedstoneLevel() {
|
||||
return shouldRender ? 15 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user