Jump to content

Vemahk20

Members
  • Posts

    33
  • Joined

  • Last visited

Everything posted by Vemahk20

  1. I didn't forget it, i was just hoping that there would be a way around it without using a tile entity, which there appears not to... Thanks anyway
  2. Hi, I'm trying to create a camouflage block just for the sake of knowing how its done and I've gotten to the point where the block changes to match that of what's around it but when that block texture changes all of the blocks of that type change with it so I was wondering if there was a specific function that changed a block's texture at a x,y,z coordinates. Thanks!
  3. Ok, so i have my container working mostly, only when a item/block is shift clicked out of the 6 slots of the repair station, that item is doubled and then put in my inv... Its probably just a stupid mistake but ive looked the program over a few times and i can't seem to find it. Any help would be nice, here's my container code package RS; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class ContainerRStation extends Container { protected TileEntityRStation tileEntity; public ContainerRStation (InventoryPlayer inventoryPlayer, TileEntityRStation te){ tileEntity = te; addSlotToContainer(new Slot(tileEntity, 0,25,34)); addSlotToContainer(new Slot(tileEntity, 1,43,34)); addSlotToContainer(new Slot(tileEntity, 2,61,34)); addSlotToContainer(new Slot(tileEntity, 3,79,34)); addSlotToContainer(new Slot(tileEntity, 4,117,34)); addSlotToContainer(new Slot(tileEntity, 5,135,34)); bindPlayerInventory(inventoryPlayer); } @Override public boolean canInteractWith(EntityPlayer player) { return tileEntity.isUseableByPlayer(player); } protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 9; j++) { addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } for (int i = 0; i < 9; i++) { addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142)); } } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slot) { ItemStack stack = null; Slot slotObject = (Slot) inventorySlots.get(slot); if (slotObject != null && slotObject.getHasStack()) { ItemStack stackInSlot = slotObject.getStack(); stack = stackInSlot.copy(); if (slot < 6) { if (!this.mergeItemStack(stackInSlot, 0, 42, true)) { return null; } else if (!this.mergeItemStack(stackInSlot, 0, 6, false)) { return null; } if (stackInSlot.stackSize == 0) { slotObject.putStack(null); } else { slotObject.onSlotChanged(); } if (stackInSlot.stackSize == stack.stackSize) { return null; } slotObject.onPickupFromSlot(player, stackInSlot); } return stack; } }
  4. I should have been more clear, the IN GAME name's of all of my items show as item.<ITEM UNLOCALIZED NAME>.name... sorry if i wasnt clear...
  5. All my names in my mod are like, item.axeLapis.name and after reading a few tutorials i find nothing wrong Main Mod File: package ExtraTools; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.common.Configuration; import net.minecraftforge.common.EnumHelper; import ExtraTools.Items.ETAxe; import ExtraTools.Items.ETHoe; import ExtraTools.Items.ETItem; import ExtraTools.Items.ETPick; import ExtraTools.Items.ETSpade; import ExtraTools.Items.ETSword; import ExtraTools.Reference.*; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid = Reference.MOD_ID, name=Reference.MOD_NAME, version=Reference.MOD_V) @NetworkMod(clientSideRequired=true) public class mod_ExtraTools { @Instance(Reference.MOD_ID) public static mod_ExtraTools instance; @EventHandler public void preInit(FMLPreInitializationEvent preevt) { preevt.getModMetadata().version = Reference.MOD_V; preevt.getModMetadata().name = Reference.MOD_NAME; preevt.getModMetadata().authorList.add("Vemahk20"); preevt.getModMetadata().modId = Reference.MOD_ID; Configuration config = new Configuration(preevt.getSuggestedConfigurationFile()); config.load(); for(int i=0; i<ItemIDs.ids.length-1; i++){ ItemIDs.ids[i] = config.getItem(ItemIDs.names[i], ItemIDs.Dids[i]).getInt(); } config.save(); } @EventHandler public void load(FMLInitializationEvent event) { craft(); smelt(); naming(); registering(); } public void craft(){ GameRegistry.addRecipe(new ItemStack(lapisBar, 2), new Object[] {"LLL", "LLL", Character.valueOf('L'), new ItemStack(Item.dyePowder, 1, 4)}); GameRegistry.addRecipe(new ItemStack(redstoneBar), new Object[] {"RRR", "RRR", 'R', Item.redstone}); //Lapis Tools GameRegistry.addRecipe(new ItemStack(lapisPickaxe), new Object[] {"LLL", " S ", " S ", 'L', lapisBar, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(lapisAxe), new Object[] {" LL", " SL", " S ", 'L', lapisBar, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(lapisAxe), new Object[] {"LL ", "LS ", " S ", 'L', lapisBar, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(lapisSpade), new Object[] {" L ", " S ", " S ", 'L', lapisBar, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(lapisSword), new Object[] {" L ", " L ", " S ", 'L', lapisBar, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(lapisHoe), new Object[] {"LL ", " S ", " S ", 'L', lapisBar, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(lapisHoe), new Object[] {" LL", " S ", " S ", 'L', lapisBar, 'S', Item.stick}); //Redstone Tools GameRegistry.addRecipe(new ItemStack(redstonePickaxe), new Object[] {"RRR", " S ", " S ", 'R', redstoneBar, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(redstoneAxe), new Object[] {" RR", " SR", " S ", 'R', redstoneBar, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(redstoneAxe), new Object[] {"RR ", "RS ", " S ", 'R', redstoneBar, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(redstoneSpade), new Object[] {" R ", " S ", " S ", 'R', redstoneBar, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(redstoneSword), new Object[] {" R ", " R ", " S ", 'R', redstoneBar, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(redstoneHoe), new Object[] {"RR ", " S ", " S ", 'R', redstoneBar, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(redstoneHoe), new Object[] {" RR", " S ", " S ", 'R', redstoneBar, 'S', Item.stick}); //Emerald GameRegistry.addRecipe(new ItemStack(emeraldPickaxe), new Object[] {"EEE", " S ", " S ", 'E', emeraldBar, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(emeraldAxe), new Object[] {" EE", " SE", " S ", 'E', emeraldBar, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(emeraldAxe), new Object[] {"EE ", "ES ", " S ", 'E', emeraldBar, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(emeraldSpade), new Object[] {" E ", " S ", " S ", 'E', emeraldBar, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(emeraldSword), new Object[] {" E ", " E ", " S ", 'E', emeraldBar, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(emeraldHoe), new Object[] {"EE ", " S ", " S ", 'E', emeraldBar, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(emeraldHoe), new Object[] {" EE", " S ", " S ", 'E', emeraldBar, 'S', Item.stick}); } public void smelt(){ GameRegistry.addSmelting(Item.emerald.itemID, new ItemStack(emeraldBar), 2.0F); } public void naming(){ //Lapis LanguageRegistry.addName(lapisBar, "Lapis Bar"); LanguageRegistry.addName(lapisPickaxe, "Lapis Pickaxe"); LanguageRegistry.addName(lapisAxe, "Lapis Axe"); LanguageRegistry.addName(lapisSpade, "Lapis Shovel"); LanguageRegistry.addName(lapisSword, "Lapis Sword"); LanguageRegistry.addName(lapisHoe, "Lapis Hoe"); //Redstone LanguageRegistry.addName(redstoneBar, "Redstone Bar"); LanguageRegistry.addName(redstonePickaxe, "Redstone Pickaxe"); LanguageRegistry.addName(redstoneAxe, "Redstone Axe"); LanguageRegistry.addName(redstoneSpade, "Redstone Shovel"); LanguageRegistry.addName(redstoneSword, "Redstone Sword"); LanguageRegistry.addName(redstoneHoe, "Redstone Hoe"); //Emerald LanguageRegistry.addName(emeraldBar, "Emerald Bar"); LanguageRegistry.addName(emeraldPickaxe, "Emerald Pickaxe"); LanguageRegistry.addName(emeraldAxe, "Emerald Axe"); LanguageRegistry.addName(emeraldSpade, "Emerald Shovel"); LanguageRegistry.addName(emeraldSword, "Emerald Sword"); LanguageRegistry.addName(emeraldHoe, "Emerald Hoe"); } public void registering(){ //Lapis GameRegistry.registerItem(lapisBar, "Lapis Bar"); GameRegistry.registerItem(lapisPickaxe, "Lapis Pickaxe"); GameRegistry.registerItem(lapisAxe, "Lapis Axe"); GameRegistry.registerItem(lapisSpade, "Lapis Shovel"); GameRegistry.registerItem(lapisSword, "Lapis Sword"); GameRegistry.registerItem(lapisHoe, "Lapis Hoe"); //Redstone GameRegistry.registerItem(redstoneBar, "Redstone Bar"); GameRegistry.registerItem(redstonePickaxe, "Redstone Pickaxe"); GameRegistry.registerItem(redstoneAxe, "Redstone Axe"); GameRegistry.registerItem(redstoneSpade, "Redstone Shovel"); GameRegistry.registerItem(redstoneSword, "Redstone Sword"); GameRegistry.registerItem(redstoneHoe, "Redstone Hoe"); //Emerald GameRegistry.registerItem(emeraldBar, "Emerald Bar"); GameRegistry.registerItem(emeraldPickaxe, "Emerald Pickaxe"); GameRegistry.registerItem(emeraldAxe, "Emerald Axe"); GameRegistry.registerItem(emeraldSpade, "Emerald Shovel"); GameRegistry.registerItem(emeraldSword, "Emerald Sword"); GameRegistry.registerItem(emeraldHoe, "Emerald Hoe"); } //Tool Materials public static final EnumToolMaterial lapis = EnumHelper.addToolMaterial("Lapis", 2, 150, 6.5F, 2, 12); public static final EnumToolMaterial redstone = EnumHelper.addToolMaterial("Redstone", 2, 125, 7.5F, 3, 15); public static final EnumToolMaterial emerald = EnumHelper.addToolMaterial("Emerald", 2, 1024, 8F, 5, 16); //Lapis public static final Item lapisBar = (new ETItem(ItemIDs.ids[0], 0)).setUnlocalizedName("barLapis"); public static final Item lapisPickaxe = (new ETPick(ItemIDs.ids[1], lapis, 1)).setUnlocalizedName("pickLapis"); public static final Item lapisAxe = (new ETAxe(ItemIDs.ids[2], lapis, 2)).setUnlocalizedName("axeLapis"); public static final Item lapisSpade = (new ETSpade(ItemIDs.ids[3], lapis, 3)).setUnlocalizedName("shovelLapis"); public static final Item lapisSword = (new ETSword(ItemIDs.ids[4], lapis, 4)).setUnlocalizedName("swordLapis"); public static final Item lapisHoe = (new ETHoe(ItemIDs.ids[5], lapis, 5)).setUnlocalizedName("tillerLapis"); //Redstone public static final Item redstoneBar = (new ETItem(ItemIDs.ids[6], 6)).setUnlocalizedName("barRedstone"); public static final Item redstonePickaxe = (new ETPick(ItemIDs.ids[7], redstone, 7)).setUnlocalizedName("pickaxeRedstone"); public static final Item redstoneAxe = (new ETAxe(ItemIDs.ids[8], redstone, ).setUnlocalizedName("axeRedstone"); public static final Item redstoneSpade = (new ETSpade(ItemIDs.ids[9], redstone, 9)).setUnlocalizedName("shovelRedstone"); public static final Item redstoneSword = (new ETSword(ItemIDs.ids[10], redstone, 10)).setUnlocalizedName("swordRedstone"); public static final Item redstoneHoe = (new ETHoe(ItemIDs.ids[11], redstone, 11)).setUnlocalizedName("tillerRedstone"); //Emerald public static final Item emeraldBar = (new ETItem(ItemIDs.ids[12], 12)).setUnlocalizedName("barEmerald"); public static final Item emeraldPickaxe = (new ETPick(ItemIDs.ids[13], emerald, 13)).setUnlocalizedName("pickaxeEmerald"); public static final Item emeraldAxe = (new ETAxe(ItemIDs.ids[14], emerald, 14)).setUnlocalizedName("axeEmerald"); public static final Item emeraldSpade = (new ETSpade(ItemIDs.ids[15], emerald, 15)).setUnlocalizedName("shovelEmerald"); public static final Item emeraldSword = (new ETSword(ItemIDs.ids[16], emerald, 16)).setUnlocalizedName("swordEmerald"); public static final Item emeraldHoe = (new ETHoe(ItemIDs.ids[17], emerald, 17)).setUnlocalizedName("tillerEmerald"); } Plz help me
  6. It has nothing to do with your block class, you simple lack a line of code in your load() in the mail class. put this line of code in the load void MinecraftForge.setBlockHarvestLevel(OREBLOCK "TOOL", HARVESTLVL); ex: MinecraftForge.setBlockHarvestLevel(oreJuli, "pickaxe", 2);
  7. I like the idea for that, and i actually planned on using that for one of my machines in the future but if there is a problem then i would like to know about it . But what i was planning on doing was in the smeltItem() void in the tile entity where it added one to the itemstack in slot 2, i was going to put a random int there and if(randint == soandso){smelt}. If that didnt or doesnt worked, then im stumped
  8. I have no idea how this works in truth... i tried debuging with adding a switch that included the metavalue but it kept changing.. first it was 5, then 0, then 2... there are some times where programming makes me hate it -.-
  9. I thought that the 2 variables on the genIcon() was the side number and the metadata value
  10. What's funny is i just did that... after looking at what i said, but when i copied the script, it still didnt work... ive came to the conclusion that i really screwed something up when updating... package IndustrialBreakout.Machines; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.Icon; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import IndustrialBreakout.*; import IndustrialBreakout.TileEntity.*; public class BlockIBMachineRefiner extends BlockContainer { /** * Is the random generator used by refiner to drop the inventory contents in random directions. */ private Random refinerRand = new Random(); /** True if this is an active refiner, false if idle */ private final boolean isActive; /** * This flag is used to prevent the refiner inventory to be dropped upon block removal, is used internally when the * refiner block changes from idle to active and vice-versa. */ private static boolean keepRefinerInventory = false; public BlockIBMachineRefiner(int par1, boolean par2) { super(par1, Material.rock); this.isActive = par2; } /** * Returns the ID of the items to drop on destruction. */ public int idDropped(int par1, Random par2Random, int par3) { return mod_IndustrialBreakout.machineRefiner.blockID; } /** * Called whenever the block is added into the world. Args: world, x, y, z */ public void onBlockAdded(World par1World, int par2, int par3, int par4) { super.onBlockAdded(par1World, par2, par3, par4); this.setDefaultDirection(par1World, par2, par3, par4); } /** * set a blocks direction */ private void setDefaultDirection(World par1World, int par2, int par3, int par4) { if (!par1World.isRemote) { int var5 = par1World.getBlockId(par2, par3, par4 - 1); int var6 = par1World.getBlockId(par2, par3, par4 + 1); int var7 = par1World.getBlockId(par2 - 1, par3, par4); int var8 = par1World.getBlockId(par2 + 1, par3, par4); byte var9 = 3; if (Block.opaqueCubeLookup[var5] && !Block.opaqueCubeLookup[var6]) { var9 = 3; } if (Block.opaqueCubeLookup[var6] && !Block.opaqueCubeLookup[var5]) { var9 = 2; } if (Block.opaqueCubeLookup[var7] && !Block.opaqueCubeLookup[var8]) { var9 = 5; } if (Block.opaqueCubeLookup[var8] && !Block.opaqueCubeLookup[var7]) { var9 = 4; } par1World.setBlockMetadataWithNotify(par2, par3, par4, var9, 2); } } /** * Called upon block activation (right click on the block.) */ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { if (world.isRemote) { return true; } else { player.openGui(mod_IndustrialBreakout.instance, 3, world, x, y, z); } return true; } /** * Returns a new instance of a block's tile entity class. Called on placing the block. */ public TileEntity createNewTileEntity(World par1World) { return new TileEntityRefiner(); } /** * Called when the block is placed in the world. */ public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving, ItemStack par6ItemStack) { int l = MathHelper.floor_double((double)(par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; if (l == 0) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 2, 2); } if (l == 1) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 5, 2); } if (l == 2) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 3, 2); } if (l == 3) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 4, 2); } if (par6ItemStack.hasDisplayName()) { ((TileEntityFurnace)par1World.getBlockTileEntity(par2, par3, par4)).func_94129_a(par6ItemStack.getDisplayName()); } } /** * ejects contained items into the world, and notifies neighbours of an update, as appropriate */ public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { if (!keepRefinerInventory) { TileEntityRefiner tileentityrefiner = (TileEntityRefiner)par1World.getBlockTileEntity(par2, par3, par4); if (tileentityrefiner != null) { for (int j1 = 0; j1 < tileentityrefiner.getSizeInventory(); ++j1) { ItemStack itemstack = tileentityrefiner.getStackInSlot(j1); if (itemstack != null) { float f = this.refinerRand.nextFloat() * 0.8F + 0.1F; float f1 = this.refinerRand.nextFloat() * 0.8F + 0.1F; float f2 = this.refinerRand.nextFloat() * 0.8F + 0.1F; while (itemstack.stackSize > 0) { int k1 = this.refinerRand.nextInt(21) + 10; if (k1 > itemstack.stackSize) { k1 = itemstack.stackSize; } itemstack.stackSize -= k1; EntityItem entityitem = new EntityItem(par1World, (double)((float)par2 + f), (double)((float)par3 + f1), (double)((float)par4 + f2), new ItemStack(itemstack.itemID, k1, itemstack.getItemDamage())); if (itemstack.hasTagCompound()) { entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); } float f3 = 0.05F; entityitem.motionX = (double)((float)this.refinerRand.nextGaussian() * f3); entityitem.motionY = (double)((float)this.refinerRand.nextGaussian() * f3 + 0.2F); entityitem.motionZ = (double)((float)this.refinerRand.nextGaussian() * f3); par1World.spawnEntityInWorld(entityitem); } } } par1World.func_96440_m(par2, par3, par4, par5); } } super.breakBlock(par1World, par2, par3, par4, par5, par6); } @SideOnly(Side.CLIENT) private Icon[] icons; @SideOnly(Side.CLIENT) public void registerIcons(IconRegister ir){ icons = new Icon[3]; icons[0] = ir.registerIcon("IndustrialBreakout:9"); icons[1] = ir.registerIcon("IndustrialBreakout:10"); icons[2] = ir.registerIcon("IndustrialBreakout:18"); } @SideOnly(Side.CLIENT) public Icon getIcon(int side, int metadata){ switch(side) { case 0: return icons[1]; case 1: return icons[1]; case 3: return icons[2]; default: return icons[0]; } } } that's the code of one of my machines if you find something royally messed up with it plz point it out
  11. Alright, so in updating my mod to 1.5.2, everything went fine and smooth until I played the game, and when i placed a machine that was supposed to face the player, there was a set direction to it... If there is anyone who can help me out with a piece of code then it would be appreciated
  12. Ah... Well i am not going to screw with nether ores or end ores so i woudn't need those.. I am going to switch styles of that code to see if it helps, but i really dont see much of a difference so... Yeah...
  13. Ah, you see, we kind of did ours similarly, i just didnt want to write out all those for loops. Also, i have a question. What is the point of calling the generateNether() and generateEnd() if there is nothing in them?
  14. Lol, tutorials make no since to me, so i just pick up on certain things from browsing the forums and that is what i got . No help then?
  15. I have no idea what's going on... I have 4 things set to genereate but for SOME reason, only one of them is and i have no flipping idea why. Any help is great, here's the gen code. package IndustrialBreakout.world; import java.util.Random; import IndustrialBreakout.mod_IndustrialBreakout; import net.minecraft.block.Block; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import cpw.mods.fml.common.IWorldGenerator; public class WorldGeneratorIB implements IWorldGenerator { @Override public void generate(Random r, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { int x = chunkX*16 +r.nextInt(16); //int y = chunkY*16 +random.nextInt(16); int z = chunkZ*16 +r.nextInt(16); addOreGen(r, chunkX, chunkZ, world, mod_IndustrialBreakout.oreTitanium.blockID, 1+r.nextInt(2), 16, 3); addOreGen(r, chunkX, chunkZ, world, mod_IndustrialBreakout.oreTin.blockID, 4 + r.nextInt(2), 32, 3); addOreGen(r, chunkX, chunkZ, world, mod_IndustrialBreakout.oreCopper.blockID, 6 + r.nextInt(6), 64, 10); addOreGen(r, chunkX, chunkZ, world, mod_IndustrialBreakout.oreChargedCoal.blockID, 2 + r.nextInt(2), 16, 3); } private void addOreGen(Random r, int cX, int cZ, World w, int id, int numberOfGen, int y, int numOfVeins){ for(int i = 0; i < numOfVeins; i++){ int x = cX*16 + r.nextInt(16); int z = cZ*16 + r.nextInt(16); (new WorldGenMinable(id, numberOfGen)).generate(w, r, x, y, z); } } }
  16. So I just needed to make my Instance my modid? @Instance("industrialBreakout") public static mod_IndustrialBreakout instance; ^^^ EDIT: OMG IT WORKS, THANK YOU SOOOO MUCH!!!
  17. I have no idea what you meant by the channel name... Uuhhgg... In the sample of the @Mod thing... What's a channel?
  18. Well, i kind of gathered earlier that that line was the problem but i really have no idea how to change it to match my needs Can you help me with that?
  19. Right... Code... GUI Compressor @SideOnly(Side.CLIENT) public class GuiCompressor extends GuiContainer { private TileEntityCompressor compressorInventory; public GuiCompressor(InventoryPlayer par1InventoryPlayer, TileEntityCompressor par2TileEntityCompressor) { super(new ContainerCompressor(par1InventoryPlayer, par2TileEntityCompressor)); this.compressorInventory = par2TileEntityCompressor; } /** * Draw the foreground layer for the GuiContainer (everything in front of the items) */ protected void drawGuiContainerForegroundLayer(int par1, int par2) { this.fontRenderer.drawString("Compressor", 60, 6, 4210752); this.fontRenderer.drawString("Inventory", 8, this.ySize - 96 + 2, 4210752); } /** * Draw the background layer for the GuiContainer (everything behind the items) */ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { int var4 = this.mc.renderEngine.getTexture("/gui/furnace.png"); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.renderEngine.bindTexture(var4); int var5 = (this.width - this.xSize) / 2; int var6 = (this.height - this.ySize) / 2; this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize); int var7; if (this.compressorInventory.isBurning()) { var7 = this.compressorInventory.getBurnTimeRemainingScaled(12); this.drawTexturedModalRect(var5 + 56, var6 + 36 + 12 - var7, 176, 12 - var7, 14, var7 + 2); } var7 = this.compressorInventory.getCookProgressScaled(24); this.drawTexturedModalRect(var5 + 79, var6 + 34, 176, 14, var7 + 1, 16); } } GUI Handler package IndustrialBreakout.Gui; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import cpw.mods.fml.common.network.IGuiHandler; import IndustrialBreakout.TileEntity.*; import IndustrialBreakout.Containers.*; public class IBGuiHandler implements IGuiHandler { //returns an instance of the Container you made earlier @Override public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity tileEntity = world.getBlockTileEntity(x, y, z); if(tileEntity instanceof TileEntityCompressor){ return new ContainerCompressor(player.inventory, (TileEntityCompressor) tileEntity); } return null; } //returns an instance of the Gui you made earlier @Override public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity tileEntity = world.getBlockTileEntity(x, y, z); if(tileEntity instanceof TileEntityCompressor){ return new GuiCompressor(player.inventory, (TileEntityCompressor) tileEntity); } return null; } } COntainter package IndustrialBreakout.Containers; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import IndustrialBreakout.TileEntity.*; import IndustrialBreakout.Machines.recipes.CompressorRecipes; import IndustrialBreakout.Slot.*; import IndustrialBreakout.*; public class ContainerCompressor extends Container { private TileEntityCompressor compressor; private int lastCookTime = 0; private int lastBurnTime = 0; private int lastItemBurnTime = 0; public ContainerCompressor(InventoryPlayer par1InventoryPlayer, TileEntityCompressor par2TileEntityCompressor) { this.compressor = par2TileEntityCompressor; this.addSlotToContainer(new Slot(par2TileEntityCompressor, 0, 56, 17)); this.addSlotToContainer(new Slot(par2TileEntityCompressor, 1, 56, 53)); this.addSlotToContainer(new SlotCompressor(par1InventoryPlayer.player, par2TileEntityCompressor, 2, 116, 35)); int var3; for (var3 = 0; var3 < 3; ++var3) { for (int var4 = 0; var4 < 9; ++var4) { this.addSlotToContainer(new Slot(par1InventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18)); } } for (var3 = 0; var3 < 9; ++var3) { this.addSlotToContainer(new Slot(par1InventoryPlayer, var3, 8 + var3 * 18, 142)); } } public void addCraftingToCrafters(ICrafting par1ICrafting) { super.addCraftingToCrafters(par1ICrafting); par1ICrafting.sendProgressBarUpdate(this, 0, this.compressor.compressorCookTime); par1ICrafting.sendProgressBarUpdate(this, 1, this.compressor.compressorBurnTime); par1ICrafting.sendProgressBarUpdate(this, 2, this.compressor.currentItemBurnTime); } /** * Looks for changes made in the container, sends them to every listener. */ public void detectAndSendChanges() { super.detectAndSendChanges(); for (int var1 = 0; var1 < this.crafters.size(); ++var1) { ICrafting var2 = (ICrafting)this.crafters.get(var1); if (this.lastCookTime != this.compressor.compressorCookTime) { var2.sendProgressBarUpdate(this, 0, this.compressor.compressorCookTime); } if (this.lastBurnTime != this.compressor.compressorBurnTime) { var2.sendProgressBarUpdate(this, 1, this.compressor.compressorBurnTime); } if (this.lastItemBurnTime != this.compressor.currentItemBurnTime) { var2.sendProgressBarUpdate(this, 2, this.compressor.currentItemBurnTime); } } this.lastCookTime = this.compressor.compressorCookTime; this.lastBurnTime = this.compressor.compressorBurnTime; this.lastItemBurnTime = this.compressor.currentItemBurnTime; } @SideOnly(Side.CLIENT) public void updateProgressBar(int par1, int par2) { if (par1 == 0) { this.compressor.compressorCookTime = par2; } if (par1 == 1) { this.compressor.compressorBurnTime = par2; } if (par1 == 2) { this.compressor.currentItemBurnTime = par2; } } public boolean canInteractWith(EntityPlayer par1EntityPlayer) { return this.compressor.isUseableByPlayer(par1EntityPlayer); } /** * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. */ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { ItemStack var3 = null; Slot var4 = (Slot)this.inventorySlots.get(par2); if (var4 != null && var4.getHasStack()) { ItemStack var5 = var4.getStack(); var3 = var5.copy(); if (par2 == 2) { if (!this.mergeItemStack(var5, 3, 39, true)) { return null; } var4.onSlotChange(var5, var3); } else if (par2 != 1 && par2 != 0) { if (CompressorRecipes.smelting().getSmeltingResult(var5) != null) { if (!this.mergeItemStack(var5, 0, 1, false)) { return null; } } else if (TileEntityCompressor.isItemFuel(var5)) { if (!this.mergeItemStack(var5, 1, 2, false)) { return null; } } else if (par2 >= 3 && par2 < 30) { if (!this.mergeItemStack(var5, 30, 39, false)) { return null; } } else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(var5, 3, 30, false)) { return null; } } else if (!this.mergeItemStack(var5, 3, 39, false)) { return null; } if (var5.stackSize == 0) { var4.putStack((ItemStack)null); } else { var4.onSlotChanged(); } if (var5.stackSize == var3.stackSize) { return null; } var4.onPickupFromSlot(par1EntityPlayer, var5); } return var3; } } Compressor package IndustrialBreakout.Machines; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import IndustrialBreakout.*; import IndustrialBreakout.TileEntity.*; public class BlockIBMachineCompressor extends BlockContainer { /** * Is the random generator used by compressor to drop the inventory contents in random directions. */ private Random compressorRand = new Random(); /** True if this is an active compressor, false if idle */ private final boolean isActive; /** * This flag is used to prevent the compressor inventory to be dropped upon block removal, is used internally when the * compressor block changes from idle to active and vice-versa. */ private static boolean keepCompressorInventory = false; public BlockIBMachineCompressor(int par1, boolean par2) { super(par1, Material.rock); this.isActive = par2; this.blockIndexInTexture = 45; } /** * Returns the ID of the items to drop on destruction. */ public int idDropped(int par1, Random par2Random, int par3) { return Block.stoneOvenIdle.blockID; } /** * Called whenever the block is added into the world. Args: world, x, y, z */ public void onBlockAdded(World par1World, int par2, int par3, int par4) { super.onBlockAdded(par1World, par2, par3, par4); this.setDefaultDirection(par1World, par2, par3, par4); } /** * set a blocks direction */ private void setDefaultDirection(World par1World, int par2, int par3, int par4) { if (!par1World.isRemote) { int var5 = par1World.getBlockId(par2, par3, par4 - 1); int var6 = par1World.getBlockId(par2, par3, par4 + 1); int var7 = par1World.getBlockId(par2 - 1, par3, par4); int var8 = par1World.getBlockId(par2 + 1, par3, par4); byte var9 = 3; if (Block.opaqueCubeLookup[var5] && !Block.opaqueCubeLookup[var6]) { var9 = 3; } if (Block.opaqueCubeLookup[var6] && !Block.opaqueCubeLookup[var5]) { var9 = 2; } if (Block.opaqueCubeLookup[var7] && !Block.opaqueCubeLookup[var8]) { var9 = 5; } if (Block.opaqueCubeLookup[var8] && !Block.opaqueCubeLookup[var7]) { var9 = 4; } par1World.setBlockMetadataWithNotify(par2, par3, par4, var9); } } @SideOnly(Side.CLIENT) /** * Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side */ public int getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { if (par5 == 1) { return this.blockIndexInTexture + 17; } else if (par5 == 0) { return this.blockIndexInTexture + 17; } else { int var6 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); return par5 != var6 ? this.blockIndexInTexture : (this.isActive ? this.blockIndexInTexture + 16 : this.blockIndexInTexture - 1); } } @SideOnly(Side.CLIENT) /** * A randomly called display update to be able to add particles or other items for display */ public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (this.isActive) { int var6 = par1World.getBlockMetadata(par2, par3, par4); float var7 = (float)par2 + 0.5F; float var8 = (float)par3 + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F; float var9 = (float)par4 + 0.5F; float var10 = 0.52F; float var11 = par5Random.nextFloat() * 0.6F - 0.3F; if (var6 == 4) { par1World.spawnParticle("smoke", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D); par1World.spawnParticle("flame", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D); } else if (var6 == 5) { par1World.spawnParticle("smoke", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D); par1World.spawnParticle("flame", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D); } else if (var6 == 2) { par1World.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D); par1World.spawnParticle("flame", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D); } else if (var6 == 3) { par1World.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D); par1World.spawnParticle("flame", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D); } } } /** * Returns the block texture based on the side being looked at. Args: side */ public int getBlockTextureFromSide(int par1) { return par1 == 1 ? this.blockIndexInTexture + 17 : (par1 == 0 ? this.blockIndexInTexture + 17 : (par1 == 3 ? this.blockIndexInTexture - 1 : this.blockIndexInTexture)); } /** * Called upon block activation (right click on the block.) */ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { if (world.isRemote) { return true; } else { player.openGui(mod_IndustrialBreakout.instance, 0, world, x, y, z); } return true; } /** * Update which block ID the compressor is using depending on whether or not it is burning */ public static void updateCompressorBlockState(boolean par0, World par1World, int par2, int par3, int par4) { int var5 = par1World.getBlockMetadata(par2, par3, par4); TileEntity var6 = par1World.getBlockTileEntity(par2, par3, par4); keepCompressorInventory = true; if (par0) { par1World.setBlockWithNotify(par2, par3, par4, Block.stoneOvenActive.blockID); } else { par1World.setBlockWithNotify(par2, par3, par4, Block.stoneOvenIdle.blockID); } keepCompressorInventory = false; par1World.setBlockMetadataWithNotify(par2, par3, par4, var5); if (var6 != null) { var6.validate(); par1World.setBlockTileEntity(par2, par3, par4, var6); } } /** * Returns a new instance of a block's tile entity class. Called on placing the block. */ public TileEntity createNewTileEntity(World par1World) { return new IndustrialBreakout.TileEntity.TileEntityCompressor(); } /** * Called when the block is placed in the world. */ public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving) { int var6 = MathHelper.floor_double((double)(par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; if (var6 == 0) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 2); } if (var6 == 1) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 5); } if (var6 == 2) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 3); } if (var6 == 3) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 4); } } /** * ejects contained items into the world, and notifies neighbours of an update, as appropriate */ public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { if (!keepCompressorInventory) { TileEntityCompressor var7 = (TileEntityCompressor)par1World.getBlockTileEntity(par2, par3, par4); if (var7 != null) { for (int var8 = 0; var8 < var7.getSizeInventory(); ++var8) { ItemStack var9 = var7.getStackInSlot(var8); if (var9 != null) { float var10 = this.compressorRand.nextFloat() * 0.8F + 0.1F; float var11 = this.compressorRand.nextFloat() * 0.8F + 0.1F; float var12 = this.compressorRand.nextFloat() * 0.8F + 0.1F; while (var9.stackSize > 0) { int var13 = this.compressorRand.nextInt(21) + 10; if (var13 > var9.stackSize) { var13 = var9.stackSize; } var9.stackSize -= var13; EntityItem var14 = new EntityItem(par1World, (double)((float)par2 + var10), (double)((float)par3 + var11), (double)((float)par4 + var12), new ItemStack(var9.itemID, var13, var9.getItemDamage())); if (var9.hasTagCompound()) { var14.func_92014_d().setTagCompound((NBTTagCompound)var9.getTagCompound().copy()); } float var15 = 0.05F; var14.motionX = (double)((float)this.compressorRand.nextGaussian() * var15); var14.motionY = (double)((float)this.compressorRand.nextGaussian() * var15 + 0.2F); var14.motionZ = (double)((float)this.compressorRand.nextGaussian() * var15); par1World.spawnEntityInWorld(var14); } } } } } super.breakBlock(par1World, par2, par3, par4, par5, par6); } } SlotCompressor package IndustrialBreakout.Slot; import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.stats.AchievementList; import net.minecraft.util.MathHelper; import cpw.mods.fml.common.registry.GameRegistry; import IndustrialBreakout.*; public class SlotCompressor extends Slot { /** The player that is using the GUI where this slot resides. */ private EntityPlayer thePlayer; private int field_75228_b; public SlotCompressor(EntityPlayer par1EntityPlayer, IInventory par2IInventory, int par3, int par4, int par5) { super(par2IInventory, par3, par4, par5); this.thePlayer = par1EntityPlayer; } /** * Check if the stack is a valid item for this slot. Always true beside for the armor slots. */ public boolean isItemValid(ItemStack par1ItemStack) { return false; } /** * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new * stack. */ public ItemStack decrStackSize(int par1) { if (this.getHasStack()) { this.field_75228_b += Math.min(par1, this.getStack().stackSize); } return super.decrStackSize(par1); } public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack) { this.onCrafting(par2ItemStack); super.onPickupFromSlot(par1EntityPlayer, par2ItemStack); } /** * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an * internal count then calls onCrafting(item). */ protected void onCrafting(ItemStack par1ItemStack, int par2) { this.field_75228_b += par2; this.onCrafting(par1ItemStack); } /** * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. */ protected void onCrafting(ItemStack par1ItemStack) { par1ItemStack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.field_75228_b); this.field_75228_b = 0; GameRegistry.onItemSmelted(thePlayer, par1ItemStack); } } TileEntityCompressor package IndustrialBreakout.TileEntity; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.item.ItemTool; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ISidedInventory; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import IndustrialBreakout.*; import IndustrialBreakout.Machines.*; import IndustrialBreakout.Machines.recipes.CompressorRecipes; public class TileEntityCompressor extends TileEntity implements IInventory, ISidedInventory { /** * The ItemStacks that hold the items currently being used in the compressor */ private ItemStack[] compressorItemStacks = new ItemStack[3]; /** The number of ticks that the compressor will keep burning */ public int compressorBurnTime = 0; /** * The number of ticks that a fresh copy of the currently-burning item would keep the compressor burning for */ public int currentItemBurnTime = 0; /** The number of ticks that the current item has been cooking for */ public int compressorCookTime = 0; /** * Returns the number of slots in the inventory. */ public int getSizeInventory() { return this.compressorItemStacks.length; } /** * Returns the stack in slot i */ public ItemStack getStackInSlot(int par1) { return this.compressorItemStacks[par1]; } /** * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a * new stack. */ public ItemStack decrStackSize(int par1, int par2) { if (this.compressorItemStacks[par1] != null) { ItemStack var3; if (this.compressorItemStacks[par1].stackSize <= par2) { var3 = this.compressorItemStacks[par1]; this.compressorItemStacks[par1] = null; return var3; } else { var3 = this.compressorItemStacks[par1].splitStack(par2); if (this.compressorItemStacks[par1].stackSize == 0) { this.compressorItemStacks[par1] = null; } return var3; } } else { return null; } } /** * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - * like when you close a workbench GUI. */ public ItemStack getStackInSlotOnClosing(int par1) { if (this.compressorItemStacks[par1] != null) { ItemStack var2 = this.compressorItemStacks[par1]; this.compressorItemStacks[par1] = null; return var2; } else { return null; } } /** * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). */ public void setInventorySlotContents(int par1, ItemStack par2ItemStack) { this.compressorItemStacks[par1] = par2ItemStack; if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) { par2ItemStack.stackSize = this.getInventoryStackLimit(); } } /** * Returns the name of the inventory. */ public String getInvName() { return "container.compressor"; } public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); NBTTagList var2 = par1NBTTagCompound.getTagList("Items"); this.compressorItemStacks = new ItemStack[this.getSizeInventory()]; for (int var3 = 0; var3 < var2.tagCount(); ++var3) { NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3); byte var5 = var4.getByte("Slot"); if (var5 >= 0 && var5 < this.compressorItemStacks.length) { this.compressorItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4); } } this.compressorBurnTime = par1NBTTagCompound.getShort("BurnTime"); this.compressorCookTime = par1NBTTagCompound.getShort("CookTime"); this.currentItemBurnTime = getItemBurnTime(this.compressorItemStacks[1]); } public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); par1NBTTagCompound.setShort("BurnTime", (short)this.compressorBurnTime); par1NBTTagCompound.setShort("CookTime", (short)this.compressorCookTime); NBTTagList var2 = new NBTTagList(); for (int var3 = 0; var3 < this.compressorItemStacks.length; ++var3) { if (this.compressorItemStacks[var3] != null) { NBTTagCompound var4 = new NBTTagCompound(); var4.setByte("Slot", (byte)var3); this.compressorItemStacks[var3].writeToNBT(var4); var2.appendTag(var4); } } par1NBTTagCompound.setTag("Items", var2); } /** * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't * this more of a set than a get?* */ public int getInventoryStackLimit() { return 64; } @SideOnly(Side.CLIENT) /** * Returns an integer between 0 and the passed value representing how close the current item is to being completely * cooked */ public int getCookProgressScaled(int par1) { return this.compressorCookTime * par1 / 200; } @SideOnly(Side.CLIENT) /** * Returns an integer between 0 and the passed value representing how much burn time is left on the current fuel * item, where 0 means that the item is exhausted and the passed value means that the item is fresh */ public int getBurnTimeRemainingScaled(int par1) { if (this.currentItemBurnTime == 0) { this.currentItemBurnTime = 200; } return this.compressorBurnTime * par1 / this.currentItemBurnTime; } /** * Returns true if the compressor is currently burning */ public boolean isBurning() { return this.compressorBurnTime > 0; } /** * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count * ticks and creates a new spawn inside its implementation. */ public void updateEntity() { boolean var1 = this.compressorBurnTime > 0; boolean var2 = false; if (this.compressorBurnTime > 0) { --this.compressorBurnTime; } if (!this.worldObj.isRemote) { if (this.compressorBurnTime == 0 && this.canSmelt()) { this.currentItemBurnTime = this.compressorBurnTime = getItemBurnTime(this.compressorItemStacks[1]); if (this.compressorBurnTime > 0) { var2 = true; if (this.compressorItemStacks[1] != null) { --this.compressorItemStacks[1].stackSize; if (this.compressorItemStacks[1].stackSize == 0) { this.compressorItemStacks[1] = this.compressorItemStacks[1].getItem().getContainerItemStack(compressorItemStacks[1]); } } } } if (this.isBurning() && this.canSmelt()) { ++this.compressorCookTime; if (this.compressorCookTime == 200) { this.compressorCookTime = 0; this.smeltItem(); var2 = true; } } else { this.compressorCookTime = 0; } if (var1 != this.compressorBurnTime > 0) { var2 = true; BlockIBMachineCompressor.updateCompressorBlockState(this.compressorBurnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord); } } if (var2) { this.onInventoryChanged(); } } /** * Returns true if the compressor can smelt an item, i.e. has a source item, destination stack isn't full, etc. */ private boolean canSmelt() { if (this.compressorItemStacks[0] == null) { return false; } else { ItemStack var1 = CompressorRecipes.smelting().getSmeltingResult(this.compressorItemStacks[0]); if (var1 == null) return false; if (this.compressorItemStacks[2] == null) return true; if (!this.compressorItemStacks[2].isItemEqual(var1)) return false; int result = compressorItemStacks[2].stackSize + var1.stackSize; return (result <= getInventoryStackLimit() && result <= var1.getMaxStackSize()); } } /** * Turn one item from the compressor source stack into the appropriate smelted item in the compressor result stack */ public void smeltItem() { if (this.canSmelt()) { ItemStack var1 = CompressorRecipes.smelting().getSmeltingResult(this.compressorItemStacks[0]); if (this.compressorItemStacks[2] == null) { this.compressorItemStacks[2] = var1.copy(); } else if (this.compressorItemStacks[2].isItemEqual(var1)) { compressorItemStacks[2].stackSize += var1.stackSize; } --this.compressorItemStacks[0].stackSize; if (this.compressorItemStacks[0].stackSize <= 0) { this.compressorItemStacks[0] = null; } } } /** * Returns the number of ticks that the supplied fuel item will keep the compressor burning, or 0 if the item isn't * fuel */ public static int getItemBurnTime(ItemStack par0ItemStack) { if (par0ItemStack == null) { return 0; } else { int var1 = par0ItemStack.getItem().itemID; Item var2 = par0ItemStack.getItem(); if (par0ItemStack.getItem() instanceof ItemBlock && Block.blocksList[var1] != null) { Block var3 = Block.blocksList[var1]; if (var3 == Block.woodSingleSlab) { return 150; } if (var3.blockMaterial == Material.wood) { return 300; } } if (var2 instanceof ItemTool && ((ItemTool) var2).getToolMaterialName().equals("WOOD")) return 200; if (var2 instanceof ItemSword && ((ItemSword) var2).func_77825_f().equals("WOOD")) return 200; if (var2 instanceof ItemHoe && ((ItemHoe) var2).func_77842_f().equals("WOOD")) return 200; if (var1 == Item.stick.itemID) return 100; if (var1 == Item.coal.itemID) return 1600; if (var1 == Item.bucketLava.itemID) return 20000; if (var1 == Block.sapling.blockID) return 100; if (var1 == Item.blazeRod.itemID) return 2400; return GameRegistry.getFuelValue(par0ItemStack); } } /** * Return true if item is a fuel source (getItemBurnTime() > 0). */ public static boolean isItemFuel(ItemStack par0ItemStack) { return getItemBurnTime(par0ItemStack) > 0; } /** * Do not make give this method the name canInteractWith because it clashes with Container */ public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; } public void openChest() {} public void closeChest() {} @Override public int getStartInventorySide(ForgeDirection side) { if (side == ForgeDirection.DOWN) return 1; if (side == ForgeDirection.UP) return 0; return 2; } @Override public int getSizeInventorySide(ForgeDirection side) { return 1; } } Main Mod File package IndustrialBreakout; import IndustrialBreakout.Gui.IBGuiHandler; import IndustrialBreakout.Machines.BlockIBMachineCompressor; import IndustrialBreakout.blocks.BlockIB; import IndustrialBreakout.items.ItemIB; import IndustrialBreakout.items.ItemIBAxe; import IndustrialBreakout.items.ItemIBHoe; import IndustrialBreakout.items.ItemIBPickaxe; import IndustrialBreakout.items.ItemIBShovel; import IndustrialBreakout.items.ItemIBSword; import IndustrialBreakout.proxy.CommonProxy; import IndustrialBreakout.world.WorldGeneratorIB; import IndustrialBreakout.TileEntity.*; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.EnumHelper; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; import IndustrialBreakout.reference.*; @Mod(modid = "industrialBreakout", name="Industrial Breakout", version="0.1 Beta") @NetworkMod(clientSideRequired=true) public class mod_IndustrialBreakout { public static WorldGeneratorIB worldGen = new WorldGeneratorIB(); @Instance("mod_IndustrialBreakout") public static mod_IndustrialBreakout instance; @SidedProxy(clientSide="IndustrialBreakout.proxy.ClientProxy", serverSide="IndustrialBreakout.proxy.CommonProxy") public static CommonProxy proxy; @PreInit public void preInit(FMLPreInitializationEvent event) { // Stub Method } @Init public void load(FMLInitializationEvent event) { proxy.registerRenderers(); NetworkRegistry.instance().registerGuiHandler(this, new IBGuiHandler()); GameRegistry.registerWorldGenerator(worldGen); fml(); craft(); smelt(); name(); register(); } public void fml(){ MinecraftForge.setBlockHarvestLevel(oreTitanium, "pickaxe", 2); MinecraftForge.setBlockHarvestLevel(oreChargedCoal, "pickaxe", 2); MinecraftForge.setBlockHarvestLevel(compressedCobble, "pickaxe", 1); MinecraftForge.setBlockHarvestLevel(compressedStone, "pickaxe", 1); MinecraftForge.setBlockHarvestLevel(oreTin, "pickaxe", 2); MinecraftForge.setBlockHarvestLevel(oreCopper, "pickaxe", 1); } public void craft(){ GameRegistry.addRecipe(new ItemStack(compressedCobble, 1), new Object[] {"###", "###", "###", '#', Block.cobblestone}); GameRegistry.addRecipe(new ItemStack(compressedStone, 1), new Object[] {"###", "###", "###", '#', Block.stone}); GameRegistry.addRecipe(new ItemStack(ingotBronze, 4), new Object[] {"##", "#$", '#', ingotCopper, '$', ingotTin}); } public void smelt(){ GameRegistry.addSmelting(oreTitanium.blockID, new ItemStack(ingotTitanium, 1), 1.0F); GameRegistry.addSmelting(oreTin.blockID, new ItemStack(ingotTin, 1), 1.0F); GameRegistry.addSmelting(oreCopper.blockID, new ItemStack(ingotCopper, 1), 1.0F); GameRegistry.addSmelting(compressedCobble.blockID, new ItemStack(compressedStone, 1), 0.0F); } public void name(){ //Blocks LanguageRegistry.addName(compressedCobble, "Compressed Cobblestosne"); LanguageRegistry.addName(compressedStone, "Compressed Stone"); LanguageRegistry.addName(oreTitanium, "Titanium Ore"); LanguageRegistry.addName(oreChargedCoal, "Charged Coal Ore"); LanguageRegistry.addName(oreTin, "Tin Ore"); LanguageRegistry.addName(oreCopper, "Copper Ore"); LanguageRegistry.addName(blockCopper, "Copper Block"); LanguageRegistry.addName(blockTin, "Tin Block"); LanguageRegistry.addName(machineCompressorIdle, "Idle Compressor"); LanguageRegistry.addName(machineCompressorActive, "Active Compressor"); //Items LanguageRegistry.addName(ingotTitanium, "Titanium Ingot"); LanguageRegistry.addName(chargedCoal, "Charged Coal"); LanguageRegistry.addName(pickaxeTitanium, "Titanium Pickaxe"); LanguageRegistry.addName(adminPickaxe, "Pickaxe of the Admin"); LanguageRegistry.addName(ingotTin, "Tin Ingot"); LanguageRegistry.addName(ingotCopper, "Copper Ingot"); LanguageRegistry.addName(ingotBronze, "Bronze Ingot"); LanguageRegistry.addName(pickaxeBronze, "Bronze Pickaxe"); LanguageRegistry.addName(axeBronze, "Bronze Axe"); LanguageRegistry.addName(swordBronze, "Bronze Sword"); LanguageRegistry.addName(shovelBronze, "Bronze Shovel"); LanguageRegistry.addName(hoeBronze, "Bronze Hoe"); } public void register(){ //Blocks GameRegistry.registerBlock(compressedCobble, "Compressed Cobble"); GameRegistry.registerBlock(compressedStone, "Compressed Stone"); GameRegistry.registerBlock(oreTitanium, "Titanium Ore"); GameRegistry.registerBlock(oreChargedCoal, "Charged Coal Ore"); GameRegistry.registerBlock(oreTin, "Tin Ore"); GameRegistry.registerBlock(oreCopper, "Copper Ore"); GameRegistry.registerBlock(blockCopper, "Copper Block"); GameRegistry.registerBlock(blockTin, "Tin Block"); GameRegistry.registerBlock(machineCompressorIdle, "Idle Compressor"); GameRegistry.registerBlock(machineCompressorActive, "Active Compressor"); //Items GameRegistry.registerItem(ingotTitanium, "Titanium Ingot"); GameRegistry.registerItem(chargedCoal, "Charged Coal"); GameRegistry.registerItem(pickaxeTitanium, "Titanium Pickaxe"); GameRegistry.registerItem(adminPickaxe, "Pickaxe of the Admin"); GameRegistry.registerItem(ingotTin, "Tin Ingot"); GameRegistry.registerItem(ingotCopper, "Copper Ingot"); GameRegistry.registerItem(ingotBronze, "Bronze Ingot"); GameRegistry.registerItem(pickaxeBronze, "Bronze Pickaxe"); GameRegistry.registerItem(axeBronze, "Bronze Axe"); GameRegistry.registerItem(swordBronze, "Bronze Sword"); GameRegistry.registerItem(shovelBronze, "Bronze Shovel"); GameRegistry.registerItem(hoeBronze, "Bronze Hoe"); //Tile Entities GameRegistry.registerTileEntity(TileEntityCompressor.class, "Compressor"); } //Tool Materials public static EnumToolMaterial Titanium = EnumHelper.addToolMaterial("titanium", 2, 2000, 7.0F, 3, 16); public static EnumToolMaterial Bronze = EnumHelper.addToolMaterial("bronze", 2, 512, 6.0F, 3, 10); //Armor Materials //Items public static final Item ingotTitanium = (new ItemIB(200, 0)).setItemName("ingotTitanium").setCreativeTab(CreativeTabs.tabMaterials); public static final Item chargedCoal = (new ItemIB(201, 1)).setItemName("chargedCoal").setCreativeTab(CreativeTabs.tabMaterials); public static final Item pickaxeTitanium = (new ItemIBPickaxe(202, 2, Titanium)).setItemName("pickaxeTitanium"); public static final Item adminPickaxe = (new ItemIBPickaxe(203, 3, EnumHelper.addToolMaterial("adminPick", 4, -1, 100.0F, 20, 100))).setItemName("adminPickaxe"); public static final Item ingotTin = (new ItemIB(204, 4)).setItemName("ingotTin").setCreativeTab(CreativeTabs.tabMaterials); public static final Item ingotCopper = (new ItemIB(205, 5)).setItemName("ingotCopper").setCreativeTab(CreativeTabs.tabMaterials); public static final Item ingotBronze = (new ItemIB(206, 6)).setItemName("ingotBronze").setCreativeTab(CreativeTabs.tabMaterials); public static final Item pickaxeBronze = (new ItemIBPickaxe(207, 7, Bronze)).setItemName("pickaxeBronze"); public static final Item axeBronze = (new ItemIBAxe(208, 8, Bronze)).setItemName("axeBronze"); public static final Item swordBronze = (new ItemIBSword(209, 9, Bronze)).setItemName("swordBronze"); public static final Item shovelBronze = (new ItemIBShovel(210, 10, Bronze)).setItemName("shovelBronze"); public static final Item hoeBronze = (new ItemIBHoe(211, 11, Bronze)).setItemName("hoeBronze"); //Blocks public static final Block compressedCobble = new BlockIB(200, 0, Material.rock).setHardness(4.0F).setResistance(6.0F).setBlockName("compressedCobble").setCreativeTab(CreativeTabs.tabBlock); public static final Block compressedStone = new BlockIB(201, 1, Material.rock).setHardness(4.0F).setResistance(6.0F).setBlockName("compressedStone").setCreativeTab(CreativeTabs.tabBlock); public static final Block oreTitanium = new BlockIB(202, 2, Material.iron).setHardness(5.0F).setResistance(7.0F).setBlockName("oreTitanium").setCreativeTab(CreativeTabs.tabBlock); public static final Block oreChargedCoal = new BlockIB(203, 3, Material.iron).setHardness(5.0F).setResistance(7.0F).setBlockName("oreChargedCoal").setCreativeTab(CreativeTabs.tabBlock); public static final Block oreTin = new BlockIB(204, 4, Material.iron).setHardness(6.0F).setResistance(10.0F).setBlockName("oreTin").setCreativeTab(CreativeTabs.tabBlock); public static final Block oreCopper = new BlockIB(205, 5, Material.iron).setHardness(6.0F).setResistance(9.0F).setBlockName("oreCopper").setCreativeTab(CreativeTabs.tabBlock); public static final Block blockCopper = new BlockIB(208, 6, Material.iron).setHardness(7.0F).setResistance(10.0F).setBlockName("blockCopper").setCreativeTab(CreativeTabs.tabBlock); public static final Block blockTin = new BlockIB(209, 7, Material.iron).setHardness(8.0F).setResistance(11.0F).setBlockName("blockTin").setCreativeTab(CreativeTabs.tabBlock); //Machines public static final Block machineCompressorIdle = (new BlockIBMachineCompressor(210, false)).setHardness(10.0F).setResistance(7.0F).setBlockName("machineCompressorIdle").setCreativeTab(CreativeTabs.tabBlock); public static final Block machineCompressorActive = (new BlockIBMachineCompressor(211, true)).setHardness(10.0F).setResistance(7.0F).setBlockName("machineCompressorActive").setCreativeTab(CreativeTabs.tabBlock).setLightValue(1.0F); //public static final Block machineExtractorIdle = (new BlockIBMachine(208, false, 2)).setHardness(11.0F).setResistance(7.0F).setBlockName("machineExtractorIdle").setCreativeTab(CreativeTabs.tabBlock); //public static final Block machineExtractorActive = (new BlockIBMachine(209, true, 3)).setHardness(11.0F).setResistance(7.0F).setBlockName("machineExtractorActive").setCreativeTab(CreativeTabs.tabBlock).setLightValue(1.0F); //Special Items //Armor //public static final Item helmetBronze = (new ItemIBArmor(212, 12, 4)).setBlockName("helmetBronze") //public static final Item chestplateBronze = (new ItemIBArmor(213, 13, 3)).setBlockName("chestplateBronze") //public static final Item leggingsBronze = (new ItemIBArmor(214, 14, 2)).setBlockName("leggingsBronze") //public static final Item bootsBronze = (new ItemIBArmor(215, 15, 1)).setBlockName("bootsBronze") } --Vemahk20
  20. Ok, so i have my tile entity, gui handler, container, slot, etc for my custom compressor type thing but whenever i right click on it in game the console 'yells' at me for not being a network mod. Any help would be good on fixing 'not being a network mod', I have no idea what it means by that or how to fix it. -- Vemahk20
  21. Simply that ^^^. Ill paste my generation code here... package IndustrialBreakout.world; import java.util.Random; import IndustrialBreakout.mod_IndustrialBreakout; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import cpw.mods.fml.common.IWorldGenerator; public class WorldGeneratorIB implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { for(int i=10;i<=32;i++){ world.setBlock(chunkX*16 + random.nextInt(16), i, chunkZ*16 + random.nextInt(16), mod_IndustrialBreakout.oreTitanium.blockID); } for(int i = 32; i <= 64; i++){ world.setBlock(chunkX*16 + random.nextInt(16), i, chunkZ*16 + random.nextInt(16), mod_IndustrialBreakout.oreCopper.blockID); } for(int i = 10; i <= 32; i++){ world.setBlock(chunkX*16 + random.nextInt(16), i, chunkZ*16 + random.nextInt(16), mod_IndustrialBreakout.oreTin.blockID); } for(int i = 5; i <= 16; i++){ world.setBlock(chunkX*16 + random.nextInt(16), i, chunkZ*16 + random.nextInt(16), mod_IndustrialBreakout.oreChargedCoal.blockID); } } }
  22. The 3rd and 4th line down from 'java.lang.NullPointerException' in the crash report suggest that the error occured in your program on the 13th line of azuritePickaxe.java on the init command (whatever that is, as far as i am conserned that only occurs in the main mod file but it could be a different init) and on line 75 of motools.java when running the load void/function. Not having the full java file, i really cant help you other then saying that something is wrong which is obviosly apparent. If you can paste said lines of the code then i think that i can help you a bit more
  23. As far as i am concerned, the major part of the update in 1.5.1 was the way minecraft has linked itself to the textures and it completely changed the ways modders had to do it as well. I just recently started updating to 1.5.1 and i have not read enough, or havent looked in the right place, to get my textures to work again. if someone could guide me to a tutorial for the 1.5.1 texturing or just tell me that would be great -- Thanks!
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.