diff --git a/src/main/java/assets/hbm/lang/de_DE.lang b/src/main/java/assets/hbm/lang/de_DE.lang index 2ccf66998..c1ce96298 100644 --- a/src/main/java/assets/hbm/lang/de_DE.lang +++ b/src/main/java/assets/hbm/lang/de_DE.lang @@ -478,6 +478,7 @@ item.ammo_9mm_du.name=9mm Patrone (DU) item.ammo_9mm_rocket.name=9mm Rakete item.ammo_cell.name=Energiezelle item.ammo_container.name=Munitionsbehälter +item.ammo_dart.name=Plastikdart (Withernd) item.ammo_folly.name=Silbernes Geschoss (Original) item.ammo_folly_du.name=Silbernes Geschoss (DU, Nicht-Explosiv) item.ammo_folly_nuclear.name=Silbernes Geschoss (Atomar) @@ -1061,6 +1062,7 @@ item.gun_calamity_dual.name=Sattelkanone item.gun_cryolator.name=Der Cryolator item.gun_cryolator_ammo.name=Kryozelle item.gun_dampfmaschine.name=Garantiert keine Scherzwaffe +item.gun_darter.name=Dartgewehr item.gun_deagle.name=Großes Eisen item.gun_defabricator.name=Defabrikator item.gun_defabricator_ammo.name=Defabrikator-Energiezelle diff --git a/src/main/java/assets/hbm/lang/en_US.lang b/src/main/java/assets/hbm/lang/en_US.lang index 21499a998..3a377f671 100644 --- a/src/main/java/assets/hbm/lang/en_US.lang +++ b/src/main/java/assets/hbm/lang/en_US.lang @@ -478,6 +478,7 @@ item.ammo_9mm_du.name=9mm Round (DU) item.ammo_9mm_rocket.name=9mm Rocket item.ammo_cell.name=Energy Cell item.ammo_container.name=Ammo Container +item.ammo_dart.name=Plastic Dart (Withering) item.ammo_folly.name=Silver Bullet (Original) item.ammo_folly_du.name=Silver Bullet (DU, Non-Explosive) item.ammo_folly_nuclear.name=Silver Bullet (Nuclear) @@ -1061,6 +1062,7 @@ item.gun_calamity_dual.name=Saddle Gun item.gun_cryolator.name=The Cryolator item.gun_cryolator_ammo.name=Cryo Cell item.gun_dampfmaschine.name=Totally Not a Joke Weapon +item.gun_darter.name=Dart Gun item.gun_deagle.name=Big Iron item.gun_defabricator.name=Defabricator item.gun_defabricator_ammo.name=Defabricator Energy Cell diff --git a/src/main/java/assets/hbm/sounds.json b/src/main/java/assets/hbm/sounds.json index d1d2d32bf..610cc1189 100644 --- a/src/main/java/assets/hbm/sounds.json +++ b/src/main/java/assets/hbm/sounds.json @@ -139,7 +139,8 @@ "weapon.whack": {"category": "player", "sounds": [{"name": "weapon/whack", "stream": false}]}, "weapon.chainsaw": {"category": "player", "sounds": [{"name": "weapon/chainsaw", "stream": false}]}, "weapon.rocketFlame": {"category": "block", "sounds": [{"name": "weapon/rocketFlame", "stream": false}]}, - "weapon.ballsLaser": {"category": "block", "sounds": [{"name": "weapon/ballsLaser", "stream": false}]}, + "weapon.ballsLaser": {"category": "hostile", "sounds": [{"name": "weapon/ballsLaser", "stream": false}]}, + "weapon.dartShoot": {"category": "player", "sounds": [{"name": "weapon/dartShoot", "stream": false}]}, "weapon.reloadTurret": {"category": "player", "sounds": [{"name": "weapon/reloadTurret", "stream": false}]}, "weapon.switchmode1": {"category": "player", "sounds": [{"name": "weapon/switchmode1", "stream": false}]}, diff --git a/src/main/java/assets/hbm/sounds/weapon/dartShoot.ogg b/src/main/java/assets/hbm/sounds/weapon/dartShoot.ogg new file mode 100644 index 000000000..c3d6744e1 Binary files /dev/null and b/src/main/java/assets/hbm/sounds/weapon/dartShoot.ogg differ diff --git a/src/main/java/assets/hbm/textures/items/ammo_dart.png b/src/main/java/assets/hbm/textures/items/ammo_dart.png new file mode 100644 index 000000000..928dc9221 Binary files /dev/null and b/src/main/java/assets/hbm/textures/items/ammo_dart.png differ diff --git a/src/main/java/assets/hbm/textures/items/chem_icon_SCHRABIDATE.png b/src/main/java/assets/hbm/textures/items/chem_icon_SCHRABIDATE.png new file mode 100644 index 000000000..d0fba264f Binary files /dev/null and b/src/main/java/assets/hbm/textures/items/chem_icon_SCHRABIDATE.png differ diff --git a/src/main/java/assets/hbm/textures/items/chem_icon_SCHRABIDIC.png b/src/main/java/assets/hbm/textures/items/chem_icon_SCHRABIDIC.png new file mode 100644 index 000000000..77f4eaec6 Binary files /dev/null and b/src/main/java/assets/hbm/textures/items/chem_icon_SCHRABIDIC.png differ diff --git a/src/main/java/assets/hbm/textures/items/gun_darter.png b/src/main/java/assets/hbm/textures/items/gun_darter.png new file mode 100644 index 000000000..1adf88adb Binary files /dev/null and b/src/main/java/assets/hbm/textures/items/gun_darter.png differ diff --git a/src/main/java/com/hbm/crafting/WeaponRecipes.java b/src/main/java/com/hbm/crafting/WeaponRecipes.java index 4c5bfae5f..32ebf13b5 100644 --- a/src/main/java/com/hbm/crafting/WeaponRecipes.java +++ b/src/main/java/com/hbm/crafting/WeaponRecipes.java @@ -143,6 +143,7 @@ public class WeaponRecipes { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gun_minigun, 1), new Object[] { "PIB", "PCM", "PIB", 'P', ModItems.pipes_steel, 'B', "blockSteel", 'I', "ingotPolymer", 'C', ModItems.mechanism_rifle_2, 'M', ModItems.motor })); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gun_avenger, 1), new Object[] { "PIB", "PCM", "PIB", 'P', ModItems.pipes_steel, 'B', "blockBeryllium", 'I', "ingotDesh", 'C', ModItems.mechanism_rifle_2, 'M', ModItems.motor })); GameRegistry.addRecipe(new ItemStack(ModItems.gun_lacunae, 1), new Object[] { "TIT", "ILI", "PRP", 'T', ModItems.syringe_taint, 'I', ModItems.ingot_starmetal, 'L', ModItems.gun_minigun, 'P', ModItems.pellet_rtg, 'R', ModBlocks.machine_rtg_grey }); + //GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gun_darter, 1), new Object[] { "SST", " P", 'S', "plateSteel", 'T', ModItems.gas_empty, 'P', ModItems.ingot_polymer })); //Legacy ammo recycling GameRegistry.addShapelessRecipe(new ItemStack(ModItems.ammo_44, 1), new Object[] { ModItems.gun_revolver_nopip_ammo }); @@ -206,6 +207,7 @@ public class WeaponRecipes { GameRegistry.addRecipe(new ItemStack(ModItems.gun_revolver_nightmare2_ammo, 6), new Object[] { "I", "C", "P", 'I', ModItems.powder_power, 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot }); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.assembly_calamity, 12), new Object[] { " I ", "GCG", " P ", 'I', "ingotLead", 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50 })); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.assembly_actionexpress, 12), new Object[] { " I", "GC", " P", 'I', "ingotLead", 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50 })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.ammo_dart, 16), new Object[] { "IPI", "ICI", "IPI", 'I', ModItems.plate_polymer, 'P', "plateIron", 'C', new ItemStack(ModItems.fluid_tank_full, 1, FluidType.WATZ.ordinal()) })); //Ammo types GameRegistry.addRecipe(new ItemStack(ModItems.ammo_12gauge_incendiary, 8), new Object[] { "BBB", "BAB", "BBB", 'B', ModItems.ammo_12gauge, 'A', ModItems.powder_fire }); diff --git a/src/main/java/com/hbm/handler/BulletConfigSyncingUtil.java b/src/main/java/com/hbm/handler/BulletConfigSyncingUtil.java index 1bc066e7c..2c55339b6 100644 --- a/src/main/java/com/hbm/handler/BulletConfigSyncingUtil.java +++ b/src/main/java/com/hbm/handler/BulletConfigSyncingUtil.java @@ -156,6 +156,8 @@ public class BulletConfigSyncingUtil { public static int B75_INCENDIARY = i++; public static int B75_HE = i++; + public static int NEEDLE_GPS = i++; + public static int G20_NORMAL_FIRE = i++; public static int G20_SHRAPNEL_FIRE = i++; public static int G20_SLUG_FIRE = i++; @@ -350,6 +352,8 @@ public class BulletConfigSyncingUtil { configSet.put(B75_NORMAL, Gun75BoltFactory.get75BoltConfig()); configSet.put(B75_INCENDIARY, Gun75BoltFactory.get75BoltIncConfig()); configSet.put(B75_HE, Gun75BoltFactory.get75BoltHEConfig()); + + configSet.put(NEEDLE_GPS, GunDartFactory.getGPSConfig()); configSet.put(G20_NORMAL_FIRE, Gun20GaugeFactory.get20GaugeConfig().setToFire(3)); configSet.put(G20_SHRAPNEL_FIRE, Gun20GaugeFactory.get20GaugeShrapnelConfig().setToFire(3)); diff --git a/src/main/java/com/hbm/handler/guncfg/GunDartFactory.java b/src/main/java/com/hbm/handler/guncfg/GunDartFactory.java new file mode 100644 index 000000000..139e86dd5 --- /dev/null +++ b/src/main/java/com/hbm/handler/guncfg/GunDartFactory.java @@ -0,0 +1,97 @@ +package com.hbm.handler.guncfg; + +import java.util.ArrayList; + +import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.handler.BulletConfigSyncingUtil; +import com.hbm.handler.BulletConfiguration; +import com.hbm.handler.GunConfiguration; +import com.hbm.interfaces.IBulletHurtBehavior; +import com.hbm.items.ModItems; +import com.hbm.items.armor.ArmorFSB; +import com.hbm.items.weapon.ItemGunDart; +import com.hbm.render.util.RenderScreenOverlay.Crosshair; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; + +public class GunDartFactory { + + public static GunConfiguration getDarterConfig() { + + GunConfiguration config = new GunConfiguration(); + + config.rateOfFire = 1; + config.roundsPerCycle = 1; + config.gunMode = GunConfiguration.MODE_NORMAL; + config.firingMode = GunConfiguration.FIRE_MANUAL; + config.hasSights = false; + config.reloadDuration = 20; + config.firingDuration = 0; + config.ammoCap = 1; + config.reloadType = GunConfiguration.RELOAD_FULL; + config.allowsInfinity = true; + config.crosshair = Crosshair.L_CROSS; + config.durability = 1000; + config.reloadSound = GunConfiguration.RSOUND_GRENADE; + config.firingSound = "hbm:weapon.dartShoot"; + config.reloadSoundEnd = false; + config.showAmmo = true; + + config.name = "Needle Gun"; + config.manufacturer = "-"; + + config.config = new ArrayList(); + config.config.add(BulletConfigSyncingUtil.NEEDLE_GPS); + + return config; + } + + public static BulletConfiguration getGPSConfig() { + + BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + + bullet.ammo = ModItems.ammo_dart; + bullet.velocity = 5.0F; + bullet.spread = 0; + bullet.dmgMin = 1; + bullet.dmgMax = 2; + bullet.doesRicochet = true; + bullet.doesPenetrate = false; + bullet.style = bullet.STYLE_FLECHETTE; + + bullet.effects = new ArrayList(); + bullet.effects.add(new PotionEffect(Potion.wither.id, 60 * 20, 2)); + + bullet.bHurt = new IBulletHurtBehavior() { + + @Override + public void behaveEntityHurt(EntityBulletBase bullet, Entity hit) { + + if(bullet.worldObj.isRemote) + return; + + if(hit instanceof EntityPlayer) { + + if(((EntityPlayer) hit).inventory.hasItem(ModItems.ingot_meteorite_forged)) + return; + + if(bullet.shooter instanceof EntityPlayer) { + + EntityPlayer shooter = (EntityPlayer) bullet.shooter; + + if(shooter.getHeldItem() != null && shooter.getHeldItem().getItem() == ModItems.gun_darter) { + ItemGunDart.writePlayer(shooter.getHeldItem(), (EntityPlayer)hit); + shooter.playSound("random.orb", 1.0F, 1.0F); + } + } + } + } + }; + + return bullet; + } + +} diff --git a/src/main/java/com/hbm/inventory/AssemblerRecipes.java b/src/main/java/com/hbm/inventory/AssemblerRecipes.java index f0fcfcdbd..78624c68f 100644 --- a/src/main/java/com/hbm/inventory/AssemblerRecipes.java +++ b/src/main/java/com/hbm/inventory/AssemblerRecipes.java @@ -8,6 +8,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -44,6 +45,7 @@ public class AssemblerRecipes { public static HashMap recipes = new HashMap(); public static HashMap time = new HashMap(); public static List recipeList = new ArrayList(); + public static HashSet hidden = new HashSet(); /** * Pre-Init phase: Finds the recipe config (if exists) and checks if a template is present, if not it generates one. @@ -265,6 +267,7 @@ public class AssemblerRecipes { makeRecipe(new ComparableStack(ModBlocks.machine_reactor, 1), new AStack[] {new ComparableStack(ModItems.reactor_core, 1), new OreDictStack("ingotSteel", 12), new OreDictStack("plateLead", 16), new ComparableStack(ModBlocks.reinforced_glass, 4), new ComparableStack(ModItems.ingot_asbestos, 4)},150); makeRecipe(new ComparableStack(ModBlocks.machine_rtg_furnace_off, 1), new AStack[] {new ComparableStack(Blocks.furnace, 1), new ComparableStack(ModItems.rtg_unit, 3), new OreDictStack("plateLead", 6), new OreDictStack("plateDenseLead", 4), new OreDictStack("plateCopper", 2), },150); makeRecipe(new ComparableStack(ModBlocks.machine_radgen, 1), new AStack[] {new OreDictStack("ingotSteel", 8), new OreDictStack("plateSteel", 32), new ComparableStack(ModItems.coil_magnetized_tungsten, 6), new ComparableStack(ModItems.wire_magnetized_tungsten, 24), new ComparableStack(ModItems.circuit_gold, 4), new ComparableStack(ModItems.reactor_core, 3), new ComparableStack(ModItems.ingot_starmetal, 1), new OreDictStack("dyeRed", 1), },400); + makeRecipe(new ComparableStack(ModBlocks.machine_diesel, 1), new AStack[] {new ComparableStack(ModItems.hull_small_steel, 4), new ComparableStack(Blocks.piston, 4), new OreDictStack("ingotSteel", 6), new OreDictStack("ingotRedCopperAlloy", 2), new OreDictStack("plateCopper", 4), new ComparableStack(ModItems.wire_red_copper, 6), },200); makeRecipe(new ComparableStack(ModBlocks.machine_selenium, 1), new AStack[] {new OreDictStack("ingotSteel", 4), new OreDictStack("plateTitanium", 6), new OreDictStack("plateCopper", 8), new ComparableStack(ModItems.hull_big_steel, 1), new ComparableStack(ModItems.hull_small_steel, 9), new ComparableStack(ModItems.pedestal_steel, 1), new ComparableStack(ModItems.coil_copper, 4), },250); makeRecipe(new ComparableStack(ModBlocks.machine_reactor_small, 1), new AStack[] {new OreDictStack("ingotSteel", 6), new ComparableStack(ModItems.ingot_polymer, 4), new OreDictStack("plateLead", 8), new OreDictStack("plateCopper", 4), new OreDictStack("ingotLead", 12), new OreDictStack("ingotRedCopperAlloy", 6), new ComparableStack(ModItems.circuit_copper, 8), new ComparableStack(ModItems.circuit_red_copper, 4), },300); @@ -608,6 +611,10 @@ public class AssemblerRecipes { }, 15 * 60 * 20); } } + + + /// HIDDEN /// + hidden.add(new ComparableStack(ModBlocks.machine_radgen, 1)); } private static void makeRecipe(ComparableStack out, AStack[] in, int duration) { diff --git a/src/main/java/com/hbm/inventory/MagicRecipes.java b/src/main/java/com/hbm/inventory/MagicRecipes.java index a6efdd739..90800d991 100644 --- a/src/main/java/com/hbm/inventory/MagicRecipes.java +++ b/src/main/java/com/hbm/inventory/MagicRecipes.java @@ -84,6 +84,12 @@ public class MagicRecipes { new ComparableStack(ModItems.powder_dineutronium), new ComparableStack(ModItems.plate_desh), new OreDictStack("dustGold"))); + + recipes.add(new MagicRecipe(new ItemStack(ModItems.gun_darter), + new OreDictStack("plateSteel"), + new OreDictStack("plateSteel"), + new ComparableStack(ModItems.ingot_polymer), + new OreDictStack("plateGold"))); } public static List getRecipes() { diff --git a/src/main/java/com/hbm/inventory/container/ContainerMachineAssembler.java b/src/main/java/com/hbm/inventory/container/ContainerMachineAssembler.java index 6a27b9ddf..c087d0f5e 100644 --- a/src/main/java/com/hbm/inventory/container/ContainerMachineAssembler.java +++ b/src/main/java/com/hbm/inventory/container/ContainerMachineAssembler.java @@ -12,38 +12,34 @@ import net.minecraft.item.ItemStack; public class ContainerMachineAssembler extends Container { -private TileEntityMachineAssembler nukeBoy; - - private int progress; - private int maxProgress; +private TileEntityMachineAssembler assembler; - public ContainerMachineAssembler(InventoryPlayer invPlayer, TileEntityMachineAssembler tedf) { - progress = 0; - nukeBoy = tedf; + public ContainerMachineAssembler(InventoryPlayer invPlayer, TileEntityMachineAssembler te) { + assembler = te; //Battery - this.addSlotToContainer(new Slot(tedf, 0, 80, 18)); + this.addSlotToContainer(new Slot(te, 0, 80, 18)); //Upgrades - this.addSlotToContainer(new Slot(tedf, 1, 152, 18)); - this.addSlotToContainer(new Slot(tedf, 2, 152, 36)); - this.addSlotToContainer(new Slot(tedf, 3, 152, 54)); + this.addSlotToContainer(new Slot(te, 1, 152, 18)); + this.addSlotToContainer(new Slot(te, 2, 152, 36)); + this.addSlotToContainer(new Slot(te, 3, 152, 54)); //Schematic - this.addSlotToContainer(new Slot(tedf, 4, 80, 54)); + this.addSlotToContainer(new Slot(te, 4, 80, 54)); //Output - this.addSlotToContainer(new SlotMachineOutput(tedf, 5, 134, 90)); + this.addSlotToContainer(new SlotMachineOutput(te, 5, 134, 90)); //Input - this.addSlotToContainer(new Slot(tedf, 6, 8, 18)); - this.addSlotToContainer(new Slot(tedf, 7, 26, 18)); - this.addSlotToContainer(new Slot(tedf, 8, 8, 36)); - this.addSlotToContainer(new Slot(tedf, 9, 26, 36)); - this.addSlotToContainer(new Slot(tedf, 10, 8, 54)); - this.addSlotToContainer(new Slot(tedf, 11, 26, 54)); - this.addSlotToContainer(new Slot(tedf, 12, 8, 72)); - this.addSlotToContainer(new Slot(tedf, 13, 26, 72)); - this.addSlotToContainer(new Slot(tedf, 14, 8, 90)); - this.addSlotToContainer(new Slot(tedf, 15, 26, 90)); - this.addSlotToContainer(new Slot(tedf, 16, 8, 108)); - this.addSlotToContainer(new Slot(tedf, 17, 26, 108)); + this.addSlotToContainer(new Slot(te, 6, 8, 18)); + this.addSlotToContainer(new Slot(te, 7, 26, 18)); + this.addSlotToContainer(new Slot(te, 8, 8, 36)); + this.addSlotToContainer(new Slot(te, 9, 26, 36)); + this.addSlotToContainer(new Slot(te, 10, 8, 54)); + this.addSlotToContainer(new Slot(te, 11, 26, 54)); + this.addSlotToContainer(new Slot(te, 12, 8, 72)); + this.addSlotToContainer(new Slot(te, 13, 26, 72)); + this.addSlotToContainer(new Slot(te, 14, 8, 90)); + this.addSlotToContainer(new Slot(te, 15, 26, 90)); + this.addSlotToContainer(new Slot(te, 16, 8, 108)); + this.addSlotToContainer(new Slot(te, 17, 26, 108)); for(int i = 0; i < 3; i++) { @@ -95,41 +91,6 @@ private TileEntityMachineAssembler nukeBoy; @Override public boolean canInteractWith(EntityPlayer player) { - return nukeBoy.isUseableByPlayer(player); - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - - for(int i = 0; i < this.crafters.size(); i++) - { - ICrafting par1 = (ICrafting)this.crafters.get(i); - - if(this.progress != this.nukeBoy.progress) - { - par1.sendProgressBarUpdate(this, 1, this.nukeBoy.progress); - } - - if(this.maxProgress != this.nukeBoy.maxProgress) - { - par1.sendProgressBarUpdate(this, 2, this.nukeBoy.maxProgress); - } - } - - this.progress= this.nukeBoy.progress; - this.maxProgress= this.nukeBoy.maxProgress; - } - - @Override - public void updateProgressBar(int i, int j) { - if(i == 1) - { - nukeBoy.progress = j; - } - if(i == 2) - { - nukeBoy.maxProgress = j; - } + return assembler.isUseableByPlayer(player); } } diff --git a/src/main/java/com/hbm/inventory/gui/GUIScreenTemplateFolder.java b/src/main/java/com/hbm/inventory/gui/GUIScreenTemplateFolder.java index e403c5149..59ebb316b 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIScreenTemplateFolder.java +++ b/src/main/java/com/hbm/inventory/gui/GUIScreenTemplateFolder.java @@ -21,6 +21,7 @@ import com.hbm.packet.PacketDispatcher; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -55,7 +56,8 @@ public class GUIScreenTemplateFolder extends GuiScreen { stacks.add(new ItemStack(ModItems.fluid_identifier, 1, i)); //Assembly Templates for(int i = 0; i < AssemblerRecipes.recipeList.size(); i++) - stacks.add(new ItemStack(ModItems.assembly_template, 1, i)); + //if(!AssemblerRecipes.hidden.contains(AssemblerRecipes.recipeList.get(i))) + stacks.add(new ItemStack(ModItems.assembly_template, 1, i)); //Chemistry Templates for(int i = 0; i < ItemChemistryTemplate.EnumChemistryTemplate.values().length; i++) stacks.add(new ItemStack(ModItems.chemistry_template, 1, i)); @@ -188,7 +190,7 @@ public class GUIScreenTemplateFolder extends GuiScreen { public void drawIcon(boolean b) { try { - GL11.glDisable(GL11.GL_LIGHTING); + RenderHelper.disableStandardItemLighting(); if(stack != null) { if(stack.getItem() == ModItems.assembly_template) itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), AssemblerRecipes.getOutputFromTempate(stack), xPos + 1, yPos + 1); @@ -197,7 +199,6 @@ public class GUIScreenTemplateFolder extends GuiScreen { else itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), stack, xPos + 1, yPos + 1); } - GL11.glEnable(GL11.GL_LIGHTING); } catch(Exception x) { } } diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index 5da52fe46..08ebd38b7 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -1249,6 +1249,7 @@ public class ModItems { public static Item ammo_fuel_vaporizer; public static Item ammo_fuel_gas; public static Item ammo_cell; + public static Item ammo_dart; public static Item gun_rpg; public static Item gun_rpg_ammo; @@ -1360,6 +1361,7 @@ public class ModItems { public static Item gun_vortex; public static Item gun_dampfmaschine; public static Item gun_waluigi; + public static Item gun_darter; public static Item grenade_generic; public static Item grenade_strong; @@ -3192,6 +3194,7 @@ public class ModItems { ammo_fuel_vaporizer = new ItemAmmo().setUnlocalizedName("ammo_fuel_vaporizer").setCreativeTab(MainRegistry.weaponTab).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":ammo_fuel_vaporizer"); ammo_fuel_gas = new ItemAmmo().setUnlocalizedName("ammo_fuel_gas").setCreativeTab(MainRegistry.weaponTab).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":ammo_fuel_gas"); ammo_cell = new ItemAmmo().setUnlocalizedName("ammo_cell").setCreativeTab(MainRegistry.weaponTab).setMaxStackSize(16).setTextureName(RefStrings.MODID + ":ammo_cell"); + ammo_dart = new ItemAmmo().setUnlocalizedName("ammo_dart").setCreativeTab(MainRegistry.weaponTab).setMaxStackSize(16).setTextureName(RefStrings.MODID + ":ammo_dart"); gun_rpg = new ItemGunBase(GunRocketFactory.getGustavConfig()).setUnlocalizedName("gun_rpg").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_rpg"); gun_karl = new ItemGunBase(GunRocketFactory.getKarlConfig()).setUnlocalizedName("gun_karl").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_karl"); @@ -3303,6 +3306,7 @@ public class ModItems { gun_super_shotgun = new ItemCustomLore().setUnlocalizedName("gun_super_shotgun").setMaxStackSize(1).setFull3D().setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_super_shotgun"); gun_moist_nugget = new ItemNugget(3, false).setUnlocalizedName("gun_moist_nugget").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_moist_nugget"); gun_dampfmaschine = new GunDampfmaschine().setUnlocalizedName("gun_dampfmaschine").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_dampfmaschine"); + gun_darter = new ItemGunDart(GunDartFactory.getDarterConfig()).setFull3D().setUnlocalizedName("gun_darter").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_darter"); grenade_generic = new ItemGrenade(4).setUnlocalizedName("grenade_generic").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":grenade_generic"); grenade_strong = new ItemGrenade(5).setUnlocalizedName("grenade_strong").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":grenade_strong"); @@ -3468,7 +3472,7 @@ public class ModItems { energy_core = new ItemBattery(10000000, 0, 1000).setUnlocalizedName("energy_core").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":energy_core"); fuse = new ItemCustomLore().setUnlocalizedName("fuse").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":fuse"); redcoil_capacitor = new ItemCapacitor(10).setUnlocalizedName("redcoil_capacitor").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":redcoil_capacitor"); - titanium_filter = new ItemCapacitor(72000).setUnlocalizedName("titanium_filter").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":titanium_filter"); + titanium_filter = new ItemCapacitor(6 * 60 * 60 * 20).setUnlocalizedName("titanium_filter").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":titanium_filter"); screwdriver = new ItemCustomLore().setUnlocalizedName("screwdriver").setMaxStackSize(1).setFull3D().setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":screwdriver"); overfuse = new ItemCustomLore().setUnlocalizedName("overfuse").setMaxStackSize(1).setFull3D().setTextureName(RefStrings.MODID + ":overfuse"); arc_electrode = new ItemCustomLore().setUnlocalizedName("arc_electrode").setMaxDamage(250).setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setFull3D().setTextureName(RefStrings.MODID + ":arc_electrode"); @@ -3786,6 +3790,7 @@ public class ModItems { .addEffect(new PotionEffect(Potion.jump.id, 20, 0)) .setBlastProtection(0.25F) .setMod(0.2F) + .setFireproof(true) .setHasGeigerSound(true) .setHasCustomGeiger(true) .addResistance("fall", 0.5F).setUnlocalizedName("hev_helmet").setTextureName(RefStrings.MODID + ":hev_helmet"); @@ -5504,6 +5509,7 @@ public class ModItems { GameRegistry.registerItem(gun_super_shotgun, gun_super_shotgun.getUnlocalizedName()); GameRegistry.registerItem(gun_moist_nugget, gun_moist_nugget.getUnlocalizedName()); GameRegistry.registerItem(gun_dampfmaschine, gun_dampfmaschine.getUnlocalizedName()); + GameRegistry.registerItem(gun_darter, gun_darter.getUnlocalizedName()); //Ammo GameRegistry.registerItem(gun_revolver_iron_ammo, gun_revolver_iron_ammo.getUnlocalizedName()); @@ -5633,6 +5639,7 @@ public class ModItems { GameRegistry.registerItem(ammo_fuel_vaporizer, ammo_fuel_vaporizer.getUnlocalizedName()); GameRegistry.registerItem(ammo_fuel_gas, ammo_fuel_gas.getUnlocalizedName()); GameRegistry.registerItem(ammo_cell, ammo_cell.getUnlocalizedName()); + GameRegistry.registerItem(ammo_dart, ammo_dart.getUnlocalizedName()); GameRegistry.registerItem(ammo_rocket, ammo_rocket.getUnlocalizedName()); GameRegistry.registerItem(ammo_rocket_he, ammo_rocket_he.getUnlocalizedName()); GameRegistry.registerItem(ammo_rocket_incendiary, ammo_rocket_incendiary.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/items/machine/ItemAssemblyTemplate.java b/src/main/java/com/hbm/items/machine/ItemAssemblyTemplate.java index 1231e83cc..a0755cbf8 100644 --- a/src/main/java/com/hbm/items/machine/ItemAssemblyTemplate.java +++ b/src/main/java/com/hbm/items/machine/ItemAssemblyTemplate.java @@ -2,30 +2,52 @@ package com.hbm.items.machine; import java.util.ArrayList; import java.util.List; -import java.util.Random; import com.hbm.inventory.AssemblerRecipes; import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.inventory.RecipesCommon.OreDictStack; +import com.hbm.lib.RefStrings; import com.hbm.util.I18nUtil; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraftforge.oredict.OreDictionary; public class ItemAssemblyTemplate extends Item { + + @SideOnly(Side.CLIENT) + protected IIcon hiddenIcon; public ItemAssemblyTemplate() { this.setHasSubtypes(true); this.setMaxDamage(0); } + + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int meta) { + + ComparableStack stack = AssemblerRecipes.recipeList.get(meta); + + if(AssemblerRecipes.hidden.contains(stack)) + return this.hiddenIcon; + + return this.itemIcon; + } + + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister reg) { + super.registerIcons(reg); + this.hiddenIcon = reg.registerIcon(this.iconString + "_secret"); + } public String getItemStackDisplayName(ItemStack stack) { diff --git a/src/main/java/com/hbm/items/machine/ItemCapacitor.java b/src/main/java/com/hbm/items/machine/ItemCapacitor.java index ac3de768e..57ee26b2c 100644 --- a/src/main/java/com/hbm/items/machine/ItemCapacitor.java +++ b/src/main/java/com/hbm/items/machine/ItemCapacitor.java @@ -8,36 +8,41 @@ import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; public class ItemCapacitor extends Item { + + private int dura; public ItemCapacitor(int dura) { - this.setMaxDamage(dura); - this.setNoRepair(); + this.dura = dura; } @Override public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) { if (this == ModItems.redcoil_capacitor) { list.add("Right-click a block to negate positive charge."); - list.add("Does not work in creative mode!"); list.add("[Needed for Schrabidium Synthesis]"); + list.add(getDura(itemstack) + "/" + dura); } if (this == ModItems.titanium_filter) { - list.add("Can be used to remove waste"); - list.add("from a watz reactor!"); list.add("[Needed for Watz Reaction]"); + list.add((getDura(itemstack) / 20) + "/" + (dura / 20)); } } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, - float p_77648_8_, float p_77648_9_, float p_77648_10_) { + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { + if (this == ModItems.redcoil_capacitor) { + if (!player.isSneaking()) { - if (stack.getItemDamage() > 0) { - stack.setItemDamage((stack.getItemDamage() - 1)); + + if (getDura(stack) < dura) { + + setDura(stack, getDura(stack) + 1); + if (!world.isRemote) { world.createExplosion(null, x + 0.5, y + 0.5, z + 0.5, 2.5F, true); } @@ -50,4 +55,29 @@ public class ItemCapacitor extends Item { return false; } + + public boolean showDurabilityBar(ItemStack stack) { + return getDurabilityForDisplay(stack) > 0; + } + + public static int getDura(ItemStack stack) { + + if(stack.stackTagCompound == null) + return ((ItemCapacitor)stack.getItem()).dura; + + return stack.stackTagCompound.getInteger("dura"); + } + + public static void setDura(ItemStack stack, int dura) { + + if(!stack.hasTagCompound()) + stack.stackTagCompound = new NBTTagCompound(); + + stack.stackTagCompound.setInteger("dura", dura); + } + + public double getDurabilityForDisplay(ItemStack stack) + { + return 1D - (double)getDura(stack) / (double)dura; + } } diff --git a/src/main/java/com/hbm/items/weapon/ItemGunDart.java b/src/main/java/com/hbm/items/weapon/ItemGunDart.java new file mode 100644 index 000000000..b034d7a50 --- /dev/null +++ b/src/main/java/com/hbm/items/weapon/ItemGunDart.java @@ -0,0 +1,60 @@ +package com.hbm.items.weapon; + +import com.hbm.handler.GunConfiguration; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatStyle; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; + +public class ItemGunDart extends ItemGunBase { + + public ItemGunDart(GunConfiguration config) { + super(config); + } + + public static void writePlayer(ItemStack stack, EntityPlayer player) { + + if(!stack.hasTagCompound()) + stack.stackTagCompound = new NBTTagCompound(); + + stack.stackTagCompound.setString("player", player.getDisplayName()); + } + + public static EntityPlayer readPlayer(ItemStack stack) { + + if(!stack.hasTagCompound()) + return null; + + return MinecraftServer.getServer().getConfigurationManager().func_152612_a(stack.stackTagCompound.getString("player")); + } + + public void startAction(ItemStack stack, World world, EntityPlayer player, boolean main) { + + if(main) { + super.startAction(stack, world, player, main); + } else { + + EntityPlayer target = readPlayer(stack); + + if(target != null) { + + int dim = target.worldObj.provider.dimensionId; + int x = (int)target.posX; + int y = (int)target.posY; + int z = (int)target.posZ; + int dist = (int) target.getDistanceToEntity(player); + + player.addChatComponentMessage(new ChatComponentText(target.getDisplayName()).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW))); + player.addChatComponentMessage(new ChatComponentText("Dim: " + dim + " X:" + x + " Y:" + y + " Z:" + z + " (" + dist + " blocks away)").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW))); + } else { + + player.addChatComponentMessage(new ChatComponentText("No Target").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); + } + } + } +} diff --git a/src/main/java/com/hbm/lib/RefStrings.java b/src/main/java/com/hbm/lib/RefStrings.java index 32b97e785..6d4cc68be 100644 --- a/src/main/java/com/hbm/lib/RefStrings.java +++ b/src/main/java/com/hbm/lib/RefStrings.java @@ -3,7 +3,7 @@ package com.hbm.lib; public class RefStrings { public static final String MODID = "hbm"; public static final String NAME = "Hbm's Nuclear Tech Mod"; - public static final String VERSION = "1.0.27 BETA (3735)"; + public static final String VERSION = "1.0.27 BETA (3738)"; //HBM's Beta Naming Convention: //V T (X) //V -> next release version diff --git a/src/main/java/com/hbm/render/tileentity/RenderAssembler.java b/src/main/java/com/hbm/render/tileentity/RenderAssembler.java index f5ade0218..76656793b 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderAssembler.java +++ b/src/main/java/com/hbm/render/tileentity/RenderAssembler.java @@ -2,11 +2,23 @@ package com.hbm.render.tileentity; import org.lwjgl.opengl.GL11; +import com.hbm.inventory.AssemblerRecipes; import com.hbm.lib.RefStrings; import com.hbm.main.ResourceManager; +import com.hbm.render.util.RenderDecoItem; +import com.hbm.render.util.RenderItemStack; import com.hbm.tileentity.machine.TileEntityMachineAssembler; +import com.hbm.tileentity.machine.TileEntityMachinePress; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.AdvancedModelLoader; @@ -14,6 +26,9 @@ import net.minecraftforge.client.model.IModelCustom; public class RenderAssembler extends TileEntitySpecialRenderer { + private RenderItem itemRenderer; + private RenderManager renderManager = RenderManager.instance; + public RenderAssembler() { } @Override @@ -41,10 +56,43 @@ public class RenderAssembler extends TileEntitySpecialRenderer { } bindTexture(ResourceManager.assembler_body_tex); - ResourceManager.assembler_body.renderAll(); + + TileEntityMachineAssembler assembler = (TileEntityMachineAssembler) tileEntity; - GL11.glPopMatrix(); + if(assembler.recipe != -1) { + itemRenderer = new RenderDecoItem(this); + itemRenderer.setRenderManager(renderManager); + GL11.glPushMatrix(); + GL11.glTranslated(-1, 0.875, 0); + + try { + ItemStack stack = AssemblerRecipes.recipeList.get(assembler.recipe).toStack(); + + RenderHelper.enableStandardItemLighting(); + GL11.glTranslated(1, 0, 1); + if(!(stack.getItem() instanceof ItemBlock)) { + GL11.glRotatef(-90, 1F, 0F, 0F); + } else { + GL11.glScaled(0.5, 0.5, 0.5); + GL11.glTranslated(0, -0.875, -2); + } + + EntityItem item = new EntityItem(null, 0.0D, 0.0D, 0.0D, stack); + item.getEntityItem().stackSize = 1; + item.hoverStart = 0.0F; + + RenderItem.renderInFrame = true; + GL11.glTranslatef(0.0F, 1.0F - 0.0625F * 165/100, 0.0F); + this.itemRenderer.doRender(item, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); + RenderItem.renderInFrame = false; + + } catch(Exception ex) { } + + GL11.glPopMatrix(); + } + + GL11.glPopMatrix(); renderSlider(tileEntity, x, y, z, f); } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssembler.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssembler.java index 9c8b7db56..724985384 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssembler.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssembler.java @@ -4,16 +4,20 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; +import com.hbm.blocks.ModBlocks; import com.hbm.interfaces.IConsumer; import com.hbm.inventory.AssemblerRecipes; import com.hbm.inventory.RecipesCommon.AStack; import com.hbm.items.ModItems; import com.hbm.items.machine.ItemAssemblyTemplate; import com.hbm.lib.Library; +import com.hbm.main.MainRegistry; import com.hbm.packet.AuxElectricityPacket; import com.hbm.packet.LoopedSoundPacket; import com.hbm.packet.PacketDispatcher; import com.hbm.packet.TEAssemblerPacket; +import com.hbm.sound.AudioWrapper; +import com.hbm.tileentity.TileEntityMachineBase; import api.hbm.energy.IBatteryItem; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; @@ -29,10 +33,9 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.tileentity.TileEntityHopper; import net.minecraft.util.AxisAlignedBB; +import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityMachineAssembler extends TileEntity implements ISidedInventory, IConsumer { - - private ItemStack slots[]; +public class TileEntityMachineAssembler extends TileEntityMachineBase implements IConsumer { public long power; public static final long maxPower = 100000; @@ -43,80 +46,22 @@ public class TileEntityMachineAssembler extends TileEntity implements ISidedInve int consumption = 100; int speed = 100; + @SideOnly(Side.CLIENT) + public int recipe; + + private AudioWrapper audio; + Random rand = new Random(); - private String customName; - public TileEntityMachineAssembler() { - slots = new ItemStack[18]; + super(18); } @Override - public int getSizeInventory() { - return slots.length; + public String getName() { + return "container.assembler"; } - @Override - public ItemStack getStackInSlot(int i) { - return slots[i]; - } - - @Override - public ItemStack getStackInSlotOnClosing(int i) { - if(slots[i] != null) - { - ItemStack itemStack = slots[i]; - slots[i] = null; - return itemStack; - } else { - return null; - } - } - - @Override - public void setInventorySlotContents(int i, ItemStack itemStack) { - slots[i] = itemStack; - if(itemStack != null && itemStack.stackSize > getInventoryStackLimit()) - { - itemStack.stackSize = getInventoryStackLimit(); - } - } - - @Override - public String getInventoryName() { - return this.hasCustomInventoryName() ? this.customName : "container.assembler"; - } - - @Override - public boolean hasCustomInventoryName() { - return this.customName != null && this.customName.length() > 0; - } - - public void setCustomName(String name) { - this.customName = name; - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer player) { - if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) - { - return false; - }else{ - return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=128; - } - } - - //You scrubs aren't needed for anything (right now) - @Override - public void openInventory() {} - @Override - public void closeInventory() {} - @Override public boolean isItemValidForSlot(int i, ItemStack itemStack) { if(i == 0) @@ -154,55 +99,15 @@ public class TileEntityMachineAssembler extends TileEntity implements ISidedInve @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - NBTTagList list = nbt.getTagList("items", 10); - this.power = nbt.getLong("powerTime"); - slots = new ItemStack[getSizeInventory()]; - - for(int i = 0; i < list.tagCount(); i++) - { - NBTTagCompound nbt1 = list.getCompoundTagAt(i); - byte b0 = nbt1.getByte("slot"); - if(b0 >= 0 && b0 < slots.length) - { - slots[b0] = ItemStack.loadItemStackFromNBT(nbt1); - } - } + this.progress = nbt.getInteger("progress"); } @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setLong("powerTime", power); - NBTTagList list = new NBTTagList(); - - for(int i = 0; i < slots.length; i++) - { - if(slots[i] != null) - { - NBTTagCompound nbt1 = new NBTTagCompound(); - nbt1.setByte("slot", (byte)i); - slots[i].writeToNBT(nbt1); - list.appendTag(nbt1); - } - } - nbt.setTag("items", list); - } - - @Override - public int[] getAccessibleSlotsFromSide(int p_94128_1_) - { - return new int[] { 0 }; - } - - @Override - public boolean canInsertItem(int i, ItemStack itemStack, int j) { - return this.isItemValidForSlot(i, itemStack); - } - - @Override - public boolean canExtractItem(int i, ItemStack itemStack, int j) { - return false; + nbt.setInteger("progress", progress); } public long getPowerScaled(long i) { @@ -215,48 +120,48 @@ public class TileEntityMachineAssembler extends TileEntity implements ISidedInve @Override public void updateEntity() { - - this.consumption = 100; - this.speed = 100; - - for(int i = 1; i < 4; i++) { - ItemStack stack = slots[i]; - - if(stack != null) { - if(stack.getItem() == ModItems.upgrade_speed_1) { - this.speed -= 25; - this.consumption += 300; - } - if(stack.getItem() == ModItems.upgrade_speed_2) { - this.speed -= 50; - this.consumption += 600; - } - if(stack.getItem() == ModItems.upgrade_speed_3) { - this.speed -= 75; - this.consumption += 900; - } - if(stack.getItem() == ModItems.upgrade_power_1) { - this.consumption -= 30; - this.speed += 5; - } - if(stack.getItem() == ModItems.upgrade_power_2) { - this.consumption -= 60; - this.speed += 10; - } - if(stack.getItem() == ModItems.upgrade_power_3) { - this.consumption -= 90; - this.speed += 15; - } - } - } - - if(speed < 25) - speed = 25; - if(consumption < 10) - consumption = 10; if(!worldObj.isRemote) { + this.consumption = 100; + this.speed = 100; + + for(int i = 1; i < 4; i++) { + ItemStack stack = slots[i]; + + if(stack != null) { + if(stack.getItem() == ModItems.upgrade_speed_1) { + this.speed -= 25; + this.consumption += 300; + } + if(stack.getItem() == ModItems.upgrade_speed_2) { + this.speed -= 50; + this.consumption += 600; + } + if(stack.getItem() == ModItems.upgrade_speed_3) { + this.speed -= 75; + this.consumption += 900; + } + if(stack.getItem() == ModItems.upgrade_power_1) { + this.consumption -= 30; + this.speed += 5; + } + if(stack.getItem() == ModItems.upgrade_power_2) { + this.consumption -= 60; + this.speed += 10; + } + if(stack.getItem() == ModItems.upgrade_power_3) { + this.consumption -= 90; + this.speed += 15; + } + } + } + + if(speed < 25) + speed = 25; + if(consumption < 10) + consumption = 10; + isProgressing = false; power = Library.chargeTEFromItems(slots, 0, power, maxPower); @@ -328,12 +233,59 @@ public class TileEntityMachineAssembler extends TileEntity implements ISidedInve if(tryFillAssembler(chest, i)) break; } + + NBTTagCompound data = new NBTTagCompound(); + data.setLong("power", power); + data.setInteger("progress", progress); + data.setInteger("maxProgress", maxProgress); + data.setBoolean("isProgressing", isProgressing); + data.setInteger("recipe", slots[4] != null ? slots[4].getItemDamage() : -1); + this.networkPack(data, 150); + } else { + + float volume = this.getVolume(2); - PacketDispatcher.wrapper.sendToAllAround(new TEAssemblerPacket(xCoord, yCoord, zCoord, isProgressing), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 150)); - PacketDispatcher.wrapper.sendToAllAround(new LoopedSoundPacket(xCoord, yCoord, zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 150)); - PacketDispatcher.wrapper.sendToAllAround(new AuxElectricityPacket(xCoord, yCoord, zCoord, power), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); + if(isProgressing && volume > 0) { + + if(audio == null) { + audio = MainRegistry.proxy.getLoopedSound("hbm:block.assemblerOperate", xCoord, yCoord, zCoord, volume, 1.0F); + audio.startSound(); + } + + } else { + + if(audio != null) { + audio.stopSound(); + audio = null; + } + } } - + } + + public void onChunkUnload() { + + if(audio != null) { + audio.stopSound(); + audio = null; + } + } + + public void invalidate() { + + super.invalidate(); + + if(audio != null) { + audio.stopSound(); + audio = null; + } + } + + public void networkUnpack(NBTTagCompound nbt) { + this.power = nbt.getLong("power"); + this.progress = nbt.getInteger("progress"); + this.maxProgress = nbt.getInteger("maxProgress"); + this.isProgressing = nbt.getBoolean("isProgressing"); + this.recipe = nbt.getInteger("recipe"); } private boolean removeItems(List stack, ItemStack[] array) { @@ -511,7 +463,9 @@ public class TileEntityMachineAssembler extends TileEntity implements ISidedInve } return false; - }public boolean tryFillAssembler(IInventory inventory, int slot) { + } + + public boolean tryFillAssembler(IInventory inventory, int slot) { if(AssemblerRecipes.getOutputFromTempate(slots[4]) == null || AssemblerRecipes.getRecipeFromTempate(slots[4]) == null) return false; @@ -612,13 +566,24 @@ public class TileEntityMachineAssembler extends TileEntity implements ISidedInve @Override public AxisAlignedBB getRenderBoundingBox() { - return TileEntity.INFINITE_EXTENT_AABB; + return AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1).expand(2, 1, 2); } @Override @SideOnly(Side.CLIENT) - public double getMaxRenderDistanceSquared() - { + public double getMaxRenderDistanceSquared() { return 65536.0D; } + + public int countMufflers() { + + int count = 0; + + for(int x = xCoord - 1; x <= xCoord + 1; x++) + for(int z = zCoord - 1; z <= zCoord + 1; z++) + if(worldObj.getBlock(x, yCoord - 1, z) == ModBlocks.muffler) + count++; + + return count; + } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineSchrabidiumTransmutator.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineSchrabidiumTransmutator.java index 23cad649f..aad2cf037 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineSchrabidiumTransmutator.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineSchrabidiumTransmutator.java @@ -4,6 +4,7 @@ import com.hbm.config.VersatileConfig; import com.hbm.interfaces.IConsumer; import com.hbm.inventory.MachineRecipes; import com.hbm.items.ModItems; +import com.hbm.items.machine.ItemCapacitor; import com.hbm.lib.Library; import com.hbm.main.MainRegistry; import com.hbm.sound.AudioWrapper; @@ -26,34 +27,13 @@ public class TileEntityMachineSchrabidiumTransmutator extends TileEntityMachineB private static final int[] slots_bottom = new int[] { 1, 2 }; private static final int[] slots_side = new int[] { 3, 2 }; - private String customName; - public TileEntityMachineSchrabidiumTransmutator() { super(4); } - @Override - public String getInventoryName() { - return this.hasCustomInventoryName() ? this.customName : "container.machine_schrabidium_transmutator"; - } - - @Override - public boolean hasCustomInventoryName() { - return this.customName != null && this.customName.length() > 0; - } - - public void setCustomName(String name) { - this.customName = name; - } - @Override public String getName() { - return getInventoryName(); - } - - @Override - public int getInventoryStackLimit() { - return 64; + return "container.machine_schrabidium_transmutator"; } @Override @@ -97,8 +77,8 @@ public class TileEntityMachineSchrabidiumTransmutator extends TileEntityMachineB @Override public boolean canExtractItem(int i, ItemStack stack, int j) { - if (i == 2 && stack.getItem() != null && stack.getItem() == ModItems.redcoil_capacitor - && stack.getItemDamage() == stack.getMaxDamage()) { + + if (i == 2 && stack.getItem() != null && stack.getItem() == ModItems.redcoil_capacitor && ItemCapacitor.getDura(stack) <= 0) { return true; } @@ -125,7 +105,7 @@ public class TileEntityMachineSchrabidiumTransmutator extends TileEntityMachineB public boolean canProcess() { if (power >= 4990000 && slots[0] != null && MachineRecipes.mODE(slots[0], "ingotUranium") && slots[2] != null && slots[2].getItem() == ModItems.redcoil_capacitor - && slots[2].getItemDamage() < slots[2].getMaxDamage() + && ItemCapacitor.getDura(slots[2]) > 0 && (slots[1] == null || (slots[1] != null && slots[1].getItem() == VersatileConfig.getTransmutatorItem() && slots[1].stackSize < slots[1].getMaxStackSize()))) { return true; @@ -156,7 +136,7 @@ public class TileEntityMachineSchrabidiumTransmutator extends TileEntityMachineB slots[1].stackSize++; } if (slots[2] != null) { - slots[2].setItemDamage(slots[2].getItemDamage() + 1); + ItemCapacitor.setDura(slots[2], ItemCapacitor.getDura(slots[2]) - 1); } this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "ambient.weather.thunder", 10000.0F, diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityWatzCore.java b/src/main/java/com/hbm/tileentity/machine/TileEntityWatzCore.java index dc3c97d6a..2a78afc92 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityWatzCore.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityWatzCore.java @@ -16,6 +16,7 @@ import com.hbm.interfaces.IReactor; import com.hbm.interfaces.ISource; import com.hbm.inventory.FluidTank; import com.hbm.items.ModItems; +import com.hbm.items.machine.ItemCapacitor; import com.hbm.items.special.WatzFuel; import com.hbm.lib.Library; import com.hbm.main.MainRegistry; @@ -492,7 +493,7 @@ public class TileEntityWatzCore extends TileEntity implements ISidedInventory, I @Override public boolean hasFuse() { - return slots[38] != null && slots[38].getItem() == ModItems.titanium_filter && slots[38].getItemDamage() < slots[38].getMaxDamage(); + return slots[38] != null && slots[38].getItem() == ModItems.titanium_filter && ItemCapacitor.getDura(slots[38]) > 0; } @Override @@ -554,7 +555,7 @@ public class TileEntityWatzCore extends TileEntity implements ISidedInventory, I //Only damages filter when heat is present (thus waste being created) if (heatList > 0) { - slots[38].setItemDamage(slots[38].getItemDamage() + 1); + ItemCapacitor.setDura(slots[38], ItemCapacitor.getDura(slots[38]) - 1); } heatList *= heatMultiplier; @@ -578,21 +579,6 @@ public class TileEntityWatzCore extends TileEntity implements ISidedInventory, I tank.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId); tank.unloadTank(36, 39, slots); - - if(slots[36] != null && slots[36].getItem() == ModItems.titanium_filter && slots[36].getItemDamage() + 100 <= slots[36].getMaxDamage()) - { - if(tank.getFill() - 10 >= 0) - { - tank.setFill(tank.getFill() - 10); - slots[36].setItemDamage(slots[36].getItemDamage() + 100); - } else { - if(tank.getFill() > 0) - { - tank.setFill(0); - slots[36].setItemDamage(slots[36].getItemDamage() + 100); - } - } - } PacketDispatcher.wrapper.sendToAllAround(new AuxElectricityPacket(xCoord, yCoord, zCoord, power), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); }