mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-27 15:33:03 +00:00
The return of achievements
- Re-added achievements - Organised all imports (seemed all over the place) - Formatted all code (seemed very combined, used the TinkerStyle)
This commit is contained in:
1 parent
ae2d8d6e4d
commit
80efde613a
419 files changed
+2406
-4144
No files matched your search
@@ -1,7 +1,6 @@
|
||||
package tconstruct.library;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package tconstruct.library;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.*;
|
||||
|
||||
public class TConstructCreativeTab extends CreativeTabs
|
||||
{
|
||||
|
||||
@@ -1,29 +1,12 @@
|
||||
package tconstruct.library;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import tconstruct.library.crafting.Detailing;
|
||||
import tconstruct.library.crafting.LiquidCasting;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import java.util.*;
|
||||
import net.minecraft.item.*;
|
||||
import org.apache.logging.log4j.*;
|
||||
import tconstruct.library.crafting.*;
|
||||
import tconstruct.library.modifier.ActiveArmorMod;
|
||||
import tconstruct.library.tools.ArrowMaterial;
|
||||
import tconstruct.library.tools.BowMaterial;
|
||||
import tconstruct.library.tools.BowstringMaterial;
|
||||
import tconstruct.library.tools.CustomMaterial;
|
||||
import tconstruct.library.tools.FletchingMaterial;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.library.tools.ToolMaterial;
|
||||
import tconstruct.library.tools.*;
|
||||
|
||||
/**
|
||||
* A registry to store any relevant API work
|
||||
@@ -283,8 +266,7 @@ public class TConstructRegistry
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void addToolMaterial (int materialID, String materialName, String displayName, int harvestLevel, int durability, int miningspeed, int attack, float handleModifier, int reinforced,
|
||||
float stonebound, String style, String ability)
|
||||
public static void addToolMaterial (int materialID, String materialName, String displayName, int harvestLevel, int durability, int miningspeed, int attack, float handleModifier, int reinforced, float stonebound, String style, String ability)
|
||||
{
|
||||
logger.warn("[TCon API] Using deprecated addToolMaterial with display and ability name. displayName and ability will be ignored, use languages files for that.");
|
||||
addToolMaterial(materialID, materialName, harvestLevel, durability, miningspeed, attack, handleModifier, reinforced, stonebound, style);
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
package tconstruct.library.accessory;
|
||||
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public abstract class AccessoryCore extends Item implements IAccessory, IModifyable
|
||||
{
|
||||
@@ -21,7 +18,8 @@ public abstract class AccessoryCore extends Item implements IAccessory, IModifya
|
||||
* Override getArmorModel() to have render on the player.
|
||||
*/
|
||||
protected String texture;
|
||||
public AccessoryCore( String texture)
|
||||
|
||||
public AccessoryCore(String texture)
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(TConstructRegistry.equipableTab);
|
||||
@@ -60,21 +58,21 @@ public abstract class AccessoryCore extends Item implements IAccessory, IModifya
|
||||
glove.setTagCompound(baseTag);
|
||||
list.add(glove);
|
||||
}*/
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems (Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
par3List.add(getDefaultItem());
|
||||
}
|
||||
|
||||
public ItemStack getDefaultItem()
|
||||
|
||||
public ItemStack getDefaultItem ()
|
||||
{
|
||||
ItemStack gear = new ItemStack(this, 1, 0);
|
||||
NBTTagCompound itemTag = new NBTTagCompound();
|
||||
|
||||
|
||||
int baseDurability = 500;
|
||||
|
||||
|
||||
itemTag.setInteger("Damage", 0); //Damage is damage to the tool
|
||||
itemTag.setInteger("TotalDurability", baseDurability);
|
||||
itemTag.setInteger("BaseDurability", baseDurability);
|
||||
@@ -83,7 +81,7 @@ public abstract class AccessoryCore extends Item implements IAccessory, IModifya
|
||||
itemTag.setInteger("Modifiers", 5);
|
||||
itemTag.setBoolean("Broken", false);
|
||||
itemTag.setBoolean("Built", true);
|
||||
|
||||
|
||||
NBTTagCompound baseTag = new NBTTagCompound();
|
||||
baseTag.setTag(getBaseTagName(), itemTag);
|
||||
gear.setTagCompound(baseTag);
|
||||
@@ -99,12 +97,12 @@ public abstract class AccessoryCore extends Item implements IAccessory, IModifya
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
itemIcon = iconRegister.registerIcon("tinker:"+texture);
|
||||
itemIcon = iconRegister.registerIcon("tinker:" + texture);
|
||||
registerModifiers(iconRegister);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void registerModifiers(IIconRegister iconRegister)
|
||||
protected void registerModifiers (IIconRegister iconRegister)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package tconstruct.library.accessory;
|
||||
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IAccessoryModel
|
||||
{
|
||||
@@ -15,7 +14,7 @@ public interface IAccessoryModel
|
||||
* @param slot
|
||||
* @return Resource location of the texture. Return null for none
|
||||
*/
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ResourceLocation getWearbleTexture(Entity entity, ItemStack stack, int slot);
|
||||
public ResourceLocation getWearbleTexture (Entity entity, ItemStack stack, int slot);
|
||||
}
|
||||
@@ -1,30 +1,22 @@
|
||||
package tconstruct.library.armor;
|
||||
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.dispenser.IBehaviorDispenseItem;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ISpecialArmor;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.modifier.ActiveArmorMod;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.modifier.*;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public abstract class ArmorCore extends ItemArmor implements ISpecialArmor, IModifyable
|
||||
{
|
||||
@@ -120,8 +112,7 @@ public abstract class ArmorCore extends ItemArmor implements ISpecialArmor, IMod
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon("tinker:" + textureFolder + "/" + textureName
|
||||
+ (this.armorType == 0 ? "helmet" : this.armorType == 1 ? "chestplate" : this.armorType == 2 ? "pants" : this.armorType == 3 ? "boots" : "helmet"));
|
||||
this.itemIcon = iconRegister.registerIcon("tinker:" + textureFolder + "/" + textureName + (this.armorType == 0 ? "helmet" : this.armorType == 1 ? "chestplate" : this.armorType == 2 ? "pants" : this.armorType == 3 ? "boots" : "helmet"));
|
||||
registerModifiers(iconRegister);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package tconstruct.library.armor;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
import tconstruct.library.modifier.*;
|
||||
|
||||
public abstract class ArmorMod extends ItemModifier
|
||||
{
|
||||
@@ -32,7 +29,7 @@ public abstract class ArmorMod extends ItemModifier
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean validType (IModifyable type)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package tconstruct.library.armor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import java.util.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public abstract class ArmorModTypeFilter extends ArmorMod
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package tconstruct.library.armor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.command.IEntitySelector;
|
||||
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
|
||||
import net.minecraft.dispenser.IBlockSource;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.dispenser.*;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.*;
|
||||
|
||||
final class BehaviorDispenseArmorCopy extends BehaviorDefaultDispenseItem
|
||||
{
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package tconstruct.library.client;
|
||||
|
||||
public class GuiElement {
|
||||
public class GuiElement
|
||||
{
|
||||
public final int buttonIconX;
|
||||
public final int buttonIconY;
|
||||
public final String domain;
|
||||
public final String texture;
|
||||
|
||||
public GuiElement(int buttonIconX, int buttonIconY, String domain, String texture) {
|
||||
public GuiElement(int buttonIconX, int buttonIconY, String domain, String texture)
|
||||
{
|
||||
this.buttonIconX = buttonIconX;
|
||||
this.buttonIconY = buttonIconY;
|
||||
this.domain = domain;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package tconstruct.library.client;
|
||||
|
||||
public class StencilGuiElement extends GuiElement {
|
||||
public class StencilGuiElement extends GuiElement
|
||||
{
|
||||
public final int stencilIndex;
|
||||
|
||||
public StencilGuiElement(int buttonIconX, int buttonIconY, int stencilIndex, String domain, String texture) {
|
||||
public StencilGuiElement(int buttonIconX, int buttonIconY, int stencilIndex, String domain, String texture)
|
||||
{
|
||||
super(buttonIconX, buttonIconY, domain, texture);
|
||||
|
||||
this.stencilIndex = stencilIndex;
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package tconstruct.library.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import java.util.*;
|
||||
import mantle.lib.client.MantleClientRegistry;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -89,7 +86,7 @@ public class TConstructClientRegistry
|
||||
public static void registerManualModifier (String name, ItemStack output, ItemStack topinput, ItemStack bottominput)
|
||||
{
|
||||
ItemStack[] recipe = new ItemStack[3];
|
||||
recipe[0] = ModifyBuilder.instance.modifyItem(output, new ItemStack[] {topinput, bottominput});//ToolBuilder.instance.buildTool(output, topinput, bottominput, "");
|
||||
recipe[0] = ModifyBuilder.instance.modifyItem(output, new ItemStack[] { topinput, bottominput });//ToolBuilder.instance.buildTool(output, topinput, bottominput, "");
|
||||
recipe[1] = topinput;
|
||||
recipe[2] = bottominput;
|
||||
MantleClientRegistry.recipeIcons.put(name, recipe);
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
package tconstruct.library.component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
import java.util.*;
|
||||
import net.minecraft.nbt.*;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import tconstruct.library.crafting.Smeltery;
|
||||
|
||||
public class MultiFluidTank extends LogicComponent implements IFluidTank
|
||||
|
||||
@@ -1,19 +1,10 @@
|
||||
package tconstruct.library.component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import mantle.blocks.iface.IFacingLogic;
|
||||
import mantle.blocks.iface.IMasterLogic;
|
||||
import mantle.blocks.iface.IServantLogic;
|
||||
import mantle.world.CoordTuple;
|
||||
import mantle.world.CoordTupleSort;
|
||||
import java.util.*;
|
||||
import mantle.blocks.iface.*;
|
||||
import mantle.world.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagIntArray;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.*;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import tconstruct.TConstruct;
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package tconstruct.library.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import java.util.*;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class AlloyMix
|
||||
|
||||
@@ -25,8 +25,7 @@ public class CastingRecipe
|
||||
|
||||
public boolean matches (FluidStack metal, ItemStack inputCast)
|
||||
{
|
||||
if (castingMetal.isFluidEqual(metal)
|
||||
&& ((cast != null && cast.getItemDamage() == Short.MAX_VALUE && inputCast.getItem() == cast.getItem()) || ItemStack.areItemStacksEqual(this.cast, inputCast)))
|
||||
if (castingMetal.isFluidEqual(metal) && ((cast != null && cast.getItemDamage() == Short.MAX_VALUE && inputCast.getItem() == cast.getItem()) || ItemStack.areItemStacksEqual(this.cast, inputCast)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package tconstruct.library.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import java.util.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class Detailing
|
||||
{
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package tconstruct.library.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.*;
|
||||
|
||||
public class DryingRackRecipes
|
||||
{
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package tconstruct.library.crafting;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import java.util.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
@@ -14,7 +11,7 @@ public class FluidType
|
||||
public final int baseTemperature;
|
||||
public final Fluid fluid;
|
||||
public final boolean isToolpart;
|
||||
|
||||
|
||||
public static HashMap<String, FluidType> fluidTypes = new HashMap<String, FluidType>();
|
||||
|
||||
public FluidType(Block block, int meta, int baseTemperature, Fluid fluid, boolean isToolpart)
|
||||
@@ -25,19 +22,19 @@ public class FluidType
|
||||
this.fluid = fluid;
|
||||
this.isToolpart = isToolpart;
|
||||
}
|
||||
|
||||
public static void registerFluidType(String name, FluidType type)
|
||||
|
||||
public static void registerFluidType (String name, FluidType type)
|
||||
{
|
||||
fluidTypes.put(name, type);
|
||||
}
|
||||
|
||||
public static void registerFluidType(String name, Block block, int meta, int baseTemperature, Fluid fluid, boolean isToolpart)
|
||||
|
||||
public static void registerFluidType (String name, Block block, int meta, int baseTemperature, Fluid fluid, boolean isToolpart)
|
||||
{
|
||||
FluidType type = new FluidType(block, meta, baseTemperature, fluid, isToolpart);
|
||||
registerFluidType(name, type);
|
||||
}
|
||||
|
||||
public static FluidType getFluidType(String typeName)
|
||||
|
||||
public static FluidType getFluidType (String typeName)
|
||||
{
|
||||
return fluidTypes.get(typeName);
|
||||
}
|
||||
@@ -48,7 +45,7 @@ public class FluidType
|
||||
while (iter.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) iter.next();
|
||||
if (((FluidType)pairs.getValue()).fluid.equals(searchedFluid))
|
||||
if (((FluidType) pairs.getValue()).fluid.equals(searchedFluid))
|
||||
return (FluidType) pairs.getValue();
|
||||
}
|
||||
return null;
|
||||
@@ -60,7 +57,7 @@ public class FluidType
|
||||
while (iter.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) iter.next();
|
||||
if (((FluidType)pairs.getValue()).fluid.equals(searchedFluid))
|
||||
if (((FluidType) pairs.getValue()).fluid.equals(searchedFluid))
|
||||
return ((FluidType) pairs.getValue()).baseTemperature;
|
||||
}
|
||||
return 800;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package tconstruct.library.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import tconstruct.library.client.FluidRenderProperties;
|
||||
|
||||
@@ -1,26 +1,23 @@
|
||||
package tconstruct.library.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import java.util.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
import tconstruct.library.modifier.*;
|
||||
|
||||
public class ModifyBuilder
|
||||
{
|
||||
public static ModifyBuilder instance = new ModifyBuilder();
|
||||
public List<ItemModifier> itemModifiers = new ArrayList<ItemModifier>();
|
||||
|
||||
public ItemStack modifyItem(ItemStack input, ItemStack[] modifiers)
|
||||
|
||||
public ItemStack modifyItem (ItemStack input, ItemStack[] modifiers)
|
||||
{
|
||||
ItemStack copy = input.copy(); //Prevent modifying the original
|
||||
if (copy.getItem() instanceof IModifyable)
|
||||
{
|
||||
IModifyable item = (IModifyable) copy.getItem();
|
||||
NBTTagCompound tags = input.getTagCompound().getCompoundTag(item.getBaseTagName());
|
||||
|
||||
|
||||
boolean built = false;
|
||||
for (ItemModifier mod : itemModifiers)
|
||||
{
|
||||
@@ -36,8 +33,8 @@ public class ModifyBuilder
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void registerModifier(ItemModifier mod)
|
||||
|
||||
public static void registerModifier (ItemModifier mod)
|
||||
{
|
||||
if (mod == null)
|
||||
throw new NullPointerException("Modifier cannot be null.");
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
package tconstruct.library.crafting;
|
||||
|
||||
/** How to build tool parts? With patterns! */
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import java.util.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.event.PartBuilderEvent;
|
||||
import tconstruct.library.tools.CustomMaterial;
|
||||
import tconstruct.library.util.IPattern;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
|
||||
public class PatternBuilder
|
||||
{
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package tconstruct.library.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import java.util.*;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
@@ -37,7 +34,7 @@ public class ShapelessToolRecipe extends ShapelessRecipes
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
ItemStack itemstack1 = (ItemStack)iterator.next();
|
||||
ItemStack itemstack1 = (ItemStack) iterator.next();
|
||||
|
||||
// TConstruct.logger.info("Rawr! "+itemstack1.getItemDamage());
|
||||
if (itemstack.getItem() == itemstack1.getItem() && (itemstack1.getItemDamage() == Short.MAX_VALUE || itemstack.getItemDamage() == itemstack1.getItemDamage()))
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
package tconstruct.library.crafting;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import mantle.utils.ItemMetaWrapper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
/** Melting and hacking, churn and burn */
|
||||
@@ -28,15 +24,15 @@ public class Smeltery
|
||||
* @param power The temperature of the fluid. This also influences the melting speed. Lava is 1000.
|
||||
* @param duration How long one "portion" of liquid fuels the smeltery. Lava is 10.
|
||||
*/
|
||||
public static void addSmelteryFuel(Fluid fluid, int power, int duration)
|
||||
public static void addSmelteryFuel (Fluid fluid, int power, int duration)
|
||||
{
|
||||
instance.smelteryFuels.put(fluid, new Integer[] {power, duration});
|
||||
instance.smelteryFuels.put(fluid, new Integer[] { power, duration });
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the liquid is a valid smeltery fuel.
|
||||
*/
|
||||
public static boolean isSmelteryFuel(Fluid fluid)
|
||||
public static boolean isSmelteryFuel (Fluid fluid)
|
||||
{
|
||||
return instance.smelteryFuels.containsKey(fluid);
|
||||
}
|
||||
@@ -44,7 +40,7 @@ public class Smeltery
|
||||
/**
|
||||
* Returns the power of a smeltery fuel or 0 if it's not a fuel.
|
||||
*/
|
||||
public static int getFuelPower(Fluid fluid)
|
||||
public static int getFuelPower (Fluid fluid)
|
||||
{
|
||||
Integer[] power = instance.smelteryFuels.get(fluid);
|
||||
return power == null ? 0 : power[0];
|
||||
@@ -53,7 +49,7 @@ public class Smeltery
|
||||
/**
|
||||
* Returns the duration of a smeltery fuel or 0 if it's not a fuel.
|
||||
*/
|
||||
public static int getFuelDuration(Fluid fluid)
|
||||
public static int getFuelDuration (Fluid fluid)
|
||||
{
|
||||
Integer[] power = instance.smelteryFuels.get(fluid);
|
||||
return power == null ? 0 : power[1];
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package tconstruct.library.crafting;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.*;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class StencilBuilder {
|
||||
public class StencilBuilder
|
||||
{
|
||||
public static StencilBuilder instance = new StencilBuilder();
|
||||
|
||||
public List<ItemStack> blanks = new LinkedList<ItemStack>(); // i wish ItemStack would support equals so i could use a Set here...
|
||||
@@ -15,50 +14,58 @@ public class StencilBuilder {
|
||||
/**
|
||||
* Returns whether the given ItemStack is a blank pattern and therefore usable for stencil crafting.
|
||||
*/
|
||||
public static boolean isBlank(ItemStack stack)
|
||||
public static boolean isBlank (ItemStack stack)
|
||||
{
|
||||
for(ItemStack blank : instance.blanks)
|
||||
if(OreDictionary.itemMatches(stack, blank, false)) // this has nothing to do with the oredictionary.
|
||||
for (ItemStack blank : instance.blanks)
|
||||
if (OreDictionary.itemMatches(stack, blank, false)) // this has nothing to do with the oredictionary.
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void registerBlankStencil(ItemStack itemStack)
|
||||
public static void registerBlankStencil (ItemStack itemStack)
|
||||
{
|
||||
instance.blanks.add(itemStack);
|
||||
}
|
||||
|
||||
public static void registerStencil(Item item, int meta)
|
||||
public static void registerStencil (Item item, int meta)
|
||||
{
|
||||
instance.stencils.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
|
||||
public static void registerStencil(ItemStack pattern)
|
||||
public static void registerStencil (ItemStack pattern)
|
||||
{
|
||||
instance.stencils.add(pattern);
|
||||
}
|
||||
|
||||
public static List<ItemStack> getStencils() { return instance.stencils; }
|
||||
public static List<ItemStack> getStencils ()
|
||||
{
|
||||
return instance.stencils;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the index of the given stencil. If no stencil is found, returns -1.
|
||||
*/
|
||||
public static int getIndex(ItemStack stencil) {
|
||||
for(int i = 0; i < instance.stencils.size(); i++)
|
||||
if(OreDictionary.itemMatches(stencil, getStencil(i), false))
|
||||
public static int getIndex (ItemStack stencil)
|
||||
{
|
||||
for (int i = 0; i < instance.stencils.size(); i++)
|
||||
if (OreDictionary.itemMatches(stencil, getStencil(i), false))
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// returns the stencil with the given index
|
||||
public static ItemStack getStencil(int num) {
|
||||
if(num >= instance.stencils.size())
|
||||
public static ItemStack getStencil (int num)
|
||||
{
|
||||
if (num >= instance.stencils.size())
|
||||
return null;
|
||||
|
||||
return instance.stencils.get(num).copy();
|
||||
}
|
||||
|
||||
public static int getStencilCount() { return instance.stencils.size(); }
|
||||
public static int getStencilCount ()
|
||||
{
|
||||
return instance.stencils.size();
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,16 @@
|
||||
package tconstruct.library.crafting;
|
||||
|
||||
/** Once upon a time, too many tools to count. Let's put them together automatically */
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import java.util.*;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.event.ToolBuildEvent;
|
||||
import tconstruct.library.event.ToolCraftEvent;
|
||||
import tconstruct.library.event.*;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.library.tools.ToolMaterial;
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.library.util.IToolPart;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
|
||||
public class ToolBuilder
|
||||
{
|
||||
@@ -130,7 +123,7 @@ public class ToolBuilder
|
||||
|
||||
if (headStack == null || handleStack == null) //Nothing to build without these. All tools need at least two parts!
|
||||
return null;
|
||||
if(name == null)
|
||||
if (name == null)
|
||||
name = "";
|
||||
|
||||
// fire the ToolBuild event to get the correct items
|
||||
@@ -378,7 +371,6 @@ public class ToolBuilder
|
||||
return null;
|
||||
}*/
|
||||
|
||||
|
||||
int buildReinforced (ToolMaterial headMat, ToolMaterial handleMat, ToolMaterial accessoryMat, ToolMaterial extraMat)
|
||||
{
|
||||
int reinforced = 0;
|
||||
@@ -423,25 +415,25 @@ public class ToolBuilder
|
||||
return (sHead + sHandle) / 2f;
|
||||
}
|
||||
|
||||
public static String defaultToolName(ItemStack stack)
|
||||
public static String defaultToolName (ItemStack stack)
|
||||
{
|
||||
if(!stack.hasTagCompound() || !stack.getTagCompound().hasKey("InfiTool"))
|
||||
if (!stack.hasTagCompound() || !stack.getTagCompound().hasKey("InfiTool"))
|
||||
return null;
|
||||
if(!(stack.getItem() instanceof ToolCore))
|
||||
if (!(stack.getItem() instanceof ToolCore))
|
||||
return null;
|
||||
|
||||
int mat = stack.getTagCompound().getCompoundTag("InfiTool").getInteger("Head");
|
||||
return defaultToolName(TConstructRegistry.getMaterial(mat), (ToolCore) stack.getItem());
|
||||
}
|
||||
|
||||
public static String defaultToolName(ToolMaterial headMat, ToolCore tool)
|
||||
public static String defaultToolName (ToolMaterial headMat, ToolCore tool)
|
||||
{
|
||||
return String.format("%s %s", headMat.prefixName(), tool.getLocalizedToolName());
|
||||
}
|
||||
|
||||
//Passthrough for now
|
||||
@Deprecated
|
||||
public static void registerToolMod(ItemModifier mod)
|
||||
public static void registerToolMod (ItemModifier mod)
|
||||
{
|
||||
ModifyBuilder.registerModifier(mod);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package tconstruct.library.crafting;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package tconstruct.library.event;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/* This event fires after all of the other construction. The resulting nbttag is added to the tool
|
||||
* Note: The tag is the base tag. toolTag.getCompoundTag("InfiTool") will have all of the tool's data.
|
||||
|
||||
@@ -9,23 +9,29 @@ import tconstruct.library.crafting.CastingRecipe;
|
||||
*
|
||||
* Set result to DENY to prevent casting.
|
||||
*/
|
||||
public abstract class SmelteryCastEvent extends Event {
|
||||
public abstract class SmelteryCastEvent extends Event
|
||||
{
|
||||
public final CastingRecipe recipe;
|
||||
public final FluidStack fluid;
|
||||
|
||||
public SmelteryCastEvent(CastingRecipe recipe, FluidStack fluid) {
|
||||
public SmelteryCastEvent(CastingRecipe recipe, FluidStack fluid)
|
||||
{
|
||||
this.recipe = recipe;
|
||||
this.fluid = fluid;
|
||||
}
|
||||
|
||||
public static class CastingTable extends SmelteryCastEvent {
|
||||
public CastingTable(CastingRecipe recipe, FluidStack fluid) {
|
||||
public static class CastingTable extends SmelteryCastEvent
|
||||
{
|
||||
public CastingTable(CastingRecipe recipe, FluidStack fluid)
|
||||
{
|
||||
super(recipe, fluid);
|
||||
}
|
||||
}
|
||||
|
||||
public static class CastingBasin extends SmelteryCastEvent {
|
||||
public CastingBasin(CastingRecipe recipe, FluidStack fluid) {
|
||||
public static class CastingBasin extends SmelteryCastEvent
|
||||
{
|
||||
public CastingBasin(CastingRecipe recipe, FluidStack fluid)
|
||||
{
|
||||
super(recipe, fluid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,26 +8,31 @@ import tconstruct.library.crafting.CastingRecipe;
|
||||
* Fired when an item is cast in the casting table.
|
||||
* If consumeCast is set to true, the cast will be destroyed.
|
||||
*/
|
||||
public abstract class SmelteryCastedEvent extends Event {
|
||||
public abstract class SmelteryCastedEvent extends Event
|
||||
{
|
||||
public final CastingRecipe recipe;
|
||||
public ItemStack output;
|
||||
public boolean consumeCast;
|
||||
|
||||
public SmelteryCastedEvent(CastingRecipe recipe, ItemStack output) {
|
||||
public SmelteryCastedEvent(CastingRecipe recipe, ItemStack output)
|
||||
{
|
||||
this.recipe = recipe;
|
||||
this.consumeCast = recipe.consumeCast;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
|
||||
public static class CastingTable extends SmelteryCastedEvent {
|
||||
public CastingTable(CastingRecipe recipe, ItemStack output) {
|
||||
public static class CastingTable extends SmelteryCastedEvent
|
||||
{
|
||||
public CastingTable(CastingRecipe recipe, ItemStack output)
|
||||
{
|
||||
super(recipe, output);
|
||||
}
|
||||
}
|
||||
|
||||
public static class CastingBasin extends SmelteryCastedEvent {
|
||||
public CastingBasin(CastingRecipe recipe, ItemStack output) {
|
||||
public static class CastingBasin extends SmelteryCastedEvent
|
||||
{
|
||||
public CastingBasin(CastingRecipe recipe, ItemStack output)
|
||||
{
|
||||
super(recipe, output);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package tconstruct.library.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import mantle.blocks.abstracts.InventoryLogic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public class SmelteryEvent extends Event
|
||||
{
|
||||
|
||||
@@ -7,14 +7,16 @@ import net.minecraft.item.ItemStack;
|
||||
* Called when the ToolBuilder tries to piece together the Parts of a tool.
|
||||
*
|
||||
*/
|
||||
public class ToolBuildEvent extends Event {
|
||||
public class ToolBuildEvent extends Event
|
||||
{
|
||||
public ItemStack headStack;
|
||||
public ItemStack handleStack;
|
||||
public ItemStack accessoryStack;
|
||||
public ItemStack extraStack;
|
||||
public String name; // to allow shenanigans
|
||||
|
||||
public ToolBuildEvent(ItemStack headStack, ItemStack handleStack, ItemStack accessoryStack, ItemStack extraStack, String name) {
|
||||
public ToolBuildEvent(ItemStack headStack, ItemStack handleStack, ItemStack accessoryStack, ItemStack extraStack, String name)
|
||||
{
|
||||
this.headStack = headStack;
|
||||
this.handleStack = handleStack;
|
||||
this.accessoryStack = accessoryStack;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package tconstruct.library.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.tools.ToolMaterial;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import tconstruct.library.tools.*;
|
||||
|
||||
/* This event fires after all of the other construction. The resulting nbttag is added to the tool
|
||||
* Note: The tag is the base tag. toolTag.getCompoundTag("InfiTool") will have all of the tool's data.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package tconstruct.library.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public class ToolCraftedEvent extends Event
|
||||
{
|
||||
|
||||
@@ -3,14 +3,13 @@ package tconstruct.library.modifier;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.ArmorPart;
|
||||
import tconstruct.library.armor.*;
|
||||
|
||||
public class ActiveArmorMod
|
||||
{
|
||||
/* Ticks for every armor piece on client and server */
|
||||
public void onArmorTick (World world, EntityPlayer player, ItemStack itemStack, ArmorCore armor, ArmorPart type)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,9 +5,9 @@ public interface IModifyable
|
||||
/**
|
||||
* @return The base tag to modify. Ex: InfiTool
|
||||
*/
|
||||
public String getBaseTagName();
|
||||
|
||||
public String getModifyType();
|
||||
|
||||
public String[] getTraits();
|
||||
public String getBaseTagName ();
|
||||
|
||||
public String getModifyType ();
|
||||
|
||||
public String[] getTraits ();
|
||||
}
|
||||
@@ -1,11 +1,6 @@
|
||||
package tconstruct.library.modifier;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import java.util.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -15,7 +10,7 @@ public abstract class ItemModifier
|
||||
public final List stacks;
|
||||
public final int effectIndex;
|
||||
public static Random random = new Random();
|
||||
|
||||
|
||||
/** Default constructor
|
||||
*
|
||||
* @param recipe Items to compare against when checking the modifier
|
||||
@@ -78,12 +73,12 @@ public abstract class ItemModifier
|
||||
return list.isEmpty();
|
||||
}
|
||||
|
||||
protected String getTagName(ItemStack stack)
|
||||
protected String getTagName (ItemStack stack)
|
||||
{
|
||||
return ((IModifyable)stack.getItem()).getBaseTagName();
|
||||
return ((IModifyable) stack.getItem()).getBaseTagName();
|
||||
}
|
||||
|
||||
protected NBTTagCompound getModifierTag(ItemStack stack)
|
||||
|
||||
protected NBTTagCompound getModifierTag (ItemStack stack)
|
||||
{
|
||||
return stack.getTagCompound().getCompoundTag(getTagName(stack));
|
||||
}
|
||||
@@ -245,7 +240,7 @@ public abstract class ItemModifier
|
||||
return false;
|
||||
return ItemStack.areItemStackTagsEqual(stack1, stack2);
|
||||
}
|
||||
|
||||
|
||||
public static NBTTagCompound getAttributeTag (String attributeType, String modifierName, double amount, boolean flat, UUID uuid)
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
|
||||
@@ -1,40 +1,27 @@
|
||||
package tconstruct.library.tools;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import java.util.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntityGhast;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.monster.*;
|
||||
import net.minecraft.entity.passive.EntityWolf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.*;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.stats.AchievementList;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.stats.*;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.event.entity.player.UseHoeEvent;
|
||||
import tconstruct.library.ActiveToolMod;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.*;
|
||||
import tconstruct.library.util.PiercingEntityDamage;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
|
||||
public class AbilityHelper
|
||||
{
|
||||
@@ -139,8 +126,7 @@ public class AbilityHelper
|
||||
|
||||
if (damage > 0 || enchantDamage > 0)
|
||||
{
|
||||
boolean criticalHit = player.fallDistance > 0.0F && !player.onGround && !player.isOnLadder() && !player.isInWater() && !player.isPotionActive(Potion.blindness)
|
||||
&& player.ridingEntity == null && entity instanceof EntityLivingBase;
|
||||
boolean criticalHit = player.fallDistance > 0.0F && !player.onGround && !player.isOnLadder() && !player.isInWater() && !player.isPotionActive(Potion.blindness) && player.ridingEntity == null && entity instanceof EntityLivingBase;
|
||||
|
||||
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
|
||||
{
|
||||
@@ -212,8 +198,7 @@ public class AbilityHelper
|
||||
|
||||
if (knockback > 0)
|
||||
{
|
||||
entity.addVelocity((double) (-MathHelper.sin(player.rotationYaw * (float) Math.PI / 180.0F) * (float) knockback * 0.5F), 0.1D,
|
||||
(double) (MathHelper.cos(player.rotationYaw * (float) Math.PI / 180.0F) * (float) knockback * 0.5F));
|
||||
entity.addVelocity((double) (-MathHelper.sin(player.rotationYaw * (float) Math.PI / 180.0F) * (float) knockback * 0.5F), 0.1D, (double) (MathHelper.cos(player.rotationYaw * (float) Math.PI / 180.0F) * (float) knockback * 0.5F));
|
||||
player.motionX *= 0.6D;
|
||||
player.motionZ *= 0.6D;
|
||||
player.setSprinting(false);
|
||||
@@ -309,8 +294,7 @@ public class AbilityHelper
|
||||
|
||||
if (!(living instanceof EntityPlayer) || player.canAttackPlayer((EntityPlayer) living))
|
||||
{
|
||||
List var6 = player.worldObj.getEntitiesWithinAABB(EntityWolf.class,
|
||||
AxisAlignedBB.getBoundingBox(player.posX, player.posY, player.posZ, player.posX + 1.0D, player.posY + 1.0D, player.posZ + 1.0D).expand(16.0D, 4.0D, 16.0D));
|
||||
List var6 = player.worldObj.getEntitiesWithinAABB(EntityWolf.class, AxisAlignedBB.getBoundingBox(player.posX, player.posY, player.posZ, player.posX + 1.0D, player.posY + 1.0D, player.posZ + 1.0D).expand(16.0D, 4.0D, 16.0D));
|
||||
Iterator var4 = var6.iterator();
|
||||
|
||||
while (var4.hasNext())
|
||||
@@ -386,7 +370,7 @@ public class AbilityHelper
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean damageEnergyTool(ItemStack stack, NBTTagCompound tags, Entity entity)
|
||||
public static boolean damageEnergyTool (ItemStack stack, NBTTagCompound tags, Entity entity)
|
||||
{
|
||||
if (!tags.hasKey("Energy"))
|
||||
return false;
|
||||
@@ -424,7 +408,8 @@ public class AbilityHelper
|
||||
{
|
||||
ToolCore tool = (ToolCore) stack.getItem();
|
||||
// first try charging from the hotbar
|
||||
if(entity instanceof EntityPlayer) {
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
// workaround for charging flux-capacitors making tools unusable
|
||||
chargeEnergyFromHotbar(stack, (EntityPlayer) entity, tags);
|
||||
energy = tool.getEnergyStored(stack);
|
||||
@@ -440,7 +425,6 @@ public class AbilityHelper
|
||||
energy -= trueSpeed * 2;
|
||||
tags.setInteger("Energy", energy);
|
||||
|
||||
|
||||
stack.setItemDamage(1 + (tool.getMaxEnergyStored(stack) - energy) * (stack.getMaxDamage() - 1) / tool.getMaxEnergyStored(stack));
|
||||
}
|
||||
return true;
|
||||
@@ -449,13 +433,13 @@ public class AbilityHelper
|
||||
protected static void chargeEnergyFromHotbar (ItemStack stack, EntityPlayer player, NBTTagCompound tags)
|
||||
{
|
||||
// cool kids only
|
||||
if(!(stack.getItem() instanceof ToolCore))
|
||||
if (!(stack.getItem() instanceof ToolCore))
|
||||
return;
|
||||
|
||||
ToolCore tool = (ToolCore)stack.getItem();
|
||||
ToolCore tool = (ToolCore) stack.getItem();
|
||||
|
||||
// check if the tool can actually receive energy
|
||||
if(tool.receiveEnergy(stack, 1, true) != 1)
|
||||
if (tool.receiveEnergy(stack, 1, true) != 1)
|
||||
// no you're not going to charge that potato battery on your tool
|
||||
return;
|
||||
|
||||
@@ -464,7 +448,7 @@ public class AbilityHelper
|
||||
int missing = max - buffer;
|
||||
|
||||
// you're full. xbox go home.
|
||||
if(missing <= 0)
|
||||
if (missing <= 0)
|
||||
return;
|
||||
|
||||
// iterate through hotbar
|
||||
@@ -473,10 +457,10 @@ public class AbilityHelper
|
||||
ItemStack slot = player.inventory.mainInventory[iter];
|
||||
|
||||
// check if item is not another tool
|
||||
if(slot == null || slot.getItem() instanceof ToolCore)
|
||||
if (slot == null || slot.getItem() instanceof ToolCore)
|
||||
continue;
|
||||
// check if item gives energy
|
||||
if(!(slot.getItem() instanceof IEnergyContainerItem))
|
||||
if (!(slot.getItem() instanceof IEnergyContainerItem))
|
||||
continue;
|
||||
|
||||
IEnergyContainerItem fluxItem = (IEnergyContainerItem) slot.getItem();
|
||||
@@ -488,7 +472,7 @@ public class AbilityHelper
|
||||
}
|
||||
}
|
||||
// update energy
|
||||
tags.setInteger("Energy", max-missing);
|
||||
tags.setInteger("Energy", max - missing);
|
||||
}
|
||||
|
||||
public static void breakTool (ItemStack stack, NBTTagCompound tags, Entity entity)
|
||||
@@ -546,7 +530,7 @@ public class AbilityHelper
|
||||
if (side != 0 && world.getBlock(x, y + 1, z).isAir(world, x, y + 1, z) && (block == Blocks.grass || block == Blocks.dirt))
|
||||
{
|
||||
Block block1 = Blocks.farmland;
|
||||
world.playSoundEffect((double)((float)x + 0.5F), (double)((float)y + 0.5F), (double)((float)z + 0.5F), block1.stepSound.getStepResourcePath(), (block1.stepSound.getVolume() + 1.0F) / 2.0F, block1.stepSound.getPitch() * 0.8F);
|
||||
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block1.stepSound.getStepResourcePath(), (block1.stepSound.getVolume() + 1.0F) / 2.0F, block1.stepSound.getPitch() * 0.8F);
|
||||
|
||||
if (world.isRemote)
|
||||
{
|
||||
@@ -680,7 +664,7 @@ public class AbilityHelper
|
||||
return world.func_147447_a(vec3, vec31, par3, !par3, par3);
|
||||
}
|
||||
|
||||
public static float calcToolSpeed(ToolCore tool, NBTTagCompound tags)
|
||||
public static float calcToolSpeed (ToolCore tool, NBTTagCompound tags)
|
||||
{
|
||||
float mineSpeed = tags.getInteger("MiningSpeed");
|
||||
int heads = 1;
|
||||
@@ -702,7 +686,7 @@ public class AbilityHelper
|
||||
heads++;
|
||||
}
|
||||
float speedMod = 1f;
|
||||
if(tool instanceof HarvestTool)
|
||||
if (tool instanceof HarvestTool)
|
||||
speedMod = ((HarvestTool) tool).breakSpeedModifier();
|
||||
|
||||
float trueSpeed = mineSpeed / (heads * 100f) * speedMod;
|
||||
@@ -711,12 +695,12 @@ public class AbilityHelper
|
||||
return trueSpeed;
|
||||
}
|
||||
|
||||
public static float calcStoneboundBonus(ToolCore tool, NBTTagCompound tags)
|
||||
public static float calcStoneboundBonus (ToolCore tool, NBTTagCompound tags)
|
||||
{
|
||||
int durability = tags.getInteger("Damage");
|
||||
float stonebound = tags.getFloat("Shoddy");
|
||||
float stoneboundMod = 72f;
|
||||
if(tool instanceof HarvestTool)
|
||||
if (tool instanceof HarvestTool)
|
||||
stoneboundMod = ((HarvestTool) tool).stoneboundModifier();
|
||||
|
||||
return (float) Math.log(durability / stoneboundMod + 1) * 2 * stonebound;
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package tconstruct.library.tools;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class CustomMaterial
|
||||
{
|
||||
public final int materialID;
|
||||
@@ -35,13 +33,13 @@ public abstract class CustomMaterial
|
||||
/**
|
||||
* Wether an itemstack is a stack of this custom material or not.
|
||||
*/
|
||||
public boolean matches(ItemStack stack)
|
||||
public boolean matches (ItemStack stack)
|
||||
{
|
||||
if(this.oredict != null)
|
||||
if (this.oredict != null)
|
||||
{
|
||||
List<ItemStack> items = OreDictionary.getOres(oredict);
|
||||
for(ItemStack item : items)
|
||||
if(OreDictionary.itemMatches(item, stack, false))
|
||||
for (ItemStack item : items)
|
||||
if (OreDictionary.itemMatches(item, stack, false))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,7 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.library.ActiveToolMod;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.*;
|
||||
|
||||
/* Base class for harvest tools with each head having a different purpose */
|
||||
|
||||
@@ -19,7 +18,7 @@ public abstract class DualHarvestTool extends HarvestTool
|
||||
{
|
||||
super(baseDamage);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
@@ -123,12 +122,13 @@ public abstract class DualHarvestTool extends HarvestTool
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEffective(Material material) {
|
||||
if(super.isEffective(material))
|
||||
public boolean isEffective (Material material)
|
||||
{
|
||||
if (super.isEffective(material))
|
||||
return true;
|
||||
|
||||
for(Material m : getEffectiveSecondaryMaterials())
|
||||
if(m == material)
|
||||
for (Material m : getEffectiveSecondaryMaterials())
|
||||
if (m == material)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
@@ -3,16 +3,18 @@ package tconstruct.library.tools;
|
||||
import mantle.blocks.BlockUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.tools.TinkerToolEvents;
|
||||
|
||||
public class FletchlingLeafMaterial extends FletchingMaterial {
|
||||
public FletchlingLeafMaterial(int materialID, int value, String oredict, ItemStack craftingItem, float accuracy, float breakChance, float mass) {
|
||||
public class FletchlingLeafMaterial extends FletchingMaterial
|
||||
{
|
||||
public FletchlingLeafMaterial(int materialID, int value, String oredict, ItemStack craftingItem, float accuracy, float breakChance, float mass)
|
||||
{
|
||||
super(materialID, value, oredict, craftingItem, accuracy, breakChance, mass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(ItemStack stack) {
|
||||
if(matchesLeaves(stack))
|
||||
public boolean matches (ItemStack stack)
|
||||
{
|
||||
if (matchesLeaves(stack))
|
||||
return true;
|
||||
|
||||
return super.matches(stack);
|
||||
|
||||
@@ -5,22 +5,18 @@ import mantle.world.WorldHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.PlayerControllerMP;
|
||||
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.INetHandler;
|
||||
import net.minecraft.network.play.client.C07PacketPlayerDigging;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import tconstruct.library.ActiveToolMod;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.*;
|
||||
|
||||
/* Base class for tools that should be harvesting blocks */
|
||||
|
||||
@@ -30,7 +26,7 @@ public abstract class HarvestTool extends ToolCore
|
||||
{
|
||||
super(baseDamage);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
@@ -138,7 +134,7 @@ public abstract class HarvestTool extends ToolCore
|
||||
return calculateStrength(tags, block, meta);
|
||||
}
|
||||
}
|
||||
if (this.getHarvestType().equals(block.getHarvestTool(meta)) && block.getHarvestLevel(meta) > 0)
|
||||
if (this.getHarvestType().equals(block.getHarvestTool(meta)) && block.getHarvestLevel(meta) > 0)
|
||||
{
|
||||
return calculateStrength(tags, block, meta); // No issue if the
|
||||
// harvest level is
|
||||
@@ -157,12 +153,12 @@ public abstract class HarvestTool extends ToolCore
|
||||
return AbilityHelper.calcToolSpeed(this, tags);
|
||||
}
|
||||
|
||||
public float breakSpeedModifier()
|
||||
public float breakSpeedModifier ()
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public float stoneboundModifier()
|
||||
|
||||
public float stoneboundModifier ()
|
||||
{
|
||||
return 72f;
|
||||
}
|
||||
@@ -193,10 +189,10 @@ public abstract class HarvestTool extends ToolCore
|
||||
|
||||
protected abstract String getHarvestType ();
|
||||
|
||||
public boolean isEffective(Material material)
|
||||
public boolean isEffective (Material material)
|
||||
{
|
||||
for(Material m : getEffectiveMaterials())
|
||||
if(m == material)
|
||||
for (Material m : getEffectiveMaterials())
|
||||
if (m == material)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -297,7 +293,7 @@ public abstract class HarvestTool extends ToolCore
|
||||
}
|
||||
|
||||
// The Scythe is not a HarvestTool and can't call this method, if you change something here you might change it there too.
|
||||
public void mineBlock(World world, int x, int y, int z, int meta, EntityPlayer player, Block block)
|
||||
public void mineBlock (World world, int x, int y, int z, int meta, EntityPlayer player, Block block)
|
||||
{
|
||||
// Workaround for dropping experience
|
||||
boolean silktouch = EnchantmentHelper.getSilkTouchModifier(player);
|
||||
@@ -313,9 +309,11 @@ public abstract class HarvestTool extends ToolCore
|
||||
if (!silktouch)
|
||||
block.dropXpOnBlockBreak(world, x, y, z, exp);
|
||||
|
||||
if(world.isRemote) {
|
||||
if (world.isRemote)
|
||||
{
|
||||
INetHandler handler = FMLClientHandler.instance().getClientPlayHandler();
|
||||
if(handler != null && handler instanceof NetHandlerPlayClient) {
|
||||
if (handler != null && handler instanceof NetHandlerPlayClient)
|
||||
{
|
||||
NetHandlerPlayClient handlerClient = (NetHandlerPlayClient) handler;
|
||||
handlerClient.addToSendQueue(new C07PacketPlayerDigging(0, x, y, z, Minecraft.getMinecraft().objectMouseOver.sideHit));
|
||||
handlerClient.addToSendQueue(new C07PacketPlayerDigging(2, x, y, z, Minecraft.getMinecraft().objectMouseOver.sideHit));
|
||||
|
||||
@@ -1,34 +1,22 @@
|
||||
package tconstruct.library.tools;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
import java.util.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemPotion;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.library.ActiveToolMod;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.*;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
import tconstruct.library.modifier.*;
|
||||
import tconstruct.tools.entity.FancyEntityItem;
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* NBTTags Main tag - InfiTool
|
||||
@@ -74,15 +62,15 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IMo
|
||||
setNoRepair();
|
||||
canRepair = false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getBaseTagName()
|
||||
public String getBaseTagName ()
|
||||
{
|
||||
return "InfiTool";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getModifyType()
|
||||
public String getModifyType ()
|
||||
{
|
||||
return "Tool";
|
||||
}
|
||||
@@ -119,7 +107,7 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IMo
|
||||
return this.getClass().getSimpleName();
|
||||
}
|
||||
|
||||
public String getLocalizedToolName()
|
||||
public String getLocalizedToolName ()
|
||||
{
|
||||
return StatCollector.translateToLocal("tool." + getToolName().toLowerCase());
|
||||
}
|
||||
@@ -801,8 +789,8 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IMo
|
||||
if (tags == null || !tags.hasKey("Energy"))
|
||||
return 0;
|
||||
int energy = tags.getInteger("Energy");
|
||||
int energyReceived = tags.hasKey("EnergyReceiveRate") ? tags.getInteger("EnergyReceiveRate") : this.maxReceive; // backup value
|
||||
int maxEnergy = tags.hasKey("EnergyMax") ? tags.getInteger("EnergyMax") : this.capacity; // backup value
|
||||
int energyReceived = tags.hasKey("EnergyReceiveRate") ? tags.getInteger("EnergyReceiveRate") : this.maxReceive; // backup value
|
||||
int maxEnergy = tags.hasKey("EnergyMax") ? tags.getInteger("EnergyMax") : this.capacity; // backup value
|
||||
|
||||
// calculate how much we can receive
|
||||
energyReceived = Math.min(maxEnergy - energy, Math.min(energyReceived, maxReceive));
|
||||
@@ -858,7 +846,7 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IMo
|
||||
if (tags == null || !tags.hasKey("Energy"))
|
||||
return 0;
|
||||
|
||||
if(tags.hasKey("EnergyMax"))
|
||||
if (tags.hasKey("EnergyMax"))
|
||||
return tags.getInteger("EnergyMax");
|
||||
// backup
|
||||
return capacity;
|
||||
|
||||
@@ -17,11 +17,11 @@ public class ToolMaterial
|
||||
public final float stonebound;
|
||||
public final String tipStyle;
|
||||
|
||||
|
||||
@Deprecated
|
||||
public String displayName;
|
||||
@Deprecated
|
||||
public String ability;
|
||||
|
||||
@Deprecated
|
||||
public ToolMaterial(String name, String displayName, int level, int durability, int speed, int damage, float handle, int reinforced, float stonebound, String style, String ability)
|
||||
{
|
||||
@@ -56,12 +56,15 @@ public class ToolMaterial
|
||||
return materialName;
|
||||
}
|
||||
|
||||
public String localizedName() { return StatCollector.translateToLocal("material." + materialName.toLowerCase()); }
|
||||
public String localizedName ()
|
||||
{
|
||||
return StatCollector.translateToLocal("material." + materialName.toLowerCase());
|
||||
}
|
||||
|
||||
public String prefixName()
|
||||
public String prefixName ()
|
||||
{
|
||||
// check if there's a special name, otherwise use the regular one
|
||||
if(StatCollector.canTranslate(String.format("material.%s.display", materialName.toLowerCase())))
|
||||
if (StatCollector.canTranslate(String.format("material.%s.display", materialName.toLowerCase())))
|
||||
return StatCollector.translateToLocal(String.format("material.%s.display", materialName.toLowerCase()));
|
||||
return localizedName();
|
||||
}
|
||||
@@ -112,7 +115,7 @@ public class ToolMaterial
|
||||
*/
|
||||
public String ability ()
|
||||
{
|
||||
if(StatCollector.canTranslate(String.format("material.%s.ability", materialName.toLowerCase())))
|
||||
if (StatCollector.canTranslate(String.format("material.%s.ability", materialName.toLowerCase())))
|
||||
return StatCollector.translateToLocal(String.format("material.%s.ability", materialName.toLowerCase()));
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package tconstruct.library.tools;
|
||||
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public abstract class Weapon extends ToolCore
|
||||
{
|
||||
|
||||
@@ -1,27 +1,31 @@
|
||||
package tconstruct.library.util;
|
||||
|
||||
import java.util.*;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Lookup for the name of each harvest level. Use this clientside only for display purposes.
|
||||
*/
|
||||
public final class HarvestLevels {
|
||||
private HarvestLevels() {} // non-instantiable
|
||||
public final class HarvestLevels
|
||||
{
|
||||
private HarvestLevels()
|
||||
{
|
||||
} // non-instantiable
|
||||
|
||||
public static final Map<Integer, String> harvestLevelNames = new HashMap<Integer, String>();
|
||||
|
||||
public static String getHarvestLevelName (int num) {
|
||||
public static String getHarvestLevelName (int num)
|
||||
{
|
||||
return harvestLevelNames.containsKey(num) ? harvestLevelNames.get(num) : String.valueOf(num);
|
||||
}
|
||||
|
||||
// initialization
|
||||
static{
|
||||
static
|
||||
{
|
||||
String base = "gui.mining";
|
||||
int i = 0;
|
||||
while(StatCollector.canTranslate(String.format("%s%d", base, i+1))) {
|
||||
while (StatCollector.canTranslate(String.format("%s%d", base, i + 1)))
|
||||
{
|
||||
harvestLevelNames.put(i, StatCollector.translateToLocal(String.format("%s%d", base, i + 1)));
|
||||
i++;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user