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

@@ -6,24 +6,20 @@ import net.minecraftforge.fluids.FluidStack;
import tconstruct.library.client.FluidRenderProperties;
/* Melting becomes hardened */
public class LiquidCasting
{
public class LiquidCasting {
// public static LiquidCasting instance = new LiquidCasting();
private final ArrayList<CastingRecipe> casts = new ArrayList<CastingRecipe>();
private boolean contains (CastingRecipe recipe)
{
for (CastingRecipe c : casts)
{
if (c.matches(recipe.castingMetal, recipe.cast))
return true;
private boolean contains(CastingRecipe recipe) {
for (CastingRecipe c : casts) {
if (c.matches(recipe.castingMetal, recipe.cast)) return true;
}
return false;
}
/**
* Adds a casting recipe
*
*
* @param output
* Result of the cast
* @param metal
@@ -38,16 +34,20 @@ public class LiquidCasting
* @param props
* The rendering properties for the casting fluid (may be null)
*/
public void addCastingRecipe (ItemStack output, FluidStack metal, ItemStack cast, boolean consume, int delay, FluidRenderProperties props)
{
public void addCastingRecipe(
ItemStack output,
FluidStack metal,
ItemStack cast,
boolean consume,
int delay,
FluidRenderProperties props) {
CastingRecipe cr = new CastingRecipe(output, metal, cast, consume, delay, props);
if (!contains(cr))
casts.add(cr);
if (!contains(cr)) casts.add(cr);
}
/**
* Adds a casting recipe
*
*
* @param output
* Result of the cast
* @param metal
@@ -60,14 +60,13 @@ public class LiquidCasting
* @param delay
* Time to cast in ticks
*/
public void addCastingRecipe (ItemStack output, FluidStack metal, ItemStack cast, boolean consume, int delay)
{
public void addCastingRecipe(ItemStack output, FluidStack metal, ItemStack cast, boolean consume, int delay) {
addCastingRecipe(output, metal, cast, consume, delay, null);
}
/**
* Adds a casting recipe. Does not consume the cast
*
*
* @param output
* Result of the cast
* @param metal
@@ -80,14 +79,14 @@ public class LiquidCasting
* @param props
* The rendering properties for the casting fluid (may be null)
*/
public void addCastingRecipe (ItemStack output, FluidStack metal, ItemStack cast, int delay, FluidRenderProperties props)
{
public void addCastingRecipe(
ItemStack output, FluidStack metal, ItemStack cast, int delay, FluidRenderProperties props) {
addCastingRecipe(output, metal, cast, false, delay, props);
}
/**
* Adds a casting recipe. Does not consume the cast
*
*
* @param output
* Result of the cast
* @param metal
@@ -98,15 +97,14 @@ public class LiquidCasting
* @param delay
* Time to cast in ticks
*/
public void addCastingRecipe (ItemStack output, FluidStack metal, ItemStack cast, int delay)
{
public void addCastingRecipe(ItemStack output, FluidStack metal, ItemStack cast, int delay) {
addCastingRecipe(output, metal, cast, false, delay, null);
}
/**
* Adds a casting recipe. Does not consume the cast or have an item to cast
* against
*
*
* @param output
* Result of the cast
* @param metal
@@ -117,15 +115,14 @@ public class LiquidCasting
* @param props
* The rendering properties for the casting fluid (may be null)
*/
public void addCastingRecipe (ItemStack output, FluidStack metal, int delay, FluidRenderProperties props)
{
public void addCastingRecipe(ItemStack output, FluidStack metal, int delay, FluidRenderProperties props) {
addCastingRecipe(output, metal, null, false, delay, props);
}
/**
* Adds a casting recipe. Does not consume the cast or have an item to cast
* against
*
*
* @param output
* Result of the cast
* @param metal
@@ -134,45 +131,35 @@ public class LiquidCasting
* @param delay
* Time to cast in ticks
*/
public void addCastingRecipe (ItemStack output, FluidStack metal, int delay)
{
public void addCastingRecipe(ItemStack output, FluidStack metal, int delay) {
addCastingRecipe(output, metal, null, false, delay, null);
}
public void addCustomCastingRecipe (CastingRecipe recipe)
{
public void addCustomCastingRecipe(CastingRecipe recipe) {
casts.add(recipe);
}
public int getCastingDelay (FluidStack metal, ItemStack cast)
{
public int getCastingDelay(FluidStack metal, ItemStack cast) {
CastingRecipe recipe = getCastingRecipe(metal, cast);
if (recipe != null)
return recipe.coolTime;
if (recipe != null) return recipe.coolTime;
return -1;
}
public int getCastingAmount (FluidStack metal, ItemStack cast)
{
public int getCastingAmount(FluidStack metal, ItemStack cast) {
CastingRecipe recipe = getCastingRecipe(metal, cast);
if (recipe != null)
return recipe.castingMetal.amount;
if (recipe != null) return recipe.castingMetal.amount;
return 0;
}
public CastingRecipe getCastingRecipe (FluidStack metal, ItemStack cast)
{
for (CastingRecipe recipe : casts)
{
if (recipe.matches(metal, cast))
return recipe;
public CastingRecipe getCastingRecipe(FluidStack metal, ItemStack cast) {
for (CastingRecipe recipe : casts) {
if (recipe.matches(metal, cast)) return recipe;
}
return null;
}
// Getter for public viewing
public ArrayList<CastingRecipe> getCastingRecipes ()
{
public ArrayList<CastingRecipe> getCastingRecipes() {
return casts;
}
}
}