magreet Posted July 27, 2014 Share Posted July 27, 2014 Hello, I am new to Minecraft modding and started working on a cement mod for 1.7.2. Goal: A placeable liquid that dries into stone (maybe with an intermediate block) within seconds. I followed the tutorial at http://www.minecraftforge.net/wiki/Create_a_Fluid resulting in: - new liquid cement - cement bucket can place and pickup source block Now, I cannot figure out how to let it dry. If I use an ExecuterService with a scheduled delay, bugs occur since world changes are not taken into account if I call world.setBlock(x, y, z, Blocks.stone); I noticed that there is always just one instance of the fluid block, and the displaced blocks are the same with increased metadata. I wanted to use onBlockAdded(final World world, final int x, final int y, final int z) to call a world.scheduleBlockUpdate(x, y, z, this, tickRate); but the scheduledBlockUpdate does not call updateTick (only by onNeighborBlockChange or something). In addition, how should I replace the flowing fluid by stone if they are one and the same object? If I replace the original source block; the adjacent blocks disappear. I tried a tick update loop with timestamp comparison but since they are the same block, they get turned to stone simultaneously. public final static int DELAY_DRY_MS = 3000; // 3sec ... @Override public void onBlockAdded(final World world, final int x, final int y, final int z) { super.onBlockAdded(world, x, y, z); dryingStartTime = System.currentTimeMillis(); } @Override public void updateTick(World world, int x, int y, int z, Random rand) { if (System.currentTimeMillis() - dryingStartTime >= DELAY_DRY_MS) { world.setBlock(x, y, z, Blocks.stone); return; } else { super.updateTick(world, x, y, z, rand); world.scheduleBlockUpdate(x, y, z, this, tickRate); } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.