Update EndStairsBlock.java

This commit is contained in:
Aleksey 2021-05-22 19:30:50 +03:00
parent 53c9525c2d
commit 2048ebae22

View file

@ -79,7 +79,8 @@ public class EndStairsBlock extends StairBlock implements BlockModelProvider {
@Override @Override
public UnbakedModel getModelVariant(ResourceLocation stateId, BlockState blockState, Map<ResourceLocation, UnbakedModel> modelCache) { public UnbakedModel getModelVariant(ResourceLocation stateId, BlockState blockState, Map<ResourceLocation, UnbakedModel> modelCache) {
String state = ""; String state = "";
switch (blockState.getValue(SHAPE)) { StairsShape shape = blockState.getValue(SHAPE);
switch (shape) {
case INNER_LEFT: case INNER_LEFT:
case INNER_RIGHT: case INNER_RIGHT:
state = "_inner"; break; state = "_inner"; break;
@ -90,7 +91,6 @@ public class EndStairsBlock extends StairBlock implements BlockModelProvider {
ResourceLocation modelId = new ResourceLocation(stateId.getNamespace(), "block/" + stateId.getPath() + state); ResourceLocation modelId = new ResourceLocation(stateId.getNamespace(), "block/" + stateId.getPath() + state);
registerBlockModel(stateId, modelId, blockState, modelCache); registerBlockModel(stateId, modelId, blockState, modelCache);
StairsShape shape = blockState.getValue(SHAPE);
boolean isTop = blockState.getValue(HALF) == Half.TOP; boolean isTop = blockState.getValue(HALF) == Half.TOP;
boolean isLeft = shape == StairsShape.INNER_LEFT || boolean isLeft = shape == StairsShape.INNER_LEFT ||
shape == StairsShape.OUTER_LEFT; shape == StairsShape.OUTER_LEFT;
@ -100,32 +100,19 @@ public class EndStairsBlock extends StairBlock implements BlockModelProvider {
int x = isTop ? 180 : 0; int x = isTop ? 180 : 0;
switch (blockState.getValue(FACING)) { switch (blockState.getValue(FACING)) {
case NORTH: case NORTH:
if (isTop) { if (isTop && !isRight) y = 270;
if (!isRight) y = 270; else if (!isTop) y = isLeft ? 180 : 270;
} else {
y = (isLeft) ? 180 : 270;
}
break; break;
case EAST: case EAST:
if (isTop) { if (isTop && isRight) y = 90;
if (isRight) y = 90; else if (!isTop && isLeft) y = 270;
} else {
if (isLeft) y = 270;
}
break; break;
case SOUTH: case SOUTH:
if (isTop) { if (isTop) y = isRight ? 180 : 90;
y = (isRight) ? 180 : 90; else if (!isLeft) y = 90;
} else {
if (!isLeft) y = 90;
}
break; break;
case WEST: case WEST:
if (isTop) { y = (isTop && isRight) ? 270 : (!isTop && isLeft) ? 90 : 180;
y = isRight ? 270 : 180;
} else {
y = isLeft ? 90 : 180;
}
break; break;
} }
BlockModelRotation rotation = BlockModelRotation.by(x, y); BlockModelRotation rotation = BlockModelRotation.by(x, y);