quick fix : 'if' can be replaced with 'switch'

This commit is contained in:
Alexdoru authored and Jason Mitchell committed 2023-01-28 18:02:41 -08:00
1 parent 9cfd723ea3
commit 4ad67bc34b
2 files changed
+380 -329

No files matched your search

+261 -245
View File
@@ -34,276 +34,292 @@ public final class IMCHandler {
if (type == null || type.isEmpty()) continue;
// process materials added from mods
if (type.equals("addMaterial")) {
if (!message.isNBTMessage()) {
logInvalidMessage(message);
continue;
}
NBTTagCompound tag = message.getNBTValue();
int id = tag.getInteger("Id");
ToolMaterial mat = scanMaterial(tag);
if (mat != null) {
TConstructRegistry.addtoolMaterial(id, mat);
TConstructRegistry.addDefaultToolPartMaterial(id);
TConstruct.logger.debug("IMC: Added material " + mat.materialName);
// bow stats
if (tag.hasKey("Bow_DrawSpeed") && tag.hasKey("Bow_ProjectileSpeed")) {
int drawspeed = tag.getInteger("Bow_DrawSpeed");
float flightspeed = tag.getFloat("Bow_ProjectileSpeed");
TConstructRegistry.addBowMaterial(id, drawspeed, flightspeed);
TConstruct.logger.debug("IMC: Added Bow stats for material " + mat.materialName);
}
// arrow stats
if (tag.hasKey("Projectile_Mass") && tag.hasKey("Projectile_Fragility")) {
float mass = tag.getFloat("Projectile_Mass");
float breakchance = tag.getFloat("Projectile_Fragility");
TConstructRegistry.addArrowMaterial(id, mass, breakchance);
TConstruct.logger.debug("IMC: Added Projectile stats for material " + mat.materialName);
switch (type) {
case "addMaterial": {
if (!message.isNBTMessage()) {
logInvalidMessage(message);
continue;
}
// add additional render mapping so resource packs or the mods themselves can have custom textures
// for the tools
if (FMLCommonHandler.instance().getSide().isClient())
TConstructClientRegistry.addMaterialRenderMapping(
id, "tinker", mat.name().toLowerCase(), true);
NBTTagCompound tag = message.getNBTValue();
int id = tag.getInteger("Id");
ToolMaterial mat = scanMaterial(tag);
if (mat != null) {
TConstructRegistry.addtoolMaterial(id, mat);
TConstructRegistry.addDefaultToolPartMaterial(id);
TConstruct.logger.debug("IMC: Added material " + mat.materialName);
// bow stats
if (tag.hasKey("Bow_DrawSpeed") && tag.hasKey("Bow_ProjectileSpeed")) {
int drawspeed = tag.getInteger("Bow_DrawSpeed");
float flightspeed = tag.getFloat("Bow_ProjectileSpeed");
TConstructRegistry.addBowMaterial(id, drawspeed, flightspeed);
TConstruct.logger.debug("IMC: Added Bow stats for material " + mat.materialName);
}
// arrow stats
if (tag.hasKey("Projectile_Mass") && tag.hasKey("Projectile_Fragility")) {
float mass = tag.getFloat("Projectile_Mass");
float breakchance = tag.getFloat("Projectile_Fragility");
TConstructRegistry.addArrowMaterial(id, mass, breakchance);
TConstruct.logger.debug("IMC: Added Projectile stats for material " + mat.materialName);
}
// add additional render mapping so resource packs or the mods themselves can have custom textures
// for the tools
if (FMLCommonHandler.instance().getSide().isClient())
TConstructClientRegistry.addMaterialRenderMapping(
id, "tinker", mat.name().toLowerCase(), true);
}
break;
}
} else if (type.equals("addPartBuilderMaterial")) {
if (!message.isNBTMessage()) {
logInvalidMessage(message);
continue;
}
NBTTagCompound tag = message.getNBTValue();
case "addPartBuilderMaterial": {
if (!message.isNBTMessage()) {
logInvalidMessage(message);
continue;
}
NBTTagCompound tag = message.getNBTValue();
if (!checkRequiredTags("PartBuilder", tag, "MaterialId", "Item", "Value")) continue;
if (!checkRequiredTags("PartBuilder", tag, "MaterialId", "Item", "Value")) continue;
int matID = tag.getInteger("MaterialId");
int value = tag.getInteger("Value");
int matID = tag.getInteger("MaterialId");
int value = tag.getInteger("Value");
if (TConstructRegistry.getMaterial(matID) == null) {
FMLLog.bigWarning("PartBuilder IMC: Unknown Material ID " + matID);
continue;
}
if (TConstructRegistry.getMaterial(matID) == null) {
FMLLog.bigWarning("PartBuilder IMC: Unknown Material ID " + matID);
continue;
}
ItemStack item = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Item"));
ItemStack shard = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Shard")); // optional
ItemStack rod = new ItemStack(TinkerTools.toolRod, 1, matID);
ItemStack item = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Item"));
ItemStack shard = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Shard")); // optional
// default shard if none present. Has to exist because old code.
if (shard == null) {
TConstructRegistry.addDefaultShardMaterial(matID);
shard = new ItemStack(TinkerTools.toolShard, 1, matID);
}
ItemStack rod = new ItemStack(TinkerTools.toolRod, 1, matID);
// register the material
PatternBuilder.instance.registerFullMaterial(
item, value, TConstructRegistry.getMaterial(matID).materialName, shard, rod, matID);
List<Item> addItems = new LinkedList<>();
List<Integer> addMetas = new LinkedList<>();
List<ItemStack> addOUtputs = new LinkedList<>();
// add mappings for everything that has stone tool mappings
for (Map.Entry<List, ItemStack> mappingEntry : TConstructRegistry.patternPartMapping.entrySet()) {
List mapping = mappingEntry.getKey();
// only stone mappings
if ((Integer) mapping.get(2) != TinkerTools.MaterialID.Stone) continue;
// only if the output is a dynamic part
if (!(mappingEntry.getValue().getItem() instanceof DynamicToolPart)) continue;
Item woodPattern = (Item) mapping.get(0);
Integer meta = (Integer) mapping.get(1);
ItemStack output = mappingEntry.getValue().copy();
output.setItemDamage(matID);
// save data, concurrent modification exception and i'm lazy
addItems.add(woodPattern);
addMetas.add(meta);
addOUtputs.add(output);
}
// add a part mapping for it
for (int i = 0; i < addItems.size(); i++)
TConstructRegistry.addPartMapping(addItems.get(i), addMetas.get(i), matID, addOUtputs.get(i));
TConstruct.logger.debug("PartBuilder IMC: Added Part builder mapping for "
+ TConstructRegistry.getMaterial(matID).materialName);
} else if (type.equals("addPartCastingMaterial")) {
if (!message.isNBTMessage()) {
logInvalidMessage(message);
continue;
}
NBTTagCompound tag = message.getNBTValue();
if (!checkRequiredTags("Casting", tag, "MaterialId", "FluidName")) continue;
if (!tag.hasKey("MaterialId")) {
FMLLog.bigWarning("Casting IMC: Not material ID for the result present");
continue;
}
int matID = tag.getInteger("MaterialId");
FluidStack liquid = FluidStack.loadFluidStackFromNBT(tag);
if (liquid == null) {
FMLLog.bigWarning("Casting IMC: No fluid found");
continue;
}
if (TConstructRegistry.getMaterial(matID) == null) {
FMLLog.bigWarning("Casting IMC: Unknown Material ID " + matID);
continue;
}
// we add the toolpart to all smeltery recipies that use iron and create a toolpart
List<CastingRecipe> newRecipies = new LinkedList<>();
for (CastingRecipe recipe : TConstructRegistry.getTableCasting().getCastingRecipes()) {
if (recipe.castingMetal.getFluid() != TinkerSmeltery.moltenIronFluid) continue;
if (recipe.cast == null || !(recipe.cast.getItem() instanceof IPattern)) continue;
if (!(recipe.getResult().getItem()
instanceof DynamicToolPart)) // has to be dynamic toolpart to support automatic addition
continue;
newRecipies.add(recipe);
}
FluidType ft = FluidType.getFluidType(liquid.getFluid());
if (ft == null) {
ft = new FluidType(TinkerSmeltery.glueBlock, 0, 500, liquid.getFluid(), true);
FluidType.registerFluidType(liquid.getFluid().getName(), ft);
}
// has to be done separately so we have all checks and no concurrent modification exception
for (CastingRecipe recipe : newRecipies) {
ItemStack output = recipe.getResult().copy();
output.setItemDamage(matID);
FluidStack liquid2 = new FluidStack(liquid, recipe.castingMetal.amount);
// ok, this recipe creates a toolpart and uses iron for it. add a new one for the IMC stuff!
TConstructRegistry.getTableCasting()
.addCastingRecipe(output, liquid2, recipe.cast, recipe.consumeCast, recipe.coolTime);
// and make it melt!
Smeltery.addMelting(ft, output, 0, liquid2.amount);
}
TConstruct.logger.debug("Casting IMC: Added fluid " + tag.getString("FluidName") + " to part casting");
} else if (type.equals("addMaterialItem")) {
if (!message.isNBTMessage()) {
logInvalidMessage(message);
continue;
}
NBTTagCompound tag = message.getNBTValue();
if (!checkRequiredTags("Material Item", tag, "MaterialId", "Value", "Item")) continue;
int id = tag.getInteger("MaterialId");
int value = tag.getInteger("Value");
ItemStack stack = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Item"));
if (stack == null) {
FMLLog.bigWarning("Material Item IMC: Item for Material %d is null", id);
continue;
}
if (TConstructRegistry.getMaterial(id) == null) {
FMLLog.bigWarning("Material Item IMC: Material with ID %d does not exist", id);
continue;
}
ToolMaterial mat = TConstructRegistry.getMaterial(id);
// we already have the material registered in there
if (PatternBuilder.instance.materialSets.containsKey(mat.materialName)) {
PatternBuilder.instance.registerMaterial(stack, value, mat.materialName);
} else {
TConstructRegistry.addDefaultShardMaterial(id);
ItemStack shard = new ItemStack(TinkerTools.toolShard, 1, id);
ItemStack rod = new ItemStack(TinkerTools.toolRod, 1, id);
// default shard if none present. Has to exist because old code.
if (shard == null) {
TConstructRegistry.addDefaultShardMaterial(matID);
shard = new ItemStack(TinkerTools.toolShard, 1, matID);
}
// register the material
PatternBuilder.instance.registerFullMaterial(
stack, value, TConstructRegistry.getMaterial(id).materialName, shard, rod, id);
item, value, TConstructRegistry.getMaterial(matID).materialName, shard, rod, matID);
List<Item> addItems = new LinkedList<>();
List<Integer> addMetas = new LinkedList<>();
List<ItemStack> addOUtputs = new LinkedList<>();
// add mappings for everything that has stone tool mappings
for (Map.Entry<List, ItemStack> mappingEntry : TConstructRegistry.patternPartMapping.entrySet()) {
List mapping = mappingEntry.getKey();
// only stone mappings
if ((Integer) mapping.get(2) != TinkerTools.MaterialID.Stone) continue;
// only if the output is a dynamic part
if (!(mappingEntry.getValue().getItem() instanceof DynamicToolPart)) continue;
Item woodPattern = (Item) mapping.get(0);
Integer meta = (Integer) mapping.get(1);
ItemStack output = mappingEntry.getValue().copy();
output.setItemDamage(matID);
// save data, concurrent modification exception and i'm lazy
addItems.add(woodPattern);
addMetas.add(meta);
addOUtputs.add(output);
}
// add a part mapping for it
for (int i = 0; i < addItems.size(); i++)
TConstructRegistry.addPartMapping(addItems.get(i), addMetas.get(i), matID, addOUtputs.get(i));
TConstruct.logger.debug("PartBuilder IMC: Added Part builder mapping for "
+ TConstructRegistry.getMaterial(matID).materialName);
break;
}
} else if (type.equals("addSmelteryMelting")) {
if (!message.isNBTMessage()) {
logInvalidMessage(message);
continue;
case "addPartCastingMaterial": {
if (!message.isNBTMessage()) {
logInvalidMessage(message);
continue;
}
NBTTagCompound tag = message.getNBTValue();
if (!checkRequiredTags("Casting", tag, "MaterialId", "FluidName")) continue;
if (!tag.hasKey("MaterialId")) {
FMLLog.bigWarning("Casting IMC: Not material ID for the result present");
continue;
}
int matID = tag.getInteger("MaterialId");
FluidStack liquid = FluidStack.loadFluidStackFromNBT(tag);
if (liquid == null) {
FMLLog.bigWarning("Casting IMC: No fluid found");
continue;
}
if (TConstructRegistry.getMaterial(matID) == null) {
FMLLog.bigWarning("Casting IMC: Unknown Material ID " + matID);
continue;
}
// we add the toolpart to all smeltery recipies that use iron and create a toolpart
List<CastingRecipe> newRecipies = new LinkedList<>();
for (CastingRecipe recipe : TConstructRegistry.getTableCasting().getCastingRecipes()) {
if (recipe.castingMetal.getFluid() != TinkerSmeltery.moltenIronFluid) continue;
if (recipe.cast == null || !(recipe.cast.getItem() instanceof IPattern)) continue;
if (!(recipe.getResult().getItem()
instanceof DynamicToolPart)) // has to be dynamic toolpart to support automatic addition
continue;
newRecipies.add(recipe);
}
FluidType ft = FluidType.getFluidType(liquid.getFluid());
if (ft == null) {
ft = new FluidType(TinkerSmeltery.glueBlock, 0, 500, liquid.getFluid(), true);
FluidType.registerFluidType(liquid.getFluid().getName(), ft);
}
// has to be done separately so we have all checks and no concurrent modification exception
for (CastingRecipe recipe : newRecipies) {
ItemStack output = recipe.getResult().copy();
output.setItemDamage(matID);
FluidStack liquid2 = new FluidStack(liquid, recipe.castingMetal.amount);
// ok, this recipe creates a toolpart and uses iron for it. add a new one for the IMC stuff!
TConstructRegistry.getTableCasting()
.addCastingRecipe(output, liquid2, recipe.cast, recipe.consumeCast, recipe.coolTime);
// and make it melt!
Smeltery.addMelting(ft, output, 0, liquid2.amount);
}
TConstruct.logger.debug("Casting IMC: Added fluid " + tag.getString("FluidName") + " to part casting");
break;
}
NBTTagCompound tag = message.getNBTValue();
case "addMaterialItem": {
if (!message.isNBTMessage()) {
logInvalidMessage(message);
continue;
}
if (!checkRequiredTags("Smeltery", tag, "FluidName", "Temperature", "Item", "Block")) continue;
NBTTagCompound tag = message.getNBTValue();
FluidStack liquid = FluidStack.loadFluidStackFromNBT(tag);
if (liquid == null) {
FMLLog.bigWarning("Smeltery IMC: No fluid found");
continue;
if (!checkRequiredTags("Material Item", tag, "MaterialId", "Value", "Item")) continue;
int id = tag.getInteger("MaterialId");
int value = tag.getInteger("Value");
ItemStack stack = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Item"));
if (stack == null) {
FMLLog.bigWarning("Material Item IMC: Item for Material %d is null", id);
continue;
}
if (TConstructRegistry.getMaterial(id) == null) {
FMLLog.bigWarning("Material Item IMC: Material with ID %d does not exist", id);
continue;
}
ToolMaterial mat = TConstructRegistry.getMaterial(id);
// we already have the material registered in there
if (PatternBuilder.instance.materialSets.containsKey(mat.materialName)) {
PatternBuilder.instance.registerMaterial(stack, value, mat.materialName);
} else {
TConstructRegistry.addDefaultShardMaterial(id);
ItemStack shard = new ItemStack(TinkerTools.toolShard, 1, id);
ItemStack rod = new ItemStack(TinkerTools.toolRod, 1, id);
// register the material
PatternBuilder.instance.registerFullMaterial(
stack, value, TConstructRegistry.getMaterial(id).materialName, shard, rod, id);
}
break;
}
if (liquid.amount <= 0) {
FMLLog.bigWarning("Smeltery IMC: Liquid has to have an amount greater than zero");
continue;
case "addSmelteryMelting": {
if (!message.isNBTMessage()) {
logInvalidMessage(message);
continue;
}
NBTTagCompound tag = message.getNBTValue();
if (!checkRequiredTags("Smeltery", tag, "FluidName", "Temperature", "Item", "Block")) continue;
FluidStack liquid = FluidStack.loadFluidStackFromNBT(tag);
if (liquid == null) {
FMLLog.bigWarning("Smeltery IMC: No fluid found");
continue;
}
if (liquid.amount <= 0) {
FMLLog.bigWarning("Smeltery IMC: Liquid has to have an amount greater than zero");
continue;
}
ItemStack item = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Item"));
ItemStack block = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Block"));
int temperature = tag.getInteger("Temperature");
if (FluidType.getFluidType(liquid.getFluid()) == null)
FluidType.registerFluidType(
liquid.getFluid().getName(),
Block.getBlockFromItem(block.getItem()),
block.getItemDamage(),
temperature,
liquid.getFluid(),
false);
Smeltery.addMelting(
item, Block.getBlockFromItem(block.getItem()), block.getItemDamage(), temperature, liquid);
TConstruct.logger.debug("Smeltery IMC: Added melting: " + item.getDisplayName() + " to " + liquid.amount
+ "mb " + liquid.getLocalizedName());
break;
}
case "addSmelteryFuel": {
if (!message.isNBTMessage()) {
logInvalidMessage(message);
continue;
}
NBTTagCompound tag = message.getNBTValue();
ItemStack item = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Item"));
ItemStack block = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Block"));
int temperature = tag.getInteger("Temperature");
if (!checkRequiredTags("Smeltery", tag, "FluidName", "Temperature", "Duration")) continue;
if (FluidType.getFluidType(liquid.getFluid()) == null)
FluidType.registerFluidType(
liquid.getFluid().getName(),
Block.getBlockFromItem(block.getItem()),
block.getItemDamage(),
temperature,
liquid.getFluid(),
false);
FluidStack liquid = FluidStack.loadFluidStackFromNBT(tag);
if (liquid == null) {
FMLLog.bigWarning("Smeltery IMC: No fluid found");
continue;
}
Smeltery.addMelting(
item, Block.getBlockFromItem(block.getItem()), block.getItemDamage(), temperature, liquid);
TConstruct.logger.debug("Smeltery IMC: Added melting: " + item.getDisplayName() + " to " + liquid.amount
+ "mb " + liquid.getLocalizedName());
} else if (type.equals("addSmelteryFuel")) {
if (!message.isNBTMessage()) {
logInvalidMessage(message);
continue;
int temperature = tag.getInteger("Temperature");
int duration = tag.getInteger("Duration");
Smeltery.addSmelteryFuel(liquid.getFluid(), temperature, duration);
TConstruct.logger.debug("Smeltery IMC: Added fuel: " + liquid.getLocalizedName() + " (" + temperature
+ ", " + duration + ")");
break;
}
NBTTagCompound tag = message.getNBTValue();
case "addFluxBattery":
if (!message.isItemStackMessage()) {
logInvalidMessage(message, "ItemStack");
continue;
}
ItemStack battery = message.getItemStackValue();
battery.stackSize = 1; // avoid getting a stack size of 0 or larger than 1
if (!checkRequiredTags("Smeltery", tag, "FluidName", "Temperature", "Duration")) continue;
FluidStack liquid = FluidStack.loadFluidStackFromNBT(tag);
if (liquid == null) {
FMLLog.bigWarning("Smeltery IMC: No fluid found");
continue;
}
if (!(battery.getItem() instanceof IEnergyContainerItem)) {
FMLLog.bigWarning("Flux Battery IMC: ItemStack is no instance of IEnergyContainerItem");
}
int temperature = tag.getInteger("Temperature");
int duration = tag.getInteger("Duration");
Smeltery.addSmelteryFuel(liquid.getFluid(), temperature, duration);
TConstruct.logger.debug("Smeltery IMC: Added fuel: " + liquid.getLocalizedName() + " (" + temperature
+ ", " + duration + ")");
} else if (type.equals("addFluxBattery")) {
if (!message.isItemStackMessage()) {
logInvalidMessage(message, "ItemStack");
continue;
}
ItemStack battery = message.getItemStackValue();
battery.stackSize = 1; // avoid getting a stack size of 0 or larger than 1
if (!(battery.getItem() instanceof IEnergyContainerItem)) {
FMLLog.bigWarning("Flux Battery IMC: ItemStack is no instance of IEnergyContainerItem");
}
if (TinkerTools.modFlux != null) {
TinkerTools.modFlux.batteries.add(battery);
}
if (TinkerTools.modFlux != null) {
TinkerTools.modFlux.batteries.add(battery);
}
break;
}
}
}
@@ -107,17 +107,21 @@ public class TinkerWorldProxyClient extends TinkerWorldProxyCommon {
double d8 = this.mc.renderViewEntity.posZ - par6;
EntityFX entityfx = null;
if (par1Str.equals("hugeexplosion")) {
this.mc.effectRenderer.addEffect(
entityfx = new EntityHugeExplodeFX(mc.theWorld, par2, par4, par6, par8, par10, par12));
} else if (par1Str.equals("largeexplode")) {
this.mc.effectRenderer.addEffect(
entityfx = new EntityLargeExplodeFX(
mc.renderEngine, mc.theWorld, par2, par4, par6, par8, par10, par12));
} else if (par1Str.equals("fireworksSpark")) {
this.mc.effectRenderer.addEffect(
entityfx = new EntityFireworkSparkFX(
mc.theWorld, par2, par4, par6, par8, par10, par12, this.mc.effectRenderer));
switch (par1Str) {
case "hugeexplosion":
this.mc.effectRenderer.addEffect(
entityfx = new EntityHugeExplodeFX(mc.theWorld, par2, par4, par6, par8, par10, par12));
break;
case "largeexplode":
this.mc.effectRenderer.addEffect(
entityfx = new EntityLargeExplodeFX(
mc.renderEngine, mc.theWorld, par2, par4, par6, par8, par10, par12));
break;
case "fireworksSpark":
this.mc.effectRenderer.addEffect(
entityfx = new EntityFireworkSparkFX(
mc.theWorld, par2, par4, par6, par8, par10, par12, this.mc.effectRenderer));
break;
}
if (entityfx != null) {
@@ -130,79 +134,110 @@ public class TinkerWorldProxyClient extends TinkerWorldProxyCommon {
} else if (i > 1) {
return null;
} else {
if (par1Str.equals("bubble")) {
entityfx = new EntityBubbleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("suspended")) {
entityfx = new EntitySuspendFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("depthsuspend")) {
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("townaura")) {
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("crit")) {
entityfx = new EntityCritFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("smoke")) {
entityfx = new EntitySmokeFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("mobSpell")) {
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, 0.0D, 0.0D, 0.0D);
((EntityFX) entityfx).setRBGColorF((float) par8, (float) par10, (float) par12);
} else if (par1Str.equals("mobSpellAmbient")) {
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, 0.0D, 0.0D, 0.0D);
((EntityFX) entityfx).setAlphaF(0.15F);
((EntityFX) entityfx).setRBGColorF((float) par8, (float) par10, (float) par12);
} else if (par1Str.equals("spell")) {
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("instantSpell")) {
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
((EntitySpellParticleFX) entityfx).setBaseSpellTextureIndex(144);
} else if (par1Str.equals("witchMagic")) {
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
((EntitySpellParticleFX) entityfx).setBaseSpellTextureIndex(144);
float f = mc.theWorld.rand.nextFloat() * 0.5F + 0.35F;
((EntityFX) entityfx).setRBGColorF(1.0F * f, 0.0F * f, 1.0F * f);
} else if (par1Str.equals("note")) {
entityfx = new EntityNoteFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("portal")) {
entityfx = new EntityPortalFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("enchantmenttable")) {
entityfx =
new EntityEnchantmentTableParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("explode")) {
entityfx = new EntityExplodeFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("flame")) {
entityfx = new EntityFlameFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("lava")) {
entityfx = new EntityLavaFX(mc.theWorld, par2, par4, par6);
} else if (par1Str.equals("footstep")) {
entityfx = new EntityFootStepFX(mc.renderEngine, mc.theWorld, par2, par4, par6);
} else if (par1Str.equals("splash")) {
entityfx = new EntitySplashFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("largesmoke")) {
entityfx = new EntitySmokeFX(mc.theWorld, par2, par4, par6, par8, par10, par12, 2.5F);
} else if (par1Str.equals("cloud")) {
entityfx = new EntityCloudFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("reddust")) {
entityfx = new EntityReddustFX(
mc.theWorld, par2, par4, par6, (float) par8, (float) par10, (float) par12);
} else if (par1Str.equals("snowballpoof")) {
entityfx = new EntityBreakingFX(mc.theWorld, par2, par4, par6, Items.snowball);
} else if (par1Str.equals("dripWater")) {
entityfx = new EntityDropParticleFX(mc.theWorld, par2, par4, par6, Material.water);
} else if (par1Str.equals("dripLava")) {
entityfx = new EntityDropParticleFX(mc.theWorld, par2, par4, par6, Material.lava);
} else if (par1Str.equals("snowshovel")) {
entityfx = new EntitySnowShovelFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("blueslime")) {
entityfx = new EntityBreakingFX(mc.theWorld, par2, par4, par6, TinkerWorld.strangeFood);
} else if (par1Str.equals("heart")) {
entityfx = new EntityHeartFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("angryVillager")) {
entityfx = new EntityHeartFX(mc.theWorld, par2, par4 + 0.5D, par6, par8, par10, par12);
((EntityFX) entityfx).setParticleTextureIndex(81);
((EntityFX) entityfx).setRBGColorF(1.0F, 1.0F, 1.0F);
} else if (par1Str.equals("happyVillager")) {
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
((EntityFX) entityfx).setParticleTextureIndex(82);
((EntityFX) entityfx).setRBGColorF(1.0F, 1.0F, 1.0F);
switch (par1Str) {
case "bubble":
entityfx = new EntityBubbleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
break;
case "suspended":
entityfx = new EntitySuspendFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
break;
case "depthsuspend":
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
break;
case "townaura":
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
break;
case "crit":
entityfx = new EntityCritFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
break;
case "smoke":
entityfx = new EntitySmokeFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
break;
case "mobSpell":
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, 0.0D, 0.0D, 0.0D);
((EntityFX) entityfx).setRBGColorF((float) par8, (float) par10, (float) par12);
break;
case "mobSpellAmbient":
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, 0.0D, 0.0D, 0.0D);
((EntityFX) entityfx).setAlphaF(0.15F);
((EntityFX) entityfx).setRBGColorF((float) par8, (float) par10, (float) par12);
break;
case "spell":
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
break;
case "instantSpell":
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
((EntitySpellParticleFX) entityfx).setBaseSpellTextureIndex(144);
break;
case "witchMagic":
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
((EntitySpellParticleFX) entityfx).setBaseSpellTextureIndex(144);
float f = mc.theWorld.rand.nextFloat() * 0.5F + 0.35F;
((EntityFX) entityfx).setRBGColorF(1.0F * f, 0.0F * f, 1.0F * f);
break;
case "note":
entityfx = new EntityNoteFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
break;
case "portal":
entityfx = new EntityPortalFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
break;
case "enchantmenttable":
entityfx =
new EntityEnchantmentTableParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
break;
case "explode":
entityfx = new EntityExplodeFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
break;
case "flame":
entityfx = new EntityFlameFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
break;
case "lava":
entityfx = new EntityLavaFX(mc.theWorld, par2, par4, par6);
break;
case "footstep":
entityfx = new EntityFootStepFX(mc.renderEngine, mc.theWorld, par2, par4, par6);
break;
case "splash":
entityfx = new EntitySplashFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
break;
case "largesmoke":
entityfx = new EntitySmokeFX(mc.theWorld, par2, par4, par6, par8, par10, par12, 2.5F);
break;
case "cloud":
entityfx = new EntityCloudFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
break;
case "reddust":
entityfx = new EntityReddustFX(
mc.theWorld, par2, par4, par6, (float) par8, (float) par10, (float) par12);
break;
case "snowballpoof":
entityfx = new EntityBreakingFX(mc.theWorld, par2, par4, par6, Items.snowball);
break;
case "dripWater":
entityfx = new EntityDropParticleFX(mc.theWorld, par2, par4, par6, Material.water);
break;
case "dripLava":
entityfx = new EntityDropParticleFX(mc.theWorld, par2, par4, par6, Material.lava);
break;
case "snowshovel":
entityfx = new EntitySnowShovelFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
break;
case "blueslime":
entityfx = new EntityBreakingFX(mc.theWorld, par2, par4, par6, TinkerWorld.strangeFood);
break;
case "heart":
entityfx = new EntityHeartFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
break;
case "angryVillager":
entityfx = new EntityHeartFX(mc.theWorld, par2, par4 + 0.5D, par6, par8, par10, par12);
((EntityFX) entityfx).setParticleTextureIndex(81);
((EntityFX) entityfx).setRBGColorF(1.0F, 1.0F, 1.0F);
break;
case "happyVillager":
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
((EntityFX) entityfx).setParticleTextureIndex(82);
((EntityFX) entityfx).setRBGColorF(1.0F, 1.0F, 1.0F);
break;
}
if (entityfx != null) {