Skip to content

Commit

Permalink
fixed hatch tank icon, started prep for button refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Sep 2, 2023
1 parent e6950a7 commit 1897873
Show file tree
Hide file tree
Showing 19 changed files with 39 additions and 42 deletions.
14 changes: 0 additions & 14 deletions common/src/main/java/muramasa/antimatter/Data.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import muramasa.antimatter.gui.MenuHandlerPipe;
import muramasa.antimatter.gui.container.ContainerBasicMachine;
import muramasa.antimatter.gui.container.ContainerCover;
import muramasa.antimatter.gui.container.ContainerHatch;
import muramasa.antimatter.gui.container.ContainerMachine;
import muramasa.antimatter.gui.container.ContainerMultiMachine;
import muramasa.antimatter.item.DebugScannerItem;
Expand All @@ -25,7 +24,6 @@
import muramasa.antimatter.registration.Side;
import muramasa.antimatter.texture.Texture;
import muramasa.antimatter.tile.TileEntityMachine;
import muramasa.antimatter.tile.multi.TileEntityHatch;
import muramasa.antimatter.tile.multi.TileEntityMultiMachine;
import muramasa.antimatter.tile.single.TileEntityInfiniteStorage;
import muramasa.antimatter.tool.enchantment.ElectricEnchantment;
Expand Down Expand Up @@ -106,18 +104,6 @@ public String screenID() {
}
};

public static MenuHandlerMachine<? extends TileEntityHatch, ? extends ContainerHatch> HATCH_MENU_HANDLER = new MenuHandlerMachine(Ref.ID, "container_hatch") {
@Override
public ContainerHatch getMenu(IGuiHandler tile, Inventory playerInv, int windowId) {
return tile instanceof TileEntityHatch ? new ContainerHatch((TileEntityHatch<?>) tile, playerInv, this, windowId) : null;
}

@Override
public String screenID() {
return "hatch";
}
};

public static final BasicMachine CREATIVE_GENERATOR = new BasicMachine(Ref.ID, "creative_generator").addFlags(ENERGY, GUI).setTiers(MAX).setAllowVerticalFacing(true).allowFrontIO().setTile(TileEntityInfiniteStorage::new)
.noCovers();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public class ClientData {
public final static MenuScreens.ScreenConstructor SCREEN_BASIC = AntimatterAPI.register(MenuScreens.ScreenConstructor.class, "basic", Ref.ID, (MenuScreens.ScreenConstructor)(a, b, c) -> new ScreenBasicMachine((ContainerBasicMachine) a, b, c));
public final static MenuScreens.ScreenConstructor SCREEN_MACHINE = AntimatterAPI.register(MenuScreens.ScreenConstructor.class, "machine", Ref.ID, (MenuScreens.ScreenConstructor)(a, b, c) -> new ScreenMachine((ContainerMachine) a, b, c));
public final static MenuScreens.ScreenConstructor SCREEN_MULTI = AntimatterAPI.register(MenuScreens.ScreenConstructor.class, "multi", Ref.ID, (MenuScreens.ScreenConstructor)(a, b, c) -> new ScreenMultiMachine((ContainerMultiMachine) a, b, c));
public final static MenuScreens.ScreenConstructor SCREEN_HATCH = AntimatterAPI.register(MenuScreens.ScreenConstructor.class, "hatch", Ref.ID, (MenuScreens.ScreenConstructor)(a, b, c) -> new ScreenHatch((ContainerHatch) a, b, c));
public final static MenuScreens.ScreenConstructor SCREEN_COVER = AntimatterAPI.register(MenuScreens.ScreenConstructor.class, "cover", Ref.ID, (MenuScreens.ScreenConstructor)(a, b, c) -> new ScreenCover((ContainerCover) a, b, c));
public final static MenuScreens.ScreenConstructor SCREEN_DEFAULT = AntimatterAPI.register(MenuScreens.ScreenConstructor.class, "default", Ref.ID, (MenuScreens.ScreenConstructor)(a, b, c) -> new AntimatterContainerScreen(a, b, c));

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
package muramasa.antimatter.gui.screen;

import com.mojang.blaze3d.vertex.PoseStack;
import muramasa.antimatter.gui.SlotData;
import muramasa.antimatter.gui.SlotType;
import muramasa.antimatter.gui.container.ContainerHatch;
import muramasa.antimatter.machine.MachineFlag;
import muramasa.antimatter.tile.multi.TileEntityHatch;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;

import java.util.List;

public class ScreenHatch<T extends TileEntityHatch<T>, U extends ContainerHatch<T>> extends ScreenMachine<T, U> {
public class ScreenHatch<T extends TileEntityHatch<T>, U extends muramasa.antimatter.gui.container.ContainerMachine<T>> extends ScreenMachine<T, U> {

public ScreenHatch(U container, Inventory inv, Component name) {
super(container, inv, name);
Expand All @@ -21,9 +14,5 @@ public ScreenHatch(U container, Inventory inv, Component name) {
@Override
protected void renderBg(PoseStack stack, float partialTicks, int mouseX, int mouseY) {
super.renderBg(stack, partialTicks, mouseX, mouseY);
ResourceLocation gui = container.source().handler.getGuiTexture();
if (container.getTile().getMachineType().has(MachineFlag.FLUID)) {
drawTexture(stack, gui, leftPos + 8, topPos + 21, imageWidth, 36, 18, 54);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package muramasa.antimatter.gui.widget;

import com.mojang.blaze3d.vertex.PoseStack;
import muramasa.antimatter.Ref;
import muramasa.antimatter.gui.GuiInstance;
import muramasa.antimatter.gui.IGuiElement;
import muramasa.antimatter.gui.Widget;
import net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class TankIconWidget extends Widget {
protected TankIconWidget(@NotNull GuiInstance gui, @Nullable IGuiElement parent) {
super(gui, parent);
}

@Override
public void render(PoseStack matrixStack, double mouseX, double mouseY, float partialTicks) {
drawTexture(matrixStack, new ResourceLocation(Ref.ID, "textures/gui/button/tank.png"), realX(), realY(), 0, 0, 18, 18, 18, 18);
}

public static WidgetSupplier build() {
return builder(TankIconWidget::new);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import muramasa.antimatter.Data;
import muramasa.antimatter.cover.CoverFactory;
import muramasa.antimatter.gui.widget.TankIconWidget;
import muramasa.antimatter.machine.Tier;
import muramasa.antimatter.tile.multi.TileEntityHatch;
import muramasa.antimatter.util.Utils;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.block.state.properties.Property;

import static muramasa.antimatter.machine.MachineFlag.COVERABLE;
import static muramasa.antimatter.machine.MachineFlag.HATCH;
import static muramasa.antimatter.machine.MachineFlag.*;

public class HatchMachine extends Machine<HatchMachine> {
String idForHandlers;
Expand All @@ -21,7 +21,7 @@ public HatchMachine(String domain, String id, CoverFactory cover) {
setTile(TileEntityHatch::new);
setTiers(Tier.getAllElectric());
addFlags(HATCH, COVERABLE);
setGUI(Data.HATCH_MENU_HANDLER);
setGUI(Data.BASIC_MENU_HANDLER);
setAllowVerticalFacing(true);
covers(cover);
setOutputCover(cover);
Expand All @@ -38,6 +38,16 @@ public String getIdForHandlers() {
return idForHandlers;
}

@Override
protected void setupGui() {
super.setupGui();
addGuiCallback(t -> {
if (has(FLUID)){
t.addWidget(TankIconWidget.build().setPos(8, 39));
}
});
}

@Override
public Direction handlePlacementFacing(BlockPlaceContext ctxt, Property<?> which, Direction dir) {
return dir.getOpposite();
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 1897873

Please sign in to comment.