Jump to content

Get Break Particles From A Block


nov4e

Recommended Posts

I'm trying to spawn the particles of the redstone block breaking in this event.

@SubscribeEvent(priority=EventPriority.LOW)
	public static void onDamagedEntity(LivingHurtEvent evLivingHurtEvent) {
		
		if(!(evLivingHurtEvent.getEntityLiving() instanceof EntityPlayer)) {
			double x = evLivingHurtEvent.getEntityLiving().getPosition().getX();
			double y = evLivingHurtEvent.getEntityLiving().getPosition().getY();
			double z = evLivingHurtEvent.getEntityLiving().getPosition().getZ();
			
			World strWorld = evLivingHurtEvent.getEntityLiving().getEntityWorld();
			SoundType strSound = Blocks.REDSTONE_BLOCK.getSoundType();
			evLivingHurtEvent.getEntity().playSound(strSound.getBreakSound(), 23, 1);
			evLivingHurtEvent.getEntityLiving().spawnRunningParticles();
			strWorld.spawnParticle(EnumParticleTypes.REDSTONE, x, y, z, 23, 23, 23, 4000);
			
		}
	}

How I can get the particle?

Link to comment
Share on other sites

Get the IBakedModel of the block, then get the particle texture from that

I think you’ll have to change the particle type to BLOCK_CRACK and play around with the last parameter a bit (the block id & meta). Or maybe you could just use something like ForgeRegistries.Blocks::getIdForBlock.

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

8 minutes ago, Cadiboo said:

Get the IBakedModel of the block, then get the particle texture from that

The OP wants to spawn a particle that is a breaking particle of a block, I think(based on the provided code). Their title is confusing though.

Edit:

8 minutes ago, Cadiboo said:

the last parameter a bit (the block id). Or maybe you could just use something like ForgeRegistries.Blocks::getIdForBlock.

The last parameter is the blockstate ID if I recall correctly. I am unable to check this at the moment though.

Edited by V0idWa1k3r
Link to comment
Share on other sites

Just now, V0idWa1k3r said:

This to me implies that you want to get a texture of a block's breaking particles, not that you want to spawn the particle.

Also that you want to get it from a block dynamically, not just spawn the exact same block particle every time

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

1 minute ago, V0idWa1k3r said:

This to me implies that you want to get a texture of a block's breaking particles, not that you want to spawn the particle.

I want to summon the breaking particles of the redstone block in the position of the damaged entity for simulate the blood.

Link to comment
Share on other sites

12 minutes ago, Cadiboo said:

I think you’ll have to change the particle type to BLOCK_CRACK and play around with the last parameter a bit (the block id & meta). Or maybe you could just use something like ForgeRegistries.Blocks::getIdForBlock.

 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

13 minutes ago, Cadiboo said:
26 minutes ago, Cadiboo said:

I think you’ll have to change the particle type to BLOCK_CRACK and play around with the last parameter a bit (the block id & meta). Or maybe you could just use something like ForgeRegistries.Blocks::getIdForBlock.

 

EnumParticleTypes.BLOCK_CRACK.getParticleFromId(152) ??

 

152 is the redstone block id

Link to comment
Share on other sites

2 minutes ago, diesieben07 said:

Which one? The breaking particle is different for every block state (dirt shows dirt particles, coarse dirt shows coarse dirt particles, etc.).

ok

2 hours ago, diesieben07 said:

EnumParticleTypes.BLOCK_CRACK

 

2 hours ago, diesieben07 said:

Block.getStateId

I have to made an instance? And how i can use Block#getStateID?

Link to comment
Share on other sites

private static void spawnBlood(Block strBlock, World strWorld, LivingHurtEvent evLivingHurtEvent) {
		
		IBlockState strBlockState = strBlock.getStateById(Block.getIdFromBlock(strBlock));
		
		int intID = strBlock.getIdFromBlock(strBlock);
		
		double x = evLivingHurtEvent.getEntity().getPosition().getX();
		double y = evLivingHurtEvent.getEntity().getPosition().getY();
		double z = evLivingHurtEvent.getEntity().getPosition().getZ();
		
		EnumParticleTypes strParticle = EnumParticleTypes.BLOCK_CRACK.getParticleFromId(intID);
		
		
		
	}

Something like that? I put all the stuff in a private method.

Link to comment
Share on other sites

2 hours ago, nov4e said:

Block strBlock

Change this to IBlockState state.

 

Then for the I'd do Block.getStateID(state)

 

The only other thing you need to do after changing those things is spawn the particle in the world.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

11 minutes ago, diesieben07 said:

No. You do not need the block ID. You need the state ID, obtained via Block.getStateId(IBlockState). A Block alone is not enough to determine breaking particles. You need the IBlockState.

int intID = Block.getStateId(strIBlockState);

 

What I didn't understand is how I can connect EnumParticleType with the block blockstate. And when I use the constructor spawnBlood what I have to but in the blockstate?

new IBlockState(Blocks.REDSTONE_BLOCK)

?????

Link to comment
Share on other sites

17 hours ago, diesieben07 said:

Only through World#spawnParticle.

yeah but this the particle method. How I can connect EnumParticleType with the block blockstate? The constructor is

World#spawnParticle(EnumParticleType, x , y, z, xspeed, yspeed, zspeed, arguments) 

