-
-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-add JEI sync in Grid + JEI ingredient under mouse handler
- Loading branch information
1 parent
7859ca4
commit f46ac1e
Showing
10 changed files
with
109 additions
and
112 deletions.
There are no files selected for viewing
53 changes: 0 additions & 53 deletions
53
src/main/java/com/raoulvdberge/refinedstorage/integration/jei/AdvancedGuiHandler.java
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
src/main/java/com/raoulvdberge/refinedstorage/integration/jei/GuiContainerHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.raoulvdberge.refinedstorage.integration.jei; | ||
|
||
import com.raoulvdberge.refinedstorage.container.BaseContainer; | ||
import com.raoulvdberge.refinedstorage.container.slot.filter.FluidFilterSlot; | ||
import com.raoulvdberge.refinedstorage.screen.BaseScreen; | ||
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen; | ||
import com.raoulvdberge.refinedstorage.util.RenderUtils; | ||
import mezz.jei.api.gui.handlers.IGuiContainerHandler; | ||
import net.minecraftforge.fluids.FluidStack; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
public class GuiContainerHandler implements IGuiContainerHandler<BaseScreen> { | ||
@Nullable | ||
@Override | ||
public Object getIngredientUnderMouse(BaseScreen screen, double mouseX, double mouseY) { | ||
mouseX -= screen.getGuiLeft(); | ||
mouseY -= screen.getGuiTop(); | ||
|
||
if (screen instanceof GridScreen) { | ||
GridScreen grid = (GridScreen) screen; | ||
|
||
if (!grid.getSearchField().isFocused() && grid.isOverSlotArea(mouseX, mouseY)) { | ||
return grid.getSlotNumber() >= 0 && grid.getSlotNumber() < grid.getView().getStacks().size() ? grid.getView().getStacks().get(grid.getSlotNumber()).getIngredient() : null; | ||
} | ||
} | ||
|
||
if (screen.getContainer() instanceof BaseContainer) { | ||
for (FluidFilterSlot slot : ((BaseContainer) screen.getContainer()).getFluidSlots()) { | ||
FluidStack fluidInSlot = slot.getFluidInventory().getFluid(slot.getSlotIndex()); | ||
|
||
if (!fluidInSlot.isEmpty() && RenderUtils.inBounds(slot.xPos, slot.yPos, 18, 18, mouseX, mouseY)) { | ||
return fluidInSlot; | ||
} | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
} |
10 changes: 0 additions & 10 deletions
10
src/main/java/com/raoulvdberge/refinedstorage/integration/jei/IntegrationJEI.java
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
src/main/java/com/raoulvdberge/refinedstorage/integration/jei/JeiIntegration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.raoulvdberge.refinedstorage.integration.jei; | ||
|
||
import net.minecraftforge.fml.ModList; | ||
|
||
public final class JeiIntegration { | ||
public static boolean isLoaded() { | ||
return ModList.get().isLoaded("jei"); | ||
} | ||
} | ||
|
38 changes: 0 additions & 38 deletions
38
src/main/java/com/raoulvdberge/refinedstorage/integration/jei/RSJEIPlugin.java
This file was deleted.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
src/main/java/com/raoulvdberge/refinedstorage/integration/jei/RSJeiPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.raoulvdberge.refinedstorage.integration.jei; | ||
|
||
import com.raoulvdberge.refinedstorage.RS; | ||
import com.raoulvdberge.refinedstorage.screen.BaseScreen; | ||
import mezz.jei.api.IModPlugin; | ||
import mezz.jei.api.JeiPlugin; | ||
import mezz.jei.api.registration.IGuiHandlerRegistration; | ||
import mezz.jei.api.runtime.IJeiRuntime; | ||
import net.minecraft.util.ResourceLocation; | ||
|
||
@JeiPlugin | ||
public class RSJeiPlugin implements IModPlugin { | ||
private static final ResourceLocation ID = new ResourceLocation(RS.ID, "plugin"); | ||
|
||
public static IJeiRuntime RUNTIME; | ||
|
||
// TODO registry.getRecipeTransferRegistry().addUniversalRecipeTransferHandler(new RecipeTransferHandlerGrid()); | ||
|
||
// TODO registry.addRecipeRegistryPlugin(new RecipeRegistryPluginCover()); | ||
// TODO registry.addRecipeRegistryPlugin(new RecipeRegistryPluginHollowCover()); | ||
|
||
// TODO: https://github.com/mezz/JustEnoughItems/issues/1307 | ||
// registry.addGhostIngredientHandler(GuiBase.class, new GhostIngredientHandler()); | ||
|
||
@Override | ||
public ResourceLocation getPluginUid() { | ||
return ID; | ||
} | ||
|
||
@Override | ||
public void registerGuiHandlers(IGuiHandlerRegistration registration) { | ||
registration.addGuiContainerHandler(BaseScreen.class, new GuiContainerHandler()); | ||
} | ||
|
||
@Override | ||
public void onRuntimeAvailable(IJeiRuntime runtime) { | ||
RUNTIME = runtime; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters