Clean up floating flower handler and let it work with the inventory crafting grid

This commit is contained in:
koolkrafter5 committed 2026-03-20 18:25:07 -04:00
1 parent b4f98d7b7c
commit e150175b3d
1 file changed
+51 -46
@@ -17,65 +17,70 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
public class RecipeHandlerFloatingFlowers extends TemplateRecipeHandler {
public class CachedFloatingFlowerRecipe extends CachedRecipe {
public class CachedFloatingFlowerRecipe extends CachedRecipe {
public List<PositionedStack> inputs = new ArrayList<>();
public PositionedStack output;
public List<PositionedStack> inputs = new ArrayList<>();
public PositionedStack output;
public CachedFloatingFlowerRecipe(ItemStack floatingFlower, ItemStack specialFlower, ItemStack output) {
inputs.add(new PositionedStack(floatingFlower, 25, 6));
inputs.add(new PositionedStack(specialFlower, 43, 6));
this.output = new PositionedStack(output, 119, 24);
this.output.setMaxSize(1);
}
public CachedFloatingFlowerRecipe(ItemStack floatingFlower, ItemStack specialFlower, ItemStack output) {
inputs.add(new PositionedStack(floatingFlower, 25, 6));
inputs.add(new PositionedStack(specialFlower, 43, 6));
this.output = new PositionedStack(output, 119, 24);
this.output.setMaxSize(1);
}
@Override
public List<PositionedStack> getIngredients() {
return inputs;
}
@Override
public List<PositionedStack> getIngredients() {
return inputs;
}
@Override
public PositionedStack getResult() {
return output;
}
@Override
public PositionedStack getResult() {
return output;
}
}
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("botania.nei.floatingFlowers");
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("botania.nei.floatingFlowers");
public String getOverlayIdentifier() {
return "crafting2x2";
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
}
@Override
public String getGuiTexture() {
return "textures/gui/container/crafting_table.png";
}
@Override
public String getGuiTexture() {
return "textures/gui/container/crafting_table.png";
}
@Override
public void loadCraftingRecipes(ItemStack result) {
if(Block.getBlockFromItem(result.getItem()) instanceof BlockFloatingSpecialFlower) {
ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower, 1, OreDictionary.WILDCARD_VALUE);
ItemStack specialFlower = new ItemStack(ModBlocks.specialFlower);
specialFlower.setTagCompound((NBTTagCompound) result.getTagCompound().copy());
@Override
public void loadCraftingRecipes(ItemStack result) {
if (Block.getBlockFromItem(result.getItem()) instanceof BlockFloatingSpecialFlower) {
ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower, 1, OreDictionary.WILDCARD_VALUE);
ItemStack specialFlower = new ItemStack(ModBlocks.specialFlower);
specialFlower.setTagCompound((NBTTagCompound) result.getTagCompound().copy());
arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower, specialFlower, result.copy()));
}
}
arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower, specialFlower, result.copy()));
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
if(Block.getBlockFromItem(ingredient.getItem()) instanceof BlockSpecialFlower) {
ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower, 1, OreDictionary.WILDCARD_VALUE);
ItemStack result = new ItemStack(ModBlocks.floatingSpecialFlower);
result.setTagCompound((NBTTagCompound) ingredient.getTagCompound().copy());
@Override
public void loadUsageRecipes(ItemStack ingredient) {
if (Block.getBlockFromItem(ingredient.getItem()) instanceof BlockSpecialFlower) {
ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower, 1, OreDictionary.WILDCARD_VALUE);
ItemStack result = new ItemStack(ModBlocks.floatingSpecialFlower);
result.setTagCompound((NBTTagCompound) ingredient.getTagCompound().copy());
arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower, ingredient.copy(), result));
}
}
arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower, ingredient.copy(), result));
}
}
}