-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from matt-159/0.3.1-fixes
0.3.1 fixes
- Loading branch information
Showing
10 changed files
with
138 additions
and
95 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
22 changes: 0 additions & 22 deletions
22
...m/github/matt159/dws/mixin/mixins/common/appliedenergistics2/NEIAERecipeHandlerMixin.java
This file was deleted.
Oops, something went wrong.
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
21 changes: 0 additions & 21 deletions
21
src/main/java/com/github/matt159/dws/mixin/mixins/common/nei/BrewingRecipeHandlerMixin.java
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
src/main/java/com/github/matt159/dws/mixin/mixins/common/nei/FurnaceRecipeHandlerMixin.java
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
src/main/java/com/github/matt159/dws/mixin/mixins/common/nei/ShapedRecipeHandlerMixin.java
This file was deleted.
Oops, something went wrong.
95 changes: 87 additions & 8 deletions
95
src/main/java/com/github/matt159/dws/mixin/mixins/common/nei/TemplateRecipeHandlerMixin.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 |
---|---|---|
@@ -1,17 +1,96 @@ | ||
package com.github.matt159.dws.mixin.mixins.common.nei; | ||
|
||
import codechicken.nei.recipe.TemplateRecipeHandler; | ||
import com.github.matt159.dws.util.ListOfGUIsWithTransferRects; | ||
import net.minecraft.client.gui.inventory.GuiContainer; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
import org.spongepowered.asm.mixin.injection.*; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
import java.awt.*; | ||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
@Mixin(TemplateRecipeHandler.class) | ||
public abstract class TemplateRecipeHandlerMixin { | ||
@ModifyConstant(method = "drawBackground", | ||
constant = @Constant(intValue = 5), | ||
remap = false, | ||
require = 1) | ||
private int modifyBackgroundXOffset(int constant) { | ||
return constant + 81; | ||
// @ModifyConstant(method = "drawBackground", | ||
// constant = @Constant(intValue = 5), | ||
// remap = false, | ||
// require = 1) | ||
// private int modifyBackgroundXOffset(int constant) { | ||
// return constant + 81; | ||
// } | ||
|
||
private static Class<? extends GuiContainer> clazz = null; | ||
|
||
@Inject(method = "transferRect(Lnet/minecraft/client/gui/inventory/GuiContainer;Ljava/util/Collection;IIZ)Z", | ||
at = @At("HEAD"), | ||
remap = false, | ||
require = 1) | ||
private static void injectCaptureGuiContainerClass(GuiContainer gui, | ||
Collection<TemplateRecipeHandler.RecipeTransferRect> transferRects, | ||
int offsetx, | ||
int offsety, | ||
boolean usage, | ||
CallbackInfoReturnable<Boolean> cir) { | ||
clazz = gui.getClass(); | ||
} | ||
|
||
@Inject(method = "transferRectTooltip", | ||
at = @At("HEAD"), | ||
remap = false, | ||
require = 1) | ||
private static void injectCaptureGuiContainerClass(GuiContainer gui, | ||
Collection<TemplateRecipeHandler.RecipeTransferRect> transferRects, | ||
int offsetx, | ||
int offsety, | ||
List<String> currenttip, | ||
CallbackInfoReturnable<List<String>> cir) { | ||
clazz = gui.getClass(); | ||
} | ||
|
||
@SuppressWarnings("rawtypes") | ||
@Redirect(method = { "transferRect(Lnet/minecraft/client/gui/inventory/GuiContainer;Ljava/util/Collection;IIZ)Z", | ||
"transferRectTooltip" }, | ||
at = @At(value = "INVOKE", | ||
target = "Ljava/awt/Rectangle;contains(Ljava/awt/Point;)Z"), | ||
remap = false, | ||
require = 2) | ||
private static boolean redirectNextRectangle(Rectangle instance, Point point) { | ||
if (ListOfGUIsWithTransferRects.contains(clazz)) { | ||
Rectangle rect = new Rectangle(instance); | ||
|
||
rect.x += 81; | ||
|
||
return rect.contains(point); | ||
} | ||
|
||
return instance.contains(point); | ||
} | ||
|
||
@Inject(method = "transferRect(Lnet/minecraft/client/gui/inventory/GuiContainer;Ljava/util/Collection;IIZ)Z", | ||
at = @At("RETURN"), | ||
remap = false, | ||
require = 1) | ||
private static void injectReleaseGuiContainerClass(GuiContainer gui, | ||
Collection<TemplateRecipeHandler.RecipeTransferRect> transferRects, | ||
int offsetx, | ||
int offsety, | ||
boolean usage, | ||
CallbackInfoReturnable<Boolean> cir) { | ||
clazz = null; | ||
} | ||
|
||
@Inject(method = "transferRectTooltip", | ||
at = @At("RETURN"), | ||
remap = false, | ||
require = 1) | ||
private static void injectReleaseGuiContainerClass(GuiContainer gui, | ||
Collection<TemplateRecipeHandler.RecipeTransferRect> transferRects, | ||
int offsetx, | ||
int offsety, | ||
List<String> currenttip, | ||
CallbackInfoReturnable<List<String>> cir) { | ||
clazz = null; | ||
} | ||
} |
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
48 changes: 48 additions & 0 deletions
48
src/main/java/com/github/matt159/dws/util/ListOfGUIsWithTransferRects.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,48 @@ | ||
package com.github.matt159.dws.util; | ||
|
||
import appeng.client.gui.implementations.GuiGrinder; | ||
import appeng.client.gui.implementations.GuiInscriber; | ||
import forestry.factory.gui.*; | ||
import net.minecraft.client.gui.inventory.GuiBrewingStand; | ||
import net.minecraft.client.gui.inventory.GuiContainer; | ||
import net.minecraft.client.gui.inventory.GuiCrafting; | ||
import net.minecraft.client.gui.inventory.GuiFurnace; | ||
|
||
import java.util.HashSet; | ||
|
||
public final class ListOfGUIsWithTransferRects { | ||
private static final HashSet<Class<? extends GuiContainer>> set = new HashSet<>(); | ||
|
||
public static boolean contains(Class<? extends GuiContainer> clazz) { | ||
return set.contains(clazz); | ||
} | ||
|
||
public static boolean addClassToList(Class<? extends GuiContainer> clazz) { | ||
return set.add(clazz); | ||
} | ||
|
||
static { | ||
//region Minecraft | ||
addClassToList(GuiCrafting.class); | ||
addClassToList(GuiBrewingStand.class); | ||
addClassToList(GuiFurnace.class); | ||
//endregion | ||
//region AE2 | ||
addClassToList(GuiGrinder.class); | ||
addClassToList(GuiInscriber.class); | ||
//endregion | ||
//region Forestry | ||
addClassToList(GuiBottler.class); | ||
addClassToList(GuiCarpenter.class); | ||
addClassToList(GuiCentrifuge.class); | ||
addClassToList(GuiFabricator.class); | ||
addClassToList(GuiFermenter.class); | ||
addClassToList(GuiMoistener.class); | ||
addClassToList(GuiSqueezer.class); | ||
addClassToList(GuiStill.class); | ||
//endregion | ||
//region Gregtech | ||
//Gregtech's NEI Handler overrides handleToolTip in TemplateRecipeHandler so a list of classes isn't needed here | ||
//endregion | ||
} | ||
} |
Binary file modified
BIN
-12 Bytes
(100%)
src/main/resources/assets/dws/textures/forestry/gui/centrifugesocket.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.