feat: initial (completely borked) portal implementation

This commit is contained in:
LordMZTE 2022-11-21 21:25:49 +01:00
parent 42320de0b0
commit 5bb2e1a969
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
3 changed files with 100 additions and 0 deletions

Binary file not shown.

View 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;
}
}

View file

@ -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();
}
}
}