From 425e60f16c9f6c864fcb0aa8ff69fa79d10db151 Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Tue, 22 Jul 2014 14:39:32 +0100 Subject: [PATCH] Tiny Planet fixes. --- .../botania/api/mana/ITinyPlanetExcempt.java | 24 +++++++++++++++++++ .../common/entity/EntityManaBurst.java | 3 +++ .../botania/common/item/ItemLaputaShard.java | 8 ++++++- .../item/equipment/bauble/ItemTinyPlanet.java | 7 +++++- 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 MODSRC/vazkii/botania/api/mana/ITinyPlanetExcempt.java diff --git a/MODSRC/vazkii/botania/api/mana/ITinyPlanetExcempt.java b/MODSRC/vazkii/botania/api/mana/ITinyPlanetExcempt.java new file mode 100644 index 000000000..56570e1e8 --- /dev/null +++ b/MODSRC/vazkii/botania/api/mana/ITinyPlanetExcempt.java @@ -0,0 +1,24 @@ +/** + * This class was created by . 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 a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jul 22, 2014, 2:26:14 PM (GMT)] + */ +package vazkii.botania.api.mana; + +import net.minecraft.item.ItemStack; + +/** + * Any Item that implements ILensEffect and this will have + * a check before being pulled by the Tiny Planet. + */ +public interface ITinyPlanetExcempt { + + public boolean shouldPull(ItemStack stack); + +} diff --git a/MODSRC/vazkii/botania/common/entity/EntityManaBurst.java b/MODSRC/vazkii/botania/common/entity/EntityManaBurst.java index 1be2daaeb..7a3a32e30 100644 --- a/MODSRC/vazkii/botania/common/entity/EntityManaBurst.java +++ b/MODSRC/vazkii/botania/common/entity/EntityManaBurst.java @@ -44,6 +44,7 @@ import vazkii.botania.common.Botania; import vazkii.botania.common.block.tile.mana.TileSpreader; import vazkii.botania.common.core.handler.ConfigHandler; import vazkii.botania.common.core.helper.Vector3; +import vazkii.botania.common.item.equipment.bauble.ItemTinyPlanet; public class EntityManaBurst extends EntityThrowable implements IManaBurst { @@ -521,6 +522,8 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst { currentPos = Vector3.fromEntity(this); diffVec = oldPos.copy().sub(currentPos); + if(getEntityData().hasKey(ItemTinyPlanet.TAG_ORBIT)) + break; } while(Math.abs(diffVec.mag()) > distance); Botania.proxy.wispFX(worldObj, posX, posY, posZ, r, g, b, 0.1F * size, (float) (Math.random() - 0.5F) * 0.06F, (float) (Math.random() - 0.5F) * 0.06F, (float) (Math.random() - 0.5F) * 0.06F); diff --git a/MODSRC/vazkii/botania/common/item/ItemLaputaShard.java b/MODSRC/vazkii/botania/common/item/ItemLaputaShard.java index 2f41b39eb..f8ba0263d 100644 --- a/MODSRC/vazkii/botania/common/item/ItemLaputaShard.java +++ b/MODSRC/vazkii/botania/common/item/ItemLaputaShard.java @@ -23,12 +23,13 @@ import net.minecraft.world.World; import vazkii.botania.api.internal.IManaBurst; import vazkii.botania.api.mana.BurstProperties; import vazkii.botania.api.mana.ILensEffect; +import vazkii.botania.api.mana.ITinyPlanetExcempt; import vazkii.botania.common.core.helper.ItemNBTHelper; import vazkii.botania.common.core.helper.MathHelper; import vazkii.botania.common.entity.EntityManaBurst; import vazkii.botania.common.lib.LibItemNames; -public class ItemLaputaShard extends ItemMod implements ILensEffect { +public class ItemLaputaShard extends ItemMod implements ILensEffect, ITinyPlanetExcempt { private static final String TAG_BLOCK = "_block"; private static final String TAG_META = "_meta"; @@ -187,4 +188,9 @@ public class ItemLaputaShard extends ItemMod implements ILensEffect { return true; } + @Override + public boolean shouldPull(ItemStack stack) { + return false; + } + } diff --git a/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemTinyPlanet.java b/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemTinyPlanet.java index 55eb5efec..534f46994 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemTinyPlanet.java +++ b/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemTinyPlanet.java @@ -20,13 +20,14 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import vazkii.botania.api.internal.IManaBurst; +import vazkii.botania.api.mana.ITinyPlanetExcempt; import vazkii.botania.common.core.helper.Vector3; import vazkii.botania.common.lib.LibItemNames; import baubles.api.BaubleType; public class ItemTinyPlanet extends ItemBauble { - private static final String TAG_ORBIT = "orbit"; + public static final String TAG_ORBIT = "orbit"; public ItemTinyPlanet() { super(LibItemNames.TINY_PLANET); @@ -55,6 +56,10 @@ public class ItemTinyPlanet extends ItemBauble { List entities = world.getEntitiesWithinAABB(IManaBurst.class, AxisAlignedBB.getBoundingBox(x - range, y - range, z - range, x + range, y + range, z + range)); for(Entity entity : entities) { IManaBurst burst = (IManaBurst) entity; + ItemStack lens = burst.getSourceLens(); + if(lens != null && lens.getItem() instanceof ITinyPlanetExcempt && !((ITinyPlanetExcempt) lens.getItem()).shouldPull(lens)) + continue; + int orbitTime = getEntityOrbitTime(entity); if(orbitTime == 0) burst.setMinManaLoss(burst.getMinManaLoss() * 3);