diff options
| author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-12-24 03:59:59 +0000 |
|---|---|---|
| committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-12-24 03:59:59 +0000 |
| commit | 12dab5d109ac81034fd0a8fe18317024a996af61 (patch) | |
| tree | c08e9a305f081fef24df556126be744d19f4c0f8 /src | |
| parent | c1606dd2997151dbf09797092a04294230d42059 (diff) | |
| download | GT5-Unofficial-12dab5d109ac81034fd0a8fe18317024a996af61.tar.gz GT5-Unofficial-12dab5d109ac81034fd0a8fe18317024a996af61.tar.bz2 GT5-Unofficial-12dab5d109ac81034fd0a8fe18317024a996af61.zip | |
+ Added a config option to adjust the Turbine Rotor removal cut-off point.
+ Added some new Bags/Packs for various things. An Automatic Lunchbox, a Tool Box and a Magicians Satchel.
+ Added full compound of Eglin Steel to ABS. Closes #392.
- Removed all Multi-Tools.
$ Rewrote and Fixed the recipe system. All recipes are queued regardless of when called, then created during the end of the POST_INIT load phase. Fixes too many bugs to list. (Few more to do before tomorrow)
$ Fixed COFH Hard requirement. Closes #398.
% Adjusted the internal map type of the AutoMap. Should improve performance, if only in single digit cpu cycles.
> To-Do) Fix Recipes pertaining to compound materials made from using fluids. State may be detected wrong after recipe system changes.
Diffstat (limited to 'src')
58 files changed, 2257 insertions, 1257 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 92c7a9a049..077efe102a 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -77,9 +77,14 @@ public class GTplusplus implements ActionListener { mPrev.setPhaseActive(false); } mIsPhaseActive = aIsPhaseActive; + if (CURRENT_LOAD_PHASE != this) { + CURRENT_LOAD_PHASE = this; + } } } + public static INIT_PHASE CURRENT_LOAD_PHASE = INIT_PHASE.SUPER; + //Mod Instance @Mod.Instance(CORE.MODID) public static GTplusplus instance; diff --git a/src/Java/gtPlusPlus/api/objects/GregtechException.java b/src/Java/gtPlusPlus/api/objects/GregtechException.java new file mode 100644 index 0000000000..916dbc4aaf --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/GregtechException.java @@ -0,0 +1,28 @@ +package gtPlusPlus.api.objects; + +public class GregtechException extends Throwable { + + private static final long serialVersionUID = 3601884582161841486L; + + public GregtechException(String aError) { + this(aError, true); + } + + public GregtechException(String aError, boolean aIsVerbose) { + Logger.ERROR("Throwing GT++ Exception!"); + Logger.ERROR("[EXCEPTION] "+aError); + if (aIsVerbose) { + Logger.INFO("Throwing GT++ Exception!"); + Logger.INFO("[EXCEPTION] "+aError); + printStackTrace(); + } + } + + @Override + public void printStackTrace() { + super.printStackTrace(); + } + + + +} diff --git a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java index 45cce2eee5..ca231dbd63 100644 --- a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java +++ b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java @@ -19,12 +19,12 @@ public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable { public AutoMap() { - this(new HashMap<Integer, V>()); + this(new LinkedHashMap<Integer, V>()); } public AutoMap(Map<Integer, V> defaultMapType) { mInternalMap = defaultMapType; - mInternalNameMap = new HashMap<String, Integer>(); + mInternalNameMap = new LinkedHashMap<String, Integer>(); } @Override @@ -86,6 +86,7 @@ public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable { public synchronized boolean clear(){ this.mInternalID = 0; this.mInternalMap.clear(); + this.mInternalNameMap.clear(); return true; } diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java index b089688193..8310fa3c23 100644 --- a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java +++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java @@ -1,14 +1,19 @@ package gtPlusPlus.core.block.base; +import java.util.HashMap; +import java.util.Map; + import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; +import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.TextureSet; import gregtech.api.util.GT_OreDictUnificator; - +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.base.itemblock.ItemBlockGtBlock; import gtPlusPlus.core.item.base.itemblock.ItemBlockGtFrameBox; import gtPlusPlus.core.lib.CORE; @@ -34,6 +39,7 @@ public class BlockBaseModular extends BasicBlock { this(material.getUnlocalizedName(), material.getLocalizedName(), net.minecraft.block.material.Material.iron, blockType, colour, Math.min(Math.max(material.vTier, 1), 6)); blockMaterial = material; + registerComponent(); } protected BlockBaseModular(final String unlocalizedName, final String blockMaterial, @@ -47,8 +53,8 @@ public class BlockBaseModular extends BasicBlock { this.thisBlockMaterial = blockMaterial; this.thisBlockType = blockType.name().toUpperCase(); this.setBlockName(this.GetProperName()); - - if (this.thisBlockType.equals(BlockTypes.STANDARD.name().toUpperCase())) { + int fx = getBlockTypeMeta(); + if (fx == 0) { GameRegistry.registerBlock(this, ItemBlockGtBlock.class, Utils.sanitizeString(blockType.getTexture() + unlocalizedName)); GT_OreDictUnificator.registerOre( @@ -56,7 +62,7 @@ public class BlockBaseModular extends BasicBlock { .replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""), ItemUtils.getSimpleStack(this)); } - else if (this.thisBlockType.equals(BlockTypes.FRAME.name().toUpperCase())) { + else if (fx == 1) { GameRegistry.registerBlock(this, ItemBlockGtBlock.class, Utils.sanitizeString(blockType.getTexture() + unlocalizedName)); GT_OreDictUnificator.registerOre( @@ -64,7 +70,7 @@ public class BlockBaseModular extends BasicBlock { .replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), ItemUtils.getSimpleStack(this)); } - else if (this.thisBlockType.equals(BlockTypes.ORE.name().toUpperCase())) { + else if (fx == 2) { GameRegistry.registerBlock(this, ItemBlockGtBlock.class, Utils.sanitizeString(blockType.getTexture() + unlocalizedName)); GT_OreDictUnificator.registerOre( @@ -72,7 +78,47 @@ public class BlockBaseModular extends BasicBlock { .replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""), ItemUtils.getSimpleStack(this)); } - + } + + public boolean registerComponent() { + Logger.MATERIALS("Attempting to register "+this.getUnlocalizedName()+"."); + if (this.blockMaterial == null) { + Logger.MATERIALS("Tried to register "+this.getUnlocalizedName()+" but the material was null."); + return false; + } + String aName = blockMaterial.getUnlocalizedName(); + //Register Component + Map<String, ItemStack> aMap = Material.mComponentMap.get(aName); + if (aMap == null) { + aMap = new HashMap<String, ItemStack>(); + } + int fx = getBlockTypeMeta(); + String aKey = (fx == 0 ? OrePrefixes.block.name() : ( fx == 1 ? OrePrefixes.frameGt.name() : OrePrefixes.ore.name())); + ItemStack x = aMap.get(aKey); + if (x == null) { + aMap.put(aKey, ItemUtils.getSimpleStack(this)); + Logger.MATERIALS("Registering a material component. Item: ["+aName+"] Map: ["+aKey+"]"); + Material.mComponentMap.put(aName, aMap); + return true; + } + else { + //Bad + Logger.MATERIALS("Tried to double register a material component."); + return false; + } + } + + public int getBlockTypeMeta() { + if (this.thisBlockType.equals(BlockTypes.STANDARD.name().toUpperCase())) { + return 0; + } + else if (this.thisBlockType.equals(BlockTypes.FRAME.name().toUpperCase())) { + return 1; + } + else if (this.thisBlockType.equals(BlockTypes.ORE.name().toUpperCase())) { + return 2; + } + return 0; } /** @@ -153,4 +199,13 @@ public class BlockBaseModular extends BasicBlock { return this.blockColour; } + @Override + public int getBlockColor() { + if (this.blockColour == 0) { + return MathUtils.generateSingularRandomHexValue(); + } + + return this.blockColour; + } + } diff --git a/src/Java/gtPlusPlus/core/config/ConfigHandler.java b/src/Java/gtPlusPlus/core/config/ConfigHandler.java index 4c992ed8f4..d5a43ab883 100644 --- a/src/Java/gtPlusPlus/core/config/ConfigHandler.java +++ b/src/Java/gtPlusPlus/core/config/ConfigHandler.java @@ -66,6 +66,7 @@ public class ConfigHandler { "Adds GT6 recipes for Sulfuric Acid. Should remove all pre-existing recipes."); enableAnimatedTurbines = config.getBoolean("enableAnimatedTurbines", "gregtech", true, "Gives GT Gas/Steam turbines animated textures while running."); + turbineCutoffBase = config.getInt("turbineCutoffBase", "gregtech", 75000, 0, Integer.MAX_VALUE, "Rotors below this durability will be removed, prevents NEI clutter. Minimum Durability is N * x, where N is the new value set and x is the turbine size, where 1 is Tiny and 4 is Huge. Set to 0 to disable."); // Pipes & Cables enableCustom_Pipes = config.getBoolean("enableCustom_Pipes", "gregtech", true, diff --git a/src/Java/gtPlusPlus/core/container/box/LunchBoxContainer.java b/src/Java/gtPlusPlus/core/container/box/LunchBoxContainer.java new file mode 100644 index 0000000000..8e56c661f2 --- /dev/null +++ b/src/Java/gtPlusPlus/core/container/box/LunchBoxContainer.java @@ -0,0 +1,13 @@ +package gtPlusPlus.core.container.box; + +import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; +import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory; +import gtPlusPlus.core.slots.SlotLunchBox; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; + +public class LunchBoxContainer extends ContainerBoxBase { + public LunchBoxContainer(EntityPlayer par1Player, InventoryPlayer inventoryPlayer, CustomBoxInventory CustomBoxInventory) { + super(par1Player, inventoryPlayer, CustomBoxInventory, SlotLunchBox.class, gtPlusPlus.core.item.tool.misc.box.AutoLunchBox.SLOTS); + } +} diff --git a/src/Java/gtPlusPlus/core/container/box/MagicBagContainer.java b/src/Java/gtPlusPlus/core/container/box/MagicBagContainer.java new file mode 100644 index 0000000000..7820d56814 --- /dev/null +++ b/src/Java/gtPlusPlus/core/container/box/MagicBagContainer.java @@ -0,0 +1,13 @@ +package gtPlusPlus.core.container.box; + +import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; +import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory; +import gtPlusPlus.core.slots.SlotMagicToolBag; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; + +public class MagicBagContainer extends ContainerBoxBase { + public MagicBagContainer(EntityPlayer par1Player, InventoryPlayer inventoryPlayer, CustomBoxInventory CustomBoxInventory) { + super(par1Player, inventoryPlayer, CustomBoxInventory, SlotMagicToolBag.class, gtPlusPlus.core.item.tool.misc.box.MagicToolBag.SLOTS); + } +} diff --git a/src/Java/gtPlusPlus/core/container/box/ToolBoxContainer.java b/src/Java/gtPlusPlus/core/container/box/ToolBoxContainer.java new file mode 100644 index 0000000000..49719aa9ba --- /dev/null +++ b/src/Java/gtPlusPlus/core/container/box/ToolBoxContainer.java @@ -0,0 +1,15 @@ +package gtPlusPlus.core.container.box; + +import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; +import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory; +import gtPlusPlus.core.item.tool.misc.box.UniversalToolBox; +import gtPlusPlus.core.slots.SlotToolBox; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; + +public class ToolBoxContainer extends ContainerBoxBase { + public ToolBoxContainer(EntityPlayer par1Player, InventoryPlayer inventoryPlayer, + CustomBoxInventory CustomBoxInventory) { + super(par1Player, inventoryPlayer, CustomBoxInventory, SlotToolBox.class, UniversalToolBox.SLOTS); + } +} diff --git a/src/Java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java b/src/Java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java new file mode 100644 index 0000000000..97ec58bfa4 --- /dev/null +++ b/src/Java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java @@ -0,0 +1,116 @@ +package gtPlusPlus.core.gui.item.box; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; +import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.ResourceLocation; + +public class GuiBaseBox extends GuiContainer { + /** + * x and y size of the inventory window in pixels. Defined as float, passed as + * int These are used for drawing the player model. + */ + private float xSize_lo; + private float ySize_lo; + + /** + * ResourceLocation takes 2 parameters: ModId, path to texture at the location: + * "src/minecraft/assets/modid/" + * + * I have provided a sample texture file that works with this tutorial. Download + * it from Forge_Tutorials/textures/gui/ + */ + private final ResourceLocation iconLocation; + + /** The inventory to render on screen */ + private final CustomBoxInventory inventory; + + public GuiBaseBox(ContainerBoxBase containerItem, ResourceLocation aGuiTexture) { + super(containerItem); + this.inventory = containerItem.getInventoryObject(); + this.iconLocation = aGuiTexture; + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) { + super.drawScreen(par1, par2, par3); + this.xSize_lo = (float) par1; + this.ySize_lo = (float) par2; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the + * items) + */ + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + String s = this.inventory.hasCustomInventoryName() ? this.inventory.getInventoryName() + : I18n.format(this.inventory.getInventoryName()); + this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 0, 4210752); + this.fontRendererObj.drawString(I18n.format("container.inventory"), 26, this.ySize - 96 + 4, 4210752); + } + + /** + * Draw the background layer for the GuiContainer (everything behind the items) + */ + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(iconLocation); + int k = (this.width - this.xSize) / 2; + int l = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); + int i1; + drawPlayerModel(k + 51, l + 75, 30, (float) (k + 51) - this.xSize_lo, (float) (l + 75 - 50) - this.ySize_lo, + this.mc.thePlayer); + } + + /** + * This renders the player model in standard inventory position (in later + * versions of Minecraft / Forge, you can simply call + * GuiInventory.drawEntityOnScreen directly instead of copying this code) + */ + public static void drawPlayerModel(int x, int y, int scale, float yaw, float pitch, EntityLivingBase entity) { + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + GL11.glPushMatrix(); + GL11.glTranslatef(x, y, 50.0F); + GL11.glScalef(-scale, scale, scale); + GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); + float f2 = entity.renderYawOffset; + float f3 = entity.rotationYaw; + float f4 = entity.rotationPitch; + float f5 = entity.prevRotationYawHead; + float f6 = entity.rotationYawHead; + GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-((float) Math.atan(pitch / 40.0F)) * 20.0F, 1.0F, 0.0F, 0.0F); + entity.renderYawOffset = (float) Math.atan(yaw / 40.0F) * 20.0F; + entity.rotationYaw = (float) Math.atan(yaw / 40.0F) * 40.0F; + entity.rotationPitch = -((float) Math.atan(pitch / 40.0F)) * 20.0F; + entity.rotationYawHead = entity.rotationYaw; + entity.prevRotationYawHead = entity.rotationYaw; + GL11.glTranslatef(0.0F, entity.yOffset, 0.0F); + RenderManager.instance.playerViewY = 180.0F; + RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); + entity.renderYawOffset = f2; + entity.rotationYaw = f3; + entity.rotationPitch = f4; + entity.prevRotationYawHead = f5; + entity.rotationYawHead = f6; + GL11.glPopMatrix(); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glDisable(GL11.GL_TEXTURE_2D); + OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java b/src/Java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java new file mode 100644 index 0000000000..28e3913ac8 --- /dev/null +++ b/src/Java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java @@ -0,0 +1,11 @@ +package gtPlusPlus.core.gui.item.box; + +import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.util.ResourceLocation; + +public class LunchBoxGui extends GuiBaseBox { + public LunchBoxGui(ContainerBoxBase containerItem) { + super(containerItem, new ResourceLocation(CORE.MODID, "textures/gui/schematic_rocket_GS1.png")); + } +} diff --git a/src/Java/gtPlusPlus/core/gui/item/box/MagicBagGui.java b/src/Java/gtPlusPlus/core/gui/item/box/MagicBagGui.java new file mode 100644 index 0000000000..958cdd3c70 --- /dev/null +++ b/src/Java/gtPlusPlus/core/gui/item/box/MagicBagGui.java @@ -0,0 +1,11 @@ +package gtPlusPlus.core.gui.item.box; + +import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.util.ResourceLocation; + +public class MagicBagGui extends GuiBaseBox { + public MagicBagGui(ContainerBoxBase containerItem) { + super(containerItem, new ResourceLocation(CORE.MODID, "textures/gui/schematic_rocket_GS1.png")); + } +} diff --git a/src/Java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java b/src/Java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java new file mode 100644 index 0000000000..c440c017e9 --- /dev/null +++ b/src/Java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java @@ -0,0 +1,11 @@ +package gtPlusPlus.core.gui.item.box; + +import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.util.ResourceLocation; + +public class ToolBoxGui extends GuiBaseBox { + public ToolBoxGui(ContainerBoxBase containerItem) { + super(containerItem, new ResourceLocation(CORE.MODID, "textures/gui/schematic_rocket_GS1.png")); + } +} |
