use of com.wuest.prefab.Tuple in project MC-Prefab by Brian-Wuest.
the class BuildingMethods method getBedState.
public static Tuple<BlockState, BlockState> getBedState(BlockPos bedHeadPos, BlockPos bedFootPos, DyeColor bedColor) {
BlockState bedHead = null;
BlockState bedFoot = null;
switch(bedColor) {
case BLACK:
{
bedHead = Blocks.BLACK_BED.defaultBlockState().setValue(BedBlock.PART, BedPart.HEAD);
bedFoot = Blocks.BLACK_BED.defaultBlockState();
break;
}
case BLUE:
{
bedHead = Blocks.BLUE_BED.defaultBlockState().setValue(BedBlock.PART, BedPart.HEAD);
bedFoot = Blocks.BLUE_BED.defaultBlockState();
break;
}
case BROWN:
{
bedHead = Blocks.BROWN_BED.defaultBlockState().setValue(BedBlock.PART, BedPart.HEAD);
bedFoot = Blocks.BROWN_BED.defaultBlockState();
break;
}
case CYAN:
{
bedHead = Blocks.CYAN_BED.defaultBlockState().setValue(BedBlock.PART, BedPart.HEAD);
bedFoot = Blocks.CYAN_BED.defaultBlockState();
break;
}
case GRAY:
{
bedHead = Blocks.GRAY_BED.defaultBlockState().setValue(BedBlock.PART, BedPart.HEAD);
bedFoot = Blocks.GRAY_BED.defaultBlockState();
break;
}
case GREEN:
{
bedHead = Blocks.GREEN_BED.defaultBlockState().setValue(BedBlock.PART, BedPart.HEAD);
bedFoot = Blocks.GREEN_BED.defaultBlockState();
break;
}
case LIGHT_BLUE:
{
bedHead = Blocks.LIGHT_BLUE_BED.defaultBlockState().setValue(BedBlock.PART, BedPart.HEAD);
bedFoot = Blocks.LIGHT_BLUE_BED.defaultBlockState();
break;
}
case LIGHT_GRAY:
{
bedHead = Blocks.LIGHT_GRAY_BED.defaultBlockState().setValue(BedBlock.PART, BedPart.HEAD);
bedFoot = Blocks.LIGHT_GRAY_BED.defaultBlockState();
break;
}
case LIME:
{
bedHead = Blocks.LIME_BED.defaultBlockState().setValue(BedBlock.PART, BedPart.HEAD);
bedFoot = Blocks.LIME_BED.defaultBlockState();
break;
}
case MAGENTA:
{
bedHead = Blocks.MAGENTA_BED.defaultBlockState().setValue(BedBlock.PART, BedPart.HEAD);
bedFoot = Blocks.MAGENTA_BED.defaultBlockState();
break;
}
case ORANGE:
{
bedHead = Blocks.ORANGE_BED.defaultBlockState().setValue(BedBlock.PART, BedPart.HEAD);
bedFoot = Blocks.ORANGE_BED.defaultBlockState();
break;
}
case PINK:
{
bedHead = Blocks.PINK_BED.defaultBlockState().setValue(BedBlock.PART, BedPart.HEAD);
bedFoot = Blocks.PINK_BED.defaultBlockState();
break;
}
case PURPLE:
{
bedHead = Blocks.PURPLE_BED.defaultBlockState().setValue(BedBlock.PART, BedPart.HEAD);
bedFoot = Blocks.PURPLE_BED.defaultBlockState();
break;
}
case RED:
{
bedHead = Blocks.RED_BED.defaultBlockState().setValue(BedBlock.PART, BedPart.HEAD);
bedFoot = Blocks.RED_BED.defaultBlockState();
break;
}
case WHITE:
{
bedHead = Blocks.WHITE_BED.defaultBlockState().setValue(BedBlock.PART, BedPart.HEAD);
bedFoot = Blocks.WHITE_BED.defaultBlockState();
break;
}
case YELLOW:
{
bedHead = Blocks.YELLOW_BED.defaultBlockState().setValue(BedBlock.PART, BedPart.HEAD);
bedFoot = Blocks.YELLOW_BED.defaultBlockState();
break;
}
}
Direction direction = Direction.NORTH;
BlockPos tempPos = bedHeadPos.relative(Direction.NORTH);
while (tempPos.getX() != bedFootPos.getX() || tempPos.getZ() != bedFootPos.getZ()) {
direction = direction.getClockWise();
tempPos = bedHeadPos.relative(direction);
}
bedHead = bedHead.setValue(BedBlock.FACING, direction.getOpposite());
bedFoot = bedFoot.setValue(BedBlock.FACING, direction.getOpposite());
return new Tuple<>(bedHead, bedFoot);
}
use of com.wuest.prefab.Tuple in project MC-Prefab by Brian-Wuest.
the class StructureBasic method CustomBlockProcessingHandled.
@Override
protected Boolean CustomBlockProcessingHandled(StructureConfiguration configuration, BuildBlock block, Level world, BlockPos originalPos, Block foundBlock, BlockState blockState, Player player) {
BasicStructureConfiguration config = (BasicStructureConfiguration) configuration;
String structureName = config.basicStructureName.getName();
BaseOption chosenOption = config.chosenOption;
if (foundBlock instanceof HopperBlock && structureName.equals(EnumBasicStructureName.ModerateFarm.getName()) && chosenOption == ModerateFarmOptions.AutomatedChickenCoop) {
this.customBlockPos = block.getStartingPosition().getRelativePosition(originalPos, this.getClearSpace().getShape().getDirection(), configuration.houseFacing);
} else if (foundBlock instanceof TrapDoorBlock && structureName.equals(EnumBasicStructureName.MineshaftEntrance.getName())) {
this.customBlockPos = block.getStartingPosition().getRelativePosition(originalPos, this.getClearSpace().getShape().getDirection(), configuration.houseFacing);
} else if (foundBlock == Blocks.SPONGE && structureName.equals(BasicStructureConfiguration.EnumBasicStructureName.WorkShop.getName())) {
// Sponges are sometimes used in-place of trapdoors when trapdoors are used for decoration.
this.customBlockPos = block.getStartingPosition().getRelativePosition(originalPos, this.getClearSpace().getShape().getDirection(), configuration.houseFacing).above();
} else if (foundBlock instanceof BedBlock && chosenOption.getHasBedColor()) {
// Even if a structure has a bed; we may want to keep a specific color to match what the design of the structure is.
BlockPos bedHeadPosition = block.getStartingPosition().getRelativePosition(originalPos, this.getClearSpace().getShape().getDirection(), configuration.houseFacing);
BlockPos bedFootPosition = block.getSubBlock().getStartingPosition().getRelativePosition(originalPos, this.getClearSpace().getShape().getDirection(), configuration.houseFacing);
Tuple<BlockState, BlockState> blockStateTuple = BuildingMethods.getBedState(bedHeadPosition, bedFootPosition, config.bedColor);
block.setBlockState(blockStateTuple.getFirst());
block.getSubBlock().setBlockState(blockStateTuple.getSecond());
this.priorityOneBlocks.add(block);
return true;
} else if (foundBlock instanceof SpawnerBlock && structureName.equals(EnumBasicStructureName.AdvancedFarm.getName()) && chosenOption == AdvancedFarmOptions.MonsterMasher && CommonProxy.proxyConfiguration.serverConfiguration.includeSpawnersInMasher) {
this.mobSpawnerPos.add(block.getStartingPosition().getRelativePosition(originalPos, this.getClearSpace().getShape().getDirection(), configuration.houseFacing));
} else if (foundBlock instanceof SignBlock && structureName.equals(EnumBasicStructureName.AdvancedFarm.getName()) && chosenOption == AdvancedFarmOptions.MonsterMasher) {
this.signPosition = block.getStartingPosition().getRelativePosition(originalPos, this.getClearSpace().getShape().getDirection(), configuration.houseFacing);
}
return false;
}
Aggregations