use of forestry.arboriculture.gadgets.BlockFruitPod in project ForestryMC by ForestryMC.
the class PluginArboriculture method preInit.
@Override
public void preInit() {
super.preInit();
ForestryBlock.log1.registerBlock(new BlockLog(LogCat.CAT0), ItemWoodBlock.class, "log1");
ForestryBlock.log2.registerBlock(new BlockLog(LogCat.CAT1), ItemWoodBlock.class, "log2");
ForestryBlock.log3.registerBlock(new BlockLog(LogCat.CAT2), ItemWoodBlock.class, "log3");
ForestryBlock.log4.registerBlock(new BlockLog(LogCat.CAT3), ItemWoodBlock.class, "log4");
ForestryBlock.log5.registerBlock(new BlockLog(LogCat.CAT4), ItemWoodBlock.class, "log5");
ForestryBlock.log6.registerBlock(new BlockLog(LogCat.CAT5), ItemWoodBlock.class, "log6");
ForestryBlock.log7.registerBlock(new BlockLog(LogCat.CAT6), ItemWoodBlock.class, "log7");
ForestryBlock.log8.registerBlock(new BlockLog(LogCat.CAT7), ItemWoodBlock.class, "log8");
for (ForestryBlock log : logs) {
log.block().setHarvestLevel("axe", 0);
OreDictionary.registerOre("logWood", log.getWildcard());
}
ForestryBlock.fireproofLog1.registerBlock(new BlockFireproofLog(LogCat.CAT0), ItemWoodBlock.class, "fireproofLog1");
ForestryBlock.fireproofLog2.registerBlock(new BlockFireproofLog(LogCat.CAT1), ItemWoodBlock.class, "fireproofLog2");
ForestryBlock.fireproofLog3.registerBlock(new BlockFireproofLog(LogCat.CAT2), ItemWoodBlock.class, "fireproofLog3");
ForestryBlock.fireproofLog4.registerBlock(new BlockFireproofLog(LogCat.CAT3), ItemWoodBlock.class, "fireproofLog4");
ForestryBlock.fireproofLog5.registerBlock(new BlockFireproofLog(LogCat.CAT4), ItemWoodBlock.class, "fireproofLog5");
ForestryBlock.fireproofLog6.registerBlock(new BlockFireproofLog(LogCat.CAT5), ItemWoodBlock.class, "fireproofLog6");
ForestryBlock.fireproofLog7.registerBlock(new BlockFireproofLog(LogCat.CAT6), ItemWoodBlock.class, "fireproofLog7");
ForestryBlock.fireproofLog8.registerBlock(new BlockFireproofLog(LogCat.CAT7), ItemWoodBlock.class, "fireproofLog8");
for (ForestryBlock fireproofLog : fireproofLogs) {
fireproofLog.block().setHarvestLevel("axe", 0);
OreDictionary.registerOre("logWood", fireproofLog.getWildcard());
}
ForestryBlock.planks1.registerBlock(new BlockPlanks(PlankCat.CAT0), ItemWoodBlock.class, "planks");
ForestryBlock.planks2.registerBlock(new BlockPlanks(PlankCat.CAT1), ItemWoodBlock.class, "planks2");
for (ForestryBlock plank : planks) {
plank.block().setHarvestLevel("axe", 0);
OreDictionary.registerOre("plankWood", plank.getWildcard());
}
ForestryBlock.fireproofPlanks1.registerBlock(new BlockFireproofPlanks(PlankCat.CAT0), ItemWoodBlock.class, "fireproofPlanks1");
ForestryBlock.fireproofPlanks2.registerBlock(new BlockFireproofPlanks(PlankCat.CAT1), ItemWoodBlock.class, "fireproofPlanks2");
for (ForestryBlock plank : fireproofPlanks) {
plank.block().setHarvestLevel("axe", 0);
OreDictionary.registerOre("plankWood", plank.getWildcard());
}
ForestryBlock.slabs1.registerBlock(new BlockSlab(SlabCat.CAT0), ItemWoodBlock.class, "slabs1");
ForestryBlock.slabs2.registerBlock(new BlockSlab(SlabCat.CAT1), ItemWoodBlock.class, "slabs2");
ForestryBlock.slabs3.registerBlock(new BlockSlab(SlabCat.CAT2), ItemWoodBlock.class, "slabs3");
ForestryBlock.slabs4.registerBlock(new BlockSlab(SlabCat.CAT3), ItemWoodBlock.class, "slabs4");
for (ForestryBlock plank : slabs) {
plank.block().setHarvestLevel("axe", 0);
OreDictionary.registerOre("slabWood", plank.getWildcard());
}
// Fences
ForestryBlock.fences1.registerBlock(new BlockArbFence(FenceCat.CAT0), ItemWoodBlock.class, "fences");
ForestryBlock.fences2.registerBlock(new BlockArbFence(FenceCat.CAT1), ItemWoodBlock.class, "fences2");
for (ForestryBlock block : fences) {
block.block().setHarvestLevel("axe", 0);
OreDictionary.registerOre("fenceWood", block.getWildcard());
}
// Stairs
ForestryBlock.stairs.registerBlock(new BlockArbStairs(ForestryBlock.planks1.block(), 0), ItemStairs.class, "stairs");
ForestryBlock.stairs.block().setHarvestLevel("axe", 0);
// Saplings
ForestryBlock.saplingGE.registerBlock(new BlockSapling(), ItemForestryBlock.class, "saplingGE");
// Leaves
ForestryBlock.leaves.registerBlock(new ForestryBlockLeaves(), ItemLeavesBlock.class, "leaves");
OreDictionary.registerOre("treeLeaves", ForestryBlock.leaves.getWildcard());
// Pods
ForestryBlock.pods.registerBlock(new BlockFruitPod(), ItemForestryBlock.class, "pods");
// Machines
ForestryBlock.arboriculture.registerBlock(new BlockBase(Material.iron), ItemForestryBlock.class, "arboriculture");
ForestryBlock.arboriculture.block().setCreativeTab(Tabs.tabArboriculture);
definitionChest = ((BlockBase) ForestryBlock.arboriculture.block()).addDefinition(new MachineDefinition(Defaults.DEFINITION_ARBCHEST_META, "forestry.ArbChest", TileArboristChest.class, ShapedRecipeCustom.createShapedRecipe(ForestryBlock.arboriculture.getItemStack(1, Defaults.DEFINITION_ARBCHEST_META), " # ", "XYX", "XXX", '#', Blocks.glass, 'X', "treeSapling", 'Y', Blocks.chest)).setFaces(0, 1, 2, 3, 4, 4, 0, 7));
// Init rendering
proxy.initializeRendering();
// Register vanilla and forestry fence ids
validFences.add(ForestryBlock.fences1.block());
validFences.add(ForestryBlock.fences2.block());
validFences.add(Blocks.fence);
validFences.add(Blocks.fence_gate);
validFences.add(Blocks.nether_brick_fence);
// Commands
PluginCore.rootCommand.addChildCommand(new CommandTree());
// Create alleles
createAlleles();
createMutations();
registerTemplates();
registerErsatzGenomes();
}
use of forestry.arboriculture.gadgets.BlockFruitPod in project ForestryMC by ForestryMC.
the class FruitPodRenderingHandler method renderWorldBlock.
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
int maturity = 0;
BlockFruitPod blockPod = (BlockFruitPod) block;
TileFruitPod pod = BlockFruitPod.getPodTile(world, x, y, z);
if (pod != null) {
maturity = pod.getMaturity();
}
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(blockPod.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(1.0f, 1.0f, 1.0f);
int metadata = world.getBlockMetadata(x, y, z);
IIcon podIcon = blockPod.getIcon(world, x, y, z, metadata);
int notchDirection = BlockDirectional.getDirection(metadata);
int k1 = 4 + maturity * 2;
int l1 = 5 + maturity * 2;
double d0 = 15.0D - k1;
double d1 = 15.0D;
double d2 = 4.0D;
double d3 = 4.0D + l1;
double d4 = (double) podIcon.getInterpolatedU(d0);
double d5 = (double) podIcon.getInterpolatedU(d1);
double d6 = (double) podIcon.getInterpolatedV(d2);
double d7 = (double) podIcon.getInterpolatedV(d3);
double d8 = 0.0D;
double d9 = 0.0D;
switch(notchDirection) {
case 0:
d8 = 8.0D - k1 / 2;
d9 = 15.0D - k1;
break;
case 1:
d8 = 1.0D;
d9 = 8.0D - k1 / 2;
break;
case 2:
d8 = 8.0D - k1 / 2;
d9 = 1.0D;
break;
case 3:
d8 = 15.0D - k1;
d9 = 8.0D - k1 / 2;
}
double d10 = x + d8 / 16.0D;
double d11 = x + (d8 + k1) / 16.0D;
double d12 = y + (12.0D - l1) / 16.0D;
double d13 = y + 0.75D;
double d14 = z + d9 / 16.0D;
double d15 = z + (d9 + k1) / 16.0D;
tessellator.addVertexWithUV(d10, d12, d14, d4, d7);
tessellator.addVertexWithUV(d10, d12, d15, d5, d7);
tessellator.addVertexWithUV(d10, d13, d15, d5, d6);
tessellator.addVertexWithUV(d10, d13, d14, d4, d6);
tessellator.addVertexWithUV(d11, d12, d15, d4, d7);
tessellator.addVertexWithUV(d11, d12, d14, d5, d7);
tessellator.addVertexWithUV(d11, d13, d14, d5, d6);
tessellator.addVertexWithUV(d11, d13, d15, d4, d6);
tessellator.addVertexWithUV(d11, d12, d14, d4, d7);
tessellator.addVertexWithUV(d10, d12, d14, d5, d7);
tessellator.addVertexWithUV(d10, d13, d14, d5, d6);
tessellator.addVertexWithUV(d11, d13, d14, d4, d6);
tessellator.addVertexWithUV(d10, d12, d15, d4, d7);
tessellator.addVertexWithUV(d11, d12, d15, d5, d7);
tessellator.addVertexWithUV(d11, d13, d15, d5, d6);
tessellator.addVertexWithUV(d10, d13, d15, d4, d6);
int i2 = k1;
if (maturity >= 2) {
i2 = k1 - 1;
}
d4 = (double) podIcon.getMinU();
d5 = (double) podIcon.getInterpolatedU((double) i2);
d6 = (double) podIcon.getMinV();
d7 = (double) podIcon.getInterpolatedV((double) i2);
tessellator.addVertexWithUV(d10, d13, d15, d4, d7);
tessellator.addVertexWithUV(d11, d13, d15, d5, d7);
tessellator.addVertexWithUV(d11, d13, d14, d5, d6);
tessellator.addVertexWithUV(d10, d13, d14, d4, d6);
tessellator.addVertexWithUV(d10, d12, d14, d4, d6);
tessellator.addVertexWithUV(d11, d12, d14, d5, d6);
tessellator.addVertexWithUV(d11, d12, d15, d5, d7);
tessellator.addVertexWithUV(d10, d12, d15, d4, d7);
d4 = (double) podIcon.getInterpolatedU(12.0D);
d5 = (double) podIcon.getMaxU();
d6 = (double) podIcon.getMinV();
d7 = (double) podIcon.getInterpolatedV(4.0D);
d8 = 8.0D;
d9 = 0.0D;
double d16;
switch(notchDirection) {
case 0:
d8 = 8.0D;
d9 = 12.0D;
d16 = d4;
d4 = d5;
d5 = d16;
break;
case 1:
d8 = 0.0D;
d9 = 8.0D;
break;
case 2:
d8 = 8.0D;
d9 = 0.0D;
break;
case 3:
d8 = 12.0D;
d9 = 8.0D;
d16 = d4;
d4 = d5;
d5 = d16;
}
d10 = x + d8 / 16.0D;
d11 = x + (d8 + 4.0D) / 16.0D;
d12 = y + 0.75D;
d13 = y + 1.0D;
d14 = z + d9 / 16.0D;
d15 = z + (d9 + 4.0D) / 16.0D;
if (notchDirection != 2 && notchDirection != 0) {
if (notchDirection == 1 || notchDirection == 3) {
tessellator.addVertexWithUV(d11, d12, d14, d4, d7);
tessellator.addVertexWithUV(d10, d12, d14, d5, d7);
tessellator.addVertexWithUV(d10, d13, d14, d5, d6);
tessellator.addVertexWithUV(d11, d13, d14, d4, d6);
tessellator.addVertexWithUV(d10, d12, d14, d5, d7);
tessellator.addVertexWithUV(d11, d12, d14, d4, d7);
tessellator.addVertexWithUV(d11, d13, d14, d4, d6);
tessellator.addVertexWithUV(d10, d13, d14, d5, d6);
}
} else {
tessellator.addVertexWithUV(d10, d12, d14, d5, d7);
tessellator.addVertexWithUV(d10, d12, d15, d4, d7);
tessellator.addVertexWithUV(d10, d13, d15, d4, d6);
tessellator.addVertexWithUV(d10, d13, d14, d5, d6);
tessellator.addVertexWithUV(d10, d12, d15, d4, d7);
tessellator.addVertexWithUV(d10, d12, d14, d5, d7);
tessellator.addVertexWithUV(d10, d13, d14, d5, d6);
tessellator.addVertexWithUV(d10, d13, d15, d4, d6);
}
return true;
}
Aggregations