Omega fixing

This commit is contained in:
Adubbz 2013-12-26 22:38:55 +11:00
parent 9a44678fed
commit fca8451b1c
46 changed files with 2040 additions and 1064 deletions

View File

@ -6,6 +6,10 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityBreakingFX;
import net.minecraft.client.particle.EntityFX;
import biomesoplenty.api.BOPItemHelper;
import biomesoplenty.client.render.blocks.BambooRenderer;
import biomesoplenty.client.render.blocks.GraveRenderer;
import biomesoplenty.client.render.blocks.RenderUtils;
import biomesoplenty.client.render.blocks.SmallBlockRenderer;
import biomesoplenty.client.render.entities.RenderDart;
import biomesoplenty.common.entities.projectiles.EntityDart;
import cpw.mods.fml.client.registry.RenderingRegistry;
@ -24,7 +28,19 @@ public class ClientProxy extends CommonProxy
@Override
public void registerRenderers()
{
RenderUtils.foliageModel = RenderingRegistry.getNextAvailableRenderId();
RenderUtils.plantsModel = RenderingRegistry.getNextAvailableRenderId();
RenderUtils.bonesModel = RenderingRegistry.getNextAvailableRenderId();
RenderUtils.graveModel = RenderingRegistry.getNextAvailableRenderId();
RenderUtils.bambooModel = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerEntityRenderingHandler(EntityDart.class, new RenderDart());
//TODO: FEATURE RenderingRegistry.registerBlockHandler(new FoliageRenderer());
//TODO: FEATURE RenderingRegistry.registerBlockHandler(new PlantsRenderer());
RenderingRegistry.registerBlockHandler(new SmallBlockRenderer());
RenderingRegistry.registerBlockHandler(new GraveRenderer());
RenderingRegistry.registerBlockHandler(new BambooRenderer());
}
@Override

View File

@ -0,0 +1,117 @@
package biomesoplenty.client.render.blocks;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
public class BambooRenderer implements ISimpleBlockRenderingHandler
{
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
{
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
//TODO: setBlockBounds
block.func_149676_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
//TODO: colorMultiplier
int l = block.func_149720_d(world, x, y, z);
float f = (float)(l >> 16 & 255) / 255.0F;
float f1 = (float)(l >> 8 & 255) / 255.0F;
float f2 = (float)(l & 255) / 255.0F;
if (EntityRenderer.anaglyphEnable)
{
float f3 = (f * 30.0F + f1 * 59.0F + f2 * 11.0F) / 100.0F;
float f4 = (f * 30.0F + f1 * 70.0F) / 100.0F;
float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F;
f = f3;
f1 = f4;
f2 = f5;
}
Tessellator tessellator = Tessellator.instance;
boolean flag = false;
float f3 = 0.5F;
float f4 = 1.0F;
float f5 = 0.8F;
float f6 = 0.6F;
float r = f3 * f;
float f8 = f4 * f;
float f9 = f5 * f;
float f10 = f6 * f;
float g = f3 * f1;
float f12 = f4 * f1;
float f13 = f5 * f1;
float f14 = f6 * f1;
float b = f3 * f2;
float f16 = f4 * f2;
float f17 = f5 * f2;
float f18 = f6 * f2;
float pixel = 0.0625F;
//TODO: getMixedBrightnessForBlock()
int m = block.func_149677_c(world, x, y, z);
//TODO: renderAllFaces shouldSideBeRendered()
if (renderer.field_147837_f || block.func_149646_a(world, x, y - 1, z, 0))
{
//TODO: renderMinY getMixedBrightnessForBlock()
tessellator.setBrightness(renderer.field_147855_j > 0.0D ? m : block.func_149677_c(world, x, y - 1, z));
tessellator.setColorOpaque_F(r, g, b);
//TODO: renderFaceYNeg getBlockIcon()
renderer.func_147768_a(block, (double)x, (double)y, (double)z, renderer.func_147793_a(block, world, x, y, z, 0));
}
//TODO: renderAllFaces shouldSideBeRendered()
if (renderer.field_147837_f || block.func_149646_a(world, x, y + 1, z, 1))
{
//TODO: renderMaxY getMixedBrightnessForBlock()
tessellator.setBrightness(renderer.field_147857_k < 1.0D ? m : block.func_149677_c(world, x, y + 1, z));
tessellator.setColorOpaque_F(f8, f12, f16);
//TODO: renderFaceYPos getBlockIcon()
renderer.func_147806_b(block, (double)x, (double)y, (double)z, renderer.func_147793_a(block, world, x, y, z, 1));
}
tessellator.setBrightness(m);
tessellator.setColorOpaque_F(f9, f13, f17);
tessellator.addTranslation(0.0F, 0.0F, pixel);
//TODO: renderFaceZNeg getBlockIcon()
renderer.func_147761_c(block, (double)x, (double)y, (double)z + (pixel * 4), renderer.func_147793_a(block, world, x, y, z, 2));
tessellator.addTranslation(0.0F, 0.0F, -pixel);
tessellator.addTranslation(0.0F, 0.0F, -pixel);
//TODO: renderFaceZPos getBlockIcon()
renderer.func_147734_d(block, (double)x, (double)y, (double)z - (pixel * 4), renderer.func_147793_a(block, world, x, y, z, 3));
tessellator.addTranslation(0.0F, 0.0F, pixel);
tessellator.setColorOpaque_F(f10, f14, f18);
tessellator.addTranslation(pixel, 0.0F, 0.0F);
//TODO: renderFaceXNeg getBlockIcon()
renderer.func_147798_e(block, (double)x + (pixel * 4), (double)y, (double)z, renderer.func_147793_a(block, world, x, y, z, 4));
tessellator.addTranslation(-pixel, 0.0F, 0.0F);
tessellator.addTranslation(-pixel, 0.0F, 0.0F);
//TODO: renderFaceXPos getBlockIcon()
renderer.func_147764_f(block, (double)x - (pixel * 4), (double)y, (double)z, renderer.func_147793_a(block, world, x, y, z, 5));
tessellator.addTranslation(pixel, 0.0F, 0.0F);
return true;
}
@Override
public boolean shouldRender3DInInventory(int modelId)
{
return false;
}
@Override
public int getRenderId()
{
return RenderUtils.bambooModel;
}
}

View File

@ -0,0 +1,260 @@
package biomesoplenty.client.render.blocks;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import biomesoplenty.api.Blocks;
import biomesoplenty.blocks.BlockBOPFoliage;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
public class FoliageRenderer implements ISimpleBlockRenderingHandler
{
private final int GRASSTOP = 6;
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
{
// Doesn't render in inventory
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
int meta = world.getBlockMetadata(x, y, z);
if (modelId == RenderUtils.foliageModel)
{
if (block == Blocks.foliage.get())
{
if (meta == 0)
return renderBlockAlgae(renderer, block, x, y, z);
else if (meta == 13)
return renderBlockClover(renderer, block, x, y, z);
else
return renderCrossedSquares(block, x, y, z, renderer);
}
else
{
if (meta == 0)
return renderBlockAlgae(renderer, block, x, y, z);
else
return renderCrossedSquares(block, x, y, z, renderer);
}
}
return true;
}
@Override
public boolean shouldRender3DInInventory()
{
return false;
}
@Override
public int getRenderId()
{
return RenderUtils.foliageModel;
}
public boolean renderBlockAlgae(RenderBlocks renderer, Block block, int x, int y, int z)
{
Tessellator tessellator = Tessellator.instance;
Icon icon = renderer.getBlockIconFromSide(block, 1);
if (renderer.hasOverrideBlockTexture())
{
icon = renderer.overrideBlockTexture;
}
float cf = 1.0F;
int cl = block.colorMultiplier(renderer.blockAccess, x, y, z);
float c1 = (cl >> 16 & 255) / 255.0F;
float c2 = (cl >> 8 & 255) / 255.0F;
float c3 = (cl & 255) / 255.0F;
if (EntityRenderer.anaglyphEnable)
{
float f4 = (c1 * 30.0F + c2 * 59.0F + c3 * 11.0F) / 100.0F;
float f5 = (c1 * 30.0F + c2 * 70.0F) / 100.0F;
float f6 = (c1 * 30.0F + c3 * 70.0F) / 100.0F;
c1 = f4;
c2 = f5;
c3 = f6;
}
tessellator.setColorOpaque_F(cf * c1, cf * c2, cf * c3);
float f = 0.015625F;
double d0 = (double)icon.getMinU();
double d1 = (double)icon.getMinV();
double d2 = (double)icon.getMaxU();
double d3 = (double)icon.getMaxV();
long l = (long)(x * 3129871) ^ (long)z * 116129781L ^ (long)y;
l = l * l * 42317861L + l * 11L;
int i1 = (int)(l >> 16 & 3L);
tessellator.setBrightness(block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z));
float f1 = (float)x + 0.5F;
float f2 = (float)z + 0.5F;
float f3 = (float)(i1 & 1) * 0.5F * (float)(1 - i1 / 2 % 2 * 2);
float f4 = (float)(i1 + 1 & 1) * 0.5F * (float)(1 - (i1 + 1) / 2 % 2 * 2);
tessellator.addVertexWithUV((double)(f1 + f3 - f4), (double)((float)y + f), (double)(f2 + f3 + f4), d0, d1);
tessellator.addVertexWithUV((double)(f1 + f3 + f4), (double)((float)y + f), (double)(f2 - f3 + f4), d2, d1);
tessellator.addVertexWithUV((double)(f1 - f3 + f4), (double)((float)y + f), (double)(f2 - f3 - f4), d2, d3);
tessellator.addVertexWithUV((double)(f1 - f3 - f4), (double)((float)y + f), (double)(f2 + f3 - f4), d0, d3);
tessellator.addVertexWithUV((double)(f1 - f3 - f4), (double)((float)y + f), (double)(f2 + f3 - f4), d0, d3);
tessellator.addVertexWithUV((double)(f1 - f3 + f4), (double)((float)y + f), (double)(f2 - f3 - f4), d2, d3);
tessellator.addVertexWithUV((double)(f1 + f3 + f4), (double)((float)y + f), (double)(f2 - f3 + f4), d2, d1);
tessellator.addVertexWithUV((double)(f1 + f3 - f4), (double)((float)y + f), (double)(f2 + f3 + f4), d0, d1);
return true;
}
public boolean renderBlockClover(RenderBlocks renderer, Block block, int x, int y, int z)
{
Tessellator tessellator = Tessellator.instance;
IIcon icon = renderer.getBlockIconFromSideAndMetadata(block, 1, 13);
if (renderer.hasOverrideBlockTexture())
{
icon = renderer.overrideBlockTexture;
}
float cf = 1.0F;
int cl = block.colorMultiplier(renderer.blockAccess, x, y, z);
float c1 = (cl >> 16 & 255) / 255.0F;
float c2 = (cl >> 8 & 255) / 255.0F;
float c3 = (cl & 255) / 255.0F;
if (EntityRenderer.anaglyphEnable)
{
float f4 = (c1 * 30.0F + c2 * 59.0F + c3 * 11.0F) / 100.0F;
float f5 = (c1 * 30.0F + c2 * 70.0F) / 100.0F;
float f6 = (c1 * 30.0F + c3 * 70.0F) / 100.0F;
c1 = f4;
c2 = f5;
c3 = f6;
}
tessellator.setColorOpaque_F(cf * c1, cf * c2, cf * c3);
float f = 0.1F;
double d0 = (double)icon.getMinU();
double d1 = (double)icon.getMinV();
double d2 = (double)icon.getMaxU();
double d3 = (double)icon.getMaxV();
long l = (long)(x * 3129871) ^ (long)z * 116129781L ^ (long)y;
l = l * l * 42317861L + l * 11L;
int i1 = (int)(l >> 16 & 3L);
tessellator.setBrightness(block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z));
float f1 = (float)x + 0.5F;
float f2 = (float)z + 0.5F;
float f3 = (float)(i1 & 1) * 0.5F * (float)(1 - i1 / 2 % 2 * 2);
float f4 = (float)(i1 + 1 & 1) * 0.5F * (float)(1 - (i1 + 1) / 2 % 2 * 2);
tessellator.addVertexWithUV((double)(f1 + f3 - f4), (double)((float)y + f), (double)(f2 + f3 + f4), d0, d1);
tessellator.addVertexWithUV((double)(f1 + f3 + f4), (double)((float)y + f), (double)(f2 - f3 + f4), d2, d1);
tessellator.addVertexWithUV((double)(f1 - f3 + f4), (double)((float)y + f), (double)(f2 - f3 - f4), d2, d3);
tessellator.addVertexWithUV((double)(f1 - f3 - f4), (double)((float)y + f), (double)(f2 + f3 - f4), d0, d3);
tessellator.addVertexWithUV((double)(f1 - f3 - f4), (double)((float)y + f), (double)(f2 + f3 - f4), d0, d3);
tessellator.addVertexWithUV((double)(f1 - f3 + f4), (double)((float)y + f), (double)(f2 - f3 - f4), d2, d3);
tessellator.addVertexWithUV((double)(f1 + f3 + f4), (double)((float)y + f), (double)(f2 - f3 + f4), d2, d1);
tessellator.addVertexWithUV((double)(f1 + f3 - f4), (double)((float)y + f), (double)(f2 + f3 + f4), d0, d1);
return true;
}
private boolean renderCrossedSquares(Block par1Block, int par2, int par3, int par4, RenderBlocks renderer)
{
Tessellator tessellator = Tessellator.instance;
//TODO: blockAccess
IBlockAccess world = renderer.field_147845_a;
tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(world, par2, par3, par4));
float f = 1.0F;
int l = par1Block.colorMultiplier(world, par2, par3, par4);
float f1 = (l >> 16 & 255) / 255.0F;
float f2 = (l >> 8 & 255) / 255.0F;
float f3 = (l & 255) / 255.0F;
if (EntityRenderer.anaglyphEnable)
{
float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
f1 = f4;
f2 = f5;
f3 = f6;
}
if ((world.getBlockMetadata(par2, par3, par4) == 8 || world.getBlockMetadata(par2, par3, par4) == 9) && world.getBlockId(par2, par3, par4) == Blocks.foliage.get().blockID)
{
tessellator.setColorOpaque_F(f, f, f);
}
else
{
tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
}
double d0 = par2;
double d1 = par3;
double d2 = par4;
if (par1Block == Blocks.foliage.get())
{
long i1;
if (world.getBlockMetadata(par2, par3, par4) == GRASSTOP) {
i1 = par2 * 3129871 ^ par4 * 116129781L ^ par3 - 1;
} else {
i1 = par2 * 3129871 ^ par4 * 116129781L ^ par3;
}
i1 = i1 * i1 * 42317861L + i1 * 11L;
d0 += ((i1 >> 16 & 15L) / 15.0F - 0.5D) * 0.5D;
d1 += ((i1 >> 20 & 15L) / 15.0F - 1.0D) * 0.2D;
d2 += ((i1 >> 24 & 15L) / 15.0F - 0.5D) * 0.5D;
}
if (world.getBlockMetadata(par2, par3, par4) == 10 && world.getBlockId(par2, par3, par4) == Blocks.flowers.get().blockID)
{
renderer.drawCrossedSquares(par1Block, world.getBlockMetadata(par2, par3, par4), d0, d1 - 1, d2, 1.0F);
}
else if (world.getBlockMetadata(par2, par3, par4) == 8 && world.getBlockId(par2, par3, par4) == Blocks.foliage.get().blockID)
{
renderBerryBush(d0, d1, d2, 1.0F, f1, f2, f3, renderer);
}
else if (world.getBlockMetadata(par2, par3, par4) == 9 && world.getBlockId(par2, par3, par4) == Blocks.foliage.get().blockID)
{
renderShrub(d0, d1, d2, 1.0F, f1, f2, f3, renderer);
}
else
{
renderer.drawCrossedSquares(par1Block, world.getBlockMetadata(par2, par3, par4), d0, d1, d2, 1.0F);
}
return true;
}
private static void renderBerryBush(double par1, double par2, double par3, float par4, float par5, float par6, float par7, RenderBlocks renderer)
{
Tessellator tessellator = Tessellator.instance;
Icon berryBush = renderer.getBlockIconFromSideAndMetadata(Blocks.foliage.get(), 0, 8);
Icon berryBushBerry = ((BlockBOPFoliage)Blocks.foliage.get()).berryBushBerry;
tessellator.setColorOpaque_F(par4 * par5, par4 * par6, par4 * par7);
RenderUtils.renderCrossedSquaresFromIcon(berryBush, par1, par2, par3, par4, renderer);
tessellator.setColorOpaque_F(par4, par4, par4);
RenderUtils.renderCrossedSquaresFromIcon(berryBushBerry, par1, par2, par3, par4, renderer);
}
private static void renderShrub(double par1, double par2, double par3, float par4, float par5, float par6, float par7, RenderBlocks renderer)
{
Tessellator tessellator = Tessellator.instance;
IIcon shrubLeaf = renderer.getBlockIconFromSideAndMetadata(Blocks.foliage.get(), 0, 9);
IIcon shrubBranch = ((BlockBOPFoliage)Blocks.foliage.get()).shrubBranch;
tessellator.setColorOpaque_F(par4 * par5, par4 * par6, par4 * par7);
RenderUtils.renderCrossedSquaresFromIcon(shrubLeaf, par1, par2, par3, par4, renderer);
tessellator.setColorOpaque_F(par4, par4, par4);
RenderUtils.renderCrossedSquaresFromIcon(shrubBranch, par1, par2, par3, par4, renderer);
}
}

View File

@ -0,0 +1,153 @@
package biomesoplenty.client.render.blocks;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
public class GraveRenderer implements ISimpleBlockRenderingHandler
{
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
if (modelId == RenderUtils.graveModel)
{
int meta = world.getBlockMetadata(x, y, z);
float pixel = 0.0625F;
if (meta == 0)
{
//Base
//TODO: setRenderBounds
renderer.func_147782_a(pixel*5, 0, pixel*5, pixel*11, pixel*3, pixel*11);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
//Base pole
//TODO: setRenderBounds
renderer.func_147782_a(pixel*6, pixel*3, pixel*6, pixel*10, pixel*11, pixel*10);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
//Head horizontal bottom
//TODO: setRenderBounds
renderer.func_147782_a(0, pixel*11, pixel*5, pixel*16, pixel*14, pixel*11);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
}
else if (meta == 1)
{
//Head vertical side 0
//TODO: setRenderBounds
renderer.func_147782_a(pixel*13, pixel*-2, pixel*5, pixel*16, pixel*8, pixel*11);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
//Head vertical side 1
//TODO: setRenderBounds
renderer.func_147782_a(0, pixel*-2, pixel*5, pixel*3, pixel*8, pixel*11);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
//Cross vertical side 1
//TODO: setRenderBounds
renderer.func_147782_a(pixel*6, pixel*-3, pixel*7, pixel*10, pixel*14, pixel*9);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
//Head horizontal middle 0
//TODO: setRenderBounds
renderer.func_147782_a(pixel*-4, pixel*1, pixel*7, pixel*6, pixel*5, pixel*9);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
//Head horizontal middle 1
//TODO: setRenderBounds
renderer.func_147782_a(pixel*10, pixel*1, pixel*7, pixel*20, pixel*5, pixel*9);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
//Head horizontal top
//TODO: setRenderBounds
renderer.func_147782_a(0, pixel*8, pixel*5, pixel*16, pixel*11, pixel*11);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
}
else if (meta == 2)
{
//Base
//TODO: setRenderBounds
renderer.func_147782_a(pixel*5, 0, pixel*5, pixel*11, pixel*3, pixel*11);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
//Base pole
//TODO: setRenderBounds
renderer.func_147782_a(pixel*6, pixel*3, pixel*6, pixel*10, pixel*11, pixel*10);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
//Head horizontal bottom
//TODO: setRenderBounds
renderer.func_147782_a(pixel*5, pixel*11, 0, pixel*11, pixel*14, pixel*16);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
}
else if (meta == 3)
{
//Head vertical side 0
//TODO: setRenderBounds
renderer.func_147782_a(pixel*5, pixel*-2, pixel*13, pixel*11, pixel*8, pixel*16);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
//Head vertical side 1
//TODO: setRenderBounds
renderer.func_147782_a(pixel*5, pixel*-2, 0, pixel*11, pixel*8, pixel*3);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
//Cross vertical side 1
//TODO: setRenderBounds
renderer.func_147782_a(pixel*7, pixel*-3, pixel*6, pixel*9, pixel*14, pixel*10);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
//Head horizontal middle 0
//TODO: setRenderBounds
renderer.func_147782_a(pixel*7, pixel*1, pixel*-4, pixel*9, pixel*5, pixel*6);
renderer.func_147784_q(block, x, y, z);
//Head horizontal middle 1
//TODO: setRenderBounds
renderer.func_147782_a(pixel*7, pixel*1, pixel*10, pixel*9, pixel*5, pixel*20);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
//Head horizontal top
//TODO: setRenderBounds
renderer.func_147782_a(pixel*5, pixel*8, 0, pixel*11, pixel*11, pixel*16);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
}
}
return true;
}
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
{
}
@Override
public boolean shouldRender3DInInventory(int modelId)
{
return false;
}
@Override
public int getRenderId()
{
return RenderUtils.graveModel;
}
}

