Fixed Bug: #0603 - Anvil Repair of Quartz Tools

This commit is contained in:
AlgorithmX2 2014-07-12 17:57:53 -05:00
parent c0c28e6681
commit 3ec4d8495e
7 changed files with 76 additions and 13 deletions

View file

@ -3,14 +3,17 @@ package appeng.items.tools.quartz;
import java.util.EnumSet;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack;
import appeng.core.features.AEFeature;
import appeng.core.features.AEFeatureHandler;
import appeng.core.features.IAEFeature;
import appeng.util.Platform;
public class ToolQuartzAxe extends ItemAxe implements IAEFeature
{
AEFeatureHandler feature;
final AEFeature type;
final AEFeatureHandler feature;
@Override
public AEFeatureHandler feature()
@ -18,9 +21,14 @@ public class ToolQuartzAxe extends ItemAxe implements IAEFeature
return feature;
}
public boolean getIsRepairable(ItemStack a, ItemStack b)
{
return Platform.canRepair( type, a, b );
}
public ToolQuartzAxe(AEFeature Type) {
super( ToolMaterial.IRON );
feature = new AEFeatureHandler( EnumSet.of( Type, AEFeature.QuartzAxe ), this, Type.name() );
feature = new AEFeatureHandler( EnumSet.of( type = Type, AEFeature.QuartzAxe ), this, Type.name() );
}
@Override

View file

@ -17,13 +17,20 @@ import appeng.util.Platform;
public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
{
public ToolQuartzCuttingKnife(AEFeature type) {
super( ToolQuartzCuttingKnife.class, type.name() );
setfeature( EnumSet.of( type, AEFeature.QuartzKnife ) );
final AEFeature type;
public ToolQuartzCuttingKnife(AEFeature Type) {
super( ToolQuartzCuttingKnife.class, Type.name() );
setfeature( EnumSet.of( type = Type, AEFeature.QuartzKnife ) );
setMaxDamage( 50 );
setMaxStackSize( 1 );
}
public boolean getIsRepairable(ItemStack a, ItemStack b)
{
return Platform.canRepair( type, a, b );
}
@Override
public boolean isRepairable()
{

View file

@ -3,14 +3,17 @@ package appeng.items.tools.quartz;
import java.util.EnumSet;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack;
import appeng.core.features.AEFeature;
import appeng.core.features.AEFeatureHandler;
import appeng.core.features.IAEFeature;
import appeng.util.Platform;
public class ToolQuartzHoe extends ItemHoe implements IAEFeature
{
AEFeatureHandler feature;
final AEFeature type;
final AEFeatureHandler feature;
@Override
public AEFeatureHandler feature()
@ -18,9 +21,14 @@ public class ToolQuartzHoe extends ItemHoe implements IAEFeature
return feature;
}
public boolean getIsRepairable(ItemStack a, ItemStack b)
{
return Platform.canRepair( type, a, b );
}
public ToolQuartzHoe(AEFeature Type) {
super( ToolMaterial.IRON );
feature = new AEFeatureHandler( EnumSet.of( Type, AEFeature.QuartzHoe ), this, Type.name() );
feature = new AEFeatureHandler( EnumSet.of( type = Type, AEFeature.QuartzHoe ), this, Type.name() );
}
@Override

View file

@ -3,14 +3,17 @@ package appeng.items.tools.quartz;
import java.util.EnumSet;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import appeng.core.features.AEFeature;
import appeng.core.features.AEFeatureHandler;
import appeng.core.features.IAEFeature;
import appeng.util.Platform;
public class ToolQuartzPickaxe extends ItemPickaxe implements IAEFeature
{
AEFeatureHandler feature;
final AEFeature type;
final AEFeatureHandler feature;
@Override
public AEFeatureHandler feature()
@ -18,9 +21,14 @@ public class ToolQuartzPickaxe extends ItemPickaxe implements IAEFeature
return feature;
}
public boolean getIsRepairable(ItemStack a, ItemStack b)
{
return Platform.canRepair( type, a, b );
}
public ToolQuartzPickaxe(AEFeature Type) {
super( ToolMaterial.IRON );
feature = new AEFeatureHandler( EnumSet.of( Type, AEFeature.QuartzPickaxe ), this, Type.name() );
feature = new AEFeatureHandler( EnumSet.of( type = Type, AEFeature.QuartzPickaxe ), this, Type.name() );
}
@Override

View file

@ -3,14 +3,17 @@ package appeng.items.tools.quartz;
import java.util.EnumSet;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import appeng.core.features.AEFeature;
import appeng.core.features.AEFeatureHandler;
import appeng.core.features.IAEFeature;
import appeng.util.Platform;
public class ToolQuartzSpade extends ItemSpade implements IAEFeature
{
AEFeatureHandler feature;
final AEFeature type;
final AEFeatureHandler feature;
@Override
public AEFeatureHandler feature()
@ -18,9 +21,14 @@ public class ToolQuartzSpade extends ItemSpade implements IAEFeature
return feature;
}
public boolean getIsRepairable(ItemStack a, ItemStack b)
{
return Platform.canRepair( type, a, b );
}
public ToolQuartzSpade(AEFeature Type) {
super( ToolMaterial.IRON );
feature = new AEFeatureHandler( EnumSet.of( Type, AEFeature.QuartzSpade ), this, Type.name() );
feature = new AEFeatureHandler( EnumSet.of( type = Type, AEFeature.QuartzSpade ), this, Type.name() );
}
@Override

View file

@ -2,15 +2,18 @@ package appeng.items.tools.quartz;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import appeng.core.features.AEFeature;
import appeng.core.features.AEFeatureHandler;
import appeng.core.features.IAEFeature;
import appeng.util.Platform;
public class ToolQuartzSword extends ItemSword implements IAEFeature
{
AEFeatureHandler feature;
final AEFeature type;
final AEFeatureHandler feature;
@Override
public AEFeatureHandler feature()
@ -18,9 +21,14 @@ public class ToolQuartzSword extends ItemSword implements IAEFeature
return feature;
}
public boolean getIsRepairable(ItemStack a, ItemStack b)
{
return Platform.canRepair( type, a, b );
}
public ToolQuartzSword(AEFeature Type) {
super( ToolMaterial.IRON );
feature = new AEFeatureHandler( EnumSet.of( Type, AEFeature.QuartzSword ), this, Type.name() );
feature = new AEFeatureHandler( EnumSet.of( type = Type, AEFeature.QuartzSword ), this, Type.name() );
}
@Override

View file

@ -19,6 +19,7 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.inventory.InventoryCrafting;
@ -83,6 +84,7 @@ import appeng.api.util.AEItemDefinition;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.AppEng;
import appeng.core.features.AEFeature;
import appeng.core.sync.GuiBridge;
import appeng.hooks.TickHandler;
import appeng.me.GridAccessException;
@ -1680,4 +1682,18 @@ public class Platform
TickHandler.instance.addCallable( worldObj, new BlockUpdate( worldObj, xCoord, yCoord, zCoord ) );
}
public static boolean canRepair(AEFeature type, ItemStack a, ItemStack b)
{
if ( b == null || a == null )
return false;
if ( type == AEFeature.CertusQuartzTools )
return AEApi.instance().materials().materialCertusQuartzCrystal.sameAsStack( b );
if ( type == AEFeature.NetherQuartzTools )
return Items.quartz == b.getItem();
return false;
}
}