made the particle packet nicer

This commit is contained in:
Ellpeck 2020-01-26 00:16:06 +01:00
parent 386dec00d1
commit 040f48b612
24 changed files with 408 additions and 402 deletions

View file

@ -73,7 +73,7 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali
BlockPos genPos = gen.getPos(); BlockPos genPos = gen.getPos();
PacketHandler.sendToAllAround(entity.world, pos, 32, new PacketParticles( PacketHandler.sendToAllAround(entity.world, pos, 32, new PacketParticles(
(float) entity.posX, (float) entity.posY, (float) entity.posZ, 17, (float) entity.posX, (float) entity.posY, (float) entity.posZ, PacketParticles.Type.ANIMAL_GEN_CONSUME,
child ? 1 : 0, child ? 1 : 0,
(int) (entity.getEyeHeight() * 10F), (int) (entity.getEyeHeight() * 10F),
genPos.getX(), genPos.getY(), genPos.getZ())); genPos.getX(), genPos.getY(), genPos.getZ()));

View file

@ -88,7 +88,7 @@ public class BlockDimensionRail extends AbstractRailBlock implements IModItem, I
return; return;
AxisAlignedBB box = cart.getBoundingBox(); AxisAlignedBB box = cart.getBoundingBox();
PacketHandler.sendToAllAround(world, pos, 32, new PacketParticles((float) box.minX, (float) box.minY, (float) box.minZ, 25, (int) ((box.maxX - box.minX) * 100F), (int) ((box.maxY - box.minY) * 100F), (int) ((box.maxZ - box.minZ) * 100F))); PacketHandler.sendToAllAround(world, pos, 32, new PacketParticles((float) box.minX, (float) box.minY, (float) box.minZ, PacketParticles.Type.DIMENSION_RAIL, (int) ((box.maxX - box.minX) * 100F), (int) ((box.maxY - box.minY) * 100F), (int) ((box.maxZ - box.minZ) * 100F)));
world.playSound(null, pos, SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.BLOCKS, 1F, 1F); world.playSound(null, pos, SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.BLOCKS, 1F, 1F);
BlockPos goalCoords = this.getGoalCoords(world, pos); BlockPos goalCoords = this.getGoalCoords(world, pos);

View file

@ -47,7 +47,7 @@ public class BlockPickupStopper extends BlockContainerImpl implements IVisualiza
if (item.world.getGameTime() % 3 == 0) if (item.world.getGameTime() % 3 == 0)
PacketHandler.sendToAllAround(item.world, pos, 32, PacketHandler.sendToAllAround(item.world, pos, 32,
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 14)); new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.PICKUP_STOPPER));
return true; return true;
}); });
} }

View file

@ -57,7 +57,7 @@ public class BlockProjectileGenerator extends BlockContainerImpl implements ITES
IAuraChunk.getAuraChunk(entity.world, spot).storeAura(spot, amount); IAuraChunk.getAuraChunk(entity.world, spot).storeAura(spot, amount);
PacketHandler.sendToAllAround(entity.world, pos, 32, PacketHandler.sendToAllAround(entity.world, pos, 32,
new PacketParticles((float) entity.posX, (float) entity.posY, (float) entity.posZ, 26, pos.getX(), pos.getY(), pos.getZ())); new PacketParticles((float) entity.posX, (float) entity.posY, (float) entity.posZ, PacketParticles.Type.PROJECTILE_GEN, pos.getX(), pos.getY(), pos.getZ()));
entity.world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.ENTITY_ENDER_EYE_LAUNCH, SoundCategory.BLOCKS, 0.8F, 1F); entity.world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.ENTITY_ENDER_EYE_LAUNCH, SoundCategory.BLOCKS, 0.8F, 1F);
generator.nextSide = generator.nextSide.rotateY(); generator.nextSide = generator.nextSide.rotateY();

View file

@ -61,7 +61,7 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable
IAuraChunk.getAuraChunk(world, spot).drainAura(spot, 200); IAuraChunk.getAuraChunk(world, spot).drainAura(spot, 200);
PacketHandler.sendToAllAround(world, lampPos, 32, PacketHandler.sendToAllAround(world, lampPos, 32,
new PacketParticles(lampPos.getX(), lampPos.getY(), lampPos.getZ(), 15)); new PacketParticles(lampPos.getX(), lampPos.getY(), lampPos.getZ(), PacketParticles.Type.SPAWN_LAMP));
} }
event.setResult(Event.Result.DENY); event.setResult(Event.Result.DENY);

View file

@ -31,7 +31,7 @@ public class TileEntityAnimalGenerator extends TileEntityImpl implements ITickab
} }
PacketHandler.sendToAllAround(this.world, this.pos, 32, PacketHandler.sendToAllAround(this.world, this.pos, 32,
new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 16)); new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), PacketParticles.Type.ANIMAL_GEN_CREATE));
} }
this.timeRemaining -= 10; this.timeRemaining -= 10;

View file

@ -90,7 +90,7 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable
for (ItemEntity item : items) { for (ItemEntity item : items) {
item.remove(); item.remove();
PacketHandler.sendToAllAround(this.world, this.pos, 32, PacketHandler.sendToAllAround(this.world, this.pos, 32,
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 19)); new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.ANIMAL_SPAWNER));
} }
this.currentRecipe = recipe; this.currentRecipe = recipe;

View file

@ -110,7 +110,7 @@ public class TileEntityAutoCrafter extends TileEntityImpl implements ITickableTi
} }
PacketHandler.sendToAllAround(this.world, this.pos, 32, PacketHandler.sendToAllAround(this.world, this.pos, 32,
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 19)); new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.ANIMAL_SPAWNER));
} }
} }
} }

View file

