Posted December 2, 20186 yr 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?
December 2, 20186 yr 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 December 2, 20186 yr by Cadiboo About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.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)
December 2, 20186 yr 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 December 2, 20186 yr by V0idWa1k3r
December 2, 20186 yr Author 2 minutes ago, V0idWa1k3r said: Their title is confusing though. What is confusing?
December 2, 20186 yr 4 minutes ago, nov4e said: What is confusing? Quote Get Break Particles From A Block 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.
December 2, 20186 yr 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 Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.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)
December 2, 20186 yr Author 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.
December 2, 20186 yr 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 Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.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)
December 2, 20186 yr Author 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
December 2, 20186 yr Author 2 hours ago, diesieben07 said: block state Block state? I need the breaking particles
December 2, 20186 yr Author 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?
December 3, 20186 yr Author 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.
December 3, 20186 yr 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.
December 3, 20186 yr Author 2 hours ago, Animefan8888 said: IBlockState Ok and in the private method construct what i have to put here?
December 3, 20186 yr Author 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) ?????
December 4, 20186 yr Author 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?
December 4, 20186 yr 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.
December 4, 20186 yr 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.
December 5, 20186 yr Author 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.
December 5, 20186 yr I don't know how to make this more obvious. 23 hours ago, V0idWa1k3r said: The arguments parameter is the one you need. Put the blockstate ID as that parameter. Quote World#spawnParticle(EnumParticleType, x , y, z, xspeed, yspeed, zspeed, arguments)
December 5, 20186 yr Author strWorld.spawnParticle(EnumParticleTypes.BLOCK_CRACK, x, y, z, 20, 20, 20, intID); Is this correct? But it not spawn particles in-game...
December 5, 20186 yr 14 minutes ago, nov4e said: But it not spawn particles in-game... It probably does but since your motion is 20, 20, 20 they instantly "teleport" 20 blocks to the right, front and up. Also, what's intID here? Is it the blockstates id or something else?
December 5, 20186 yr Author 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 December 5, 20186 yr by nov4e
December 5, 20186 yr 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?
December 5, 20186 yr Author 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)
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.