-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Impl DME JEI Exclusion Zones from DME #39
- Loading branch information
1 parent
7a01e0d
commit d544f75
Showing
8 changed files
with
168 additions
and
3 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
8 changes: 8 additions & 0 deletions
8
src/main/java/com/nomiceu/nomilabs/integration/deepmobevolution/AccessibleGuiMachine.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,8 @@ | ||
package com.nomiceu.nomilabs.integration.deepmobevolution; | ||
|
||
import java.awt.*; | ||
|
||
public interface AccessibleGuiMachine { | ||
|
||
Rectangle getRedstoneButtonRect(); | ||
} |
50 changes: 50 additions & 0 deletions
50
src/main/java/com/nomiceu/nomilabs/integration/deepmobevolution/DMEJEIExclusion.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,50 @@ | ||
package com.nomiceu.nomilabs.integration.deepmobevolution; | ||
|
||
import static mustapelto.deepmoblearning.DMLConstants.Gui.TrialKeystone.*; | ||
|
||
import java.awt.*; | ||
import java.util.List; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
|
||
import mezz.jei.api.gui.IAdvancedGuiHandler; | ||
import mustapelto.deepmoblearning.client.gui.GuiMachine; | ||
import mustapelto.deepmoblearning.client.gui.GuiTrialKeystone; | ||
|
||
public class DMEJEIExclusion { | ||
|
||
public static class MachineGuiExclusion implements IAdvancedGuiHandler<GuiMachine> { | ||
|
||
@Override | ||
@NotNull | ||
public Class<GuiMachine> getGuiContainerClass() { | ||
return GuiMachine.class; | ||
} | ||
|
||
@Override | ||
public List<Rectangle> getGuiExtraAreas(@NotNull GuiMachine gui) { | ||
return ((JEIExcluded) gui).getGuiExclusionAreas(); | ||
} | ||
} | ||
|
||
public static class TrialGuiExclusion implements IAdvancedGuiHandler<GuiTrialKeystone> { | ||
|
||
@Override | ||
@NotNull | ||
public Class<GuiTrialKeystone> getGuiContainerClass() { | ||
return GuiTrialKeystone.class; | ||
} | ||
|
||
@Override | ||
public List<Rectangle> getGuiExtraAreas(GuiTrialKeystone gui) { | ||
return ImmutableList.of( | ||
new Rectangle( | ||
gui.guiLeft + TRIAL_KEY_SLOT.LEFT, | ||
gui.guiTop + TRIAL_KEY_SLOT.TOP, | ||
TRIAL_KEY_SLOT.WIDTH, | ||
TRIAL_KEY_SLOT.HEIGHT)); | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/nomiceu/nomilabs/integration/deepmobevolution/JEIExcluded.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,9 @@ | ||
package com.nomiceu.nomilabs.integration.deepmobevolution; | ||
|
||
import java.awt.*; | ||
import java.util.List; | ||
|
||
public interface JEIExcluded { | ||
|
||
List<Rectangle> getGuiExclusionAreas(); | ||
} |
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
39 changes: 39 additions & 0 deletions
39
src/main/java/com/nomiceu/nomilabs/mixin/deepmoblearning/GuiMachineMixin.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.nomiceu.nomilabs.mixin.deepmoblearning; | ||
|
||
import java.awt.*; | ||
import java.util.List; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import com.nomiceu.nomilabs.integration.deepmobevolution.AccessibleGuiMachine; | ||
import com.nomiceu.nomilabs.integration.deepmobevolution.JEIExcluded; | ||
|
||
import mustapelto.deepmoblearning.client.gui.GuiMachine; | ||
import mustapelto.deepmoblearning.client.gui.buttons.ButtonRedstoneMode; | ||
|
||
/** | ||
* Adds JEI Exclusion Areas to Gui Machine. | ||
*/ | ||
@Mixin(value = GuiMachine.class, remap = false) | ||
public class GuiMachineMixin implements JEIExcluded, AccessibleGuiMachine { | ||
|
||
@Shadow | ||
private ButtonRedstoneMode redstoneModeButton; | ||
|
||
@Override | ||
public List<Rectangle> getGuiExclusionAreas() { | ||
return ImmutableList.of( | ||
getRedstoneButtonRect()); | ||
} | ||
|
||
@Override | ||
public Rectangle getRedstoneButtonRect() { | ||
return new Rectangle( | ||
redstoneModeButton.x, | ||
redstoneModeButton.y, | ||
redstoneModeButton.width, | ||
redstoneModeButton.height); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/com/nomiceu/nomilabs/mixin/deepmoblearning/GuiSimulationChamberMixin.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,46 @@ | ||
package com.nomiceu.nomilabs.mixin.deepmoblearning; | ||
|
||
import static mustapelto.deepmoblearning.DMLConstants.Gui.SimulationChamber.DATA_MODEL_SLOT; | ||
|
||
import java.awt.*; | ||
import java.util.List; | ||
|
||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.world.World; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import com.nomiceu.nomilabs.integration.deepmobevolution.AccessibleGuiMachine; | ||
import com.nomiceu.nomilabs.integration.deepmobevolution.JEIExcluded; | ||
|
||
import mustapelto.deepmoblearning.client.gui.GuiMachine; | ||
import mustapelto.deepmoblearning.client.gui.GuiSimulationChamber; | ||
import mustapelto.deepmoblearning.common.tiles.TileEntityMachine; | ||
import mustapelto.deepmoblearning.common.util.Point; | ||
|
||
/** | ||
* Adds JEI Exclusion Areas to Gui Simulation Chamber. | ||
*/ | ||
@Mixin(value = GuiSimulationChamber.class, remap = false) | ||
public abstract class GuiSimulationChamberMixin extends GuiMachine implements JEIExcluded { | ||
|
||
/** | ||
* Default Ignored Constructor | ||
*/ | ||
private GuiSimulationChamberMixin(TileEntityMachine tileEntity, EntityPlayer player, World world, int width, | ||
int height, Point redstoneModeButtonLocation) { | ||
super(tileEntity, player, world, width, height, redstoneModeButtonLocation); | ||
} | ||
|
||
@Override | ||
public List<Rectangle> getGuiExclusionAreas() { | ||
return ImmutableList.of( | ||
((AccessibleGuiMachine) this).getRedstoneButtonRect(), | ||
new Rectangle( | ||
guiLeft + DATA_MODEL_SLOT.LEFT, | ||
guiTop + DATA_MODEL_SLOT.TOP, | ||
DATA_MODEL_SLOT.WIDTH, | ||
DATA_MODEL_SLOT.HEIGHT)); | ||
} | ||
} |
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