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.

Featured Replies

Posted

So what I am trying to do is to get my custom fire block to break like the vanilla one, so far I have it working in survival mode, but it still breaks the block that the fire is on in creative mode.

 

This is my current working code:

 

 

public class BreakEvents

{

@SubscribeEvent

public void extinguishFire(PlayerInteractEvent event)

{

boolean flag = event.action == PlayerInteractEvent.Action.LEFT_CLICK_BLOCK ? true : false;

BlockPos pos = event.pos;

World theWorld = event.world;

EnumFacing side = event.face;

ItemInWorldManager theItemInWorldManager = new ItemInWorldManager(theWorld);

EntityPlayerMP thisPlayerMP = theItemInWorldManager.thisPlayerMP;

 

if (flag)

{

Block block = theWorld.getBlockState(pos).getBlock();

 

if (!block.isAir(theWorld, pos))

{

if (event.useBlock != Result.DENY)

{

block.onBlockClicked(theWorld, pos, thisPlayerMP);

this.extinguishFire((EntityPlayer) null, pos, side, event);

}

else

{

thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos));

}

}

}

}

 

private boolean extinguishFire(EntityPlayer player, BlockPos pos, EnumFacing side, PlayerInteractEvent event)

{

World world = event.world;

pos = pos.offset(side);

 

if (world.getBlockState(pos).getBlock() == Blocks_and_Items.fire_block)

{

world.playAuxSFXAtEntity(player, 1004, pos, 0);

world.setBlockToAir(pos);

return true;

}

else

{

return false;

}

}

}

 

 

I think you should call block.onBlockClicked(theWorld, pos, thisPlayerMP); after extinguishFire, and do not click the block when there was no fire there.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

  • Author

So I tried putting the onBlockClicked after the extinguishFire, but it still doesn't work. Also in my console I have "Model defenition for location modid:block_fire#inventory not found, how do I get rid of this?

So I tried putting the onBlockClicked after the extinguishFire, but it still doesn't work. Also in my console I have "Model defenition for location modid:block_fire#inventory not found, how do I get rid of this?

and do not click the block when there was no fire there

And that message is another problem. Do you have proper model for your fire?

 

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

  • Author

Yes, its just for the inventory model that I don't need, cause if you check, vanilla doesn't have an inventory model for fire

Yes, its just for the inventory model that I don't need, cause if you check, vanilla doesn't have an inventory model for fire

Then that is not a problem I think. (Also I dont know how to make the message disappear)

 

Anyway, Do this:

and do not click the block when there was no fire there

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

You will still need an inventory model for that error to go away. Could be useful for people using nei/tmi that want to place down the fire

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

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.