I have to put the block state in EnumParticleType?

Link to comment
Share on other sites

11 minutes ago, nov4e said:

I have to put the block state in EnumParticleType?

No.

On 12/3/2018 at 5:27 AM, nov4e said:

EnumParticleTypes strParticle = EnumParticleTypes.BLOCK_CRACK.getParticleFromId(intID);

 

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

9 minutes ago, Animefan8888 said:

No.

On 12/3/2018 at 4:27 PM, nov4e said:

EnumParticleTypes strParticle = EnumParticleTypes.BLOCK_CRACK.getParticleFromId(intID);

 

 

18 hours ago, diesieben07 said:
21 hours ago, nov4e said:

What I didn't understand is how I can connect EnumParticleType with the block blockstate.

Only through World#spawnParticle.

21 hours ago, diesieben07 said:

this makes no sense. I already told you that getParticleFromId is a static method. Why are you calling it on an instance? Moreover getParticleFromId expects a particle ID, you are passing it a block ID.

 

21 minutes ago, nov4e said:

yeah but this the particle method. How I can connect EnumParticleType with the block blockstate? The constructor is


World#spawnParticle(EnumParticleType, x , y, z, xspeed, yspeed, zspeed, arguments) 

The arguments parameter is the one you need. Put the blockstate ID as that parameter.

Link to comment
Share on other sites

private static void spawnBlood(IBlockState strIBlockState, World strWorld, LivingHurtEvent evLivingHurtEvent) {
		
		
		int intID = Block.getStateId(strIBlockState);
		
		double x = evLivingHurtEvent.getEntity().getPosition().getX();
		double y = evLivingHurtEvent.getEntity().getPosition().getY();
		double z = evLivingHurtEvent.getEntity().getPosition().getZ();
		
		strWorld.spawnAlwaysVisibleParticle(intID, x, y, z, 20, 20, 20, 243);
		
		
		
	}

I changed 

World#spawnParticle

to 

World#spawnAlwaysVisibleParticle

Is this the same thing? World#spawnParticle not accepts a ID but World#spawnAlwaysVisibleParticle yes.

23 hours ago, V0idWa1k3r said:

Put the blockstate ID as that parameter.

 

Link to comment
Share on other sites

6 minutes ago, V0idWa1k3r said:

what's intID

int intID = Block.getStateId(strIBlockState);

 

So i have to put the number of the blocks in this case 0,0,0 right?

18 minutes ago, nov4e said:

20, 20, 20

And now I also have to set particle number?

Edited by nov4e
Link to comment
Share on other sites

5 minutes ago, nov4e said:

So i have to put the number of the blocks in this case 0,0,0 right?

The motion is the change in position each tick. 0,0,0 means that your particle is stationary.

 

5 minutes ago, nov4e said:

And now I also have to set particle number?

Could you elaborate on this? What number?

Link to comment
Share on other sites

1 minute ago, V0idWa1k3r said:

The motion is the change in position each tick. 0,0,0 means that your particle is stationary

it has to follow the entity.

 

1 minute ago, V0idWa1k3r said:

Could you elaborate on this? What number?

The number of the particles generated. For example in vanilla theres a command that requires the particle number id. (quantity)

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I was just trying to play my modded world when i randomly got this crash for no reason. I sorted through like every mod and eventually I realized it was LLibrary but I can't seem to find a solution to fix the crashing. I can't lose the world that I have that uses this mod please help me. Here's the report: https://pastebin.com/0D00B79i If anyone has a solution please let me know.  
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑   Daftar Slot Ligawin88 adalah bocoran slot rekomendasi gacor dari Ligawin88 yang bisa anda temukan di SLOT Ligawin88. Situs SLOT Ligawin88 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Ligawin88 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Ligawin88 merupakan SLOT Ligawin88 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Ligawin88. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Ligawin88 hari ini yang telah disediakan SLOT Ligawin88. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Ligawin88 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Ligawin88 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Ligawin88 di link SLOT Ligawin88.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑   Daftar Slot Asusslot adalah bocoran slot rekomendasi gacor dari Asusslot yang bisa anda temukan di SLOT Asusslot. Situs SLOT Asusslot hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Asusslot terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Asusslot merupakan SLOT Asusslot hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Asusslot. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Asusslot hari ini yang telah disediakan SLOT Asusslot. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Asusslot terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Asusslot terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Asusslot di link SLOT Asusslot.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 Daftar Slot Galeri555 adalah bocoran slot rekomendasi gacor dari Galeri555 yang bisa anda temukan di SLOT Galeri555. Situs SLOT Galeri555 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Galeri555 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Galeri555 merupakan SLOT Galeri555 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Galeri555. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Galeri555 hari ini yang telah disediakan SLOT Galeri555. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Galeri555 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Galeri555 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Galeri555 di link SLOT Galeri555.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 Daftar Slot Kocok303 adalah bocoran slot rekomendasi gacor dari Kocok303 yang bisa anda temukan di SLOT Kocok303. Situs SLOT Kocok303 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Kocok303 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Kocok303 merupakan SLOT Kocok303 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Kocok303. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Kocok303 hari ini yang telah disediakan SLOT Kocok303. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Kocok303 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Kocok303 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Kocok303 di link SLOT Kocok303.
  • Topics

×
×
  • Create New...

Important Information

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