use of com.builtbroken.mc.client.json.imp.IEffectData in project Engine by VoltzEngine-Project.
the class PacketSpawnParticle method handleClientSide.
@Override
public void handleClientSide(EntityPlayer player) {
if (player.worldObj.provider.dimensionId == dim) {
try {
if (name.startsWith("JSON_")) {
String key = name.substring(5, name.length()).toLowerCase();
IEffectData data = ClientDataHandler.INSTANCE.getEffect(key);
if (data != null) {
data.trigger(player.getEntityWorld(), x, y, z, vx, vy, vz, endPoint, otherData != null ? otherData : new NBTTagCompound());
} else if (Engine.runningAsDev) {
Engine.logger().error("Failed to find a effect data for key '" + name + "'");
}
} else if (name.startsWith("VEP_")) {
String key = name.substring(4, name.length());
VisualEffectProvider provider = VisualEffectRegistry.main.get(key);
if (provider != null) {
provider.displayEffect(player.getEntityWorld(), x, y, z, vx, vy, vz, endPoint, otherData != null ? otherData : new NBTTagCompound());
} else if (Engine.runningAsDev) {
Engine.logger().error("Failed to find a visual effect provider for name '" + name + "'");
}
} else {
player.worldObj.spawnParticle(name, x, y, z, vx, vy, vz);
}
} catch (Exception e) {
Engine.logger().error("Failed handling particle spawn packet with [name=" + name + ", dim=" + dim + ",pos=" + x + ", " + y + ", " + z + ", Vel=" + vx + ", " + vy + ", " + vz + "]", e);
}
}
}
use of com.builtbroken.mc.client.json.imp.IEffectData in project Engine by VoltzEngine-Project.
the class EffectList method trigger.
@Override
public void trigger(World world, double x, double y, double z, double mx, double my, double mz, boolean endPoint, NBTTagCompound nbt) {
for (IEffectData layer : layers) {
NBTTagCompound usedNBT;
if (nbt != null && !nbt.hasNoTags()) {
usedNBT = (NBTTagCompound) nbt.copy();
//Merges base NBT with server nbt
if (this.getNbt() != null) {
for (Object o : getNbt().func_150296_c()) {
if (o instanceof String) {
String key = (String) o;
NBTBase tag = getNbt().getTag(key);
if (tag != null) {
usedNBT.setTag(key, tag);
}
}
}
}
} else if (this.getNbt() != null) {
usedNBT = nbt;
} else {
usedNBT = new NBTTagCompound();
}
Pos renderOffset = this.renderOffset;
if (renderOffset != Pos.zero && (usedNBT.hasKey("yaw") || usedNBT.hasKey("pitch"))) {
float yaw = usedNBT.getFloat("yaw");
float pitch = usedNBT.getFloat("pitch");
angle.set(yaw, pitch, 0);
renderOffset = (Pos) angle.transform(renderOffset);
}
layer.trigger(world, x + renderOffset.x(), y + renderOffset.y(), z + renderOffset.z(), mx, my, mz, endPoint, usedNBT);
}
}
Aggregations