Skip to content

Commit

Permalink
add compat for the thaumatorium
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-159 committed May 4, 2024
1 parent bd2e5b3 commit d92adfa
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package com.github.matt159.dws.mixin.mixins.client.thaumcraft;

import com.github.matt159.dws.interfaces.IDWSGui;
import com.github.matt159.dws.util.Constants;
import lombok.val;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import thaumcraft.client.gui.GuiThaumatorium;

import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Container;

@Mixin(GuiThaumatorium.class)
public abstract class GuiThaumatoriumMixin extends GuiContainer implements IDWSGui {
public GuiThaumatoriumMixin(Container container) {
super(container);
}

@ModifyConstant(method = "drawGuiContainerBackgroundLayer",
constant = { @Constant(intValue = 176),
@Constant(intValue = 192),
@Constant(intValue = 184),
@Constant(intValue = 200) },
require = 10)
private int modifyTextureUVXOffset2(int constant) {
val offset = constant - 176;

return offset + Constants.GENERAL_DWS_GUI_WIDTH;
}

@ModifyConstant(method = "drawAspects",
constant = @Constant(intValue = 176),
remap = false,
require = 2)
private int modifyTextureUVXOffset(int constant) {
return Constants.GENERAL_DWS_GUI_WIDTH;
}

@ModifyConstant(method = "drawGuiContainerBackgroundLayer",
constant = { @Constant(intValue = 32),
@Constant(intValue = 88),
@Constant(intValue = 104),
@Constant(intValue = 128),
@Constant(intValue = 136) },
require = 15)
private int modifyTextureDrawXOffsets(int constant) {
return constant + Constants.GENERAL_X_OFFSET;
}

@ModifyConstant(method = "drawAspects",
constant = { @Constant(intValue = 40, ordinal = 0),
@Constant(intValue = 41),
@Constant(intValue = 42) },
remap = false,
require = 3)
private int modifyAspectXOffset(int constant) {
return constant + Constants.GENERAL_X_OFFSET;
}

@ModifyConstant(method = "drawOutput",
constant = { @Constant(intValue = 112) },
remap = false,
require = 3)
private int modifyOutputXOffset(int constant) {
return constant + Constants.GENERAL_X_OFFSET;
}

@ModifyConstant(method = "mouseClicked",
constant = { @Constant(intValue = 112),
@Constant(intValue = 128),
@Constant(intValue = 32),
@Constant(intValue = 136) },
require = 5)
private int modifyMouseClickRegionXOffset(int constant) {
return constant + Constants.GENERAL_X_OFFSET;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.github.matt159.dws.mixin.mixins.common.thaumcraft;

import com.github.matt159.dws.interfaces.IDWSContainer;
import com.github.matt159.dws.util.Constants;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import thaumcraft.common.container.ContainerThaumatorium;

import net.minecraft.inventory.Container;

@Mixin(ContainerThaumatorium.class)
public abstract class ContainerThaumatoriumMixin extends Container implements IDWSContainer {
@ModifyConstant(method = "<init>",
constant = @Constant(intValue = 9),
require = 4)
private int modifyInventorySize(int constant) {
return 18;
}

@ModifyConstant(method = "<init>",
constant = @Constant(intValue = 48),
require = 1)
private int modifyInputSlotXOffset(int constant) {
return constant + Constants.GENERAL_X_OFFSET;
}

@ModifyConstant(method = "transferStackInSlot",
constant = { @Constant(intValue = 28),
@Constant(intValue = 37) },
require = 7)
private int modifyInventoryBounds(int constant) {
return constant + 27;
}
}
2 changes: 2 additions & 0 deletions src/main/java/com/github/matt159/dws/mixin/plugin/Mixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,13 @@ public enum Mixin implements IMixin {
ContainerArcaneWorkbenchMixin (COMMON, require(THAUMCRAFT), "thaumcraft.ContainerArcaneWorkbenchMixin"),
ContainerFocusPouchMixin (COMMON, require(THAUMCRAFT), "thaumcraft.ContainerFocusPouchMixin"),
ContainerResearchTableMixin (COMMON, require(THAUMCRAFT), "thaumcraft.ContainerResearchTableMixin"),
ContainerThaumatoriumMixin (COMMON, require(THAUMCRAFT), "thaumcraft.ContainerThaumatoriumMixin"),

GuiAlchemyFurnaceMixin (CLIENT, require(THAUMCRAFT), "thaumcraft.GuiAlchemyFurnaceMixin"),
GuiArcaneWorkbenchMixin (CLIENT, require(THAUMCRAFT), "thaumcraft.GuiArcaneWorkbenchMixin"),
GuiFocusPouchMixin (CLIENT, require(THAUMCRAFT), "thaumcraft.GuiFocusPouchMixin"),
GuiResearchTableMixin (CLIENT, require(THAUMCRAFT), "thaumcraft.GuiResearchTableMixin"),
GuiThaumatoriumMixin (CLIENT, require(THAUMCRAFT), "thaumcraft.GuiThaumatoriumMixin"),

REHWandHandlerMixin (CLIENT, require(THAUMCRAFT), "thaumcraft.REHWandHandlerMixin"),
WandManagerMixin (COMMON, require(THAUMCRAFT), "thaumcraft.WandManagerMixin"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ public static void useDoubleWideTexture(boolean value) {
addTextureToWhitelist("thaumcraft:textures/gui/gui_arcaneworkbench.png");
addTextureToWhitelist("thaumcraft:textures/gui/gui_focuspouch.png");
addTextureToWhitelist("thaumcraft:textures/gui/guiresearchtable2.png");
addTextureToWhitelist("thaumcraft:textures/gui/gui_thaumatorium.png");
//endregion

//region Industrialcraft 2
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d92adfa

Please sign in to comment.