View File

@ -0,0 +1,150 @@
package biomesoplenty.blocks.renderers;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import biomesoplenty.api.Blocks;
import biomesoplenty.blocks.BlockBOPPlant;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
public class PlantsRenderer implements ISimpleBlockRenderingHandler
{
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
{
// Doesn't render in inventory
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
if (modelId == RenderUtils.plantsModel)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta < 5)
return renderCrossedSquares(block, x, y, z, renderer, true);
if (meta == 5)
return renderer.renderCrossedSquares(block, x, y, z);
if (meta == 6)
return renderBlockCrops(block, x, y, z, renderer);
if (meta == 7)
return renderer.renderBlockCrops(block, x, y, z);
if (meta == 8)
return renderer.renderBlockCrops(block, x, y, z);
if (meta == 9)
return renderer.renderBlockCrops(block, x, y, z);
if (meta == 10)
return renderer.renderBlockCrops(block, x, y, z);
if (meta == 11)
return renderer.renderBlockCrops(block, x, y, z);
if (meta == 12)
return renderCrossedSquares(block, x, y, z, renderer, true);
if (meta == 13)
return renderer.renderBlockCrops(block, x, y, z);
if (meta == 14)
{
return renderCrossedSquares(block, x, y, z, renderer, false);
}
if (meta == 15)
return renderCrossedSquares(block, x, y, z, renderer, true);
}
return true;
}
@Override
public boolean shouldRender3DInInventory(int modelId)
{
return false;
}
@Override
public int getRenderId()
{
return RenderUtils.plantsModel;
}
private boolean renderBlockCrops(Block par1Block, int par2, int par3, int par4, RenderBlocks renderer)
{
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3, par4));
tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
double d0 = par2;
double d1 = par3;
double d2 = par4;
long i1 = par2 * 3129871 ^ par4 * 116129781L ^ par3;
i1 = i1 * i1 * 42317861L + i1 * 11L;
d0 += ((i1 >> 16 & 15L) / 15.0F - 0.5D) * 0.125D;
d2 += ((i1 >> 24 & 15L) / 15.0F - 0.5D) * 0.125D;
renderer.renderBlockCropsImpl(par1Block, renderer.blockAccess.getBlockMetadata(par2, par3, par4), d0, par3 - 0.0625F, d2);
return true;
}
private boolean renderCrossedSquares(Block par1Block, int par2, int par3, int par4, RenderBlocks renderer, boolean colourMultiply)
{
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3, par4));
float f = 1.0F;
int l = par1Block.colorMultiplier(renderer.blockAccess, par2, par3, par4);
float f1 = (l >> 16 & 255) / 255.0F;
float f2 = (l >> 8 & 255) / 255.0F;
float f3 = (l & 255) / 255.0F;
if (EntityRenderer.anaglyphEnable)
{
float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
f1 = f4;
f2 = f5;
f3 = f6;
}
if (!colourMultiply)
{
f1 = f;
f2 = f;
f3 = f;
}
tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
double d0 = par2;
double d1 = par3;
double d2 = par4;
long i1 = par2 * 3129871 ^ par4 * 116129781L ^ par3;
int meta = renderer.blockAccess.getBlockMetadata(par2, par3, par4);
if (meta == 15)
{
i1 = i1 * i1 * 42317861L + i1 * 11L;
d0 += ((i1 >> 16 & 15L) / 15.0F - 0.5D) * 0.2D;
d1 -= ((i1 >> 20 & 15L) / 15.0F - 1.0D) * 0.4D;
d2 += ((i1 >> 24 & 15L) / 15.0F - 0.5D) * 0.2D;
}
else
{
i1 = i1 * i1 * 42317861L + i1 * 11L;
d0 += ((i1 >> 16 & 15L) / 15.0F - 0.5D) * 0.5D;
d1 += ((i1 >> 20 & 15L) / 15.0F - 1.0D) * 0.2D;
d2 += ((i1 >> 24 & 15L) / 15.0F - 0.5D) * 0.5D;
}
if (meta == 14)
{
renderer.drawCrossedSquares(par1Block, meta, d0, d1, d2, 1.0F);
RenderUtils.renderCrossedSquaresFromIcon(((BlockBOPPlant)Blocks.plants.get()).reedbottom, d0, d1 - 1, d2, 1.0F, renderer);
}
else
{
renderer.drawCrossedSquares(par1Block, meta, d0, d1, d2, 1.0F);
}
return true;
}
}

View File

