generated from tilera/1710mod
feat: initial (completely borked) portal implementation
This commit is contained in:
parent
42320de0b0
commit
5a78c93c1d
|
@ -44,6 +44,7 @@ dependencies {
|
|||
implementation "thaumcraft:Thaumcraft:1.7.10-4.2.3.5:deobf"
|
||||
implementation "dev.tilera:auracore:1.0.0-SNAPSHOT:deobf"
|
||||
implementation "com.github.tox1cozZ:mixin-booter-legacy:1.1.2"
|
||||
implementation files("libs/LookingGlass-1.7.10-0.2.0.01-dev.jar")
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
|
BIN
libs/LookingGlass-1.7.10-0.2.0.01-dev.jar
Normal file
BIN
libs/LookingGlass-1.7.10-0.2.0.01-dev.jar
Normal file
Binary file not shown.
49
src/main/java/net/anvilcraft/arcaneseals/SealData.java
Normal file
49
src/main/java/net/anvilcraft/arcaneseals/SealData.java
Normal file
|
@ -0,0 +1,49 @@
|
|||
package net.anvilcraft.arcaneseals;
|
||||
|
||||
import net.anvilcraft.arcaneseals.tiles.TileSeal;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class SealData {
|
||||
public int dim;
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
public short orientation;
|
||||
public byte rune;
|
||||
|
||||
public SealData() {}
|
||||
|
||||
public SealData(TileSeal seal) {
|
||||
this.dim = seal.getWorldObj().provider.dimensionId;
|
||||
|
||||
this.x = seal.xCoord;
|
||||
this.y = seal.yCoord;
|
||||
this.z = seal.zCoord;
|
||||
|
||||
this.orientation = seal.orientation;
|
||||
|
||||
this.rune = seal.runes[2];
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNbt(NBTTagCompound nbt) {
|
||||
nbt.setInteger("dim", this.dim);
|
||||
nbt.setInteger("x", this.x);
|
||||
nbt.setInteger("y", this.y);
|
||||
nbt.setInteger("z", this.z);
|
||||
nbt.setShort("orientation", this.orientation);
|
||||
nbt.setByte("rune", this.rune);
|
||||
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public static SealData readFromNbt(NBTTagCompound nbt) {
|
||||
SealData self = new SealData();
|
||||
|
||||
self.dim = nbt.getInteger("dim");
|
||||
self.x = nbt.getInteger("x");
|
||||
self.y = nbt.getInteger("y");
|
||||
self.z = nbt.getInteger("z");
|
||||
|
||||
return self;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package net.anvilcraft.arcaneseals.render;
|
||||
|
||||
import com.xcompwiz.lookingglass.api.APIInstanceProvider;
|
||||
import com.xcompwiz.lookingglass.api.APIUndefined;
|
||||
import com.xcompwiz.lookingglass.api.APIVersionRemoved;
|
||||
import com.xcompwiz.lookingglass.api.APIVersionUndefined;
|
||||
import com.xcompwiz.lookingglass.api.hook.WorldViewAPI2;
|
||||
import com.xcompwiz.lookingglass.api.view.IWorldView;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import net.anvilcraft.arcaneseals.tiles.TileSeal;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
|
||||
public class PortalRenderer {
|
||||
static WorldViewAPI2 LG_API;
|
||||
public IWorldView ww;
|
||||
TileSeal thisSeal;
|
||||
TileSeal otherSeal;
|
||||
|
||||
public PortalRenderer(TileSeal thisSeal, TileSeal otherSeal) {
|
||||
this.thisSeal = thisSeal;
|
||||
this.otherSeal = otherSeal;
|
||||
|
||||
this.ww = LG_API.createWorldView(
|
||||
otherSeal.getWorldObj().provider.dimensionId,
|
||||
new ChunkCoordinates(otherSeal.xCoord, otherSeal.yCoord, otherSeal.zCoord),
|
||||
256,
|
||||
256
|
||||
);
|
||||
}
|
||||
|
||||
public void deinit() {
|
||||
LG_API.cleanupWorldView(this.ww);
|
||||
}
|
||||
|
||||
public static void initLookingGlass() {
|
||||
FMLInterModComms.sendMessage(
|
||||
"LookingGlass",
|
||||
"API",
|
||||
"net.anvilcraft.arcaneseals.render.PortalRenderer.lookingGlassInitCb"
|
||||
);
|
||||
}
|
||||
|
||||
public static void lookingGlassInitCb(APIInstanceProvider ip) {
|
||||
try {
|
||||
LG_API = (WorldViewAPI2) ip.getAPIInstance("view-2");
|
||||
} catch (APIUndefined | APIVersionUndefined | APIVersionRemoved e) {
|
||||
System.err.println("LookingGlass alec");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,14 +1,21 @@
|
|||
package net.anvilcraft.arcaneseals.tiles;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import dev.tilera.auracore.api.AuraNode;
|
||||
import dev.tilera.auracore.aura.AuraManager;
|
||||
import dev.tilera.auracore.client.FXSparkle;
|
||||
import dev.tilera.auracore.helper.Utils;
|
||||
import net.anvilcraft.arcaneseals.SealData;
|
||||
import net.anvilcraft.arcaneseals.utils.HelperLocation;
|
||||
import net.anvilcraft.arcaneseals.utils.UtilsFX;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IProjectile;
|
||||
|
@ -41,6 +48,9 @@ import thaumcraft.client.fx.particles.FXScorch;
|
|||
import thaumcraft.client.fx.particles.FXWisp;
|
||||
|
||||
public class TileSeal extends TileEntity {
|
||||
public static Set<SealData> SEALS = new HashSet<>();
|
||||
SealData otherSeal;
|
||||
|
||||
public int delay = 0;
|
||||
private int soundDelay = 0;
|
||||
public int portalWindow = 0;
|
||||
|
@ -178,28 +188,15 @@ public class TileSeal extends TileEntity {
|
|||
return;
|
||||
}
|
||||
case 1:
|
||||
// TODO: WTF
|
||||
//SISpecialTile current
|
||||
// = (SISpecialTile) mod_ThaumCraft.SpecialTileHM.get(Arrays.asList(
|
||||
// super.xCoord,
|
||||
// super.yCoord,
|
||||
// super.zCoord,
|
||||
// (byte) ModLoader.getMinecraftInstance().thePlayer.dimension,
|
||||
// 0
|
||||
// ));
|
||||
//if (current == null) {
|
||||
// SISpecialTile pd = new SISpecialTile(
|
||||
// super.xCoord,
|
||||
// super.yCoord,
|
||||
// super.zCoord,
|
||||
// this.runes[2],
|
||||
// (byte) ModLoader.getMinecraftInstance().thePlayer.dimension,
|
||||
// (byte) 0
|
||||
// );
|
||||
// mod_ThaumCraft.AddSpecialTileToList(pd);
|
||||
//}
|
||||
SealData sd = new SealData(this);
|
||||
if (!SEALS.contains(sd)) {
|
||||
SEALS.add(sd);
|
||||
this.worldObj.markBlockForUpdate(
|
||||
this.xCoord, this.yCoord, this.zCoord
|
||||
);
|
||||
}
|
||||
|
||||
//this.handlePortals();
|
||||
this.handlePortals();
|
||||
break;
|
||||
case 2:
|
||||
switch (this.runes[2]) {
|
||||
|
@ -389,7 +386,6 @@ public class TileSeal extends TileEntity {
|
|||
if (!(entity instanceof EntityPlayer)
|
||||
/*&& !(entity instanceof EntityTravelingTrunk)*/) {
|
||||
entity.attackEntityFrom(DamageSource.generic, 1);
|
||||
// TODO: server or client side?
|
||||
net.anvilcraft.arcaneseals.utils.UtilsFX.poof(
|
||||
super.worldObj,
|
||||
(float) entity.posX - 0.5F,
|
||||
|
@ -1493,100 +1489,88 @@ public class TileSeal extends TileEntity {
|
|||
//}
|
||||
}
|
||||
|
||||
// TODO: portals
|
||||
//private void handlePortals() {
|
||||
// List list = this.getEntitiesSorted(super.worldObj, 1, this.orientation, false);
|
||||
// boolean p = false;
|
||||
private void handlePortals() {
|
||||
List<Entity> list
|
||||
= this.getEntitiesSorted(super.worldObj, 1, this.orientation, false);
|
||||
boolean p = false;
|
||||
|
||||
// int q;
|
||||
// for (q = 0; q < list.size(); ++q) {
|
||||
// if (list.get(q) instanceof EntityPlayer) {
|
||||
// p = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
int q;
|
||||
for (q = 0; q < list.size(); ++q) {
|
||||
if (list.get(q) instanceof EntityPlayer) {
|
||||
p = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if (list.size() > 0) {
|
||||
// Collection pp = mod_ThaumCraft.SpecialTileHM.values();
|
||||
// boolean fs = false;
|
||||
// Iterator i$ = pp.iterator();
|
||||
if (list.size() > 0) {
|
||||
Iterator<SealData> i$ = SEALS.iterator();
|
||||
|
||||
// label74: {
|
||||
// SISpecialTile pd;
|
||||
// do {
|
||||
// do {
|
||||
// do {
|
||||
// do {
|
||||
// if (!i$.hasNext()) {
|
||||
// break label74;
|
||||
// }
|
||||
boolean fs = false;
|
||||
label74: {
|
||||
SealData pd;
|
||||
do {
|
||||
do {
|
||||
do {
|
||||
if (!i$.hasNext()) {
|
||||
break label74;
|
||||
}
|
||||
|
||||
// pd = (SISpecialTile) i$.next();
|
||||
// } while (pd.type != 0);
|
||||
// } while (pd.dimension
|
||||
// != ModLoader.getMinecraftInstance().thePlayer.dimension);
|
||||
// } while (pd.rune != this.runes[2]);
|
||||
// } while (pd.x == super.xCoord && pd.y == super.yCoord && pd.z ==
|
||||
// super.zCoord
|
||||
// );
|
||||
pd = i$.next();
|
||||
} while (pd.dim != list.get(0).worldObj.provider.dimensionId);
|
||||
} while (pd.rune != this.runes[2]);
|
||||
} while (pd.x == super.xCoord && pd.y == super.yCoord && pd.z == super.zCoord
|
||||
);
|
||||
|
||||
// if (!(super.worldObj.getBlockTileEntity(pd.x, pd.y, pd.z) instanceof
|
||||
// TileSeal
|
||||
// )) {
|
||||
// mod_ThaumCraft.DeleteSpecialTileFromList(pd);
|
||||
// this.portalWindow = 0;
|
||||
// } else {
|
||||
// if (!this.pOpen && p) {
|
||||
// super.worldObj.playSoundEffect(
|
||||
// (double) super.xCoord + 0.5,
|
||||
// (double) super.yCoord + 0.5,
|
||||
// (double) super.zCoord + 0.5,
|
||||
// "thaumcraft.popen",
|
||||
// 0.4F,
|
||||
// 1.0F + super.worldObj.rand.nextFloat() * 0.2F
|
||||
// );
|
||||
// }
|
||||
this.otherSeal = pd;
|
||||
|
||||
// if (this.pDelay <= 0 && p) {
|
||||
// this.renderTeleportDest();
|
||||
// this.pDelay = 3;
|
||||
// }
|
||||
if (!this.pOpen && p) {
|
||||
super.worldObj.playSoundEffect(
|
||||
(double) super.xCoord + 0.5,
|
||||
(double) super.yCoord + 0.5,
|
||||
(double) super.zCoord + 0.5,
|
||||
"thaumcraft:popen",
|
||||
0.4F,
|
||||
1.0F + super.worldObj.rand.nextFloat() * 0.2F
|
||||
);
|
||||
}
|
||||
|
||||
// --this.pDelay;
|
||||
// this.pOpen = true;
|
||||
// fs = true;
|
||||
// }
|
||||
// }
|
||||
if (this.delay <= 0 && p) {
|
||||
//this.renderTeleportDest();
|
||||
this.delay = 3;
|
||||
}
|
||||
|
||||
// if (!fs && this.pOpen) {
|
||||
// this.pOpen = false;
|
||||
// }
|
||||
// } else {
|
||||
// if (this.pOpen) {
|
||||
// list = ThaumCraftCore.getEntitiesSorted(
|
||||
// super.worldObj, this, 2, this.orientation, false
|
||||
// );
|
||||
--this.delay;
|
||||
this.pOpen = true;
|
||||
fs = true;
|
||||
}
|
||||
if (!fs && this.pOpen) {
|
||||
this.pOpen = false;
|
||||
}
|
||||
} else {
|
||||
this.otherSeal = null;
|
||||
if (this.pOpen) {
|
||||
list = this.getEntitiesSorted(super.worldObj, 2, this.orientation, false);
|
||||
|
||||
// for (q = 0; q < list.size(); ++q) {
|
||||
// if (list.get(q) instanceof EntityPlayer) {
|
||||
// super.worldObj.playSoundEffect(
|
||||
// (double) super.xCoord + 0.5,
|
||||
// (double) super.yCoord + 0.5,
|
||||
// (double) super.zCoord + 0.5,
|
||||
// "thaumcraft.pclose",
|
||||
// 0.4F,
|
||||
// 1.0F + super.worldObj.rand.nextFloat() * 0.2F
|
||||
// );
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
for (q = 0; q < list.size(); ++q) {
|
||||
if (list.get(q) instanceof EntityPlayer) {
|
||||
super.worldObj.playSoundEffect(
|
||||
(double) super.xCoord + 0.5,
|
||||
(double) super.yCoord + 0.5,
|
||||
(double) super.zCoord + 0.5,
|
||||
"thaumcraft:pclose",
|
||||
0.4F,
|
||||
1.0F + super.worldObj.rand.nextFloat() * 0.2F
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// this.pOpen = false;
|
||||
// }
|
||||
this.pOpen = false;
|
||||
}
|
||||
|
||||
// this.teleport();
|
||||
//}
|
||||
this.teleport();
|
||||
}
|
||||
|
||||
// TODO: implement portal rendering with looking glass
|
||||
//private void renderTeleportDest() {
|
||||
|
@ -1617,8 +1601,8 @@ public class TileSeal extends TileEntity {
|
|||
// ++count;
|
||||
// if (count >= this.portalWindow) {
|
||||
// skipped = false;
|
||||
// TileEntity ts = super.worldObj.getBlockTileEntity(pd.x, pd.y, pd.z);
|
||||
// if (ts != null && ts instanceof TileSeal) {
|
||||
// TileEntity ts = super.worldObj.getBlockTileEntity(pd.x, pd.y,
|
||||
// pd.z);Api if (ts != null && ts instanceof TileSeal) {
|
||||
// PortalRenderer.createPortalView(
|
||||
// this.txRender, this, (TileSeal) ts
|
||||
// );
|
||||
|
@ -1633,258 +1617,223 @@ public class TileSeal extends TileEntity {
|
|||
// }
|
||||
//}
|
||||
|
||||
// TODO: portals
|
||||
//public boolean teleport() {
|
||||
// if (this.delay > 0) {
|
||||
// return false;
|
||||
// } else {
|
||||
// List list = super.worldObj.getEntitiesWithinAABB(
|
||||
// Entity.class,
|
||||
// AxisAlignedBB.getBoundingBoxFromPool(
|
||||
// (double) super.xCoord,
|
||||
// (double) super.yCoord,
|
||||
// (double) super.zCoord,
|
||||
// (double) (super.xCoord + 1),
|
||||
// (double) (super.yCoord + 1),
|
||||
// (double) (super.zCoord + 1)
|
||||
// )
|
||||
// );
|
||||
// if (list.size() == 0) {
|
||||
// return false;
|
||||
// } else {
|
||||
// Entity entity = (Entity) list.get(0);
|
||||
// if (entity instanceof EntityFX) {
|
||||
// return false;
|
||||
// } else {
|
||||
// ArrayList rd = new ArrayList();
|
||||
// Collection p = mod_ThaumCraft.SpecialTileHM.values();
|
||||
// int count = -1;
|
||||
// Iterator i$ = p.iterator();
|
||||
public boolean teleport() {
|
||||
if (this.delay > 0) {
|
||||
return false;
|
||||
} else {
|
||||
List<Entity> list = super.worldObj.getEntitiesWithinAABB(
|
||||
Entity.class,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
(double) super.xCoord,
|
||||
(double) super.yCoord,
|
||||
(double) super.zCoord,
|
||||
(double) (super.xCoord + 1),
|
||||
(double) (super.yCoord + 1),
|
||||
(double) (super.zCoord + 1)
|
||||
)
|
||||
);
|
||||
if (list.size() == 0) {
|
||||
return false;
|
||||
} else {
|
||||
Entity entity = (Entity) list.get(0);
|
||||
if (entity instanceof EntityFX) {
|
||||
return false;
|
||||
} else {
|
||||
if (this.otherSeal == null) {
|
||||
return false;
|
||||
} else {
|
||||
SealData targetDest = this.otherSeal;
|
||||
TileEntity ts = super.worldObj.getTileEntity(
|
||||
targetDest.x, targetDest.y, targetDest.z
|
||||
);
|
||||
if (ts != null && ts instanceof TileSeal) {
|
||||
TileSeal target = (TileSeal) ts;
|
||||
if (target.runes[0] == 0 && target.runes[1] == 1) {
|
||||
target.delay = 40;
|
||||
float tYaw = entity.rotationYaw;
|
||||
switch (target.orientation) {
|
||||
case 2:
|
||||
tYaw = 180.0F;
|
||||
break;
|
||||
case 3:
|
||||
tYaw = 0.0F;
|
||||
break;
|
||||
case 4:
|
||||
tYaw = 90.0F;
|
||||
break;
|
||||
case 5:
|
||||
tYaw = 270.0F;
|
||||
}
|
||||
|
||||
// while (i$.hasNext()) {
|
||||
// SISpecialTile pd = (SISpecialTile) i$.next();
|
||||
// if (pd.type == 0
|
||||
// && pd.dimension
|
||||
// == ModLoader.getMinecraftInstance().thePlayer.dimension
|
||||
// && pd.rune == this.runes[2]
|
||||
// && (pd.x != super.xCoord || pd.y != super.yCoord
|
||||
// || pd.z != super.zCoord)) {
|
||||
// ++count;
|
||||
// if (count >= this.portalWindow) {
|
||||
// rd.add(pd);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
int diff = this.orientation - target.orientation;
|
||||
double t;
|
||||
if (diff == -3 || diff == 2
|
||||
|| diff == -1
|
||||
&& this.orientation + target.orientation != 5
|
||||
&& this.orientation + target.orientation != 9) {
|
||||
t = entity.motionX;
|
||||
entity.motionX = entity.motionZ;
|
||||
entity.motionZ = -t;
|
||||
if (entity.ridingEntity != null) {
|
||||
entity.ridingEntity.motionX
|
||||
= entity.ridingEntity.motionZ;
|
||||
entity.ridingEntity.motionZ = -t;
|
||||
}
|
||||
} else if (diff == -2 || diff == 3 || diff == 1 &&
|
||||
this.orientation + target.orientation != 5 &&
|
||||
this.orientation + target.orientation != 9) {
|
||||
t = entity.motionX;
|
||||
entity.motionX = -entity.motionZ;
|
||||
entity.motionZ = t;
|
||||
if (entity.ridingEntity != null) {
|
||||
entity.ridingEntity.motionX
|
||||
= -entity.ridingEntity.motionZ;
|
||||
entity.ridingEntity.motionZ = t;
|
||||
}
|
||||
} else if (diff == 0) {
|
||||
entity.motionX = -entity.motionX;
|
||||
entity.motionZ = -entity.motionZ;
|
||||
if (entity.ridingEntity != null) {
|
||||
entity.ridingEntity.motionX
|
||||
= -entity.ridingEntity.motionX;
|
||||
entity.ridingEntity.motionZ
|
||||
= -entity.ridingEntity.motionZ;
|
||||
}
|
||||
}
|
||||
|
||||
// if (rd.size() < 1) {
|
||||
// return false;
|
||||
// } else {
|
||||
// SISpecialTile targetDest = (SISpecialTile) rd.get(0);
|
||||
// if (targetDest == null) {
|
||||
// return false;
|
||||
// } else {
|
||||
// ThaumCraftCore.loadChunk(
|
||||
// super.worldObj, targetDest.x, targetDest.z
|
||||
// );
|
||||
// TileEntity ts = super.worldObj.getBlockTileEntity(
|
||||
// targetDest.x, targetDest.y, targetDest.z
|
||||
// );
|
||||
// if (ts != null && ts instanceof TileSeal) {
|
||||
// TileSeal target = (TileSeal) ts;
|
||||
// if (target.runes[0] == 0 && target.runes[1] == 1) {
|
||||
// target.delay = 40;
|
||||
// float tYaw = entity.rotationYaw;
|
||||
// switch (target.orientation) {
|
||||
// case 2:
|
||||
// tYaw = 180.0F;
|
||||
// break;
|
||||
// case 3:
|
||||
// tYaw = 0.0F;
|
||||
// break;
|
||||
// case 4:
|
||||
// tYaw = 90.0F;
|
||||
// break;
|
||||
// case 5:
|
||||
// tYaw = 270.0F;
|
||||
// }
|
||||
if (diff == 0
|
||||
&& (this.orientation == 1 || this.orientation == 0)) {
|
||||
entity.motionY = -entity.motionY;
|
||||
if (entity.ridingEntity != null) {
|
||||
entity.ridingEntity.motionY
|
||||
= -entity.ridingEntity.motionY;
|
||||
}
|
||||
}
|
||||
|
||||
// int diff = this.orientation - target.orientation;
|
||||
// double t;
|
||||
// if (diff == -3 || diff == 2
|
||||
// || diff == -1
|
||||
// && this.orientation + target.orientation !=
|
||||
// 5
|
||||
// && this.orientation + target.orientation
|
||||
// != 9) {
|
||||
// t = entity.motionX;
|
||||
// entity.motionX = entity.motionZ;
|
||||
// entity.motionZ = -t;
|
||||
// if (entity.ridingEntity != null) {
|
||||
// entity.ridingEntity.motionX
|
||||
// = entity.ridingEntity.motionZ;
|
||||
// entity.ridingEntity.motionZ = -t;
|
||||
// }
|
||||
// } else if (diff == -2 || diff == 3 || diff == 1 &&
|
||||
// this.orientation + target.orientation != 5 &&
|
||||
// this.orientation + target.orientation != 9) {
|
||||
// t = entity.motionX;
|
||||
// entity.motionX = -entity.motionZ;
|
||||
// entity.motionZ = t;
|
||||
// if (entity.ridingEntity != null) {
|
||||
// entity.ridingEntity.motionX
|
||||
// = -entity.ridingEntity.motionZ;
|
||||
// entity.ridingEntity.motionZ = t;
|
||||
// }
|
||||
// } else if (diff == 0) {
|
||||
// entity.motionX = -entity.motionX;
|
||||
// entity.motionZ = -entity.motionZ;
|
||||
// if (entity.ridingEntity != null) {
|
||||
// entity.ridingEntity.motionX
|
||||
// = -entity.ridingEntity.motionX;
|
||||
// entity.ridingEntity.motionZ
|
||||
// = -entity.ridingEntity.motionZ;
|
||||
// }
|
||||
// }
|
||||
UtilsFX.poof(
|
||||
super.worldObj,
|
||||
(float) entity.posX - 0.5F,
|
||||
(float) entity.posY - 0.5F,
|
||||
(float) entity.posZ - 0.5F
|
||||
);
|
||||
super.worldObj.playSoundEffect(
|
||||
entity.posX,
|
||||
entity.posY,
|
||||
entity.posZ,
|
||||
"mob.endermen.portal",
|
||||
1.0F,
|
||||
1.0F
|
||||
);
|
||||
int xm = 0;
|
||||
int zm = 0;
|
||||
int ym = 0;
|
||||
switch (target.orientation) {
|
||||
case 0:
|
||||
ym = -1;
|
||||
break;
|
||||
case 1:
|
||||
ym = 1;
|
||||
break;
|
||||
case 2:
|
||||
zm = -1;
|
||||
break;
|
||||
case 3:
|
||||
zm = 1;
|
||||
break;
|
||||
case 4:
|
||||
xm = -1;
|
||||
break;
|
||||
case 5:
|
||||
xm = 1;
|
||||
}
|
||||
|
||||
// if (diff == 0
|
||||
// && (this.orientation == 1 || this.orientation ==
|
||||
// 0
|
||||
// )) {
|
||||
// entity.motionY = -entity.motionY;
|
||||
// if (entity.ridingEntity != null) {
|
||||
// entity.ridingEntity.motionY
|
||||
// = -entity.ridingEntity.motionY;
|
||||
// }
|
||||
// }
|
||||
if (target.orientation > 1
|
||||
&& super.worldObj.isAirBlock(
|
||||
target.xCoord + xm,
|
||||
target.yCoord + ym - 1,
|
||||
target.zCoord + zm
|
||||
)) {
|
||||
--ym;
|
||||
}
|
||||
|
||||
// ThaumCraftCore.poof(
|
||||
// super.worldObj,
|
||||
// (float) entity.posX - 0.5F,
|
||||
// (float) entity.posY - 0.5F,
|
||||
// (float) entity.posZ - 0.5F
|
||||
// );
|
||||
// super.worldObj.playSoundEffect(
|
||||
// entity.posX,
|
||||
// entity.posY,
|
||||
// entity.posZ,
|
||||
// "mob.endermen.portal",
|
||||
// 1.0F,
|
||||
// 1.0F
|
||||
// );
|
||||
// int xm = 0;
|
||||
// int zm = 0;
|
||||
// int ym = 0;
|
||||
// switch (target.orientation) {
|
||||
// case 0:
|
||||
// ym = -1;
|
||||
// break;
|
||||
// case 1:
|
||||
// ym = 1;
|
||||
// break;
|
||||
// case 2:
|
||||
// zm = -1;
|
||||
// break;
|
||||
// case 3:
|
||||
// zm = 1;
|
||||
// break;
|
||||
// case 4:
|
||||
// xm = -1;
|
||||
// break;
|
||||
// case 5:
|
||||
// xm = 1;
|
||||
// }
|
||||
entity.setLocationAndAngles(
|
||||
(double) target.xCoord + 0.5 + (double) xm,
|
||||
(double) target.yCoord + 0.5 + (double) ym,
|
||||
(double) target.zCoord + 0.5 + (double) zm,
|
||||
tYaw,
|
||||
entity.rotationPitch
|
||||
);
|
||||
if (entity.ridingEntity != null) {
|
||||
entity.ridingEntity.setLocationAndAngles(
|
||||
(double) target.xCoord + 0.5 + (double) xm,
|
||||
(double) target.yCoord + 0.5 + (double) ym,
|
||||
(double) target.zCoord + 0.5 + (double) zm,
|
||||
tYaw,
|
||||
entity.ridingEntity.rotationPitch
|
||||
);
|
||||
}
|
||||
|
||||
// if (target.orientation > 1
|
||||
// && super.worldObj.isAirBlock(
|
||||
// target.xCoord + xm,
|
||||
// target.yCoord + ym - 1,
|
||||
// target.zCoord + zm
|
||||
// )) {
|
||||
// --ym;
|
||||
// }
|
||||
UtilsFX.poof(
|
||||
super.worldObj,
|
||||
(float) entity.posX - 0.5F,
|
||||
(float) entity.posY - 0.5F,
|
||||
(float) entity.posZ - 0.5F
|
||||
);
|
||||
super.worldObj.playSoundEffect(
|
||||
entity.posX,
|
||||
entity.posY,
|
||||
entity.posZ,
|
||||
"mob.endermen.portal",
|
||||
1.0F,
|
||||
1.0F
|
||||
);
|
||||
|
||||
// entity.setLocationAndAngles(
|
||||
// (double) target.xCoord + 0.5 + (double) xm,
|
||||
// (double) target.yCoord + 0.5 + (double) ym,
|
||||
// (double) target.zCoord + 0.5 + (double) zm,
|
||||
// tYaw,
|
||||
// entity.rotationPitch
|
||||
// );
|
||||
// if (entity.ridingEntity != null) {
|
||||
// entity.ridingEntity.setLocationAndAngles(
|
||||
// (double) target.xCoord + 0.5 + (double) xm,
|
||||
// (double) target.yCoord + 0.5 + (double) ym,
|
||||
// (double) target.zCoord + 0.5 + (double) zm,
|
||||
// tYaw,
|
||||
// entity.ridingEntity.rotationPitch
|
||||
// );
|
||||
// }
|
||||
// TODO: use specific aspect for flux
|
||||
int thisAura = AuraManager.getClosestAuraWithinRange(
|
||||
this.worldObj,
|
||||
this.xCoord,
|
||||
this.yCoord,
|
||||
this.zCoord,
|
||||
512
|
||||
);
|
||||
|
||||
// ThaumCraftCore.poof(
|
||||
// super.worldObj,
|
||||
// (float) entity.posX - 0.5F,
|
||||
// (float) entity.posY - 0.5F,
|
||||
// (float) entity.posZ - 0.5F
|
||||
// );
|
||||
// super.worldObj.playSoundEffect(
|
||||
// entity.posX,
|
||||
// entity.posY,
|
||||
// entity.posZ,
|
||||
// "mob.endermen.portal",
|
||||
// 1.0F,
|
||||
// 1.0F
|
||||
// );
|
||||
// int auraX = super.xCoord >> 4;
|
||||
// int auraZ = super.zCoord >> 4;
|
||||
// SIAuraChunk ac
|
||||
// = (SIAuraChunk) mod_ThaumCraft.AuraHM.get(
|
||||
// Arrays.asList(
|
||||
// auraX,
|
||||
// auraZ,
|
||||
// ThaumCraftCore.getDimension(super.worldObj
|
||||
// )
|
||||
// )
|
||||
// );
|
||||
// if (ac != null) {
|
||||
// if (entity instanceof EntityItem) {
|
||||
// ++ac.badVibes;
|
||||
// } else {
|
||||
// ac.badVibes = (short) (ac.badVibes + 4);
|
||||
// }
|
||||
// }
|
||||
if (thisAura >= 0) {
|
||||
AuraManager.addRandomFlux(
|
||||
this.worldObj,
|
||||
AuraManager.getNode(thisAura),
|
||||
(entity instanceof EntityItem) ? 1 : 4
|
||||
);
|
||||
}
|
||||
|
||||
// auraX = target.xCoord >> 4;
|
||||
// auraZ = target.zCoord >> 4;
|
||||
// ac = (SIAuraChunk) mod_ThaumCraft.AuraHM.get(
|
||||
// Arrays.asList(
|
||||
// auraX,
|
||||
// auraZ,
|
||||
// ThaumCraftCore.getDimension(super.worldObj)
|
||||
// )
|
||||
// );
|
||||
// if (ac != null) {
|
||||
// if (entity instanceof EntityItem) {
|
||||
// ++ac.badVibes;
|
||||
// } else {
|
||||
// ac.badVibes = (short) (ac.badVibes + 4);
|
||||
// }
|
||||
// }
|
||||
int otherAura = AuraManager.getClosestAuraWithinRange(
|
||||
target.worldObj,
|
||||
target.xCoord,
|
||||
target.yCoord,
|
||||
target.zCoord,
|
||||
512
|
||||
);
|
||||
|
||||
// this.worked = true;
|
||||
// return true;
|
||||
// } else {
|
||||
// return false;
|
||||
// }
|
||||
// } else {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
if (otherAura >= 0) {
|
||||
AuraManager.addRandomFlux(
|
||||
this.worldObj,
|
||||
AuraManager.getNode(otherAura),
|
||||
(entity instanceof EntityItem) ? 1 : 4
|
||||
);
|
||||
}
|
||||
|
||||
this.worked = true;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void beam(
|
||||
int range,
|
||||
|
@ -2508,19 +2457,25 @@ public class TileSeal extends TileEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
this.orientation = nbttagcompound.getShort("orientation");
|
||||
this.runes = nbttagcompound.getByteArray("runes");
|
||||
this.portalWindow = nbttagcompound.getInteger("window");
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
this.orientation = nbt.getShort("orientation");
|
||||
this.runes = nbt.getByteArray("runes");
|
||||
this.portalWindow = nbt.getInteger("window");
|
||||
if (nbt.hasKey("other"))
|
||||
this.otherSeal = SealData.readFromNbt(nbt.getCompoundTag("other"));
|
||||
else
|
||||
this.otherSeal = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
nbttagcompound.setShort("orientation", this.orientation);
|
||||
nbttagcompound.setByteArray("runes", this.runes);
|
||||
nbttagcompound.setInteger("window", this.portalWindow);
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setShort("orientation", this.orientation);
|
||||
nbt.setByteArray("runes", this.runes);
|
||||
nbt.setInteger("window", this.portalWindow);
|
||||
if (this.otherSeal != null)
|
||||
nbt.setTag("other", this.otherSeal.writeToNbt(new NBTTagCompound()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2530,6 +2485,8 @@ public class TileSeal extends TileEntity {
|
|||
nbt.setShort("orientation", this.orientation);
|
||||
nbt.setByteArray("runes", this.runes);
|
||||
nbt.setInteger("window", this.portalWindow);
|
||||
if (this.otherSeal != null)
|
||||
nbt.setTag("other", this.otherSeal.writeToNbt(new NBTTagCompound()));
|
||||
|
||||
return new S35PacketUpdateTileEntity(
|
||||
this.xCoord, this.yCoord, this.zCoord, this.getBlockMetadata(), nbt
|
||||
|
@ -2543,6 +2500,10 @@ public class TileSeal extends TileEntity {
|
|||
this.orientation = nbt.getShort("orientation");
|
||||
this.runes = nbt.getByteArray("runes");
|
||||
this.portalWindow = nbt.getInteger("window");
|
||||
if (nbt.hasKey("other"))
|
||||
this.otherSeal = SealData.readFromNbt(nbt.getCompoundTag("other"));
|
||||
else
|
||||
this.otherSeal = null;
|
||||
}
|
||||
|
||||
public List<Entity>
|
||||
|
@ -2602,6 +2563,13 @@ public class TileSeal extends TileEntity {
|
|||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
if (!this.worldObj.isRemote)
|
||||
SEALS.remove(this);
|
||||
}
|
||||
|
||||
public boolean canEntityBeSeen(Entity entity) {
|
||||
return this.worldObj.rayTraceBlocks(
|
||||
Vec3.createVectorHelper(
|
||||
|
|
Reference in a new issue