use of com.wuest.prefab.Config.Structures.ModerateHouseConfiguration in project MC-Prefab by Brian-Wuest.
the class StructureModerateHouse 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) {
ModerateHouseConfiguration houseConfig = (ModerateHouseConfiguration) configuration;
EntityPlayerConfiguration playerConfig = EntityPlayerConfiguration.loadFromEntityData((EntityPlayerMP) player);
if (this.furnacePosition != null) {
for (BlockPos furnacePos : this.furnacePosition) {
// Fill the furnace.
TileEntity tileEntity = world.getTileEntity(furnacePos);
if (tileEntity instanceof TileEntityFurnace) {
TileEntityFurnace furnaceTile = (TileEntityFurnace) tileEntity;
furnaceTile.setInventorySlotContents(1, new ItemStack(Items.COAL, 20));
}
}
}
if (this.chestPosition != null && !playerConfig.builtStarterHouse && houseConfig.addChestContents) {
// Fill the chest if the player hasn't generated the starting house yet.
StructureModerateHouse.FillChest(world, this.chestPosition, houseConfig, player);
}
if (this.trapDoorPosition != null && this.trapDoorPosition.getY() > 15 && houseConfig.addMineshaft) {
// Build the mineshaft.
StructureAlternateStart.PlaceMineShaft(world, this.trapDoorPosition.down(), houseConfig.houseFacing, false);
}
// Make sure to set this value so the player cannot fill the chest a second time.
playerConfig.builtStarterHouse = true;
playerConfig.saveToPlayer(player);
}
Aggregations