Posted October 31, 20186 yr Hi. It's me again. I'm trying to make a block that outputs redstone on and off by a self timer. The block is on for X ticks, and then is off by X ticks, and repeat (a clock). It kinda works... The value inside the tile entity changes, but the output signal doesn't changes (neither the texture). Code is here. The problem is related with `blocks.LogicClock_Block.java` and `blocks.datablock.ClockEntity.java`. I suspect there is a method that I am not overriding, but I don't know what it is... Thanks ? Edited November 1, 20186 yr by AngheloAlf
October 31, 20186 yr When you update the counter in your TE you need to do 2 things: In order for the texture to change you need to notify the client of the new value of the counter and tell it to re-render the block. TileEntity#markDirty only notifies the chunk that the data has changed and needs to be serialized, it doesn't do anything with the client. When the state of the lit field changes you need to notify all neighbouring blocks of the change in order for the redstone to update. See BlockLever#onBlockActivated as an example of what to do.
November 1, 20186 yr Author Thanks a lot! This fixed my problem. What I did was add Block#notifyNeighborsOfStateChange into the update() method of my tile entity, just like this: @Override public void update(){ counter -= lastCount * 4; if (counter <= 0) { lit = !lit; counter = 400; markDirty(); world.notifyNeighborsOfStateChange(getPos(), blockType, false); } } I have one doubt remaining, what is the third argument (the boolean) of Block#notifyNeighborsOfStateChange supposed to mean? I put there a false, but I don't know what will change if I put true there. Oh, and i just noticed that I forgot to put a title to my post. Ups. Is there a way to change it?? Thanks a lot again!
November 1, 20186 yr Author Thanks a lot! This fixed my problem. What I did was add Block#notifyNeighborsOfStateChange into the update() method of my tile entity, just like this: @Override public void update(){ counter -= lastCount * 4; if (counter <= 0) { lit = !lit; counter = 400; markDirty(); world.notifyNeighborsOfStateChange(getPos(), blockType, false); } } I have one doubt remaining, what is the third argument (the boolean) of Block#notifyNeighborsOfStateChange supposed to mean? I put there a false, but I don't know what will change if I put true there. Oh, and i just noticed that I forgot to put a title to my post. Ups. Is there a way to change it?? Thanks a lot again!
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.