mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 03:39:17 +00:00
The great binding redo!
Changes: - Flowers no longer rebind to the closest spreader if the one they were bound to stops existing. - Added an indicator to the generating and functional flower HUDs that shows if they're properly bound or not. - Added the Floral Obedience Stick, a way to mass bind flowers, since that's more relevant now.
This commit is contained in:
1 parent
978a25328f
commit
3a078edafe
17 files changed
+243
-63
No files matched your search
@@ -32,6 +32,7 @@ import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
|
||||
public class DummyMethodHandler implements IInternalMethodHandler {
|
||||
|
||||
@@ -148,7 +149,17 @@ public class DummyMethodHandler implements IInternalMethodHandler {
|
||||
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawComplexManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res, ItemStack bindDisplay, boolean properlyBound) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getBindDisplayForFlowerType(SubTileEntity e) {
|
||||
return new ItemStack(Blocks.stone, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderLexiconText(int x, int y, int width, int height, String unlocalizedText) {
|
||||
// NO-OP
|
||||
|
||||
@@ -31,6 +31,7 @@ import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -96,6 +97,12 @@ public interface IInternalMethodHandler {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawComplexManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res, ItemStack bindDisplay, boolean properlyBound);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack getBindDisplayForFlowerType(SubTileEntity e);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderLexiconText(int x, int y, int width, int height, String unlocalizedText);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@API(owner = "Botania", apiVersion = "56", provides = "BotaniaAPI")
|
||||
@API(owner = "Botania", apiVersion = "57", provides = "BotaniaAPI")
|
||||
package vazkii.botania.api;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -23,6 +23,7 @@ import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.internal.IManaNetwork;
|
||||
import vazkii.botania.api.mana.IManaCollector;
|
||||
import vazkii.botania.api.mana.IManaPool;
|
||||
|
||||
/**
|
||||
@@ -30,6 +31,8 @@ import vazkii.botania.api.mana.IManaPool;
|
||||
*/
|
||||
public class SubTileFunctional extends SubTileEntity {
|
||||
|
||||
public static final int RANGE = 10;
|
||||
|
||||
private static final String TAG_MANA = "mana";
|
||||
|
||||
private static final String TAG_POOL_X = "poolX";
|
||||
@@ -85,8 +88,6 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
}
|
||||
|
||||
public void linkPool() {
|
||||
final int range = 10;
|
||||
|
||||
boolean needsNew = false;
|
||||
if(linkedPool == null) {
|
||||
needsNew = true;
|
||||
@@ -103,31 +104,26 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
cachedPoolCoordinates = null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
TileEntity tileAt = supertile.getWorldObj().getTileEntity(linkedPool.xCoord, linkedPool.yCoord, linkedPool.zCoord);
|
||||
if(tileAt != null && tileAt instanceof IManaPool)
|
||||
linkedPool = tileAt;
|
||||
}
|
||||
|
||||
if(!needsNew && linkedPool != null) {
|
||||
if(supertile.getWorldObj().blockExists(linkedPool.xCoord, linkedPool.yCoord, linkedPool.zCoord) && !linkedPool.isInvalid()) {
|
||||
TileEntity tileAt = supertile.getWorldObj().getTileEntity(linkedPool.xCoord, linkedPool.yCoord, linkedPool.zCoord);
|
||||
if(!(tileAt instanceof IManaPool) || tileAt.isInvalid()) {
|
||||
linkedPool = null;
|
||||
needsNew = true;
|
||||
} else linkedPool = tileAt;
|
||||
} else {
|
||||
cachedPoolCoordinates = new ChunkCoordinates(linkedPool.xCoord, linkedPool.yCoord, linkedPool.zCoord);
|
||||
linkedPool = null;
|
||||
}
|
||||
}
|
||||
|
||||
if(needsNew) {
|
||||
if(needsNew && ticksExisted == 1) { // Only for new flowers
|
||||
IManaNetwork network = BotaniaAPI.internalHandler.getManaNetworkInstance();
|
||||
int size = network.getAllPoolsInWorld(supertile.getWorldObj()).size();
|
||||
if(BotaniaAPI.internalHandler.shouldForceCheck() || size != sizeLastCheck) {
|
||||
ChunkCoordinates coords = new ChunkCoordinates(supertile.xCoord, supertile.yCoord, supertile.zCoord);
|
||||
linkedPool = network.getClosestPool(coords, supertile.getWorldObj(), range);
|
||||
linkedPool = network.getClosestPool(coords, supertile.getWorldObj(), RANGE);
|
||||
sizeLastCheck = size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void linkToForcefully(TileEntity pool) {
|
||||
linkedPool = pool;
|
||||
}
|
||||
|
||||
public void addMana(int mana) {
|
||||
this.mana = Math.min(getMaxMana(), this.mana + mana);
|
||||
@@ -210,12 +206,16 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isValidBinding() {
|
||||
return linkedPool != null && !linkedPool.isInvalid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res) {
|
||||
String name = StatCollector.translateToLocal("tile.botania:flower." + getUnlocalizedName() + ".name");
|
||||
int color = getColor();
|
||||
BotaniaAPI.internalHandler.drawSimpleManaHUD(color, knownMana, getMaxMana(), name, res);
|
||||
BotaniaAPI.internalHandler.drawComplexManaHUD(color, knownMana, getMaxMana(), name, res, BotaniaAPI.internalHandler.getBindDisplayForFlowerType(this), isValidBinding());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,6 +30,8 @@ import vazkii.botania.api.mana.IManaCollector;
|
||||
*/
|
||||
public class SubTileGenerating extends SubTileEntity {
|
||||
|
||||
public static final int RANGE = 6;
|
||||
|
||||
private static final String TAG_MANA = "mana";
|
||||
|
||||
private static final String TAG_COLLECTOR_X = "collectorX";
|
||||
@@ -78,8 +80,6 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
}
|
||||
|
||||
public void linkCollector() {
|
||||
final int range = 6;
|
||||
|
||||
boolean needsNew = false;
|
||||
if(linkedCollector == null) {
|
||||
needsNew = true;
|
||||
@@ -96,31 +96,26 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
cachedCollectorCoordinates = null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
TileEntity tileAt = supertile.getWorldObj().getTileEntity(linkedCollector.xCoord, linkedCollector.yCoord, linkedCollector.zCoord);
|
||||
if(tileAt != null && tileAt instanceof IManaCollector)
|
||||
linkedCollector = tileAt;
|
||||
}
|
||||
|
||||
if(!needsNew && linkedCollector != null) {
|
||||
if(supertile.getWorldObj().blockExists(linkedCollector.xCoord, linkedCollector.yCoord, linkedCollector.zCoord) && !linkedCollector.isInvalid()) {
|
||||
TileEntity tileAt = supertile.getWorldObj().getTileEntity(linkedCollector.xCoord, linkedCollector.yCoord, linkedCollector.zCoord);
|
||||
if(!(tileAt instanceof IManaCollector) || tileAt.isInvalid()) {
|
||||
linkedCollector = null;
|
||||
needsNew = true;
|
||||
} else linkedCollector = tileAt;
|
||||
} else {
|
||||
cachedCollectorCoordinates = new ChunkCoordinates(linkedCollector.xCoord, linkedCollector.yCoord, linkedCollector.zCoord);
|
||||
linkedCollector = null;
|
||||
}
|
||||
}
|
||||
|
||||
if(needsNew) {
|
||||
if(needsNew && ticksExisted == 1) { // New flowers only
|
||||
IManaNetwork network = BotaniaAPI.internalHandler.getManaNetworkInstance();
|
||||
int size = network.getAllCollectorsInWorld(supertile.getWorldObj()).size();
|
||||
if(BotaniaAPI.internalHandler.shouldForceCheck() || size != sizeLastCheck) {
|
||||
ChunkCoordinates coords = new ChunkCoordinates(supertile.xCoord, supertile.yCoord, supertile.zCoord);
|
||||
linkedCollector = network.getClosestCollector(coords, supertile.getWorldObj(), range);
|
||||
linkedCollector = network.getClosestCollector(coords, supertile.getWorldObj(), RANGE);
|
||||
sizeLastCheck = size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void linkToForcefully(TileEntity collector) {
|
||||
linkedCollector = collector;
|
||||
}
|
||||
|
||||
public void addMana(int mana) {
|
||||
this.mana = Math.min(getMaxMana(), this.mana + mana);
|
||||
@@ -239,11 +234,16 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public boolean isValidBinding() {
|
||||
return linkedCollector != null && !linkedCollector.isInvalid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res) {
|
||||
String name = StatCollector.translateToLocal("tile.botania:flower." + getUnlocalizedName() + ".name");
|
||||
int color = getColor();
|
||||
BotaniaAPI.internalHandler.drawSimpleManaHUD(color, knownMana, getMaxMana(), name, res);
|
||||
BotaniaAPI.internalHandler.drawComplexManaHUD(color, knownMana, getMaxMana(), name, res, BotaniaAPI.internalHandler.getBindDisplayForFlowerType(this), isValidBinding());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -394,6 +394,30 @@ public final class HUDHandler {
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
public static void drawComplexManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res, ItemStack bindDisplay, boolean properlyBound) {
|
||||
drawSimpleManaHUD(color, mana, maxMana, name, res);
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
int x = res.getScaledWidth() / 2 + 55;
|
||||
int y = res.getScaledHeight() / 2 + 12;
|
||||
|
||||
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, bindDisplay, x, y);
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
if(properlyBound) {
|
||||
mc.fontRenderer.drawStringWithShadow("\u2714", x + 10, y + 9, 0x004C00);
|
||||
mc.fontRenderer.drawStringWithShadow("\u2714", x + 10, y + 8, 0x0BD20D);
|
||||
} else {
|
||||
mc.fontRenderer.drawStringWithShadow("\u2718", x + 10, y + 9, 0x4C0000);
|
||||
mc.fontRenderer.drawStringWithShadow("\u2718", x + 10, y + 8, 0xD2080D);
|
||||
}
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
public static void renderManaBar(int x, int y, int color, float alpha, int mana, int maxMana) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
@@ -67,6 +67,7 @@ public final class BotaniaCreativeTab extends CreativeTabs {
|
||||
addItem(ModItems.grassSeeds);
|
||||
addItem(ModItems.blackLotus);
|
||||
addItem(ModItems.twigWand);
|
||||
addItem(ModItems.obedienceStick);
|
||||
addItem(ModItems.manaResource);
|
||||
addBlock(ModBlocks.storage);
|
||||
addItem(ModItems.manaCookie);
|
||||
|
||||
@@ -35,6 +35,9 @@ import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
import vazkii.botania.api.subtile.SubTileFunctional;
|
||||
import vazkii.botania.api.subtile.SubTileGenerating;
|
||||
import vazkii.botania.client.core.handler.BossBarHandler;
|
||||
import vazkii.botania.client.core.handler.HUDHandler;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
@@ -42,6 +45,7 @@ import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.BlockModFlower;
|
||||
import vazkii.botania.common.block.BlockSpecialFlower;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
import vazkii.botania.common.item.relic.ItemLokiRing;
|
||||
import vazkii.botania.common.lexicon.page.PageBrew;
|
||||
@@ -179,6 +183,16 @@ public class InternalMethodHandler extends DummyMethodHandler {
|
||||
HUDHandler.drawSimpleManaHUD(color, mana, maxMana, name, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawComplexManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res, ItemStack bindDisplay, boolean properlyBound) {
|
||||
HUDHandler.drawComplexManaHUD(color, mana, maxMana, name, res, bindDisplay, properlyBound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getBindDisplayForFlowerType(SubTileEntity e) {
|
||||
return e instanceof SubTileGenerating ? new ItemStack(ModBlocks.spreader) : e instanceof SubTileFunctional ? new ItemStack(ModBlocks.pool) : new ItemStack(ModItems.twigWand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderLexiconText(int x, int y, int width, int height, String unlocalizedText) {
|
||||
PageText.renderText(x, y, width, height, unlocalizedText);
|
||||
|
||||
@@ -270,6 +270,7 @@ public final class ModCraftingRecipes {
|
||||
public static IRecipe recipeLuminizer;
|
||||
public static IRecipe recipeDetectorLuminizer;
|
||||
public static IRecipe recipeLuminizerLauncher;
|
||||
public static IRecipe recipeObedienceStick;
|
||||
|
||||
// Garden of Glass
|
||||
public static IRecipe recipeRootToSapling;
|
||||
@@ -1828,6 +1829,13 @@ public final class ModCraftingRecipes {
|
||||
'L', new ItemStack(ModBlocks.lightRelay));
|
||||
recipeLuminizerLauncher = BotaniaAPI.getLatestAddedRecipe();
|
||||
|
||||
// Floral Obedience Stick Recipe
|
||||
addOreDictRecipe(new ItemStack(ModItems.obedienceStick),
|
||||
" M", " T ", "T ",
|
||||
'M', LibOreDict.MANA_STEEL,
|
||||
'T', LibOreDict.LIVINGWOOD_TWIG);
|
||||
recipeObedienceStick = BotaniaAPI.getLatestAddedRecipe();
|
||||
|
||||
// Storage Block/Nugget Recipes
|
||||
addOreDictRecipe(new ItemStack(ModBlocks.storage, 1, 0),
|
||||
"III", "III", "III",
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Jul 20, 2015, 7:26:14 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.item;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.mana.IManaCollector;
|
||||
import vazkii.botania.api.mana.IManaPool;
|
||||
import vazkii.botania.api.subtile.ISubTileContainer;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
import vazkii.botania.api.subtile.SubTileFunctional;
|
||||
import vazkii.botania.api.subtile.SubTileGenerating;
|
||||
import vazkii.botania.common.core.helper.MathHelper;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
public class ItemObedienceStick extends ItemMod {
|
||||
|
||||
public ItemObedienceStick() {
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(LibItemNames.OBEDIENCE_STICK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int s, float xs, float ys, float zs) {
|
||||
TileEntity tileAt = world.getTileEntity(x, y, z);
|
||||
if(tileAt != null && (tileAt instanceof IManaPool || tileAt instanceof IManaCollector)) {
|
||||
boolean pool = tileAt instanceof IManaPool;
|
||||
Actuator act = pool ? Actuator.functionalActuator : Actuator.generatingActuator;
|
||||
int range = pool ? SubTileFunctional.RANGE : SubTileGenerating.RANGE;
|
||||
|
||||
for(int i = -range; i < range + 1; i++)
|
||||
for(int j = -range; j < range + 1; j++)
|
||||
for(int k = -range; k < range + 1; k++) {
|
||||
int xp = x + i;
|
||||
int yp = y + j;
|
||||
int zp = z + k;
|
||||
if(MathHelper.pointDistanceSpace(xp, yp, zp, x, y, z) > range)
|
||||
continue;
|
||||
|
||||
TileEntity tile = world.getTileEntity(xp, yp, zp);
|
||||
if(tile instanceof ISubTileContainer) {
|
||||
SubTileEntity subtile = ((ISubTileContainer) tile).getSubTile();
|
||||
if(act.actuate(subtile, tileAt)) {
|
||||
Vector3 orig = new Vector3(xp + 0.5, yp + 0.5, zp + 0.5);
|
||||
Vector3 end = new Vector3(x + 0.5, y + 0.5, z + 0.5);
|
||||
ItemTwigWand.doParticleBeam(world, orig, end);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static abstract class Actuator {
|
||||
public static final Actuator generatingActuator = new Actuator() {
|
||||
|
||||
@Override
|
||||
public boolean actuate(SubTileEntity flower, TileEntity tile) {
|
||||
if(flower instanceof SubTileGenerating) {
|
||||
((SubTileGenerating) flower).linkToForcefully(tile);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public static final Actuator functionalActuator = new Actuator() {
|
||||
|
||||
@Override
|
||||
public boolean actuate(SubTileEntity flower, TileEntity tile) {
|
||||
if(flower instanceof SubTileFunctional) {
|
||||
((SubTileFunctional) flower).linkToForcefully(tile);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public abstract boolean actuate(SubTileEntity flower, TileEntity tile);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -71,29 +71,9 @@ public class ItemTwigWand extends Item16Colors implements ICoordBoundItem {
|
||||
TileEntity tile = par3World.getTileEntity(boundTile.posX, boundTile.posY, boundTile.posZ);
|
||||
if(tile instanceof IWandBindable) {
|
||||
if(((IWandBindable) tile).bindTo(par2EntityPlayer, par1ItemStack, par4, par5, par6, par7)) {
|
||||
if(par3World.isRemote) {
|
||||
Vector3 orig = new Vector3(boundTile.posX + 0.5, boundTile.posY + 0.5, boundTile.posZ + 0.5);
|
||||
Vector3 end = new Vector3(par4 + 0.5, par5 + 0.5, par6 + 0.5);
|
||||
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 = color.getRed() / 255F;
|
||||
float g = color.getGreen() / 255F;
|
||||
float b = color.getBlue() / 255F;
|
||||
|
||||
Botania.proxy.setSparkleFXNoClip(true);
|
||||
Botania.proxy.sparkleFX(par3World, currentPos.x, currentPos.y, currentPos.z, r, g, b, 0.5F, 4);
|
||||
Botania.proxy.setSparkleFXNoClip(false);
|
||||
currentPos.add(movement);
|
||||
}
|
||||
}
|
||||
Vector3 orig = new Vector3(boundTile.posX + 0.5, boundTile.posY + 0.5, boundTile.posZ + 0.5);
|
||||
Vector3 end = new Vector3(par4 + 0.5, par5 + 0.5, par6 + 0.5);
|
||||
doParticleBeam(par3World, orig, end);
|
||||
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(par3World, boundTile.posX, boundTile.posY, boundTile.posZ);
|
||||
setBoundTile(par1ItemStack, 0, -1, 0);
|
||||
@@ -166,6 +146,31 @@ public class ItemTwigWand extends Item16Colors implements ICoordBoundItem {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void doParticleBeam(World world, Vector3 orig, Vector3 end) {
|
||||
if(!world.isRemote)
|
||||
return;
|
||||
|
||||
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 = color.getRed() / 255F;
|
||||
float g = color.getGreen() / 255F;
|
||||
float b = color.getBlue() / 255F;
|
||||
|
||||
Botania.proxy.setSparkleFXNoClip(true);
|
||||
Botania.proxy.sparkleFX(world, currentPos.x, currentPos.y, currentPos.z, r, g, b, 0.5F, 4);
|
||||
Botania.proxy.setSparkleFXNoClip(false);
|
||||
currentPos.add(movement);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) {
|
||||
|
||||
@@ -244,6 +244,7 @@ public final class ModItems {
|
||||
public static Item incenseStick;
|
||||
public static Item terraAxe;
|
||||
public static Item waterBowl;
|
||||
public static Item obedienceStick;
|
||||
|
||||
public static void init() {
|
||||
lexicon = new ItemLexicon();
|
||||
@@ -378,6 +379,7 @@ public final class ModItems {
|
||||
incenseStick = new ItemIncenseStick();
|
||||
terraAxe = new ItemTerraAxe();
|
||||
waterBowl = new ItemWaterBowl();
|
||||
obedienceStick = new ItemObedienceStick();
|
||||
|
||||
OreDictionary.registerOre(LibOreDict.LEXICON, lexicon);
|
||||
for(int i = 0; i < 16; i++) {
|
||||
|
||||
@@ -191,6 +191,7 @@ public final class LexiconData {
|
||||
public static LexiconEntry crystalBow;
|
||||
public static LexiconEntry temperanceStone;
|
||||
public static LexiconEntry terraAxe;
|
||||
public static LexiconEntry obedienceStick;
|
||||
|
||||
public static LexiconEntry enderAir;
|
||||
public static LexiconEntry enderEyeBlock;
|
||||
@@ -731,6 +732,9 @@ public final class LexiconData {
|
||||
terraAxe = new BLexiconEntry(LibLexicon.TOOL_TERRA_AXE, categoryTools);
|
||||
terraAxe.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeTerraAxe));
|
||||
|
||||
obedienceStick = new BLexiconEntry(LibLexicon.TOOL_OBEDIENCE_STICK, categoryTools);
|
||||
obedienceStick.setPriority().setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeObedienceStick));
|
||||
|
||||
// ENDER ENTRIES
|
||||
enderAir = new BLexiconEntry(LibLexicon.ENDER_AIR, categoryEnder);
|
||||
enderAir.setPriority().setLexiconPages(new PageText("0"));
|
||||
|
||||
@@ -145,7 +145,8 @@ public final class LibItemNames {
|
||||
public static final String INCENSE_STICK = "incenseStick";
|
||||
public static final String TERRA_AXE = "terraAxe";
|
||||
public static final String WATER_BOWL = "waterBowl";
|
||||
|
||||
public static final String OBEDIENCE_STICK = "obedienceStick";
|
||||
|
||||
public static final String[] LENS_NAMES = new String[] {
|
||||
"lensNormal",
|
||||
"lensSpeed",
|
||||
|
||||
@@ -161,6 +161,7 @@ public final class LibLexicon {
|
||||
public static final String TOOL_CRYSTAL_BOW = "crystalBow";
|
||||
public static final String TOOL_TEMPERANCE_STONE = "temperanceStone";
|
||||
public static final String TOOL_TERRA_AXE = "terraAxe";
|
||||
public static final String TOOL_OBEDIENCE_STICK = "obedienceStick";
|
||||
|
||||
public static final String ENDER_AIR = "enderAir";
|
||||
public static final String ENDER_ENDER_EYE_BLOCK = "enderEyeBlock";
|
||||
|
||||
Reference in new issue
Block a user