Skip to content

Commit c897b15

Browse files
KaupenjoeKaupenjoe
authored andcommitted
spawn particles
1 parent 203694d commit c897b15

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/main/java/net/kaupenjoe/tutorialmod/item/custom/ChiselItem.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import net.minecraft.item.ItemStack;
1717
import net.minecraft.item.ItemUsageContext;
1818
import net.minecraft.item.tooltip.TooltipType;
19+
import net.minecraft.particle.BlockStateParticleEffect;
20+
import net.minecraft.particle.ParticleTypes;
1921
import net.minecraft.server.network.ServerPlayerEntity;
2022
import net.minecraft.server.world.ServerWorld;
2123
import net.minecraft.sound.SoundCategory;
@@ -56,6 +58,16 @@ public ActionResult useOnBlock(ItemUsageContext context) {
5658

5759
world.playSound(null, context.getBlockPos(), ModSounds.CHISEL_USE, SoundCategory.BLOCKS);
5860

61+
((ServerWorld) world).spawnParticles(new BlockStateParticleEffect(ParticleTypes.BLOCK, clickedBlock.getDefaultState()),
62+
context.getBlockPos().getX() + 0.5, context.getBlockPos().getY() + 1.0,
63+
context.getBlockPos().getZ() + 0.5, 5, 0, 0, 0, 1);
64+
65+
((ServerWorld) world).spawnParticles(ParticleTypes.FLAME,
66+
context.getBlockPos().getX() + 0.5, context.getBlockPos().getY() + 1.5,
67+
context.getBlockPos().getZ() + 0.5, 10, 0, 0, 0, 3);
68+
69+
70+
5971
context.getStack().set(ModDataComponentTypes.COORDINATES, context.getBlockPos());
6072
}
6173
}

0 commit comments

Comments
 (0)