mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 11:19:19 +00:00
Client stuff, fix all JEI stuff
This commit is contained in:
26 files changed
+222
-329
No files matched your search
@@ -18,6 +18,7 @@ import java.util.TreeSet;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.util.NonNullList;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -50,7 +51,7 @@ public class CorporeaAutoCompleteHandler {
|
||||
public static void updateItemList() {
|
||||
itemNames.clear();
|
||||
Iterator<Item> iterator = Item.REGISTRY.iterator();
|
||||
ArrayList<ItemStack> curList = new ArrayList<>();
|
||||
NonNullList<ItemStack> curList = NonNullList.create();
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
Item item = iterator.next();
|
||||
|
||||
@@ -112,8 +112,8 @@ public final class ItemsRemainingRenderHandler {
|
||||
int count = 0;
|
||||
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = player.inventory.getStackInSlot(i);
|
||||
if(stack != null && pattern.matcher(stack.getUnlocalizedName()).find())
|
||||
count += stack.stackSize;
|
||||
if(!stack.isEmpty() && pattern.matcher(stack.getUnlocalizedName()).find())
|
||||
count += stack.getCount();
|
||||
}
|
||||
|
||||
set(displayStack, count);
|
||||
|
||||
@@ -152,7 +152,7 @@ public class FXSparkle extends Particle {
|
||||
motionY *= 0.908000001907348633D;
|
||||
motionZ *= 0.908000001907348633D;
|
||||
|
||||
if (isCollided) {
|
||||
if (onGround) {
|
||||
motionX *= 0.69999998807907104D;
|
||||
motionZ *= 0.69999998807907104D;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ContainerFlowerBag extends Container {
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
|
||||
ItemStack itemstack = null;
|
||||
ItemStack itemstack = ItemStack.EMPTY;
|
||||
Slot slot = inventorySlots.get(slotIndex);
|
||||
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
@@ -65,24 +65,24 @@ public class ContainerFlowerBag extends Container {
|
||||
|
||||
if(slotIndex < 16) {
|
||||
if(!mergeItemStack(itemstack1, 16, 52, true))
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
} else {
|
||||
int i = itemstack.getItemDamage();
|
||||
if(i < 16) {
|
||||
Slot slot1 = inventorySlots.get(i);
|
||||
if(slot1.isItemValid(itemstack) && !mergeItemStack(itemstack1, i, i + 1, true))
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
if(itemstack1.stackSize == 0)
|
||||
slot.putStack(null);
|
||||
if(itemstack1.isEmpty())
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
else slot.onSlotChanged();
|
||||
|
||||
if(itemstack1.stackSize == itemstack.stackSize)
|
||||
return null;
|
||||
if(itemstack1.getCount() == itemstack.getCount())
|
||||
return ItemStack.EMPTY;
|
||||
|
||||
slot.onPickupFromSlot(player, itemstack1);
|
||||
slot.onTake(player, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
|
||||
@@ -14,6 +14,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class InventoryFlowerBag implements IItemHandlerModifiable {
|
||||
|
||||
private final IItemHandlerModifiable bagInv;
|
||||
@@ -25,7 +27,7 @@ public class InventoryFlowerBag implements IItemHandlerModifiable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStackInSlot(int slot, ItemStack stack) {
|
||||
public void setStackInSlot(int slot, @Nonnull ItemStack stack) {
|
||||
bagInv.setStackInSlot(slot, stack);
|
||||
}
|
||||
|
||||
@@ -34,18 +36,26 @@ public class InventoryFlowerBag implements IItemHandlerModifiable {
|
||||
return bagInv.getSlots();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return bagInv.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
|
||||
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
|
||||
return bagInv.insertItem(slot, stack, simulate);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack extractItem(int slot, int amount, boolean simulate) {
|
||||
return bagInv.extractItem(slot, amount, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotLimit(int slot) {
|
||||
return bagInv.getSlotLimit(slot);
|
||||
}
|
||||
}
|
||||
@@ -23,10 +23,14 @@ import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
import vazkii.botania.api.mana.IManaItem;
|
||||
import vazkii.botania.client.gui.SlotLocked;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ContainerBaubleBox extends Container {
|
||||
|
||||
private final InventoryBaubleBox baubleBoxInv;
|
||||
@@ -80,15 +84,17 @@ public class ContainerBaubleBox extends Container {
|
||||
// TODO do we need anything here?
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void putStacksInSlots(ItemStack[] arr) {
|
||||
public void setAll(List<ItemStack> l) {
|
||||
baubles.setEventBlock(true);
|
||||
super.putStacksInSlots(arr);
|
||||
super.setAll(l);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
|
||||
ItemStack itemstack = null;
|
||||
ItemStack itemstack = ItemStack.EMPTY;
|
||||
Slot slot = inventorySlots.get(slotIndex);
|
||||
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
@@ -101,20 +107,20 @@ public class ContainerBaubleBox extends Container {
|
||||
|
||||
if(slotIndex < boxEnd) {
|
||||
if(!mergeItemStack(itemstack1, boxEnd, invEnd, true))
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
} else {
|
||||
if(itemstack1 != null && (itemstack1.getItem() instanceof IBauble || itemstack1.getItem() instanceof IManaItem) && !mergeItemStack(itemstack1, boxStart, boxEnd, false))
|
||||
return null;
|
||||
if(!itemstack1.isEmpty() && (itemstack1.getItem() instanceof IBauble || itemstack1.getItem() instanceof IManaItem) && !mergeItemStack(itemstack1, boxStart, boxEnd, false))
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if(itemstack1.stackSize == 0)
|
||||
slot.putStack(null);
|
||||
if(itemstack1.isEmpty())
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
else slot.onSlotChanged();
|
||||
|
||||
if(itemstack1.stackSize == itemstack.stackSize)
|
||||
return null;
|
||||
if(itemstack1.getCount() == itemstack.getCount())
|
||||
return ItemStack.EMPTY;
|
||||
|
||||
slot.onPickupFromSlot(player, itemstack1);
|
||||
slot.onTake(player, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
|
||||
@@ -14,6 +14,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class InventoryBaubleBox implements IItemHandlerModifiable {
|
||||
|
||||
private final IItemHandlerModifiable boxInv;
|
||||
@@ -25,7 +27,7 @@ public class InventoryBaubleBox implements IItemHandlerModifiable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStackInSlot(int slot, ItemStack stack) {
|
||||
public void setStackInSlot(int slot, @Nonnull ItemStack stack) {
|
||||
boxInv.setStackInSlot(slot, stack);
|
||||
}
|
||||
|
||||
@@ -34,19 +36,27 @@ public class InventoryBaubleBox implements IItemHandlerModifiable {
|
||||
return boxInv.getSlots();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return boxInv.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
|
||||
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
|
||||
return boxInv.insertItem(slot, stack, simulate);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack extractItem(int slot, int amount, boolean simulate) {
|
||||
return boxInv.extractItem(slot, amount, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotLimit(int slot) {
|
||||
return boxInv.getSlotLimit(slot);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,7 +14,9 @@ import mezz.jei.api.IJeiHelpers;
|
||||
import mezz.jei.api.IJeiRuntime;
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.ISubtypeRegistry;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
import mezz.jei.api.ingredients.IModIngredientRegistration;
|
||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -41,13 +43,19 @@ import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
@JEIPlugin
|
||||
public class JEIBotaniaPlugin implements IModPlugin {
|
||||
|
||||
@Override
|
||||
public void registerItemSubtypes(@Nonnull ISubtypeRegistry subtypeRegistry) {
|
||||
subtypeRegistry.registerSubtypeInterpreter(Item.getItemFromBlock(ModBlocks.specialFlower), ItemBlockSpecialFlower::getType);
|
||||
subtypeRegistry.registerNbtInterpreter(Item.getItemFromBlock(ModBlocks.floatingSpecialFlower), ItemBlockSpecialFlower::getType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIngredients(@Nonnull IModIngredientRegistration registry) {}
|
||||
|
||||
@Override
|
||||
public void register(@Nonnull IModRegistry registry) {
|
||||
IJeiHelpers jeiHelpers = registry.getJeiHelpers();
|
||||
|
||||
jeiHelpers.getSubtypeRegistry().registerNbtInterpreter(Item.getItemFromBlock(ModBlocks.specialFlower), ItemBlockSpecialFlower::getType);
|
||||
jeiHelpers.getSubtypeRegistry().registerNbtInterpreter(Item.getItemFromBlock(ModBlocks.floatingSpecialFlower), ItemBlockSpecialFlower::getType);
|
||||
|
||||
registry.addRecipeCategories(
|
||||
new BreweryRecipeCategory(jeiHelpers.getGuiHelper()),
|
||||
new PureDaisyRecipeCategory(jeiHelpers.getGuiHelper()),
|
||||
|
||||
+15
-21
@@ -12,11 +12,13 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -54,45 +56,37 @@ public class BreweryRecipeCategory implements IRecipeCategory {
|
||||
return background;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IDrawable getIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(@Nonnull Minecraft minecraft) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(@Nonnull Minecraft minecraft) {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
if(!(recipeWrapper instanceof BreweryRecipeWrapper))
|
||||
return;
|
||||
BreweryRecipeWrapper wrapper = (BreweryRecipeWrapper) recipeWrapper;
|
||||
|
||||
List inputs = wrapper.getInputs();
|
||||
List<List<ItemStack>> inputs = ingredients.getInputs(ItemStack.class);
|
||||
|
||||
recipeLayout.getItemStacks().init(0, true, 39, 41);
|
||||
if(inputs.get(0) instanceof ItemStack) {
|
||||
recipeLayout.getItemStacks().set(0, (ItemStack) inputs.get(0));
|
||||
} else {
|
||||
recipeLayout.getItemStacks().set(0, (Collection<ItemStack>) inputs.get(0));
|
||||
}
|
||||
recipeLayout.getItemStacks().set(0, inputs.get(0));
|
||||
|
||||
int index = 1, posX = 60;
|
||||
for(int i = 1; i < wrapper.getInputs().size(); i++) {
|
||||
Object o = wrapper.getInputs().get(i);
|
||||
for(int i = 1; i < inputs.size(); i++) {
|
||||
List<ItemStack> o = inputs.get(i);
|
||||
recipeLayout.getItemStacks().init(index, true, posX, 6);
|
||||
if(o instanceof ItemStack) {
|
||||
recipeLayout.getItemStacks().set(index, (ItemStack) o);
|
||||
} else if(o instanceof Collection) {
|
||||
recipeLayout.getItemStacks().set(index, (Collection<ItemStack>) o);
|
||||
}
|
||||
recipeLayout.getItemStacks().set(index, o);
|
||||
index++;
|
||||
posX += 18;
|
||||
}
|
||||
|
||||
recipeLayout.getItemStacks().init(7, false, 87, 41);
|
||||
recipeLayout.getItemStacks().set(7, wrapper.getOutputs());
|
||||
recipeLayout.getItemStacks().set(7, ingredients.getOutputs(ItemStack.class).get(0));
|
||||
}
|
||||
|
||||
}
|
||||
+1
-7
@@ -22,16 +22,10 @@ public class BreweryRecipeHandler implements IRecipeHandler<RecipeBrew> {
|
||||
return RecipeBrew.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid() {
|
||||
return "botania.brewery";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid(@Nonnull RecipeBrew recipe) { // o is erased type param
|
||||
return getRecipeCategoryUid();
|
||||
return "botania.brewery";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
+8
-23
@@ -14,6 +14,7 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -24,16 +25,16 @@ import vazkii.botania.common.item.ModItems;
|
||||
|
||||
public class BreweryRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
private final List input;
|
||||
private final List<List<ItemStack>> input;
|
||||
private final List<ItemStack> output;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public BreweryRecipeWrapper(RecipeBrew recipeBrew) {
|
||||
ImmutableList.Builder builder = ImmutableList.builder();
|
||||
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
|
||||
builder.add(ImmutableList.of(new ItemStack(ModItems.vial, 1, 0), new ItemStack(ModItems.vial, 1, 1)));
|
||||
for(Object o : recipeBrew.getInputs()) {
|
||||
if(o instanceof ItemStack) {
|
||||
builder.add(o);
|
||||
builder.add(ImmutableList.of((ItemStack) o));
|
||||
}
|
||||
if(o instanceof String) {
|
||||
builder.add(OreDictionary.getOres((String) o));
|
||||
@@ -45,33 +46,17 @@ public class BreweryRecipeWrapper implements IRecipeWrapper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs() {
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getOutputs() {
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs() {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidOutputs() {
|
||||
return ImmutableList.of();
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(ItemStack.class, input);
|
||||
ingredients.setOutputLists(ItemStack.class, ImmutableList.of(output));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY) {
|
||||
return ImmutableList.of();
|
||||
|
||||
+15
-15
@@ -9,9 +9,12 @@
|
||||
package vazkii.botania.client.integration.jei.elventrade;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
@@ -62,6 +65,12 @@ public class ElvenTradeRecipeCategory implements IRecipeCategory {
|
||||
return background;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IDrawable getIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(@Nonnull Minecraft minecraft) {
|
||||
GlStateManager.enableAlpha();
|
||||
@@ -69,10 +78,7 @@ public class ElvenTradeRecipeCategory implements IRecipeCategory {
|
||||
overlay.draw(minecraft, 0, 4);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableAlpha();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(@Nonnull Minecraft minecraft) {
|
||||
minecraft.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
TextureAtlasSprite sprite = MiscellaneousIcons.INSTANCE.alfPortalTex;
|
||||
Tessellator tess = Tessellator.getInstance();
|
||||
@@ -89,29 +95,23 @@ public class ElvenTradeRecipeCategory implements IRecipeCategory {
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
if(!(recipeWrapper instanceof ElvenTradeRecipeWrapper))
|
||||
return;
|
||||
ElvenTradeRecipeWrapper wrapper = (ElvenTradeRecipeWrapper) recipeWrapper;
|
||||
|
||||
int index = 0, posX = 42;
|
||||
for(Object o : wrapper.getInputs()) {
|
||||
for(List<ItemStack> o : ingredients.getInputs(ItemStack.class)) {
|
||||
recipeLayout.getItemStacks().init(index, true, posX, 0);
|
||||
if(o instanceof Collection) {
|
||||
recipeLayout.getItemStacks().set(index, (Collection<ItemStack>) o);
|
||||
} else {
|
||||
recipeLayout.getItemStacks().set(index, (ItemStack) o);
|
||||
}
|
||||
recipeLayout.getItemStacks().set(index, o);
|
||||
index++;
|
||||
posX += 18;
|
||||
}
|
||||
|
||||
for (int i = 0; i < wrapper.getOutputs().size(); i++) {
|
||||
ItemStack stack = wrapper.getOutputs().get(i);
|
||||
for (int i = 0; i < ingredients.getOutputs(ItemStack.class).size(); i++) {
|
||||
List<ItemStack> stacks = ingredients.getOutputs(ItemStack.class).get(i);
|
||||
recipeLayout.getItemStacks().init(index + i, false, 93 + i % 2 * 20, 41 + i / 2 * 20);
|
||||
recipeLayout.getItemStacks().set(index + i, stack);
|
||||
recipeLayout.getItemStacks().set(index + i, stacks);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-7
@@ -22,16 +22,10 @@ public class ElvenTradeRecipeHandler implements IRecipeHandler<RecipeElvenTrade>
|
||||
return RecipeElvenTrade.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid() {
|
||||
return "botania.elvenTrade";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid(@Nonnull RecipeElvenTrade recipe) { // o is erased type param
|
||||
return getRecipeCategoryUid();
|
||||
return "botania.elvenTrade";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
+9
-26
@@ -14,6 +14,7 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -23,15 +24,15 @@ import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
|
||||
public class ElvenTradeRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
private final List input;
|
||||
private final List<List<ItemStack>> input;
|
||||
private final List<ItemStack> outputs;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ElvenTradeRecipeWrapper(RecipeElvenTrade recipe) {
|
||||
ImmutableList.Builder builder = ImmutableList.builder();
|
||||
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
|
||||
for(Object o : recipe.getInputs()) {
|
||||
if(o instanceof ItemStack) {
|
||||
builder.add(o);
|
||||
builder.add(ImmutableList.of((ItemStack) o));
|
||||
}
|
||||
if(o instanceof String) {
|
||||
builder.add(OreDictionary.getOres((String) o));
|
||||
@@ -42,33 +43,15 @@ public class ElvenTradeRecipeWrapper implements IRecipeWrapper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs() {
|
||||
return input;
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(ItemStack.class, input);
|
||||
ingredients.setOutputs(ItemStack.class, outputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getOutputs() {
|
||||
return outputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs() {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidOutputs() {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
|
||||
}
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY) {
|
||||
return ImmutableList.of();
|
||||
|
||||
+13
-19
@@ -11,10 +11,12 @@ package vazkii.botania.client.integration.jei.manapool;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -59,6 +61,12 @@ public class ManaPoolRecipeCategory implements IRecipeCategory {
|
||||
return background;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IDrawable getIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(@Nonnull Minecraft minecraft) {
|
||||
GlStateManager.enableAlpha();
|
||||
@@ -69,31 +77,21 @@ public class ManaPoolRecipeCategory implements IRecipeCategory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(@Nonnull Minecraft minecraft) {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
if(!(recipeWrapper instanceof ManaPoolRecipeWrapper))
|
||||
return;
|
||||
|
||||
ManaPoolRecipeWrapper wrapper = (ManaPoolRecipeWrapper) recipeWrapper;
|
||||
int index = 0;
|
||||
|
||||
recipeLayout.getItemStacks().init(index, true, 40, 12);
|
||||
if(wrapper.getInputs().get(0) instanceof Collection) {
|
||||
recipeLayout.getItemStacks().set(index, (Collection<ItemStack>) wrapper.getInputs().get(0));
|
||||
} else {
|
||||
recipeLayout.getItemStacks().set(index, (ItemStack) wrapper.getInputs().get(0));
|
||||
}
|
||||
recipeLayout.getItemStacks().set(index, ingredients.getInputs(ItemStack.class).get(0));
|
||||
|
||||
index++;
|
||||
|
||||
if(wrapper.getInputs().size() > 1) {
|
||||
if(ingredients.getInputs(ItemStack.class).size() > 1) {
|
||||
// Has catalyst
|
||||
recipeLayout.getItemStacks().init(index, true, 20, 12);
|
||||
recipeLayout.getItemStacks().set(index, (ItemStack) wrapper.getInputs().get(1));
|
||||
recipeLayout.getItemStacks().set(index, ingredients.getInputs(ItemStack.class).get(1));
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -102,11 +100,7 @@ public class ManaPoolRecipeCategory implements IRecipeCategory {
|
||||
index++;
|
||||
|
||||
recipeLayout.getItemStacks().init(index, false, 99, 12);
|
||||
if(wrapper.getOutputs().get(0) instanceof Collection) {
|
||||
recipeLayout.getItemStacks().set(index, (Collection<ItemStack>) wrapper.getOutputs().get(0));
|
||||
} else {
|
||||
recipeLayout.getItemStacks().set(index, (ItemStack) wrapper.getOutputs().get(0));
|
||||
}
|
||||
recipeLayout.getItemStacks().set(index, ingredients.getOutputs(ItemStack.class).get(0));
|
||||
}
|
||||
|
||||
}
|
||||
+1
-7
@@ -22,16 +22,10 @@ public class ManaPoolRecipeHandler implements IRecipeHandler<RecipeManaInfusion>
|
||||
return RecipeManaInfusion.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid() {
|
||||
return "botania.manaPool";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid(@Nonnull RecipeManaInfusion recipe) { // o is erased type param
|
||||
return getRecipeCategoryUid();
|
||||
return "botania.manaPool";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
+9
-26
@@ -15,6 +15,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -29,15 +30,15 @@ import vazkii.botania.common.block.tile.mana.TilePool;
|
||||
|
||||
public class ManaPoolRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
private final List input;
|
||||
private final List<List<ItemStack>> input;
|
||||
private final ItemStack output;
|
||||
private final int mana;
|
||||
|
||||
public ManaPoolRecipeWrapper(RecipeManaInfusion recipe) {
|
||||
ImmutableList.Builder<Object> builder = ImmutableList.builder();
|
||||
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
|
||||
|
||||
if(recipe.getInput() instanceof ItemStack) {
|
||||
builder.add(recipe.getInput());
|
||||
builder.add(ImmutableList.of((ItemStack) recipe.getInput()));
|
||||
} else if(recipe.getInput() instanceof String) {
|
||||
builder.add(OreDictionary.getOres((String) recipe.getInput()));
|
||||
}
|
||||
@@ -45,7 +46,7 @@ public class ManaPoolRecipeWrapper implements IRecipeWrapper {
|
||||
if(recipe.getCatalyst() != null) {
|
||||
Block block = recipe.getCatalyst().getBlock();
|
||||
if (Item.getItemFromBlock(block) != null) {
|
||||
builder.add(new ItemStack(block, 1, block.getMetaFromState(recipe.getCatalyst())));
|
||||
builder.add(ImmutableList.of(new ItemStack(block, 1, block.getMetaFromState(recipe.getCatalyst()))));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,23 +56,9 @@ public class ManaPoolRecipeWrapper implements IRecipeWrapper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs() {
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getOutputs() {
|
||||
return ImmutableList.of(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs() {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidOutputs() {
|
||||
return ImmutableList.of();
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(ItemStack.class, input);
|
||||
ingredients.setOutput(ItemStack.class, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,11 +68,7 @@ public class ManaPoolRecipeWrapper implements IRecipeWrapper {
|
||||
GlStateManager.disableAlpha();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY) {
|
||||
return ImmutableList.of();
|
||||
|
||||
+14
-16
@@ -10,13 +10,16 @@ package vazkii.botania.client.integration.jei.petalapothecary;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -58,6 +61,12 @@ public class PetalApothecaryRecipeCategory implements IRecipeCategory {
|
||||
return background;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IDrawable getIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(@Nonnull Minecraft minecraft) {
|
||||
GlStateManager.enableAlpha();
|
||||
@@ -68,37 +77,26 @@ public class PetalApothecaryRecipeCategory implements IRecipeCategory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(@Nonnull Minecraft minecraft) {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
if(!(recipeWrapper instanceof PetalApothecaryRecipeWrapper))
|
||||
return;
|
||||
PetalApothecaryRecipeWrapper wrapper = (PetalApothecaryRecipeWrapper) recipeWrapper;
|
||||
|
||||
recipeLayout.getItemStacks().init(0, true, 64, 52);
|
||||
recipeLayout.getItemStacks().set(0, new ItemStack(ModBlocks.altar));
|
||||
|
||||
int index = 1;
|
||||
double angleBetweenEach = 360.0 / wrapper.getInputs().size();
|
||||
double angleBetweenEach = 360.0 / ingredients.getInputs(ItemStack.class).size();
|
||||
Point point = new Point(64, 20), center = new Point(64, 52);
|
||||
|
||||
for(Object o : wrapper.getInputs()) {
|
||||
for(List<ItemStack> o : ingredients.getInputs(ItemStack.class)) {
|
||||
recipeLayout.getItemStacks().init(index, true, point.x, point.y);
|
||||
if(o instanceof Collection) {
|
||||
recipeLayout.getItemStacks().set(index, (Collection<ItemStack>) o);
|
||||
}
|
||||
if(o instanceof ItemStack) {
|
||||
recipeLayout.getItemStacks().set(index, (ItemStack) o);
|
||||
}
|
||||
recipeLayout.getItemStacks().set(index, o);
|
||||
index += 1;
|
||||
point = rotatePointAbout(point, center, angleBetweenEach);
|
||||
}
|
||||
|
||||
recipeLayout.getItemStacks().init(index, false, 103, 17);
|
||||
recipeLayout.getItemStacks().set(index, wrapper.getOutputs().get(0));
|
||||
recipeLayout.getItemStacks().set(index, ingredients.getOutputs(ItemStack.class).get(0));
|
||||
}
|
||||
|
||||
private Point rotatePointAbout(Point in, Point about, double degrees) {
|
||||
|
||||
+1
-7
@@ -22,16 +22,10 @@ public class PetalApothecaryRecipeHandler implements IRecipeHandler<RecipePetals
|
||||
return RecipePetals.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid() {
|
||||
return "botania.petals";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid(@Nonnull RecipePetals recipe) { // o is erased type param
|
||||
return getRecipeCategoryUid();
|
||||
return "botania.petals";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
+8
-24
@@ -14,6 +14,7 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -23,14 +24,14 @@ import vazkii.botania.api.recipe.RecipePetals;
|
||||
|
||||
public class PetalApothecaryRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
private final List input;
|
||||
private final List<List<ItemStack>> input;
|
||||
private final ItemStack output;
|
||||
|
||||
public PetalApothecaryRecipeWrapper(RecipePetals recipe) {
|
||||
ImmutableList.Builder<Object> builder = ImmutableList.builder();
|
||||
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
|
||||
for(Object o : recipe.getInputs()) {
|
||||
if(o instanceof ItemStack) {
|
||||
builder.add(o);
|
||||
builder.add(ImmutableList.of((ItemStack) o));
|
||||
}
|
||||
if(o instanceof String) {
|
||||
builder.add(OreDictionary.getOres((String) o));
|
||||
@@ -41,33 +42,16 @@ public class PetalApothecaryRecipeWrapper implements IRecipeWrapper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs() {
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getOutputs() {
|
||||
return ImmutableList.of(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs() {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidOutputs() {
|
||||
return ImmutableList.of();
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(ItemStack.class, input);
|
||||
ingredients.setOutput(ItemStack.class, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY) {
|
||||
return ImmutableList.of();
|
||||
|
||||
+16
-22
@@ -11,10 +11,12 @@ package vazkii.botania.client.integration.jei.puredaisy;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -22,6 +24,7 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
@@ -57,6 +60,12 @@ public class PureDaisyRecipeCategory implements IRecipeCategory {
|
||||
return background;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IDrawable getIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(@Nonnull Minecraft minecraft) {
|
||||
GlStateManager.enableAlpha();
|
||||
@@ -67,30 +76,19 @@ public class PureDaisyRecipeCategory implements IRecipeCategory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(@Nonnull Minecraft minecraft) {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
if(!(recipeWrapper instanceof PureDaisyRecipeWrapper))
|
||||
return;
|
||||
|
||||
PureDaisyRecipeWrapper wrapper = (PureDaisyRecipeWrapper) recipeWrapper;
|
||||
boolean inputFluid = wrapper.getInputs().isEmpty();
|
||||
boolean outputFluid = wrapper.getOutputs().isEmpty();
|
||||
|
||||
boolean inputFluid = !ingredients.getInputs(FluidStack.class).isEmpty();
|
||||
boolean outputFluid = !ingredients.getOutputs(FluidStack.class).isEmpty();
|
||||
|
||||
if(inputFluid) {
|
||||
recipeLayout.getFluidStacks().init(0, true, 40, 12, 16, 16, 1000, false, null);
|
||||
recipeLayout.getFluidStacks().set(0, wrapper.getFluidInputs().get(0));
|
||||
recipeLayout.getFluidStacks().set(0, ingredients.getInputs(FluidStack.class).get(0));
|
||||
} else {
|
||||
recipeLayout.getItemStacks().init(0, true, 40, 12);
|
||||
if(wrapper.getInputs().get(0) instanceof Collection) {
|
||||
recipeLayout.getItemStacks().set(0, (Collection<ItemStack>) wrapper.getInputs().get(0));
|
||||
} else {
|
||||
recipeLayout.getItemStacks().set(0, (ItemStack) wrapper.getInputs().get(0));
|
||||
}
|
||||
recipeLayout.getItemStacks().set(0, ingredients.getInputs(ItemStack.class).get(0));
|
||||
}
|
||||
|
||||
recipeLayout.getItemStacks().init(1, true, 70, 12);
|
||||
@@ -98,14 +96,10 @@ public class PureDaisyRecipeCategory implements IRecipeCategory {
|
||||
|
||||
if(outputFluid) {
|
||||
recipeLayout.getFluidStacks().init(2, false, 99, 12, 16, 16, 1000, false, null);
|
||||
recipeLayout.getFluidStacks().set(2, wrapper.getFluidOutputs().get(0));
|
||||
recipeLayout.getFluidStacks().set(2, ingredients.getOutputs(FluidStack.class).get(0));
|
||||
} else {
|
||||
recipeLayout.getItemStacks().init(2, false, 99, 12);
|
||||
if(wrapper.getOutputs().get(0) instanceof Collection) {
|
||||
recipeLayout.getItemStacks().set(2, (Collection<ItemStack>) wrapper.getOutputs().get(0));
|
||||
} else {
|
||||
recipeLayout.getItemStacks().set(2, (ItemStack) wrapper.getOutputs().get(0));
|
||||
}
|
||||
recipeLayout.getItemStacks().set(2, ingredients.getOutputs(ItemStack.class).get(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-7
@@ -22,16 +22,10 @@ public class PureDaisyRecipeHandler implements IRecipeHandler<RecipePureDaisy> {
|
||||
return RecipePureDaisy.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid() {
|
||||
return "botania.pureDaisy";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid(@Nonnull RecipePureDaisy recipe) { // o is erased type param
|
||||
return getRecipeCategoryUid();
|
||||
return "botania.pureDaisy";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
+21
-26
@@ -14,6 +14,7 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -25,18 +26,18 @@ import vazkii.botania.api.recipe.RecipePureDaisy;
|
||||
|
||||
public class PureDaisyRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
private List inputs = ImmutableList.of();
|
||||
private List outputs = ImmutableList.of();
|
||||
private List<FluidStack> fluidInputs = ImmutableList.of();
|
||||
private List<FluidStack> fluidOutputs = ImmutableList.of();
|
||||
private List<ItemStack> inputs = ImmutableList.of();
|
||||
private ItemStack output = ItemStack.EMPTY;
|
||||
private FluidStack fluidInput = null;
|
||||
private FluidStack fluidOutput = null;
|
||||
|
||||
public PureDaisyRecipeWrapper(RecipePureDaisy recipe) {
|
||||
if(recipe.getInput() instanceof String) {
|
||||
inputs = ImmutableList.of(OreDictionary.getOres((String) recipe.getInput()));
|
||||
inputs = ImmutableList.copyOf(OreDictionary.getOres((String) recipe.getInput()));
|
||||
} else if(recipe.getInput() instanceof Block) {
|
||||
Block b = (Block) recipe.getInput();
|
||||
if(FluidRegistry.lookupFluidForBlock(b) != null) {
|
||||
fluidInputs = ImmutableList.of(new FluidStack(FluidRegistry.lookupFluidForBlock(b), 1000));
|
||||
fluidInput = new FluidStack(FluidRegistry.lookupFluidForBlock(b), 1000);
|
||||
} else {
|
||||
inputs = ImmutableList.of(new ItemStack(b, 1, b.getMetaFromState(b.getDefaultState())));
|
||||
}
|
||||
@@ -44,40 +45,34 @@ public class PureDaisyRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
Block outBlock = recipe.getOutputState().getBlock();
|
||||
if(FluidRegistry.lookupFluidForBlock(outBlock) != null) {
|
||||
fluidOutputs = ImmutableList.of(new FluidStack(FluidRegistry.lookupFluidForBlock(outBlock), 1000));
|
||||
fluidOutput = new FluidStack(FluidRegistry.lookupFluidForBlock(outBlock), 1000);
|
||||
} else {
|
||||
outputs = ImmutableList.of(new ItemStack(outBlock, 1, outBlock.getMetaFromState(recipe.getOutputState())));
|
||||
output = new ItemStack(outBlock, 1, outBlock.getMetaFromState(recipe.getOutputState()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs() {
|
||||
return inputs;
|
||||
}
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputs(ItemStack.class, inputs);
|
||||
|
||||
@Override
|
||||
public List getOutputs() {
|
||||
return outputs;
|
||||
}
|
||||
if (fluidInput != null) {
|
||||
ingredients.setInput(FluidStack.class, fluidInput);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs() {
|
||||
return fluidInputs;
|
||||
}
|
||||
if (!output.isEmpty()) {
|
||||
ingredients.setOutput(ItemStack.class, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidOutputs() {
|
||||
return fluidOutputs;
|
||||
if (fluidOutput != null) {
|
||||
ingredients.setOutput(FluidStack.class, fluidOutput);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY) {
|
||||
return ImmutableList.of();
|
||||
|
||||
+15
-15
@@ -10,12 +10,15 @@ package vazkii.botania.client.integration.jei.runicaltar;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -57,6 +60,12 @@ public class RunicAltarRecipeCategory implements IRecipeCategory {
|
||||
return background;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IDrawable getIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(@Nonnull Minecraft minecraft) {
|
||||
GlStateManager.enableAlpha();
|
||||
@@ -67,12 +76,7 @@ public class RunicAltarRecipeCategory implements IRecipeCategory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(@Nonnull Minecraft minecraft) {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
if(!(recipeWrapper instanceof RunicAltarRecipeWrapper))
|
||||
return;
|
||||
RunicAltarRecipeWrapper wrapper = (RunicAltarRecipeWrapper) recipeWrapper;
|
||||
@@ -81,23 +85,19 @@ public class RunicAltarRecipeCategory implements IRecipeCategory {
|
||||
recipeLayout.getItemStacks().set(0, new ItemStack(ModBlocks.runeAltar));
|
||||
|
||||
int index = 1;
|
||||
double angleBetweenEach = 360.0 / wrapper.getInputs().size();
|
||||
double angleBetweenEach = 360.0 / ingredients.getInputs(ItemStack.class).size();
|
||||
Point point = new Point(64, 20), center = new Point(64, 52);
|
||||
|
||||
for(Object o : wrapper.getInputs()) {
|
||||
for(List<ItemStack> o : ingredients.getInputs(ItemStack.class)) {
|
||||
recipeLayout.getItemStacks().init(index, true, point.x, point.y);
|
||||
if(o instanceof Collection) {
|
||||
recipeLayout.getItemStacks().set(index, (Collection<ItemStack>) o);
|
||||
}
|
||||
if(o instanceof ItemStack) {
|
||||
recipeLayout.getItemStacks().set(index, (ItemStack) o);
|
||||
}
|
||||
recipeLayout.getItemStacks().set(index, o);
|
||||
index += 1;
|
||||
point = rotatePointAbout(point, center, angleBetweenEach);
|
||||
}
|
||||
|
||||
recipeLayout.getItemStacks().init(index, false, 103, 17);
|
||||
recipeLayout.getItemStacks().set(index, wrapper.getOutputs().get(0));
|
||||
recipeLayout.getItemStacks().set(index, ingredients.getOutputs(ItemStack.class).get(0));
|
||||
|
||||
}
|
||||
|
||||
private Point rotatePointAbout(Point in, Point about, double degrees) {
|
||||
|
||||
+1
-7
@@ -22,16 +22,10 @@ public class RunicAltarRecipeHandler implements IRecipeHandler<RecipeRuneAltar>
|
||||
return RecipeRuneAltar.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid() {
|
||||
return "botania.runicAltar";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid(@Nonnull RecipeRuneAltar recipe) { // o is erased type param
|
||||
return getRecipeCategoryUid();
|
||||
return "botania.runicAltar";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
+8
-24
@@ -14,6 +14,7 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
@@ -26,16 +27,16 @@ import vazkii.botania.common.block.tile.mana.TilePool;
|
||||
|
||||
public class RunicAltarRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
private final List input;
|
||||
private final List<List<ItemStack>> input;
|
||||
private final ItemStack output;
|
||||
private final int manaUsage;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public RunicAltarRecipeWrapper(RecipeRuneAltar recipe) {
|
||||
ImmutableList.Builder builder = ImmutableList.builder();
|
||||
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
|
||||
for(Object o : recipe.getInputs()) {
|
||||
if(o instanceof ItemStack) {
|
||||
builder.add(o);
|
||||
builder.add(ImmutableList.of((ItemStack) o));
|
||||
}
|
||||
if(o instanceof String) {
|
||||
builder.add(OreDictionary.getOres((String) o));
|
||||
@@ -47,23 +48,9 @@ public class RunicAltarRecipeWrapper implements IRecipeWrapper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs() {
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getOutputs() {
|
||||
return ImmutableList.of(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs() {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidOutputs() {
|
||||
return ImmutableList.of();
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(ItemStack.class, input);
|
||||
ingredients.setOutput(ItemStack.class, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,10 +60,7 @@ public class RunicAltarRecipeWrapper implements IRecipeWrapper {
|
||||
GlStateManager.disableAlpha();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY) {
|
||||
return ImmutableList.of();
|
||||
|
||||
Reference in new issue
Block a user