diff --git a/assets/hbm/lang/de_DE.lang b/assets/hbm/lang/de_DE.lang index 32d79b0db..6a45a6a48 100644 --- a/assets/hbm/lang/de_DE.lang +++ b/assets/hbm/lang/de_DE.lang @@ -260,6 +260,7 @@ item.turret_biometry.name=Geschütz-Telemetriekarte item.key.name=Schlüssel item.key_red.name=Roter Schlüssel +item.pin.name=Haarklammer item.padlock.name=Vorhängeschloss tile.machine_keyforge.name=Schlossertisch container.keyForge=Schlossertisch @@ -371,6 +372,8 @@ tile.crate_iron.name=Eisenkiste container.crateIron=Eisenkiste tile.crate_steel.name=Stahlkiste container.crateSteel=Stahlkiste +tile.safe.name=Panzerschrank +container.safe=Panzerschrank tile.machine_press.name=Dampfpresse container.press=Dampfpresse tile.machine_siren.name=Sirene @@ -1113,6 +1116,7 @@ item.lemon.name="Zitrone" item.definitelyfood.name=GarantiertKeinDreck-Marken Feldration item.loops.name=Lüüps item.loop_stew.name=Informatiker-Frühstück +item.fooditem.name=lebensmittel tile.frozen_grass.name=Gefrorenes Gras tile.frozen_dirt.name=Gefrorene Erde @@ -1270,6 +1274,7 @@ item.plan_c.name=Plan C item.med_ipecac.name=Ipecac-Sirup item.med_ptsd.name=PTBS-Medikament item.med_schiziphrenia.name=Schizophrenie-Medikament +item.gas_mask_filter.name=Gasmaskenfilter item.stealth_boy.name=Mobile Tarnkappe diff --git a/assets/hbm/lang/en_US.lang b/assets/hbm/lang/en_US.lang index ca0ba8451..954bd0019 100644 --- a/assets/hbm/lang/en_US.lang +++ b/assets/hbm/lang/en_US.lang @@ -273,6 +273,7 @@ item.turret_biometry.name=Turret Telemetry Card item.key.name=Key item.key_red.name=Red Key +item.pin.name=Bobby Pin item.padlock.name=Padlock tile.machine_keyforge.name=Locksmith Table container.keyForge=Locksmith Table @@ -371,6 +372,8 @@ tile.crate_iron.name=Iron Crate container.crateIron=Iron Crate tile.crate_steel.name=Steel Crate container.crateSteel=Steel Crate +tile.safe.name=Safe +container.safe=Safe tile.machine_press.name=Steam Press container.press=Steam Press tile.machine_siren.name=Siren @@ -1113,6 +1116,7 @@ item.lemon.name="Lemon" item.definitelyfood.name=TotallyNotDirt-Brand MRE item.loops.name=Lööps item.loop_stew.name=IT Breakfast +item.fooditem.name=food item tile.frozen_grass.name=Frozen Grass tile.frozen_dirt.name=Frozen Dirt @@ -1270,6 +1274,7 @@ item.plan_c.name=Plan C item.med_ipecac.name=Ipecac Syrup item.med_ptsd.name=PTSD Medication item.med_schiziphrenia.name=Schizophrenia Medication +item.gas_mask_filter.name=Gas Mask Filter item.stealth_boy.name=Stealth Device diff --git a/assets/hbm/sounds.json b/assets/hbm/sounds.json index 16580839e..d6e94b461 100644 --- a/assets/hbm/sounds.json +++ b/assets/hbm/sounds.json @@ -34,6 +34,8 @@ "item.geiger4": {"category": "player", "sounds": [{"name": "tool/geiger4", "stream": false}]}, "item.geiger5": {"category": "player", "sounds": [{"name": "tool/geiger5", "stream": false}]}, "item.geiger6": {"category": "player", "sounds": [{"name": "tool/geiger6", "stream": false}]}, + "item.pinUnlock": {"category": "player", "sounds": [{"name": "tool/pinUnlock", "stream": false}]}, + "item.pinBreak": {"category": "player", "sounds": [{"name": "tool/pinBreak", "stream": false}]}, "music.recordLambdaCore": {"category": "record", "sounds": [{"name": "music/recordLambdaCore", "stream": true}]}, "music.recordSectorSweep": {"category": "record", "sounds": [{"name": "music/recordSectorSweep", "stream": true}]}, diff --git a/assets/hbm/sounds/tool/pinBreak.ogg b/assets/hbm/sounds/tool/pinBreak.ogg new file mode 100644 index 000000000..bdb42d2ff Binary files /dev/null and b/assets/hbm/sounds/tool/pinBreak.ogg differ diff --git a/assets/hbm/sounds/tool/pinUnlock.ogg b/assets/hbm/sounds/tool/pinUnlock.ogg new file mode 100644 index 000000000..680d20a19 Binary files /dev/null and b/assets/hbm/sounds/tool/pinUnlock.ogg differ diff --git a/assets/hbm/textures/blocks/safe_front.png b/assets/hbm/textures/blocks/safe_front.png new file mode 100644 index 000000000..28999652a Binary files /dev/null and b/assets/hbm/textures/blocks/safe_front.png differ diff --git a/assets/hbm/textures/blocks/safe_front_alt.png b/assets/hbm/textures/blocks/safe_front_alt.png new file mode 100644 index 000000000..abb87b06f Binary files /dev/null and b/assets/hbm/textures/blocks/safe_front_alt.png differ diff --git a/assets/hbm/textures/blocks/safe_side.png b/assets/hbm/textures/blocks/safe_side.png new file mode 100644 index 000000000..2e3a21dc1 Binary files /dev/null and b/assets/hbm/textures/blocks/safe_side.png differ diff --git a/assets/hbm/textures/blocks/safe_side_alt.png b/assets/hbm/textures/blocks/safe_side_alt.png new file mode 100644 index 000000000..c6fbfefbb Binary files /dev/null and b/assets/hbm/textures/blocks/safe_side_alt.png differ diff --git a/assets/hbm/textures/gui/gui_safe.png b/assets/hbm/textures/gui/gui_safe.png new file mode 100644 index 000000000..05f9aa155 Binary files /dev/null and b/assets/hbm/textures/gui/gui_safe.png differ diff --git a/assets/hbm/textures/items/gas_mask_filter.png b/assets/hbm/textures/items/gas_mask_filter.png new file mode 100644 index 000000000..b1393ea9f Binary files /dev/null and b/assets/hbm/textures/items/gas_mask_filter.png differ diff --git a/assets/hbm/textures/items/pin.png b/assets/hbm/textures/items/pin.png new file mode 100644 index 000000000..a7257d750 Binary files /dev/null and b/assets/hbm/textures/items/pin.png differ diff --git a/com/hbm/blocks/ModBlocks.java b/com/hbm/blocks/ModBlocks.java index 2fae4ec01..33bbcf07f 100644 --- a/com/hbm/blocks/ModBlocks.java +++ b/com/hbm/blocks/ModBlocks.java @@ -226,6 +226,9 @@ public class ModBlocks { public static Block crate_steel; public static final int guiID_crate_steel = 47; + public static Block safe; + public static final int guiID_safe = 70; + public static Block nuke_gadget; public static final int guiID_nuke_gadget = 3; @@ -910,6 +913,7 @@ public class ModBlocks { crate_red = new BlockCrate(Material.iron).setBlockName("crate_red").setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":crate_red"); crate_iron = new BlockStorageCrate(Material.iron).setBlockName("crate_iron").setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); crate_steel = new BlockStorageCrate(Material.iron).setBlockName("crate_steel").setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); + safe = new BlockStorageCrate(Material.iron).setBlockName("safe").setStepSound(Block.soundTypeMetal).setHardness(7.5F).setResistance(10000.0F).setCreativeTab(MainRegistry.machineTab); boxcar = new DecoBlock(Material.iron).setBlockName("boxcar").setStepSound(Block.soundTypeMetal).setHardness(10.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":boxcar"); bomber = new DecoBlock(Material.iron).setBlockName("bomber").setStepSound(Block.soundTypeMetal).setHardness(10.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":bomber"); @@ -1233,6 +1237,7 @@ public class ModBlocks { //Crates GameRegistry.registerBlock(crate_iron, crate_iron.getUnlocalizedName()); GameRegistry.registerBlock(crate_steel, crate_steel.getUnlocalizedName()); + GameRegistry.registerBlock(safe, safe.getUnlocalizedName()); //Junk GameRegistry.registerBlock(boxcar, boxcar.getUnlocalizedName()); diff --git a/com/hbm/blocks/generic/BlockStorageCrate.java b/com/hbm/blocks/generic/BlockStorageCrate.java index 86c7692e1..0e91ac1f2 100644 --- a/com/hbm/blocks/generic/BlockStorageCrate.java +++ b/com/hbm/blocks/generic/BlockStorageCrate.java @@ -9,7 +9,9 @@ import com.hbm.main.MainRegistry; import com.hbm.tileentity.machine.TileEntityCrateIron; import com.hbm.tileentity.machine.TileEntityCrateSteel; import com.hbm.tileentity.machine.TileEntityLockableBase; +import com.hbm.tileentity.machine.TileEntityMachineCoal; import com.hbm.tileentity.machine.TileEntityMachineOilWell; +import com.hbm.tileentity.machine.TileEntitySafe; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; @@ -18,6 +20,7 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; @@ -25,6 +28,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class BlockStorageCrate extends BlockContainer { @@ -53,11 +57,20 @@ public class BlockStorageCrate extends BlockContainer { this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":crate_steel_top"); this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":crate_steel_side"); } + if(this == ModBlocks.safe) + { + this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":safe_front"); + this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":safe_side"); + } } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { + + if(this == ModBlocks.safe) + return metadata == 0 && side == 3 ? this.iconTop : (side == metadata ? this.iconTop : this.blockIcon); + return side == 1 ? this.iconTop : (side == 0 ? this.iconTop : this.blockIcon); } @@ -67,6 +80,8 @@ public class BlockStorageCrate extends BlockContainer { return new TileEntityCrateIron(); if(this == ModBlocks.crate_steel) return new TileEntityCrateSteel(); + if(this == ModBlocks.safe) + return new TileEntitySafe(); return null; } @@ -147,10 +162,40 @@ public class BlockStorageCrate extends BlockContainer { { FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_crate_steel, world, x, y, z); } + if(entity instanceof TileEntitySafe && ((TileEntitySafe)entity).canAccess(player)) + { + FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_safe, world, x, y, z); + } return true; } else { return false; } } + + @Override + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { + + if(this != ModBlocks.safe) + super.onBlockPlacedBy(world, x, y, z, player, itemStack); + + int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + + if(i == 0) + { + world.setBlockMetadataWithNotify(x, y, z, 2, 2); + } + if(i == 1) + { + world.setBlockMetadataWithNotify(x, y, z, 5, 2); + } + if(i == 2) + { + world.setBlockMetadataWithNotify(x, y, z, 3, 2); + } + if(i == 3) + { + world.setBlockMetadataWithNotify(x, y, z, 4, 2); + } + } } diff --git a/com/hbm/handler/GUIHandler.java b/com/hbm/handler/GUIHandler.java index 3e46aa2c7..0c14d9851 100644 --- a/com/hbm/handler/GUIHandler.java +++ b/com/hbm/handler/GUIHandler.java @@ -72,6 +72,7 @@ import com.hbm.tileentity.machine.TileEntityRadiobox; import com.hbm.tileentity.machine.TileEntityReactorMultiblock; import com.hbm.tileentity.machine.TileEntityReiXMainframe; import com.hbm.tileentity.machine.TileEntityRtgFurnace; +import com.hbm.tileentity.machine.TileEntitySafe; import com.hbm.tileentity.machine.TileEntityMachineSatLinker; import com.hbm.tileentity.machine.TileEntityWatzCore; @@ -698,6 +699,15 @@ public class GUIHandler implements IGuiHandler { } return null; } + + case ModBlocks.guiID_safe: + { + if(entity instanceof TileEntitySafe) + { + return new ContainerSafe(player.inventory, (TileEntitySafe) entity); + } + return null; + } } return null; } @@ -1320,6 +1330,15 @@ public class GUIHandler implements IGuiHandler { } return null; } + + case ModBlocks.guiID_safe: + { + if(entity instanceof TileEntitySafe) + { + return new GUISafe(player.inventory, (TileEntitySafe) entity); + } + return null; + } } } else { //CLIENTONLY GUIS diff --git a/com/hbm/inventory/container/ContainerSafe.java b/com/hbm/inventory/container/ContainerSafe.java new file mode 100644 index 000000000..91f13f804 --- /dev/null +++ b/com/hbm/inventory/container/ContainerSafe.java @@ -0,0 +1,80 @@ +package com.hbm.inventory.container; + +import com.hbm.tileentity.machine.TileEntityCrateSteel; +import com.hbm.tileentity.machine.TileEntitySafe; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class ContainerSafe extends Container { + + private TileEntitySafe diFurnace; + + public ContainerSafe(InventoryPlayer invPlayer, TileEntitySafe tedf) { + diFurnace = tedf; + + for(int i = 0; i < 3; i++) + { + for(int j = 0; j < 5; j++) + { + this.addSlotToContainer(new Slot(tedf, j + i * 5, 8 + j * 18 + 18 * 2, 18 + i * 18)); + } + } + + for(int i = 0; i < 3; i++) + { + for(int j = 0; j < 9; j++) + { + this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + 2)); + } + } + + for(int i = 0; i < 9; i++) + { + this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 2)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) + { + ItemStack var3 = null; + Slot var4 = (Slot) this.inventorySlots.get(par2); + + if (var4 != null && var4.getHasStack()) + { + ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + if (par2 <= diFurnace.getSizeInventory() - 1) { + if (!this.mergeItemStack(var5, diFurnace.getSizeInventory(), this.inventorySlots.size(), true)) + { + return null; + } + } + else if (!this.mergeItemStack(var5, 0, diFurnace.getSizeInventory(), false)) + { + return null; + } + + if (var5.stackSize == 0) + { + var4.putStack((ItemStack) null); + } + else + { + var4.onSlotChanged(); + } + } + + return var3; + } + + @Override + public boolean canInteractWith(EntityPlayer player) { + return diFurnace.isUseableByPlayer(player); + } +} diff --git a/com/hbm/inventory/gui/GUISafe.java b/com/hbm/inventory/gui/GUISafe.java new file mode 100644 index 000000000..3b6fbac0c --- /dev/null +++ b/com/hbm/inventory/gui/GUISafe.java @@ -0,0 +1,44 @@ +package com.hbm.inventory.gui; + +import org.lwjgl.opengl.GL11; + +import com.hbm.inventory.container.ContainerCrateSteel; +import com.hbm.inventory.container.ContainerSafe; +import com.hbm.lib.RefStrings; +import com.hbm.tileentity.machine.TileEntityCrateSteel; +import com.hbm.tileentity.machine.TileEntitySafe; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; + +public class GUISafe extends GuiContainer { + + private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_safe.png"); + private TileEntitySafe diFurnace; + + public GUISafe(InventoryPlayer invPlayer, TileEntitySafe tedf) { + super(new ContainerSafe(invPlayer, tedf)); + diFurnace = tedf; + + this.xSize = 176; + this.ySize = 168; + } + + @Override + protected void drawGuiContainerForegroundLayer(int i, int j) { + String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName()); + + this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); + this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); + } +} diff --git a/com/hbm/items/ModItems.java b/com/hbm/items/ModItems.java index e60eb0971..1ad6035aa 100644 --- a/com/hbm/items/ModItems.java +++ b/com/hbm/items/ModItems.java @@ -525,6 +525,7 @@ public class ModItems { public static Item pill_iodine; public static Item plan_c; public static Item stealth_boy; + public static Item gas_mask_filter; public static Item can_empty; public static Item can_smart; @@ -1190,6 +1191,7 @@ public class ModItems { public static Item key; public static Item key_red; + public static Item pin; public static Item padlock; public static Item turret_light_ammo; @@ -1794,6 +1796,7 @@ public class ModItems { pill_iodine = new ItemPill(0).setUnlocalizedName("pill_iodine").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":pill_iodine"); plan_c = new ItemPill(0).setUnlocalizedName("plan_c").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":plan_c"); stealth_boy = new ItemStarterKit().setUnlocalizedName("stealth_boy").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":stealth_boy"); + gas_mask_filter = new ItemSyringe().setUnlocalizedName("gas_mask_filter").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":gas_mask_filter"); can_empty = new Item().setUnlocalizedName("can_empty").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":can_empty"); can_smart = new ItemEnergy().setUnlocalizedName("can_smart").setContainerItem(ModItems.can_empty).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":can_smart"); @@ -2310,6 +2313,7 @@ public class ModItems { key = new ItemKey().setUnlocalizedName("key").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":key"); key_red = new Item().setUnlocalizedName("key_red").setMaxStackSize(1).setCreativeTab(null).setTextureName(RefStrings.MODID + ":key_red"); + pin = new ItemCustomLore().setUnlocalizedName("pin").setMaxStackSize(8).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":pin"); padlock = new ItemLock().setUnlocalizedName("padlock").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":padlock"); turret_light_ammo = new ItemTurretAmmo(ModBlocks.turret_light, 100).setUnlocalizedName("turret_light_ammo").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":turret_light_ammo"); @@ -3365,6 +3369,7 @@ public class ModItems { //Keys and Locks GameRegistry.registerItem(key, key.getUnlocalizedName()); GameRegistry.registerItem(key_red, key_red.getUnlocalizedName()); + GameRegistry.registerItem(pin, pin.getUnlocalizedName()); GameRegistry.registerItem(padlock, padlock.getUnlocalizedName()); //Missiles @@ -3650,6 +3655,7 @@ public class ModItems { GameRegistry.registerItem(pill_iodine, pill_iodine.getUnlocalizedName()); GameRegistry.registerItem(plan_c, plan_c.getUnlocalizedName()); GameRegistry.registerItem(stealth_boy, stealth_boy.getUnlocalizedName()); + GameRegistry.registerItem(gas_mask_filter, gas_mask_filter.getUnlocalizedName()); //Food GameRegistry.registerItem(bomb_waffle, bomb_waffle.getUnlocalizedName()); diff --git a/com/hbm/items/special/ItemCustomLore.java b/com/hbm/items/special/ItemCustomLore.java index 097e0ff59..d259f914f 100644 --- a/com/hbm/items/special/ItemCustomLore.java +++ b/com/hbm/items/special/ItemCustomLore.java @@ -3,6 +3,7 @@ package com.hbm.items.special; import java.util.List; import com.hbm.items.ModItems; +import com.hbm.lib.Library; import com.hbm.main.MainRegistry; import cpw.mods.fml.relauncher.Side; @@ -636,6 +637,16 @@ public class ItemCustomLore extends ItemRadioactive { list.add("Schrabidium +15"); list.add("Removes fallout"); } + + if(this == ModItems.pin) + { + list.add("Can be used with a screwdriver to pick locks."); + + if(Library.checkArmorPiece(player, ModItems.jackt, 2) || Library.checkArmorPiece(player, ModItems.jackt2, 2)) + list.add("Success rate of lockpicking is 100%!"); + else + list.add("Success rate of lockpicking is ~10%"); + } } @Override diff --git a/com/hbm/items/special/ItemSyringe.java b/com/hbm/items/special/ItemSyringe.java index c1766990d..78fd31b4a 100644 --- a/com/hbm/items/special/ItemSyringe.java +++ b/com/hbm/items/special/ItemSyringe.java @@ -230,6 +230,17 @@ public class ItemSyringe extends Item { } } + if(this == ModItems.gas_mask_filter && player.inventory.armorInventory[3] != null && + (player.inventory.armorInventory[3].getItem() == ModItems.gas_mask || player.inventory.armorInventory[3].getItem() == ModItems.gas_mask_m65)) + { + if (!world.isRemote) + { + player.inventory.armorInventory[3].setItemDamage(0); + + stack.stackSize--; + } + } + return stack; } @@ -484,5 +495,8 @@ public class ItemSyringe extends Item { list.add("Nausea I for 5 seconds"); list.add("Cloud damage + taint = tainted heart effect"); } + if(this == ModItems.gas_mask_filter) { + list.add("Repairs worn gasmask"); + } } } diff --git a/com/hbm/lib/HbmChestContents.java b/com/hbm/lib/HbmChestContents.java index b3d15572d..6fa674809 100644 --- a/com/hbm/lib/HbmChestContents.java +++ b/com/hbm/lib/HbmChestContents.java @@ -36,7 +36,8 @@ public class HbmChestContents { new WeightedRandomChestContent(ModItems.cap_nuka, 0, 1, 15, 7), new WeightedRandomChestContent(ModItems.canister_fuel, 0, 1, 2, 2), new WeightedRandomChestContent(ModItems.canister_biofuel, 0, 1, 2, 3), - new WeightedRandomChestContent(ModItems.gas_mask_m65, 60, 1, 1, 2) }; + new WeightedRandomChestContent(ModItems.gas_mask_m65, 60, 1, 1, 2), + new WeightedRandomChestContent(ModItems.gas_mask_filter, 0, 1, 1, 3) }; private static WeightedRandomChestContent[] antenna = new WeightedRandomChestContent[] { new WeightedRandomChestContent(ModItems.ingot_steel, 0, 1, 2, 7), @@ -61,7 +62,8 @@ public class HbmChestContents { new WeightedRandomChestContent(ModItems.bottle_cherry, 0, 1, 1, 2), new WeightedRandomChestContent(ModItems.stealth_boy, 0, 1, 1, 1), new WeightedRandomChestContent(ModItems.cap_nuka, 0, 1, 15, 7), - new WeightedRandomChestContent(ModItems.bomb_caller, 0, 1, 2, 1) }; + new WeightedRandomChestContent(ModItems.bomb_caller, 0, 1, 2, 1), + new WeightedRandomChestContent(ModItems.gas_mask_filter, 0, 1, 1, 2) }; private static WeightedRandomChestContent[] expensive = new WeightedRandomChestContent[] { new WeightedRandomChestContent(ModItems.nugget_schrabidium, 0, 1, 1, 1), @@ -98,7 +100,8 @@ public class HbmChestContents { new WeightedRandomChestContent(ModItems.bomb_caller, 1, 1, 2, 1), new WeightedRandomChestContent(ModItems.bomb_caller, 2, 1, 2, 1), new WeightedRandomChestContent(ModItems.bomb_caller, 3, 1, 2, 2), - new WeightedRandomChestContent(ModItems.bomb_caller, 4, 1, 2, 1) }; + new WeightedRandomChestContent(ModItems.bomb_caller, 4, 1, 2, 1), + new WeightedRandomChestContent(ModItems.gas_mask_filter, 0, 1, 1, 4) }; private static WeightedRandomChestContent[] nukeTrash = new WeightedRandomChestContent[] { new WeightedRandomChestContent(ModItems.nugget_u238, 0, 3, 12, 5), @@ -113,6 +116,7 @@ public class HbmChestContents { new WeightedRandomChestContent(ModItems.rod_quad_pu240, 0, 1, 1, 3), new WeightedRandomChestContent(ModItems.bottle_quantum, 0, 1, 1, 1), new WeightedRandomChestContent(ModItems.gas_mask_m65, 60, 1, 1, 5), + new WeightedRandomChestContent(ModItems.gas_mask_filter, 0, 1, 1, 5), new WeightedRandomChestContent(Item.getItemFromBlock(ModBlocks.yellow_barrel), 0, 1, 1, 2) }; private static WeightedRandomChestContent[] nuclear = new WeightedRandomChestContent[] { @@ -141,6 +145,7 @@ public class HbmChestContents { new WeightedRandomChestContent(ModItems.powder_cobalt, 0, 1, 1, 1), new WeightedRandomChestContent(ModItems.bottle_quantum, 0, 1, 1, 1), new WeightedRandomChestContent(ModItems.gas_mask_m65, 60, 1, 1, 5), + new WeightedRandomChestContent(ModItems.gas_mask_filter, 0, 1, 1, 5), new WeightedRandomChestContent(Item.getItemFromBlock(ModBlocks.yellow_barrel), 0, 1, 3, 3) }; private static WeightedRandomChestContent[] vertibird = new WeightedRandomChestContent[] { @@ -164,6 +169,7 @@ public class HbmChestContents { new WeightedRandomChestContent(ModItems.stealth_boy, 0, 1, 1, 7), new WeightedRandomChestContent(ModItems.crate_caller, 0, 1, 1, 3), new WeightedRandomChestContent(ModItems.gas_mask_m65, 0, 1, 1, 5), + new WeightedRandomChestContent(ModItems.gas_mask_filter, 0, 1, 1, 5), new WeightedRandomChestContent(ModItems.grenade_nuclear, 0, 1, 2, 2), new WeightedRandomChestContent(ModItems.bomb_caller, 0, 1, 2, 3), new WeightedRandomChestContent(ModItems.bomb_caller, 1, 1, 2, 3), diff --git a/com/hbm/main/CraftingManager.java b/com/hbm/main/CraftingManager.java index 09c4eff9f..2c33da46d 100644 --- a/com/hbm/main/CraftingManager.java +++ b/com/hbm/main/CraftingManager.java @@ -1077,8 +1077,9 @@ public class CraftingManager { //GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.australium_v, 1), new Object[] { "SCS", "PAP", "ESE", 'S', ModItems.syringe_metal_empty, 'C', ModItems.circuit_gold, 'P', "plateAdvanced", 'A', ModItems.nugget_australium, 'E', ModItems.powder_power })); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.goggles, 1), new Object[] { "P P", "GPG", 'G', "paneGlass", 'P', "plateSteel" })); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gas_mask, 1), new Object[] { "PPP", "GPG", "FPF", 'G', "paneGlass", 'P', "plateSteel", 'F', ModItems.filter_coal })); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gas_mask_m65, 1), new Object[] { "PPP", "GPG", "FIF", 'G', "paneGlass", 'P', ModItems.plate_polymer, 'F', ModItems.filter_coal, 'I', "plateIron" })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gas_mask, 1), new Object[] { "PPP", "GPG", " F ", 'G', "paneGlass", 'P', "plateSteel", 'F', ModItems.gas_mask_filter })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gas_mask_m65, 1), new Object[] { "PPP", "GPG", " F ", 'G', "paneGlass", 'P', ModItems.plate_polymer, 'F', ModItems.gas_mask_filter })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gas_mask_filter, 1), new Object[] { "F", "I", "F", 'F', ModItems.filter_coal, 'I', "plateIron" })); GameRegistry.addRecipe(new ItemStack(ModItems.cape_radiation, 1), new Object[] { "W W", "WIW", "WDW", 'W', new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 11), 'D', new ItemStack(Items.dye, 1, 11), 'I', ModItems.nuclear_waste }); GameRegistry.addRecipe(new ItemStack(ModItems.cape_gasmask, 1), new Object[] { "W W", "WIW", "WDW", 'W', new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 4), 'D', new ItemStack(Items.dye, 1, 0), 'I', ModItems.gas_mask }); @@ -1111,6 +1112,7 @@ public class CraftingManager { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.key, 1), new Object[] { " B", " B ", "P ", 'P', "plateSteel", 'B', ModItems.bolt_tungsten })); GameRegistry.addRecipe(new ItemStack(ModItems.key_red, 1), new Object[] { " C", " M ", "K ", 'C', ModItems.circuit_targeting_tier4, 'M', ModItems.motor, 'K', ModItems.key }); + GameRegistry.addRecipe(new ItemStack(ModItems.pin, 1), new Object[] { "W ", " W", " W", 'W', ModItems.wire_copper }); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.padlock, 1), new Object[] { " P ", "PBP", "PPP", 'P', "plateSteel", 'B', ModItems.bolt_tungsten })); //GameRegistry.addRecipe(new ItemStack(ModItems.schrabidium_hammer, 1), new Object[] { "BBB", "BBB", " S ", 'B', Item.getItemFromBlock(ModBlocks.block_schrabidium), 'S', Items.stick }); diff --git a/com/hbm/main/MainRegistry.java b/com/hbm/main/MainRegistry.java index a4e442770..6404e640b 100644 --- a/com/hbm/main/MainRegistry.java +++ b/com/hbm/main/MainRegistry.java @@ -300,6 +300,7 @@ import com.hbm.tileentity.machine.TileEntityRadioRec; import com.hbm.tileentity.machine.TileEntityRadiobox; import com.hbm.tileentity.machine.TileEntityReactorMultiblock; import com.hbm.tileentity.machine.TileEntityRtgFurnace; +import com.hbm.tileentity.machine.TileEntitySafe; import com.hbm.tileentity.machine.TileEntityMachineSatLinker; import com.hbm.tileentity.machine.TileEntityStructureMarker; import com.hbm.tileentity.machine.TileEntityVaultDoor; @@ -696,6 +697,7 @@ public class MainRegistry GameRegistry.registerTileEntity(TileEntitySellafield.class, "tileentity_sellafield_core"); GameRegistry.registerTileEntity(TileEntityNukeN45.class, "tileentity_n45"); GameRegistry.registerTileEntity(TileEntityBlastDoor.class, "tileentity_blast_door"); + GameRegistry.registerTileEntity(TileEntitySafe.class, "tileentity_safe"); EntityRegistry.registerModEntity(EntityRocket.class, "entity_rocket", 0, this, 250, 1, true); EntityRegistry.registerModEntity(EntityNukeExplosion.class, "entity_nuke_explosion", 1, this, 250, 1, true); diff --git a/com/hbm/tileentity/machine/TileEntityLockableBase.java b/com/hbm/tileentity/machine/TileEntityLockableBase.java index 7bf0311b8..be5c40a27 100644 --- a/com/hbm/tileentity/machine/TileEntityLockableBase.java +++ b/com/hbm/tileentity/machine/TileEntityLockableBase.java @@ -2,6 +2,7 @@ package com.hbm.tileentity.machine; import com.hbm.items.ModItems; import com.hbm.items.tool.ItemKey; +import com.hbm.lib.Library; import com.hbm.main.MainRegistry; import net.minecraft.entity.player.EntityPlayer; @@ -65,6 +66,33 @@ public abstract class TileEntityLockableBase extends TileEntity { worldObj.playSoundAtEntity(player, "hbm:block.lockOpen", 1.0F, 1.0F); return true; } + + if(stack != null && stack.getItem() == ModItems.pin && player.inventory.hasItem(ModItems.screwdriver)) { + + stack.stackSize--; + + if(player.worldObj.rand.nextInt(10) == 0 || Library.checkArmorPiece(player, ModItems.jackt, 2) || Library.checkArmorPiece(player, ModItems.jackt2, 2)) { + worldObj.playSoundAtEntity(player, "hbm:item.pinUnlock", 1.0F, 1.0F); + return true; + } else { + worldObj.playSoundAtEntity(player, "hbm:item.pinBreak", 1.0F, 0.8F + player.worldObj.rand.nextFloat() * 0.2F); + return false; + } + } + + if(stack != null && stack.getItem() == ModItems.screwdriver && player.inventory.hasItem(ModItems.pin)) { + + player.inventory.consumeInventoryItem(ModItems.pin); + player.inventoryContainer.detectAndSendChanges(); + + if(player.worldObj.rand.nextInt(10) == 0 || Library.checkArmorPiece(player, ModItems.jackt, 2) || Library.checkArmorPiece(player, ModItems.jackt2, 2)) { + worldObj.playSoundAtEntity(player, "hbm:item.pinUnlock", 1.0F, 1.0F); + return true; + } else { + worldObj.playSoundAtEntity(player, "hbm:item.pinBreak", 1.0F, 0.8F + player.worldObj.rand.nextFloat() * 0.2F); + return false; + } + } } return false; diff --git a/com/hbm/tileentity/machine/TileEntitySafe.java b/com/hbm/tileentity/machine/TileEntitySafe.java new file mode 100644 index 000000000..3af01a068 --- /dev/null +++ b/com/hbm/tileentity/machine/TileEntitySafe.java @@ -0,0 +1,160 @@ +package com.hbm.tileentity.machine; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; + +public class TileEntitySafe extends TileEntityLockableBase implements ISidedInventory { + + private ItemStack slots[]; + + private String customName; + + public TileEntitySafe() { + slots = new ItemStack[15]; + } + + @Override + public int getSizeInventory() { + return slots.length; + } + + @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.safe"; + } + + @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) <= 64; + } + } + + // You scrubs aren't needed for anything (right now) + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack stack) { + return true; + } + + @Override + public ItemStack decrStackSize(int i, int j) { + if (slots[i] != null) { + if (slots[i].stackSize <= j) { + ItemStack itemStack = slots[i]; + slots[i] = null; + return itemStack; + } + ItemStack itemStack1 = slots[i].splitStack(j); + if (slots[i].stackSize == 0) { + slots[i] = null; + } + + return itemStack1; + } else { + return null; + } + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + NBTTagList list = nbt.getTagList("items", 10); + + 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); + } + } + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + 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_) { + int[] slots = new int[15]; + for(int i = 0; i < slots.length; i++) + slots[i] = i; + return slots; + } + + @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 true; + } +} diff --git a/com/hbm/world/Relay.java b/com/hbm/world/Relay.java index ebf1b35fb..b9d00fa58 100644 --- a/com/hbm/world/Relay.java +++ b/com/hbm/world/Relay.java @@ -7,6 +7,7 @@ import java.util.Random; import com.hbm.blocks.ModBlocks; import com.hbm.lib.HbmChestContents; import com.hbm.main.MainRegistry; +import com.hbm.tileentity.machine.TileEntityCrateIron; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -646,9 +647,9 @@ public class Relay extends WorldGenerator world.setBlock(x + 10, y + 0, z + 9, Blocks.iron_bars, 0, 3); world.setBlock(x + 0, y + 0, z + 10, Block3, 0, 3); world.setBlock(x + 4, y + 0, z + 10, Blocks.brick_block, 0, 3); - world.setBlock(x + 6, y + 0, z + 10, Blocks.chest, 3, 3); + world.setBlock(x + 6, y + 0, z + 10, ModBlocks.crate_iron, 0, 3); world.setBlockMetadataWithNotify(x + 6, y + 0, z + 10, 3, 3); - WeightedRandomChestContent.generateChestContents(rand, HbmChestContents.getLoot(1), (TileEntityChest)world.getTileEntity(x + 6, y + 0, z + 10), 8); + WeightedRandomChestContent.generateChestContents(rand, HbmChestContents.getLoot(1), (TileEntityCrateIron)world.getTileEntity(x + 6, y + 0, z + 10), 8); world.setBlock(x + 7, y + 0, z + 10, Blocks.brick_block, 0, 3); world.setBlock(x + 8, y + 0, z + 10, Blocks.brick_block, 0, 3); world.setBlock(x + 10, y + 0, z + 10, Blocks.iron_bars, 0, 3); @@ -1265,9 +1266,9 @@ public class Relay extends WorldGenerator world.setBlock(x + 5, y + 14, z + 6, Block4, 2, 3); world.setBlock(x + 6, y + 14, z + 6, Block2, 0, 3); world.setBlock(x + 7, y + 14, z + 6, Block4, 2, 3); - world.setBlock(x + 8, y + 14, z + 6, Blocks.chest, 3, 3); + world.setBlock(x + 8, y + 14, z + 6, ModBlocks.crate_iron, 0, 3); world.setBlockMetadataWithNotify(x + 8, y + 14, z + 6, 3, 3); - WeightedRandomChestContent.generateChestContents(rand, HbmChestContents.getLoot(2), (TileEntityChest)world.getTileEntity(x + 8, y + 14, z + 6), 8); + WeightedRandomChestContent.generateChestContents(rand, HbmChestContents.getLoot(2), (TileEntityCrateIron)world.getTileEntity(x + 8, y + 14, z + 6), 8); world.setBlock(x + 9, y + 14, z + 6, Blocks.iron_bars, 0, 3); world.setBlock(x + 10, y + 14, z + 6, Block6, 0, 3); world.setBlock(x + 9, y + 14, z + 7, Blocks.iron_bars, 0, 3); @@ -1485,9 +1486,9 @@ public class Relay extends WorldGenerator world.setBlock(x + 6, y + 32, z + 1, Block7, 0, 3); world.setBlock(x + 8, y + 32, z + 1, Block6, 0, 3); world.setBlock(x + 5, y + 32, z + 2, Block6, 0, 3); - world.setBlock(x + 6, y + 32, z + 2, Blocks.chest, 2, 3); + world.setBlock(x + 6, y + 32, z + 2, ModBlocks.crate_iron, 0, 3); world.setBlockMetadataWithNotify(x + 6, y + 32, z + 2, 2, 3); - WeightedRandomChestContent.generateChestContents(rand, HbmChestContents.getLoot(3), (TileEntityChest)world.getTileEntity(x + 6, y + 32, z + 2), 8); + WeightedRandomChestContent.generateChestContents(rand, HbmChestContents.getLoot(3), (TileEntityCrateIron)world.getTileEntity(x + 6, y + 32, z + 2), 8); world.setBlock(x + 7, y + 32, z + 2, Block6, 0, 3); world.setBlock(x + 5, y + 32, z + 3, Block4, 3, 3); world.setBlock(x + 6, y + 32, z + 3, Block2, 0, 3);