@Override public final NBTTagCompound buildTag(List<Material> materials) { return buildTagData(materials).get(); }
public NBTTagCompound get() { NBTTagCompound tag = parent.copy(); write(tag); return tag; }
@Override public void read(NBTTagCompound tag) { super.read(tag); axeLevel = tag.getInteger(TAG_AxeLevel); shovelLevel = tag.getInteger(TAG_ShovelLevel); }
@Override protected boolean canApplyCustom(ItemStack stack) throws TinkerGuiException { return !((ToolCore) stack.getItem()).hasCategory(Category.NO_MELEE); }
@Override public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) { if(DualToolHarvestUtils.shouldUseOffhand(player, pos, itemstack)) { ItemStack offhand = player.getHeldItemOffhand(); return offhand.getItem().onBlockStartBreak(offhand, pos, player); } return super.onBlockStartBreak(itemstack, pos, player); }
protected boolean isValidSubitem(Item toolpart) { if(toolpart instanceof IToolPart) { for(Material material : TinkerRegistry.getAllMaterials()) { if(isValidSubitemMaterial(material) && ((IToolPart) toolpart).canUseMaterial(material)) { return true; } } return false; } return true; }
public SwordCore(PartMaterialType... requiredComponents) { super(requiredComponents); // extended compatibility setHarvestLevel("sword", 0); }
@Override public Multimap<String, AttributeModifier> getProjectileAttributeModifier(ItemStack stack) { // return the standard damage map return super.getAttributeModifiers(EntityEquipmentSlot.MAINHAND, stack); }
/** * Workaround for dual-materials like crossbow-bolts. * E.g. Obsidian is not an "acceptable" material because those are only shaft materials * but we still need to generate the texture for it. */ default boolean canUseMaterialForRendering(Material mat) { return canUseMaterial(mat); }
public static ItemStack getItemstackToUse(EntityLivingBase player, IBlockState blockState) { ItemStack mainhand = player.getHeldItemMainhand(); if(!mainhand.isEmpty() && shouldUseOffhand(player, blockState, mainhand)) { return player.getHeldItemOffhand(); } return mainhand; }
@Override public boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStack) { return shouldCauseReequipAnimation(oldStack, newStack, false); }
@Override public List<String> getInformation(ItemStack stack) { return getInformation(stack, true); }
/** A simple string identifier for the tool, used for identification in texture generation etc. */ public String getIdentifier() { return getRegistryName().getResourcePath(); }
public AoeToolCore(PartMaterialType... requiredComponents) { super(requiredComponents); addCategory(Category.AOE); }
@Override public void write(NBTTagCompound tag) { super.write(tag); tag.setInteger(TAG_AxeLevel, axeLevel); tag.setInteger(TAG_ShovelLevel, shovelLevel); } }
@Override public void read(NBTTagCompound tag) { super.read(tag); this.drawSpeed = tag.getFloat(Tags.DRAWSPEED); this.range = tag.getFloat(Tags.RANGE); this.bonusDamage = tag.getFloat(Tags.PROJECTILE_BONUS_DAMAGE); }
@Override public void write(NBTTagCompound tag) { super.write(tag); tag.setFloat(Tags.DRAWSPEED, drawSpeed); tag.setFloat(Tags.RANGE, range); tag.setFloat(Tags.PROJECTILE_BONUS_DAMAGE, bonusDamage); }
@Override public void read(NBTTagCompound tag) { super.read(tag); this.accuracy = tag.getFloat(Tags.ACCURACY); }
@Override public void write(NBTTagCompound tag) { super.write(tag); tag.setFloat(Tags.ACCURACY, accuracy); }
public ToolNBT(NBTTagCompound tag) { read(tag); parent = tag; }