mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 11:59:14 +00:00
Fix JABBA-related issues with crafting station slots (#54)
* Fix shift-merging tools voiding items fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11392> * Change 0-sized ItemStacks into null stacks in crafting station attached slots Fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10425> * Update buildscript * spotlessApply
This commit is contained in:
1 parent
18bfeaff32
commit
39be06c23b
571 files changed
+25959
-28223
No files matched your search
@@ -1,11 +1,9 @@
|
||||
package tconstruct.tools.items;
|
||||
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mantle.items.abstracts.CraftingItem;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -15,15 +13,12 @@ import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.PatternBuilder.MaterialSet;
|
||||
import tconstruct.library.util.IPattern;
|
||||
|
||||
public class Pattern extends CraftingItem implements IPattern
|
||||
{
|
||||
public Pattern(String patternType, String folder)
|
||||
{
|
||||
public class Pattern extends CraftingItem implements IPattern {
|
||||
public Pattern(String patternType, String folder) {
|
||||
this(patternName, getPatternNames(patternType), folder);
|
||||
}
|
||||
|
||||
public Pattern(String[] names, String[] patternTypes, String folder)
|
||||
{
|
||||
public Pattern(String[] names, String[] patternTypes, String folder) {
|
||||
super(names, patternTypes, folder, "tinker", TConstructRegistry.materialTab);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
@@ -31,31 +26,53 @@ public class Pattern extends CraftingItem implements IPattern
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
protected static String[] getPatternNames (String partType)
|
||||
{
|
||||
protected static String[] getPatternNames(String partType) {
|
||||
String[] names = new String[patternName.length];
|
||||
for (int i = 0; i < patternName.length; i++)
|
||||
names[i] = partType + patternName[i];
|
||||
for (int i = 0; i < patternName.length; i++) names[i] = partType + patternName[i];
|
||||
return names;
|
||||
}
|
||||
|
||||
private static final String[] patternName = new String[] { "ingot", "rod", "pickaxe", "shovel", "axe", "swordblade", "largeguard", "mediumguard", "crossbar", "binding", "frypan", "sign", "knifeblade", "chisel", "largerod", "toughbinding", "largeplate", "broadaxe", "scythe", "excavator", "largeblade", "hammerhead", "fullguard", "bowstring", "fletching", "arrowhead" };
|
||||
private static final String[] patternName = new String[] {
|
||||
"ingot",
|
||||
"rod",
|
||||
"pickaxe",
|
||||
"shovel",
|
||||
"axe",
|
||||
"swordblade",
|
||||
"largeguard",
|
||||
"mediumguard",
|
||||
"crossbar",
|
||||
"binding",
|
||||
"frypan",
|
||||
"sign",
|
||||
"knifeblade",
|
||||
"chisel",
|
||||
"largerod",
|
||||
"toughbinding",
|
||||
"largeplate",
|
||||
"broadaxe",
|
||||
"scythe",
|
||||
"excavator",
|
||||
"largeblade",
|
||||
"hammerhead",
|
||||
"fullguard",
|
||||
"bowstring",
|
||||
"fletching",
|
||||
"arrowhead"
|
||||
};
|
||||
|
||||
private static final Map<Integer, Integer> patternCosts = buildPatternCostMap();
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item b, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 1; i < patternName.length; i++)
|
||||
{
|
||||
public void getSubItems(Item b, CreativeTabs tab, List list) {
|
||||
for (int i = 1; i < patternName.length; i++) {
|
||||
// if (i != 23)
|
||||
list.add(new ItemStack(b, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
// 2 for full material, 1 for half.
|
||||
private static Map<Integer, Integer> buildPatternCostMap()
|
||||
{
|
||||
private static Map<Integer, Integer> buildPatternCostMap() {
|
||||
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
|
||||
|
||||
map.put(0, 2);
|
||||
@@ -89,56 +106,44 @@ public class Pattern extends CraftingItem implements IPattern
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItem (ItemStack stack)
|
||||
{
|
||||
if (stack.stackSize <= 0)
|
||||
return null;
|
||||
public ItemStack getContainerItem(ItemStack stack) {
|
||||
if (stack.stackSize <= 0) return null;
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid (ItemStack stack)
|
||||
{
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Tags and information about the pattern */
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
float cost = getPatternCost(stack) / 2f;
|
||||
if (cost > 0)
|
||||
{
|
||||
if (cost - (int) cost < 0.1)
|
||||
list.add(StatCollector.translateToLocal("pattern1.tooltip") + (int) cost);
|
||||
else
|
||||
list.add(StatCollector.translateToLocal("pattern2.tooltip") + cost);
|
||||
if (cost > 0) {
|
||||
if (cost - (int) cost < 0.1) list.add(StatCollector.translateToLocal("pattern1.tooltip") + (int) cost);
|
||||
else list.add(StatCollector.translateToLocal("pattern2.tooltip") + cost);
|
||||
}
|
||||
}
|
||||
|
||||
public static Map<Integer, Integer> getPatternCosts()
|
||||
{
|
||||
public static Map<Integer, Integer> getPatternCosts() {
|
||||
return patternCosts;
|
||||
}
|
||||
|
||||
public static void setPatternCost (Integer index, Integer newCost)
|
||||
{
|
||||
if (patternCosts.containsKey(index))
|
||||
{
|
||||
|
||||
public static void setPatternCost(Integer index, Integer newCost) {
|
||||
if (patternCosts.containsKey(index)) {
|
||||
patternCosts.put(index, newCost);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPatternCost (ItemStack pattern)
|
||||
{
|
||||
public int getPatternCost(ItemStack pattern) {
|
||||
return patternCosts.containsKey(pattern.getItemDamage()) ? patternCosts.get(pattern.getItemDamage()) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPatternOutput (ItemStack stack, ItemStack input, MaterialSet set)
|
||||
{
|
||||
public ItemStack getPatternOutput(ItemStack stack, ItemStack input, MaterialSet set) {
|
||||
return TConstructRegistry.getPartMapping((Item) this, stack.getItemDamage(), set.materialID);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user