Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
hughe code refractor and hughe multis
Browse files Browse the repository at this point in the history
+added tooltip for Vat glas
+enhanched code quality
+moved glass from biolab -> new stuff
+fixed diodes not working after restart
+added MEBF and MVFZ
+version number increase

Signed-off-by: bartimaeusnek <[email protected]>
  • Loading branch information
bartimaeusnek committed Jan 31, 2019
1 parent 28e4687 commit f11457d
Show file tree
Hide file tree
Showing 50 changed files with 1,136 additions and 324 deletions.
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
mc_version=1.7.10
majorUpdate=0
minorUpdate=3
buildNumber=17
buildNumber=18
ic2.version=2.2.828-experimental
gregtech.version=5.09.32.36
gregtech.jenkinsbuild=143
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static boolean addCustomGlass(String sModname, String sUnlocBlockName, in
if (ret)
BioVatGlass.glasses.put(new BlockMetaPair(block, (byte) meta), (byte) tier);
else
MainMod.logger.warn("Block: " + sUnlocBlockName + " of the Mod: " + sModname + " was NOT found!");
MainMod.LOGGER.warn("Block: " + sUnlocBlockName + " of the Mod: " + sModname + " was NOT found!");
block = null;
return ret;
}
Expand Down
24 changes: 14 additions & 10 deletions src/main/java/com/github/bartimaeusnek/bartworks/GuiHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.github.bartimaeusnek.bartworks.server.container.BW_Container_RadioHatch;
import com.github.bartimaeusnek.bartworks.server.container.GT_Container_CircuitProgrammer;
import com.github.bartimaeusnek.bartworks.server.container.GT_Container_Item_Destructopack;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.IGuiHandler;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.entity.player.EntityPlayer;
Expand All @@ -54,18 +55,21 @@ public Object getServerGuiElement(int ID, EntityPlayer player, World world, int

@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
switch (ID) {
case 0:
return new GT_GUIContainer_Destructopack(player.inventory);
case 1:
return new GT_GUIContainer_CircuitProgrammer(player.inventory);
case 2: {
if (world.getTileEntity(x, y, z) instanceof IGregTechTileEntity) {
IGregTechTileEntity te = (IGregTechTileEntity) world.getTileEntity(x, y, z);
return new BW_GUIContainer_RadLevel(new BW_Container_RadioHatch(player.inventory, te.getMetaTileEntity()));
if (FMLCommonHandler.instance().getSide().isClient()) {
switch (ID) {
case 0:
return new GT_GUIContainer_Destructopack(player.inventory);
case 1:
return new GT_GUIContainer_CircuitProgrammer(player.inventory);
case 2: {
if (world.getTileEntity(x, y, z) instanceof IGregTechTileEntity) {
IGregTechTileEntity te = (IGregTechTileEntity) world.getTileEntity(x, y, z);
return new BW_GUIContainer_RadLevel(new BW_Container_RadioHatch(player.inventory, te.getMetaTileEntity()));
}
}
}
}
} else
return getServerGuiElement(ID, player, world, x, y, z);
return null;
}
}
35 changes: 20 additions & 15 deletions src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,66 +23,72 @@
package com.github.bartimaeusnek.bartworks;


import com.github.bartimaeusnek.bartworks.API.API_REFERENCE;
import com.github.bartimaeusnek.bartworks.client.ClientEventHandler.ClientEventHandler;
import com.github.bartimaeusnek.bartworks.client.creativetabs.BioTab;
import com.github.bartimaeusnek.bartworks.client.creativetabs.GT2Tab;
import com.github.bartimaeusnek.bartworks.client.creativetabs.bartworksTab;
import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler;
import com.github.bartimaeusnek.bartworks.common.loaders.GTNHBlocks;
import com.github.bartimaeusnek.bartworks.common.loaders.LoaderRegistry;
import com.github.bartimaeusnek.bartworks.common.net.BW_Network;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import gregtech.api.enums.Materials;
import gregtech.api.enums.SubTag;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraftforge.common.MinecraftForge;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import static com.github.bartimaeusnek.bartworks.API.API_REFERENCE.VERSION;

@Mod(
modid = MainMod.modID, name = MainMod.name, version = MainMod.version,
modid = MainMod.MOD_ID, name = MainMod.NAME, version = MainMod.VERSION,
dependencies = "required-after:IC2; "
+ "required-after:gregtech; "
)
public final class MainMod {
public static final String name = "BartWorks";
public static final String version = "@version@";
public static final String modID = "bartworks";
public static final Logger logger = LogManager.getLogger(name);
public static final String NAME = "BartWorks";
public static final String VERSION = "@version@";
public static final String MOD_ID = "bartworks";
public static final Logger LOGGER = LogManager.getLogger(NAME);
public static final CreativeTabs GT2 = new GT2Tab("GT2C");
public static final CreativeTabs BioTab = new BioTab("BioTab");
public static final CreativeTabs BIO_TAB = new BioTab("BioTab");
public static final CreativeTabs BWT = new bartworksTab("bartworks");
public static final IGuiHandler GH = new GuiHandler();
public static boolean GTNH = false;

@Mod.Instance(modID)
@Mod.Instance(MOD_ID)
public static MainMod instance;
public static ConfigHandler CHandler;
public static BW_Network BW_Network_instance = new BW_Network();

@Mod.EventHandler
public void preInit(FMLPreInitializationEvent preinit) {
if (!(VERSION.equals(version))) {
logger.error("Something has loaded an old API. Please contact the Mod authors to update!");
//fixing BorosilicateGlass... -_-'
Materials.BorosilicateGlass.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_RECYCLING, SubTag.SMELTING_TO_FLUID);
if (!(API_REFERENCE.VERSION.equals(VERSION))) {
LOGGER.error("Something has loaded an old API. Please contact the Mod authors to update!");
}

if (Loader.isModLoaded("dreamcraft")) {
GTNH = true;
}
CHandler = new ConfigHandler(preinit);
if (GTNH)
logger.info("GTNH-Detected . . . ACTIVATE HARDMODE.");

LOGGER.info("GTNH-Detected . . . ACTIVATE HARDMODE.");
}

@Mod.EventHandler
public void init(FMLInitializationEvent init) {
if (FMLCommonHandler.instance().getSide().isClient() && ConfigHandler.BioLab)
MinecraftForge.EVENT_BUS.register(new ClientEventHandler());
new LoaderRegistry().run();

}

@Mod.EventHandler
Expand All @@ -91,5 +97,4 @@ public void postInit(FMLPostInitializationEvent postinit) {
if (ConfigHandler.BioLab)
new GTNHBlocks().run();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright (c) 2019 bartimaeusnek
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package com.github.bartimaeusnek.bartworks.client.ClientEventHandler;

import com.github.bartimaeusnek.bartworks.API.BioVatLogicAdder;
import com.github.bartimaeusnek.bartworks.common.blocks.BW_Blocks;
import com.github.bartimaeusnek.bartworks.util.BW_Util;
import com.github.bartimaeusnek.bartworks.util.ChatColorHelper;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.enums.GT_Values;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;

import java.util.HashMap;

@SideOnly(Side.CLIENT)
public class ClientEventHandler {

@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void getTooltip(ItemTooltipEvent event) {
if (event.itemStack == null || event.itemStack.getItem() == null || Block.getBlockFromItem(event.itemStack.getItem()) == null || event.itemStack.getItemDamage() > 127)
return;

final Block BLOCK = Block.getBlockFromItem(event.itemStack.getItem());
if (BLOCK instanceof BW_Blocks) {
return;
}
final BioVatLogicAdder.BlockMetaPair PAIR = new BioVatLogicAdder.BlockMetaPair(BLOCK, (byte) event.itemStack.getItemDamage());
final HashMap<BioVatLogicAdder.BlockMetaPair, Byte> GLASSMAP = BioVatLogicAdder.BioVatGlass.getGlassMap();
if (GLASSMAP.containsKey(PAIR)) {
int tier = GLASSMAP.get(PAIR);
event.toolTip.add("Glass-Tier: " + BW_Util.getColorForTier(tier) + GT_Values.VN[tier] + ChatColorHelper.RESET);
} else if (BLOCK.getMaterial().equals(Material.glass)) {
event.toolTip.add("Glass-Tier: " + BW_Util.getColorForTier(3) + GT_Values.VN[3] + ChatColorHelper.RESET);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public BW_GUIContainer_RadLevel(Container p_i1072_1_) {
@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GL11.glColor3f(1, 1, 1);
this.mc.getTextureManager().bindTexture(new ResourceLocation(MainMod.modID, "textures/GUI/GUI_RSC.png"));
this.mc.getTextureManager().bindTexture(new ResourceLocation(MainMod.MOD_ID, "textures/GUI/GUI_RSC.png"));
drawTexturedModalRect(guiLeft - 79, guiTop, 0, 0, 256, 165);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)

protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GL11.glColor3f(0.5f, 0.25f, 0.07f);
this.mc.getTextureManager().bindTexture(new ResourceLocation(MainMod.modID, "textures/GUI/GUIPrimitiveKUBox.png"));
this.mc.getTextureManager().bindTexture(new ResourceLocation(MainMod.MOD_ID, "textures/GUI/GUIPrimitiveKUBox.png"));
int j = (this.width - this.xSize) / 2;
int k = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(j, k, 0, 0, this.xSize, this.ySize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@
package com.github.bartimaeusnek.bartworks.client.gui;

import com.github.bartimaeusnek.bartworks.MainMod;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.gui.GT_Container_MultiMachine;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;

@SideOnly(Side.CLIENT)
public class BW_GUIContainer_Windmill extends GT_GUIContainer_MultiMachine {

public BW_GUIContainer_Windmill(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) {
Expand All @@ -46,7 +49,7 @@ protected void drawGuiContainerForegroundLayer(int par1, int par2) {

protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
GL11.glColor3f(0.5f, 0.25f, 0.07f);
this.mc.getTextureManager().bindTexture(new ResourceLocation(MainMod.modID, "textures/GUI/GUI_Windmill.png"));
this.mc.getTextureManager().bindTexture(new ResourceLocation(MainMod.MOD_ID, "textures/GUI/GUI_Windmill.png"));

int x = (this.width - this.xSize) / 2;
int y = (this.height - this.ySize) / 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@

import com.github.bartimaeusnek.bartworks.MainMod;
import com.github.bartimaeusnek.bartworks.server.container.GT_Container_CircuitProgrammer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;

@SideOnly(Side.CLIENT)
public class GT_GUIContainer_CircuitProgrammer extends GuiContainer {

public static final ResourceLocation texture = new ResourceLocation(MainMod.modID, "textures/GUI/GUI_CircuitP.png");
public static final ResourceLocation texture = new ResourceLocation(MainMod.MOD_ID, "textures/GUI/GUI_CircuitP.png");

public GT_GUIContainer_CircuitProgrammer(InventoryPlayer p_i1072_1_) {
super(new GT_Container_CircuitProgrammer(p_i1072_1_));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@

import com.github.bartimaeusnek.bartworks.MainMod;
import com.github.bartimaeusnek.bartworks.server.container.GT_Container_Item_Destructopack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;

@SideOnly(Side.CLIENT)
public class GT_GUIContainer_Destructopack extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation(MainMod.modID, "textures/GT2/gui/Destructopack.png");
public static final ResourceLocation texture = new ResourceLocation(MainMod.MOD_ID, "textures/GT2/gui/Destructopack.png");

public GT_GUIContainer_Destructopack(InventoryPlayer inventory) {
super(new GT_Container_Item_Destructopack(inventory));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@

import com.github.bartimaeusnek.bartworks.MainMod;
import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler;
import com.github.bartimaeusnek.bartworks.common.tileentities.GT_TileEntity_LESU;
import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_LESU;
import com.github.bartimaeusnek.bartworks.server.container.GT_Container_LESU;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.gui.GT_GUIContainer;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.client.Minecraft;
Expand All @@ -35,9 +37,10 @@

import java.awt.*;

@SideOnly(Side.CLIENT)
public class GT_GUIContainer_LESU extends GT_GUIContainer {

public static final ResourceLocation texture = new ResourceLocation(MainMod.modID, "textures/GT2/gui/LESU.png");
public static final ResourceLocation texture = new ResourceLocation(MainMod.MOD_ID, "textures/GT2/gui/LESU.png");
protected GT_Container_LESU mContainer;
private GT_TileEntity_LESU c;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@

import com.github.bartimaeusnek.bartworks.API.BioVatLogicAdder;
import com.github.bartimaeusnek.bartworks.MainMod;
import com.github.bartimaeusnek.bartworks.common.tileentities.GT_MetaTileEntity_RadioHatch;
import com.github.bartimaeusnek.bartworks.common.tileentities.tiered.GT_MetaTileEntity_RadioHatch;
import com.github.bartimaeusnek.bartworks.server.container.GT_Container_RadioHatch;
import com.github.bartimaeusnek.bartworks.util.BW_Util;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.entity.player.InventoryPlayer;
Expand All @@ -35,12 +36,13 @@

import java.nio.ByteBuffer;

@SideOnly(Side.CLIENT)
public class GT_GUIContainer_RadioHatch extends GT_GUIContainerMetaTile_Machine {
private static int maxSv;
private final String mName;

public GT_GUIContainer_RadioHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) {
super(new GT_Container_RadioHatch(aInventoryPlayer, aTileEntity), MainMod.modID + ":textures/GUI/RadHatch.png");
super(new GT_Container_RadioHatch(aInventoryPlayer, aTileEntity), MainMod.MOD_ID + ":textures/GUI/RadHatch.png");
this.mName = "Radio Hatch";
this.mContainer.detectAndSendChanges();
maxSv = BioVatLogicAdder.RadioHatch.getMaxSv();
Expand All @@ -52,7 +54,7 @@ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
double rem = maxT - timer % maxT;

this.fontRendererObj.drawString(this.mName, 8, 4, 4210752);
this.mc.getTextureManager().bindTexture(new ResourceLocation(MainMod.modID + ":textures/GUI/RadHatch.png"));
this.mc.getTextureManager().bindTexture(new ResourceLocation(MainMod.MOD_ID + ":textures/GUI/RadHatch.png"));
if (((GT_Container_RadioHatch) mContainer).mass > 0) {
GL11.glColor3f(((GT_Container_RadioHatch) mContainer).r / 255f, ((GT_Container_RadioHatch) mContainer).g / 255f, ((GT_Container_RadioHatch) mContainer).b / 255f);
this.drawTexturedModalRect(124, 18, 124, 18, 16, 48);
Expand All @@ -61,9 +63,10 @@ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
this.drawTexturedModalRect(124, 18, 176, 0, 16, 48 - (int) Math.ceil(48 * (rem / maxT)));
this.drawTexturedModalRect(65, 13, 192, 0, (48 * (((GT_Container_RadioHatch) mContainer).sv)) / (maxSv), 16);

this.fontRendererObj.drawString("Sv: " + ((GT_Container_RadioHatch) mContainer).sievert, 8, 50, BW_Util.getColorFromArray(new short[]{((GT_Container_RadioHatch) mContainer).r, ((GT_Container_RadioHatch) mContainer).g, ((GT_Container_RadioHatch) mContainer).b}));
this.fontRendererObj.drawString("Kg: " + ((GT_Container_RadioHatch) mContainer).mass, 8, 68, BW_Util.getColorFromArray(new short[]{((GT_Container_RadioHatch) mContainer).r, ((GT_Container_RadioHatch) mContainer).g, ((GT_Container_RadioHatch) mContainer).b}));
this.fontRendererObj.drawString("Time: " + timer, 8, 76, BW_Util.getColorFromArray(new short[]{((GT_Container_RadioHatch) mContainer).r, ((GT_Container_RadioHatch) mContainer).g, ((GT_Container_RadioHatch) mContainer).b}));

// this.fontRendererObj.drawString("Sv: " + ((GT_Container_RadioHatch) mContainer).sievert, 8, 50, BW_Util.getColorFromArray(new short[]{((GT_Container_RadioHatch) mContainer).r, ((GT_Container_RadioHatch) mContainer).g, ((GT_Container_RadioHatch) mContainer).b}));
// this.fontRendererObj.drawString("Kg: " + ((GT_Container_RadioHatch) mContainer).mass, 8, 68, BW_Util.getColorFromArray(new short[]{((GT_Container_RadioHatch) mContainer).r, ((GT_Container_RadioHatch) mContainer).g, ((GT_Container_RadioHatch) mContainer).b}));
// this.fontRendererObj.drawString("Time: " + timer, 8, 76, BW_Util.getColorFromArray(new short[]{((GT_Container_RadioHatch) mContainer).r, ((GT_Container_RadioHatch) mContainer).g, ((GT_Container_RadioHatch) mContainer).b}));

}

Expand Down
Loading

0 comments on commit f11457d

Please sign in to comment.