Skip to content

Commit

Permalink
Added back mantle code
Browse files Browse the repository at this point in the history
  • Loading branch information
r8420 committed Jan 12, 2022
1 parent 9d0e81a commit 76f2639
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,26 @@
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.phys.Vec2;
//import slimeknights.mantle.client.screen.MultiModuleScreen;
import slimeknights.mantle.client.screen.MultiModuleScreen;

public class MantleModuleScreenOverride implements IOverrideSlotPos {

@Override
public IViewSlot getSlot(AbstractContainerScreen<?> gui, Slot slot) {
// if (gui instanceof MultiModuleScreen) {
// return new ModuleScreenSlotView(slot, (MultiModuleScreen<?>) gui);
// }
if (gui instanceof MultiModuleScreen) {
return new ModuleScreenSlotView(slot, (MultiModuleScreen<?>) gui);
}
return null;
}

public static class ModuleScreenSlotView implements IViewSlot {

private final Slot slot;
// private final MultiModuleScreen<?> gui;
private final MultiModuleScreen<?> gui;

public ModuleScreenSlotView(Slot slot) {
public ModuleScreenSlotView(Slot slot, MultiModuleScreen<?> gui) {
this.slot = slot;
this.gui = gui;
}

@Override
Expand All @@ -33,7 +34,7 @@ public Slot getSlot() {

@Override
public Vec2 getRenderPos(int guiLeft, int guiTop) {
return new Vec2(-guiLeft, -guiTop + slot.y);
return new Vec2(-guiLeft + gui.cornerX + slot.x, -guiTop + gui.cornerY + slot.y);
}

@Override
Expand Down

0 comments on commit 76f2639

Please sign in to comment.