This repository has been archived on 2022-11-23. You can view files and clone it, but cannot push or open issues or pull requests.
arcane-seals/src/main/java/net/anvilcraft/arcaneseals/render/PortalRenderer.java

52 lines
1.6 KiB
Java

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