diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index 1b3f8c318..c6661933d 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -149,6 +149,7 @@ public class ModBlocks { public static Block block_titanium; public static Block block_sulfur; public static Block block_niter; + public static Block block_niter_reinforced; public static Block block_copper; public static Block block_red_copper; public static Block block_tungsten; @@ -198,6 +199,7 @@ public class ModBlocks { public static Block block_lanthanium; public static Block block_actinium; public static Block block_tritium; + public static Block block_semtex; public static Block block_australium; public static Block block_weidanium; @@ -1196,6 +1198,7 @@ public class ModBlocks { block_titanium = new BlockGeneric(Material.iron).setBlockName("block_titanium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_titanium"); block_sulfur = new BlockGeneric(Material.iron).setBlockName("block_sulfur").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_sulfur"); block_niter = new BlockGeneric(Material.iron).setBlockName("block_niter").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_niter"); + block_niter_reinforced = new BlockGeneric(Material.iron).setBlockName("block_niter_reinforced").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":block_niter_reinforced"); block_copper = new BlockGeneric(Material.iron).setBlockName("block_copper").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_copper"); block_red_copper = new BlockGeneric(Material.iron).setBlockName("block_red_copper").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_red_copper"); block_tungsten = new BlockGeneric(Material.iron).setBlockName("block_tungsten").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_tungsten"); @@ -1245,6 +1248,7 @@ public class ModBlocks { block_lanthanium = new BlockGeneric(Material.iron).setBlockName("block_lanthanium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_lanthanium"); block_actinium = new BlockGeneric(Material.iron).setBlockName("block_actinium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_actinium"); block_tritium = new BlockRotatablePillar(Material.glass, RefStrings.MODID + ":block_tritium_top").setBlockName("block_tritium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGlass).setHardness(3.0F).setResistance(2.0F).setBlockTextureName(RefStrings.MODID + ":block_tritium_side"); + block_semtex = new BlockSemtex(Material.tnt).setBlockName("block_semtex").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(2.0F).setResistance(2.0F).setBlockTextureName(RefStrings.MODID + ":block_semtex"); block_australium = new BlockGeneric(Material.iron).setBlockName("block_australium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_australium"); block_weidanium = new BlockGeneric(Material.iron).setBlockName("block_weidanium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_weidanium"); @@ -2077,6 +2081,7 @@ public class ModBlocks { GameRegistry.registerBlock(block_titanium, block_titanium.getUnlocalizedName()); GameRegistry.registerBlock(block_sulfur, block_sulfur.getUnlocalizedName()); GameRegistry.registerBlock(block_niter, block_niter.getUnlocalizedName()); + GameRegistry.registerBlock(block_niter_reinforced, block_niter_reinforced.getUnlocalizedName()); GameRegistry.registerBlock(block_copper, block_copper.getUnlocalizedName()); GameRegistry.registerBlock(block_red_copper, block_red_copper.getUnlocalizedName()); GameRegistry.registerBlock(block_advanced_alloy, block_advanced_alloy.getUnlocalizedName()); @@ -2132,6 +2137,7 @@ public class ModBlocks { GameRegistry.registerBlock(block_lanthanium, block_lanthanium.getUnlocalizedName()); GameRegistry.registerBlock(block_actinium, block_actinium.getUnlocalizedName()); GameRegistry.registerBlock(block_tritium, block_tritium.getUnlocalizedName()); + GameRegistry.registerBlock(block_semtex, block_semtex.getUnlocalizedName()); //Bottlecap Blocks GameRegistry.registerBlock(block_cap_nuka, block_cap_nuka.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/blocks/bomb/BlockSemtex.java b/src/main/java/com/hbm/blocks/bomb/BlockSemtex.java new file mode 100644 index 000000000..e9a604f7c --- /dev/null +++ b/src/main/java/com/hbm/blocks/bomb/BlockSemtex.java @@ -0,0 +1,66 @@ +package com.hbm.blocks.bomb; + +import com.hbm.lib.RefStrings; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class BlockSemtex extends Block { + + @SideOnly(Side.CLIENT) + private IIcon topIcon; + + public BlockSemtex(Material mat) { + super(mat); + } + + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister p_149651_1_) { + this.blockIcon = p_149651_1_.registerIcon(RefStrings.MODID + ":block_semtex"); + this.topIcon = p_149651_1_.registerIcon(RefStrings.MODID + ":block_semtex_front"); + } + + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + int k = getPistonOrientation(meta); + return ForgeDirection.getOrientation(k).getOpposite().ordinal() == side ? this.topIcon : this.blockIcon; + } + + public static int getPistonOrientation(int meta) { + return meta & 7; + } + + @Override + public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) { + int l = determineOrientation(p_149689_1_, p_149689_2_, p_149689_3_, p_149689_4_, p_149689_5_); + p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, l, 2); + } + + public static int determineOrientation(World p_150071_0_, int p_150071_1_, int p_150071_2_, int p_150071_3_, EntityLivingBase p_150071_4_) { + + if(MathHelper.abs((float) p_150071_4_.posX - (float) p_150071_1_) < 2.0F && MathHelper.abs((float) p_150071_4_.posZ - (float) p_150071_3_) < 2.0F) { + double d0 = p_150071_4_.posY + 1.82D - (double) p_150071_4_.yOffset; + + if(d0 - (double) p_150071_2_ > 2.0D) { + return 0; + } + + if((double) p_150071_2_ - d0 > 0.0D) { + return 1; + } + } + + int l = MathHelper.floor_double((double) (p_150071_4_.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + + return l == 0 ? 3 : (l == 1 ? 4 : (l == 2 ? 2 : (l == 3 ? 5 : 1))); + } +} diff --git a/src/main/java/com/hbm/handler/GUIHandler.java b/src/main/java/com/hbm/handler/GUIHandler.java index 6d81d5567..b6d064c25 100644 --- a/src/main/java/com/hbm/handler/GUIHandler.java +++ b/src/main/java/com/hbm/handler/GUIHandler.java @@ -1687,7 +1687,7 @@ public class GUIHandler implements IGuiHandler { case ModBlocks.guiID_anvil: { if(world.getBlock(x, y, z) instanceof NTMAnvil) { - return new GUIAnvil(player.inventory); + return new GUIAnvil(player.inventory, ((NTMAnvil)world.getBlock(x, y, z)).tier); } return null; } diff --git a/src/main/java/com/hbm/handler/HTTPHandler.java b/src/main/java/com/hbm/handler/HTTPHandler.java index d1633e9a5..651c4691d 100644 --- a/src/main/java/com/hbm/handler/HTTPHandler.java +++ b/src/main/java/com/hbm/handler/HTTPHandler.java @@ -68,9 +68,6 @@ public class HTTPHandler { capsule.add(line); } - if(capsule.isEmpty()) - capsule.add("I AM ERROR"); - in.close(); } diff --git a/src/main/java/com/hbm/inventory/AnvilRecipes.java b/src/main/java/com/hbm/inventory/AnvilRecipes.java index ce45e7a4f..5ea71bc3d 100644 --- a/src/main/java/com/hbm/inventory/AnvilRecipes.java +++ b/src/main/java/com/hbm/inventory/AnvilRecipes.java @@ -10,44 +10,89 @@ import com.hbm.inventory.RecipesCommon.OreDictStack; import com.hbm.items.ModItems; import net.minecraft.block.Block; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; public class AnvilRecipes { - + private static List smithingRecipes = new ArrayList(); + private static List constructionRecipes = new ArrayList(); public static void register() { + registerSmithing(); + registerConstruction(); + } + + public static void registerSmithing() { - smithingRecipes.add(new AnvilSmithingRecipe(2, new ItemStack(ModItems.plate_steel, 2), - new OreDictStack("ingotSteel"), new OreDictStack("ingotSteel"))); + smithingRecipes.add(new AnvilSmithingRecipe(2, new ItemStack(ModItems.plate_steel, 2), new OreDictStack("ingotSteel"), new OreDictStack("ingotSteel"))); Block[] anvils = new Block[]{ModBlocks.anvil_iron, ModBlocks.anvil_lead}; for(Block anvil : anvils) { - smithingRecipes.add(new AnvilSmithingRecipe(1, new ItemStack(ModBlocks.anvil_bismuth, 1), - new ComparableStack(anvil), new ComparableStack(ModItems.ingot_bismuth, 10))); - smithingRecipes.add(new AnvilSmithingRecipe(1, new ItemStack(ModBlocks.anvil_dnt, 1), - new ComparableStack(anvil), new ComparableStack(ModItems.ingot_dineutronium, 10))); - smithingRecipes.add(new AnvilSmithingRecipe(1, new ItemStack(ModBlocks.anvil_ferrouranium, 1), - new ComparableStack(anvil), new ComparableStack(ModItems.ingot_u238, 10))); - smithingRecipes.add(new AnvilSmithingRecipe(1, new ItemStack(ModBlocks.anvil_meteorite, 1), - new ComparableStack(anvil), new ComparableStack(ModItems.ingot_meteorite, 10))); - smithingRecipes.add(new AnvilSmithingRecipe(1, new ItemStack(ModBlocks.anvil_schrabidate, 1), - new ComparableStack(anvil), new ComparableStack(ModItems.ingot_schrabidate, 10))); - smithingRecipes.add(new AnvilSmithingRecipe(1, new ItemStack(ModBlocks.anvil_starmetal, 1), - new ComparableStack(anvil), new ComparableStack(ModItems.ingot_starmetal, 10))); - smithingRecipes.add(new AnvilSmithingRecipe(1, new ItemStack(ModBlocks.anvil_steel, 1), - new ComparableStack(anvil), new OreDictStack("ingotSteel", 10))); + smithingRecipes.add(new AnvilSmithingRecipe(1, new ItemStack(ModBlocks.anvil_bismuth, 1), new ComparableStack(anvil), new ComparableStack(ModItems.ingot_bismuth, 10))); + smithingRecipes.add(new AnvilSmithingRecipe(1, new ItemStack(ModBlocks.anvil_dnt, 1), new ComparableStack(anvil), new ComparableStack(ModItems.ingot_dineutronium, 10))); + smithingRecipes.add(new AnvilSmithingRecipe(1, new ItemStack(ModBlocks.anvil_ferrouranium, 1), new ComparableStack(anvil), new ComparableStack(ModItems.ingot_u238, 10))); + smithingRecipes.add(new AnvilSmithingRecipe(1, new ItemStack(ModBlocks.anvil_meteorite, 1), new ComparableStack(anvil), new ComparableStack(ModItems.ingot_meteorite, 10))); + smithingRecipes.add(new AnvilSmithingRecipe(1, new ItemStack(ModBlocks.anvil_schrabidate, 1), new ComparableStack(anvil), new ComparableStack(ModItems.ingot_schrabidate, 10))); + smithingRecipes.add(new AnvilSmithingRecipe(1, new ItemStack(ModBlocks.anvil_starmetal, 1), new ComparableStack(anvil), new ComparableStack(ModItems.ingot_starmetal, 10))); + smithingRecipes.add(new AnvilSmithingRecipe(1, new ItemStack(ModBlocks.anvil_steel, 1), new ComparableStack(anvil), new OreDictStack("ingotSteel", 10))); } - smithingRecipes.add(new AnvilSmithingRecipe(1, new ItemStack(ModItems.gun_ar15, 1), - new ComparableStack(ModItems.gun_thompson), new ComparableStack(ModItems.pipe_lead))); + smithingRecipes.add(new AnvilSmithingRecipe(1, new ItemStack(ModItems.gun_ar15, 1), new ComparableStack(ModItems.gun_thompson), new ComparableStack(ModItems.pipe_lead))); + } + + public static void registerConstruction() { + constructionRecipes.add(new AnvilConstructionRecipe( + new OreDictStack("ingotIron"), + new AnvilOutput(new ItemStack(ModItems.plate_iron)) + ).setTier(1)); + constructionRecipes.add(new AnvilConstructionRecipe( + new OreDictStack("ingotGold"), + new AnvilOutput(new ItemStack(ModItems.plate_gold)) + ).setTier(1)); + constructionRecipes.add(new AnvilConstructionRecipe( + new OreDictStack("ingotCopper"), + new AnvilOutput(new ItemStack(ModItems.plate_copper)) + ).setTier(1)); + constructionRecipes.add(new AnvilConstructionRecipe( + new OreDictStack("ingotLead"), + new AnvilOutput(new ItemStack(ModItems.plate_lead)) + ).setTier(1)); + constructionRecipes.add(new AnvilConstructionRecipe( + new OreDictStack("ingotSteel"), + new AnvilOutput(new ItemStack(ModItems.plate_steel)) + ).setTier(1)); + constructionRecipes.add(new AnvilConstructionRecipe( + new ComparableStack(ModBlocks.barrel_tcalloy), + new AnvilOutput[] { + new AnvilOutput(new ItemStack(ModItems.ingot_titanium, 2)), + new AnvilOutput(new ItemStack(ModItems.ingot_tcalloy, 4)), + new AnvilOutput(new ItemStack(ModItems.ingot_tcalloy, 1), 0.50F), + new AnvilOutput(new ItemStack(ModItems.ingot_tcalloy, 1), 0.25F) + } + ).setTier(3)); + + for(int i = 0; i < 8; i++) + constructionRecipes.add(new AnvilConstructionRecipe( + new OreDictStack("plateCopper"), + new AnvilOutput(new ItemStack(ModItems.wire_copper, 8)) + ).setTier(1)); + + constructionRecipes.add(new AnvilConstructionRecipe( + new OreDictStack("plateGold"), + new AnvilOutput(new ItemStack(ModItems.wire_gold, 8)) + ).setTier(1)); } public static List getSmithing() { return smithingRecipes; } + public static List getConstruction() { + return constructionRecipes; + } + public static class AnvilSmithingRecipe { int tier; @@ -102,4 +147,89 @@ public class AnvilRecipes { return 0; } } + + public static class AnvilConstructionRecipe { + public List input = new ArrayList(); + public List output = new ArrayList(); + int tier = 0; + OverlayType overlay = OverlayType.NONE; + + public AnvilConstructionRecipe(AStack input, AnvilOutput output) { + this.input.add(input); + this.output.add(output); + this.setOverlay(OverlayType.SMITHING); //preferred overlay for 1:1 conversions is smithing + } + + public AnvilConstructionRecipe(AStack[] input, AnvilOutput output) { + for(AStack stack : input) this.input.add(stack); + this.output.add(output); + this.setOverlay(OverlayType.CONSTRUCTION); //preferred overlay for many:1 conversions is construction + } + + public AnvilConstructionRecipe(AStack input, AnvilOutput[] output) { + this.input.add(input); + for(AnvilOutput out : output) this.output.add(out); + this.setOverlay(OverlayType.RECYCLING); //preferred overlay for 1:many conversions is recycling + } + + public AnvilConstructionRecipe(AStack[] input, AnvilOutput[] output) { + for(AStack stack : input) this.input.add(stack); + for(AnvilOutput out : output) this.output.add(out); + this.setOverlay(OverlayType.NONE); //no preferred overlay for many:many conversions + } + + public AnvilConstructionRecipe setTier(int tier) { + this.tier = tier; + return this; + } + + public int getTier() { + return this.tier; + } + + public AnvilConstructionRecipe setOverlay(OverlayType overlay) { + this.overlay = overlay; + return this; + } + + public OverlayType getOverlay() { + return this.overlay; + } + + public ItemStack getDisplay() { + switch(this.overlay) { + case NONE: return this.output.get(0).stack.copy(); + case CONSTRUCTION: return this.output.get(0).stack.copy(); + case SMITHING: return this.output.get(0).stack.copy(); + case RECYCLING: + for(AStack stack : this.input) { + if(stack instanceof ComparableStack) + return ((ComparableStack)stack).toStack(); + } + return this.output.get(0).stack.copy(); + default: return new ItemStack(Items.iron_pickaxe); + } + } + } + + public static class AnvilOutput { + public ItemStack stack; + public float chance; + + public AnvilOutput(ItemStack stack) { + this(stack, 1F); + } + + public AnvilOutput(ItemStack stack, float chance) { + this.stack = stack; + this.chance = chance; + } + } + + public static enum OverlayType { + NONE, + CONSTRUCTION, + RECYCLING, + SMITHING; + } } diff --git a/src/main/java/com/hbm/inventory/gui/GUIAnvil.java b/src/main/java/com/hbm/inventory/gui/GUIAnvil.java index 96c267419..2517d54e6 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIAnvil.java +++ b/src/main/java/com/hbm/inventory/gui/GUIAnvil.java @@ -1,34 +1,179 @@ package com.hbm.inventory.gui; +import java.util.ArrayList; +import java.util.List; + import org.lwjgl.opengl.GL11; +import com.hbm.inventory.AnvilRecipes; +import com.hbm.inventory.AnvilRecipes.AnvilConstructionRecipe; +import com.hbm.inventory.AnvilRecipes.AnvilOutput; +import com.hbm.inventory.RecipesCommon.AStack; +import com.hbm.inventory.RecipesCommon.ComparableStack; +import com.hbm.inventory.RecipesCommon.OreDictStack; import com.hbm.inventory.container.ContainerAnvil; import com.hbm.lib.RefStrings; +import com.hbm.packet.AuxButtonPacket; +import com.hbm.packet.PacketDispatcher; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.oredict.OreDictionary; public class GUIAnvil extends GuiContainer { public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_anvil.png"); + + private int tier; + private List recipes = new ArrayList(); + int index; + int size; + int selection; - public GUIAnvil(InventoryPlayer player) { + public GUIAnvil(InventoryPlayer player, int tier) { super(new ContainerAnvil(player)); + this.tier = tier; this.xSize = 176; this.ySize = 222; + this.index = 0; + this.selection = -1; guiLeft = (this.width - this.xSize) / 2; guiTop = (this.height - this.ySize) / 2; + + for(AnvilConstructionRecipe recipe : AnvilRecipes.getConstruction()) { + if(recipe.getTier() <= this.tier) + this.recipes.add(recipe); + } + + this.size = (int)Math.ceil((this.recipes.size() - 10) / 2D); + } + + protected void mouseClicked(int x, int y, int k) { + super.mouseClicked(x, y, k); + + if(guiLeft + 7 <= x && guiLeft + 7 + 9 > x && guiTop + 71 < y && guiTop + 71 + 36 >= y) { + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + if(this.index > 0) + this.index--; + + return; + } + + if(guiLeft + 106 <= x && guiLeft + 106 + 9 > x && guiTop + 71 < y && guiTop + 71 + 36 >= y) { + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + if(this.index < this.size) + this.index++; + + return; + } + + if(guiLeft + 52 <= x && guiLeft + 52 + 18 > x && guiTop + 53 < y && guiTop + 53 + 18 >= y) { + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + //craft + + return; + } + + for(int i = index * 2; i < index * 2 + 10; i++) { + + if(i >= this.recipes.size()) + break; + + int ind = i - index * 2; + + int ix = 16 + 18 * (ind / 2); + int iy = 71 + 18 * (ind % 2); + if(guiLeft + ix <= x && guiLeft + ix + 18 > x && guiTop + iy < y && guiTop + iy + 18 >= y) { + + if(this.selection != i) + this.selection = i; + else + this.selection = -1; + + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + return; + } + } } protected void drawGuiContainerForegroundLayer(int mX, int mY) { - String name = I18n.format("container.anvil"); + String name = I18n.format("container.anvil", tier); this.fontRendererObj.drawString(name, 61 - this.fontRendererObj.getStringWidth(name) / 2, 8, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + + if(this.selection >= 0) { + int longest = 1; + List list = new ArrayList(); + AnvilConstructionRecipe recipe = recipes.get(this.selection); + + list.add(EnumChatFormatting.YELLOW + "Inputs:"); + + for(AStack stack : recipe.input) { + if(stack instanceof ComparableStack) { + ItemStack input = ((ComparableStack) stack).toStack(); + String toAdd = ">" + input.stackSize + "x " + input.getDisplayName(); + int len = this.fontRendererObj.getStringWidth(toAdd); + if(len > longest) + longest = len; + list.add(toAdd); + + } else if(stack instanceof OreDictStack) { + OreDictStack input = (OreDictStack) stack; + ArrayList ores = OreDictionary.getOres(input.name); + + if(ores.size() > 0) { + ItemStack inStack = ores.get((int) (Math.abs(System.currentTimeMillis() / 1000) % ores.size())); + String toAdd = ">" + input.stacksize + "x " + inStack.getDisplayName(); + int len = this.fontRendererObj.getStringWidth(toAdd); + if(len > longest) + longest = len; + list.add(toAdd); + + } else { + list.add("I AM ERROR"); + } + } + } + + list.add(""); + list.add(EnumChatFormatting.YELLOW + "Outputs:"); + + for(AnvilOutput stack : recipe.output) { + String toAdd = ">" + stack.stack.stackSize + "x " + stack.stack.getDisplayName() + (stack.chance != 1F ? (" (" + (stack.chance * 100) + "%)" ) : ""); + int len = this.fontRendererObj.getStringWidth(toAdd); + if(len > longest) + longest = len; + list.add(toAdd); + } + + double scale = 0.5D; + GL11.glScaled(scale, scale, scale); + int offset = 0; + for(String s : list) { + this.fontRendererObj.drawString(s, 260, 50 + offset, 0xffffff); + offset += 9; + } + + this.lastSize = (int)(longest * scale); + GL11.glScaled(1D/scale, 1D/scale, 1D/scale); + + } else { + this.lastSize = 0; + } } + + int lastSize = 1; protected void drawGuiContainerBackgroundLayer(float inter, int mX, int mY) { @@ -36,6 +181,49 @@ public class GUIAnvil extends GuiContainer { this.mc.getTextureManager().bindTexture(texture); this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, this.xSize, this.ySize); - this.drawTexturedModalRect(guiLeft + 176, guiTop + 17, 176, 17, 3, 108); + + int slide = MathHelper.clamp_int(this.lastSize - 42, 0, 1000); + this.drawTexturedModalRect(guiLeft + 125 + slide, guiTop + 17, 125, 17, 54, 108); + + if(guiLeft + 7 <= mX && guiLeft + 7 + 9 > mX && guiTop + 71 < mY && guiTop + 71 + 36 >=mY) { + drawTexturedModalRect(guiLeft + 7, guiTop + 71, 176, 186, 9, 36); + } + if(guiLeft + 106 <= mX && guiLeft + 106 + 9 > mX && guiTop + 71 < mY && guiTop + 71 + 36 >=mY) { + drawTexturedModalRect(guiLeft + 106, guiTop + 71, 185, 186, 9, 36); + } + if(guiLeft + 52 <= mX && guiLeft + 52 + 18 > mX && guiTop + 53 < mY && guiTop + 53 + 18 >=mY) { + drawTexturedModalRect(guiLeft + 52, guiTop + 53, 176, 150, 18, 18); + } + + for(int i = index * 2; i < index * 2 + 10; i++) { + if(i >= recipes.size()) + break; + + int ind = i - index * 2; + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + RenderHelper.enableGUIStandardItemLighting(); + GL11.glDisable(GL11.GL_LIGHTING); + + AnvilConstructionRecipe recipe = recipes.get(i); + ItemStack display = recipe.getDisplay(); + + FontRenderer font = null; + if (display != null) font = display.getItem().getFontRenderer(display); + if (font == null) font = fontRendererObj; + + itemRender.zLevel = 100.0F; + itemRender.renderItemAndEffectIntoGUI(font, this.mc.getTextureManager(), recipe.getDisplay(), guiLeft + 17 + 18 * (ind / 2), guiTop + 72 + 18 * (ind % 2)); + itemRender.zLevel = 0.0F; + + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glDisable(GL11.GL_LIGHTING); + this.mc.getTextureManager().bindTexture(texture); + this.zLevel = 300.0F; + this.drawTexturedModalRect(guiLeft + 16 + 18 * (ind / 2), guiTop + 71 + 18 * (ind % 2), 18 + 18 * recipe.getOverlay().ordinal(), 222, 18, 18); + + if(selection == i) + this.drawTexturedModalRect(guiLeft + 16 + 18 * (ind / 2), guiTop + 71 + 18 * (ind % 2), 0, 222, 18, 18); + } } } diff --git a/src/main/java/com/hbm/inventory/gui/GUICoreEmitter.java b/src/main/java/com/hbm/inventory/gui/GUICoreEmitter.java index ed32d3091..7acdbb6b6 100644 --- a/src/main/java/com/hbm/inventory/gui/GUICoreEmitter.java +++ b/src/main/java/com/hbm/inventory/gui/GUICoreEmitter.java @@ -109,11 +109,12 @@ public class GUICoreEmitter extends GuiInfoContainer { emitter.tank.renderTank(this, guiLeft + 8, guiTop + 69, emitter.tank.getTankType().textureX() * FluidTank.x, emitter.tank.getTankType().textureY() * FluidTank.y, 16, 52); } - protected void keyTyped(char p_73869_1_, int p_73869_2_) - { - if (this.field.textboxKeyTyped(p_73869_1_, p_73869_2_)) { } - else { - super.keyTyped(p_73869_1_, p_73869_2_); - } - } + protected void keyTyped(char p_73869_1_, int p_73869_2_) { + + if(this.field.textboxKeyTyped(p_73869_1_, p_73869_2_)) { + + } else { + super.keyTyped(p_73869_1_, p_73869_2_); + } + } } diff --git a/src/main/java/com/hbm/inventory/gui/GUIFEL.java b/src/main/java/com/hbm/inventory/gui/GUIFEL.java index 9bac2e645..3365d8759 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIFEL.java +++ b/src/main/java/com/hbm/inventory/gui/GUIFEL.java @@ -1,5 +1,6 @@ package com.hbm.inventory.gui; +import org.apache.commons.lang3.math.NumberUtils; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; @@ -14,13 +15,14 @@ import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; public class GUIFEL extends GuiInfoContainer { public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/machine/gui_fel.png"); private TileEntityFEL fel; - private GuiTextField field; + private GuiTextField field; public GUIFEL(InventoryPlayer invPlayer, TileEntityFEL laser) { super(new ContainerFEL(invPlayer, laser)); @@ -32,16 +34,15 @@ public class GUIFEL extends GuiInfoContainer { @Override public void initGui() { - super.initGui(); - - Keyboard.enableRepeatEvents(true); - this.field = new GuiTextField(this.fontRendererObj, guiLeft + 57, guiTop + 57, 29, 12); - this.field.setTextColor(-1); - this.field.setDisabledTextColour(-1); - this.field.setEnableBackgroundDrawing(false); - this.field.setMaxStringLength(3); - this.field.setText(String.valueOf(fel.watts)); + + Keyboard.enableRepeatEvents(true); + this.field = new GuiTextField(this.fontRendererObj, guiLeft + 57, guiTop + 57, 29, 12); + this.field.setTextColor(-1); + this.field.setDisabledTextColour(-1); + this.field.setEnableBackgroundDrawing(false); + this.field.setMaxStringLength(3); + this.field.setText(String.valueOf(fel.watts)); } @Override @@ -54,12 +55,29 @@ public class GUIFEL extends GuiInfoContainer { this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 133, guiTop + 43, 18, 9, mouseX, mouseY, new String[] {"UV"}); this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 133, guiTop + 52, 18, 9, mouseX, mouseY, new String[] {"X-Ray"}); this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 133, guiTop + 61, 18, 9, mouseX, mouseY, new String[] {"Gamma Ray"}); + + this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 17, 16, 52, fel.power, fel.maxPower); } protected void mouseClicked(int x, int y, int i) { super.mouseClicked(x, y, i); this.field.mouseClicked(x, y, i); + + if(guiLeft + 97 <= x && guiLeft + 97 + 18 > x && guiTop + 52 < y && guiTop + 52 + 18 >= y) { + + if(NumberUtils.isNumber(field.getText())) { + int j = MathHelper.clamp_int((int) Double.parseDouble(field.getText()), 1, 100); + field.setText(j + ""); + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(fel.xCoord, fel.yCoord, fel.zCoord, j, 1)); + } + } + + if(guiLeft + 97 <= x && guiLeft + 97 + 18 > x && guiTop + 16 < y && guiTop + 16 + 18 >= y) { + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(fel.xCoord, fel.yCoord, fel.zCoord, 0, 2)); + } for(int k = 0; k < 6; k++) { @@ -86,10 +104,26 @@ public class GUIFEL extends GuiInfoContainer { if(field.isFocused()) drawTexturedModalRect(guiLeft + 53, guiTop + 53, 210, 4, 34, 16); + + if(fel.isOn) + drawTexturedModalRect(guiLeft + 97, guiTop + 16, 192, 0, 18, 18); int mode = fel.mode; drawTexturedModalRect(guiLeft + 133, guiTop + 16 + mode * 9, 176, 52 + mode * 9, 18, 9); - this.field.drawTextBox(); + int i = (int) fel.getPowerScaled(52); + drawTexturedModalRect(guiLeft + 8, guiTop + 69 - i, 176, 52 - i, 16, i); + + drawTexturedModalRect(guiLeft + 53, guiTop + 45, 210, 0, fel.watts * 34 / 100, 4); + + this.field.drawTextBox(); + } + + @Override + protected void keyTyped(char c, int key) { + + if(!this.field.textboxKeyTyped(c, key)) { + super.keyTyped(c, key); + } } } diff --git a/src/main/java/com/hbm/inventory/gui/GUIScreenTemplateFolder.java b/src/main/java/com/hbm/inventory/gui/GUIScreenTemplateFolder.java index 84515a50d..dc74af560 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIScreenTemplateFolder.java +++ b/src/main/java/com/hbm/inventory/gui/GUIScreenTemplateFolder.java @@ -166,9 +166,6 @@ public class GUIScreenTemplateFolder extends GuiScreen { } protected void mouseClicked(int i, int j, int k) { - - System.out.println(i + " " + j); - System.out.println((guiLeft + i) + " " + (guiTop + j)); if(i >= guiLeft + 45 && i < guiLeft + 117 && j >= guiTop + 211 && j < guiTop + 223) { this.search.setFocused(true); diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index 669e9cdcb..96d3be728 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -352,6 +352,7 @@ public class CraftingManager { GameRegistry.addRecipe(new ItemStack(ModBlocks.tile_lab_broken, 6), new Object[] { " C " , "C C", " C ", 'C', ModBlocks.tile_lab_cracked }); GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.asphalt_light, 1), new Object[] { ModBlocks.asphalt, Items.glowstone_dust }); GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.asphalt, 1), new Object[] { ModBlocks.asphalt_light }); + GameRegistry.addRecipe(new ItemStack(ModBlocks.block_niter_reinforced, 1), new Object[] { "TCT", "CNC", "TCT", 'T', ModItems.ingot_tcalloy, 'C', ModBlocks.concrete, 'N', ModBlocks.block_niter }); for(int i = 0; i < 16; i++) { GameRegistry.addRecipe(new ItemStack(ModBlocks.concrete_colored, 8, i), new Object[] { "CCC", "CDC", "CCC", 'C', ModBlocks.concrete_smooth, 'D', new ItemStack(Items.dye, 1, 15 - i) }); diff --git a/src/main/java/com/hbm/main/ModEventHandlerClient.java b/src/main/java/com/hbm/main/ModEventHandlerClient.java index 75dde05ed..768e9ca13 100644 --- a/src/main/java/com/hbm/main/ModEventHandlerClient.java +++ b/src/main/java/com/hbm/main/ModEventHandlerClient.java @@ -472,20 +472,20 @@ public class ModEventHandlerClient { if(BlockAshes.ashes == 0) return; + GL11.glPushMatrix(); + Minecraft mc = Minecraft.getMinecraft(); GL11.glRotatef((float)-mc.thePlayer.rotationYaw, 0, 1, 0); GL11.glRotatef((float)(mc.thePlayer.rotationPitch), 1, 0, 0); ScaledResolution resolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); - - GL11.glPushMatrix(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(false); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); - GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_ALPHA_TEST); mc.getTextureManager().bindTexture(ashes); @@ -527,7 +527,6 @@ public class ModEventHandlerClient { GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); @@ -553,7 +552,7 @@ public class ModEventHandlerClient { Vec3 vec = Vec3.createVectorHelper(x - dx, y - dy, z - dz); - if(player.worldObj.provider.dimensionId == 0 && vec.lengthVector() < dist) { + if(player.worldObj.provider.dimensionId == 0 && vec.lengthVector() < dist && !HTTPHandler.capsule.isEmpty()) { GL11.glTranslated(vec.xCoord, vec.yCoord, vec.zCoord); @@ -604,6 +603,8 @@ public class ModEventHandlerClient { GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); RenderHelper.disableStandardItemLighting(); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityFEL.java b/src/main/java/com/hbm/tileentity/machine/TileEntityFEL.java index 31a4056bc..94284bed7 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityFEL.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityFEL.java @@ -1,11 +1,13 @@ package com.hbm.tileentity.machine; +import com.hbm.lib.Library; import com.hbm.tileentity.TileEntityMachineBase; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; public class TileEntityFEL extends TileEntityMachineBase { @@ -13,6 +15,7 @@ public class TileEntityFEL extends TileEntityMachineBase { public static final long maxPower = 1000000; public int watts; public int mode = 0; + public boolean isOn; public TileEntityFEL() { super(1); @@ -28,9 +31,13 @@ public class TileEntityFEL extends TileEntityMachineBase { if(!worldObj.isRemote) { + this.power = Library.chargeTEFromItems(slots, 0, power, maxPower); + NBTTagCompound data = new NBTTagCompound(); data.setLong("power", power); data.setByte("mode", (byte)mode); + data.setByte("watts", (byte)watts); + data.setBoolean("isOn", isOn); this.networkPack(data, 250); } } @@ -39,6 +46,8 @@ public class TileEntityFEL extends TileEntityMachineBase { public void networkUnpack(NBTTagCompound nbt) { this.power = nbt.getLong("power"); this.mode = nbt.getByte("mode"); + this.watts = nbt.getByte("watts"); + this.isOn = nbt.getBoolean("isOn"); } @Override @@ -47,8 +56,44 @@ public class TileEntityFEL extends TileEntityMachineBase { if(meta == 0) { this.mode = Math.abs(value) % 6; } + + if(meta == 1){ + this.watts = MathHelper.clamp_int(value, 1, 100); + } + + if(meta == 2){ + this.isOn = !this.isOn; + } } - + + public long getPowerScaled(long i) { + return (power * i) / maxPower; + } + + public int getWattsScaled(int i) { + return (watts * i) / 100; + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + power = nbt.getLong("power"); + watts = nbt.getInteger("watts"); + mode = nbt.getInteger("mode"); + isOn = nbt.getBoolean("isOn"); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + nbt.setLong("power", power); + nbt.setInteger("watts", watts); + nbt.setInteger("mode", mode); + nbt.setBoolean("isOn", isOn); + } + @Override public AxisAlignedBB getRenderBoundingBox() { return AxisAlignedBB.getBoundingBox( @@ -63,8 +108,7 @@ public class TileEntityFEL extends TileEntityMachineBase { @Override @SideOnly(Side.CLIENT) - public double getMaxRenderDistanceSquared() - { + public double getMaxRenderDistanceSquared() { return 65536.0D; } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineReactorSmall.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineReactorSmall.java index 88b1b49f7..d02ceec6a 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineReactorSmall.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineReactorSmall.java @@ -517,7 +517,7 @@ public class TileEntityMachineReactorSmall extends TileEntity implements ISidedI if(tanks[0].getFill() > tanks[0].getMaxFill()) tanks[0].setFill(tanks[0].getMaxFill()); - } else if(b == ModBlocks.block_niter) { + } else if(b == ModBlocks.block_niter || b == ModBlocks.block_niter_reinforced) { if(tanks[0].getFill() >= 50 && tanks[1].getFill() + 5 <= tanks[1].getMaxFill()) { tanks[0].setFill(tanks[0].getFill() - 50); tanks[1].setFill(tanks[1].getFill() + 5); diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index 99473eb2c..e1228040f 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -170,7 +170,7 @@ chem.YELLOWCAKE=Yellowcakeproduktion container.amsBase=AMS-Basis [WIP] container.amsEmitter=AMS-Emitter [WIP] container.amsLimiter=AMS-Stabilisator [WIP] -container.anvil=Amboss +container.anvil=Stufe %s Amboss container.arcFurnace=Lichtbogenofen container.armorTable=Rüstungsmodifikationstisch container.assembler=Fertigungsmaschine @@ -2587,6 +2587,7 @@ tile.block_meteor_treasure.name=Meteoritenschatz tile.block_mox_fuel.name=MOX-Kernbrennstoffblock tile.block_neptunium.name=Neptuniumblock tile.block_niter.name=Salpeterblock +tile.block_niter_reinforced.name=Sprengsicherer Salpeterblock tile.block_plutonium.name=Plutoniumblock tile.block_plutonium_fuel.name=Plutoniumkernbrennstoffblock tile.block_polonium.name=Polonium-210-Block @@ -2603,6 +2604,7 @@ tile.block_schrabidium_cluster.name=Schrabidium-Cluster tile.block_schrabidium_fuel.name=Schrabidiumkernbrennstoffblock tile.block_schraranium.name=Schraraniumblock tile.block_scrap.name=Schrottblock +tile.block_semtex.name=Semtexblock tile.block_solinium.name=Soliniumblock tile.block_starmetal.name=§9Sternenmetallblock§r tile.block_steel.name=Stahlblock diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index b2ff69b51..631cd4857 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -238,7 +238,7 @@ chem.YELLOWCAKE=Yellowcake Production container.amsBase=AMS Base [WIP] container.amsEmitter=AMS Emitter [WIP] container.amsLimiter=AMS Stabilizer [WIP] -container.anvil=Anvil +container.anvil=Tier %s Anvil container.arcFurnace=Arc Furnace container.armorTable=Armor Modification Table container.assembler=Assembly Machine @@ -2655,6 +2655,7 @@ tile.block_meteor_treasure.name=Meteorite Treasure Block tile.block_mox_fuel.name=Block of MOX Fuel tile.block_neptunium.name=Block of Neptunium tile.block_niter.name=Block of Niter +tile.block_niter_reinforced.name=Reinforced Block of Niter tile.block_plutonium.name=Block of Plutonium tile.block_plutonium_fuel.name=Block of Plutonium Fuel tile.block_polonium.name=Block of Polonium-210 @@ -2671,6 +2672,7 @@ tile.block_schrabidium_cluster.name=Schrabidium Cluster tile.block_schrabidium_fuel.name=Block of Schrabidium Fuel tile.block_schraranium.name=Block of Schraranium tile.block_scrap.name=Block of Scrap +tile.block_semtex.name=Block of Semtex tile.block_solinium.name=Block of Solinium tile.block_starmetal.name=§9Block of Starmetal§r tile.block_steel.name=Block of Steel diff --git a/src/main/resources/assets/hbm/textures/blocks/block_niter_reinforced.png b/src/main/resources/assets/hbm/textures/blocks/block_niter_reinforced.png new file mode 100644 index 000000000..5eee33672 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/block_niter_reinforced.png differ diff --git a/src/main/resources/assets/hbm/textures/gui/processing/gui_anvil.png b/src/main/resources/assets/hbm/textures/gui/processing/gui_anvil.png index 98575bddc..d8d000cf9 100755 Binary files a/src/main/resources/assets/hbm/textures/gui/processing/gui_anvil.png and b/src/main/resources/assets/hbm/textures/gui/processing/gui_anvil.png differ