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:
Raven Szewczyk authored and GitHub committed 2022-09-22 20:51:23 +02:00
1 parent 18bfeaff32
commit 39be06c23b
571 files changed
+25959 -28223

No files matched your search

@@ -1,21 +1,19 @@
package tconstruct.weaponry.ammo;
import net.minecraft.util.StatCollector;
import tconstruct.TConstruct;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.tools.ArrowMaterial;
import tconstruct.library.tools.CustomMaterial;
import tconstruct.library.tools.FletchingMaterial;
import tconstruct.library.tools.FletchlingLeafMaterial;
import tconstruct.weaponry.TinkerWeaponry;
import tconstruct.library.weaponry.AmmoItem;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import tconstruct.TConstruct;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.ToolBuilder;
import tconstruct.library.tools.CustomMaterial;
import tconstruct.library.tools.FletchingMaterial;
import tconstruct.library.tools.FletchlingLeafMaterial;
import tconstruct.library.weaponry.AmmoItem;
import tconstruct.tools.TinkerTools;
import java.util.List;
import tconstruct.weaponry.TinkerWeaponry;
public class ArrowAmmo extends AmmoItem {
public static ItemStack vanillaArrow;
@@ -25,10 +23,8 @@ public class ArrowAmmo extends AmmoItem {
}
@Override
public String getIconSuffix (int partType)
{
switch (partType)
{
public String getIconSuffix(int partType) {
switch (partType) {
case 0:
return "_arrow_head";
case 1:
@@ -43,33 +39,28 @@ public class ArrowAmmo extends AmmoItem {
}
@Override
public String getEffectSuffix ()
{
public String getEffectSuffix() {
return "_arrow_effect";
}
@Override
public String getDefaultFolder ()
{
public String getDefaultFolder() {
return "arrow";
}
@Override
public void registerPartPaths (int index, String[] location)
{
public void registerPartPaths(int index, String[] location) {
headStrings.put(index, location[0]);
}
@Override
public void registerAlternatePartPaths (int index, String[] location)
{
public void registerAlternatePartPaths(int index, String[] location) {
handleStrings.put(index, location[2]);
accessoryStrings.put(index, location[3]);
}
@Override
public Item getHeadItem ()
{
public Item getHeadItem() {
return TinkerWeaponry.arrowhead;
}
@@ -79,8 +70,7 @@ public class ArrowAmmo extends AmmoItem {
}
@Override
public Item getAccessoryItem ()
{
public Item getAccessoryItem() {
return TinkerWeaponry.fletching;
}
@@ -91,23 +81,20 @@ public class ArrowAmmo extends AmmoItem {
}
@Override
public String[] getTraits ()
{
return new String[] { "ammo", "projectile", "weapon" };
public String[] getTraits() {
return new String[] {"ammo", "projectile", "weapon"};
}
@Override
public void buildTool (int id, String name, List list)
{
if(TConstructRegistry.getArrowMaterial(id) == null)
return;
public void buildTool(int id, String name, List list) {
if (TConstructRegistry.getArrowMaterial(id) == null) return;
ItemStack handleStack = new ItemStack(getHandleItem(), 1, 0); // wooden shaft
ItemStack accessoryStack = new ItemStack(getAccessoryItem(), 1, 0); // feather fletchling
ItemStack tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, id), handleStack, accessoryStack, null, "");
if (tool != null)
{
ItemStack tool = ToolBuilder.instance.buildTool(
new ItemStack(getHeadItem(), 1, id), handleStack, accessoryStack, null, "");
if (tool != null) {
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
list.add(tool);
}
@@ -123,25 +110,19 @@ public class ArrowAmmo extends AmmoItem {
ItemStack accessoryStack = new ItemStack(getAccessoryItem(), 1, 0); // feather fletchling
ItemStack tool = ToolBuilder.instance.buildTool(headStack, handleStack, accessoryStack, null, "");
if (tool != null)
{
if (tool != null) {
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
vanillaArrow = tool;
}
else
TConstruct.logger.error("Couldn't build vanilla equivalent of Tinker Arrow");
} else TConstruct.logger.error("Couldn't build vanilla equivalent of Tinker Arrow");
}
@Override
protected int getDefaultColor(int renderPass, int materialID) {
if(renderPass != 2)
return super.getDefaultColor(renderPass, materialID);
if (renderPass != 2) return super.getDefaultColor(renderPass, materialID);
CustomMaterial mat = TConstructRegistry.getCustomMaterial(materialID, FletchingMaterial.class);
if(mat == null)
TConstructRegistry.getCustomMaterial(materialID, FletchlingLeafMaterial.class);
if(mat == null)
return 0xffffff;
if (mat == null) TConstructRegistry.getCustomMaterial(materialID, FletchlingLeafMaterial.class);
if (mat == null) return 0xffffff;
return mat.color;
}
@@ -150,10 +131,9 @@ public class ArrowAmmo extends AmmoItem {
@Override
public String getAbilityNameForType(int type, int part) {
// blaze shaft?
if(part == 1 && type == 3)
return "\u00a76" + StatCollector.translateToLocal("modifier.tool.blaze");
if(part >= 1) // only head has ability otherwise
return "";
if (part == 1 && type == 3) return "\u00a76" + StatCollector.translateToLocal("modifier.tool.blaze");
if (part >= 1) // only head has ability otherwise
return "";
return super.getAbilityNameForType(type, part);
}
}
@@ -1,18 +1,17 @@
package tconstruct.weaponry.ammo;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.tools.CustomMaterial;
import tconstruct.library.tools.FletchingMaterial;
import tconstruct.library.tools.FletchlingLeafMaterial;
import tconstruct.tools.TinkerTools;
import tconstruct.weaponry.TinkerWeaponry;
import tconstruct.library.tools.DualMaterialToolPart;
import tconstruct.library.weaponry.AmmoItem;
import java.util.List;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.ToolBuilder;
import java.util.List;
import tconstruct.library.tools.CustomMaterial;
import tconstruct.library.tools.DualMaterialToolPart;
import tconstruct.library.tools.FletchingMaterial;
import tconstruct.library.tools.FletchlingLeafMaterial;
import tconstruct.library.weaponry.AmmoItem;
import tconstruct.tools.TinkerTools;
import tconstruct.weaponry.TinkerWeaponry;
public class BoltAmmo extends AmmoItem {
public BoltAmmo() {
@@ -21,8 +20,7 @@ public class BoltAmmo extends AmmoItem {
@Override
public String getIconSuffix(int partType) {
switch (partType)
{
switch (partType) {
case 0:
return "_bolt_head";
case 1:
@@ -47,15 +45,13 @@ public class BoltAmmo extends AmmoItem {
}
@Override
public void registerPartPaths (int index, String[] location)
{
public void registerPartPaths(int index, String[] location) {
headStrings.put(index, location[0]);
handleStrings.put(index, location[2]);
}
@Override
public void registerAlternatePartPaths (int index, String[] location)
{
public void registerAlternatePartPaths(int index, String[] location) {
accessoryStrings.put(index, location[3]);
}
@@ -75,25 +71,22 @@ public class BoltAmmo extends AmmoItem {
}
@Override
public String[] getTraits ()
{
return new String[] { "ammo", "projectile", "weapon" };
public String[] getTraits() {
return new String[] {"ammo", "projectile", "weapon"};
}
@Override
public void buildTool (int id, String name, List list)
{
if(TConstructRegistry.getArrowMaterial(id) == null)
return;
public void buildTool(int id, String name, List list) {
if (TConstructRegistry.getArrowMaterial(id) == null) return;
// dual material head: we use wooden shafts
ItemStack headStack = DualMaterialToolPart.createDualMaterial(getHeadItem(), id, TinkerTools.MaterialID.Iron); // material shaft
ItemStack headStack = DualMaterialToolPart.createDualMaterial(
getHeadItem(), id, TinkerTools.MaterialID.Iron); // material shaft
ItemStack handleStack = new ItemStack(getAccessoryItem(), 1, 0); // feather Fletchling
//ItemStack accessoryStack = new ItemStack(getAccessoryItem(), 1, 0); // feather fletchling
// ItemStack accessoryStack = new ItemStack(getAccessoryItem(), 1, 0); // feather fletchling
ItemStack tool = ToolBuilder.instance.buildTool(headStack, handleStack, null, null, "");
if (tool != null)
{
if (tool != null) {
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
list.add(tool);
}
@@ -101,14 +94,11 @@ public class BoltAmmo extends AmmoItem {
@Override
protected int getDefaultColor(int renderPass, int materialID) {
if(renderPass != 2)
return super.getDefaultColor(renderPass, materialID);
if (renderPass != 2) return super.getDefaultColor(renderPass, materialID);
CustomMaterial mat = TConstructRegistry.getCustomMaterial(materialID, FletchingMaterial.class);
if(mat == null)
mat = TConstructRegistry.getCustomMaterial(materialID, FletchlingLeafMaterial.class);
if(mat == null)
return 0xffffff;
if (mat == null) mat = TConstructRegistry.getCustomMaterial(materialID, FletchlingLeafMaterial.class);
if (mat == null) return 0xffffff;
return mat.color;
}
@@ -116,8 +106,8 @@ public class BoltAmmo extends AmmoItem {
// fix tooltip custom materials
@Override
public String getAbilityNameForType(int type, int part) {
if(part >= 2) // only head and handle have ability
return "";
if (part >= 2) // only head and handle have ability
return "";
return super.getAbilityNameForType(type, part);
}
}