mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 04:09:40 +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
@@ -2,6 +2,8 @@ package tconstruct.library.tools;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -9,14 +11,10 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.tools.DynamicToolPart;
|
||||
import tconstruct.library.util.TextureHelper;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class DualMaterialToolPart extends DynamicToolPart {
|
||||
public IIcon defaultIcon2;
|
||||
public IIcon[] icons2;
|
||||
@@ -25,8 +23,7 @@ public class DualMaterialToolPart extends DynamicToolPart {
|
||||
super(textureType, name);
|
||||
}
|
||||
|
||||
public static ItemStack createDualMaterial(Item item, int mat1, int mat2)
|
||||
{
|
||||
public static ItemStack createDualMaterial(Item item, int mat1, int mat2) {
|
||||
ItemStack stack = new ItemStack(item, 1, mat1);
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
NBTTagCompound subtag = new NBTTagCompound();
|
||||
@@ -38,24 +35,20 @@ public class DualMaterialToolPart extends DynamicToolPart {
|
||||
return stack;
|
||||
}
|
||||
|
||||
public int getMaterialID2(ItemStack stack)
|
||||
{
|
||||
if(!stack.hasTagCompound())
|
||||
return -1;
|
||||
public int getMaterialID2(ItemStack stack) {
|
||||
if (!stack.hasTagCompound()) return -1;
|
||||
|
||||
int id = stack.getTagCompound().getCompoundTag("DualMat").getInteger("Material2");
|
||||
|
||||
if (TConstructRegistry.toolMaterials.keySet().contains(id))
|
||||
return id;
|
||||
if (TConstructRegistry.toolMaterials.keySet().contains(id)) return id;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item item, CreativeTabs tab, List list)
|
||||
{
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
// material id == metadata
|
||||
for(Integer matID : TConstructRegistry.toolMaterials.keySet())
|
||||
for (Integer matID : TConstructRegistry.toolMaterials.keySet())
|
||||
list.add(createDualMaterial(item, matID, TinkerTools.MaterialID.Iron));
|
||||
}
|
||||
|
||||
@@ -78,12 +71,12 @@ public class DualMaterialToolPart extends DynamicToolPart {
|
||||
this.icons2 = new IIcon[icons.length];
|
||||
|
||||
// register icon for each material that has one
|
||||
if(!PHConstruct.minimalTextures)
|
||||
for(Map.Entry<Integer, tconstruct.library.tools.ToolMaterial> entry : TConstructRegistry.toolMaterials.entrySet())
|
||||
{
|
||||
String tex = modTexPrefix + ":" + folder + entry.getValue().materialName.toLowerCase() + texture + "_2";
|
||||
if(TextureHelper.itemTextureExists(tex))
|
||||
this.icons2[entry.getKey()] = iconRegister.registerIcon(tex);
|
||||
if (!PHConstruct.minimalTextures)
|
||||
for (Map.Entry<Integer, tconstruct.library.tools.ToolMaterial> entry :
|
||||
TConstructRegistry.toolMaterials.entrySet()) {
|
||||
String tex = modTexPrefix + ":" + folder
|
||||
+ entry.getValue().materialName.toLowerCase() + texture + "_2";
|
||||
if (TextureHelper.itemTextureExists(tex)) this.icons2[entry.getKey()] = iconRegister.registerIcon(tex);
|
||||
}
|
||||
|
||||
this.defaultIcon2 = iconRegister.registerIcon(modTexPrefix + ":" + folder + texture + "_2");
|
||||
@@ -92,12 +85,10 @@ public class DualMaterialToolPart extends DynamicToolPart {
|
||||
@Override
|
||||
public IIcon getIconFromDamageForRenderPass(int meta, int pass) {
|
||||
// secondary item
|
||||
if(pass > 0) {
|
||||
if(meta > icons.length)
|
||||
return defaultIcon2;
|
||||
if (pass > 0) {
|
||||
if (meta > icons.length) return defaultIcon2;
|
||||
|
||||
if(icons2[meta] == null)
|
||||
return defaultIcon2;
|
||||
if (icons2[meta] == null) return defaultIcon2;
|
||||
|
||||
return icons2[meta];
|
||||
}
|
||||
@@ -106,13 +97,11 @@ public class DualMaterialToolPart extends DynamicToolPart {
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack stack, int renderpass) {
|
||||
if(renderpass > 0)
|
||||
{
|
||||
if (renderpass > 0) {
|
||||
int matId = getMaterialID2(stack);
|
||||
if(matId > icons2.length || matId < 0)
|
||||
return super.getColorFromItemStack(stack, renderpass);
|
||||
if (matId > icons2.length || matId < 0) return super.getColorFromItemStack(stack, renderpass);
|
||||
|
||||
if(icons[matId] == null)
|
||||
if (icons[matId] == null)
|
||||
return TConstructRegistry.getMaterial(matId).primaryColor();
|
||||
|
||||
return super.getColorFromItemStack(stack, renderpass);
|
||||
|
||||
Reference in new issue
Block a user