Jump to content

virtualoxygen

Members
  • Posts

    4
  • Joined

  • Last visited

virtualoxygen's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Ah ok, so in my case, litTime could be hardcoded becuase it is not depending on a fuel type.
  2. Hi, I was just responding to your other comment. Ok, I changed it to this. Is this what you mean? @SubscribeEvent public static void countTicks(TickEvent.WorldTickEvent event) {... On saving the ticks: I know its not the right way and only works for one block. Its meant for testing only at the moment. I will have a read thru the capabilties in the link you provided. I also had a look at the Furnace and BlockEntity, but find it hard to understand how the FurnaceTicker is working. (I'm fairly new to the minecraft codebase). Anyways thanks for the help.
  3. @SubscribeEvent public static void countTicks(TickEvent event){ if(!ticking) return; ticks++; if(ticks == 100){ // do stuff and reset } } Ok, thank you. I managed to get it to work with the above code. I could not find `LevelTickEvent` in the codebase. Not sure if its the same as `TickEvent`
  4. Hi, I'm trying to set (reset) a blockstate after a certain amount of ticks. I can't seem to find any examples on how ticks are used in general. The below method is for an item. If a block is clicked with the item, it changes the block to another one. I want to implement a timer that resets this block to its original state. @Override public InteractionResult useOn(UseOnContext pContext) { if (!pContext.getLevel().isClientSide()) { BlockPos positionClicked = pContext.getClickedPos(); BlockState originalBlockState = pContext.getLevel().getBlockState(positionClicked); pContext.getLevel().setBlock(pContext.getClickedPos(), Blocks.PUMPKIN.defaultBlockState(), 3); // TODO reset to originalBlock after ticks (e.g. 10 seconds) } return super.useOn(pContext); } A little code snippet or a pointer to a few examples would be very helfpful.
×
×
  • Create New...

Important Information

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