Tiny Planet fixes.

This commit is contained in:
Vasco Lavos committed 2014-07-22 14:39:32 +01:00
1 parent 298b3a9318
commit 425e60f16c
4 files changed
+40 -2

No files matched your search

@@ -0,0 +1,24 @@
/**
* 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 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);
}
@@ -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);
@@ -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;
}
}
@@ -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<Entity> 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);