@ -73,7 +73,7 @@ public class TileEntityEndFlower extends TileEntityImpl implements ITickableTile
item.remove(); item.remove();
PacketHandler.sendToAllAround(this.world, this.pos, 32, PacketHandler.sendToAllAround(this.world, this.pos, 32,
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 21, this.container.getAuraColor())); new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.END_FLOWER_CONSUME, this.container.getAuraColor()));
break; break;
} }
} else { } else {
@ -88,7 +88,7 @@ public class TileEntityEndFlower extends TileEntityImpl implements ITickableTile
if (this.container.getStoredAura() <= 0) { if (this.container.getStoredAura() <= 0) {
this.world.setBlockState(this.pos, Blocks.DEAD_BUSH.getDefaultState()); this.world.setBlockState(this.pos, Blocks.DEAD_BUSH.getDefaultState());
PacketHandler.sendToAllAround(this.world, this.pos, 32, PacketHandler.sendToAllAround(this.world, this.pos, 32,
new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 18, this.container.getAuraColor())); new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), PacketParticles.Type.END_FLOWER_DECAY, this.container.getAuraColor()));
} }
} }
} else { } else {

View file

@ -110,7 +110,7 @@ public class TileEntityFireworkGenerator extends TileEntityImpl implements ITick
data.addAll(usedColors); data.addAll(usedColors);
PacketHandler.sendToAllLoaded(this.world, this.pos, new PacketParticles( PacketHandler.sendToAllLoaded(this.world, this.pos, new PacketParticles(
(float) this.trackedEntity.posX, (float) this.trackedEntity.posY, (float) this.trackedEntity.posZ, (float) this.trackedEntity.posX, (float) this.trackedEntity.posY, (float) this.trackedEntity.posZ,
24, Ints.toArray(data))); PacketParticles.Type.FIREWORK_GEN, Ints.toArray(data)));
} }
} }
@ -127,7 +127,7 @@ public class TileEntityFireworkGenerator extends TileEntityImpl implements ITick
} }
PacketHandler.sendToAllLoaded(this.world, this.pos, PacketHandler.sendToAllLoaded(this.world, this.pos,
new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 8)); new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), PacketParticles.Type.FLOWER_GEN_AURA_CREATION));
} }
} }
} }

View file

@ -91,9 +91,9 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab
this.pos.getZ() + 0.25F + this.world.rand.nextFloat() * 0.5F, this.pos.getZ() + 0.25F + this.world.rand.nextFloat() * 0.5F,
this.world.rand.nextFloat() * 0.02F + 0.1F, color, 1F this.world.rand.nextFloat() * 0.02F + 0.1F, color, 1F
)); ));
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 8)); PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), PacketParticles.Type.FLOWER_GEN_AURA_CREATION));
} }
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(pos.getX(), pos.getY(), pos.getZ(), 7, color)); PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(pos.getX(), pos.getY(), pos.getZ(), PacketParticles.Type.FLOWER_GEN_CONSUME, color));
} }
} }

View file

@ -63,7 +63,7 @@ public class TileEntityHopperUpgrade extends TileEntityImpl implements ITickable
IAuraChunk.getAuraChunk(this.world, spot).drainAura(spot, 500); IAuraChunk.getAuraChunk(this.world, spot).drainAura(spot, 500);
PacketHandler.sendToAllAround(this.world, this.pos, 32, PacketHandler.sendToAllAround(this.world, this.pos, 32,
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 10)); new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.HOPPER_UPGRADE));
} }
} }
} }

View file

@ -49,7 +49,7 @@ public class TileEntityMossGenerator extends TileEntityImpl implements ITickable
} }
PacketHandler.sendToAllAround(this.world, this.pos, 32, PacketHandler.sendToAllAround(this.world, this.pos, 32,
new PacketParticles(offset.getX(), offset.getY(), offset.getZ(), 23)); new PacketParticles(offset.getX(), offset.getY(), offset.getZ(), PacketParticles.Type.MOSS_GENERATOR));
} }
this.world.playEvent(2001, offset, Block.getStateId(state)); this.world.playEvent(2001, offset, Block.getStateId(state));

View file

@ -124,7 +124,7 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickableTi
this.container.drainAura(stored, false); this.container.drainAura(stored, false);
if (this.world.getGameTime() % 4 == 0) if (this.world.getGameTime() % 4 == 0)
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 4)); PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), PacketParticles.Type.ALTAR_CONVERSION));
} }
} }
} else { } else {
@ -142,7 +142,7 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickableTi
this.container.drainAura(req, false); this.container.drainAura(req, false);
if (this.timer % 4 == 0) if (this.timer % 4 == 0)
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 4)); PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), PacketParticles.Type.ALTAR_CONVERSION));
this.timer++; this.timer++;
if (this.timer >= this.currentRecipe.time) { if (this.timer >= this.currentRecipe.time) {

View file

@ -34,7 +34,7 @@ public class TileEntityOakGenerator extends TileEntityImpl implements ITickableT
} }
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles( PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(
this.pos.getX(), this.pos.getY(), this.pos.getZ(), 12, this.pos.getX(), this.pos.getY(), this.pos.getZ(), PacketParticles.Type.OAK_GENERATOR,
pos.getX(), pos.getY(), pos.getZ(), canGen ? 1 : 0)); pos.getX(), pos.getY(), pos.getZ(), canGen ? 1 : 0));
} }
} }

View file

@ -77,7 +77,7 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable
((ServerWorld) this.world).addLightningBolt(new LightningBoltEntity(this.world, this.pos.getX(), this.pos.getY(), this.pos.getZ(), true)); ((ServerWorld) this.world).addLightningBolt(new LightningBoltEntity(this.world, this.pos.getX(), this.pos.getY(), this.pos.getZ(), true));
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles( PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(
(float) item.posX, (float) item.posY, (float) item.posZ, 13, (float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.OFFERING_TABLE,
this.pos.getX(), this.pos.getY(), this.pos.getZ())); this.pos.getX(), this.pos.getY(), this.pos.getZ()));
break; break;

View file

@ -79,7 +79,7 @@ public class TileEntityPlacer extends TileEntityImpl implements ITickableTileEnt
BlockPos spot = IAuraChunk.getHighestSpot(this.world, this.pos, 10, this.pos); BlockPos spot = IAuraChunk.getHighestSpot(this.world, this.pos, 10, this.pos);
IAuraChunk.getAuraChunk(this.world, spot).drainAura(spot, 1000); IAuraChunk.getAuraChunk(this.world, spot).drainAura(spot, 1000);
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(pos.getX(), pos.getY(), pos.getZ(), 9)); PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(pos.getX(), pos.getY(), pos.getZ(), PacketParticles.Type.PLACER_PLACING));
return; return;
} }

View file

@ -44,7 +44,7 @@ public class TileEntityPotionGenerator extends TileEntityImpl implements ITickab
continue; continue;
} }
int toAdd = ((effect.getAmplifier() * 7 + 1) * (effect.getDuration() / 25)) * 100; int toAdd = (effect.getAmplifier() * 7 + 1) * (effect.getDuration() / 25) * 100;
boolean canGen = this.canGenerateRightNow(30, toAdd); boolean canGen = this.canGenerateRightNow(30, toAdd);
if (canGen) if (canGen)
while (toAdd > 0) { while (toAdd > 0) {
@ -53,7 +53,7 @@ public class TileEntityPotionGenerator extends TileEntityImpl implements ITickab
} }
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles( PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(
this.pos.getX(), this.pos.getY(), this.pos.getZ(), 5, this.pos.getX(), this.pos.getY(), this.pos.getZ(), PacketParticles.Type.POTION_GEN,
PotionUtils.getPotionColor(type), canGen ? 1 : 0)); PotionUtils.getPotionColor(type), canGen ? 1 : 0));
addedOne = true; addedOne = true;

View file

