fix particles
This commit is contained in:
parent
30e6b4eb74
commit
0171d81724
41 changed files with 181 additions and 239 deletions
|
@ -1274,14 +1274,14 @@ public abstract class EntityNPC extends EntityLiving
|
|||
oy + this.rand.doublev() * (double)this.height,
|
||||
oz + (this.rand.doublev() - 0.5D) * (double)this.width * 2.0D, 8,
|
||||
(this.rand.floatv() - 0.5F) * 0.2F, (this.rand.floatv() - 0.5F) * 0.2F, (this.rand.floatv() - 0.5F) * 0.2F,
|
||||
0.15D);
|
||||
0.15D, 0);
|
||||
this.worldObj.playAuxSFX(1005, this.getPosition(), 0);
|
||||
((AWorldServer)this.worldObj).spawnParticle(ParticleType.PORTAL,
|
||||
this.posX + (this.rand.doublev() - 0.5D) * (double)this.width * 2.0D,
|
||||
this.posY + this.rand.doublev() * (double)this.height,
|
||||
this.posZ + (this.rand.doublev() - 0.5D) * (double)this.width * 2.0D, 8,
|
||||
(this.rand.floatv() - 0.5F) * 0.2F, (this.rand.floatv() - 0.5F) * 0.2F, (this.rand.floatv() - 0.5F) * 0.2F,
|
||||
0.15D);
|
||||
0.15D, 0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -417,8 +417,8 @@ public class EntityHook extends Entity implements IObjectData
|
|||
this.motionY -= 0.20000000298023224D;
|
||||
this.playSound(SoundEvent.SPLASH, 0.25F);
|
||||
float f8 = (float)ExtMath.floord(this.getEntityBoundingBox().minY);
|
||||
worldserver.spawnParticle(ParticleType.WATER_BUBBLE, this.posX, (double)(f8 + 1.0F), this.posZ, (int)(1.0F + this.width * 20.0F), (double)this.width, 0.0D, (double)this.width, 0.20000000298023224D);
|
||||
worldserver.spawnParticle(ParticleType.WATER_WAKE, this.posX, (double)(f8 + 1.0F), this.posZ, (int)(1.0F + this.width * 20.0F), (double)this.width, 0.0D, (double)this.width, 0.20000000298023224D);
|
||||
worldserver.spawnParticle(ParticleType.WATER_BUBBLE, this.posX, (double)(f8 + 1.0F), this.posZ, (int)(1.0F + this.width * 20.0F), (double)this.width, 0.0D, (double)this.width, 0.20000000298023224D, 0);
|
||||
worldserver.spawnParticle(ParticleType.WATER_WAKE, this.posX, (double)(f8 + 1.0F), this.posZ, (int)(1.0F + this.width * 20.0F), (double)this.width, 0.0D, (double)this.width, 0.20000000298023224D, 0);
|
||||
this.ticksCatchable = this.rand.range(10, 30);
|
||||
}
|
||||
else
|
||||
|
@ -436,13 +436,13 @@ public class EntityHook extends Entity implements IObjectData
|
|||
{
|
||||
if (this.rand.floatv() < 0.15F)
|
||||
{
|
||||
worldserver.spawnParticle(ParticleType.WATER_BUBBLE, d13, d15 - 0.10000000149011612D, d16, 1, (double)f10, 0.1D, (double)f11, 0.0D);
|
||||
worldserver.spawnParticle(ParticleType.WATER_BUBBLE, d13, d15 - 0.10000000149011612D, d16, 1, (double)f10, 0.1D, (double)f11, 0.0D, 0);
|
||||
}
|
||||
|
||||
float f3 = f10 * 0.04F;
|
||||
float f4 = f11 * 0.04F;
|
||||
worldserver.spawnParticle(ParticleType.WATER_WAKE, d13, d15, d16, 0, (double)f4, 0.01D, (double)(-f3), 1.0D);
|
||||
worldserver.spawnParticle(ParticleType.WATER_WAKE, d13, d15, d16, 0, (double)(-f4), 0.01D, (double)f3, 1.0D);
|
||||
worldserver.spawnParticle(ParticleType.WATER_WAKE, d13, d15, d16, 0, (double)f4, 0.01D, (double)(-f3), 1.0D, 0);
|
||||
worldserver.spawnParticle(ParticleType.WATER_WAKE, d13, d15, d16, 0, (double)(-f4), 0.01D, (double)f3, 1.0D, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -475,7 +475,7 @@ public class EntityHook extends Entity implements IObjectData
|
|||
|
||||
if (block == Blocks.water || block == Blocks.flowing_water)
|
||||
{
|
||||
worldserver.spawnParticle(ParticleType.WATER_SPLASH, d12, d14, d6, this.rand.range(2, 3), 0.10000000149011612D, 0.0D, 0.10000000149011612D, 0.0D);
|
||||
worldserver.spawnParticle(ParticleType.WATER_SPLASH, d12, d14, d6, this.rand.range(2, 3), 0.10000000149011612D, 0.0D, 0.10000000149011612D, 0.0D, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,119 +1,66 @@
|
|||
package common.model;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import common.util.Identifyable;
|
||||
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
public enum ParticleType implements Identifyable {
|
||||
EXPLOSION_NORMAL("explode", true),
|
||||
EXPLOSION_LARGE("largeexplode", true),
|
||||
EXPLOSION_HUGE("hugeexplosion", true),
|
||||
FIREWORKS_SPARK("fireworksSpark"),
|
||||
WATER_BUBBLE("bubble"),
|
||||
WATER_SPLASH("splash"),
|
||||
WATER_WAKE("wake"),
|
||||
SUSPENDED("suspended"),
|
||||
SUSPENDED_DEPTH("depthsuspend"),
|
||||
CRIT("crit"),
|
||||
CRIT_MAGIC("magicCrit"),
|
||||
SMOKE_NORMAL("smoke"),
|
||||
SMOKE_LARGE("largesmoke"),
|
||||
SPELL("spell"),
|
||||
SPELL_INSTANT("instantSpell"),
|
||||
SPELL_MOB("mobSpell"),
|
||||
SPELL_MOB_AMBIENT("mobSpellAmbient"),
|
||||
SPELL_WITCH("witchMagic"),
|
||||
DRIP_WATER("dripWater"),
|
||||
DRIP_LAVA("dripLava"),
|
||||
GROW("grow"),
|
||||
TOWN_AURA("townaura"),
|
||||
NOTE("note"),
|
||||
PORTAL("portal"),
|
||||
ENCHANTMENT_TABLE("enchantmenttable"),
|
||||
FLAME("flame"),
|
||||
LAVA("lava"),
|
||||
FOOTSTEP("footstep"),
|
||||
CLOUD("cloud"),
|
||||
REDSTONE("reddust"),
|
||||
SNOWBALL("snowballpoof"),
|
||||
SNOW_SHOVEL("snowshovel"),
|
||||
SLIME("slime"),
|
||||
HEART("heart"),
|
||||
ITEM_CRACK("iconcrack"),
|
||||
BLOCK_CRACK("blockcrack"),
|
||||
BLOCK_DUST("blockdust"),
|
||||
WATER_DROP("droplet"),
|
||||
ITEM_TAKE("take"),
|
||||
HAIL_CORN("hail");
|
||||
|
||||
public enum ParticleType
|
||||
{
|
||||
EXPLOSION_NORMAL("explode", 0, true),
|
||||
EXPLOSION_LARGE("largeexplode", 1, true),
|
||||
EXPLOSION_HUGE("hugeexplosion", 2, true),
|
||||
FIREWORKS_SPARK("fireworksSpark", 3, false),
|
||||
WATER_BUBBLE("bubble", 4, false),
|
||||
WATER_SPLASH("splash", 5, false),
|
||||
WATER_WAKE("wake", 6, false),
|
||||
SUSPENDED("suspended", 7, false),
|
||||
SUSPENDED_DEPTH("depthsuspend", 8, false),
|
||||
CRIT("crit", 9, false),
|
||||
CRIT_MAGIC("magicCrit", 10, false),
|
||||
SMOKE_NORMAL("smoke", 11, false),
|
||||
SMOKE_LARGE("largesmoke", 12, false),
|
||||
SPELL("spell", 13, false),
|
||||
SPELL_INSTANT("instantSpell", 14, false),
|
||||
SPELL_MOB("mobSpell", 15, false),
|
||||
SPELL_MOB_AMBIENT("mobSpellAmbient", 16, false),
|
||||
SPELL_WITCH("witchMagic", 17, false),
|
||||
DRIP_WATER("dripWater", 18, false),
|
||||
DRIP_LAVA("dripLava", 19, false),
|
||||
// VILLAGER_ANGRY("angryVillager", 20, false),
|
||||
GROW("grow", 21, false),
|
||||
TOWN_AURA("townaura", 22, false),
|
||||
NOTE("note", 23, false),
|
||||
PORTAL("portal", 24, false),
|
||||
ENCHANTMENT_TABLE("enchantmenttable", 25, false),
|
||||
FLAME("flame", 26, false),
|
||||
LAVA("lava", 27, false),
|
||||
FOOTSTEP("footstep", 28, false),
|
||||
CLOUD("cloud", 29, false),
|
||||
REDSTONE("reddust", 30, false),
|
||||
SNOWBALL("snowballpoof", 31, false),
|
||||
SNOW_SHOVEL("snowshovel", 32, false),
|
||||
SLIME("slime", 33, false),
|
||||
HEART("heart", 34, false),
|
||||
// BARRIER("barrier", 35, false),
|
||||
ITEM_CRACK("iconcrack_", 36, false, true),
|
||||
BLOCK_CRACK("blockcrack_", 37, false, true),
|
||||
BLOCK_DUST("blockdust_", 38, false, true),
|
||||
WATER_DROP("droplet", 39, false),
|
||||
ITEM_TAKE("take", 40, false),
|
||||
HAIL_CORN("hail", 41, false);
|
||||
private final String name;
|
||||
private final boolean unlimited;
|
||||
|
||||
private final String particleName;
|
||||
private final int particleID;
|
||||
private final boolean shouldIgnoreRange;
|
||||
private final boolean argument;
|
||||
private static final Map<Integer, ParticleType> PARTICLES = Maps.<Integer, ParticleType>newHashMap();
|
||||
private static final String[] PARTICLE_NAMES;
|
||||
private ParticleType(String name, boolean unlimited) {
|
||||
this.name = name;
|
||||
this.unlimited = unlimited;
|
||||
}
|
||||
|
||||
private ParticleType(String particleNameIn, int particleIDIn, boolean unlimited, boolean argumentCountIn)
|
||||
{
|
||||
this.particleName = particleNameIn;
|
||||
this.particleID = particleIDIn;
|
||||
this.shouldIgnoreRange = unlimited;
|
||||
this.argument = argumentCountIn;
|
||||
}
|
||||
private ParticleType(String name) {
|
||||
this(name, false);
|
||||
}
|
||||
|
||||
private ParticleType(String particleNameIn, int particleIDIn, boolean unlimited)
|
||||
{
|
||||
this(particleNameIn, particleIDIn, unlimited, false);
|
||||
}
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public static String[] getParticleNames()
|
||||
{
|
||||
return PARTICLE_NAMES;
|
||||
}
|
||||
|
||||
public String getParticleName()
|
||||
{
|
||||
return this.particleName;
|
||||
}
|
||||
|
||||
public int getParticleID()
|
||||
{
|
||||
return this.particleID;
|
||||
}
|
||||
|
||||
public boolean hasArgument()
|
||||
{
|
||||
return this.argument;
|
||||
}
|
||||
|
||||
public boolean getShouldIgnoreRange()
|
||||
{
|
||||
return this.shouldIgnoreRange;
|
||||
}
|
||||
|
||||
public static ParticleType getParticleFromId(int particleId)
|
||||
{
|
||||
return PARTICLES.get(particleId);
|
||||
}
|
||||
|
||||
static {
|
||||
List<String> list = Lists.<String>newArrayList();
|
||||
|
||||
for (ParticleType enumparticletypes : values())
|
||||
{
|
||||
PARTICLES.put(enumparticletypes.getParticleID(), enumparticletypes);
|
||||
|
||||
if (!enumparticletypes.getParticleName().endsWith("_"))
|
||||
{
|
||||
list.add(enumparticletypes.getParticleName());
|
||||
}
|
||||
}
|
||||
|
||||
PARTICLE_NAMES = list.toArray(new String[list.size()]);
|
||||
}
|
||||
public boolean isUnlimited() {
|
||||
return this.unlimited;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,13 +45,7 @@ public class SPacketParticles implements Packet<IClientPlayer>
|
|||
*/
|
||||
public void readPacketData(PacketBuffer buf) throws IOException
|
||||
{
|
||||
this.particleType = ParticleType.getParticleFromId(buf.readInt());
|
||||
|
||||
if (this.particleType == null)
|
||||
{
|
||||
this.particleType = ParticleType.HEART; //TODO: ???
|
||||
}
|
||||
|
||||
this.particleType = buf.readEnumValue(ParticleType.class);
|
||||
this.longDistance = buf.readBoolean();
|
||||
this.xCoord = buf.readFloat();
|
||||
this.yCoord = buf.readFloat();
|
||||
|
@ -61,8 +55,7 @@ public class SPacketParticles implements Packet<IClientPlayer>
|
|||
this.zOffset = buf.readFloat();
|
||||
this.particleSpeed = buf.readFloat();
|
||||
this.particleCount = buf.readInt();
|
||||
if(this.particleType.hasArgument())
|
||||
this.particleArgument = buf.readVarInt();
|
||||
this.particleArgument = buf.readVarInt();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,7 +63,7 @@ public class SPacketParticles implements Packet<IClientPlayer>
|
|||
*/
|
||||
public void writePacketData(PacketBuffer buf) throws IOException
|
||||
{
|
||||
buf.writeInt(this.particleType.getParticleID());
|
||||
buf.writeEnumValue(this.particleType);
|
||||
buf.writeBoolean(this.longDistance);
|
||||
buf.writeFloat(this.xCoord);
|
||||
buf.writeFloat(this.yCoord);
|
||||
|
@ -80,8 +73,7 @@ public class SPacketParticles implements Packet<IClientPlayer>
|
|||
buf.writeFloat(this.zOffset);
|
||||
buf.writeFloat(this.particleSpeed);
|
||||
buf.writeInt(this.particleCount);
|
||||
if(this.particleType.hasArgument())
|
||||
buf.writeVarInt(this.particleArgument);
|
||||
buf.writeVarInt(this.particleArgument);
|
||||
}
|
||||
|
||||
public ParticleType getParticleType()
|
||||
|
|
|
@ -32,7 +32,7 @@ public abstract class AWorldServer extends World {
|
|||
public abstract void strikeLightning(double x, double y, double z, int color, int damage, boolean fire, EntityLiving summoner);
|
||||
public abstract void resetWeather();
|
||||
public abstract void spawnParticle(ParticleType particleType, double xCoord, double yCoord, double zCoord, int numberOfParticles, double xOffset, double yOffset,
|
||||
double zOffset, double particleSpeed, int... particleArguments);
|
||||
double zOffset, double particleSpeed, int data);
|
||||
public abstract long getSeed();
|
||||
public abstract boolean isExterminated();
|
||||
public abstract boolean exterminate();
|
||||
|
|
|
@ -171,7 +171,7 @@ public class Explosion
|
|||
worldObj.setState(blockpos, Blocks.air.getState(), 3);
|
||||
if(rand.chance(1000)) {
|
||||
worldObj.playSound(SoundEvent.EXPLODE, explosionX + x, explosionY + y, explosionZ + z, 4.0F);
|
||||
((AWorldServer)worldObj).spawnParticle(ParticleType.EXPLOSION_HUGE, explosionX + x, explosionY + y, explosionZ + z, 0, rand.gaussian() * 0.02D, rand.gaussian() * 0.02D, rand.gaussian() * 0.02D, 1.0);
|
||||
((AWorldServer)worldObj).spawnParticle(ParticleType.EXPLOSION_HUGE, explosionX + x, explosionY + y, explosionZ + z, 0, rand.gaussian() * 0.02D, rand.gaussian() * 0.02D, rand.gaussian() * 0.02D, 1.0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2089,7 +2089,12 @@ public abstract class World implements IWorldAccess {
|
|||
}
|
||||
|
||||
public void spawnParticle(ParticleType particleType, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset,
|
||||
double zOffset, int... data) {
|
||||
double zOffset, int data) {
|
||||
}
|
||||
|
||||
public final void spawnParticle(ParticleType particleType, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset,
|
||||
double zOffset) {
|
||||
this.spawnParticle(particleType, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, 0);
|
||||
}
|
||||
|
||||
// public Difficulty getDifficulty() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue