From cd70fc7c10529bc3d8864dacc14d8e4cb8b82303 Mon Sep 17 00:00:00 2001 From: Vaern Date: Sun, 6 Nov 2022 12:45:15 -0800 Subject: [PATCH] BlockDecoModel moved to BlockEnumMulti, more lore, vinyl tile crafting --- .../java/com/hbm/blocks/BlockEnumMulti.java | 2 +- src/main/java/com/hbm/blocks/BlockEnums.java | 12 ++++ src/main/java/com/hbm/blocks/ModBlocks.java | 11 +-- .../blocks/generic/BlockDecoContainer.java | 57 +++++++-------- .../hbm/blocks/generic/BlockDecoModel.java | 61 ++++------------ .../com/hbm/inventory/gui/GUIBookLore.java | 11 ++- .../com/hbm/items/special/ItemBookLore.java | 5 ++ .../java/com/hbm/lib/HbmChestContents.java | 69 +++---------------- .../java/com/hbm/main/CraftingManager.java | 7 +- .../render/block/RenderBlockDecoModel.java | 4 +- .../render/tileentity/RenderFileCabinet.java | 10 +-- .../hbm/world/worldgen/MapGenNTMFeatures.java | 2 +- .../worldgen/components/CivilianFeatures.java | 1 + .../world/worldgen/components/Component.java | 14 ++-- .../worldgen/components/OfficeFeatures.java | 15 ++-- src/main/resources/assets/hbm/lang/en_US.lang | 30 +++++++- 16 files changed, 142 insertions(+), 169 deletions(-) diff --git a/src/main/java/com/hbm/blocks/BlockEnumMulti.java b/src/main/java/com/hbm/blocks/BlockEnumMulti.java index 94b4d7519..8c92a8384 100644 --- a/src/main/java/com/hbm/blocks/BlockEnumMulti.java +++ b/src/main/java/com/hbm/blocks/BlockEnumMulti.java @@ -41,7 +41,7 @@ public class BlockEnumMulti extends BlockMulti { @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { - return this.icons[meta % this.icons.length]; + return multiTexture ? this.icons[meta % this.icons.length] : this.blockIcon; } @Override diff --git a/src/main/java/com/hbm/blocks/BlockEnums.java b/src/main/java/com/hbm/blocks/BlockEnums.java index 00858aae8..91ddd90e4 100644 --- a/src/main/java/com/hbm/blocks/BlockEnums.java +++ b/src/main/java/com/hbm/blocks/BlockEnums.java @@ -14,8 +14,20 @@ public class BlockEnums { ASBESTOS } + /** DECO / STRUCTURE ENUMS */ + //i apologize in advance + public static enum TileType { LARGE, SMALL } + + public static enum DecoComputerEnum { + IBM_300PL + } + + public static enum DecoCabinetEnum { + GREEN, + STEEL + } } diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index d32485948..ea28c4f5d 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -3,7 +3,8 @@ package com.hbm.blocks; import com.hbm.blocks.generic.*; import com.hbm.blocks.generic.BlockHazard.ExtDisplayEffect; import com.hbm.blocks.generic.BlockMotherOfAllOres.ItemRandomOreBlock; -import com.hbm.blocks.BlockEnums.TileType; +import com.hbm.blocks.BlockEnums.DecoComputerEnum; +import com.hbm.blocks.BlockEnums.*; import com.hbm.blocks.bomb.*; import com.hbm.blocks.fluid.*; import com.hbm.blocks.gas.*; @@ -1680,9 +1681,9 @@ public class ModBlocks { brick_forgotten = new BlockGeneric(Material.rock).setBlockName("brick_forgotten").setCreativeTab(MainRegistry.blockTab).setBlockUnbreakable().setResistance(1000000).setBlockTextureName(RefStrings.MODID + ":brick_forgotten"); - deco_computer = new BlockDecoModel(Material.iron, 1).setBlockBoundsTo(.160749F, 0F, 0F, .839251F, .867849F, .622184F).setBlockName("deco_computer").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_computer"); + deco_computer = new BlockDecoModel(Material.iron, DecoComputerEnum.class, true, false).setBlockBoundsTo(.160749F, 0F, 0F, .839251F, .867849F, .622184F).setBlockName("deco_computer").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_computer"); - filing_cabinet = new BlockDecoContainer(Material.iron, 2, TileEntityFileCabinet.class).setBlockBoundsTo(.1875F, 0F, 0F, .8125F, 1F, .75F).setBlockName("filing_cabinet").setCreativeTab(MainRegistry.blockTab).setHardness(10.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":block_steel"); + filing_cabinet = new BlockDecoContainer(Material.iron, DecoCabinetEnum.class, true, false, TileEntityFileCabinet.class).setBlockBoundsTo(.1875F, 0F, 0F, .8125F, 1F, .75F).setBlockName("filing_cabinet").setCreativeTab(MainRegistry.blockTab).setHardness(10.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":block_steel"); tape_recorder = new DecoTapeRecorder(Material.iron).setBlockName("tape_recorder").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_tape_recorder"); steel_poles = new DecoSteelPoles(Material.iron).setBlockName("steel_poles").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_beam"); @@ -2798,8 +2799,8 @@ public class ModBlocks { GameRegistry.registerBlock(brick_dungeon_tile, brick_dungeon_tile.getUnlocalizedName()); GameRegistry.registerBlock(brick_dungeon_circle, brick_dungeon_circle.getUnlocalizedName()); GameRegistry.registerBlock(brick_forgotten, brick_forgotten.getUnlocalizedName()); - GameRegistry.registerBlock(deco_computer, deco_computer.getUnlocalizedName()); - GameRegistry.registerBlock(filing_cabinet, ItemBlockMeta.class, filing_cabinet.getUnlocalizedName()); + GameRegistry.registerBlock(deco_computer, ItemBlockBase.class, deco_computer.getUnlocalizedName()); + GameRegistry.registerBlock(filing_cabinet, ItemBlockBase.class, filing_cabinet.getUnlocalizedName()); GameRegistry.registerBlock(tape_recorder, tape_recorder.getUnlocalizedName()); GameRegistry.registerBlock(steel_poles, steel_poles.getUnlocalizedName()); GameRegistry.registerBlock(pole_top, pole_top.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java b/src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java index e9f65a120..9640095d5 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java +++ b/src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java @@ -1,37 +1,40 @@ package com.hbm.blocks.generic; -import java.util.List; import java.util.Random; +import com.hbm.items.ModItems; +import com.hbm.items.tool.ItemLock; import com.hbm.main.MainRegistry; +import com.hbm.tileentity.machine.TileEntityLockableBase; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; import net.minecraft.world.World; + + public class BlockDecoContainer extends BlockDecoModel implements ITileEntityProvider { Class tile; - public BlockDecoContainer(Material mat, int types, Class tile) { - super(mat, types); + public BlockDecoContainer(Material mat, Class theEnum, boolean multiName, boolean multiTexture, Class tile) { + super(mat, theEnum, multiName, multiTexture); this.tile = tile; } + @Override + public int getRenderType() { + return -1; + } + @Override public TileEntity createNewTileEntity(World world, int metadata) { try { @@ -54,30 +57,22 @@ public class BlockDecoContainer extends BlockDecoModel implements ITileEntityPro if(world.isRemote) { return true; - } else if(!player.isSneaking()) { - - FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z); - return true; } else { - return true; + TileEntity entity = world.getTileEntity(x, y, z); + if(entity instanceof TileEntityLockableBase) { //annoying accommodations for the filing cabinet, but whatever, could potentially be useful + if(player.getHeldItem() != null && (player.getHeldItem().getItem() instanceof ItemLock || player.getHeldItem().getItem() == ModItems.key_kit)) + return false; + else if(!player.isSneaking() && ((TileEntityLockableBase) entity).canAccess(player)) { + FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z); + return true; + } + } else if(!player.isSneaking()) { + FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z); + return true; + } } - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) { - super.registerBlockIcons(iconRegister); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) { - return this.blockIcon; - } - - @Override - public int getRenderType() { - return -1; + + return false; } @Override diff --git a/src/main/java/com/hbm/blocks/generic/BlockDecoModel.java b/src/main/java/com/hbm/blocks/generic/BlockDecoModel.java index 78320789c..019d2dc2c 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockDecoModel.java +++ b/src/main/java/com/hbm/blocks/generic/BlockDecoModel.java @@ -2,6 +2,7 @@ package com.hbm.blocks.generic; import java.util.List; +import com.hbm.blocks.BlockEnumMulti; import com.hbm.lib.RefStrings; import cpw.mods.fml.client.registry.RenderingRegistry; @@ -20,56 +21,14 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockDecoModel extends Block { +public class BlockDecoModel extends BlockEnumMulti { - //Allows between 1-4 differently colored/textured sub-blocks altogether. - int subTypes; - - public BlockDecoModel(Material mat, int types) { - super(mat); - subTypes = types; - } - - @SideOnly(Side.CLIENT) - protected IIcon[] icons; - - @Override - public int damageDropped(int meta) { - return meta & 12; - } - - @Override - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs tabs, List list) { - for(byte i = 0; i < subTypes; i++) { - list.add(new ItemStack(item, 1, i << 2)); - } - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) { - super.registerBlockIcons(iconRegister); - icons = new IIcon[subTypes]; - - if(subTypes == 1) - return; - - for(byte i = 0; i < subTypes; i++) - icons[i] = iconRegister.registerIcon(this.textureName + "_" + i); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) { - if(subTypes > 1) - return this.icons[(meta >> 2) % this.icons.length]; - - return this.blockIcon; + public BlockDecoModel(Material mat, Class theEnum, boolean multiName, boolean multiTexture) { + super(mat, theEnum, multiName, multiTexture); } public static int renderID = RenderingRegistry.getNextAvailableRenderId(); - + @Override public int getRenderType() { return renderID; @@ -105,7 +64,12 @@ public class BlockDecoModel extends Block { meta = 3; //For East(b01>b11), just set to 3 } - world.setBlockMetadataWithNotify(x, y, z, meta | stack.getItemDamage(), 2); + world.setBlockMetadataWithNotify(x, y, z, (meta << 2) | stack.getItemDamage(), 2); + } + + @Override + public int damageDropped(int meta) { + return meta & 3; } //These are separate because they have to be constant @@ -129,7 +93,7 @@ public class BlockDecoModel extends Block { @Override public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { - switch(world.getBlockMetadata(x, y, z) & 3) { + switch(world.getBlockMetadata(x, y, z) >> 2) { case 0://North this.setBlockBounds(1 - mxX, mnY, 1 - mxZ, 1 - mnX, mxY, 1 - mnZ); break; @@ -150,5 +114,4 @@ public class BlockDecoModel extends Block { this.setBlockBoundsBasedOnState(world, x, y, z); return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ); } - } \ No newline at end of file diff --git a/src/main/java/com/hbm/inventory/gui/GUIBookLore.java b/src/main/java/com/hbm/inventory/gui/GUIBookLore.java index 329d470dc..85f3658f4 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIBookLore.java +++ b/src/main/java/com/hbm/inventory/gui/GUIBookLore.java @@ -23,7 +23,6 @@ import net.minecraft.world.World; // and I would answer, shut the fuck up nerd, the guide book system is too involved for my small // brain to use for god knows how many tidbits of lore. i'll settle for a text box and cool textures, thanks public class GUIBookLore extends GuiScreen { - //TODO: refactor some of these variables protected int xSize; protected int ySize; protected int guiLeft; @@ -252,7 +251,17 @@ public class GUIBookLore extends GuiScreen { int indent = renderer.getStringWidth(words[0]); for(int w = 1; w < words.length; w++) { + + if(words[w].equals("$")) { + if(w + 1 < words.length && !words[w + 1].equals("$")) { + lines.add(words[++w]); + indent = renderer.getStringWidth(words[w]); + } else + lines.add(""); + continue; + } + indent += renderer.getStringWidth(" " + words[w]); if(indent <= widthScaled) { diff --git a/src/main/java/com/hbm/items/special/ItemBookLore.java b/src/main/java/com/hbm/items/special/ItemBookLore.java index 5c40c867d..9dc5cc635 100644 --- a/src/main/java/com/hbm/items/special/ItemBookLore.java +++ b/src/main/java/com/hbm/items/special/ItemBookLore.java @@ -126,6 +126,11 @@ public class ItemBookLore extends Item implements IGUIProvider { public String resolveKey(String key, NBTTagCompound tag) { return I18nUtil.resolveKey(key, tag.getInteger("mku_slot")); }}, + RESIGNATION_NOTE(true, "resignation_note", 3, GUIAppearance.NOTEBOOK), + MEMO_STOCKS(false, "memo_stocks", 1, GUIAppearance.LOOSEPAPER), + MEMO_SCHRAB_GSA(false, "memo_schrab_gsa", 2, GUIAppearance.LOOSEPAPERS), + MEMO_SCHRAB_RD(false, "memo_schrab_rd", 4, GUIAppearance.LOOSEPAPERS), + MEMO_SCHRAB_NUKE(true, "memo_schrab_nuke", 3, GUIAppearance.LOOSEPAPERS), ; //Why? it's quite simple; i am too burnt out and also doing it the other way diff --git a/src/main/java/com/hbm/lib/HbmChestContents.java b/src/main/java/com/hbm/lib/HbmChestContents.java index 80b520b54..7bed23262 100644 --- a/src/main/java/com/hbm/lib/HbmChestContents.java +++ b/src/main/java/com/hbm/lib/HbmChestContents.java @@ -6,6 +6,7 @@ import com.hbm.blocks.ModBlocks; import com.hbm.inventory.fluid.Fluids; import com.hbm.items.ModItems; import com.hbm.items.machine.ItemBreedingRod.*; +import com.hbm.items.special.ItemBookLore.BookLoreType; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -368,67 +369,15 @@ public class HbmChestContents { new WeightedRandomChestContent(ModItems.ink, 0, 1, 1, 1), //make that mf rare; 1:555 weight }; - public static WeightedRandomChestContent[] bedroom1 = new WeightedRandomChestContent[] { //soda enjoyer who really needs to charge their radio - new WeightedRandomChestContent(ModItems.can_empty, 0, 1, 1, 2), - new WeightedRandomChestContent(ModItems.can_creature, 0, 1, 2, 2), - new WeightedRandomChestContent(ModItems.can_smart, 0, 1, 3, 2), - new WeightedRandomChestContent(ModItems.can_mrsugar, 0, 1, 2, 2), - new WeightedRandomChestContent(ModItems.med_ipecac, 0, 1, 1, 1), - new WeightedRandomChestContent(ModItems.radx, 0, 1, 1, 2), - new WeightedRandomChestContent(ModItems.dust_tiny, 0, 1, 3, 2), - new WeightedRandomChestContent(ModItems.dust, 0, 1, 1, 1), - new WeightedRandomChestContent(Items.paper, 0, 1, 12, 7), - new WeightedRandomChestContent(Items.book, 0, 1, 3, 5), - new WeightedRandomChestContent(ModItems.battery_su, 0, 1, 1, 3), - new WeightedRandomChestContent(ModItems.canteen_13, 0, 1, 1, 1), + /** ITEMBOOKLORE ARRAYS */ + //might make a wrapper class for this, if game-state knowledge using the nbt system becomes that relevant + public final static BookLoreType[] books_office_sch = new BookLoreType[] { + BookLoreType.RESIGNATION_NOTE, + BookLoreType.MEMO_STOCKS, + BookLoreType.MEMO_SCHRAB_GSA, + BookLoreType.MEMO_SCHRAB_RD, + BookLoreType.MEMO_SCHRAB_NUKE, }; - public static WeightedRandomChestContent[] bedroom2 = new WeightedRandomChestContent[] { //overworking nuka-cola enthusiast - new WeightedRandomChestContent(ModItems.twinkie, 0, 1, 3, 7), - new WeightedRandomChestContent(ModItems.coffee, 0, 1, 1, 5), - new WeightedRandomChestContent(ModItems.bottle_nuka, 0, 1, 1, 3), - new WeightedRandomChestContent(ModItems.bottle_quantum, 0, 1, 1, 4), - new WeightedRandomChestContent(ModItems.bottle_cherry, 0, 1, 1, 3), - new WeightedRandomChestContent(ModItems.bottle_opener, 0, 1, 1, 3), - new WeightedRandomChestContent(ModItems.radaway, 0, 1, 1, 2), - new WeightedRandomChestContent(ModItems.dust_tiny, 0, 1, 3, 2), - new WeightedRandomChestContent(ModItems.dust, 0, 1, 1, 1), - new WeightedRandomChestContent(ModItems.battery_su_l, 0, 1, 1, 1), - new WeightedRandomChestContent(Items.paper, 0, 1, 12, 10), - new WeightedRandomChestContent(Items.book, 0, 1, 3, 5), - new WeightedRandomChestContent(ModItems.canteen_13, 0, 1, 1, 1), - }; - - public static WeightedRandomChestContent[] bedroom3 = new WeightedRandomChestContent[] { //secretly alcoholic journaling fan who drinks straight from the canister - new WeightedRandomChestContent(Items.writable_book, 0, 1, 12, 10), - new WeightedRandomChestContent(Items.feather, 0, 1, 2, 5), - new WeightedRandomChestContent(new ItemStack(ModItems.canister_full, 1, Fluids.ETHANOL.getID()), 1, 2, 10), - new WeightedRandomChestContent(ModItems.scrumpy, 0, 1, 1, 1), - new WeightedRandomChestContent(ModItems.dust_tiny, 0, 1, 3, 3), - new WeightedRandomChestContent(ModItems.dust, 0, 1, 1, 2), - new WeightedRandomChestContent(Items.paper, 0, 1, 12, 10), - new WeightedRandomChestContent(Items.book, 0, 1, 3, 10), - new WeightedRandomChestContent(ModItems.canteen_13, 0, 1, 1, 2), - }; - - public static WeightedRandomChestContent[] bedroom4 = new WeightedRandomChestContent[] { //gun nut with a knack for self-made weapons - new WeightedRandomChestContent(ModItems.armor_polish, 0, 1, 1, 3), - new WeightedRandomChestContent(ModItems.gun_kit_1, 0, 1, 2, 2), - new WeightedRandomChestContent(ModItems.mechanism_revolver_1, 0, 1, 2, 2), - new WeightedRandomChestContent(ModItems.mechanism_revolver_2, 0, 1, 1, 2), - new WeightedRandomChestContent(ModItems.mechanism_rifle_1, 0, 1, 2, 1), - new WeightedRandomChestContent(ModItems.mechanism_rifle_2, 0, 1, 1, 1), - new WeightedRandomChestContent(ModItems.battery_su_l, 0, 1, 1, 1), - new WeightedRandomChestContent(ModItems.bolt_tungsten, 0, 1, 4, 1), - new WeightedRandomChestContent(ModItems.wire_aluminium, 0, 1, 5, 1), - new WeightedRandomChestContent(ModItems.steel_plate, 0, 1, 3, 1), - new WeightedRandomChestContent(ModItems.screwdriver, 0, 1, 1, 2), - new WeightedRandomChestContent(ModItems.wrench, 0, 1, 1, 2), - new WeightedRandomChestContent(ModItems.hand_drill, 0, 1, 1, 2), - new WeightedRandomChestContent(ModItems.clip_revolver_nopip, 0, 1, 1, 2), - new WeightedRandomChestContent(ModItems.ammo_20gauge, 0, 1, 8, 2), - new WeightedRandomChestContent(ModItems.gun_revolver_nopip, 0, 1, 1, 3), - new WeightedRandomChestContent(ModItems.canteen_13, 0, 1, 1, 1), - }; } diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index 30977623a..fad8be6de 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -3,6 +3,7 @@ package com.hbm.main; import java.util.ArrayList; import java.util.List; +import com.hbm.blocks.BlockEnums.DecoCabinetEnum; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.generic.BlockGenericStairs; import com.hbm.blocks.generic.BlockMultiSlab; @@ -975,7 +976,11 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModBlocks.brick_fire), new Object[] { "BB", "BB", 'B', ModItems.ingot_firebrick }); addShapelessAuto(new ItemStack(ModItems.ingot_firebrick, 4), new Object[] { ModBlocks.brick_fire }); - addRecipeAuto(new ItemStack(ModBlocks.filing_cabinet, 1, 4), new Object[] { " P ", "PIP", " P ", 'P', STEEL.plate(), 'I', ModItems.plate_polymer }); + addRecipeAuto(new ItemStack(ModBlocks.filing_cabinet, 1, DecoCabinetEnum.STEEL.ordinal()), new Object[] { " P ", "PIP", " P ", 'P', STEEL.plate(), 'I', ModItems.plate_polymer }); + + addRecipeAuto(new ItemStack(ModBlocks.vinyl_tile, 4), new Object[] { " I ", "IBI", " I ", 'I', ModItems.plate_polymer, 'B', ModBlocks.brick_light }); + addRecipeAuto(new ItemStack(ModBlocks.vinyl_tile, 4, 1), new Object[] { "BB", "BB", 'B', new ItemStack(ModBlocks.vinyl_tile, 1, 0) }); + addShapelessAuto(new ItemStack(ModBlocks.vinyl_tile), new Object[] { new ItemStack(ModBlocks.vinyl_tile, 1, 1) }); addShapelessAuto(new ItemStack(ModItems.upgrade_5g), new Object[] { ModItems.upgrade_template, ModItems.gem_alexandrite }); diff --git a/src/main/java/com/hbm/render/block/RenderBlockDecoModel.java b/src/main/java/com/hbm/render/block/RenderBlockDecoModel.java index 660cf8f13..171cba047 100644 --- a/src/main/java/com/hbm/render/block/RenderBlockDecoModel.java +++ b/src/main/java/com/hbm/render/block/RenderBlockDecoModel.java @@ -50,7 +50,7 @@ public class RenderBlockDecoModel implements ISimpleBlockRenderingHandler { Tessellator tessellator = Tessellator.instance; int meta = world.getBlockMetadata(x, y, z); - IIcon iicon = block.getIcon(0, meta & 12); + IIcon iicon = block.getIcon(0, meta & 3); tessellator.setColorOpaque_F(1, 1, 1); if(renderer.hasOverrideBlockTexture()) { @@ -62,7 +62,7 @@ public class RenderBlockDecoModel implements ISimpleBlockRenderingHandler { float rotation = 0; - switch(meta & 3) { + switch(meta >> 2) { default: //North rotation = (float) Math.PI; break; case 1: //South diff --git a/src/main/java/com/hbm/render/tileentity/RenderFileCabinet.java b/src/main/java/com/hbm/render/tileentity/RenderFileCabinet.java index bbe0119b6..4793c46fb 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderFileCabinet.java +++ b/src/main/java/com/hbm/render/tileentity/RenderFileCabinet.java @@ -23,7 +23,7 @@ public class RenderFileCabinet extends TileEntitySpecialRenderer implements IIte GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); - switch(tile.getBlockMetadata() & 3) { //rotation + switch(tile.getBlockMetadata() >> 2) { //rotation case 0: GL11.glRotatef(180, 0F, 1F, 0F); break; @@ -38,8 +38,8 @@ public class RenderFileCabinet extends TileEntitySpecialRenderer implements IIte break; } - switch(tile.getBlockMetadata() >> 2) { - case 0: + switch(tile.getBlockMetadata() & 3) { + default: bindTexture(ResourceManager.file_cabinet_tex); break; case 1: bindTexture(ResourceManager.file_cabinet_steel_tex); //sadge @@ -81,8 +81,8 @@ public class RenderFileCabinet extends TileEntitySpecialRenderer implements IIte GL11.glTranslated(0, -1.25D, 0); GL11.glScaled(2.75D, 2.75D, 2.75D); - switch(stack.getItemDamage() >> 2) { - case 0: + switch(stack.getItemDamage()) { + default: bindTexture(ResourceManager.file_cabinet_tex); break; case 1: bindTexture(ResourceManager.file_cabinet_steel_tex); diff --git a/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java b/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java index f578cb70c..cba55afdf 100644 --- a/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java @@ -139,7 +139,7 @@ public class MapGenNTMFeatures extends MapGenStructure { NTMWorkshop1 workshop1 = new NTMWorkshop1(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8); this.components.add(workshop1); } else { //Everything else - switch(rand.nextInt(3)) { + switch(rand.nextInt(4)) { case 0: NTMLab2 lab2 = new NTMLab2(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8); this.components.add(lab2); break; diff --git a/src/main/java/com/hbm/world/worldgen/components/CivilianFeatures.java b/src/main/java/com/hbm/world/worldgen/components/CivilianFeatures.java index bbd9bab87..05b02c604 100644 --- a/src/main/java/com/hbm/world/worldgen/components/CivilianFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/components/CivilianFeatures.java @@ -568,6 +568,7 @@ public class CivilianFeatures { this.fillWithBlocks(world, box, sizeX - 4, 3, sizeZ - 2, sizeX - 2, 3, sizeZ - 2, ModBlocks.steel_roof, Blocks.air, false); if(!hasPlacedLoot[1]) { this.hasPlacedLoot[1] = this.generateInvContents(world, box, rand, ModBlocks.crate_iron, sizeX - 2, 1, 3, HbmChestContents.nukeTrash, 9); + generateLoreBook(world, box, rand, sizeX - 2, 1, 3, 1, HbmChestContents.books_office_sch); } return true; diff --git a/src/main/java/com/hbm/world/worldgen/components/Component.java b/src/main/java/com/hbm/world/worldgen/components/Component.java index 88b8dd3bf..fb9c13813 100644 --- a/src/main/java/com/hbm/world/worldgen/components/Component.java +++ b/src/main/java/com/hbm/world/worldgen/components/Component.java @@ -8,6 +8,8 @@ import com.hbm.blocks.generic.BlockBobble.BobbleType; import com.hbm.blocks.generic.BlockBobble.TileEntityBobble; import com.hbm.config.StructureConfig; import com.hbm.handler.MultiblockHandlerXR; +import com.hbm.items.ModItems; +import com.hbm.items.special.ItemBookLore.BookLoreType; import com.hbm.lib.HbmChestContents; import com.hbm.tileentity.machine.TileEntityLockableBase; import com.hbm.tileentity.machine.storage.TileEntityCrateIron; @@ -194,7 +196,7 @@ abstract public class Component extends StructureComponent { break; } - return metadata; + return metadata << 2; //To accommodate for BlockDecoModel's shift in the rotation bits; otherwise, simply bit-shift right and or any non-rotation meta after } /** @@ -369,7 +371,7 @@ abstract public class Component extends StructureComponent { return false; } - protected void generateLoreBook(World world, StructureBoundingBox box, int featureX, int featureY, int featureZ, int slot, String key) { + protected void generateLoreBook(World world, StructureBoundingBox box, Random rand, int featureX, int featureY, int featureZ, int slot, BookLoreType[] books) { int posX = this.getXWithOffset(featureX, featureZ); int posY = this.getYWithOffset(featureY); int posZ = this.getZWithOffset(featureX, featureZ); @@ -377,9 +379,11 @@ abstract public class Component extends StructureComponent { IInventory inventory = (IInventory) world.getTileEntity(posX, posY, posZ); if(inventory != null) { - //ItemStack book = HbmChestContents.genetateBook(key); - //TODO: replace this with ItemBookLore version - //inventory.setInventorySlotContents(slot, book); + ItemStack book = new ItemStack(ModItems.book_lore); + int i = rand.nextInt(books.length); + + BookLoreType.setTypeForStack(book, books[i]); + inventory.setInventorySlotContents(slot, book); } } diff --git a/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java b/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java index ee632225a..25bba3f1b 100644 --- a/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java @@ -208,13 +208,12 @@ public class OfficeFeatures { //Woot if(!this.hasPlacedLoot[0]) - this.hasPlacedLoot[0] = generateInvContents(world, box, rand, Blocks.chest, sizeX - 4, 1, sizeZ - 1, HbmChestContents.officeTrash, 10); + this.hasPlacedLoot[0] = generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), sizeX - 4, 1, sizeZ - 1, HbmChestContents.officeTrash, 8); if(!this.hasPlacedLoot[1]) { - this.hasPlacedLoot[1] = generateLockableContents(world, box, rand, ModBlocks.safe, 6, 1, 1, HbmChestContents.machineParts, 10, 0.5D); - generateLoreBook(world, box, 6, 1, 1, 7, "office" + rand.nextInt(1)); + this.hasPlacedLoot[1] = generateLockableContents(world, box, rand, ModBlocks.safe, getDecoMeta(3), 6, 1, 1, HbmChestContents.machineParts, 10, 0.5D); + generateLoreBook(world, box, rand, 6, 1, 1, 7, HbmChestContents.books_office_sch); } - //TODO: add book with funny lore to safe, add cobwebs too //0b00/0 West, 0b01/1 East, 0b10/2 North, 0b11/3 South, 0b100/4 West UD, 0b101 East UD, 0b110 North UD, 0b111 South UD return true; } @@ -527,7 +526,6 @@ public class OfficeFeatures { placeBlockAtCurrentPosition(world, Blocks.flower_pot, 0, 5, 13, 9, box); placeBlockAtCurrentPosition(world, Blocks.flower_pot, 0, 7, 13, 11, box); - //almost certainly a fucking astronomically better way to do this generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(3), 9, 1, 7, HbmChestContents.filingCabinet, 4); generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(1), 7, 5, 4, HbmChestContents.filingCabinet, 4); generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(1), 7, 6, 4, HbmChestContents.filingCabinet, 4); @@ -535,14 +533,19 @@ public class OfficeFeatures { generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 10, 5, 12, HbmChestContents.filingCabinet, 4); generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 10, 6, 12, HbmChestContents.filingCabinet, 4); generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 2, 9, 5, HbmChestContents.filingCabinet, 4); + generateLockableContents(world, box, rand, ModBlocks.safe, getDecoMeta(2), 1, 9, 13, HbmChestContents.officeTrash, 10, 1.0D); + generateLoreBook(world, box, rand, 1, 9, 13, 7, HbmChestContents.books_office_sch); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 2, 9, 13, HbmChestContents.filingCabinet, 4); generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 3, 9, 13, HbmChestContents.filingCabinet, 4); generateLockableContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 3, 10, 13, HbmChestContents.expensive, 8, 0.1D); placeBlockAtCurrentPosition(world, ModBlocks.deco_loot, 0, 6, 13, 11, box); LootGenerator.lootCapStash(world, this.getXWithOffset(6, 11), this.getYWithOffset(13), this.getZWithOffset(6, 11)); - + placeBlockAtCurrentPosition(world, ModBlocks.deco_loot, 0, 1, 10, 11, box); + LootGenerator.lootMedicine(world, this.getXWithOffset(1, 11), this.getYWithOffset(10), this.getZWithOffset(1, 11)); + //this hurt my soul return true; diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index adcadbee4..bc78aee2b 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -355,6 +355,31 @@ book_lore.book_syringe.author=Dave book_lore.book_syringe.page.1=a little addendum to my fifth message, obviously you have to store this MKU stuff in a container. the R&D nuts used regular metal syringes that they got from medical. surplus ware i presume, they got thousands of needles just lying around. the metal book_lore.book_syringe.page.2=syringe goes into slot %d +book_lore.resignation_note.name=Letter of Resignation +book_lore.resignation_note.author=Kosma +book_lore.resignation_note.page.1=Management downsized our department again yesterday. Those idiots only have themselves to blame, I don't know what they were expecting after that fiasco. Who the hell leaks that sort of information? We're losing millions and +book_lore.resignation_note.page.2=it's ME who's the one out of a job now. I'M the one being asked to resign. I hope you asshats finally learn from your overabundance of mistakes and take that stick out of your ass. +book_lore.resignation_note.page.3=I'm not coming back on Friday. Just send the paycheck. + +book_lore.memo_stocks.name=Intracorporate Memorandum +book_lore.memo_stocks.page.1=Investor Relations - $ $ There's been some glaring discrepancies in the figures provided for the latest quarterly report. It would be prudent for the financial department to make some adjustments, so there won't be any concern. + +book_lore.memo_schrab_gsa.name=Internal Memorandum +book_lore.memo_schrab_gsa.page.1=Contract Management - $ $ Legal has made a breakthrough with the DLA. They've awarded us with a 45 BILLION GSA Schedule for further procurement and research of saralloy. At current estimates, that would be at minimum +book_lore.memo_schrab_gsa.page.2=a 40%% profit on related operations, let alone the possibility of future contracts. Due to the confidential nature, all fiscal evidence is to remain private. + +book_lore.memo_schrab_rd.name=Internal Memorandum +book_lore.memo_schrab_rd.page.1=Research & Development - $ $ Our main production method of saralloy has been through the new particle accelerator. However, the energy costs are exorbitantly high compared to the amount of output. +book_lore.memo_schrab_rd.page.2=Doctor Schrabauer, however, has discovered a new interaction - called "Strange Lepton Oscillation" - that could significantly reduce costs. Through a not entirely understood process, supplied electrons are transmuted into extremely +book_lore.memo_schrab_rd.page.3=high-energy photons, through a strange charm. This is an extreme exception to many established particle conversion laws, but preliminary experiments have proved that these protons transmute into up and down quarks, eventually creating saralloy. +book_lore.memo_schrab_rd.page.4=Strangely, the prototype requires Tungsten alloyed with small amounts of saralloy. In addition, a special capacitor is required to negate the leftover positive charge. + +book_lore.memo_schrab_nuke.name=Research Report +book_lore.memo_schrab_nuke.author=Doctor Schrabauer +book_lore.memo_schrab_nuke.page.1=Our most recent investigation led us to the effects of nuclear explosions on materials. Thanks to our grant money, we *accidentally* tested our theory on direct saralloy synthesis from uranium. +book_lore.memo_schrab_nuke.page.2=Only our cyclotron has actually created saralloy previously. However, at our underground shot at Everwerpen, miniscule traces of saralloy were found in uranium ore at the site. All pure, metallic uranium nearby had fissioned. +book_lore.memo_schrab_nuke.page.3=As such, given enough uranium ore concentrated around an explosive, or perhaps even a dirty bomb rich in waste containing fissionable material, one could hypothetically create enough saralloy to collect manually. + cannery.f1=[ Press F1 for help ] cannery.centrifuge=Gas Centrifuge @@ -3885,7 +3910,7 @@ tile.crystal_virus.name=Dark Crystal tile.deco_aluminium.name=Aluminium Deco Block tile.deco_asbestos.name=Asbestos Roof tile.deco_beryllium.name=Beryllium Deco Block -tile.deco_computer.name=IBM Personal Computer 300PL +tile.deco_computer.ibm_300pl.name=IBM Personal Computer 300PL tile.deco_emitter.name=Deco Light Emitter tile.deco_lead.name=Lead Deco Block tile.deco_rbmk.name=RBMK Deco Block @@ -3956,7 +3981,8 @@ tile.factory_titanium_hull.name=Factory Block tile.fallout.name=Fallout tile.fence_metal.name=Chainlink Fence tile.field_disturber.name=High Energy Field Jammer -tile.filing_cabinet.name=Filing Cabinet +tile.filing_cabinet.green.name=Dusty Filing Cabinet +tile.filing_cabinet.steel.name=Steel Filing Cabinet tile.fire_digamma.name=Lingering Digamma tile.fire_door.name=Fire Door tile.fireworks.name=Firework Battery