Made Drill harvest very slowly instead of not at all when out of energy

(Fixes Ghost Blocks when using an empty Drill in creative)
This commit is contained in:
Ellpeck 2015-11-21 10:58:28 +01:00
parent 01b745ccf9
commit 4d7f562754

View file

@ -244,18 +244,18 @@ public class ItemDrill extends ItemEnergy{
@Override
public Multimap getAttributeModifiers(ItemStack stack){
Multimap map = super.getAttributeModifiers(stack);
map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Drill Modifier", this.getEnergyStored(stack) >= ConfigIntValues.DRILL_ENERGY_USE.getValue() ? 8.0F : 0.0F, 0));
map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Drill Modifier", this.getEnergyStored(stack) >= ConfigIntValues.DRILL_ENERGY_USE.getValue() ? 8.0F : 0.1F, 0));
return map;
}
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta){
return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) ? (this.hasExtraWhitelist(block) || block.getHarvestTool(meta) == null || block.getHarvestTool(meta).isEmpty() || this.getToolClasses(stack).contains(block.getHarvestTool(meta)) ? this.getEfficiencyFromUpgrade(stack) : 1.0F) : 0.0F;
return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) ? (this.hasExtraWhitelist(block) || block.getHarvestTool(meta) == null || block.getHarvestTool(meta).isEmpty() || this.getToolClasses(stack).contains(block.getHarvestTool(meta)) ? this.getEfficiencyFromUpgrade(stack) : 1.0F) : 0.1F;
}
@Override
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player){
boolean toReturn = true;
boolean toReturn = false;
int use = this.getEnergyUsePerBlock(stack);
if(this.getEnergyStored(stack) >= use){
//Enchants the Drill depending on the Upgrades it has