generated from tilera/1710mod
feat: initial (completely borked) portal implementation
This commit is contained in:
parent
42320de0b0
commit
5bb2e1a969
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();
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue