generated from tilera/1710mod
feat: initial (very borked) portals
This commit is contained in:
parent
5a78c93c1d
commit
63f12376f7
|
@ -44,7 +44,6 @@ dependencies {
|
||||||
implementation "thaumcraft:Thaumcraft:1.7.10-4.2.3.5:deobf"
|
implementation "thaumcraft:Thaumcraft:1.7.10-4.2.3.5:deobf"
|
||||||
implementation "dev.tilera:auracore:1.0.0-SNAPSHOT:deobf"
|
implementation "dev.tilera:auracore:1.0.0-SNAPSHOT:deobf"
|
||||||
implementation "com.github.tox1cozZ:mixin-booter-legacy:1.1.2"
|
implementation "com.github.tox1cozZ:mixin-booter-legacy:1.1.2"
|
||||||
implementation files("libs/LookingGlass-1.7.10-0.2.0.01-dev.jar")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
|
|
Binary file not shown.
|
@ -2,6 +2,7 @@ package net.anvilcraft.arcaneseals;
|
||||||
|
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
import cpw.mods.fml.common.SidedProxy;
|
import cpw.mods.fml.common.SidedProxy;
|
||||||
|
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
|
||||||
@Mod(
|
@Mod(
|
||||||
|
@ -25,4 +26,9 @@ public class ArcaneSeals {
|
||||||
|
|
||||||
proxy.registerTileEntities();
|
proxy.registerTileEntities();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Mod.EventHandler
|
||||||
|
public void init(FMLInitializationEvent ev) {
|
||||||
|
proxy.init();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.anvilcraft.arcaneseals;
|
package net.anvilcraft.arcaneseals;
|
||||||
|
|
||||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import net.anvilcraft.arcaneseals.render.TileSealRenderer;
|
import net.anvilcraft.arcaneseals.render.TileSealRenderer;
|
||||||
import net.anvilcraft.arcaneseals.tiles.TileSeal;
|
import net.anvilcraft.arcaneseals.tiles.TileSeal;
|
||||||
|
|
||||||
|
@ -9,4 +10,9 @@ public class ClientProxy extends CommonProxy {
|
||||||
public void registerTileEntities() {
|
public void registerTileEntities() {
|
||||||
ClientRegistry.registerTileEntity(TileSeal.class, "seal", new TileSealRenderer());
|
ClientRegistry.registerTileEntity(TileSeal.class, "seal", new TileSealRenderer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() {
|
||||||
|
FMLCommonHandler.instance().bus().register(new RenderTicker());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,4 +7,6 @@ public class CommonProxy {
|
||||||
public void registerTileEntities() {
|
public void registerTileEntities() {
|
||||||
GameRegistry.registerTileEntity(TileSeal.class, "seal");
|
GameRegistry.registerTileEntity(TileSeal.class, "seal");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void init() {}
|
||||||
}
|
}
|
||||||
|
|
15
src/main/java/net/anvilcraft/arcaneseals/RenderTicker.java
Normal file
15
src/main/java/net/anvilcraft/arcaneseals/RenderTicker.java
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
package net.anvilcraft.arcaneseals;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent;
|
||||||
|
import net.anvilcraft.arcaneseals.render.PortalRenderer;
|
||||||
|
|
||||||
|
public class RenderTicker {
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onRenderTickEvent(RenderTickEvent ev) {
|
||||||
|
for (PortalRenderer ren : PortalRenderer.INSTANCES) {
|
||||||
|
// TODO: optimize
|
||||||
|
ren.createPortalView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -43,7 +43,46 @@ public class SealData {
|
||||||
self.x = nbt.getInteger("x");
|
self.x = nbt.getInteger("x");
|
||||||
self.y = nbt.getInteger("y");
|
self.y = nbt.getInteger("y");
|
||||||
self.z = nbt.getInteger("z");
|
self.z = nbt.getInteger("z");
|
||||||
|
self.orientation = nbt.getShort("orientation");
|
||||||
|
self.rune = nbt.getByte("rune");
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + dim;
|
||||||
|
result = prime * result + x;
|
||||||
|
result = prime * result + y;
|
||||||
|
result = prime * result + z;
|
||||||
|
result = prime * result + orientation;
|
||||||
|
result = prime * result + rune;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
SealData other = (SealData) obj;
|
||||||
|
if (dim != other.dim)
|
||||||
|
return false;
|
||||||
|
if (x != other.x)
|
||||||
|
return false;
|
||||||
|
if (y != other.y)
|
||||||
|
return false;
|
||||||
|
if (z != other.z)
|
||||||
|
return false;
|
||||||
|
if (orientation != other.orientation)
|
||||||
|
return false;
|
||||||
|
if (rune != other.rune)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,51 +1,195 @@
|
||||||
package net.anvilcraft.arcaneseals.render;
|
package net.anvilcraft.arcaneseals.render;
|
||||||
|
|
||||||
import com.xcompwiz.lookingglass.api.APIInstanceProvider;
|
import java.nio.ByteBuffer;
|
||||||
import com.xcompwiz.lookingglass.api.APIUndefined;
|
import java.util.HashSet;
|
||||||
import com.xcompwiz.lookingglass.api.APIVersionRemoved;
|
import java.util.Set;
|
||||||
import com.xcompwiz.lookingglass.api.APIVersionUndefined;
|
|
||||||
import com.xcompwiz.lookingglass.api.hook.WorldViewAPI2;
|
import net.anvilcraft.arcaneseals.SealData;
|
||||||
import com.xcompwiz.lookingglass.api.view.IWorldView;
|
|
||||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
|
||||||
import net.anvilcraft.arcaneseals.tiles.TileSeal;
|
import net.anvilcraft.arcaneseals.tiles.TileSeal;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.ChunkCoordinates;
|
import net.minecraft.util.ChunkCoordinates;
|
||||||
|
import net.minecraft.util.IChatComponent;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.EXTFramebufferObject;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
public class PortalRenderer {
|
public class PortalRenderer {
|
||||||
static WorldViewAPI2 LG_API;
|
public static Set<PortalRenderer> INSTANCES = new HashSet<>();
|
||||||
public IWorldView ww;
|
|
||||||
TileSeal thisSeal;
|
|
||||||
TileSeal otherSeal;
|
|
||||||
|
|
||||||
public PortalRenderer(TileSeal thisSeal, TileSeal otherSeal) {
|
public int portalTexture;
|
||||||
this.thisSeal = thisSeal;
|
public int depthRenderBuffer;
|
||||||
this.otherSeal = otherSeal;
|
public int frameBuffer;
|
||||||
|
public static int renderRecursion;
|
||||||
|
public TileSeal seal;
|
||||||
|
|
||||||
this.ww = LG_API.createWorldView(
|
public PortalRenderer(TileSeal seal) {
|
||||||
otherSeal.getWorldObj().provider.dimensionId,
|
this.frameBuffer = EXTFramebufferObject.glGenFramebuffersEXT();
|
||||||
new ChunkCoordinates(otherSeal.xCoord, otherSeal.yCoord, otherSeal.zCoord),
|
this.portalTexture = GL11.glGenTextures();
|
||||||
256,
|
this.depthRenderBuffer = EXTFramebufferObject.glGenRenderbuffersEXT();
|
||||||
256
|
EXTFramebufferObject.glBindFramebufferEXT(36160, this.frameBuffer);
|
||||||
|
GL11.glBindTexture(3553, this.portalTexture);
|
||||||
|
GL11.glTexParameterf(3553, 10241, 9729.0F);
|
||||||
|
GL11.glTexImage2D(3553, 0, 32856, 512, 512, 0, 6408, 5124, (ByteBuffer) null);
|
||||||
|
EXTFramebufferObject.glFramebufferTexture2DEXT(
|
||||||
|
36160, 36064, 3553, this.portalTexture, 0
|
||||||
);
|
);
|
||||||
|
EXTFramebufferObject.glBindRenderbufferEXT(36161, this.depthRenderBuffer);
|
||||||
|
EXTFramebufferObject.glRenderbufferStorageEXT(36161, 35056, 512, 512);
|
||||||
|
EXTFramebufferObject.glFramebufferRenderbufferEXT(
|
||||||
|
36160, 33306, 36161, this.depthRenderBuffer
|
||||||
|
);
|
||||||
|
EXTFramebufferObject.glBindFramebufferEXT(36160, 0);
|
||||||
|
this.seal = seal;
|
||||||
|
INSTANCES.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deinit() {
|
public void deinit() {
|
||||||
LG_API.cleanupWorldView(this.ww);
|
// TODO: WTF
|
||||||
|
//GL11.glDeleteFramebuffers(this.frameBuffer);
|
||||||
|
GL11.glDeleteTextures(this.portalTexture);
|
||||||
|
INSTANCES.remove(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initLookingGlass() {
|
public void createPortalView() {
|
||||||
FMLInterModComms.sendMessage(
|
++PortalRenderer.renderRecursion;
|
||||||
"LookingGlass",
|
if (this.seal.otherSeal == null)
|
||||||
"API",
|
return;
|
||||||
"net.anvilcraft.arcaneseals.render.PortalRenderer.lookingGlassInitCb"
|
|
||||||
|
SealData target = this.seal.otherSeal;
|
||||||
|
Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glLoadIdentity();
|
||||||
|
|
||||||
|
int prevFbo = GL11.glGetInteger(EXTFramebufferObject.GL_FRAMEBUFFER_BINDING_EXT);
|
||||||
|
EXTFramebufferObject.glBindFramebufferEXT(36160, this.frameBuffer);
|
||||||
|
|
||||||
|
GL11.glEnable(2960);
|
||||||
|
GL11.glStencilFunc(519, 1, 1);
|
||||||
|
GL11.glStencilOp(7680, 7680, 7681);
|
||||||
|
GL11.glViewport(0, 0, 512, 512);
|
||||||
|
GL11.glLoadIdentity();
|
||||||
|
GL11.glDisable(3553);
|
||||||
|
GL11.glColor3f(1.0f, 1.0f, 1.0f);
|
||||||
|
GL11.glBegin(6);
|
||||||
|
GL11.glVertex2f(0.0f, 0.0f);
|
||||||
|
for (int oh = 0; oh <= 10; ++oh) {
|
||||||
|
final double aa = 6.283185307179586 * oh / 10.0;
|
||||||
|
GL11.glVertex2f((float) Math.cos(aa), (float) Math.sin(aa));
|
||||||
|
}
|
||||||
|
GL11.glEnd();
|
||||||
|
GL11.glStencilFunc(514, 1, 1);
|
||||||
|
GL11.glStencilOp(7680, 7680, 7680);
|
||||||
|
GL11.glEnable(3553);
|
||||||
|
Entity rve = mc.renderViewEntity;
|
||||||
|
|
||||||
|
mc.renderViewEntity = new EntityPlayer(
|
||||||
|
mc.theWorld, mc.getSession().func_148256_e()
|
||||||
|
) {
|
||||||
|
@Override
|
||||||
|
public void addChatMessage(IChatComponent p_145747_1_) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canCommandSenderUseCommand(int p_70003_1_, String p_70003_2_) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ChunkCoordinates getPlayerCoordinates() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
int orientation = target.orientation;
|
||||||
|
float yaw = 0.0f;
|
||||||
|
float pitch = 0.0f;
|
||||||
|
switch (orientation) {
|
||||||
|
case 0: {
|
||||||
|
pitch = 90.0f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1: {
|
||||||
|
pitch = -90.0f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2: {
|
||||||
|
yaw = 180.0f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 3: {
|
||||||
|
yaw = 0.0f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 4: {
|
||||||
|
yaw = 90.0f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 5: {
|
||||||
|
yaw = 270.0f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int xm = 0;
|
||||||
|
int zm = 0;
|
||||||
|
int ym = 0;
|
||||||
|
switch (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;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mc.renderViewEntity.setPositionAndRotation(
|
||||||
|
target.x + 0.5 + xm, target.y - 0.5f + ym, target.z + 0.5 + zm, yaw, pitch
|
||||||
);
|
);
|
||||||
}
|
final boolean di = mc.gameSettings.showDebugInfo;
|
||||||
|
mc.gameSettings.showDebugInfo = false;
|
||||||
public static void lookingGlassInitCb(APIInstanceProvider ip) {
|
final float fov = mc.gameSettings.fovSetting;
|
||||||
try {
|
final int width = mc.displayWidth;
|
||||||
LG_API = (WorldViewAPI2) ip.getAPIInstance("view-2");
|
final int height = mc.displayHeight;
|
||||||
} catch (APIUndefined | APIVersionUndefined | APIVersionRemoved e) {
|
int tpv = mc.gameSettings.thirdPersonView;
|
||||||
System.err.println("LookingGlass alec");
|
mc.displayWidth = 512;
|
||||||
e.printStackTrace();
|
mc.displayHeight = 512;
|
||||||
}
|
mc.gameSettings.thirdPersonView = 0;
|
||||||
|
mc.gameSettings.fovSetting = 120.0f;
|
||||||
|
mc.renderViewEntity.rotationYaw = yaw;
|
||||||
|
mc.renderViewEntity.rotationPitch = pitch;
|
||||||
|
final boolean hg = mc.gameSettings.hideGUI;
|
||||||
|
mc.gameSettings.hideGUI = true;
|
||||||
|
mc.entityRenderer.renderWorld(1F, 0L);
|
||||||
|
mc.renderViewEntity = (EntityLivingBase) rve;
|
||||||
|
mc.displayWidth = width;
|
||||||
|
mc.displayHeight = height;
|
||||||
|
mc.gameSettings.showDebugInfo = di;
|
||||||
|
mc.gameSettings.hideGUI = hg;
|
||||||
|
mc.gameSettings.fovSetting = fov;
|
||||||
|
mc.gameSettings.thirdPersonView = tpv;
|
||||||
|
GL11.glViewport(0, 0, mc.displayWidth, mc.displayHeight);
|
||||||
|
//GL11.glDisable(2960);
|
||||||
|
EXTFramebufferObject.glBindFramebufferEXT(36160, prevFbo);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
--PortalRenderer.renderRecursion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import net.anvilcraft.arcaneseals.utils.UtilsFX;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureUtil;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
@ -75,95 +76,95 @@ public class TileSealRenderer extends TileEntitySpecialRenderer {
|
||||||
GL11.glDepthMask(true);
|
GL11.glDepthMask(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: portal rendering
|
private void drawPortal(TileSeal seal, float angle, double x, double y, double z) {
|
||||||
//private void drawPortal(TileSeal seal, float angle, double x, double y, double z) {
|
Tessellator tessellator = Tessellator.instance;
|
||||||
// Tessellator tessellator = Tessellator.instance;
|
Minecraft mc = Minecraft.getMinecraft();
|
||||||
// Minecraft mc = ModLoader.getMinecraftInstance();
|
GL11.glDisable(2896);
|
||||||
// GL11.glDisable(2896);
|
if (seal.otherSeal != null && seal.renderer != null) {
|
||||||
// if (Config.portalGfx && seal.txRender != null
|
GL11.glPushMatrix();
|
||||||
// && PortalRenderer.renderRecursion < 2) {
|
GL11.glDisable(3553);
|
||||||
// GL11.glPushMatrix();
|
GL11.glColor4f(
|
||||||
// GL11.glDisable(3553);
|
1.0f,
|
||||||
// GL11.glColor4f(
|
1.0f,
|
||||||
// ThaumCraftCore.fColorR(),
|
1.0f,
|
||||||
// ThaumCraftCore.fColorG(),
|
1.0f
|
||||||
// ThaumCraftCore.fColorB(),
|
);
|
||||||
// 1.0F
|
tessellator.setBrightness(220);
|
||||||
// );
|
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
||||||
// tessellator.setBrightness(220);
|
GL11.glScaled(
|
||||||
// GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
(double) (seal.pSize / 2.0F),
|
||||||
// GL11.glScaled(
|
(double) (seal.pSize / 2.0F),
|
||||||
// (double) (seal.pSize / 2.0F),
|
(double) (seal.pSize / 2.0F)
|
||||||
// (double) (seal.pSize / 2.0F),
|
);
|
||||||
// (double) (seal.pSize / 2.0F)
|
GL11.glBegin(6);
|
||||||
// );
|
GL11.glVertex2f(0.0F, 0.0F);
|
||||||
// GL11.glBegin(6);
|
|
||||||
// GL11.glVertex2f(0.0F, 0.0F);
|
|
||||||
|
|
||||||
// for (int oh = 0; oh <= 10; ++oh) {
|
for (int oh = 0; oh <= 10; ++oh) {
|
||||||
// double aa = 6.283185307179586 * (double) oh / 10.0;
|
double aa = 6.283185307179586 * (double) oh / 10.0;
|
||||||
// GL11.glVertex2f((float) Math.cos(aa), (float) Math.sin(aa));
|
GL11.glVertex2f((float) Math.cos(aa), (float) Math.sin(aa));
|
||||||
// }
|
}
|
||||||
|
|
||||||
// GL11.glEnd();
|
GL11.glEnd();
|
||||||
// GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
// GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
// GL11.glEnable(3553);
|
GL11.glEnable(3553);
|
||||||
// GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
// GL11.glDisable(2896);
|
GL11.glDisable(2896);
|
||||||
// GL11.glEnable(3042);
|
GL11.glEnable(3042);
|
||||||
// GL11.glBlendFunc(770, 771);
|
GL11.glBlendFunc(770, 771);
|
||||||
// GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
|
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
|
||||||
// GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
||||||
// GL11.glTranslatef(-seal.pSize / 2.0F, -0.01F, -seal.pSize / 2.0F);
|
GL11.glTranslatef(-seal.pSize / 2.0F, -0.01F, -seal.pSize / 2.0F);
|
||||||
// GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
// GL11.glBindTexture(3553, seal.txRender.portalTexture);
|
GL11.glBindTexture(GL11.GL_TEXTURE_2D, seal.renderer.portalTexture);
|
||||||
// tessellator.startDrawingQuads();
|
tessellator.startDrawingQuads();
|
||||||
// tessellator.setBrightness(220);
|
tessellator.setBrightness(220);
|
||||||
// tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F);
|
tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
// tessellator.addVertexWithUV(0.0, 0.0, 0.0, 0.0, 0.0);
|
tessellator.addVertexWithUV(0.0, 0.0, 0.0, 0.0, 0.0);
|
||||||
// tessellator.addVertexWithUV((double) seal.pSize, 0.0, 0.0, 1.0, 0.0);
|
tessellator.addVertexWithUV((double) seal.pSize, 0.0, 0.0, 1.0, 0.0);
|
||||||
// tessellator.addVertexWithUV(
|
tessellator.addVertexWithUV(
|
||||||
// (double) seal.pSize, 0.0, (double) seal.pSize, 1.0, 1.0
|
(double) seal.pSize, 0.0, (double) seal.pSize, 1.0, 1.0
|
||||||
// );
|
);
|
||||||
// tessellator.addVertexWithUV(0.0, 0.0, (double) seal.pSize, 0.0, 1.0);
|
tessellator.addVertexWithUV(0.0, 0.0, (double) seal.pSize, 0.0, 1.0);
|
||||||
// tessellator.draw();
|
tessellator.draw();
|
||||||
// GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
// GL11.glDisable(3042);
|
GL11.glDisable(3042);
|
||||||
// GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
// }
|
}
|
||||||
|
|
||||||
// GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
// GL11.glRotatef(90.0F, -1.0F, 0.0F, 0.0F);
|
GL11.glRotatef(90.0F, -1.0F, 0.0F, 0.0F);
|
||||||
// GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F);
|
GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F);
|
||||||
// GL11.glTranslatef(-seal.pSize, 0.02F, -seal.pSize);
|
GL11.glTranslatef(-seal.pSize, 0.02F, -seal.pSize);
|
||||||
// GL11.glDepthMask(false);
|
GL11.glDepthMask(false);
|
||||||
// GL11.glEnable(3042);
|
GL11.glEnable(3042);
|
||||||
// GL11.glBlendFunc(770, 771);
|
GL11.glBlendFunc(770, 771);
|
||||||
// if (Config.portalGfx && seal.txRender != null) {
|
if (seal.otherSeal != null && seal.renderer != null) {
|
||||||
// MinecraftForgeClient.bindTexture("/thaumcraft/resources/portal2.png");
|
mc.renderEngine.bindTexture(
|
||||||
// } else {
|
new ResourceLocation("arcaneseals", "textures/misc/portal2.png")
|
||||||
// MinecraftForgeClient.bindTexture("/thaumcraft/resources/portal.png");
|
);
|
||||||
// }
|
} else {
|
||||||
|
mc.renderEngine.bindTexture(
|
||||||
|
new ResourceLocation("arcaneseals", "textures/misc/portal.png")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// tessellator.startDrawingQuads();
|
tessellator.startDrawingQuads();
|
||||||
// tessellator.setBrightness(220);
|
tessellator.setBrightness(220);
|
||||||
// tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F);
|
tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
// tessellator.addVertexWithUV(0.0, 0.0, (double) (seal.pSize * 2.0F), 0.0, 1.0);
|
tessellator.addVertexWithUV(0.0, 0.0, (double) (seal.pSize * 2.0F), 0.0, 1.0);
|
||||||
// tessellator.addVertexWithUV(
|
tessellator.addVertexWithUV(
|
||||||
// (double) (seal.pSize * 2.0F), 0.0, (double) (seal.pSize * 2.0F), 1.0, 1.0
|
(double) (seal.pSize * 2.0F), 0.0, (double) (seal.pSize * 2.0F), 1.0, 1.0
|
||||||
// );
|
);
|
||||||
// tessellator.addVertexWithUV((double) (seal.pSize * 2.0F), 0.0, 0.0, 1.0, 0.0);
|
tessellator.addVertexWithUV((double) (seal.pSize * 2.0F), 0.0, 0.0, 1.0, 0.0);
|
||||||
// tessellator.addVertexWithUV(0.0, 0.0, 0.0, 0.0, 0.0);
|
tessellator.addVertexWithUV(0.0, 0.0, 0.0, 0.0, 0.0);
|
||||||
// tessellator.draw();
|
tessellator.draw();
|
||||||
// GL11.glDisable(3042);
|
GL11.glDisable(3042);
|
||||||
// GL11.glDepthMask(true);
|
GL11.glDepthMask(true);
|
||||||
// GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
// GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
// GL11.glEnable(2896);
|
GL11.glEnable(2896);
|
||||||
// GL11.glPopMatrix();
|
}
|
||||||
// GL11.glPopMatrix();
|
|
||||||
//}
|
|
||||||
|
|
||||||
public void renderEntityAt(TileSeal seal, double x, double y, double z, float fq) {
|
public void renderEntityAt(TileSeal seal, double x, double y, double z, float fq) {
|
||||||
int a = this.count % 360;
|
int a = this.count % 360;
|
||||||
|
@ -217,14 +218,12 @@ public class TileSealRenderer extends TileEntitySpecialRenderer {
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: portal rendering
|
if (seal.runes[0] == 0 && seal.runes[1] == 1 && seal.pSize > 0.0F) {
|
||||||
//if (seal.runes[0] == 0 && seal.runes[1] == 1 && seal.pSize > 0.0F) {
|
GL11.glPushMatrix();
|
||||||
// GL11.glPushMatrix();
|
GL11.glTranslatef(0.5F, 0.5F, -seal.pSize / 5.0F);
|
||||||
// GL11.glPushMatrix();
|
this.drawPortal(seal, (float) (-a * 4), x, y, z);
|
||||||
// GL11.glTranslatef(0.5F, 0.5F, -seal.pSize / 5.0F);
|
GL11.glPopMatrix();
|
||||||
// this.drawPortal(seal, (float) (-a * 4), x, y, z);
|
}
|
||||||
// nopush = false;
|
|
||||||
//}
|
|
||||||
|
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package net.anvilcraft.arcaneseals.tiles;
|
package net.anvilcraft.arcaneseals.tiles;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -11,6 +10,7 @@ import dev.tilera.auracore.aura.AuraManager;
|
||||||
import dev.tilera.auracore.client.FXSparkle;
|
import dev.tilera.auracore.client.FXSparkle;
|
||||||
import dev.tilera.auracore.helper.Utils;
|
import dev.tilera.auracore.helper.Utils;
|
||||||
import net.anvilcraft.arcaneseals.SealData;
|
import net.anvilcraft.arcaneseals.SealData;
|
||||||
|
import net.anvilcraft.arcaneseals.render.PortalRenderer;
|
||||||
import net.anvilcraft.arcaneseals.utils.HelperLocation;
|
import net.anvilcraft.arcaneseals.utils.HelperLocation;
|
||||||
import net.anvilcraft.arcaneseals.utils.UtilsFX;
|
import net.anvilcraft.arcaneseals.utils.UtilsFX;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -49,7 +49,8 @@ import thaumcraft.client.fx.particles.FXWisp;
|
||||||
|
|
||||||
public class TileSeal extends TileEntity {
|
public class TileSeal extends TileEntity {
|
||||||
public static Set<SealData> SEALS = new HashSet<>();
|
public static Set<SealData> SEALS = new HashSet<>();
|
||||||
SealData otherSeal;
|
public SealData otherSeal;
|
||||||
|
public PortalRenderer renderer;
|
||||||
|
|
||||||
public int delay = 0;
|
public int delay = 0;
|
||||||
private int soundDelay = 0;
|
private int soundDelay = 0;
|
||||||
|
@ -73,6 +74,11 @@ public class TileSeal extends TileEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
if (this.worldObj.isRemote && this.otherSeal != null) {
|
||||||
|
if (this.renderer == null)
|
||||||
|
this.renderer = new PortalRenderer(this);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.delay <= 0) {
|
if (this.delay <= 0) {
|
||||||
boolean oldPower = this.isPowering;
|
boolean oldPower = this.isPowering;
|
||||||
this.isPowering = false;
|
this.isPowering = false;
|
||||||
|
@ -1522,13 +1528,14 @@ public class TileSeal extends TileEntity {
|
||||||
);
|
);
|
||||||
|
|
||||||
this.otherSeal = pd;
|
this.otherSeal = pd;
|
||||||
|
super.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||||
|
|
||||||
if (!this.pOpen && p) {
|
if (!this.pOpen && p) {
|
||||||
super.worldObj.playSoundEffect(
|
super.worldObj.playSoundEffect(
|
||||||
(double) super.xCoord + 0.5,
|
(double) super.xCoord + 0.5,
|
||||||
(double) super.yCoord + 0.5,
|
(double) super.yCoord + 0.5,
|
||||||
(double) super.zCoord + 0.5,
|
(double) super.zCoord + 0.5,
|
||||||
"thaumcraft:popen",
|
"arcaneseals:popen",
|
||||||
0.4F,
|
0.4F,
|
||||||
1.0F + super.worldObj.rand.nextFloat() * 0.2F
|
1.0F + super.worldObj.rand.nextFloat() * 0.2F
|
||||||
);
|
);
|
||||||
|
@ -1548,6 +1555,8 @@ public class TileSeal extends TileEntity {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.otherSeal = null;
|
this.otherSeal = null;
|
||||||
|
super.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||||
|
|
||||||
if (this.pOpen) {
|
if (this.pOpen) {
|
||||||
list = this.getEntitiesSorted(super.worldObj, 2, this.orientation, false);
|
list = this.getEntitiesSorted(super.worldObj, 2, this.orientation, false);
|
||||||
|
|
||||||
|
@ -1557,7 +1566,7 @@ public class TileSeal extends TileEntity {
|
||||||
(double) super.xCoord + 0.5,
|
(double) super.xCoord + 0.5,
|
||||||
(double) super.yCoord + 0.5,
|
(double) super.yCoord + 0.5,
|
||||||
(double) super.zCoord + 0.5,
|
(double) super.zCoord + 0.5,
|
||||||
"thaumcraft:pclose",
|
"arcaneseals:pclose",
|
||||||
0.4F,
|
0.4F,
|
||||||
1.0F + super.worldObj.rand.nextFloat() * 0.2F
|
1.0F + super.worldObj.rand.nextFloat() * 0.2F
|
||||||
);
|
);
|
||||||
|
@ -2487,6 +2496,8 @@ public class TileSeal extends TileEntity {
|
||||||
nbt.setInteger("window", this.portalWindow);
|
nbt.setInteger("window", this.portalWindow);
|
||||||
if (this.otherSeal != null)
|
if (this.otherSeal != null)
|
||||||
nbt.setTag("other", this.otherSeal.writeToNbt(new NBTTagCompound()));
|
nbt.setTag("other", this.otherSeal.writeToNbt(new NBTTagCompound()));
|
||||||
|
//nbt.setFloat("pSize", this.pSize);
|
||||||
|
nbt.setBoolean("pOpen", this.pOpen);
|
||||||
|
|
||||||
return new S35PacketUpdateTileEntity(
|
return new S35PacketUpdateTileEntity(
|
||||||
this.xCoord, this.yCoord, this.zCoord, this.getBlockMetadata(), nbt
|
this.xCoord, this.yCoord, this.zCoord, this.getBlockMetadata(), nbt
|
||||||
|
@ -2504,6 +2515,8 @@ public class TileSeal extends TileEntity {
|
||||||
this.otherSeal = SealData.readFromNbt(nbt.getCompoundTag("other"));
|
this.otherSeal = SealData.readFromNbt(nbt.getCompoundTag("other"));
|
||||||
else
|
else
|
||||||
this.otherSeal = null;
|
this.otherSeal = null;
|
||||||
|
//this.pSize = nbt.getFloat("pSize");
|
||||||
|
this.pOpen = nbt.getBoolean("pOpen");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Entity>
|
public List<Entity>
|
||||||
|
@ -2567,7 +2580,15 @@ public class TileSeal extends TileEntity {
|
||||||
public void invalidate() {
|
public void invalidate() {
|
||||||
super.invalidate();
|
super.invalidate();
|
||||||
if (!this.worldObj.isRemote)
|
if (!this.worldObj.isRemote)
|
||||||
SEALS.remove(this);
|
SEALS.remove(new SealData(this));
|
||||||
|
else if (this.renderer != null)
|
||||||
|
this.renderer.deinit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChunkUnload() {
|
||||||
|
super.onChunkUnload();
|
||||||
|
this.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canEntityBeSeen(Entity entity) {
|
public boolean canEntityBeSeen(Entity entity) {
|
||||||
|
|
20
src/main/resources/assets/arcaneseals/sounds.json
Normal file
20
src/main/resources/assets/arcaneseals/sounds.json
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"popen": {
|
||||||
|
"category": "master",
|
||||||
|
"sounds": [
|
||||||
|
{
|
||||||
|
"name": "popen",
|
||||||
|
"stream": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"pclose": {
|
||||||
|
"category": "master",
|
||||||
|
"sounds": [
|
||||||
|
{
|
||||||
|
"name": "pclose",
|
||||||
|
"stream": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
BIN
src/main/resources/assets/arcaneseals/sounds/pclose.ogg
Normal file
BIN
src/main/resources/assets/arcaneseals/sounds/pclose.ogg
Normal file
Binary file not shown.
BIN
src/main/resources/assets/arcaneseals/sounds/popen.ogg
Normal file
BIN
src/main/resources/assets/arcaneseals/sounds/popen.ogg
Normal file
Binary file not shown.
Reference in a new issue