@ -85,7 +85,7 @@ public class TileEntityRFConverter extends TileEntityImpl implements ITickableTi
IAuraChunk.getAuraChunk(this.world, pos).drainAura(pos, amountToUse); IAuraChunk.getAuraChunk(this.world, pos).drainAura(pos, amountToUse);
PacketHandler.sendToAllAround(this.world, this.pos, 32, PacketHandler.sendToAllAround(this.world, this.pos, 32,
new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 20)); new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), PacketParticles.Type.RF_CONVERTER));
} }
} }

View file

@ -76,7 +76,7 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickableTile
}); });
PacketHandler.sendToAllAround(this.world, this.ritualPos, 32, PacketHandler.sendToAllAround(this.world, this.ritualPos, 32,
new PacketParticles(this.ritualPos.getX(), this.ritualPos.getY(), this.ritualPos.getZ(), 0)); new PacketParticles(this.ritualPos.getX(), this.ritualPos.getY(), this.ritualPos.getZ(), PacketParticles.Type.TR_GOLD_POWDER));
if (this.timer >= this.recipe.time) { if (this.timer >= this.recipe.time) {
this.recurseTreeDestruction(this.ritualPos, this.ritualPos); this.recurseTreeDestruction(this.ritualPos, this.ritualPos);
@ -91,7 +91,7 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickableTile
this.world.addEntity(item); this.world.addEntity(item);
PacketHandler.sendToAllAround(this.world, this.pos, 32, PacketHandler.sendToAllAround(this.world, this.pos, 32,
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 3)); new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.TR_SPAWN_RESULT));
this.world.playSound(null, this.pos.getX() + 0.5, this.pos.getY() + 0.5, this.pos.getZ() + 0.5, this.world.playSound(null, this.pos.getX() + 0.5, this.pos.getY() + 0.5, this.pos.getZ() + 0.5,
SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.BLOCKS, 0.65F, 1F); SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.BLOCKS, 0.65F, 1F);
@ -105,7 +105,7 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickableTile
TileEntityWoodStand stand = (TileEntityWoodStand) tile; TileEntityWoodStand stand = (TileEntityWoodStand) tile;
if (!stand.items.getStackInSlot(0).isEmpty()) { if (!stand.items.getStackInSlot(0).isEmpty()) {
PacketHandler.sendToAllAround(this.world, this.pos, 32, PacketHandler.sendToAllAround(this.world, this.pos, 32,
new PacketParticles(stand.pos.getX(), stand.pos.getY(), stand.pos.getZ(), 1)); new PacketParticles(stand.pos.getX(), stand.pos.getY(), stand.pos.getZ(), PacketParticles.Type.TR_CONSUME_ITEM));
this.world.playSound(null, stand.pos.getX() + 0.5, stand.pos.getY() + 0.5, stand.pos.getZ() + 0.5, this.world.playSound(null, stand.pos.getX() + 0.5, stand.pos.getY() + 0.5, stand.pos.getZ() + 0.5,
SoundEvents.BLOCK_WOOD_STEP, SoundCategory.BLOCKS, 0.5F, 1F); SoundEvents.BLOCK_WOOD_STEP, SoundCategory.BLOCKS, 0.5F, 1F);
@ -141,7 +141,7 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickableTile
BlockState state = this.world.getBlockState(offset); BlockState state = this.world.getBlockState(offset);
if (state.getBlock() instanceof LogBlock || state.getBlock() instanceof LeavesBlock) { if (state.getBlock() instanceof LogBlock || state.getBlock() instanceof LeavesBlock) {
this.world.setBlockState(offset, Blocks.AIR.getDefaultState()); this.world.setBlockState(offset, Blocks.AIR.getDefaultState());
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(offset.getX(), offset.getY(), offset.getZ(), 2)); PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(offset.getX(), offset.getY(), offset.getZ(), PacketParticles.Type.TR_DISAPPEAR));
this.recurseTreeDestruction(offset, start); this.recurseTreeDestruction(offset, start);
} }

View file

@ -78,7 +78,7 @@ public class PlantBoostEffect implements IDrainSpotEffect {
IAuraChunk.getAuraChunk(world, closestSpot).drainAura(closestSpot, 3500); IAuraChunk.getAuraChunk(world, closestSpot).drainAura(closestSpot, 3500);
PacketHandler.sendToAllAround(world, plantPos, 32, PacketHandler.sendToAllAround(world, plantPos, 32,
new PacketParticles(plantPos.getX(), plantPos.getY(), plantPos.getZ(), 6)); new PacketParticles(plantPos.getX(), plantPos.getY(), plantPos.getZ(), PacketParticles.Type.PLANT_BOOST));
} }
} }
} }

View file

@ -53,7 +53,7 @@ public class EntityMoverMinecart extends AbstractMinecartEntity {
if (!this.spotOffsets.isEmpty() && this.world.getGameTime() % 10 == 0) if (!this.spotOffsets.isEmpty() && this.world.getGameTime() % 10 == 0)
PacketHandler.sendToAllAround(this.world, pos, 32, new PacketParticles( PacketHandler.sendToAllAround(this.world, pos, 32, new PacketParticles(
(float) this.posX, (float) this.posY, (float) this.posZ, 22, (float) this.posX, (float) this.posY, (float) this.posZ, PacketParticles.Type.MOVER_CART,
MathHelper.floor(this.getMotion().getX() * 100F), MathHelper.floor(this.getMotion().getY() * 100F), MathHelper.floor(this.getMotion().getZ() * 100F))); MathHelper.floor(this.getMotion().getX() * 100F), MathHelper.floor(this.getMotion().getY() * 100F), MathHelper.floor(this.getMotion().getZ() * 100F)));
if (pos.distanceSq(this.lastPosition) < 8 * 8) if (pos.distanceSq(this.lastPosition) < 8 * 8)

View file

@ -19,7 +19,6 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.potion.EffectInstance; import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects; import net.minecraft.potion.Effects;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
@ -28,7 +27,6 @@ import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -105,7 +103,7 @@ public class ShockwaveCreator extends ItemImpl implements ITrinketItem {
worldIn.playSound(null, pos, type.getBreakSound(), SoundCategory.BLOCKS, type.getVolume() * 0.5F, type.getPitch() * 0.8F); worldIn.playSound(null, pos, type.getBreakSound(), SoundCategory.BLOCKS, type.getVolume() * 0.5F, type.getPitch() * 0.8F);
} }
PacketHandler.sendToAllAround(worldIn, pos, 32, new PacketParticles((float) living.posX, (float) living.posY, (float) living.posZ, 11)); PacketHandler.sendToAllAround(worldIn, pos, 32, new PacketParticles((float) living.posX, (float) living.posY, (float) living.posZ, PacketParticles.Type.SHOCKWAVE_CREATOR));
} }
} }

View file

