Entity exit fixes
This commit is contained in:
parent
2fc9418e96
commit
3fde68a14d
1 changed files with 18 additions and 21 deletions
|
@ -16,6 +16,7 @@ import net.minecraft.sound.SoundEvents;
|
||||||
import net.minecraft.util.BlockRotation;
|
import net.minecraft.util.BlockRotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.math.Direction.Axis;
|
||||||
import net.minecraft.util.math.Direction.AxisDirection;
|
import net.minecraft.util.math.Direction.AxisDirection;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraft.world.Heightmap;
|
import net.minecraft.world.Heightmap;
|
||||||
|
@ -99,7 +100,7 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTypeable
|
||||||
}
|
}
|
||||||
Direction direction = Direction.EAST;
|
Direction direction = Direction.EAST;
|
||||||
BlockPos.Mutable checkPos = basePos.mutableCopy();
|
BlockPos.Mutable checkPos = basePos.mutableCopy();
|
||||||
for (int step = 1; step < 64; step++) {
|
for (int step = 1; step < 128; step++) {
|
||||||
for (int i = 0; i < (step >> 1); i++) {
|
for (int i = 0; i < (step >> 1); i++) {
|
||||||
checkPos.setY(5);
|
checkPos.setY(5);
|
||||||
int ceil = world.getChunk(basePos).sampleHeightmap(Heightmap.Type.WORLD_SURFACE, checkPos.getX(), checkPos.getZ()) + 1;
|
int ceil = world.getChunk(basePos).sampleHeightmap(Heightmap.Type.WORLD_SURFACE, checkPos.getX(), checkPos.getZ()) + 1;
|
||||||
|
@ -107,26 +108,22 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTypeable
|
||||||
while(checkPos.getY() < ceil) {
|
while(checkPos.getY() < ceil) {
|
||||||
BlockState state = world.getBlockState(checkPos);
|
BlockState state = world.getBlockState(checkPos);
|
||||||
if(state.isOf(this)) {
|
if(state.isOf(this)) {
|
||||||
int offStep;
|
Axis axis = state.get(AXIS);
|
||||||
checkPos = this.findCenter(world, checkPos, state.get(AXIS));
|
checkPos = this.findCenter(world, checkPos, axis);
|
||||||
if (state.get(AXIS).equals(Direction.Axis.X)) {
|
|
||||||
if (entity.getMovementDirection().getAxis() == Direction.Axis.X) {
|
Direction frontDir = Direction.from(axis, AxisDirection.POSITIVE).rotateYClockwise();
|
||||||
offStep = entity.getMovementDirection() == Direction.EAST ? 1 : -1;
|
Direction entityDir = entity.getMovementDirection();
|
||||||
float rotation = entity.applyRotation(BlockRotation.CLOCKWISE_90);
|
if (entityDir.getAxis().isVertical()) {
|
||||||
entity.yaw = rotation;
|
entityDir = frontDir;
|
||||||
} else {
|
}
|
||||||
offStep = entity.getMovementDirection() == Direction.NORTH ? -1 : 1;
|
|
||||||
}
|
if (frontDir == entityDir || frontDir.getOpposite() == entityDir) {
|
||||||
return checkPos.add(0, 0, offStep);
|
return checkPos.offset(entityDir);
|
||||||
} else {
|
}
|
||||||
if (entity.getMovementDirection().getAxis() == Direction.Axis.Z) {
|
else {
|
||||||
offStep = entity.getMovementDirection() == Direction.SOUTH ? -1 : 1;
|
entity.applyRotation(BlockRotation.CLOCKWISE_90);
|
||||||
float rotation = entity.applyRotation(BlockRotation.CLOCKWISE_90);
|
entityDir = entityDir.rotateYClockwise();
|
||||||
entity.yaw = rotation;
|
return checkPos.offset(entityDir);
|
||||||
} else {
|
|
||||||
offStep = entity.getMovementDirection() == Direction.EAST ? 1 : -1;
|
|
||||||
}
|
|
||||||
return checkPos.add(offStep, 0, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkPos.move(Direction.UP);
|
checkPos.move(Direction.UP);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue