Warnings cleanup

This commit is contained in:
paulevsGitch 2021-05-26 14:42:51 +03:00
parent ab4c614eac
commit 27e077ddd0
8 changed files with 26 additions and 29 deletions

View file

@ -84,6 +84,7 @@ public class ChandelierBlock extends AttachedBlock implements IRenderTypeable, B
rotation = BlockModelRotation.X0_Y180;
break;
case WEST:
default:
rotation = BlockModelRotation.X0_Y90;
break;
}

View file

@ -125,7 +125,8 @@ public class EndBarrelBlock extends BarrelBlock implements BlockModelProvider {
case EAST: rotation = BlockModelRotation.X90_Y90; break;
case SOUTH: rotation = BlockModelRotation.X90_Y180; break;
case WEST: rotation = BlockModelRotation.X90_Y270; break;
case DOWN: rotation = BlockModelRotation.X180_Y0; break;
case DOWN:
default: rotation = BlockModelRotation.X180_Y0; break;
}
return ModelsHelper.createMultiVariant(modelId, rotation.getRotation(), false);
}

View file

@ -64,13 +64,15 @@ public abstract class EndButtonBlock extends ButtonBlock implements BlockModelPr
int x = 0, y = 0;
switch (face) {
case CEILING: x = 180; break;
case WALL: x = 90; break;
case WALL:
default: x = 90; break;
}
switch (blockState.getValue(FACING)) {
case NORTH: if (isCeiling) { y = 180; } break;
case EAST: y = isCeiling ? 270 : 90; break;
case SOUTH: if(!isCeiling) { y = 180; } break;
case WEST: y = isCeiling ? 90 : 270; break;
case WEST:
default: y = isCeiling ? 90 : 270; break;
}
BlockModelRotation rotation = BlockModelRotation.by(x, y);
return ModelsHelper.createMultiVariant(modelId, rotation.getRotation(), face == AttachFace.WALL);

View file

@ -51,19 +51,17 @@ public class EndDoorBlock extends DoorBlock implements IRenderTypeable, BlockMod
DoorType doorType = getDoorType(blockState);
Optional<String> pattern = Patterns.createJson(Patterns.BLOCK_DOOR_BOTTOM, blockName, blockName);
switch (doorType) {
case TOP_HINGE: {
case TOP_HINGE:
pattern = Patterns.createJson(Patterns.BLOCK_DOOR_TOP_HINGE, blockName, blockName);
break;
}
case BOTTOM_HINGE: {
case BOTTOM_HINGE:
pattern = Patterns.createJson(Patterns.BLOCK_DOOR_BOTTOM_HINGE, blockName, blockName);
break;
}
case TOP: {
case TOP:
default:
pattern = Patterns.createJson(Patterns.BLOCK_DOOR_TOP, blockName, blockName);
break;
}
}
return ModelsHelper.fromPattern(pattern);
}
@ -75,23 +73,21 @@ public class EndDoorBlock extends DoorBlock implements IRenderTypeable, BlockMod
boolean hinge = doorType.isHinge();
BlockModelRotation rotation = BlockModelRotation.X0_Y0;
switch (facing) {
case EAST: {
case EAST:
if (hinge && open) {
rotation = BlockModelRotation.X0_Y90;
} else if (open) {
rotation = BlockModelRotation.X0_Y270;
}
break;
}
case SOUTH: {
case SOUTH:
if (!hinge && !open || hinge && !open) {
rotation = BlockModelRotation.X0_Y90;
} else if (hinge) {
rotation = BlockModelRotation.X0_Y180;
}
break;
}
case WEST: {
case WEST:
if (!hinge && !open || hinge && !open) {
rotation = BlockModelRotation.X0_Y180;
} else if (hinge) {
@ -100,8 +96,8 @@ public class EndDoorBlock extends DoorBlock implements IRenderTypeable, BlockMod
rotation = BlockModelRotation.X0_Y90;
}
break;
}
case NORTH: {
case NORTH:
default:
if (!hinge && !open || hinge && !open) {
rotation = BlockModelRotation.X0_Y270;
} else if (!hinge) {
@ -109,7 +105,6 @@ public class EndDoorBlock extends DoorBlock implements IRenderTypeable, BlockMod
}
break;
}
}
ResourceLocation modelId = new ResourceLocation(stateId.getNamespace(),
"block/" + stateId.getPath() + "_" + doorType);
registerBlockModel(stateId, modelId, blockState, modelCache);

View file

@ -73,6 +73,7 @@ public class EndStairsBlock extends StairBlock implements BlockModelProvider {
state = "_inner"; break;
case OUTER_LEFT:
case OUTER_RIGHT:
default:
state = "_outer"; break;
}
ResourceLocation modelId = new ResourceLocation(stateId.getNamespace(), "block/" + stateId.getPath() + state);
@ -99,6 +100,7 @@ public class EndStairsBlock extends StairBlock implements BlockModelProvider {
else if (!isLeft) y = 90;
break;
case WEST:
default:
y = (isTop && isRight) ? 270 : (!isTop && isLeft) ? 90 : 180;
break;
}

View file

@ -77,6 +77,7 @@ public class EndTrapdoorBlock extends TrapDoorBlock implements IRenderTypeable,
y = (isTop && isOpen) ? 0 : 180;
break;
case WEST:
default:
y = (isTop && isOpen) ? 90 : 270;
break;
}

View file

@ -348,27 +348,23 @@ public class PedestalBlock extends BlockBaseNotFull implements EntityBlock {
PedestalState state = blockState.getValue(STATE);
Optional<String> pattern = Patterns.createJson(Patterns.BLOCK_PEDESTAL_DEFAULT, textures);
switch (state) {
case COLUMN_TOP: {
case COLUMN_TOP:
pattern = Patterns.createJson(Patterns.BLOCK_PEDESTAL_COLUMN_TOP, textures);
break;
}
case COLUMN: {
case COLUMN:
pattern = Patterns.createJson(Patterns.BLOKC_PEDESTAL_COLUMN, textures);
break;
}
case PEDESTAL_TOP: {
case PEDESTAL_TOP:
pattern = Patterns.createJson(Patterns.BLOCK_PEDESTAL_TOP, textures);
break;
}
case BOTTOM: {
case BOTTOM:
pattern = Patterns.createJson(Patterns.BLOCK_PEDESTAL_BOTTOM, textures);
break;
}
case PILLAR: {
case PILLAR:
default:
pattern = Patterns.createJson(Patterns.BLOCK_PEDESTAL_PILLAR, textures);
break;
}
}
return ModelsHelper.fromPattern(pattern);
}

View file

@ -24,7 +24,6 @@ import net.minecraft.world.level.block.state.StateDefinition;
@Environment(EnvType.CLIENT)
public class ModelsHelper {
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
public static BlockModel fromPattern(Optional<String> pattern) {
return pattern.map(BlockModel::fromString).orElse(null);
}
@ -70,7 +69,7 @@ public class ModelsHelper {
BlockModelRotation rotation = BlockModelRotation.X0_Y0;
switch (axis) {
case X: rotation = BlockModelRotation.X90_Y90; break;
case Z: rotation = BlockModelRotation.X90_Y0; break;
case Z: default: rotation = BlockModelRotation.X90_Y0; break;
}
return createMultiVariant(resourceLocation, rotation.getRotation(), false);
}