|
16 | 16 | import net.minecraft.item.*;
|
17 | 17 | import net.minecraft.nbt.*;
|
18 | 18 | import net.minecraft.particle.*;
|
19 |
| -import net.minecraft.registry.RegistryWrapper; |
| 19 | +import net.minecraft.registry.*; |
20 | 20 | import net.minecraft.server.world.*;
|
21 | 21 | import net.minecraft.sound.*;
|
22 | 22 | import net.minecraft.util.*;
|
@@ -120,37 +120,35 @@ public int decrementBowlStack(Vec3d orbTargetPos, int amount, boolean doEffects)
|
120 | 120 | public void spawnOrbParticles(Vec3d orbTargetPos) {
|
121 | 121 | ItemStack storedStack = this.getStack(0);
|
122 | 122 | if (!storedStack.isEmpty()) {
|
123 |
| - Optional<DyeColor> optionalItemColor = ColorRegistry.ITEM_COLORS.getMapping(storedStack.getItem(), DyeColor.PURPLE); |
124 |
| - if (optionalItemColor.isPresent()) { |
125 |
| - ParticleEffect sparkleRisingParticleEffect = SpectrumParticleTypes.getSparkleRisingParticle(optionalItemColor.get()); |
| 123 | + DyeColor itemColor = ColorRegistry.ITEM_COLORS.getMapping(storedStack.getItem(), DyeColor.PURPLE); |
| 124 | + ParticleEffect sparkleRisingParticleEffect = SpectrumParticleTypes.getSparkleRisingParticle(itemColor); |
| 125 | + |
| 126 | + if (this.getWorld() instanceof ServerWorld serverWorld) { |
| 127 | + PlayParticleWithRandomOffsetAndVelocityPayload.playParticleWithRandomOffsetAndVelocity((ServerWorld) world, |
| 128 | + new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5), |
| 129 | + sparkleRisingParticleEffect, 50, |
| 130 | + new Vec3d(0.4, 0.2, 0.4), new Vec3d(0.06, 0.16, 0.06)); |
126 | 131 |
|
127 |
| - if (this.getWorld() instanceof ServerWorld serverWorld) { |
128 |
| - PlayParticleWithRandomOffsetAndVelocityPayload.playParticleWithRandomOffsetAndVelocity((ServerWorld) world, |
129 |
| - new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5), |
130 |
| - sparkleRisingParticleEffect, 50, |
131 |
| - new Vec3d(0.4, 0.2, 0.4), new Vec3d(0.06, 0.16, 0.06)); |
132 |
| - |
133 |
| - ColorTransmissionPayload.playColorTransmissionParticle(serverWorld, new ColoredTransmission(new Vec3d(this.pos.getX() + 0.5D, this.pos.getY() + 1.0D, this.pos.getZ() + 0.5D), new ExactPositionSource(orbTargetPos), 20, optionalItemColor.get())); |
134 |
| - } else if (this.getWorld() instanceof ClientWorld clientWorld) { |
135 |
| - for (int i = 0; i < 50; i++) { |
136 |
| - float randomOffsetX = pos.getX() + 0.3F + world.random.nextFloat() * 0.6F; |
137 |
| - float randomOffsetY = pos.getY() + 0.3F + world.random.nextFloat() * 0.6F; |
138 |
| - float randomOffsetZ = pos.getZ() + 0.3F + world.random.nextFloat() * 0.6F; |
139 |
| - float randomVelocityX = 0.03F - world.random.nextFloat() * 0.06F; |
140 |
| - float randomVelocityY = world.random.nextFloat() * 0.16F; |
141 |
| - float randomVelocityZ = 0.03F - world.random.nextFloat() * 0.06F; |
142 |
| - |
143 |
| - clientWorld.addParticle(sparkleRisingParticleEffect, |
144 |
| - randomOffsetX, randomOffsetY, randomOffsetZ, |
145 |
| - randomVelocityX, randomVelocityY, randomVelocityZ); |
146 |
| - } |
| 132 | + ColorTransmissionPayload.playColorTransmissionParticle(serverWorld, new ColoredTransmission(new Vec3d(this.pos.getX() + 0.5D, this.pos.getY() + 1.0D, this.pos.getZ() + 0.5D), new ExactPositionSource(orbTargetPos), 20, itemColor)); |
| 133 | + } else if (this.getWorld() instanceof ClientWorld clientWorld) { |
| 134 | + for (int i = 0; i < 50; i++) { |
| 135 | + float randomOffsetX = pos.getX() + 0.3F + world.random.nextFloat() * 0.6F; |
| 136 | + float randomOffsetY = pos.getY() + 0.3F + world.random.nextFloat() * 0.6F; |
| 137 | + float randomOffsetZ = pos.getZ() + 0.3F + world.random.nextFloat() * 0.6F; |
| 138 | + float randomVelocityX = 0.03F - world.random.nextFloat() * 0.06F; |
| 139 | + float randomVelocityY = world.random.nextFloat() * 0.16F; |
| 140 | + float randomVelocityZ = 0.03F - world.random.nextFloat() * 0.06F; |
147 | 141 |
|
148 |
| - ParticleEffect sphereParticleEffect = new ColoredTransmissionParticleEffect(new ExactPositionSource(orbTargetPos), 20, optionalItemColor.get()); |
149 |
| - clientWorld.addParticle(sphereParticleEffect, this.pos.getX() + 0.5D, this.pos.getY() + 1.0D, this.pos.getZ() + 0.5D, (orbTargetPos.getX() - this.pos.getX()) * 0.045, 0, (orbTargetPos.getZ() - this.pos.getZ()) * 0.045); |
| 142 | + clientWorld.addParticle(sparkleRisingParticleEffect, |
| 143 | + randomOffsetX, randomOffsetY, randomOffsetZ, |
| 144 | + randomVelocityX, randomVelocityY, randomVelocityZ); |
150 | 145 | }
|
151 | 146 |
|
152 |
| - world.playSound(null, this.pos, SpectrumSoundEvents.ENCHANTER_DING, SoundCategory.BLOCKS, SpectrumCommon.CONFIG.BlockSoundVolume, 0.7F + world.random.nextFloat() * 0.6F); |
| 147 | + ParticleEffect sphereParticleEffect = new ColoredTransmissionParticleEffect(new ExactPositionSource(orbTargetPos), 20, itemColor); |
| 148 | + clientWorld.addParticle(sphereParticleEffect, this.pos.getX() + 0.5D, this.pos.getY() + 1.0D, this.pos.getZ() + 0.5D, (orbTargetPos.getX() - this.pos.getX()) * 0.045, 0, (orbTargetPos.getZ() - this.pos.getZ()) * 0.045); |
153 | 149 | }
|
| 150 | + |
| 151 | + world.playSound(null, this.pos, SpectrumSoundEvents.ENCHANTER_DING, SoundCategory.BLOCKS, SpectrumCommon.CONFIG.BlockSoundVolume, 0.7F + world.random.nextFloat() * 0.6F); |
154 | 152 | }
|
155 | 153 | }
|
156 | 154 |
|
|
0 commit comments