summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2015-05-02 22:33:25 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2015-05-02 22:33:25 +0100
commit9db9b523bfb4ebd75f6a46a9eb563ef9388ffed4 (patch)
treec4ce2cf0ce8cd22bd856fe380c3f528995c1c275
parentceb1aaa90b769d4a38e2fc8bca0e966087a56db6 (diff)
downloadkinniutils-9db9b523bfb4ebd75f6a46a9eb563ef9388ffed4.tar.bz2
Lots of stuff for particle groupings
-rw-r--r--src/main/java/net/flarn/kinniutils/KinniUtils.java4
-rw-r--r--src/main/java/net/flarn/kinniutils/handlers/ParticleFilter.java24
-rw-r--r--src/main/java/net/flarn/kinniutils/init/ModItems.java16
-rw-r--r--src/main/java/net/flarn/kinniutils/init/VanillaParticles.java53
-rw-r--r--src/main/java/net/flarn/kinniutils/item/ItemTestFilter.java7
-rw-r--r--src/main/java/net/flarn/kinniutils/proxy/ClientProxy.java3
-rw-r--r--src/main/java/net/flarn/kinniutils/refs/Names.java3
-rw-r--r--src/main/java/net/flarn/kinniutils/refs/ParticleGroup.java62
-rw-r--r--src/main/java/net/flarn/kinniutils/util/ParticleClassifier.java151
-rw-r--r--src/main/resources/META-INF/kinniutils_at.cfg10
10 files changed, 320 insertions, 13 deletions
diff --git a/src/main/java/net/flarn/kinniutils/KinniUtils.java b/src/main/java/net/flarn/kinniutils/KinniUtils.java
index 92eb875..86c7faa 100644
--- a/src/main/java/net/flarn/kinniutils/KinniUtils.java
+++ b/src/main/java/net/flarn/kinniutils/KinniUtils.java
@@ -1,4 +1,4 @@
-package net.flarn.antipp;
+package net.flarn.kinniutils;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
@@ -6,6 +6,7 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import net.flarn.kinniutils.init.ModBlocks;
+import net.flarn.kinniutils.init.ModItems;
import net.flarn.kinniutils.proxy.IProxy;
import net.flarn.kinniutils.refs.Core;
@@ -24,6 +25,7 @@ public class KinniUtils {
// Network, mod config, items, blocks
proxy.registerParticleFilters();
ModBlocks.init();
+ ModItems.init();
}
@Mod.EventHandler
diff --git a/src/main/java/net/flarn/kinniutils/handlers/ParticleFilter.java b/src/main/java/net/flarn/kinniutils/handlers/ParticleFilter.java
index 5097bd0..a48f33f 100644
--- a/src/main/java/net/flarn/kinniutils/handlers/ParticleFilter.java
+++ b/src/main/java/net/flarn/kinniutils/handlers/ParticleFilter.java
@@ -1,12 +1,14 @@
package net.flarn.kinniutils.handlers;
+import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
+import net.flarn.kinniutils.refs.ParticleGroup;
+import net.flarn.kinniutils.util.ParticleClassifier;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.particle.EntityFX;
-import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
@@ -38,12 +40,14 @@ public class ParticleFilter {
Minecraft mc = Minecraft.getMinecraft();
if (event.phase == TickEvent.Phase.START && filters.size() != 0) {
EffectRenderer er = mc.effectRenderer;
- List<EntityFX> layers[] = er.fxLayers;
- for (int i = 0; i < layers.length; ++i) {
- for (int j = 0; j < layers[i].size(); ++j) {
- EntityFX e = layers[i].get(j);
- if (e != null) {
- layers[i].set(j, filterFX(e));
+ synchronized (er.fxLayers) {
+ List<EntityFX> layers[] = er.fxLayers;
+ for (int i = 0; i < layers.length; ++i) {
+ for (int j = 0; j < layers[i].size(); ++j) {
+ EntityFX e = layers[i].get(j);
+ if (e != null) {
+ layers[i].set(j, filterFX(e));
+ }
}
}
}
@@ -57,7 +61,11 @@ public class ParticleFilter {
double dist_y = filter.y - entity.posY;
double dist_z = filter.z - entity.posZ;
double dist = (dist_x * dist_x) + (dist_y * dist_y) + (dist_z * dist_z);
- if (dist < filter.range_sq) { return null; }
+ if (dist < filter.range_sq) {
+ ParticleGroup g = ParticleClassifier.classifyParticle(entity);
+ FMLLog.getLogger().error("Killing a " + g);
+ return null;
+ }
}
return entity;
}
diff --git a/src/main/java/net/flarn/kinniutils/init/ModItems.java b/src/main/java/net/flarn/kinniutils/init/ModItems.java
new file mode 100644
index 0000000..8d42020
--- /dev/null
+++ b/src/main/java/net/flarn/kinniutils/init/ModItems.java
@@ -0,0 +1,16 @@
+package net.flarn.kinniutils.init;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import net.flarn.kinniutils.item.ItemTestFilter;
+import net.flarn.kinniutils.refs.Names;
+
+/**
+ * Created by dsilvers on 29/04/15.
+ */
+public class ModItems {
+ public static final ItemTestFilter testFilter = new ItemTestFilter();
+
+ public static void init() {
+ GameRegistry.registerItem(testFilter, Names.Items.TEST_FILTER);
+ }
+}
diff --git a/src/main/java/net/flarn/kinniutils/init/VanillaParticles.java b/src/main/java/net/flarn/kinniutils/init/VanillaParticles.java
new file mode 100644
index 0000000..bef1ede
--- /dev/null
+++ b/src/main/java/net/flarn/kinniutils/init/VanillaParticles.java
@@ -0,0 +1,53 @@
+package net.flarn.kinniutils.init;
+
+import net.flarn.kinniutils.refs.ParticleGroup;
+import net.flarn.kinniutils.util.ParticleClassifier;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.particle.*;
+import net.minecraft.init.Items;
+
+/**
+ * Created by dsilvers on 02/05/15.
+ */
+public class VanillaParticles {
+ public static void init() {
+ /* Registration of all vanilla particles supported by RenderGlobal */
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityHugeExplodeFX.class), ParticleGroup.HUGEEXPLOSION);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityLargeExplodeFX.class), ParticleGroup.LARGEEXPLOSION);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityFireworkSparkFX.class), ParticleGroup.FIREWORKSPARK);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityBubbleFX.class), ParticleGroup.BUBBLE);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityAuraFX.class), ParticleGroup.DEPTHSUSPEND);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityAuraFX.class), ParticleGroup.TOWNAURA);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityCritFX.class, 65), ParticleGroup.CRIT);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityCritFX.class, 66), ParticleGroup.MAGICCRIT);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.SmokeClassifier(false), ParticleGroup.SMOKE);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.SpellClassifier(0), ParticleGroup.MOBSPELL);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.SpellClassifier(1), ParticleGroup.MOBSPELLAMBIENT);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.SpellClassifier(2), ParticleGroup.SPELL);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.SpellClassifier(3), ParticleGroup.INSTANTSPELL);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.SpellClassifier(4), ParticleGroup.WITCHMAGIC);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntitySpellParticleFX.class, -1, -1000), ParticleGroup.ALLSPELLS);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityNoteFX.class), ParticleGroup.NOTE);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityPortalFX.class), ParticleGroup.PORTAL);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityEnchantmentTableParticleFX.class), ParticleGroup.ENCHANTMENTTABLE);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityExplodeFX.class), ParticleGroup.EXPLODE);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityFlameFX.class), ParticleGroup.FLAME);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityLavaFX.class), ParticleGroup.LAVA);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityFootStepFX.class), ParticleGroup.FOOTSTEP);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityFishWakeFX.class), ParticleGroup.WAKE);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.SmokeClassifier(true), ParticleGroup.LARGESMOKE);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityCloudFX.class), ParticleGroup.CLOUD);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityReddustFX.class), ParticleGroup.REDDUST);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BreakingClassifier(Items.snowball), ParticleGroup.SNOWBALLPOOF);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.DripClassifier(Material.water), ParticleGroup.DRIPWATER);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.DripClassifier(Material.lava), ParticleGroup.DRIPLAVA);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntitySnowShovelFX.class), ParticleGroup.SNOWSHOVEL);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BreakingClassifier(Items.slime_ball), ParticleGroup.SLIME);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityHeartFX.class, 80), ParticleGroup.HEART);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityHeartFX.class, 81), ParticleGroup.ANGRYVILLAGER);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityHeartFX.class, 82), ParticleGroup.HAPPYVILLAGER);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityBreakingFX.class, -1, -1000), ParticleGroup.ICONCRACK);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityDiggingFX.class), ParticleGroup.BLOCKCRACK);
+ ParticleClassifier.registerClassifier(new ParticleClassifier.BasicClassifier(EntityBlockDustFX.class), ParticleGroup.BLOCKDUST);
+ }
+}
diff --git a/src/main/java/net/flarn/kinniutils/item/ItemTestFilter.java b/src/main/java/net/flarn/kinniutils/item/ItemTestFilter.java
index bc66f90..ede6208 100644
--- a/src/main/java/net/flarn/kinniutils/item/ItemTestFilter.java
+++ b/src/main/java/net/flarn/kinniutils/item/ItemTestFilter.java
@@ -4,14 +4,14 @@ import baubles.api.BaubleType;
import baubles.api.IBauble;
import baubles.common.container.InventoryBaubles;
import baubles.common.lib.PlayerHandler;
+import net.flarn.kinniutils.handlers.ParticleFilter;
+import net.flarn.kinniutils.refs.Names;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.potion.Potion;
-import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
/**
@@ -24,6 +24,7 @@ public class ItemTestFilter extends Item implements IBauble {
setHasSubtypes(false);
setMaxDamage(0);
setCreativeTab(CreativeTabs.tabDecorations);
+ setUnlocalizedName(Names.Items.TEST_FILTER);
}
@Override
@@ -51,7 +52,7 @@ public class ItemTestFilter extends Item implements IBauble {
@Override
public void onWornTick(ItemStack itemstack, EntityLivingBase player) {
- //filter?
+ ParticleFilter.addFilterAt(player.posX, player.posY, player.posZ, 5);
}
@Override
diff --git a/src/main/java/net/flarn/kinniutils/proxy/ClientProxy.java b/src/main/java/net/flarn/kinniutils/proxy/ClientProxy.java
index f3d3826..37d5b93 100644
--- a/src/main/java/net/flarn/kinniutils/proxy/ClientProxy.java
+++ b/src/main/java/net/flarn/kinniutils/proxy/ClientProxy.java
@@ -1,8 +1,8 @@
package net.flarn.kinniutils.proxy;
-import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.FMLCommonHandler;
import net.flarn.kinniutils.handlers.ParticleFilter;
+import net.flarn.kinniutils.init.VanillaParticles;
/**
* Created by dsilvers on 28/04/15.
@@ -10,5 +10,6 @@ import net.flarn.kinniutils.handlers.ParticleFilter;
public class ClientProxy extends CommonProxy {
public void registerParticleFilters() {
FMLCommonHandler.instance().bus().register(new ParticleFilter());
+ VanillaParticles.init();
}
}
diff --git a/src/main/java/net/flarn/kinniutils/refs/Names.java b/src/main/java/net/flarn/kinniutils/refs/Names.java
index 1c49ad7..c1cea25 100644
--- a/src/main/java/net/flarn/kinniutils/refs/Names.java
+++ b/src/main/java/net/flarn/kinniutils/refs/Names.java
@@ -7,4 +7,7 @@ public class Names {
public static final class Blocks {
public static final String PARTICLE_FILTER = "particlefilter";
}
+ public static final class Items {
+ public static final String TEST_FILTER = "testfilter";
+ }
}
diff --git a/src/main/java/net/flarn/kinniutils/refs/ParticleGroup.java b/src/main/java/net/flarn/kinniutils/refs/ParticleGroup.java
new file mode 100644
index 0000000..42e3182
--- /dev/null
+++ b/src/main/java/net/flarn/kinniutils/refs/ParticleGroup.java
@@ -0,0 +1,62 @@
+package net.flarn.kinniutils.refs;
+
+/**
+ * Created by dsilvers on 29/04/15.
+ */
+public class ParticleGroup {
+ public final String groupName;
+ public final ParticleGroup subGroups[];
+
+ ParticleGroup(String groupName, ParticleGroup... subGroups) {
+ this.groupName = groupName;
+ this.subGroups = subGroups;
+ }
+
+ public String toString() {
+ return "ParticleGroup(" + groupName + ")";
+ }
+
+ public static final ParticleGroup HUGEEXPLOSION = new ParticleGroup("vanilla.hugeexplosion");
+ public static final ParticleGroup LARGEEXPLOSION = new ParticleGroup("vanilla.largeexplosion");
+ public static final ParticleGroup FIREWORKSPARK = new ParticleGroup("vanilla.fireworksSpark");
+ public static final ParticleGroup BUBBLE = new ParticleGroup("vanilla.bubble");
+ public static final ParticleGroup SUSPENDED = new ParticleGroup("vanilla.suspended");
+ public static final ParticleGroup DEPTHSUSPEND = new ParticleGroup("vanilla.depthsuspend");
+ public static final ParticleGroup TOWNAURA = new ParticleGroup("vanilla.townaura");
+ public static final ParticleGroup CRIT = new ParticleGroup("vanilla.crit");
+ public static final ParticleGroup MAGICCRIT = new ParticleGroup("vanilla.magicCrit");
+ public static final ParticleGroup SMOKE = new ParticleGroup("vanilla.smoke");
+ public static final ParticleGroup MOBSPELL = new ParticleGroup("vanilla.mobSpell");
+ public static final ParticleGroup MOBSPELLAMBIENT = new ParticleGroup("vanilla.mobSpellAmbient");
+ public static final ParticleGroup SPELL = new ParticleGroup("vanilla.spell");
+ public static final ParticleGroup INSTANTSPELL = new ParticleGroup("vanilla.instantSpell");
+ public static final ParticleGroup WITCHMAGIC = new ParticleGroup("vanilla.witchMagic");
+ public static final ParticleGroup NOTE = new ParticleGroup("vanilla.note");
+ public static final ParticleGroup PORTAL = new ParticleGroup("vanilla.portal");
+ public static final ParticleGroup ENCHANTMENTTABLE = new ParticleGroup("vanilla.enchantmenttable");
+ public static final ParticleGroup EXPLODE = new ParticleGroup("vanilla.explode");
+ public static final ParticleGroup FLAME = new ParticleGroup("vanilla.flame");
+ public static final ParticleGroup LAVA = new ParticleGroup("vanilla.lava");
+ public static final ParticleGroup FOOTSTEP = new ParticleGroup("vanilla.footstep");
+ public static final ParticleGroup SPLASH = new ParticleGroup("vanilla.splash");
+ public static final ParticleGroup WAKE = new ParticleGroup("vanilla.wake");
+ public static final ParticleGroup LARGESMOKE = new ParticleGroup("vanilla.largesmoke");
+ public static final ParticleGroup CLOUD = new ParticleGroup("vanilla.cloud");
+ public static final ParticleGroup REDDUST = new ParticleGroup("vanilla.reddust");
+ public static final ParticleGroup SNOWBALLPOOF = new ParticleGroup("vanilla.snowballpoof");
+ public static final ParticleGroup DRIPWATER = new ParticleGroup("vanilla.dripWater");
+ public static final ParticleGroup DRIPLAVA = new ParticleGroup("vanilla.dripLava");
+ public static final ParticleGroup SNOWSHOVEL = new ParticleGroup("vanilla.snowshovel");
+ public static final ParticleGroup SLIME = new ParticleGroup("vanilla.slime");
+ public static final ParticleGroup HEART = new ParticleGroup("vanilla.heart");
+ public static final ParticleGroup ANGRYVILLAGER = new ParticleGroup("vanilla.angryVillager");
+ public static final ParticleGroup HAPPYVILLAGER = new ParticleGroup("vanilla.happyVillager");
+ public static final ParticleGroup ICONCRACK = new ParticleGroup("vanilla.iconcrack_");
+ public static final ParticleGroup BLOCKCRACK = new ParticleGroup("vanilla.blockcrack");
+ public static final ParticleGroup BLOCKDUST = new ParticleGroup("vanilla.blockdust");
+
+ public static final ParticleGroup EXPLOSION = new ParticleGroup("group.explosion", HUGEEXPLOSION, LARGEEXPLOSION, EXPLODE);
+ public static final ParticleGroup ALLCRITS = new ParticleGroup("group.allcrits", CRIT, MAGICCRIT);
+ public static final ParticleGroup ALLSPELLS = new ParticleGroup("group.allspells", MOBSPELL, MOBSPELLAMBIENT, SPELL, INSTANTSPELL, WITCHMAGIC);
+ public static final ParticleGroup FOG = new ParticleGroup("group.fog", DEPTHSUSPEND, TOWNAURA);
+}
diff --git a/src/main/java/net/flarn/kinniutils/util/ParticleClassifier.java b/src/main/java/net/flarn/kinniutils/util/ParticleClassifier.java
new file mode 100644
index 0000000..3ac4bae
--- /dev/null
+++ b/src/main/java/net/flarn/kinniutils/util/ParticleClassifier.java
@@ -0,0 +1,151 @@
+package net.flarn.kinniutils.util;
+
+import cpw.mods.fml.common.FMLLog;
+import net.flarn.kinniutils.refs.ParticleGroup;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.particle.*;
+import net.minecraft.item.Item;
+import net.minecraft.util.IIcon;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by dsilvers on 02/05/15.
+ */
+public abstract class ParticleClassifier {
+ public final int specificity;
+ public final Class entityClass;
+ public final int textureIndex;
+ public abstract boolean dynamicMatch(EntityFX entity);
+
+ public ParticleClassifier(Class entityClass) {
+ this.entityClass = entityClass;
+ this.textureIndex = -1;
+ this.specificity = 0;
+ }
+
+ public ParticleClassifier() {
+ this.entityClass = EntityFX.class;
+ this.textureIndex = -1;
+ this.specificity = 0;
+ }
+
+ public ParticleClassifier(Class entityClass, int textureIndex) {
+ this.entityClass = entityClass;
+ this.textureIndex = textureIndex;
+ this.specificity = 0;
+ }
+
+ public ParticleClassifier(Class entityClass, int textureIndex, int specificity) {
+ this.entityClass = entityClass;
+ this.textureIndex = textureIndex;
+ this.specificity = specificity;
+ }
+
+ public boolean matchAgainstEntityFX(EntityFX entity) {
+ if (entity == null) { return false; }
+ if (!entityClass.isAssignableFrom(entity.getClass())) { return false; }
+ if (textureIndex != -1 && (entity.particleTextureIndexX + entity.particleTextureIndexY * 16) != textureIndex) { return false; }
+ return dynamicMatch(entity);
+ }
+
+ public static class BasicClassifier extends ParticleClassifier {
+ public BasicClassifier(Class entityClass, int textureIndex, int specificity) { super(entityClass, textureIndex, specificity); }
+ public BasicClassifier(Class entityClass, int textureIndex) { super(entityClass, textureIndex); }
+ public BasicClassifier(Class entityClass) { super(entityClass); }
+ public boolean dynamicMatch(EntityFX entity) { return true; }
+ }
+
+ public static class SpellClassifier extends ParticleClassifier {
+ private int kind;
+ public SpellClassifier(int kind) { super(EntitySpellParticleFX.class); this.kind = kind; }
+ public boolean dynamicMatch(EntityFX entity) {
+ /* We're only used for spell entities */
+ EntitySpellParticleFX sfx = (EntitySpellParticleFX)entity;
+ switch (kind) {
+ case 0:
+ /* mobSpell */
+ if (sfx.baseSpellTextureIndex != 128) { return false; }
+ if (sfx.particleAlpha != 1.0) { return false; }
+ if (sfx.particleRed == 1.0f && sfx.particleGreen == 1.0f && sfx.particleBlue == 1.0f) { return false; }
+ return true;
+ case 1:
+ /* mobSpellAmbient */
+ if (sfx.baseSpellTextureIndex != 128) { return false; }
+ if (sfx.particleAlpha != 0.15f) { return false; }
+ return true;
+ case 2:
+ /* spell */
+ if (sfx.baseSpellTextureIndex != 128) { return false; }
+ if (sfx.particleAlpha != 1.0) { return false; }
+ if (sfx.particleRed != 1.0f || sfx.particleGreen != 1.0f || sfx.particleBlue != 1.0f) { return false; }
+ return true;
+ case 3:
+ /* instantSpell */
+ if (sfx.baseSpellTextureIndex != 144) { return false; }
+ if (sfx.particleRed != 1.0f || sfx.particleGreen != 1.0f || sfx.particleBlue != 1.0f) { return false; }
+ return true;
+ case 4:
+ /* witchMagic */
+ if (sfx.baseSpellTextureIndex != 144) { return false; }
+ if (sfx.particleRed == 1.0f && sfx.particleGreen == 1.0f && sfx.particleBlue == 1.0f) { return false; }
+ return true;
+ }
+ return false;
+ }
+ }
+
+ public static class SmokeClassifier extends ParticleClassifier {
+ private final boolean large;
+ public SmokeClassifier(boolean large) { super(EntitySmokeFX.class); this.large = large; }
+ public boolean dynamicMatch(EntityFX entity) {
+ EntitySmokeFX sfx = (EntitySmokeFX) entity;
+ if (large) {
+ return sfx.smokeParticleScale > 1.5;
+ }
+ return sfx.smokeParticleScale <= 1.5;
+ }
+ }
+
+ public static class BreakingClassifier extends ParticleClassifier {
+ private final IIcon icon;
+ public BreakingClassifier(Item item) { this(item, 0); }
+ public BreakingClassifier(Item item, int dmg) { super(EntityBreakingFX.class); icon = item.getIconFromDamage(dmg); }
+ public boolean dynamicMatch(EntityFX entity) {
+ return entity.particleIcon == icon;
+ }
+ }
+
+ public static class DripClassifier extends ParticleClassifier {
+ private final Material material;
+ public DripClassifier(Material material) { super(EntityDropParticleFX.class); this.material = material; }
+ public boolean dynamicMatch(EntityFX entity) {
+ if (material == Material.water) {
+ return (entity.particleRed == 0.0F && entity.particleGreen == 0.0F && entity.particleBlue == 1.0F);
+ } else if (material == Material.lava) {
+ return (entity.particleRed == 1.0F && entity.particleGreen == 0.0F && entity.particleBlue == 0.0F);
+ }
+ return false; /* Any other material ... */
+ }
+ }
+
+ public static Map<ParticleClassifier, ParticleGroup> allClassifiers = new HashMap<ParticleClassifier, ParticleGroup>();
+ public static void registerClassifier(ParticleClassifier c, ParticleGroup g) {
+ allClassifiers.put(c, g);
+ }
+
+ public static ParticleGroup classifyParticle(EntityFX entity) {
+ int found_specificity = -1000000;
+ ParticleGroup result = null;
+ for (Map.Entry<ParticleClassifier, ParticleGroup> entry : allClassifiers.entrySet()) {
+ if (entry.getKey().matchAgainstEntityFX(entity)) {
+ if (entry.getKey().specificity > found_specificity) {
+ found_specificity = entry.getKey().specificity;
+ result = entry.getValue();
+ }
+ }
+ }
+ return result;
+ }
+}
diff --git a/src/main/resources/META-INF/kinniutils_at.cfg b/src/main/resources/META-INF/kinniutils_at.cfg
index 49e4663..9b56d18 100644
--- a/src/main/resources/META-INF/kinniutils_at.cfg
+++ b/src/main/resources/META-INF/kinniutils_at.cfg
@@ -2,3 +2,13 @@
#
# Those for the Particle Filters
public net.minecraft.client.particle.EffectRenderer field_78876_b # fxLayers
+public net.minecraft.client.particle.EntityFX field_94054_b # particleTextureIndexX
+public net.minecraft.client.particle.EntityFX field_94055_c # particleTextureIndexY
+public net.minecraft.client.particle.EntityFX field_70552_h # particleRed
+public net.minecraft.client.particle.EntityFX field_70553_i # particleGreen
+public net.minecraft.client.particle.EntityFX field_70551_j # particleBlue
+public net.minecraft.client.particle.EntityFX field_82339_as # particleAlpha
+public net.minecraft.client.particle.EntityFX field_70544_f # particleScale
+public net.minecraft.client.particle.EntityFX field_70550_a # particleIcon
+public net.minecraft.client.particle.EntitySpellParticleFX field_70590_a # baseSpellTextureIndex
+public net.minecraft.client.particle.EntitySmokeFX field_70587_a # smokeParticleScale