Reimplement JEI ghost ingredient handler but leave it disabled since it's still broken
This commit is contained in:
@@ -1,40 +1,35 @@
|
|||||||
package com.raoulvdberge.refinedstorage.integration.jei;
|
package com.raoulvdberge.refinedstorage.integration.jei;
|
||||||
/*
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.container.slot.filter.FilterSlot;
|
||||||
import com.raoulvdberge.refinedstorage.container.slot.filter.SlotFilter;
|
import com.raoulvdberge.refinedstorage.container.slot.filter.FluidFilterSlot;
|
||||||
import com.raoulvdberge.refinedstorage.container.slot.filter.SlotFilterFluid;
|
import com.raoulvdberge.refinedstorage.container.slot.legacy.LegacyFilterSlot;
|
||||||
import com.raoulvdberge.refinedstorage.container.slot.legacy.SlotLegacyFilter;
|
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
||||||
import com.raoulvdberge.refinedstorage.gui.GuiBase;
|
import mezz.jei.api.gui.handlers.IGhostIngredientHandler;
|
||||||
import com.raoulvdberge.refinedstorage.network.MessageSlotFilterSet;
|
import net.minecraft.client.renderer.Rectangle2d;
|
||||||
import com.raoulvdberge.refinedstorage.network.MessageSlotFilterSetFluid;
|
import net.minecraft.inventory.container.Slot;
|
||||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
|
||||||
import mezz.jei.api.gui.IGhostIngredientHandler;
|
|
||||||
import net.minecraft.inventory.Slot;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class GhostIngredientHandler implements IGhostIngredientHandler<GuiBase> {
|
public class GhostIngredientHandler implements IGhostIngredientHandler<BaseScreen> {
|
||||||
@Override
|
@Override
|
||||||
public <I> List<Target<I>> getTargets(GuiBase gui, I ingredient, boolean doStart) {
|
public <I> List<Target<I>> getTargets(BaseScreen gui, I ingredient, boolean doStart) {
|
||||||
List<Target<I>> targets = new ArrayList<>();
|
List<Target<I>> targets = new ArrayList<>();
|
||||||
|
|
||||||
for (Slot slot : gui.inventorySlots.inventorySlots) {
|
for (Slot slot : gui.getContainer().inventorySlots) {
|
||||||
if (!slot.isEnabled()) {
|
if (!slot.isEnabled()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle bounds = new Rectangle(gui.getGuiLeft() + slot.xPos, gui.getGuiTop() + slot.yPos, 17, 17);
|
Rectangle2d bounds = new Rectangle2d(gui.getGuiLeft() + slot.xPos, gui.getGuiTop() + slot.yPos, 17, 17);
|
||||||
|
|
||||||
if (ingredient instanceof ItemStack) {
|
if (ingredient instanceof ItemStack) {
|
||||||
if (slot instanceof SlotLegacyFilter || slot instanceof SlotFilter) {
|
if (slot instanceof LegacyFilterSlot || slot instanceof FilterSlot) {
|
||||||
targets.add(new Target<I>() {
|
targets.add(new Target<I>() {
|
||||||
@Override
|
@Override
|
||||||
public Rectangle getArea() {
|
public Rectangle2d getArea() {
|
||||||
return bounds;
|
return bounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,21 +37,21 @@ public class GhostIngredientHandler implements IGhostIngredientHandler<GuiBase>
|
|||||||
public void accept(I ingredient) {
|
public void accept(I ingredient) {
|
||||||
slot.putStack((ItemStack) ingredient);
|
slot.putStack((ItemStack) ingredient);
|
||||||
|
|
||||||
RS.INSTANCE.network.sendToServer(new MessageSlotFilterSet(slot.slotNumber, (ItemStack) ingredient));
|
// TODO RS.INSTANCE.network.sendToServer(new MessageSlotFilterSet(slot.slotNumber, (ItemStack) ingredient));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (ingredient instanceof FluidStack) {
|
} else if (ingredient instanceof FluidStack) {
|
||||||
if (slot instanceof SlotFilterFluid) {
|
if (slot instanceof FluidFilterSlot) {
|
||||||
targets.add(new Target<I>() {
|
targets.add(new Target<I>() {
|
||||||
@Override
|
@Override
|
||||||
public Rectangle getArea() {
|
public Rectangle2d getArea() {
|
||||||
return bounds;
|
return bounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(I ingredient) {
|
public void accept(I ingredient) {
|
||||||
RS.INSTANCE.network.sendToServer(new MessageSlotFilterSetFluid(slot.slotNumber, StackUtils.copy((FluidStack) ingredient, Fluid.BUCKET_VOLUME)));
|
// TODO RS.INSTANCE.network.sendToServer(new MessageSlotFilterSetFluid(slot.slotNumber, StackUtils.copy((FluidStack) ingredient, Fluid.BUCKET_VOLUME)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -71,4 +66,3 @@ public class GhostIngredientHandler implements IGhostIngredientHandler<GuiBase>
|
|||||||
// NO OP
|
// NO OP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
@@ -18,9 +18,6 @@ public class RSJeiPlugin implements IModPlugin {
|
|||||||
// TODO registry.addRecipeRegistryPlugin(new RecipeRegistryPluginCover());
|
// TODO registry.addRecipeRegistryPlugin(new RecipeRegistryPluginCover());
|
||||||
// TODO registry.addRecipeRegistryPlugin(new RecipeRegistryPluginHollowCover());
|
// TODO registry.addRecipeRegistryPlugin(new RecipeRegistryPluginHollowCover());
|
||||||
|
|
||||||
// TODO: https://github.com/mezz/JustEnoughItems/issues/1307
|
|
||||||
// registry.addGhostIngredientHandler(GuiBase.class, new GhostIngredientHandler());
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getPluginUid() {
|
public ResourceLocation getPluginUid() {
|
||||||
return ID;
|
return ID;
|
||||||
@@ -34,6 +31,9 @@ public class RSJeiPlugin implements IModPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void registerGuiHandlers(IGuiHandlerRegistration registration) {
|
public void registerGuiHandlers(IGuiHandlerRegistration registration) {
|
||||||
registration.addGuiContainerHandler(BaseScreen.class, new GuiContainerHandler());
|
registration.addGuiContainerHandler(BaseScreen.class, new GuiContainerHandler());
|
||||||
|
|
||||||
|
// TODO: https://github.com/mezz/JustEnoughItems/issues/1307
|
||||||
|
// registration.addGhostIngredientHandler(BaseScreen.class, new GhostIngredientHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user