use of com.wuest.prefab.Config.Structures.BasicStructureConfiguration in project MC-Prefab by Brian-Wuest.
the class StructureBasic method AfterBuilding.
/**
* This method is used after the main building is build for any additional
* structures or modifications.
*
* @param configuration The structure configuration.
* @param world The current world.
* @param originalPos The original position clicked on.
* @param assumedNorth The assumed northern direction.
* @param player The player which initiated the construction.
*/
@Override
public void AfterBuilding(StructureConfiguration configuration, World world, BlockPos originalPos, EnumFacing assumedNorth, EntityPlayer player) {
BasicStructureConfiguration config = (BasicStructureConfiguration) configuration;
if (this.customBlockPos != null) {
if (config.basicStructureName.getName().equals(EnumBasicStructureName.AdvancedCoop.getName())) {
// For the advanced chicken coop, spawn 4 chickens above the hopper.
for (int i = 0; i < 4; i++) {
EntityChicken entity = new EntityChicken(world);
entity.setPosition(this.customBlockPos.getX(), this.customBlockPos.up().getY(), this.customBlockPos.getZ());
world.spawnEntity(entity);
}
} else if (config.basicStructureName.getName().equals(EnumBasicStructureName.MineshaftEntrance.getName())) {
// Build the mineshaft where the trap door exists.
StructureAlternateStart.PlaceMineShaft(world, this.customBlockPos.down(), configuration.houseFacing, true);
}
this.customBlockPos = null;
}
if (config.basicStructureName.getName().equals(EnumBasicStructureName.AquaBase.getName())) {
// Replace the entrance area with air blocks.
BlockPos airPos = originalPos.up(4).offset(configuration.houseFacing.getOpposite(), 1);
// This is the first wall.
world.setBlockToAir(airPos.offset(configuration.houseFacing.rotateY()));
world.setBlockToAir(airPos);
world.setBlockToAir(airPos.offset(configuration.houseFacing.rotateYCCW()));
airPos = airPos.down();
world.setBlockToAir(airPos.offset(configuration.houseFacing.rotateY()));
world.setBlockToAir(airPos);
world.setBlockToAir(airPos.offset(configuration.houseFacing.rotateYCCW()));
airPos = airPos.down();
world.setBlockToAir(airPos.offset(configuration.houseFacing.rotateY()));
world.setBlockToAir(airPos);
world.setBlockToAir(airPos.offset(configuration.houseFacing.rotateYCCW()));
airPos = airPos.down();
world.setBlockToAir(airPos.offset(configuration.houseFacing.rotateY()));
world.setBlockToAir(airPos);
world.setBlockToAir(airPos.offset(configuration.houseFacing.rotateYCCW()));
// Second part of the wall.
airPos = airPos.offset(configuration.houseFacing.getOpposite()).up();
world.setBlockToAir(airPos.offset(configuration.houseFacing.rotateY()));
world.setBlockToAir(airPos);
world.setBlockToAir(airPos.offset(configuration.houseFacing.rotateYCCW()));
airPos = airPos.up();
world.setBlockToAir(airPos.offset(configuration.houseFacing.rotateY()));
world.setBlockToAir(airPos);
world.setBlockToAir(airPos.offset(configuration.houseFacing.rotateYCCW()));
airPos = airPos.up();
world.setBlockToAir(airPos);
}
}
Aggregations