Posted August 13, 201312 yr Hello, I've got 3 problems. 1. I've got my GUI working, but when i try to decrease the stack size of a slot in a method, it decreases it, but leaves a phantom item when i open the GUI and when i take out the item and right click with it it's gone. It tried running onInventoryChanged(), but that doesn't worked. 2. I returned in the method getInventoryStackLimit the value 15, and i can only put 15 items in the slot and get the rest back, but when i shift-click the itemstack in it just deletes the rest. 3. I would like to know how to get the strength of the redstone signal on the sides of a block with a TileEntity. I tried onNeighbourBlockChange() at my Block class, and setting the variable redstonestrenght at the TileEntity to par1World.getBlockPowerInput(par2, par3, par4). But when i have 2 blocks and power 1 block the other gets also powered I know that's a LOT of questions, but i'm new to Forge Modding, and have done some Bukkit Plugin Modding before. ss7 You sir are a god damn hero.
August 13, 201312 yr I'm not sure about #3, but here are my thoughts on the other two. 1. I'm fairly certain that is a server-client issue, as in the client says you have a different amount of items than the server says you have. It's some sort of de-sync issue that could be attributed to a lot of different things. Just go into the debugging tool and work your way through it as it's running on the client, then the server, and see where they start to disagree. 2. Override the transferStackInSlot method and make sure it will only try to transfer 15, or however many makes 15, at a time to a single slot and leave the rest. I'm not really sure why it would be deleting it, because the default minecraft code will only transfer up to the slot limit and leave the rest.
August 13, 201312 yr Author Hello, Thank you for your answer! To #2: I copied the code from the ContainerFurnace, but that also removes the stack. And when i don't override that method i get an error, because the javadoc says: Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. ss7 You sir are a god damn hero.
August 13, 201312 yr #3: Make sure you variable isn't static, that you change the value on server side, and save the value within NBT.
August 14, 201312 yr Author #3: Make sure you variable isn't static, that you change the value on server side, and save the value within NBT. Hello, You are AWESOME, yes my variable was public ans static and now the wireless crazy redstone problem is solved! But when i try to place 2 bridges and power them at once, no bridge extends. And what do you mean with server side? With packets? ss7 You sir are a god damn hero.
August 14, 201312 yr No, make the change on server side means having a server side check beforehand, typically: if(!world.isRemote) { //do things } else { //do nothing }
August 14, 201312 yr Author Hello, I've tried it with if (world.isRemote == false) { tileentity.redstonestrength = world.getBlockPowerInput(par2, par3, par4); } but that doesn't seem to work. When i place 2 bridgeblocks i can't power them at once ):. ss7 You sir are a god damn hero.
August 14, 201312 yr Note that redstone do not power instantaneously. If you want both blocks to be powered at the same time, you have to take redstone delay into account.
August 14, 201312 yr Author Hello, But i have that code snippet in the on neighborblockchange event, so it should be on all blocks at the same time, or what do you mean? ss7 You sir are a god damn hero.
August 14, 201312 yr Redstone will trigger neighbour block change only if its power has changed. Nothing happens until the neighbouring redstone receive power. In a more detailed sequence: -first redstone powered (tick 0) -first redstone triggers neighbour block change -second redstone receives neighbour block change -second redstone powered (tick 1) -second redstone triggers neighbour block change ... -last redstone powered (tick n) -last redstone triggers neighbour block change -your block is powered (tick n+1) To power two blocks simultaneously, you need to take the delay into account. Unless you make the first block wait for the second to be powered, or you don't need them activated at the exact same time.
August 15, 201312 yr Author Hello, And how do i take the delay into account? ss7 You sir are a god damn hero.
August 15, 201312 yr Author Hello, YES!!! Redstone is my favorite part of Minecraft! Do you mean with repeaters? Sorry if i don't understand, that's cause i'm German. ss7 You sir are a god damn hero.
August 16, 201312 yr Author Hello, But even with repeaters only one bridge extends ): ss7 You sir are a god damn hero.
August 16, 201312 yr Author Hello, OK, here are the files: http://gw.minecraftforge.net/kfos http://gw.minecraftforge.net/KNuc Also the bridge pull-back doesn't work. ss7 You sir are a god damn hero.
August 16, 201312 yr boolean RemoveBlockValid(int x, int y, int z) { if (worldObj.getBlockId(x, y, z) == Block.cobblestone.blockID) You are only removing cobblestone blocks here. You are using nextplaceblock and nextplaceblock as field, but they are not reset to false on each update tick of your entity. This means the tile entity will try to place or remove blocks, whether there are unmovable blocks or not within the line. ( if you have a gold block in your cobblestone line to remove, it will not be removed, but all others will, which looks kinda strange for a bridge) @Override public void updateEntity() { ticks++; if (ticks == 20) { ticks = 0; //ModLoader.getMinecraftInstance().thePlayer.addChatMessage(blockspushed + "/" + redstonestrength); if (blockspushed < redstonestrength) { switch(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)) { case 1: nextplaceblock = PlaceBlockValid(xCoord, yCoord, zCoord - blockspushed); break; case 2: nextplaceblock = PlaceBlockValid(xCoord, yCoord, zCoord + blockspushed); break; case 3: nextplaceblock = PlaceBlockValid(xCoord - blockspushed, yCoord, zCoord); break; case 4: nextplaceblock = PlaceBlockValid(xCoord + blockspushed, yCoord, zCoord); break; } if (nextplaceblock) { blockspushed++; } } else { switch(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)) { case 1: nextremoveblock = RemoveBlockValid(xCoord, yCoord, zCoord + blockspushed); break; case 2: nextremoveblock = RemoveBlockValid(xCoord, yCoord, zCoord - blockspushed); break; case 3: nextremoveblock = RemoveBlockValid(xCoord - blockspushed, yCoord, zCoord); break; case 4: nextremoveblock = RemoveBlockValid(xCoord + blockspushed, yCoord, zCoord); break; } if (nextremoveblock) { blockspushed--; } } } } The blocks will also start being removed as soon as blockspushed == redstonestrength. You should probably make this a case where things are stable.
August 16, 201312 yr Author Hello, That with the cobblestone is for testing purposes only, cause i don't no how to a ItemBlock or a ItemStack to a Block. Reset, do you mean this: nextplaceblock = false; nextremoveblock = false; I tried everything for the blockspushed == redstonestrength, e.g. i checked if blockspushed != 2, but that doesn't worked. And after the one blocks removed, no other blocks get removed :'( ss7 You sir are a god damn hero.
August 16, 201312 yr @Override public void updateEntity() { ticks++; if (ticks == 20) { ticks = 0; //ModLoader.getMinecraftInstance().thePlayer.addChatMessage(blockspushed + "/" + redstonestrength); if (blockspushed < redstonestrength) { switch(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)) { case 1: nextplaceblock = PlaceBlockValid(xCoord, yCoord, zCoord - blockspushed); break; case 2: nextplaceblock = PlaceBlockValid(xCoord, yCoord, zCoord + blockspushed); break; case 3: nextplaceblock = PlaceBlockValid(xCoord - blockspushed, yCoord, zCoord); break; case 4: nextplaceblock = PlaceBlockValid(xCoord + blockspushed, yCoord, zCoord); break; } if (nextplaceblock) { blockspushed++; nextplaceblock=false; } } else if(blockspushed > redstonestrength) { switch(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)) { case 1: nextremoveblock = RemoveBlockValid(xCoord, yCoord, zCoord + blockspushed); break; case 2: nextremoveblock = RemoveBlockValid(xCoord, yCoord, zCoord - blockspushed); break; case 3: nextremoveblock = RemoveBlockValid(xCoord - blockspushed, yCoord, zCoord); break; case 4: nextremoveblock = RemoveBlockValid(xCoord + blockspushed, yCoord, zCoord); break; } if (nextremoveblock) { blockspushed--; nextremoveblock = false; } } } } Something like this.
August 17, 201312 yr Author Hello, I've tried your code but that doesn't worked. On the x axis the block is still being removed, on the z axis not. And it looks like the block is being removed, but on the client side, because i can't walk into it. Also the bridge doesn't remove. Even with the else if. I've tried printing the blockspushed and the redstonestrength into the chat, but at the end it's 15/0 so it should do it. And it prints it twice in the chat, the second is 0/0 at the x axis, and 1/0 at the z axis. That's also weird. ss7 You sir are a god damn hero.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.