use of forestry.apiculture.gadgets.TileBeehouse in project ForestryMC by ForestryMC.
the class ComponentVillageBeeHouse method populateApiary.
private void populateApiary(World world, StructureBoundingBox box, int x, int y, int z) {
int xCoord = this.getXWithOffset(x, z);
int yCoord = this.getYWithOffset(y);
int zCoord = this.getZWithOffset(x, z);
if (box.isVecInside(xCoord, yCoord, zCoord) && !ForestryBlock.apiculture.isBlockEqual(world, xCoord, yCoord, zCoord) && world.blockExists(xCoord, yCoord - 1, zCoord)) {
world.setBlock(xCoord, yCoord, zCoord, ForestryBlock.apiculture.block(), Defaults.DEFINITION_APIARY_META, Defaults.FLAG_BLOCK_SYNCH);
ForestryBlock.apiculture.block().onBlockAdded(world, xCoord, yCoord, zCoord);
TileEntity tile = world.getTileEntity(xCoord, yCoord, zCoord);
if (tile instanceof TileBeehouse) {
TileBeehouse apiary = ((TileBeehouse) tile);
apiary.initialize();
apiary.setInventorySlotContents(TileBeehouse.SLOT_QUEEN, PluginApiculture.beeInterface.getMemberStack(getVillageBee(world, xCoord, yCoord, zCoord), EnumBeeType.PRINCESS.ordinal()));
apiary.setInventorySlotContents(TileBeehouse.SLOT_DRONE, PluginApiculture.beeInterface.getMemberStack(getVillageBee(world, xCoord, yCoord, zCoord), EnumBeeType.DRONE.ordinal()));
for (int i = TileBeehouse.SLOT_FRAMES_1; i < TileBeehouse.SLOT_FRAMES_1 + TileBeehouse.SLOT_FRAMES_COUNT; i++) {
float roll = world.rand.nextFloat();
if (roll < 0.2f) {
apiary.setInventorySlotContents(i, ForestryItem.frameUntreated.getItemStack());
} else if (roll < 0.4f) {
apiary.setInventorySlotContents(i, ForestryItem.frameImpregnated.getItemStack());
} else if (roll < 0.6) {
apiary.setInventorySlotContents(i, ForestryItem.frameProven.getItemStack());
}
}
}
}
}
use of forestry.apiculture.gadgets.TileBeehouse in project ForestryMC by ForestryMC.
the class GuiApiary method drawGuiContainerBackgroundLayer.
@Override
protected void drawGuiContainerBackgroundLayer(float var1, int mouseX, int mouseY) {
super.drawGuiContainerBackgroundLayer(var1, mouseX, mouseY);
TileBeehouse machine = inventory;
drawHealthMeter(guiLeft + 20, guiTop + 37, machine.getHealthScaled(46), Utils.rateTankLevel(machine.getHealthScaled(100)));
}
Aggregations