Fixed turbines not dropping with correct metadata

This commit is contained in:
Calclavia 2014-03-02 23:12:35 +08:00
parent d703676ee8
commit 4c1188daee
2 changed files with 32 additions and 0 deletions

View file

@ -1,5 +1,7 @@
package resonantinduction.mechanical.energy.turbine;
import java.util.ArrayList;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@ -19,6 +21,35 @@ public class BlockMechanicalTurbine extends BlockTurbine
rotationMask = Byte.parseByte("111111", 2);
}
@Override
public int getDamageValue(World world, int x, int y, int z)
{
TileEntity tile = world.getBlockTileEntity(x, y, z);
System.out.println(world.isRemote + " : " + tile);
if (tile instanceof TileTurbine)
return ((TileTurbine) tile).tier;
return 0;
}
/**
* Temporarily "cheat" var for dropping with damage.
*/
int dropDamage = 0;
@Override
public int damageDropped(int par1)
{
return dropDamage;
}
@Override
public void breakBlock(World world, int x, int y, int z, int par5, int par6)
{
dropDamage = getDamageValue(world, x, y, z);
super.breakBlock(world, x, y, z, par5, par6);
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack)
{

View file

@ -2,6 +2,7 @@ package resonantinduction.mechanical.energy.turbine;
import java.util.List;
import calclavia.lib.prefab.turbine.TileTurbine;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;