initial commit
This commit is contained in:
parent
3c9ee26b06
commit
22186c33b9
1458 changed files with 282792 additions and 0 deletions
55
java/src/game/item/ItemShears.java
Executable file
55
java/src/game/item/ItemShears.java
Executable file
|
@ -0,0 +1,55 @@
|
|||
package game.item;
|
||||
|
||||
import game.block.Block;
|
||||
import game.entity.types.EntityLiving;
|
||||
import game.init.Blocks;
|
||||
import game.init.ToolMaterial;
|
||||
import game.material.Material;
|
||||
import game.world.BlockPos;
|
||||
import game.world.World;
|
||||
|
||||
public class ItemShears extends Item
|
||||
{
|
||||
private final ToolMaterial material;
|
||||
|
||||
public ItemShears(ToolMaterial material)
|
||||
{
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(material.getMaxUses() - 12);
|
||||
this.setTab(CheatTab.tabTools);
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLiving playerIn)
|
||||
{
|
||||
if (blockIn.getShearsEfficiency() < 0) // blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool)
|
||||
{
|
||||
return super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn);
|
||||
}
|
||||
else
|
||||
{
|
||||
stack.damageItem(1, playerIn);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canHarvestBlock(Block blockIn)
|
||||
{
|
||||
return blockIn.getMaterial() == Material.web || blockIn == Blocks.redstone || blockIn == Blocks.string;
|
||||
}
|
||||
|
||||
public float getStrVsBlock(ItemStack stack, Block state)
|
||||
{
|
||||
return state.getShearsEfficiency() <= 0 ? 1.0F : (((float)state.getShearsEfficiency()) * (this.material.getEfficiencyOnProperMaterial() - 1.0F));
|
||||
// state != Blocks.web && state.getMaterial() != Material.leaves ? (state == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, state)) : 15.0F;
|
||||
}
|
||||
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
|
||||
{
|
||||
return this.material.isRepairItem(repair.getItem()) ? true : super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
return this.material.isMagnetic();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue