Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ dependencies {
implementation('com.github.GTNewHorizons:twilightforest:2.6.5:dev')
implementation("com.github.GTNewHorizons:Galaxy-Space-GTNH:1.1.97-GTNH:dev")
implementation("com.github.GTNewHorizons:Galacticraft:3.2.6-GTNH:dev")
implementation("com.github.GTNewHorizons:TinkersConstruct:1.12.16-GTNH:dev")
}
8 changes: 0 additions & 8 deletions src/main/java/com/hepdd/easytech/ClientProxy.java

This file was deleted.

12 changes: 11 additions & 1 deletion src/main/java/com/hepdd/easytech/EasyTechnology.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
import org.apache.logging.log4j.Logger;

import com.hepdd.easytech.api.objects.VoidMinerUtilityEx;
import com.hepdd.easytech.common.ETHNetwork;
import com.hepdd.easytech.loaders.preload.ETHLoaderItem;
import com.hepdd.easytech.loaders.preload.ETHLoaderMetaTileEntities;
import com.hepdd.easytech.loaders.preload.ETHLoaderRecipe;
import com.hepdd.easytech.loaders.preload.ETHStatics;
import com.hepdd.easytech.proxy.CommonProxy;
import com.hepdd.easytech.proxy.GuiHandler;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
Expand All @@ -27,7 +30,12 @@ public class EasyTechnology {
public static final String MODID = "easytech";
public static final Logger LOG = LogManager.getLogger(MODID);

@SidedProxy(clientSide = "com.hepdd.easytech.ClientProxy", serverSide = "com.hepdd.easytech.CommonProxy")
@Mod.Instance("easytech")
public static EasyTechnology instance;

@SidedProxy(
clientSide = "com.hepdd.easytech.proxy.ClientProxy",
serverSide = "com.hepdd.easytech.proxy.CommonProxy")
public static CommonProxy proxy;

@Mod.EventHandler
Expand All @@ -44,6 +52,7 @@ public void init(FMLInitializationEvent event) {
new ETHLoaderMetaTileEntities().run();
new ETHLoaderItem().run();
new ETHLoaderRecipe().run();
ETHStatics.NW = new ETHNetwork();
}

@Mod.EventHandler
Expand All @@ -63,5 +72,6 @@ public void loadComplated(FMLLoadCompleteEvent event) {
proxy.loadComplate(event);
VoidMinerUtilityEx.generateDropMaps();
new ETHStatics().run();
GuiHandler.init();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public enum ETHItemList {
Hatch_Output_Bus_Primitive,

ITEM_Void_Oil_Location_Card,
ITEM_Portable_Crafting_Station,

;

Expand Down
48 changes: 48 additions & 0 deletions src/main/java/com/hepdd/easytech/api/enums/ETHPacketTypes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.hepdd.easytech.api.enums;

import java.util.Arrays;

import com.hepdd.easytech.network.PacketOpenCraftingStation;

import gregtech.api.net.GTPacket;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;

public enum ETHPacketTypes {

OPEN_PORTABLE_CRAFTING_STATION(0, new PacketOpenCraftingStation());

static {
// Validate no duplicate IDs
final ETHPacketTypes[] types = values();
final Int2ObjectOpenHashMap<GTPacket> foundIds = new Int2ObjectOpenHashMap<>(types.length);
for (ETHPacketTypes type : types) {
final GTPacket previous = foundIds.get(type.id);
if (previous != null) {
throw new IllegalStateException(
"Duplicate packet IDs defined: " + type.id
+ " for "
+ type.getClass()
+ " and "
+ previous.getClass());
}
foundIds.put(type.id, type.referencePacket);
}
}

public final byte id;
public final GTPacket referencePacket;

ETHPacketTypes(int id, GTPacket referencePacket) {
if (((int) (byte) id) != id) {
throw new IllegalArgumentException("Value outside of byte normal range: " + id);
}
this.id = (byte) id;
this.referencePacket = referencePacket;
}

public static GTPacket[] referencePackets() {
return Arrays.stream(values())
.map(p -> p.referencePacket)
.toArray(GTPacket[]::new);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
package com.hepdd.easytech.api.gui;

import java.util.Collections;
import java.util.List;

import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;

import org.lwjgl.opengl.GL11;

import com.hepdd.easytech.api.objects.PortableCraftingStationContainer;

import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cpw.mods.fml.common.Optional;
import tconstruct.tools.logic.CraftingStationLogic;

@Optional.Interface(iface = "codechicken.nei.api.INEIGuiHandler", modid = "NotEnoughItems")
public class PortableCraftingStationGui extends GuiContainer implements INEIGuiHandler {

/*
* Slider/slots related. Taken & adapted from Tinkers Construct 1.12 under the MIT License
*/
private static final ResourceLocation gui_inventory = new ResourceLocation("tinker", "textures/gui/generic.png");
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/tinkertable.png");
private static final ResourceLocation icons = new ResourceLocation("tinker", "textures/gui/icons.png");

public boolean active;

// Panel positions
public String toolName;
public String title, body;
CraftingStationLogic logic;

private int craftingLeft = 0;
private int craftingTop = 0;
private int craftingTextLeft = 0;

public PortableCraftingStationGui(InventoryPlayer inventory, CraftingStationLogic logic, int slotId) {
super(new PortableCraftingStationContainer(inventory, logic, slotId));
this.logic = logic;

title = "\u00A7n" + StatCollector.translateToLocal("gui.toolforge1");
body = StatCollector.translateToLocal("gui.toolforge2");
toolName = "";
}

@Override
public void initGui() {
super.initGui();

this.xSize = 176;
this.ySize = 166;

this.guiLeft = (this.width - this.xSize) / 2;
this.guiTop = (this.height - this.ySize) / 2;

this.craftingLeft = this.guiLeft;
this.craftingTop = this.guiTop;

this.craftingTextLeft = 0;
}

@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
this.fontRendererObj
.drawString(StatCollector.translateToLocal(logic.getInvName()), craftingTextLeft + 8, 6, 0x202020);
this.fontRendererObj
.drawString(StatCollector.translateToLocal("container.inventory"), craftingTextLeft + 8, 72, 0x202020);
}

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {

// Draw the background
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager()
.bindTexture(background);
this.drawTexturedModalRect(this.craftingLeft, this.craftingTop, 0, 0, 176, 166);

if (active) {
this.drawTexturedModalRect(this.craftingLeft + 62, this.craftingTop, 0, 166, 112, 22);
}

this.mc.getTextureManager()
.bindTexture(icons);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

this.mc.getTextureManager()
.bindTexture(gui_inventory);
}

@Override
public VisiblityData modifyVisiblity(GuiContainer gui, VisiblityData currentVisibility) {
currentVisibility.showWidgets = width - xSize >= 107;

if (guiLeft < 58) {
currentVisibility.showStateButtons = false;
}

return currentVisibility;
}

@Override
public Iterable<Integer> getItemSpawnSlots(GuiContainer gui, ItemStack item) {
return null;
}

@Override
public List<TaggedInventoryArea> getInventoryAreas(GuiContainer gui) {
return Collections.emptyList();
}

@Override
public boolean handleDragNDrop(GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button) {
return false;
}

@Override
public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) {
final int cw = 0;
if (y + h - 4 < guiTop || y + 4 > guiTop + ySize) return false;
return x - w - 4 >= guiLeft + cw && x + 4 <= guiLeft + xSize + cw;
}
}
Loading