forked from CleanroomMC/InventoryBogoSorter
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
1,163 additions
and
15 deletions.
There are no files selected for viewing
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
Binary file not shown.
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
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
52 changes: 52 additions & 0 deletions
52
src/main/java/com/cleanroommc/bogosorter/common/dropoff/DropOffButtonHandler.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,52 @@ | ||
package com.cleanroommc.bogosorter.common.dropoff; | ||
|
||
import com.cleanroommc.bogosorter.BogoSorter; | ||
import com.cleanroommc.bogosorter.ClientEventHandler; | ||
import com.cleanroommc.bogosorter.common.sort.ButtonHandler; | ||
import com.cleanroommc.bogosorter.common.sort.IGuiContainerAccessor; | ||
import com.cleanroommc.modularui.screen.GuiScreenWrapper; | ||
import cpw.mods.fml.common.eventhandler.SubscribeEvent; | ||
import cpw.mods.fml.relauncher.Side; | ||
import cpw.mods.fml.relauncher.SideOnly; | ||
import net.minecraft.client.gui.GuiButton; | ||
import net.minecraft.client.gui.GuiScreen; | ||
import net.minecraft.client.gui.inventory.GuiContainerCreative; | ||
import net.minecraft.client.renderer.InventoryEffectRenderer; | ||
import net.minecraftforge.client.event.GuiScreenEvent; | ||
|
||
public class DropOffButtonHandler { | ||
|
||
public static int buttonX = 80; | ||
public static int buttonY = 12; | ||
|
||
@SubscribeEvent | ||
@SideOnly(Side.CLIENT) | ||
public void onGuiInit(GuiScreenEvent.InitGuiEvent.Post event) { | ||
GuiScreen screen = event.gui; | ||
if (screen instanceof GuiContainerCreative) { | ||
return; | ||
} | ||
try { | ||
if (screen instanceof InventoryEffectRenderer inv) { | ||
event.buttonList.add(new InvButton(inv)); | ||
} | ||
} catch (NullPointerException e) { | ||
BogoSorter.LOGGER.error( | ||
"Erroring adding dropoff button to player inventory \n" + e); | ||
} | ||
} | ||
|
||
|
||
@SubscribeEvent | ||
public void onDrawScreen(GuiScreenEvent.DrawScreenEvent.Post event) { | ||
GuiScreen screen = event.gui; | ||
|
||
if (screen instanceof InventoryEffectRenderer) { | ||
for (GuiButton guiButton : ((IGuiContainerAccessor) event.gui).getButtons()) { | ||
if (guiButton instanceof InvButton invButton) { | ||
invButton.drawTooltip(event.mouseX, event.mouseY); | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.