@ -14,6 +14,7 @@ import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeColors; import net.minecraft.world.biome.BiomeColors;
import net.minecraftforge.fml.network.NetworkEvent; import net.minecraftforge.fml.network.NetworkEvent;
import java.util.function.BiConsumer;
import java.util.function.Supplier; import java.util.function.Supplier;
public class PacketParticles { public class PacketParticles {
@ -21,10 +22,10 @@ public class PacketParticles {
private float posX; private float posX;
private float posY; private float posY;
private float posZ; private float posZ;
private int type; private Type type;
private int[] data; private int[] data;
public PacketParticles(float posX, float posY, float posZ, int type, int... data) { public PacketParticles(float posX, float posY, float posZ, Type type, int... data) {
this.posX = posX; this.posX = posX;
this.posY = posY; this.posY = posY;
this.posZ = posZ; this.posZ = posZ;
@ -41,7 +42,7 @@ public class PacketParticles {
packet.posX = buf.readFloat(); packet.posX = buf.readFloat();
packet.posY = buf.readFloat(); packet.posY = buf.readFloat();
packet.posZ = buf.readFloat(); packet.posZ = buf.readFloat();
packet.type = buf.readByte(); packet.type = Type.values()[buf.readByte()];
packet.data = new int[buf.readByte()]; packet.data = new int[buf.readByte()];
for (int i = 0; i < packet.data.length; i++) { for (int i = 0; i < packet.data.length; i++) {
@ -55,7 +56,7 @@ public class PacketParticles {
buf.writeFloat(packet.posX); buf.writeFloat(packet.posX);
buf.writeFloat(packet.posY); buf.writeFloat(packet.posY);
buf.writeFloat(packet.posZ); buf.writeFloat(packet.posZ);
buf.writeByte(packet.type); buf.writeByte(packet.type.ordinal());
buf.writeByte(packet.data.length); buf.writeByte(packet.data.length);
for (int i : packet.data) { for (int i : packet.data) {
@ -63,6 +64,376 @@ public class PacketParticles {
} }
} }
public enum Type {
TR_GOLD_POWDER((message, world) -> {
BlockPos pos = new BlockPos(message.posX, message.posY, message.posZ);
Multiblocks.TREE_RITUAL.forEach(pos, 'G', (dustPos, matcher) -> {
BlockState state = world.getBlockState(dustPos);
AxisAlignedBB box = state.getShape(world, dustPos).getBoundingBox();
NaturesAuraAPI.instance().spawnMagicParticle(
dustPos.getX() + box.minX + (box.maxX - box.minX) * world.rand.nextFloat(),
dustPos.getY() + 0.1F,
dustPos.getZ() + box.minZ + (box.maxZ - box.minZ) * world.rand.nextFloat(),
(float) world.rand.nextGaussian() * 0.02F,
world.rand.nextFloat() * 0.01F + 0.02F,
(float) world.rand.nextGaussian() * 0.02F,
0xf4cb42, 2F, 50, 0F, false, true);
return true;
});
}),
TR_CONSUME_ITEM((message, world) -> {
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--) {
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + 0.5F, message.posY + 0.9F, message.posZ + 0.5F,
(float) world.rand.nextGaussian() * 0.04F, world.rand.nextFloat() * 0.04F, (float) world.rand.nextGaussian() * 0.04F,
0x89cc37, 1.5F, 25, 0F, false, true);
}
}),
TR_DISAPPEAR((message, world) -> {
for (int i = world.rand.nextInt(5) + 3; i >= 0; i--) {
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + world.rand.nextFloat(), message.posY + world.rand.nextFloat(), message.posZ + world.rand.nextFloat(),
0F, 0F, 0F,
0x33FF33, 1F, 50, 0F, false, true);
}
}),
TR_SPAWN_RESULT((message, world) -> {
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--) {
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX, message.posY, message.posZ,
world.rand.nextGaussian() * 0.1F, world.rand.nextGaussian() * 0.1F, world.rand.nextGaussian() * 0.1F,
0x89cc37, 2F, 100, 0F, true, true);
}
}),
ALTAR_CONVERSION((message, world) -> {
for (int i = world.rand.nextInt(5) + 2; i >= 0; i--) {
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
message.posY + 0.9F + 0.25F * world.rand.nextFloat(),
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
world.rand.nextGaussian() * 0.02F, world.rand.nextFloat() * 0.02F, world.rand.nextGaussian() * 0.02F,
0x00FF00, world.rand.nextFloat() * 1.5F + 0.75F, 20, 0F, false, true);
}
}),
POTION_GEN((message, world) -> {
int color = message.data[0];
boolean releaseAura = message.data[1] > 0;
for (int i = world.rand.nextInt(5) + 5; i >= 0; i--) {
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + world.rand.nextFloat(),
message.posY + 1.1F,
message.posZ + world.rand.nextFloat(),
world.rand.nextGaussian() * 0.01F, world.rand.nextFloat() * 0.1F, world.rand.nextGaussian() * 0.01F,
color, 2F + world.rand.nextFloat(), 40, 0F, true, true);
if (releaseAura)
for (int x = -1; x <= 1; x += 2)
for (int z = -1; z <= 1; z += 2) {
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + x * 3 + 0.5F,
message.posY + 2.5,
message.posZ + z * 3 + 0.5F,
world.rand.nextGaussian() * 0.02F,
world.rand.nextFloat() * 0.04F,
world.rand.nextGaussian() * 0.02F,
0xd6340c, 1F + world.rand.nextFloat() * 2F, 75, 0F, true, true);
}
}
}),
PLANT_BOOST((message, world) -> {
for (int i = world.rand.nextInt(20) + 15; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + world.rand.nextFloat(),
message.posY + 0.25F + world.rand.nextFloat() * 0.5F,
message.posZ + world.rand.nextFloat(),
0F, world.rand.nextFloat() * 0.02F, 0F,
0x5ccc30, 1F + world.rand.nextFloat() * 2F, 50, 0F, false, true);
}),
FLOWER_GEN_CONSUME((message, world) -> {
int color = message.data[0];
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
message.posY + 0.25F + world.rand.nextFloat() * 0.5F,
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
world.rand.nextGaussian() * 0.02F,
world.rand.nextGaussian() * 0.02F,
world.rand.nextGaussian() * 0.02F,
color, world.rand.nextFloat() * 2F + 1F, 25, 0F, false, true);
}),
FLOWER_GEN_AURA_CREATION((message, world) -> {
for (int i = world.rand.nextInt(10) + 5; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
message.posY + 1.01F,
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
world.rand.nextGaussian() * 0.01F,
world.rand.nextFloat() * 0.04F + 0.02F,
world.rand.nextGaussian() * 0.01F,
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, false, true);
}),
PLACER_PLACING((message, world) -> {
for (int i = world.rand.nextInt(20) + 20; i >= 0; i--) {
boolean side = world.rand.nextBoolean();
float x = side ? world.rand.nextFloat() : world.rand.nextBoolean() ? 1.1F : -0.1F;
float z = !side ? world.rand.nextFloat() : world.rand.nextBoolean() ? 1.1F : -0.1F;
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + x, message.posY + 0.1F + world.rand.nextFloat() * 0.98F, message.posZ + z,
0F, 0F, 0F,
0xad7a37, world.rand.nextFloat() + 1F, 50, 0F, true, true);
}
}),
HOPPER_UPGRADE((message, world) -> {
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX, message.posY + 0.45F, message.posZ,
world.rand.nextGaussian() * 0.015F,
world.rand.nextGaussian() * 0.015F,
world.rand.nextGaussian() * 0.015F,
0xdde7ff, world.rand.nextFloat() + 1F, 30, -0.06F, true, true);
}),
SHOCKWAVE_CREATOR((message, world) -> {
for (int i = 0; i < 360; i += 2) {
double rad = Math.toRadians(i);
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX, message.posY + 0.01F, message.posZ,
(float) Math.sin(rad) * 0.65F,
0F,
(float) Math.cos(rad) * 0.65F,
0x911b07, 3F, 10, 0F, false, true);
}
}),
OAK_GENERATOR((message, world) -> {
int sapX = message.data[0];
int sapY = message.data[1];
int sapZ = message.data[2];
boolean releaseAura = message.data[3] > 0;
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
NaturesAuraAPI.instance().spawnParticleStream(
sapX + 0.5F + (float) world.rand.nextGaussian() * 3F,
sapY + 0.5F + world.rand.nextFloat() * 4F,
sapZ + 0.5F + (float) world.rand.nextGaussian() * 3F,
message.posX + 0.5F,
message.posY + 0.5F,
message.posZ + 0.5F,
0.6F, BiomeColors.getFoliageColor(world, new BlockPos(sapX, sapY, sapZ)), 1.5F);
if (releaseAura)
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
message.posY + 1.01F,
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
world.rand.nextGaussian() * 0.03F,
world.rand.nextFloat() * 0.04F + 0.04F,
world.rand.nextGaussian() * 0.03F,
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 60, 0F, false, true);
}),
OFFERING_TABLE((message, world) -> {
int genX = message.data[0];
int genY = message.data[1];
int genZ = message.data[2];
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX, message.posY + 0.5F, message.posZ,
world.rand.nextGaussian() * 0.02F,
world.rand.nextFloat() * 0.25F,
world.rand.nextGaussian() * 0.02F,
0xffadfd, 1.5F, 40, 0F, false, true);
for (int i = world.rand.nextInt(50) + 30; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
genX + 0.5F + world.rand.nextGaussian() * 2.5F,
genY + 0.1F,
genZ + 0.5F + world.rand.nextGaussian() * 2.5F,
world.rand.nextGaussian() * 0.01F,
world.rand.nextFloat() * 0.01F,
world.rand.nextGaussian() * 0.01F,
0xd3e4ff, 1.5F, 150, 0F, false, true);
}),
PICKUP_STOPPER((message, world) -> {
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX, message.posY + 0.4F, message.posZ,
world.rand.nextGaussian() * 0.005F,
world.rand.nextFloat() * 0.005F,
world.rand.nextGaussian() * 0.005F,
0xcc3116, 1.5F, 40, 0F, false, true);
}),
SPAWN_LAMP((message, world) -> {
for (int i = world.rand.nextInt(5) + 5; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + 0.3F + world.rand.nextFloat() * 0.4F,
message.posY + 0.15F + world.rand.nextFloat() * 0.5F,
message.posZ + 0.3F + world.rand.nextFloat() * 0.4F,
0F, 0F, 0F,
0xf4a142, 1F, 30, 0F, false, true);
}),
ANIMAL_GEN_CREATE((message, world) -> {
for (int i = world.rand.nextInt(5) + 5; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
message.posY + 1.01F,
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
world.rand.nextGaussian() * 0.01F,
world.rand.nextFloat() * 0.04F + 0.02F,
world.rand.nextGaussian() * 0.01F,
0xd13308, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, false, true);
}),
ANIMAL_GEN_CONSUME((message, world) -> {
boolean child = message.data[0] > 0;
float height = message.data[1] / 10F;
int genX = message.data[2];
int genY = message.data[3];
int genZ = message.data[4];
for (int i = child ? world.rand.nextInt(10) + 10 : world.rand.nextInt(20) + 20; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + world.rand.nextGaussian() * 0.25F,
message.posY + height * 0.75F + world.rand.nextGaussian() * 0.25F,
message.posZ + world.rand.nextGaussian() * 0.25F,
world.rand.nextGaussian() * 0.01F,
world.rand.nextFloat() * 0.01F,
world.rand.nextGaussian() * 0.01F,
0x42f4c8, world.rand.nextFloat() * (child ? 0.5F : 2F) + 1F, world.rand.nextInt(30) + 40, 0F, true, true);
NaturesAuraAPI.instance().spawnParticleStream(
message.posX, message.posY + height * 0.75F, message.posZ,
genX + 0.5F, genY + 0.5F, genZ + 0.5F,
0.15F, 0x41c4f4, child ? 1.5F : 3F);
}),
END_FLOWER_DECAY((message, world) -> {
int color = message.data[0];
for (int i = world.rand.nextInt(10) + 20; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + world.rand.nextFloat(),
message.posY + world.rand.nextFloat(),
message.posZ + world.rand.nextFloat(),
world.rand.nextGaussian() * 0.01F,
world.rand.nextFloat() * 0.01F,
world.rand.nextGaussian() * 0.01F,
color, 1.5F, 80, 0F, true, true);
}),
ANIMAL_SPAWNER((message, world) -> {
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX, message.posY + 0.5F, message.posZ,
world.rand.nextGaussian() * 0.02F,
world.rand.nextFloat() * 0.02F,
world.rand.nextGaussian() * 0.02F,
0x16b7b2, 1.5F, 40, 0F, false, true);
}),
RF_CONVERTER((message, world) -> {
for (int i = world.rand.nextInt(5) + 2; i >= 0; i--)
Multiblocks.RF_CONVERTER.forEach(new BlockPos(message.posX, message.posY, message.posZ), 'R', (blockPos, matcher) -> {
if (world.rand.nextFloat() < 0.35F) {
NaturesAuraAPI.instance().spawnParticleStream(
blockPos.getX() + world.rand.nextFloat(),
blockPos.getY() + world.rand.nextFloat(),
blockPos.getZ() + world.rand.nextFloat(),
message.posX + world.rand.nextFloat(),
message.posY + world.rand.nextFloat(),
message.posZ + world.rand.nextFloat(),
0.05F, 0xff1a05, 1.5F);
}
return true;
});
}),
END_FLOWER_CONSUME((message, world) -> {
int color = message.data[0];
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX, message.posY + 0.5F, message.posZ,
world.rand.nextGaussian() * 0.01F,
world.rand.nextFloat() * 0.01F,
world.rand.nextGaussian() * 0.01F,
color, 1.5F, 40, 0F, false, true);
}),
MOVER_CART((message, world) -> {
float motionX = message.data[0] / 100F;
float motionY = message.data[1] / 100F;
float motionZ = message.data[2] / 100F;
for (int i = world.rand.nextInt(60) + 30; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + world.rand.nextGaussian() * 10F,
message.posY + world.rand.nextGaussian() * 10F,
message.posZ + world.rand.nextGaussian() * 10F,
motionX * 0.2F, motionY * 0.2F, motionZ * 0.2F,
IAuraType.forWorld(world).getColor(), 2F, 30, 0F, false, true);
}),
MOSS_GENERATOR((message, world) -> {
for (int i = world.rand.nextInt(30) + 30; i >= 0; i--) {
int side = world.rand.nextInt(3);
float x = side != 0 ? world.rand.nextFloat() : world.rand.nextBoolean() ? 1.1F : -0.1F;
float y = side != 1 ? world.rand.nextFloat() : world.rand.nextBoolean() ? 1.1F : -0.1F;
float z = side != 2 ? world.rand.nextFloat() : world.rand.nextBoolean() ? 1.1F : -0.1F;
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + x,
message.posY + y,
message.posZ + z,
0F, 0F, 0F,
0x184c0d, world.rand.nextFloat() + 1F, 30, 0F, true, true);
}
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + world.rand.nextFloat(),
message.posY + 1F,
message.posZ + world.rand.nextFloat(),
world.rand.nextGaussian() * 0.01F,
world.rand.nextFloat() * 0.04F + 0.02F,
world.rand.nextGaussian() * 0.01F,
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, true, true);
}),
FIREWORK_GEN((message, world) -> {
int goalX = message.data[0];
int goalY = message.data[1];
int goalZ = message.data[2];
NaturesAuraAPI.instance().setParticleSpawnRange(64);
for (int i = world.rand.nextInt(30) + 30; i >= 0; i--)
NaturesAuraAPI.instance().spawnParticleStream(
message.posX + (float) world.rand.nextGaussian(),
message.posY + (float) world.rand.nextGaussian(),
message.posZ + (float) world.rand.nextGaussian(),
goalX + 0.25F + world.rand.nextFloat() * 0.5F,
goalY + 0.25F + world.rand.nextFloat() * 0.5F,
goalZ + 0.25F + world.rand.nextFloat() * 0.5F,
0.65F, message.data[3 + world.rand.nextInt(message.data.length - 3)], 1F);
NaturesAuraAPI.instance().setParticleSpawnRange(32);
}),
DIMENSION_RAIL((message, world) -> {
float width = message.data[0] / 100F;
float height = message.data[1] / 100F;
float depth = message.data[2] / 100F;
for (int i = world.rand.nextInt(100) + 50; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + world.rand.nextFloat() * width,
message.posY + world.rand.nextFloat() * height,
message.posZ + world.rand.nextFloat() * depth,
0F, 0F, 0F, 0xd60cff, 1F + world.rand.nextFloat(), 60, 0F, false, true);
}),
PROJECTILE_GEN((message, world) -> {
int x = message.data[0];
int y = message.data[1];
int z = message.data[2];
for (int i = world.rand.nextInt(10) + 5; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
x + 0.25F + world.rand.nextFloat() * 0.5F,
y + 1.01F,
z + 0.25F + world.rand.nextFloat() * 0.5F,
world.rand.nextGaussian() * 0.01F,
world.rand.nextFloat() * 0.04F + 0.02F,
world.rand.nextGaussian() * 0.01F,
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, false, true);
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--)
world.addParticle(ParticleTypes.FIREWORK,
message.posX, message.posY, message.posZ,
world.rand.nextGaussian() * 0.03F,
world.rand.nextGaussian() * 0.03F,
world.rand.nextGaussian() * 0.03F);
});
public final BiConsumer<PacketParticles, World> action;
Type(BiConsumer<PacketParticles, World> action) {
this.action = action;
}
}
// lambda causes classloading issues on a server here // lambda causes classloading issues on a server here
@SuppressWarnings("Convert2Lambda") @SuppressWarnings("Convert2Lambda")
public static void onMessage(PacketParticles message, Supplier<NetworkEvent.Context> ctx) { public static void onMessage(PacketParticles message, Supplier<NetworkEvent.Context> ctx) {
@ -70,371 +441,8 @@ public class PacketParticles {
@Override @Override
public void run() { public void run() {
World world = Minecraft.getInstance().world; World world = Minecraft.getInstance().world;
if (world != null) { if (world != null)
switch (message.type) { message.type.action.accept(message, world);
case 0: // Tree ritual: Gold powder
BlockPos pos = new BlockPos(message.posX, message.posY, message.posZ);
Multiblocks.TREE_RITUAL.forEach(pos, 'G', (dustPos, matcher) -> {
BlockState state = world.getBlockState(dustPos);
AxisAlignedBB box = state.getShape(world, dustPos).getBoundingBox();
NaturesAuraAPI.instance().spawnMagicParticle(
dustPos.getX() + box.minX + (box.maxX - box.minX) * world.rand.nextFloat(),
dustPos.getY() + 0.1F,
dustPos.getZ() + box.minZ + (box.maxZ - box.minZ) * world.rand.nextFloat(),
(float) world.rand.nextGaussian() * 0.02F,
world.rand.nextFloat() * 0.01F + 0.02F,
(float) world.rand.nextGaussian() * 0.02F,
0xf4cb42, 2F, 50, 0F, false, true);
return true;
});
break;
case 1: // Tree ritual: Consuming item
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--) {
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + 0.5F, message.posY + 0.9F, message.posZ + 0.5F,
(float) world.rand.nextGaussian() * 0.04F, world.rand.nextFloat() * 0.04F, (float) world.rand.nextGaussian() * 0.04F,
0x89cc37, 1.5F, 25, 0F, false, true);
}
break;
case 2: // Tree ritual: Tree disappearing
for (int i = world.rand.nextInt(5) + 3; i >= 0; i--) {
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + world.rand.nextFloat(), message.posY + world.rand.nextFloat(), message.posZ + world.rand.nextFloat(),
0F, 0F, 0F,
0x33FF33, 1F, 50, 0F, false, true);
}
break;
case 3: // Tree ritual: Spawn result item
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--) {
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX, message.posY, message.posZ,
world.rand.nextGaussian() * 0.1F, world.rand.nextGaussian() * 0.1F, world.rand.nextGaussian() * 0.1F,
0x89cc37, 2F, 100, 0F, true, true);
}
break;
case 4: // Nature altar: Conversion
for (int i = world.rand.nextInt(5) + 2; i >= 0; i--) {
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
message.posY + 0.9F + 0.25F * world.rand.nextFloat(),
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
world.rand.nextGaussian() * 0.02F, world.rand.nextFloat() * 0.02F, world.rand.nextGaussian() * 0.02F,
0x00FF00, world.rand.nextFloat() * 1.5F + 0.75F, 20, 0F, false, true);
}
break;
case 5: // Potion generator
int color = message.data[0];
boolean releaseAura = message.data[1] > 0;
for (int i = world.rand.nextInt(5) + 5; i >= 0; i--) {
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + world.rand.nextFloat(),
message.posY + 1.1F,
message.posZ + world.rand.nextFloat(),
world.rand.nextGaussian() * 0.01F, world.rand.nextFloat() * 0.1F, world.rand.nextGaussian() * 0.01F,
color, 2F + world.rand.nextFloat(), 40, 0F, true, true);
if (releaseAura)
for (int x = -1; x <= 1; x += 2)
for (int z = -1; z <= 1; z += 2) {
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + x * 3 + 0.5F,
message.posY + 2.5,
message.posZ + z * 3 + 0.5F,
world.rand.nextGaussian() * 0.02F,
world.rand.nextFloat() * 0.04F,
world.rand.nextGaussian() * 0.02F,
0xd6340c, 1F + world.rand.nextFloat() * 2F, 75, 0F, true, true);
}
}
break;
case 6: // Plant boost effect
for (int i = world.rand.nextInt(20) + 15; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + world.rand.nextFloat(),
message.posY + 0.25F + world.rand.nextFloat() * 0.5F,
message.posZ + world.rand.nextFloat(),
0F, world.rand.nextFloat() * 0.02F, 0F,
0x5ccc30, 1F + world.rand.nextFloat() * 2F, 50, 0F, false, true);
break;
case 7: // Flower generator consumation
color = message.data[0];
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
message.posY + 0.25F + world.rand.nextFloat() * 0.5F,
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
world.rand.nextGaussian() * 0.02F,
world.rand.nextGaussian() * 0.02F,
world.rand.nextGaussian() * 0.02F,
color, world.rand.nextFloat() * 2F + 1F, 25, 0F, false, true);
break;
case 8: // Flower generator, firework generator aura creation
for (int i = world.rand.nextInt(10) + 5; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
message.posY + 1.01F,
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
world.rand.nextGaussian() * 0.01F,
world.rand.nextFloat() * 0.04F + 0.02F,
world.rand.nextGaussian() * 0.01F,
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, false, true);
break;
case 9: // Placer placing
for (int i = world.rand.nextInt(20) + 20; i >= 0; i--) {
boolean side = world.rand.nextBoolean();
float x = side ? world.rand.nextFloat() : (world.rand.nextBoolean() ? 1.1F : -0.1F);
float z = !side ? world.rand.nextFloat() : (world.rand.nextBoolean() ? 1.1F : -0.1F);
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + x, message.posY + 0.1F + world.rand.nextFloat() * 0.98F, message.posZ + z,
0F, 0F, 0F,
0xad7a37, world.rand.nextFloat() + 1F, 50, 0F, true, true);
}
break;
case 10: // Hopper upgrade picking up
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX, message.posY + 0.45F, message.posZ,
world.rand.nextGaussian() * 0.015F,
world.rand.nextGaussian() * 0.015F,
world.rand.nextGaussian() * 0.015F,
0xdde7ff, world.rand.nextFloat() + 1F, 30, -0.06F, true, true);
break;
case 11: // Shockwave creator particles
for (int i = 0; i < 360; i += 2) {
double rad = Math.toRadians(i);
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX, message.posY + 0.01F, message.posZ,
(float) Math.sin(rad) * 0.65F,
0F,
(float) Math.cos(rad) * 0.65F,
0x911b07, 3F, 10, 0F, false, true);
}
break;
case 12: // Oak generator
int sapX = message.data[0];
int sapY = message.data[1];
int sapZ = message.data[2];
releaseAura = message.data[3] > 0;
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
NaturesAuraAPI.instance().spawnParticleStream(
sapX + 0.5F + (float) world.rand.nextGaussian() * 3F,
sapY + 0.5F + world.rand.nextFloat() * 4F,
sapZ + 0.5F + (float) world.rand.nextGaussian() * 3F,
message.posX + 0.5F,
message.posY + 0.5F,
message.posZ + 0.5F,
0.6F, BiomeColors.getFoliageColor(world, new BlockPos(sapX, sapY, sapZ)), 1.5F);
if (releaseAura)
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
message.posY + 1.01F,
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
world.rand.nextGaussian() * 0.03F,
world.rand.nextFloat() * 0.04F + 0.04F,
world.rand.nextGaussian() * 0.03F,
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 60, 0F, false, true);
break;
case 13: // Offering table
int genX = message.data[0];
int genY = message.data[1];
int genZ = message.data[2];
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX, message.posY + 0.5F, message.posZ,
world.rand.nextGaussian() * 0.02F,
world.rand.nextFloat() * 0.25F,
world.rand.nextGaussian() * 0.02F,
0xffadfd, 1.5F, 40, 0F, false, true);
for (int i = world.rand.nextInt(50) + 30; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
genX + 0.5F + world.rand.nextGaussian() * 2.5F,
genY + 0.1F,
genZ + 0.5F + world.rand.nextGaussian() * 2.5F,
world.rand.nextGaussian() * 0.01F,
world.rand.nextFloat() * 0.01F,
world.rand.nextGaussian() * 0.01F,
0xd3e4ff, 1.5F, 150, 0F, false, true);
break;
case 14: // Pickup stopper
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX, message.posY + 0.4F, message.posZ,
world.rand.nextGaussian() * 0.005F,
world.rand.nextFloat() * 0.005F,
world.rand.nextGaussian() * 0.005F,
0xcc3116, 1.5F, 40, 0F, false, true);
break;
case 15: // Spawn lamp
for (int i = world.rand.nextInt(5) + 5; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + 0.3F + world.rand.nextFloat() * 0.4F,
message.posY + 0.15F + world.rand.nextFloat() * 0.5F,
message.posZ + 0.3F + world.rand.nextFloat() * 0.4F,
0F, 0F, 0F,
0xf4a142, 1F, 30, 0F, false, true);
break;
case 16: // Animal generator aura creation
for (int i = world.rand.nextInt(5) + 5; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
message.posY + 1.01F,
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
world.rand.nextGaussian() * 0.01F,
world.rand.nextFloat() * 0.04F + 0.02F,
world.rand.nextGaussian() * 0.01F,
0xd13308, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, false, true);
break;
case 17: // Animal generator consuming
boolean child = message.data[0] > 0;
float height = message.data[1] / 10F;
genX = message.data[2];
genY = message.data[3];
genZ = message.data[4];
for (int i = (child ? world.rand.nextInt(10) + 10 : world.rand.nextInt(20) + 20); i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + world.rand.nextGaussian() * 0.25F,
message.posY + height * 0.75F + world.rand.nextGaussian() * 0.25F,
message.posZ + world.rand.nextGaussian() * 0.25F,
world.rand.nextGaussian() * 0.01F,
world.rand.nextFloat() * 0.01F,
world.rand.nextGaussian() * 0.01F,
0x42f4c8, world.rand.nextFloat() * (child ? 0.5F : 2F) + 1F, world.rand.nextInt(30) + 40, 0F, true, true);
NaturesAuraAPI.instance().spawnParticleStream(
message.posX, message.posY + height * 0.75F, message.posZ,
genX + 0.5F, genY + 0.5F, genZ + 0.5F,
0.15F, 0x41c4f4, child ? 1.5F : 3F);
break;
case 18: // End flower decay
color = message.data[0];
for (int i = world.rand.nextInt(10) + 20; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + world.rand.nextFloat(),
message.posY + world.rand.nextFloat(),
message.posZ + world.rand.nextFloat(),
world.rand.nextGaussian() * 0.01F,
world.rand.nextFloat() * 0.01F,
world.rand.nextGaussian() * 0.01F,
color, 1.5F, 80, 0F, true, true);
break;
case 19: // Animal spawner, auto crafter
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX, message.posY + 0.5F, message.posZ,
world.rand.nextGaussian() * 0.02F,
world.rand.nextFloat() * 0.02F,
world.rand.nextGaussian() * 0.02F,
0x16b7b2, 1.5F, 40, 0F, false, true);
break;
case 20: // RF converter
for (int i = world.rand.nextInt(5) + 2; i >= 0; i--)
Multiblocks.RF_CONVERTER.forEach(new BlockPos(message.posX, message.posY, message.posZ), 'R', (blockPos, matcher) -> {
if (world.rand.nextFloat() < 0.35F) {
NaturesAuraAPI.instance().spawnParticleStream(
blockPos.getX() + world.rand.nextFloat(),
blockPos.getY() + world.rand.nextFloat(),
blockPos.getZ() + world.rand.nextFloat(),
message.posX + world.rand.nextFloat(),
message.posY + world.rand.nextFloat(),
message.posZ + world.rand.nextFloat(),
0.05F, 0xff1a05, 1.5F);
}
return true;
});
break;
case 21: // End flower item consuming
color = message.data[0];
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX, message.posY + 0.5F, message.posZ,
world.rand.nextGaussian() * 0.01F,
world.rand.nextFloat() * 0.01F,
world.rand.nextGaussian() * 0.01F,
color, 1.5F, 40, 0F, false, true);
break;
case 22: // Mover cart
float motionX = message.data[0] / 100F;
float motionY = message.data[1] / 100F;
float motionZ = message.data[2] / 100F;
for (int i = world.rand.nextInt(60) + 30; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + world.rand.nextGaussian() * 10F,
message.posY + world.rand.nextGaussian() * 10F,
message.posZ + world.rand.nextGaussian() * 10F,
motionX * 0.2F, motionY * 0.2F, motionZ * 0.2F,
IAuraType.forWorld(world).getColor(), 2F, 30, 0F, false, true);
break;
case 23: // Moss generator
for (int i = world.rand.nextInt(30) + 30; i >= 0; i--) {
int side = world.rand.nextInt(3);
float x = side != 0 ? world.rand.nextFloat() : (world.rand.nextBoolean() ? 1.1F : -0.1F);
float y = side != 1 ? world.rand.nextFloat() : (world.rand.nextBoolean() ? 1.1F : -0.1F);
float z = side != 2 ? world.rand.nextFloat() : (world.rand.nextBoolean() ? 1.1F : -0.1F);
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + x,
message.posY + y,
message.posZ + z,
0F, 0F, 0F,
0x184c0d, world.rand.nextFloat() + 1F, 30, 0F, true, true);
}
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + world.rand.nextFloat(),
message.posY + 1F,
message.posZ + world.rand.nextFloat(),
world.rand.nextGaussian() * 0.01F,
world.rand.nextFloat() * 0.04F + 0.02F,
world.rand.nextGaussian() * 0.01F,
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, true, true);
break;
case 24: // Firework generator
int goalX = message.data[0];
int goalY = message.data[1];
int goalZ = message.data[2];
NaturesAuraAPI.instance().setParticleSpawnRange(64);
for (int i = world.rand.nextInt(30) + 30; i >= 0; i--)
NaturesAuraAPI.instance().spawnParticleStream(
message.posX + (float) world.rand.nextGaussian(),
message.posY + (float) world.rand.nextGaussian(),
message.posZ + (float) world.rand.nextGaussian(),
goalX + 0.25F + world.rand.nextFloat() * 0.5F,
goalY + 0.25F + world.rand.nextFloat() * 0.5F,
goalZ + 0.25F + world.rand.nextFloat() * 0.5F,
0.65F, message.data[3 + world.rand.nextInt(message.data.length - 3)], 1F);
NaturesAuraAPI.instance().setParticleSpawnRange(32);
break;
case 25: // Dimension rail
float width = message.data[0] / 100F;
height = message.data[1] / 100F;
float depth = message.data[2] / 100F;
for (int i = world.rand.nextInt(100) + 50; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + world.rand.nextFloat() * width,
message.posY + world.rand.nextFloat() * height,
message.posZ + world.rand.nextFloat() * depth,
0F, 0F, 0F, 0xd60cff, 1F + world.rand.nextFloat(), 60, 0F, false, true);
break;
case 26: // Projectile generator
int x = message.data[0];
int y = message.data[1];
int z = message.data[2];
for (int i = world.rand.nextInt(10) + 5; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
x + 0.25F + world.rand.nextFloat() * 0.5F,
y + 1.01F,
z + 0.25F + world.rand.nextFloat() * 0.5F,
world.rand.nextGaussian() * 0.01F,
world.rand.nextFloat() * 0.04F + 0.02F,
world.rand.nextGaussian() * 0.01F,
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, false, true);
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--)
world.addParticle(ParticleTypes.FIREWORK,
message.posX, message.posY, message.posZ,
world.rand.nextGaussian() * 0.03F,
world.rand.nextGaussian() * 0.03F,
world.rand.nextGaussian() * 0.03F);
}
}
} }
}); });
ctx.get().setPacketHandled(true); ctx.get().setPacketHandled(true);