mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 03:49:29 +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,46 +1,36 @@
|
||||
package tconstruct.plugins.nei;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.library.crafting.AlloyMix;
|
||||
import tconstruct.library.crafting.Smeltery;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.PositionedStack;
|
||||
|
||||
public class RecipeHandlerAlloying extends RecipeHandlerBase
|
||||
{
|
||||
public class RecipeHandlerAlloying extends RecipeHandlerBase {
|
||||
|
||||
public static final Rectangle OUTPUT_TANK = new Rectangle(118, 9, 18, 32);
|
||||
|
||||
public class CachedAlloyingRecipe extends CachedBaseRecipe
|
||||
{
|
||||
public class CachedAlloyingRecipe extends CachedBaseRecipe {
|
||||
private List<FluidTankElement> fluidTanks;
|
||||
private int minAmount;
|
||||
|
||||
public CachedAlloyingRecipe(AlloyMix recipe)
|
||||
{
|
||||
public CachedAlloyingRecipe(AlloyMix recipe) {
|
||||
this.fluidTanks = new ArrayList<FluidTankElement>();
|
||||
|
||||
int maxAmount = recipe.mixers.get(0).amount;
|
||||
int mult = 1;
|
||||
this.minAmount = maxAmount;
|
||||
for (FluidStack stack : recipe.mixers)
|
||||
{
|
||||
if (stack.amount > maxAmount)
|
||||
{
|
||||
for (FluidStack stack : recipe.mixers) {
|
||||
if (stack.amount > maxAmount) {
|
||||
maxAmount = stack.amount;
|
||||
}
|
||||
if (stack.amount < this.minAmount)
|
||||
{
|
||||
if (stack.amount < this.minAmount) {
|
||||
this.minAmount = stack.amount;
|
||||
}
|
||||
}
|
||||
@@ -50,15 +40,13 @@ public class RecipeHandlerAlloying extends RecipeHandlerBase
|
||||
|
||||
int width = 36 / recipe.mixers.size();
|
||||
int counter = 0;
|
||||
for (FluidStack stack : recipe.mixers)
|
||||
{
|
||||
if (counter == recipe.mixers.size() - 1)
|
||||
{
|
||||
tank = new FluidTankElement(new Rectangle(21 + width * counter, 9, 36 - width * counter, 32), maxAmount * mult, stack);
|
||||
}
|
||||
else
|
||||
{
|
||||
tank = new FluidTankElement(new Rectangle(21 + width * counter, 9, width, 32), maxAmount * mult, stack);
|
||||
for (FluidStack stack : recipe.mixers) {
|
||||
if (counter == recipe.mixers.size() - 1) {
|
||||
tank = new FluidTankElement(
|
||||
new Rectangle(21 + width * counter, 9, 36 - width * counter, 32), maxAmount * mult, stack);
|
||||
} else {
|
||||
tank = new FluidTankElement(
|
||||
new Rectangle(21 + width * counter, 9, width, 32), maxAmount * mult, stack);
|
||||
}
|
||||
tank.fluid.amount *= mult;
|
||||
this.fluidTanks.add(tank);
|
||||
@@ -67,102 +55,81 @@ public class RecipeHandlerAlloying extends RecipeHandlerBase
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getIngredient ()
|
||||
{
|
||||
public PositionedStack getIngredient() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult ()
|
||||
{
|
||||
public PositionedStack getResult() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidTankElement> getFluidTanks ()
|
||||
{
|
||||
public List<FluidTankElement> getFluidTanks() {
|
||||
return this.fluidTanks;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName ()
|
||||
{
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tconstruct.nei.alloying");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeID ()
|
||||
{
|
||||
public String getRecipeID() {
|
||||
return "tconstruct.smeltery.alloying";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture ()
|
||||
{
|
||||
public String getGuiTexture() {
|
||||
return "tinker:textures/gui/nei/smeltery.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects ()
|
||||
{
|
||||
this.transferRects.add(new RecipeTransferRect(new Rectangle(76, 21, 22, 15), this.getRecipeID(), new Object[0]));
|
||||
public void loadTransferRects() {
|
||||
this.transferRects.add(
|
||||
new RecipeTransferRect(new Rectangle(76, 21, 22, 15), this.getRecipeID(), new Object[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground (int recipe)
|
||||
{
|
||||
public void drawBackground(int recipe) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GuiDraw.changeTexture(this.getGuiTexture());
|
||||
GuiDraw.drawTexturedModalRect(0, 0, 0, 62, 160, 65);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes (String outputId, Object... results)
|
||||
{
|
||||
if (outputId.equals(this.getRecipeID()))
|
||||
{
|
||||
for (AlloyMix recipe : Smeltery.getAlloyList())
|
||||
{
|
||||
if (!recipe.mixers.isEmpty())
|
||||
{
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals(this.getRecipeID())) {
|
||||
for (AlloyMix recipe : Smeltery.getAlloyList()) {
|
||||
if (!recipe.mixers.isEmpty()) {
|
||||
this.arecipes.add(new CachedAlloyingRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes (FluidStack result)
|
||||
{
|
||||
for (AlloyMix recipe : Smeltery.getAlloyList())
|
||||
{
|
||||
if (areFluidsEqual(recipe.result, result) && !recipe.mixers.isEmpty())
|
||||
{
|
||||
public void loadCraftingRecipes(FluidStack result) {
|
||||
for (AlloyMix recipe : Smeltery.getAlloyList()) {
|
||||
if (areFluidsEqual(recipe.result, result) && !recipe.mixers.isEmpty()) {
|
||||
this.arecipes.add(new CachedAlloyingRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes (FluidStack ingredient)
|
||||
{
|
||||
for (Iterator<AlloyMix> i = Smeltery.getAlloyList().iterator(); i.hasNext();)
|
||||
{
|
||||
public void loadUsageRecipes(FluidStack ingredient) {
|
||||
for (Iterator<AlloyMix> i = Smeltery.getAlloyList().iterator(); i.hasNext(); ) {
|
||||
AlloyMix recipe = i.next();
|
||||
for (FluidStack liquid : recipe.mixers)
|
||||
{
|
||||
if (areFluidsEqual(liquid, ingredient) && !recipe.mixers.isEmpty())
|
||||
{
|
||||
for (FluidStack liquid : recipe.mixers) {
|
||||
if (areFluidsEqual(liquid, ingredient) && !recipe.mixers.isEmpty()) {
|
||||
this.arecipes.add(new CachedAlloyingRecipe(recipe));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user