Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Eractnod

Members
  • Joined

  • Last visited

Everything posted by Eractnod

  1. In 1.7.10 I used useneighborlightlevel = true. Or something close to that. On my phone so don't have access to my code.
  2. I too got a NPE when returning null in my gui handler for the container. I found that it was giving me the NPE due to no slots in the container, even though I was not calling it. I changed my block class from extending BlockContainer to just extend Block. Then I didn't need to worry about the container I wasn't using anyway.
  3. Caused by me doing something stupid in my coding. Just because you set the container to return null in the GUI handler doesn't mean you can't leave the container blank. Figured out how to remove that container and all is working as expected.
  4. I think this might have something to do with the actual world. I created another server and moved in the mods one at a time. No crash. Swapped in the bad world on the new server files and got it to crash. Created a new server world, placed 3 elevators and no crashing at this time. EDIT: had nothing to do with the world. I am now crashing on any world. Happens only if there is something equipped in any armor slot. Would this be a player client/server sync issue?
  5. I have my own modded server using forge build 1207. Only have a couple of mods and most are mine. The client crashes when they use an elevator, then are hit by a mob causing damage. I am getting an index out of bounds. I can play single player with no issues and can open up a lan world with no issues as well. Only when I connect to a server. Very repeatable when using the elevator. fml-client-latest on paste bin broken up in 6 pastes to make it work. http://pastebin.com/9aghdQhv http://pastebin.com/49XB320m http://pastebin.com/zmW3F27v http://pastebin.com/WS4z3ZYB http://pastebin.com/GDV63mw1 http://pastebin.com/a738hrfh
  6. I am looking for some tutorials on how to setup a config file. In particular, I need a config file where a user will enter blocks that should not be used to make an elevator shaft. Config would be like minecraft:gold_block; minecraft:diamond_block; modid:mod_block. These values would then be compared to a slot itemstack and if match, set isItemValid(ItemStack stack) to false. My config file at present looks like this, with the console output added. # Configuration file general { S:disallowedblocks=minecraft:gold_block;minecraft:iron_block;minecraft:emerald_block;minecraft:redstone_block } minecraft:gold_block minecraft:iron_block minecraft:emerald_block minecraft:redstone_block To read the file in, I have Configuration Config = new Configuration(event.getSuggestedConfigurationFile()); Config.load(); String bandBlocks = Config.get(Configuration.CATEGORY_GENERAL,"disallowBlocks", "").getString(); EVarInit.bandBlocksArray = bandBlocks.split(";"); for(int i = 0; i < EVarInit.bandBlocksArray.length; i++){ System.out.println(EVarInit.bandBlocksArray[i]); } if (Config.hasChanged()){ Config.save(); } Where I am running into a problem is comparing the string EVarInit.bandBlockArray with an ItemStack. EDIT: Solution No changes made to the config portion. Here is the code in the isItemValid method @Override public boolean isItemValid(ItemStack itemStack) { if (itemStack.getItem() instanceof ItemBlock){ if (itemStack != null){ String str = Item.itemRegistry.getNameForObject(itemStack.getItem()); if(itemStack.getHasSubtypes()) str = str + " " + itemStack.getItemDamage(); if(itemStack.hasTagCompound()){ str = str + " " + itemStack.stackTagCompound.toString(); } for(int ii = 0; ii < EVarInit.bandBlocksArray.length; ii++){ if (str.equals(EVarInit.bandBlocksArray[ii])){ return false; } } //Hardcode in the removal of diamond block and diamond ore if (itemStack.getItem() == new ItemStack(Blocks.diamond_block).getItem() || itemStack.getItem() == new ItemStack(Blocks.diamond_ore).getItem()){ return false; } return true; } } return false; }
  7. I was thinking about going that route. Make the floor into a 9 block entity that mimic's the boat or minecart, then set ridable to true. That would mean a 3rd re-write of this mod. (and of coarse I am most likely going to do it as it would mean learning something new), but not at this time. The first writing was with 2 tile entitys. One for the elevator shaft and one placed upto 15 times for making the call and floor buttons. Started to be a nightmare syncing all the data between the two tile entities. The second writing removed the second tile entity and now just places a block with meta data, and this block then calls the gui for call and floor buttons. Everything is then stored in the one tile entity. Made it easier to set and save each floor location during the build of the shaft.
  8. Thank you for the replies. Between the two answers I was able to get my ServerTickHandler to work to add the delay. However I have come to the conclusion that the jerky movement would cause too many headaches. So will do without until I can figure out 1/4 or 1/8 block steps. Would make the movement less choppy. Now to add Elevator music while you are in the elevator. Tickhandler code public class ServerTickHandler { public int timer; public ServerTickHandler(){ this.timer = 12000; } @SubscribeEvent public int onServerTick(TickEvent.ServerTickEvent event){ timer--; if (timer == 0){ timer = 12000; } return timer; } } And what I added to the TE. ServerTickHandler handler = new ServerTickHandler(); int tick; do{ tick = handler.onServerTick(null); }while (tick != 1);
  9. Could you place in your onBlockActivated method of your master block a check TileEnitity te = world.getTileEntity(x, y, z) if(!world.isRemote){ if (muiltiblockStructure()){ open gui } } Then create a method called boolean multiBlockStructure(). Set the tile block there as meta zero. Create the mutliblock around it uing for loops or just setBlock(x, y, z, gagBlock, meta, flag).. Gag block can be normal block or a vanilla block. Return true if the structure is correct. This way only one tile entity at X, Y, and Z.
  10. My latest project has been to make an Elevator for Minecraft. Have learned a lot doing so with respect to Tile entities, packet handling, and gui's and I know that I can learn more. Everything works well but one thing. The floor movement up and down moves too fast. I would like to slow it down, so it feels like a real elevator moving up and down. Attached is my TE that has all the movement code in it. I am looking for some suggestions on how to place a few second delay between each step of the Y axis movement as the floor and players move up and down. The method startFloorCall is at the bottom of the code. The method is called from within the updateEntity() method when floorCall = true. 1. Tried just a simple counter loop. No change. 2. Tried a tick handler server side. Seemed to work for the floor, but not the players. Are player movements client side, server side, or both. If client side, would explain why this did not work. 3. Tried to add a timer to the updateEntity() in the TE, but the timer would never update when I was within my method. If I could get this to work, would be best for cpu time. package com.eractnod.elevator.tileentity; import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; 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.AxisAlignedBB; import net.minecraft.world.World; public class TileEntityCreateElevator extends TileEntity implements IInventory{ private ItemStack[] inv; private String customName; public String numberOfFloors; public String numberBetweenFloors; public String direction; private boolean floors = false; public int[] floorX = new int[16]; public int[] floorY = new int[16]; public int[] floorZ = new int[16]; public int[] floorNum = new int[16]; public int currentFloor; public int calledFloor; public boolean performCall = false; public boolean floorCall = false; public TileEntityCreateElevator(){ inv = new ItemStack[2]; } @Override public int getSizeInventory() { return inv.length; } @Override public ItemStack getStackInSlot(int slot) { return inv[slot]; } @Override public ItemStack decrStackSize(int slot, int amount) { ItemStack stack = getStackInSlot(slot); if (stack != null) { if (stack.stackSize <= amount) { setInventorySlotContents(slot, null); } else { stack = stack.splitStack(amount); if (stack.stackSize == 0) { setInventorySlotContents(slot, null); } } } return stack; } @Override public ItemStack getStackInSlotOnClosing(int slot) { ItemStack stack = getStackInSlot(slot); if (stack != null) { setInventorySlotContents(slot, null); } return stack; } @Override public void setInventorySlotContents(int slot, ItemStack stack) { inv[slot] = stack; if (stack != null && stack.stackSize > getInventoryStackLimit()) { stack.stackSize = getInventoryStackLimit(); } } @Override public String getInventoryName() { return null; } @Override public boolean hasCustomInventoryName() { return false; } @Override public int getInventoryStackLimit() { return 1; } @Override public boolean isUseableByPlayer(EntityPlayer player) { return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64; } @Override public void openInventory() { } @Override public void closeInventory() { } @Override public boolean isItemValidForSlot(int slot, ItemStack stack) { return true; } public void updateEntity(){ if (performCall){ System.out.println("yobo"); startCall(calledFloor, worldObj); this.setCurrent(calledFloor); this.currentFloor = calledFloor; performCall = false; worldObj.markBlockForUpdate(floorX[0], floorY[0], floorZ[0]); } if(!worldObj.isRemote){ if (floorCall){ System.out.println("yobo2"); startFloorCall(calledFloor, worldObj); this.setCurrent(calledFloor); floorCall = false; worldObj.markBlockForUpdate(floorX[0], floorY[0], floorZ[0]); } } } public void setFloors(String a, String b, String c){ numberOfFloors = a; numberBetweenFloors = b; direction = c; } public ItemStack getFloorItemStack(){ return inv[0]; } public String getFloors(){ return numberOfFloors; } public String getBetween(){ return numberBetweenFloors; } public String getDirection(){ return direction; } public void setFloorLocations(int x, int y, int z, int metaCall) { System.out.println("x " + x + " y " + y + " z " + z + " meta " + metaCall); this.floorX[metaCall] = x; this.floorY[metaCall] = y; this.floorZ[metaCall] = z; } public void setCurrent(int meta){ this.currentFloor = meta; } public int getCurrent(){ return currentFloor; } public void setPerformCall(int calledFloor, boolean performCall, boolean floorCall) { this.calledFloor = calledFloor; this.performCall = performCall; this.floorCall = floorCall; } public int getFloorCalled(){ return this.calledFloor; } public boolean getPerformCall(){ return this.performCall; } public boolean getNextFloor(){ return this.floorCall; } /** * Reads a tile entity from NBT. */ public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); NBTTagList nbttaglist = nbt.getTagList("Items", 10); this.inv = new ItemStack[this.getSizeInventory()]; if (nbt.hasKey("NumberFloors")){ numberOfFloors = nbt.getString("NumberFloors"); } if (nbt.hasKey("NumberBetween")){ numberBetweenFloors = nbt.getString("NumberBetween"); } if (nbt.hasKey("Direction")){ direction = nbt.getString("Direction"); } if (nbt.hasKey("name")) { this.customName = nbt.getString("name"); } for (int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttaglist.getCompoundTagAt(i); int j = nbttagcompound1.getByte("Slot") & 255; if (j >= 0 && j < this.inv.length) { this.inv[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } for (int i = 0; i < floorX.length; i++){ this.floorX[i] = nbt.getInteger("floorX" + i); this.floorY[i] = nbt.getInteger("floorY" + i); this.floorZ[i] = nbt.getInteger("floorZ" + i); } this.currentFloor = nbt.getInteger("current"); this.calledFloor = nbt.getInteger("calledfloor"); this.performCall = nbt.getBoolean("performcall"); this.floorCall = nbt.getBoolean("floorcall"); } /** * Writes a tile entity to NBT. */ public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.inv.length; ++i) { if (this.inv[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte)i); this.inv[i].writeToNBT(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1); } } nbt.setTag("Items", nbttaglist); if (this.hasCustomInventoryName()) { nbt.setString("name", this.customName); } if (numberOfFloors != null){ nbt.setString("NumberFloors", numberOfFloors); } if (numberBetweenFloors != null){ nbt.setString("NumberBetween", numberBetweenFloors); } if (direction != null){ nbt.setString("Direction", direction); } for (int i = 0; i < floorX.length; i++){ nbt.setInteger("floorX" + i, this.floorX[i]); nbt.setInteger("floorY" + i, this.floorY[i]); nbt.setInteger("floorZ" + i, this.floorZ[i]); } nbt.setInteger("current", currentFloor); nbt.setInteger("calledfloor", calledFloor); nbt.setBoolean("performcall", performCall); nbt.setBoolean("floorcall", floorCall); } /** * Called when you receive a TileEntityData packet for the location this * TileEntity is currently in. On the client, the NetworkManager will always * be the remote server. On the server, it will be whomever is responsible for * sending the packet. * * @param net The NetworkManager the packet originated from * @param pkt The data packet */ // Client Server Sync @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { NBTTagCompound nbt = pkt.func_148857_g(); numberOfFloors = nbt.getString("NumberFloors"); numberBetweenFloors = nbt.getString("NumberBetween"); direction = nbt.getString("Direction"); for (int i = 0; i < floorX.length; i++){ floorX[i] = nbt.getInteger("floorX" + i); floorY[i] = nbt.getInteger("floorY" + i); floorZ[i] = nbt.getInteger("floorZ" + i); } this.currentFloor = nbt.getInteger("current"); this.calledFloor = nbt.getInteger("calledfloor"); this.performCall = nbt.getBoolean("performcall"); this.floorCall = nbt.getBoolean("floorcall"); } @Override public Packet getDescriptionPacket() { NBTTagCompound nbt = new NBTTagCompound(); if (numberOfFloors != null){ nbt.setString("NumberFloors", numberOfFloors); } if (numberBetweenFloors != null){ nbt.setString("NumberBetween", numberBetweenFloors); } if (direction != null){ nbt.setString("Direction", direction); } for (int i = 0; i < floorX.length; i++){ nbt.setInteger("floorX" + i, floorX[i]); nbt.setInteger("floorY" + i, floorY[i]); nbt.setInteger("floorZ" + i, floorZ[i]); } nbt.setInteger("current", currentFloor); nbt.setInteger("calledfloor", calledFloor); nbt.setBoolean("performcall", performCall); nbt.setBoolean("floorcall", floorCall); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, nbt); } public Block getFloorBlock(World world){ Block floorBlock = Blocks.stone; TileEntityCreateElevator te = (TileEntityCreateElevator) world.getTileEntity(floorX[0], floorY[0], floorZ[0]); ItemStack stack = te.getStackInSlot(0); if (stack != null){ if (stack.getItem() instanceof ItemBlock){ Item floorItem = stack.getItem(); int meta0 = stack.getItemDamage(); floorBlock = Block.getBlockFromItem(floorItem); return floorBlock; } } return floorBlock; } public int getFloorBlockMeta(World world){ Block floorBlock = Blocks.stone; TileEntityCreateElevator te = (TileEntityCreateElevator) world.getTileEntity(floorX[0], floorY[0], floorZ[0]); ItemStack stack = te.getStackInSlot(0); if (stack != null){ if (stack.getItem() instanceof ItemBlock){ Item floorItem = stack.getItem(); int meta0 = stack.getItemDamage(); floorBlock = Block.getBlockFromItem(floorItem); return meta0; } } return 0; } public void startCall(int meta, World world) { Block floorBlock = this.getFloorBlock(world); int floorMeta = this.getFloorBlockMeta(world); int currentFloor = this.getCurrent(); int x = this.floorX[currentFloor]; int y = this.floorY[currentFloor]; int z = this.floorZ[currentFloor]; //Current floor below called floor Move UP if (currentFloor < meta){ for (int y2 = y; y2 != floorY[meta]; y2++){ for (int x11 = -1; x11 <=1; x11++){ for (int z11 = -1; z11 <=1; z11++){ world.setBlock(x + x11, y2, z + z11, Blocks.air); world.setBlock(x + x11, y2 + 1, z + z11, floorBlock, floorMeta, 2); } } } } //Current floor above called floor Move DOWN if (currentFloor > meta){ for (int y2 = y; y2 != floorY[meta]; y2--){ for (int x11 = -1; x11 <=1; x11++){ for (int z11 = -1; z11 <=1; z11++){ world.setBlock(x + x11, y2, z + z11, Blocks.air); world.setBlock(x + x11, y2 - 1, z + z11, floorBlock, floorMeta, 2); } } } } } private void startFloorCall(int calledFloor2, World world) { int numberFloors = Integer.parseInt(numberOfFloors); //EntityPlayer player = this.worldObj.getClosestPlayer(this.floorX[currentFloor], this.floorY[currentFloor], this.floorZ[currentFloor], 10); List listPlayer = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(this.floorX[0]-2,this.floorY[0],this.floorZ[0]-2,this.floorX[numberFloors]+2,this.floorY[numberFloors]+2,this.floorZ[numberFloors]+2)); System.out.println("List " + listPlayer); if (!listPlayer.isEmpty()){ Block floorBlock = this.getFloorBlock(world); int floorMeta = this.getFloorBlockMeta(world); int currentFloor = this.getCurrent(); int x = this.floorX[currentFloor]; int y = this.floorY[currentFloor]; int z = this.floorZ[currentFloor]; //Current floor below called floor Move UP if (currentFloor < calledFloor2){ for (int y2 = y; y2 != floorY[calledFloor2]; y2++){ for (int x11 = -1; x11 <=1; x11++){ for (int z11 = -1; z11 <=1; z11++){ /** Need delay here * * * */ world.setBlock(x + x11, y2, z + z11, Blocks.air); world.setBlock(x + x11, y2 + 1, z + z11, floorBlock, floorMeta, 2); for (int i = 0; i < listPlayer.size(); i++){ EntityPlayer p = (EntityPlayer) listPlayer.get(i); p.setPositionAndUpdate(x + x11, y2 + 2, z + z11); } //player.setPositionAndUpdate(x + x11, y2 + 2, z + z11); } } } } //Current floor above called floor Move DOWN if (currentFloor > calledFloor2){ for (int y2 = y; y2 != floorY[calledFloor2]; y2--){ for (int x11 = -1; x11 <=1; x11++){ for (int z11 = -1; z11 <=1; z11++){ /** Need delay here * * * */ world.setBlock(x + x11, y2, z + z11, Blocks.air); world.setBlock(x + x11, y2 - 1, z + z11, floorBlock, floorMeta, 2); for (int i = 0; i < listPlayer.size(); i++){ EntityPlayer p = (EntityPlayer) listPlayer.get(i); p.setPositionAndUpdate(x + x11, y2, z + z11); } //player.setPositionAndUpdate(x + x11, y2, z + z11); } } } } } } }
  11. I am at work now, so am not able to test anything, but are you trying to put something like coal into slot 2 of your furnace to smelt items. If no items are available to smelt, then to continue buring the coal and adding to a "battery" for later consumtion? There is nothing in the tile entity to show what is used for fuel. ScratchForFun tutorials on Windmill was a great help for me to adding a power progress bar to my gui. I also tried to pull up your gui picture, but said it was private and could not access it.
  12. When I made my back pack, I added this to my gui handler for opening a gui that was equiped. public class TEGuiHandler implements IGuiHandler{ @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity tile_entity = world.getTileEntity(x, y, z); ItemStack equipped; equipped = getEquippedItem(player); if (equipped == null) { return null; } if ((equipped.getItem() instanceof BackPack)) { return new ContainerBackPack(player, player.inventory, new ItemInventory(player.getHeldItem())); } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity tile_entity = world.getTileEntity(x, y, z); ItemStack equipped; //Entity BackPack equipped = getEquippedItem(player); if (equipped == null) { return null; } if ((equipped.getItem() instanceof BackPack)) { return new GuiBackPack((ContainerBackPack) new ContainerBackPack(player, player.inventory, new ItemInventory(player.getHeldItem()))); } return null; } public ItemStack getEquippedItem(EntityPlayer player) { return player.getCurrentEquippedItem(); } }
  13. Thank you both. This worked quite nicely.
  14. Now I understand what Diesieben07 meant by cheat a bit. I was still trying to make the block have a random top. When placing the block at the same location, it could have 10 different tops. What this does is make the location generate the top. Place the block at the same location 10 times, you get the same top. Each location could give a number between 0 and 9, but always give the same number at that given x, y, z location. This gives the illusion of random tops. I was closer to the right way in one of my earlier attempts that I didn't post. I generated a unique number by adding x + y + z and storing it in the TE. Also saved the random number in the TE when the block was placed. My conditional statement must have been not quite right as one or two blocks would not change, but the rest would. Thank you all for the help. This is why when I am bored at work, I try and read every post. I gain new knowledge from each question asked. My goal is to learn something new each day, or each week until the day I die (Like my Dad). Java and Minecraft now, with something new always around the corner. EDIT: This is what I put into my block class. Worked fine in my test mod, but crashed in my real mod. For some strange reason, it just didn't like negative block coordinates. (Joke) @SideOnly(Side.CLIENT) //Many thanks goes to TheGreyGhost and DieSieBen07 for the help on this method public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { int meta = world.getBlockMetadata(x, y, z); final int NUMBER_OF_TOP_ICONS = 11; int topIconIndex = (x + y + z) % NUMBER_OF_TOP_ICONS; // "randomly" select a texture for the table top. //Sometimes the coordinates are negative if (topIconIndex < 0) { topIconIndex *= -1; } return side == 1 ? tableIconTop[topIconIndex] : (side == 0 ? tableIconTop[0] : (side != meta ? tableIconSide : tableIconFront)); }
  15. This is what I have tried in my block class. When I use the variable [top] in tableIconTop, it changes all the blocks top icons still. As a temporary setup, I change top to meta and at least get 4 different tops based on direction. @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess block, int x, int y, int z, int side) { TECraftingTableClass block1 = (TECraftingTableClass) block.getBlock(x, y, z); int meta = block.getBlockMetadata(x, y, z); return side == 1 ? block1.tableIconTop[top] : (side == 0 ? block1.tableIconTop[0] : (side != meta ? block1.tableIconSide : block1.tableIconFront)); } @SideOnly(Side.CLIENT) //Not used at the moment public IIcon getIcon(int side, int meta, IIcon icon) { return side == 1 ? icon : (side == 0 ? this.tableIconTop[0] : (side != meta ? this.tableIconSide : this.tableIconFront)); } /** * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata * This is needed to show the textures while in the tool bar */ public IIcon getIcon(int side, int meta) { return side == 1 ? this.tableIconTop[0] : (side == 0 ? this.tableIconTop[0] : (side != meta ? this.tableIconSide : this.tableIconFront)); } public void onBlockAdded(World world, int x, int y, int z) { //Random number top = rand.nextInt(10); }
  16. I am going to have to admit temporary defeat on this one. I have tried every which way I know to manipulate this method to only change one block, but they still all change. I am going to continue to gain knowledge and revisit later, but for now, I am just going to leave the top side of the block as one texture. @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess block, int x, int y, int z, int side) { return this.getIcon(side, block.getBlockMetadata(x, y, z)); }
  17. @imadnsn I had done this. Works to a point, but like you said can only work with 4 textures. Best result so far. @kenoba10 It is a tile entity. I tried adding block updates in the tile, but still had to same effect of changing all the like tables. I have been playing around with something like the way the furnace changes the block with a burning and idle block to do this from the TE, but have not hit on the right way yet. I am also thinking about using a special renderer. Should be able to use forge direction for the front then and be able use meta for the tops. Only in idea form at the moment. Might cause some lag issues.
  18. If you were using Java 32 bit and now have Java 64 bit, and you use Eclipse, you will need the 64 bit Eclipse. I went throught a similar issue when I updated my Java to 64 bit.
  19. I have created a customized crafting table that has some internal storage. What I am trying to do is randomize the top texture when I place the block down. I can get the top to randomly pick the texture, but the issue is it will also change all like blocks that are already placed. I can't use metadata as I change the metadata to set direction when placing the block. (I also have a front texture). Any suggestions would be greatly appreciated.
  20. Well, I copied over the options file from my fresh build of 1160(Works just fine) to this build, but still have the same error. This looks to be a core class file net.minecraft.client.main.main.class. Only place I can find this. It references this type private static final java.lang.reflect.Type field_152370_a = new ParameterizedType() I tried to delete the saved world as well. I just don't know where these items are being saved. I have never made any changes to this class before. I will keep looking. These are the other properties from the same class ArgumentAcceptingOptionSpec argumentacceptingoptionspec = optionparser.accepts("server").withRequiredArg(); ArgumentAcceptingOptionSpec argumentacceptingoptionspec1 = optionparser.accepts("port").withRequiredArg().ofType(Integer.class).defaultsTo(Integer.valueOf(25565), new Integer[0]); ArgumentAcceptingOptionSpec argumentacceptingoptionspec2 = optionparser.accepts("gameDir").withRequiredArg().ofType(File.class).defaultsTo(new File("."), new File[0]); ArgumentAcceptingOptionSpec argumentacceptingoptionspec3 = optionparser.accepts("assetsDir").withRequiredArg().ofType(File.class); ArgumentAcceptingOptionSpec argumentacceptingoptionspec4 = optionparser.accepts("resourcePackDir").withRequiredArg().ofType(File.class); ArgumentAcceptingOptionSpec argumentacceptingoptionspec5 = optionparser.accepts("proxyHost").withRequiredArg(); ArgumentAcceptingOptionSpec argumentacceptingoptionspec6 = optionparser.accepts("proxyPort").withRequiredArg().defaultsTo("8080", new String[0]).ofType(Integer.class); ArgumentAcceptingOptionSpec argumentacceptingoptionspec7 = optionparser.accepts("proxyUser").withRequiredArg(); ArgumentAcceptingOptionSpec argumentacceptingoptionspec8 = optionparser.accepts("proxyPass").withRequiredArg(); ArgumentAcceptingOptionSpec argumentacceptingoptionspec9 = optionparser.accepts("username").withRequiredArg().defaultsTo("Player" + Minecraft.getSystemTime() % 1000L, new String[0]); ArgumentAcceptingOptionSpec argumentacceptingoptionspec10 = optionparser.accepts("uuid").withRequiredArg(); ArgumentAcceptingOptionSpec argumentacceptingoptionspec11 = optionparser.accepts("accessToken").withRequiredArg().required(); ArgumentAcceptingOptionSpec argumentacceptingoptionspec12 = optionparser.accepts("version").withRequiredArg().required(); ArgumentAcceptingOptionSpec argumentacceptingoptionspec13 = optionparser.accepts("width").withRequiredArg().ofType(Integer.class).defaultsTo(Integer.valueOf(854), new Integer[0]); ArgumentAcceptingOptionSpec argumentacceptingoptionspec14 = optionparser.accepts("height").withRequiredArg().ofType(Integer.class).defaultsTo(Integer.valueOf(480), new Integer[0]); ArgumentAcceptingOptionSpec argumentacceptingoptionspec15 = optionparser.accepts("userProperties").withRequiredArg().required(); ArgumentAcceptingOptionSpec argumentacceptingoptionspec16 = optionparser.accepts("assetIndex").withRequiredArg(); ArgumentAcceptingOptionSpec argumentacceptingoptionspec17 = optionparser.accepts("userType").withRequiredArg().defaultsTo("legacy", new String[0]);
  21. I just updated my development environment from 1047 to 1160. When I did this, I found that I had been programing everything in the JRE and not JDK (I know stupid. I work on too many computers). Took some doing, but finally got everything updated to bring up Eclipse and see my code again. However, when I try to start Minecraft, I get the following error. Looks like joptsimple is missing some arguments. Looking at it between the 1047 and the 1160, there are more arguments in the new version. I tried the following gradlew commands, but to no avail. clean setupdevWorkspace setupDecompWorkspace --refresh-dependencies eclipse Am I trying to move through too many updates at once? Do I need to make smaller jumps, or just start from a very fresh 1160 setup and port in my mod? EDIT: I stumbled on the solution when looking for my no sound issue. Need to add the following Run/Arguments. I always like to learn new things. --version 1.7 --tweakClass cpw.mods.fml.common.launcher.FMLTweaker --username=ForgeDevName --accessToken FML --userProperties={}
  22. Thank you Sir. Have made the changes to the container class and now all is working as it should be. Added these methods to the container class. And removed what I had added to the Tile Entity. public void addCraftingToCrafters(ICrafting icrafting) public void detectAndSendChanges() public void updateProgressBar(int par1, int par2)
  23. I am getting closer. I added the following code and now the GUI data will update with what is saved in NBT. However, the GUI still does not update in real time. Still need some help on that part. public Packet getDescriptionPacket() { NBTTagCompound tagCompound = new NBTTagCompound(); writeToNBT(tagCompound); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.solarPower, tagCompound); } public void onDataPacket(NetworkManager networkManager, S35PacketUpdateTileEntity packet){ readFromNBT(packet.func_148857_g()); }
  24. I am trying to add a power storage bar to my solar furnace that can be bled off during the night or while raining to smelt items. I have one variable called solarPower that should be used when I write it to the NBT and also when I send the scaled value to be displayed by the GUI. In my updateEntity() method, the value for solarPower is being updated correctly when the sun is out and will be saved by the NBT, but it is not being used by my getPowerScaled() method. If I change the updateEntity() method to have if(this.worldobj.isRemote) from (!this.worldobj.isRemote) then the progress bar on the GUI works, but it does not save the value. Attached is the Tile Entity code I have. I know it is not complete, but I am just trying to get the GUI and saves to work correctly. And if it will help, the block class as it stands now is also attached. What am I missing? From the System.out's I have added, it looks like the solarPower is being updated for both the client and server. I have tried with and without the @SideOnly. package telvarianpipes.solarfurnace; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenDesert; public class TileEntitySolarFurnace extends TileEntity implements ISidedInventory{ private ItemStack[] slots = new ItemStack[2]; public static boolean sunIsVisible = false; public int furnaceCookTime; public int maxPower = 10000; public int solarPower = 0; public float powerPerTick = 5.0F; public void updateEntity(){ updateSunVisibility(); if(!this.worldObj.isRemote){ updateSolarPower(); } } public int updateSolarPower(){ if (sunIsVisible){ this.solarPower+=this.powerPerTick; if(this.solarPower > this.maxPower) this.solarPower = this.maxPower; System.out.println ("sp " + this.solarPower); } return this.solarPower; } @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) { //change this to increase or decrease speed. Lower number is faster return this.furnaceCookTime * par1 / 100; } //@SideOnly(Side.CLIENT) public int getPowerScaled(int scaled){ System.out.println("We getting here " + this.solarPower); return (this.solarPower * scaled / this.maxPower); } public void readFromNBT(NBTTagCompound nbt){ super.readFromNBT(nbt); NBTTagList list = nbt.getTagList("Slots", 10); this.slots = new ItemStack[getSizeInventory()]; for(int i = 0; i < list.tagCount(); i++){ NBTTagCompound item = list.getCompoundTagAt(i); byte b = item.getByte("Item"); if(b >= 0 && b < this.slots.length){ this.slots[b] = ItemStack.loadItemStackFromNBT(item); } } this.solarPower = nbt.getInteger("Power"); if(nbt.hasKey("CustomeName")){ this.setInventoryName(nbt.getString("CustomerName")); } } public void writeToNBT(NBTTagCompound nbt){ super.writeToNBT(nbt); System.out.println("Write sp " + this.solarPower); nbt.setInteger("Power", this.solarPower); NBTTagList list = new NBTTagList(); for(int i = 0; i < this.slots.length; i++){ if(this.slots[i] != null){ NBTTagCompound item = new NBTTagCompound(); item.setByte("Item", (byte)i); this.slots[i].writeToNBT(item); list.appendTag(item); } } nbt.setTag("Slots", list); if(this.hasCustomInventoryName()){ nbt.setString("CustomName", this.getInventoryName()); } } @Override public int getSizeInventory() { return this.slots.length; } @Override public ItemStack getStackInSlot(int i) { return this.slots[i]; } @Override public ItemStack decrStackSize(int i, int j) { if(this.slots[i] != null){ ItemStack itemstack; if(this.slots[i].stackSize <= j){ itemstack = this.slots[i]; this.slots[i] = null; }else{ itemstack = this.slots[i].splitStack(j); if(this.slots[i].stackSize == 0){ this.slots[i] = null; } } return itemstack; } return null; } @Override public ItemStack getStackInSlotOnClosing(int i) { if(this.slots[i] != null){ ItemStack itemstack = this.slots[i]; this.slots[i] = null; return itemstack; } return null; } @Override public void setInventorySlotContents(int i, ItemStack itemstack) { this.slots[i] = itemstack; if(itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()){ itemstack.stackSize = this.getInventoryStackLimit(); } } public void setInventoryName(String string){ } @Override public String getInventoryName() { return null; } @Override public boolean hasCustomInventoryName() { // TODO Auto-generated method stub return false; } @Override public int getInventoryStackLimit() { return 64; } @Override public boolean isUseableByPlayer(EntityPlayer var1) { // TODO Auto-generated method stub return false; } @Override public void openInventory() { // TODO Auto-generated method stub } @Override public void closeInventory() { // TODO Auto-generated method stub } @Override public boolean isItemValidForSlot(int var1, ItemStack var2) { // TODO Auto-generated method stub return false; } @Override public int[] getAccessibleSlotsFromSide(int var1) { // TODO Auto-generated method stub return null; } @Override public boolean canInsertItem(int var1, ItemStack var2, int var3) { // TODO Auto-generated method stub return false; } @Override public boolean canExtractItem(int var1, ItemStack var2, int var3) { // TODO Auto-generated method stub return false; } /** * Checks if the specified block is able to see the sky */ public void updateSunVisibility() { this.sunIsVisible = isSunVisible(this.worldObj, this.xCoord, this.yCoord + 1, this.zCoord); } public static boolean isSunVisible(World world, int x, int y, int z) { return (world.isDaytime()) && (!world.provider.hasNoSky) && (world.canBlockSeeTheSky(x, y, z)) && (((world.getWorldChunkManager().getBiomeGenAt(x, z) instanceof BiomeGenDesert)) || ((!world.isRaining()) && (!world.isThundering()))); } /** * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't * fuel */ public static int getItemBurnTime(ItemStack par0ItemStack) { if (par0ItemStack == null) { if (sunIsVisible == true) { return 100; } } return 0; } } package telvarianpipes.solarfurnace; import telvarianpipes.TelvarianPipes; import telvarianpipes.common.VarInit; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class SolarFurnaceClass extends BlockContainer{ private static boolean keepFurnaceInventory; public SolarFurnaceClass(Material material) { super(material); this.setCreativeTab(TelvarianPipes.tabTelvarianPipe); } public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){ if(!world.isRemote){ FMLNetworkHandler.openGui(player, TelvarianPipes.instance, VarInit.guiIDSolarFurnace, world, x, y, z); } return true; } @Override public TileEntity createNewTileEntity(World world, int var2) { return new TileEntitySolarFurnace(); } }
  25. I use this for my solar furnace. public static boolean sunIsVisible = false; /** * Checks if the specified block is able to see the sky */ public void updateSunVisibility() { this.sunIsVisible = isSunVisible(this.worldObj, this.xCoord, this.yCoord + 1, this.zCoord); } public static boolean isSunVisible(World world, int x, int y, int z) { return (world.isDaytime()) && (!world.provider.hasNoSky) && (world.canBlockSeeTheSky(x, y, z)) && (((world.getWorldChunkManager().getBiomeGenAt(x, z) instanceof BiomeGenDesert)) || ((!world.isRaining()) && (!world.isThundering()))); }

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.