Take 2 at reeds
This commit is contained in:
parent
1fc72b635f
commit
05945b7bcd
4 changed files with 58 additions and 41 deletions
|
@ -32,6 +32,7 @@ public class BlockBOPPlant extends BlockFlower implements IShearable
|
||||||
{
|
{
|
||||||
private static final String[] plants = new String[] {"deadgrass", "desertgrass", "desertsprouts", "dunegrass", "holytallgrass", "thorn", "barley", "cattail", "rivercane", "cattailtop", "cattailbottom", "wildcarrot", "cactus", "witherwart", "reed"};
|
private static final String[] plants = new String[] {"deadgrass", "desertgrass", "desertsprouts", "dunegrass", "holytallgrass", "thorn", "barley", "cattail", "rivercane", "cattailtop", "cattailbottom", "wildcarrot", "cactus", "witherwart", "reed"};
|
||||||
private Icon[] textures;
|
private Icon[] textures;
|
||||||
|
public Icon reedbottom;
|
||||||
|
|
||||||
private static final int CATTAILTOP = 9;
|
private static final int CATTAILTOP = 9;
|
||||||
private static final int CATTAILBOTTOM = 10;
|
private static final int CATTAILBOTTOM = 10;
|
||||||
|
@ -56,6 +57,8 @@ public class BlockBOPPlant extends BlockFlower implements IShearable
|
||||||
for (int i = 0; i < plants.length; ++i) {
|
for (int i = 0; i < plants.length; ++i) {
|
||||||
textures[i] = iconRegister.registerIcon("biomesoplenty:" + plants[i]);
|
textures[i] = iconRegister.registerIcon("biomesoplenty:" + plants[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reedbottom = iconRegister.registerIcon("biomesoplenty:" + "reedbottom");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -173,9 +173,9 @@ public class FoliageRenderer implements ISimpleBlockRenderingHandler
|
||||||
Icon berryBushBerry = ((BlockBOPFoliage)Blocks.foliage.get()).berryBushBerry;
|
Icon berryBushBerry = ((BlockBOPFoliage)Blocks.foliage.get()).berryBushBerry;
|
||||||
|
|
||||||
tessellator.setColorOpaque_F(par4 * par5, par4 * par6, par4 * par7);
|
tessellator.setColorOpaque_F(par4 * par5, par4 * par6, par4 * par7);
|
||||||
renderCrossedSquaresFromIcon(berryBush, par1, par2, par3, par4, renderer);
|
RenderUtils.renderCrossedSquaresFromIcon(berryBush, par1, par2, par3, par4, renderer);
|
||||||
tessellator.setColorOpaque_F(par4, par4, par4);
|
tessellator.setColorOpaque_F(par4, par4, par4);
|
||||||
renderCrossedSquaresFromIcon(berryBushBerry, par1, par2, par3, par4, renderer);
|
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)
|
private static void renderShrub(double par1, double par2, double par3, float par4, float par5, float par6, float par7, RenderBlocks renderer)
|
||||||
|
@ -185,44 +185,8 @@ public class FoliageRenderer implements ISimpleBlockRenderingHandler
|
||||||
Icon shrubBranch = ((BlockBOPFoliage)Blocks.foliage.get()).shrubBranch;
|
Icon shrubBranch = ((BlockBOPFoliage)Blocks.foliage.get()).shrubBranch;
|
||||||
|
|
||||||
tessellator.setColorOpaque_F(par4 * par5, par4 * par6, par4 * par7);
|
tessellator.setColorOpaque_F(par4 * par5, par4 * par6, par4 * par7);
|
||||||
renderCrossedSquaresFromIcon(shrubLeaf, par1, par2, par3, par4, renderer);
|
RenderUtils.renderCrossedSquaresFromIcon(shrubLeaf, par1, par2, par3, par4, renderer);
|
||||||
tessellator.setColorOpaque_F(par4, par4, par4);
|
tessellator.setColorOpaque_F(par4, par4, par4);
|
||||||
renderCrossedSquaresFromIcon(shrubBranch, par1, par2, par3, par4, renderer);
|
RenderUtils.renderCrossedSquaresFromIcon(shrubBranch, par1, par2, par3, par4, renderer);
|
||||||
}
|
|
||||||
|
|
||||||
private static void renderCrossedSquaresFromIcon(Icon icon, double par3, double par5, double par7, float par9, RenderBlocks renderer)
|
|
||||||
{
|
|
||||||
Tessellator tessellator = Tessellator.instance;
|
|
||||||
|
|
||||||
if (renderer.hasOverrideBlockTexture())
|
|
||||||
{
|
|
||||||
icon = renderer.overrideBlockTexture;
|
|
||||||
}
|
|
||||||
|
|
||||||
double d3 = (double)icon.getMinU();
|
|
||||||
double d4 = (double)icon.getMinV();
|
|
||||||
double d5 = (double)icon.getMaxU();
|
|
||||||
double d6 = (double)icon.getMaxV();
|
|
||||||
double d7 = 0.45D * (double)par9;
|
|
||||||
double d8 = par3 + 0.5D - d7;
|
|
||||||
double d9 = par3 + 0.5D + d7;
|
|
||||||
double d10 = par7 + 0.5D - d7;
|
|
||||||
double d11 = par7 + 0.5D + d7;
|
|
||||||
tessellator.addVertexWithUV(d8, par5 + (double)par9, d10, d3, d4);
|
|
||||||
tessellator.addVertexWithUV(d8, par5 + 0.0D, d10, d3, d6);
|
|
||||||
tessellator.addVertexWithUV(d9, par5 + 0.0D, d11, d5, d6);
|
|
||||||
tessellator.addVertexWithUV(d9, par5 + (double)par9, d11, d5, d4);
|
|
||||||
tessellator.addVertexWithUV(d9, par5 + (double)par9, d11, d3, d4);
|
|
||||||
tessellator.addVertexWithUV(d9, par5 + 0.0D, d11, d3, d6);
|
|
||||||
tessellator.addVertexWithUV(d8, par5 + 0.0D, d10, d5, d6);
|
|
||||||
tessellator.addVertexWithUV(d8, par5 + (double)par9, d10, d5, d4);
|
|
||||||
tessellator.addVertexWithUV(d8, par5 + (double)par9, d11, d3, d4);
|
|
||||||
tessellator.addVertexWithUV(d8, par5 + 0.0D, d11, d3, d6);
|
|
||||||
tessellator.addVertexWithUV(d9, par5 + 0.0D, d10, d5, d6);
|
|
||||||
tessellator.addVertexWithUV(d9, par5 + (double)par9, d10, d5, d4);
|
|
||||||
tessellator.addVertexWithUV(d9, par5 + (double)par9, d10, d3, d4);
|
|
||||||
tessellator.addVertexWithUV(d9, par5 + 0.0D, d10, d3, d6);
|
|
||||||
tessellator.addVertexWithUV(d8, par5 + 0.0D, d11, d5, d6);
|
|
||||||
tessellator.addVertexWithUV(d8, par5 + (double)par9, d11, d5, d4);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ import net.minecraft.client.renderer.EntityRenderer;
|
||||||
import net.minecraft.client.renderer.RenderBlocks;
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import biomesoplenty.api.Blocks;
|
||||||
|
import biomesoplenty.blocks.BlockBOPPlant;
|
||||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||||
|
|
||||||
public class PlantsRenderer implements ISimpleBlockRenderingHandler
|
public class PlantsRenderer implements ISimpleBlockRenderingHandler
|
||||||
|
@ -42,8 +44,10 @@ public class PlantsRenderer implements ISimpleBlockRenderingHandler
|
||||||
if (meta == 13)
|
if (meta == 13)
|
||||||
return renderer.renderBlockCrops(block, x, y, z);
|
return renderer.renderBlockCrops(block, x, y, z);
|
||||||
if (meta == 14)
|
if (meta == 14)
|
||||||
|
{
|
||||||
return renderCrossedSquares(block, x, y, z, renderer, false);
|
return renderCrossedSquares(block, x, y, z, renderer, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +122,17 @@ public class PlantsRenderer implements ISimpleBlockRenderingHandler
|
||||||
d1 += ((i1 >> 20 & 15L) / 15.0F - 1.0D) * 0.2D;
|
d1 += ((i1 >> 20 & 15L) / 15.0F - 1.0D) * 0.2D;
|
||||||
d2 += ((i1 >> 24 & 15L) / 15.0F - 0.5D) * 0.5D;
|
d2 += ((i1 >> 24 & 15L) / 15.0F - 0.5D) * 0.5D;
|
||||||
|
|
||||||
renderer.drawCrossedSquares(par1Block, renderer.blockAccess.getBlockMetadata(par2, par3, par4), d0, d1, d2, 1.0F);
|
int meta = renderer.blockAccess.getBlockMetadata(par2, par3, par4);
|
||||||
|
|
||||||
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,42 @@ public class RenderUtils
|
||||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void renderCrossedSquaresFromIcon(Icon icon, double par3, double par5, double par7, float par9, RenderBlocks renderer)
|
||||||
|
{
|
||||||
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
|
||||||
|
if (renderer.hasOverrideBlockTexture())
|
||||||
|
{
|
||||||
|
icon = renderer.overrideBlockTexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
double d3 = (double)icon.getMinU();
|
||||||
|
double d4 = (double)icon.getMinV();
|
||||||
|
double d5 = (double)icon.getMaxU();
|
||||||
|
double d6 = (double)icon.getMaxV();
|
||||||
|
double d7 = 0.45D * (double)par9;
|
||||||
|
double d8 = par3 + 0.5D - d7;
|
||||||
|
double d9 = par3 + 0.5D + d7;
|
||||||
|
double d10 = par7 + 0.5D - d7;
|
||||||
|
double d11 = par7 + 0.5D + d7;
|
||||||
|
tessellator.addVertexWithUV(d8, par5 + (double)par9, d10, d3, d4);
|
||||||
|
tessellator.addVertexWithUV(d8, par5 + 0.0D, d10, d3, d6);
|
||||||
|
tessellator.addVertexWithUV(d9, par5 + 0.0D, d11, d5, d6);
|
||||||
|
tessellator.addVertexWithUV(d9, par5 + (double)par9, d11, d5, d4);
|
||||||
|
tessellator.addVertexWithUV(d9, par5 + (double)par9, d11, d3, d4);
|
||||||
|
tessellator.addVertexWithUV(d9, par5 + 0.0D, d11, d3, d6);
|
||||||
|
tessellator.addVertexWithUV(d8, par5 + 0.0D, d10, d5, d6);
|
||||||
|
tessellator.addVertexWithUV(d8, par5 + (double)par9, d10, d5, d4);
|
||||||
|
tessellator.addVertexWithUV(d8, par5 + (double)par9, d11, d3, d4);
|
||||||
|
tessellator.addVertexWithUV(d8, par5 + 0.0D, d11, d3, d6);
|
||||||
|
tessellator.addVertexWithUV(d9, par5 + 0.0D, d10, d5, d6);
|
||||||
|
tessellator.addVertexWithUV(d9, par5 + (double)par9, d10, d5, d4);
|
||||||
|
tessellator.addVertexWithUV(d9, par5 + (double)par9, d10, d3, d4);
|
||||||
|
tessellator.addVertexWithUV(d9, par5 + 0.0D, d10, d3, d6);
|
||||||
|
tessellator.addVertexWithUV(d8, par5 + 0.0D, d11, d5, d6);
|
||||||
|
tessellator.addVertexWithUV(d8, par5 + (double)par9, d11, d5, d4);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean renderFace(RenderBlocks renderer, Block block, Icon icon, IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
public static boolean renderFace(RenderBlocks renderer, Block block, Icon icon, IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||||
{
|
{
|
||||||
return renderFace(renderer, block, icon, world, x, y, z, -1, face);
|
return renderFace(renderer, block, icon, world, x, y, z, -1, face);
|
||||||
|
|
Loading…
Reference in a new issue