mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 19:58:34 +01:00
made the particle packet nicer
This commit is contained in:
parent
386dec00d1
commit
040f48b612
24 changed files with 408 additions and 402 deletions
|
@ -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()));
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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));
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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,16 +64,8 @@ public class PacketParticles {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// lambda causes classloading issues on a server here
|
public enum Type {
|
||||||
@SuppressWarnings("Convert2Lambda")
|
TR_GOLD_POWDER((message, world) -> {
|
||||||
public static void onMessage(PacketParticles message, Supplier<NetworkEvent.Context> ctx) {
|
|
||||||
ctx.get().enqueueWork(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
World world = Minecraft.getInstance().world;
|
|
||||||
if (world != null) {
|
|
||||||
switch (message.type) {
|
|
||||||
case 0: // Tree ritual: Gold powder
|
|
||||||
BlockPos pos = new BlockPos(message.posX, message.posY, message.posZ);
|
BlockPos pos = new BlockPos(message.posX, message.posY, message.posZ);
|
||||||
Multiblocks.TREE_RITUAL.forEach(pos, 'G', (dustPos, matcher) -> {
|
Multiblocks.TREE_RITUAL.forEach(pos, 'G', (dustPos, matcher) -> {
|
||||||
BlockState state = world.getBlockState(dustPos);
|
BlockState state = world.getBlockState(dustPos);
|
||||||
|
@ -87,32 +80,32 @@ public class PacketParticles {
|
||||||
0xf4cb42, 2F, 50, 0F, false, true);
|
0xf4cb42, 2F, 50, 0F, false, true);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
break;
|
}),
|
||||||
case 1: // Tree ritual: Consuming item
|
TR_CONSUME_ITEM((message, world) -> {
|
||||||
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--) {
|
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--) {
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
message.posX + 0.5F, message.posY + 0.9F, message.posZ + 0.5F,
|
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,
|
(float) world.rand.nextGaussian() * 0.04F, world.rand.nextFloat() * 0.04F, (float) world.rand.nextGaussian() * 0.04F,
|
||||||
0x89cc37, 1.5F, 25, 0F, false, true);
|
0x89cc37, 1.5F, 25, 0F, false, true);
|
||||||
}
|
}
|
||||||
break;
|
}),
|
||||||
case 2: // Tree ritual: Tree disappearing
|
TR_DISAPPEAR((message, world) -> {
|
||||||
for (int i = world.rand.nextInt(5) + 3; i >= 0; i--) {
|
for (int i = world.rand.nextInt(5) + 3; i >= 0; i--) {
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
message.posX + world.rand.nextFloat(), message.posY + world.rand.nextFloat(), message.posZ + world.rand.nextFloat(),
|
message.posX + world.rand.nextFloat(), message.posY + world.rand.nextFloat(), message.posZ + world.rand.nextFloat(),
|
||||||
0F, 0F, 0F,
|
0F, 0F, 0F,
|
||||||
0x33FF33, 1F, 50, 0F, false, true);
|
0x33FF33, 1F, 50, 0F, false, true);
|
||||||
}
|
}
|
||||||
break;
|
}),
|
||||||
case 3: // Tree ritual: Spawn result item
|
TR_SPAWN_RESULT((message, world) -> {
|
||||||
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--) {
|
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--) {
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
message.posX, message.posY, message.posZ,
|
message.posX, message.posY, message.posZ,
|
||||||
world.rand.nextGaussian() * 0.1F, world.rand.nextGaussian() * 0.1F, world.rand.nextGaussian() * 0.1F,
|
world.rand.nextGaussian() * 0.1F, world.rand.nextGaussian() * 0.1F, world.rand.nextGaussian() * 0.1F,
|
||||||
0x89cc37, 2F, 100, 0F, true, true);
|
0x89cc37, 2F, 100, 0F, true, true);
|
||||||
}
|
}
|
||||||
break;
|
}),
|
||||||
case 4: // Nature altar: Conversion
|
ALTAR_CONVERSION((message, world) -> {
|
||||||
for (int i = world.rand.nextInt(5) + 2; i >= 0; i--) {
|
for (int i = world.rand.nextInt(5) + 2; i >= 0; i--) {
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
|
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||||
|
@ -121,8 +114,8 @@ public class PacketParticles {
|
||||||
world.rand.nextGaussian() * 0.02F, world.rand.nextFloat() * 0.02F, world.rand.nextGaussian() * 0.02F,
|
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);
|
0x00FF00, world.rand.nextFloat() * 1.5F + 0.75F, 20, 0F, false, true);
|
||||||
}
|
}
|
||||||
break;
|
}),
|
||||||
case 5: // Potion generator
|
POTION_GEN((message, world) -> {
|
||||||
int color = message.data[0];
|
int color = message.data[0];
|
||||||
boolean releaseAura = message.data[1] > 0;
|
boolean releaseAura = message.data[1] > 0;
|
||||||
for (int i = world.rand.nextInt(5) + 5; i >= 0; i--) {
|
for (int i = world.rand.nextInt(5) + 5; i >= 0; i--) {
|
||||||
|
@ -146,8 +139,8 @@ public class PacketParticles {
|
||||||
0xd6340c, 1F + world.rand.nextFloat() * 2F, 75, 0F, true, true);
|
0xd6340c, 1F + world.rand.nextFloat() * 2F, 75, 0F, true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
}),
|
||||||
case 6: // Plant boost effect
|
PLANT_BOOST((message, world) -> {
|
||||||
for (int i = world.rand.nextInt(20) + 15; i >= 0; i--)
|
for (int i = world.rand.nextInt(20) + 15; i >= 0; i--)
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
message.posX + world.rand.nextFloat(),
|
message.posX + world.rand.nextFloat(),
|
||||||
|
@ -155,10 +148,9 @@ public class PacketParticles {
|
||||||
message.posZ + world.rand.nextFloat(),
|
message.posZ + world.rand.nextFloat(),
|
||||||
0F, world.rand.nextFloat() * 0.02F, 0F,
|
0F, world.rand.nextFloat() * 0.02F, 0F,
|
||||||
0x5ccc30, 1F + world.rand.nextFloat() * 2F, 50, 0F, false, true);
|
0x5ccc30, 1F + world.rand.nextFloat() * 2F, 50, 0F, false, true);
|
||||||
|
}),
|
||||||
break;
|
FLOWER_GEN_CONSUME((message, world) -> {
|
||||||
case 7: // Flower generator consumation
|
int color = message.data[0];
|
||||||
color = message.data[0];
|
|
||||||
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--)
|
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--)
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
|
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||||
|
@ -168,8 +160,8 @@ public class PacketParticles {
|
||||||
world.rand.nextGaussian() * 0.02F,
|
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);
|
color, world.rand.nextFloat() * 2F + 1F, 25, 0F, false, true);
|
||||||
break;
|
}),
|
||||||
case 8: // Flower generator, firework generator aura creation
|
FLOWER_GEN_AURA_CREATION((message, world) -> {
|
||||||
for (int i = world.rand.nextInt(10) + 5; i >= 0; i--)
|
for (int i = world.rand.nextInt(10) + 5; i >= 0; i--)
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
|
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||||
|
@ -179,19 +171,19 @@ public class PacketParticles {
|
||||||
world.rand.nextFloat() * 0.04F + 0.02F,
|
world.rand.nextFloat() * 0.04F + 0.02F,
|
||||||
world.rand.nextGaussian() * 0.01F,
|
world.rand.nextGaussian() * 0.01F,
|
||||||
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, false, true);
|
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, false, true);
|
||||||
break;
|
}),
|
||||||
case 9: // Placer placing
|
PLACER_PLACING((message, world) -> {
|
||||||
for (int i = world.rand.nextInt(20) + 20; i >= 0; i--) {
|
for (int i = world.rand.nextInt(20) + 20; i >= 0; i--) {
|
||||||
boolean side = world.rand.nextBoolean();
|
boolean side = world.rand.nextBoolean();
|
||||||
float x = side ? world.rand.nextFloat() : (world.rand.nextBoolean() ? 1.1F : -0.1F);
|
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);
|
float z = !side ? world.rand.nextFloat() : world.rand.nextBoolean() ? 1.1F : -0.1F;
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
message.posX + x, message.posY + 0.1F + world.rand.nextFloat() * 0.98F, message.posZ + z,
|
message.posX + x, message.posY + 0.1F + world.rand.nextFloat() * 0.98F, message.posZ + z,
|
||||||
0F, 0F, 0F,
|
0F, 0F, 0F,
|
||||||
0xad7a37, world.rand.nextFloat() + 1F, 50, 0F, true, true);
|
0xad7a37, world.rand.nextFloat() + 1F, 50, 0F, true, true);
|
||||||
}
|
}
|
||||||
break;
|
}),
|
||||||
case 10: // Hopper upgrade picking up
|
HOPPER_UPGRADE((message, world) -> {
|
||||||
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
|
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
message.posX, message.posY + 0.45F, message.posZ,
|
message.posX, message.posY + 0.45F, message.posZ,
|
||||||
|
@ -199,8 +191,8 @@ public class PacketParticles {
|
||||||
world.rand.nextGaussian() * 0.015F,
|
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);
|
0xdde7ff, world.rand.nextFloat() + 1F, 30, -0.06F, true, true);
|
||||||
break;
|
}),
|
||||||
case 11: // Shockwave creator particles
|
SHOCKWAVE_CREATOR((message, world) -> {
|
||||||
for (int i = 0; i < 360; i += 2) {
|
for (int i = 0; i < 360; i += 2) {
|
||||||
double rad = Math.toRadians(i);
|
double rad = Math.toRadians(i);
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
|
@ -210,12 +202,12 @@ public class PacketParticles {
|
||||||
(float) Math.cos(rad) * 0.65F,
|
(float) Math.cos(rad) * 0.65F,
|
||||||
0x911b07, 3F, 10, 0F, false, true);
|
0x911b07, 3F, 10, 0F, false, true);
|
||||||
}
|
}
|
||||||
break;
|
}),
|
||||||
case 12: // Oak generator
|
OAK_GENERATOR((message, world) -> {
|
||||||
int sapX = message.data[0];
|
int sapX = message.data[0];
|
||||||
int sapY = message.data[1];
|
int sapY = message.data[1];
|
||||||
int sapZ = message.data[2];
|
int sapZ = message.data[2];
|
||||||
releaseAura = message.data[3] > 0;
|
boolean releaseAura = message.data[3] > 0;
|
||||||
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
|
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
|
||||||
NaturesAuraAPI.instance().spawnParticleStream(
|
NaturesAuraAPI.instance().spawnParticleStream(
|
||||||
sapX + 0.5F + (float) world.rand.nextGaussian() * 3F,
|
sapX + 0.5F + (float) world.rand.nextGaussian() * 3F,
|
||||||
|
@ -235,8 +227,8 @@ public class PacketParticles {
|
||||||
world.rand.nextFloat() * 0.04F + 0.04F,
|
world.rand.nextFloat() * 0.04F + 0.04F,
|
||||||
world.rand.nextGaussian() * 0.03F,
|
world.rand.nextGaussian() * 0.03F,
|
||||||
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 60, 0F, false, true);
|
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 60, 0F, false, true);
|
||||||
break;
|
}),
|
||||||
case 13: // Offering table
|
OFFERING_TABLE((message, world) -> {
|
||||||
int genX = message.data[0];
|
int genX = message.data[0];
|
||||||
int genY = message.data[1];
|
int genY = message.data[1];
|
||||||
int genZ = message.data[2];
|
int genZ = message.data[2];
|
||||||
|
@ -256,16 +248,16 @@ public class PacketParticles {
|
||||||
world.rand.nextFloat() * 0.01F,
|
world.rand.nextFloat() * 0.01F,
|
||||||
world.rand.nextGaussian() * 0.01F,
|
world.rand.nextGaussian() * 0.01F,
|
||||||
0xd3e4ff, 1.5F, 150, 0F, false, true);
|
0xd3e4ff, 1.5F, 150, 0F, false, true);
|
||||||
break;
|
}),
|
||||||
case 14: // Pickup stopper
|
PICKUP_STOPPER((message, world) -> {
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
message.posX, message.posY + 0.4F, message.posZ,
|
message.posX, message.posY + 0.4F, message.posZ,
|
||||||
world.rand.nextGaussian() * 0.005F,
|
world.rand.nextGaussian() * 0.005F,
|
||||||
world.rand.nextFloat() * 0.005F,
|
world.rand.nextFloat() * 0.005F,
|
||||||
world.rand.nextGaussian() * 0.005F,
|
world.rand.nextGaussian() * 0.005F,
|
||||||
0xcc3116, 1.5F, 40, 0F, false, true);
|
0xcc3116, 1.5F, 40, 0F, false, true);
|
||||||
break;
|
}),
|
||||||
case 15: // Spawn lamp
|
SPAWN_LAMP((message, world) -> {
|
||||||
for (int i = world.rand.nextInt(5) + 5; i >= 0; i--)
|
for (int i = world.rand.nextInt(5) + 5; i >= 0; i--)
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
message.posX + 0.3F + world.rand.nextFloat() * 0.4F,
|
message.posX + 0.3F + world.rand.nextFloat() * 0.4F,
|
||||||
|
@ -273,8 +265,8 @@ public class PacketParticles {
|
||||||
message.posZ + 0.3F + world.rand.nextFloat() * 0.4F,
|
message.posZ + 0.3F + world.rand.nextFloat() * 0.4F,
|
||||||
0F, 0F, 0F,
|
0F, 0F, 0F,
|
||||||
0xf4a142, 1F, 30, 0F, false, true);
|
0xf4a142, 1F, 30, 0F, false, true);
|
||||||
break;
|
}),
|
||||||
case 16: // Animal generator aura creation
|
ANIMAL_GEN_CREATE((message, world) -> {
|
||||||
for (int i = world.rand.nextInt(5) + 5; i >= 0; i--)
|
for (int i = world.rand.nextInt(5) + 5; i >= 0; i--)
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
|
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||||
|
@ -284,14 +276,14 @@ public class PacketParticles {
|
||||||
world.rand.nextFloat() * 0.04F + 0.02F,
|
world.rand.nextFloat() * 0.04F + 0.02F,
|
||||||
world.rand.nextGaussian() * 0.01F,
|
world.rand.nextGaussian() * 0.01F,
|
||||||
0xd13308, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, false, true);
|
0xd13308, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, false, true);
|
||||||
break;
|
}),
|
||||||
case 17: // Animal generator consuming
|
ANIMAL_GEN_CONSUME((message, world) -> {
|
||||||
boolean child = message.data[0] > 0;
|
boolean child = message.data[0] > 0;
|
||||||
float height = message.data[1] / 10F;
|
float height = message.data[1] / 10F;
|
||||||
genX = message.data[2];
|
int genX = message.data[2];
|
||||||
genY = message.data[3];
|
int genY = message.data[3];
|
||||||
genZ = message.data[4];
|
int genZ = message.data[4];
|
||||||
for (int i = (child ? world.rand.nextInt(10) + 10 : world.rand.nextInt(20) + 20); i >= 0; i--)
|
for (int i = child ? world.rand.nextInt(10) + 10 : world.rand.nextInt(20) + 20; i >= 0; i--)
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
message.posX + world.rand.nextGaussian() * 0.25F,
|
message.posX + world.rand.nextGaussian() * 0.25F,
|
||||||
message.posY + height * 0.75F + world.rand.nextGaussian() * 0.25F,
|
message.posY + height * 0.75F + world.rand.nextGaussian() * 0.25F,
|
||||||
|
@ -304,9 +296,9 @@ public class PacketParticles {
|
||||||
message.posX, message.posY + height * 0.75F, message.posZ,
|
message.posX, message.posY + height * 0.75F, message.posZ,
|
||||||
genX + 0.5F, genY + 0.5F, genZ + 0.5F,
|
genX + 0.5F, genY + 0.5F, genZ + 0.5F,
|
||||||
0.15F, 0x41c4f4, child ? 1.5F : 3F);
|
0.15F, 0x41c4f4, child ? 1.5F : 3F);
|
||||||
break;
|
}),
|
||||||
case 18: // End flower decay
|
END_FLOWER_DECAY((message, world) -> {
|
||||||
color = message.data[0];
|
int color = message.data[0];
|
||||||
for (int i = world.rand.nextInt(10) + 20; i >= 0; i--)
|
for (int i = world.rand.nextInt(10) + 20; i >= 0; i--)
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
message.posX + world.rand.nextFloat(),
|
message.posX + world.rand.nextFloat(),
|
||||||
|
@ -316,8 +308,8 @@ public class PacketParticles {
|
||||||
world.rand.nextFloat() * 0.01F,
|
world.rand.nextFloat() * 0.01F,
|
||||||
world.rand.nextGaussian() * 0.01F,
|
world.rand.nextGaussian() * 0.01F,
|
||||||
color, 1.5F, 80, 0F, true, true);
|
color, 1.5F, 80, 0F, true, true);
|
||||||
break;
|
}),
|
||||||
case 19: // Animal spawner, auto crafter
|
ANIMAL_SPAWNER((message, world) -> {
|
||||||
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
|
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
message.posX, message.posY + 0.5F, message.posZ,
|
message.posX, message.posY + 0.5F, message.posZ,
|
||||||
|
@ -325,8 +317,8 @@ public class PacketParticles {
|
||||||
world.rand.nextFloat() * 0.02F,
|
world.rand.nextFloat() * 0.02F,
|
||||||
world.rand.nextGaussian() * 0.02F,
|
world.rand.nextGaussian() * 0.02F,
|
||||||
0x16b7b2, 1.5F, 40, 0F, false, true);
|
0x16b7b2, 1.5F, 40, 0F, false, true);
|
||||||
break;
|
}),
|
||||||
case 20: // RF converter
|
RF_CONVERTER((message, world) -> {
|
||||||
for (int i = world.rand.nextInt(5) + 2; i >= 0; i--)
|
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) -> {
|
Multiblocks.RF_CONVERTER.forEach(new BlockPos(message.posX, message.posY, message.posZ), 'R', (blockPos, matcher) -> {
|
||||||
if (world.rand.nextFloat() < 0.35F) {
|
if (world.rand.nextFloat() < 0.35F) {
|
||||||
|
@ -341,9 +333,9 @@ public class PacketParticles {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
break;
|
}),
|
||||||
case 21: // End flower item consuming
|
END_FLOWER_CONSUME((message, world) -> {
|
||||||
color = message.data[0];
|
int color = message.data[0];
|
||||||
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
|
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
message.posX, message.posY + 0.5F, message.posZ,
|
message.posX, message.posY + 0.5F, message.posZ,
|
||||||
|
@ -351,8 +343,8 @@ public class PacketParticles {
|
||||||
world.rand.nextFloat() * 0.01F,
|
world.rand.nextFloat() * 0.01F,
|
||||||
world.rand.nextGaussian() * 0.01F,
|
world.rand.nextGaussian() * 0.01F,
|
||||||
color, 1.5F, 40, 0F, false, true);
|
color, 1.5F, 40, 0F, false, true);
|
||||||
break;
|
}),
|
||||||
case 22: // Mover cart
|
MOVER_CART((message, world) -> {
|
||||||
float motionX = message.data[0] / 100F;
|
float motionX = message.data[0] / 100F;
|
||||||
float motionY = message.data[1] / 100F;
|
float motionY = message.data[1] / 100F;
|
||||||
float motionZ = message.data[2] / 100F;
|
float motionZ = message.data[2] / 100F;
|
||||||
|
@ -363,13 +355,13 @@ public class PacketParticles {
|
||||||
message.posZ + world.rand.nextGaussian() * 10F,
|
message.posZ + world.rand.nextGaussian() * 10F,
|
||||||
motionX * 0.2F, motionY * 0.2F, motionZ * 0.2F,
|
motionX * 0.2F, motionY * 0.2F, motionZ * 0.2F,
|
||||||
IAuraType.forWorld(world).getColor(), 2F, 30, 0F, false, true);
|
IAuraType.forWorld(world).getColor(), 2F, 30, 0F, false, true);
|
||||||
break;
|
}),
|
||||||
case 23: // Moss generator
|
MOSS_GENERATOR((message, world) -> {
|
||||||
for (int i = world.rand.nextInt(30) + 30; i >= 0; i--) {
|
for (int i = world.rand.nextInt(30) + 30; i >= 0; i--) {
|
||||||
int side = world.rand.nextInt(3);
|
int side = world.rand.nextInt(3);
|
||||||
float x = side != 0 ? world.rand.nextFloat() : (world.rand.nextBoolean() ? 1.1F : -0.1F);
|
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 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);
|
float z = side != 2 ? world.rand.nextFloat() : world.rand.nextBoolean() ? 1.1F : -0.1F;
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
message.posX + x,
|
message.posX + x,
|
||||||
message.posY + y,
|
message.posY + y,
|
||||||
|
@ -386,8 +378,8 @@ public class PacketParticles {
|
||||||
world.rand.nextFloat() * 0.04F + 0.02F,
|
world.rand.nextFloat() * 0.04F + 0.02F,
|
||||||
world.rand.nextGaussian() * 0.01F,
|
world.rand.nextGaussian() * 0.01F,
|
||||||
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, true, true);
|
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, true, true);
|
||||||
break;
|
}),
|
||||||
case 24: // Firework generator
|
FIREWORK_GEN((message, world) -> {
|
||||||
int goalX = message.data[0];
|
int goalX = message.data[0];
|
||||||
int goalY = message.data[1];
|
int goalY = message.data[1];
|
||||||
int goalZ = message.data[2];
|
int goalZ = message.data[2];
|
||||||
|
@ -402,10 +394,10 @@ public class PacketParticles {
|
||||||
goalZ + 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);
|
0.65F, message.data[3 + world.rand.nextInt(message.data.length - 3)], 1F);
|
||||||
NaturesAuraAPI.instance().setParticleSpawnRange(32);
|
NaturesAuraAPI.instance().setParticleSpawnRange(32);
|
||||||
break;
|
}),
|
||||||
case 25: // Dimension rail
|
DIMENSION_RAIL((message, world) -> {
|
||||||
float width = message.data[0] / 100F;
|
float width = message.data[0] / 100F;
|
||||||
height = message.data[1] / 100F;
|
float height = message.data[1] / 100F;
|
||||||
float depth = message.data[2] / 100F;
|
float depth = message.data[2] / 100F;
|
||||||
for (int i = world.rand.nextInt(100) + 50; i >= 0; i--)
|
for (int i = world.rand.nextInt(100) + 50; i >= 0; i--)
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
|
@ -413,8 +405,8 @@ public class PacketParticles {
|
||||||
message.posY + world.rand.nextFloat() * height,
|
message.posY + world.rand.nextFloat() * height,
|
||||||
message.posZ + world.rand.nextFloat() * depth,
|
message.posZ + world.rand.nextFloat() * depth,
|
||||||
0F, 0F, 0F, 0xd60cff, 1F + world.rand.nextFloat(), 60, 0F, false, true);
|
0F, 0F, 0F, 0xd60cff, 1F + world.rand.nextFloat(), 60, 0F, false, true);
|
||||||
break;
|
}),
|
||||||
case 26: // Projectile generator
|
PROJECTILE_GEN((message, world) -> {
|
||||||
int x = message.data[0];
|
int x = message.data[0];
|
||||||
int y = message.data[1];
|
int y = message.data[1];
|
||||||
int z = message.data[2];
|
int z = message.data[2];
|
||||||
|
@ -433,8 +425,24 @@ public class PacketParticles {
|
||||||
world.rand.nextGaussian() * 0.03F,
|
world.rand.nextGaussian() * 0.03F,
|
||||||
world.rand.nextGaussian() * 0.03F,
|
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
|
||||||
|
@SuppressWarnings("Convert2Lambda")
|
||||||
|
public static void onMessage(PacketParticles message, Supplier<NetworkEvent.Context> ctx) {
|
||||||
|
ctx.get().enqueueWork(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
World world = Minecraft.getInstance().world;
|
||||||
|
if (world != null)
|
||||||
|
message.type.action.accept(message, world);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ctx.get().setPacketHandled(true);
|
ctx.get().setPacketHandled(true);
|
||||||
|
|
Loading…
Reference in a new issue