diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index 4e768e7ed..ec06e13b4 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -2,6 +2,7 @@ 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.bomb.*; import com.hbm.blocks.fluid.*; import com.hbm.blocks.gas.*; @@ -2399,6 +2400,9 @@ public class ModBlocks { //End Ores GameRegistry.registerBlock(ore_tikite, ore_tikite.getUnlocalizedName()); + //It's a meme you dip + GameRegistry.registerBlock(ore_random, ItemRandomOreBlock.class, ore_random.getUnlocalizedName()); + //Crystals GameRegistry.registerBlock(crystal_power, crystal_power.getUnlocalizedName()); GameRegistry.registerBlock(crystal_energy, crystal_energy.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/blocks/generic/BlockMotherOfAllOres.java b/src/main/java/com/hbm/blocks/generic/BlockMotherOfAllOres.java index 6a093fe80..0efa14a13 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockMotherOfAllOres.java +++ b/src/main/java/com/hbm/blocks/generic/BlockMotherOfAllOres.java @@ -1,28 +1,59 @@ package com.hbm.blocks.generic; +import java.awt.Color; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Random; + +import com.google.common.collect.HashBiMap; import com.hbm.blocks.IBlockMultiPass; +import com.hbm.blocks.ModBlocks; import com.hbm.inventory.RecipesCommon.ComparableStack; +import com.hbm.items.ModItems; import com.hbm.lib.RefStrings; import com.hbm.render.block.RenderBlockMultipass; +import com.hbm.util.ColorUtil; +import com.hbm.util.I18nUtil; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +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.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.oredict.OreDictionary; public class BlockMotherOfAllOres extends BlockContainer implements IBlockMultiPass { + + public static int override = -1; + + public static void shuffleOverride(Random rand) { + override = rand.nextInt(uniqueItems.size()); + } + + public static void resetOverride() { + override = -1; + } public BlockMotherOfAllOres() { super(Material.rock); - this.blockIcon = Blocks.stone.getIcon(0, 0); + this.setBlockTextureName("stone"); } @Override @@ -30,16 +61,54 @@ public class BlockMotherOfAllOres extends BlockContainer implements IBlockMultiP return new TileEntityRandomOre(); } + @Override + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item item, CreativeTabs tab, List list) { + + for(int i = 0; i < uniqueItems.size(); i++) + list.add(new ItemStack(item, 1, i)); + } + @Override public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityRandomOre) { - return ((TileEntityRandomOre) te).getStack().copy(); + TileEntityRandomOre ore = (TileEntityRandomOre) te; + return new ItemStack(this, 1, ore.getStackId()); } - return super.getPickBlock(target, world, x, y, z); + return new ItemStack(ModItems.nothing); + } + + @Override + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { + ArrayList ret = new ArrayList(); + + if(fortune == 0xFECE00) { + TileEntity te = world.getTileEntity(x, y, z); + + if(te instanceof TileEntityRandomOre) { + TileEntityRandomOre ore = (TileEntityRandomOre) te; + ComparableStack item = ore.getCompStack(); + ret.add(item.toStack()); + } + } + + return ret; + } + + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + this.dropBlockAsItemWithChance(world, x, y, z, meta, 1, 0xFECE00); + } + + @Override + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) { + ((TileEntityRandomOre)world.getTileEntity(x, y, z)).setItem(stack.getItemDamage()); + world.markBlockForUpdate(x, y, z); } @Override @@ -57,6 +126,8 @@ public class BlockMotherOfAllOres extends BlockContainer implements IBlockMultiP @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister reg) { + + this.blockIcon = reg.registerIcon("stone"); for(int i = 0; i < overlays.length; i++) { overlays[i] = reg.registerIcon(RefStrings.MODID + ":ore_random_" + (i + 1)); } @@ -67,22 +138,27 @@ public class BlockMotherOfAllOres extends BlockContainer implements IBlockMultiP public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { if(RenderBlockMultipass.currentPass == 0) - return this.blockIcon; + return Blocks.stone.getIcon(0, 0); TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityRandomOre) { TileEntityRandomOre ore = (TileEntityRandomOre) te; - ItemStack item = ore.getStack(); - - if(item != null) { - ComparableStack stack = new ComparableStack(item); - int index = stack.hashCode() % overlays.length; - return overlays[index]; - } + int index = ore.getStackId() % overlays.length; + return overlays[index]; } + + return Blocks.stone.getIcon(0, 0); + } + + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + + if(RenderBlockMultipass.currentPass == 0) + return Blocks.stone.getIcon(0, 0); - return this.getIcon(side, world.getBlockMetadata(x, y, z)); + int index = meta % overlays.length; + return overlays[index]; } @Override @@ -91,19 +167,149 @@ public class BlockMotherOfAllOres extends BlockContainer implements IBlockMultiP if(RenderBlockMultipass.currentPass == 0) return 0xffffff; + + TileEntity te = world.getTileEntity(x, y, z); + + if(te instanceof TileEntityRandomOre) { + TileEntityRandomOre ore = (TileEntityRandomOre) te; + ItemStack stack = ore.getStack(); + int color = ColorUtil.getAverageColorFromStack(stack); + color = ColorUtil.amplifyColor(color); + + Color col = new Color(color); + int r = col.getRed(); + int g = col.getGreen(); + int b = col.getBlue(); + + float[] hsb = new Color(color).RGBtoHSB(r, g, b, new float[3]); + + if(hsb[1] > 0F && hsb[1] < 0.75F) + hsb[1] = 0.75F; + + color = Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]); + + return color; + } return super.colorMultiplier(world, x, y, z); } public static class TileEntityRandomOre extends TileEntity { + private ComparableStack stack; + + public TileEntityRandomOre() { + if(override != -1) { + setItem(override); + } + } + + public void setItem(int id) { + ComparableStack comp = itemMap.get(id); + this.stack = comp != null ? ((ComparableStack) comp.copy()) : null; + + if(this.worldObj != null) + this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this); + } + + public int getStackId() { + return itemMap.inverse().get(getCompStack()); + } + public ItemStack getStack() { - return new ItemStack(Blocks.dirt); + return getCompStack().toStack(); + } + + public ComparableStack getCompStack() { + + if(stack == null) { + int rand = worldObj.rand.nextInt(uniqueItems.size()); + stack = (ComparableStack) itemMap.get(rand).copy(); + this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this); + } + + return stack != null ? stack : new ComparableStack(ModItems.nothing); } @Override public boolean canUpdate() { return false; } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + int key = nbt.getInteger("item"); + this.setItem(key); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + try { + Integer key = itemMap.inverse().get(getCompStack()); + nbt.setInteger("item", key != null ? key : 0); + } catch(Exception ex) { } + } + + @Override + public Packet getDescriptionPacket() { + NBTTagCompound nbt = new NBTTagCompound(); + this.writeToNBT(nbt); + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt); + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + this.readFromNBT(pkt.func_148857_g()); + } + } + + public static class ItemRandomOreBlock extends ItemBlock { + + public ItemRandomOreBlock(Block block) { + super(block); + this.setHasSubtypes(true); + this.setMaxDamage(0); + } + + @Override + public String getItemStackDisplayName(ItemStack stack) { + ComparableStack comp = itemMap.get(stack.getItemDamage()); + ItemStack name = comp != null ? comp.toStack() : new ItemStack(ModItems.nothing); + if(name.getItemDamage() == OreDictionary.WILDCARD_VALUE) { + name.setItemDamage(0); + } + return I18nUtil.resolveKey(this.getUnlocalizedName() + ".name", name.getItem().getItemStackDisplayName(name)); + } + } + + public static HashSet uniqueItems = new HashSet(); + public static HashBiMap itemMap = HashBiMap.create(); + + public static void init() { + + for(Object b : Block.blockRegistry.getKeys()) { + Block block = Block.getBlockFromName((String) b); + if(block != null && Item.getItemFromBlock(block) != null) + uniqueItems.add(new ComparableStack(block)); + } + + for(Object i : Item.itemRegistry.getKeys()) { + Item item = (Item) Item.itemRegistry.getObject((String) i); + uniqueItems.add(new ComparableStack(item)); + } + + for(String i : OreDictionary.getOreNames()) { + for(ItemStack stack : OreDictionary.getOres(i)) { + uniqueItems.add(new ComparableStack(stack)); + } + } + + int i = 0; + for(ComparableStack stack : uniqueItems) { + itemMap.put(i++, stack); + } } } diff --git a/src/main/java/com/hbm/config/WorldConfig.java b/src/main/java/com/hbm/config/WorldConfig.java index 6d5d55fdb..a6c5b2c50 100644 --- a/src/main/java/com/hbm/config/WorldConfig.java +++ b/src/main/java/com/hbm/config/WorldConfig.java @@ -47,6 +47,8 @@ public class WorldConfig { public static int endTikiteSpawn = 8; + public static int randomSpawn = 16; + public static int radioStructure = 500; public static int antennaStructure = 250; public static int atomStructure = 500; @@ -124,6 +126,8 @@ public class WorldConfig { endTikiteSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.E00_tikiteSpawnrate", "Amount of end trixite per chunk", 8); + randomSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.R00_randomOreSpawnrate", "Amount of random ore per chunk", 16); + final String CATEGORY_DUNGEON = "04_dungeons"; radioStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.00_radioSpawn", "Spawn radio station on every nTH chunk", 500); antennaStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.01_antennaSpawn", "Spawn antenna on every nTH chunk", 250); diff --git a/src/main/java/com/hbm/items/tool/ItemWandD.java b/src/main/java/com/hbm/items/tool/ItemWandD.java index dd61128ba..3faa74be1 100644 --- a/src/main/java/com/hbm/items/tool/ItemWandD.java +++ b/src/main/java/com/hbm/items/tool/ItemWandD.java @@ -9,9 +9,11 @@ import com.hbm.lib.Library; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; @@ -27,10 +29,17 @@ public class ItemWandD extends Item { if(pos != null) { - EntitySiegeTunneler tunneler = new EntitySiegeTunneler(world); + List zombies = world.getEntitiesWithinAABB(EntityZombie.class, AxisAlignedBB.getBoundingBox(pos.blockX - 2, pos.blockY - 2, pos.blockZ - 2, pos.blockX + 2, pos.blockY + 2, pos.blockZ + 2)); + + for(EntityZombie zombie : zombies) { + zombie.setChild(true); + zombie.setCurrentItemOrArmor(4, new ItemStack(ModItems.gas_mask_m65)); + } + + /*EntitySiegeTunneler tunneler = new EntitySiegeTunneler(world); tunneler.setPosition(pos.blockX, pos.blockY + 1, pos.blockZ); tunneler.onSpawnWithEgg(null); - world.spawnEntityInWorld(tunneler); + world.spawnEntityInWorld(tunneler);*/ //CellularDungeonFactory.meteor.generate(world, x, y, z, world.rand); diff --git a/src/main/java/com/hbm/lib/HbmWorldGen.java b/src/main/java/com/hbm/lib/HbmWorldGen.java index a5442ede4..691f6c114 100644 --- a/src/main/java/com/hbm/lib/HbmWorldGen.java +++ b/src/main/java/com/hbm/lib/HbmWorldGen.java @@ -3,6 +3,7 @@ package com.hbm.lib; import java.util.Random; import com.hbm.blocks.ModBlocks; +import com.hbm.blocks.generic.BlockMotherOfAllOres; import com.hbm.config.GeneralConfig; import com.hbm.config.WorldConfig; import com.hbm.items.ModItems; @@ -116,6 +117,12 @@ public class HbmWorldGen implements IWorldGenerator { DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.titaniumClusterSpawn, 6, 15, 30, ModBlocks.cluster_titanium); DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.aluminiumClusterSpawn, 6, 15, 35, ModBlocks.cluster_aluminium); DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.copperClusterSpawn, 6, 15, 20, ModBlocks.cluster_copper); + + for(int k = 0; k < WorldConfig.randomSpawn; k++) { + BlockMotherOfAllOres.shuffleOverride(rand); + DungeonToolbox.generateOre(world, rand, i, j, 1, 10, 4, 30, ModBlocks.ore_random); + } + BlockMotherOfAllOres.resetOverride(); if(GeneralConfig.enable528ColtanSpawn) { DungeonToolbox.generateOre(world, rand, i, j, GeneralConfig.coltanRate, 4, 15, 40, ModBlocks.ore_coltan); diff --git a/src/main/java/com/hbm/lib/Library.java b/src/main/java/com/hbm/lib/Library.java index 483b0368b..6d93c8f8b 100644 --- a/src/main/java/com/hbm/lib/Library.java +++ b/src/main/java/com/hbm/lib/Library.java @@ -74,6 +74,8 @@ public class Library { public static String SolsticeUnlimitd = "f5574fd2-ec28-4927-9d11-3c0c731771f4"; public static String FrizzleFrazzle = "fc4cc2ee-12e8-4097-b26a-1c6cb1b96531"; public static String the_NCR = "28ae585f-4431-4491-9ce8-3def6126e3c6"; + public static String Barnaby99_x = "711aaf78-a862-4b7e-921a-216349716e9a"; + public static String Ma118 = "1121cb7a-8773-491f-8e2b-221290c93d81"; public static Set contributors = Sets.newHashSet(new String[] { "06ab7c03-55ce-43f8-9d3c-2850e3c652de", //mustang_rudolf diff --git a/src/main/java/com/hbm/lib/RefStrings.java b/src/main/java/com/hbm/lib/RefStrings.java index 9235430d4..26cba2c9b 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 (4186)"; + public static final String VERSION = "1.0.27 BETA (4191)"; //HBM's Beta Naming Convention: //V T (X) //V -> next release version diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index b24f96d5c..ce28cc008 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -678,7 +678,7 @@ public class ClientProxy extends ServerProxy { RenderingRegistry.registerBlockHandler(new RenderBattery()); RenderingRegistry.registerBlockHandler(new RenderAnvil()); RenderingRegistry.registerBlockHandler(new RenderCrystal()); - RenderingRegistry.registerBlockHandler(new RenderTestCable()); + RenderingRegistry.registerBlockHandler(new RenderCable()); RenderingRegistry.registerBlockHandler(new RenderCableClassic()); RenderingRegistry.registerBlockHandler(new RenderTestPipe()); RenderingRegistry.registerBlockHandler(new RenderBlockCT()); diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index ab51cbad6..118a58068 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -242,7 +242,9 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModBlocks.cable_detector, 1), new Object[] { "S", "W", 'S', REDSTONE.dust(), 'W', ModBlocks.red_wire_coated }); addRecipeAuto(new ItemStack(ModBlocks.cable_diode, 1), new Object[] { " Q ", "CAC", " Q ", 'Q', NETHERQUARTZ.gem(), 'C', ModBlocks.red_cable, 'A', AL.ingot() }); addRecipeAuto(new ItemStack(ModBlocks.machine_detector, 1), new Object[] { "IRI", "CTC", "IRI", 'I', ModItems.plate_polymer, 'R', REDSTONE.dust(), 'C', ModItems.wire_red_copper, 'T', ModItems.coil_tungsten }); - addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.red_cable), 16), new Object[] { " W ", "RRR", " W ", 'W', ModItems.plate_polymer, 'R', ModItems.wire_red_copper }); + addRecipeAuto(new ItemStack(ModBlocks.red_cable, 16), new Object[] { " W ", "RRR", " W ", 'W', ModItems.plate_polymer, 'R', ModItems.wire_red_copper }); + addShapelessAuto(new ItemStack(ModBlocks.red_cable_classic, 1), new Object[] { ModBlocks.red_cable }); + addShapelessAuto(new ItemStack(ModBlocks.red_cable, 1), new Object[] { ModBlocks.red_cable_classic }); addRecipeAuto(new ItemStack(ModBlocks.red_connector, 4), new Object[] { "C", "I", "S", 'C', ModItems.coil_copper, 'I', ModItems.plate_polymer, 'S', STEEL.ingot() }); addRecipeAuto(new ItemStack(ModBlocks.red_pylon, 4), new Object[] { "CWC", "PWP", " T ", 'C', ModItems.coil_copper, 'W', KEY_PLANKS, 'P', ModItems.plate_polymer, 'T', ModBlocks.red_wire_coated }); addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.oil_duct_solid), 16), new Object[] { "SPS", "P P", "SPS", 'S', STEEL.ingot(), 'P', IRON.plate() }); diff --git a/src/main/java/com/hbm/main/MainRegistry.java b/src/main/java/com/hbm/main/MainRegistry.java index 0297c2d0a..90313f632 100644 --- a/src/main/java/com/hbm/main/MainRegistry.java +++ b/src/main/java/com/hbm/main/MainRegistry.java @@ -38,6 +38,7 @@ import org.apache.logging.log4j.Logger; import com.google.common.collect.ImmutableList; import com.hbm.blocks.ModBlocks; +import com.hbm.blocks.generic.BlockMotherOfAllOres; import com.hbm.config.*; import com.hbm.creativetabs.*; import com.hbm.entity.effect.*; @@ -972,6 +973,8 @@ public class MainRegistry { proxy.registerMissileItems(); + BlockMotherOfAllOres.init(); + //expand for the largest entity we have (currently Quackos who is 17.5m in diameter, that's one fat duck) World.MAX_ENTITY_RADIUS = Math.max(World.MAX_ENTITY_RADIUS, 8.75); diff --git a/src/main/java/com/hbm/main/NEIConfig.java b/src/main/java/com/hbm/main/NEIConfig.java index 1d57eeb24..0b79f4212 100644 --- a/src/main/java/com/hbm/main/NEIConfig.java +++ b/src/main/java/com/hbm/main/NEIConfig.java @@ -1,6 +1,9 @@ package com.hbm.main; +import java.util.List; + import com.hbm.blocks.ModBlocks; +import com.hbm.blocks.generic.BlockMotherOfAllOres.TileEntityRandomOre; import com.hbm.config.VersatileConfig; import com.hbm.handler.nei.*; import com.hbm.items.ModItems; @@ -9,7 +12,14 @@ import com.hbm.lib.RefStrings; import codechicken.nei.api.API; import codechicken.nei.api.IConfigureNEI; +import codechicken.nei.api.IHighlightHandler; +import codechicken.nei.api.ItemInfo.Layout; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; public class NEIConfig implements IConfigureNEI { @@ -139,6 +149,31 @@ public class NEIConfig implements IConfigureNEI { API.hideItem(new ItemStack(ModBlocks.pink_slab)); API.hideItem(new ItemStack(ModBlocks.pink_double_slab)); API.hideItem(new ItemStack(ModBlocks.pink_stairs)); + + API.registerHighlightIdentifier(ModBlocks.ore_random, new IHighlightHandler() { + + @Override + public ItemStack identifyHighlight(World world, EntityPlayer player, MovingObjectPosition mop) { + int x = mop.blockX; + int y = mop.blockY; + int z = mop.blockZ; + + TileEntity te = world.getTileEntity(x, y, z); + + if(te instanceof TileEntityRandomOre) { + TileEntityRandomOre ore = (TileEntityRandomOre) te; + return new ItemStack(ModBlocks.ore_random, 1, ore.getStackId()); + } + + return null; + } + + @Override + public List handleTextData(ItemStack itemStack, World world, EntityPlayer player, MovingObjectPosition mop, List currenttip, Layout layout) { + return currenttip; + } + + }); } @Override diff --git a/src/main/java/com/hbm/render/block/RenderBlockMultipass.java b/src/main/java/com/hbm/render/block/RenderBlockMultipass.java index 9a3e26d03..9932ae2a1 100644 --- a/src/main/java/com/hbm/render/block/RenderBlockMultipass.java +++ b/src/main/java/com/hbm/render/block/RenderBlockMultipass.java @@ -1,13 +1,21 @@ package com.hbm.render.block; +import java.awt.Color; + import org.lwjgl.opengl.GL11; import com.hbm.blocks.IBlockMultiPass; +import com.hbm.blocks.ModBlocks; +import com.hbm.blocks.generic.BlockMotherOfAllOres; +import com.hbm.inventory.RecipesCommon.ComparableStack; +import com.hbm.items.ModItems; +import com.hbm.util.ColorUtil; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; public class RenderBlockMultipass implements ISimpleBlockRenderingHandler { @@ -59,6 +67,60 @@ public class RenderBlockMultipass implements ISimpleBlockRenderingHandler { renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, metadata)); tessellator.draw(); + /** terrible hack to make this shit work */ + if(block == ModBlocks.ore_random) { + + this.currentPass = 1; + renderer.setOverrideBlockTexture(block.getIcon(0, metadata)); + this.currentPass = 0; + ComparableStack stack = BlockMotherOfAllOres.itemMap.get(metadata); + int color = ColorUtil.getAverageColorFromStack(stack != null ? stack.toStack() : new ItemStack(ModItems.nothing)); + color = ColorUtil.amplifyColor(color); + + Color col = new Color(color); + int r = col.getRed(); + int g = col.getGreen(); + int b = col.getBlue(); + + float[] hsb = new Color(color).RGBtoHSB(r, g, b, new float[3]); + + if(hsb[1] > 0F && hsb[1] < 0.75F) + hsb[1] = 0.75F; + + color = Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]); + col = new Color(color); + + GL11.glColor3f(col.getRed() / 255F, col.getGreen() / 255F, col.getBlue() / 255F); + + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, -1.0F, 0.0F); + renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, metadata)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 1.0F, 0.0F); + renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, metadata)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 0.0F, -1.0F); + renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, metadata)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 0.0F, 1.0F); + renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, metadata)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(-1.0F, 0.0F, 0.0F); + renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, metadata)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(1.0F, 0.0F, 0.0F); + renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, metadata)); + tessellator.draw(); + + renderer.clearOverrideBlockTexture(); + GL11.glColor3f(1F, 1F, 1F); + } + GL11.glTranslatef(0.5F, 0.5F, 0.5F); } diff --git a/src/main/java/com/hbm/render/block/RenderTestCable.java b/src/main/java/com/hbm/render/block/RenderCable.java similarity index 94% rename from src/main/java/com/hbm/render/block/RenderTestCable.java rename to src/main/java/com/hbm/render/block/RenderCable.java index ad4f013ec..5b3b823c9 100644 --- a/src/main/java/com/hbm/render/block/RenderTestCable.java +++ b/src/main/java/com/hbm/render/block/RenderCable.java @@ -7,19 +7,15 @@ import com.hbm.lib.Library; import com.hbm.main.ResourceManager; import com.hbm.render.util.ObjUtil; -import api.hbm.energy.IEnergyConnector; -import api.hbm.energy.IEnergyConnectorBlock; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraftforge.client.model.obj.WavefrontObject; -import net.minecraftforge.common.util.ForgeDirection; -public class RenderTestCable implements ISimpleBlockRenderingHandler { +public class RenderCable implements ISimpleBlockRenderingHandler { @Override public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { diff --git a/src/main/java/com/hbm/render/block/RenderCableClassic.java b/src/main/java/com/hbm/render/block/RenderCableClassic.java index 1ccfbcd7b..00c55223a 100644 --- a/src/main/java/com/hbm/render/block/RenderCableClassic.java +++ b/src/main/java/com/hbm/render/block/RenderCableClassic.java @@ -1,5 +1,7 @@ package com.hbm.render.block; +import org.lwjgl.opengl.GL11; + import com.hbm.blocks.network.BlockCable; import com.hbm.lib.Library; @@ -13,7 +15,139 @@ import net.minecraft.world.IBlockAccess; public class RenderCableClassic implements ISimpleBlockRenderingHandler { @Override - public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { } + public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { + + GL11.glPushMatrix(); + GL11.glScaled(1.25D, 1.25D, 1.25D); + GL11.glTranslated(-0.5, -0.5, -0.5); + IIcon iicon = block.getIcon(0, 0); + + double uv_cL = iicon.getMinU(); + double uv_cR = iicon.getInterpolatedU(5); + double uv_cT = iicon.getMinV(); + double uv_cB = iicon.getInterpolatedV(5); + + double uv_sL = iicon.getInterpolatedU(5); + double uv_sR = iicon.getInterpolatedU(10); + double uv_sT = iicon.getMinV(); + double uv_sB = iicon.getInterpolatedV(5); + + double pos_nil = 0D; + double pos_one = 1D; + double pos_min = 0.34375D; + double pos_max = 0.65625D; + + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.setColorOpaque_F(1F, 1F, 1F); + tessellator.setNormal(0F, 1F, 0F); + tessellator.addVertexWithUV(pos_max, pos_max, pos_min, uv_cR, uv_cT); + tessellator.addVertexWithUV(pos_min, pos_max, pos_min, uv_cL, uv_cT); + tessellator.addVertexWithUV(pos_min, pos_max, pos_max, uv_cL, uv_cB); + tessellator.addVertexWithUV(pos_max, pos_max, pos_max, uv_cR, uv_cB); + tessellator.addVertexWithUV(pos_max, pos_max, pos_min, uv_sL, uv_sT); + tessellator.addVertexWithUV(pos_max, pos_max, pos_max, uv_sL, uv_sB); + tessellator.addVertexWithUV(pos_one, pos_max, pos_max, uv_sR, uv_sB); + tessellator.addVertexWithUV(pos_one, pos_max, pos_min, uv_sR, uv_sT); + tessellator.addVertexWithUV(pos_min, pos_max, pos_max, uv_sL, uv_sT); + tessellator.addVertexWithUV(pos_min, pos_max, pos_min, uv_sL, uv_sB); + tessellator.addVertexWithUV(pos_nil, pos_max, pos_min, uv_sR, uv_sB); + tessellator.addVertexWithUV(pos_nil, pos_max, pos_max, uv_sR, uv_sT); + tessellator.addVertexWithUV(pos_max, pos_max, pos_max, uv_sL, uv_sT); + tessellator.addVertexWithUV(pos_min, pos_max, pos_max, uv_sL, uv_sB); + tessellator.addVertexWithUV(pos_min, pos_max, pos_one, uv_sR, uv_sB); + tessellator.addVertexWithUV(pos_max, pos_max, pos_one, uv_sR, uv_sT); + tessellator.addVertexWithUV(pos_min, pos_max, pos_min, uv_sL, uv_sT); + tessellator.addVertexWithUV(pos_max, pos_max, pos_min, uv_sL, uv_sB); + tessellator.addVertexWithUV(pos_max, pos_max, pos_nil, uv_sR, uv_sB); + tessellator.addVertexWithUV(pos_min, pos_max, pos_nil, uv_sR, uv_sT); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0F, -1F, 0F); + tessellator.addVertexWithUV(pos_min, pos_min, pos_min, uv_cL, uv_cT); + tessellator.addVertexWithUV(pos_max, pos_min, pos_min, uv_cR, uv_cT); + tessellator.addVertexWithUV(pos_max, pos_min, pos_max, uv_cR, uv_cB); + tessellator.addVertexWithUV(pos_min, pos_min, pos_max, uv_cL, uv_cB); + tessellator.addVertexWithUV(pos_max, pos_min, pos_max, uv_sL, uv_sT); + tessellator.addVertexWithUV(pos_max, pos_min, pos_min, uv_sL, uv_sB); + tessellator.addVertexWithUV(pos_one, pos_min, pos_min, uv_sR, uv_sB); + tessellator.addVertexWithUV(pos_one, pos_min, pos_max, uv_sR, uv_sT); + tessellator.addVertexWithUV(pos_min, pos_min, pos_min, uv_sL, uv_sT); + tessellator.addVertexWithUV(pos_min, pos_min, pos_max, uv_sL, uv_sB); + tessellator.addVertexWithUV(pos_nil, pos_min, pos_max, uv_sR, uv_sB); + tessellator.addVertexWithUV(pos_nil, pos_min, pos_min, uv_sR, uv_sT); + tessellator.addVertexWithUV(pos_min, pos_min, pos_max, uv_sL, uv_sT); + tessellator.addVertexWithUV(pos_max, pos_min, pos_max, uv_sL, uv_sB); + tessellator.addVertexWithUV(pos_max, pos_min, pos_one, uv_sR, uv_sB); + tessellator.addVertexWithUV(pos_min, pos_min, pos_one, uv_sR, uv_sT); + tessellator.addVertexWithUV(pos_max, pos_min, pos_min, uv_sL, uv_sT); + tessellator.addVertexWithUV(pos_min, pos_min, pos_min, uv_sL, uv_sB); + tessellator.addVertexWithUV(pos_min, pos_min, pos_nil, uv_sR, uv_sB); + tessellator.addVertexWithUV(pos_max, pos_min, pos_nil, uv_sR, uv_sT); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(1F, 0F, 0F); + tessellator.addVertexWithUV(pos_max, pos_min, pos_max, uv_sL, uv_sT); + tessellator.addVertexWithUV(pos_max, pos_max, pos_max, uv_sL, uv_sB); + tessellator.addVertexWithUV(pos_max, pos_max, pos_one, uv_sR, uv_sB); + tessellator.addVertexWithUV(pos_max, pos_min, pos_one, uv_sR, uv_sT); + tessellator.addVertexWithUV(pos_max, pos_max, pos_min, uv_sL, uv_sT); + tessellator.addVertexWithUV(pos_max, pos_min, pos_min, uv_sL, uv_sB); + tessellator.addVertexWithUV(pos_max, pos_min, pos_nil, uv_sR, uv_sB); + tessellator.addVertexWithUV(pos_max, pos_max, pos_nil, uv_sR, uv_sT); + tessellator.addVertexWithUV(pos_one, pos_max, pos_min, uv_cR, uv_cT); + tessellator.addVertexWithUV(pos_one, pos_max, pos_max, uv_cL, uv_cT); + tessellator.addVertexWithUV(pos_one, pos_min, pos_max, uv_cL, uv_cB); + tessellator.addVertexWithUV(pos_one, pos_min, pos_min, uv_cR, uv_cB); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(-1F, 0F, 0F); + tessellator.addVertexWithUV(pos_min, pos_max, pos_max, uv_sL, uv_sT); + tessellator.addVertexWithUV(pos_min, pos_min, pos_max, uv_sL, uv_sB); + tessellator.addVertexWithUV(pos_min, pos_min, pos_one, uv_sR, uv_sB); + tessellator.addVertexWithUV(pos_min, pos_max, pos_one, uv_sR, uv_sT); + tessellator.addVertexWithUV(pos_min, pos_min, pos_min, uv_sL, uv_sT); + tessellator.addVertexWithUV(pos_min, pos_max, pos_min, uv_sL, uv_sB); + tessellator.addVertexWithUV(pos_min, pos_max, pos_nil, uv_sR, uv_sB); + tessellator.addVertexWithUV(pos_min, pos_min, pos_nil, uv_sR, uv_sT); + tessellator.addVertexWithUV(pos_nil, pos_max, pos_max, uv_cR, uv_cT); + tessellator.addVertexWithUV(pos_nil, pos_max, pos_min, uv_cL, uv_cT); + tessellator.addVertexWithUV(pos_nil, pos_min, pos_min, uv_cL, uv_cB); + tessellator.addVertexWithUV(pos_nil, pos_min, pos_max, uv_cR, uv_cB); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0F, 0F, 1F); + tessellator.addVertexWithUV(pos_max, pos_max, pos_max, uv_sL, uv_sT); + tessellator.addVertexWithUV(pos_max, pos_min, pos_max, uv_sL, uv_sB); + tessellator.addVertexWithUV(pos_one, pos_min, pos_max, uv_sR, uv_sB); + tessellator.addVertexWithUV(pos_one, pos_max, pos_max, uv_sR, uv_sT); + tessellator.addVertexWithUV(pos_min, pos_min, pos_max, uv_sL, uv_sT); + tessellator.addVertexWithUV(pos_min, pos_max, pos_max, uv_sL, uv_sB); + tessellator.addVertexWithUV(pos_nil, pos_max, pos_max, uv_sR, uv_sB); + tessellator.addVertexWithUV(pos_nil, pos_min, pos_max, uv_sR, uv_sT); + tessellator.addVertexWithUV(pos_max, pos_max, pos_one, uv_cR, uv_cT); + tessellator.addVertexWithUV(pos_min, pos_max, pos_one, uv_cL, uv_cT); + tessellator.addVertexWithUV(pos_min, pos_min, pos_one, uv_cL, uv_cB); + tessellator.addVertexWithUV(pos_max, pos_min, pos_one, uv_cR, uv_cB); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0F, 0F, -1F); + tessellator.addVertexWithUV(pos_max, pos_min, pos_min, uv_sL, uv_sT); + tessellator.addVertexWithUV(pos_max, pos_max, pos_min, uv_sL, uv_sB); + tessellator.addVertexWithUV(pos_one, pos_max, pos_min, uv_sR, uv_sB); + tessellator.addVertexWithUV(pos_one, pos_min, pos_min, uv_sR, uv_sT); + tessellator.addVertexWithUV(pos_min, pos_max, pos_min, uv_sL, uv_sT); + tessellator.addVertexWithUV(pos_min, pos_min, pos_min, uv_sL, uv_sB); + tessellator.addVertexWithUV(pos_nil, pos_min, pos_min, uv_sR, uv_sB); + tessellator.addVertexWithUV(pos_nil, pos_max, pos_min, uv_sR, uv_sT); + tessellator.addVertexWithUV(pos_min, pos_max, pos_nil, uv_cR, uv_cT); + tessellator.addVertexWithUV(pos_max, pos_max, pos_nil, uv_cL, uv_cT); + tessellator.addVertexWithUV(pos_max, pos_min, pos_nil, uv_cL, uv_cB); + tessellator.addVertexWithUV(pos_min, pos_min, pos_nil, uv_cR, uv_cB); + tessellator.draw(); + + GL11.glPopMatrix(); + } @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { @@ -36,26 +170,225 @@ public class RenderCableClassic implements ISimpleBlockRenderingHandler { boolean pZ = Library.canConnect(world, x, y, z + 1, Library.NEG_Z); boolean nZ = Library.canConnect(world, x, y, z - 1, Library.POS_Z); - double spanU = iicon.getMaxU() - iicon.getMinU(); - double spanV = iicon.getMaxV() - iicon.getMinV(); - double px = 0.0625D; - double uv_cL = iicon.getMinU(); - double uv_cR = iicon.getMinU() + spanU * 5 / px; - double uv_cT = iicon.getMaxV(); - double uv_cB = iicon.getMaxV() - spanV * 5 / px; + double uv_cR = iicon.getInterpolatedU(5); + double uv_cT = iicon.getMinV(); + double uv_cB = iicon.getInterpolatedV(5); - double pos_min = px * 5.5D; - double pos_max = px * 10.5D; + double uv_sL = iicon.getInterpolatedU(5); + double uv_sR = iicon.getInterpolatedU(10); + double uv_sT = iicon.getMinV(); + double uv_sB = iicon.getInterpolatedV(5); - //TODO: all that manual tessellator crap + double pos_nil = 0D; + double pos_one = 1D; + double pos_min = 0.34375D; + double pos_max = 0.65625D; + + float topColor = 1.0F; + float brightColor = 0.8F; + float darkColor = 0.6F; + float bottomColor = 0.5F; + + //this is a lot less tedious than it looks when you draw a 3D cube to take the vertex positions from + if(!pY) { + tessellator.setColorOpaque_F(topColor, topColor, topColor); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_min, uv_cR, uv_cT); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_min, uv_cL, uv_cT); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_max, uv_cL, uv_cB); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_max, uv_cR, uv_cB); + } else { + tessellator.setColorOpaque_F(brightColor, brightColor, brightColor); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_min, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_min, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_min, y + pos_one, z + pos_min, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_max, y + pos_one, z + pos_min, uv_sR, uv_sT); + + tessellator.setColorOpaque_F(darkColor, darkColor, darkColor); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_max, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_min, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_max, y + pos_one, z + pos_min, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_max, y + pos_one, z + pos_max, uv_sR, uv_sT); + + tessellator.setColorOpaque_F(brightColor, brightColor, brightColor); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_max, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_max, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_max, y + pos_one, z + pos_max, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_min, y + pos_one, z + pos_max, uv_sR, uv_sT); + + tessellator.setColorOpaque_F(darkColor, darkColor, darkColor); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_min, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_max, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_min, y + pos_one, z + pos_max, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_min, y + pos_one, z + pos_min, uv_sR, uv_sT); + } + + if(!nY) { + tessellator.setColorOpaque_F(bottomColor, bottomColor, bottomColor); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_min, uv_cL, uv_cT); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_min, uv_cR, uv_cT); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_max, uv_cR, uv_cB); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_max, uv_cL, uv_cB); + } else { + tessellator.setColorOpaque_F(brightColor, brightColor, brightColor); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_min, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_min, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_max, y + pos_nil, z + pos_min, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_min, y + pos_nil, z + pos_min, uv_sR, uv_sT); + + tessellator.setColorOpaque_F(darkColor, darkColor, darkColor); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_min, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_max, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_max, y + pos_nil, z + pos_max, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_max, y + pos_nil, z + pos_min, uv_sR, uv_sT); + + tessellator.setColorOpaque_F(brightColor, brightColor, brightColor); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_max, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_max, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_min, y + pos_nil, z + pos_max, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_max, y + pos_nil, z + pos_max, uv_sR, uv_sT); + + tessellator.setColorOpaque_F(darkColor, darkColor, darkColor); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_max, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_min, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_min, y + pos_nil, z + pos_min, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_min, y + pos_nil, z + pos_max, uv_sR, uv_sT); + } + + if(!pX) { + tessellator.setColorOpaque_F(darkColor, darkColor, darkColor); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_min, uv_cR, uv_cT); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_max, uv_cL, uv_cT); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_max, uv_cL, uv_cB); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_min, uv_cR, uv_cB); + } else { + tessellator.setColorOpaque_F(topColor, topColor, topColor); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_min, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_max, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_one, y + pos_max, z + pos_max, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_one, y + pos_max, z + pos_min, uv_sR, uv_sT); + + tessellator.setColorOpaque_F(brightColor, brightColor, brightColor); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_min, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_min, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_one, y + pos_max, z + pos_min, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_one, y + pos_min, z + pos_min, uv_sR, uv_sT); + + tessellator.setColorOpaque_F(bottomColor, bottomColor, bottomColor); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_max, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_min, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_one, y + pos_min, z + pos_min, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_one, y + pos_min, z + pos_max, uv_sR, uv_sT); + + tessellator.setColorOpaque_F(brightColor, brightColor, brightColor); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_max, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_max, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_one, y + pos_min, z + pos_max, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_one, y + pos_max, z + pos_max, uv_sR, uv_sT); + } + + if(!nX) { + tessellator.setColorOpaque_F(darkColor, darkColor, darkColor); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_max, uv_cR, uv_cT); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_min, uv_cL, uv_cT); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_min, uv_cL, uv_cB); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_max, uv_cR, uv_cB); + } else { + tessellator.setColorOpaque_F(topColor, topColor, topColor); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_max, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_min, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_nil, y + pos_max, z + pos_min, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_nil, y + pos_max, z + pos_max, uv_sR, uv_sT); + + tessellator.setColorOpaque_F(brightColor, brightColor, brightColor); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_min, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_min, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_nil, y + pos_min, z + pos_min, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_nil, y + pos_max, z + pos_min, uv_sR, uv_sT); + + tessellator.setColorOpaque_F(bottomColor, bottomColor, bottomColor); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_min, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_max, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_nil, y + pos_min, z + pos_max, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_nil, y + pos_min, z + pos_min, uv_sR, uv_sT); + + tessellator.setColorOpaque_F(brightColor, brightColor, brightColor); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_max, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_max, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_nil, y + pos_max, z + pos_max, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_nil, y + pos_min, z + pos_max, uv_sR, uv_sT); + } + + if(!pZ) { + tessellator.setColorOpaque_F(brightColor, brightColor, brightColor); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_max, uv_cR, uv_cT); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_max, uv_cL, uv_cT); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_max, uv_cL, uv_cB); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_max, uv_cR, uv_cB); + } else { + tessellator.setColorOpaque_F(topColor, topColor, topColor); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_max, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_max, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_one, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_one, uv_sR, uv_sT); + + tessellator.setColorOpaque_F(darkColor, darkColor, darkColor); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_max, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_max, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_one, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_one, uv_sR, uv_sT); + + tessellator.setColorOpaque_F(bottomColor, bottomColor, bottomColor); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_max, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_max, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_one, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_one, uv_sR, uv_sT); + + tessellator.setColorOpaque_F(darkColor, darkColor, darkColor); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_max, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_max, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_one, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_one, uv_sR, uv_sT); + } + + if(!nZ) { + tessellator.setColorOpaque_F(brightColor, brightColor, brightColor); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_min, uv_cR, uv_cT); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_min, uv_cL, uv_cT); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_min, uv_cL, uv_cB); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_min, uv_cR, uv_cB); + } else { + tessellator.setColorOpaque_F(topColor, topColor, topColor); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_min, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_min, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_nil, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_nil, uv_sR, uv_sT); + + tessellator.setColorOpaque_F(darkColor, darkColor, darkColor); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_min, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_min, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_min, y + pos_max, z + pos_nil, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_nil, uv_sR, uv_sT); + + tessellator.setColorOpaque_F(bottomColor, bottomColor, bottomColor); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_min, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_min, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_min, y + pos_min, z + pos_nil, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_nil, uv_sR, uv_sT); + + tessellator.setColorOpaque_F(darkColor, darkColor, darkColor); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_min, uv_sL, uv_sT); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_min, uv_sL, uv_sB); + tessellator.addVertexWithUV(x + pos_max, y + pos_min, z + pos_nil, uv_sR, uv_sB); + tessellator.addVertexWithUV(x + pos_max, y + pos_max, z + pos_nil, uv_sR, uv_sT); + } return true; } @Override public boolean shouldRender3DInInventory(int modelId) { - return false; + return true; } @Override diff --git a/src/main/java/com/hbm/render/model/ModelM65.java b/src/main/java/com/hbm/render/model/ModelM65.java index c1eaaab90..d61b13d43 100644 --- a/src/main/java/com/hbm/render/model/ModelM65.java +++ b/src/main/java/com/hbm/render/model/ModelM65.java @@ -126,17 +126,33 @@ public class ModelM65 extends ModelBiped { @Override public void render(Entity entity, float par2, float par3, float par4, float par5, float par6, float par7) { setRotationAngles(par2, par3, par4, par5, par6, par7, entity); - GL11.glPushMatrix(); - double d = 1D / 16D * 18D; - //GL11.glTranslated(0, 1/16D, 0); - GL11.glScaled(d, d, d); - GL11.glScaled(1.01D, 1.01D, 1.01D); - this.mask.render(par7); - if(!(entity instanceof EntityLivingBase) || ArmorUtil.getGasMaskFilterRecursively(((EntityLivingBase)entity).getEquipmentInSlot(4), (EntityLivingBase)entity) != null) - this.filter.render(par7); - - GL11.glPopMatrix(); + if(this.isChild) { + float f6 = 2.0F; + GL11.glPushMatrix(); + GL11.glScalef(1.5F / f6, 1.5F / f6, 1.5F / f6); + GL11.glTranslatef(0.0F, 16.0F * par7, 0.0F); + double d = 1D / 16D * 18D; + GL11.glScaled(d, d, d); + GL11.glScaled(1.01D, 1.01D, 1.01D); + this.mask.render(par7); + + if(!(entity instanceof EntityLivingBase) || ArmorUtil.getGasMaskFilterRecursively(((EntityLivingBase)entity).getEquipmentInSlot(4), (EntityLivingBase)entity) != null) + this.filter.render(par7); + + GL11.glPopMatrix(); + } else { + GL11.glPushMatrix(); + double d = 1D / 16D * 18D; + GL11.glScaled(d, d, d); + GL11.glScaled(1.01D, 1.01D, 1.01D); + this.mask.render(par7); + + if(!(entity instanceof EntityLivingBase) || ArmorUtil.getGasMaskFilterRecursively(((EntityLivingBase)entity).getEquipmentInSlot(4), (EntityLivingBase)entity) != null) + this.filter.render(par7); + + GL11.glPopMatrix(); + } } private void setRotation(ModelRenderer model, float x, float y, float z) { diff --git a/src/main/java/com/hbm/render/util/RenderAccessoryUtility.java b/src/main/java/com/hbm/render/util/RenderAccessoryUtility.java index 7103eebad..9b0278752 100644 --- a/src/main/java/com/hbm/render/util/RenderAccessoryUtility.java +++ b/src/main/java/com/hbm/render/util/RenderAccessoryUtility.java @@ -41,6 +41,8 @@ public class RenderAccessoryUtility { private static ResourceLocation rightnugget = new ResourceLocation(RefStrings.MODID + ":textures/models/capes/CapeRightNugget.png"); private static ResourceLocation tankish = new ResourceLocation(RefStrings.MODID + ":textures/models/capes/CapeTankish.png"); private static ResourceLocation frizzlefrazzle = new ResourceLocation(RefStrings.MODID + ":textures/models/capes/CapeFrizzleFrazzle.png"); + private static ResourceLocation pheo = new ResourceLocation(RefStrings.MODID + ":textures/models/capes/CapePheo.png"); + private static ResourceLocation vaer = new ResourceLocation(RefStrings.MODID + ":textures/models/capes/CapeVaer.png"); public static ResourceLocation getCloakFromPlayer(EntityPlayer player) { @@ -111,6 +113,12 @@ public class RenderAccessoryUtility { if(uuid.equals(Library.FrizzleFrazzle)) { return frizzlefrazzle; } + if(uuid.equals(Library.Barnaby99_x)) { + return pheo; + } + if(uuid.equals(Library.Ma118)) { + return vaer; + } if(Library.contributors.contains(uuid)) { return wiki; } diff --git a/src/main/java/com/hbm/tileentity/TileMappings.java b/src/main/java/com/hbm/tileentity/TileMappings.java index 3b044c1ea..ca2701011 100644 --- a/src/main/java/com/hbm/tileentity/TileMappings.java +++ b/src/main/java/com/hbm/tileentity/TileMappings.java @@ -5,6 +5,7 @@ import java.util.HashMap; import com.hbm.blocks.generic.BlockBobble.TileEntityBobble; import com.hbm.blocks.generic.BlockEmitter.TileEntityEmitter; import com.hbm.blocks.generic.BlockLoot.TileEntityLoot; +import com.hbm.blocks.generic.BlockMotherOfAllOres.TileEntityRandomOre; import com.hbm.blocks.network.CableDiode.TileEntityDiode; import com.hbm.tileentity.bomb.*; import com.hbm.tileentity.conductor.*; @@ -199,6 +200,8 @@ public class TileMappings { put(TileEntityProxyEnergy.class, "tileentity_proxy_power"); put(TileEntityProxyCombo.class, "tileentity_proxy_combo"); put(TileEntityProxyConductor.class, "tileentity_proxy_conductor"); + + put(TileEntityRandomOre.class, "tileentity_mother_of_all_ores"); putNetwork(); putBombs(); diff --git a/src/main/java/com/hbm/util/ColorUtil.java b/src/main/java/com/hbm/util/ColorUtil.java index 60779593e..1cfcfe039 100644 --- a/src/main/java/com/hbm/util/ColorUtil.java +++ b/src/main/java/com/hbm/util/ColorUtil.java @@ -63,7 +63,7 @@ public class ColorUtil { int avgG = g / pixels; int avgB = b / pixels; - return (r << 16) | (g << 8) | b; + return (avgR << 16) | (avgG << 8) | avgB; } catch(Exception ex) { return 0xFFFFFF; @@ -122,7 +122,7 @@ public class ColorUtil { if(b / r > 1.5) return true; if(b / g > 1.5) return true;*/ - float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), new float[0]); + float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), new float[3]); // saturation brightness return hsb[1] > 0.25 && hsb[2] > 0.25; @@ -139,7 +139,7 @@ public class ColorUtil { int r = color.getRed(); int g = color.getGreen(); int b = color.getBlue(); - int max = Math.max(r, Math.max(g, b)); + int max = Math.max(Math.max(1, r), Math.max(g, b)); r = r * limit / max; g = g * limit / max; diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index 2e0bdc918..e61347c6d 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -947,6 +947,7 @@ item.can_empty.name=Leere Dose item.can_key.name=Dosenschlüssel item.can_luna.name=Black Mesa Luna - Dark Cola item.can_mrsugar.name='Dr. Sugar' Softdrink +item.can_mug.name=MUG Root Beer item.can_overcharge.name=Overcharge Delirium XT item.can_redbomb.name='Red Bomb' Energy-Drink item.can_smart.name='Smart' Energy-Drink @@ -3446,6 +3447,7 @@ tile.ore_niter.name=Salpetererz tile.ore_oil.name=Ölvorkommen tile.ore_oil_empty.name=Leeres Ölvorkommen tile.ore_oil_sand.name=Teersand +tile.ore_random.name=%s-Erz tile.ore_rare.name=Seltenerden-Erz tile.ore_reiium.name=Reiit tile.ore_schrabidium.name=Schrabidiumerz @@ -3506,6 +3508,7 @@ tile.reactor_hatch.name=Kraftwerkszugriffsluke tile.reactor_inserter.name=Reaktor-Brennstoffeinlass tile.red_barrel.name=Explosives Fass tile.red_cable.name=Rotes Kupferkabel +tile.red_cable_classic.name=Rotes Kupferkabel (Klassisch) tile.red_connector.name=Stromverbindungsstück tile.red_pylon.name=Strommasten tile.red_pylon_large.name=Hochspannungsmasten diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 78a4494a2..a36e920ad 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -1157,6 +1157,7 @@ item.can_empty.name=Empty Can item.can_key.name=Winding Key item.can_luna.name=Black Mesa Luna - Dark Cola item.can_mrsugar.name='Dr. Sugar' Soft Drink +item.can_mug.name=MUG Root Beer item.can_overcharge.name=Overcharge Delirium XT item.can_redbomb.name='Red Bomb' Energy Drink item.can_smart.name='Smart' Energy Drink @@ -3819,6 +3820,7 @@ tile.ore_niter.name=Niter Ore tile.ore_oil.name=Oil Deposit tile.ore_oil_empty.name=Empty Oil Deposit tile.ore_oil_sand.name=Tar Sand +tile.ore_random.name=%s Ore tile.ore_rare.name=Rare Earth Ore tile.ore_reiium.name=Reiite tile.ore_schrabidium.name=Schrabidium Ore @@ -3879,6 +3881,7 @@ tile.reactor_hatch.name=Reactor Access Hatch tile.reactor_inserter.name=Reactor Fuel Inserter tile.red_barrel.name=Explosive Barrel tile.red_cable.name=Red Copper Cable +tile.red_cable_classic.name=Red Copper Cable (Classic) tile.red_connector.name=Electricity Connector tile.red_pylon.name=Electricity Pole tile.red_pylon_large.name=Large Electricity Pylon diff --git a/src/main/resources/assets/hbm/textures/blocks/ore_cobalt.png b/src/main/resources/assets/hbm/textures/blocks/ore_cobalt.png index 2553fad84..40dfc4cf0 100644 Binary files a/src/main/resources/assets/hbm/textures/blocks/ore_cobalt.png and b/src/main/resources/assets/hbm/textures/blocks/ore_cobalt.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/ore_copper.png b/src/main/resources/assets/hbm/textures/blocks/ore_copper.png index ae1ff8b0c..56901b0b5 100644 Binary files a/src/main/resources/assets/hbm/textures/blocks/ore_copper.png and b/src/main/resources/assets/hbm/textures/blocks/ore_copper.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/red_cable_classic.png b/src/main/resources/assets/hbm/textures/blocks/red_cable_classic.png index 0990a1e90..a1ba54be6 100644 Binary files a/src/main/resources/assets/hbm/textures/blocks/red_cable_classic.png and b/src/main/resources/assets/hbm/textures/blocks/red_cable_classic.png differ diff --git a/src/main/resources/assets/hbm/textures/models/capes/CapePheo.png b/src/main/resources/assets/hbm/textures/models/capes/CapePheo.png new file mode 100644 index 000000000..97b7a7538 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/models/capes/CapePheo.png differ diff --git a/src/main/resources/assets/hbm/textures/models/capes/CapeVaer.png b/src/main/resources/assets/hbm/textures/models/capes/CapeVaer.png new file mode 100644 index 000000000..5b7939981 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/models/capes/CapeVaer.png differ diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index be645a79a..fe91e7960 100755 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "hbm", "name": "Hbm's Nuclear Tech", "description": "A mod that adds weapons, nuclear themed stuff and machines", - "version":"1.0.27_X4186", + "version":"1.0.27_X4191", "mcversion": "1.7.10", "url": "", "updateUrl": "",