mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 02:45:13 +00:00
Luminizers now synergize with Ender Pearls.
This commit is contained in:
1 parent
dd7a9d56d7
commit
917a0aa229
1 file changed
+42
@@ -11,14 +11,18 @@
|
||||
package vazkii.botania.common.block.tile;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityEnderPearl;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
@@ -80,6 +84,17 @@ public class TileLightRelay extends TileMod implements IWandBindable {
|
||||
Botania.proxy.wispFX(worldObj, vecRot.x, vecRot.y, vecRot.z, 0.4F, 0.4F, 1F, 0.1F, (float) -vecMag.x, (float) -vecMag.y, (float) -vecMag.z, 1F);
|
||||
vecTip.add(vecMag);
|
||||
}
|
||||
|
||||
ChunkCoordinates endpoint = getEndpoint();
|
||||
if(endpoint != null && !worldObj.isRemote) {
|
||||
float range = 0.5F;
|
||||
List<EntityEnderPearl> enderPearls = worldObj.getEntitiesWithinAABB(EntityEnderPearl.class, AxisAlignedBB.getBoundingBox(xCoord - range, yCoord - range, zCoord - range, xCoord + 1 + range, yCoord + 1 + range, zCoord + 1 + range));
|
||||
for(EntityEnderPearl pearl : enderPearls) {
|
||||
pearl.posX = endpoint.posX + pearl.posX - xCoord;
|
||||
pearl.posY = endpoint.posY + pearl.posY - yCoord;
|
||||
pearl.posZ = endpoint.posZ + pearl.posZ - zCoord;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +102,33 @@ public class TileLightRelay extends TileMod implements IWandBindable {
|
||||
Block block = worldObj.getBlock(bindX, bindY, bindZ);
|
||||
return block == ModBlocks.lightRelay;
|
||||
}
|
||||
|
||||
public ChunkCoordinates getEndpoint() {
|
||||
List<TileLightRelay> pointsPassed = new ArrayList();
|
||||
TileLightRelay relay = this;
|
||||
ChunkCoordinates lastCoords = null;
|
||||
|
||||
// Doing while(true) gives an unreachable code error
|
||||
boolean run = true;
|
||||
while(run) {
|
||||
if(pointsPassed.contains(relay))
|
||||
return null; // Circular path
|
||||
pointsPassed.add(relay);
|
||||
|
||||
ChunkCoordinates coords = relay.getBinding();
|
||||
if(coords == null)
|
||||
return lastCoords;
|
||||
|
||||
TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ);
|
||||
if(tile != null && tile instanceof TileLightRelay)
|
||||
relay = (TileLightRelay) tile;
|
||||
else return lastCoords;
|
||||
|
||||
lastCoords = coords;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Vector3 getMovementVector() {
|
||||
return new Vector3(bindX - xCoord, bindY - yCoord, bindZ - zCoord);
|
||||
|
||||
Reference in new issue
Block a user