diff options
Diffstat (limited to 'src/main/java/lance5057/tDefense')
73 files changed, 4361 insertions, 1917 deletions
diff --git a/src/main/java/lance5057/tDefense/Reference.java b/src/main/java/lance5057/tDefense/Reference.java index 2908cf5..83c7a0a 100644 --- a/src/main/java/lance5057/tDefense/Reference.java +++ b/src/main/java/lance5057/tDefense/Reference.java @@ -4,7 +4,7 @@ public class Reference { public static final String MOD_ID = "tinkerscompendium"; - public static final String VERSION = "1.4.2.8a"; + public static final String VERSION = "1.4.2.9a"; public static final String MOD_NAME = "Tinkers' Compendium"; } diff --git a/src/main/java/lance5057/tDefense/TinkersDefense.java b/src/main/java/lance5057/tDefense/TinkersDefense.java index e39b439..06833d1 100644 --- a/src/main/java/lance5057/tDefense/TinkersDefense.java +++ b/src/main/java/lance5057/tDefense/TinkersDefense.java @@ -20,7 +20,7 @@ import scala.reflect.internal.Trees.Modifiers; import slimeknights.mantle.client.CreativeTab; -@Mod(modid = Reference.MOD_ID, version = Reference.VERSION, name = Reference.MOD_NAME, dependencies = "required-after:tconstruct") +@Mod(modid = Reference.MOD_ID, version = Reference.VERSION, name = Reference.MOD_NAME, dependencies = "required-after: tconstruct") public class TinkersDefense { private static int modGuiIndex = 0; @@ -62,8 +62,9 @@ public class TinkersDefense { holiday = new HolidayBase(); - mats = new TDMaterials(); + parts = new TDParts(); + mats = new TDMaterials(); tools = new TDTools(); events = new TDEvents(); traits = new TDTraits(); @@ -71,8 +72,11 @@ public class TinkersDefense { //core.preInit(e); holiday.preInit(e); - mats.preInit(e); + + + parts.preInit(e); + mats.preInit(e); tools.preInit(e); traits.preInit(); events.preInit(); @@ -86,9 +90,12 @@ public class TinkersDefense { NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy); //core.init(e); holiday.init(e); - mats.init(e); + + + parts.init(e); - tools.init(e); + mats.init(e); + tools.init(e); traits.init(); events.init(); proxy.init(); @@ -100,8 +107,11 @@ public class TinkersDefense { @Mod.EventHandler public void postInit(FMLPostInitializationEvent e) { - mats.postInit(e); + + + parts.postInit(e); + mats.postInit(e); tools.postInit(e); traits.postInit(); events.postInit(); diff --git a/src/main/java/lance5057/tDefense/armor/events/ArmorBaseEvents.java b/src/main/java/lance5057/tDefense/armor/events/ArmorBaseEvents.java index 4f00ee9..fe25f81 100644 --- a/src/main/java/lance5057/tDefense/armor/events/ArmorBaseEvents.java +++ b/src/main/java/lance5057/tDefense/armor/events/ArmorBaseEvents.java @@ -1,6 +1,6 @@ package lance5057.tDefense.armor.events; -import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableList; import lance5057.tDefense.core.tools.bases.ArmorCore; import net.minecraft.nbt.NBTTagCompound; diff --git a/src/main/java/lance5057/tDefense/core/blocks/ArmorStationBlock.java b/src/main/java/lance5057/tDefense/core/blocks/ArmorStationBlock.java index 71abf9f..b7d61ab 100644 --- a/src/main/java/lance5057/tDefense/core/blocks/ArmorStationBlock.java +++ b/src/main/java/lance5057/tDefense/core/blocks/ArmorStationBlock.java @@ -25,6 +25,8 @@ public class ArmorStationBlock extends BlockTable implements ITinkerStationBlock public ArmorStationBlock() { super(Material.WOOD); + this.setUnlocalizedName("armorstation"); + this.setRegistryName("armorstation"); this.setCreativeTab(TinkerRegistry.tabGeneral); this.setSoundType(SoundType.WOOD); this.setResistance(5f); diff --git a/src/main/java/lance5057/tDefense/core/gui/ArmorStationContainer.java b/src/main/java/lance5057/tDefense/core/gui/ArmorStationContainer.java index c0b7016..2216ed1 100644 --- a/src/main/java/lance5057/tDefense/core/gui/ArmorStationContainer.java +++ b/src/main/java/lance5057/tDefense/core/gui/ArmorStationContainer.java @@ -1,6 +1,353 @@ package lance5057.tDefense.core.gui; -public class ArmorStationContainer -{ +import java.util.List; +import java.util.Set; -} +import lance5057.tDefense.core.library.ArmorBuilder; +import lance5057.tDefense.core.library.TDRegistry; +import lance5057.tDefense.core.network.ArmorStationSelectionPacket; +import lance5057.tDefense.core.tileentities.ArmorStationTile; +import lance5057.tDefense.core.tools.bases.ArmorBase; +import lance5057.tDefense.core.tools.bases.ArmorCore; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; +import net.minecraft.util.StringUtils; +import net.minecraft.world.WorldServer; +import slimeknights.mantle.inventory.BaseContainer; +import slimeknights.mantle.util.ItemStackList; +import slimeknights.tconstruct.TConstruct; +import slimeknights.tconstruct.common.Sounds; +import slimeknights.tconstruct.common.TinkerNetwork; +import slimeknights.tconstruct.library.Util; +import slimeknights.tconstruct.library.events.TinkerCraftingEvent; +import slimeknights.tconstruct.library.modifiers.TinkerGuiException; +import slimeknights.tconstruct.library.tinkering.IModifyable; +import slimeknights.tconstruct.library.tinkering.IRepairable; +import slimeknights.tconstruct.library.tinkering.PartMaterialType; +import slimeknights.tconstruct.library.utils.TagUtil; +import slimeknights.tconstruct.library.utils.ToolBuilder; +import slimeknights.tconstruct.tools.common.client.GuiToolStation; +import slimeknights.tconstruct.tools.common.inventory.ContainerTinkerStation; +import slimeknights.tconstruct.tools.common.inventory.SlotToolStationIn; +import slimeknights.tconstruct.tools.common.network.ToolStationSelectionPacket; +import slimeknights.tconstruct.tools.common.network.ToolStationTextPacket; + +// also tool forge +public class ArmorStationContainer extends ContainerTinkerStation<ArmorStationTile> { + + private final EntityPlayer player; + protected ArmorStationSlotOut out; + protected ArmorCore selectedTool; // needed for newly opened containers to sync + protected int activeSlots; + public String toolName; + + public ArmorStationContainer(InventoryPlayer playerInventory, ArmorStationTile tile) { + super(tile); + + // input slots + int i; + for(i = 0; i < tile.getSizeInventory(); i++) { + addSlotToContainer(new SlotToolStationIn(tile, i, 0, 0, this)); + } + + // output slot + out = new ArmorStationSlotOut(i, 124, 38, this); + addSlotToContainer(out); + this.addPlayerInventory(playerInventory, 8, 84 + 8); + onCraftMatrixChanged(null); + + this.player = playerInventory.player; + } + + public ItemStack getResult() { + return out.getStack(); + } + + @Override + protected void syncNewContainer(EntityPlayerMP player) { + this.activeSlots = tile.getSizeInventory(); + TinkerNetwork.sendTo(new ToolStationSelectionPacket(null, tile.getSizeInventory()), player); + } + + @Override + protected void syncWithOtherContainer(BaseContainer<ArmorStationTile> otherContainer, EntityPlayerMP player) { + this.syncWithOtherContainer((ArmorStationContainer) otherContainer, player); + } + + protected void syncWithOtherContainer(ArmorStationContainer otherContainer, EntityPlayerMP player) { + // set same selection as other container + this.setToolSelection(otherContainer.selectedTool, otherContainer.activeSlots); + this.setToolName(otherContainer.toolName); + // also send the data to the player + TinkerNetwork.sendTo(new ArmorStationSelectionPacket(otherContainer.selectedTool, otherContainer.activeSlots), player); + if(otherContainer.toolName != null && !otherContainer.toolName.isEmpty()) { + TinkerNetwork.sendTo(new ToolStationTextPacket(otherContainer.toolName), player); + } + } + + public void setToolSelection(ArmorCore selectedTool2, int activeSlots) { + if(activeSlots > tile.getSizeInventory()) { + activeSlots = tile.getSizeInventory(); + } + + this.activeSlots = activeSlots; + this.selectedTool = selectedTool2; + + for(int i = 0; i < tile.getSizeInventory(); i++) { + Slot slot = inventorySlots.get(i); + // set part info for the slot + if(slot instanceof SlotToolStationIn) { + SlotToolStationIn slotToolPart = (SlotToolStationIn) slot; + + slotToolPart.setRestriction(null); + + // deactivate not needed slots + if(i >= activeSlots) { + slotToolPart.deactivate(); + } + // activate the other slots and set toolpart if possible + else { + slotToolPart.activate(); + if(selectedTool2 != null) { + List<PartMaterialType> pmts = selectedTool2.getToolBuildComponents(); + if(i < pmts.size()) { + slotToolPart.setRestriction(pmts.get(i)); + } + } + } + + if(world.isRemote) { + slotToolPart.updateIcon(); + } + } + } + } + + public void setToolName(String name) { + this.toolName = name; + + if(world.isRemote) { + GuiScreen screen = Minecraft.getMinecraft().currentScreen; + if(screen instanceof GuiToolStation) { + ((GuiToolStation) screen).textField.setText(name); + } + } + + onCraftMatrixChanged(tile); + if(out.getHasStack()) { + if(name != null && !name.isEmpty()) { + out.inventory.getStackInSlot(0).setStackDisplayName(name); + } + else { + out.inventory.getStackInSlot(0).clearCustomName(); + } + } + } + + // update crafting - called whenever the content of an input slot changes + @Override + public void onCraftMatrixChanged(IInventory inventoryIn) { + // reset gui state + updateGUI(); + try { + ItemStack result; + // 1. try repairing + result = repairTool(false); + // 2. try swapping tool parts + if(result.isEmpty()) { + result = replaceToolParts(false); + } + // 3. try modifying + if(result.isEmpty()) { + result = modifyTool(false); + } + // 4. try renaming + if(result.isEmpty()) { + result = renameTool(); + } + // 5. try building a new tool + if(result.isEmpty()) { + result = buildTool(); + } + + out.inventory.setInventorySlotContents(0, result); + updateGUI(); + } catch(TinkerGuiException e) { + // error ;( + out.inventory.setInventorySlotContents(0, ItemStack.EMPTY); + this.error(e.getMessage()); + } + // sync output with other open containers on the server + if(!this.world.isRemote) { + WorldServer server = (WorldServer) this.world; + for(EntityPlayer player : server.playerEntities) { + if(player.openContainer != this && player.openContainer instanceof ArmorStationContainer && this.sameGui((ArmorStationContainer) player.openContainer)) { + ((ArmorStationContainer) player.openContainer).out.inventory.setInventorySlotContents(0, out.getStack()); + } + } + } + } + + // Called when the crafting result is taken out of its slot + public void onResultTaken(EntityPlayer playerIn, ItemStack stack) { + boolean resultTaken = false; + + try { + resultTaken = !repairTool(true).isEmpty() || + !replaceToolParts(true).isEmpty() || + !modifyTool(true).isEmpty() || + !renameTool().isEmpty(); + } catch(TinkerGuiException e) { + // no error updating needed + e.printStackTrace(); + } + + if(resultTaken) { + updateSlotsAfterToolAction(); + } + else { + // calculate the result again (serverside) + try { + ItemStack tool = buildTool(); + + // we built a tool + if(!tool.isEmpty()) { + // remove 1 of each in the slots + // it's guaranteed that each slot that has an item has used exactly 1 item to build the tool + for(int i = 0; i < tile.getSizeInventory(); i++) { + tile.decrStackSize(i, 1); + } + + setToolName(""); + } + } catch(TinkerGuiException e) { + // no error updating needed + e.printStackTrace(); + } + } + onCraftMatrixChanged(null); + + this.playCraftSound(playerIn); + } + + protected void playCraftSound(EntityPlayer player) { + Sounds.playSoundForAll(player, Sounds.saw, 0.8f, 0.8f + 0.4f * TConstruct.random.nextFloat()); + } + + private ItemStack repairTool(boolean remove) { + ItemStack repairable = getToolStack(); + + // modifying possible? + if(repairable.isEmpty() || !(repairable.getItem() instanceof IRepairable)) { + return ItemStack.EMPTY; + } + + return ToolBuilder.tryRepairTool(getInputs(), repairable, remove); + } + + private ItemStack replaceToolParts(boolean remove) throws TinkerGuiException { + ItemStack tool = getToolStack(); + + if(tool.isEmpty() || !(tool.getItem() instanceof ArmorBase)) { + return ItemStack.EMPTY; + } + + NonNullList<ItemStack> inputs = getInputs(); + ItemStack result = ToolBuilder.tryReplaceToolParts(tool, inputs, remove); + if(!result.isEmpty()) { + TinkerCraftingEvent.ToolPartReplaceEvent.fireEvent(result, player, inputs); + } + return result; + } + + private ItemStack modifyTool(boolean remove) throws TinkerGuiException { + ItemStack modifyable = getToolStack(); + + // modifying possible? + if(modifyable.isEmpty() || !(modifyable.getItem() instanceof IModifyable)) { + return ItemStack.EMPTY; + } + + ItemStack result = ToolBuilder.tryModifyTool(getInputs(), modifyable, remove); + if(!result.isEmpty()) { + TinkerCraftingEvent.ToolModifyEvent.fireEvent(result, player, modifyable.copy()); + } + return result; + } + + private ItemStack renameTool() throws TinkerGuiException { + ItemStack tool = getToolStack(); + + // modifying possible? + if(tool.isEmpty() || + !(tool.getItem() instanceof ArmorBase) || + StringUtils.isNullOrEmpty(toolName) || + tool.getDisplayName().equals(toolName)) { + return ItemStack.EMPTY; + } + + ItemStack result = tool.copy(); + if(TagUtil.getNoRenameFlag(result)) { + throw new TinkerGuiException(Util.translate("gui.error.no_rename")); + } + + result.setStackDisplayName(toolName); + + return result; + } + + private ItemStack buildTool() throws TinkerGuiException { + NonNullList<ItemStack> input = ItemStackList.withSize(tile.getSizeInventory()); + for(int i = 0; i < input.size(); i++) { + input.set(i, tile.getStackInSlot(i)); + } + + ItemStack result = ArmorBuilder.tryBuildArmor(input, toolName, getBuildableTools()); + if(!result.isEmpty()) { + TinkerCraftingEvent.ToolCraftingEvent.fireEvent(result, player, input); + } + return result; + } + + protected Set<ArmorCore> getBuildableTools() { + return TDRegistry.getArmorStationCrafting(); + } + + private ItemStack getToolStack() { + return inventorySlots.get(0).getStack(); + } + + /** + * Removes the tool in the input slot and fixes all stacks that have stacksize 0 after being used up. + */ + private void updateSlotsAfterToolAction() { +// perfect, items already got removed but we still have to clean up 0-stacks and remove the tool + tile.setInventorySlotContents(0, ItemStack.EMPTY); // slot where the tool was + for(int i = 1; i < tile.getSizeInventory(); i++) { + if(!tile.getStackInSlot(i).isEmpty() && tile.getStackInSlot(i).getCount() == 0) { + tile.setInventorySlotContents(i, ItemStack.EMPTY); + } + } + } + + private NonNullList<ItemStack> getInputs() { + NonNullList<ItemStack> input = NonNullList.withSize(tile.getSizeInventory() - 1, ItemStack.EMPTY); + for(int i = 1; i < tile.getSizeInventory(); i++) { + input.set(i - 1, tile.getStackInSlot(i)); + } + + return input; + } + + @Override + public boolean canMergeSlot(ItemStack stack, Slot slot) { + return slot != out && super.canMergeSlot(stack, slot); + } +}
\ No newline at end of file diff --git a/src/main/java/lance5057/tDefense/core/gui/ArmorStationGui.java b/src/main/java/lance5057/tDefense/core/gui/ArmorStationGui.java index 8bcea9c..0de5ced 100644 --- a/src/main/java/lance5057/tDefense/core/gui/ArmorStationGui.java +++ b/src/main/java/lance5057/tDefense/core/gui/ArmorStationGui.java @@ -9,10 +9,13 @@ import org.lwjgl.util.Point; import com.google.common.collect.Lists; +import lance5057.tDefense.core.library.ArmorBuildGuiInfo; +import lance5057.tDefense.core.library.TDClientRegistry; +import lance5057.tDefense.core.library.TDRegistry; +import lance5057.tDefense.core.network.ArmorStationSelectionPacket; +import lance5057.tDefense.core.tileentities.ArmorStationTile; +import lance5057.tDefense.core.tools.bases.ArmorBase; import lance5057.tDefense.core.tools.bases.ArmorCore; -import lance5057.tDefense.util.ArmorBuildGuiInfo; -import lance5057.tDefense.util.TDClientRegistry; -import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; @@ -31,32 +34,21 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import slimeknights.mantle.client.gui.GuiElement; import slimeknights.mantle.client.gui.GuiElementScalable; -import slimeknights.mantle.client.gui.GuiModule; import slimeknights.tconstruct.common.TinkerNetwork; import slimeknights.tconstruct.library.TinkerRegistry; -import slimeknights.tconstruct.library.TinkerRegistryClient; import slimeknights.tconstruct.library.Util; import slimeknights.tconstruct.library.client.Icons; -import slimeknights.tconstruct.library.client.ToolBuildGuiInfo; import slimeknights.tconstruct.library.modifiers.IModifier; import slimeknights.tconstruct.library.modifiers.ModifierNBT; import slimeknights.tconstruct.library.tinkering.IModifyable; import slimeknights.tconstruct.library.tinkering.IToolStationDisplay; import slimeknights.tconstruct.library.tinkering.PartMaterialType; -import slimeknights.tconstruct.library.tinkering.TinkersItem; import slimeknights.tconstruct.library.tools.IToolPart; -import slimeknights.tconstruct.library.tools.ToolCore; import slimeknights.tconstruct.library.utils.TagUtil; -import slimeknights.tconstruct.tools.common.client.GuiButtonRepair; import slimeknights.tconstruct.tools.common.client.GuiTinkerStation; -import slimeknights.tconstruct.tools.common.client.module.GuiButtonsToolStation; import slimeknights.tconstruct.tools.common.client.module.GuiInfoPanel; -import slimeknights.tconstruct.tools.common.inventory.ContainerTinkerStation; -import slimeknights.tconstruct.tools.common.inventory.ContainerToolStation; import slimeknights.tconstruct.tools.common.inventory.SlotToolStationIn; -import slimeknights.tconstruct.tools.common.network.ToolStationSelectionPacket; import slimeknights.tconstruct.tools.common.network.ToolStationTextPacket; -import slimeknights.tconstruct.tools.common.tileentity.TileToolStation; @SideOnly(Side.CLIENT) public class ArmorStationGui extends GuiTinkerStation { @@ -99,8 +91,8 @@ public class ArmorStationGui extends GuiTinkerStation { public ArmorBuildGuiInfo currentInfo = ArmorStationGuiButtonRepair.info; - public ArmorStationGui(InventoryPlayer playerInv, World world, BlockPos pos, TileToolStation tile) { - super(world, pos, (ContainerTinkerStation) tile.createContainer(playerInv, world, pos)); + public ArmorStationGui(InventoryPlayer playerInv, World world, BlockPos pos, ArmorStationTile armorStationTile) { + super(world, pos, (ArmorStationContainer) armorStationTile.createContainer(playerInv, world, pos)); buttons = new ArmorStationGuiButtons(this, inventorySlots); this.addModule(buttons); @@ -152,32 +144,32 @@ public class ArmorStationGui extends GuiTinkerStation { Keyboard.enableRepeatEvents(false); } - public Set<ToolCore> getBuildableItems() { - return TinkerRegistry.getToolStationCrafting(); + public Set<ArmorCore> getBuildableItems() { + return TDRegistry.getArmorStationCrafting(); } public void onToolSelection(ArmorBuildGuiInfo data) { activeSlots = Math.min(data.positions.size(), Table_slot_count); currentInfo = data; - ToolCore tool = null; + ArmorCore tool = null; - if(data.armor.getItem() instanceof ToolCore) { - tool = (ToolCore) data.armor.getItem(); + if(data.armor.getItem() instanceof ArmorCore) { + tool = (ArmorCore) data.armor.getItem(); } - ((ContainerToolStation) inventorySlots).setToolSelection(tool, activeSlots); + ((ArmorStationContainer) inventorySlots).setToolSelection(tool, activeSlots); // update the server (and others) - TinkerNetwork.sendToServer(new ToolStationSelectionPacket(tool, activeSlots)); + TinkerNetwork.sendToServer(new ArmorStationSelectionPacket(tool, activeSlots)); updateGUI(); } - public void onToolSelectionPacket(ToolStationSelectionPacket packet) { - ArmorBuildGuiInfo info = TDClientRegistry.getArmorBuildInfoForArmor(packet.tool); + public void onToolSelectionPacket(ArmorStationSelectionPacket armorStationSelectionPacket) { + ArmorBuildGuiInfo info = TDClientRegistry.getArmorBuildInfoForArmor(armorStationSelectionPacket.armor); if(info == null) { info = ArmorStationGuiButtonRepair.info; } - activeSlots = packet.activeSlots; + activeSlots = armorStationSelectionPacket.activeSlots; currentInfo = info; buttons.setSelectedButtonByTool(currentInfo.armor); @@ -218,7 +210,7 @@ public class ArmorStationGui extends GuiTinkerStation { @Override public void updateDisplay() { // tool info of existing or tool to build - ContainerToolStation container = (ContainerToolStation) inventorySlots; + ArmorStationContainer container = (ArmorStationContainer) inventorySlots; ItemStack toolStack = container.getResult(); if(toolStack.isEmpty()) { toolStack = inventorySlots.getSlot(0).getStack(); @@ -282,7 +274,7 @@ public class ArmorStationGui extends GuiTinkerStation { // tool build info else { ArmorCore tool = (ArmorCore) currentInfo.armor.getItem(); - toolInfo.setCaption(tool.getLocalizedToolName()); + toolInfo.setCaption(tool.getLocalizedToolName()); toolInfo.setText(tool.getLocalizedDescription()); // Components @@ -338,7 +330,7 @@ public class ArmorStationGui extends GuiTinkerStation { textField.textboxKeyTyped(typedChar, keyCode); TinkerNetwork.sendToServer(new ToolStationTextPacket(textField.getText())); - ((ContainerToolStation) container).setToolName(textField.getText()); + ((ArmorStationContainer) container).setToolName(textField.getText()); } } @@ -434,7 +426,7 @@ public class ArmorStationGui extends GuiTinkerStation { if(currentInfo == ArmorStationGuiButtonRepair.info) { drawRepairSlotIcons(); } - else if(currentInfo.armor.getItem() instanceof TinkersItem) { + else if(currentInfo.armor.getItem() instanceof ArmorBase) { for(int i = 0; i < activeSlots; i++) { Slot slot = inventorySlots.getSlot(i); if(!(slot instanceof SlotToolStationIn)) { @@ -555,7 +547,7 @@ public class ArmorStationGui extends GuiTinkerStation { buttons.metal(); beamL = BeamLeft.shift(0, BeamLeft.h); - beamR = BeamRight.shift(0, BeamRight.h); + beamR = BeamRight.shift(0, BeamRight.h); beamC = BeamCenter.shift(0, BeamCenter.h); } diff --git a/src/main/java/lance5057/tDefense/core/gui/ArmorStationGuiButtonRepair.java b/src/main/java/lance5057/tDefense/core/gui/ArmorStationGuiButtonRepair.java index dba33e8..1dddfa8 100644 --- a/src/main/java/lance5057/tDefense/core/gui/ArmorStationGuiButtonRepair.java +++ b/src/main/java/lance5057/tDefense/core/gui/ArmorStationGuiButtonRepair.java @@ -1,6 +1,6 @@ package lance5057.tDefense.core.gui; -import lance5057.tDefense.util.ArmorBuildGuiInfo; +import lance5057.tDefense.core.library.ArmorBuildGuiInfo; import net.minecraft.client.Minecraft; import net.minecraft.util.text.translation.I18n; import slimeknights.tconstruct.library.client.Icons; diff --git a/src/main/java/lance5057/tDefense/core/gui/ArmorStationGuiButtons.java b/src/main/java/lance5057/tDefense/core/gui/ArmorStationGuiButtons.java index d89b002..2e047b4 100644 --- a/src/main/java/lance5057/tDefense/core/gui/ArmorStationGuiButtons.java +++ b/src/main/java/lance5057/tDefense/core/gui/ArmorStationGuiButtons.java @@ -2,16 +2,14 @@ package lance5057.tDefense.core.gui; import java.io.IOException; -import lance5057.tDefense.util.ArmorBuildGuiInfo; -import lance5057.tDefense.util.TDClientRegistry; +import lance5057.tDefense.core.library.ArmorBuildGuiInfo; +import lance5057.tDefense.core.library.TDClientRegistry; import net.minecraft.client.gui.GuiButton; import net.minecraft.inventory.Container; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import slimeknights.tconstruct.library.client.Icons; -import slimeknights.tconstruct.library.client.ToolBuildGuiInfo; import slimeknights.tconstruct.tools.common.client.GuiButtonItem; -import slimeknights.tconstruct.tools.common.client.GuiToolStation; import slimeknights.tconstruct.tools.common.client.module.GuiSideButtons; public class ArmorStationGuiButtons extends GuiSideButtons { @@ -19,7 +17,7 @@ public class ArmorStationGuiButtons extends GuiSideButtons { protected final ArmorStationGui parent; public ArmorStationGuiButtons(ArmorStationGui parent, Container container) { - super(parent, container, GuiToolStation.Column_Count); + super(parent, container, ArmorStationGui.Column_Count); this.parent = parent; } @@ -65,8 +63,8 @@ public class ArmorStationGuiButtons extends GuiSideButtons { for(Object o : buttonList) { if(o instanceof GuiButtonItem) { @SuppressWarnings("unchecked") - GuiButtonItem<ToolBuildGuiInfo> btn = (GuiButtonItem<ToolBuildGuiInfo>) o; - btn.pressed = ItemStack.areItemStacksEqual(btn.data.tool, stack); + GuiButtonItem<ArmorBuildGuiInfo> btn = (GuiButtonItem<ArmorBuildGuiInfo>) o; + btn.pressed = ItemStack.areItemStacksEqual(btn.data.armor, stack); } } } diff --git a/src/main/java/lance5057/tDefense/core/gui/ArmorStationSlotOut.java b/src/main/java/lance5057/tDefense/core/gui/ArmorStationSlotOut.java new file mode 100644 index 0000000..b3187a4 --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/gui/ArmorStationSlotOut.java @@ -0,0 +1,36 @@ +package lance5057.tDefense.core.gui; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.InventoryCraftResult; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.common.FMLCommonHandler; +import slimeknights.tconstruct.tools.common.inventory.ContainerToolStation; + +import javax.annotation.Nonnull; + +public class ArmorStationSlotOut extends Slot { + + public ArmorStationContainer parent; + + public ArmorStationSlotOut(int index, int xPosition, int yPosition, ArmorStationContainer container) { + super(new InventoryCraftResult(), index, xPosition, yPosition); + + this.parent = container; + } + + @Override + public boolean isItemValid(ItemStack stack) { + return false; + } + + @Nonnull + @Override + public ItemStack onTake(EntityPlayer playerIn, @Nonnull ItemStack stack) { + FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, parent.getTile()); + parent.onResultTaken(playerIn, stack); + stack.onCrafting(playerIn.getEntityWorld(), playerIn, 1); + + return super.onTake(playerIn, stack); + } +}
\ No newline at end of file diff --git a/src/main/java/lance5057/tDefense/util/ArmorBuildGuiInfo.java b/src/main/java/lance5057/tDefense/core/library/ArmorBuildGuiInfo.java index a72b9ab..cf9f522 100644 --- a/src/main/java/lance5057/tDefense/util/ArmorBuildGuiInfo.java +++ b/src/main/java/lance5057/tDefense/core/library/ArmorBuildGuiInfo.java @@ -1,4 +1,4 @@ -package lance5057.tDefense.util; +package lance5057.tDefense.core.library; import java.util.List; diff --git a/src/main/java/lance5057/tDefense/util/ArmorBuilder.java b/src/main/java/lance5057/tDefense/core/library/ArmorBuilder.java index 94014a6..2edb3fe 100644 --- a/src/main/java/lance5057/tDefense/util/ArmorBuilder.java +++ b/src/main/java/lance5057/tDefense/core/library/ArmorBuilder.java @@ -1,4 +1,4 @@ -package lance5057.tDefense.util; +package lance5057.tDefense.core.library; import java.util.Collection; import java.util.List; @@ -37,7 +37,6 @@ import slimeknights.tconstruct.library.tinkering.MaterialItem; import slimeknights.tconstruct.library.tinkering.PartMaterialType; import slimeknights.tconstruct.library.tools.IToolPart; import slimeknights.tconstruct.library.tools.Pattern; -import slimeknights.tconstruct.library.tools.ToolCore; import slimeknights.tconstruct.library.traits.AbstractTrait; import slimeknights.tconstruct.library.traits.ITrait; import slimeknights.tconstruct.library.utils.ListUtil; @@ -54,7 +53,7 @@ public final class ArmorBuilder { @Nonnull public static ItemStack tryBuildTool(NonNullList<ItemStack> stacks, String name) { - return tryBuildArmor(stacks, name, TDRegistry.getArmor()); + return tryBuildArmor(stacks, name, TDRegistry.getArmor()); } /** @@ -87,10 +86,10 @@ public final class ArmorBuilder { input = ItemStackList.of(stacks); for(Item item : possibleTools) { - if(!(item instanceof ToolCore)) { + if(!(item instanceof ArmorCore)) { continue; } - ItemStack output = ((ToolCore) item).buildItemFromStacks(input); + ItemStack output = ((ArmorCore) item).buildItemFromStacks(input); if(!output.isEmpty()) { // name the item if(name != null && !name.isEmpty()) { diff --git a/src/main/java/lance5057/tDefense/util/ArmorEvent.java b/src/main/java/lance5057/tDefense/core/library/ArmorEvent.java index d83a930..c1e98f7 100644 --- a/src/main/java/lance5057/tDefense/util/ArmorEvent.java +++ b/src/main/java/lance5057/tDefense/core/library/ArmorEvent.java @@ -1,4 +1,4 @@ -package lance5057.tDefense.util; +package lance5057.tDefense.core.library; import com.google.common.collect.ImmutableList; diff --git a/src/main/java/lance5057/tDefense/util/ArmorNBT.java b/src/main/java/lance5057/tDefense/core/library/ArmorNBT.java index 28455ff..cac62ae 100644 --- a/src/main/java/lance5057/tDefense/util/ArmorNBT.java +++ b/src/main/java/lance5057/tDefense/core/library/ArmorNBT.java @@ -1,9 +1,10 @@ -package lance5057.tDefense.util; +package lance5057.tDefense.core.library; -import lance5057.tDefense.core.materials.ArmorMaterialStats; +import lance5057.tDefense.core.materials.stats.ArmorMaterialStats; import net.minecraft.nbt.NBTTagCompound; import slimeknights.tconstruct.library.materials.ExtraMaterialStats; import slimeknights.tconstruct.library.materials.HandleMaterialStats; +import slimeknights.tconstruct.library.tools.ToolNBT; import slimeknights.tconstruct.library.utils.Tags; public class ArmorNBT { @@ -12,7 +13,6 @@ public class ArmorNBT { public int armorRating; public int armorToughness; public int modifiers; // free modifiers - private final NBTTagCompound parent; public ArmorNBT() { @@ -65,27 +65,27 @@ public class ArmorNBT { /** Calculate in handles. call this last! */ public ArmorNBT handle(HandleMaterialStats... handles) { - // (Average Head Durability + Average Extra Durability) * Average Handle Modifier + Average Handle Durability + // (Average Head Durability + Average Extra Durability) * Average Handle Modifier + Average Handle Durability - int dur = 0; - float modifier = 0f; - for(HandleMaterialStats handle : handles) { - if(handle != null) { - dur += handle.durability; - modifier += handle.modifier; - } - } + int dur = 0; + float modifier = 0f; + for(HandleMaterialStats handle : handles) { + if(handle != null) { + dur += handle.durability; + modifier += handle.modifier; + } + } - modifier /= (float) handles.length; - this.durability = Math.round((float) this.durability * modifier); + modifier /= (float) handles.length; + this.durability = Math.round((float) this.durability * modifier); - // add in handle durability change - this.durability += Math.round((float) dur / (float) handles.length); + // add in handle durability change + this.durability += Math.round((float) dur / (float) handles.length); - this.durability = Math.max(1, this.durability); + this.durability = Math.max(1, this.durability); - return this; - } + return this; + } public void read(NBTTagCompound tag) { durability = tag.getInteger(Tags.DURABILITY); diff --git a/src/main/java/lance5057/tDefense/core/library/ArmorPart.java b/src/main/java/lance5057/tDefense/core/library/ArmorPart.java new file mode 100644 index 0000000..24f8c86 --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/library/ArmorPart.java @@ -0,0 +1,258 @@ +package lance5057.tDefense.core.library; + +import java.util.List; +import java.util.ListIterator; +import java.util.Map; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; + +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.NonNullList; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.translation.I18n; +import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import slimeknights.mantle.util.LocUtils; +import slimeknights.tconstruct.common.ClientProxy; +import slimeknights.tconstruct.common.config.Config; +import slimeknights.tconstruct.library.TinkerRegistry; +import slimeknights.tconstruct.library.Util; +import slimeknights.tconstruct.library.materials.IMaterialStats; +import slimeknights.tconstruct.library.materials.Material; +import slimeknights.tconstruct.library.tinkering.MaterialItem; +import slimeknights.tconstruct.library.tinkering.PartMaterialType; +import slimeknights.tconstruct.library.tools.IToolPart; +import slimeknights.tconstruct.library.tools.ToolCore; +import slimeknights.tconstruct.library.traits.ITrait; +import slimeknights.tconstruct.library.utils.TagUtil; +import slimeknights.tconstruct.library.utils.Tags; + +public class ArmorPart extends MaterialItem implements IToolPart { + + protected int cost; + + public ArmorPart(int cost) { + this.setCreativeTab(TinkerRegistry.tabParts); + this.cost = cost; + } + + @Override + public int getCost() { + return cost; + } + + @Override + public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) { + if(this.isInCreativeTab(tab)) { + for(Material mat : TinkerRegistry.getAllMaterials()) { + // check if the material makes sense for this item (is it usable to build stuff?) + if(canUseMaterial(mat)) { + subItems.add(getItemstackWithMaterial(mat)); + if(!Config.listAllMaterials) { + break; + } + } + } + } + } + + @Override + public boolean canUseMaterial(Material mat) { + for(ToolCore tool : TinkerRegistry.getTools()) { + for(PartMaterialType pmt : tool.getRequiredComponents()) { + if(pmt.isValid(this, mat)) { + return true; + } + } + } + + return false; + } + + @SideOnly(Side.CLIENT) + @Override + public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { + Material material = getMaterial(stack); + + // Material traits/info + boolean shift = Util.isShiftKeyDown(); + + if(!checkMissingMaterialTooltip(stack, tooltip)) { + tooltip.addAll(getTooltipTraitInfo(material)); + } + + // Stats + if(Config.extraTooltips) { + if(!shift) { + // info tooltip for detailed and component info + tooltip.add(""); + tooltip.add(Util.translate("tooltip.tool.holdShift")); + } + else { + tooltip.addAll(getTooltipStatsInfo(material)); + } + } + + tooltip.addAll(getAddedByInfo(material)); + } + + public List<String> getTooltipTraitInfo(Material material) { + // We build a map with Stat -> Traits mappings that allows us to group or not group depending on what's available + Map<String, List<ITrait>> mapping = Maps.newConcurrentMap(); + + // go through all stats of the material, and check if they have a use, build the map from them + for(IMaterialStats stat : material.getAllStats()) { + if(hasUseForStat(stat.getIdentifier())) { + List<ITrait> traits = material.getAllTraitsForStats(stat.getIdentifier()); + if(!traits.isEmpty()) { + boolean unified = false; + for(Map.Entry<String, List<ITrait>> entry : mapping.entrySet()) { + // group together if identical + if(entry.getValue().equals(traits)) { + mapping.put(entry.getKey() + ", " + stat.getLocalizedName(), entry.getValue()); + mapping.remove(entry.getKey()); + unified = true; + break; + } + } + + if(!unified) { + mapping.put(stat.getLocalizedName(), traits); + } + } + } + } + + List<String> tooltips = Lists.newLinkedList(); + boolean withType = mapping.size() > 1; + + // convert the entries into tooltips + for(Map.Entry<String, List<ITrait>> entry : mapping.entrySet()) { + // add the traits in "Stattype: Trait1, Trait2,..." style + StringBuilder sb = new StringBuilder(); + if(withType) { + sb.append(TextFormatting.ITALIC.toString()); + sb.append(entry.getKey()); + sb.append(": "); + sb.append(TextFormatting.RESET.toString()); + } + sb.append(material.getTextColor()); + List<ITrait> traits = entry.getValue(); + if(!traits.isEmpty()) { + ListIterator<ITrait> iter = traits.listIterator(); + + sb.append(iter.next().getLocalizedName()); + while(iter.hasNext()) { + sb.append(", ").append(iter.next().getLocalizedName()); + } + + tooltips.add(sb.toString()); + } + } + + return tooltips; + } + + public List<String> getTooltipStatsInfo(Material material) { + ImmutableList.Builder<String> builder = ImmutableList.builder(); + + for(IMaterialStats stat : material.getAllStats()) { + if(hasUseForStat(stat.getIdentifier())) { + List<String> text = stat.getLocalizedInfo(); + if(!text.isEmpty()) { + builder.add(""); + builder.add(TextFormatting.WHITE.toString() + TextFormatting.UNDERLINE + stat.getLocalizedName()); + builder.addAll(stat.getLocalizedInfo()); + } + } + } + + return builder.build(); + } + + public List<String> getAddedByInfo(Material material) { + ImmutableList.Builder<String> builder = ImmutableList.builder(); + if(TinkerRegistry.getTrace(material) != null) { + String materialInfo = I18n.translateToLocalFormatted("tooltip.part.material_added_by", + TinkerRegistry.getTrace(material).getName()); + builder.add(""); + builder.add(materialInfo); + } + return builder.build(); + } + + @Nonnull + @Override + public String getItemStackDisplayName(@Nonnull ItemStack stack) { + Material material = getMaterial(stack); + + String locString = getUnlocalizedName() + "." + material.getIdentifier(); + + // custom name? + if(I18n.canTranslate(locString)) { + return Util.translate(locString); + } + + // no, create the default name combo + return material.getLocalizedItemName(super.getItemStackDisplayName(stack)); + } + + @Nonnull + @SideOnly(Side.CLIENT) + @Override + public FontRenderer getFontRenderer(ItemStack stack) { + return ClientProxy.fontRenderer; + } + + @Override + public boolean hasUseForStat(String stat) { + for(ToolCore tool : TinkerRegistry.getTools()) { + for(PartMaterialType pmt : tool.getRequiredComponents()) { + if(pmt.isValidItem(this) && pmt.usesStat(stat)) { + return true; + } + } + } + + return false; + } + + public boolean checkMissingMaterialTooltip(ItemStack stack, List<String> tooltip) { + return checkMissingMaterialTooltip(stack, tooltip, null); + } + + public boolean checkMissingMaterialTooltip(ItemStack stack, List<String> tooltip, String statIdentifier) { + Material material = getMaterial(stack); + + if(material == Material.UNKNOWN) { + NBTTagCompound tag = TagUtil.getTagSafe(stack); + String materialID = tag.getString(Tags.PART_MATERIAL); + + String error; + if(!materialID.isEmpty()) { + error = I18n.translateToLocalFormatted("tooltip.part.missing_material", materialID); + } + else { + error = I18n.translateToLocal("tooltip.part.missing_info"); + } + tooltip.addAll(LocUtils.getTooltips(error)); + return true; + } + else if(statIdentifier != null && material.getStats(statIdentifier) == null) { + tooltip.addAll(LocUtils.getTooltips(Util.translateFormatted("tooltip.part.missing_stats", material.getLocalizedName(), statIdentifier))); + return true; + } + + return false; + } +}
\ No newline at end of file diff --git a/src/main/java/lance5057/tDefense/core/library/ArmorTags.java b/src/main/java/lance5057/tDefense/core/library/ArmorTags.java new file mode 100644 index 0000000..c9cff2f --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/library/ArmorTags.java @@ -0,0 +1,8 @@ +package lance5057.tDefense.core.library; + +public final class ArmorTags +{ + /** The stored dynamic texture location for this piece of armor */ + public static final String DynTex = "DynTex"; + public static final String TexLoc = "TexLoc"; +} diff --git a/src/main/java/lance5057/tDefense/core/library/ArmorTextureBuilder.java b/src/main/java/lance5057/tDefense/core/library/ArmorTextureBuilder.java new file mode 100644 index 0000000..7dee0b0 --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/library/ArmorTextureBuilder.java @@ -0,0 +1,94 @@ +package lance5057.tDefense.core.library; + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.util.ArrayList; +import java.util.List; + +import lance5057.tDefense.Reference; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import slimeknights.tconstruct.library.client.MaterialRenderInfo; +import slimeknights.tconstruct.library.materials.Material; + +@SideOnly(Side.CLIENT) +public class ArmorTextureBuilder +{ + @SideOnly(Side.CLIENT) + public static ResourceLocation createArmorTexture(String type, String[] parts, List<Material> materials) + { + List<BufferedImage> looseTex = new ArrayList<BufferedImage>(); + + TextureMap map = Minecraft.getMinecraft().getTextureMapBlocks(); + + for (int i = 0; i < materials.size(); i++) + { + BufferedImage bi = null; + if (materials.get(i).renderInfo instanceof MaterialRenderInfo.Default) + { + MaterialRenderInfo.Default render = (MaterialRenderInfo.Default)materials.get(i).renderInfo; + TextureAtlasSprite tex = map.getTextureExtry(String.format("tinkerscompendium:armor/%s/_%s_%s", type, type, parts[i])); + bi = new BufferedImage(tex.getIconWidth(), tex.getIconHeight(), BufferedImage.TYPE_4BYTE_ABGR); + + Graphics2D g2d = bi.createGraphics(); + int vert = render.getVertexColor(); + Color c = new Color(vert); + g2d.drawImage(createBufferedImage(tex), 0, 0, null); + g2d.setPaint(c); + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.9f)); + g2d.fillRect(0, 0, tex.getIconWidth(), tex.getIconHeight()); + + g2d.dispose(); + + } else + { + String s = String.format("tinkerscompendium:armor/%s/_%s_%s_%s", type, type, parts[i], materials.get(i).identifier); + bi = createBufferedImage(map.getTextureExtry(s)); + } + + if (bi != null) + looseTex.add(bi); + } + + if (looseTex.size() != 0) + { + BufferedImage fullTex = new BufferedImage(looseTex.get(0).getWidth(), looseTex.get(0).getHeight(), BufferedImage.TYPE_4BYTE_ABGR); + Graphics2D g2d = fullTex.createGraphics(); + + for (BufferedImage tex : looseTex) + g2d.drawImage(tex, 0, 0, null); + g2d.dispose(); + + return Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation(Reference.MOD_ID, new DynamicTexture(fullTex)); + } + return null; + } + + @SideOnly(Side.CLIENT) + private static BufferedImage createBufferedImage(TextureAtlasSprite sprite) + { + if (sprite != null) + { + int w = sprite.getIconWidth(); + int h = sprite.getIconHeight(); + int count = sprite.getFrameCount(); + + BufferedImage buff = new BufferedImage(w, h * count, BufferedImage.TYPE_4BYTE_ABGR); + + for (int i = 0; i < count; i++) + { + buff.setRGB(0, i * h, w, h, sprite.getFrameTextureData(i)[0], 0, w); + } + + return buff; + } + return null; + } +} diff --git a/src/main/java/lance5057/tDefense/util/BlocksBase.java b/src/main/java/lance5057/tDefense/core/library/BlocksBase.java index d6b576a..98e07f1 100644 --- a/src/main/java/lance5057/tDefense/util/BlocksBase.java +++ b/src/main/java/lance5057/tDefense/core/library/BlocksBase.java @@ -1,4 +1,4 @@ -package lance5057.tDefense.util; +package lance5057.tDefense.core.library; import java.util.ArrayList; diff --git a/src/main/java/lance5057/tDefense/core/library/CustomArmorTextureCreator.java b/src/main/java/lance5057/tDefense/core/library/CustomArmorTextureCreator.java new file mode 100644 index 0000000..67c9661 --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/library/CustomArmorTextureCreator.java @@ -0,0 +1,304 @@ +package lance5057.tDefense.core.library; + +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.item.Item; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.event.TextureStitchEvent; +import net.minecraftforge.client.model.IModel; +import net.minecraftforge.client.model.ModelLoaderRegistry; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import org.apache.logging.log4j.Logger; + +import java.io.IOException; +import java.lang.reflect.Constructor; +import java.util.Collection; +import java.util.Map; +import java.util.Optional; +import java.util.Set; + +import javax.annotation.Nonnull; + +import slimeknights.tconstruct.library.TinkerRegistry; +import slimeknights.tconstruct.library.Util; +import slimeknights.tconstruct.library.client.MaterialRenderInfo; +import slimeknights.tconstruct.library.client.material.MaterialRenderInfoLoader; +import slimeknights.tconstruct.library.client.model.IPatternOffset; +import slimeknights.tconstruct.library.client.model.MaterialModelLoader; +import slimeknights.tconstruct.library.client.texture.CastTexture; +import slimeknights.tconstruct.library.client.texture.GuiOutlineTexture; +import slimeknights.tconstruct.library.client.texture.PatternTexture; +import slimeknights.tconstruct.library.client.texture.TextureColoredTexture; +import slimeknights.tconstruct.library.client.texture.TinkerTexture; +import slimeknights.tconstruct.library.materials.Material; +import slimeknights.tconstruct.library.materials.MaterialGUI; +import slimeknights.tconstruct.library.tools.IToolPart; +import slimeknights.tconstruct.library.tools.Pattern; + +/** + * Textures registered with this creator will get a texture created/loaded for each material. + */ +public class CustomArmorTextureCreator implements IResourceManagerReloadListener { + + public static final CustomArmorTextureCreator INSTANCE = new CustomArmorTextureCreator(); + + private static Logger log = Util.getLogger("ArmorTextureGen"); + + /** + * Holds all sprites built from the base-texture used as the key. + */ + public static Map<String, Map<String, TextureAtlasSprite>> sprites = Maps.newHashMap(); + + private static Set<ResourceLocation> baseTextures = Sets.newHashSet(); + + //private static Map<ResourceLocation, Set<IToolPart>> texturePartMapping = Maps.newHashMap(); + + public static void registerTextures(Collection<ResourceLocation> textures) { + baseTextures.addAll(textures); + } + + public static void registerTexture(ResourceLocation texture) { + baseTextures.add(texture); + } + +// public static void registerTextureForPart(ResourceLocation texture, IToolPart toolPart) { +// if(!texturePartMapping.containsKey(texture)) { +// texturePartMapping.put(texture, Sets.newHashSet()); +// } +// texturePartMapping.get(texture).add(toolPart); +// registerTexture(texture); +// } + + // set these to the pattern/cast model to generate part-textures for them +// public static ResourceLocation patternModelLocation; +// public static ResourceLocation castModelLocation; +// public static String patternLocString; +// public static String castLocString; + + public static final Material guiMaterial; + + private int createdTextures; + + // low since other event-handlers might want to register textures beforehand + @SubscribeEvent(priority = EventPriority.LOW) + public void createCustomTextures(TextureStitchEvent.Pre event) { + // get the material info at this point, to override hardcoded material rendering with resources + MaterialRenderInfoLoader.INSTANCE.onResourceManagerReload(Minecraft.getMinecraft().getResourceManager()); + + createdTextures = 0; + // create textures for each material where needed + createMaterialTextures(event.getMap()); + + // add stencil and cast textures for all used toolparts + //createPatterntextures(event.getMap()); + + log.debug("Generated " + createdTextures + " Textures for Materials"); + } + + private void createMaterialTextures(TextureMap map) { + // Create textures for toolparts and tools - Textures that need 1 per material + for(ResourceLocation baseTexture : baseTextures) { + // exclude missingno :I + if(baseTexture.toString().equals("minecraft:missingno")) { + continue; + } + + //Set<IToolPart> parts = texturePartMapping.get(baseTexture); + + Map<String, TextureAtlasSprite> builtSprites = Maps.newHashMap(); + Collection<Material> mats = TinkerRegistry.getAllMaterials(); + for(Material material : mats) { + boolean usable; +// if(parts == null || material instanceof MaterialGUI) { +// usable = true; +// } +// else { +// usable = false; +// for(IToolPart toolPart : parts) { +// usable |= toolPart.canUseMaterialForRendering(material); +// } +// } + +// if(usable) { + TextureAtlasSprite sprite = createTexture(material, baseTexture, map); + if(sprite != null) { + builtSprites.put(material.identifier, sprite); + } + } +// } +// +// if(belongsToToolPart(baseTexture)) { +// TextureAtlasSprite sprite = createTexture(guiMaterial, baseTexture, map); +// if(sprite != null) { +// builtSprites.put(guiMaterial.identifier, sprite); +// } +// } + + sprites.put(baseTexture.toString(), builtSprites); + } + } + + private TextureAtlasSprite createTexture(Material material, ResourceLocation baseTexture, TextureMap map) { + String location = baseTexture.toString() + "_" + material.identifier; + TextureAtlasSprite sprite; + + if(exists(location)) { + sprite = map.registerSprite(new ResourceLocation(location)); + } + else { + // material does not need a special generated texture + if(material.renderInfo == null) { + return null; + } + + // different base texture? + if(material.renderInfo.getTextureSuffix() != null) { + String loc2 = baseTexture.toString() + "_" + material.renderInfo.getTextureSuffix(); + TextureAtlasSprite base2 = map.getTextureExtry(loc2); + // can we manually load it? + if(base2 == null && exists(loc2)) { + base2 = TinkerTexture.loadManually(new ResourceLocation(loc2)); + // save in the map so it's getting reused by the others and is available + map.setTextureEntry(base2); + } + if(base2 != null) { + baseTexture = new ResourceLocation(base2.getIconName()); + } + } + + sprite = material.renderInfo.getTexture(baseTexture, location); + createdTextures++; + } + + // stitch new textures + if(sprite != null && material.renderInfo.isStitched()) { + map.setTextureEntry(sprite); + } + return sprite; + } + +// private void createPatterntextures(TextureMap map) { +// // create Pattern textures +// if(patternModelLocation != null) { +// patternLocString = createPatternTexturesFor(map, patternModelLocation, TinkerRegistry.getPatternItems(), PatternTexture.class); +// } +// // create cast textures +// if(castModelLocation != null) { +// castLocString = createPatternTexturesFor(map, castModelLocation, TinkerRegistry.getCastItems(), CastTexture.class); +// } +// } + +// public String createPatternTexturesFor(TextureMap map, ResourceLocation baseTextureLoc, Iterable<Item> items, Class<? extends TextureColoredTexture> clazz) { +// Constructor<? extends TextureColoredTexture> constructor; +// String baseTextureString; +// ResourceLocation patternLocation; +// try { +// constructor = clazz.getConstructor(ResourceLocation.class, ResourceLocation.class, String.class); +// IModel patternModel = ModelLoaderRegistry.getModel(baseTextureLoc); +// patternLocation = patternModel.getTextures().iterator().next(); +// baseTextureString = patternLocation.toString(); +// } catch(Exception e) { +// log.error(e); +// return null; +// } +// +// for(Item item : items) { +// try { +// // get id +// String identifier = Pattern.getTextureIdentifier(item); +// String partPatternLocation = baseTextureString + identifier; +// TextureAtlasSprite partPatternTexture; +// if(exists(partPatternLocation)) { +// partPatternTexture = map.registerSprite(new ResourceLocation(partPatternLocation)); +// map.setTextureEntry(partPatternTexture); +// } +// else { +// ResourceLocation modelLocation = item.getRegistryName(); +// IModel partModel = ModelLoaderRegistry.getModel(new ResourceLocation(modelLocation.getResourceDomain(), +// "item/parts/" + modelLocation +// .getResourcePath() +// + MaterialModelLoader.EXTENSION)); +// ResourceLocation partTexture = partModel.getTextures().iterator().next(); +// +// if(partModel != ModelLoaderRegistry.getMissingModel()) { +// partPatternTexture = constructor.newInstance(partTexture, patternLocation, partPatternLocation); +// if(partModel instanceof IPatternOffset) { +// IPatternOffset offset = (IPatternOffset) partModel; +// ((TextureColoredTexture) partPatternTexture).setOffset(offset.getXOffset(), offset.getYOffset()); +// } +// map.setTextureEntry(partPatternTexture); +// } +// } +// } catch(Exception e) { +// log.error(e); +// } +// } +// +// return baseTextureString; +// } + + public static boolean exists(String res) { + try { + ResourceLocation loc = new ResourceLocation(res); + loc = new ResourceLocation(loc.getResourceDomain(), "textures/" + loc.getResourcePath() + ".png"); + Minecraft.getMinecraft().getResourceManager().getAllResources(loc); + return true; + } catch(IOException e) { + return false; + } + } + + @Override + public void onResourceManagerReload(@Nonnull IResourceManager resourceManager) { + // clear cache + baseTextures.clear(); + for(Map map : sprites.values()) { + // safety in case there are some references lying around + map.clear(); + } + sprites.clear(); + } + + public static boolean belongsToToolPart(ResourceLocation location) { + for(IToolPart toolpart : TinkerRegistry.getToolParts()) { + if(!(toolpart instanceof Item)) { + continue; // WHY?! + } + try { + Optional<ResourceLocation> storedResourceLocation = MaterialModelLoader.getToolPartModelLocation(toolpart); + if(storedResourceLocation.isPresent()) { + ResourceLocation stored = storedResourceLocation.get(); + ResourceLocation modelLocation = new ResourceLocation(stored.getResourceDomain(), "item/" + stored.getResourcePath()); + IModel partModel = ModelLoaderRegistry.getModel(modelLocation); + + // the actual texture of the part + ResourceLocation baseTexture = partModel.getTextures().iterator().next(); + if(baseTexture.toString().equals(location.toString())) { + return true; + } + } + } catch(Exception e) { + return false; + } + } + return false; + } + + static { + guiMaterial = new MaterialGUI("_internal_gui"); + guiMaterial.setRenderInfo(new MaterialRenderInfo.AbstractMaterialRenderInfo() { + @Override + public TextureAtlasSprite getTexture(ResourceLocation baseTexture, String location) { + return new GuiOutlineTexture(baseTexture, location); + } + }); + } +}
\ No newline at end of file diff --git a/src/main/java/lance5057/tDefense/util/ItemsBase.java b/src/main/java/lance5057/tDefense/core/library/ItemsBase.java index 3e1064b..ce802fd 100644 --- a/src/main/java/lance5057/tDefense/util/ItemsBase.java +++ b/src/main/java/lance5057/tDefense/core/library/ItemsBase.java @@ -1,4 +1,4 @@ -package lance5057.tDefense.util; +package lance5057.tDefense.core.library; import java.util.ArrayList; diff --git a/src/main/java/lance5057/tDefense/util/MetaItem.java b/src/main/java/lance5057/tDefense/core/library/MetaItem.java index 1064da6..cc75e17 100644 --- a/src/main/java/lance5057/tDefense/util/MetaItem.java +++ b/src/main/java/lance5057/tDefense/core/library/MetaItem.java @@ -1,4 +1,4 @@ -package lance5057.tDefense.util; +package lance5057.tDefense.core.library; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; diff --git a/src/main/java/lance5057/tDefense/util/ModuleBase.java b/src/main/java/lance5057/tDefense/core/library/ModuleBase.java index b17d76a..9e8a506 100644 --- a/src/main/java/lance5057/tDefense/util/ModuleBase.java +++ b/src/main/java/lance5057/tDefense/core/library/ModuleBase.java @@ -1,4 +1,4 @@ -package lance5057.tDefense.util; +package lance5057.tDefense.core.library; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; diff --git a/src/main/java/lance5057/tDefense/core/library/RegEvents.java b/src/main/java/lance5057/tDefense/core/library/RegEvents.java new file mode 100644 index 0000000..0c9f942 --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/library/RegEvents.java @@ -0,0 +1,5 @@ +package lance5057.tDefense.core.library; + +public class RegEvents { + +} diff --git a/src/main/java/lance5057/tDefense/util/TDClientRegistry.java b/src/main/java/lance5057/tDefense/core/library/TDClientRegistry.java index 8fd47a1..7e0a482 100644 --- a/src/main/java/lance5057/tDefense/util/TDClientRegistry.java +++ b/src/main/java/lance5057/tDefense/core/library/TDClientRegistry.java @@ -1,17 +1,15 @@ -package lance5057.tDefense.util; +package lance5057.tDefense.core.library; + +import java.util.Map; + +import org.apache.logging.log4j.Logger; import com.google.common.collect.Maps; import net.minecraft.item.Item; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; - -import org.apache.logging.log4j.Logger; - -import java.util.Map; - import slimeknights.tconstruct.library.Util; -import slimeknights.tconstruct.library.client.ToolBuildGuiInfo; import slimeknights.tconstruct.library.client.texture.AbstractColoredTexture; @SideOnly(Side.CLIENT) diff --git a/src/main/java/lance5057/tDefense/util/TDMatHelper.java b/src/main/java/lance5057/tDefense/core/library/TDMatHelper.java index 2a42541..d0cfa54 100644 --- a/src/main/java/lance5057/tDefense/util/TDMatHelper.java +++ b/src/main/java/lance5057/tDefense/core/library/TDMatHelper.java @@ -1,12 +1,13 @@ -package lance5057.tDefense.util; +package lance5057.tDefense.core.library; import javax.annotation.Nullable; -import lance5057.tDefense.core.materials.ArmorMaterialStats.ChestMaterialStats; -import lance5057.tDefense.core.materials.ArmorMaterialStats.FeetMaterialStats; -import lance5057.tDefense.core.materials.ArmorMaterialStats.HelmMaterialStats; -import lance5057.tDefense.core.materials.ArmorMaterialStats.LegsMaterialStats; -import lance5057.tDefense.core.materials.ShieldMaterialStats; +import lance5057.tDefense.core.materials.stats.ChestMaterialStats; +import lance5057.tDefense.core.materials.stats.FabricMaterialStats; +import lance5057.tDefense.core.materials.stats.FeetMaterialStats; +import lance5057.tDefense.core.materials.stats.HelmMaterialStats; +import lance5057.tDefense.core.materials.stats.LegsMaterialStats; +import lance5057.tDefense.core.materials.stats.ShieldMaterialStats; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import slimeknights.tconstruct.library.fluid.FluidMolten; @@ -38,6 +39,7 @@ public class TDMatHelper public ChestMaterialStats chest; public LegsMaterialStats legs; public FeetMaterialStats boots; + public FabricMaterialStats cloth; public ItemStack gem; public ItemStack ingot; @@ -46,6 +48,7 @@ public class TDMatHelper public ItemStack grain; public boolean createMat = true; + public boolean createParts = true; public TDMatHelper(String n, int c, FluidMolten f, boolean doMat) { @@ -57,25 +60,30 @@ public class TDMatHelper public TDMatHelper(String n, int c, boolean doMat) { - init(n, c, null, false, doMat); + init(n, c, null, false, doMat, true); } public TDMatHelper(String n, int c, boolean o, boolean doMat) { - init(n, c, null, o, doMat); + init(n, c, null, o, doMat, true); } public TDMatHelper(String n, int c, @Nullable FluidMolten f, boolean o, boolean doMat) { - init(n, c, f, o, doMat); + init(n, c, f, o, doMat, true); + } + + public TDMatHelper(String n, int c, @Nullable FluidMolten f, boolean o, boolean doMat, boolean doParts) + { + init(n, c, f, o, doMat, doParts); } public TDMatHelper(String n, int c) { - init(n, c, null, false, true); + init(n, c, null, false, true, true); } - private void init(String n, int c, @Nullable FluidMolten f, boolean o, boolean doMat) + private void init(String n, int c, @Nullable FluidMolten f, boolean o, boolean doMat, boolean doParts) { name = n; color = c; @@ -83,6 +91,7 @@ public class TDMatHelper isGem = o; createMat = doMat; + createParts = doParts; } public TDMatHelper setHead(HeadMaterialStats h) @@ -156,6 +165,12 @@ public class TDMatHelper boots = h; return this; } + + public TDMatHelper setCloth(FabricMaterialStats h) + { + cloth = h; + return this; + } public TDMatHelper setGem(Item i) { diff --git a/src/main/java/lance5057/tDefense/util/TDModelLoader.java b/src/main/java/lance5057/tDefense/core/library/TDModelLoader.java index 5ecdacf..fd57081 100644 --- a/src/main/java/lance5057/tDefense/util/TDModelLoader.java +++ b/src/main/java/lance5057/tDefense/core/library/TDModelLoader.java @@ -1,4 +1,4 @@ -package lance5057.tDefense.util; +package lance5057.tDefense.core.library; import java.io.IOException; import java.util.List; @@ -39,7 +39,7 @@ public class TDModelLoader implements ICustomModelLoader { public static String EXTENSION = ".td"; // used to create only actually needed textures in the texturegenerator instead of ALL materials for all parts - private static final Map<ResourceLocation, ArmorCore> modelItemMap = Maps.newHashMap(); + private static final Map<ResourceLocation, ArmorCore> modelItemMap = Maps.newHashMap(); public static void addPartMapping(ResourceLocation resourceLocation, ArmorCore tool) { modelItemMap.put(resourceLocation, tool); diff --git a/src/main/java/lance5057/tDefense/util/TDModelRegistar.java b/src/main/java/lance5057/tDefense/core/library/TDModelRegistar.java index ad628b0..8043307 100644 --- a/src/main/java/lance5057/tDefense/util/TDModelRegistar.java +++ b/src/main/java/lance5057/tDefense/core/library/TDModelRegistar.java @@ -1,4 +1,4 @@ -package lance5057.tDefense.util; +package lance5057.tDefense.core.library; import javax.annotation.Nonnull; @@ -10,8 +10,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader; import slimeknights.tconstruct.TConstruct; -import slimeknights.tconstruct.library.client.model.ToolModelLoader; -import slimeknights.tconstruct.library.tools.ToolCore; public class TDModelRegistar { public static ResourceLocation registerToolModel(ArmorCore armor) { @@ -19,7 +17,7 @@ public class TDModelRegistar { return null; } ResourceLocation itemLocation = armor.getRegistryName(); - String path = "tools/" + itemLocation.getResourcePath() + ToolModelLoader.EXTENSION; + String path = "tools/" + itemLocation.getResourcePath() + TDModelLoader.EXTENSION; ResourceLocation location = new ResourceLocation(itemLocation.getResourceDomain(), path); TDModelLoader.addPartMapping(location, armor); @@ -31,9 +29,9 @@ public class TDModelRegistar { * Manual registration of a tool model. You probably shouldn't be using this. */ public static ResourceLocation registerToolModel(Item item, final ResourceLocation location) { - if (!location.getResourcePath().endsWith(ToolModelLoader.EXTENSION)) { + if (!location.getResourcePath().endsWith(TDModelLoader.EXTENSION)) { TConstruct.log.error("The material-model " + location.toString() + " does not end with '" - + ToolModelLoader.EXTENSION + "' and will therefore not be loaded by the custom model loader!"); + + TDModelLoader.EXTENSION + "' and will therefore not be loaded by the custom model loader!"); } return registerIt(item, location); @@ -45,7 +43,7 @@ public class TDModelRegistar { // a model to render an Itemstack // we use an ItemMeshDefinition because it allows us to do it no matter what // metadata we use - ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() { + ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() { @Nonnull @Override public ModelResourceLocation getModelLocation(@Nonnull ItemStack stack) { diff --git a/src/main/java/lance5057/tDefense/util/TDRegistry.java b/src/main/java/lance5057/tDefense/core/library/TDRegistry.java index 87fed5b..74b4cba 100644 --- a/src/main/java/lance5057/tDefense/util/TDRegistry.java +++ b/src/main/java/lance5057/tDefense/core/library/TDRegistry.java @@ -1,24 +1,28 @@ -package lance5057.tDefense.util; +package lance5057.tDefense.core.library; +import java.util.List; import java.util.Set; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; import com.google.common.collect.Sets; +import akka.japi.Pair; import gnu.trove.set.hash.TLinkedHashSet; import lance5057.tDefense.core.tools.bases.ArmorCore; +import net.minecraft.item.Item; import slimeknights.tconstruct.library.TinkerRegistry; import slimeknights.tconstruct.library.tinkering.PartMaterialType; import slimeknights.tconstruct.library.tools.IToolPart; -import slimeknights.tconstruct.library.tools.ToolCore; public class TDRegistry { private static final Set<ArmorCore> armor = new TLinkedHashSet<>(); private static final Set<IToolPart> armorParts = new TLinkedHashSet<>(); private static final Set<ArmorCore> armorStationCrafting = Sets.newLinkedHashSet(); private static final Set<ArmorCore> armorForgeCrafting = Sets.newLinkedHashSet(); + public static List<Pair<Item, ArmorPart>> armorPartPatterns = Lists.newLinkedList(); - public static void registerTool(ArmorCore tool) { + public static void registerTool(ArmorCore tool) { armor.add(tool); for(PartMaterialType pmt : tool.getRequiredComponents()) { diff --git a/src/main/java/lance5057/tDefense/util/TDToolHelper.java b/src/main/java/lance5057/tDefense/core/library/TDToolHelper.java index d5b6e6e..f0ce30f 100644 --- a/src/main/java/lance5057/tDefense/util/TDToolHelper.java +++ b/src/main/java/lance5057/tDefense/core/library/TDToolHelper.java @@ -1,18 +1,18 @@ -package lance5057.tDefense.util; +package lance5057.tDefense.core.library; +import lance5057.tDefense.core.tools.bases.ArmorCore; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemTool; import net.minecraft.nbt.NBTTagList; import slimeknights.tconstruct.library.TinkerRegistry; import slimeknights.tconstruct.library.materials.Material; -import slimeknights.tconstruct.library.tools.ToolCore; import slimeknights.tconstruct.library.utils.TagUtil; public class TDToolHelper { public static boolean checkIfMetal(ItemStack item) { - if(item.getItem() instanceof ToolCore) + if(item.getItem() instanceof ArmorCore) { NBTTagList list = TagUtil.getBaseMaterialsTagList(item); diff --git a/src/main/java/lance5057/tDefense/core/materials/TDMaterials.java b/src/main/java/lance5057/tDefense/core/materials/TDMaterials.java index 47afb76..f66e916 100644 --- a/src/main/java/lance5057/tDefense/core/materials/TDMaterials.java +++ b/src/main/java/lance5057/tDefense/core/materials/TDMaterials.java @@ -5,6 +5,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.Set; import org.apache.commons.lang3.StringUtils; @@ -15,7 +16,15 @@ import gnu.trove.set.hash.THashSet; import lance5057.tDefense.Reference; import lance5057.tDefense.TinkersDefense; import lance5057.tDefense.core.items.TDOreDictItem; -import lance5057.tDefense.util.TDMatHelper; +import lance5057.tDefense.core.library.TDMatHelper; +import lance5057.tDefense.core.materials.stats.ArmorMaterialStats; +import lance5057.tDefense.core.materials.stats.BaubleMaterialStats; +import lance5057.tDefense.core.materials.stats.ChestMaterialStats; +import lance5057.tDefense.core.materials.stats.FabricMaterialStats; +import lance5057.tDefense.core.materials.stats.FeetMaterialStats; +import lance5057.tDefense.core.materials.stats.HelmMaterialStats; +import lance5057.tDefense.core.materials.stats.LegsMaterialStats; +import lance5057.tDefense.core.materials.stats.ShieldMaterialStats; import net.minecraft.block.Block; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.init.Blocks; @@ -46,8 +55,8 @@ import slimeknights.tconstruct.library.materials.ExtraMaterialStats; import slimeknights.tconstruct.library.materials.HandleMaterialStats; import slimeknights.tconstruct.library.materials.HeadMaterialStats; import slimeknights.tconstruct.library.materials.Material; -//import slimeknights.tconstruct.library.materials.Material; import slimeknights.tconstruct.library.materials.MaterialTypes; +import slimeknights.tconstruct.library.tools.IToolPart; import slimeknights.tconstruct.library.utils.HarvestLevels; import slimeknights.tconstruct.shared.TinkerCommons; import slimeknights.tconstruct.shared.TinkerFluids; @@ -55,239 +64,245 @@ import slimeknights.tconstruct.smeltery.block.BlockMolten; import slimeknights.tconstruct.tools.TinkerMaterials; @Mod.EventBusSubscriber(modid = Reference.MOD_ID) -public class TDMaterials { +public class TDMaterials +{ // public static final List<Material> materials = Lists.newArrayList(); ArmorMaterialStats ams = new ArmorMaterialStats(0, 0, 0, 0, ""); - String SHIELD = ShieldMaterialStats.TYPE; - String HELM = ArmorMaterialStats.HelmMaterialStats.TYPE; - String CHEST = ArmorMaterialStats.ChestMaterialStats.TYPE; - String LEGS = ArmorMaterialStats.LegsMaterialStats.TYPE; - String BOOTS = ArmorMaterialStats.FeetMaterialStats.TYPE; - String BAUBLE = BaubleMaterialStats.TYPE; - - public static final Map<String, Material> materials = new THashMap<>(); - public static final Map<String, MaterialIntegration> materialIntegrations = new THashMap<>(); - public static final Collection<String> deferredMaterials = new THashSet<>(); - - public static final Map<String, Integer> colors = new THashMap(); - public static final Map<String, FluidMolten> fluids = new THashMap(); - - public static Material black; - public static Material red; - public static Material green; - public static Material brown; - public static Material blue; - public static Material purple; - public static Material cyan; - public static Material lightgray; - public static Material gray; - public static Material pink; - public static Material lime; - public static Material yellow; - public static Material lightblue; - public static Material magenta; - public static Material orange; - public static Material white; - - public static FluidMolten fluidVile = fluids.put("vile", - (FluidMolten) new FluidMolten("vile", 0x111111).setTemperature(0)); - public static FluidMolten fluidVibrant = fluids.put("vibrant", new FluidMolten("vibrant", 0x76ff00)); - public static FluidMolten fluidSlush = fluids.put("slush", - (FluidMolten) new FluidMolten("slush", 0xbfefff).setTemperature(0)); - public static FluidMolten fluidQuartz = fluids.put("quartz", - (FluidMolten) new FluidMolten("quartz", 0xdddddd).setTemperature(75)); - public static FluidMolten fluidChorusJuice = fluids.put("chorusjuice", new FluidMolten("chorusjuice", 0xd982ff)); - public static FluidMolten fluidDragonsBreath = fluids.put("dragonsbreath", - new FluidMolten("dragonsbreath", 0x7f00b7)); + String SHIELD = ShieldMaterialStats.TYPE; + String HELM = HelmMaterialStats.TYPE; + String CHEST = ChestMaterialStats.TYPE; + String LEGS = LegsMaterialStats.TYPE; + String BOOTS = FeetMaterialStats.TYPE; + String BAUBLE = BaubleMaterialStats.TYPE; + + public static final Map<String, Material> materials = new THashMap<>(); + public static final Map<String, MaterialIntegration> materialIntegrations = new THashMap<>(); + public static final Collection<String> deferredMaterials = new THashSet<>(); + + public static final Map<String, Integer> colors = new THashMap(); + public static final Map<String, FluidMolten> fluids = new THashMap(); + + public static Material black; + public static Material red; + public static Material green; + public static Material brown; + public static Material blue; + public static Material purple; + public static Material cyan; + public static Material lightgray; + public static Material gray; + public static Material pink; + public static Material lime; + public static Material yellow; + public static Material lightblue; + public static Material magenta; + public static Material orange; + public static Material white; + + public static FluidMolten fluidVile = fluids.put("vile", (FluidMolten) new FluidMolten("vile", 0x111111).setTemperature(0)); + public static FluidMolten fluidVibrant = fluids.put("vibrant", new FluidMolten("vibrant", 0x76ff00)); + public static FluidMolten fluidSlush = fluids.put("slush", (FluidMolten) new FluidMolten("slush", 0xbfefff).setTemperature(0)); + public static FluidMolten fluidQuartz = fluids.put("quartz", (FluidMolten) new FluidMolten("quartz", 0xdddddd).setTemperature(75)); + public static FluidMolten fluidChorusJuice = fluids.put("chorusjuice", new FluidMolten("chorusjuice", 0xd982ff)); + public static FluidMolten fluidDragonsBreath = fluids.put("dragonsbreath", new FluidMolten("dragonsbreath", 0x7f00b7)); List<TDMatHelper> materials_master = new ArrayList<>(); // Base List<TDMatHelper> materials_base = new ArrayList<>(Arrays.asList( - new TDMatHelper("aeonsteel", 0xa470e0, fluids.put("aeonsteel", new FluidMolten("aeonsteel", 0xa470e0)), - true).setHead(new HeadMaterialStats(500, 15.00f, 4.0f, HarvestLevels.COBALT)) - .setHandle(new HandleMaterialStats(1.1f, 0)).setExtra(new ExtraMaterialStats(50)) - .setShield(new ShieldMaterialStats(500 / 4, 85)) - .setBow(new BowMaterialStats(0.75f, 1.0f, 2.5f)) - .setHelm(ams.new HelmMaterialStats(500, 2, 2, 0f)) - .setChest(ams.new ChestMaterialStats(500, 6, 3, 0f)) - .setLegs(ams.new LegsMaterialStats(500, 5, 3, 0f)) - .setBoots(ams.new FeetMaterialStats(500, 3, 2, 0f)), - new TDMatHelper("queensgold", 0xdcff00, fluids.put("queensgold", new FluidMolten("queensgold", 0xdcff00)), - true).setHead(new HeadMaterialStats(70, 3.00f, 3.00f, HarvestLevels.IRON)) - .setHandle(new HandleMaterialStats(1.05f, -45)).setExtra(new ExtraMaterialStats(20)) - .setShield(new ShieldMaterialStats(70 / 4, 57)) - .setBow(new BowMaterialStats(1.1f, 1.0f, 0.5f)) - .setHelm(ams.new HelmMaterialStats(70, 2, 1, 20f)) - .setChest(ams.new ChestMaterialStats(70, 6, 2, 30f)) - .setLegs(ams.new LegsMaterialStats(70, 5, 2, 20f)) - .setBoots(ams.new FeetMaterialStats(70, 2, 1, 15f)), - new TDMatHelper("dogbearium", 0x6d3300, fluids.put("dogbearium", new FluidMolten("dogbearium", 0x6d3300)), - true).setHead(new HeadMaterialStats(150, 5.00f, 9.00f, HarvestLevels.DIAMOND)) - .setHandle(new HandleMaterialStats(0.85f, 75)).setExtra(new ExtraMaterialStats(75)) - .setShield(new ShieldMaterialStats(150 / 4, 75)) - .setBow(new BowMaterialStats(0.1f, 0.5f, 5.5f)) - .setHelm(ams.new HelmMaterialStats(150, 3, 3, -60f)) - .setChest(ams.new ChestMaterialStats(150, 8, 4, -60f)) - .setLegs(ams.new LegsMaterialStats(150, 6, 4, -60f)) - .setBoots(ams.new FeetMaterialStats(150, 3, 3, -60f)), - new TDMatHelper("sinisterium", 0x210000, - fluids.put("sinisterium", new FluidMolten("sinisterium", 0x210000)), true) - .setHead(new HeadMaterialStats(224, 5.00f, 5.00f, HarvestLevels.DIAMOND)) - .setHandle(new HandleMaterialStats(0.75f, 99)).setExtra(new ExtraMaterialStats(99)) - .setShield(new ShieldMaterialStats(224 / 4, 55)) - .setBow(new BowMaterialStats(2.1f, 1.6f, 7.2f)) - .setHelm(ams.new HelmMaterialStats(224, 2, 0, 9.5f)) - .setChest(ams.new ChestMaterialStats(224, 6, 0, 10.5f)) - .setLegs(ams.new LegsMaterialStats(224, 5, 0, 10.0f)) - .setBoots(ams.new FeetMaterialStats(224, 2, 0, 9.5f)), - new TDMatHelper("nihilite", 0x000021, fluids.put("nihilite", new FluidMolten("nihilite", 0x000021)), true) - .setHead(new HeadMaterialStats(400, 9.7f, 7.1f, HarvestLevels.COBALT)) - .setHandle(new HandleMaterialStats(0.9f, 70)).setExtra(new ExtraMaterialStats(74)) - .setShield(new ShieldMaterialStats(400 / 4, 95)).setBow(new BowMaterialStats(0.9f, 1.7f, -1f)) - .setHelm(ams.new HelmMaterialStats(400, 2, 0, 19)) - .setChest(ams.new ChestMaterialStats(400, 5, 0, 15)) - .setLegs(ams.new LegsMaterialStats(400, 4, 0, 15)) - .setBoots(ams.new FeetMaterialStats(400, 2, 0, 19)), - new TDMatHelper("orichalcum", 0xffc700, fluids.put("orichalcum", new FluidMolten("orichalcum", 0xffc700)), - true).setHead(new HeadMaterialStats(180, 5.3f, 6.23f, HarvestLevels.OBSIDIAN)) - .setHandle(new HandleMaterialStats(1.1f, 25)).setExtra(new ExtraMaterialStats(35)) - .setShield(new ShieldMaterialStats(180 / 4, 70)) - .setBow(new BowMaterialStats(1.9f, 1.9f, 2.3f)) - .setHelm(ams.new HelmMaterialStats(180, 2, 2, 20.5f)) - .setChest(ams.new ChestMaterialStats(180, 6, 3, 20.5f)) - .setLegs(ams.new LegsMaterialStats(180, 5, 3, 20.5f)) - .setBoots(ams.new FeetMaterialStats(180, 2, 3, 20.5f)), - new TDMatHelper("pandorium", 0x7f6a00, fluids.put("pandorium", new FluidMolten("pandorium", 0x7f6a00)), - true).setHead(new HeadMaterialStats(999, 10.2f, 8.72f, HarvestLevels.OBSIDIAN)) - .setHandle(new HandleMaterialStats(0.4f, 999)).setExtra(new ExtraMaterialStats(99)) - .setShield(new ShieldMaterialStats(999 / 4, 100)).setBow(new BowMaterialStats(3f, 0.9f, 9f)) - .setHelm(ams.new HelmMaterialStats(999, 3, 3, -70.0f)) - .setChest(ams.new ChestMaterialStats(999, 8, 4, -70.0f)) - .setLegs(ams.new LegsMaterialStats(999, 6, 4, -70.0f)) - .setBoots(ams.new FeetMaterialStats(999, 3, 3, -70.0f)), - new TDMatHelper("rosegold", 0xff9b84, fluids.put("rosegold", new FluidMolten("rosegold", 0xff9b84)), true) - .setHead(new HeadMaterialStats(99, 4f, 1f, HarvestLevels.STONE)) - .setHandle(new HandleMaterialStats(1.5f, -90)).setExtra(new ExtraMaterialStats(-90)) - .setShield(new ShieldMaterialStats(99 / 4, 24)).setBow(new BowMaterialStats(0.1f, 0.1f, -2f)) - .setHelm(ams.new HelmMaterialStats(99, 1, 0, 23.0f)) - .setChest(ams.new ChestMaterialStats(99, 4, 0, 23.0f)) - .setLegs(ams.new LegsMaterialStats(99, 3, 0, 23.0f)) - .setBoots(ams.new FeetMaterialStats(99, 1, 0, 23.0f)), - new TDMatHelper("platinum", 0xe8e8e8, fluids.put("platinum", new FluidMolten("platinum", 0xe8e8e8)), true) - .setHead(new HeadMaterialStats(99, 3.7f, 4f, HarvestLevels.IRON)) - .setHandle(new HandleMaterialStats(1.5f, -90)).setExtra(new ExtraMaterialStats(-90)) - .setShield(new ShieldMaterialStats(99 / 4, 14)).setBow(new BowMaterialStats(0.1f, 0.1f, -2f)) - .setHelm(ams.new HelmMaterialStats(99, 1, 1, 19.0f)) - .setChest(ams.new ChestMaterialStats(99, 4, 1, 19.0f)) - .setLegs(ams.new LegsMaterialStats(99, 3, 1, 19.0f)) - .setBoots(ams.new FeetMaterialStats(99, 1, 1, 19.0f)), - new TDMatHelper("brass", 0xdbb332, fluids.put("brass", new FluidMolten("brass", 0xdbb332)), true) - .setHead(new HeadMaterialStats(380, 5f, 3f, HarvestLevels.IRON)) - .setHandle(new HandleMaterialStats(0.85f, 90)).setExtra(new ExtraMaterialStats(75)) - .setShield(new ShieldMaterialStats(380 / 4, 50)).setBow(new BowMaterialStats(0.1f, 0.5f, -1f)) - .setHelm(ams.new HelmMaterialStats(380, 2, 1, 4.5f)) - .setChest(ams.new ChestMaterialStats(380, 3, 2, 4.5f)) - .setLegs(ams.new LegsMaterialStats(380, 2, 2, 4.5f)) - .setBoots(ams.new FeetMaterialStats(380, 2, 2, 4.5f)), - new TDMatHelper("silver", 0x9e9e9e, new FluidMolten("silver", 0x9e9e9e), false), - new TDMatHelper("gold", 0xfff428, TinkerFluids.gold, true).setIngot(Items.GOLD_INGOT) - .setNugget(Items.GOLD_NUGGET).setHead(new HeadMaterialStats(100, 1f, 1f, HarvestLevels.STONE)) - .setHandle(new HandleMaterialStats(0.25f, 10)).setExtra(new ExtraMaterialStats(25)) - .setShield(new ShieldMaterialStats(100 / 4, 14)).setBow(new BowMaterialStats(0.2f, 0.4f, -1f)) - .setHelm(ams.new HelmMaterialStats(100, 1, 0, 33f)) - .setChest(ams.new ChestMaterialStats(100, 4, 0, 33f)) - .setLegs(ams.new LegsMaterialStats(100, 3, 0, 33f)) - .setBoots(ams.new FeetMaterialStats(100, 1, 0, 33f)), - new TDMatHelper("valyriansteel", 0xe2d9e2, - fluids.put("valyriansteel", new FluidMolten("valyriansteel", 0xe2d9e2)), true) - .setHead(new HeadMaterialStats(610, 7f, 7f, HarvestLevels.OBSIDIAN)) - .setHandle(new HandleMaterialStats(0.9f, 180)).setExtra(new ExtraMaterialStats(125)) - .setShield(new ShieldMaterialStats(610 / 4, 85)) - .setBow(new BowMaterialStats(1.6f, 1.5f, 3f)) - .setHelm(ams.new HelmMaterialStats(610, 3, 3, 0)) - .setChest(ams.new ChestMaterialStats(610, 7, 4, 0)) - .setLegs(ams.new LegsMaterialStats(610, 6, 2, 0)) - .setBoots(ams.new FeetMaterialStats(610, 3, 3, 0)), - new TDMatHelper("froststeel", 0xc6dcff, fluids.put("froststeel", new FluidMolten("froststeel", 0xc6dcff)), - true).setHead(new HeadMaterialStats(610, 7f, 7f, HarvestLevels.OBSIDIAN)) - .setHandle(new HandleMaterialStats(1.1f, 110)).setExtra(new ExtraMaterialStats(125)) - .setShield(new ShieldMaterialStats(610 / 4, 85)) - .setBow(new BowMaterialStats(1.6f, 1.5f, 3f)) - .setHelm(ams.new HelmMaterialStats(610, 2, 2, 0)) - .setChest(ams.new ChestMaterialStats(610, 6, 3, 0)) - .setLegs(ams.new LegsMaterialStats(610, 5, 2, 0)) - .setBoots(ams.new FeetMaterialStats(610, 3, 1, 0)), - new TDMatHelper("pureardite", 0xff4300, fluids.put("pureardite", new FluidMolten("pureardite", 0xff4300)), - true).setHead(new HeadMaterialStats(1200, 3.5f, 3.6f, HarvestLevels.COBALT)) - .setHandle(new HandleMaterialStats(1.4f, -200)).setExtra(new ExtraMaterialStats(450)) - .setShield(new ShieldMaterialStats(1200 / 4, 33)) - .setBow(new BowMaterialStats(0.45f, 0.8f, 1f)), - new TDMatHelper("purecobalt", 0x547eff, fluids.put("purecobalt", new FluidMolten("purecobalt", 0x547eff)), - true).setHead(new HeadMaterialStats(780, 13f, 4.1f, HarvestLevels.COBALT)) - .setHandle(new HandleMaterialStats(1.4f, 100)).setExtra(new ExtraMaterialStats(300)) - .setShield(new ShieldMaterialStats(780 / 4, 33)) - .setBow(new BowMaterialStats(0.3f, 1.3f, 3f)), - new TDMatHelper("puremanyullyn", 0xd044ff, - fluids.put("puremanyullyn", new FluidMolten("puremanyullyn", 0xd044ff)), true) - .setHead(new HeadMaterialStats(820, 7.02f, 9.1f, HarvestLevels.COBALT)) - .setHandle(new HandleMaterialStats(0.5f, 350)).setExtra(new ExtraMaterialStats(350)) - .setShield(new ShieldMaterialStats(820 / 4, 33)) - .setBow(new BowMaterialStats(0.65f, 1.2f, 4f)), - new TDMatHelper("glass", 0xffffff, TinkerFluids.glass, true) - .setHead(new HeadMaterialStats(6, 4f, 7f, HarvestLevels.STONE)) - .setHandle(new HandleMaterialStats(0.1f, -45)).setExtra(new ExtraMaterialStats(-45)) - .setShield(new ShieldMaterialStats(6 / 4, 33)).setBow(new BowMaterialStats(0.1f, 0.1f, -2f)), - new TDMatHelper("ice", 0xdcff00, false), - new TDMatHelper("purifiedgold", 0xffe242, - fluids.put("purifiedgold", new FluidMolten("purifiedgold", 0xffe242)), true), - new TDMatHelper("purifiedsilver", 0xefefef, - fluids.put("purifiedsilver", new FluidMolten("purifiedsilver", 0xefefef)), true))); + new TDMatHelper("aeonsteel", 0xa470e0, fluids.put("aeonsteel", new FluidMolten("aeonsteel", 0xa470e0)), true).setHead(new HeadMaterialStats(500, 15.00f, 4.0f, HarvestLevels.COBALT)) + .setHandle(new HandleMaterialStats(1.1f, 0)) + .setExtra(new ExtraMaterialStats(50)) + .setShield(new ShieldMaterialStats(500 / 4, 85)) + .setBow(new BowMaterialStats(0.75f, 1.0f, 2.5f)) + .setHelm(new HelmMaterialStats(500, 2, 2, 0f)) + .setChest(new ChestMaterialStats(500, 6, 3, 0f)) + .setLegs(new LegsMaterialStats(500, 5, 3, 0f)) + .setBoots(new FeetMaterialStats(500, 3, 2, 0f)), + new TDMatHelper("queensgold", 0xdcff00, fluids.put("queensgold", new FluidMolten("queensgold", 0xdcff00)), true).setHead(new HeadMaterialStats(70, 3.00f, 3.00f, HarvestLevels.IRON)) + .setHandle(new HandleMaterialStats(1.05f, -45)) + .setExtra(new ExtraMaterialStats(20)) + .setShield(new ShieldMaterialStats(70 / 4, 57)) + .setBow(new BowMaterialStats(1.1f, 1.0f, 0.5f)) + .setHelm(new HelmMaterialStats(70, 2, 1, 20f)) + .setChest(new ChestMaterialStats(70, 6, 2, 30f)) + .setLegs(new LegsMaterialStats(70, 5, 2, 20f)) + .setBoots(new FeetMaterialStats(70, 2, 1, 15f)), + new TDMatHelper("dogbearium", 0x6d3300, fluids.put("dogbearium", new FluidMolten("dogbearium", 0x6d3300)), true).setHead(new HeadMaterialStats(150, 5.00f, 9.00f, HarvestLevels.DIAMOND)) + .setHandle(new HandleMaterialStats(0.85f, 75)) + .setExtra(new ExtraMaterialStats(75)) + .setShield(new ShieldMaterialStats(150 / 4, 75)) + .setBow(new BowMaterialStats(0.1f, 0.5f, 5.5f)) + .setHelm(new HelmMaterialStats(150, 3, 3, -60f)) + .setChest(new ChestMaterialStats(150, 8, 4, -60f)) + .setLegs(new LegsMaterialStats(150, 6, 4, -60f)) + .setBoots(new FeetMaterialStats(150, 3, 3, -60f)), + new TDMatHelper("sinisterium", 0x210000, fluids.put("sinisterium", new FluidMolten("sinisterium", 0x210000)), true).setHead(new HeadMaterialStats(224, 5.00f, 5.00f, HarvestLevels.DIAMOND)) + .setHandle(new HandleMaterialStats(0.75f, 99)) + .setExtra(new ExtraMaterialStats(99)) + .setShield(new ShieldMaterialStats(224 / 4, 55)) + .setBow(new BowMaterialStats(2.1f, 1.6f, 7.2f)) + .setHelm(new HelmMaterialStats(224, 2, 0, 9.5f)) + .setChest(new ChestMaterialStats(224, 6, 0, 10.5f)) + .setLegs(new LegsMaterialStats(224, 5, 0, 10.0f)) + .setBoots(new FeetMaterialStats(224, 2, 0, 9.5f)), + new TDMatHelper("nihilite", 0x000021, fluids.put("nihilite", new FluidMolten("nihilite", 0x000021)), true).setHead(new HeadMaterialStats(400, 9.7f, 7.1f, HarvestLevels.COBALT)) + .setHandle(new HandleMaterialStats(0.9f, 70)) + .setExtra(new ExtraMaterialStats(74)) + .setShield(new ShieldMaterialStats(400 / 4, 95)) + .setBow(new BowMaterialStats(0.9f, 1.7f, -1f)) + .setHelm(new HelmMaterialStats(400, 2, 0, 19)) + .setChest(new ChestMaterialStats(400, 5, 0, 15)) + .setLegs(new LegsMaterialStats(400, 4, 0, 15)) + .setBoots(new FeetMaterialStats(400, 2, 0, 19)), + new TDMatHelper("orichalcum", 0xffc700, fluids.put("orichalcum", new FluidMolten("orichalcum", 0xffc700)), true).setHead(new HeadMaterialStats(180, 5.3f, 6.23f, HarvestLevels.OBSIDIAN)) + .setHandle(new HandleMaterialStats(1.1f, 25)) + .setExtra(new ExtraMaterialStats(35)) + .setShield(new ShieldMaterialStats(180 / 4, 70)) + .setBow(new BowMaterialStats(1.9f, 1.9f, 2.3f)) + .setHelm(new HelmMaterialStats(180, 2, 2, 20.5f)) + .setChest(new ChestMaterialStats(180, 6, 3, 20.5f)) + .setLegs(new LegsMaterialStats(180, 5, 3, 20.5f)) + .setBoots(new FeetMaterialStats(180, 2, 3, 20.5f)), + new TDMatHelper("pandorium", 0x7f6a00, fluids.put("pandorium", new FluidMolten("pandorium", 0x7f6a00)), true).setHead(new HeadMaterialStats(999, 10.2f, 8.72f, HarvestLevels.OBSIDIAN)) + .setHandle(new HandleMaterialStats(0.4f, 999)) + .setExtra(new ExtraMaterialStats(99)) + .setShield(new ShieldMaterialStats(999 / 4, 100)) + .setBow(new BowMaterialStats(3f, 0.9f, 9f)) + .setHelm(new HelmMaterialStats(999, 3, 3, -70.0f)) + .setChest(new ChestMaterialStats(999, 8, 4, -70.0f)) + .setLegs(new LegsMaterialStats(999, 6, 4, -70.0f)) + .setBoots(new FeetMaterialStats(999, 3, 3, -70.0f)), + new TDMatHelper("rosegold", 0xff9b84, fluids.put("rosegold", new FluidMolten("rosegold", 0xff9b84)), true).setHead(new HeadMaterialStats(99, 4f, 1f, HarvestLevels.STONE)) + .setHandle(new HandleMaterialStats(1.5f, -90)) + .setExtra(new ExtraMaterialStats(-90)) + .setShield(new ShieldMaterialStats(99 / 4, 24)) + .setBow(new BowMaterialStats(0.1f, 0.1f, -2f)) + .setHelm(new HelmMaterialStats(99, 1, 0, 23.0f)) + .setChest(new ChestMaterialStats(99, 4, 0, 23.0f)) + .setLegs(new LegsMaterialStats(99, 3, 0, 23.0f)) + .setBoots(new FeetMaterialStats(99, 1, 0, 23.0f)), + new TDMatHelper("platinum", 0xe8e8e8, fluids.put("platinum", new FluidMolten("platinum", 0xe8e8e8)), true).setHead(new HeadMaterialStats(99, 3.7f, 4f, HarvestLevels.IRON)) + .setHandle(new HandleMaterialStats(1.5f, -90)) + .setExtra(new ExtraMaterialStats(-90)) + .setShield(new ShieldMaterialStats(99 / 4, 14)) + .setBow(new BowMaterialStats(0.1f, 0.1f, -2f)) + .setHelm(new HelmMaterialStats(99, 1, 1, 19.0f)) + .setChest(new ChestMaterialStats(99, 4, 1, 19.0f)) + .setLegs(new LegsMaterialStats(99, 3, 1, 19.0f)) + .setBoots(new FeetMaterialStats(99, 1, 1, 19.0f)), + new TDMatHelper("brass", 0xdbb332, fluids.put("brass", new FluidMolten("brass", 0xdbb332)), true).setHead(new HeadMaterialStats(380, 5f, 3f, HarvestLevels.IRON)) + .setHandle(new HandleMaterialStats(0.85f, 90)) + .setExtra(new ExtraMaterialStats(75)) + .setShield(new ShieldMaterialStats(380 / 4, 50)) + .setBow(new BowMaterialStats(0.1f, 0.5f, -1f)) + .setHelm(new HelmMaterialStats(380, 2, 1, 4.5f)) + .setChest(new ChestMaterialStats(380, 3, 2, 4.5f)) + .setLegs(new LegsMaterialStats(380, 2, 2, 4.5f)) + .setBoots(new FeetMaterialStats(380, 2, 2, 4.5f)), + new TDMatHelper("silver", 0x9e9e9e, new FluidMolten("silver", 0x9e9e9e), false), + new TDMatHelper("gold", 0xfff428, TinkerFluids.gold, true).setIngot(Items.GOLD_INGOT) + .setNugget(Items.GOLD_NUGGET) + .setHead(new HeadMaterialStats(100, 1f, 1f, HarvestLevels.STONE)) + .setHandle(new HandleMaterialStats(0.25f, 10)) + .setExtra(new ExtraMaterialStats(25)) + .setShield(new ShieldMaterialStats(100 / 4, 14)) + .setBow(new BowMaterialStats(0.2f, 0.4f, -1f)) + .setHelm(new HelmMaterialStats(100, 1, 0, 33f)) + .setChest(new ChestMaterialStats(100, 4, 0, 33f)) + .setLegs(new LegsMaterialStats(100, 3, 0, 33f)) + .setBoots(new FeetMaterialStats(100, 1, 0, 33f)), + new TDMatHelper("valyriansteel", 0xe2d9e2, fluids.put("valyriansteel", new FluidMolten("valyriansteel", 0xe2d9e2)), true).setHead(new HeadMaterialStats(610, 7f, 7f, HarvestLevels.OBSIDIAN)) + .setHandle(new HandleMaterialStats(0.9f, 180)) + .setExtra(new ExtraMaterialStats(125)) + .setShield(new ShieldMaterialStats(610 / 4, 85)) + .setBow(new BowMaterialStats(1.6f, 1.5f, 3f)) + .setHelm(new HelmMaterialStats(610, 3, 3, 0)) + .setChest(new ChestMaterialStats(610, 7, 4, 0)) + .setLegs(new LegsMaterialStats(610, 6, 2, 0)) + .setBoots(new FeetMaterialStats(610, 3, 3, 0)), + new TDMatHelper("froststeel", 0xc6dcff, fluids.put("froststeel", new FluidMolten("froststeel", 0xc6dcff)), true).setHead(new HeadMaterialStats(610, 7f, 7f, HarvestLevels.OBSIDIAN)) + .setHandle(new HandleMaterialStats(1.1f, 110)) + .setExtra(new ExtraMaterialStats(125)) + .setShield(new ShieldMaterialStats(610 / 4, 85)) + .setBow(new BowMaterialStats(1.6f, 1.5f, 3f)) + .setHelm(new HelmMaterialStats(610, 2, 2, 0)) + .setChest(new ChestMaterialStats(610, 6, 3, 0)) + .setLegs(new LegsMaterialStats(610, 5, 2, 0)) + .setBoots(new FeetMaterialStats(610, 3, 1, 0)), + new TDMatHelper("pureardite", 0xff4300, fluids.put("pureardite", new FluidMolten("pureardite", 0xff4300)), true).setHead(new HeadMaterialStats(1200, 3.5f, 3.6f, HarvestLevels.COBALT)) + .setHandle(new HandleMaterialStats(1.4f, -200)) + .setExtra(new ExtraMaterialStats(450)) + .setShield(new ShieldMaterialStats(1200 / 4, 33)) + .setBow(new BowMaterialStats(0.45f, 0.8f, 1f)), + new TDMatHelper("purecobalt", 0x547eff, fluids.put("purecobalt", new FluidMolten("purecobalt", 0x547eff)), true).setHead(new HeadMaterialStats(780, 13f, 4.1f, HarvestLevels.COBALT)) + .setHandle(new HandleMaterialStats(1.4f, 100)) + .setExtra(new ExtraMaterialStats(300)) + .setShield(new ShieldMaterialStats(780 / 4, 33)) + .setBow(new BowMaterialStats(0.3f, 1.3f, 3f)), + new TDMatHelper("puremanyullyn", 0xd044ff, fluids.put("puremanyullyn", new FluidMolten("puremanyullyn", 0xd044ff)), true).setHead(new HeadMaterialStats(820, 7.02f, 9.1f, HarvestLevels.COBALT)) + .setHandle(new HandleMaterialStats(0.5f, 350)) + .setExtra(new ExtraMaterialStats(350)) + .setShield(new ShieldMaterialStats(820 / 4, 33)) + .setBow(new BowMaterialStats(0.65f, 1.2f, 4f)), + new TDMatHelper("glass", 0xffffff, TinkerFluids.glass, true).setHead(new HeadMaterialStats(6, 4f, 7f, HarvestLevels.STONE)) + .setHandle(new HandleMaterialStats(0.1f, -45)) + .setExtra(new ExtraMaterialStats(-45)) + .setShield(new ShieldMaterialStats(6 / 4, 33)) + .setBow(new BowMaterialStats(0.1f, 0.1f, -2f)), + new TDMatHelper("ice", 0xdcff00, false), + new TDMatHelper("purifiedgold", 0xffe242, fluids.put("purifiedgold", new FluidMolten("purifiedgold", 0xffe242)), true), + new TDMatHelper("purifiedsilver", 0xefefef, fluids.put("purifiedsilver", new FluidMolten("purifiedsilver", 0xefefef)), true))); + // + // new TDMatHelper("white cloth", 0xDDDDDD, null, true, true, + // false).setGem(new ItemStack(Blocks.WOOL, 0, 1)).setCloth(new + // ClothMaterialStats(100, 0, 0, 25)), + // new TDMatHelper("orange cloth", 0xDB7D3E, null, true, true, + // false).setGem(new ItemStack(Blocks.WOOL, 0, 1)).setCloth(new + // ClothMaterialStats(100, 0, 0, 25)) // Jokes - List<TDMatHelper> materials_joke = new ArrayList<>(Arrays.asList( - new TDMatHelper("cheese", 0xffe900, fluids.put("cheese", new FluidMolten("cheese", 0xffe900)), true), - new TDMatHelper("bread", 0x89732a), new TDMatHelper("melon", 0xff77a4))); + List<TDMatHelper> materials_joke = new ArrayList<>(Arrays.asList(new TDMatHelper("cheese", 0xffe900, fluids.put("cheese", new FluidMolten("cheese", 0xffe900)), true), + new TDMatHelper("bread", 0x89732a), + new TDMatHelper("melon", 0xff77a4))); // Holiday - List<TDMatHelper> materials_xmas = new ArrayList<>( - Arrays.asList(new TDMatHelper("redcandy", 0xff0000).setNugget(TinkersDefense.holiday.item_redmintcane), - new TDMatHelper("greencandy", 0x00ff00).setNugget(TinkersDefense.holiday.item_greenmintcane))); + List<TDMatHelper> materials_xmas = new ArrayList<>(Arrays.asList(new TDMatHelper("redcandy", 0xff0000).setNugget(TinkersDefense.holiday.item_redmintcane), + new TDMatHelper("greencandy", 0x00ff00).setNugget(TinkersDefense.holiday.item_greenmintcane))); // Gems List<TDMatHelper> materials_gems = new ArrayList<>(Arrays.asList(new TDMatHelper("sapphire", 0x6e00ff), - new TDMatHelper("ruby", 0xff0061, true, true), - new TDMatHelper("emerald", 0x16cc4f, true, true).setGem(Items.EMERALD), - new TDMatHelper("diamond", 0x96ecf2, true, true).setGem(Items.DIAMOND), - new TDMatHelper("starsapphire", 0x6e00ff, true, true), new TDMatHelper("starruby", 0xff0061, true, true), - new TDMatHelper("citrine", 0xffe877, true, true), new TDMatHelper("ghasttear", 0xe8fbff, true, true), - new TDMatHelper("quartz", 0xede8e8, true, true), new TDMatHelper("glowstonecrystal", 0xfff956, true, true), - new TDMatHelper("enderpearl", 0x2bad3a, true, true), new TDMatHelper("amethyst", 0xb436e2, true, true), - new TDMatHelper("lapis", 0x4349bc, true, true).setGem(new ItemStack(Items.DYE, 1, 4)), - new TDMatHelper("topaz", 0xffc551, true, true), new TDMatHelper("garnet", 0x9e1c1c, true, true), - new TDMatHelper("opal", 0xe2e2e2, true, true), new TDMatHelper("tanzanite", 0x8860e5, true, true), - new TDMatHelper("amber", 0xdba827, true, true))); + new TDMatHelper("ruby", 0xff0061, true, true), + new TDMatHelper("emerald", 0x16cc4f, true, true).setGem(Items.EMERALD), + new TDMatHelper("diamond", 0x96ecf2, true, true).setGem(Items.DIAMOND), + new TDMatHelper("starsapphire", 0x6e00ff, true, true), + new TDMatHelper("starruby", 0xff0061, true, true), + new TDMatHelper("citrine", 0xffe877, true, true), + new TDMatHelper("ghasttear", 0xe8fbff, true, true), + new TDMatHelper("quartz", 0xede8e8, true, true), + new TDMatHelper("glowstonecrystal", 0xfff956, true, true), + new TDMatHelper("enderpearl", 0x2bad3a, true, true), + new TDMatHelper("amethyst", 0xb436e2, true, true), + new TDMatHelper("lapis", 0x4349bc, true, true).setGem(new ItemStack(Items.DYE, 1, 4)), + new TDMatHelper("topaz", 0xffc551, true, true), + new TDMatHelper("garnet", 0x9e1c1c, true, true), + new TDMatHelper("opal", 0xe2e2e2, true, true), + new TDMatHelper("tanzanite", 0x8860e5, true, true), + new TDMatHelper("amber", 0xdba827, true, true))); // Cornucopia - List<TDMatHelper> materials_cornucopia = new ArrayList<>(Arrays.asList( - new TDMatHelper("gallite", 0x198c09, fluids.put("gallite", new FluidMolten("gallite", 0x198c09)), true), - new TDMatHelper("sundrop", 0xfff987, fluids.put("sundrop", new FluidMolten("sundrop", 0xfff987)), true), - new TDMatHelper("voidite", 0x450059, fluids.put("voidite", new FluidMolten("voidite", 0x450059)), true), - new TDMatHelper("solarium", 0xffff31, fluids.put("solarium", new FluidMolten("solarium", 0xffff31)), true), - new TDMatHelper("dragonsteel", 0x55914d, - fluids.put("dragonsteel", new FluidMolten("dragonsteel", 0x55914d)), true), - new TDMatHelper("blacksteel", 0x383838, fluids.put("blacksteel", new FluidMolten("blacksteel", 0x383838)), - true), - new TDMatHelper("abyssalium", 0x000633, fluids.put("abyssalium", new FluidMolten("abyssalium", 0x000633)), - true), - new TDMatHelper("depthsilver", 0x646782, - fluids.put("depthsilver", new FluidMolten("depthsilver", 0x646782)), true), - new TDMatHelper("moonsilver", 0x777777, fluids.put("moonsilver", new FluidMolten("moonsilver", 0x777777)), - true), - new TDMatHelper("novagold", 0xffc300, fluids.put("novagold", new FluidMolten("novagold", 0xffc300)), - true))); + List<TDMatHelper> materials_cornucopia = new ArrayList<>(Arrays.asList(new TDMatHelper("gallite", 0x198c09, fluids.put("gallite", new FluidMolten("gallite", 0x198c09)), true), + new TDMatHelper("sundrop", 0xfff987, fluids.put("sundrop", new FluidMolten("sundrop", 0xfff987)), true), + new TDMatHelper("voidite", 0x450059, fluids.put("voidite", new FluidMolten("voidite", 0x450059)), true), + new TDMatHelper("solarium", 0xffff31, fluids.put("solarium", new FluidMolten("solarium", 0xffff31)), true), + new TDMatHelper("dragonsteel", 0x55914d, fluids.put("dragonsteel", new FluidMolten("dragonsteel", 0x55914d)), true), + new TDMatHelper("blacksteel", 0x383838, fluids.put("blacksteel", new FluidMolten("blacksteel", 0x383838)), true), + new TDMatHelper("abyssalium", 0x000633, fluids.put("abyssalium", new FluidMolten("abyssalium", 0x000633)), true), + new TDMatHelper("depthsilver", 0x646782, fluids.put("depthsilver", new FluidMolten("depthsilver", 0x646782)), true), + new TDMatHelper("moonsilver", 0x777777, fluids.put("moonsilver", new FluidMolten("moonsilver", 0x777777)), true), + new TDMatHelper("novagold", 0xffc300, fluids.put("novagold", new FluidMolten("novagold", 0xffc300)), true))); // // Blood Magic // List<String> materials_bm = new ArrayList<>( // Arrays.asList("blankslate", "reinforcedslate", "imbued", "demonic", @@ -302,11 +317,11 @@ public class TDMaterials { // List<String> materials_pam = new // ArrayList<>(Arrays.asList("hardenedleather")); - public static TDOreDictItem ingot; - public static TDOreDictItem dust; - public static TDOreDictItem nugget; - public static TDOreDictItem grain; - public static TDOreDictItem gem; + public static TDOreDictItem ingot; + public static TDOreDictItem dust; + public static TDOreDictItem nugget; + public static TDOreDictItem grain; + public static TDOreDictItem gem; // public static final AbstractTrait axelover = new TraitAxeLover(); // public static final AbstractTrait dulling = new TraitDulling(); @@ -314,39 +329,46 @@ public class TDMaterials { // public static final AbstractTrait barbed = new TraitBarbed(); // public static final AbstractTrait dogtoy = new TraitDogToy(); - static ArrayList<Item> itemList = new ArrayList<Item>(); - static ArrayList<Block> blockList = new ArrayList<Block>(); + static ArrayList<Item> itemList = new ArrayList<Item>(); + static ArrayList<Block> blockList = new ArrayList<Block>(); - private static Material mat(String name, int color) { + private static Material mat(String name, int color) + { Material mat = new Material(name, color); // materials.add(mat); return mat; } - List<String> getMatNames(List<TDMatHelper> mats) { + List<String> getMatNames(List<TDMatHelper> mats) + { List<String> r = new ArrayList<String>(); - for (TDMatHelper m : mats) { + for (TDMatHelper m : mats) + { r.add(m.name); } return r; } - List<Integer> getMatColors(List<TDMatHelper> mats) { + List<Integer> getMatColors(List<TDMatHelper> mats) + { List<Integer> r = new ArrayList<Integer>(); - for (TDMatHelper m : mats) { + for (TDMatHelper m : mats) + { r.add(m.color); } return r; } - List<FluidMolten> getMatFluids(List<TDMatHelper> mats) { + List<FluidMolten> getMatFluids(List<TDMatHelper> mats) + { List<FluidMolten> r = new ArrayList<FluidMolten>(); - for (TDMatHelper m : mats) { + for (TDMatHelper m : mats) + { r.add(m.fluid); } @@ -354,18 +376,19 @@ public class TDMaterials { } @Subscribe - public void preInit(FMLPreInitializationEvent event) { + public void preInit(FMLPreInitializationEvent event) + { if (TinkersDefense.config.materials.enableBaseMaterials) this.materials_master.addAll(materials_base); -// if (TinkersDefense.config.materials.enableJokeMaterials) -// this.materials_master.addAll(this.materials_joke); -// if (TinkersDefense.config.materials.enableHolidayMaterials) -// this.materials_master.addAll(materials_xmas); -// if (TinkersDefense.config.materials.enableGemMaterials) -// this.materials_master.addAll(materials_gems); -// if (TinkersDefense.config.materials.enableCornucopiaMaterials) -// this.materials_master.addAll(materials_cornucopia); + // if (TinkersDefense.config.materials.enableJokeMaterials) + // this.materials_master.addAll(this.materials_joke); + // if (TinkersDefense.config.materials.enableHolidayMaterials) + // this.materials_master.addAll(materials_xmas); + // if (TinkersDefense.config.materials.enableGemMaterials) + // this.materials_master.addAll(materials_gems); + // if (TinkersDefense.config.materials.enableCornucopiaMaterials) + // this.materials_master.addAll(materials_cornucopia); // if (TinkersDefense.config.materials.enableTwilightForestMaterials) // this.materials_master.addAll(materials_tf); // if (TinkersDefense.config.materials.enableBloodMagicMaterials) @@ -373,281 +396,283 @@ public class TDMaterials { // if (TinkersDefense.config.materials.enableHarvestCraftMaterials) // this.materials_master.addAll(materials_pam); - nugget = new TDOreDictItem("nugget", getMatNames(materials_master), getMatColors(materials_master)); - dust = new TDOreDictItem("dust", getMatNames(materials_master), getMatColors(materials_master)); - grain = new TDOreDictItem("grain", getMatNames(materials_master), getMatColors(materials_master)); - - List<TDMatHelper> gemMaster = new ArrayList<TDMatHelper>(); - List<TDMatHelper> ingotMaster = new ArrayList<TDMatHelper>(); - - for (TDMatHelper i : materials_master) { - if (i.isGem) - gemMaster.add(i); - else - ingotMaster.add(i); - } - - gem = new TDOreDictItem("gem", getMatNames(gemMaster), getMatColors(gemMaster)); - ingot = new TDOreDictItem("ingot", getMatNames(ingotMaster), getMatColors(ingotMaster)); - - registerClothMaterials(); - Material.UNKNOWN.addStats(new ShieldMaterialStats(35, 33)); - Material.UNKNOWN.addStats(ams.new HelmMaterialStats(35, 1, 0, 0)); - Material.UNKNOWN.addStats(ams.new ChestMaterialStats(35, 1, 0, 0)); - Material.UNKNOWN.addStats(ams.new LegsMaterialStats(35, 1, 0, 0)); - Material.UNKNOWN.addStats(ams.new FeetMaterialStats(35, 1, 0, 0)); - Material.UNKNOWN.addStats(ams.new ClothMaterialStats(35, 0, 0, 0)); + Material.UNKNOWN.addStats(new HelmMaterialStats(35, 1, 0, 0)); + Material.UNKNOWN.addStats(new ChestMaterialStats(35, 1, 0, 0)); + Material.UNKNOWN.addStats(new LegsMaterialStats(35, 1, 0, 0)); + Material.UNKNOWN.addStats(new FeetMaterialStats(35, 1, 0, 0)); + Material.UNKNOWN.addStats(new FabricMaterialStats(35, 0, 0, 0)); Material.UNKNOWN.addStats(new BaubleMaterialStats(35)); - TinkerRegistry.addMaterialStats(this.white, ams.new ClothMaterialStats(100, 10, 0, 25)); - TinkerRegistry.addMaterialStats(this.black, ams.new ClothMaterialStats(100, 10, 0, 25)); - TinkerRegistry.addMaterialStats(this.blue, ams.new ClothMaterialStats(100, 10, 0, 25)); - TinkerRegistry.addMaterialStats(this.brown, ams.new ClothMaterialStats(100, 10, 0, 25)); - TinkerRegistry.addMaterialStats(this.cyan, ams.new ClothMaterialStats(100, 10, 0, 25)); - TinkerRegistry.addMaterialStats(this.gray, ams.new ClothMaterialStats(100, 10, 0, 25)); - TinkerRegistry.addMaterialStats(this.green, ams.new ClothMaterialStats(100, 10, 0, 25)); - TinkerRegistry.addMaterialStats(this.lightblue, ams.new ClothMaterialStats(100, 10, 0, 25)); - TinkerRegistry.addMaterialStats(this.lightgray, ams.new ClothMaterialStats(100, 10, 0, 25)); - TinkerRegistry.addMaterialStats(this.lime, ams.new ClothMaterialStats(100, 10, 0, 25)); - TinkerRegistry.addMaterialStats(this.magenta, ams.new ClothMaterialStats(100, 10, 0, 25)); - TinkerRegistry.addMaterialStats(this.orange, ams.new ClothMaterialStats(100, 10, 0, 25)); - TinkerRegistry.addMaterialStats(this.pink, ams.new ClothMaterialStats(100, 10, 0, 25)); - TinkerRegistry.addMaterialStats(this.purple, ams.new ClothMaterialStats(100, 10, 0, 25)); - TinkerRegistry.addMaterialStats(this.red, ams.new ClothMaterialStats(100, 10, 0, 25)); - TinkerRegistry.addMaterialStats(this.yellow, ams.new ClothMaterialStats(100, 10, 0, 25)); + registerClothMaterials(); TinkerRegistry.addMaterialStats(TinkerMaterials.wood, new ShieldMaterialStats(35, 25)); - TinkerRegistry.addMaterialStats(TinkerMaterials.wood, ams.new HelmMaterialStats(35, 1, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.wood, ams.new ChestMaterialStats(35, 3, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.wood, ams.new LegsMaterialStats(35, 2, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.wood, ams.new FeetMaterialStats(35, 1, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.wood, new HelmMaterialStats(35, 1, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.wood, new ChestMaterialStats(35, 3, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.wood, new LegsMaterialStats(35, 2, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.wood, new FeetMaterialStats(35, 1, 0, 0)); // TinkerMaterials.wood.addTrait(axelover, SHIELD); TinkerRegistry.addMaterialStats(TinkerMaterials.stone, new ShieldMaterialStats(120, 30)); - TinkerRegistry.addMaterialStats(TinkerMaterials.stone, ams.new HelmMaterialStats(120, 2, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.stone, ams.new ChestMaterialStats(120, 4, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.stone, ams.new LegsMaterialStats(120, 3, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.stone, ams.new FeetMaterialStats(120, 2, 0, 0)); - //TinkerRegistry.addMaterialTrait(TinkerMaterials.stone, dulling, SHIELD); + TinkerRegistry.addMaterialStats(TinkerMaterials.stone, new HelmMaterialStats(120, 2, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.stone, new ChestMaterialStats(120, 4, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.stone, new LegsMaterialStats(120, 3, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.stone, new FeetMaterialStats(120, 2, 0, 0)); + // TinkerRegistry.addMaterialTrait(TinkerMaterials.stone, dulling, + // SHIELD); // TinkerMaterials.stone.addTrait(dulling, SHIELD); TinkerRegistry.addMaterialStats(TinkerMaterials.flint, new ShieldMaterialStats(150, 30)); - TinkerRegistry.addMaterialStats(TinkerMaterials.flint, ams.new HelmMaterialStats(150, 2, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.flint, ams.new ChestMaterialStats(150, 4, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.flint, ams.new LegsMaterialStats(150, 3, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.flint, ams.new FeetMaterialStats(150, 2, 0, 0)); - // TinkerRegistry.addMaterialTrait(TinkerMaterials.flint, firestarter, + TinkerRegistry.addMaterialStats(TinkerMaterials.flint, new HelmMaterialStats(150, 2, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.flint, new ChestMaterialStats(150, 4, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.flint, new LegsMaterialStats(150, 3, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.flint, new FeetMaterialStats(150, 2, 0, 0)); + // TinkerRegistry.addMaterialTrait(TinkerMaterials.flint, + // firestarter, // SHIELD); TinkerRegistry.addMaterialStats(TinkerMaterials.cactus, new ShieldMaterialStats(210, 25)); - TinkerRegistry.addMaterialStats(TinkerMaterials.cactus, ams.new HelmMaterialStats(210, 1, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.cactus, ams.new ChestMaterialStats(210, 3, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.cactus, ams.new LegsMaterialStats(210, 2, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.cactus, ams.new FeetMaterialStats(210, 1, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.cactus, new HelmMaterialStats(210, 1, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.cactus, new ChestMaterialStats(210, 3, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.cactus, new LegsMaterialStats(210, 2, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.cactus, new FeetMaterialStats(210, 1, 0, 0)); // TinkerRegistry.addMaterialTrait(TinkerMaterials.cactus, barbed, // SHIELD); TinkerRegistry.addMaterialStats(TinkerMaterials.bone, new ShieldMaterialStats(200, 40)); - TinkerRegistry.addMaterialStats(TinkerMaterials.bone, ams.new HelmMaterialStats(200, 2, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.bone, ams.new ChestMaterialStats(200, 4, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.bone, ams.new LegsMaterialStats(200, 4, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.bone, ams.new FeetMaterialStats(200, 2, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.bone, new HelmMaterialStats(200, 2, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.bone, new ChestMaterialStats(200, 4, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.bone, new LegsMaterialStats(200, 4, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.bone, new FeetMaterialStats(200, 2, 0, 0)); // TinkerRegistry.addMaterialTrait(TinkerMaterials.bone, dogtoy, // SHIELD); TinkerRegistry.addMaterialStats(TinkerMaterials.obsidian, new ShieldMaterialStats(139, 50)); - TinkerRegistry.addMaterialStats(TinkerMaterials.obsidian, ams.new HelmMaterialStats(139, 2, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.obsidian, ams.new ChestMaterialStats(139, 6, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.obsidian, ams.new LegsMaterialStats(139, 5, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.obsidian, ams.new FeetMaterialStats(139, 2, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.obsidian, new HelmMaterialStats(139, 2, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.obsidian, new ChestMaterialStats(139, 6, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.obsidian, new LegsMaterialStats(139, 5, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.obsidian, new FeetMaterialStats(139, 2, 0, 0)); TinkerRegistry.addMaterialStats(TinkerMaterials.prismarine, new ShieldMaterialStats(430, 45)); - TinkerRegistry.addMaterialStats(TinkerMaterials.prismarine, ams.new HelmMaterialStats(430, 2, 0, 2.5f)); - TinkerRegistry.addMaterialStats(TinkerMaterials.prismarine, ams.new ChestMaterialStats(430, 5, 0, 3.5f)); - TinkerRegistry.addMaterialStats(TinkerMaterials.prismarine, ams.new LegsMaterialStats(430, 5, 0, 3.0f)); - TinkerRegistry.addMaterialStats(TinkerMaterials.prismarine, ams.new FeetMaterialStats(430, 2, 0, 2.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.prismarine, new HelmMaterialStats(430, 2, 0, 2.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.prismarine, new ChestMaterialStats(430, 5, 0, 3.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.prismarine, new LegsMaterialStats(430, 5, 0, 3.0f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.prismarine, new FeetMaterialStats(430, 2, 0, 2.5f)); TinkerRegistry.addMaterialStats(TinkerMaterials.endstone, new ShieldMaterialStats(420, 50)); - TinkerRegistry.addMaterialStats(TinkerMaterials.endstone, ams.new HelmMaterialStats(420, 3, 1, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.endstone, ams.new ChestMaterialStats(420, 6, 1, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.endstone, ams.new LegsMaterialStats(420, 5, 1, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.endstone, ams.new FeetMaterialStats(420, 3, 1, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.endstone, new HelmMaterialStats(420, 3, 1, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.endstone, new ChestMaterialStats(420, 6, 1, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.endstone, new LegsMaterialStats(420, 5, 1, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.endstone, new FeetMaterialStats(420, 3, 1, 0)); TinkerRegistry.addMaterialStats(TinkerMaterials.paper, new ShieldMaterialStats(12, 10)); - TinkerRegistry.addMaterialStats(TinkerMaterials.paper, ams.new HelmMaterialStats(12, 1, 0, 4)); - TinkerRegistry.addMaterialStats(TinkerMaterials.paper, ams.new ChestMaterialStats(12, 2, 0, 5.5f)); - TinkerRegistry.addMaterialStats(TinkerMaterials.paper, ams.new LegsMaterialStats(12, 1, 0, 5)); - TinkerRegistry.addMaterialStats(TinkerMaterials.paper, ams.new FeetMaterialStats(12, 1, 0, 4)); + TinkerRegistry.addMaterialStats(TinkerMaterials.paper, new HelmMaterialStats(12, 1, 0, 4)); + TinkerRegistry.addMaterialStats(TinkerMaterials.paper, new ChestMaterialStats(12, 2, 0, 5.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.paper, new LegsMaterialStats(12, 1, 0, 5)); + TinkerRegistry.addMaterialStats(TinkerMaterials.paper, new FeetMaterialStats(12, 1, 0, 4)); TinkerRegistry.addMaterialStats(TinkerMaterials.sponge, new ShieldMaterialStats(550, 20)); - TinkerRegistry.addMaterialStats(TinkerMaterials.sponge, ams.new HelmMaterialStats(550, 1, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.sponge, ams.new ChestMaterialStats(550, 2, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.sponge, ams.new LegsMaterialStats(550, 2, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.sponge, ams.new FeetMaterialStats(550, 1, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.sponge, new HelmMaterialStats(550, 1, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.sponge, new ChestMaterialStats(550, 2, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.sponge, new LegsMaterialStats(550, 2, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.sponge, new FeetMaterialStats(550, 1, 0, 0)); + // TinkerRegistry.addMaterialStats(TinkerMaterials.sponge, new + // FabricMaterialStats(550, 0, 0, 0)); TinkerRegistry.addMaterialStats(TinkerMaterials.firewood, new ShieldMaterialStats(550, 25)); - TinkerRegistry.addMaterialStats(TinkerMaterials.firewood, ams.new HelmMaterialStats(550, 1, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.firewood, ams.new ChestMaterialStats(550, 3, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.firewood, ams.new LegsMaterialStats(550, 2, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.firewood, ams.new FeetMaterialStats(550, 1, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.firewood, new HelmMaterialStats(550, 1, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.firewood, new ChestMaterialStats(550, 3, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.firewood, new LegsMaterialStats(550, 2, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.firewood, new FeetMaterialStats(550, 1, 0, 0)); // Slime TinkerRegistry.addMaterialStats(TinkerMaterials.slime, new ShieldMaterialStats(1000, 5)); - TinkerRegistry.addMaterialStats(TinkerMaterials.slime, ams.new HelmMaterialStats(1000, 1, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.slime, ams.new ChestMaterialStats(1000, 2, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.slime, ams.new LegsMaterialStats(1000, 2, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.slime, ams.new FeetMaterialStats(1000, 1, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.slime, new HelmMaterialStats(1000, 1, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.slime, new ChestMaterialStats(1000, 2, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.slime, new LegsMaterialStats(1000, 2, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.slime, new FeetMaterialStats(1000, 1, 0, 0)); TinkerRegistry.addMaterialStats(TinkerMaterials.blueslime, new ShieldMaterialStats(780, 7)); - TinkerRegistry.addMaterialStats(TinkerMaterials.blueslime, ams.new HelmMaterialStats(780, 1, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.blueslime, ams.new ChestMaterialStats(780, 2, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.blueslime, ams.new LegsMaterialStats(780, 2, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.blueslime, ams.new FeetMaterialStats(780, 1, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.blueslime, new HelmMaterialStats(780, 1, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.blueslime, new ChestMaterialStats(780, 2, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.blueslime, new LegsMaterialStats(780, 2, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.blueslime, new FeetMaterialStats(780, 1, 0, 0)); TinkerRegistry.addMaterialStats(TinkerMaterials.knightslime, new ShieldMaterialStats(850, 27)); - TinkerRegistry.addMaterialStats(TinkerMaterials.knightslime, ams.new HelmMaterialStats(850, 2, 1, 1.5f)); - TinkerRegistry.addMaterialStats(TinkerMaterials.knightslime, ams.new ChestMaterialStats(850, 6, 1, 2.5f)); - TinkerRegistry.addMaterialStats(TinkerMaterials.knightslime, ams.new LegsMaterialStats(850, 5, 1, 2.0f)); - TinkerRegistry.addMaterialStats(TinkerMaterials.knightslime, ams.new FeetMaterialStats(850, 2, 1, 1.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.knightslime, new HelmMaterialStats(850, 2, 1, 1.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.knightslime, new ChestMaterialStats(850, 6, 1, 2.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.knightslime, new LegsMaterialStats(850, 5, 1, 2.0f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.knightslime, new FeetMaterialStats(850, 2, 1, 1.5f)); TinkerRegistry.addMaterialStats(TinkerMaterials.magmaslime, new ShieldMaterialStats(600, 6)); - TinkerRegistry.addMaterialStats(TinkerMaterials.magmaslime, ams.new HelmMaterialStats(600, 1, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.magmaslime, ams.new ChestMaterialStats(600, 2, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.magmaslime, ams.new LegsMaterialStats(600, 2, 0, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.magmaslime, ams.new FeetMaterialStats(600, 1, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.magmaslime, new HelmMaterialStats(600, 1, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.magmaslime, new ChestMaterialStats(600, 2, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.magmaslime, new LegsMaterialStats(600, 2, 0, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.magmaslime, new FeetMaterialStats(600, 1, 0, 0)); // Nether TinkerRegistry.addMaterialStats(TinkerMaterials.netherrack, new ShieldMaterialStats(270, 20)); - TinkerRegistry.addMaterialStats(TinkerMaterials.netherrack, ams.new HelmMaterialStats(270, 1, 0, -12)); - TinkerRegistry.addMaterialStats(TinkerMaterials.netherrack, ams.new ChestMaterialStats(270, 3, 0, -12)); - TinkerRegistry.addMaterialStats(TinkerMaterials.netherrack, ams.new LegsMaterialStats(270, 2, 0, -12)); - TinkerRegistry.addMaterialStats(TinkerMaterials.netherrack, ams.new FeetMaterialStats(270, 1, 0, -12)); + TinkerRegistry.addMaterialStats(TinkerMaterials.netherrack, new HelmMaterialStats(270, 1, 0, -12)); + TinkerRegistry.addMaterialStats(TinkerMaterials.netherrack, new ChestMaterialStats(270, 3, 0, -12)); + TinkerRegistry.addMaterialStats(TinkerMaterials.netherrack, new LegsMaterialStats(270, 2, 0, -12)); + TinkerRegistry.addMaterialStats(TinkerMaterials.netherrack, new FeetMaterialStats(270, 1, 0, -12)); TinkerRegistry.addMaterialStats(TinkerMaterials.cobalt, new ShieldMaterialStats(780, 55)); - TinkerRegistry.addMaterialStats(TinkerMaterials.cobalt, ams.new HelmMaterialStats(780, 3, 0, 5)); - TinkerRegistry.addMaterialStats(TinkerMaterials.cobalt, ams.new ChestMaterialStats(780, 7, 0, 5)); - TinkerRegistry.addMaterialStats(TinkerMaterials.cobalt, ams.new LegsMaterialStats(780, 5, 0, 5)); - TinkerRegistry.addMaterialStats(TinkerMaterials.cobalt, ams.new FeetMaterialStats(780, 3, 0, 5)); + TinkerRegistry.addMaterialStats(TinkerMaterials.cobalt, new HelmMaterialStats(780, 3, 0, 5)); + TinkerRegistry.addMaterialStats(TinkerMaterials.cobalt, new ChestMaterialStats(780, 7, 0, 5)); + TinkerRegistry.addMaterialStats(TinkerMaterials.cobalt, new LegsMaterialStats(780, 5, 0, 5)); + TinkerRegistry.addMaterialStats(TinkerMaterials.cobalt, new FeetMaterialStats(780, 3, 0, 5)); TinkerRegistry.addMaterialStats(TinkerMaterials.ardite, new ShieldMaterialStats(990, 75)); - TinkerRegistry.addMaterialStats(TinkerMaterials.ardite, ams.new HelmMaterialStats(990, 3, 3, -100)); - TinkerRegistry.addMaterialStats(TinkerMaterials.ardite, ams.new ChestMaterialStats(990, 8, 4, -100)); - TinkerRegistry.addMaterialStats(TinkerMaterials.ardite, ams.new LegsMaterialStats(990, 6, 4, -100)); - TinkerRegistry.addMaterialStats(TinkerMaterials.ardite, ams.new FeetMaterialStats(990, 3, 3, -100)); + TinkerRegistry.addMaterialStats(TinkerMaterials.ardite, new HelmMaterialStats(990, 3, 3, -100)); + TinkerRegistry.addMaterialStats(TinkerMaterials.ardite, new ChestMaterialStats(990, 8, 4, -100)); + TinkerRegistry.addMaterialStats(TinkerMaterials.ardite, new LegsMaterialStats(990, 6, 4, -100)); + TinkerRegistry.addMaterialStats(TinkerMaterials.ardite, new FeetMaterialStats(990, 3, 3, -100)); TinkerRegistry.addMaterialStats(TinkerMaterials.manyullyn, new ShieldMaterialStats(820, 60)); - TinkerRegistry.addMaterialStats(TinkerMaterials.manyullyn, ams.new HelmMaterialStats(820, 3, 2, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.manyullyn, ams.new ChestMaterialStats(820, 8, 2, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.manyullyn, ams.new LegsMaterialStats(820, 6, 2, 0)); - TinkerRegistry.addMaterialStats(TinkerMaterials.manyullyn, ams.new FeetMaterialStats(820, 3, 2, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.manyullyn, new HelmMaterialStats(820, 3, 2, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.manyullyn, new ChestMaterialStats(820, 8, 2, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.manyullyn, new LegsMaterialStats(820, 6, 2, 0)); + TinkerRegistry.addMaterialStats(TinkerMaterials.manyullyn, new FeetMaterialStats(820, 3, 2, 0)); // Metals TinkerRegistry.addMaterialStats(TinkerMaterials.iron, new ShieldMaterialStats(204, 50)); - TinkerRegistry.addMaterialStats(TinkerMaterials.iron, ams.new HelmMaterialStats(204, 2, 0, -4)); - TinkerRegistry.addMaterialStats(TinkerMaterials.iron, ams.new ChestMaterialStats(204, 6, 0, -5)); - TinkerRegistry.addMaterialStats(TinkerMaterials.iron, ams.new LegsMaterialStats(204, 5, 0, -4)); - TinkerRegistry.addMaterialStats(TinkerMaterials.iron, ams.new FeetMaterialStats(204, 2, 0, -3)); + TinkerRegistry.addMaterialStats(TinkerMaterials.iron, new HelmMaterialStats(204, 2, 0, -4)); + TinkerRegistry.addMaterialStats(TinkerMaterials.iron, new ChestMaterialStats(204, 6, 0, -5)); + TinkerRegistry.addMaterialStats(TinkerMaterials.iron, new LegsMaterialStats(204, 5, 0, -4)); + TinkerRegistry.addMaterialStats(TinkerMaterials.iron, new FeetMaterialStats(204, 2, 0, -3)); TinkerRegistry.addMaterialStats(TinkerMaterials.pigiron, new ShieldMaterialStats(380, 52)); - TinkerRegistry.addMaterialStats(TinkerMaterials.pigiron, ams.new HelmMaterialStats(380, 2, 0, 0.5f)); - TinkerRegistry.addMaterialStats(TinkerMaterials.pigiron, ams.new ChestMaterialStats(380, 6, 0, 1.5f)); - TinkerRegistry.addMaterialStats(TinkerMaterials.pigiron, ams.new LegsMaterialStats(380, 5, 0, 1)); - TinkerRegistry.addMaterialStats(TinkerMaterials.pigiron, ams.new FeetMaterialStats(380, 2, 0, 0.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.pigiron, new HelmMaterialStats(380, 2, 0, 0.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.pigiron, new ChestMaterialStats(380, 6, 0, 1.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.pigiron, new LegsMaterialStats(380, 5, 0, 1)); + TinkerRegistry.addMaterialStats(TinkerMaterials.pigiron, new FeetMaterialStats(380, 2, 0, 0.5f)); // Mod Integration TinkerRegistry.addMaterialStats(TinkerMaterials.copper, new ShieldMaterialStats(210, 34)); - TinkerRegistry.addMaterialStats(TinkerMaterials.copper, ams.new HelmMaterialStats(210, 1, 0, 3)); - TinkerRegistry.addMaterialStats(TinkerMaterials.copper, ams.new ChestMaterialStats(210, 4, 0, 3)); - TinkerRegistry.addMaterialStats(TinkerMaterials.copper, ams.new LegsMaterialStats(210, 3, 0, 3)); - TinkerRegistry.addMaterialStats(TinkerMaterials.copper, ams.new FeetMaterialStats(210, 1, 0, 3)); + TinkerRegistry.addMaterialStats(TinkerMaterials.copper, new HelmMaterialStats(210, 1, 0, 3)); + TinkerRegistry.addMaterialStats(TinkerMaterials.copper, new ChestMaterialStats(210, 4, 0, 3)); + TinkerRegistry.addMaterialStats(TinkerMaterials.copper, new LegsMaterialStats(210, 3, 0, 3)); + TinkerRegistry.addMaterialStats(TinkerMaterials.copper, new FeetMaterialStats(210, 1, 0, 3)); TinkerRegistry.addMaterialStats(TinkerMaterials.bronze, new ShieldMaterialStats(430, 50)); - TinkerRegistry.addMaterialStats(TinkerMaterials.bronze, ams.new HelmMaterialStats(430, 2, 0, 0.5f)); - TinkerRegistry.addMaterialStats(TinkerMaterials.bronze, ams.new ChestMaterialStats(430, 6, 0, 0.5f)); - TinkerRegistry.addMaterialStats(TinkerMaterials.bronze, ams.new LegsMaterialStats(430, 5, 0, 0.5f)); - TinkerRegistry.addMaterialStats(TinkerMaterials.bronze, ams.new FeetMaterialStats(430, 2, 0, 0.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.bronze, new HelmMaterialStats(430, 2, 0, 0.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.bronze, new ChestMaterialStats(430, 6, 0, 0.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.bronze, new LegsMaterialStats(430, 5, 0, 0.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.bronze, new FeetMaterialStats(430, 2, 0, 0.5f)); TinkerRegistry.addMaterialStats(TinkerMaterials.lead, new ShieldMaterialStats(334, 42)); - TinkerRegistry.addMaterialStats(TinkerMaterials.lead, ams.new HelmMaterialStats(334, 1, 0, -20)); - TinkerRegistry.addMaterialStats(TinkerMaterials.lead, ams.new ChestMaterialStats(334, 5, 0, -20)); - TinkerRegistry.addMaterialStats(TinkerMaterials.lead, ams.new LegsMaterialStats(334, 4, 0, -20)); - TinkerRegistry.addMaterialStats(TinkerMaterials.lead, ams.new FeetMaterialStats(334, 1, 0, -20)); + TinkerRegistry.addMaterialStats(TinkerMaterials.lead, new HelmMaterialStats(334, 1, 0, -20)); + TinkerRegistry.addMaterialStats(TinkerMaterials.lead, new ChestMaterialStats(334, 5, 0, -20)); + TinkerRegistry.addMaterialStats(TinkerMaterials.lead, new LegsMaterialStats(334, 4, 0, -20)); + TinkerRegistry.addMaterialStats(TinkerMaterials.lead, new FeetMaterialStats(334, 1, 0, -20)); TinkerRegistry.addMaterialStats(TinkerMaterials.silver, new ShieldMaterialStats(250, 33)); - TinkerRegistry.addMaterialStats(TinkerMaterials.silver, ams.new HelmMaterialStats(250, 1, 0, 1.5f)); - TinkerRegistry.addMaterialStats(TinkerMaterials.silver, ams.new ChestMaterialStats(250, 3, 0, 1.5f)); - TinkerRegistry.addMaterialStats(TinkerMaterials.silver, ams.new LegsMaterialStats(250, 2, 0, 1.5f)); - TinkerRegistry.addMaterialStats(TinkerMaterials.silver, ams.new FeetMaterialStats(250, 1, 0, 1.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.silver, new HelmMaterialStats(250, 1, 0, 1.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.silver, new ChestMaterialStats(250, 3, 0, 1.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.silver, new LegsMaterialStats(250, 2, 0, 1.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.silver, new FeetMaterialStats(250, 1, 0, 1.5f)); TinkerRegistry.addMaterialStats(TinkerMaterials.electrum, new ShieldMaterialStats(50, 22)); - TinkerRegistry.addMaterialStats(TinkerMaterials.electrum, ams.new HelmMaterialStats(50, 1, 0, 2.5f)); - TinkerRegistry.addMaterialStats(TinkerMaterials.electrum, ams.new ChestMaterialStats(50, 3, 0, 2.5f)); - TinkerRegistry.addMaterialStats(TinkerMaterials.electrum, ams.new LegsMaterialStats(50, 2, 0, 2.5f)); - TinkerRegistry.addMaterialStats(TinkerMaterials.electrum, ams.new FeetMaterialStats(50, 1, 0, 2.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.electrum, new HelmMaterialStats(50, 1, 0, 2.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.electrum, new ChestMaterialStats(50, 3, 0, 2.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.electrum, new LegsMaterialStats(50, 2, 0, 2.5f)); + TinkerRegistry.addMaterialStats(TinkerMaterials.electrum, new FeetMaterialStats(50, 1, 0, 2.5f)); TinkerRegistry.addMaterialStats(TinkerMaterials.steel, new ShieldMaterialStats(540, 55)); - TinkerRegistry.addMaterialStats(TinkerMaterials.steel, ams.new HelmMaterialStats(540, 3, 1, -12)); - TinkerRegistry.addMaterialStats(TinkerMaterials.steel, ams.new ChestMaterialStats(540, 7, 1, -12)); - TinkerRegistry.addMaterialStats(TinkerMaterials.steel, ams.new LegsMaterialStats(540, 6, 1, -12)); - TinkerRegistry.addMaterialStats(TinkerMaterials.steel, ams.new FeetMaterialStats(540, 3, 1, -12)); + TinkerRegistry.addMaterialStats(TinkerMaterials.steel, new HelmMaterialStats(540, 3, 1, -12)); + TinkerRegistry.addMaterialStats(TinkerMaterials.steel, new ChestMaterialStats(540, 7, 1, -12)); + TinkerRegistry.addMaterialStats(TinkerMaterials.steel, new LegsMaterialStats(540, 6, 1, -12)); + TinkerRegistry.addMaterialStats(TinkerMaterials.steel, new FeetMaterialStats(540, 3, 1, -12)); - for (String s : fluids.keySet()) { + for (String s : fluids.keySet()) + { createFluid(s, fluids.get(s)); FluidRegistry.registerFluid(fluids.get(s)); FluidRegistry.addBucketForFluid(fluids.get(s)); } - for (TDMatHelper m : materials_master) { - Material test = TinkerRegistry.getMaterial(m.name); - if (m.createMat && test.getIdentifier() == "unknown" - && !TinkersDefense.config.materials.isBlacklisted(m.name)) - createMaterial(m); - } + // TAIGA TEST - // Collection<Material> mats = TinkerRegistry.getAllMaterials(); - for (Material m : TinkerRegistry.getAllMaterials()) { - if (!m.hasStats(SHIELD)) { - if (m.hasStats(MaterialTypes.HEAD)) { + Collection<Material> mats = TinkerRegistry.getAllMaterials(); + for (Material m : TinkerRegistry.getAllMaterials()) + { + if (!m.hasStats(SHIELD)) + { + if (m.hasStats(MaterialTypes.HEAD)) + { int dur = ((HeadMaterialStats) m.getStats(MaterialTypes.HEAD)).durability; m.addStats(new ShieldMaterialStats(dur, 33)); + m.addStats(new HelmMaterialStats(dur, 1, 0, 0)); + m.addStats(new ChestMaterialStats(dur, 1, 0, 0)); + m.addStats(new LegsMaterialStats(dur, 1, 0, 0)); + m.addStats(new FeetMaterialStats(dur, 1, 0, 0)); + // m.addStats(new ClothMaterialStats(dur, 1, 0, 0)); } } } + // Collection<Material> mats = TinkerRegistry.getAllMaterials(); + // mats.isEmpty(); + // + // Set<IToolPart> parts = TinkerRegistry.getToolParts(); + // parts.size(); } - void createMaterial(TDMatHelper tdmat) { + void createMaterial(TDMatHelper tdmat) + { Material mat = new Material(tdmat.name, tdmat.color); - if (tdmat.isGem) { - if (tdmat.gem == null) { - mat.addItem("gem" + tdmat.name.substring(0, 1).toUpperCase() + tdmat.name.substring(1)); - mat.addItem(gem.getItembyName(tdmat.name), 1, Material.VALUE_Ingot); + if (tdmat.isGem) + { + if (tdmat.gem == null) + { + if (tdmat.createParts) + { + mat.addItem("gem" + tdmat.name.substring(0, 1).toUpperCase() + tdmat.name.substring(1)); + mat.addItem(gem.getItembyName(tdmat.name), 1, Material.VALUE_Ingot); + } } else mat.addItem(tdmat.gem, 1, Material.VALUE_Ingot); - } else { - if (tdmat.ingot == null) { - mat.addItem("ingot" + tdmat.name.substring(0, 1).toUpperCase() + tdmat.name.substring(1)); - mat.addItem(ingot.getItembyName(tdmat.name), 1, Material.VALUE_Ingot); + } else + { + if (tdmat.ingot == null) + { + if (tdmat.createParts) + { + mat.addItem("ingot" + tdmat.name.substring(0, 1).toUpperCase() + tdmat.name.substring(1)); + mat.addItem(ingot.getItembyName(tdmat.name), 1, Material.VALUE_Ingot); + } } else mat.addItem(tdmat.ingot, 1, Material.VALUE_Ingot); } - if (tdmat.nugget == null) { - mat.addItem("nugget" + tdmat.name.substring(0, 1).toUpperCase() + tdmat.name.substring(1)); - mat.addItem(nugget.getItembyName(tdmat.name), 1, Material.VALUE_Nugget); + if (tdmat.nugget == null) + { + if (tdmat.createParts) + { + mat.addItem("nugget" + tdmat.name.substring(0, 1).toUpperCase() + tdmat.name.substring(1)); + mat.addItem(nugget.getItembyName(tdmat.name), 1, Material.VALUE_Nugget); + } } else mat.addItem(tdmat.nugget, 1, Material.VALUE_Nugget); - if (tdmat.dust == null) { - mat.addItem("dust" + tdmat.name.substring(0, 1).toUpperCase() + tdmat.name.substring(1)); - mat.addItem(nugget.getItembyName(tdmat.name), 1, Material.VALUE_Ingot); + if (tdmat.dust == null) + { + if (tdmat.createParts) + { + mat.addItem("dust" + tdmat.name.substring(0, 1).toUpperCase() + tdmat.name.substring(1)); + mat.addItem(nugget.getItembyName(tdmat.name), 1, Material.VALUE_Ingot); + } } else mat.addItem(tdmat.nugget, 1, Material.VALUE_Ingot); - if (tdmat.grain == null) { - mat.addItem("grain" + tdmat.name.substring(0, 1).toUpperCase() + tdmat.name.substring(1)); - mat.addItem(nugget.getItembyName(tdmat.name), 1, Material.VALUE_Ingot / 4); + if (tdmat.grain == null) + { + if (tdmat.createParts) + { + mat.addItem("grain" + tdmat.name.substring(0, 1).toUpperCase() + tdmat.name.substring(1)); + mat.addItem(nugget.getItembyName(tdmat.name), 1, Material.VALUE_Ingot / 4); + } } else mat.addItem(tdmat.grain, 1, Material.VALUE_Nugget / 4); @@ -681,21 +706,16 @@ public class TDMaterials { TinkerRegistry.integrate(new MaterialIntegration(mat).toolforge()).preInit(); } - void setStats(Material m, TDMatHelper tdm) { + void setStats(Material m, TDMatHelper tdm) + { if (tdm.head != null) TinkerRegistry.addMaterialStats(m, tdm.head); - else - TinkerRegistry.addMaterialStats(m, new HeadMaterialStats(0, 0, 0, 0)); if (tdm.handle != null) TinkerRegistry.addMaterialStats(m, tdm.handle); - else - TinkerRegistry.addMaterialStats(m, new HandleMaterialStats(0, 0)); if (tdm.extra != null) TinkerRegistry.addMaterialStats(m, tdm.extra); - else - TinkerRegistry.addMaterialStats(m, new ExtraMaterialStats(0)); if (tdm.bow != null) TinkerRegistry.addMaterialStats(m, tdm.bow); @@ -720,40 +740,60 @@ public class TDMaterials { if (tdm.boots != null) TinkerRegistry.addMaterialStats(m, tdm.boots); + + if (tdm.cloth != null) + TinkerRegistry.addMaterialStats(m, tdm.cloth); } - public void registerItems(final RegistryEvent.Register<Item> event) { + public void registerItems(final RegistryEvent.Register<Item> event) + { final IForgeRegistry registry = event.getRegistry(); + nugget = new TDOreDictItem("nugget", getMatNames(materials_master), getMatColors(materials_master)); + dust = new TDOreDictItem("dust", getMatNames(materials_master), getMatColors(materials_master)); + grain = new TDOreDictItem("grain", getMatNames(materials_master), getMatColors(materials_master)); + + List<TDMatHelper> gemMaster = new ArrayList<TDMatHelper>(); + List<TDMatHelper> ingotMaster = new ArrayList<TDMatHelper>(); + + for (TDMatHelper i : materials_master) + { + if (i.isGem) + gemMaster.add(i); + else + ingotMaster.add(i); + } + + gem = new TDOreDictItem("gem", getMatNames(gemMaster), getMatColors(gemMaster)); + ingot = new TDOreDictItem("ingot", getMatNames(ingotMaster), getMatColors(ingotMaster)); registry.register(ingot); registry.register(dust); registry.register(nugget); registry.register(grain); registry.register(gem); + + for (TDMatHelper m : materials_master) + { + Material test = TinkerRegistry.getMaterial(m.name); + if (m.createMat && test.getIdentifier() == "unknown" && !TinkersDefense.config.materials.isBlacklisted(m.name)) + createMaterial(m); + } } @Subscribe - public void init(FMLInitializationEvent event) { + public void init(FMLInitializationEvent event) + { + for (int i = 0; i < ingot.mats.size(); i++) - OreDictionary.registerOre( - "ingot" + ingot.mats.get(i).substring(0, 1).toUpperCase() + ingot.mats.get(i).substring(1), - new ItemStack(ingot, 1, i)); + OreDictionary.registerOre("ingot" + ingot.mats.get(i).substring(0, 1).toUpperCase() + ingot.mats.get(i).substring(1), new ItemStack(ingot, 1, i)); for (int i = 0; i < nugget.mats.size(); i++) - OreDictionary.registerOre( - "nugget" + nugget.mats.get(i).substring(0, 1).toUpperCase() + nugget.mats.get(i).substring(1), - new ItemStack(nugget, 1, i)); + OreDictionary.registerOre("nugget" + nugget.mats.get(i).substring(0, 1).toUpperCase() + nugget.mats.get(i).substring(1), new ItemStack(nugget, 1, i)); for (int i = 0; i < dust.mats.size(); i++) - OreDictionary.registerOre( - "dust" + dust.mats.get(i).substring(0, 1).toUpperCase() + dust.mats.get(i).substring(1), - new ItemStack(dust, 1, i)); + OreDictionary.registerOre("dust" + dust.mats.get(i).substring(0, 1).toUpperCase() + dust.mats.get(i).substring(1), new ItemStack(dust, 1, i)); for (int i = 0; i < grain.mats.size(); i++) - OreDictionary.registerOre( - "grain" + grain.mats.get(i).substring(0, 1).toUpperCase() + grain.mats.get(i).substring(1), - new ItemStack(grain, 1, i)); + OreDictionary.registerOre("grain" + grain.mats.get(i).substring(0, 1).toUpperCase() + grain.mats.get(i).substring(1), new ItemStack(grain, 1, i)); for (int i = 0; i < gem.mats.size(); i++) - OreDictionary.registerOre( - "gem" + gem.mats.get(i).substring(0, 1).toUpperCase() + gem.mats.get(i).substring(1), - new ItemStack(gem, 1, i)); + OreDictionary.registerOre("gem" + gem.mats.get(i).substring(0, 1).toUpperCase() + gem.mats.get(i).substring(1), new ItemStack(gem, 1, i)); TinkerRegistry.registerMelting(Items.CHORUS_FRUIT, fluids.get("chorusjuice"), Material.VALUE_Nugget); TinkerRegistry.registerMelting(Items.DRAGON_BREATH, fluids.get("dragonsbreath"), Material.VALUE_Ingot); @@ -765,112 +805,109 @@ public class TDMaterials { TinkerRegistry.registerMelting(Blocks.QUARTZ_BLOCK, fluids.get("quartz"), Material.VALUE_Ingot * 4); TinkerRegistry.registerMelting(Items.QUARTZ, fluids.get("quartz"), Material.VALUE_Ingot); - TinkerRegistry.registerTableCasting(new ItemStack(Items.QUARTZ, 1, 0), ItemStack.EMPTY, - (Fluid) fluids.get("quartz"), Material.VALUE_Ingot); - - TinkerRegistry.registerBasinCasting(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 0), ItemStack.EMPTY, - (Fluid) fluids.get("quartz"), Material.VALUE_Ingot * 4); - TinkerRegistry.registerBasinCasting(new ItemStack(Blocks.ICE, 1, 0), ItemStack.EMPTY, - (Fluid) fluids.get("slush"), Material.VALUE_Ingot); - - TinkerRegistry.registerAlloy(new FluidStack(fluids.get("aeonsteel"), 4), - new FluidStack(fluids.get("chorusjuice"), 1), new FluidStack(TinkerFluids.cobalt, 3)); - TinkerRegistry.registerAlloy(new FluidStack(fluids.get("queensgold"), 2), new FluidStack(TinkerFluids.gold, 1), - new FluidStack(TinkerFluids.knightslime, 1)); - TinkerRegistry.registerAlloy(new FluidStack(fluids.get("dogbearium"), 4), - new FluidStack(TinkerFluids.ardite, 1), new FluidStack(fluids.get("dragonsbreath"), 3)); - TinkerRegistry.registerAlloy(new FluidStack(fluids.get("sinisterium"), 6), - new FluidStack(TinkerFluids.blood, 1), new FluidStack(fluids.get("vile"), 2), - new FluidStack(TinkerFluids.iron, 4)); - TinkerRegistry.registerAlloy(new FluidStack(fluids.get("nihilite"), 3), new FluidStack(TinkerFluids.cobalt, 1), - new FluidStack(fluids.get("vile"), 2)); + TinkerRegistry.registerTableCasting(new ItemStack(Items.QUARTZ, 1, 0), ItemStack.EMPTY, (Fluid) fluids.get("quartz"), Material.VALUE_Ingot); + + TinkerRegistry.registerBasinCasting(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 0), ItemStack.EMPTY, (Fluid) fluids.get("quartz"), Material.VALUE_Ingot * 4); + TinkerRegistry.registerBasinCasting(new ItemStack(Blocks.ICE, 1, 0), ItemStack.EMPTY, (Fluid) fluids.get("slush"), Material.VALUE_Ingot); + + TinkerRegistry.registerAlloy(new FluidStack(fluids.get("aeonsteel"), 4), new FluidStack(fluids.get("chorusjuice"), 1), new FluidStack(TinkerFluids.cobalt, 3)); + TinkerRegistry.registerAlloy(new FluidStack(fluids.get("queensgold"), 2), new FluidStack(TinkerFluids.gold, 1), new FluidStack(TinkerFluids.knightslime, 1)); + TinkerRegistry.registerAlloy(new FluidStack(fluids.get("dogbearium"), 4), new FluidStack(TinkerFluids.ardite, 1), new FluidStack(fluids.get("dragonsbreath"), 3)); + TinkerRegistry.registerAlloy(new FluidStack(fluids.get("sinisterium"), 6), new FluidStack(TinkerFluids.blood, 1), new FluidStack(fluids.get("vile"), 2), new FluidStack(TinkerFluids.iron, 4)); + TinkerRegistry.registerAlloy(new FluidStack(fluids.get("nihilite"), 3), new FluidStack(TinkerFluids.cobalt, 1), new FluidStack(fluids.get("vile"), 2)); TinkerRegistry.registerAlloy(new FluidStack(fluids.get("orichalcum"), 6), - new FluidStack(TinkerFluids.bronze, 4), new FluidStack(fluids.get("vibrant"), 2), - new FluidStack(TinkerFluids.gold, 1)); - TinkerRegistry.registerAlloy(new FluidStack(fluids.get("pandorium"), 3), new FluidStack(TinkerFluids.ardite, 1), - new FluidStack(fluids.get("vibrant"), 2)); - TinkerRegistry.registerAlloy(new FluidStack(fluids.get("rosegold"), 4), new FluidStack(TinkerFluids.gold, 1), - new FluidStack(TinkerFluids.copper, 3)); - TinkerRegistry.registerAlloy(new FluidStack(fluids.get("brass"), 3), new FluidStack(TinkerFluids.copper, 2), - new FluidStack(TinkerFluids.zinc, 2)); + new FluidStack(TinkerFluids.bronze, 4), + new FluidStack(fluids.get("vibrant"), 2), + new FluidStack(TinkerFluids.gold, 1)); + TinkerRegistry.registerAlloy(new FluidStack(fluids.get("pandorium"), 3), new FluidStack(TinkerFluids.ardite, 1), new FluidStack(fluids.get("vibrant"), 2)); + TinkerRegistry.registerAlloy(new FluidStack(fluids.get("rosegold"), 4), new FluidStack(TinkerFluids.gold, 1), new FluidStack(TinkerFluids.copper, 3)); + TinkerRegistry.registerAlloy(new FluidStack(fluids.get("brass"), 3), new FluidStack(TinkerFluids.copper, 2), new FluidStack(TinkerFluids.zinc, 2)); TinkerRegistry.registerAlloy(new FluidStack(fluids.get("valyriansteel"), 4), - new FluidStack(TinkerFluids.steel, 2), new FluidStack(TinkerFluids.obsidian, 2), - new FluidStack(fluids.get("dragonsbreath"), 1)); - TinkerRegistry.registerAlloy(new FluidStack(fluids.get("froststeel"), 4), new FluidStack(TinkerFluids.steel, 2), - new FluidStack(TinkerFluids.cobalt, 2), new FluidStack(fluids.get("slush"), 1)); + new FluidStack(TinkerFluids.steel, 2), + new FluidStack(TinkerFluids.obsidian, 2), + new FluidStack(fluids.get("dragonsbreath"), 1)); + TinkerRegistry.registerAlloy(new FluidStack(fluids.get("froststeel"), 4), + new FluidStack(TinkerFluids.steel, 2), + new FluidStack(TinkerFluids.cobalt, 2), + new FluidStack(fluids.get("slush"), 1)); TinkerRegistry.registerAlloy(new FluidStack(fluids.get("pureardite"), 1), - new FluidStack(TinkerFluids.ardite, 1), new FluidStack(fluids.get("dragonsbreath"), 2), - new FluidStack(TinkerFluids.blood, 2), new FluidStack(fluids.get("purifiedgold"), 2)); + new FluidStack(TinkerFluids.ardite, 1), + new FluidStack(fluids.get("dragonsbreath"), 2), + new FluidStack(TinkerFluids.blood, 2), + new FluidStack(fluids.get("purifiedgold"), 2)); TinkerRegistry.registerAlloy(new FluidStack(fluids.get("purecobalt"), 1), - new FluidStack(TinkerFluids.cobalt, 1), new FluidStack(fluids.get("dragonsbreath"), 2), - new FluidStack(fluids.get("slush"), 2), new FluidStack(fluids.get("purifiedsilver"), 2)); - TinkerRegistry.registerAlloy(new FluidStack(fluids.get("puremanyullyn"), 2), - new FluidStack(fluids.get("pureardite"), 1), new FluidStack(fluids.get("purecobalt"), 1)); + new FluidStack(TinkerFluids.cobalt, 1), + new FluidStack(fluids.get("dragonsbreath"), 2), + new FluidStack(fluids.get("slush"), 2), + new FluidStack(fluids.get("purifiedsilver"), 2)); + TinkerRegistry.registerAlloy(new FluidStack(fluids.get("puremanyullyn"), 2), new FluidStack(fluids.get("pureardite"), 1), new FluidStack(fluids.get("purecobalt"), 1)); TinkerRegistry.registerAlloy(new FluidStack(fluids.get("purifiedgold"), 1), - new FluidStack(TinkerFluids.gold, 1), new FluidStack(fluids.get("quartz"), 8), - new FluidStack(TinkerFluids.glass, 2), new FluidStack(TinkerFluids.purpleSlime, 2)); + new FluidStack(TinkerFluids.gold, 1), + new FluidStack(fluids.get("quartz"), 8), + new FluidStack(TinkerFluids.glass, 2), + new FluidStack(TinkerFluids.purpleSlime, 2)); TinkerRegistry.registerAlloy(new FluidStack(fluids.get("purifiedsilver"), 1), - new FluidStack(TinkerFluids.silver, 1), new FluidStack(fluids.get("quartz"), 8), - new FluidStack(TinkerFluids.glass, 2), new FluidStack(TinkerFluids.purpleSlime, 2)); - TinkerRegistry.registerAlloy(new FluidStack(fluids.get("solarium"), 1), new FluidStack(TinkerFluids.steel, 1), - new FluidStack(fluids.get("sundrop"), 1)); - TinkerRegistry.registerAlloy(new FluidStack(fluids.get("dragonsteel"), 1), - new FluidStack(TinkerFluids.steel, 1), new FluidStack(fluids.get("gallite"), 1)); - TinkerRegistry.registerAlloy(new FluidStack(fluids.get("blacksteel"), 1), new FluidStack(TinkerFluids.steel, 1), - new FluidStack(fluids.get("voidite"), 1)); - TinkerRegistry.registerAlloy(new FluidStack(fluids.get("abyssalium"), 1), - new FluidStack(fluids.get("voidite"), 1), new FluidStack(fluids.get("sundrop"), 1)); - TinkerRegistry.registerAlloy(new FluidStack(fluids.get("depthsilver"), 1), - new FluidStack(TinkerFluids.silver, 1), new FluidStack(fluids.get("abyssalium"), 1)); - TinkerRegistry.registerAlloy(new FluidStack(fluids.get("moonsilver"), 1), - new FluidStack(TinkerFluids.silver, 1), new FluidStack(fluids.get("voidite"), 1)); - TinkerRegistry.registerAlloy(new FluidStack(fluids.get("novagold"), 1), new FluidStack(TinkerFluids.gold, 1), - new FluidStack(fluids.get("sundrop"), 1)); + new FluidStack(TinkerFluids.silver, 1), + new FluidStack(fluids.get("quartz"), 8), + new FluidStack(TinkerFluids.glass, 2), + new FluidStack(TinkerFluids.purpleSlime, 2)); + TinkerRegistry.registerAlloy(new FluidStack(fluids.get("solarium"), 1), new FluidStack(TinkerFluids.steel, 1), new FluidStack(fluids.get("sundrop"), 1)); + TinkerRegistry.registerAlloy(new FluidStack(fluids.get("dragonsteel"), 1), new FluidStack(TinkerFluids.steel, 1), new FluidStack(fluids.get("gallite"), 1)); + TinkerRegistry.registerAlloy(new FluidStack(fluids.get("blacksteel"), 1), new FluidStack(TinkerFluids.steel, 1), new FluidStack(fluids.get("voidite"), 1)); + TinkerRegistry.registerAlloy(new FluidStack(fluids.get("abyssalium"), 1), new FluidStack(fluids.get("voidite"), 1), new FluidStack(fluids.get("sundrop"), 1)); + TinkerRegistry.registerAlloy(new FluidStack(fluids.get("depthsilver"), 1), new FluidStack(TinkerFluids.silver, 1), new FluidStack(fluids.get("abyssalium"), 1)); + TinkerRegistry.registerAlloy(new FluidStack(fluids.get("moonsilver"), 1), new FluidStack(TinkerFluids.silver, 1), new FluidStack(fluids.get("voidite"), 1)); + TinkerRegistry.registerAlloy(new FluidStack(fluids.get("novagold"), 1), new FluidStack(TinkerFluids.gold, 1), new FluidStack(fluids.get("sundrop"), 1)); } @Subscribe - public void postInit(FMLPostInitializationEvent event) { + public void postInit(FMLPostInitializationEvent event) + { } @SideOnly(Side.CLIENT) @SubscribeEvent - public static void registerModels(ModelRegistryEvent event) { - for (int i = 0; i < dust.mats.size(); i++) { - ModelLoader.setCustomModelResourceLocation(dust, i, - new ModelResourceLocation(Reference.MOD_ID + ":dust", "inventory")); + public static void registerModels(ModelRegistryEvent event) + { + for (int i = 0; i < dust.mats.size(); i++) + { + ModelLoader.setCustomModelResourceLocation(dust, i, new ModelResourceLocation(Reference.MOD_ID + ":dust", "inventory")); } - for (int i = 0; i < ingot.mats.size(); i++) { - ModelLoader.setCustomModelResourceLocation(ingot, i, - new ModelResourceLocation(Reference.MOD_ID + ":ingot", "inventory")); + for (int i = 0; i < ingot.mats.size(); i++) + { + ModelLoader.setCustomModelResourceLocation(ingot, i, new ModelResourceLocation(Reference.MOD_ID + ":ingot", "inventory")); } - for (int i = 0; i < gem.mats.size(); i++) { - ModelLoader.setCustomModelResourceLocation(gem, i, - new ModelResourceLocation(Reference.MOD_ID + ":gem", "inventory")); + for (int i = 0; i < gem.mats.size(); i++) + { + ModelLoader.setCustomModelResourceLocation(gem, i, new ModelResourceLocation(Reference.MOD_ID + ":gem", "inventory")); } - for (int i = 0; i < nugget.mats.size(); i++) { - ModelLoader.setCustomModelResourceLocation(nugget, i, - new ModelResourceLocation(Reference.MOD_ID + ":nugget", "inventory")); + for (int i = 0; i < nugget.mats.size(); i++) + { + ModelLoader.setCustomModelResourceLocation(nugget, i, new ModelResourceLocation(Reference.MOD_ID + ":nugget", "inventory")); } - for (int i = 0; i < grain.mats.size(); i++) { - ModelLoader.setCustomModelResourceLocation(grain, i, - new ModelResourceLocation(Reference.MOD_ID + ":grain", "inventory")); + for (int i = 0; i < grain.mats.size(); i++) + { + ModelLoader.setCustomModelResourceLocation(grain, i, new ModelResourceLocation(Reference.MOD_ID + ":grain", "inventory")); } } @SubscribeEvent - public static void registerBlocks(final RegistryEvent.Register<Block> event) { - for (Block i : blockList) { + public static void registerBlocks(final RegistryEvent.Register<Block> event) + { + for (Block i : blockList) + { event.getRegistry().register(i); } } - static void createFluid(String name, FluidMolten fluid) { + static void createFluid(String name, FluidMolten fluid) + { FluidRegistry.registerFluid(fluid); BlockMolten block = new BlockMolten(fluid); @@ -886,23 +923,40 @@ public class TDMaterials { FluidRegistry.addBucketForFluid(fluid); } - private void registerClothMaterials() { - black = new Material("blackCloth", 0x191616); - red = new Material("redCloth", 0x963430); - green = new Material("greeCloth", 0x35461B); - brown = new Material("brownCloth", 0x4F321F); - blue = new Material("blueCloth", 0x2E388D); - purple = new Material("purpleCloth", 0x7E3DB5); - cyan = new Material("cyanCloth", 0x2E6E89); - lightgray = new Material("lightgrayCloth", 0x9AA1A1); - gray = new Material("grayCloth", 0x404040); - pink = new Material("pinkCloth", 0xD08499); - lime = new Material("limeCloth", 0x41AE38); - yellow = new Material("yellowCloth", 0xB1A627); - lightblue = new Material("lightblueCloth", 0x6B8AC9); - magenta = new Material("magentaCloth", 0xB350BC); - orange = new Material("orangeCloth", 0xDB7D3E); - white = new Material("whiteCloth", 0xDDDDDD); + private void registerClothMaterials() + { + black = new Material("blackCloth", 0x191616).setCraftable(true).setCastable(false); + ; + red = new Material("redCloth", 0x963430).setCraftable(true).setCastable(false); + ; + green = new Material("greeCloth", 0x35461B).setCraftable(true).setCastable(false); + ; + brown = new Material("brownCloth", 0x4F321F).setCraftable(true).setCastable(false); + ; + blue = new Material("blueCloth", 0x2E388D).setCraftable(true).setCastable(false); + ; + purple = new Material("purpleCloth", 0x7E3DB5).setCraftable(true).setCastable(false); + ; + cyan = new Material("cyanCloth", 0x2E6E89).setCraftable(true).setCastable(false); + ; + lightgray = new Material("lightgrayCloth", 0x9AA1A1).setCraftable(true).setCastable(false); + ; + gray = new Material("grayCloth", 0x404040).setCraftable(true).setCastable(false); + ; + pink = new Material("pinkCloth", 0xD08499).setCraftable(true).setCastable(false); + ; + lime = new Material("limeCloth", 0x41AE38).setCraftable(true).setCastable(false); + ; + yellow = new Material("yellowCloth", 0xB1A627).setCraftable(true).setCastable(false); + ; + lightblue = new Material("lightblueCloth", 0x6B8AC9).setCraftable(true).setCastable(false); + ; + magenta = new Material("magentaCloth", 0xB350BC).setCraftable(true).setCastable(false); + ; + orange = new Material("orangeCloth", 0xDB7D3E).setCraftable(true).setCastable(false); + ; + white = new Material("whiteCloth", 0xDDDDDD).setCraftable(true).setCastable(false); + ; // Material.UNKNOWN.addStats(new MaterialCloth(100)); black.addItem(new ItemStack(Blocks.WOOL, 1, 15), 1, Material.VALUE_Ingot); @@ -939,22 +993,54 @@ public class TDMaterials { orange.setRepresentativeItem(new ItemStack(Blocks.WOOL, 1, 1)); white.setRepresentativeItem(new ItemStack(Blocks.WOOL, 1, 0)); - // TinkerRegistry.addMaterial(black); - // TinkerRegistry.addMaterial(red); - // TinkerRegistry.addMaterial(green); - // TinkerRegistry.addMaterial(brown); - // TinkerRegistry.addMaterial(blue); - // TinkerRegistry.addMaterial(purple); - // TinkerRegistry.addMaterial(cyan); - // TinkerRegistry.addMaterial(lightgray); - // TinkerRegistry.addMaterial(gray); - // TinkerRegistry.addMaterial(pink); - // TinkerRegistry.addMaterial(lime); - // TinkerRegistry.addMaterial(yellow); - // TinkerRegistry.addMaterial(lightblue); - // TinkerRegistry.addMaterial(magenta); - // TinkerRegistry.addMaterial(orange); - // TinkerRegistry.addMaterial(white); + TinkerRegistry.addMaterialStats(this.white, new FabricMaterialStats(100, 10, 0, 25)); + TinkerRegistry.addMaterialStats(this.black, new FabricMaterialStats(100, 10, 0, 25)); + TinkerRegistry.addMaterialStats(this.blue, new FabricMaterialStats(100, 10, 0, 25)); + TinkerRegistry.addMaterialStats(this.brown, new FabricMaterialStats(100, 10, 0, 25)); + TinkerRegistry.addMaterialStats(this.cyan, new FabricMaterialStats(100, 10, 0, 25)); + TinkerRegistry.addMaterialStats(this.gray, new FabricMaterialStats(100, 10, 0, 25)); + TinkerRegistry.addMaterialStats(this.green, new FabricMaterialStats(100, 10, 0, 25)); + TinkerRegistry.addMaterialStats(this.lightblue, new FabricMaterialStats(100, 10, 0, 25)); + TinkerRegistry.addMaterialStats(this.lightgray, new FabricMaterialStats(100, 10, 0, 25)); + TinkerRegistry.addMaterialStats(this.lime, new FabricMaterialStats(100, 10, 0, 25)); + TinkerRegistry.addMaterialStats(this.magenta, new FabricMaterialStats(100, 10, 0, 25)); + TinkerRegistry.addMaterialStats(this.orange, new FabricMaterialStats(100, 10, 0, 25)); + TinkerRegistry.addMaterialStats(this.pink, new FabricMaterialStats(100, 10, 0, 25)); + TinkerRegistry.addMaterialStats(this.purple, new FabricMaterialStats(100, 10, 0, 25)); + TinkerRegistry.addMaterialStats(this.red, new FabricMaterialStats(100, 10, 0, 25)); + TinkerRegistry.addMaterialStats(this.yellow, new FabricMaterialStats(100, 10, 0, 25)); + + // TinkerRegistry.addMaterialStats(this.white, new + // ExtraMaterialStats(5)); + // TinkerRegistry.addMaterialStats(this.black, new + // ExtraMaterialStats(5)); + // TinkerRegistry.addMaterialStats(this.blue, new + // ExtraMaterialStats(5)); + // TinkerRegistry.addMaterialStats(this.brown, new + // ExtraMaterialStats(5)); + // TinkerRegistry.addMaterialStats(this.cyan, new + // ExtraMaterialStats(5)); + // TinkerRegistry.addMaterialStats(this.gray, new + // ExtraMaterialStats(5)); + // TinkerRegistry.addMaterialStats(this.green, new + // ExtraMaterialStats(5)); + // TinkerRegistry.addMaterialStats(this.lightblue, new + // ExtraMaterialStats(5)); + // TinkerRegistry.addMaterialStats(this.lightgray, new + // ExtraMaterialStats(5)); + // TinkerRegistry.addMaterialStats(this.lime, new + // ExtraMaterialStats(5)); + // TinkerRegistry.addMaterialStats(this.magenta, new + // ExtraMaterialStats(5)); + // TinkerRegistry.addMaterialStats(this.orange, new + // ExtraMaterialStats(5)); + // TinkerRegistry.addMaterialStats(this.pink, new + // ExtraMaterialStats(5)); + // TinkerRegistry.addMaterialStats(this.purple, new + // ExtraMaterialStats(5)); + // TinkerRegistry.addMaterialStats(this.red, new ExtraMaterialStats(5)); + // TinkerRegistry.addMaterialStats(this.yellow, new + // ExtraMaterialStats(5)); materials.put("white", white); materials.put("orange", orange); @@ -1009,14 +1095,18 @@ public class TDMaterials { } // PlusTIC to the rescue - public static void integrate(Map<String, Material> materials, Map<String, MaterialIntegration> materialIntegrations, - Collection<String> excludedMaterials) { - materials.forEach((k, v) -> { - if (!materialIntegrations.containsKey(k) && !excludedMaterials.contains(k)) { + public static void integrate(Map<String, Material> materials, Map<String, MaterialIntegration> materialIntegrations, Collection<String> excludedMaterials) + { + materials.forEach((k, v) -> + { + if (!materialIntegrations.containsKey(k) && !excludedMaterials.contains(k)) + { MaterialIntegration mi; - if (v.getFluid() != null && v.getFluid() != TinkerFluids.emerald) { + if (v.getFluid() != null && v.getFluid() != TinkerFluids.emerald) + { mi = new MaterialIntegration(v, v.getFluid(), StringUtils.capitalize(k)).toolforge(); - } else { + } else + { mi = new MaterialIntegration(v); } mi.integrate(); diff --git a/src/main/java/lance5057/tDefense/core/materials/TDTraits.java b/src/main/java/lance5057/tDefense/core/materials/TDTraits.java index 1ed655c..9ab8007 100644 --- a/src/main/java/lance5057/tDefense/core/materials/TDTraits.java +++ b/src/main/java/lance5057/tDefense/core/materials/TDTraits.java @@ -1,9 +1,9 @@ package lance5057.tDefense.core.materials; -import lance5057.tDefense.core.materials.ArmorMaterialStats.ChestMaterialStats; -import lance5057.tDefense.core.materials.ArmorMaterialStats.FeetMaterialStats; -import lance5057.tDefense.core.materials.ArmorMaterialStats.HelmMaterialStats; -import lance5057.tDefense.core.materials.ArmorMaterialStats.LegsMaterialStats; +import lance5057.tDefense.core.materials.stats.ChestMaterialStats; +import lance5057.tDefense.core.materials.stats.FeetMaterialStats; +import lance5057.tDefense.core.materials.stats.HelmMaterialStats; +import lance5057.tDefense.core.materials.stats.LegsMaterialStats; import lance5057.tDefense.core.materials.traits.armor.TraitDamageSourceAlteration; import lance5057.tDefense.core.materials.traits.armor.TraitPhotosynthetic; import lance5057.tDefense.core.materials.traits.armor.TraitReduceKnockback; diff --git a/src/main/java/lance5057/tDefense/core/materials/ArmorMaterialStats.java b/src/main/java/lance5057/tDefense/core/materials/stats/ArmorMaterialStats.java index 031384f..da48d32 100644 --- a/src/main/java/lance5057/tDefense/core/materials/ArmorMaterialStats.java +++ b/src/main/java/lance5057/tDefense/core/materials/stats/ArmorMaterialStats.java @@ -1,4 +1,4 @@ -package lance5057.tDefense.core.materials; +package lance5057.tDefense.core.materials.stats; import java.util.List; @@ -75,7 +75,7 @@ public class ArmorMaterialStats extends AbstractMaterialStats { @Override public List<String> getLocalizedDesc() { - List<String> info = Lists.newArrayList(); + List<String> info = Lists.newArrayList(); info.add(Util.translate(LOC_DurabilityDesc)); info.add(Util.translate(LOC_ArmorRatingDesc)); @@ -84,49 +84,4 @@ public class ArmorMaterialStats extends AbstractMaterialStats { return info; } - - public class HelmMaterialStats extends ArmorMaterialStats { - public final static String TYPE = "helm"; - - public HelmMaterialStats(int durability, int rating, int toughness, float potency) { - super(durability, rating, toughness,potency, TYPE); - } - - } - - public class ChestMaterialStats extends ArmorMaterialStats { - public final static String TYPE = "chest"; - - public ChestMaterialStats(int durability, int rating, int toughness, float potency) { - super(durability, rating, toughness,potency, TYPE); - } - - } - - public class LegsMaterialStats extends ArmorMaterialStats { - public final static String TYPE = "legs"; - - public LegsMaterialStats(int durability, int rating, int toughness, float potency) { - super(durability, rating, toughness,potency, TYPE); - } - - } - - public class FeetMaterialStats extends ArmorMaterialStats { - public final static String TYPE = "feet"; - - public FeetMaterialStats(int durability, int rating, int toughness, float potency) { - super(durability, rating, toughness,potency, TYPE); - } - - } - - public class ClothMaterialStats extends ArmorMaterialStats { - public final static String TYPE = "cloth"; - - public ClothMaterialStats(int durability, int rating, int toughness, float potency) { - super(durability, rating, toughness,potency, TYPE); - } - - } } diff --git a/src/main/java/lance5057/tDefense/core/materials/BaubleMaterialStats.java b/src/main/java/lance5057/tDefense/core/materials/stats/BaubleMaterialStats.java index aa28dc1..b99022f 100644 --- a/src/main/java/lance5057/tDefense/core/materials/BaubleMaterialStats.java +++ b/src/main/java/lance5057/tDefense/core/materials/stats/BaubleMaterialStats.java @@ -1,4 +1,4 @@ -package lance5057.tDefense.core.materials; +package lance5057.tDefense.core.materials.stats; import java.util.List; diff --git a/src/main/java/lance5057/tDefense/core/materials/stats/ChestMaterialStats.java b/src/main/java/lance5057/tDefense/core/materials/stats/ChestMaterialStats.java new file mode 100644 index 0000000..689f742 --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/materials/stats/ChestMaterialStats.java @@ -0,0 +1,10 @@ +package lance5057.tDefense.core.materials.stats; + +public class ChestMaterialStats extends ArmorMaterialStats { + public final static String TYPE = "chest"; + + public ChestMaterialStats(int durability, int rating, int toughness, float potency) { + super(durability, rating, toughness,potency, TYPE); + } + +}
\ No newline at end of file diff --git a/src/main/java/lance5057/tDefense/core/materials/stats/FabricMaterialStats.java b/src/main/java/lance5057/tDefense/core/materials/stats/FabricMaterialStats.java new file mode 100644 index 0000000..c80c61d --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/materials/stats/FabricMaterialStats.java @@ -0,0 +1,10 @@ +package lance5057.tDefense.core.materials.stats; + +public class FabricMaterialStats extends ArmorMaterialStats { + public final static String TYPE = "fabric"; + + public FabricMaterialStats(int durability, int rating, int toughness, float potency) { + super(durability, rating, toughness,potency, TYPE); + } + +}
\ No newline at end of file diff --git a/src/main/java/lance5057/tDefense/core/materials/stats/FeetMaterialStats.java b/src/main/java/lance5057/tDefense/core/materials/stats/FeetMaterialStats.java new file mode 100644 index 0000000..1afe1dd --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/materials/stats/FeetMaterialStats.java @@ -0,0 +1,10 @@ +package lance5057.tDefense.core.materials.stats; + +public class FeetMaterialStats extends ArmorMaterialStats { + public final static String TYPE = "feet"; + + public FeetMaterialStats(int durability, int rating, int toughness, float potency) { + super(durability, rating, toughness,potency, TYPE); + } + +}
\ No newline at end of file diff --git a/src/main/java/lance5057/tDefense/core/materials/stats/HelmMaterialStats.java b/src/main/java/lance5057/tDefense/core/materials/stats/HelmMaterialStats.java new file mode 100644 index 0000000..2bd8526 --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/materials/stats/HelmMaterialStats.java @@ -0,0 +1,10 @@ +package lance5057.tDefense.core.materials.stats; + +public class HelmMaterialStats extends ArmorMaterialStats { + public final static String TYPE = "helm"; + + public HelmMaterialStats(int durability, int rating, int toughness, float potency) { + super(durability, rating, toughness,potency, TYPE); + } + + }
\ No newline at end of file diff --git a/src/main/java/lance5057/tDefense/core/materials/stats/LegsMaterialStats.java b/src/main/java/lance5057/tDefense/core/materials/stats/LegsMaterialStats.java new file mode 100644 index 0000000..911a610 --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/materials/stats/LegsMaterialStats.java @@ -0,0 +1,10 @@ +package lance5057.tDefense.core.materials.stats; + +public class LegsMaterialStats extends ArmorMaterialStats { + public final static String TYPE = "legs"; + + public LegsMaterialStats(int durability, int rating, int toughness, float potency) { + super(durability, rating, toughness,potency, TYPE); + } + +}
\ No newline at end of file diff --git a/src/main/java/lance5057/tDefense/core/materials/ShieldMaterialStats.java b/src/main/java/lance5057/tDefense/core/materials/stats/ShieldMaterialStats.java index bad520d..664777b 100644 --- a/src/main/java/lance5057/tDefense/core/materials/ShieldMaterialStats.java +++ b/src/main/java/lance5057/tDefense/core/materials/stats/ShieldMaterialStats.java @@ -1,4 +1,4 @@ -package lance5057.tDefense.core.materials; +package lance5057.tDefense.core.materials.stats; import java.util.List; diff --git a/src/main/java/lance5057/tDefense/core/materials/traits/armor/TraitDamageSourceAlteration.java b/src/main/java/lance5057/tDefense/core/materials/traits/armor/TraitDamageSourceAlteration.java index e40fdff..e17b112 100644 --- a/src/main/java/lance5057/tDefense/core/materials/traits/armor/TraitDamageSourceAlteration.java +++ b/src/main/java/lance5057/tDefense/core/materials/traits/armor/TraitDamageSourceAlteration.java @@ -1,6 +1,7 @@ package lance5057.tDefense.core.materials.traits.armor; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import lance5057.tDefense.core.materials.traits.AbstractTDTrait; @@ -10,7 +11,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraftforge.event.entity.living.LivingHurtEvent; -import scala.actors.threadpool.Arrays; import slimeknights.tconstruct.library.traits.AbstractTrait; public class TraitDamageSourceAlteration extends AbstractTDTrait { diff --git a/src/main/java/lance5057/tDefense/core/materials/traits/armor/TraitReduceKnockback.java b/src/main/java/lance5057/tDefense/core/materials/traits/armor/TraitReduceKnockback.java index f20b4fc..d0f08f8 100644 --- a/src/main/java/lance5057/tDefense/core/materials/traits/armor/TraitReduceKnockback.java +++ b/src/main/java/lance5057/tDefense/core/materials/traits/armor/TraitReduceKnockback.java @@ -1,6 +1,7 @@ package lance5057.tDefense.core.materials.traits.armor; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.UUID; @@ -14,7 +15,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import scala.actors.threadpool.Arrays; import slimeknights.tconstruct.library.traits.AbstractTrait; public class TraitReduceKnockback extends AbstractTrait { diff --git a/src/main/java/lance5057/tDefense/core/materials/traits/shields/TraitFirestarter.java b/src/main/java/lance5057/tDefense/core/materials/traits/shields/TraitFirestarter.java index 310b07e..feb59a6 100644 --- a/src/main/java/lance5057/tDefense/core/materials/traits/shields/TraitFirestarter.java +++ b/src/main/java/lance5057/tDefense/core/materials/traits/shields/TraitFirestarter.java @@ -2,7 +2,7 @@ package lance5057.tDefense.core.materials.traits.shields; import java.util.Optional; -import lance5057.tDefense.util.TDToolHelper; +import lance5057.tDefense.core.library.TDToolHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; diff --git a/src/main/java/lance5057/tDefense/core/network/ArmorNetwork.java b/src/main/java/lance5057/tDefense/core/network/ArmorNetwork.java new file mode 100644 index 0000000..8aadb48 --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/network/ArmorNetwork.java @@ -0,0 +1,5 @@ +package lance5057.tDefense.core.network; + +public class ArmorNetwork +{ +} diff --git a/src/main/java/lance5057/tDefense/core/network/ArmorStationSelectionPacket.java b/src/main/java/lance5057/tDefense/core/network/ArmorStationSelectionPacket.java new file mode 100644 index 0000000..e76d1df --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/network/ArmorStationSelectionPacket.java @@ -0,0 +1,90 @@ +package lance5057.tDefense.core.network; + +import io.netty.buffer.ByteBuf; +import lance5057.tDefense.core.gui.ArmorStationContainer; +import lance5057.tDefense.core.gui.ArmorStationGui; +import lance5057.tDefense.core.tools.bases.ArmorCore; +import net.minecraft.client.Minecraft; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.inventory.Container; +import net.minecraft.item.Item; +import net.minecraft.network.NetHandlerPlayServer; +import net.minecraft.world.WorldServer; +import slimeknights.mantle.inventory.BaseContainer; +import slimeknights.mantle.network.AbstractPacketThreadsafe; +import slimeknights.tconstruct.common.TinkerNetwork; + +public class ArmorStationSelectionPacket extends AbstractPacketThreadsafe { + + public ArmorCore armor; + public int activeSlots; + + public ArmorStationSelectionPacket() { + } + + public ArmorStationSelectionPacket(ArmorCore tool, int activeSlots) { + this.armor = tool; + this.activeSlots = activeSlots; + } + + @Override + public void handleClientSafe(NetHandlerPlayClient netHandler) { + Container container = Minecraft.getMinecraft().player.openContainer; + if(container instanceof ArmorStationContainer) { + ((ArmorStationContainer) container).setToolSelection(armor, activeSlots); + if(Minecraft.getMinecraft().currentScreen instanceof ArmorStationGui) { + ((ArmorStationGui) Minecraft.getMinecraft().currentScreen).onToolSelectionPacket(this); + } + } + } + + @Override + public void handleServerSafe(NetHandlerPlayServer netHandler) { + Container container = netHandler.player.openContainer; + if(container instanceof ArmorStationContainer) { + ((ArmorStationContainer) container).setToolSelection(armor, activeSlots); + + // find all people who also have the same gui open and update them too + WorldServer server = netHandler.player.getServerWorld(); + for(EntityPlayer player : server.playerEntities) { + if(player == netHandler.player) { + continue; + } + if(player.openContainer instanceof ArmorStationContainer) { + if(((BaseContainer) container).sameGui((BaseContainer) player.openContainer)) { + ((ArmorStationContainer) player.openContainer).setToolSelection(armor, activeSlots); + // same gui, send him an update + TinkerNetwork.sendTo(this, (EntityPlayerMP) player); + } + } + } + } + } + + @Override + public void fromBytes(ByteBuf buf) { + int id = buf.readShort(); + if(id > -1) { + Item item = Item.getItemById(id); + if(item instanceof ArmorCore) { + armor = (ArmorCore) item; + } + } + + activeSlots = buf.readInt(); + } + + @Override + public void toBytes(ByteBuf buf) { + if(armor == null) { + buf.writeShort(-1); + } + else { + buf.writeShort(Item.getIdFromItem(armor)); + } + + buf.writeInt(activeSlots); + } +}
\ No newline at end of file diff --git a/src/main/java/lance5057/tDefense/core/parts/TDParts.java b/src/main/java/lance5057/tDefense/core/parts/TDParts.java index af0d8f4..c0fff8f 100644 --- a/src/main/java/lance5057/tDefense/core/parts/TDParts.java +++ b/src/main/java/lance5057/tDefense/core/parts/TDParts.java @@ -1,12 +1,19 @@ package lance5057.tDefense.core.parts; import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.tuple.Pair; + +import com.google.common.collect.Lists; import lance5057.tDefense.Reference; import lance5057.tDefense.TinkersDefense; -import lance5057.tDefense.util.ModuleBase; +import lance5057.tDefense.core.library.ArmorPart; +import lance5057.tDefense.core.library.ModuleBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLInitializationEvent; @@ -16,53 +23,62 @@ import net.minecraftforge.registries.IForgeRegistry; import slimeknights.tconstruct.library.TinkerRegistry; import slimeknights.tconstruct.library.materials.Material; import slimeknights.tconstruct.library.tinkering.PartMaterialType; +import slimeknights.tconstruct.library.tools.IToolPart; import slimeknights.tconstruct.library.tools.Pattern; +import slimeknights.tconstruct.library.tools.ToolCore; import slimeknights.tconstruct.library.tools.ToolPart; import slimeknights.tconstruct.tools.TinkerTools; @Mod.EventBusSubscriber(modid = Reference.MOD_ID) -public class TDParts extends ModuleBase { - public static PartMaterialType ShieldMat; - - public static PartMaterialType ArmorplateMat; - public static PartMaterialType ChainmailMat; - public static PartMaterialType RivetMat; - public static PartMaterialType ClaspMat; - public static PartMaterialType ClothMat; - - public static ToolPart armorPlate; - public static ToolPart chainmail; - public static ToolPart cloth; - public static ToolPart rivets; - public static ToolPart clasp; - - public static ToolPart ringShank; - public static ToolPart setting; - public static ToolPart wire; - public static ToolPart filigree; - - public static ToolPart armor_hoodCloth; +public class TDParts extends ModuleBase +{ + private static final List<IToolPart> toolParts = new ArrayList<>(); + static List<Pair<Item, ToolPart>> toolPartPatterns = Lists.newLinkedList(); + static List<Pair<Item, ArmorPart>> armorPartPatterns = Lists.newLinkedList(); + // public static PartMaterialType ShieldMat; + + // public static PartMaterialType ArmorplateMat; + // public static PartMaterialType ChainmailMat; + // public static PartMaterialType RivetMat; + // public static PartMaterialType ClaspMat; + // public static PartMaterialType ClothMat; + + public static ToolPart armorPlate; + public static ArmorPart chainmail; + public static ArmorPart fabric; + public static ToolPart rivets; + public static ToolPart clasp; + + public static ToolPart ringShank; + public static ToolPart setting; + public static ToolPart wire; + public static ToolPart filigree; + + // public static ToolPart armor_hoodCloth; protected static ArrayList<Item> itemList = new ArrayList<Item>(); @Override - public void preInit(FMLPreInitializationEvent e) { + public void preInit(FMLPreInitializationEvent e) + { } @Override - public void init(FMLInitializationEvent e) { + public void init(FMLInitializationEvent e) + { } @Override - public void postInit(FMLPostInitializationEvent e) { + public void postInit(FMLPostInitializationEvent e) + { // TODO Auto-generated method stub - + } - public void registerItems(final RegistryEvent.Register<Item> event) { - + public void registerItems(final RegistryEvent.Register<Item> event) + { final IForgeRegistry registry = event.getRegistry(); armorPlate = regToolPart(Material.VALUE_Ingot * 4, "armor_plate", event); @@ -73,39 +89,130 @@ public class TDParts extends ModuleBase { // TinkerRegistry.registerStencilTableCrafting(Pattern.setTagForPart(new // ItemStack(TinkerTools.pattern), armorPlate)); // - chainmail = regToolPart(Material.VALUE_Ingot * 3, "chainmail", event); - cloth = regToolPart(Material.VALUE_Ingot * 3, "cloth", event); + chainmail = regArmorPart(Material.VALUE_Ingot * 3, "chainmail", event); + + fabric = regArmorPart(Material.VALUE_Ingot * 3, "fabric", event); + rivets = regToolPart(Material.VALUE_Ingot * 1, "rivets", event); clasp = regToolPart(Material.VALUE_Ingot * 1, "clasp", event); - - ringShank = regToolPart(Material.VALUE_Ingot * 2, "ringShank", event); - setting = regToolPart(Material.VALUE_Ingot * 1, "setting", event); - wire = regToolPart(Material.VALUE_Ingot * 1, "wire", event); +// +// ringShank = regToolPart(Material.VALUE_Ingot * 2, "ringShank", event); +// setting = regToolPart(Material.VALUE_Ingot * 1, "setting", event); +// wire = regToolPart(Material.VALUE_Ingot * 1, "wire", event); filigree = regToolPart(Material.VALUE_Ingot * 1, "filigree", event); - - //ShieldMat = new PartMaterialType(TDParts.armorPlate, ShieldMaterialStats.TYPE); -// ArmorplateMat = new PartMaterialType(armorPlate, MaterialArmor.TYPE); -// ChainmailMat = new PartMaterialType(chainmail, MaterialArmor.TYPE); -// RivetMat = new PartMaterialType(rivets, MaterialTypes.EXTRA); -// ClaspMat = new PartMaterialType(clasp, MaterialTypes.EXTRA); -// ClothMat = new PartMaterialType(cloth, MaterialCloth.TYPE); + // ShieldMat = new PartMaterialType(TDParts.armorPlate, + // ShieldMaterialStats.TYPE); + + // ArmorplateMat = new PartMaterialType(armorPlate, MaterialArmor.TYPE); + // ChainmailMat = new PartMaterialType(chainmail, MaterialArmor.TYPE); + // RivetMat = new PartMaterialType(rivets, MaterialTypes.EXTRA); + // ClaspMat = new PartMaterialType(clasp, MaterialTypes.EXTRA); + // ClothMat = new PartMaterialType(cloth, MaterialCloth.TYPE); - //registry.registerAll((Item[]) itemList.toArray()); + // registry.registerAll((Item[]) itemList.toArray()); + + // armor_hoodCloth = regToolPart(Material.VALUE_Ingot * 1, + // "armor_hood_cloth", event); + for(Pair<Item, ToolPart> toolPartPattern : toolPartPatterns) { + registerStencil(toolPartPattern.getLeft(), toolPartPattern.getRight()); + } + + for(Pair<Item, ArmorPart> toolPartPattern : armorPartPatterns) { + registerStencil(toolPartPattern.getLeft(), toolPartPattern.getRight()); + } - armor_hoodCloth = regToolPart(Material.VALUE_Ingot * 1, "armor_hood_cloth", event); +// for (final IToolPart part : toolParts) +// { +// for (final ToolCore tool : TDTools.tools) +// { +// for (final PartMaterialType pmt : tool.getRequiredComponents()) +// { +// if (pmt.getPossibleParts().contains(part)) +// { +// TinkerRegistry.registerStencilTableCrafting(Pattern.setTagForPart(new ItemStack(TinkerTools.pattern), (Item) part)); +// } +// } +// } +// +// for (final ArmorCore armor : TDTools.armors) +// { +// for (final PartMaterialType pmt : armor.getRequiredComponents()) +// { +// if (pmt.getPossibleParts().contains(part)) +// { +// TinkerRegistry.registerStencilTableCrafting(Pattern.setTagForPart(new ItemStack(TinkerTools.pattern), (Item) part)); +// } +// } +// } +// } } - private static ToolPart regToolPart(int castVolume, String name, RegistryEvent.Register<Item> event) { + private static ToolPart regToolPart(int castVolume, String name, RegistryEvent.Register<Item> event) + { ToolPart part = new ToolPart(castVolume); - part.setUnlocalizedName(name).setRegistryName("tinkersdefense:" + name); + part.setUnlocalizedName(name).setRegistryName(new ResourceLocation(Reference.MOD_ID,name)); event.getRegistry().register(part); - TinkerRegistry.registerStencilTableCrafting(Pattern.setTagForPart(new ItemStack(TinkerTools.pattern), part)); + + if(TinkerTools.pattern != null) { + toolPartPatterns.add(Pair.of(TinkerTools.pattern, part)); + } + + TinkerRegistry.registerToolPart(part); TinkersDefense.proxy.registerPartModel(part); + TinkerRegistry.registerStencilTableCrafting(Pattern.setTagForPart(new ItemStack(TinkerTools.pattern), (Item) part)); + // TinkerRegistry.registerTableCasting(output, cast, fluid, amount); + toolParts.add(part); itemList.add(part); + + return part; + } + + private void registerStencil(Item pattern, ToolPart toolPart) { + for(ToolCore toolCore : TinkerRegistry.getTools()) { + for(PartMaterialType partMaterialType : toolCore.getRequiredComponents()) { + if(partMaterialType.getPossibleParts().contains(toolPart)) { + ItemStack stencil = new ItemStack(pattern); + Pattern.setTagForPart(stencil, toolPart); + TinkerRegistry.registerStencilTableCrafting(stencil); + return; + } + } + } + } + + private static ArmorPart regArmorPart(int castVolume, String name, RegistryEvent.Register<Item> event) + { + ArmorPart part = new ArmorPart(castVolume); + part.setUnlocalizedName(name).setRegistryName(new ResourceLocation(Reference.MOD_ID,name)); + event.getRegistry().register(part); + + if(TinkerTools.pattern != null) { + armorPartPatterns.add(Pair.of(TinkerTools.pattern, part)); + } + TinkerRegistry.registerToolPart(part); + TinkersDefense.proxy.registerArmorPartModel(part); + TinkerRegistry.registerStencilTableCrafting(Pattern.setTagForPart(new ItemStack(TinkerTools.pattern), (Item) part)); + + // TinkerRegistry.registerTableCasting(output, cast, fluid, amount); + toolParts.add(part); + itemList.add(part); + return part; } + private void registerStencil(Item pattern, ArmorPart toolPart) { + for(ToolCore toolCore : TinkerRegistry.getTools()) { + for(PartMaterialType partMaterialType : toolCore.getRequiredComponents()) { + if(partMaterialType.getPossibleParts().contains(toolPart)) { + ItemStack stencil = new ItemStack(pattern); + Pattern.setTagForPart(stencil, toolPart); + TinkerRegistry.registerStencilTableCrafting(stencil); + return; + } + } + } + } } diff --git a/src/main/java/lance5057/tDefense/core/tileentities/ArmorStationTile.java b/src/main/java/lance5057/tDefense/core/tileentities/ArmorStationTile.java index e2d3654..901a772 100644 --- a/src/main/java/lance5057/tDefense/core/tileentities/ArmorStationTile.java +++ b/src/main/java/lance5057/tDefense/core/tileentities/ArmorStationTile.java @@ -1,29 +1,83 @@ package lance5057.tDefense.core.tileentities; +import lance5057.tDefense.core.gui.ArmorStationContainer; import lance5057.tDefense.core.gui.ArmorStationGui; +import net.minecraft.block.Block; +import net.minecraft.block.BlockPane; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import slimeknights.tconstruct.tools.common.tileentity.TileToolStation; -public class ArmorStationTile extends TileToolStation { +import slimeknights.mantle.common.IInventoryGui; +import slimeknights.tconstruct.library.client.ToolBuildGuiInfo; +import slimeknights.tconstruct.shared.block.BlockTable; +import slimeknights.tconstruct.shared.block.PropertyTableItem; +import slimeknights.tconstruct.shared.inventory.ConfigurableInvWrapperCapability; +import slimeknights.tconstruct.shared.tileentity.TileTable; +import slimeknights.tconstruct.tools.common.client.GuiButtonRepair; +import slimeknights.tconstruct.tools.common.client.GuiToolStation; +import slimeknights.tconstruct.tools.common.inventory.ContainerToolStation; - public ArmorStationTile() { - inventoryTitle = "armorstation.name"; - } +public class ArmorStationTile extends TileTable implements IInventoryGui { - @Override - @SideOnly(Side.CLIENT) - public GuiContainer createGui(InventoryPlayer inventoryPlayer, World world, BlockPos pos) { - return new ArmorStationGui(inventoryPlayer, world, pos, this); - } + public ArmorStationTile() { + super("gui.toolstation.name", 6); + this.itemHandler = new ConfigurableInvWrapperCapability(this, false, false); + } + + @Override + public Container createContainer(InventoryPlayer inventoryplayer, World world, BlockPos pos) { + return new ArmorStationContainer(inventoryplayer, this); + } + + @Override + @SideOnly(Side.CLIENT) + public GuiContainer createGui(InventoryPlayer inventoryplayer, World world, BlockPos pos) { + return new ArmorStationGui(inventoryplayer, world, pos, this); + } + + @Override + protected IExtendedBlockState setInventoryDisplay(IExtendedBlockState state) { + PropertyTableItem.TableItems toDisplay = new PropertyTableItem.TableItems(); - @Override - public Container createContainer(InventoryPlayer inventoryPlayer, World world, BlockPos pos) { - return new ArmorStationContainer(inventoryPlayer, this, false); + ToolBuildGuiInfo info = GuiButtonRepair.info; + /* Disabled for now + // todo: evaluate this again + if(Minecraft.getMinecraft().currentScreen instanceof GuiToolStation) { + info = ((GuiToolStation) Minecraft.getMinecraft().currentScreen).currentInfo; + }*/ + float s = 0.46875f; + + for(int i = 0; i < info.positions.size(); i++) { + ItemStack stackInSlot = getStackInSlot(i); + PropertyTableItem.TableItem item = getTableItem(stackInSlot, this.getWorld(), null); + if(item != null) { + item.x = (33 - info.positions.get(i).getX()) / 61f; + item.z = (42 - info.positions.get(i).getY()) / 61f; + item.s *= s; + + if(i == 0 || info != GuiButtonRepair.info) { + item.s *= 1.3f; + } + + // correct itemblock because scaling + if(stackInSlot.getItem() instanceof ItemBlock && !(Block.getBlockFromItem(stackInSlot.getItem()) instanceof BlockPane)) { + item.y = -(1f - item.s) / 2f; + } + + //item.s *= 2/5f; + toDisplay.items.add(item); + } } + + // add inventory if needed + return state.withProperty(BlockTable.INVENTORY, toDisplay); + } }
\ No newline at end of file diff --git a/src/main/java/lance5057/tDefense/core/tools/TDTools.java b/src/main/java/lance5057/tDefense/core/tools/TDTools.java index bfa650c..b93e92b 100644 --- a/src/main/java/lance5057/tDefense/core/tools/TDTools.java +++ b/src/main/java/lance5057/tDefense/core/tools/TDTools.java @@ -1,11 +1,17 @@ package lance5057.tDefense.core.tools; import java.util.ArrayList; +import java.util.List; import com.google.common.eventbus.Subscribe; import lance5057.tDefense.Reference; import lance5057.tDefense.TinkersDefense; +import lance5057.tDefense.core.blocks.ArmorStationBlock; +import lance5057.tDefense.core.library.CustomArmorTextureCreator; +import lance5057.tDefense.core.library.TDRegistry; +import lance5057.tDefense.core.network.ArmorStationSelectionPacket; +import lance5057.tDefense.core.tileentities.ArmorStationTile; import lance5057.tDefense.core.tools.armor.cloth.TinkersHood; import lance5057.tDefense.core.tools.armor.cloth.TinkersRobe; import lance5057.tDefense.core.tools.armor.cloth.TinkersShawl; @@ -21,11 +27,10 @@ import lance5057.tDefense.core.tools.basic.RoundShield; import lance5057.tDefense.core.tools.basic.Shears; import lance5057.tDefense.core.tools.basic.TowerShield; import lance5057.tDefense.core.tools.basic.Zweihander; -import lance5057.tDefense.core.tools.baubles.Amulet; -import lance5057.tDefense.core.tools.baubles.Ring; import lance5057.tDefense.core.tools.baubles.Sheathe; -import lance5057.tDefense.util.TDRegistry; +import net.minecraft.block.Block; import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; @@ -33,45 +38,54 @@ import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.registries.IForgeRegistry; +import slimeknights.tconstruct.common.TinkerNetwork; import slimeknights.tconstruct.library.TinkerRegistry; import slimeknights.tconstruct.library.client.CustomTextureCreator; import slimeknights.tconstruct.library.tools.ToolCore; @Mod.EventBusSubscriber(modid = Reference.MOD_ID) -//@Pulse(id = TDTools.PulseId, description = "All the tools and everything related to it.") -public class TDTools { - +// @Pulse(id = TDTools.PulseId, description = "All the tools and everything +// related to it.") +public class TDTools +{ + public static final List<ToolCore> tools = new ArrayList<>(); + public static final List<ArmorCore> armors = new ArrayList<>(); TDToolEvents events = new TDToolEvents(); - // Tools - public static ToolCore roundshield; - public static ToolCore heatershield; - public static ToolCore towershield; - public static ToolCore zweihander; - public static ToolCore shears; - public static ToolCore fishingRod; - - public static ArmorCore hood; - public static ArmorCore shawl; - public static ArmorCore robe; - public static ArmorCore shoes; - - public static ArmorCore coif; - public static ArmorCore hauberk; - public static ArmorCore chausses; - //public static ToolCore boots; - - public static ArmorCore helm; - public static ArmorCore breastplate; - public static ArmorCore grieves; - public static ArmorCore sabatons; - - //baubles - public static ToolCore sheathe; - public static ToolCore ring; - public static ToolCore amulet; + public static ArmorStationBlock station; + public static Item stationItem; + + // Tools + public static ToolCore roundshield; + public static ToolCore heatershield; + public static ToolCore towershield; + public static ToolCore zweihander; + public static ToolCore shears; + public static ToolCore fishingRod; + + public static ArmorCore hood; + public static ArmorCore shawl; + public static ArmorCore robe; + public static ArmorCore shoes; + + public static ArmorCore coif; + public static ArmorCore hauberk; + public static ArmorCore chausses; + // public static ToolCore boots; + + public static ArmorCore helm; + public static ArmorCore breastplate; + public static ArmorCore grieves; + public static ArmorCore sabatons; + + // baubles + public static ToolCore sheathe; +// public static ToolCore ring; +// public static ToolCore amulet; + static ArrayList<Item> itemList = new ArrayList<Item>(); // Tool Parts @@ -88,42 +102,46 @@ public class TDTools { // PRE-INITIALIZATION @Subscribe - public void preInit(FMLPreInitializationEvent event) { + public void preInit(FMLPreInitializationEvent event) + { } - private void regTools() { + private void regTools() + { } - + public void registerItems(final RegistryEvent.Register<Item> event) { + stationItem = new ItemBlock(station).setUnlocalizedName("stationitem").setRegistryName("stationitem"); + roundshield = new RoundShield(); heatershield = new HeaterShield(); towershield = new TowerShield(); zweihander = new Zweihander(); shears = new Shears(); fishingRod = new FishingRod(); - + hood = new TinkersHood(); shawl = new TinkersShawl(); robe = new TinkersRobe(); shoes = new TinkersShoes(); - -// coif = new TinkersCoif(); -// hauberk = new TinkersHauberk(); -// chausses = new TinkersChausses(); - //boots = new TinkersBoots(); - + + // coif = new TinkersCoif(); + // hauberk = new TinkersHauberk(); + // chausses = new TinkersChausses(); + // boots = new TinkersBoots(); + helm = new TinkersHelm(); breastplate = new TinkersBreastplate(); grieves = new TinkersGrieves(); sabatons = new TinkersSabatons(); - + sheathe = new Sheathe(); - ring = new Ring(); - amulet = new Amulet(); - +// ring = new Ring(); +// amulet = new Amulet(); + regTool(roundshield, "roundshield", event); regTool(heatershield, "heatershield", event); regTool(towershield, "towershield", event); @@ -132,72 +150,118 @@ public class TDTools { regTool(fishingRod, "fishingRod", event); regArmor(hood, "hood", event); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/hood/_hood_cloth")); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/hood/_hood_trim")); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/hood/_hood_metal")); + regArmor(shawl, "shawl", event); - regArmor(robe, "robe", event); - regArmor(shoes, "shoes", event); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/shawl/_shawl_cloth")); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/shawl/_shawl_trim")); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/shawl/_shawl_metal")); - //regTool(boots, "boots", event); + regArmor(robe, "robe", event); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/robe/_robe_cloth")); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/robe/_robe_trim")); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/robe/_robe_metal")); + regArmor(shoes, "shoes", event); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/shoes/_shoes_cloth")); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/shoes/_shoes_trim")); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/shoes/_shoes_metal")); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/shoes/_shoes_string")); + + // regTool(boots, "boots", event); + regArmor(helm, "helm", event); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/helm/_helm_chain")); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/helm/_helm_plate")); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/helm/_helm_top")); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/helm/_helm_visor")); + regArmor(breastplate, "breastplate", event); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/breastplate/_breastplate_chain")); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/breastplate/_breastplate_plate")); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/breastplate/_breastplate_smallplate")); + CustomArmorTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/breastplate/_breastplate_trim")); + regArmor(grieves, "grieves", event); regArmor(sabatons, "sabatons", event); - -// CustomTextureCreator.registerTexture(new ResourceLocation("tinkersdefense", "items/battleaxe/_halbard_accessory")); - CustomTextureCreator.registerTexture(new ResourceLocation("tinkersdefense", "armor/helm/_helm_chain")); - CustomTextureCreator.registerTexture(new ResourceLocation("tinkersdefense", "armor/helm/_helm_plate")); - CustomTextureCreator.registerTexture(new ResourceLocation("tinkersdefense", "armor/helm/_helm_top")); - CustomTextureCreator.registerTexture(new ResourceLocation("tinkersdefense", "armor/helm/_helm_visor")); -// - regTool(sheathe, "sheathe", event); - regTool(ring, "ring", event); - regTool(amulet, "amulet", event); + // CustomTextureCreator.registerTexture(new + // ResourceLocation("tinkersdefense", + // "items/battleaxe/_halbard_accessory")); + + // + regTool(sheathe, "sheathe", event); +// regTool(ring, "ring", event); +// regTool(amulet, "amulet", event); + final IForgeRegistry registry = event.getRegistry(); - for (Item i : itemList) { + for (Item i : itemList) + { registry.register(i); } + + registry.register(stationItem); } - private static void regTool(ToolCore tool, String name, RegistryEvent.Register<Item> event) { - tool.setRegistryName(new ResourceLocation("tinkersdefense:" + name)); + public void registerBlocks(final RegistryEvent.Register<Block> event) + { + IForgeRegistry<Block> registry = event.getRegistry(); + + station = new ArmorStationBlock(); + + registry.register(station); + + GameRegistry.registerTileEntity(ArmorStationTile.class, "armorstationtile"); + + } + + private static void regTool(ToolCore tool, String name, RegistryEvent.Register<Item> event) + { + tool.setRegistryName(new ResourceLocation(Reference.MOD_ID,name)); event.getRegistry().register(tool); TinkerRegistry.registerTool(tool); TinkersDefense.proxy.registerToolModel(tool); - //itemList.add(tool); - } + tools.add(tool); + } - private static void regArmor(ArmorCore armor, String name, RegistryEvent.Register<Item> event) { - armor.setRegistryName(new ResourceLocation("tinkersdefense:" + name)); + private static void regArmor(ArmorCore armor, String name, RegistryEvent.Register<Item> event) + { + armor.setRegistryName(new ResourceLocation(Reference.MOD_ID,name)); event.getRegistry().register(armor); TDRegistry.registerTool(armor); TinkersDefense.proxy.registerArmorModel(armor); - //itemList.add(tool); - } - - private void registerModifiers() { + armors.add(armor); + } + + private void registerModifiers() + { } // INITIALIZATION @Subscribe - public void init(FMLInitializationEvent event) { + public void init(FMLInitializationEvent event) + { // register items - - // register blocks + // register blocks - // register entities + // register entities - // proxy.preInit(); + // proxy.preInit(); regToolBuilding(); regRecipies(); // proxy.init(); + + TinkerNetwork.instance.registerPacket(ArmorStationSelectionPacket.class); } - private void regToolBuilding() { + private void regToolBuilding() + { TinkerRegistry.registerToolCrafting(roundshield); TinkerRegistry.registerToolForgeCrafting(heatershield); TinkerRegistry.registerToolForgeCrafting(towershield); @@ -209,28 +273,29 @@ public class TDTools { TDRegistry.registerArmorCrafting(shawl); TDRegistry.registerArmorCrafting(robe); TDRegistry.registerArmorCrafting(shoes); - - //TinkerRegistry.registerToolCrafting(boots); - - TDRegistry.registerArmorForgeCrafting(helm); + + // TinkerRegistry.registerToolCrafting(boots); + + TDRegistry.registerArmorCrafting(helm); TDRegistry.registerArmorForgeCrafting(breastplate); TDRegistry.registerArmorForgeCrafting(grieves); TDRegistry.registerArmorForgeCrafting(sabatons); - + TinkerRegistry.registerToolCrafting(sheathe); - TinkerRegistry.registerToolCrafting(ring); - TinkerRegistry.registerToolCrafting(amulet); +// TinkerRegistry.registerToolCrafting(ring); +// TinkerRegistry.registerToolCrafting(amulet); } - private void regRecipies() { + private void regRecipies() + { } // POST-INITIALIZATION @Subscribe - public void postInit(FMLPostInitializationEvent event) { + public void postInit(FMLPostInitializationEvent event) + { // proxy.postInit(); - MinecraftForge.EVENT_BUS.register(events); diff --git a/src/main/java/lance5057/tDefense/core/tools/armor/cloth/TinkersHood.java b/src/main/java/lance5057/tDefense/core/tools/armor/cloth/TinkersHood.java index 482055b..a5f576a 100644 --- a/src/main/java/lance5057/tDefense/core/tools/armor/cloth/TinkersHood.java +++ b/src/main/java/lance5057/tDefense/core/tools/armor/cloth/TinkersHood.java @@ -1,15 +1,18 @@ package lance5057.tDefense.core.tools.armor.cloth; -import java.util.ArrayList; import java.util.List; -import lance5057.tDefense.core.materials.ArmorMaterialStats.ClothMaterialStats; -import lance5057.tDefense.core.materials.ArmorMaterialStats.HelmMaterialStats; +import lance5057.tDefense.core.library.ArmorNBT; +import lance5057.tDefense.core.library.ArmorTags; +import lance5057.tDefense.core.library.ArmorTextureBuilder; +import lance5057.tDefense.core.materials.stats.ArmorMaterialStats; +import lance5057.tDefense.core.materials.stats.FabricMaterialStats; import lance5057.tDefense.core.parts.TDParts; -import lance5057.tDefense.core.tools.armor.renderers.ArmorRenderer; import lance5057.tDefense.core.tools.armor.renderers.cloth.ModelTinkersHood; import lance5057.tDefense.core.tools.bases.ArmorCore; -import lance5057.tDefense.util.ArmorNBT; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -17,83 +20,131 @@ import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; +import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import slimeknights.tconstruct.library.materials.ExtraMaterialStats; import slimeknights.tconstruct.library.materials.Material; +import slimeknights.tconstruct.library.materials.MaterialTypes; import slimeknights.tconstruct.library.tinkering.PartMaterialType; +import slimeknights.tconstruct.library.utils.TagUtil; -public class TinkersHood extends ArmorCore { +public class TinkersHood extends ArmorCore +{ int induceDamage = 0; - public TinkersHood() { - super(EntityEquipmentSlot.HEAD, new PartMaterialType(TDParts.cloth, ClothMaterialStats.TYPE), - new PartMaterialType(TDParts.cloth, ClothMaterialStats.TYPE), PartMaterialType.extra(TDParts.rivets)); + public TinkersHood() + { + super(EntityEquipmentSlot.HEAD, new PartMaterialType(TDParts.fabric, FabricMaterialStats.TYPE), new PartMaterialType(TDParts.fabric, FabricMaterialStats.TYPE), PartMaterialType + .extra(TDParts.rivets)); setUnlocalizedName("tinkerhood"); } @Override - public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) { + public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) + { super.onUpdate(stack, world, entity, par4, par5); } @SideOnly(Side.CLIENT) @Override - public List<String> getArmorTexture(ItemStack stack) { - List<String> textures = new ArrayList(); - textures.add("textures/armor/hood/_hood_cloth.png"); - textures.add("textures/armor/hood/_hood_trim.png"); - textures.add("textures/armor/hood/_hood_metal.png"); + public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default) + { + return new ModelTinkersHood(itemStack); + } - return textures; + @Override + public NBTTagCompound buildTag(List<Material> materials) + { + ArmorNBT data = buildDefaultTag(materials); + return data.get(); } - @SideOnly(Side.CLIENT) @Override - public ArmorRenderer getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack) { - return new ModelTinkersHood(itemStack); + public EntityEquipmentSlot getArmorSlot(ItemStack stack, EntityEquipmentSlot armorType) + { + return EntityEquipmentSlot.HEAD; } @Override - public NBTTagCompound buildTag(List<Material> materials) { - ArmorNBT data = buildDefaultArmorTag(materials, HelmMaterialStats.TYPE); - return data.get(); + protected ArmorNBT buildDefaultTag(List<Material> materials) + { + ArmorNBT data = new ArmorNBT(); + + if (materials.size() >= 2) + { + ArmorMaterialStats handle = materials.get(0).getStatsOrUnknown(FabricMaterialStats.TYPE); + ArmorMaterialStats head = materials.get(1).getStatsOrUnknown(FabricMaterialStats.TYPE); + // start with head + data.head(head, handle); + + // add in accessoires if present + if (materials.size() >= 3) + { + ExtraMaterialStats binding = materials.get(2).getStatsOrUnknown(MaterialTypes.EXTRA); + data.extra(binding); + } + + // calculate handle impact + // data.head(handle); + } + + // 3 free modifiers + data.modifiers = DEFAULT_MODIFIERS; + + return data; } @Override - public EntityEquipmentSlot getArmorSlot(ItemStack stack, EntityEquipmentSlot armorType) { - return EntityEquipmentSlot.HEAD; + @SideOnly(Side.CLIENT) + public NBTTagCompound setupTexture(List<Material> materials) + { + NBTTagCompound base = new NBTTagCompound(); + + ResourceLocation rc = ArmorTextureBuilder.createArmorTexture("hood", new String[] { "cloth", "trim", "metal" }, materials); + + if (rc != null) + { + base.setString(ArmorTags.TexLoc, rc.toString()); + return base; + } + return null; } @Override - public void getTooltipDetailed(ItemStack stack, List<String> tooltips) { + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) + { // TODO Auto-generated method stub - + return null; } @Override - public void getTooltipComponents(ItemStack stack, List<String> tooltips) { + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) + { // TODO Auto-generated method stub - + return 0; } @Override - public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, - int slot) { + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) + { // TODO Auto-generated method stub - return null; + } @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { + public float damagePotential() + { // TODO Auto-generated method stub return 0; } @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { + public double attackSpeed() + { // TODO Auto-generated method stub - + return 0; } } diff --git a/src/main/java/lance5057/tDefense/core/tools/armor/cloth/TinkersRobe.java b/src/main/java/lance5057/tDefense/core/tools/armor/cloth/TinkersRobe.java index 6703fd6..37e9b6e 100644 --- a/src/main/java/lance5057/tDefense/core/tools/armor/cloth/TinkersRobe.java +++ b/src/main/java/lance5057/tDefense/core/tools/armor/cloth/TinkersRobe.java @@ -3,25 +3,35 @@ package lance5057.tDefense.core.tools.armor.cloth; import java.util.ArrayList; import java.util.List; -import lance5057.tDefense.core.materials.ArmorMaterialStats.ClothMaterialStats; -import lance5057.tDefense.core.materials.ArmorMaterialStats.LegsMaterialStats; +import lance5057.tDefense.core.library.ArmorNBT; +import lance5057.tDefense.core.library.ArmorTags; +import lance5057.tDefense.core.library.ArmorTextureBuilder; +import lance5057.tDefense.core.materials.stats.ArmorMaterialStats; +import lance5057.tDefense.core.materials.stats.FabricMaterialStats; +import lance5057.tDefense.core.materials.stats.LegsMaterialStats; import lance5057.tDefense.core.parts.TDParts; import lance5057.tDefense.core.tools.armor.renderers.ArmorRenderer; import lance5057.tDefense.core.tools.armor.renderers.cloth.ModelTinkersRobe; import lance5057.tDefense.core.tools.bases.ArmorCore; -import lance5057.tDefense.util.ArmorNBT; +import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; import net.minecraft.util.DamageSource; +import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; +import net.minecraftforge.common.ISpecialArmor.ArmorProperties; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import slimeknights.tconstruct.library.materials.ExtraMaterialStats; import slimeknights.tconstruct.library.materials.Material; +import slimeknights.tconstruct.library.materials.MaterialTypes; import slimeknights.tconstruct.library.tinkering.PartMaterialType; +import slimeknights.tconstruct.library.utils.TagUtil; public class TinkersRobe extends ArmorCore { @@ -30,11 +40,13 @@ public class TinkersRobe extends ArmorCore public TinkersRobe() { - super(EntityEquipmentSlot.CHEST,new PartMaterialType(TDParts.cloth, ClothMaterialStats.TYPE), - new PartMaterialType(TDParts.cloth, ClothMaterialStats.TYPE), + super(EntityEquipmentSlot.LEGS,new PartMaterialType(TDParts.fabric, FabricMaterialStats.TYPE), + new PartMaterialType(TDParts.fabric, FabricMaterialStats.TYPE), PartMaterialType.extra(TDParts.clasp)); setUnlocalizedName("tinkerrobe"); } + + @Override public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) @@ -43,27 +55,32 @@ public class TinkersRobe extends ArmorCore } - @SideOnly(Side.CLIENT) @Override - public List<String> getArmorTexture(ItemStack stack) { - List<String> textures = new ArrayList(); - textures.add("textures/armor/robe/_robe_cloth.png"); - textures.add("textures/armor/robe/_robe_trim.png"); - textures.add("textures/armor/robe/_robe_metal.png"); + @SideOnly(Side.CLIENT) + public NBTTagCompound setupTexture(List<Material> materials) + { + NBTTagCompound base = new NBTTagCompound(); - return textures; - } + ResourceLocation rc = ArmorTextureBuilder.createArmorTexture("robe", new String[] { "cloth", "trim", "metal" }, materials); + if (rc != null) + { + base.setString(ArmorTags.TexLoc, rc.toString()); + return base; + } + return null; + } + @SideOnly(Side.CLIENT) @Override - public ArmorRenderer getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack) + public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default) { return new ModelTinkersRobe(itemStack); } @Override public NBTTagCompound buildTag(List<Material> materials) { - ArmorNBT data = buildDefaultArmorTag(materials, LegsMaterialStats.TYPE); + ArmorNBT data = buildDefaultTag(materials); return data.get(); } @@ -71,35 +88,68 @@ public class TinkersRobe extends ArmorCore public EntityEquipmentSlot getArmorSlot(ItemStack stack, EntityEquipmentSlot armorType) { return EntityEquipmentSlot.LEGS; } + + @Override + protected ArmorNBT buildDefaultTag(List<Material> materials) + { + ArmorNBT data = new ArmorNBT(); + + if (materials.size() >= 2) + { + ArmorMaterialStats handle = materials.get(0).getStatsOrUnknown(FabricMaterialStats.TYPE); + ArmorMaterialStats head = materials.get(1).getStatsOrUnknown(FabricMaterialStats.TYPE); + // start with head + data.head(head, handle); + + // add in accessoires if present + if (materials.size() >= 3) + { + ExtraMaterialStats binding = materials.get(2).getStatsOrUnknown(MaterialTypes.EXTRA); + data.extra(binding); + } + + // calculate handle impact + //data.head(handle); + } + + // 3 free modifiers + data.modifiers = DEFAULT_MODIFIERS; + + return data; + } @Override - public void getTooltipDetailed(ItemStack stack, List<String> tooltips) { + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) + { // TODO Auto-generated method stub - + return null; } @Override - public void getTooltipComponents(ItemStack stack, List<String> tooltips) { + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) + { // TODO Auto-generated method stub - + return 0; } @Override - public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, - int slot) { + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) + { // TODO Auto-generated method stub - return null; + } @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { + public float damagePotential() + { // TODO Auto-generated method stub return 0; } @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { + public double attackSpeed() + { // TODO Auto-generated method stub - + return 0; } } diff --git a/src/main/java/lance5057/tDefense/core/tools/armor/cloth/TinkersShawl.java b/src/main/java/lance5057/tDefense/core/tools/armor/cloth/TinkersShawl.java index 825d5e4..eb1e1b6 100644 --- a/src/main/java/lance5057/tDefense/core/tools/armor/cloth/TinkersShawl.java +++ b/src/main/java/lance5057/tDefense/core/tools/armor/cloth/TinkersShawl.java @@ -3,13 +3,16 @@ package lance5057.tDefense.core.tools.armor.cloth; import java.util.ArrayList; import java.util.List; -import lance5057.tDefense.core.materials.ArmorMaterialStats.ChestMaterialStats; -import lance5057.tDefense.core.materials.ArmorMaterialStats.ClothMaterialStats; +import lance5057.tDefense.core.library.ArmorNBT; +import lance5057.tDefense.core.library.ArmorTags; +import lance5057.tDefense.core.library.ArmorTextureBuilder; +import lance5057.tDefense.core.materials.stats.ArmorMaterialStats; +import lance5057.tDefense.core.materials.stats.ChestMaterialStats; +import lance5057.tDefense.core.materials.stats.FabricMaterialStats; import lance5057.tDefense.core.parts.TDParts; import lance5057.tDefense.core.tools.armor.renderers.ArmorRenderer; import lance5057.tDefense.core.tools.armor.renderers.cloth.ModelTinkersShawl; import lance5057.tDefense.core.tools.bases.ArmorCore; -import lance5057.tDefense.util.ArmorNBT; import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -17,12 +20,18 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; import net.minecraft.util.DamageSource; +import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; +import net.minecraftforge.common.ISpecialArmor.ArmorProperties; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import slimeknights.tconstruct.library.materials.ExtraMaterialStats; import slimeknights.tconstruct.library.materials.Material; +import slimeknights.tconstruct.library.materials.MaterialTypes; import slimeknights.tconstruct.library.tinkering.PartMaterialType; +import slimeknights.tconstruct.library.utils.TagUtil; public class TinkersShawl extends ArmorCore { @@ -30,7 +39,7 @@ public class TinkersShawl extends ArmorCore public TinkersShawl() { - super(EntityEquipmentSlot.LEGS,new PartMaterialType(TDParts.cloth, ClothMaterialStats.TYPE), new PartMaterialType(TDParts.cloth, ClothMaterialStats.TYPE), PartMaterialType.extra(TDParts.armorPlate)); + super(EntityEquipmentSlot.CHEST,new PartMaterialType(TDParts.fabric, FabricMaterialStats.TYPE), new PartMaterialType(TDParts.fabric, FabricMaterialStats.TYPE), PartMaterialType.extra(TDParts.armorPlate)); setUnlocalizedName("tinkershawl"); } @@ -41,27 +50,32 @@ public class TinkersShawl extends ArmorCore } - @SideOnly(Side.CLIENT) @Override - public List<String> getArmorTexture(ItemStack stack) { - List<String> textures = new ArrayList(); - textures.add("textures/armor/shawl/_shawl_cloth.png"); - textures.add("textures/armor/shawl/_shawl_trim.png"); - textures.add("textures/armor/shawl/_shawl_metal.png"); + @SideOnly(Side.CLIENT) + public NBTTagCompound setupTexture(List<Material> materials) + { + NBTTagCompound base = new NBTTagCompound(); + + ResourceLocation rc = ArmorTextureBuilder.createArmorTexture("shawl", new String[] { "cloth", "trim", "metal" }, materials); - return textures; + if (rc != null) + { + base.setString(ArmorTags.TexLoc, rc.toString()); + return base; + } + return null; } @SideOnly(Side.CLIENT) @Override - public ArmorRenderer getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack) + public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default) { return new ModelTinkersShawl(itemStack); } @Override public NBTTagCompound buildTag(List<Material> materials) { - ArmorNBT data = buildDefaultArmorTag(materials, ChestMaterialStats.TYPE); + ArmorNBT data = buildDefaultTag(materials); return data.get(); } @@ -71,33 +85,64 @@ public class TinkersShawl extends ArmorCore } @Override - public void getTooltipDetailed(ItemStack stack, List<String> tooltips) { + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, + int slot) { // TODO Auto-generated method stub - + return null; } @Override - public void getTooltipComponents(ItemStack stack, List<String> tooltips) { + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { // TODO Auto-generated method stub - + return 0; } @Override - public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, - int slot) { + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { // TODO Auto-generated method stub - return null; + } @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { + public float damagePotential() + { // TODO Auto-generated method stub return 0; } @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { + public double attackSpeed() + { // TODO Auto-generated method stub - + return 0; + } + + @Override + protected ArmorNBT buildDefaultTag(List<Material> materials) + { + ArmorNBT data = new ArmorNBT(); + + if (materials.size() >= 2) + { + ArmorMaterialStats handle = materials.get(0).getStatsOrUnknown(FabricMaterialStats.TYPE); + ArmorMaterialStats head = materials.get(1).getStatsOrUnknown(FabricMaterialStats.TYPE); + // start with head + data.head(head, handle); + + // add in accessoires if present + if (materials.size() >= 3) + { + ExtraMaterialStats binding = materials.get(2).getStatsOrUnknown(MaterialTypes.EXTRA); + data.extra(binding); + } + + // calculate handle impact + //data.head(handle); + } + + // 3 free modifiers + data.modifiers = DEFAULT_MODIFIERS; + + return data; } } diff --git a/src/main/java/lance5057/tDefense/core/tools/armor/cloth/TinkersShoes.java b/src/main/java/lance5057/tDefense/core/tools/armor/cloth/TinkersShoes.java index c7c8606..0c3c85d 100644 --- a/src/main/java/lance5057/tDefense/core/tools/armor/cloth/TinkersShoes.java +++ b/src/main/java/lance5057/tDefense/core/tools/armor/cloth/TinkersShoes.java @@ -1,15 +1,16 @@ package lance5057.tDefense.core.tools.armor.cloth; -import java.util.ArrayList; import java.util.List; -import lance5057.tDefense.core.materials.ArmorMaterialStats.ClothMaterialStats; -import lance5057.tDefense.core.materials.ArmorMaterialStats.FeetMaterialStats; +import lance5057.tDefense.core.library.ArmorNBT; +import lance5057.tDefense.core.library.ArmorTags; +import lance5057.tDefense.core.library.ArmorTextureBuilder; +import lance5057.tDefense.core.materials.stats.ArmorMaterialStats; +import lance5057.tDefense.core.materials.stats.FabricMaterialStats; import lance5057.tDefense.core.parts.TDParts; import lance5057.tDefense.core.tools.armor.renderers.ArmorRenderer; import lance5057.tDefense.core.tools.armor.renderers.cloth.ModelTinkersShoes; import lance5057.tDefense.core.tools.bases.ArmorCore; -import lance5057.tDefense.util.ArmorNBT; import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -17,12 +18,17 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; import net.minecraft.util.DamageSource; +import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import slimeknights.tconstruct.library.materials.ExtraMaterialStats; import slimeknights.tconstruct.library.materials.Material; +import slimeknights.tconstruct.library.materials.MaterialTypes; import slimeknights.tconstruct.library.tinkering.PartMaterialType; +import slimeknights.tconstruct.library.utils.TagUtil; import slimeknights.tconstruct.tools.TinkerTools; public class TinkersShoes extends ArmorCore @@ -32,9 +38,9 @@ public class TinkersShoes extends ArmorCore public TinkersShoes() { - super(EntityEquipmentSlot.FEET,new PartMaterialType(TDParts.cloth, ClothMaterialStats.TYPE), + super(EntityEquipmentSlot.FEET,new PartMaterialType(TDParts.fabric, FabricMaterialStats.TYPE), PartMaterialType.extra(TDParts.rivets), - new PartMaterialType(TDParts.cloth, ClothMaterialStats.TYPE), + new PartMaterialType(TDParts.fabric, FabricMaterialStats.TYPE), PartMaterialType.bowstring(TinkerTools.bowString)); setUnlocalizedName("tinkershoes"); } @@ -46,27 +52,32 @@ public class TinkersShoes extends ArmorCore } - @SideOnly(Side.CLIENT) @Override - public List<String> getArmorTexture(ItemStack stack) { - List<String> textures = new ArrayList(); - textures.add("textures/armor/shoes/_shoes_cloth.png"); - textures.add("textures/armor/shoes/_shoes_trim.png"); - textures.add("textures/armor/shoes/_shoes_metal.png"); + @SideOnly(Side.CLIENT) + public NBTTagCompound setupTexture(List<Material> materials) + { + NBTTagCompound base = new NBTTagCompound(); + + ResourceLocation rc = ArmorTextureBuilder.createArmorTexture("shoes", new String[] { "cloth", "trim", "metal", "string" }, materials); - return textures; + if (rc != null) + { + base.setString(ArmorTags.TexLoc, rc.toString()); + return base; + } + return null; } @SideOnly(Side.CLIENT) @Override - public ArmorRenderer getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack) + public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default) { return new ModelTinkersShoes(itemStack); } @Override public NBTTagCompound buildTag(List<Material> materials) { - ArmorNBT data = buildDefaultArmorTag(materials, FeetMaterialStats.TYPE); + ArmorNBT data = buildDefaultTag(materials); return data.get(); } @@ -76,33 +87,64 @@ public class TinkersShoes extends ArmorCore } @Override - public void getTooltipDetailed(ItemStack stack, List<String> tooltips) { + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, + int slot) { // TODO Auto-generated method stub - + return null; } @Override - public void getTooltipComponents(ItemStack stack, List<String> tooltips) { + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { // TODO Auto-generated method stub - + return 0; } @Override - public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, - int slot) { + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { // TODO Auto-generated method stub - return null; + } @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { + public float damagePotential() + { // TODO Auto-generated method stub return 0; } @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { + public double attackSpeed() + { // TODO Auto-generated method stub - + return 0; + } + + @Override + protected ArmorNBT buildDefaultTag(List<Material> materials) + { + ArmorNBT data = new ArmorNBT(); + + if (materials.size() >= 2) + { + ArmorMaterialStats handle = materials.get(0).getStatsOrUnknown(FabricMaterialStats.TYPE); + ArmorMaterialStats head = materials.get(1).getStatsOrUnknown(FabricMaterialStats.TYPE); + // start with head + data.head(head, handle); + + // add in accessoires if present + if (materials.size() >= 3) + { + ExtraMaterialStats binding = materials.get(2).getStatsOrUnknown(MaterialTypes.EXTRA); + data.extra(binding); + } + + // calculate handle impact + //data.head(handle); + } + + // 3 free modifiers + data.modifiers = DEFAULT_MODIFIERS; + + return data; } } diff --git a/src/main/java/lance5057/tDefense/core/tools/armor/heavy/TinkersBreastplate.java b/src/main/java/lance5057/tDefense/core/tools/armor/heavy/TinkersBreastplate.java index a7df0f0..b64d130 100644 --- a/src/main/java/lance5057/tDefense/core/tools/armor/heavy/TinkersBreastplate.java +++ b/src/main/java/lance5057/tDefense/core/tools/armor/heavy/TinkersBreastplate.java @@ -1,91 +1,132 @@ package lance5057.tDefense.core.tools.armor.heavy; -import java.util.ArrayList; import java.util.List; -import lance5057.tDefense.core.materials.ArmorMaterialStats.ChestMaterialStats; +import lance5057.tDefense.core.library.ArmorNBT; +import lance5057.tDefense.core.materials.stats.ArmorMaterialStats; +import lance5057.tDefense.core.materials.stats.ChestMaterialStats; +import lance5057.tDefense.core.materials.stats.FabricMaterialStats; import lance5057.tDefense.core.parts.TDParts; -import lance5057.tDefense.core.tools.armor.renderers.ArmorRenderer; import lance5057.tDefense.core.tools.armor.renderers.heavy.ModelTinkersBreastplate; import lance5057.tDefense.core.tools.bases.ArmorCore; -import lance5057.tDefense.util.ArmorNBT; import net.minecraft.client.model.ModelBiped; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; import net.minecraft.util.DamageSource; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import slimeknights.tconstruct.library.materials.ExtraMaterialStats; import slimeknights.tconstruct.library.materials.Material; +import slimeknights.tconstruct.library.materials.MaterialTypes; import slimeknights.tconstruct.library.tinkering.PartMaterialType; +import slimeknights.tconstruct.library.utils.TagUtil; import slimeknights.tconstruct.tools.TinkerTools; -public class TinkersBreastplate extends ArmorCore { - public TinkersBreastplate() { - super(EntityEquipmentSlot.CHEST, new PartMaterialType(TinkerTools.largePlate, ChestMaterialStats.TYPE), - new PartMaterialType(TDParts.armorPlate, ChestMaterialStats.TYPE), - PartMaterialType.handle(TDParts.filigree), PartMaterialType.extra(TDParts.chainmail)); +public class TinkersBreastplate extends ArmorCore +{ + public TinkersBreastplate() + { + super(EntityEquipmentSlot.CHEST, new PartMaterialType(TinkerTools.largePlate, ChestMaterialStats.TYPE), new PartMaterialType(TDParts.armorPlate, ChestMaterialStats.TYPE), PartMaterialType + .handle(TDParts.filigree), PartMaterialType.extra(TDParts.chainmail)); setUnlocalizedName("tinkersbreastplate"); } @SideOnly(Side.CLIENT) @Override - public List<String> getArmorTexture(ItemStack stack) { - List<String> textures = new ArrayList(); - textures.add("textures/armor/breastplate/_breastplate_plate.png"); - textures.add("textures/armor/breastplate/_breastplate_smallplate.png"); - textures.add("textures/armor/breastplate/_breastplate_trim.png"); - textures.add("textures/armor/breastplate/_breastplate_chain.png"); - return textures; + public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) + { + String texture; + NBTTagList t = TagUtil.getBaseMaterialsTagList(stack); + texture = "textures/armor/breastplate/_breastplate_plate_" + t.getStringTagAt(0); + return texture; } @SideOnly(Side.CLIENT) @Override - public ArmorRenderer getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack) { + public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default) + { return new ModelTinkersBreastplate(itemStack); } @Override - public NBTTagCompound buildTag(List<Material> materials) { - ArmorNBT data = buildDefaultArmorTag(materials, ChestMaterialStats.TYPE); + public NBTTagCompound buildTag(List<Material> materials) + { + ArmorNBT data = buildDefaultTag(materials); return data.get(); } @Override - public EntityEquipmentSlot getArmorSlot(ItemStack stack, EntityEquipmentSlot armorType) { + public EntityEquipmentSlot getArmorSlot(ItemStack stack, EntityEquipmentSlot armorType) + { return EntityEquipmentSlot.CHEST; } @Override - public void getTooltipDetailed(ItemStack stack, List<String> tooltips) { + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) + { // TODO Auto-generated method stub - + return null; } @Override - public void getTooltipComponents(ItemStack stack, List<String> tooltips) { + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) + { // TODO Auto-generated method stub - + return 0; } @Override - public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, - int slot) { + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) + { // TODO Auto-generated method stub - return null; + } @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { + public float damagePotential() + { // TODO Auto-generated method stub return 0; } @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { + public double attackSpeed() + { // TODO Auto-generated method stub - + return 0; + } + + @Override + protected ArmorNBT buildDefaultTag(List<Material> materials) + { + ArmorNBT data = new ArmorNBT(); + + if (materials.size() >= 2) + { + ArmorMaterialStats handle = materials.get(0).getStatsOrUnknown(FabricMaterialStats.TYPE); + ArmorMaterialStats head = materials.get(1).getStatsOrUnknown(FabricMaterialStats.TYPE); + // start with head + data.head(head); + + // add in accessoires if present + if (materials.size() >= 3) + { + ExtraMaterialStats binding = materials.get(2).getStatsOrUnknown(MaterialTypes.EXTRA); + data.extra(binding); + } + + // calculate handle impact + data.head(handle); + } + + // 3 free modifiers + data.modifiers = DEFAULT_MODIFIERS; + + return data; } } diff --git a/src/main/java/lance5057/tDefense/core/tools/armor/heavy/TinkersGrieves.java b/src/main/java/lance5057/tDefense/core/tools/armor/heavy/TinkersGrieves.java index ccefbf7..88047a1 100644 --- a/src/main/java/lance5057/tDefense/core/tools/armor/heavy/TinkersGrieves.java +++ b/src/main/java/lance5057/tDefense/core/tools/armor/heavy/TinkersGrieves.java @@ -1,26 +1,31 @@ package lance5057.tDefense.core.tools.armor.heavy; -import java.util.ArrayList; import java.util.List; -import lance5057.tDefense.core.materials.ArmorMaterialStats.ClothMaterialStats; -import lance5057.tDefense.core.materials.ArmorMaterialStats.LegsMaterialStats; +import lance5057.tDefense.core.library.ArmorNBT; +import lance5057.tDefense.core.materials.stats.ArmorMaterialStats; +import lance5057.tDefense.core.materials.stats.FabricMaterialStats; +import lance5057.tDefense.core.materials.stats.LegsMaterialStats; import lance5057.tDefense.core.parts.TDParts; import lance5057.tDefense.core.tools.armor.renderers.ArmorRenderer; import lance5057.tDefense.core.tools.armor.renderers.heavy.ModelTinkersGrieves; import lance5057.tDefense.core.tools.bases.ArmorCore; -import lance5057.tDefense.util.ArmorNBT; import net.minecraft.client.model.ModelBiped; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; import net.minecraft.util.DamageSource; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import slimeknights.tconstruct.library.materials.ExtraMaterialStats; import slimeknights.tconstruct.library.materials.Material; +import slimeknights.tconstruct.library.materials.MaterialTypes; import slimeknights.tconstruct.library.tinkering.PartMaterialType; +import slimeknights.tconstruct.library.utils.TagUtil; public class TinkersGrieves extends ArmorCore { @@ -29,32 +34,29 @@ public class TinkersGrieves extends ArmorCore super(EntityEquipmentSlot.LEGS,new PartMaterialType(TDParts.armorPlate, LegsMaterialStats.TYPE), new PartMaterialType(TDParts.chainmail, LegsMaterialStats.TYPE), PartMaterialType.handle(TDParts.filigree), - new PartMaterialType(TDParts.cloth, ClothMaterialStats.TYPE)); + new PartMaterialType(TDParts.fabric, FabricMaterialStats.TYPE)); setUnlocalizedName("tinkersgrieves"); } @SideOnly(Side.CLIENT) @Override - public List<String> getArmorTexture(ItemStack stack) - { - List<String> textures = new ArrayList(); - textures.add("textures/armor/grieves/_grieves_plate.png"); - textures.add("textures/armor/grieves/_grieves_chain.png"); - textures.add("textures/armor/grieves/_grieves_trim.png"); - textures.add("textures/armor/grieves/_grieves_cloth.png"); - return textures; + public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) { + String texture; + NBTTagList t = TagUtil.getBaseMaterialsTagList(stack); + texture = "textures/armor/grieves/_grieves_plate_" + t.getStringTagAt(0); + return texture; } @SideOnly(Side.CLIENT) @Override - public ArmorRenderer getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack) + public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default) { return new ModelTinkersGrieves(itemStack); } @Override public NBTTagCompound buildTag(List<Material> materials) { - ArmorNBT data = buildDefaultArmorTag(materials, LegsMaterialStats.TYPE); + ArmorNBT data = buildDefaultTag(materials); return data.get(); } @@ -64,33 +66,64 @@ public class TinkersGrieves extends ArmorCore } @Override - public void getTooltipDetailed(ItemStack stack, List<String> tooltips) { + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, + int slot) { // TODO Auto-generated method stub - + return null; } @Override - public void getTooltipComponents(ItemStack stack, List<String> tooltips) { + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { // TODO Auto-generated method stub - + return 0; } @Override - public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, - int slot) { + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { // TODO Auto-generated method stub - return null; + } @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { + public float damagePotential() + { // TODO Auto-generated method stub return 0; } @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { + public double attackSpeed() + { // TODO Auto-generated method stub - + return 0; + } + + @Override + protected ArmorNBT buildDefaultTag(List<Material> materials) + { + ArmorNBT data = new ArmorNBT(); + + if (materials.size() >= 2) + { + ArmorMaterialStats handle = materials.get(0).getStatsOrUnknown(FabricMaterialStats.TYPE); + ArmorMaterialStats head = materials.get(1).getStatsOrUnknown(FabricMaterialStats.TYPE); + // start with head + data.head(head); + + // add in accessoires if present + if (materials.size() >= 3) + { + ExtraMaterialStats binding = materials.get(2).getStatsOrUnknown(MaterialTypes.EXTRA); + data.extra(binding); + } + + // calculate handle impact + data.head(handle); + } + + // 3 free modifiers + data.modifiers = DEFAULT_MODIFIERS; + + return data; } } diff --git a/src/main/java/lance5057/tDefense/core/tools/armor/heavy/TinkersHelm.java b/src/main/java/lance5057/tDefense/core/tools/armor/heavy/TinkersHelm.java index 3b1973d..37fc148 100644 --- a/src/main/java/lance5057/tDefense/core/tools/armor/heavy/TinkersHelm.java +++ b/src/main/java/lance5057/tDefense/core/tools/armor/heavy/TinkersHelm.java @@ -3,12 +3,18 @@ package lance5057.tDefense.core.tools.armor.heavy; import java.util.ArrayList; import java.util.List; -import lance5057.tDefense.core.materials.ArmorMaterialStats.HelmMaterialStats; +import lance5057.tDefense.core.library.ArmorNBT; +import lance5057.tDefense.core.library.ArmorTags; +import lance5057.tDefense.core.library.ArmorTextureBuilder; +import lance5057.tDefense.core.materials.stats.ArmorMaterialStats; +import lance5057.tDefense.core.materials.stats.FabricMaterialStats; +import lance5057.tDefense.core.materials.stats.HelmMaterialStats; import lance5057.tDefense.core.parts.TDParts; import lance5057.tDefense.core.tools.armor.renderers.ArmorRenderer; import lance5057.tDefense.core.tools.armor.renderers.heavy.ModelTinkersHelm; import lance5057.tDefense.core.tools.bases.ArmorCore; -import lance5057.tDefense.util.ArmorNBT; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; @@ -16,42 +22,54 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.DamageSource; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import slimeknights.tconstruct.library.materials.ExtraMaterialStats; import slimeknights.tconstruct.library.materials.Material; +import slimeknights.tconstruct.library.materials.MaterialTypes; import slimeknights.tconstruct.library.tinkering.PartMaterialType; import slimeknights.tconstruct.library.utils.TagUtil; +import slimeknights.tconstruct.library.utils.TinkerUtil; import slimeknights.tconstruct.tools.TinkerTools; -public class TinkersHelm extends ArmorCore { +public class TinkersHelm extends ArmorCore { public TinkersHelm() { super(EntityEquipmentSlot.HEAD,new PartMaterialType(TinkerTools.panHead, HelmMaterialStats.TYPE), new PartMaterialType(TDParts.armorPlate, HelmMaterialStats.TYPE), - PartMaterialType.handle(TDParts.filigree), PartMaterialType.extra(TDParts.chainmail)); + PartMaterialType.handle(TDParts.filigree), PartMaterialType.extra(TDParts.rivets)); setUnlocalizedName("tinkershelm"); } + + @SideOnly(Side.CLIENT) @Override - public List<String> getArmorTexture(ItemStack stack) { - List<String> textures = new ArrayList(); - NBTTagList t = TagUtil.getBaseMaterialsTagList(stack); - textures.add("textures/armor/helm/_helm_top_" + t.getStringTagAt(0)); - textures.add("textures/armor/helm/_helm_plate_" + t.getStringTagAt(1)); - textures.add("textures/armor/helm/_helm_visor_" + t.getStringTagAt(2)); - textures.add("textures/armor/helm/_helm_chain_" + t.getStringTagAt(3)); - return textures; + public NBTTagCompound setupTexture(List<Material> materials) + { + NBTTagCompound base = new NBTTagCompound(); + + ResourceLocation rc = ArmorTextureBuilder.createArmorTexture("helm", new String[] { "top", "plate", "visor", "chain" }, materials); + + if (rc != null) + { + base.setString(ArmorTags.TexLoc, rc.toString()); + return base; + } + return null; } + @SideOnly(Side.CLIENT) @Override - public ArmorRenderer getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack) { + public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default) + { return new ModelTinkersHelm(itemStack); } @Override public NBTTagCompound buildTag(List<Material> materials) { - ArmorNBT data = buildDefaultArmorTag(materials, HelmMaterialStats.TYPE); + ArmorNBT data = buildDefaultTag(materials); return data.get(); } @@ -61,33 +79,64 @@ public class TinkersHelm extends ArmorCore { } @Override - public void getTooltipDetailed(ItemStack stack, List<String> tooltips) { + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, + int slot) { // TODO Auto-generated method stub - + return null; } @Override - public void getTooltipComponents(ItemStack stack, List<String> tooltips) { + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { // TODO Auto-generated method stub - + return 0; } @Override - public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, - int slot) { + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { // TODO Auto-generated method stub - return null; + } @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { + public float damagePotential() + { // TODO Auto-generated method stub return 0; } @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { + public double attackSpeed() + { // TODO Auto-generated method stub - + return 0; + } + + @Override + protected ArmorNBT buildDefaultTag(List<Material> materials) + { + ArmorNBT data = new ArmorNBT(); + + if (materials.size() >= 2) + { + ArmorMaterialStats handle = materials.get(0).getStatsOrUnknown(FabricMaterialStats.TYPE); + ArmorMaterialStats head = materials.get(1).getStatsOrUnknown(FabricMaterialStats.TYPE); + // start with head + data.head(head); + + // add in accessoires if present + if (materials.size() >= 3) + { + ExtraMaterialStats binding = materials.get(2).getStatsOrUnknown(MaterialTypes.EXTRA); + data.extra(binding); + } + + // calculate handle impact + data.head(handle); + } + + // 3 free modifiers + data.modifiers = DEFAULT_MODIFIERS; + + return data; } } diff --git a/src/main/java/lance5057/tDefense/core/tools/armor/heavy/TinkersSabatons.java b/src/main/java/lance5057/tDefense/core/tools/armor/heavy/TinkersSabatons.java index 7172492..331dda6 100644 --- a/src/main/java/lance5057/tDefense/core/tools/armor/heavy/TinkersSabatons.java +++ b/src/main/java/lance5057/tDefense/core/tools/armor/heavy/TinkersSabatons.java @@ -1,56 +1,60 @@ package lance5057.tDefense.core.tools.armor.heavy; -import java.util.ArrayList; import java.util.List; -import lance5057.tDefense.core.materials.ArmorMaterialStats.ClothMaterialStats; -import lance5057.tDefense.core.materials.ArmorMaterialStats.FeetMaterialStats; +import lance5057.tDefense.core.library.ArmorNBT; +import lance5057.tDefense.core.materials.stats.ArmorMaterialStats; +import lance5057.tDefense.core.materials.stats.FabricMaterialStats; +import lance5057.tDefense.core.materials.stats.FeetMaterialStats; import lance5057.tDefense.core.parts.TDParts; import lance5057.tDefense.core.tools.armor.renderers.ArmorRenderer; import lance5057.tDefense.core.tools.armor.renderers.heavy.ModelTinkersSabatons; import lance5057.tDefense.core.tools.bases.ArmorCore; -import lance5057.tDefense.util.ArmorNBT; import net.minecraft.client.model.ModelBiped; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; import net.minecraft.util.DamageSource; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import slimeknights.tconstruct.library.materials.ExtraMaterialStats; import slimeknights.tconstruct.library.materials.Material; +import slimeknights.tconstruct.library.materials.MaterialTypes; import slimeknights.tconstruct.library.tinkering.PartMaterialType; +import slimeknights.tconstruct.library.utils.TagUtil; public class TinkersSabatons extends ArmorCore { public TinkersSabatons() { super(EntityEquipmentSlot.FEET,new PartMaterialType(TDParts.armorPlate, FeetMaterialStats.TYPE), new PartMaterialType(TDParts.armorPlate, FeetMaterialStats.TYPE), PartMaterialType.handle(TDParts.filigree), - new PartMaterialType(TDParts.cloth, ClothMaterialStats.TYPE)); + new PartMaterialType(TDParts.fabric, FabricMaterialStats.TYPE)); setUnlocalizedName("tinkerssabatons"); } @SideOnly(Side.CLIENT) @Override - public List<String> getArmorTexture(ItemStack stack) { - List<String> textures = new ArrayList(); - textures.add("textures/armor/sabatons/_sabatons_plates.png"); - textures.add("textures/armor/sabatons/_sabatons_caps.png"); - textures.add("textures/armor/sabatons/_sabatons_trim.png"); - textures.add("textures/armor/sabatons/_sabatons_soles.png"); - return textures; + public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) { + String texture; + NBTTagList t = TagUtil.getBaseMaterialsTagList(stack); + texture = "textures/armor/sabatons/_sabatons_plate_" + t.getStringTagAt(0); + return texture; } @SideOnly(Side.CLIENT) @Override - public ArmorRenderer getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack) { + public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default) + { return new ModelTinkersSabatons(itemStack); } @Override public NBTTagCompound buildTag(List<Material> materials) { - ArmorNBT data = buildDefaultArmorTag(materials, FeetMaterialStats.TYPE); + ArmorNBT data = buildDefaultTag(materials); return data.get(); } @@ -60,33 +64,64 @@ public class TinkersSabatons extends ArmorCore { } @Override - public void getTooltipDetailed(ItemStack stack, List<String> tooltips) { + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, + int slot) { // TODO Auto-generated method stub - + return null; } @Override - public void getTooltipComponents(ItemStack stack, List<String> tooltips) { + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { // TODO Auto-generated method stub - + return 0; } @Override - public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, - int slot) { + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { // TODO Auto-generated method stub - return null; + } @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { + public float damagePotential() + { // TODO Auto-generated method stub return 0; } @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { + public double attackSpeed() + { // TODO Auto-generated method stub - + return 0; + } + + @Override + protected ArmorNBT buildDefaultTag(List<Material> materials) + { + ArmorNBT data = new ArmorNBT(); + + if (materials.size() >= 2) + { + ArmorMaterialStats handle = materials.get(0).getStatsOrUnknown(FabricMaterialStats.TYPE); + ArmorMaterialStats head = materials.get(1).getStatsOrUnknown(FabricMaterialStats.TYPE); + // start with head + data.head(head); + + // add in accessoires if present + if (materials.size() >= 3) + { + ExtraMaterialStats binding = materials.get(2).getStatsOrUnknown(MaterialTypes.EXTRA); + data.extra(binding); + } + + // calculate handle impact + data.head(handle); + } + + // 3 free modifiers + data.modifiers = DEFAULT_MODIFIERS; + + return data; } } diff --git a/src/main/java/lance5057/tDefense/core/tools/armor/renderers/cloth/ModelTinkersHood.java b/src/main/java/lance5057/tDefense/core/tools/armor/renderers/cloth/ModelTinkersHood.java index 54b2c6d..b5cf2c2 100644 --- a/src/main/java/lance5057/tDefense/core/tools/armor/renderers/cloth/ModelTinkersHood.java +++ b/src/main/java/lance5057/tDefense/core/tools/armor/renderers/cloth/ModelTinkersHood.java @@ -15,10 +15,10 @@ public class ModelTinkersHood extends ArmorRenderer { public ModelRenderer ScarfNeck; public ModelTinkersHood(ItemStack stack) { - super(0.25f, 0, 96, 64, stack); + super(0.25f, 0, 96, 96, stack); this.textureWidth = 96; - this.textureHeight = 64; - + this.textureHeight = 96; + this.Flop_1 = new ModelRenderer(this, 77, 9); this.Flop_1.setRotationPoint(0.0F, 0.0F, 0.0F); this.Flop_1.addBox(-2.0F, -6.8F, -0.1F, 4, 4, 5, 0.5F); diff --git a/src/main/java/lance5057/tDefense/core/tools/armor/renderers/cloth/ModelTinkersRobe.java b/src/main/java/lance5057/tDefense/core/tools/armor/renderers/cloth/ModelTinkersRobe.java index e5f179a..bdf11c6 100644 --- a/src/main/java/lance5057/tDefense/core/tools/armor/renderers/cloth/ModelTinkersRobe.java +++ b/src/main/java/lance5057/tDefense/core/tools/armor/renderers/cloth/ModelTinkersRobe.java @@ -21,9 +21,9 @@ public class ModelTinkersRobe extends ArmorRenderer { public ModelRenderer LeftFrontL; public ModelTinkersRobe(ItemStack stack) { - super(0.25f, 0, 96, 64, stack); + super(0.25f, 0, 96, 96, stack); this.textureWidth = 96; - this.textureHeight = 64; + this.textureHeight = 96; this.BeltStraight = new ModelRenderer(this, 66, 24); this.BeltStraight.setRotationPoint(0.0F, 10.0F, 0.0F); diff --git a/src/main/java/lance5057/tDefense/core/tools/armor/renderers/cloth/ModelTinkersShawl.java b/src/main/java/lance5057/tDefense/core/tools/armor/renderers/cloth/ModelTinkersShawl.java index 1dc721f..b2f8f6c 100644 --- a/src/main/java/lance5057/tDefense/core/tools/armor/renderers/cloth/ModelTinkersShawl.java +++ b/src/main/java/lance5057/tDefense/core/tools/armor/renderers/cloth/ModelTinkersShawl.java @@ -17,9 +17,9 @@ public class ModelTinkersShawl extends ArmorRenderer { public ModelRenderer ShawlRightTrimLong; public ModelTinkersShawl(ItemStack stack) { - super(0.25f, 0, 96, 64, stack); + super(0.25f, 0, 96, 96, stack); this.textureWidth = 96; - this.textureHeight = 64; + this.textureHeight = 96; this.TrimNeck = new ModelRenderer(this, 68, 49); this.TrimNeck.setRotationPoint(0.0F, 0.0F, 0.0F); diff --git a/src/main/java/lance5057/tDefense/core/tools/armor/renderers/heavy/ModelTinkersHelm.java b/src/main/java/lance5057/tDefense/core/tools/armor/renderers/heavy/ModelTinkersHelm.java index 937bcc4..c74e4af 100644 --- a/src/main/java/lance5057/tDefense/core/tools/armor/renderers/heavy/ModelTinkersHelm.java +++ b/src/main/java/lance5057/tDefense/core/tools/armor/renderers/heavy/ModelTinkersHelm.java @@ -15,9 +15,9 @@ public class ModelTinkersHelm extends ArmorRenderer { public ModelRenderer MouthGuard; public ModelTinkersHelm(ItemStack stack) { - super(0.25f, 0, 96, 64, stack); + super(0.25f, 0, 96, 96, stack); this.textureWidth = 96; - this.textureHeight = 64; + this.textureHeight = 96; this.MouthGuard = new ModelRenderer(this, 64, 32); this.MouthGuard.setRotationPoint(0.0F, 0.0F, 0.0F); diff --git a/src/main/java/lance5057/tDefense/core/tools/armor/renderers/layers/LayerTDArmor.java b/src/main/java/lance5057/tDefense/core/tools/armor/renderers/layers/LayerTDArmor.java index 14c3fc1..d45d64b 100644 --- a/src/main/java/lance5057/tDefense/core/tools/armor/renderers/layers/LayerTDArmor.java +++ b/src/main/java/lance5057/tDefense/core/tools/armor/renderers/layers/LayerTDArmor.java @@ -1,6 +1,6 @@ package lance5057.tDefense.core.tools.armor.renderers.layers; -import java.util.List; +import java.util.List; import java.util.Map; import com.google.common.collect.Maps; diff --git a/src/main/java/lance5057/tDefense/core/tools/armor/renderers/layers/LayerTDBipedArmor.java b/src/main/java/lance5057/tDefense/core/tools/armor/renderers/layers/LayerTDBipedArmor.java index 890ba1f..2ba5720 100644 --- a/src/main/java/lance5057/tDefense/core/tools/armor/renderers/layers/LayerTDBipedArmor.java +++ b/src/main/java/lance5057/tDefense/core/tools/armor/renderers/layers/LayerTDBipedArmor.java @@ -1,6 +1,6 @@ package lance5057.tDefense.core.tools.armor.renderers.layers; -import java.util.List; +import java.util.List; import lance5057.tDefense.core.tools.bases.ArmorCore; import net.minecraft.client.model.ModelBiped; @@ -59,8 +59,8 @@ public class LayerTDBipedArmor extends LayerTDArmor<ModelBiped> { if (entity instanceof EntityPlayer) { EntityPlayer p = (EntityPlayer) entity; ItemStack armor = p.inventory.armorItemInSlot(slot.getIndex()); - List<String> l = ((ArmorCore)armor.getItem()).getArmorTexture(armor); - return l; + //List<String> l = ((ArmorCore)armor.getItem()).getArmorTexture(armor); + //return l; } return null; } diff --git a/src/main/java/lance5057/tDefense/core/tools/armor/renderers/shaders/ArmorShader.java b/src/main/java/lance5057/tDefense/core/tools/armor/renderers/shaders/ArmorShader.java deleted file mode 100644 index 5a1e803..0000000 --- a/src/main/java/lance5057/tDefense/core/tools/armor/renderers/shaders/ArmorShader.java +++ /dev/null @@ -1,183 +0,0 @@ -package lance5057.tDefense.core.tools.armor.renderers.shaders; - -import static org.lwjgl.opengl.GL11.GL_BLEND; -import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA; -import static org.lwjgl.opengl.GL11.GL_QUADS; -import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA; -import static org.lwjgl.opengl.GL11.glBegin; -import static org.lwjgl.opengl.GL11.glBlendFunc; -import static org.lwjgl.opengl.GL11.glColor3d; -import static org.lwjgl.opengl.GL11.glColor4f; -import static org.lwjgl.opengl.GL11.glEnable; -import static org.lwjgl.opengl.GL11.glEnd; -import static org.lwjgl.opengl.GL11.glTexCoord2f; - -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.imageio.ImageIO; - -import lance5057.tDefense.util.Color16Util; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.util.ResourceLocation; -import slimeknights.tconstruct.library.client.MaterialRenderInfo; -import slimeknights.tconstruct.library.client.texture.TextureColoredTexture; - -public class ArmorShader { - - public static BufferedImage colorize(ResourceLocation r1, int color) { - IResourceManager manager = Minecraft.getMinecraft().getResourceManager(); - try { - BufferedImage buff = ImageIO.read(manager.getResource(r1).getInputStream()); - BufferedImage tint = new BufferedImage(buff.getWidth(), buff.getHeight(), BufferedImage.TYPE_INT_ARGB); - - Graphics2D graphics = tint.createGraphics(); - - graphics.setPaint(new Color(color)); - graphics.fillRect(0, 0, tint.getWidth(), tint.getHeight()); - graphics.dispose(); - - return multiply(buff, tint); - - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return null; - } - - public static void metalTexture(ResourceLocation r1, ResourceLocation r2, int color) { - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - Minecraft.getMinecraft().getTextureManager().bindTexture(r1); - - int[] colors = Color16Util.hexToRGB(Integer.toHexString(color)); - // glColor3d((float) colors[0] / 255, (float) colors[1] / 255, (float) - // colors[2] / 255); - - Minecraft.getMinecraft().getTextureManager().bindTexture(r1); - glColor4f((float) colors[0] / 255, (float) colors[1] / 255, (float) colors[2] / 255, 1.0f); - glBegin(GL_QUADS); - glTexCoord2f(0.0f, 0.0f); - glTexCoord2f(1.0f, 0.0f); - glTexCoord2f(1.0f, 1.0f); - glTexCoord2f(0.0f, 1.0f); - glEnd(); - - Minecraft.getMinecraft().getTextureManager().bindTexture(r2); - glColor4f((float) colors[0] / 255, (float) colors[1] / 255, (float) colors[2] / 255, 1.0f); - glBegin(GL_QUADS); - glTexCoord2f(0.0f, 0.0f); - glTexCoord2f(1.0f, 0.0f); - glTexCoord2f(1.0f, 1.0f); - glTexCoord2f(0.0f, 1.0f); - glEnd(); - } - - public static BufferedImage blockTexture(TextureColoredTexture sprite) { - - List<ResourceLocation> l = (List<ResourceLocation>) sprite.getDependencies(); - String s = l.get(1).toString(); - - IResourceManager manager = Minecraft.getMinecraft().getResourceManager(); - if (s.contains("minecraft:")) { - s = s.substring(s.indexOf(":") + 1); - s = "textures/" + s + ".png"; - } else { - s = l.get(1).getResourceDomain() + ":textures/" + l.get(1).getResourcePath() + ".png"; - } - try { - BufferedImage buff = ImageIO.read(manager.getResource(l.get(0)).getInputStream()); - BufferedImage buff2 = ImageIO.read(manager.getResource(new ResourceLocation(s)).getInputStream()); - - return multiply(buff, buff2); - } catch (IOException e) { - Logger.getAnonymousLogger().log(Level.SEVERE, "Somethings Fucky - TinkersDefense:ArmorShader - Line 107"); - } - return null; - - } - - public static void selectRenderer(BufferedImage b, MaterialRenderInfo info, ResourceLocation r1) { - - Graphics g = b.getGraphics(); - - if (info instanceof MaterialRenderInfo.MetalTextured) - metalTexture(r1, r1, ((MaterialRenderInfo.MetalTextured) info).color); - else if (info instanceof MaterialRenderInfo.Metal) - g.drawImage(colorize(r1, ((MaterialRenderInfo.Metal) info).color), 0, 0, null); - else if (info instanceof MaterialRenderInfo.MultiColor) - g.drawImage(colorize(r1, ((MaterialRenderInfo.MultiColor) info).getVertexColor()), 0, 0, null); - else if (info instanceof MaterialRenderInfo.InverseMultiColor) - g.drawImage(colorize(r1, ((MaterialRenderInfo.InverseMultiColor) info).getVertexColor()), 0, 0, null); - else if (info instanceof MaterialRenderInfo.BlockTexture) - g.drawImage( - blockTexture((TextureColoredTexture) ((MaterialRenderInfo.BlockTexture) info).getTexture(r1, "")), - 0, 0, null); - else - g.drawImage(colorize(r1, ((MaterialRenderInfo.Default) info).color), 0, 0, null); - - g.dispose(); - - } - - public static BufferedImage multiply(BufferedImage buff, BufferedImage buff2) { - BufferedImage buffImg = new BufferedImage(buff.getWidth(), buff.getHeight(), BufferedImage.TYPE_INT_ARGB); - - for (int i = 0; i < buff.getWidth(); i++) - for (int j = 0; j < buff.getHeight(); j++) { - Color c1 = new Color(buff.getRGB(i, j), true); - int x = i % buff2.getWidth(); - int y = j % buff2.getHeight(); - Color c2 = new Color(buff2.getRGB(x, y), true); - float r, g, b, a; - Color out; - - // multiply here - r = (((float) c1.getRed()) / 255) * (((float) c2.getRed()) / 255); - g = (((float) c1.getGreen()) / 255) * (((float) c2.getGreen()) / 255); - b = (((float) c1.getBlue()) / 255) * (((float) c2.getBlue()) / 255); - - // transparency always comes from the first buffer - int a2 = c1.getAlpha(); - a = ((float) c1.getAlpha()) / 255; - - out = new Color(r, g, b, a); - buffImg.setRGB(i, j, out.getRGB()); - } - - return buffImg; - } - - public static BufferedImage Invert(BufferedImage buff) { - BufferedImage buffImg = new BufferedImage(buff.getWidth(), buff.getHeight(), BufferedImage.TYPE_INT_ARGB); - - for (int i = 0; i < buff.getWidth(); i++) - for (int j = 0; j < buff.getHeight(); j++) { - Color c1 = new Color(buff.getRGB(i, j), true); - float r, g, b, a; - Color out; - - // invert here - r = Math.abs((((float) c1.getRed()) / 255) - 1.0f); - g = Math.abs((((float) c1.getGreen()) / 255) - 1.0f); - b = Math.abs((((float) c1.getBlue()) / 255) - 1.0f); - - // transparency always comes from the first buffer - int a2 = c1.getAlpha(); - a = ((float) c1.getAlpha()) / 255; - - out = new Color(r, g, b, a); - buffImg.setRGB(i, j, out.getRGB()); - } - - return buffImg; - } -} diff --git a/src/main/java/lance5057/tDefense/core/tools/bases/ArmorBase.java b/src/main/java/lance5057/tDefense/core/tools/bases/ArmorBase.java index 4c3d876..e6c86d0 100644 --- a/src/main/java/lance5057/tDefense/core/tools/bases/ArmorBase.java +++ b/src/main/java/lance5057/tDefense/core/tools/bases/ArmorBase.java @@ -15,8 +15,10 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Sets; import gnu.trove.set.hash.THashSet; -import lance5057.tDefense.util.ArmorBuilder; -import lance5057.tDefense.util.ArmorEvent; +import jline.internal.Log; +import lance5057.tDefense.core.library.ArmorBuilder; +import lance5057.tDefense.core.library.ArmorEvent; +import lance5057.tDefense.core.library.ArmorTags; import net.minecraft.client.Minecraft; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.Entity; @@ -58,459 +60,543 @@ import slimeknights.tconstruct.library.utils.ToolBuilder; import slimeknights.tconstruct.library.utils.ToolHelper; import slimeknights.tconstruct.library.utils.TooltipBuilder; -public abstract class ArmorBase extends ItemArmor implements ITinkerable, IModifyable, IRepairable, ISpecialArmor{ +public abstract class ArmorBase extends ItemArmor implements ITinkerable, IModifyable, IRepairable, ISpecialArmor +{ protected final PartMaterialType[] requiredComponents; - // used to classify what the thing can do - protected final Set<Category> categories = new THashSet<>(); - - public ArmorBase(EntityEquipmentSlot slot, PartMaterialType... requiredComponents) { - super(ItemArmor.ArmorMaterial.LEATHER, 0, slot); - this.requiredComponents = requiredComponents; - - this.setMaxStackSize(1); - //this.setHasSubtypes(true); - } - - /* Tool Information */ - public List<PartMaterialType> getRequiredComponents() { - return ImmutableList.copyOf(requiredComponents); - } - - public List<PartMaterialType> getToolBuildComponents() { - return getRequiredComponents(); - } - - protected void addCategory(Category... categories) { - Collections.addAll(this.categories, categories); - } - - public boolean hasCategory(Category category) { - return categories.contains(category); - } - - protected Category[] getCategories() { - Category[] out = new Category[categories.size()]; - int i = 0; - for(Category category : categories) { - out[i++] = category; - } - - return out; - } - - /* INDESTRUCTIBLE */ - - @Override - public boolean hasCustomEntity(ItemStack stack) { - return true; - } - - @Nonnull - @Override - public Entity createEntity(World world, Entity location, ItemStack itemstack) { - EntityItem entity = new IndestructibleEntityItem(world, location.posX, location.posY, location.posZ, itemstack); - if(location instanceof EntityItem) { - // workaround for private access on that field >_> - NBTTagCompound tag = new NBTTagCompound(); - location.writeToNBT(tag); - entity.setPickupDelay(tag.getShort("PickupDelay")); - } - entity.motionX = location.motionX; - entity.motionY = location.motionY; - entity.motionZ = location.motionZ; - return entity; - } - - /* Building the Item */ - public boolean validComponent(int slot, ItemStack stack) { - if(slot > requiredComponents.length || slot < 0) { - return false; - } - - return requiredComponents[slot].isValid(stack); - } - - /** - * Builds an Itemstack of this tool with the given materials, if applicable. - * - * @param stacks Items to build with. Have to be in the correct order and have exact length. No nulls! - * @return The built item or null if invalid input. - */ - @Nonnull - public ItemStack buildItemFromStacks(NonNullList<ItemStack> stacks) { - long itemCount = stacks.stream().filter(stack -> !stack.isEmpty()).count(); - List<Material> materials = new ArrayList<>(stacks.size()); - - if(itemCount != requiredComponents.length) { - return ItemStack.EMPTY; - } - - // not a valid part arrangement for this tool - for(int i = 0; i < itemCount; i++) { - if(!validComponent(i, stacks.get(i))) { - return ItemStack.EMPTY; - } - - materials.add(TinkerUtil.getMaterialFromStack(stacks.get(i))); - } - - return buildItem(materials); - } - - /** - * Builds an Itemstack of this tool with the given materials. - * - * @param materials Materials to build with. Have to be in the correct order. No nulls! - * @return The built item or null if invalid input. - */ - @Nonnull - public ItemStack buildItem(List<Material> materials) { - ItemStack tool = new ItemStack(this); - tool.setTagCompound(buildItemNBT(materials)); - - return tool; - } - - /** - * Builds the NBT for a new tinker item with the given data. - * - * @param materials Materials to build with. Have to be in the correct order. No nulls! - * @return The built nbt - */ - public NBTTagCompound buildItemNBT(List<Material> materials) { - NBTTagCompound basetag = new NBTTagCompound(); - NBTTagCompound toolTag = buildTag(materials); - NBTTagCompound dataTag = buildData(materials); - - basetag.setTag(Tags.BASE_DATA, dataTag); - basetag.setTag(Tags.TOOL_DATA, toolTag); - // copy of the original tool data - basetag.setTag(Tags.TOOL_DATA_ORIG, toolTag.copy()); - - // save categories on the tool - TagUtil.setCategories(basetag, getCategories()); - - // add traits - addMaterialTraits(basetag, materials); - - // fire toolbuilding event - ArmorEvent.OnItemBuilding.fireEvent(basetag, ImmutableList.copyOf(materials), this); - - return basetag; - } - - /** - * Creates an NBT Tag with the materials that were used to build the item. - */ - private NBTTagCompound buildData(List<Material> materials) { - NBTTagCompound base = new NBTTagCompound(); - NBTTagList materialList = new NBTTagList(); - - for(Material material : materials) { - materialList.appendTag(new NBTTagString(material.identifier)); - } - - // pre-type base-modifier list - NBTTagList modifierList = new NBTTagList(); - // we cannot set the type directly, but it gets typed by adding a tag, so we add and remove one - modifierList.appendTag(new NBTTagString()); - modifierList.removeTag(0); - - base.setTag(Tags.BASE_MATERIALS, materialList); - base.setTag(Tags.BASE_MODIFIERS, modifierList); - - return base; - } - - /** - * Builds an unusable tool that only has the rendering info - */ - @Nonnull - public ItemStack buildItemForRendering(List<Material> materials) { - ItemStack tool = new ItemStack(this); - NBTTagCompound base = new NBTTagCompound(); - base.setTag(Tags.BASE_DATA, buildData(materials)); - tool.setTagCompound(base); - - return tool; - } - - @Nonnull - public ItemStack buildItemForRenderingInGui() { - List<Material> materials = IntStream.range(0, getRequiredComponents().size()) - .mapToObj(this::getMaterialForPartForGuiRendering) - .collect(Collectors.toList()); - - return buildItemForRendering(materials); - } - - @SideOnly(Side.CLIENT) - public Material getMaterialForPartForGuiRendering(int index) { - return ClientProxy.RenderMaterials[index % ClientProxy.RenderMaterials.length]; - } - - public abstract NBTTagCompound buildTag(List<Material> materials); - - /** Checks whether an Item built from materials has only valid materials. Uses the standard NBT to determine materials. */ - public boolean hasValidMaterials(ItemStack stack) { - // checks if the materials used support all stats needed - NBTTagList list = TagUtil.getBaseMaterialsTagList(stack); - List<Material> materials = TinkerUtil.getMaterialsFromTagList(list); - - // something went wrooooong - if(materials.size() != requiredComponents.length) { - return false; - } - - // check if all materials used have the stats needed - for(int i = 0; i < materials.size(); i++) { - Material material = materials.get(i); - PartMaterialType required = requiredComponents[i]; - if(!required.isValidMaterial(material)) { - return false; - } - } - - return true; - } - - public void addMaterialTraits(NBTTagCompound root, List<Material> materials) { - int size = requiredComponents.length; - // safety - if(materials.size() < size) { - size = materials.size(); - } - // add corresponding traits per material usage - for(int i = 0; i < size; i++) { - PartMaterialType required = requiredComponents[i]; - Material material = materials.get(i); - for(ITrait trait : required.getApplicableTraitsForMaterial(material)) { - ToolBuilder.addTrait(root, trait, material.materialTextColor); - } - } - } - - /* Repairing */ - - /** Returns indices of the parts that are used for repairing */ - public int[] getRepairParts() { - return new int[] { 1 }; // index 1 usually is the head. 0 is handle. - } - - public float getRepairModifierForPart(int index) { - return 1f; - } - - @Nonnull - @Override - public ItemStack repair(ItemStack repairable, NonNullList<ItemStack> repairItems) { - if(repairable.getItemDamage() == 0 && !ToolHelper.isBroken(repairable)) { - // undamaged and not broken - no need to repair - return ItemStack.EMPTY; - } - - // we assume the first required part exclusively determines repair material - List<Material> materials = TinkerUtil.getMaterialsFromTagList(TagUtil.getBaseMaterialsTagList(repairable)); - if(materials.isEmpty()) { - return ItemStack.EMPTY; - } - - // ensure the items only contain valid items - NonNullList<ItemStack> items = Util.deepCopyFixedNonNullList(repairItems); - boolean foundMatch = false; - for(int index : getRepairParts()) { - Material material = materials.get(index); - - if(repairCustom(material, items) > 0) { - foundMatch = true; - } - - Optional<RecipeMatch.Match> match = material.matches(items); - - // not a single match -> nothing to repair with - if(!match.isPresent()) { - continue; - } - foundMatch = true; - - while((match = material.matches(items)).isPresent()) { - RecipeMatch.removeMatch(items, match.get()); - } - } - - if(!foundMatch) { - return ItemStack.EMPTY; - } - - // check if all items were used - for(int i = 0; i < repairItems.size(); i++) { - // was non-null and did not get modified (stacksize changed or null now, usually) - if(!repairItems.get(i).isEmpty() && ItemStack.areItemStacksEqual(repairItems.get(i), items.get(i))) { - // found an item that was not touched - return ItemStack.EMPTY; - } - } - - // now do it all over again with the real items, to actually repair \o/ - ItemStack item = repairable.copy(); - - while(item.getItemDamage() > 0) { - int amount = calculateRepairAmount(materials, repairItems); - - // nothing to repair with, we're therefore done - if(amount <= 0) { - break; - } - - ToolHelper.repairTool(item, calculateRepair(item, amount)); - // save that we repaired it :I - NBTTagCompound tag = TagUtil.getExtraTag(item); - tag.setInteger(Tags.REPAIR_COUNT, tag.getInteger(Tags.REPAIR_COUNT) + 1); - TagUtil.setExtraTag(item, tag); - } - - return item; - } - - /** Allows for custom repair items. Remove used items from the array. */ - protected int repairCustom(Material material, NonNullList<ItemStack> repairItems) { - return 0; - } - - protected int calculateRepairAmount(List<Material> materials, NonNullList<ItemStack> repairItems) { - Set<Material> materialsMatched = Sets.newHashSet(); - float durability = 0f; - // try to match each material once - for(int index : getRepairParts()) { - Material material = materials.get(index); - - if(materialsMatched.contains(material)) { - continue; - } - - // custom repairing - durability += repairCustom(material, repairItems) * getRepairModifierForPart(index); - - Optional<RecipeMatch.Match> matchOptional = material.matches(repairItems); - if(matchOptional.isPresent()) { - RecipeMatch.Match match = matchOptional.get(); - HeadMaterialStats stats = material.getStats(MaterialTypes.HEAD); - if(stats != null) { - materialsMatched.add(material); - durability += ((float) stats.durability * (float) match.amount * getRepairModifierForPart(index)) / 144f; - RecipeMatch.removeMatch(repairItems, match); - } - } - } - - durability *= 1f + ((float) materialsMatched.size() - 1) / 9f; - - return (int) durability; - } - - protected int calculateRepair(ItemStack tool, int amount) { - float origDur = TagUtil.getOriginalToolStats(tool).durability; - float actualDur = ToolHelper.getDurabilityStat(tool); - - // calculate in modifiers that change the total durability of a tool, like diamond - // they should not punish the player with higher repair costs - float durabilityFactor = actualDur / origDur; - float increase = amount * Math.min(10f, durabilityFactor); - - increase = Math.max(increase, actualDur / 64f); - //increase = Math.max(50, increase); - - int modifiersUsed = TagUtil.getBaseModifiersUsed(tool.getTagCompound()); - float mods = 1.0f; - if(modifiersUsed == 1) { - mods = 0.95f; - } - else if(modifiersUsed == 2) { - mods = 0.9f; - } - else if(modifiersUsed >= 3) { - mods = 0.85f; - } - - increase *= mods; - - NBTTagCompound tag = TagUtil.getExtraTag(tool); - int repair = tag.getInteger(Tags.REPAIR_COUNT); - float repairDimishingReturns = (100 - repair / 2) / 100f; - if(repairDimishingReturns < 0.5f) { - repairDimishingReturns = 0.5f; - } - increase *= repairDimishingReturns; - - return (int) Math.ceil(increase); - } - - /* Information */ - - @Override - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { - boolean shift = Util.isShiftKeyDown(); - boolean ctrl = Util.isCtrlKeyDown(); - // modifiers - if(!shift && !ctrl) { - getTooltip(stack, tooltip); - - tooltip.add(""); - // info tooltip for detailed and componend info - tooltip.add(Util.translate("tooltip.tool.holdShift")); - tooltip.add(Util.translate("tooltip.tool.holdCtrl")); - -// if(worldIn != null) { -// tooltip.add(TextFormatting.BLUE + -// I18n.translateToLocalFormatted("attribute.modifier.plus.0", -// Util.df.format(ToolHelper.getActualDamage(stack, Minecraft.getMinecraft().player)), -// I18n.translateToLocal("attribute.name.generic.attackDamage"))); -// } - } - // detailed data - else if(Config.extraTooltips && shift) { - getTooltipDetailed(stack, tooltip); - } - // component data - else if(Config.extraTooltips && ctrl) { - getTooltipComponents(stack, tooltip); - } - } - - @Override - public void getTooltip(ItemStack stack, List<String> tooltips) { - // Default tooltip: modifiers - TooltipBuilder.addModifierTooltips(stack, tooltips); - } - - @Nonnull - @Override - public EnumRarity getRarity(ItemStack stack) { - // prevents enchanted items to have a different name color - return EnumRarity.COMMON; - } - - @Override - public boolean isBookEnchantable(ItemStack stack, ItemStack book) { - return false; - } - - /* NBT loading */ - - @Override - public boolean updateItemStackNBT(NBTTagCompound nbt) { - // when the itemstack is loaded from NBT we recalculate all the data - if(nbt.hasKey(Tags.BASE_DATA)) { - try { - ArmorBuilder.rebuildArmor(nbt, this); - } - catch(TinkerGuiException e) { - // nothing to do - } - } - - // return value shouldn't matter since it's never checked - return true; - } + // used to classify what the thing can do + protected final Set<Category> categories = new THashSet<>(); + + public ArmorBase(EntityEquipmentSlot slot, PartMaterialType... requiredComponents) + { + super(ItemArmor.ArmorMaterial.LEATHER, 0, slot); + this.requiredComponents = requiredComponents; + + this.setMaxStackSize(1); + // this.setHasSubtypes(true); + } + + /* Tool Information */ + public List<PartMaterialType> getRequiredComponents() + { + return ImmutableList.copyOf(requiredComponents); + } + + public List<PartMaterialType> getToolBuildComponents() + { + return getRequiredComponents(); + } + + protected void addCategory(Category... categories) + { + Collections.addAll(this.categories, categories); + } + + public boolean hasCategory(Category category) + { + return categories.contains(category); + } + + protected Category[] getCategories() + { + Category[] out = new Category[categories.size()]; + int i = 0; + for (Category category : categories) + { + out[i++] = category; + } + + return out; + } + + /* INDESTRUCTIBLE */ + + @Override + public boolean hasCustomEntity(ItemStack stack) + { + return true; + } + + @Nonnull + @Override + public Entity createEntity(World world, Entity location, ItemStack itemstack) + { + EntityItem entity = new IndestructibleEntityItem(world, location.posX, location.posY, location.posZ, itemstack); + if (location instanceof EntityItem) + { + // workaround for private access on that field >_> + NBTTagCompound tag = new NBTTagCompound(); + location.writeToNBT(tag); + entity.setPickupDelay(tag.getShort("PickupDelay")); + } + entity.motionX = location.motionX; + entity.motionY = location.motionY; + entity.motionZ = location.motionZ; + return entity; + } + + /* Building the Item */ + public boolean validComponent(int slot, ItemStack stack) + { + if (slot > requiredComponents.length || slot < 0) + { + return false; + } + + return requiredComponents[slot].isValid(stack); + } + + /** + * Builds an Itemstack of this tool with the given materials, if applicable. + * + * @param stacks + * Items to build with. Have to be in the correct order and have + * exact length. No nulls! + * @return The built item or null if invalid input. + */ + @Nonnull + public ItemStack buildItemFromStacks(NonNullList<ItemStack> stacks) + { + long itemCount = stacks.stream().filter(stack -> !stack.isEmpty()).count(); + List<Material> materials = new ArrayList<>(stacks.size()); + + if (itemCount != requiredComponents.length) + { + return ItemStack.EMPTY; + } + + // not a valid part arrangement for this tool + for (int i = 0; i < itemCount; i++) + { + if (!validComponent(i, stacks.get(i))) + { + return ItemStack.EMPTY; + } + + materials.add(TinkerUtil.getMaterialFromStack(stacks.get(i))); + } + + return buildItem(materials); + } + + /** + * Builds an Itemstack of this tool with the given materials. + * + * @param materials + * Materials to build with. Have to be in the correct order. No + * nulls! + * @return The built item or null if invalid input. + */ + @Nonnull + public ItemStack buildItem(List<Material> materials) + { + ItemStack tool = new ItemStack(this); + tool.setTagCompound(buildItemNBT(materials)); + + return tool; + } + + /** + * Builds the NBT for a new tinker item with the given data. + * + * @param materials + * Materials to build with. Have to be in the correct order. No + * nulls! + * @return The built nbt + */ + public NBTTagCompound buildItemNBT(List<Material> materials) + { + NBTTagCompound basetag = new NBTTagCompound(); + NBTTagCompound toolTag = buildTag(materials); + NBTTagCompound dataTag = buildData(materials); + + basetag.setTag(Tags.BASE_DATA, dataTag); + basetag.setTag(Tags.TOOL_DATA, toolTag); + // copy of the original tool data + basetag.setTag(Tags.TOOL_DATA_ORIG, toolTag.copy()); + // save categories on the tool + TagUtil.setCategories(basetag, getCategories()); + + // add traits + addMaterialTraits(basetag, materials); + + // fire toolbuilding event + ArmorEvent.OnItemBuilding.fireEvent(basetag, ImmutableList.copyOf(materials), this); + + return basetag; + } + + + + @SideOnly(Side.CLIENT) + public NBTTagCompound setupTexture(List<Material> materials) + { + return null; + } + + /** + * Creates an NBT Tag with the materials that were used to build the item. + */ + private NBTTagCompound buildData(List<Material> materials) + { + NBTTagCompound base = new NBTTagCompound(); + NBTTagList materialList = new NBTTagList(); + + for (Material material : materials) + { + materialList.appendTag(new NBTTagString(material.identifier)); + } + + // pre-type base-modifier list + NBTTagList modifierList = new NBTTagList(); + // we cannot set the type directly, but it gets typed by adding a tag, + // so we add and remove one + modifierList.appendTag(new NBTTagString()); + modifierList.removeTag(0); + + base.setTag(Tags.BASE_MATERIALS, materialList); + base.setTag(Tags.BASE_MODIFIERS, modifierList); + + return base; + } + + /** + * Builds an unusable tool that only has the rendering info + */ + @Nonnull + public ItemStack buildItemForRendering(List<Material> materials) + { + ItemStack tool = new ItemStack(this); + NBTTagCompound base = new NBTTagCompound(); + base.setTag(Tags.BASE_DATA, buildData(materials)); + tool.setTagCompound(base); + + return tool; + } + + @Nonnull + public ItemStack buildItemForRenderingInGui() + { + List<Material> materials = IntStream.range(0, getRequiredComponents().size()).mapToObj(this::getMaterialForPartForGuiRendering).collect(Collectors.toList()); + + return buildItemForRendering(materials); + } + + @SideOnly(Side.CLIENT) + public Material getMaterialForPartForGuiRendering(int index) + { + return ClientProxy.RenderMaterials[index % ClientProxy.RenderMaterials.length]; + } + + public abstract NBTTagCompound buildTag(List<Material> materials); + + /** + * Checks whether an Item built from materials has only valid materials. + * Uses the standard NBT to determine materials. + */ + public boolean hasValidMaterials(ItemStack stack) + { + // checks if the materials used support all stats needed + NBTTagList list = TagUtil.getBaseMaterialsTagList(stack); + List<Material> materials = TinkerUtil.getMaterialsFromTagList(list); + + // something went wrooooong + if (materials.size() != requiredComponents.length) + { + return false; + } + + // check if all materials used have the stats needed + for (int i = 0; i < materials.size(); i++) + { + Material material = materials.get(i); + PartMaterialType required = requiredComponents[i]; + if (!required.isValidMaterial(material)) + { + return false; + } + } + + return true; + } + + public void addMaterialTraits(NBTTagCompound root, List<Material> materials) + { + int size = requiredComponents.length; + // safety + if (materials.size() < size) + { + size = materials.size(); + } + // add corresponding traits per material usage + for (int i = 0; i < size; i++) + { + PartMaterialType required = requiredComponents[i]; + Material material = materials.get(i); + for (ITrait trait : required.getApplicableTraitsForMaterial(material)) + { + ToolBuilder.addTrait(root, trait, material.materialTextColor); + } + } + } + + /* Repairing */ + + /** Returns indices of the parts that are used for repairing */ + public int[] getRepairParts() + { + return new int[] { 1 }; // index 1 usually is the head. 0 is handle. + } + + public float getRepairModifierForPart(int index) + { + return 1f; + } + + @Nonnull + @Override + public ItemStack repair(ItemStack repairable, NonNullList<ItemStack> repairItems) + { + if (repairable.getItemDamage() == 0 && !ToolHelper.isBroken(repairable)) + { + // undamaged and not broken - no need to repair + return ItemStack.EMPTY; + } + + // we assume the first required part exclusively determines repair + // material + List<Material> materials = TinkerUtil.getMaterialsFromTagList(TagUtil.getBaseMaterialsTagList(repairable)); + if (materials.isEmpty()) + { + return ItemStack.EMPTY; + } + + // ensure the items only contain valid items + NonNullList<ItemStack> items = Util.deepCopyFixedNonNullList(repairItems); + boolean foundMatch = false; + for (int index : getRepairParts()) + { + Material material = materials.get(index); + + if (repairCustom(material, items) > 0) + { + foundMatch = true; + } + + Optional<RecipeMatch.Match> match = material.matches(items); + + // not a single match -> nothing to repair with + if (!match.isPresent()) + { + continue; + } + foundMatch = true; + + while ((match = material.matches(items)).isPresent()) + { + RecipeMatch.removeMatch(items, match.get()); + } + } + + if (!foundMatch) + { + return ItemStack.EMPTY; + } + + // check if all items were used + for (int i = 0; i < repairItems.size(); i++) + { + // was non-null and did not get modified (stacksize changed or null + // now, usually) + if (!repairItems.get(i).isEmpty() && ItemStack.areItemStacksEqual(repairItems.get(i), items.get(i))) + { + // found an item that was not touched + return ItemStack.EMPTY; + } + } + + // now do it all over again with the real items, to actually repair \o/ + ItemStack item = repairable.copy(); + + while (item.getItemDamage() > 0) + { + int amount = calculateRepairAmount(materials, repairItems); + + // nothing to repair with, we're therefore done + if (amount <= 0) + { + break; + } + + ToolHelper.repairTool(item, calculateRepair(item, amount)); + // save that we repaired it :I + NBTTagCompound tag = TagUtil.getExtraTag(item); + tag.setInteger(Tags.REPAIR_COUNT, tag.getInteger(Tags.REPAIR_COUNT) + 1); + TagUtil.setExtraTag(item, tag); + } + + return item; + } + + /** Allows for custom repair items. Remove used items from the array. */ + protected int repairCustom(Material material, NonNullList<ItemStack> repairItems) + { + return 0; + } + + protected int calculateRepairAmount(List<Material> materials, NonNullList<ItemStack> repairItems) + { + Set<Material> materialsMatched = Sets.newHashSet(); + float durability = 0f; + // try to match each material once + for (int index : getRepairParts()) + { + Material material = materials.get(index); + + if (materialsMatched.contains(material)) + { + continue; + } + + // custom repairing + durability += repairCustom(material, repairItems) * getRepairModifierForPart(index); + + Optional<RecipeMatch.Match> matchOptional = material.matches(repairItems); + if (matchOptional.isPresent()) + { + RecipeMatch.Match match = matchOptional.get(); + HeadMaterialStats stats = material.getStats(MaterialTypes.HEAD); + if (stats != null) + { + materialsMatched.add(material); + durability += ((float) stats.durability * (float) match.amount * getRepairModifierForPart(index)) / 144f; + RecipeMatch.removeMatch(repairItems, match); + } + } + } + + durability *= 1f + ((float) materialsMatched.size() - 1) / 9f; + + return (int) durability; + } + + protected int calculateRepair(ItemStack tool, int amount) + { + float origDur = TagUtil.getOriginalToolStats(tool).durability; + float actualDur = ToolHelper.getDurabilityStat(tool); + + // calculate in modifiers that change the total durability of a tool, + // like diamond + // they should not punish the player with higher repair costs + float durabilityFactor = actualDur / origDur; + float increase = amount * Math.min(10f, durabilityFactor); + + increase = Math.max(increase, actualDur / 64f); + // increase = Math.max(50, increase); + + int modifiersUsed = TagUtil.getBaseModifiersUsed(tool.getTagCompound()); + float mods = 1.0f; + if (modifiersUsed == 1) + { + mods = 0.95f; + } else if (modifiersUsed == 2) + { + mods = 0.9f; + } else if (modifiersUsed >= 3) + { + mods = 0.85f; + } + + increase *= mods; + + NBTTagCompound tag = TagUtil.getExtraTag(tool); + int repair = tag.getInteger(Tags.REPAIR_COUNT); + float repairDimishingReturns = (100 - repair / 2) / 100f; + if (repairDimishingReturns < 0.5f) + { + repairDimishingReturns = 0.5f; + } + increase *= repairDimishingReturns; + + return (int) Math.ceil(increase); + } + + /* Information */ + + @Override + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) + { + boolean shift = Util.isShiftKeyDown(); + boolean ctrl = Util.isCtrlKeyDown(); + // modifiers + if (!shift && !ctrl) + { + getTooltip(stack, tooltip); + + tooltip.add(""); + // info tooltip for detailed and componend info + tooltip.add(Util.translate("tooltip.tool.holdShift")); + tooltip.add(Util.translate("tooltip.tool.holdCtrl")); + + // if(worldIn != null) { + // tooltip.add(TextFormatting.BLUE + + // I18n.translateToLocalFormatted("attribute.modifier.plus.0", + // Util.df.format(ToolHelper.getActualDamage(stack, + // Minecraft.getMinecraft().player)), + // I18n.translateToLocal("attribute.name.generic.attackDamage"))); + // } + } + // detailed data + else if (Config.extraTooltips && shift) + { + getTooltipDetailed(stack, tooltip); + } + // component data + else if (Config.extraTooltips && ctrl) + { + getTooltipComponents(stack, tooltip); + } + } + + @Override + public void getTooltip(ItemStack stack, List<String> tooltips) + { + // Default tooltip: modifiers + TooltipBuilder.addModifierTooltips(stack, tooltips); + } + + @Nonnull + @Override + public EnumRarity getRarity(ItemStack stack) + { + // prevents enchanted items to have a different name color + return EnumRarity.COMMON; + } + + @Override + public boolean isBookEnchantable(ItemStack stack, ItemStack book) + { + return false; + } + + /* NBT loading */ + + @Override + public boolean updateItemStackNBT(NBTTagCompound nbt) + { + // when the itemstack is loaded from NBT we recalculate all the data + if (nbt.hasKey(Tags.BASE_DATA)) + { + try + { + ArmorBuilder.rebuildArmor(nbt, this); + } catch (TinkerGuiException e) + { + // nothing to do + } + } + + // return value shouldn't matter since it's never checked + return true; + } } diff --git a/src/main/java/lance5057/tDefense/core/tools/bases/ArmorCore.java b/src/main/java/lance5057/tDefense/core/tools/bases/ArmorCore.java index 44ca576..1355b97 100644 --- a/src/main/java/lance5057/tDefense/core/tools/bases/ArmorCore.java +++ b/src/main/java/lance5057/tDefense/core/tools/bases/ArmorCore.java @@ -1,179 +1,867 @@ package lance5057.tDefense.core.tools.bases; +import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; import java.util.List; +import java.util.Optional; import java.util.Set; +import javax.annotation.Nonnull; import javax.annotation.Nullable; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Multimap; import com.google.common.collect.Sets; -import lance5057.tDefense.core.materials.ArmorMaterialStats; +import lance5057.tDefense.core.library.ArmorNBT; +import lance5057.tDefense.core.library.ArmorTags; import lance5057.tDefense.core.tools.armor.renderers.ArmorRenderer; -import lance5057.tDefense.util.ArmorNBT; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.text.TextFormatting; +import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import slimeknights.mantle.util.RecipeMatch; +import slimeknights.tconstruct.common.ClientProxy; +import slimeknights.tconstruct.common.config.Config; +import slimeknights.tconstruct.library.TinkerRegistry; import slimeknights.tconstruct.library.Util; -import slimeknights.tconstruct.library.materials.ExtraMaterialStats; -import slimeknights.tconstruct.library.materials.HandleMaterialStats; +import slimeknights.tconstruct.library.materials.HeadMaterialStats; import slimeknights.tconstruct.library.materials.IMaterialStats; import slimeknights.tconstruct.library.materials.Material; import slimeknights.tconstruct.library.materials.MaterialTypes; +import slimeknights.tconstruct.library.modifiers.IModifier; +import slimeknights.tconstruct.library.modifiers.ModifierNBT; import slimeknights.tconstruct.library.tinkering.Category; +import slimeknights.tconstruct.library.tinkering.IToolStationDisplay; import slimeknights.tconstruct.library.tinkering.PartMaterialType; +import slimeknights.tconstruct.library.tools.DualToolHarvestUtils; +import slimeknights.tconstruct.library.tools.IAoeTool; import slimeknights.tconstruct.library.tools.IToolPart; import slimeknights.tconstruct.library.traits.ITrait; import slimeknights.tconstruct.library.utils.TagUtil; import slimeknights.tconstruct.library.utils.TinkerUtil; import slimeknights.tconstruct.library.utils.ToolHelper; import slimeknights.tconstruct.library.utils.TooltipBuilder; +import slimeknights.tconstruct.tools.TinkerMaterials; +import slimeknights.tconstruct.tools.TinkerTools; +import slimeknights.tconstruct.tools.traits.InfiTool; -public abstract class ArmorCore extends ArmorBase { - public ArmorCore(EntityEquipmentSlot slot, PartMaterialType... requiredComponents) { +/** + * Intermediate abstraction layer for all tools/melee weapons. This class has + * all the callbacks for blocks and enemies so tools and weapons can share + * behaviour. + */ +public abstract class ArmorCore extends ArmorBase implements IToolStationDisplay +{ + + public final static int DEFAULT_MODIFIERS = 3; + public static final String TAG_SWITCHED_HAND_HAX = "SwitchedHand"; + + public ArmorCore(EntityEquipmentSlot slot, PartMaterialType... requiredComponents) + { super(slot, requiredComponents); + + this.setCreativeTab(TinkerRegistry.tabTools); + this.setNoRepair(); // >_> + + // TinkerRegistry.registerTool(this); + addCategory(Category.TOOL); } - protected String getHarvestType() { - return null; + @Override + public int getMaxDamage(ItemStack stack) + { + return ToolHelper.getDurabilityStat(stack); + } + + @Override + public void setDamage(ItemStack stack, int damage) + { + int max = getMaxDamage(stack); + super.setDamage(stack, Math.min(max, damage)); + + if (getDamage(stack) == max) + { + ToolHelper.breakTool(stack, null); + } + } + + @Override + public boolean isDamageable() + { + return true; + } + + @Override + public boolean showDurabilityBar(ItemStack stack) + { + return super.showDurabilityBar(stack) && !ToolHelper.isBroken(stack); + } + + /* Tool and Weapon specific properties */ + + /** + * Multiplier applied to the actual mining speed of the tool Internally a + * hammer and pick have the same speed, but a hammer is 2/3 slower + */ + public float miningSpeedModifier() + { + return 1f; + } + + /** Multiplier for damage from materials. Should be fixed per tool. */ + public abstract float damagePotential(); + + /** + * A fixed damage value where the calculations start to apply dimishing + * returns. Basically if you'd hit more than that damage with this tool, the + * damage is gradually reduced depending on how much the cutoff is exceeded. + */ + public float damageCutoff() + { + return 15.0f; // in general this should be sufficient and only needs + // increasing if it's a stronger weapon + // fun fact: diamond sword with sharpness V has 15 damage + } + + /** + * Allows you set the base attack speed, can be changed by modifiers. + * Equivalent to the vanilla attack speed. 4 is equal to any standard item. + * Value has to be greater than zero. + */ + public abstract double attackSpeed(); + + /** + * Knockback modifier. Basically this takes the vanilla knockback on hit and + * modifies it by this factor. + */ + public float knockback() + { + return 1.0f; + } + + /** + * Actually deal damage to the entity we hit. Can be overridden for special + * behaviour + * + * @return True if the entity was hit. Usually the return value of + * {@link Entity#attackEntityFrom(DamageSource, float)} + */ + public boolean dealDamage(ItemStack stack, EntityLivingBase player, Entity entity, float damage) + { + if (player instanceof EntityPlayer) + { + return entity.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) player), damage); + } + return entity.attackEntityFrom(DamageSource.causeMobDamage(player), damage); + } + + protected boolean readyForSpecialAttack(EntityLivingBase player) + { + return player instanceof EntityPlayer && ((EntityPlayer) player).getCooledAttackStrength(0.5f) > 0.9f; + } + + /** + * Called when an entity is getting damaged with the tool. Reduce the tools + * durability accordingly player can be null! + */ + public void reduceDurabilityOnHit(ItemStack stack, EntityPlayer player, float damage) + { + damage = Math.max(1f, damage / 10f); + if (!hasCategory(Category.WEAPON)) + { + damage *= 2; + } + ToolHelper.damageTool(stack, (int) damage, player); + } + + // @Override + // public float getStrVsBlock(ItemStack stack, IBlockState state) { + // if(isEffective(state) || ToolHelper.isToolEffective(stack, state)) { + // return ToolHelper.calcDigSpeed(stack, state); + // } + // return super.getStrVsBlock(stack, state); + // } + + public boolean isEffective(IBlockState state) + { + return false; + } + + @Override + public boolean canHarvestBlock(@Nonnull IBlockState state, ItemStack stack) + { + return isEffective(state); + } + + @Override + public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) + { + if (!ToolHelper.isBroken(itemstack) && this instanceof IAoeTool && ((IAoeTool) this).isAoeHarvestTool()) + { + for (BlockPos extraPos : ((IAoeTool) this).getAOEBlocks(itemstack, player.getEntityWorld(), player, pos)) + { + breakExtraBlock(itemstack, player.getEntityWorld(), player, extraPos, pos); + } + } + + // this is a really dumb hack. + // Basically when something with silktouch harvests a block from the + // offhand + // the game can't detect that. so we have to switch around the items in + // the hands for the break call + // it's switched back in onBlockDestroyed + if (DualToolHarvestUtils.shouldUseOffhand(player, pos, player.getHeldItemMainhand())) + { + ItemStack off = player.getHeldItemOffhand(); + switchItemsInHands(player); + // remember, off is in the mainhand now + NBTTagCompound tag = TagUtil.getTagSafe(off); + tag.setLong(TAG_SWITCHED_HAND_HAX, player.getEntityWorld().getTotalWorldTime()); + off.setTagCompound(tag); + } + + return breakBlock(itemstack, pos, player); + } + + /** + * Called to break the base block, return false to perform no breaking + * + * @param itemstack + * Tool ItemStack + * @param pos + * Current position + * @param player + * Player instance + * @return true if the normal block break code should be skipped + */ + protected boolean breakBlock(ItemStack itemstack, BlockPos pos, EntityPlayer player) + { + return super.onBlockStartBreak(itemstack, pos, player); + } + + /** + * Called when an AOE block is broken by the tool. Use to oveerride the + * block breaking logic + * + * @param tool + * Tool ItemStack + * @param world + * World instance + * @param player + * Player instance + * @param pos + * Current position + * @param refPos + * Base position + */ + protected void breakExtraBlock(ItemStack tool, World world, EntityPlayer player, BlockPos pos, BlockPos refPos) + { + ToolHelper.breakExtraBlock(tool, world, player, pos, refPos); + } + + // @Override + // public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, + // Entity entity) { + // return ToolHelper.attackEntity(stack, this, player, entity); + // } + + @Override + public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) + { + /* + * if(attackSpeed() > 0) { int speed = Math.min(5, attackSpeed()); + * ToolHelper.swingItem(speed, entityLiving); return true; } + */ + return super.onEntitySwing(entityLiving, stack); + } + + @Override + public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) + { + float speed = ToolHelper.getActualAttackSpeed(stack); + int time = Math.round(20f / speed); + if (time < target.hurtResistantTime / 2) + { + target.hurtResistantTime = (target.hurtResistantTime + time) / 2; + target.hurtTime = (target.hurtTime + time) / 2; + } + return super.hitEntity(stack, target, attacker); } + @Nonnull @Override - public abstract NBTTagCompound buildTag(List<slimeknights.tconstruct.library.materials.Material> materials); + public Multimap<String, AttributeModifier> getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, ItemStack stack) + { + Multimap<String, AttributeModifier> multimap = super.getAttributeModifiers(slot, stack); + + if (slot == EntityEquipmentSlot.MAINHAND && !ToolHelper.isBroken(stack)) + { + multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", ToolHelper.getActualAttack(stack), 0)); + multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", ToolHelper.getActualAttackSpeed(stack) - 4d, 0)); + } + + NBTTagList traitsTagList = TagUtil.getTraitsTagList(stack); + for (int i = 0; i < traitsTagList.tagCount(); i++) + { + ITrait trait = TinkerRegistry.getTrait(traitsTagList.getStringTagAt(i)); + if (trait != null) + { + trait.getAttributeModifiers(slot, stack, multimap); + } + } - public int getArmorDisplay(ItemStack stack) { - return TagUtil.getToolStats(stack).get().getInteger("ArmorRating"); + return multimap; + } + + @Override + public List<String> getInformation(ItemStack stack) + { + return getInformation(stack, true); + } + + @Override + public void getTooltip(ItemStack stack, List<String> tooltips) + { + if (ToolHelper.isBroken(stack)) + { + tooltips.add("" + TextFormatting.DARK_RED + TextFormatting.BOLD + getBrokenTooltip(stack)); + } + super.getTooltip(stack, tooltips); + } + + protected String getBrokenTooltip(ItemStack itemStack) + { + return Util.translate(TooltipBuilder.LOC_Broken); + } + + @Override + public void getTooltipDetailed(ItemStack stack, List<String> tooltips) + { + tooltips.addAll(getInformation(stack, false)); + } + + public List<String> getInformation(ItemStack stack, boolean detailed) + { + TooltipBuilder info = new TooltipBuilder(stack); + + info.addDurability(!detailed); + if (hasCategory(Category.HARVEST)) + { + info.addHarvestLevel(); + info.addMiningSpeed(); + } + if (hasCategory(Category.LAUNCHER)) + { + info.addDrawSpeed(); + info.addRange(); + info.addProjectileBonusDamage(); + } + info.addAttack(); + + if (ToolHelper.getFreeModifiers(stack) > 0) + { + info.addFreeModifiers(); + } + + if (detailed) + { + info.addModifierInfo(); + } + + return info.getTooltip(); + } + + @Override + public void getTooltipComponents(ItemStack stack, List<String> tooltips) + { + List<Material> materials = TinkerUtil.getMaterialsFromTagList(TagUtil.getBaseMaterialsTagList(stack)); + List<PartMaterialType> component = getRequiredComponents(); + + if (materials.size() < component.size()) + { + return; + } + + for (int i = 0; i < component.size(); i++) + { + PartMaterialType pmt = component.get(i); + Material material = materials.get(i); + + // get (one possible) toolpart used to craft the thing + Iterator<IToolPart> partIter = pmt.getPossibleParts().iterator(); + if (!partIter.hasNext()) + { + continue; + } + + IToolPart part = partIter.next(); + ItemStack partStack = part.getItemstackWithMaterial(material); + if (partStack != null) + { + // we have the part, add it + tooltips.add(material.getTextColor() + TextFormatting.UNDERLINE + partStack.getDisplayName()); + + Set<ITrait> usedTraits = Sets.newHashSet(); + // find out which stats and traits it contributes and add it to + // the tooltip + for (IMaterialStats stats : material.getAllStats()) + { + if (pmt.usesStat(stats.getIdentifier())) + { + tooltips.addAll(stats.getLocalizedInfo()); + for (ITrait trait : pmt.getApplicableTraitsForMaterial(material)) + { + if (!usedTraits.contains(trait)) + { + tooltips.add(material.getTextColor() + trait.getLocalizedName()); + usedTraits.add(trait); + } + } + } + } + tooltips.add(""); + } + } + } + + @Nonnull + @SideOnly(Side.CLIENT) + @Override + public FontRenderer getFontRenderer(ItemStack stack) + { + return ClientProxy.fontRenderer; } @SideOnly(Side.CLIENT) - public abstract List<String> getArmorTexture(ItemStack stack); + @Override + public boolean hasEffect(ItemStack stack) + { + return TagUtil.hasEnchantEffect(stack); + } + + @Nonnull + @Override + public String getItemStackDisplayName(@Nonnull ItemStack stack) + { + // if the tool is not named we use the repair tools for a prefix like + // thing + List<Material> materials = TinkerUtil.getMaterialsFromTagList(TagUtil.getBaseMaterialsTagList(stack)); + // we save all the ones for the name in a set so we don't have the same + // material in it twice + Set<Material> nameMaterials = Sets.newLinkedHashSet(); + + for (int index : getRepairParts()) + { + if (index < materials.size()) + { + nameMaterials.add(materials.get(index)); + } + } + + return Material.getCombinedItemName(super.getItemStackDisplayName(stack), nameMaterials); + } + + // Creative tab items + @Override + public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) + { + if (this.isInCreativeTab(tab)) + { + addDefaultSubItems(subItems); + } + } + + protected void addDefaultSubItems(List<ItemStack> subItems, Material... fixedMaterials) + { + for (Material head : TinkerRegistry.getAllMaterials()) + { + List<Material> mats = new ArrayList<>(requiredComponents.length); + + for (int i = 0; i < requiredComponents.length; i++) + { + if (fixedMaterials.length > i && fixedMaterials[i] != null && requiredComponents[i].isValidMaterial(fixedMaterials[i])) + { + mats.add(fixedMaterials[i]); + } else + { + // todo: check for applicability with stats + mats.add(head); + } + } + + ItemStack tool = buildItem(mats); + // only valid ones + if (hasValidMaterials(tool)) + { + subItems.add(tool); + if (!Config.listAllMaterials) + { + break; + } + } + } + } + + protected void addInfiTool(List<ItemStack> subItems, String name) + { + ItemStack tool = getInfiTool(name); + if (hasValidMaterials(tool)) + { + subItems.add(tool); + } + } + + protected ItemStack getInfiTool(String name) + { + // The InfiHarvester! + List<Material> materials = ImmutableList.of(TinkerMaterials.slime, TinkerMaterials.cobalt, TinkerMaterials.ardite, TinkerMaterials.ardite); + materials = materials.subList(0, requiredComponents.length); + ItemStack tool = buildItem(materials); + tool.setStackDisplayName(name); + InfiTool.INSTANCE.apply(tool); + + return tool; + } + + @Override + public int getHarvestLevel(ItemStack stack, String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState) + { + if (ToolHelper.isBroken(stack)) + { + return -1; + } + + if (this.getToolClasses(stack).contains(toolClass)) + { + // will return 0 if the tag has no info anyway + return ToolHelper.getHarvestLevelStat(stack); + } + + return super.getHarvestLevel(stack, toolClass, player, blockState); + } + + @Override + public Set<String> getToolClasses(ItemStack stack) + { + // no classes if broken + if (ToolHelper.isBroken(stack)) + { + return Collections.emptySet(); + } + return super.getToolClasses(stack); + } + + /** + * A simple string identifier for the tool, used for identification in + * texture generation etc. + */ + public String getIdentifier() + { + return getRegistryName().getResourcePath(); + } + + /** The tools name completely without material information */ + @Override + public String getLocalizedToolName() + { + return Util.translate(getUnlocalizedName() + ".name"); + } + + /** The tools name with the given material. e.g. "Wooden Pickaxe" */ + public String getLocalizedToolName(Material material) + { + return material.getLocalizedItemName(getLocalizedToolName()); + } + + /** Returns info about the Tool. Displayed in the tool stations etc. */ + public String getLocalizedDescription() + { + return Util.translate(getUnlocalizedName() + ".desc"); + } + + @Override + protected int repairCustom(Material material, NonNullList<ItemStack> repairItems) + { + Optional<RecipeMatch.Match> matchOptional = RecipeMatch.of(TinkerTools.sharpeningKit).matches(repairItems); + if (!matchOptional.isPresent()) + { + return 0; + } + + RecipeMatch.Match match = matchOptional.get(); + for (ItemStack stacks : match.stacks) + { + // invalid material? + if (TinkerTools.sharpeningKit.getMaterial(stacks) != material) + { + return 0; + } + } + + RecipeMatch.removeMatch(repairItems, match); + HeadMaterialStats stats = material.getStats(MaterialTypes.HEAD); + float durability = stats.durability * match.amount * TinkerTools.sharpeningKit.getCost(); + durability /= Material.VALUE_Ingot; + return (int) (durability); + } + + /* Additional Trait callbacks */ + + @Override + public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) + { + super.onUpdate(stack, worldIn, entityIn, itemSlot, isSelected); + + onUpdateTraits(stack, worldIn, entityIn, itemSlot, isSelected); + } + + protected void onUpdateTraits(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) + { + if (!isSelected && entityIn instanceof EntityPlayer && ((EntityPlayer) entityIn).getHeldItemOffhand() == stack) + { + isSelected = true; + } + NBTTagList list = TagUtil.getTraitsTagList(stack); + for (int i = 0; i < list.tagCount(); i++) + { + ITrait trait = TinkerRegistry.getTrait(list.getStringTagAt(i)); + if (trait != null) + { + trait.onUpdate(stack, worldIn, entityIn, itemSlot, isSelected); + } + } + } + + @Override + public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving) + { + // move item back into offhand. See onBlockBreakStart + if (stack != null && entityLiving != null && stack.hasTagCompound()) + { + NBTTagCompound tag = stack.getTagCompound(); + assert tag != null; + if (tag.getLong(TAG_SWITCHED_HAND_HAX) == entityLiving.getEntityWorld().getTotalWorldTime()) + { + tag.removeTag(TAG_SWITCHED_HAND_HAX); + stack.setTagCompound(tag); + + switchItemsInHands(entityLiving); + } + } + if (ToolHelper.isBroken(stack)) + { + return false; + } + + boolean effective = isEffective(state) || ToolHelper.isToolEffective(stack, worldIn.getBlockState(pos)); + int damage = effective ? 1 : 2; + + afterBlockBreak(stack, worldIn, state, pos, entityLiving, damage, effective); + + return hasCategory(Category.TOOL); + } + + protected void switchItemsInHands(EntityLivingBase entityLiving) + { + ItemStack main = entityLiving.getHeldItemMainhand(); + ItemStack off = entityLiving.getHeldItemOffhand(); + entityLiving.setHeldItem(EnumHand.OFF_HAND, main); + entityLiving.setHeldItem(EnumHand.MAIN_HAND, off); + } + + public void afterBlockBreak(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase player, int damage, boolean wasEffective) + { + NBTTagList list = TagUtil.getTraitsTagList(stack); + for (int i = 0; i < list.tagCount(); i++) + { + ITrait trait = TinkerRegistry.getTrait(list.getStringTagAt(i)); + if (trait != null) + { + trait.afterBlockBreak(stack, world, state, pos, player, wasEffective); + } + } + + ToolHelper.damageTool(stack, damage, player); + } + + // elevate to public + @Override + public RayTraceResult rayTrace(@Nonnull World worldIn, @Nonnull EntityPlayer playerIn, boolean useLiquids) + { + return super.rayTrace(worldIn, playerIn, useLiquids); + } + + protected void preventSlowDown(Entity entityIn, float originalSpeed) + { + TinkerTools.proxy.preventPlayerSlowdown(entityIn, originalSpeed, this); + } + + @Override + public boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStack) + { + return shouldCauseReequipAnimation(oldStack, newStack, false); + } @SideOnly(Side.CLIENT) - @Nullable - public abstract ArmorRenderer getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack); - - public ArmorNBT buildDefaultArmorTag(List<Material> materials, String type) { - ArmorNBT data = new ArmorNBT(); - - if (materials.size() >= 2) { - HandleMaterialStats handle = materials.get(0).getStatsOrUnknown(MaterialTypes.HANDLE); - ArmorMaterialStats head = materials.get(1).getStatsOrUnknown(type); - // start with head - data.head(head); - - // add in accessories if present - if (materials.size() >= 3) { - ExtraMaterialStats binding = materials.get(2).getStatsOrUnknown(MaterialTypes.EXTRA); - data.extra(binding); + @Override + public boolean shouldCauseReequipAnimation(ItemStack oldStack, @Nonnull ItemStack newStack, boolean slotChanged) + { + if (TagUtil.getResetFlag(newStack)) + { + TagUtil.setResetFlag(newStack, false); + return true; + } + if (oldStack == newStack) + { + return false; + } + if (slotChanged) + { + return true; + } + + if (oldStack.hasEffect() != newStack.hasEffect()) + { + return true; + } + + Multimap<String, AttributeModifier> attributesNew = newStack.getAttributeModifiers(EntityEquipmentSlot.MAINHAND); + Multimap<String, AttributeModifier> attributesOld = oldStack.getAttributeModifiers(EntityEquipmentSlot.MAINHAND); + + if (attributesNew.size() != attributesOld.size()) + { + return true; + } + for (String key : attributesOld.keySet()) + { + if (!attributesNew.containsKey(key)) + { + return true; + } + Iterator<AttributeModifier> iter1 = attributesNew.get(key).iterator(); + Iterator<AttributeModifier> iter2 = attributesOld.get(key).iterator(); + while (iter1.hasNext() && iter2.hasNext()) + { + if (!iter1.next().equals(iter2.next())) + { + return true; + } } + } + + if (oldStack.getItem() == newStack.getItem() && newStack.getItem() instanceof ArmorCore) + { + return !isEqualTinkersItem(oldStack, newStack); + } + return !ItemStack.areItemStacksEqual(oldStack, newStack); + } + + /** + * Builds a default tool from: 1. Handle 2. Head 3. Accessoire (if present) + */ + protected ArmorNBT buildDefaultTag(List<Material> materials) + { + return null; + + } + + public static boolean isEqualTinkersItem(ItemStack item1, ItemStack item2) + { + if (item1 == null || item2 == null || item1.getItem() != item2.getItem()) + { + return false; + } + if (!(item1.getItem() instanceof ArmorCore)) + { + return false; + } + + NBTTagCompound tag1 = TagUtil.getTagSafe(item1); + NBTTagCompound tag2 = TagUtil.getTagSafe(item2); + + NBTTagList mods1 = TagUtil.getModifiersTagList(tag1); + NBTTagList mods2 = TagUtil.getModifiersTagList(tag2); - // calculate handle impact - data.handle(handle); + if (mods1.tagCount() != mods1.tagCount()) + { + return false; } - // 3 free modifiers - data.modifiers = 5; + // check modifiers + for (int i = 0; i < mods1.tagCount(); i++) + { + NBTTagCompound tag = mods1.getCompoundTagAt(i); + ModifierNBT data = ModifierNBT.readTag(tag); + IModifier modifier = TinkerRegistry.getModifier(data.identifier); + if (modifier != null && !modifier.equalModifier(tag, mods2.getCompoundTagAt(i))) + { + return false; + } + } + + return TagUtil.getBaseMaterialsTagList(tag1).equals(TagUtil.getBaseMaterialsTagList(tag2)) && // materials + // used + TagUtil.getBaseModifiersUsed(tag1) == TagUtil.getBaseModifiersUsed(tag2) && // number + // of + // free + // modifiers + // used + TagUtil.getOriginalToolStats(tag1).equals(TagUtil.getOriginalToolStats(tag2)); // unmodified + // base + // stats + } + + public EntityEquipmentSlot getArmorSlot(ItemStack stack, EntityEquipmentSlot armorType) + { + return null; + } - return data; + @SideOnly(Side.CLIENT) + public ArmorRenderer getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack) + { + return null; } @Override - public boolean isValidArmor(ItemStack stack, EntityEquipmentSlot armorType, Entity entity) - { - return armorType == getArmorSlot(stack, armorType); - } - - public abstract EntityEquipmentSlot getArmorSlot(ItemStack stack, EntityEquipmentSlot armorType); + public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) + { + String s = TagUtil.getTagSafe(TagUtil.getTagSafe(stack), ArmorTags.DynTex).getString(ArmorTags.TexLoc); + if((s == "" || s == null) || !checkForTexture(s)) + { + NBTTagCompound texTag = setupTexture(TinkerUtil.getMaterialsFromTagList(TagUtil.getBaseMaterialsTagList(stack))); + if (texTag != null) + TagUtil.getTagSafe(stack).setTag(ArmorTags.DynTex, texTag); + NBTTagCompound n = TagUtil.getTagSafe(TagUtil.getTagSafe(stack), ArmorTags.DynTex); + s = n.getString(ArmorTags.TexLoc); + } + return s; + } - @Override - public void getTooltip(ItemStack stack, List<String> tooltips) { - if(ToolHelper.isBroken(stack)) { - tooltips.add("" + TextFormatting.DARK_RED + TextFormatting.BOLD + getBrokenTooltip(stack)); - } - super.getTooltip(stack, tooltips); - } - - protected String getBrokenTooltip(ItemStack itemStack) { - return Util.translate(TooltipBuilder.LOC_Broken); - } - - @Override - public void getTooltipDetailed(ItemStack stack, List<String> tooltips) { - tooltips.addAll(getInformation(stack, false)); - } - - public List<String> getInformation(ItemStack stack, boolean detailed) { - TooltipBuilder info = new TooltipBuilder(stack); - - info.addDurability(!detailed); - if(hasCategory(Category.HARVEST)) { - info.addHarvestLevel(); - info.addMiningSpeed(); - } - if(hasCategory(Category.LAUNCHER)) { - info.addDrawSpeed(); - info.addRange(); - info.addProjectileBonusDamage(); - } - info.addAttack(); - - if(ToolHelper.getFreeModifiers(stack) > 0) { - info.addFreeModifiers(); - } - - if(detailed) { - info.addModifierInfo(); - } - - return info.getTooltip(); - } - - @Override - public void getTooltipComponents(ItemStack stack, List<String> tooltips) { - List<Material> materials = TinkerUtil.getMaterialsFromTagList(TagUtil.getBaseMaterialsTagList(stack)); - List<PartMaterialType> component = getRequiredComponents(); - - if(materials.size() < component.size()) { - return; - } - - for(int i = 0; i < component.size(); i++) { - PartMaterialType pmt = component.get(i); - Material material = materials.get(i); - - // get (one possible) toolpart used to craft the thing - Iterator<IToolPart> partIter = pmt.getPossibleParts().iterator(); - if(!partIter.hasNext()) { - continue; - } - - IToolPart part = partIter.next(); - ItemStack partStack = part.getItemstackWithMaterial(material); - if(partStack != null) { - // we have the part, add it - tooltips.add(material.getTextColor() + TextFormatting.UNDERLINE + partStack.getDisplayName()); - - Set<ITrait> usedTraits = Sets.newHashSet(); - // find out which stats and traits it contributes and add it to the tooltip - for(IMaterialStats stats : material.getAllStats()) { - if(pmt.usesStat(stats.getIdentifier())) { - tooltips.addAll(stats.getLocalizedInfo()); - for(ITrait trait : pmt.getApplicableTraitsForMaterial(material)) { - if(!usedTraits.contains(trait)) { - tooltips.add(material.getTextColor() + trait.getLocalizedName()); - usedTraits.add(trait); - } - } - } - } - tooltips.add(""); - } - } - } - -} + private boolean checkForTexture(String s) + { + if(Minecraft.getMinecraft().getTextureManager().getTexture(new ResourceLocation(s)) != null) + return true; + return false; + } +}
\ No newline at end of file diff --git a/src/main/java/lance5057/tDefense/core/tools/basic/HeaterShield.java b/src/main/java/lance5057/tDefense/core/tools/basic/HeaterShield.java index f70dca9..e3f9253 100644 --- a/src/main/java/lance5057/tDefense/core/tools/basic/HeaterShield.java +++ b/src/main/java/lance5057/tDefense/core/tools/basic/HeaterShield.java @@ -1,6 +1,6 @@ package lance5057.tDefense.core.tools.basic; -import lance5057.tDefense.core.materials.ShieldMaterialStats; +import lance5057.tDefense.core.materials.stats.ShieldMaterialStats; import lance5057.tDefense.core.parts.TDParts; import lance5057.tDefense.core.tools.bases.Shield; import slimeknights.tconstruct.library.tinkering.PartMaterialType; diff --git a/src/main/java/lance5057/tDefense/core/tools/basic/RoundShield.java b/src/main/java/lance5057/tDefense/core/tools/basic/RoundShield.java index ff4388a..ddfd7f4 100644 --- a/src/main/java/lance5057/tDefense/core/tools/basic/RoundShield.java +++ b/src/main/java/lance5057/tDefense/core/tools/basic/RoundShield.java @@ -1,6 +1,6 @@ package lance5057.tDefense.core.tools.basic; -import lance5057.tDefense.core.materials.ShieldMaterialStats; +import lance5057.tDefense.core.materials.stats.ShieldMaterialStats; import lance5057.tDefense.core.parts.TDParts; import lance5057.tDefense.core.tools.bases.Shield; import slimeknights.tconstruct.library.tinkering.PartMaterialType; diff --git a/src/main/java/lance5057/tDefense/core/tools/basic/TowerShield.java b/src/main/java/lance5057/tDefense/core/tools/basic/TowerShield.java index ebaf791..d5bd9e8 100644 --- a/src/main/java/lance5057/tDefense/core/tools/basic/TowerShield.java +++ b/src/main/java/lance5057/tDefense/core/tools/basic/TowerShield.java @@ -1,6 +1,6 @@ package lance5057.tDefense.core.tools.basic; -import lance5057.tDefense.core.materials.ShieldMaterialStats; +import lance5057.tDefense.core.materials.stats.ShieldMaterialStats; import lance5057.tDefense.core.parts.TDParts; import lance5057.tDefense.core.tools.bases.Shield; import slimeknights.tconstruct.library.tinkering.PartMaterialType; diff --git a/src/main/java/lance5057/tDefense/core/tools/baubles/Sheathe.java b/src/main/java/lance5057/tDefense/core/tools/baubles/Sheathe.java index f6f2c3b..8c84171 100644 --- a/src/main/java/lance5057/tDefense/core/tools/baubles/Sheathe.java +++ b/src/main/java/lance5057/tDefense/core/tools/baubles/Sheathe.java @@ -2,6 +2,8 @@ package lance5057.tDefense.core.tools.baubles; import baubles.api.BaubleType; import lance5057.tDefense.Reference; +import lance5057.tDefense.core.materials.stats.FabricMaterialStats; +import lance5057.tDefense.core.parts.TDParts; import lance5057.tDefense.core.tools.bases.BaubleTool; import lance5057.tDefense.proxy.ClientProxy; import net.minecraft.client.Minecraft; @@ -16,8 +18,9 @@ public class Sheathe extends BaubleTool { private static final ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "textures/model/sheathe.png"); public Sheathe(PartMaterialType... requiredComponents) { - super(PartMaterialType.head(TinkerTools.largePlate), PartMaterialType.handle(TinkerTools.toolRod), - PartMaterialType.bowstring(TinkerTools.bowString)); + super(PartMaterialType.head(TDParts.armorPlate), PartMaterialType.handle(TDParts.clasp), + new PartMaterialType(TDParts.fabric, FabricMaterialStats.TYPE), + PartMaterialType.extra(TDParts.filigree)); } diff --git a/src/main/java/lance5057/tDefense/holiday/HolidayBase.java b/src/main/java/lance5057/tDefense/holiday/HolidayBase.java index 80cb4e0..4700f6b 100644 --- a/src/main/java/lance5057/tDefense/holiday/HolidayBase.java +++ b/src/main/java/lance5057/tDefense/holiday/HolidayBase.java @@ -3,7 +3,7 @@ package lance5057.tDefense.holiday; import java.util.Calendar; import lance5057.tDefense.Reference; -import lance5057.tDefense.util.ModuleBase; +import lance5057.tDefense.core.library.ModuleBase; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; diff --git a/src/main/java/lance5057/tDefense/holiday/xmas/XmasBase.java b/src/main/java/lance5057/tDefense/holiday/xmas/XmasBase.java index 5ce4017..3c3f43d 100644 --- a/src/main/java/lance5057/tDefense/holiday/xmas/XmasBase.java +++ b/src/main/java/lance5057/tDefense/holiday/xmas/XmasBase.java @@ -1,9 +1,9 @@ package lance5057.tDefense.holiday.xmas; import lance5057.tDefense.TinkersDefense; +import lance5057.tDefense.core.library.ItemsBase; +import lance5057.tDefense.core.library.ModuleBase; import lance5057.tDefense.holiday.xmas.gumdropslime.GumDropSlime; -import lance5057.tDefense.util.ItemsBase; -import lance5057.tDefense.util.ModuleBase; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; diff --git a/src/main/java/lance5057/tDefense/holiday/xmas/XmasItems.java b/src/main/java/lance5057/tDefense/holiday/xmas/XmasItems.java index 0df5a97..789e18e 100644 --- a/src/main/java/lance5057/tDefense/holiday/xmas/XmasItems.java +++ b/src/main/java/lance5057/tDefense/holiday/xmas/XmasItems.java @@ -1,7 +1,7 @@ package lance5057.tDefense.holiday.xmas; -import lance5057.tDefense.util.ItemsBase; -import lance5057.tDefense.util.MetaItem; +import lance5057.tDefense.core.library.ItemsBase; +import lance5057.tDefense.core.library.MetaItem; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.event.FMLInitializationEvent; diff --git a/src/main/java/lance5057/tDefense/proxy/ClientProxy.java b/src/main/java/lance5057/tDefense/proxy/ClientProxy.java index 5b697ae..94cc8a5 100644 --- a/src/main/java/lance5057/tDefense/proxy/ClientProxy.java +++ b/src/main/java/lance5057/tDefense/proxy/ClientProxy.java @@ -10,17 +10,19 @@ import lance5057.tDefense.Reference; import lance5057.tDefense.TD_Commands; import lance5057.tDefense.TinkersDefense; import lance5057.tDefense.core.items.TDOreDictItem; +import lance5057.tDefense.core.library.ArmorBuildGuiInfo; +import lance5057.tDefense.core.library.ArmorPart; +import lance5057.tDefense.core.library.CustomArmorTextureCreator; +import lance5057.tDefense.core.library.TDClientRegistry; +import lance5057.tDefense.core.library.TDModelLoader; +import lance5057.tDefense.core.library.TDModelRegistar; import lance5057.tDefense.core.materials.TDMaterials; -import lance5057.tDefense.core.parts.TDParts; import lance5057.tDefense.core.renderers.BaubleRenderer; import lance5057.tDefense.core.renderers.SheatheModel; import lance5057.tDefense.core.tools.TDTools; import lance5057.tDefense.core.tools.armor.renderers.layers.LayerTDBipedArmor; import lance5057.tDefense.core.tools.bases.ArmorCore; import lance5057.tDefense.renderers.deserializers.AlphaColorTextureDeserializer; -import lance5057.tDefense.util.ArmorBuildGuiInfo; -import lance5057.tDefense.util.TDClientRegistry; -import lance5057.tDefense.util.TDModelRegistar; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -36,11 +38,14 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.client.model.ModelLoaderRegistry; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fml.common.Mod; import slimeknights.tconstruct.common.ModelRegisterUtil; import slimeknights.tconstruct.library.TinkerRegistry; import slimeknights.tconstruct.library.TinkerRegistryClient; +import slimeknights.tconstruct.library.client.CustomTextureCreator; import slimeknights.tconstruct.library.client.ToolBuildGuiInfo; import slimeknights.tconstruct.library.client.material.MaterialRenderInfoLoader; import slimeknights.tconstruct.library.materials.Material; @@ -54,6 +59,8 @@ public class ClientProxy extends CommonProxy { // ModifierSoulHandler SoulHandler; // public static ModelTinkersTabard sheath; + + private static final TDModelLoader loader = new TDModelLoader(); ToolBuildGuiInfo roundshieldGUI; ToolBuildGuiInfo heatershieldGUI; @@ -79,20 +86,18 @@ public class ClientProxy extends CommonProxy { ArmorBuildGuiInfo sabatonsGUI; ToolBuildGuiInfo sheatheGUI; - ToolBuildGuiInfo ringGUI; - ToolBuildGuiInfo amuletGUI; +// ToolBuildGuiInfo ringGUI; +// ToolBuildGuiInfo amuletGUI; public static SheatheModel sheathe; @Override public void preInit() { ClientCommandHandler.instance.registerCommand(new TD_Commands()); - + ModelLoaderRegistry.registerLoader(loader); MaterialRenderInfoLoader.addRenderInfo("alpha_color", AlphaColorTextureDeserializer.class); - //register all armor textures into tinkers - //CustomTextureCreator.registerTexture(new ResourceLocation(Reference.MOD_ID, "armor/hood/_hood_cloth")); - + MinecraftForge.EVENT_BUS.register(CustomArmorTextureCreator.INSTANCE); } @Override @@ -101,11 +106,11 @@ public class ClientProxy extends CommonProxy { RenderPlayer render; render = skinMap.get("default"); render.addLayer(new BaubleRenderer()); - render.addLayer(new LayerTDBipedArmor(render)); + //render.addLayer(new LayerTDBipedArmor(render)); render = skinMap.get("slim"); render.addLayer(new BaubleRenderer()); - render.addLayer(new LayerTDBipedArmor(render)); + //render.addLayer(new LayerTDBipedArmor(render)); createToolGuis(); setToolGuis(); @@ -154,6 +159,11 @@ public class ClientProxy extends CommonProxy { public void registerPartModel(ToolPart part) { ModelRegisterUtil.registerPartModel(part); } + + @Override + public void registerArmorPartModel(ArmorPart part) { + ModelRegisterUtil.registerPartModel(part); + } @Override public void registerMatColor(Material mat, int color) { @@ -181,8 +191,8 @@ public class ClientProxy extends CommonProxy { sabatonsGUI = new ArmorBuildGuiInfo(TDTools.sabatons); sheatheGUI = new ToolBuildGuiInfo(TDTools.sheathe); - ringGUI = new ToolBuildGuiInfo(TDTools.ring); - amuletGUI = new ToolBuildGuiInfo(TDTools.amulet); +// ringGUI = new ToolBuildGuiInfo(TDTools.ring); +// amuletGUI = new ToolBuildGuiInfo(TDTools.amulet); } @@ -231,9 +241,9 @@ public class ClientProxy extends CommonProxy { shearsGUI.addSlotPosition(43, 33 + 8); shearsGUI.addSlotPosition(34, 51 + 8); - ringGUI.addSlotPosition(34, 15 + 8); - ringGUI.addSlotPosition(43, 33 + 8); - ringGUI.addSlotPosition(34, 51 + 8); +// ringGUI.addSlotPosition(34, 15 + 8); +// ringGUI.addSlotPosition(43, 33 + 8); +// ringGUI.addSlotPosition(34, 51 + 8); breastplateGUI.addSlotPosition(34, 15 + 8); breastplateGUI.addSlotPosition(43, 33 + 8); @@ -262,26 +272,27 @@ public class ClientProxy extends CommonProxy { //TinkerRegistryClient.addToolBuilding(bootsGUI); TinkerRegistryClient.addToolBuilding(sheatheGUI); - TinkerRegistryClient.addToolBuilding(ringGUI); - TinkerRegistryClient.addToolBuilding(amuletGUI); - +// TinkerRegistryClient.addToolBuilding(ringGUI); +// TinkerRegistryClient.addToolBuilding(amuletGUI); +// TDClientRegistry.addArmorBuilding(helmGUI); TDClientRegistry.addArmorBuilding(breastplateGUI); TDClientRegistry.addArmorBuilding(grievesGUI); TDClientRegistry.addArmorBuilding(sabatonsGUI); } - public void registerPartModels() { - ModelRegisterUtil.registerPartModel(TDParts.armorPlate); - ModelRegisterUtil.registerPartModel(TDParts.chainmail); - ModelRegisterUtil.registerPartModel(TDParts.clasp); - ModelRegisterUtil.registerPartModel(TDParts.cloth); - ModelRegisterUtil.registerPartModel(TDParts.filigree); - ModelRegisterUtil.registerPartModel(TDParts.ringShank); - ModelRegisterUtil.registerPartModel(TDParts.rivets); - ModelRegisterUtil.registerPartModel(TDParts.setting); - ModelRegisterUtil.registerPartModel(TDParts.wire); - } +// @Override +// public void registerPartModel(ToolPart part) { +// ModelRegisterUtil.registerPartModel(TDParts.armorPlate); +// ModelRegisterUtil.registerPartModel(TDParts.chainmail); +// ModelRegisterUtil.registerPartModel(TDParts.clasp); +// ModelRegisterUtil.registerPartModel(TDParts.cloth); +// ModelRegisterUtil.registerPartModel(TDParts.filigree); +// ModelRegisterUtil.registerPartModel(TDParts.ringShank); +// ModelRegisterUtil.registerPartModel(TDParts.rivets); +// ModelRegisterUtil.registerPartModel(TDParts.setting); +// ModelRegisterUtil.registerPartModel(TDParts.wire); +// } @Override public void reloadRenderers() { @@ -376,16 +387,16 @@ public class ClientProxy extends CommonProxy { sheatheGUI.addSlotPosition(34, 15); sheatheGUI.addSlotPosition(34, 33); sheatheGUI.addSlotPosition(34, 51); - - ringGUI.positions.clear(); - ringGUI.addSlotPosition(34, 15); - ringGUI.addSlotPosition(34, 33); - ringGUI.addSlotPosition(34, 51); - - amuletGUI.positions.clear(); - amuletGUI.addSlotPosition(34, 15); - amuletGUI.addSlotPosition(34, 33); - amuletGUI.addSlotPosition(34, 51); +// +// ringGUI.positions.clear(); +// ringGUI.addSlotPosition(34, 15); +// ringGUI.addSlotPosition(34, 33); +// ringGUI.addSlotPosition(34, 51); +// +// amuletGUI.positions.clear(); +// amuletGUI.addSlotPosition(34, 15); +// amuletGUI.addSlotPosition(34, 33); +// amuletGUI.addSlotPosition(34, 51); } void createToolModels() { diff --git a/src/main/java/lance5057/tDefense/proxy/CommonProxy.java b/src/main/java/lance5057/tDefense/proxy/CommonProxy.java index dde7d7a..7f3e988 100644 --- a/src/main/java/lance5057/tDefense/proxy/CommonProxy.java +++ b/src/main/java/lance5057/tDefense/proxy/CommonProxy.java @@ -2,6 +2,7 @@ package lance5057.tDefense.proxy; import lance5057.tDefense.Reference; import lance5057.tDefense.TinkersDefense; +import lance5057.tDefense.core.library.ArmorPart; import lance5057.tDefense.core.tools.bases.ArmorCore; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; @@ -93,9 +94,22 @@ public class CommonProxy implements IGuiHandler { @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { - TinkersDefense.mats.registerItems(event); + + TinkersDefense.parts.registerItems(event); + TinkersDefense.mats.registerItems(event); TinkersDefense.tools.registerItems(event); TinkersDefense.holiday.registerItems(event); } + + @SubscribeEvent + public static void registerBlocks(RegistryEvent.Register<Block> event) { + TinkersDefense.tools.registerBlocks(event); + } + + public void registerArmorPartModel(ArmorPart part) + { + // TODO Auto-generated method stub + + } } diff --git a/src/main/java/lance5057/tDefense/util/RegEvents.java b/src/main/java/lance5057/tDefense/util/RegEvents.java deleted file mode 100644 index 35df69e..0000000 --- a/src/main/java/lance5057/tDefense/util/RegEvents.java +++ /dev/null @@ -1,5 +0,0 @@ -package lance5057.tDefense.util; - -public class RegEvents { - -} |
