From bab73d8a4389004fc8b0a48dee5c5ddbbf80b3af Mon Sep 17 00:00:00 2001 From: Lizbeth Rika Date: Mon, 10 Nov 2014 18:20:59 +0000 Subject: [PATCH] Added some more info to the spark page and add a display to show which sparks it can connect. --- .../botania/common/entity/EntitySpark.java | 63 +++++++++++++++---- .../botania/common/lexicon/LexiconData.java | 2 +- .../resources/assets/botania/lang/en_US.lang | 3 +- 3 files changed, 53 insertions(+), 15 deletions(-) diff --git a/src/main/java/vazkii/botania/common/entity/EntitySpark.java b/src/main/java/vazkii/botania/common/entity/EntitySpark.java index c030be59b..a5d5f45b5 100644 --- a/src/main/java/vazkii/botania/common/entity/EntitySpark.java +++ b/src/main/java/vazkii/botania/common/entity/EntitySpark.java @@ -11,6 +11,7 @@ */ package vazkii.botania.common.entity; +import java.awt.Color; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -41,6 +42,7 @@ public class EntitySpark extends Entity implements ISparkEntity { private static final int TRANSFER_RATE = 1000; private static final String TAG_UPGRADE = "upgrade"; int removeTransferants = 2; + boolean didStartupParticles = false; public EntitySpark(World world) { super(world); @@ -68,11 +70,41 @@ public class EntitySpark extends Entity implements ISparkEntity { return; } + + List allSparks = SparkHelper.getSparksAround(worldObj, posX, posY, posZ); + if(worldObj.isRemote && !didStartupParticles) { + for(ISparkEntity spark : allSparks) { + Entity e = (Entity) spark; + Vector3 orig = new Vector3(e.posX , e.posY + 0.25, e.posZ); + Vector3 end = new Vector3(posX, posY + 0.25, posZ); + Vector3 diff = end.copy().sub(orig); + Vector3 movement = diff.copy().normalize().multiply(0.05); + int iters = (int) (diff.mag() / movement.mag()); + float huePer = 1F / iters; + float hueSum = (float) Math.random(); + + Vector3 currentPos = orig.copy(); + for(int i = 0; i < iters; i++) { + float hue = i * huePer + hueSum; + Color color = Color.getHSBColor(hue, 1F, 1F); + float r = Math.min(1F, color.getRed() / 255F + 0.4F); + float g = Math.min(1F, color.getGreen() / 255F + 0.4F); + float b = Math.min(1F, color.getBlue() / 255F + 0.4F); + + Botania.proxy.setSparkleFXNoClip(true); + Botania.proxy.sparkleFX(worldObj, currentPos.x, currentPos.y, currentPos.z, r, g, b, 0.6F, 12); + Botania.proxy.setSparkleFXNoClip(false); + currentPos.add(movement); + } + } + + didStartupParticles = true; + } + Collection transfers = getTransfers(); int upgrade = getUpgrade(); if(upgrade != 0) { - List sparks = SparkHelper.getSparksAround(worldObj, posX, posY, posZ); switch(upgrade) { case 1 : { // Dispersive List players = SparkHelper.getEntitiesAround(EntityPlayer.class, worldObj, posX, posY, posZ); @@ -126,7 +158,7 @@ public class EntitySpark extends Entity implements ISparkEntity { break; } case 2 : { // Dominant - for(ISparkEntity spark : sparks) { + for(ISparkEntity spark : allSparks) { if(spark == this) continue; @@ -137,7 +169,7 @@ public class EntitySpark extends Entity implements ISparkEntity { break; } case 3 : { // Recessive - for(ISparkEntity spark : sparks) { + for(ISparkEntity spark : allSparks) { if(spark == this) continue; @@ -202,17 +234,22 @@ public class EntitySpark extends Entity implements ISparkEntity { if(stack != null) { int upgrade = getUpgrade(); if(stack.getItem() == ModItems.twigWand) { - if(upgrade > 0) { - if(!worldObj.isRemote) - entityDropItem(new ItemStack(ModItems.sparkUpgrade, 1, upgrade - 1), 0F); - setUpgrade(0); + if(player.isSneaking()) { + if(upgrade > 0) { + if(!worldObj.isRemote) + entityDropItem(new ItemStack(ModItems.sparkUpgrade, 1, upgrade - 1), 0F); + setUpgrade(0); - dataWatcher.updateObject(29, ""); - removeTransferants = 2; - } else setDead(); - if(player.worldObj.isRemote) - player.swingItem(); - return true; + dataWatcher.updateObject(29, ""); + removeTransferants = 2; + } else setDead(); + if(player.worldObj.isRemote) + player.swingItem(); + return true; + } else { + didStartupParticles = false; + return true; + } } else if(stack.getItem() == ModItems.sparkUpgrade && upgrade == 0) { int newUpgrade = stack.getItemDamage() + 1; setUpgrade(newUpgrade); diff --git a/src/main/java/vazkii/botania/common/lexicon/LexiconData.java b/src/main/java/vazkii/botania/common/lexicon/LexiconData.java index d01edb34a..7c5138803 100644 --- a/src/main/java/vazkii/botania/common/lexicon/LexiconData.java +++ b/src/main/java/vazkii/botania/common/lexicon/LexiconData.java @@ -253,7 +253,7 @@ public final class LexiconData { pool.setPriority().setLexiconPages(new PageText("0"), new PageText("9"), new PageCraftingRecipe("1", ModCraftingRecipes.recipePool), new PageManaInfusionRecipe("10", ModManaInfusionRecipes.poolRecipe), new PageText("2"), new PageText("8"), new PageManaInfusionRecipe("3", ModManaInfusionRecipes.manasteelRecipes), new PageManaInfusionRecipe("4", ModManaInfusionRecipes.manaPearlRecipe), new PageManaInfusionRecipe("5", ModManaInfusionRecipes.manaDiamondRecipe), new PageManaInfusionRecipe("6", ModManaInfusionRecipes.manaPetalRecipes), new PageManaInfusionRecipe("11", ModManaInfusionRecipes.managlassRecipe), new PageManaInfusionRecipe("7", ModManaInfusionRecipes.manaCookieRecipe)); sparks = new BLexiconEntry(LibLexicon.MANA_SPARKS, categoryMana); - sparks.setPriority().setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipesSpark)); + sparks.setPriority().setLexiconPages(new PageText("0"), new PageText("1"), new PageCraftingRecipe("2", ModCraftingRecipes.recipesSpark)); sparkUpgrades = new ALexiconEntry(LibLexicon.MANA_SPARK_UPGRADES, categoryMana); sparkUpgrades.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"), new PageText("3"), new PageText("4"), new PageCraftingRecipe("5", ModCraftingRecipes.recipesSparkUpgrades)); diff --git a/src/main/resources/assets/botania/lang/en_US.lang b/src/main/resources/assets/botania/lang/en_US.lang index bcd4adb21..e525a8cd9 100644 --- a/src/main/resources/assets/botania/lang/en_US.lang +++ b/src/main/resources/assets/botania/lang/en_US.lang @@ -950,7 +950,8 @@ botania.page.pool7=Infusing &1Mana Cookies&0, pretty good food. # -- SPARKS botania.entry.sparks=Sparks botania.page.sparks0=&1Sparks&0 are interesting entities. Created from a combination of raw energy and &4Mana&0, they have the ability to be placed on top of a few specific &4Mana&0 containing or accepting blocks, mainly, &1Mana Pools&0.
Some blocks have the ability to harness &4Mana&0 from &1Sparks&0, but the uses for them seem rather limited right now. -botania.page.sparks1=&oholds up spork&r +botania.page.sparks1=Placing a &1Spark&0 on top of a &1Mana Pool&0 and another on top of a block that can accept it will allow for the latter to remotely access the reservoirs of the &1Mana Pool&0 when needed, given it's not too far away.
To remove a &1Spark&0 simply shift-right click it with a &1Wand of the Forest&0. Regular right clicking shows which other &1Sparks&0 it can transfer to. +botania.page.sparks2=&oholds up spork&r # -- SPARK AUGMENTATION botania.entry.sparkUpgrades=Spark Agumentation