implement void chest and interface

This commit is contained in:
LordMZTE 2023-05-16 15:51:07 +02:00
parent 981e1152b9
commit 98c93662df
Signed by: LordMZTE
GPG Key ID: B64802DC33A64FF6
22 changed files with 1161 additions and 442 deletions

View File

@ -27,16 +27,25 @@ public class AuraUtils {
}
}
/*for(xx = 0; xx < 100; ++xx) {
FXWisp ef = new FXWisp(w, (double)((float)x + 0.5F), (double)((float)y +
0.5F), (double)((float)z + 0.5F), (double)((float)x + 0.5F +
(w.rand.nextFloat() - w.rand.nextFloat()) * 2.0F), (double)((float)y + 0.5F
+ (w.rand.nextFloat() - w.rand.nextFloat()) * 2.0F), (double)((float)z +
0.5F + (w.rand.nextFloat() - w.rand.nextFloat()) * 2.0F), 1.0F, 5);
ef.setGravity(0.02F);
ef.shrink = true;
ModLoader.getMinecraftInstance().effectRenderer.addEffect(ef);
}*/
//for (xx = 0; xx < 100; ++xx) {
// FXWisp ef = new FXWisp(
// w,
// (double) ((float) x + 0.5F),
// (double) ((float) y + 0.5F),
// (double) ((float) z + 0.5F),
// (double
// ) ((float) x + 0.5F + (w.rand.nextFloat() - w.rand.nextFloat()) * 2.0F),
// (double
// ) ((float) y + 0.5F + (w.rand.nextFloat() - w.rand.nextFloat()) * 2.0F),
// (double
// ) ((float) z + 0.5F + (w.rand.nextFloat() - w.rand.nextFloat()) * 2.0F),
// 1.0F,
// 5
// );
// ef.setGravity(0.02F);
// ef.shrink = true;
// ModLoader.getMinecraftInstance().effectRenderer.addEffect(ef);
//}
}
public static void spillTaint(World world, int x, int y, int z) {

View File

@ -11,6 +11,8 @@ import net.anvilcraft.thaummach.render.entity.EntitySingularityRenderer;
import net.anvilcraft.thaummach.render.tile.TileBoreRenderer;
import net.anvilcraft.thaummach.render.tile.TileConduitPumpRenderer;
import net.anvilcraft.thaummach.render.tile.TileCrystallizerRenderer;
import net.anvilcraft.thaummach.render.tile.TileVoidChestRenderer;
import net.anvilcraft.thaummach.render.tile.TileVoidInterfaceRenderer;
import net.anvilcraft.thaummach.tiles.TileBore;
import net.anvilcraft.thaummach.tiles.TileConduit;
import net.anvilcraft.thaummach.tiles.TileConduitPump;
@ -23,6 +25,7 @@ import net.anvilcraft.thaummach.tiles.TileFilter;
import net.anvilcraft.thaummach.tiles.TilePurifier;
import net.anvilcraft.thaummach.tiles.TileSeal;
import net.anvilcraft.thaummach.tiles.TileVoidChest;
import net.anvilcraft.thaummach.tiles.TileVoidInterface;
public class ClientProxy extends CommonProxy {
@Override
@ -53,7 +56,6 @@ public class ClientProxy extends CommonProxy {
GameRegistry.registerTileEntity(TileCrucible.class, "crucible");
GameRegistry.registerTileEntity(TileFilter.class, "filter");
GameRegistry.registerTileEntity(TilePurifier.class, "purifier");
GameRegistry.registerTileEntity(TileVoidChest.class, "voidChest");
ClientRegistry.registerTileEntity(TileBore.class, "bore", new TileBoreRenderer());
ClientRegistry.registerTileEntity(
@ -63,5 +65,11 @@ public class ClientProxy extends CommonProxy {
TileCrystallizer.class, "crystallizer", new TileCrystallizerRenderer()
);
ClientRegistry.registerTileEntity(TileSeal.class, "seal", new TileSealRenderer());
ClientRegistry.registerTileEntity(
TileVoidChest.class, "voidChest", new TileVoidChestRenderer()
);
ClientRegistry.registerTileEntity(
TileVoidInterface.class, "voidInterface", new TileVoidInterfaceRenderer()
);
}
}

View File

@ -13,6 +13,7 @@ import net.anvilcraft.thaummach.tiles.TileFilter;
import net.anvilcraft.thaummach.tiles.TilePurifier;
import net.anvilcraft.thaummach.tiles.TileSeal;
import net.anvilcraft.thaummach.tiles.TileVoidChest;
import net.anvilcraft.thaummach.tiles.TileVoidInterface;
public class CommonProxy {
public void preInit() {}
@ -34,5 +35,6 @@ public class CommonProxy {
GameRegistry.registerTileEntity(TilePurifier.class, "purifier");
GameRegistry.registerTileEntity(TileSeal.class, "seal");
GameRegistry.registerTileEntity(TileVoidChest.class, "voidChest");
GameRegistry.registerTileEntity(TileVoidInterface.class, "voidInterface");
}
}

View File

@ -2,8 +2,9 @@ package net.anvilcraft.thaummach;
import net.anvilcraft.thaummach.tiles.TileSeal;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
public class SealData {
public class RuneTileData {
public int dim;
public int x;
public int y;
@ -11,9 +12,17 @@ public class SealData {
public short orientation;
public byte rune;
public SealData() {}
public RuneTileData() {}
public SealData(TileSeal seal) {
public RuneTileData(TileEntity te, byte rune) {
this.dim = te.getWorldObj().provider.dimensionId;
this.x = te.xCoord;
this.y = te.yCoord;
this.z = te.zCoord;
this.rune = rune;
}
public RuneTileData(TileSeal seal) {
this.dim = seal.getWorldObj().provider.dimensionId;
this.x = seal.xCoord;
@ -36,8 +45,8 @@ public class SealData {
return nbt;
}
public static SealData readFromNbt(NBTTagCompound nbt) {
SealData self = new SealData();
public static RuneTileData readFromNbt(NBTTagCompound nbt) {
RuneTileData self = new RuneTileData();
self.dim = nbt.getInteger("dim");
self.x = nbt.getInteger("x");
@ -70,7 +79,7 @@ public class SealData {
return false;
if (getClass() != obj.getClass())
return false;
SealData other = (SealData) obj;
RuneTileData other = (RuneTileData) obj;
if (dim != other.dim)
return false;
if (x != other.x)

View File

@ -13,12 +13,14 @@ import net.anvilcraft.thaummach.render.apparatus.apparati.metal.BoreApparatusRen
import net.anvilcraft.thaummach.render.apparatus.apparati.metal.CrucibleApparatusRenderer;
import net.anvilcraft.thaummach.render.apparatus.apparati.metal.CrystallizerApparatusRenderer;
import net.anvilcraft.thaummach.render.apparatus.apparati.metal.VoidChestApparatusRenderer;
import net.anvilcraft.thaummach.render.apparatus.apparati.metal.VoidInterfaceApparatusRenderer;
import net.anvilcraft.thaummach.tiles.TileArcaneFurnace;
import net.anvilcraft.thaummach.tiles.TileBore;
import net.anvilcraft.thaummach.tiles.TileConduitTank;
import net.anvilcraft.thaummach.tiles.TileCrucible;
import net.anvilcraft.thaummach.tiles.TileCrystallizer;
import net.anvilcraft.thaummach.tiles.TileVoidChest;
import net.anvilcraft.thaummach.tiles.TileVoidInterface;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
@ -28,6 +30,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@ -38,6 +41,8 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import thaumcraft.client.fx.WRVector3;
import thaumcraft.client.fx.bolt.FXLightningBolt;
import thaumcraft.common.entities.monster.EntityThaumicSlime;
import thaumcraft.common.tiles.TileBellows;
@ -158,6 +163,9 @@ public class BlockApparatusMetal extends BlockApparatus {
case VOID_CHEST:
return VoidChestApparatusRenderer.INSTANCE;
case VOID_INTERFACE:
return VoidInterfaceApparatusRenderer.INSTANCE;
default:
return null;
}
@ -181,7 +189,7 @@ public class BlockApparatusMetal extends BlockApparatus {
} else if (md == MetaVals.VOID_CHEST) {
return new TileVoidChest();
} else if (md == MetaVals.VOID_INTERFACE) {
//return new TileVoidInterface();
return new TileVoidInterface();
} else if (md == MetaVals.TANK) {
return new TileConduitTank();
} else if (md == MetaVals.SOUL_BRAZIER) {
@ -247,7 +255,7 @@ public class BlockApparatusMetal extends BlockApparatus {
} else if (meta == MetaVals.VOID_CHEST) {
return i == 0 ? this.iconVoidChestBottom
: i == 1 ? this.iconVoidChestTop
: this.iconVoidChestSide;
: this.iconVoidChestSideTransparent;
} else if (meta == MetaVals.VOID_INTERFACE) {
return i <= 1 ? this.iconVoidInterfaceBottom : this.iconVoidInterfaceSide;
} else if (meta == MetaVals.SOUL_BRAZIER) {
@ -317,15 +325,16 @@ public class BlockApparatusMetal extends BlockApparatus {
} else if (meta == MetaVals.VOID_CHEST) {
return side == 0 ? this.iconVoidChestBottom
: side == 1 ? this.iconVoidChestTop
: this.iconVoidChestSide;
: this.iconVoidChestSideTransparent;
} else if (meta == MetaVals.VOID_INTERFACE) {
if (side == 0) {
return this.iconVoidChestBottom;
} else {
return side == 1 ? this.iconVoidInterfaceBottom
: this.iconVoidInterfaceSide;
}
}
//else if (meta == 8) {
// if (side == 0) {
// return 104;
// } else {
// return side == 1 ? 97 : 255;
// }
//} else if (meta == 10) {
// else if (meta == 10) {
// return side <= 1 ? 78 : 79;
//} else {
// return super.getBlockTexture(iblockaccess, i, j, k, side);
@ -672,27 +681,25 @@ public class BlockApparatusMetal extends BlockApparatus {
}
if (meta == MetaVals.VOID_INTERFACE) {
// TODO: void interface
//TileVoidInterface tvi = (TileVoidInterface) w.getTileEntity(i, j, k);
//if (tvi != null && tvi.linked && w.rand.nextInt(10) == 0) {
// LightningBolt bolt = new LightningBolt(
// w,
// new WRVector3((double) i + 0.5, (double) j + 0.75, (double) k +
// 0.5), new WRVector3(
// (double) i + 0.5 + (double) w.rand.nextFloat()
// - (double) w.rand.nextFloat(),
// (double) (j + 2),
// (double) k + 0.5 + (double) w.rand.nextFloat()
// - (double) w.rand.nextFloat()
// ),
// w.rand.nextLong()
// );
// bolt.setMultiplier(4.0F);
// bolt.defaultFractal();
// bolt.setType(5);
// bolt.setNonLethal();
// bolt.finalizeBolt();
//}
TileVoidInterface tvi = (TileVoidInterface) w.getTileEntity(i, j, k);
if (tvi != null && tvi.linked && w.rand.nextInt(10) == 0) {
FXLightningBolt bolt = new FXLightningBolt(
w,
new WRVector3((double) i + 0.5, (double) j + 0.75, (double) k + 0.5),
new WRVector3(
(double) i + 0.5 + (double) w.rand.nextFloat()
- (double) w.rand.nextFloat(),
(double) (j + 2),
(double) k + 0.5 + (double) w.rand.nextFloat()
- (double) w.rand.nextFloat()
),
w.rand.nextLong()
);
bolt.setMultiplier(4.0F);
bolt.defaultFractal();
bolt.setType(5);
bolt.finalizeBolt();
}
}
}
@ -704,20 +711,10 @@ public class BlockApparatusMetal extends BlockApparatus {
}
if (meta == MetaVals.VOID_INTERFACE) {
// TODO: void interface
//TileVoidInterface ts = (TileVoidInterface) world.getTileEntity(i, j,
//k); if (ts != null) {
// ts.invalidateLinks();
// SISpecialTile pd = new SISpecialTile(
// i,
// j,
// k,
// ts.network,
// (byte) ModLoader.getMinecraftInstance().thePlayer.dimension,
// (byte) 1
// );
// mod_ThaumCraft.DeleteSpecialTileFromList(pd);
//}
TileVoidInterface ts = (TileVoidInterface) world.getTileEntity(i, j, k);
if (ts != null) {
ts.invalidateLinks();
}
} else {
super.breakBlock(world, i, j, k, block, meta_);
@ -737,29 +734,11 @@ public class BlockApparatusMetal extends BlockApparatus {
) {
MetaVals md = MetaVals.get(world.getBlockMetadata(i, j, k));
if (md == MetaVals.VOID_INTERFACE) {
// TODO: void interface
//if (world.getBlock(i, j - 1, k) == this
// && world.getBlockMetadata(i, j - 1, k) == 8) {
// TileVoidInterface tvi
// = (TileVoidInterface) world.getTileEntity(i, j, k);
// if (tvi != null) {
// tvi.network = (byte) world.rand.nextInt(6);
// SISpecialTile pd = new SISpecialTile(
// i,
// j,
// k,
// tvi.network,
// (byte) ModLoader.getMinecraftInstance().thePlayer.dimension,
// (byte) 1
// );
// mod_ThaumCraft.AddSpecialTileToList(pd);
// tvi.invalidateLinks();
// tvi.establishLinks();
// }
//} else {
// this.dropBlockAsItem(world, i, j, k, md, 0);
// world.setBlock(i, j, k, 0);
//}
if (world.getBlock(i, j - 1, k) != this
|| world.getBlockMetadata(i, j - 1, k) != MetaVals.VOID_CHEST.ordinal()) {
this.dropBlockAsItem(world, i, j, k, md.ordinal(), 0);
world.setBlock(i, j, k, Blocks.air);
}
} else if (md == MetaVals.BORE) {
TileBore tb = (TileBore) world.getTileEntity(i, j, k);
if (MathHelper.abs((float) entityliving.posX - (float) i) < 1.0F

View File

@ -4,7 +4,7 @@ import java.nio.ByteBuffer;
import java.util.HashSet;
import java.util.Set;
import net.anvilcraft.thaummach.SealData;
import net.anvilcraft.thaummach.RuneTileData;
import net.anvilcraft.thaummach.tiles.TileSeal;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
@ -55,7 +55,7 @@ public class PortalRenderer {
if (this.seal.otherSeal == null)
return;
SealData target = this.seal.otherSeal;
RuneTileData target = this.seal.otherSeal;
Minecraft mc = Minecraft.getMinecraft();
GL11.glPushMatrix();
GL11.glLoadIdentity();

View File

@ -0,0 +1,104 @@
package net.anvilcraft.thaummach.render.apparatus.apparati.metal;
import net.anvilcraft.thaummach.blocks.BlockApparatusMetal;
import net.anvilcraft.thaummach.render.apparatus.ApparatusRenderingHelper;
import net.anvilcraft.thaummach.render.apparatus.IApparatusRenderer;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
public class VoidInterfaceApparatusRenderer implements IApparatusRenderer {
public static VoidInterfaceApparatusRenderer INSTANCE
= new VoidInterfaceApparatusRenderer();
@Override
public void renderApparatus(
IBlockAccess w,
RenderBlocks rb,
int x,
int y,
int z,
Block block_,
int meta,
boolean inv
) {
float t1x = 0.0625F;
float t3x = 0.1875F;
float t4x = 0.25F;
BlockApparatusMetal block = (BlockApparatusMetal) block_;
if (block.getRenderBlockPass() == 0 || inv) {
rb.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, t3x, 1.0F);
if (inv) {
ApparatusRenderingHelper.drawFaces(
rb,
block,
block.iconVoidInterfaceBottom,
block.iconVoidInterfaceBottom,
block.iconVoidInterfaceSide,
block.iconVoidInterfaceSide,
block.iconVoidInterfaceSide,
block.iconVoidInterfaceSide,
true
);
} else {
rb.renderStandardBlock(block, x, y, z);
}
rb.setRenderBounds(0.0F, 0.5F - t4x, 0.0F, 1.0F, 0.5F - t1x, 1.0F);
if (inv) {
ApparatusRenderingHelper.drawFaces(
rb,
block,
block.iconVoidInterfaceBottom,
block.iconVoidInterfaceBottom,
block.iconVoidInterfaceSide,
block.iconVoidInterfaceSide,
block.iconVoidInterfaceSide,
block.iconVoidInterfaceSide,
true
);
} else {
rb.renderStandardBlock(block, x, y, z);
}
rb.setRenderBounds(t4x, 0.5F - t1x, t4x, 1.0F - t4x, 0.5F + t4x, 1.0F - t4x);
if (inv) {
ApparatusRenderingHelper.drawFaces(
rb,
block,
block.iconVoidInterfaceBottom,
block.iconVoidInterfaceBottom,
block.iconVoidInterfaceSide,
block.iconVoidInterfaceSide,
block.iconVoidInterfaceSide,
block.iconVoidInterfaceSide,
true
);
} else {
rb.renderStandardBlock(block, x, y, z);
}
}
rb.setRenderBounds(t1x, t3x, t1x, 1.0F - t1x, 0.5F - t4x, 1.0F - t1x);
if (!inv) {
rb.renderFaceXNeg(
block, (double) x, (double) y, (double) z, block.iconTcubeanim
);
rb.renderFaceXPos(
block, (double) x, (double) y, (double) z, block.iconTcubeanim
);
rb.renderFaceZNeg(
block, (double) x, (double) y, (double) z, block.iconTcubeanim
);
rb.renderFaceZPos(
block, (double) x, (double) y, (double) z, block.iconTcubeanim
);
} else {
rb.overrideBlockTexture = block.iconTcubeanim;
ApparatusRenderingHelper.drawFaces(rb, block, block.iconTcubeanim, true);
}
rb.overrideBlockTexture = null;
rb.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
}

View File

@ -0,0 +1,627 @@
package net.anvilcraft.thaummach.render.tile;
import java.nio.FloatBuffer;
import java.util.Random;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public class TileVoidChestRenderer extends TileEntitySpecialRenderer {
FloatBuffer fBuffer = GLAllocation.createDirectFloatBuffer(16);
private FloatBuffer calcFloatBuffer(float f, float f1, float f2, float f3) {
this.fBuffer.clear();
this.fBuffer.put(f).put(f1).put(f2).put(f3);
this.fBuffer.flip();
return this.fBuffer;
}
// _____ ___ ____ ___ __ _______ _____
// |_ _/ _ \| _ \ / _ \ _ \ \ / /_ _| ___|
// | || | | | | | | | | (_) \ \ /\ / / | | | |_
// | || |_| | |_| | |_| |_ \ V V / | | | _|
// |_| \___/|____/ \___/(_) \_/\_/ |_| |_|
public void drawPlaneYNeg(double x, double y, double z, float f) {
EntityClientPlayerMP player = FMLClientHandler.instance().getClientPlayerEntity();
float px = (float) player.posX;
float py = (float) player.posY;
float pz = (float) player.posZ;
GL11.glDisable(2896);
Random random = new Random(31100L);
float offset = 0.01F;
for (int i = 0; i < 16; ++i) {
GL11.glPushMatrix();
float f5 = (float) (16 - i);
float f6 = 0.0625F;
float f7 = 1.0F / (f5 + 1.0F);
if (i == 0) {
this.bindTexture(
new ResourceLocation("thaummach", "textures/misc/tunnel.png")
);
f7 = 0.1F;
f5 = 65.0F;
f6 = 0.125F;
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
}
if (i == 1) {
this.bindTexture(
new ResourceLocation("thaummach", "textures/misc/particlefield.png")
);
GL11.glEnable(3042);
GL11.glBlendFunc(1, 1);
f6 = 0.5F;
}
float f8 = (float) (y + (double) offset);
float f9 = f8 - ActiveRenderInfo.objectY;
float f10 = f8 + f5 - ActiveRenderInfo.objectY;
float f11 = f9 / f10;
f11 += (float) (y + (double) offset);
GL11.glTranslatef(px, f11, pz);
GL11.glTexGeni(8192, 9472, 9217);
GL11.glTexGeni(8193, 9472, 9217);
GL11.glTexGeni(8194, 9472, 9217);
GL11.glTexGeni(8195, 9472, 9216);
GL11.glTexGen(8192, 9473, this.calcFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
GL11.glTexGen(8193, 9473, this.calcFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
GL11.glTexGen(8194, 9473, this.calcFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
GL11.glTexGen(8195, 9474, this.calcFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
GL11.glEnable(3168);
GL11.glEnable(3169);
GL11.glEnable(3170);
GL11.glEnable(3171);
GL11.glPopMatrix();
GL11.glMatrixMode(5890);
GL11.glPushMatrix();
GL11.glLoadIdentity();
GL11.glTranslatef(
0.0F, (float) (System.currentTimeMillis() % 700000L) / 250000.0F, 0.0F
);
GL11.glScalef(f6, f6, f6);
GL11.glTranslatef(0.5F, 0.5F, 0.0F);
GL11.glRotatef((float) (i * i * 4321 + i * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
GL11.glTranslatef(-px, -pz, -py);
GL11.glTranslatef(
ActiveRenderInfo.objectX * f5 / f9,
ActiveRenderInfo.objectZ * f5 / f9,
-py
);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
f11 = random.nextFloat() * 0.5F + 0.1F;
float f12 = random.nextFloat() * 0.5F + 0.4F;
float f13 = random.nextFloat() * 0.5F + 0.5F;
if (i == 0) {
f13 = 1.0F;
f12 = 1.0F;
f11 = 1.0F;
}
tessellator.setBrightness(180);
tessellator.setColorRGBA_F(f11 * f7, f12 * f7, f13 * f7, 1.0F);
tessellator.addVertex(x, y + (double) offset, z + 1.0);
tessellator.addVertex(x, y + (double) offset, z);
tessellator.addVertex(x + 1.0, y + (double) offset, z);
tessellator.addVertex(x + 1.0, y + (double) offset, z + 1.0);
tessellator.draw();
GL11.glPopMatrix();
GL11.glMatrixMode(5888);
}
GL11.glDisable(3042);
GL11.glDisable(3168);
GL11.glDisable(3169);
GL11.glDisable(3170);
GL11.glDisable(3171);
GL11.glEnable(2896);
}
public void drawPlaneYPos(double x, double y, double z, float f) {
EntityClientPlayerMP player = FMLClientHandler.instance().getClientPlayerEntity();
float f1 = (float) player.posX;
float f2 = (float) player.posY;
float f3 = (float) player.posZ;
GL11.glDisable(2896);
Random random = new Random(31100L);
float offset = 0.99F;
for (int i = 0; i < 16; ++i) {
GL11.glPushMatrix();
float f5 = (float) (16 - i);
float f6 = 0.0625F;
float f7 = 1.0F / (f5 + 1.0F);
if (i == 0) {
this.bindTexture(
new ResourceLocation("thaummach", "textures/misc/tunnel.png")
);
f7 = 0.1F;
f5 = 65.0F;
f6 = 0.125F;
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
}
if (i == 1) {
this.bindTexture(
new ResourceLocation("thaummach", "textures/misc/particlefield.png")
);
GL11.glEnable(3042);
GL11.glBlendFunc(1, 1);
f6 = 0.5F;
}
float f8 = (float) (-(y + (double) offset));
float f9 = f8 + ActiveRenderInfo.objectY;
float f10 = f8 + f5 + ActiveRenderInfo.objectY;
float f11 = f9 / f10;
f11 += (float) (y + (double) offset);
GL11.glTranslatef(f1, f11, f3);
GL11.glTexGeni(8192, 9472, 9217);
GL11.glTexGeni(8193, 9472, 9217);
GL11.glTexGeni(8194, 9472, 9217);
GL11.glTexGeni(8195, 9472, 9216);
GL11.glTexGen(8192, 9473, this.calcFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
GL11.glTexGen(8193, 9473, this.calcFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
GL11.glTexGen(8194, 9473, this.calcFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
GL11.glTexGen(8195, 9474, this.calcFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
GL11.glEnable(3168);
GL11.glEnable(3169);
GL11.glEnable(3170);
GL11.glEnable(3171);
GL11.glPopMatrix();
GL11.glMatrixMode(5890);
GL11.glPushMatrix();
GL11.glLoadIdentity();
GL11.glTranslatef(
0.0F, (float) (System.currentTimeMillis() % 700000L) / 250000.0F, 0.0F
);
GL11.glScalef(f6, f6, f6);
GL11.glTranslatef(0.5F, 0.5F, 0.0F);
GL11.glRotatef((float) (i * i * 4321 + i * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
GL11.glTranslatef(-f1, -f3, -f2);
GL11.glTranslatef(
ActiveRenderInfo.objectX * f5 / f9,
ActiveRenderInfo.objectZ * f5 / f9,
-f2
);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
f11 = random.nextFloat() * 0.5F + 0.1F;
float f12 = random.nextFloat() * 0.5F + 0.4F;
float f13 = random.nextFloat() * 0.5F + 0.5F;
if (i == 0) {
f13 = 1.0F;
f12 = 1.0F;
f11 = 1.0F;
}
tessellator.setBrightness(180);
tessellator.setColorRGBA_F(f11 * f7, f12 * f7, f13 * f7, 1.0F);
tessellator.addVertex(x, y + (double) offset, z);
tessellator.addVertex(x, y + (double) offset, z + 1.0);
tessellator.addVertex(x + 1.0, y + (double) offset, z + 1.0);
tessellator.addVertex(x + 1.0, y + (double) offset, z);
tessellator.draw();
GL11.glPopMatrix();
GL11.glMatrixMode(5888);
}
GL11.glDisable(3042);
GL11.glDisable(3168);
GL11.glDisable(3169);
GL11.glDisable(3170);
GL11.glDisable(3171);
GL11.glEnable(2896);
}
public void drawPlaneZPos(double x, double y, double z, float f) {
EntityClientPlayerMP player = FMLClientHandler.instance().getClientPlayerEntity();
float px = (float) player.posX;
float py = (float) player.posY;
float pz = (float) player.posZ;
GL11.glDisable(2896);
Random random = new Random(31100L);
float offset = 0.99F;
for (int i = 0; i < 16; ++i) {
GL11.glPushMatrix();
float f5 = (float) (16 - i);
float f6 = 0.0625F;
float f7 = 1.0F / (f5 + 1.0F);
if (i == 0) {
this.bindTexture(
new ResourceLocation("thaummach", "textures/misc/tunnel.png")
);
f7 = 0.1F;
f5 = 65.0F;
f6 = 0.125F;
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
}
if (i == 1) {
this.bindTexture(
new ResourceLocation("thaummach", "textures/misc/particlefield.png")
);
GL11.glEnable(3042);
GL11.glBlendFunc(1, 1);
f6 = 0.5F;
}
float f8 = (float) (-(z + (double) offset));
float f9 = f8 + ActiveRenderInfo.objectZ;
float f10 = f8 + f5 + ActiveRenderInfo.objectZ;
float f11 = f9 / f10;
f11 += (float) (z + (double) offset);
GL11.glTranslatef(px, py, f11);
GL11.glTexGeni(8192, 9472, 9217);
GL11.glTexGeni(8193, 9472, 9217);
GL11.glTexGeni(8194, 9472, 9217);
GL11.glTexGeni(8195, 9472, 9216);
GL11.glTexGen(8192, 9473, this.calcFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
GL11.glTexGen(8193, 9473, this.calcFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
GL11.glTexGen(8194, 9473, this.calcFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
GL11.glTexGen(8195, 9474, this.calcFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
GL11.glEnable(3168);
GL11.glEnable(3169);
GL11.glEnable(3170);
GL11.glEnable(3171);
GL11.glPopMatrix();
GL11.glMatrixMode(5890);
GL11.glPushMatrix();
GL11.glLoadIdentity();
GL11.glTranslatef(
0.0F, (float) (System.currentTimeMillis() % 700000L) / 250000.0F, 0.0F
);
GL11.glScalef(f6, f6, f6);
GL11.glTranslatef(0.5F, 0.5F, 0.0F);
GL11.glRotatef((float) (i * i * 4321 + i * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
GL11.glTranslatef(-px, -py, -pz);
GL11.glTranslatef(
ActiveRenderInfo.objectX * f5 / f9,
ActiveRenderInfo.objectY * f5 / f9,
-pz
);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
f11 = random.nextFloat() * 0.5F + 0.1F;
float f12 = random.nextFloat() * 0.5F + 0.4F;
float f13 = random.nextFloat() * 0.5F + 0.5F;
if (i == 0) {
f13 = 1.0F;
f12 = 1.0F;
f11 = 1.0F;
}
tessellator.setBrightness(180);
tessellator.setColorRGBA_F(f11 * f7, f12 * f7, f13 * f7, 1.0F);
tessellator.addVertex(x, y + 1.0, z + (double) offset);
tessellator.addVertex(x, y, z + (double) offset);
tessellator.addVertex(x + 1.0, y, z + (double) offset);
tessellator.addVertex(x + 1.0, y + 1.0, z + (double) offset);
tessellator.draw();
GL11.glPopMatrix();
GL11.glMatrixMode(5888);
}
GL11.glDisable(3042);
GL11.glDisable(3168);
GL11.glDisable(3169);
GL11.glDisable(3170);
GL11.glDisable(3171);
GL11.glEnable(2896);
}
public void drawPlaneZNeg(double x, double y, double z, float f) {
EntityClientPlayerMP player = FMLClientHandler.instance().getClientPlayerEntity();
float px = (float) player.posX;
float py = (float) player.posY;
float pz = (float) player.posZ;
GL11.glDisable(2896);
Random random = new Random(31100L);
float offset = 0.01F;
for (int i = 0; i < 16; ++i) {
GL11.glPushMatrix();
float f5 = (float) (16 - i);
float f6 = 0.0625F;
float f7 = 1.0F / (f5 + 1.0F);
if (i == 0) {
this.bindTexture(
new ResourceLocation("thaummach", "textures/misc/tunnel.png")
);
f7 = 0.1F;
f5 = 65.0F;
f6 = 0.125F;
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
}
if (i == 1) {
this.bindTexture(
new ResourceLocation("thaummach", "textures/misc/particlefield.png")
);
GL11.glEnable(3042);
GL11.glBlendFunc(1, 1);
f6 = 0.5F;
}
float f8 = (float) (z + (double) offset);
float f9 = f8 - ActiveRenderInfo.objectZ;
float f10 = f8 + f5 - ActiveRenderInfo.objectZ;
float f11 = f9 / f10;
f11 += (float) (z + (double) offset);
GL11.glTranslatef(px, py, f11);
GL11.glTexGeni(8192, 9472, 9217);
GL11.glTexGeni(8193, 9472, 9217);
GL11.glTexGeni(8194, 9472, 9217);
GL11.glTexGeni(8195, 9472, 9216);
GL11.glTexGen(8192, 9473, this.calcFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
GL11.glTexGen(8193, 9473, this.calcFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
GL11.glTexGen(8194, 9473, this.calcFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
GL11.glTexGen(8195, 9474, this.calcFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
GL11.glEnable(3168);
GL11.glEnable(3169);
GL11.glEnable(3170);
GL11.glEnable(3171);
GL11.glPopMatrix();
GL11.glMatrixMode(5890);
GL11.glPushMatrix();
GL11.glLoadIdentity();
GL11.glTranslatef(
0.0F, (float) (System.currentTimeMillis() % 700000L) / 250000.0F, 0.0F
);
GL11.glScalef(f6, f6, f6);
GL11.glTranslatef(0.5F, 0.5F, 0.0F);
GL11.glRotatef((float) (i * i * 4321 + i * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
GL11.glTranslatef(-px, -py, -pz);
GL11.glTranslatef(
ActiveRenderInfo.objectX * f5 / f9,
ActiveRenderInfo.objectY * f5 / f9,
-pz
);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
f11 = random.nextFloat() * 0.5F + 0.1F;
float f12 = random.nextFloat() * 0.5F + 0.4F;
float f13 = random.nextFloat() * 0.5F + 0.5F;
if (i == 0) {
f13 = 1.0F;
f12 = 1.0F;
f11 = 1.0F;
}
tessellator.setBrightness(180);
tessellator.setColorRGBA_F(f11 * f7, f12 * f7, f13 * f7, 1.0F);
tessellator.addVertex(x, y, z + (double) offset);
tessellator.addVertex(x, y + 1.0, z + (double) offset);
tessellator.addVertex(x + 1.0, y + 1.0, z + (double) offset);
tessellator.addVertex(x + 1.0, y, z + (double) offset);
tessellator.draw();
GL11.glPopMatrix();
GL11.glMatrixMode(5888);
}
GL11.glDisable(3042);
GL11.glDisable(3168);
GL11.glDisable(3169);
GL11.glDisable(3170);
GL11.glDisable(3171);
GL11.glEnable(2896);
}
public void drawPlaneXPos(double x, double y, double z, float f) {
EntityClientPlayerMP player = FMLClientHandler.instance().getClientPlayerEntity();
float px = (float) player.posX;
float py = (float) player.posY;
float pz = (float) player.posZ;
GL11.glDisable(2896);
Random random = new Random(31100L);
float offset = 0.99F;
for (int i = 0; i < 16; ++i) {
GL11.glPushMatrix();
float f5 = (float) (16 - i);
float f6 = 0.0625F;
float f7 = 1.0F / (f5 + 1.0F);
if (i == 0) {
this.bindTexture(
new ResourceLocation("thaummach", "textures/misc/tunnel.png")
);
f7 = 0.1F;
f5 = 65.0F;
f6 = 0.125F;
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
}
if (i == 1) {
this.bindTexture(
new ResourceLocation("thaummach", "textures/misc/particlefield.png")
);
GL11.glEnable(3042);
GL11.glBlendFunc(1, 1);
f6 = 0.5F;
}
float f8 = (float) (-(x + (double) offset));
float f9 = f8 + ActiveRenderInfo.objectX;
float f10 = f8 + f5 + ActiveRenderInfo.objectX;
float f11 = f9 / f10;
f11 += (float) (x + (double) offset);
GL11.glTranslatef(f11, py, pz);
GL11.glTexGeni(8192, 9472, 9217);
GL11.glTexGeni(8193, 9472, 9217);
GL11.glTexGeni(8194, 9472, 9217);
GL11.glTexGeni(8195, 9472, 9216);
GL11.glTexGen(8193, 9473, this.calcFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
GL11.glTexGen(8192, 9473, this.calcFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
GL11.glTexGen(8194, 9473, this.calcFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
GL11.glTexGen(8195, 9474, this.calcFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
GL11.glEnable(3168);
GL11.glEnable(3169);
GL11.glEnable(3170);
GL11.glEnable(3171);
GL11.glPopMatrix();
GL11.glMatrixMode(5890);
GL11.glPushMatrix();
GL11.glLoadIdentity();
GL11.glTranslatef(
0.0F, (float) (System.currentTimeMillis() % 700000L) / 250000.0F, 0.0F
);
GL11.glScalef(f6, f6, f6);
GL11.glTranslatef(0.5F, 0.5F, 0.0F);
GL11.glRotatef((float) (i * i * 4321 + i * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
GL11.glTranslatef(-pz, -py, -px);
GL11.glTranslatef(
ActiveRenderInfo.objectZ * f5 / f9,
ActiveRenderInfo.objectY * f5 / f9,
-px
);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
f11 = random.nextFloat() * 0.5F + 0.1F;
float f12 = random.nextFloat() * 0.5F + 0.4F;
float f13 = random.nextFloat() * 0.5F + 0.5F;
if (i == 0) {
f13 = 1.0F;
f12 = 1.0F;
f11 = 1.0F;
}
tessellator.setBrightness(180);
tessellator.setColorRGBA_F(f11 * f7, f12 * f7, f13 * f7, 1.0F);
tessellator.addVertex(x + (double) offset, y + 1.0, z);
tessellator.addVertex(x + (double) offset, y + 1.0, z + 1.0);
tessellator.addVertex(x + (double) offset, y, z + 1.0);
tessellator.addVertex(x + (double) offset, y, z);
tessellator.draw();
GL11.glPopMatrix();
GL11.glMatrixMode(5888);
}
GL11.glDisable(3042);
GL11.glDisable(3168);
GL11.glDisable(3169);
GL11.glDisable(3170);
GL11.glDisable(3171);
GL11.glEnable(2896);
}
public void drawPlaneXNeg(double x, double y, double z, float f) {
EntityClientPlayerMP player = FMLClientHandler.instance().getClientPlayerEntity();
float px = (float) player.posX;
float py = (float) player.posY;
float pz = (float) player.posZ;
GL11.glDisable(2896);
Random random = new Random(31100L);
float offset = 0.01F;
for (int i = 0; i < 16; ++i) {
GL11.glPushMatrix();
float f5 = (float) (16 - i);
float f6 = 0.0625F;
float f7 = 1.0F / (f5 + 1.0F);
if (i == 0) {
this.bindTexture(
new ResourceLocation("thaummach", "textures/misc/tunnel.png")
);
f7 = 0.1F;
f5 = 65.0F;
f6 = 0.125F;
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
}
if (i == 1) {
this.bindTexture(
new ResourceLocation("thaummach", "textures/misc/particlefield.png")
);
GL11.glEnable(3042);
GL11.glBlendFunc(1, 1);
f6 = 0.5F;
}
float f8 = (float) (x + (double) offset);
float f9 = f8 - ActiveRenderInfo.objectX;
float f10 = f8 + f5 - ActiveRenderInfo.objectX;
float f11 = f9 / f10;
f11 += (float) (x + (double) offset);
GL11.glTranslatef(f11, py, pz);
GL11.glTexGeni(8192, 9472, 9217);
GL11.glTexGeni(8193, 9472, 9217);
GL11.glTexGeni(8194, 9472, 9217);
GL11.glTexGeni(8195, 9472, 9216);
GL11.glTexGen(8193, 9473, this.calcFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
GL11.glTexGen(8192, 9473, this.calcFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
GL11.glTexGen(8194, 9473, this.calcFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
GL11.glTexGen(8195, 9474, this.calcFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
GL11.glEnable(3168);
GL11.glEnable(3169);
GL11.glEnable(3170);
GL11.glEnable(3171);
GL11.glPopMatrix();
GL11.glMatrixMode(5890);
GL11.glPushMatrix();
GL11.glLoadIdentity();
GL11.glTranslatef(
0.0F, (float) (System.currentTimeMillis() % 700000L) / 250000.0F, 0.0F
);
GL11.glScalef(f6, f6, f6);
GL11.glTranslatef(0.5F, 0.5F, 0.0F);
GL11.glRotatef((float) (i * i * 4321 + i * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
GL11.glTranslatef(-pz, -py, -px);
GL11.glTranslatef(
ActiveRenderInfo.objectZ * f5 / f9,
ActiveRenderInfo.objectY * f5 / f9,
-px
);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
f11 = random.nextFloat() * 0.5F + 0.1F;
float f12 = random.nextFloat() * 0.5F + 0.4F;
float f13 = random.nextFloat() * 0.5F + 0.5F;
if (i == 0) {
f13 = 1.0F;
f12 = 1.0F;
f11 = 1.0F;
}
tessellator.setBrightness(180);
tessellator.setColorRGBA_F(f11 * f7, f12 * f7, f13 * f7, 1.0F);
tessellator.addVertex(x + (double) offset, y, z);
tessellator.addVertex(x + (double) offset, y, z + 1.0);
tessellator.addVertex(x + (double) offset, y + 1.0, z + 1.0);
tessellator.addVertex(x + (double) offset, y + 1.0, z);
tessellator.draw();
GL11.glPopMatrix();
GL11.glMatrixMode(5888);
}
GL11.glDisable(3042);
GL11.glDisable(3168);
GL11.glDisable(3169);
GL11.glDisable(3170);
GL11.glDisable(3171);
GL11.glEnable(2896);
}
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
this.drawPlaneZNeg(x, y, z, f);
this.drawPlaneZPos(x, y, z, f);
this.drawPlaneXNeg(x, y, z, f);
this.drawPlaneXPos(x, y, z, f);
}
}

View File

@ -0,0 +1,84 @@
package net.anvilcraft.thaummach.render.tile;
import net.anvilcraft.thaummach.tiles.TileVoidInterface;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public class TileVoidInterfaceRenderer extends TileEntitySpecialRenderer {
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
for (int a = 0; a < 4; ++a) {
float xx = 0.0F;
float zz = 0.0F;
switch (a) {
case 0:
xx = 0.375F;
zz = 0.2F;
break;
case 1:
zz = -0.375F;
xx = 0.2F;
break;
case 2:
xx = -0.375F;
zz = -0.2F;
break;
case 3:
zz = 0.375F;
xx = -0.2F;
}
GL11.glPushMatrix();
GL11.glTranslatef(
(float) x + (float) (a != 2 && a != 3 ? 1 : 0),
(float) y + 0.44F,
(float) z + (float) (a != 1 && a != 2 ? 1 : 0)
);
GL11.glTranslatef(xx, 0.0F, zz);
GL11.glRotatef(90.0F * (float) a, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(90.0F, 1.0f, 0.0f, 0.0f);
GL11.glTranslatef(-0.75f, -0.4f, 0.0f);
GL11.glScalef(-0.25f, 1.0f, -0.25f);
GL11.glPushMatrix();
//ThaumCraftRenderer.renderItemFromTexture(
// ModLoader.getMinecraftInstance(),
// "/thaumcraft/resources/particles.png",
// 8,
// 56 + ((TileVoidInterface) te).network,
// 0.25F,
// 0.0F,
// false,
// 1.0F,
// 1.0F,
// 1.0F,
// 220,
// 1
//);
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(
"thaummach",
"textures/misc/i_" + ((TileVoidInterface) te).network
+ ".png"
));
GL11.glEnable(3042);
GL11.glBlendFunc(770, 1);
Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();
tess.addVertexWithUV(0.0, 0.0, 1.0, 1.0, 0.0);
tess.addVertexWithUV(1.0, 0.0, 1.0, 0.0, 0.0);
tess.addVertexWithUV(1.0, 0.0, 0.0, 0.0, 1.0);
tess.addVertexWithUV(0.0, 0.0, 0.0, 1.0, 1.0);
tess.draw();
GL11.glDisable(3042);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
}
}

View File

@ -6,12 +6,12 @@ import java.util.List;
import java.util.Set;
import dev.tilera.auracore.api.AuraNode;
import dev.tilera.auracore.api.HelperLocation;
import dev.tilera.auracore.aura.AuraManager;
import dev.tilera.auracore.client.FXSparkle;
import dev.tilera.auracore.helper.Utils;
import net.anvilcraft.thaummach.SealData;
import net.anvilcraft.thaummach.RuneTileData;
import net.anvilcraft.thaummach.render.PortalRenderer;
import net.anvilcraft.thaummach.utils.HelperLocation;
import net.anvilcraft.thaummach.utils.UtilsFX;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
@ -52,8 +52,8 @@ import thaumcraft.client.fx.particles.FXScorch;
import thaumcraft.client.fx.particles.FXWisp;
public class TileSeal extends TileEntity {
public static Set<SealData> SEALS = new HashSet<>();
public SealData otherSeal;
public static Set<RuneTileData> SEALS = new HashSet<>();
public RuneTileData otherSeal;
public PortalRenderer renderer;
public int delay = 0;
@ -198,7 +198,7 @@ public class TileSeal extends TileEntity {
return;
}
case 1:
SealData sd = new SealData(this);
RuneTileData sd = new RuneTileData(this);
if (!SEALS.contains(sd)) {
SEALS.add(sd);
this.worldObj.markBlockForUpdate(
@ -1513,11 +1513,11 @@ public class TileSeal extends TileEntity {
}
if (list.size() > 0) {
Iterator<SealData> i$ = SEALS.iterator();
Iterator<RuneTileData> i$ = SEALS.iterator();
boolean fs = false;
label74: {
SealData pd;
RuneTileData pd;
do {
do {
do {
@ -1650,7 +1650,7 @@ public class TileSeal extends TileEntity {
if (this.otherSeal == null) {
return false;
} else {
SealData targetDest = this.otherSeal;
RuneTileData targetDest = this.otherSeal;
TileEntity ts = super.worldObj.getTileEntity(
targetDest.x, targetDest.y, targetDest.z
);
@ -2500,7 +2500,7 @@ public class TileSeal extends TileEntity {
this.runes = nbt.getByteArray("runes");
this.portalWindow = nbt.getInteger("window");
if (nbt.hasKey("other"))
this.otherSeal = SealData.readFromNbt(nbt.getCompoundTag("other"));
this.otherSeal = RuneTileData.readFromNbt(nbt.getCompoundTag("other"));
else
this.otherSeal = null;
}
@ -2540,7 +2540,7 @@ public class TileSeal extends TileEntity {
this.runes = nbt.getByteArray("runes");
this.portalWindow = nbt.getInteger("window");
if (nbt.hasKey("other"))
this.otherSeal = SealData.readFromNbt(nbt.getCompoundTag("other"));
this.otherSeal = RuneTileData.readFromNbt(nbt.getCompoundTag("other"));
else
this.otherSeal = null;
//this.pSize = nbt.getFloat("pSize");
@ -2608,7 +2608,7 @@ public class TileSeal extends TileEntity {
public void invalidate() {
super.invalidate();
if (!this.worldObj.isRemote)
SEALS.remove(new SealData(this));
SEALS.remove(new RuneTileData(this));
else if (this.renderer != null)
this.renderer.deinit();
}

View File

@ -143,7 +143,7 @@ public class TileVoidChest extends TileEntity implements ISidedInventory {
@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
return IntStream.rangeClosed(0, this.vcItemStacks.length - 1).toArray();
return IntStream.range(0, this.vcItemStacks.length).toArray();
}
@Override

View File

@ -0,0 +1,240 @@
package net.anvilcraft.thaummach.tiles;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.IntStream;
import dev.tilera.auracore.api.HelperLocation;
import net.anvilcraft.thaummach.RuneTileData;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
public class TileVoidInterface extends TileEntity implements ISidedInventory {
// TODO: WTF
public static Set<RuneTileData> VOID_INTERFACES = new HashSet<>();
public byte network = 0;
public ArrayList<HelperLocation> links = new ArrayList<>();
public boolean linked = false;
public int current = 0;
public boolean init = false;
public int getLinkedSize() {
return this.links.size();
}
@Override
public int getSizeInventory() {
return Math.max(72, 72 * this.links.size());
}
private IInventory getInventory(HelperLocation v3d) {
TileEntity te = v3d.getFacingTile(this.worldObj);
return te instanceof TileVoidChest ? (IInventory) te : null;
}
@Override
public ItemStack getStackInSlot(int i) {
int inventory = i / 72;
int slot = i % 72;
try {
return this.getInventory(this.links.get(inventory)).getStackInSlot(slot);
} catch (Exception var5) {
return null;
}
}
@Override
public ItemStack getStackInSlotOnClosing(int i) {
int inventory = i / 72;
int slot = i % 72;
return this.getInventory(this.links.get(inventory)).getStackInSlotOnClosing(slot);
}
@Override
public ItemStack decrStackSize(int i, int j) {
int inventory = i / 72;
int slot = i % 72;
return this.getInventory(this.links.get(inventory)).decrStackSize(slot, j);
}
@Override
public void setInventorySlotContents(int i, ItemStack itemstack) {
int inventory = i / 72;
int slot = i % 72;
try {
this.getInventory(this.links.get(inventory))
.setInventorySlotContents(slot, itemstack);
} catch (Exception var6) {}
}
// TODO: WTF
//@Override
//public ItemStack getStackInSlotVirtual(int i) {
// try {
// return this.getInventory(this.links.get(this.current)).getStackInSlot(i %
// 72);
// } catch (Exception var3) {
// return null;
// }
//}
//@Override
//public ItemStack decrStackSizeVirtual(int i, int j) {
// try {
// return this.getInventory(this.links.get(this.current))
// .decrStackSize(i % 72, j);
// } catch (Exception var4) {
// return null;
// }
//}
//@Override
//public void setInventorySlotContentsVirtual(int i, ItemStack itemstack) {
// try {
// this.getInventory(this.links.get(this.current))
// .setInventorySlotContents(i % 72, itemstack);
// } catch (Exception var4) {}
//}
public void establishLinks() {
this.current = 0;
this.links.clear();
ArrayList<RuneTileData> tiles = new ArrayList<>();
for (RuneTileData rtd : VOID_INTERFACES) {
if (rtd.rune == this.network
&& rtd.dim == this.worldObj.provider.dimensionId) {
tiles.add(rtd);
}
}
tiles.sort(
(a, b)
-> Double.compare(
this.getDistanceFrom(a.x, a.y, a.z),
this.getDistanceFrom(b.x, b.y, b.z)
)
);
for (RuneTileData rtd : tiles) {
TileEntity te = this.worldObj.getTileEntity(rtd.x, rtd.y - 1, rtd.z);
if (te instanceof TileVoidChest) {
this.links.add(new HelperLocation(te));
}
}
this.linked = this.links.size() > 1;
}
public void invalidateLinks() {
for (RuneTileData rtd : VOID_INTERFACES) {
if (rtd.rune != this.network)
continue;
TileEntity te = this.worldObj.getTileEntity(rtd.x, rtd.y, rtd.z);
if (!(te instanceof TileVoidInterface)) {
VOID_INTERFACES.remove(rtd);
// TODO: WTF WTF WTF WTF
this.invalidateLinks();
break;
}
if (te != null) {
TileVoidInterface tvi = (TileVoidInterface) te;
tvi.markDirty();
tvi.clearLinks();
}
}
}
public void clearLinks() {
this.current = 0;
this.links.clear();
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
this.network = nbttagcompound.getByte("network");
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
nbttagcompound.setByte("network", this.network);
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public void updateEntity() {
super.updateEntity();
if (!this.init) {
this.init = true;
VOID_INTERFACES.add(new RuneTileData(this, this.network));
}
if (this.links.size() == 0) {
this.establishLinks();
}
}
@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
return true;
}
@Override
public String getInventoryName() {
return "Void Interface";
}
@Override
public boolean hasCustomInventoryName() {
return true;
}
@Override
public void openInventory() {}
@Override
public void closeInventory() {}
@Override
public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
return true;
}
@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
return IntStream.range(0, this.getSizeInventory()).toArray();
}
@Override
public boolean canInsertItem(int slot, ItemStack otherStack, int side) {
ItemStack thisStack = this.getStackInSlot(slot);
return thisStack == null
|| (thisStack.isItemEqual(otherStack)
&& thisStack.stackSize + otherStack.stackSize
<= thisStack.getMaxStackSize());
}
@Override
public boolean canExtractItem(int slot, ItemStack otherStack, int side) {
ItemStack thisStack = this.getStackInSlot(slot);
return thisStack != null && thisStack.isItemEqual(otherStack)
&& thisStack.stackSize >= otherStack.stackSize;
}
}

View File

@ -1,90 +0,0 @@
package net.anvilcraft.thaummach.utils;
public enum HelperFacing {
NEGY,
POSY,
NEGZ,
POSZ,
NEGX,
POSX,
UNKNOWN;
public HelperFacing turnAround() {
switch (this) {
case POSY: {
return HelperFacing.NEGY;
}
case NEGY: {
return HelperFacing.POSY;
}
case POSZ: {
return HelperFacing.NEGZ;
}
case NEGZ: {
return HelperFacing.POSZ;
}
case POSX: {
return HelperFacing.NEGX;
}
case NEGX: {
return HelperFacing.POSX;
}
default: {
return HelperFacing.UNKNOWN;
}
}
}
public HelperFacing turnLeft() {
switch (this) {
case POSY: {
return HelperFacing.POSY;
}
case NEGY: {
return HelperFacing.NEGY;
}
case POSZ: {
return HelperFacing.POSX;
}
case NEGZ: {
return HelperFacing.NEGX;
}
case POSX: {
return HelperFacing.NEGZ;
}
case NEGX: {
return HelperFacing.POSZ;
}
default: {
return HelperFacing.UNKNOWN;
}
}
}
public HelperFacing turnRight() {
switch (this) {
case POSY: {
return HelperFacing.POSY;
}
case NEGY: {
return HelperFacing.NEGY;
}
case POSZ: {
return HelperFacing.NEGX;
}
case NEGZ: {
return HelperFacing.POSX;
}
case POSX: {
return HelperFacing.POSZ;
}
case NEGX: {
return HelperFacing.NEGZ;
}
default: {
return HelperFacing.UNKNOWN;
}
}
}
}

View File

@ -1,253 +0,0 @@
package net.anvilcraft.thaummach.utils;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class HelperLocation {
public double x;
public double y;
public double z;
public HelperFacing facing;
public HelperLocation(final TileEntity tile) {
this.x = tile.xCoord;
this.y = tile.yCoord;
this.z = tile.zCoord;
this.facing = HelperFacing.UNKNOWN;
}
public HelperLocation(final double x, final double y, final double z) {
this.x = x;
this.y = y;
this.z = z;
this.facing = HelperFacing.UNKNOWN;
}
public HelperLocation(
final double x, final double y, final double z, final HelperFacing facing
) {
this.x = x;
this.y = y;
this.z = z;
this.facing = facing;
}
public HelperLocation(final TileEntity te, final HelperFacing facing) {
this.x = te.xCoord;
this.y = te.yCoord;
this.z = te.zCoord;
this.facing = facing;
}
public HelperLocation(final TileEntity te, final int facing) {
this.x = te.xCoord;
this.y = te.yCoord;
this.z = te.zCoord;
switch (facing) {
case 0: {
this.facing = HelperFacing.NEGY;
break;
}
case 1: {
this.facing = HelperFacing.POSY;
break;
}
case 2: {
this.facing = HelperFacing.NEGZ;
break;
}
case 3: {
this.facing = HelperFacing.POSZ;
break;
}
case 4: {
this.facing = HelperFacing.NEGX;
break;
}
case 5: {
this.facing = HelperFacing.POSX;
break;
}
}
}
public HelperLocation(final HelperLocation l) {
this.x = l.x;
this.y = l.y;
this.z = l.z;
this.facing = l.facing;
}
public void moveUp(final double amount) {
switch (this.facing) {
case POSZ:
case NEGZ:
case POSX:
case NEGX: {
this.y += amount;
break;
}
default:
break;
}
}
public void moveDown(final double amount) {
switch (this.facing) {
case POSZ:
case NEGZ:
case POSX:
case NEGX: {
this.y -= amount;
break;
}
default:
break;
}
}
public void moveRight(final double amount) {
switch (this.facing) {
case POSZ: {
this.x -= amount;
break;
}
case NEGZ: {
this.x += amount;
break;
}
case POSX: {
this.z += amount;
break;
}
case NEGX: {
this.z -= amount;
break;
}
default:
break;
}
}
public void moveLeft(final double amount) {
switch (this.facing) {
case POSZ: {
this.x += amount;
break;
}
case NEGZ: {
this.x -= amount;
break;
}
case POSX: {
this.z -= amount;
break;
}
case NEGX: {
this.z += amount;
break;
}
default:
break;
}
}
public void moveForwards(final double amount) {
switch (this.facing) {
case POSY: {
this.y += amount;
break;
}
case NEGY: {
this.y -= amount;
break;
}
case POSZ: {
this.z += amount;
break;
}
case NEGZ: {
this.z -= amount;
break;
}
case POSX: {
this.x += amount;
break;
}
case NEGX: {
this.x -= amount;
break;
}
default:
break;
}
}
public void moveBackwards(final double amount) {
switch (this.facing) {
case POSY: {
this.y -= amount;
break;
}
case NEGY: {
this.y += amount;
break;
}
case POSZ: {
this.z -= amount;
break;
}
case NEGZ: {
this.z += amount;
break;
}
case POSX: {
this.x -= amount;
break;
}
case NEGX: {
this.x += amount;
break;
}
default:
break;
}
}
// TODO: waiting on auracore update
//public TileEntity getConnectableTile(final World w) {
// this.moveForwards(1.0);
// final TileEntity te
// = w.getTileEntity((int) this.x, (int) this.y, (int) this.z);
// if (te instanceof IConnection
// && ((IConnection) te).getConnectable(this.facing.turnAround())) {
// return te;
// }
// return null;
//}
public TileEntity getFacingTile(final World w) {
this.moveForwards(1.0);
final TileEntity te
= w.getTileEntity((int) this.x, (int) this.y, (int) this.z);
if (te != null) {
return te;
}
return null;
}
//public TileEntity getConnectableTile(final IBlockAccess ibc) {
// this.moveForwards(1.0);
// final TileEntity te
// = ibc.getTileEntity((int) this.x, (int) this.y, (int) this.z);
// if (te instanceof IConnection
// && ((IConnection) te).getConnectable(this.facing.turnAround())) {
// return te;
// }
// return null;
//}
public boolean equals(final HelperLocation loc) {
return this.x == loc.x && this.y == loc.y && this.z == loc.z;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB