diff --git a/src/main/java/vazkii/botania/api/mana/ILens.java b/src/main/java/vazkii/botania/api/mana/ILens.java
index f65ce6218..928f9c447 100644
--- a/src/main/java/vazkii/botania/api/mana/ILens.java
+++ b/src/main/java/vazkii/botania/api/mana/ILens.java
@@ -10,7 +10,9 @@
*/
package vazkii.botania.api.mana;
+import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.item.ItemStack;
+import vazkii.botania.api.internal.IManaBurst;
/**
* Have an Item implement this to be counted as a lens for the mana spreader.
diff --git a/src/main/java/vazkii/botania/api/mana/ILensEffect.java b/src/main/java/vazkii/botania/api/mana/ILensEffect.java
index 875524aa6..cf08fd6e2 100644
--- a/src/main/java/vazkii/botania/api/mana/ILensEffect.java
+++ b/src/main/java/vazkii/botania/api/mana/ILensEffect.java
@@ -10,6 +10,7 @@
*/
package vazkii.botania.api.mana;
+import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.RayTraceResult;
import vazkii.botania.api.internal.IManaBurst;
@@ -45,4 +46,11 @@ public interface ILensEffect {
*/
public boolean doParticles(IManaBurst burst, ItemStack stack);
+ /**
+ * Gets the amount of mana to transfer to the passed in mana receiver block.
+ */
+ public default int getManaToTransfer(IManaBurst burst, EntityThrowable entity, ItemStack stack, IManaReceiver receiver) {
+ return burst.getMana();
+ }
+
}
diff --git a/src/main/java/vazkii/botania/api/package-info.java b/src/main/java/vazkii/botania/api/package-info.java
index 8763114bb..81354baf9 100644
--- a/src/main/java/vazkii/botania/api/package-info.java
+++ b/src/main/java/vazkii/botania/api/package-info.java
@@ -1,4 +1,4 @@
-@API(owner = "Botania", apiVersion = "84", provides = "BotaniaAPI")
+@API(owner = "Botania", apiVersion = "85", provides = "BotaniaAPI")
package vazkii.botania.api;
import net.minecraftforge.fml.common.API;
diff --git a/src/main/java/vazkii/botania/common/entity/EntityManaBurst.java b/src/main/java/vazkii/botania/common/entity/EntityManaBurst.java
index e1d5ac3f5..b98227293 100644
--- a/src/main/java/vazkii/botania/common/entity/EntityManaBurst.java
+++ b/src/main/java/vazkii/botania/common/entity/EntityManaBurst.java
@@ -591,11 +591,19 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
}
private void onRecieverImpact(IManaReceiver tile, BlockPos pos) {
+ ILensEffect lens = getLensInstance();
int mana = getMana();
+
+ if(lens != null) {
+ ItemStack stack = getSourceLens();
+ mana = lens.getManaToTransfer(this, this, stack, tile);
+ }
+
if(tile instanceof IManaCollector)
mana *= ((IManaCollector) tile).getManaYieldMultiplier(this);
tile.recieveMana(mana);
+
if(tile instanceof IThrottledPacket)
((IThrottledPacket) tile).markDispatchable();
else VanillaPacketDispatcher.dispatchTEToNearbyPlayers(worldObj, pos);
diff --git a/src/main/java/vazkii/botania/common/item/lens/ItemLens.java b/src/main/java/vazkii/botania/common/item/lens/ItemLens.java
index f6f060b63..8b05aac5b 100644
--- a/src/main/java/vazkii/botania/common/item/lens/ItemLens.java
+++ b/src/main/java/vazkii/botania/common/item/lens/ItemLens.java
@@ -34,6 +34,7 @@ import vazkii.botania.api.mana.BurstProperties;
import vazkii.botania.api.mana.ICompositableLens;
import vazkii.botania.api.mana.ILens;
import vazkii.botania.api.mana.ILensControl;
+import vazkii.botania.api.mana.IManaReceiver;
import vazkii.botania.api.mana.IManaSpreader;
import vazkii.botania.api.mana.ITinyPlanetExcempt;
import vazkii.botania.client.core.handler.ModelHandler;
@@ -310,6 +311,11 @@ public class ItemLens extends ItemMod implements ILensControl, ICompositableLens
return sourceLens;
}
+ @Override
+ public int getManaToTransfer(IManaBurst burst, EntityThrowable entity, ItemStack stack, IManaReceiver receiver) {
+ return lenses[stack.getItemDamage()].getManaToTransfer(burst, entity, stack, receiver);
+ }
+
@Override
public boolean shouldPull(ItemStack stack) {
return stack.getItemDamage() != STORM;
diff --git a/src/main/java/vazkii/botania/common/item/lens/Lens.java b/src/main/java/vazkii/botania/common/item/lens/Lens.java
index 6b72a0015..9898beded 100644
--- a/src/main/java/vazkii/botania/common/item/lens/Lens.java
+++ b/src/main/java/vazkii/botania/common/item/lens/Lens.java
@@ -15,6 +15,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.math.RayTraceResult;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.api.mana.BurstProperties;
+import vazkii.botania.api.mana.IManaBlock;
+import vazkii.botania.api.mana.IManaReceiver;
import vazkii.botania.api.mana.IManaSpreader;
public class Lens {
@@ -34,6 +36,9 @@ public class Lens {
public void onControlledSpreaderTick(ItemStack stack, IManaSpreader spreader, boolean redstone) {}
public void onControlledSpreaderPulse(ItemStack stack, IManaSpreader spreader, boolean redstone) {}
-
+
+ public int getManaToTransfer(IManaBurst burst, EntityThrowable entity, ItemStack stack, IManaReceiver receiver) {
+ return burst.getMana();
+ }
}
diff --git a/src/main/java/vazkii/botania/common/item/lens/LensWarp.java b/src/main/java/vazkii/botania/common/item/lens/LensWarp.java
index 5b880ebf5..c3b0a9594 100644
--- a/src/main/java/vazkii/botania/common/item/lens/LensWarp.java
+++ b/src/main/java/vazkii/botania/common/item/lens/LensWarp.java
@@ -15,16 +15,19 @@ import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.RayTraceResult;
import vazkii.botania.api.internal.IManaBurst;
+import vazkii.botania.api.mana.IManaReceiver;
import vazkii.botania.common.block.BlockPistonRelay;
import vazkii.botania.common.block.ModBlocks;
public class LensWarp extends Lens {
+ private static final String TAG_WARPED = "botania:warped";
+
@Override
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, RayTraceResult pos, boolean isManaBlock, boolean dead, ItemStack stack) {
if(burst.isFake() || pos.getBlockPos() == null)
return dead;
-
+
Block block = entity.worldObj.getBlockState(pos.getBlockPos()).getBlock();
if(block == ModBlocks.pistonRelay) {
BlockPistonRelay.DimWithPos key = ((BlockPistonRelay) ModBlocks.pistonRelay).mappedPositions.get(new BlockPistonRelay.DimWithPos(entity.worldObj.provider.getDimension(), pos.getBlockPos()));
@@ -32,11 +35,19 @@ public class LensWarp extends Lens {
if(key.dim == entity.worldObj.provider.getDimension()) {
entity.setPosition(key.blockPos.getX() + 0.5, key.blockPos.getY() + 0.5, key.blockPos.getZ() + 0.5);
burst.setCollidedAt(key.blockPos);
+
+ entity.getEntityData().setBoolean(TAG_WARPED, true);
+
return false;
}
}
}
return dead;
}
+
+ @Override
+ public int getManaToTransfer(IManaBurst burst, EntityThrowable entity, ItemStack stack, IManaReceiver receiver) {
+ return entity.getEntityData().getBoolean(TAG_WARPED) ? 0 : burst.getMana();
+ }
}
diff --git a/src/main/resources/assets/botania/lang/en_US.lang b/src/main/resources/assets/botania/lang/en_US.lang
index ae75ecd1e..d96870f71 100644
--- a/src/main/resources/assets/botania/lang/en_US.lang
+++ b/src/main/resources/assets/botania/lang/en_US.lang
@@ -3156,7 +3156,7 @@ botania.page.enderEyeBlock1=MY BRAND
botania.entry.pistonRelay=Force Relay
botania.tagline.pistonRelay=Remote piston extension
botania.page.pistonRelay0=It seems that infusing &1Pistons&0 with &4Mana&0 results in some interesting adverse effects.
This block tears the fabric of space, relaying any piston force applied to it to the block it's bound to.
To bind it to a block, right click it with a &1Wand of the Forest&0, and right click on the block you want to bind it to.
-botania.page.pistonRelay1=To break the block, shift-right click it with a &1Wand of the Forest&0, any other means will destroy it.
Furthermore, this block is highly unstable, and may create uncanny effects, care is to be taken. It is also resistant to glue, both in pulling and pushing. This allows for a "frame" like setup.
+botania.page.pistonRelay1=To break the block, shift-right click it with a &1Wand of the Forest&0, any other means will destroy it.
Furthermore, this block is highly unstable, and may create uncanny effects, care is to be taken. It also ignores &1Sticky Pistons&0, both in pulling and pushing. This allows for a "frame" like setup.
botania.page.pistonRelay2=Infusing a &1Piston&0 with &4Mana&0.
# -- HAND OF ENDER