Fixed reed rendering

This commit is contained in:
Adubbz 2013-09-24 08:55:39 +10:00
parent 306770be61
commit 1fc72b635f
3 changed files with 54 additions and 3 deletions

View file

@ -140,7 +140,7 @@ public class BlockBOPPlant extends BlockFlower implements IShearable
protected boolean canThisPlantGrowOnThisBlockID(int id)
{
return id == Blocks.driedDirt.get().blockID || id == Block.sand.blockID || id == Blocks.redRock.get().blockID || id == Blocks.holyGrass.get().blockID
|| id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.tilledField.blockID || id == Block.waterStill.blockID;
|| id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.tilledField.blockID;
}
@Override

View file

@ -22,7 +22,7 @@ public class PlantsRenderer implements ISimpleBlockRenderingHandler
{
int meta = world.getBlockMetadata(x, y, z);
if (meta < 5)
return renderCrossedSquares(block, x, y, z, renderer);
return renderCrossedSquares(block, x, y, z, renderer, true);
if (meta == 5)
return renderer.renderCrossedSquares(block, x, y, z);
if (meta == 6)
@ -41,6 +41,8 @@ public class PlantsRenderer implements ISimpleBlockRenderingHandler
return renderer.renderCrossedSquares(block, x, y, z);
if (meta == 13)
return renderer.renderBlockCrops(block, x, y, z);
if (meta == 14)
return renderCrossedSquares(block, x, y, z, renderer, false);
}
return true;
}
@ -77,7 +79,7 @@ public class PlantsRenderer implements ISimpleBlockRenderingHandler
return true;
}
private boolean renderCrossedSquares(Block par1Block, int par2, int par3, int par4, RenderBlocks renderer)
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));
@ -96,6 +98,13 @@ public class PlantsRenderer implements ISimpleBlockRenderingHandler
f2 = f5;
f3 = f6;
}
if (!colourMultiply)
{
f1 = f;
f2 = f;
f3 = f;
}
tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
double d0 = par2;

View file

@ -1,12 +1,15 @@
package biomesoplenty.itemblocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.Icon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -70,6 +73,45 @@ public class ItemBlockPlant extends ItemBlock
else
return Block.blocksList[itemID].getIcon(0, meta);
}
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
{
if (itemStack.getItemDamage() != 14)
return super.onItemRightClick(itemStack, world, player);
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true);
if (movingobjectposition == null)
return itemStack;
else
{
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE)
{
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
if (!world.canMineBlock(player, i, j, k))
return itemStack;
if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack))
return itemStack;
if (world.getBlockMaterial(i, j, k) == Material.water && world.getBlockMetadata(i, j, k) == 0 && world.isAirBlock(i, j + 1, k))
{
world.setBlock(i, j + 1, k, itemStack.itemID, 14, 2);
if (!player.capabilities.isCreativeMode)
{
--itemStack.stackSize;
}
}
}
return itemStack;
}
}
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)