@ -0,0 +1,61 @@
package biomesoplenty.client.render.blocks;
import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.init.Blocks;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
public class RenderUtils
{
public static int foliageModel = -1;
public static int plantsModel = -1;
public static int bonesModel = -1;
public static int graveModel = -1;
public static int bambooModel = -1;
public static void renderStandardInvBlock(RenderBlocks renderblocks, Block block, int meta)
{
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
//TODO: renderFaceYNeg getIcon()
renderblocks.func_147768_a(block, 0.0D, 0.0D, 0.0D, block.func_149691_a(0, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
//TODO: renderFaceYPos getIcon()
renderblocks.func_147806_b(block, 0.0D, 0.0D, 0.0D, block.func_149691_a(1, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1F);
//TODO: renderFaceZNeg getIcon()
renderblocks.func_147761_c(block, 0.0D, 0.0D, 0.0D, block.func_149691_a(2, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
//TODO: renderFaceZPos getIcon()
renderblocks.func_147734_d(block, 0.0D, 0.0D, 0.0D, block.func_149691_a(3, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0.0F, 0.0F);
//TODO: renderFaceXNeg getIcon()
renderblocks.func_147798_e(block, 0.0D, 0.0D, 0.0D, block.func_149691_a(4, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
//TODO: renderFaceXPos getIcon()
renderblocks.func_147764_f(block, 0.0D, 0.0D, 0.0D, block.func_149691_a(5, meta));
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
}

View File

@ -0,0 +1,135 @@
package biomesoplenty.client.render.blocks;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
public class SmallBlockRenderer implements ISimpleBlockRenderingHandler
{
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
if (modelId == RenderUtils.bonesModel)
{
int meta = world.getBlockMetadata(x, y, z);
//0.062 Approx (Per pixel)
if (meta == 0)
{
//TODO: setRenderBounds
renderer.func_147782_a(0.374F, 0.0F, 0.374F, 0.626F, 1.0F, 0.626F);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
}
else if (meta == 1)
{
//TODO: setRenderBounds
renderer.func_147782_a(0.187F, 0.0F, 0.187F, 0.813F, 1.0F, 0.813F);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
}
else if (meta == 3)
{
//TODO: setRenderBounds
renderer.func_147782_a(0.374F, 0.374F, 0.0F, 0.626F, 0.626F, 1.0F);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
}
else if (meta == 4)
{
//TODO: setRenderBounds
renderer.func_147782_a(0.0F, 0.374F, 0.374F, 1.0F, 0.626F, 0.626F);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
}
else if (meta == 5)
{
//TODO: setRenderBounds
renderer.func_147782_a(0.187F, 0.187F, 0.0F, 0.813F, 0.813F, 1.0F);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
}
else if (meta == 6)
{
//TODO: setRenderBounds
renderer.func_147782_a(0.0F, 0.187F, 0.187F, 1.0F, 0.813F, 0.813F);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
}
else
{
//TODO: setRenderBounds
renderer.func_147782_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
//TODO: renderStandardBlock
renderer.func_147784_q(block, x, y, z);
}
}
return true;
}
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == RenderUtils.bonesModel)
{
Tessellator tessellator = Tessellator.instance;
if (metadata == 0)
{
//TODO: setRenderBounds
renderer.func_147782_a(0.374F, 0.0F, 0.374F, 0.626F, 1.0F, 0.626F);
RenderUtils.renderStandardInvBlock(renderer, block, metadata);
}
else if (metadata == 1)
{
//TODO: setRenderBounds
renderer.func_147782_a(0.187F, 0.0F, 0.187F, 0.813F, 1.0F, 0.813F);
RenderUtils.renderStandardInvBlock(renderer, block, metadata);
}
else if (metadata == 3)
{
//TODO: setRenderBounds
renderer.func_147782_a(0.374F, 0.374F, 0.0F, 0.626F, 0.626F, 1.0F);
RenderUtils.renderStandardInvBlock(renderer, block, metadata);
}
else if (metadata == 4)
{
//TODO: setRenderBounds
renderer.func_147782_a(0.0F, 0.374F, 0.374F, 1.0F, 0.626F, 0.626F);
RenderUtils.renderStandardInvBlock(renderer, block, metadata);
}
else if (metadata == 5)
{
//TODO: setRenderBounds
renderer.func_147782_a(0.187F, 0.187F, 0.0F, 0.813F, 0.813F, 1.0F);
RenderUtils.renderStandardInvBlock(renderer, block, metadata);
}
else if (metadata == 6)
{
//TODO: setRenderBounds
renderer.func_147782_a(0.0F, 0.187F, 0.187F, 1.0F, 0.813F, 0.813F);
RenderUtils.renderStandardInvBlock(renderer, block, metadata);
}
else
{
//TODO: setRenderBounds
renderer.func_147782_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
RenderUtils.renderStandardInvBlock(renderer, block, metadata);
}
}
}
@Override
public boolean shouldRender3DInInventory(int modelId)
{
return true;
}
@Override
public int getRenderId()
{
return RenderUtils.bonesModel;
}
}

View File

@ -12,6 +12,7 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
@ -20,6 +21,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.IShearable;
import net.minecraftforge.common.util.FakePlayer;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.BOPBlockHelper;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -32,7 +34,8 @@ public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable
public BlockBOPAppleLeaves()
{
super(Material.leaves, false);
//TODO: Material.leaves
super(Material.field_151584_j, false);
//TODO: setBurnProperties() getIdFromBlock()
Blocks.fire.func_149842_a(func_149682_b(this), 30, 60);
@ -40,7 +43,6 @@ public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable
this.func_149675_a(true);
//TODO: this.setHardness
this.func_149711_c(0.2F);
setLightOpacity(1);
//TODO setStepSound(Block.soundGrassFootstep)
this.func_149672_a(Block.field_149779_h);
@ -83,15 +85,17 @@ public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable
//TODO: getIcon()
public IIcon func_149691_a(int side, int meta)
{
return textures[(!isOpaqueCube() ? 0 : 1)][meta & 3];
//TODO: isOpaqueCube()
return textures[(!func_149662_c() ? 0 : 1)][meta & 3];
}
@Override
@Override
//TODO: isOpaqueCube()
public boolean func_149662_c()
{
return Blocks.leaves.isOpaqueCube();
}
{
//TODO: isOpaqueCube()
return Blocks.leaves.func_149662_c();
}
@Override
//TODO: getSubBlocks()
@ -100,43 +104,50 @@ public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable
list.add(new ItemStack(block, 1, 0));
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random random)
{
if (world.canLightningStrikeAt(x, y + 1, z) && !world.doesBlockHaveSolidTopSurface(x, y - 1, z) && random.nextInt(15) == 1)
{
double d0 = x + random.nextFloat();
double d1 = y - 0.05D;
double d2 = z + random.nextFloat();
world.spawnParticle("dripWater", d0, d1, d2, 0.0D, 0.0D, 0.0D);
}
@Override
//TODO: randomDisplayTick()
public void func_149734_b(World world, int x, int y, int z, Random random)
{
//TODO: doesBlockHaveSolidTopSurface
if (world.canLightningStrikeAt(x, y + 1, z) && !World.func_147466_a(world, x, y - 1, z) && random.nextInt(15) == 1)
{
double d0 = x + random.nextFloat();
double d1 = y - 0.05D;
double d2 = z + random.nextFloat();
world.spawnParticle("dripWater", d0, d1, d2, 0.0D, 0.0D, 0.0D);
}
super.randomDisplayTick(world, x, y, z, random);
//TODO: randomDisplayTick()
super.func_149734_b(world, x, y, z, random);
}
}
@Override
//TODO: breakBlock()
public void func_149749_a(World world, int x, int y, int z, Block par5, int par6)
{
byte radius = 1;
int bounds = radius + 1;
@Override
public void breakBlock(World world, int x, int y, int z, int par5, int par6)
{
byte radius = 1;
int bounds = radius + 1;
if (world.checkChunksExist(x - bounds, y - bounds, z - bounds, x + bounds, y + bounds, z + bounds))
{
for (int i = -radius; i <= radius; ++i)
{
for (int j = -radius; j <= radius; ++j)
{
for (int k = -radius; k <= radius; ++k)
{
//TODO: getBlock()
Block block = world.func_147439_a(x + i, y + j, z + k);
if (world.checkChunksExist(x - bounds, y - bounds, z - bounds, x + bounds, y + bounds, z + bounds)) {
for (int i = -radius; i <= radius; ++i) {
for (int j = -radius; j <= radius; ++j) {
for (int k = -radius; k <= radius; ++k)
{
int blockID = world.getBlockId(x + i, y + j, z + k);
if (Block.blocksList[blockID] != null) {
Block.blocksList[blockID].beginLeavesDecay(world, x + i, y + j, z + k);
if (block.isLeaves(world, x, y, z))
{
block.beginLeavesDecay(world, x + i, y + j, z + k);
}
}
}
}
}
}
}
}
}
}
}
@Override
//TODO: updateTick()
@ -148,8 +159,10 @@ public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable
int meta = world.getBlockMetadata(x, y, z);
if (random.nextInt(25) == 0)
if (meta > 0)
if ((meta & 3) < 3) {
world.setBlock(x, y, z, blockID, ++meta, 3);
if ((meta & 3) < 3)
{
//TODO: setBlock()
world.func_147465_d(x, y, z, this, ++meta, 3);
}
if ((meta & 8) != 0/* && (meta & 4) == 0*/)
@ -179,9 +192,8 @@ public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable
{
for (j2 = -b0; j2 <= b0; ++j2)
{
k2 = world.getBlockId(x + l1, y + i2, z + j2);
Block block = Block.blocksList[k2];
//TODO: world.getBlock()
Block block = world.func_147439_a(x + l1, y + i2, z + j2);
if (block != null && block.canSustainLeaves(world, x + l1, y + i2, z + j2))
{
@ -258,20 +270,26 @@ public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable
}
}
private void removeLeaves(World world, int x, int y, int z)
{
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
world.setBlockToAir(x, y, z);
}
private void removeLeaves(World world, int x, int y, int z)
{
//TODO: dropBlockAsItem
this.func_149697_b(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
//TODO: setBlockToAir
world.func_147468_f(x, y, z);
}
@Override
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
//TODO: onBlockActivated
public boolean func_149727_a(World world, int x, int y, int z, EntityPlayer player, int side, float hitVecX, float hitVecY, float hitVecZ)
{
int meta = world.getBlockMetadata(x, y, z);
if ((meta & 3) == 3)
{
world.setBlock(x, y, z, blockID, meta - 3, 3);
EntityItem entityitem = new EntityItem(world, x, y, z, new ItemStack(Item.appleRed, 1, 0));
//TODO: setBlock
world.func_147465_d(x, y, z, this, meta - 3, 3);
EntityItem entityitem = new EntityItem(world, x, y, z, new ItemStack(Items.apple, 1, 0));
if (!world.isRemote) {
world.spawnEntityInWorld(entityitem);
@ -288,7 +306,7 @@ public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable
//TODO: getItemDropped()
public Item func_149650_a(int metadata, Random random, int fortune)
{
return Blocks.saplings.get().blockID;
return Item.func_150898_a(BOPBlockHelper.get("saplings"));
}
@Override
@ -314,19 +332,20 @@ public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable
if (world.rand.nextInt(20) == 0)
{
int var9 = this.idDropped(meta, world.rand, par7);
this.dropBlockAsItem_do(world, x, y, z, new ItemStack(var9, 1, this.damageDropped(meta)));
//TODO: getItemDropped()
Item item = this.func_149650_a(metadata, world.rand, fortune);
//TODO:dropBlockAsItem_do damageDropped()
this.func_149642_a(world, x, y, z, new ItemStack(item, 1, this.func_149692_a(metadata)));
}
if ((meta & 3) == 3) {
this.dropBlockAsItem_do(world, x, y, z, new ItemStack(Item.appleRed, 1, 0));
} else if ((meta & 3) == 2 && world.rand.nextInt(16) == 0) {
this.dropBlockAsItem_do(world, x, y, z, new ItemStack(Item.appleRed, 1, 0));
} else if ((meta & 3) == 1 && world.rand.nextInt(48) == 0) {
this.dropBlockAsItem_do(world, x, y, z, new ItemStack(Item.appleRed, 1, 0));
} else if ((meta & 3) == 0 && world.rand.nextInt(80) == 0) {
this.dropBlockAsItem_do(world, x, y, z, new ItemStack(Item.appleRed, 1, 0));
}
//TODO: dropBlockAsItem_do
if ((metadata & 3) == 3) this.func_149642_a(world, x, y, z, new ItemStack(Items.apple, 1, 0));
//TODO: dropBlockAsItem_do
else if ((metadata & 3) == 2 && world.rand.nextInt(16) == 0) this.func_149642_a(world, x, y, z, new ItemStack(Items.apple, 1, 0));
//TODO: dropBlockAsItem_do
else if ((metadata & 3) == 1 && world.rand.nextInt(48) == 0) this.func_149642_a(world, x, y, z, new ItemStack(Items.apple, 1, 0));
//TODO: dropBlockAsItem_do
else if ((metadata & 3) == 0 && world.rand.nextInt(80) == 0) this.func_149642_a(world, x, y, z, new ItemStack(Items.apple, 1, 0));
}
@Override
@ -336,19 +355,13 @@ public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, 0));
return ret;
}
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1)
{
graphicsLevel = par1;
}
@Override
//TODO shouldSideBeRendered
public boolean func_149646_a(IBlockAccess world, int x, int y, int z, int side)
@ -363,7 +376,7 @@ public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable
}
@Override
public boolean isLeaves(World world, int x, int y, int z)
public boolean isLeaves(IBlockAccess world, int x, int y, int z)
{
return true;
}

View File

@ -18,6 +18,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.IShearable;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.BOPBlockHelper;
import cpw.mods.fml.common.Loader;
public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearable
@ -100,7 +101,8 @@ public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearab
}
@Override
public int getBlockColor()
//TODO: getBlockColor()
public int func_149635_D()
{
double temperature = 0.5D;
double humidity = 1.0D;
@ -108,7 +110,8 @@ public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearab
}
@Override
public int getRenderColor(int par1)
//TODO: getRenderColor()
public int func_149741_i(int par1)
{
switch (par1)
{
@ -124,7 +127,8 @@ public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearab
}
@Override
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
//TODO: colorMultiplier()
public int func_149720_d(IBlockAccess world, int x, int y, int z)
{
int var6 = 0;
int var7 = 0;
@ -134,7 +138,8 @@ public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearab
{
for (int var10 = -1; var10 <= 1; ++var10)
{
int var11 = par1IBlockAccess.getBiomeGenForCoords(par2 + var10, par4 + var9).getBiomeFoliageColor();
//TODO: getBiomeFoliageColor()
int var11 = world.getBiomeGenForCoords(x + var10, z + var9).func_150571_c(x + var10, y, z + var9);
var6 += (var11 & 16711680) >> 16;
var7 += (var11 & 65280) >> 8;
var8 += var11 & 255;
@ -335,14 +340,18 @@ public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearab
private void removeLeaves(World world, int x, int y, int z)
{
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
world.setBlockToAir(x, y, z);
//TODO: dropBlockAsItem
this.func_149697_b(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
//TODO: setBlockToAir
world.func_147468_f(x, y, z);
}
@Override
public int idDropped(int par1, Random par2Random, int par3)
{
return Blocks.colorizedSaplings.get().blockID;
//TODO: getItemDropped()
public Item func_149650_a(int metadata, Random random, int fortune)
{
//TODO: getItemFromBlock()
return Item.func_150898_a(BOPBlockHelper.get("colorizedSaplings"));
}
@Override
@ -353,14 +362,16 @@ public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearab
}
@Override
public int getDamageValue(World par1World, int par2, int par3, int par4)
//TODO: getDamageValue()
public int func_149643_k(World world, int x, int y, int z)
{
return getTypeFromMeta(par1World.getBlockMetadata(par2, par3, par4));
return getTypeFromMeta(world.getBlockMetadata(x, y, z));
}
@Override
public int quantityDropped(Random random)
{
//TODO: quantityDropped()
public int func_149745_a(Random random)
{
return random.nextInt(20) == 0 ? 1 : 0;
}

View File

@ -4,7 +4,7 @@ import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.BlockBush;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
@ -17,7 +17,7 @@ import biomesoplenty.BiomesOPlenty;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockBOPCoral extends BlockFlower
public class BlockBOPCoral extends BlockBush
{
private static final String[] coral = new String[] {"kelpbottom", "kelpmiddle", "kelptop", "kelpsingle", "pinkcoral", "orangecoral", "bluecoral", "glowcoral"};
private IIcon[] textures;
@ -30,7 +30,7 @@ public class BlockBOPCoral extends BlockFlower
this.func_149675_a(true);
float f = 0.4F;
//TODO: setBlockBounds
//TODO: setBlockBounds
this.func_149676_a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.8F, 0.5F + f);
//TODO: this.setCreativeTab()
@ -100,20 +100,20 @@ public class BlockBOPCoral extends BlockFlower
@Override
public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int side, ItemStack itemStack)
{
int id = world.getBlockId(x, y - 1, z);
int block = world.getBlockId(x, y - 1, z);
int meta = itemStack.getItemDamage();
if (itemStack.itemID == blockID) {
switch (meta)
{
case 1: // Kelp Middle
return id == blockID;
return block == blockID;
case 2: // Kelp Top
return id == blockID;
return block == blockID;
default:
return id == Block.dirt.blockID || id == Block.sand.blockID || id == Block.sponge.blockID || id == Block.stone.blockID || id == Block.blockClay.blockID;
return block == Block.dirt.blockID || block == Block.sand.blockID || block == Blocks.sponge || block == Block.stone || block == Block.blockClay.blockID;
}
} else
return this.canPlaceBlockOnSide(world, x, y, z, side);

View File

@ -4,6 +4,7 @@ import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBush;
import net.minecraft.block.BlockFlower;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
@ -24,7 +25,7 @@ import biomesoplenty.BiomesOPlenty;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockBOPFlower extends BlockFlower
public class BlockBOPFlower extends BlockBush
{
private static final String[] plants = new String[] {"clover", "swampflower", "deadbloom", "glowflower", "hydrangea", "cosmos", "daffodil", "wildflower", "violet", "anemone", "lilyflower", "rainbowflower", "bromeliad", "sunflowerbottom", "sunflowertop", "dandelion"};
private IIcon[] textures;
@ -35,14 +36,14 @@ public class BlockBOPFlower extends BlockFlower
protected BlockBOPFlower()
{
super(material);
//TODO: setTickRandomly()
this.func_149675_a(true);
float var4 = 0.2F;
//TODO: setBlockBounds
this.func_149676_a(0.5F - var4, 0.0F, 0.5F - var4, 0.5F + var4, var4 * 3.0F, 0.5F + var4);
//TODO: this.setCreativeTab()
this.func_149647_a(BiomesOPlenty.tabBiomesOPlenty);
}
@ -97,45 +98,45 @@ public class BlockBOPFlower extends BlockFlower
switch (meta)
{
case 0:
//TODO: setBlockBounds
this.func_149676_a0.0F, 0.0F, 0.0F, 1.0F, 0.015625F, 1.0F);
//TODO: setBlockBounds
this.func_149676_a(0.0F, 0.0F, 0.0F, 1.0F, 0.015625F, 1.0F);
break;
case 5:
//TODO: setBlockBounds
this.func_149676_a0.3F, 0.0F, 0.3F, 0.7F, 0.8F, 0.7F);
//TODO: setBlockBounds
this.func_149676_a(0.3F, 0.0F, 0.3F, 0.7F, 0.8F, 0.7F);
break;
case 6:
//TODO: setBlockBounds
this.func_149676_a0.3F, 0.0F, 0.3F, 0.7F, 0.6F, 0.7F);
//TODO: setBlockBounds
this.func_149676_a(0.3F, 0.0F, 0.3F, 0.7F, 0.6F, 0.7F);
break;
case 9:
//TODO: setBlockBounds
this.func_149676_a0.3F, 0.0F, 0.3F, 0.7F, 0.5F, 0.7F);
//TODO: setBlockBounds
this.func_149676_a(0.3F, 0.0F, 0.3F, 0.7F, 0.5F, 0.7F);
break;
case 10:
//TODO: setBlockBounds
this.func_149676_a0.3F, -0.97F, 0.3F, 0.7F, -0.7F, 0.7F);
//TODO: setBlockBounds
this.func_149676_a(0.3F, -0.97F, 0.3F, 0.7F, -0.7F, 0.7F);
// //TODO: setBlockBounds
this.func_149676_a0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F);
this.func_149676_a(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F);
break;
case 11:
//TODO: setBlockBounds
this.func_149676_a0.3F, 0.0F, 0.3F, 0.7F, 0.4F, 0.7F);
//TODO: setBlockBounds
this.func_149676_a(0.3F, 0.0F, 0.3F, 0.7F, 0.4F, 0.7F);
break;
case 15:
//TODO: setBlockBounds
this.func_149676_a0.3F, 0.0F, 0.3F, 0.7F, 0.6F, 0.7F);
//TODO: setBlockBounds
this.func_149676_a(0.3F, 0.0F, 0.3F, 0.7F, 0.6F, 0.7F);
break;
default:
//TODO: setBlockBounds
this.func_149676_a0.1F, 0.0F, 0.1F, 0.9F, 0.8F, 0.9F);
//TODO: setBlockBounds
this.func_149676_a(0.1F, 0.0F, 0.1F, 0.9F, 0.8F, 0.9F);
break;
}
}
@ -145,7 +146,7 @@ public class BlockBOPFlower extends BlockFlower
public void func_149670_a(World world, int x, int y, int z, Entity entity)
{
int meta = world.getBlockMetadata(x, y, z);
if (!world.isRemote && meta == 2 && entity instanceof EntityLivingBase)
{
if (entity instanceof EntityPlayer)
@ -169,9 +170,9 @@ public class BlockBOPFlower extends BlockFlower
public void func_149734_b(World world, int x, int y, int z, Random random)
{
super.randomDisplayTick(par1World, par2, par3, par4, par5Random);
int meta = par1World.getBlockMetadata(par2, par3, par4);
if (meta == 2)
{
if (par5Random.nextInt(4) != 0)
@ -208,7 +209,7 @@ public class BlockBOPFlower extends BlockFlower
protected boolean canThisPlantGrowOnThisBlockID(int id, int metadata)
{
if (metadata == 6) //Tulip
return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.tilledField.blockID || id == Blocks.holyGrass.get().blockID || id == Blocks.longGrass.get().blockID || id == Blocks.overgrownNetherrack.get().blockID;
return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.tilledField.blockID || id == Blocks.holyGrass.get().blockID || id == Blocks.longGrass.get().blockID || id == Blocks.overgrownNetherrack.get().blockID;
if (metadata == 10) //Lily Flower
return id == Block.waterlily.blockID;
if (metadata == 11) //Rainbow Flower
@ -258,9 +259,9 @@ public class BlockBOPFlower extends BlockFlower
public void func_149695_a(World world, int x, int y, int z, Block neighborBlock)
{
super.func_149695_a(world, x, y, z, neighborBlock);
this.checkFlowerChange(world, x, y, z);
if (world.getBlockMetadata(x, y, z) == SUNFLOWERTOP && world.getBlockId(x, y - 1, z) == blockID && world.getBlockMetadata(x, y - 1, z) != SUNFLOWERBOTTOM)
{
world.setBlockToAir(x, y, z);
@ -321,15 +322,15 @@ public class BlockBOPFlower extends BlockFlower
return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) && this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z), world.getBlockMetadata(x, y, z));
}
}
@Override
//TODO: harvestBlock()
public void func_149636_a(World world, EntityPlayer player, int x, int y, int z, int meta)
{
super.func_149636_a(world, player, x, y, z, meta);
ItemStack equippedItem = player.getCurrentEquippedItem();
if (equippedItem != null)
{
if (equippedItem.getItem() != Items.shears)
@ -359,7 +360,7 @@ public class BlockBOPFlower extends BlockFlower
public boolean isBlockReplaceable(World world, int x, int y, int z)
{
if (world.getBlockMetadata(x, y, z) == 10) return true;
return false;
}
}

View File

@ -97,7 +97,7 @@ public class BlockBOPFoliage extends BlockTallGrass implements IShearable
}
@Override
public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int meta, int fortune)
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();

View File

@ -16,12 +16,12 @@ import net.minecraft.world.World;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.BOPItemHelper;
public class BlockBOPAmethyst extends Block
public class BlockBOPGems extends Block
{
public static final String[] types = new String[] {"amethystore", "amethystblock", "rubyore", "rubyblock", "peridotore", "peridotblock", "topazore", "topazblock", "tanzaniteore", "tanzaniteblock", "malachiteore", "malachiteblock", "sapphireore", "sapphireblock"};
private IIcon[] textures;
public BlockBOPAmethyst()
public BlockBOPGems()
{
//TODO: Material.rock
super(Material.field_151576_e);

View File

@ -17,6 +17,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.BOPBlockHelper;
public class BlockBOPGrass extends Block
{
@ -24,7 +25,8 @@ public class BlockBOPGrass extends Block
public BlockBOPGrass()
{
super(Material.grass);
//TODO: Material.grass
super(Material.field_151577_b);
//TODO: setTickRandomly()
this.func_149675_a(true);
@ -85,18 +87,18 @@ public class BlockBOPGrass extends Block
}
@Override
public boolean isFireSource(IBlockAccess world, int x, int y, int z, ForgeDirection side)
public boolean isFireSource(World world, int x, int y, int z, ForgeDirection side)
{
int blockId = world.getBlockId(x, y, z);
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 0)
{
if (blockId == this.blockID && side == UP && world.provider.dimensionId == -1)
if (side == ForgeDirection.UP && world.provider.dimensionId == -1)
return true;
}
else if (metadata == 1) return true;
return super.isFireSource(world, x, y, z, metadata, side);
return super.isFireSource(world, x, y, z, side);
}
@Override
@ -107,12 +109,12 @@ public class BlockBOPGrass extends Block
{
if (world.provider.isHellWorld)
{
world.playSound(par2, par3, par4, "mob.ghast.death", 20.0F, 0.95F + (float)Math.random() * 0.1F, true);
world.playSound(x, y, z, "mob.ghast.death", 20.0F, 0.95F + (float)Math.random() * 0.1F, true);
for (int l = 0; l < 8; ++l)
{
world.spawnParticle("flame", par2 + Math.random(), par3 + Math.random(), par4 + Math.random(), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", par2 + Math.random(), par3 + Math.random(), par4 + Math.random(), 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", x + Math.random(), y + Math.random(), z + Math.random(), 0.0D, 0.0D, 0.0D);
world.spawnParticle("smoke", x + Math.random(), y + Math.random(), z + Math.random(), 0.0D, 0.0D, 0.0D);
}
}
}
@ -149,28 +151,34 @@ public class BlockBOPGrass extends Block
{
if (world.provider.isHellWorld)
{
world.setBlock(x, y + 1, z, Block.fire.blockID);
world.setBlock(x, y, z, Blocks.holyGrass.get().blockID, 1, 2);
//TODO: setBlock()
world.func_147465_d(x, y + 1, z, Blocks.fire, 0, 2);
//TODO: setBlock()
world.func_147465_d(x, y, z, this, 1, 2);
}
if (!world.isRemote)
{
if (world.getBlockLightValue(x, y + 1, z) < 4 && Block.lightOpacity[world.getBlockId(x, y + 1, z)] > 2)
if (world.getBlockLightValue(x, y + 1, z) < 4 && world.getBlockLightOpacity(x, y + 1, z) > 2)
{
world.setBlock(x, y, z, Blocks.holyDirt.get().blockID);
//TODO: setBlock()
world.func_147465_d(x, y, z, BOPBlockHelper.get("holyDirt"), 0, 2);
}
else if (world.getBlockLightValue(x, y + 1, z) >= 9)
{
for (int var6 = 0; var6 < 4; ++var6)
{
int var7 = x + random.nextInt(3) - 1;
int var8 = y + random.nextInt(5) - 3;
int var9 = z + random.nextInt(3) - 1;
int var10 = world.getBlockId(var7, var8 + 1, var9);
int rX = x + random.nextInt(3) - 1;
int rY = y + random.nextInt(5) - 3;
int rZ = z + random.nextInt(3) - 1;
//TODO: getBlock()
Block block = world.func_147439_a(rX, rY + 1, rZ);
if (world.getBlockId(var7, var8, var9) == Blocks.holyDirt.get().blockID && world.getBlockLightValue(var7, var8 + 1, var9) >= 4 && Block.lightOpacity[var10] <= 2)
//TODO: getBlock()
if (world.func_147439_a(rX, rY, rZ) == BOPBlockHelper.get("holyDirt") && world.getBlockLightValue(rX, rY + 1, rZ) >= 4 && world.getBlockLightOpacity(rX, rY + 1, rZ) <= 2)
{
world.setBlock(var7, var8, var9, Blocks.holyGrass.get().blockID, 0, 2);
//TODO: setBlock()
world.func_147465_d(rX, rY, rZ, BOPBlockHelper.get("holyGrass"), 0, 2);
}
}
}
@ -205,7 +213,8 @@ public class BlockBOPGrass extends Block
//TODO: getItemDropped()
public Item func_149650_a(int metadata, Random random, int fortune)
{
return metadata == 0 ? Blocks.holyDirt.get().blockID : Blocks.dirt
//TODO: getItemFromBlock() getItemFromBlock()
return metadata == 0 ? Item.func_150898_a(BOPBlockHelper.get("holyDirt")) : Item.func_150898_a(Blocks.dirt);
}
}

View File

@ -11,6 +11,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@ -18,138 +19,149 @@ import net.minecraft.world.World;
import net.minecraftforge.common.IShearable;
import net.minecraftforge.common.util.ForgeDirection;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.BOPBlockHelper;
import biomesoplenty.api.BOPItemHelper;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockBOPLeaves extends BlockLeavesBase implements IShearable
{
public static enum LeafCategory
{
CAT1, CAT2, CAT3, CAT4;
}
public static enum LeafCategory
{
CAT1, CAT2, CAT3, CAT4;
}
//leaves1
//Yellow Autumn (0)
//Bamboo (1)
//Magic (2)
//Dark (3)
//leaves2
//Dead (0)
//Fir (1)
//Loftwood (2)
//Orange Autumn (3)
//leaves3
//Origin (0)
//Pink Cherry (1)
//Maple (2)
//White Cherry (3)
//leaves4
//Hellbark (0)
//Jacaranda (1)
private static final String[] leaves = new String[] {"yellowautumn", "bamboo", "magic", "dark", "dead", "fir", "holy", "orangeautumn", "origin", "pinkcherry", "maple", "whitecherry", "hellbark", "jacaranda"};
//leaves1
//Yellow Autumn (0)
//Bamboo (1)
//Magic (2)
//Dark (3)
private static final float[] fallingLeavesChance = new float[] {0.1F, 0.008F, 0.016F, 0.008F, 0.0F, 0.008F, 0.016F, 0.1F, 0.008F, 0.1F, 0.008F, 0.1F, 0.008F, 0.008F};
//leaves2
//Dead (0)
//Fir (1)
//Loftwood (2)
//Orange Autumn (3)
private IIcon[][] textures;
private final LeafCategory category;
int[] adjacentTreeBlocks;
//leaves3
//Origin (0)
//Pink Cherry (1)
//Maple (2)
//White Cherry (3)
public BlockBOPLeaves(LeafCategory cat)
{
super(Material.leaves, false);
category = cat;
//TODO: setTickRandomly()
//leaves4
//Hellbark (0)
//Jacaranda (1)
private static final String[] leaves = new String[] {"yellowautumn", "bamboo", "magic", "dark", "dead", "fir", "holy", "orangeautumn", "origin", "pinkcherry", "maple", "whitecherry", "hellbark", "jacaranda"};
private static final float[] fallingLeavesChance = new float[] {0.1F, 0.008F, 0.016F, 0.008F, 0.0F, 0.008F, 0.016F, 0.1F, 0.008F, 0.1F, 0.008F, 0.1F, 0.008F, 0.008F};
private IIcon[][] textures;
private final LeafCategory category;
int[] adjacentTreeBlocks;
public BlockBOPLeaves(LeafCategory cat)
{
//TODO: Material.leaves
super(Material.field_151584_j, false);
category = cat;
//TODO: setTickRandomly()
this.func_149675_a(true);
//TODO: this.setHardness
//TODO: this.setHardness
this.func_149711_c(0.2F);
setLightOpacity(1);
setStepSound(Block.soundGrassFootstep);
//TODO setStepSound(Block.soundGrassFootstep)
this.func_149672_a(Block.field_149779_h);
//TODO: this.setCreativeTab()
this.func_149647_a(BiomesOPlenty.tabBiomesOPlenty);
}
}
@Override
public void registerIcons(IIconRegister iconRegister)
{
textures = new IIcon[3][leaves.length];
if(Loader.isModLoaded("BetterGrassAndLeavesMod"))
for (int i = 0; i < leaves.length; ++i)
{
textures[0][i] = iconRegister.registerIcon("biomesoplenty:leaves_" + leaves[i] + "_round");
textures[1][i] = iconRegister.registerIcon("biomesoplenty:leaves_" + leaves[i] + "_fast");
textures[2][i] = iconRegister.registerIcon("biomesoplenty:better_leaves_" + leaves[i]);
}
else
for (int i = 0; i < leaves.length; ++i)
{
textures[0][i] = iconRegister.registerIcon("biomesoplenty:leaves_" + leaves[i] + "_fancy");
textures[1][i] = iconRegister.registerIcon("biomesoplenty:leaves_" + leaves[i] + "_fast");
}
}
@Override
//TODO: registerIcons()
public void func_149651_a(IIconRegister iconRegister)
{
textures = new IIcon[3][leaves.length];
if(Loader.isModLoaded("BetterGrassAndLeavesMod"))
for (int i = 0; i < leaves.length; ++i)
{
textures[0][i] = iconRegister.registerIcon("biomesoplenty:leaves_" + leaves[i] + "_round");
textures[1][i] = iconRegister.registerIcon("biomesoplenty:leaves_" + leaves[i] + "_fast");
textures[2][i] = iconRegister.registerIcon("biomesoplenty:better_leaves_" + leaves[i]);
}
else
for (int i = 0; i < leaves.length; ++i)
{
textures[0][i] = iconRegister.registerIcon("biomesoplenty:leaves_" + leaves[i] + "_fancy");
textures[1][i] = iconRegister.registerIcon("biomesoplenty:leaves_" + leaves[i] + "_fast");
}
}
public IIcon getIconBetterLeaves(int metadata, float randomIndex)
{
int type = getTypeFromMeta(metadata) + (category.ordinal() * 4);
return textures[2][type >= leaves.length ? 0 : type];
}
public IIcon getIconBetterLeaves(int metadata, float randomIndex)
{
int type = getTypeFromMeta(metadata) + (category.ordinal() * 4);
return textures[2][type >= leaves.length ? 0 : type];
}
public IIcon getIconFallingLeaves(int metadata)
{
int type = getTypeFromMeta(metadata) + (category.ordinal() * 4);
return textures[1][type >= leaves.length ? 0 : type];
}
public IIcon getIconFallingLeaves(int metadata)
{
int type = getTypeFromMeta(metadata) + (category.ordinal() * 4);
return textures[1][type >= leaves.length ? 0 : type];
}
public float getSpawnChanceFallingLeaves(int metadata)
{
int type = getTypeFromMeta(metadata) + (category.ordinal() * 4);
return fallingLeavesChance[type >= leaves.length ? 0 : type];
}
public float getSpawnChanceFallingLeaves(int metadata)
{
int type = getTypeFromMeta(metadata) + (category.ordinal() * 4);
return fallingLeavesChance[type >= leaves.length ? 0 : type];
}
@Override
public IIcon getIcon(int side, int metadata)
{
int type = getTypeFromMeta(metadata) + (category.ordinal() * 4);
return textures[(!isOpaqueCube() ? 0 : 1)][type >= leaves.length ? 0 : type];
}
@Override
//TODO: getIcon()
public IIcon func_149691_a(int side, int metadata)
{
int type = getTypeFromMeta(metadata) + (category.ordinal() * 4);
//TODO: isOpaqueCube()
return textures[(!func_149662_c() ? 0 : 1)][type >= leaves.length ? 0 : type];
}
@Override
public boolean isOpaqueCube()
{
return Block.leaves.isOpaqueCube();
}
@Override
//TODO: isOpaqueCube()
public boolean func_149662_c()
{
//TODO: isOpaqueCube()
return Blocks.leaves.func_149662_c();
}
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public void getSubBlocks(int blockID, CreativeTabs creativeTabs, List list)
{
for (int i = 0; i < 4; ++i)
{
if (category != LeafCategory.CAT4 || i < 2)
{
list.add(new ItemStack(blockID, 1, i));
}
}
}
@Override
//TODO: getSubBlocks()
public void func_149666_a(Item block, CreativeTabs creativeTabs, List list)
{
for (int i = 0; i < 4; ++i)
{
if (category != LeafCategory.CAT4 || i < 2)
{
list.add(new ItemStack(block, 1, i));
}
}
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random random)
{
if (world.canLightningStrikeAt(x, y + 1, z) && !world.doesBlockHaveSolidTopSurface(x, y - 1, z) && random.nextInt(15) == 1)
{
double d0 = x + random.nextFloat();
double d1 = y - 0.05D;
double d2 = z + random.nextFloat();
world.spawnParticle("dripWater", d0, d1, d2, 0.0D, 0.0D, 0.0D);
}
if (world.getBlockId(x, y, z) == Blocks.leaves1.get().blockID && world.getBlockMetadata(x, y, z) == 2)
@Override
//TODO: randomDisplayTick()
public void func_149734_b(World world, int x, int y, int z, Random random)
{
//TODO: doesBlockHaveSolidTopSurface
if (world.canLightningStrikeAt(x, y + 1, z) && !World.func_147466_a(world, x, y - 1, z) && random.nextInt(15) == 1)
{
double d0 = x + random.nextFloat();
double d1 = y - 0.05D;
double d2 = z + random.nextFloat();
world.spawnParticle("dripWater", d0, d1, d2, 0.0D, 0.0D, 0.0D);
}
/*TODO: FEATURE if (world.getBlockId(x, y, z) == Blocks.leaves1.get().blockID && world.getBlockMetadata(x, y, z) == 2)
{
if (!(world.getBlockId(x, y - 1, z) == Blocks.leaves1.get().blockID && world.getBlockMetadata(x, y - 1, z) == 2))
{
@ -158,11 +170,11 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable
BiomesOPlenty.proxy.spawnParticle("magictree", x + random.nextFloat(), y + 0.9F, z + random.nextFloat());
}
}
}
}*/
super.randomDisplayTick(world, x, y, z, random);
}
//TODO: randomDisplayTick()
super.func_149734_b(world, x, y, z, random);
}
@Override
//TODO: breakBlock()
@ -171,268 +183,291 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable
byte radius = 1;
int bounds = radius + 1;
if (world.checkChunksExist(x - bounds, y - bounds, z - bounds, x + bounds, y + bounds, z + bounds)) {
for (int i = -radius; i <= radius; ++i) {
for (int j = -radius; j <= radius; ++j) {
if (world.checkChunksExist(x - bounds, y - bounds, z - bounds, x + bounds, y + bounds, z + bounds))
{
for (int i = -radius; i <= radius; ++i)
{
for (int j = -radius; j <= radius; ++j)
{
for (int k = -radius; k <= radius; ++k)
{
int blockID = world.getBlockId(x + i, y + j, z + k);
//TODO: getBlock()
Block block = world.func_147439_a(x + i, y + j, z + k);
if (Block.blocksList[blockID] != null) {
Block.blocksList[blockID].beginLeavesDecay(world, x + i, y + j, z + k);
}
if (block.isLeaves(world, x, y, z))
{
block.beginLeavesDecay(world, x + i, y + j, z + k);
}
}
}
}
}
}
@Override
public void //TODO: updateTick()
public void func_149674_a(World world, int x, int y, int z, Random random)(World world, int x, int y, int z, Random random)
{
if (world.isRemote)
return;
@Override
//TODO: updateTick()
public void func_149674_a(World world, int x, int y, int z, Random random)
{
if (world.isRemote)
return;
int meta = world.getBlockMetadata(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
if ((meta & 8) != 0 && (meta & 4) == 0)
{
byte b0 = 4;
int i1 = b0 + 1;
byte b1 = 32;
int j1 = b1 * b1;
int k1 = b1 / 2;
if ((meta & 8) != 0 && (meta & 4) == 0)
{
byte b0 = 4;
int i1 = b0 + 1;
byte b1 = 32;
int j1 = b1 * b1;
int k1 = b1 / 2;
if (adjacentTreeBlocks == null)
{
adjacentTreeBlocks = new int[b1 * b1 * b1];
}
if (adjacentTreeBlocks == null)
{
adjacentTreeBlocks = new int[b1 * b1 * b1];
}
int l1;
int l1;
if (world.checkChunksExist(x - i1, y - i1, z - i1, x + i1, y + i1, z + i1))
{
int i2;
int j2;
int k2;
if (world.checkChunksExist(x - i1, y - i1, z - i1, x + i1, y + i1, z + i1))
{
int i2;
int j2;
int k2;
for (l1 = -b0; l1 <= b0; ++l1)
{
for (i2 = -b0; i2 <= b0; ++i2)
{
for (j2 = -b0; j2 <= b0; ++j2)
{
k2 = world.getBlockId(x + l1, y + i2, z + j2);
for (l1 = -b0; l1 <= b0; ++l1)
{
for (i2 = -b0; i2 <= b0; ++i2)
{
for (j2 = -b0; j2 <= b0; ++j2)
{
//TODO: world.getBlock()
Block block = world.func_147439_a(x + l1, y + i2, z + j2);
Block block = Block.blocksList[k2];
if (block != null && block.canSustainLeaves(world, x + l1, y + i2, z + j2))
{
adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
}
else if (block != null && block.isLeaves(world, x + l1, y + i2, z + j2))
{
adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
}
else
{
adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
}
}
}
}
if (block != null && block.canSustainLeaves(world, x + l1, y + i2, z + j2))
{
adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
}
else if (block != null && block.isLeaves(world, x + l1, y + i2, z + j2))
{
adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
}
else
{
adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
}
}
}
}
for (l1 = 1; l1 <= 4; ++l1)
{
for (i2 = -b0; i2 <= b0; ++i2)
{
for (j2 = -b0; j2 <= b0; ++j2)
{
for (k2 = -b0; k2 <= b0; ++k2)
{
if (adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1)
{
if (adjacentTreeBlocks[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2)
{
adjacentTreeBlocks[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
}
for (l1 = 1; l1 <= 4; ++l1)
{
for (i2 = -b0; i2 <= b0; ++i2)
{
for (j2 = -b0; j2 <= b0; ++j2)
{
for (k2 = -b0; k2 <= b0; ++k2)
{
if (adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1)
{
if (adjacentTreeBlocks[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2)
{
adjacentTreeBlocks[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
}
if (adjacentTreeBlocks[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2)
{
adjacentTreeBlocks[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
}
if (adjacentTreeBlocks[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2)
{
adjacentTreeBlocks[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
}
if (adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2)
{
adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1;
}
if (adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2)
{
adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1;
}
if (adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2)
{
adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1;
}
if (adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2)
{
adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1;
}
if (adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2)
{
adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1;
}
if (adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2)
{
adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1;
}
if (adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2)
{
adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
}
}
}
}
}
}
}
if (adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2)
{
adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
}
}
}
}
}
}
}
l1 = adjacentTreeBlocks[k1 * j1 + k1 * b1 + k1];
l1 = adjacentTreeBlocks[k1 * j1 + k1 * b1 + k1];
if (l1 >= 0)
{
world.setBlockMetadataWithNotify(x, y, z, meta & -9, 4);
}
else
{
this.removeLeaves(world, x, y, z);
}
}
}
if (l1 >= 0)
{
world.setBlockMetadataWithNotify(x, y, z, meta & -9, 4);
}
else
{
this.removeLeaves(world, x, y, z);
}
}
}
private void removeLeaves(World world, int x, int y, int z)
{
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
world.setBlockToAir(x, y, z);
//TODO: dropBlockAsItem
this.func_149697_b(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
//TODO: setBlockToAir
world.func_147468_f(x, y, z);
}
@Override
public int getFlammability(IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face)
{
if (category == LeafCategory.CAT4 && metadata == 0)
return 0;
else
{
super.setBurnProperties(blockID, 30, 60);
return blockFlammability[blockID];
}
}
@Override
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face)
{
int metadata = world.getBlockMetadata(x, y, z);
if (category == LeafCategory.CAT4 && metadata == 0)
{
return 0;
}
else
{
return Blocks.fire.getFlammability(this);
}
}
@Override
public int getFireSpreadSpeed(World world, int x, int y, int z, int metadata, ForgeDirection face)
{
if (category == LeafCategory.CAT4 && metadata == 0)
return 0;
else
return blockFireSpreadSpeed[blockID];
}
@Override
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face)
{
int metadata = world.getBlockMetadata(x, y, z);
if (category == LeafCategory.CAT4 && metadata == 0)
{
return 0;
}
else
{
return Blocks.fire.getEncouragement(this);
}
}
@Override
public boolean isFlammable(IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face)
{
if (category == LeafCategory.CAT4 && metadata == 0)
return false;
else
return getFlammability(world, x, y, z, metadata, face) > 0;
}
@Override
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face)
{
int metadata = world.getBlockMetadata(x, y, z);
if (category == LeafCategory.CAT4 && metadata == 0)
{
return false;
}
else
{
return getFlammability(world, x, y, z, face) > 0;
}
}
@Override
public int idDropped(int par1, Random par2Random, int par3)
{
return Blocks.saplings.get().blockID;
//TODO: getItemDropped()
public Item func_149650_a(int metadata, Random random, int fortune)
{
//TODO: getItemFromBlock()
return Item.func_150898_a(BOPBlockHelper.get("saplings"));
}
@Override
@Override
//TODO: dropBlockAsItemWithChance()
public void func_149690_a(World world, int x, int y, int z, int metadata, float chance, int fortune)
{
if (world.isRemote)
return;
{
if (world.isRemote)
return;
if (world.rand.nextInt(20) == 0)
{
int var9 = this.idDropped(meta, world.rand, par7);
this.dropBlockAsItem_do(world, x, y, z, new ItemStack(var9, 1, this.damageDropped(meta)));
}
if (world.rand.nextInt(20) == 0)
{
//TODO: getItemDropped()
Item item = this.func_149650_a(metadata, world.rand, fortune);
//TODO:dropBlockAsItem_do damageDropped()
this.func_149642_a(world, x, y, z, new ItemStack(item, 1, this.func_149692_a(metadata)));
}
if (((meta & 3) == 0 || (meta & 3) == 4 || (meta & 3) == 7) && (world.rand.nextInt(50) == 0)) {
this.dropBlockAsItem_do(world, x, y, z, new ItemStack(Items.food.get(), 1, 8));
}
}
if (((metadata & 3) == 0 || (metadata & 3) == 4 || (metadata & 3) == 7) && (world.rand.nextInt(50) == 0))
{
//TODO:dropBlockAsItem_do
this.func_149642_a(world, x, y, z, new ItemStack(BOPItemHelper.get("food"), 1, 8));
}
}
@Override
@Override
//TODO damageDropped()
public int func_149692_a(int meta)
{
return (getTypeFromMeta(meta) + category.ordinal() * 4) + 1;
}
{
return (getTypeFromMeta(meta) + category.ordinal() * 4) + 1;
}
@Override
public int getDamageValue(World par1World, int par2, int par3, int par4)
@Override
//TODO: getDamageValue()
public int func_149643_k(World world, int x, int y, int z)
{
return getTypeFromMeta(par1World.getBlockMetadata(par2, par3, par4));
}
return getTypeFromMeta(world.getBlockMetadata(x, y, z));
}
@Override
public int quantityDropped(Random random)
{
return random.nextInt(20) == 0 ? 1 : 0;
}
@Override
//TODO: quantityDropped()
public int func_149745_a(Random random)
{
return random.nextInt(20) == 0 ? 1 : 0;
}
@Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
@Override
public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, getTypeFromMeta(world.getBlockMetadata(x, y, z))));
return ret;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, getTypeFromMeta(world.getBlockMetadata(x, y, z))));
return ret;
}
public String getLeafType(int metadata)
{
int type = getTypeFromMeta(metadata) + (category.ordinal() * 4);
return leaves[type >= leaves.length ? 0 : type];
}
public String getLeafType(int metadata)
{
int type = getTypeFromMeta(metadata) + (category.ordinal() * 4);
return leaves[type >= leaves.length ? 0 : type];
}
private static int getTypeFromMeta(int meta)
{
meta = meta & 3;
if (meta < 0 || meta >= leaves.length) {
meta = 0;
}
return meta;
}
private static int getTypeFromMeta(int meta)
{
meta = meta & 3;
if (meta < 0 || meta >= leaves.length) {
meta = 0;
}
return meta;
}
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1)
{
graphicsLevel = par1;
}
@Override
@Override
//TODO shouldSideBeRendered
public boolean func_149646_a(IBlockAccess world, int x, int y, int z, int side)
{
return true;
}
public boolean func_149646_a(IBlockAccess world, int x, int y, int z, int side)
{
return true;
}
@Override
public void beginLeavesDecay(World world, int x, int y, int z)
{
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) | 8, 4);
}
@Override
public void beginLeavesDecay(World world, int x, int y, int z)
{
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) | 8, 4);
}
@Override
public boolean isLeaves(World world, int x, int y, int z)
{
return true;
}
@Override
public boolean isLeaves(IBlockAccess world, int x, int y, int z)
{
return true;
}
}

View File

@ -3,7 +3,7 @@ package biomesoplenty.common.blocks;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.BlockBush;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
@ -13,17 +13,15 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import biomesoplenty.BiomesOPlenty;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockBOPMushroom extends BlockFlower
public class BlockBOPMushroom extends BlockBush
{
private static final String[] plants = new String[] {"toadstool", "portobello", "bluemilk", "glowshroom", "flatmushroom"};
private IIcon[] textures;
protected BlockBOPMushroom()
{
super(bmaterial);
super(0);
//TODO: setTickRandomly()
this.func_149675_a(true);
@ -126,30 +124,25 @@ public class BlockBOPMushroom extends BlockFlower
{
int id = world.getBlockId(x, y - 1, z);
int meta = itemStack.getItemDamage();
//boolean sky = world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z);
if (itemStack.itemID == blockID)
switch (meta)
{
switch (meta)
{
case 0: // Toadstool
return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.mycelium.blockID || id == Blocks.holyGrass.get().blockID || id == Block.netherrack.blockID || id == Blocks.overgrownNetherrack.get().blockID;
case 0: // Toadstool
return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.mycelium.blockID || id == Blocks.holyGrass.get().blockID || id == Block.netherrack.blockID || id == Blocks.overgrownNetherrack.get().blockID;
case 1: // Portobello
return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.mycelium.blockID || id == Blocks.holyGrass.get().blockID;
case 1: // Portobello
return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.mycelium.blockID || id == Blocks.holyGrass.get().blockID;
case 2: // Blue Milk Cap
return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.mycelium.blockID || id == Blocks.holyGrass.get().blockID;
case 2: // Blue Milk Cap
return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.mycelium.blockID || id == Blocks.holyGrass.get().blockID;
case 3: // Glowshroom
return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.mycelium.blockID || id == Block.stone.blockID || id == Block.netherrack.blockID || id == Blocks.overgrownNetherrack.get().blockID;
case 3: // Glowshroom
return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.mycelium.blockID || id == Block.stone.blockID || id == Block.netherrack.blockID || id == Blocks.overgrownNetherrack.get().blockID;
default:
return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.mycelium.blockID || id == Blocks.overgrownNetherrack.get().blockID;
}
} else
return this.canPlaceBlockOnSide(world, x, y, z, side);
}
default:
return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.mycelium.blockID || id == Blocks.overgrownNetherrack.get().blockID;
}
}
@Override
//TODO: canBlockStay()

View File

@ -21,6 +21,8 @@ import net.minecraft.world.World;
import net.minecraftforge.common.IShearable;
import net.minecraftforge.common.util.FakePlayer;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.BOPBlockHelper;
import biomesoplenty.api.BOPItemHelper;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -36,8 +38,8 @@ public class BlockBOPPersimmonLeaves extends BlockLeavesBase implements IShearab
//TODO: Material.leaves
super(Material.field_151584_j, false);
setBurnProperties(this.blockID, 30, 60);
//TODO: setBurnProperties() getIdFromBlock()
Blocks.fire.func_149842_a(func_149682_b(this), 30, 60);
//TODO: setTickRandomly()
this.func_149675_a(true);
//TODO: this.setHardness
@ -150,7 +152,7 @@ public class BlockBOPPersimmonLeaves extends BlockLeavesBase implements IShearab
@Override
//TODO: updateTick()
public void func_149674_a(World world, int x, int y, int z, Random random)(World world, int x, int y, int z, Random random)
public void func_149674_a(World world, int x, int y, int z, Random random)
{
if (world.isRemote)
return;
@ -158,8 +160,10 @@ public class BlockBOPPersimmonLeaves extends BlockLeavesBase implements IShearab
int meta = world.getBlockMetadata(x, y, z);
if (random.nextInt(25) == 0)
if (meta > 0)
if ((meta & 3) < 3) {
world.setBlock(x, y, z, blockID, ++meta, 3);
if ((meta & 3) < 3)
{
//TODO: setBlock()
world.func_147465_d(x, y, z, this, ++meta, 3);
}
if ((meta & 8) != 0/* && (meta & 4) == 0*/)
@ -189,9 +193,8 @@ public class BlockBOPPersimmonLeaves extends BlockLeavesBase implements IShearab
{
for (j2 = -b0; j2 <= b0; ++j2)
{
k2 = world.getBlockId(x + l1, y + i2, z + j2);
Block block = Block.blocksList[k2];
//TODO: world.getBlock()
Block block = world.func_147439_a(x + l1, y + i2, z + j2);
if (block != null && block.canSustainLeaves(world, x + l1, y + i2, z + j2))
{
@ -268,20 +271,24 @@ public class BlockBOPPersimmonLeaves extends BlockLeavesBase implements IShearab
}
}
private void removeLeaves(World world, int x, int y, int z)
{
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
world.setBlockToAir(x, y, z);
}
private void removeLeaves(World world, int x, int y, int z)
{
//TODO: dropBlockAsItem
this.func_149697_b(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
//TODO: setBlockToAir
world.func_147468_f(x, y, z);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
//TODO: onBlockActivated
public boolean func_149727_a(World world, int x, int y, int z, EntityPlayer player, int side, float hitVecX, float hitVecY, float hitVecZ)
{
int meta = world.getBlockMetadata(x, y, z);
if ((meta & 3) == 3)
{
world.setBlock(x, y, z, blockID, meta - 3, 3);
EntityItem entityitem = new EntityItem(world, x, y, z, new ItemStack(Items.food.get(), 1, 8));
//TODO: setBlock
world.func_147465_d(x, y, z, this, meta - 3, 3);
EntityItem entityitem = new EntityItem(world, x, y, z, new ItemStack(BOPItemHelper.get("food"), 1, 8));
if (!world.isRemote)
{
@ -299,7 +306,7 @@ public class BlockBOPPersimmonLeaves extends BlockLeavesBase implements IShearab
//TODO: getItemDropped()
public Item func_149650_a(int metadata, Random random, int fortune)
{
return Blocks.saplings.get().blockID;
return Item.func_150898_a(BOPBlockHelper.get("saplings"));
}
@Override
@ -325,19 +332,20 @@ public class BlockBOPPersimmonLeaves extends BlockLeavesBase implements IShearab
if (world.rand.nextInt(20) == 0)
{
int var9 = this.idDropped(meta, world.rand, par7);
this.dropBlockAsItem_do(world, x, y, z, new ItemStack(var9, 1, this.damageDropped(meta)));
//TODO: getItemDropped()
Item item = this.func_149650_a(metadata, world.rand, fortune);
//TODO:dropBlockAsItem_do damageDropped()
this.func_149642_a(world, x, y, z, new ItemStack(item, 1, this.func_149692_a(metadata)));
}
if ((meta & 3) == 3) {
this.dropBlockAsItem_do(world, x, y, z, new ItemStack(Items.food.get(), 1, 8));
} else if ((meta & 3) == 2 && world.rand.nextInt(8) == 0) {
this.dropBlockAsItem_do(world, x, y, z, new ItemStack(Items.food.get(), 1, 8));
} else if ((meta & 3) == 1 && world.rand.nextInt(16) == 0) {
this.dropBlockAsItem_do(world, x, y, z, new ItemStack(Items.food.get(), 1, 8));
} else if ((meta & 3) == 0 && world.rand.nextInt(32) == 0) {
this.dropBlockAsItem_do(world, x, y, z, new ItemStack(Items.food.get(), 1, 8));
}
//TODO: dropBlockAsItem_do
if ((metadata & 3) == 3) this.func_149642_a(world, x, y, z, new ItemStack(BOPItemHelper.get("food"), 1, 8));
//TODO: dropBlockAsItem_do
else if ((metadata & 3) == 2 && world.rand.nextInt(8) == 0) this.func_149642_a(world, x, y, z, new ItemStack(BOPItemHelper.get("food"), 1, 8));
//TODO: dropBlockAsItem_do
else if ((metadata & 3) == 1 && world.rand.nextInt(16) == 0) this.func_149642_a(world, x, y, z, new ItemStack(BOPItemHelper.get("food"), 1, 8));
//TODO: dropBlockAsItem_do
else if ((metadata & 3) == 0 && world.rand.nextInt(32) == 0) this.func_149642_a(world, x, y, z, new ItemStack(BOPItemHelper.get("food"), 1, 8));
}
@Override

View File

@ -25,6 +25,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.IShearable;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.client.render.blocks.RenderUtils;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -162,60 +163,59 @@ public class BlockBOPPlant extends BlockFlower implements IShearable
}
@Override
public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int side, ItemStack itemStack)
//TODO: canPlaceBlockOnSide
public boolean func_149707_d(World world, int x, int y, int z, int side)
{
int id = world.getBlockId(x, y - 1, z);
int idRoot = world.getBlockId(x, y + 1, z);
int meta = itemStack.getItemDamage();
Block block = world.getBlockId(x, y - 1, z);
int meta = world.getBlockMetadata(x, y - 1, z);
int root = world.getBlockId(x, y + 1, z);
if (itemStack.itemID == blockID) {
switch (meta)
{
case 0: // Dead Grass
return id == Blocks.driedDirt.get().blockID || id == Block.sand.blockID;
return block == Blocks.driedDirt.get().blockID || block == Block.sand.blockID;
case 1: // Desert Grass
return id == Blocks.redRock.get().blockID;
return block == Blocks.redRock.get().blockID;
case 2: // Desert Sprouts
case 3: // Dune Grass
return id == Block.sand.blockID;
return block == Block.sand.blockID;
case 4: // Holy Tall Grass
return id == Blocks.holyGrass.get().blockID;
return block == Blocks.holyGrass.get().blockID;
case 5: // Thorns
return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.slowSand.blockID;
return block == Block.grass.blockID || block == Block.dirt.blockID || block == Block.slowSand.blockID;
case 6: // Barley
return id == Block.grass.blockID || id == Block.dirt.blockID;
return block == Block.grass.blockID || block == Block.dirt.blockID;
case 7: // Cattail
return id != Block.grass.blockID ? false : (world.getBlockMaterial(x - 1, y - 1, z) == Material.water ? true : (world.getBlockMaterial(x + 1, y - 1, z) == Material.water ? true : (world.getBlockMaterial(x, y - 1, z - 1) == Material.water ? true : world.getBlockMaterial(x, y - 1, z + 1) == Material.water)));
return block != Block.grass.blockID ? false : (world.getBlockMaterial(x - 1, y - 1, z) == Material.water ? true : (world.getBlockMaterial(x + 1, y - 1, z) == Material.water ? true : (world.getBlockMaterial(x, y - 1, z - 1) == Material.water ? true : world.getBlockMaterial(x, y - 1, z + 1) == Material.water)));
case 8: // River Cane
return id == blockID || id == Block.grass.blockID;
return block == blockID || block == Block.grass.blockID;
case 10: // High Cattail Bottom
return id != Block.grass.blockID ? false : (world.getBlockMaterial(x - 1, y - 1, z) == Material.water ? true : (world.getBlockMaterial(x + 1, y - 1, z) == Material.water ? true : (world.getBlockMaterial(x, y - 1, z - 1) == Material.water ? true : world.getBlockMaterial(x, y - 1, z + 1) == Material.water)));
return block != Block.grass.blockID ? false : (world.getBlockMaterial(x - 1, y - 1, z) == Material.water ? true : (world.getBlockMaterial(x + 1, y - 1, z) == Material.water ? true : (world.getBlockMaterial(x, y - 1, z - 1) == Material.water ? true : world.getBlockMaterial(x, y - 1, z + 1) == Material.water)));
case 12: // Tiny Cactus
return id == Block.sand.blockID || id == Blocks.redRock.get().blockID || id == Block.slowSand.blockID;
return block == Block.sand.blockID || block == Blocks.redRock.get().blockID || block == Block.slowSand.blockID;
case 13: // Wither Wart
return id == Block.slowSand.blockID;
return block == Block.slowSand.blockID;
case 14: // Reed
return id == Block.waterStill.blockID;
return block == Blocks.water;
case 15: // Reed
return idRoot == Block.grass.blockID || idRoot == Block.dirt.blockID || idRoot == Block.tilledField.blockID || idRoot == Blocks.longGrass.get().blockID || idRoot == Blocks.holyGrass.get().blockID || idRoot == Blocks.holyDirt.get().blockID;
return root == Block.grass.blockID || root == Block.dirt.blockID || root == Block.tilledField.blockID || root == Blocks.longGrass.get().blockID || root == Blocks.holyGrass.get().blockID || root == Blocks.holyDirt.get().blockID;
default:
return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.tilledField.blockID || id == Blocks.overgrownNetherrack.get().blockID;
return block == Block.grass.blockID || block == Block.dirt.blockID || block == Block.tilledField.blockID || block == Blocks.overgrownNetherrack.get().blockID;
}
} else
return this.canPlaceBlockOnSide(world, x, y, z, side);
}
}
@Override
@ -249,10 +249,9 @@ public class BlockBOPPlant extends BlockFlower implements IShearable
@Override
//TODO: onNeighborBlockChange()
public void func_149695_a(World world, int x, int y, int z, Block neighborBlock)(World world, int x, int y, int z, int neighborID)
public void func_149695_a(World world, int x, int y, int z, Block neighborBlock)
{
super. //TODO: onNeighborBlockChange()
public void func_149695_a(World world, int x, int y, int z, Block neighborBlock)(world, x, y, z, neighborID);
super.func_149695_a(World world, int x, int y, int z, Block neighborBlock)(world, x, y, z, neighborID);
this.checkFlowerChange(world, x, y, z);
if (world.getBlockMetadata(x, y, z) == CATTAILTOP && world.getBlockId(x, y - 1, z) == blockID && world.getBlockMetadata(x, y - 1, z) != CATTAILBOTTOM)
{
@ -405,7 +404,7 @@ public class BlockBOPPlant extends BlockFlower implements IShearable
//TODO: harvestBlock()
public void func_149636_a(World world, EntityPlayer player, int x, int y, int z, int meta)
{
super.harvestBlock(world, player, x, y, z, meta);
super.func_149636_a(world, player, x, y, z, meta);
if (meta == 13)
{
@ -416,7 +415,7 @@ public class BlockBOPPlant extends BlockFlower implements IShearable
if (equippedItem != null)
{
if (equippedItem.itemID != Item.shears.itemID)
if (equippedItem.getItem() != Items.shears)
{
if (meta == 5)
{
@ -460,11 +459,13 @@ public class BlockBOPPlant extends BlockFlower implements IShearable
}
@Override
public boolean isBlockReplaceable(World world, int x, int y, int z)
//TODO: isBlockReplaceable
public boolean func_149742_c(World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta == 5 || meta == 8)
return false;
if (meta == 5 || meta == 8) return false;
return true;
}
@ -478,7 +479,7 @@ public class BlockBOPPlant extends BlockFlower implements IShearable
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
@ -487,7 +488,7 @@ public class BlockBOPPlant extends BlockFlower implements IShearable
}
@Override
public boolean isBlockFoliage(World world, int x, int y, int z)
public boolean isBlockFoliage(IBlockAccess world, int x, int y, int z)
{
return true;
}

View File

@ -13,8 +13,10 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.BOPBlockHelper;
public class BlockBOPSlab extends BlockSlab
{
@ -26,7 +28,6 @@ public class BlockBOPSlab extends BlockSlab
private static final String[] woodTypes = new String[] {"acacia", "cherry", "dark", "fir", "holy", "magic", "mangrove", "palm", "redwood", "willow", "pine", "hell_bark", "jacaranda"};
private static final String[] rockTypes = new String[] {"redcobble", "redbrick", "mudbrick", "holycobble", "holybrick"};
private IIcon[] textures;
protected final boolean isDoubleSlab;
private final SlabCategory category;
@ -43,8 +44,10 @@ public class BlockBOPSlab extends BlockSlab
Blocks.fire.func_149842_a(func_149682_b(this), 5, 20);
//TODO: this.setHardness
this.func_149711_c(2.0F);
setResistance(5.0F);
setStepSound(Block.soundWoodFootstep);
//TODO: this.setResistance
this.func_149752_b(5.0F);
//TODO setStepSound(Block.soundWoodFootstep)
this.func_149672_a(Block.field_149766_f);
}
//TODO: Material.rock
else if (material == Material.field_151576_e)
@ -68,7 +71,8 @@ public class BlockBOPSlab extends BlockSlab
{
textures = new IIcon[rockTypes.length];
for (int i = 0; i < rockTypes.length; ++i) {
for (int i = 0; i < rockTypes.length; ++i)
{
textures[i] = iconRegister.registerIcon("biomesoplenty:"+rockTypes[i]);
}
}
@ -76,7 +80,8 @@ public class BlockBOPSlab extends BlockSlab
{
textures = new IIcon[woodTypes.length];
for (int i = 0; i < woodTypes.length; ++i) {
for (int i = 0; i < woodTypes.length; ++i)
{
textures[i] = iconRegister.registerIcon("biomesoplenty:plank_"+woodTypes[i]);
}
}
@ -113,7 +118,8 @@ public class BlockBOPSlab extends BlockSlab
}
@Override
public String getFullSlabName(int meta)
//TODO: getFullSlabName()
public String func_150002_b(int meta)
{
if (category == SlabCategory.STONE)
return (new StringBuilder()).append(rockTypes[getTypeFromMeta(meta)]).append("Slab").toString();
@ -132,14 +138,18 @@ public class BlockBOPSlab extends BlockSlab
//TODO: getItemDropped()
public Item func_149650_a(int metadata, Random random, int fortune)
{
if (isDoubleSlab)
//TODO: isDoubleSlab
if (field_150004_a)
{
if (this == Blocks.woodenDoubleSlab1.get().blockID)
return Blocks.woodenSingleSlab1.get().blockID;
if (this == Blocks.woodenDoubleSlab2.get().blockID)
return Blocks.woodenSingleSlab2.get().blockID;
if (this == BOPBlockHelper.get("woodenDoubleSlab1"))
//TODO: getItemFromBlock()
return Item.func_150898_a(BOPBlockHelper.get("woodenSingleSlab1"));
if (this == BOPBlockHelper.get("woodenDoubleSlab2"))
//TODO: getItemFromBlock()
return Item.func_150898_a(BOPBlockHelper.get("woodenSingleSlab2"));
else
return Blocks.stoneSingleSlab.get().blockID;
//TODO: getItemFromBlock()
return Item.func_150898_a(BOPBlockHelper.get("stoneSingleSlab"));
}
else
//TODO: getItemForBlock()
@ -151,7 +161,8 @@ public class BlockBOPSlab extends BlockSlab
public float func_149712_f(World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
float hardness = blockHardness;
//TODO: blockHardness
float hardness = field_149782_v;
if (category == SlabCategory.STONE)
{
@ -180,7 +191,8 @@ public class BlockBOPSlab extends BlockSlab
public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ)
{
int meta = world.getBlockMetadata(x, y, z);
float resistance = blockHardness;
//TODO: blockResistance
float resistance = field_149781_w;
if (category == SlabCategory.STONE)
{
@ -206,15 +218,19 @@ public class BlockBOPSlab extends BlockSlab
}
@Override
public int idPicked(World par1World, int par2, int par3, int par4)
{
return !isDoubleSlab ? blockID : (blockID == Blocks.woodenDoubleSlab1.get().blockID ? Blocks.woodenSingleSlab1.get().blockID : (blockID == Blocks.woodenDoubleSlab2.get().blockID ? Blocks.woodenSingleSlab2.get().blockID : Blocks.stoneSingleSlab.get().blockID));
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
//TODO: isDoubleSlab getItemFromBlock()
Block block = !field_150004_a ? this : (this == BOPBlockHelper.get("woodenDoubleSlab1") ? BOPBlockHelper.get("woodenSingleSlab1") : (this == BOPBlockHelper.get("woodenDoubleSlab2") ? BOPBlockHelper.get("woodenSingleSlab2") : BOPBlockHelper.get("stoneSingleSlab")));
return new ItemStack(block, 1);
}
@Override
protected ItemStack createStackedBlock(int par1)
//TODO: createStackedBlock()
protected ItemStack func_149644_j(int meta)
{
return new ItemStack(blockID, 2, par1);
return new ItemStack(this, 2, meta);
}
private int getWoodType(int meta)

View File

@ -13,6 +13,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.client.render.blocks.RenderUtils;
public class BlockBamboo extends Block
{
@ -85,7 +86,8 @@ public class BlockBamboo extends Block
}
@Override
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z)
//TODO: getSelectedBoundingBoxFromPool()
public AxisAlignedBB func_149633_g(World world, int x, int y, int z)
{
float pixel = 0.0625F;
@ -93,13 +95,15 @@ public class BlockBamboo extends Block
}
@Override
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axisAlignedBB, List list, Entity entity)
//TODO: addCollisionBoxesToList()
public void func_149743_a(World world, int x, int y, int z, AxisAlignedBB axisAlignedBB, List list, Entity entity)
{
float pixel = 0.0625F;
//TODO: setBlockBounds
this.func_149676_a((pixel * 4), 0.0F, (pixel * 4), 1.0F - (pixel * 4), 1.0F, 1.0F - (pixel * 4));
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
this.setBlockBoundsForItemRender();
super.func_149743_a(world, x, y, z, axisAlignedBB, list, entity);
//TODO: setBlockBoundsForItemRender()
this.func_149683_g();
}
@Override
@ -117,12 +121,15 @@ public class BlockBamboo extends Block
}
@Override
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
//TODO: canPlaceBlockAt
public boolean func_149742_c(World world, int x, int y, int z)
{
int var5 = par1World.getBlockId(par2, par3 - 1, par4);
if (var5 == blockID)
//TODO: getBlock
Block block = world.func_147439_a(x, y - 1, z);
if (block == this)
return true;
else if (var5 == Block.grass.blockID)
else if (block == Blocks.grass)
return true;
else
return false;
@ -135,19 +142,24 @@ public class BlockBamboo extends Block
this.checkBlockCoordValid(world, x, y, z);
}
protected final void checkBlockCoordValid(World par1World, int par2, int par3, int par4)
public final void checkBlockCoordValid(World world, int x, int y, int z)
{
if (!this.canBlockStay(par1World, par2, par3, par4))
//TODO: canBlockStay()
if (!this.func_149718_j(world, x, y, z))
{
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlock(par2, par3, par4, 0);
//TODO: dropBlockAsItem()
this.func_149697_b(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
//TODO: setBlockToAir
world.func_147468_f(x, y, z);
}
}
@Override
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
//TODO: canBlockStay()
public boolean func_149718_j(World world, int x, int y, int z)
{
return this.canPlaceBlockAt(par1World, par2, par3, par4);
//TODO: canPlaceBlockAt
return this.func_149742_c(world, x, y, z);
}
@Override

View File

@ -13,6 +13,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.client.render.blocks.RenderUtils;
public class BlockBones extends Block
{
@ -28,7 +29,8 @@ public class BlockBones extends Block
//TODO: this.setHardness
this.func_149711_c(3.0F);
setResistance(5.0F);
//TODO: this.setResistance
this.func_149752_b(5.0F);
//TODO: this.setCreativeTab()
this.func_149647_a(BiomesOPlenty.tabBiomesOPlenty);
@ -93,7 +95,8 @@ public class BlockBones extends Block
}
@Override
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z)
//TODO: getSelectedBoundingBoxFromPool()
public AxisAlignedBB func_149633_g(World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
@ -126,7 +129,7 @@ public class BlockBones extends Block
//TODO: setBlockBoundsBasedOnState()
public void func_149719_a(IBlockAccess world, int x, int y, int z)
{
int meta = iblockaccess.getBlockMetadata(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
float minX;
float minY;
@ -187,7 +190,8 @@ public class BlockBones extends Block
break;
}
setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ);
//TODO: this.setBlockBounds()
this.func_149676_a(minX, minY, minZ, maxX, maxY, maxZ);
}
@Override

View File

@ -16,7 +16,7 @@ import biomesoplenty.api.BOPItemHelper;
public class BlockFlesh extends Block
{
public BlockFlesh(int par1)
public BlockFlesh()
{
//TODO: Material.sponge
super(Material.field_151583_m);

View File

@ -10,6 +10,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.client.render.blocks.RenderUtils;
public class BlockGrave extends Block
{
@ -71,28 +72,32 @@ public class BlockGrave extends Block
{
if (world.getBlockMetadata(x, y, z) == 0 || world.getBlockMetadata(x, y, z) == 2)
{
if (world.getBlockId(x, y + 1, z) != Blocks.grave.get().blockID)
//TODO: getBlock()
if (world.func_147439_a(x, y + 1, z) != this)
{
world.destroyBlock(x, y, z, true);
//TODO: destroyBlock()
world.func_147480_a(x, y, z, true);
}
}
else
{
if (world.getBlockId(x, y - 1, z) != Blocks.grave.get().blockID)
//TODO: getBlock()
if (world.func_147439_a(x, y - 1, z) != this)
{
world.destroyBlock(x, y, z, true);
//TODO: destroyBlock()
world.func_147480_a(x, y, z, true);
}
}
}
}
@Override
public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int meta, int fortune)
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
if (meta == 0) ret.add(new ItemStack(Blocks.grave.get(), 1));
else if (meta == 2) ret.add(new ItemStack(Blocks.grave.get(), 1));
if (meta == 0) ret.add(new ItemStack(this, 1));
else if (meta == 2) ret.add(new ItemStack(this, 1));
return ret;
}

View File

@ -67,23 +67,21 @@ public class BlockIvy extends Block implements IShearable
return false;
}
/**
* Updates the blocks bounds based on its current state. Args: world, x, y, z
*/
@Override
//TODO: setBlockBoundsBasedOnState()
public void func_149719_a(IBlockAccess world, int x, int y, int z)
{
int var6 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
int metadata = world.getBlockMetadata(x, y, z);
float var7 = 1.0F;
float var8 = 1.0F;
float var9 = 1.0F;
float var10 = 0.0F;
float var11 = 0.0F;
float var12 = 0.0F;
boolean var13 = var6 > 0;
boolean var13 = metadata > 0;
if ((var6 & 2) != 0)
if ((metadata & 2) != 0)
{
var10 = Math.max(var10, 0.0625F);
var7 = 0.0F;
@ -94,7 +92,7 @@ public class BlockIvy extends Block implements IShearable
var13 = true;
}
if ((var6 & 8) != 0)
if ((metadata & 8) != 0)
{
var7 = Math.min(var7, 0.9375F);
var10 = 1.0F;
@ -105,7 +103,7 @@ public class BlockIvy extends Block implements IShearable
var13 = true;
}
if ((var6 & 4) != 0)
if ((metadata & 4) != 0)
{
var12 = Math.max(var12, 0.0625F);
var9 = 0.0F;
@ -116,7 +114,7 @@ public class BlockIvy extends Block implements IShearable
var13 = true;
}
if ((var6 & 1) != 0)
if ((metadata & 1) != 0)
{
var9 = Math.min(var9, 0.9375F);
var12 = 1.0F;
@ -148,9 +146,6 @@ public class BlockIvy extends Block implements IShearable
return null;
}
/**
* checks to see if you can place this block can be placed on that side of a block: BlockLever overrides
*/
@Override
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
{
@ -253,7 +248,7 @@ public class BlockIvy extends Block implements IShearable
@Override
//TODO: updateTick()
public void func_149674_a(World world, int x, int y, int z, Random random)(World par1World, int par2, int par3, int par4, Random par5Random)
public void func_149674_a(World world, int x, int y, int z, Random random)
{
}
@ -326,12 +321,6 @@ public class BlockIvy extends Block implements IShearable
return 0;
}
@Override
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{
super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
}
@Override
public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z)
{
@ -339,7 +328,7 @@ public class BlockIvy extends Block implements IShearable
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, 0));

View File

@ -7,7 +7,9 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
@ -15,15 +17,16 @@ import biomesoplenty.BiomesOPlenty;
public class BlockLongGrass extends Block
{
private IIcon[] //TODO: blockIcon
this.field_149761_L = new IIcon[6];
private IIcon[] icons = new IIcon[6];
public BlockLongGrass()
{
super(Material.grass);
//TODO: setTickRandomly()
this.func_149675_a(true);
//TODO: Material.grass
super(Material.field_151577_b);
//TODO: setTickRandomly()
this.func_149675_a(true);
//TODO: this.setCreativeTab()
this.func_149647_a(BiomesOPlenty.tabBiomesOPlenty);
}
@ -32,123 +35,98 @@ public class BlockLongGrass extends Block
//TODO: registerIcons()
public void func_149651_a(IIconRegister iconRegister)
{
//TODO: blockIcon
this.field_149761_L[0] = par1IconRegister.registerIcon("biomesoplenty:longgrass3");
//TODO: blockIcon
this.field_149761_L[1] = par1IconRegister.registerIcon("biomesoplenty:longgrass1");
//TODO: blockIcon
this.field_149761_L[2] = par1IconRegister.registerIcon("biomesoplenty:longgrass2");
//TODO: blockIcon
this.field_149761_L[3] = par1IconRegister.registerIcon("biomesoplenty:longgrass2");
//TODO: blockIcon
this.field_149761_L[4] = par1IconRegister.registerIcon("biomesoplenty:longgrass2");
//TODO: blockIcon
this.field_149761_L[5] = par1IconRegister.registerIcon("biomesoplenty:longgrass2");
this.icons[0] = iconRegister.registerIcon("biomesoplenty:longgrass3");
this.icons[1] = iconRegister.registerIcon("biomesoplenty:longgrass1");
this.icons[2] = iconRegister.registerIcon("biomesoplenty:longgrass2");
this.icons[3] = iconRegister.registerIcon("biomesoplenty:longgrass2");
this.icons[4] = iconRegister.registerIcon("biomesoplenty:longgrass2");
this.icons[5] = iconRegister.registerIcon("biomesoplenty:longgrass2");
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
@Override
public IIcon getIcon(int par1, int par2)
//TODO: getIcon()
public IIcon func_149691_a(int side, int meta)
{
if (par1 < 0 || par1 >= //TODO: blockIcon
this.field_149761_L.length)
par1 = 1;
if (side < 0 || side >= this.icons.length) side = 1;
return //TODO: blockIcon
this.field_149761_L[par1];
return this.icons[side];
}
/**
* Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side
*/
/*public int getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
if (par5 == 1)
{
return 32;
}
else if (par5 == 0)
{
return 34;
}
else
{
Material var6 = par1IBlockAccess.getBlockMaterial(par2, par3 + 1, par4);
return var6 != Material.snow && var6 != Material.craftedSnow ? 33 : 33;
}
}*/
@Override
public boolean canSustainPlant(World world, int x, int y, int z, ForgeDirection direction, IPlantable plant)
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plant)
{
return true;
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
//TODO: onBlockActivated()
public boolean func_149727_a(World world, int x, int y, int z, EntityPlayer player, int side, float hitVecX, float hitVecY, float hitVecZ)
{
if (par5EntityPlayer.getCurrentEquippedItem() != null)
if (player.getCurrentEquippedItem() != null)
{
if (par5EntityPlayer.getCurrentEquippedItem().getDisplayName().toLowerCase().contains(" hoe"))
if (player.getCurrentEquippedItem().getDisplayName().toLowerCase().contains(" hoe"))
{
Block block = Block.tilledField;
Block tilledField = Blocks.farmland;
world.playSoundEffect(par2 + 0.5F, par3 + 0.5F, par4 + 0.5F, block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
//TODO: stepSound.getPlaceSound() stepSound.getVolume() stepSound.getPitch()
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, tilledField.field_149762_H.func_150496_b(), (tilledField.field_149762_H.func_150497_c() + 1.0F) / 2.0F, tilledField.field_149762_H.func_150494_d() * 0.8F);
if (!world.isRemote)
{
world.setBlock(par2, par3, par4, block.blockID);
//TODO: setBlock()
world.func_147465_d(x, y, z, tilledField, 0, 2);
}
return true;
} else
}
else
{
return false;
} else
}
}
else
{
return false;
}
}
/**
* Ticks the block if it's been scheduled
*/
@Override
public void //TODO: updateTick()
public void func_149674_a(World world, int x, int y, int z, Random random)(World par1World, int par2, int par3, int par4, Random par5Random)
//TODO: updateTick()
public void func_149674_a(World world, int x, int y, int z, Random random)
{
if (!par1World.isRemote)
if (!world.isRemote)
{
if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && Block.lightOpacity[par1World.getBlockId(par2, par3 + 1, par4)] > 2)
if (world.getBlockLightValue(x, y + 1, z) < 4 && world.getBlockLightOpacity(x, y + 1, z) > 2)
{
par1World.setBlock(par2, par3, par4, Block.dirt.blockID);
//TODO: setBlock()
world.func_147465_d(x, y, z, Blocks.dirt, 0, 2);
}
else if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9)
else if (world.getBlockLightValue(x, y + 1, z) >= 9)
{
for (int var6 = 0; var6 < 4; ++var6)
{
int var7 = par2 + par5Random.nextInt(3) - 1;
int var8 = par3 + par5Random.nextInt(5) - 3;
int var9 = par4 + par5Random.nextInt(3) - 1;
int var10 = par1World.getBlockId(var7, var8 + 1, var9);
int rX = x + random.nextInt(3) - 1;
int rY = y + random.nextInt(5) - 3;
int rZ = z + random.nextInt(3) - 1;
//TODO: getBlock()
Block block = world.func_147439_a(rX, rY + 1, rZ);
if (par1World.getBlockId(var7, var8, var9) == Block.dirt.blockID && par1World.getBlockLightValue(var7, var8 + 1, var9) >= 4 && Block.lightOpacity[var10] <= 2)
//TODO: getBlock()
if (world.func_147439_a(rX, rY, rZ) == Blocks.dirt && world.getBlockLightValue(rX, rY + 1, rZ) >= 4 && world.getBlockLightOpacity(rX, rY + 1, rZ) <= 2)
{
par1World.setBlock(var7, var8, var9, Blocks.longGrass.get().blockID);
//TODO: setBlock()
world.func_147465_d(rX, rY, rZ, this, 0, 2);
}
}
}
}
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
//TODO: getItemDropped()
public Item func_149650_a(int metadata, Random random, int fortune
public Item func_149650_a(int metadata, Random random, int fortune)
{
return Block.dirt.idDropped(0, par2Random, par3);
//TODO: getItemDropped()
return Blocks.dirt.func_149650_a(0, random, fortune);
}
}

View File

@ -7,7 +7,9 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
@ -19,7 +21,8 @@ public class BlockOriginGrass extends Block
public BlockOriginGrass()
{
super(Material.grass);
//TODO: Material.grass
super(Material.field_151577_b);
//TODO: setTickRandomly()
this.func_149675_a(true);
@ -32,80 +35,88 @@ public class BlockOriginGrass extends Block
//TODO: registerIcons()
public void func_149651_a(IIconRegister iconRegister)
{
this.icon[0] = par1IconRegister.registerIcon("biomesoplenty:origingrass3");
this.icon[1] = par1IconRegister.registerIcon("biomesoplenty:origingrass1");
this.icon[2] = par1IconRegister.registerIcon("biomesoplenty:origingrass2");
this.icon[3] = par1IconRegister.registerIcon("biomesoplenty:origingrass2");
this.icon[4] = par1IconRegister.registerIcon("biomesoplenty:origingrass2");
this.icon[5] = par1IconRegister.registerIcon("biomesoplenty:origingrass2");
this.icon[0] = iconRegister.registerIcon("biomesoplenty:origingrass3");
this.icon[1] = iconRegister.registerIcon("biomesoplenty:origingrass1");
this.icon[2] = iconRegister.registerIcon("biomesoplenty:origingrass2");
this.icon[3] = iconRegister.registerIcon("biomesoplenty:origingrass2");
this.icon[4] = iconRegister.registerIcon("biomesoplenty:origingrass2");
this.icon[5] = iconRegister.registerIcon("biomesoplenty:origingrass2");
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
@Override
public IIcon getIcon(int par1, int par2)
//TODO: getIcon()
public IIcon func_149691_a(int side, int meta)
{
if (par1 < 0 || par1 >= //TODO: blockIcon
this.field_149761_L.length)
par1 = 1;
if (side < 0 || side >= this.icon.length)
side = 1;
return icon[par1];
return icon[side];
}
@Override
public boolean canSustainPlant(World world, int x, int y, int z, ForgeDirection direction, IPlantable plant)
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plant)
{
return true;
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
//TODO: onBlockActivated()
public boolean func_149727_a(World world, int x, int y, int z, EntityPlayer player, int side, float hitVecX, float hitVecY, float hitVecZ)
{
if (par5EntityPlayer.getCurrentEquippedItem() != null)
if (player.getCurrentEquippedItem() != null)
{
if (par5EntityPlayer.getCurrentEquippedItem().getDisplayName().toLowerCase().contains(" hoe"))
if (player.getCurrentEquippedItem().getDisplayName().toLowerCase().contains(" hoe"))
{
Block block = Block.tilledField;
Block tilledField = Blocks.farmland;
world.playSoundEffect(par2 + 0.5F, par3 + 0.5F, par4 + 0.5F, block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
//TODO: stepSound.getPlaceSound() stepSound.getVolume() stepSound.getPitch()
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, tilledField.field_149762_H.func_150496_b(), (tilledField.field_149762_H.func_150497_c() + 1.0F) / 2.0F, tilledField.field_149762_H.func_150494_d() * 0.8F);
if (!world.isRemote)
{
world.setBlock(par2, par3, par4, block.blockID);
//TODO: setBlock()
world.func_147465_d(x, y, z, tilledField, 0, 2);
}
return true;
} else
}
else
{
return false;
} else
}
}
else
{
return false;
}
}
@Override
//TODO: updateTick()
public void func_149674_a(World world, int x, int y, int z, Random random)(World par1World, int par2, int par3, int par4, Random par5Random)
public void func_149674_a(World world, int x, int y, int z, Random random)
{
if (!par1World.isRemote)
if (!world.isRemote)
{
if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && Block.lightOpacity[par1World.getBlockId(par2, par3 + 1, par4)] > 2)
if (world.getBlockLightValue(x, y + 1, z) < 4 && world.getBlockLightOpacity(x, y + 1, z) > 2)
{
par1World.setBlock(par2, par3, par4, Block.dirt.blockID);
//TODO: setBlock()
world.func_147465_d(x, y, z, Blocks.dirt, 0, 2);
}
else if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9)
else if (world.getBlockLightValue(x, y + 1, z) >= 9)
{
for (int var6 = 0; var6 < 4; ++var6)
{
int var7 = par2 + par5Random.nextInt(3) - 1;
int var8 = par3 + par5Random.nextInt(5) - 3;
int var9 = par4 + par5Random.nextInt(3) - 1;
int var10 = par1World.getBlockId(var7, var8 + 1, var9);
int rX = x + random.nextInt(3) - 1;
int rY = y + random.nextInt(5) - 3;
int rZ = z + random.nextInt(3) - 1;
//TODO: getBlock()
Block block = world.func_147439_a(rX, rY + 1, rZ);
if (par1World.getBlockId(var7, var8, var9) == Block.dirt.blockID && par1World.getBlockLightValue(var7, var8 + 1, var9) >= 4 && Block.lightOpacity[var10] <= 2)
//TODO: getBlock()
if (world.func_147439_a(rX, rY, rZ) == Blocks.dirt && world.getBlockLightValue(rX, rY + 1, rZ) >= 4 && world.getBlockLightOpacity(rX, rY + 1, rZ) <= 2)
{
par1World.setBlock(var7, var8, var9, Blocks.originGrass.get().blockID);
//TODO: setBlock()
world.func_147465_d(rX, rY, rZ, this, 0, 2);
}
}
}
@ -116,6 +127,7 @@ public class BlockOriginGrass extends Block
//TODO: getItemDropped()
public Item func_149650_a(int metadata, Random random, int fortune)
{
return Block.dirt.idDropped(0, par2Random, par3);
//TODO: getItemDropped()
return Blocks.dirt.func_149650_a(0, random, fortune);
}
}

View File

@ -5,22 +5,24 @@ import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
import biomesoplenty.BiomesOPlenty;
public class BlockOvergrownNetherrack extends Block
{
private IIcon[] //TODO: blockIcon
this.field_149761_L = new IIcon[6];
private IIcon[] icons = new IIcon[6];
public BlockOvergrownNetherrack()
{
//TODO: Material.rock
super(Material.field_151576_e);
//TODO: setTickRandomly()
//TODO: setTickRandomly()
this.func_149675_a(true);
//TODO: this.setCreativeTab()
@ -31,67 +33,33 @@ public class BlockOvergrownNetherrack extends Block
//TODO: registerIcons()
public void func_149651_a(IIconRegister iconRegister)
{
//TODO: blockIcon
this.field_149761_L[0] = par1IconRegister.registerIcon("biomesoplenty:overgrownnetherrack3");
//TODO: blockIcon
this.field_149761_L[1] = par1IconRegister.registerIcon("biomesoplenty:overgrownnetherrack1");
//TODO: blockIcon
this.field_149761_L[2] = par1IconRegister.registerIcon("biomesoplenty:overgrownnetherrack2");
//TODO: blockIcon
this.field_149761_L[3] = par1IconRegister.registerIcon("biomesoplenty:overgrownnetherrack2");
//TODO: blockIcon
this.field_149761_L[4] = par1IconRegister.registerIcon("biomesoplenty:overgrownnetherrack2");
//TODO: blockIcon
this.field_149761_L[5] = par1IconRegister.registerIcon("biomesoplenty:overgrownnetherrack2");
this.icons[0] = iconRegister.registerIcon("biomesoplenty:overgrownnetherrack3");
this.icons[1] = iconRegister.registerIcon("biomesoplenty:overgrownnetherrack1");
this.icons[2] = iconRegister.registerIcon("biomesoplenty:overgrownnetherrack2");
this.icons[3] = iconRegister.registerIcon("biomesoplenty:overgrownnetherrack2");
this.icons[4] = iconRegister.registerIcon("biomesoplenty:overgrownnetherrack2");
this.icons[5] = iconRegister.registerIcon("biomesoplenty:overgrownnetherrack2");
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
@Override
public IIcon getIcon(int par1, int par2)
//TODO: getIcon()
public IIcon func_149691_a(int side, int meta)
{
if (par1 < 0 || par1 >= //TODO: blockIcon
this.field_149761_L.length)
par1 = 1;
if (side < 0 || side >= this.icons.length) side = 1;
return //TODO: blockIcon
this.field_149761_L[par1];
return this.icons[side];
}
/**
* Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side
*/
/*public int getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
if (par5 == 1)
{
return 32;
}
else if (par5 == 0)
{
return 34;
}
else
{
Material var6 = par1IBlockAccess.getBlockMaterial(par2, par3 + 1, par4);
return var6 != Material.snow && var6 != Material.craftedSnow ? 33 : 33;
}
}*/
@Override
public boolean canSustainPlant(World world, int x, int y, int z, ForgeDirection direction, IPlantable plant)
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plant)
{
return true;
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
//TODO: getItemDropped()
public Item func_149650_a(int metadata, Random random, int fortune
public Item func_149650_a(int metadata, Random random, int fortune)
{
return Block.netherrack.idDropped(0, par2Random, par3);
return Blocks.netherrack.func_149650_a(0, random, fortune);
}
}

View File

@ -1,115 +0,0 @@
package biomesoplenty.common.blocks;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import biomesoplenty.ClientProxy;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockPuddle extends Block
{
@SideOnly(Side.CLIENT)
private IIcon field_94441_a;
@SideOnly(Side.CLIENT)
private IIcon field_94440_b;
public BlockPuddle(int par1)
{
super(par1, Material.ground);
//TODO: setTickRandomly()
this.func_149675_a(true);
//TODO: setBlockBounds
this.func_149676_a0.0F, 0.0F, 0.0F, 1.0F, 0.8135F, 1.0F);
this.setLightOpacity(0);
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
{
return AxisAlignedBB.getAABBPool().getAABB((double)(par2 + 0), (double)(par3 + 0), (double)(par4 + 0), (double)(par2 + 1), (double)(par3 + 0.8135F), (double)(par4 + 1));
}
@Override
public boolean isBlockNormalCube(World world, int x, int y, int z)
{
return false;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean //TODO: renderAsNormalBlock()
public boolean func_149686_d()()
{
return false;
}
@Override
public void //TODO: updateTick()
public void func_149674_a(World world, int x, int y, int z, Random random)(World world, int x, int y, int z, Random par5Random)
{
if (!world.isRaining() && world.rand.nextInt(2) == 0)
{
world.setBlock(x, y, z, Block.dirt.blockID);
}
}
@Override
//TODO: getRenderBlockPass()
public int func_149701_w()
{
return 1;
}
@Override
public boolean canRenderInPass(int pass)
{
ClientProxy.puddleRenderPass = pass;
return true;
}
@Override
public int //TODO getRenderType()
public int func_149645_b()()
{
return RenderUtils.puddleModel;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int par1, int par2)
{
return Block.dirt.getBlockTextureFromSide(par1);
}
@Override
//TODO: getItemDropped()
public Item func_149650_a(int metadata, Random random, int fortune
{
return Block.dirt.idDropped(0, par2Random, par3);
}
@Override
@SideOnly(Side.CLIENT)
public int idPicked(World par1World, int par2, int par3, int par4)
{
return Block.dirt.blockID;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister)
{
}
}

View File

@ -12,16 +12,6 @@ public class BlockTurnip extends BlockCrops
@SideOnly(Side.CLIENT)
private IIcon[] iconArray;
public BlockTurnip(int par1)
{
super(par1);
}
@SideOnly(Side.CLIENT)
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
@Override
public IIcon getIcon(int par1, int par2)
{
@ -40,18 +30,12 @@ public class BlockTurnip extends BlockCrops
}
}
/**
* Generate a seed ItemStack for this crop.
*/
@Override
protected int getSeedItem()
{
return Items.turnipseeds.get().itemID;
}
/**
* Generate a crop produce ItemStack for this crop.
*/
@Override
protected int getCropItem()
{
@ -65,12 +49,6 @@ public class BlockTurnip extends BlockCrops
return meta == 7 ? 11 : 0;
}
@SideOnly(Side.CLIENT)
/**
* When this method is called, your block should register all the icons it needs with the given IIconRegister. This
* is the only chance you get to register icons.
*/
@Override
public void registerIcons(IIconRegister par1IconRegister)
{

View File

@ -33,18 +33,15 @@ public class BlockWillow extends Block implements IShearable
//TODO: registerIcons()
public void func_149651_a(IIconRegister iconRegister)
{
//TODO: blockIcon
this.field_149761_L = par1IconRegister.registerIcon("biomesoplenty:willow");
//TODO: blockIcon
this.field_149761_L = iconRegister.registerIcon("biomesoplenty:willow");
}
/**
* Sets the block's bounds for rendering it as an item
*/
@Override
public void setBlockBoundsForItemRender()
{
//TODO: setBlockBounds
this.func_149676_a0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
this.func_149676_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
/**
@ -149,13 +146,9 @@ public class BlockWillow extends Block implements IShearable
}
//TODO: setBlockBounds
this.func_149676_avar7, var8, var9, var10, var11, var12);
this.func_149676_a(var7, var8, var9, var10, var11, var12);
}
/**
* Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
* cleared to be reused)
*/
@Override
//TODO: getCollisionBoundingBoxFromPool
public AxisAlignedBB func_149668_a(World world, int x, int y, int z)
@ -265,12 +258,9 @@ public class BlockWillow extends Block implements IShearable
return par1IBlockAccess.getBiomeGenForCoords(par2, par4).getBiomeFoliageColor();
}
/**
* Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
* their own) Args: x, y, z, neighbor blockID
*/
@Override
public void //TODO: onNeighborBlockChange()
//TODO: onNeighborBlockChange()
public void func_149695_a(World world, int x, int y, int z, Block neighborBlock)(World par1World, int par2, int par3, int par4, int par5)
{
if (!par1World.isRemote && !this.canVineStay(par1World, par2, par3, par4))
@ -280,11 +270,8 @@ public class BlockWillow extends Block implements IShearable
}
}
/**
* Ticks the block if it's been scheduled
*/
@Override
public void //TODO: updateTick()
//TODO: updateTick()
public void func_149674_a(World world, int x, int y, int z, Random random)(World par1World, int par2, int par3, int par4, Random par5Random)
{
}

View File

@ -1,17 +1,62 @@
package biomesoplenty.common.core;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemBlock;
import biomesoplenty.api.BOPBlockHelper;
import biomesoplenty.common.blocks.BlockAsh;
import biomesoplenty.common.blocks.BlockBOPAppleLeaves;
import biomesoplenty.common.blocks.BlockBOPColorizedLeaves;
import biomesoplenty.common.blocks.BlockBOPColorizedLeaves.ColourizedLeafCategory;
import biomesoplenty.common.blocks.BlockBOPColorizedSapling;
import biomesoplenty.common.blocks.BlockBOPGems;
import biomesoplenty.common.blocks.BlockBOPGeneric;
import biomesoplenty.common.blocks.BlockBOPGeneric.BlockType;
import biomesoplenty.common.blocks.BlockBOPGrass;
import biomesoplenty.common.blocks.BlockBOPLeaves;
import biomesoplenty.common.blocks.BlockBOPLeaves.LeafCategory;
import biomesoplenty.common.blocks.BlockBOPLog;
import biomesoplenty.common.blocks.BlockBOPLog.LogCategory;
import biomesoplenty.common.blocks.BlockBOPPersimmonLeaves;
import biomesoplenty.common.blocks.BlockBOPPetals;
import biomesoplenty.common.blocks.BlockBOPPlank;
import biomesoplenty.common.blocks.BlockBOPRedRock;
import biomesoplenty.common.blocks.BlockBOPSapling;
import biomesoplenty.common.blocks.BlockBOPSkystone;
import biomesoplenty.common.blocks.BlockBOPSlab;
import biomesoplenty.common.blocks.BlockBOPSlab.SlabCategory;
import biomesoplenty.common.blocks.BlockBOPStairs;
import biomesoplenty.common.blocks.BlockBOPStairs.Category;
import biomesoplenty.common.blocks.BlockBamboo;
import biomesoplenty.common.blocks.BlockBones;
import biomesoplenty.common.blocks.BlockCloud;
import biomesoplenty.common.blocks.BlockFlesh;
import biomesoplenty.common.blocks.BlockGrave;
import biomesoplenty.common.blocks.BlockHive;
import biomesoplenty.common.blocks.BlockHoney;
import biomesoplenty.common.blocks.BlockLongGrass;
import biomesoplenty.common.blocks.BlockMud;
import biomesoplenty.common.blocks.BlockOriginGrass;
import biomesoplenty.common.blocks.BlockOvergrownNetherrack;
import biomesoplenty.common.blocks.BlockPromisedPortal;
import biomesoplenty.common.itemblocks.ItemBlockAppleLeaves;
import biomesoplenty.common.itemblocks.ItemBlockBamboo;
import biomesoplenty.common.itemblocks.ItemBlockBones;
import biomesoplenty.common.itemblocks.ItemBlockColorizedLeaves;
import biomesoplenty.common.itemblocks.ItemBlockColorizedSapling;
import biomesoplenty.common.itemblocks.ItemBlockGems;
import biomesoplenty.common.itemblocks.ItemBlockGrave;
import biomesoplenty.common.itemblocks.ItemBlockHive;
import biomesoplenty.common.itemblocks.ItemBlockLeaves;
import biomesoplenty.common.itemblocks.ItemBlockLog;
import biomesoplenty.common.itemblocks.ItemBlockMud;
import biomesoplenty.common.itemblocks.ItemBlockPersimmonLeaves;
import biomesoplenty.common.itemblocks.ItemBlockPetals;
import biomesoplenty.common.itemblocks.ItemBlockPlank;
import biomesoplenty.common.itemblocks.ItemBlockRedRock;
import biomesoplenty.common.itemblocks.ItemBlockSapling;
import biomesoplenty.common.itemblocks.ItemBlockSkystone;
import biomesoplenty.common.itemblocks.ItemBlockSlab;
import cpw.mods.fml.common.registry.GameRegistry;
public class BOPBlocks
@ -24,22 +69,123 @@ public class BOPBlocks
private static void initializeBlocks()
{
// Block declaration
//TODO: setBlockName
registerBlock(new BlockMud().func_149663_c("mud"), ItemBlockMud.class);
//TODO: Dried Dirt
//TODO: Red Rock
//TODO: rock
registerBlock(new BlockBOPGeneric(Material.field_151576_e, BlockType.DRIED_DIRT).func_149663_c("driedDirt"));
registerBlock(new BlockBOPRedRock().func_149663_c("redRock"), ItemBlockRedRock.class);
registerBlock(new BlockAsh().func_149663_c("ash"));
registerBlock(new BlockCloud().func_149663_c("cloud"));
registerBlock(new BlockHoney().func_149663_c("honeyBlock"));
registerBlock(new BlockFlesh().func_149663_c("flesh"));
//Blocks.plants = Optional.of((new BlockBOPPlant(BOPConfigurationIDs.plantsID)).setUnlocalizedName("bop.plants"));
//Blocks.flowers = Optional.of((new BlockBOPFlower(BOPConfigurationIDs.flowersID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("bop.flowers"));
//Blocks.flowers2 = Optional.of((new BlockBOPFlower2(BOPConfigurationIDs.flowers2ID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("bop.flowers2"));
//Blocks.stoneFormations = Optional.of((new BlockStoneFormations(BOPConfigurationIDs.stoneFormationsID)).setHardness(0.5F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("bop.stoneFormations"));
//Blocks.mushrooms = Optional.of((new BlockBOPMushroom(BOPConfigurationIDs.mushroomsID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("bop.mushrooms"));
//Blocks.coral = Optional.of((new BlockBOPCoral(BOPConfigurationIDs.coralID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("bop.coral"));
//Blocks.willow = Optional.of((new BlockWillow(BOPConfigurationIDs.willowID)).setHardness(0.2F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("bop.willow"));
//Blocks.ivy = Optional.of((new BlockIvy(BOPConfigurationIDs.ivyID)).setHardness(0.2F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("bop.ivy"));
registerBlock(new BlockBOPLeaves(LeafCategory.CAT1).func_149663_c("leaves1"), ItemBlockLeaves.class);
registerBlock(new BlockBOPLeaves(LeafCategory.CAT2).func_149663_c("leaves2"), ItemBlockLeaves.class);
registerBlock(new BlockBOPLeaves(LeafCategory.CAT3).func_149663_c("leaves3"), ItemBlockLeaves.class);
registerBlock(new BlockBOPLeaves(LeafCategory.CAT4).func_149663_c("leaves4"), ItemBlockLeaves.class);
//Blocks.foliage = Optional.of((new BlockBOPFoliage(BOPConfigurationIDs.foliageID)).setUnlocalizedName("bop.foliage"));
//Blocks.turnip = Optional.of((new BlockTurnip(BOPConfigurationIDs.turnipID)).setUnlocalizedName("bop.turnip").setTextureName("turnip"));
//TODO: rock
registerBlock(new BlockBOPGeneric(Material.field_151576_e, BlockType.ASH_STONE).func_149663_c("ashStone"));
//TODO: rock
registerBlock(new BlockBOPGeneric(Material.field_151576_e, BlockType.HARD_ICE).func_149663_c("hardIce"));
registerBlock(new BlockBOPAppleLeaves().func_149663_c("appleLeaves"), ItemBlockAppleLeaves.class);
registerBlock(new BlockBOPPersimmonLeaves().func_149663_c("persimmonLeaves"), ItemBlockPersimmonLeaves.class);
registerBlock(new BlockBamboo().func_149663_c("bamboo"), ItemBlockBamboo.class);
//TODO: rock
registerBlock(new BlockBOPGeneric(Material.field_151576_e, BlockType.MUD_BRICK).func_149663_c("mudBricks"));
registerBlock(new BlockOriginGrass().func_149663_c("originGrass"));
registerBlock(new BlockLongGrass().func_149663_c("longGrass"));
registerBlock(new BlockOvergrownNetherrack().func_149663_c("overgrownNetherrack"));
registerBlock(new BlockBOPGrass().func_149663_c("grass"));
//Blocks.treeMoss = Optional.of((new BlockTreeMoss(BOPConfigurationIDs.treeMossID)).setHardness(0.2F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("bop.treeMoss"));
registerBlock(new BlockBOPLog(LogCategory.CAT1).func_149663_c("logs1"), ItemBlockLog.class);
registerBlock(new BlockBOPLog(LogCategory.CAT2).func_149663_c("logs2"), ItemBlockLog.class);
registerBlock(new BlockBOPLog(LogCategory.CAT3).func_149663_c("logs3"), ItemBlockLog.class);
registerBlock(new BlockBOPLog(LogCategory.CAT4).func_149663_c("logs4"), ItemBlockLog.class);
registerBlock(new BlockBOPPetals().func_149663_c("petals"), ItemBlockPetals.class);
registerBlock(new BlockBOPSapling().func_149663_c("saplings"), ItemBlockSapling.class);
registerBlock(new BlockBOPColorizedSapling().func_149663_c("colorizedSaplings"), ItemBlockColorizedSapling.class);
//TODO: sand
registerBlock(new BlockBOPGeneric(Material.field_151595_p, BlockType.HARD_SAND).func_149663_c("hardSand"));
//TODO: rock
registerBlock(new BlockBOPGeneric(Material.field_151576_e, BlockType.HARD_DIRT).func_149663_c("hardDirt"));
//TODO: sand
registerBlock(new BlockBOPGeneric(Material.field_151595_p, BlockType.HOLY_DIRT).func_149663_c("holyDirt"));
registerBlock(new BlockBOPSkystone().func_149663_c("holyStone"), ItemBlockSkystone.class);
//TODO: glass
registerBlock(new BlockBOPGeneric(Material.field_151592_s, BlockType.CRYSTAL).func_149663_c("crystal"));
registerBlock(new BlockPromisedPortal().func_149663_c("promisedPortal"));
registerBlock(new BlockBOPGems().func_149663_c("gemOre"), ItemBlockGems.class);
//
//Blocks.moss = Optional.of((new BlockMoss(BOPConfigurationIDs.mossID)).setHardness(0.2F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("bop.moss"));
//TODO: rock
registerBlock(new BlockBOPGeneric(Material.field_151576_e, BlockType.CRAG_ROCK).func_149663_c("cragRock"));
registerBlock(new BlockCloud().func_149663_c("cloud"));
registerBlock(new BlockHive().func_149663_c("hive"), ItemBlockHive.class);
registerBlock(new BlockHoney().func_149663_c("honeyBlock"));
registerBlock(new BlockBones().func_149663_c("bones"), ItemBlockBones.class);
registerBlock(new BlockGrave().func_149663_c("grave"), ItemBlockGrave.class);
registerBlock(new BlockBOPPlank().func_149663_c("planks"), ItemBlockPlank.class);
//TODO: wood
registerBlock(new BlockBOPSlab(true, Material.field_151575_d, SlabCategory.WOOD1).func_149663_c("woodenDoubleSlab1"), ItemBlockSlab.class);
//TODO: wood
registerBlock(new BlockBOPSlab(false, Material.field_151575_d, SlabCategory.WOOD1).func_149663_c("woodenSingleSlab1"), ItemBlockSlab.class);
//TODO: wood
registerBlock(new BlockBOPSlab(true, Material.field_151575_d, SlabCategory.WOOD2).func_149663_c("woodenDoubleSlab2"), ItemBlockSlab.class);
//TODO: wood
registerBlock(new BlockBOPSlab(false, Material.field_151575_d, SlabCategory.WOOD2).func_149663_c("woodenSingleSlab2"), ItemBlockSlab.class);
//TODO: stone
registerBlock(new BlockBOPSlab(true, Material.field_151576_e, SlabCategory.STONE).func_149663_c("stoneDoubleSlab"), ItemBlockSlab.class);
//TODO: stone
registerBlock(new BlockBOPSlab(false, Material.field_151576_e, SlabCategory.STONE).func_149663_c("stoneSingleSlab"), ItemBlockSlab.class);
registerBlock(new BlockBOPStairs(BOPBlockHelper.get("planks"), Category.ACACIA).func_149663_c("acaciaStairs"));
registerBlock(new BlockBOPStairs(BOPBlockHelper.get("planks"), Category.CHERRY).func_149663_c("cherryStairs"));
registerBlock(new BlockBOPStairs(BOPBlockHelper.get("planks"), Category.DARK).func_149663_c("darkStairs"));
registerBlock(new BlockBOPStairs(BOPBlockHelper.get("planks"), Category.FIR).func_149663_c("firStairs"));
registerBlock(new BlockBOPStairs(BOPBlockHelper.get("planks"), Category.HOLY).func_149663_c("holyStairs"));
registerBlock(new BlockBOPStairs(BOPBlockHelper.get("planks"), Category.MAGIC).func_149663_c("magicStairs"));
registerBlock(new BlockBOPStairs(BOPBlockHelper.get("planks"), Category.MANGROVE).func_149663_c("mangroveStairs"));
registerBlock(new BlockBOPStairs(BOPBlockHelper.get("planks"), Category.PALM).func_149663_c("palmStairs"));
registerBlock(new BlockBOPStairs(BOPBlockHelper.get("planks"), Category.REDWOOD).func_149663_c("redwoodStairs"));
registerBlock(new BlockBOPStairs(BOPBlockHelper.get("planks"), Category.WILLOW).func_149663_c("willowStairs"));
registerBlock(new BlockBOPStairs(BOPBlockHelper.get("planks"), Category.PINE).func_149663_c("pineStairs"));
registerBlock(new BlockBOPStairs(BOPBlockHelper.get("planks"), Category.HELL_BARK).func_149663_c("hellBarkStairs"));
registerBlock(new BlockBOPStairs(BOPBlockHelper.get("planks"), Category.JACARANDA).func_149663_c("jacarandaStairs"));
registerBlock(new BlockBOPStairs(BOPBlockHelper.get("redRock"), Category.RED_COBBLE).func_149663_c("redCobbleStairs"));
registerBlock(new BlockBOPStairs(BOPBlockHelper.get("redRock"), Category.RED_BRICKS).func_149663_c("redBricksStairs"));
registerBlock(new BlockBOPStairs(BOPBlockHelper.get("holyStone"), Category.HOLY_COBBLE).func_149663_c("holyCobbleStairs"));
registerBlock(new BlockBOPStairs(BOPBlockHelper.get("holyStone"), Category.HOLY_BRICKS).func_149663_c("holyBricksStairs"));
registerBlock(new BlockBOPStairs(BOPBlockHelper.get("redRock"), Category.MUD_BRICKS).func_149663_c("mudBricksStairs"));
registerBlock(new BlockBOPColorizedLeaves(ColourizedLeafCategory.CAT1).func_149663_c("colorizedLeaves1"), ItemBlockColorizedLeaves.class);
registerBlock(new BlockBOPColorizedLeaves(ColourizedLeafCategory.CAT2).func_149663_c("colorizedLeaves2"), ItemBlockColorizedLeaves.class);
}
public static void registerBlock(Block block)

View File

@ -1,15 +1,15 @@
package biomesoplenty.itemblocks;
package biomesoplenty.common.itemblocks;
import java.util.Random;
import javax.swing.IIcon;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import biomesoplenty.BiomesOPlenty;
@ -39,12 +39,12 @@ public class ItemBlockFlower extends ItemBlock
@Override
@SideOnly(Side.CLIENT)
public void registerIIcons(IIconRegister IIconRegister)
public void registerIcons(IIconRegister iconRegister)
{
textures = new IIcon[2];
textures[0] = IIconRegister.registerIIcon("biomesoplenty:item_sunflower");
textures[1] = IIconRegister.registerIIcon("biomesoplenty:item_rainbowflower");
textures[0] = iconRegister.registerIcon("biomesoplenty:item_sunflower");
textures[1] = iconRegister.registerIcon("biomesoplenty:item_rainbowflower");
}
@Override
@ -59,14 +59,14 @@ public class ItemBlockFlower extends ItemBlock
}
@Override
public IIcon getIIconFromDamage(int meta)
public IIcon getIconFromDamage(int meta)
{
if (meta == 11)
return textures[1];
else if (meta == 13)
return textures[0];
else
return Block.blocksList[itemID].getIIcon(0, meta);
return Block.blocksList[itemID].getIcon(0, meta);
}
@Override
@ -104,7 +104,7 @@ public class ItemBlockFlower extends ItemBlock
}
@Override
public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count)
public void onUsingTick(ItemStack stack, EntityPlayer player, int count)
{
Vec3 vec = player.getLook(0.5F);
Random rnd = player.getRNG();

View File

@ -4,11 +4,11 @@ import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class ItemBlockAmethyst extends ItemBlock
public class ItemBlockGems extends ItemBlock
{
private static final String[] types = new String[] {"amethystore", "amethystblock", "rubyore", "rubyblock", "peridotore", "peridotblock", "topazore", "topazblock", "tanzaniteore", "tanzaniteblock", "malachiteore", "malachiteblock", "sapphireore", "sapphireblock"};
public ItemBlockAmethyst(Block block)
public ItemBlockGems(Block block)
{
super(block);

View File

@ -1,5 +1,6 @@
package biomesoplenty.itemblocks;
package biomesoplenty.common.itemblocks;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
@ -7,11 +8,12 @@ public class ItemBlockGrass extends ItemBlock
{
private static final String[] types = new String[] {"holygrass", "smolderinggrass"};
public ItemBlockGrass(int par1)
public ItemBlockGrass(Block block)
{
super(par1);
setMaxDamage(0);
setHasSubtypes(true);
super(block);
this.setMaxDamage(0);
this.setHasSubtypes(true);
}
@Override
@ -21,7 +23,8 @@ public class ItemBlockGrass extends ItemBlock
}
@Override
public String getUnlocalizedName(ItemStack itemstack) {
public String getUnlocalizedName(ItemStack itemstack)
{
int meta = itemstack.getItemDamage();
if (meta < 0 || meta >= types.length) {
meta = 0;

View File

@ -1,11 +1,12 @@
package biomesoplenty.common.itemblocks;
import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
@ -13,7 +14,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ItemBlockGrave extends ItemBlock
{
private Icon grave;
private IIcon grave;
public ItemBlockGrave(Block block)
{
@ -25,13 +26,13 @@ public class ItemBlockGrave extends ItemBlock
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
public void registerIcons(IIconRegister iconRegister)
{
grave = iconRegister.registerIcon("biomesoplenty:item_grave");
}
@Override
public Icon getIconFromDamage(int meta)
public IIcon getIconFromDamage(int meta)
{
return grave;
}
@ -43,16 +44,16 @@ public class ItemBlockGrave extends ItemBlock
}
@Override
public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, float par8, float par9, float par10)
public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, float hitVecX, float hitVecY, float hitVecZ)
{
int id = world.getBlockId(x, y, z);
//TODO: getBlock()
Block block = world.func_147439_a(x, y, z);
if (id == Block.snow.blockID && (world.getBlockMetadata(x, y, z) & 7) < 1)
if (block == Blocks.snow && (world.getBlockMetadata(x, y, z) & 7) < 1)
{
side = 1;
}
else if (id != Block.vine.blockID && id != Block.tallGrass.blockID && id != Block.deadBush.blockID
&& (Block.blocksList[id] == null || !Block.blocksList[id].isBlockReplaceable(world, x, y, z)))
else if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush && !block.isReplaceable(world, x, y, z))
{
if (side == 0)
{
@ -89,11 +90,12 @@ public class ItemBlockGrave extends ItemBlock
return false;
else if (!player.canPlayerEdit(x, y, z, side, itemstack))
return false;
else if (y == 255 && Block.blocksList[itemID].blockMaterial.isSolid())
//TODO: getBlockMaterial()
else if (y == 255 && block.func_149688_o().isSolid())
return false;
else if (world.canPlaceEntityOnSide(itemID, x, y, z, false, side, player, itemstack))
//TODO: canPlaceEntityOnSide()?
else if (world.func_147472_a(block, x, y, z, false, side, player, itemstack))
{
Block block = Block.blocksList[itemID];
int o = ((MathHelper.floor_double((double)(player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3) + 2) % 4;
int fO;
@ -106,22 +108,26 @@ public class ItemBlockGrave extends ItemBlock
fO = 2;
}
if (placeGrave(itemstack, player, block, world, x, y, z, fO, side, par8, par9, par10)) return true;
if (placeGrave(itemstack, player, block, world, x, y, z, fO, side, hitVecX, hitVecY, hitVecZ)) return true;
}
return false;
}
private boolean placeGrave(ItemStack itemstack, EntityPlayer player, Block block, World world, int x, int y, int z, int meta, int side, float par8, float par9, float par10)
private boolean placeGrave(ItemStack itemstack, EntityPlayer player, Block block, World world, int x, int y, int z, int meta, int side, float hitVecX, float hitVecY, float hitVecZ)
{
if (world.isAirBlock(x, y + 1, z))
//TODO: isAirBlock()
if (world.func_147437_c(x, y + 1, z))
{
int k1 = Block.blocksList[itemID].onBlockPlaced(world, x, y, z, side, par8, par9, par10, meta);
int k2 = Block.blocksList[itemID].onBlockPlaced(world, x, y, z, side, par8, par9, par10, meta + 1);
//TODO: onBlockPlaced()
int k1 = block.func_149660_a(world, x, y, z, side, hitVecX, hitVecY, hitVecZ, meta);
//TODO: onBlockPlaced()
int k2 = block.func_149660_a(world, x, y, z, side, hitVecX, hitVecY, hitVecZ, meta + 1);
if (placeBlockAt(itemstack, player, world, x, y, z, side, par8, par9, par10, k1) && placeBlockAt(itemstack, player, world, x, y + 1, z, side, par8, par9, par10, k2))
if (placeBlockAt(itemstack, player, world, x, y, z, side, hitVecX, hitVecY, hitVecZ, k1) && placeBlockAt(itemstack, player, world, x, y + 1, z, side, hitVecX, hitVecY, hitVecZ, k2))
{
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, block.stepSound.getPlaceSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
//TODO: stepSound.getPlaceSound() stepSound.getVolume() stepSound.getPitch()
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, block.field_149762_H.func_150496_b(), (block.field_149762_H.func_150497_c() + 1.0F) / 2.0F, block.field_149762_H.func_150494_d() * 0.8F);
--itemstack.stackSize;
}

View File

@ -1,4 +1,4 @@
package biomesoplenty.itemblocks;
package biomesoplenty.common.itemblocks;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
@ -7,11 +7,12 @@ import biomesoplenty.common.blocks.BlockBOPLeaves;
public class ItemBlockLeaves extends ItemBlock
{
public ItemBlockLeaves(int par1)
public ItemBlockLeaves(Block block)
{
super(par1);
setMaxDamage(0);
setHasSubtypes(true);
super(block);
this.setMaxDamage(0);
this.setHasSubtypes(true);
}
@Override
@ -23,7 +24,9 @@ public class ItemBlockLeaves extends ItemBlock
@Override
public String getUnlocalizedName(ItemStack itemStack)
{
BlockBOPLeaves block = (BlockBOPLeaves)Block.blocksList[itemStack.itemID];
//TODO: linkedBlock
BlockBOPLeaves block = (BlockBOPLeaves)field_150939_a;
return super.getUnlocalizedName() + "." + block.getLeafType(itemStack.getItemDamage());
}
}

View File

@ -1,7 +1,8 @@
package biomesoplenty.itemblocks;
package biomesoplenty.common.itemblocks;
import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -11,11 +12,12 @@ public class ItemBlockPersimmonLeaves extends ItemBlock
@SideOnly(Side.CLIENT)
private Icon texture;
public ItemBlockPersimmonLeaves(int par1)
public ItemBlockPersimmonLeaves(Block block)
{
super(par1);
setMaxDamage(0);
setHasSubtypes(true);
super(block);
this.setMaxDamage(0);
this.setHasSubtypes(true);
}
@Override

View File

@ -1,5 +1,6 @@
package biomesoplenty.itemblocks;
package biomesoplenty.common.itemblocks;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
@ -7,11 +8,12 @@ public class ItemBlockPetals extends ItemBlock
{
private static final String[] petals = new String[] {"bigflowerred", "bigfloweryellow"};
public ItemBlockPetals(int par1)
public ItemBlockPetals(Block block)
{
super(par1);
setMaxDamage(0);
setHasSubtypes(true);
super(block);
this.setMaxDamage(0);
this.setHasSubtypes(true);
}
@Override

View File

@ -1,5 +1,6 @@
package biomesoplenty.itemblocks;
package biomesoplenty.common.itemblocks;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
@ -7,11 +8,12 @@ public class ItemBlockPlank extends ItemBlock
{
private static final String[] woodTypes = new String[] {"acaciaPlank", "cherryPlank", "darkPlank", "firPlank", "holyPlank", "magicPlank", "mangrovePlank", "palmPlank", "redwoodPlank", "willowPlank", "bambooThatching", "pinePlank", "hellBarkPlank", "jacarandaPlank"};
public ItemBlockPlank(int par1)
public ItemBlockPlank(Block block)
{
super(par1);
setMaxDamage(0);
setHasSubtypes(true);
super(block);
this.setMaxDamage(0);
this.setHasSubtypes(true);
}
@Override
@ -24,7 +26,8 @@ public class ItemBlockPlank extends ItemBlock
public String getUnlocalizedName(ItemStack itemStack)
{
int meta = itemStack.getItemDamage();
if (meta < 0 || meta >= woodTypes.length) {
if (meta < 0 || meta >= woodTypes.length)
{
meta = 0;
}

View File

@ -1,5 +1,6 @@
package biomesoplenty.itemblocks;
package biomesoplenty.common.itemblocks;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
@ -7,11 +8,12 @@ public class ItemBlockRedRock extends ItemBlock
{
private static final String[] types = new String[] {"redrock", "redcobble", "redbrick"};
public ItemBlockRedRock(int par1)
public ItemBlockRedRock(Block block)
{
super(par1);
setMaxDamage(0);
setHasSubtypes(true);
super(block);
this.setMaxDamage(0);
this.setHasSubtypes(true);
}
@Override
@ -21,7 +23,8 @@ public class ItemBlockRedRock extends ItemBlock
}
@Override
public String getUnlocalizedName(ItemStack itemstack) {
public String getUnlocalizedName(ItemStack itemstack)
{
int meta = itemstack.getItemDamage();
if (meta < 0 || meta >= types.length) {
meta = 0;

View File

@ -1,21 +1,21 @@
package biomesoplenty.itemblocks;
import javax.swing.Icon;
package biomesoplenty.common.itemblocks;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
public class ItemBlockSapling extends ItemBlock
{
private static final String[] saplings = new String[] {"apple", "yellowautumn", "bamboo", "magic", "dark", "dead", "fir", "holy", "orangeautumn", "origin", "pinkcherry", "maple", "whitecherry", "hellbark", "jacaranda", "persimmon"};
private static final int MAX = 15;
public ItemBlockSapling(int par1)
public ItemBlockSapling(Block block)
{
super(par1);
setMaxDamage(0);
setHasSubtypes(true);
super(block);
this.setMaxDamage(0);
this.setHasSubtypes(true);
}
@Override
@ -31,11 +31,10 @@ public class ItemBlockSapling extends ItemBlock
return super.getUnlocalizedName() + "." + (new StringBuilder()).append(saplings[meta]).append("Sapling").toString();
}
@Override
public Icon getIconFromDamage(int meta)
public IIcon getIconFromDamage(int meta)
{
return Block.blocksList[itemID].getIcon(0, meta);
//TODO: linkedBlock getIcon
return field_150939_a.func_149691_a(0, meta);
}
}

View File

@ -1,5 +1,6 @@
package biomesoplenty.itemblocks;
package biomesoplenty.common.itemblocks;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
@ -7,11 +8,12 @@ public class ItemBlockSkystone extends ItemBlock
{
private static final String[] types = new String[] {"holystone", "holycobble", "holybrick", "holystonemossy"};
public ItemBlockSkystone(int par1)
public ItemBlockSkystone(Block block)
{
super(par1);
setMaxDamage(0);
setHasSubtypes(true);
super(block);
this.setMaxDamage(0);
this.setHasSubtypes(true);
}
@Override
@ -21,7 +23,8 @@ public class ItemBlockSkystone extends ItemBlock
}
@Override
public String getUnlocalizedName(ItemStack itemstack) {
public String getUnlocalizedName(ItemStack itemstack)
{
int meta = itemstack.getItemDamage();
if (meta < 0 || meta >= types.length) {
meta = 0;

View File

@ -1,6 +1,7 @@
package biomesoplenty.itemblocks;
package biomesoplenty.common.itemblocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
import net.minecraft.item.ItemSlab;
import net.minecraft.item.ItemStack;
import biomesoplenty.common.blocks.BlockBOPSlab;
@ -9,17 +10,18 @@ import com.google.common.base.Optional;
public class ItemBlockSlab extends ItemSlab
{
private static Optional<BlockHalfSlab> singleSlab = Optional.absent();
private static Optional<BlockHalfSlab> doubleSlab = Optional.absent();
private static BlockSlab singleSlab;
private static BlockSlab doubleSlab;
static public void setSlabs(BlockHalfSlab singleSlab, BlockHalfSlab doubleSlab)
public static void setSlabs(BlockSlab singleSlab, BlockSlab doubleSlab)
{
ItemBlockSlab.singleSlab = Optional.of(singleSlab);
ItemBlockSlab.doubleSlab = Optional.of(doubleSlab);
ItemBlockSlab.singleSlab = singleSlab;
ItemBlockSlab.doubleSlab = doubleSlab;
}
public ItemBlockSlab(int id) {
super(id, singleSlab.get(), doubleSlab.get(), id == doubleSlab.get().blockID);
public ItemBlockSlab(Block block)
{
super(block, singleSlab, doubleSlab, block == doubleSlab);
}
@Override
@ -29,9 +31,12 @@ public class ItemBlockSlab extends ItemSlab
}
@Override
public String getUnlocalizedName(ItemStack itemStack) {
BlockBOPSlab slab = (BlockBOPSlab)Block.blocksList[itemStack.itemID];
public String getUnlocalizedName(ItemStack itemStack)
{
//TODO: getBlockFromItem
BlockBOPSlab slab = (BlockBOPSlab)Block.func_149634_a(itemStack.getItem());
return super.getUnlocalizedName() + "." + (new StringBuilder()).append(slab.getFullSlabName(itemStack.getItemDamage())).toString();
//TODO: getFullSlabName()
return super.getUnlocalizedName() + "." + (new StringBuilder()).append(slab.func_150002_b(itemStack.getItemDamage())).toString();
}
}

View File

@ -1,23 +1,23 @@
package biomesoplenty.itemblocks;
import javax.swing.Icon;
package biomesoplenty.common.itemblocks;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemBlockTurnip extends ItemBlock
{
@SideOnly(Side.CLIENT)
private Icon texture;
private IIcon texture;
public ItemBlockTurnip(int par1)
public ItemBlockTurnip(Block block)
{
super(par1);
super(block);
}
@Override
public Icon getIconFromDamage(int meta)
public IIcon getIconFromDamage(int meta)
{
return texture;
}

View File

@ -1,26 +1,26 @@
package biomesoplenty.common.itemblocks;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemColored;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import biomesoplenty.api.Blocks;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemBlockWillow extends ItemColored
{
@SideOnly(Side.CLIENT)
private Icon texture;
private IIcon texture;
public ItemBlockWillow(int par1)
public ItemBlockWillow(Block block)
{
super(par1, false);
super(block, false);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
public void registerIcons(IIconRegister iconRegister)
{
texture = iconRegister.registerIcon("biomesoplenty:willow");
}
@ -33,7 +33,7 @@ public class ItemBlockWillow extends ItemColored
}
@Override
public Icon getIconFromDamage(int meta)
public IIcon getIconFromDamage(int meta)
{
return texture;
}

View File

@ -2,11 +2,15 @@ package biomesoplenty.common.items;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
import biomesoplenty.BiomesOPlenty;
public class ItemBOPSeeds extends Item implements IPlantable
@ -29,21 +33,21 @@ public class ItemBOPSeeds extends Item implements IPlantable
}
/*TODO: FEATURE @Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float hitVecX, float hitVecY, float hitVecZ)
{
if (par7 != 1)
if (side != 1)
{
return false;
}
else if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack))
else if (player.canPlayerEdit(x, y, z, side, itemStack) && player.canPlayerEdit(x, y + 1, z, side, itemStack))
{
int i1 = par3World.getBlockId(par4, par5, par6);
int i1 = world.getBlockId(x, y, z);
Block soil = Block.blocksList[i1];
if (soil != null && soil.canSustainPlant(par3World, par4, par5, par6, ForgeDirection.UP, this) && par3World.isAirBlock(par4, par5 + 1, par6))
if (soil != null && soil.canSustainPlant(world, x, y, z, ForgeDirection.UP, this) && world.isAirBlock(x, y + 1, z))
{
par3World.setBlock(par4, par5 + 1, par6, this.blockType);
--par1ItemStack.stackSize;
world.setBlock(x, y + 1, z, this.blockType);
--itemStack.stackSize;
return true;
}
else