diff --git a/src/main/java/net/anvilcraft/thaummach/ClientProxy.java b/src/main/java/net/anvilcraft/thaummach/ClientProxy.java index 5619587..6715910 100644 --- a/src/main/java/net/anvilcraft/thaummach/ClientProxy.java +++ b/src/main/java/net/anvilcraft/thaummach/ClientProxy.java @@ -2,9 +2,11 @@ package net.anvilcraft.thaummach; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.registry.GameRegistry; import net.anvilcraft.thaummach.entities.EntitySingularity; import net.anvilcraft.thaummach.render.BlockApparatusRenderer; +import net.anvilcraft.thaummach.render.TileSealRenderer; import net.anvilcraft.thaummach.render.entity.EntitySingularityRenderer; import net.anvilcraft.thaummach.render.tile.TileBoreRenderer; import net.anvilcraft.thaummach.render.tile.TileConduitPumpRenderer; @@ -19,6 +21,7 @@ import net.anvilcraft.thaummach.tiles.TileCrucible; import net.anvilcraft.thaummach.tiles.TileCrystallizer; import net.anvilcraft.thaummach.tiles.TileFilter; import net.anvilcraft.thaummach.tiles.TilePurifier; +import net.anvilcraft.thaummach.tiles.TileSeal; public class ClientProxy extends CommonProxy { @Override @@ -34,6 +37,8 @@ public class ClientProxy extends CommonProxy { RenderingRegistry.registerEntityRenderingHandler( EntitySingularity.class, new EntitySingularityRenderer() ); + + FMLCommonHandler.instance().bus().register(new RenderTicker()); } @Override @@ -55,5 +60,6 @@ public class ClientProxy extends CommonProxy { ClientRegistry.registerTileEntity( TileCrystallizer.class, "crystallizer", new TileCrystallizerRenderer() ); + ClientRegistry.registerTileEntity(TileSeal.class, "seal", new TileSealRenderer()); } } diff --git a/src/main/java/net/anvilcraft/thaummach/CommonProxy.java b/src/main/java/net/anvilcraft/thaummach/CommonProxy.java index 8afca9b..384296b 100644 --- a/src/main/java/net/anvilcraft/thaummach/CommonProxy.java +++ b/src/main/java/net/anvilcraft/thaummach/CommonProxy.java @@ -11,6 +11,7 @@ import net.anvilcraft.thaummach.tiles.TileCrucible; import net.anvilcraft.thaummach.tiles.TileCrystallizer; import net.anvilcraft.thaummach.tiles.TileFilter; import net.anvilcraft.thaummach.tiles.TilePurifier; +import net.anvilcraft.thaummach.tiles.TileSeal; public class CommonProxy { public void preInit() {} @@ -30,5 +31,6 @@ public class CommonProxy { GameRegistry.registerTileEntity(TileCrystallizer.class, "crystallizer"); GameRegistry.registerTileEntity(TileFilter.class, "filter"); GameRegistry.registerTileEntity(TilePurifier.class, "purifier"); + GameRegistry.registerTileEntity(TileSeal.class, "seal"); } } diff --git a/src/main/java/net/anvilcraft/thaummach/RenderTicker.java b/src/main/java/net/anvilcraft/thaummach/RenderTicker.java new file mode 100644 index 0000000..7e97a4a --- /dev/null +++ b/src/main/java/net/anvilcraft/thaummach/RenderTicker.java @@ -0,0 +1,19 @@ +package net.anvilcraft.thaummach; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent; +import net.anvilcraft.thaummach.render.PortalRenderer; +import net.minecraft.client.Minecraft; + +public class RenderTicker { + @SubscribeEvent + public void onRenderTickEvent(RenderTickEvent ev) { + if (Minecraft.getMinecraft().theWorld == null) + return; + + for (PortalRenderer ren : PortalRenderer.INSTANCES) { + // TODO: optimize + ren.createPortalView(); + } + } +} diff --git a/src/main/java/net/anvilcraft/thaummach/SealData.java b/src/main/java/net/anvilcraft/thaummach/SealData.java new file mode 100644 index 0000000..ed15820 --- /dev/null +++ b/src/main/java/net/anvilcraft/thaummach/SealData.java @@ -0,0 +1,88 @@ +package net.anvilcraft.thaummach; + +import net.anvilcraft.thaummach.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"); + self.orientation = nbt.getShort("orientation"); + self.rune = nbt.getByte("rune"); + + 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; + } +} diff --git a/src/main/java/net/anvilcraft/thaummach/TMBlocks.java b/src/main/java/net/anvilcraft/thaummach/TMBlocks.java index 1c410a3..b27a772 100644 --- a/src/main/java/net/anvilcraft/thaummach/TMBlocks.java +++ b/src/main/java/net/anvilcraft/thaummach/TMBlocks.java @@ -3,19 +3,28 @@ package net.anvilcraft.thaummach; import cpw.mods.fml.common.registry.GameRegistry; import net.anvilcraft.thaummach.blocks.BlockApparatusFragile; import net.anvilcraft.thaummach.blocks.BlockApparatusMetal; +import net.anvilcraft.thaummach.blocks.BlockSeal; import net.anvilcraft.thaummach.items.ItemBlockApparatusFragile; import net.anvilcraft.thaummach.items.ItemBlockApparatusMetal; +import net.anvilcraft.thaummach.items.ItemSeal; import net.minecraft.block.Block; public class TMBlocks { public static Block apparatusFragile; public static Block apparatusMetal; + public static Block seal; public static void init() { apparatusFragile = new BlockApparatusFragile(); apparatusMetal = new BlockApparatusMetal(); + seal = new BlockSeal(); - GameRegistry.registerBlock(apparatusFragile, ItemBlockApparatusFragile.class, "apparatus_fragile"); - GameRegistry.registerBlock(apparatusMetal, ItemBlockApparatusMetal.class, "apparatus_metal"); + GameRegistry.registerBlock( + apparatusFragile, ItemBlockApparatusFragile.class, "apparatus_fragile" + ); + GameRegistry.registerBlock( + apparatusMetal, ItemBlockApparatusMetal.class, "apparatus_metal" + ); + GameRegistry.registerBlock(seal, ItemSeal.class, "seal"); } } diff --git a/src/main/java/net/anvilcraft/thaummach/TMItems.java b/src/main/java/net/anvilcraft/thaummach/TMItems.java index 363d35a..54b3fcb 100644 --- a/src/main/java/net/anvilcraft/thaummach/TMItems.java +++ b/src/main/java/net/anvilcraft/thaummach/TMItems.java @@ -2,6 +2,7 @@ package net.anvilcraft.thaummach; import cpw.mods.fml.common.registry.GameRegistry; import net.anvilcraft.thaummach.items.ItemFocus; +import net.anvilcraft.thaummach.items.ItemRunicEssence; import net.anvilcraft.thaummach.items.ItemSingularity; import net.minecraft.item.Item; @@ -11,6 +12,7 @@ public class TMItems { public static Item focus2; public static Item focus3; public static Item focus4; + public static Item runicEssence; public static Item singularity; public static void init() { @@ -20,6 +22,8 @@ public class TMItems { focus3 = new ItemFocus(3); focus4 = new ItemFocus(4); + runicEssence = new ItemRunicEssence(); + singularity = new ItemSingularity(); GameRegistry.registerItem(focus0, "focus0"); @@ -28,6 +32,8 @@ public class TMItems { GameRegistry.registerItem(focus3, "focus3"); GameRegistry.registerItem(focus4, "focus4"); + GameRegistry.registerItem(runicEssence, "runicEssence"); + GameRegistry.registerItem(singularity, "singularity"); } } diff --git a/src/main/java/net/anvilcraft/thaummach/blocks/BlockSeal.java b/src/main/java/net/anvilcraft/thaummach/blocks/BlockSeal.java new file mode 100644 index 0000000..3f088ca --- /dev/null +++ b/src/main/java/net/anvilcraft/thaummach/blocks/BlockSeal.java @@ -0,0 +1,263 @@ +package net.anvilcraft.thaummach.blocks; + +import net.anvilcraft.thaummach.TMTab; +import net.anvilcraft.thaummach.tiles.TileSeal; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class BlockSeal extends BlockContainer { + public BlockSeal() { + super(Material.rock); + this.setHardness(0.5F); + this.setResistance(15.0F); + this.setStepSound(Block.soundTypeStone); + this.setBlockName("thaummach:seal"); + this.setCreativeTab(TMTab.INSTANCE); + } + + @Override + public void registerBlockIcons(IIconRegister ir) { + // TODO: add texture for this + this.blockIcon = ir.registerIcon("thaummach:seal"); + } + + @Override + public boolean onBlockActivated( + World world, + int i, + int j, + int k, + EntityPlayer entityplayer, + // useless parameters + int alec1, + float alec2, + float alec3, + float alec4 + ) { + TileEntity te = world.getTileEntity(i, j, k); + if (te != null && ((TileSeal) te).runes[0] == 0 + && ((TileSeal) te).runes[1] == 1) { + ++((TileSeal) te).portalWindow; + world.playSoundEffect( + (double) i + 0.5, + (double) j + 0.5, + (double) k + 0.5, + "thaummach:pclose", + 0.2F, + 1.0F + world.rand.nextFloat() * 0.2F + ); + return true; + } + return false; + } + + @Override + public int getRenderType() { + return -1; + } + + @Override + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { + TileEntity te = world.getTileEntity(x, y, z); + int l = 1; + if (te != null && te instanceof TileSeal) { + l = ((TileSeal) te).orientation; + } + + float thickness = 0.0625F; + if (l == 0) { + this.setBlockBounds(0.3F, 1.0F - thickness, 0.3F, 0.7F, 1.0F, 0.7F); + } + + if (l == 1) { + this.setBlockBounds(0.3F, 0.0F, 0.3F, 0.7F, thickness, 0.7F); + } + + if (l == 2) { + this.setBlockBounds(0.3F, 0.3F, 1.0F - thickness, 0.7F, 0.7F, 1.0F); + } + + if (l == 3) { + this.setBlockBounds(0.3F, 0.3F, 0.0F, 0.7F, 0.7F, thickness); + } + + if (l == 4) { + this.setBlockBounds(1.0F - thickness, 0.3F, 0.3F, 1.0F, 0.7F, 0.7F); + } + + if (l == 5) { + this.setBlockBounds(0.0F, 0.3F, 0.3F, thickness, 0.7F, 0.7F); + } + } + + @Override + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { + return new TileSeal(); + } + + @Override + public TileEntity createTileEntity(World world, int metadata) { + return this.createNewTileEntity(world, metadata); + } + + @Override + public void setBlockBoundsForItemRender() { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + @Override + public boolean + isSideSolid(IBlockAccess world, int i, int j, int k, ForgeDirection side) { + //int md = world.getBlockMetadata(i, j, k); + //return md != 0 && md != 3 && md != 4 && md != 7; + return false; + } + + @Override + public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l) { + if (l == 0 && world.isSideSolid(i, j + 1, k, ForgeDirection.DOWN)) { + return true; + } else if (l == 1 && world.isSideSolid(i, j - 1, k, ForgeDirection.UP)) { + return true; + } else if (l == 2 && world.isSideSolid(i, j, k + 1, ForgeDirection.NORTH)) { + return true; + } else if (l == 3 && world.isSideSolid(i, j, k - 1, ForgeDirection.SOUTH)) { + return true; + } else if (l == 4 && world.isSideSolid(i + 1, j, k, ForgeDirection.EAST)) { + return true; + } else { + return l == 5 && world.isSideSolid(i - 1, j, k, ForgeDirection.WEST); + } + } + + @Override + public boolean canPlaceBlockAt(World world, int i, int j, int k) { + if (world.isSideSolid(i - 1, j, k, ForgeDirection.EAST)) { + return true; + } else if (world.isSideSolid(i + 1, j, k, ForgeDirection.WEST)) { + return true; + } else if (world.isSideSolid(i, j, k - 1, ForgeDirection.SOUTH)) { + return true; + } else if (world.isSideSolid(i, j, k + 1, ForgeDirection.NORTH)) { + return true; + } else { + return world.isSideSolid(i, j - 1, k, ForgeDirection.UP) + ? true + : world.isSideSolid(i, j + 1, k, ForgeDirection.DOWN); + } + } + + @Override + public void onPostBlockPlaced( + World world, + int x, + int y, + int z, + int l + ) { + int orientation = -1; + if (world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) { + orientation = 0; + } else if (world.isSideSolid(x, y - 1, z, ForgeDirection.UP)) { + orientation = 1; + } else if (world.isSideSolid(x, y, z + 1, ForgeDirection.NORTH)) { + orientation = 2; + } else if (world.isSideSolid(x, y, z - 1, ForgeDirection.SOUTH)) { + orientation = 3; + } else if (world.isSideSolid(x + 1, y, z, ForgeDirection.WEST)) { + orientation = 4; + } else if (world.isSideSolid(x - 1, y, z, ForgeDirection.EAST)) { + orientation = 5; + } + + TileSeal ts = (TileSeal) world.getTileEntity(x, y, z); + ts.orientation = (short) orientation; + } + + @Override + public boolean canProvidePower() { + return true; + } + + @Override + public int + isProvidingStrongPower(IBlockAccess iblockaccess, int i, int j, int k, int meta) { + TileSeal ts = (TileSeal) iblockaccess.getTileEntity(i, j, k); + if (ts != null) { + return ts.isPowering ? 15 : 0; + } + + return 0; + } + + @Override + public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int meta) { + return this.isProvidingStrongPower(world, x, y, z, meta); + } + + private boolean checkIfAttachedToBlock(World world, int i, int j, int k) { + if (!this.canPlaceBlockAt(world, i, j, k)) { + this.dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k), 0); + world.setBlockToAir(i, j, k); + return false; + } else { + return true; + } + } + + @Override + public void onNeighborBlockChange(World world, int i, int j, int k, Block l) { + super.onNeighborBlockChange(world, i, j, k, l); + if (this.checkIfAttachedToBlock(world, i, j, k)) { + TileSeal tes = (TileSeal) world.getTileEntity(i, j, k); + if (tes != null) { + int i1 = tes.orientation; + boolean flag = false; + if (!world.isSideSolid(i - 1, j, k, ForgeDirection.EAST) && i1 == 5) { + flag = true; + } + + if (!world.isSideSolid(i + 1, j, k, ForgeDirection.WEST) && i1 == 4) { + flag = true; + } + + if (!world.isSideSolid(i, j, k - 1, ForgeDirection.SOUTH) && i1 == 3) { + flag = true; + } + + if (!world.isSideSolid(i, j, k + 1, ForgeDirection.NORTH) && i1 == 2) { + flag = true; + } + + if (!world.isSideSolid(i, j - 1, k, ForgeDirection.UP) && i1 == 1) { + flag = true; + } + + if (!world.isSideSolid(i, j + 1, k, ForgeDirection.DOWN) && i1 == 0) { + flag = true; + } + + if (flag) { + world.setBlockToAir(i, j, k); + } + } + } + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } +} diff --git a/src/main/java/net/anvilcraft/thaummach/items/ItemRunicEssence.java b/src/main/java/net/anvilcraft/thaummach/items/ItemRunicEssence.java new file mode 100644 index 0000000..3cfe0f0 --- /dev/null +++ b/src/main/java/net/anvilcraft/thaummach/items/ItemRunicEssence.java @@ -0,0 +1,112 @@ +package net.anvilcraft.thaummach.items; + +import java.util.List; + +import net.anvilcraft.thaummach.TMBlocks; +import net.anvilcraft.thaummach.TMTab; +import net.anvilcraft.thaummach.tiles.TileSeal; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +public class ItemRunicEssence extends Item { + private IIcon[] icons = new IIcon[6]; + + public ItemRunicEssence() { + super(); + super.maxStackSize = 16; + this.setHasSubtypes(true); + this.setMaxDamage(0); + this.setCreativeTab(TMTab.INSTANCE); + } + + @Override + public void registerIcons(IIconRegister reg) { + for (int i = 0; i < 6; i++) { + this.icons[i] = reg.registerIcon("thaummach:runic_essence_" + i); + } + } + + @Override + public void getSubItems(Item p_150895_1_, CreativeTabs p_150895_2_, List l) { + for (int i = 0; i < 6; i++) { + l.add(new ItemStack(this, 1, i)); + } + } + + @Override + public IIcon getIconFromDamage(int meta) { + return this.icons[meta]; + } + + @Override + public IIcon getIcon(ItemStack stack, int pass) { + return this.getIconFromDamage(stack.getItemDamage()); + } + + @Override + public String getUnlocalizedName(ItemStack is) { + return "thaummach:runic_essence." + is.getItemDamage(); + } + + @Override + public boolean onItemUseFirst( + ItemStack itemstack, + EntityPlayer player, + World world, + int i, + int j, + int k, + int l, + // useless parameters + float alec1, + float alec2, + float alec3 + ) { + Block bi = world.getBlock(i, j, k); + if (itemstack.stackSize == 0) { + return false; + } else { + if (bi == TMBlocks.seal) { + TileSeal ts = (TileSeal) world.getTileEntity(i, j, k); + if (ts != null) { + boolean added = false; + int addPitch = 0; + + for (int q = 0; q < 3; ++q) { + if (ts.runes[q] == -1) { + ts.runes[q] = (byte) itemstack.getItemDamage(); + added = true; + addPitch = ts.runes[q]; + ts.delay = 60; + + break; + } + } + + if (added) { + world.playSoundEffect( + (double) ((float) i + 0.5F), + (double) ((float) j + 0.5F), + (double) ((float) k + 0.5F), + "thaumcraft:rune_set", + 0.5F, + 1.2F - (float) addPitch * 0.075F + ); + --itemstack.stackSize; + return true; + } + } + } + + return super.onItemUseFirst( + itemstack, player, world, i, j, k, l, alec1, alec2, alec3 + ); + } + } +} diff --git a/src/main/java/net/anvilcraft/thaummach/items/ItemSeal.java b/src/main/java/net/anvilcraft/thaummach/items/ItemSeal.java new file mode 100644 index 0000000..0a7540b --- /dev/null +++ b/src/main/java/net/anvilcraft/thaummach/items/ItemSeal.java @@ -0,0 +1,14 @@ +package net.anvilcraft.thaummach.items; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; + +public class ItemSeal extends ItemBlock { + public ItemSeal(Block b) { + super(b); + super.maxStackSize = 16; + this.setHasSubtypes(true); + this.setMaxDamage(0); + this.setUnlocalizedName("thaummach:seal"); + } +} diff --git a/src/main/java/net/anvilcraft/thaummach/render/PortalRenderer.java b/src/main/java/net/anvilcraft/thaummach/render/PortalRenderer.java new file mode 100644 index 0000000..8bde86a --- /dev/null +++ b/src/main/java/net/anvilcraft/thaummach/render/PortalRenderer.java @@ -0,0 +1,196 @@ +package net.anvilcraft.thaummach.render; + +import java.nio.ByteBuffer; +import java.util.HashSet; +import java.util.Set; + +import net.anvilcraft.thaummach.SealData; +import net.anvilcraft.thaummach.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.IChatComponent; +import org.lwjgl.opengl.EXTFramebufferObject; +import org.lwjgl.opengl.GL11; + +public class PortalRenderer { + public static Set INSTANCES = new HashSet<>(); + + public int portalTexture; + public int depthRenderBuffer; + public int frameBuffer; + public TileSeal seal; + + public PortalRenderer(TileSeal seal) { + this.frameBuffer = EXTFramebufferObject.glGenFramebuffersEXT(); + this.portalTexture = GL11.glGenTextures(); + this.depthRenderBuffer = EXTFramebufferObject.glGenRenderbuffersEXT(); + 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() { + // TODO: WTF + //GL11.glDeleteFramebuffers(this.frameBuffer); + GL11.glDeleteTextures(this.portalTexture); + INSTANCES.remove(this); + } + + public void createPortalView() { + if (this.seal.otherSeal == null) + return; + + 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); + + // TODO: stencils aren't stenciling + GL11.glEnable(2960); + GL11.glStencilFunc(519, 1, 1); + GL11.glStencilOp(7680, 7680, 7681); + GL11.glViewport(0, 0, 512, 512); + GL11.glMatrixMode(5889); + GL11.glLoadIdentity(); + GL11.glMatrixMode(5888); + 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) { + double aa = 6.283185307179586 * (double) 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; + final float fov = mc.gameSettings.fovSetting; + final int width = mc.displayWidth; + final int height = mc.displayHeight; + int tpv = mc.gameSettings.thirdPersonView; + mc.displayWidth = 512; + 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(); + } +} diff --git a/src/main/java/net/anvilcraft/thaummach/render/TileSealRenderer.java b/src/main/java/net/anvilcraft/thaummach/render/TileSealRenderer.java new file mode 100644 index 0000000..622eeef --- /dev/null +++ b/src/main/java/net/anvilcraft/thaummach/render/TileSealRenderer.java @@ -0,0 +1,236 @@ +package net.anvilcraft.thaummach.render; + +import net.anvilcraft.thaummach.TMBlocks; +import net.anvilcraft.thaummach.tiles.TileSeal; +import net.anvilcraft.thaummach.utils.UtilsFX; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +public class TileSealRenderer extends TileEntitySpecialRenderer { + private float bob = 0.0F; + private int count = 0; + private static int[] colors + = new int[] { 13532671, 16777088, 8421631, 8454016, 16744576, 4194368 }; + + private void translateFromOrientation(double x, double y, double z, int orientation) { + GL11.glPushMatrix(); + if (orientation == 0) { + GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F); + GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); + } else if (orientation == 1) { + GL11.glTranslatef((float) x, (float) y, (float) z); + GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); + } else if (orientation == 2) { + GL11.glTranslatef((float) x, (float) y, (float) z + 1.0F); + } else if (orientation == 3) { + GL11.glTranslatef((float) x + 1.0F, (float) y, (float) z); + GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); + } else if (orientation == 4) { + GL11.glTranslatef((float) x + 1.0F, (float) y, (float) z + 1.0F); + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + } else if (orientation == 5) { + GL11.glTranslatef((float) x, (float) y, (float) z); + GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); + } + } + + private void drawSeal(float angle, int level, int rune) { + Tessellator tessellator = Tessellator.instance; + GL11.glRotatef(90.0F, -1.0F, 0.0F, 0.0F); + GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(-0.5F, 0.0F, -0.5F); + GL11.glDepthMask(false); + GL11.glEnable(3042); + GL11.glBlendFunc(770, 1); + if (level != 2) { + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation( + "thaummach", "textures/misc/s_" + level + "_" + rune + ".png" + )); + } else { + Minecraft.getMinecraft().getTextureManager().bindTexture( + new ResourceLocation("thaummach", "textures/misc/seal5.png") + ); + } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + tessellator.startDrawingQuads(); + tessellator.setBrightness(220); + if (level == 2) { + tessellator.setColorRGBA_I(colors[rune], 255); + } + + tessellator.addVertexWithUV(0.0, 0.0, 1.0, 0.0, 1.0); + tessellator.addVertexWithUV(1.0, 0.0, 1.0, 1.0, 1.0); + tessellator.addVertexWithUV(1.0, 0.0, 0.0, 1.0, 0.0); + tessellator.addVertexWithUV(0.0, 0.0, 0.0, 0.0, 0.0); + tessellator.draw(); + GL11.glDisable(3042); + GL11.glDepthMask(true); + } + + private void drawPortal(TileSeal seal, float angle, double x, double y, double z) { + Tessellator tessellator = Tessellator.instance; + Minecraft mc = Minecraft.getMinecraft(); + GL11.glDisable(2896); + if (seal.otherSeal != null && seal.renderer != null) { + GL11.glPushMatrix(); + GL11.glDisable(3553); + GL11.glColor4f( + 1.0f, + 1.0f, + 1.0f, + 1.0f + ); + tessellator.setBrightness(220); + GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); + GL11.glScaled( + (double) (seal.pSize / 2.0F), + (double) (seal.pSize / 2.0F), + (double) (seal.pSize / 2.0F) + ); + GL11.glBegin(6); + GL11.glVertex2f(0.0F, 0.0F); + + for (int oh = 0; oh <= 10; ++oh) { + double aa = 6.283185307179586 * (double) oh / 10.0; + GL11.glVertex2f((float) Math.cos(aa), (float) Math.sin(aa)); + } + + GL11.glEnd(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPopMatrix(); + GL11.glEnable(3553); + GL11.glPushMatrix(); + GL11.glDisable(2896); + GL11.glEnable(3042); + GL11.glBlendFunc(770, 771); + GL11.glRotatef(90.0F, 1.0F, 0.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.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, seal.renderer.portalTexture); + tessellator.startDrawingQuads(); + tessellator.setBrightness(220); + 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((double) seal.pSize, 0.0, 0.0, 1.0, 0.0); + tessellator.addVertexWithUV( + (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.draw(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + GL11.glPushMatrix(); + GL11.glRotatef(90.0F, -1.0F, 0.0F, 0.0F); + GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(-seal.pSize, 0.02F, -seal.pSize); + GL11.glDepthMask(false); + GL11.glEnable(3042); + GL11.glBlendFunc(770, 771); + if (seal.otherSeal != null && seal.renderer != null) { + mc.renderEngine.bindTexture( + new ResourceLocation("thaummach", "textures/misc/portal2.png") + ); + } else { + mc.renderEngine.bindTexture( + new ResourceLocation("thaummach", "textures/misc/portal.png") + ); + } + + tessellator.startDrawingQuads(); + tessellator.setBrightness(220); + 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( + (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(0.0, 0.0, 0.0, 0.0, 0.0); + tessellator.draw(); + GL11.glDisable(3042); + GL11.glDepthMask(true); + GL11.glPopMatrix(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glEnable(2896); + } + + public void renderEntityAt(TileSeal seal, double x, double y, double z, float fq) { + int a = this.count % 360; + Minecraft mc = Minecraft.getMinecraft(); + this.translateFromOrientation( + (double) ((float) x), + (double) ((float) y), + (double) ((float) z), + seal.orientation + ); + GL11.glTranslatef(0.33F, 0.33F, -0.01F); + GL11.glScalef(0.33f, 0.33f, 0.33f); + mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + IIcon icon = TMBlocks.seal.getIcon(0, 0); + UtilsFX.renderItemIn2D( + Tessellator.instance, + icon.getMaxU(), + icon.getMinV(), + icon.getMinU(), + icon.getMaxV(), + icon.getIconWidth(), + icon.getIconHeight(), + 0.0625f, + 128 + ); + GL11.glPopMatrix(); + this.translateFromOrientation( + (double) ((float) x), + (double) ((float) y), + (double) ((float) z), + seal.orientation + ); + if (seal.runes[0] != -1) { + GL11.glPushMatrix(); + GL11.glTranslatef(0.5F, 0.5F, -0.02f); + this.drawSeal(180.0F, 0, seal.runes[0]); + GL11.glPopMatrix(); + } + + if (seal.runes[1] != -1) { + GL11.glPushMatrix(); + GL11.glTranslatef(0.5F, 0.5F, -0.03f); + this.drawSeal((float) (-a), 1, seal.runes[1]); + GL11.glPopMatrix(); + } + + if (seal.runes[2] != -1) { + GL11.glPushMatrix(); + GL11.glTranslatef(0.5F, 0.5F, -0.03f - this.bob); + this.drawSeal((float) a, 2, seal.runes[2]); + GL11.glPopMatrix(); + } + + if (seal.runes[0] == 0 && seal.runes[1] == 1 && seal.pSize > 0.0F) { + GL11.glPushMatrix(); + GL11.glTranslatef(0.5F, 0.5F, -seal.pSize / 5.0F); + this.drawPortal(seal, (float) (-a * 4), x, y, z); + GL11.glPopMatrix(); + } + + GL11.glPopMatrix(); + } + + public void + renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + this.count = Minecraft.getMinecraft().thePlayer.ticksExisted; + this.bob = MathHelper.sin((float) this.count / 10.0F) * 0.025F + 0.03F; + this.renderEntityAt((TileSeal) tileentity, d, d1, d2, f); + } +} diff --git a/src/main/java/net/anvilcraft/thaummach/tiles/TileSeal.java b/src/main/java/net/anvilcraft/thaummach/tiles/TileSeal.java new file mode 100644 index 0000000..1ca078b --- /dev/null +++ b/src/main/java/net/anvilcraft/thaummach/tiles/TileSeal.java @@ -0,0 +1,2665 @@ +package net.anvilcraft.thaummach.tiles; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import dev.tilera.auracore.api.AuraNode; +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.render.PortalRenderer; +import net.anvilcraft.thaummach.utils.HelperLocation; +import net.anvilcraft.thaummach.utils.UtilsFX; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IProjectile; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.monster.EntityMob; +import net.minecraft.entity.monster.IMob; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.passive.EntityTameable; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S08PacketPlayerPosLook; +import net.minecraft.network.play.server.S12PacketEntityVelocity; +import net.minecraft.network.play.server.S18PacketEntityTeleport; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import thaumcraft.client.fx.WRVector3; +import thaumcraft.client.fx.bolt.FXLightningBolt; +import thaumcraft.client.fx.particles.FXScorch; +import thaumcraft.client.fx.particles.FXWisp; + +public class TileSeal extends TileEntity { + public static Set SEALS = new HashSet<>(); + public SealData otherSeal; + public PortalRenderer renderer; + + public int delay = 0; + private int soundDelay = 0; + public int portalWindow = 0; + public boolean pOpen = false; + public float pSize = 0.0F; + //private int pDelay = 0; + public boolean worked; + public boolean isPowering = false; + public short orientation = -1; + public byte[] runes = new byte[] { -1, -1, -1 }; + + protected boolean gettingPower() { + return super.worldObj.isBlockIndirectlyGettingPowered( + super.xCoord, super.yCoord, super.zCoord + ) + || super.worldObj.isBlockIndirectlyGettingPowered( + super.xCoord, super.yCoord + 1, super.zCoord + ); + } + + @Override + public void updateEntity() { + if (this.worldObj.isRemote && this.otherSeal != null) { + if (this.renderer == null) + this.renderer = new PortalRenderer(this); + } + + if (this.delay <= 0) { + boolean oldPower = this.isPowering; + this.isPowering = false; + --this.soundDelay; + if (!this.worldObj.isRemote + && (!this.gettingPower() || this.runes[0] == 0 && this.runes[1] == 4)) { + switch (this.runes[0]) { + case 0: + this.magicSeal(); + break; + case 1: + this.airSeal(); + break; + case 2: + this.waterSeal(); + break; + case 3: + this.earthSeal(); + break; + case 4: + this.fireSeal(); + break; + case 5: + this.darkSeal(); + } + } + + if (oldPower != this.isPowering) { + HelperLocation loc = new HelperLocation(this, this.orientation); + + int xx; + int yy; + int zz; + for (xx = -1; xx <= 1; ++xx) { + for (yy = -1; yy <= 1; ++yy) { + for (zz = -1; zz <= 1; ++zz) { + super.worldObj.markBlockForUpdate( + (int) loc.x + xx, (int) loc.y + yy, (int) loc.z + zz + ); + } + } + } + + super.worldObj.notifyBlocksOfNeighborChange( + (int) loc.x, (int) loc.y, (int) loc.z, Blocks.air + ); + loc.moveBackwards(1.0); + + for (xx = -1; xx <= 1; ++xx) { + for (yy = -1; yy <= 1; ++yy) { + for (zz = -1; zz <= 1; ++zz) { + super.worldObj.markBlockForUpdate( + (int) loc.x + xx, (int) loc.y + yy, (int) loc.z + zz + ); + } + } + } + + super.worldObj.notifyBlocksOfNeighborChange( + (int) loc.x, (int) loc.y, (int) loc.z, Blocks.air + ); + } + } + + if (this.delay > 0) { + --this.delay; + } + + if (this.pOpen && (double) this.pSize < 1.4) { + this.pSize += 0.15F; + } + + if (!this.pOpen && this.pSize > 0.0F || this.delay > 0 && this.pSize > 0.0F) { + this.pSize -= 0.25F; + } + + if ((double) this.pSize > 1.4) { + this.pSize = 1.4F; + } + + if (this.pSize < 0.0F) { + this.pSize = 0.0F; + } + } + + @Override + public boolean canUpdate() { + return true; + } + + private void magicSeal() { + switch (this.runes[1]) { + case -1: + this.magicBoost(); + this.delay = 20; + break; + case 0: + switch (this.runes[2]) { + case -1: + this.magicBoost(); + this.delay = 15; + return; + case 0: + this.magicBoost(); + this.delay = 10; + return; + case 1: + case 2: + case 3: + case 4: + case 5: + default: + return; + } + case 1: + SealData sd = new SealData(this); + if (!SEALS.contains(sd)) { + SEALS.add(sd); + this.worldObj.markBlockForUpdate( + this.xCoord, this.yCoord, this.zCoord + ); + } + + this.handlePortals(); + break; + case 2: + switch (this.runes[2]) { + case -1: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + default: + return; + } + case 3: + switch (this.runes[2]) { + case -1: + if (this.worldObj.isRemote) { + FXSparkle ef = new FXSparkle( + super.worldObj, + (double) this.sealX(false), + (double) this.sealY(false), + (double) this.sealZ(false), + (double + ) ((float) super.xCoord + super.worldObj.rand.nextFloat() + ), + (double + ) ((float) super.yCoord + super.worldObj.rand.nextFloat() + ), + (double + ) ((float) super.zCoord + super.worldObj.rand.nextFloat() + ), + 1.0F, + super.worldObj.rand.nextBoolean() ? 0 : 3, + 4 + ); + Minecraft.getMinecraft().effectRenderer.addEffect(ef); + this.delay = 5; + } + return; + case 3: + FXSparkle ef2 = new FXSparkle( + super.worldObj, + (double) this.sealX(false), + (double) this.sealY(false), + (double) this.sealZ(false), + (double + ) ((float) super.xCoord + super.worldObj.rand.nextFloat()), + (double + ) ((float) super.yCoord + super.worldObj.rand.nextFloat()), + (double + ) ((float) super.zCoord + super.worldObj.rand.nextFloat()), + 1.0F, + super.worldObj.rand.nextBoolean() ? 0 : 3, + 4 + ); + Minecraft.getMinecraft().effectRenderer.addEffect(ef2); + this.delay = 5; + return; + default: + return; + } + case 4: + switch (this.runes[2]) { + case -1: + this.scan(3, true, true, true, true); + break; + case 0: + this.scan(6, false, true, false, false); + break; + case 1: + this.scan(9, true, true, true, true); + case 2: + default: + break; + case 3: + this.scan(6, false, false, true, false); + break; + case 4: + this.scan(6, true, false, false, false); + break; + case 5: + this.scan(6, false, false, false, true); + } + + this.delay = 5; + case 5: + } + } + + private void airSeal() { + switch (this.runes[1]) { + case -1: + this.pushEntity(false, true, true, 3, 0.03F); + this.delay = 2; + break; + case 0: + switch (this.runes[2]) { + case -1: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + default: + return; + } + case 1: + switch (this.runes[2]) { + case -1: + this.pushEntity(false, true, true, 5, 0.06F); + break; + case 0: + this.pushEntity(false, true, false, 7, 0.08F); + break; + case 1: + this.pushEntity(false, true, true, 7, 0.08F); + case 2: + case 4: + case 5: + default: + break; + case 3: + this.pushEntity(false, false, true, 7, 0.08F); + } + + this.delay = 2; + break; + case 2: + switch (this.runes[2]) { + case -1: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + default: + return; + } + case 3: + switch (this.runes[2]) { + case -1: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + default: + return; + } + case 4: + this.shock(); + this.delay = 8 + super.worldObj.rand.nextInt(3) - this.runeAmount(1) * 2; + break; + case 5: + label86: + switch (this.runes[2]) { + case -1: + this.pushEntity(true, true, true, 5, 0.06F); + break; + case 0: + this.pushEntity(true, true, false, 7, 0.08F); + break; + case 1: + this.pushEntity(true, true, true, 7, 0.08F); + case 2: + default: + break; + case 3: + this.pushEntity(true, false, true, 7, 0.08F); + break; + case 4: + this.pushEntity(true, true, true, 6, 0.07F); + List list = this.getEntities( + super.worldObj, 0.0F, this.orientation, false + ); + int a = 0; + + while (true) { + if (a >= list.size()) { + break label86; + } + + Entity entity = (Entity) list.get(a); + if (!(entity instanceof EntityPlayer) + /*&& !(entity instanceof EntityTravelingTrunk)*/) { + entity.attackEntityFrom(DamageSource.generic, 1); + net.anvilcraft.thaummach.utils.UtilsFX.poof( + super.worldObj, + (float) entity.posX - 0.5F, + (float) entity.posY - 0.5F + entity.getEyeHeight(), + (float) entity.posZ - 0.5F + ); + super.worldObj.playSoundEffect( + (double) super.xCoord, + (double) super.yCoord, + (double) super.zCoord, + // TODO: 99% wrong sound ID + "random.fizz", + 0.5F, + 2.0F + super.worldObj.rand.nextFloat() * 0.4F + ); + } + + ++a; + } + case 5: + this.pushEntity(true, false, true, 6, 0.04F); + List list2 = this.getEntities( + super.worldObj, 0.2F, this.orientation, false + ); + + for (int b = 0; b < list2.size(); ++b) { + Entity entity = (Entity) list2.get(b); + if (entity instanceof EntityItem) { + this.attemptItemPickup((EntityItem) entity); + } + } + } + + this.delay = 2; + } + } + + private void waterSeal() { + switch (this.runes[1]) { + case -1: + this.hydrate(3); + this.delay = 20; + break; + case 0: + switch (this.runes[2]) { + case -1: + this.heal(3, true, true, true, false); + this.delay = 20; + return; + case 0: + this.heal(5, false, false, true, false); + this.delay = 20; + return; + case 1: + this.heal(5, true, true, true, false); + this.delay = 10; + return; + case 2: + this.heal(5, true, true, true, true); + this.delay = 20; + return; + case 3: + this.heal(5, false, true, false, false); + this.delay = 20; + return; + case 4: + this.heal(5, true, true, true, false); + this.delay = 20; + return; + case 5: + this.heal(5, true, false, false, false); + this.delay = 20; + return; + default: + return; + } + case 1: + switch (this.runes[2]) { + case -1: + this.freeze(6, true, true, false); + return; + case 0: + this.freeze(10, true, false, false); + return; + case 1: + this.freeze(10, true, true, false); + return; + case 2: + this.freeze(15, true, false, false); + return; + case 3: + this.freeze(10, false, true, false); + return; + case 4: + this.freeze(10, true, true, false); + return; + case 5: + this.freeze(10, false, false, true); + return; + default: + return; + } + case 2: + switch (this.runes[2]) { + case -1: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + default: + return; + } + case 3: + switch (this.runes[2]) { + case -1: + this.fertilize(3); + this.delay = 30; + return; + case 0: + case 2: + case 4: + case 5: + default: + return; + case 1: + this.fertilize(3); + this.delay = 15; + return; + case 3: + this.fertilize(6); + this.delay = 30; + return; + } + case 4: + switch (this.runes[2]) { + case -1: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + default: + return; + } + case 5: + switch (this.runes[2]) { + case -1: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + } + } + } + + private void earthSeal() { + switch (this.runes[1]) { + case -1: + this.till(3); + this.delay = 20; + break; + case 0: + switch (this.runes[2]) { + case -1: + //this.replant(6); + this.delay = 40; + return; + case 0: + case 2: + case 4: + case 5: + default: + return; + case 1: + //this.replant(6); + this.delay = 20; + return; + case 3: + //this.replant(12); + this.delay = 40; + return; + } + case 1: + switch (this.runes[2]) { + case -1: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + default: + return; + } + case 2: + switch (this.runes[2]) { + case -1: + this.harvest(3); + this.delay = 20; + return; + case 0: + case 2: + case 4: + case 5: + default: + return; + case 1: + this.harvest(3); + this.delay = 10; + return; + case 3: + this.harvest(6); + this.delay = 20; + return; + } + case 3: + switch (this.runes[2]) { + case -1: + this.till(3); + this.delay = 20; + return; + case 0: + case 2: + case 4: + case 5: + default: + return; + case 1: + this.till(3); + this.delay = 10; + return; + case 3: + this.till(6); + this.delay = 20; + return; + } + case 4: + switch (this.runes[2]) { + case -1: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + default: + return; + } + case 5: + switch (this.runes[2]) { + case -1: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + } + } + } + + private void fireSeal() { + switch (this.runes[1]) { + case -1: + this.scorch(4, 1, true, true, false); + break; + case 0: + switch (this.runes[2]) { + case -1: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + default: + return; + } + case 1: + switch (this.runes[2]) { + case -1: + this.beam(6, 1, true, false, true, false, 6.0F, 2.0F); + this.delay = 5; + return; + case 0: + case 2: + case 3: + case 5: + default: + return; + case 1: + this.beam(9, 2, true, true, true, false, 9.0F, 2.0F); + this.delay = 5; + return; + case 4: + this.beam(9, 3, true, false, true, true, 9.0F, 3.0F); + this.delay = 5; + return; + } + case 2: + switch (this.runes[2]) { + case -1: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + default: + return; + } + case 3: + switch (this.runes[2]) { + case -1: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + default: + return; + } + case 4: + switch (this.runes[2]) { + case -1: + this.scorch(5, 2, true, true, false); + return; + case 0: + this.scorch(7, 3, true, false, false); + return; + case 1: + this.scorch(8, 3, true, true, false); + return; + case 2: + this.scorch(6, 6, true, true, false); + return; + case 3: + this.scorch(7, 3, false, true, false); + return; + case 4: + this.scorch(7, 3, true, true, false); + return; + case 5: + this.scorch(7, 3, false, false, true); + return; + default: + return; + } + case 5: + switch (this.runes[2]) { + case -1: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + } + } + } + + private void darkSeal() { + switch (this.runes[1]) { + case -1: + default: + break; + case 0: + switch (this.runes[2]) { + case -1: + this.nullifyAura(); + this.delay = 100; + return; + case 0: + this.nullifyAura(); + this.delay = 80; + return; + case 1: + case 2: + case 3: + case 4: + case 5: + default: + return; + } + case 1: + switch (this.runes[2]) { + case -1: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + default: + return; + } + case 2: + switch (this.runes[2]) { + case -1: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + default: + return; + } + case 3: + switch (this.runes[2]) { + case -1: + this.preventSpawn(6); + return; + case 0: + case 1: + case 2: + case 4: + case 5: + default: + return; + case 3: + this.preventSpawn(12); + return; + } + case 4: + switch (this.runes[2]) { + case -1: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + default: + return; + } + case 5: + switch (this.runes[2]) { + case -1: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + } + } + } + + private void nullifyAura() { + if (super.worldObj.isRemote) + return; + + int nodeId = AuraManager.getClosestAuraWithinRange( + super.worldObj, super.xCoord, super.yCoord, super.zCoord, 512 + ); + + if (nodeId < 0) + return; + + AuraNode node = AuraManager.getNode(nodeId); + + if (node.level > 0 /* && node.taint > 0*/) { + AuraManager.addRandomFlux(super.worldObj, node, 1); + AuraManager.queueNodeChanges(nodeId, -1, 0, false, null, 0, 0, 0); + + FXSparkle ef = new FXSparkle( + super.worldObj, + (double) ((float) super.xCoord + super.worldObj.rand.nextFloat()), + (double) ((float) super.yCoord + super.worldObj.rand.nextFloat()), + (double) ((float) super.zCoord + super.worldObj.rand.nextFloat()), + 2.0F, + 5, + 5 + ); + Minecraft.getMinecraft().effectRenderer.addEffect(ef); + } + } + + private void preventSpawn(int range) { + List list + = this.getEntitiesSorted(super.worldObj, range, this.orientation, true); + + for (int a = 0; a < list.size(); ++a) { + Entity entity = (Entity) list.get(a); + if (entity instanceof EntityMob && ((EntityMob) entity).ticksExisted < 5) { + entity.setDead(); + } + } + } + + private boolean + scan(int range, boolean items, boolean mobs, boolean animals, boolean pvp) { + if (super.worldObj.isRemote) + return false; + + boolean foundsomething = false; + List list + = this.getEntitiesSorted(super.worldObj, range, this.orientation, true); + + int q; + for (q = 0; q < list.size(); ++q) { + Entity entity = (Entity) list.get(q); + if (items && entity instanceof EntityItem + || animals && entity instanceof EntityAnimal + || mobs && (entity instanceof EntityMob || entity instanceof IMob) + || pvp && entity instanceof EntityPlayer) { + this.worked = true; + foundsomething = true; + break; + } + } + + this.isPowering = foundsomething; + if (foundsomething) { + q = Minecraft.getMinecraft().gameSettings.fancyGraphics ? 6 : 3; + + for (int a = 0; a < q; ++a) { + FXWisp ef = new FXWisp( + super.worldObj, + (double) this.sealX(false), + (double) this.sealY(false), + (double) this.sealZ(false), + (double) ((float) super.xCoord + super.worldObj.rand.nextFloat()), + (double) ((float) super.yCoord + super.worldObj.rand.nextFloat()), + (double) ((float) super.zCoord + super.worldObj.rand.nextFloat()), + 0.1F, + 4 + ); + Minecraft.getMinecraft().effectRenderer.addEffect(ef); + } + } + + return false; + } + + private boolean freeze(int range, boolean mobs, boolean animals, boolean pvp) { + if (super.worldObj.isRemote) + return false; + + boolean didsomething = false; + List list + = this.getEntitiesSorted(super.worldObj, range, this.orientation, true); + + for (int a = 0; a < list.size(); ++a) { + Entity entity = (Entity) list.get(a); + if (entity instanceof EntityLivingBase + && (animals && entity instanceof EntityAnimal + + && !(entity instanceof EntityTameable) + || mobs && (entity instanceof EntityMob || entity instanceof IMob) + || pvp && entity instanceof EntityPlayer)) { + entity.motionX *= 0.05; + entity.motionY *= 0.05; + entity.motionZ *= 0.05; + if (this.runes[2] == 1) { + entity.motionY += 0.05999999865889549; + entity.onGround = false; + } + + // TODO: implement FXFreeze + //for (int repeat = 0; repeat < 3; ++repeat) { + // FXFreeze ef = new FXFreeze( + // super.worldObj, + // this.sealX(false), + // this.sealY(false), + // this.sealZ(false), + // entity + // ); + // ModLoader.getMinecraftInstance().effectRenderer.addEffect(ef); + //} + + this.worked = true; + didsomething = true; + if (this.runes[2] != 4) { + break; + } + } + } + + if (this.soundDelay <= 0 && didsomething) { + super.worldObj.playSoundEffect( + (double) ((float) super.xCoord + 0.5F), + (double) ((float) super.yCoord + 0.5F), + (double) ((float) super.zCoord + 0.5F), + "thaumcraft.wind", + 0.2F, + 0.9F + super.worldObj.rand.nextFloat() * 0.1F + ); + this.soundDelay = 25; + } + + return false; + } + + private boolean fertilize(int range) { + if (super.worldObj.isRemote) + return false; + + int xm = 0; + int xp = 0; + int ym = 0; + int yp = 0; + int zm = 0; + int zp = 0; + + if (this.orientation == 0) { + xm = zm = -range; + zp = range; + xp = range; + ym = -(range * 2); + } else if (this.orientation == 1) { + xm = zm = -range; + zp = range; + xp = range; + yp = range * 2; + } else if (this.orientation == 2) { + xm = ym = -range; + yp = range; + xp = range; + zm = -(range * 2); + } else if (this.orientation == 3) { + xm = ym = -range; + yp = range; + xp = range; + zp = range * 2; + } else if (this.orientation == 4) { + zm = ym = -range; + yp = range; + zp = range; + xm = -(range * 2); + } else if (this.orientation == 5) { + zm = ym = -range; + yp = range; + zp = range; + xp = range * 2; + } + + for (int x = xm; x <= xp; ++x) { + for (int y = ym; y <= yp; ++y) { + for (int z = zm; z <= zp; ++z) { + if (super.worldObj.getBlockLightValue( + super.xCoord + x, super.yCoord + y + 1, super.zCoord + z + ) >= 8 + && super.yCoord + y + 1 <= super.worldObj.getHeight() + && super.yCoord + y - 1 >= 0) { + if (Utils.useBonemealAtLoc( + super.worldObj, + super.xCoord + x, + super.yCoord + y, + super.zCoord + z + )) { + net.anvilcraft.thaummach.utils.UtilsFX.poofUpwards( + super.worldObj, + super.xCoord + x, + super.yCoord + y, + super.zCoord + z, + 3 + ); + } + } + } + } + } + + return false; + } + + private boolean harvest(int range) { + int xm = 0; + int xp = 0; + int ym = 0; + int yp = 0; + int zm = 0; + int zp = 0; + if (this.orientation == 0) { + xm = zm = -range; + zp = range; + xp = range; + ym = -(range * 2); + } else if (this.orientation == 1) { + xm = zm = -range; + zp = range; + xp = range; + yp = range * 2; + } else if (this.orientation == 2) { + xm = ym = -range; + yp = range; + xp = range; + zm = -(range * 2); + } else if (this.orientation == 3) { + xm = ym = -range; + yp = range; + xp = range; + zp = range * 2; + } else if (this.orientation == 4) { + zm = ym = -range; + yp = range; + zp = range; + xm = -(range * 2); + } else if (this.orientation == 5) { + zm = ym = -range; + yp = range; + zp = range; + xp = range * 2; + } + + for (int x = xm; x <= xp; ++x) { + for (int y = ym; y <= yp; ++y) { + for (int z = zm; z <= zp; ++z) { + if (super.yCoord + y + 1 <= super.worldObj.getHeight() + && super.yCoord + y - 1 >= 0) { + // TODO: alter ne + //int cbID = super.worldObj.getBlockId( + // super.xCoord + x, super.yCoord + y, super.zCoord + z + //); + //super.worldObj.getBlockId( + // super.xCoord + x, super.yCoord + y + 1, super.zCoord + z + //); + //int bbID = super.worldObj.getBlockId( + // super.xCoord + x, super.yCoord + y - 1, super.zCoord + z + //); + //TileEntity te = super.worldObj.getBlockTileEntity( + // super.xCoord + x, super.yCoord + y - 1, super.zCoord + z + //); + //if (super.worldObj.rand.nextInt(10) == 0) { + // if (cbID == Block.crops.blockID + // && super.worldObj.getBlockMetadata( + // super.xCoord + x, + // super.yCoord + y, + // super.zCoord + z + // ) == 7 + // || cbID == Block.melon.blockID + // || cbID == Block.tallGrass.blockID + // || cbID == Block.pumpkin.blockID + // || cbID == Block.plantYellow.blockID + // || cbID == Block.plantRed.blockID + // || cbID == flaxId + // && super.worldObj.getBlockMetadata( + // super.xCoord + x, + // super.yCoord + y, + // super.zCoord + z + // ) == 4 + // || cbID == Block.plantRed.blockID + // || cbID == Block.reed.blockID + // && bbID == Block.reed.blockID + // || cbID == Block.cactus.blockID + // && bbID == Block.cactus.blockID) { + // Block.blocksList[cbID].dropBlockAsItem( + // super.worldObj, + // super.xCoord + x, + // super.yCoord + y, + // super.zCoord + z, + // super.worldObj.getBlockMetadata( + // super.xCoord + x, + // super.yCoord + y, + // super.zCoord + z + // ), + // 0 + // ); + // super.worldObj.setBlockWithNotify( + // super.xCoord + x, + // super.yCoord + y, + // super.zCoord + z, + // 0 + // ); + // ThaumCraftCore.poof( + // super.worldObj, + // (float) (super.xCoord + x), + // (float) (super.yCoord + y), + // (float) (super.zCoord + z) + // ); + // this.worked = true; + // return true; + // } + + // if (te != null && te instanceof TECrop) { + // TECrop tec = (TECrop) te; + // if (tec.id != -1 && tec.harvest(false)) { + // ThaumCraftCore.poof( + // super.worldObj, + // (float) (super.xCoord + x), + // (float) (super.yCoord + y), + // (float) (super.zCoord + z) + // ); + // this.worked = true; + // return true; + // } + // } + //} + } + } + } + } + + return false; + } + + private boolean hydrate(int range) { + int xm = 0; + int xp = 0; + int ym = 0; + int yp = 0; + int zm = 0; + int zp = 0; + if (this.orientation == 0) { + xm = zm = -range; + zp = range; + xp = range; + ym = -(range * 2); + } else if (this.orientation == 1) { + xm = zm = -range; + zp = range; + xp = range; + yp = range * 2; + } else if (this.orientation == 2) { + xm = ym = -range; + yp = range; + xp = range; + zm = -(range * 2); + } else if (this.orientation == 3) { + xm = ym = -range; + yp = range; + xp = range; + zp = range * 2; + } else if (this.orientation == 4) { + zm = ym = -range; + yp = range; + zp = range; + xm = -(range * 2); + } else if (this.orientation == 5) { + zm = ym = -range; + yp = range; + zp = range; + xp = range * 2; + } + + for (int x = xm; x <= xp; ++x) { + for (int y = ym; y <= yp; ++y) { + for (int z = zm; z <= zp; ++z) { + if (super.yCoord + y <= super.worldObj.getHeight() + && super.yCoord + y >= 0) { + Block cbID = super.worldObj.getBlock( + super.xCoord + x, super.yCoord + y, super.zCoord + z + ); + int md = super.worldObj.getBlockMetadata( + super.xCoord + x, super.yCoord + y, super.zCoord + z + ); + if (cbID == Blocks.farmland && md != 7 + && super.worldObj.rand.nextInt(10) == 0) { + super.worldObj.setBlockMetadataWithNotify( + super.xCoord + x, super.yCoord + y, super.zCoord + z, 7, 3 + ); + net.anvilcraft.thaummach.utils.UtilsFX.sparkleDown( + super.worldObj, + super.xCoord + x, + super.yCoord + y + 1, + super.zCoord + z, + 2 + ); + this.worked = true; + return true; + } + } + } + } + } + + return false; + } + + // TODO: implement plant stuff + //private boolean replant(int range) { + // int xm = 0; + // int xp = 0; + // int ym = 0; + // int yp = 0; + // int zm = 0; + // int zp = 0; + // if (this.orientation == 0) { + // xm = zm = -range; + // zp = range; + // xp = range; + // ym = -(range * 2); + // } else if (this.orientation == 1) { + // xm = zm = -range; + // zp = range; + // xp = range; + // yp = range * 2; + // } else if (this.orientation == 2) { + // xm = ym = -range; + // yp = range; + // xp = range; + // zm = -(range * 2); + // } else if (this.orientation == 3) { + // xm = ym = -range; + // yp = range; + // xp = range; + // zp = range * 2; + // } else if (this.orientation == 4) { + // zm = ym = -range; + // yp = range; + // zp = range; + // xm = -(range * 2); + // } else if (this.orientation == 5) { + // zm = ym = -range; + // yp = range; + // zp = range; + // xp = range * 2; + // } + + // for (int x = xm; x <= xp; ++x) { + // for (int y = ym; y <= yp; ++y) { + // for (int z = zm; z <= zp; ++z) { + // if (super.yCoord + y + 1 <= super.worldObj.getHeight() + // && super.yCoord + y >= 0) { + // Block cbID = super.worldObj.getBlock( + // super.xCoord + x, super.yCoord + y, super.zCoord + z + // ); + // super.worldObj.getBlockMetadata( + // super.xCoord + x, super.yCoord + y, super.zCoord + z + // ); + // if (cbID == Blocks.farmland + // && super.worldObj.isAirBlock( + // super.xCoord + x, super.yCoord + y + 1, super.zCoord + z + // ) + // && super.worldObj.rand.nextInt(10) == 0 && this.fetchSeed()) + // { super.worldObj.setBlockAndMetadataWithNotify( + // super.xCoord + x, + // super.yCoord + y + 1, + // super.zCoord + z, + // Blocks.crops.blockID, + // 0 + // ); + // ThaumCraftCore.poofUpwards( + // super.worldObj, + // super.xCoord + x, + // super.yCoord + y + 1, + // super.zCoord + z, + // 0 + // ); + // this.worked = true; + // return true; + // } + // } + // } + // } + // } + + // return false; + //} + + //private boolean fetchSeed() { + // for (int x = -2; x <= 2; ++x) { + // for (int y = -2; y <= 2; ++y) { + // for (int z = -2; z <= 2; ++z) { + // if ((x != 0 || y != 0 || z != 0) && super.yCoord + y >= 0) { + // TileEntity block = super.worldObj.getBlockTileEntity( + // super.xCoord + x, super.yCoord + y, super.zCoord + z + // ); + // if (block instanceof IInventory) { + // IInventory chest = (IInventory) block; + + // for (int a = 0; a < chest.getSizeInventory(); ++a) { + // if (chest.getStackInSlot(a) != null + // && chest.getStackInSlot(a).getItem().shiftedIndex + // == Item.seeds.shiftedIndex) { + // chest.decrStackSize(a, 1); + // ThaumCraftCore.poofGood( + // super.worldObj, + // (float) block.xCoord, + // (float) block.yCoord, + // (float) block.zCoord + // ); + // return true; + // } + // } + // } + // } + // } + // } + // } + + // return false; + //} + + private boolean till(int range) { + int xm = 0; + int xp = 0; + int ym = 0; + int yp = 0; + int zm = 0; + int zp = 0; + if (this.orientation == 0) { + xm = zm = -range; + zp = range; + xp = range; + ym = -(range * 2); + } else if (this.orientation == 1) { + xm = zm = -range; + zp = range; + xp = range; + yp = range * 2; + } else if (this.orientation == 2) { + xm = ym = -range; + yp = range; + xp = range; + zm = -(range * 2); + } else if (this.orientation == 3) { + xm = ym = -range; + yp = range; + xp = range; + zp = range * 2; + } else if (this.orientation == 4) { + zm = ym = -range; + yp = range; + zp = range; + xm = -(range * 2); + } else if (this.orientation == 5) { + zm = ym = -range; + yp = range; + zp = range; + xp = range * 2; + } + + for (int x = xm; x <= xp; ++x) { + for (int y = ym; y <= yp; ++y) { + for (int z = zm; z <= zp; ++z) { + if (super.yCoord + y <= super.worldObj.getHeight() + && super.yCoord + y >= 0) { + Block cbID = super.worldObj.getBlock( + super.xCoord + x, super.yCoord + y, super.zCoord + z + ); + Block tbID = super.worldObj.getBlock( + super.xCoord + x, super.yCoord + y + 1, super.zCoord + z + ); + if ((cbID == Blocks.dirt || cbID == Blocks.grass) + && tbID == Blocks.air + && super.worldObj.rand.nextInt(10) == 0) { + super.worldObj.setBlock( + super.xCoord + x, + super.yCoord + y, + super.zCoord + z, + Blocks.farmland, + 0, + 3 + ); + net.anvilcraft.thaummach.utils.UtilsFX.sparkleUp( + super.worldObj, + super.xCoord + x, + super.yCoord + y + 1, + super.zCoord + z, + 3 + ); + this.worked = true; + return true; + } + } + } + } + } + + return false; + } + + private void magicBoost() { + int auraId = AuraManager.getClosestAuraWithinRange( + super.worldObj, super.xCoord, super.yCoord, super.zCoord, 512 + ); + + if (auraId < 0) + return; + + // TODO: WTF + //int auraX = super.xCoord >> 4; + //int auraZ = super.zCoord >> 4; + //SIAuraChunk ac = (SIAuraChunk) mod_ThaumCraft.AuraHM.get( + // Arrays.asList(auraX, auraZ, ThaumCraftCore.getDimension(super.worldObj)) + //); + //if (ac != null && ac.boost < 100) { + // this.worked = true; + // ++ac.boost; + // FXWisp ef = new FXWisp( + // super.worldObj, + // (double) this.sealX(false), + // (double) this.sealY(false), + // (double) this.sealZ(false), + // (double) ((float) super.xCoord + super.worldObj.rand.nextFloat()), + // (double) ((float) super.yCoord + super.worldObj.rand.nextFloat()), + // (double) ((float) super.zCoord + super.worldObj.rand.nextFloat()), + // 0.1F, + // super.worldObj.rand.nextInt(5) + // ); + // ModLoader.getMinecraftInstance().effectRenderer.addEffect(ef); + //} + } + + private void handlePortals() { + List list + = this.getEntitiesSorted(super.worldObj, 1, this.orientation, false); + boolean p = false; + + int q; + for (q = 0; q < list.size(); ++q) { + if (list.get(q) instanceof EntityPlayer) { + p = true; + break; + } + } + + if (list.size() > 0) { + Iterator i$ = SEALS.iterator(); + + boolean fs = false; + label74: { + SealData pd; + do { + do { + do { + if (!i$.hasNext()) { + break label74; + } + + pd = i$.next(); + } while (pd.dim != list.get(0).worldObj.provider.dimensionId); + } while (pd.rune != this.runes[2]); + } while (pd.x == super.xCoord && pd.y == super.yCoord && pd.z == super.zCoord + ); + + this.otherSeal = pd; + super.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + + if (!this.pOpen && p) { + super.worldObj.playSoundEffect( + (double) super.xCoord + 0.5, + (double) super.yCoord + 0.5, + (double) super.zCoord + 0.5, + "thaummach:popen", + 0.4F, + 1.0F + super.worldObj.rand.nextFloat() * 0.2F + ); + } + + if (this.delay <= 0 && p) { + //this.renderTeleportDest(); + this.delay = 10; + } + + --this.delay; + this.pOpen = true; + fs = true; + } + if (!fs && this.pOpen) { + this.pOpen = false; + } + } else { + this.otherSeal = null; + super.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + + if (this.pOpen) { + list = this.getEntitiesSorted(super.worldObj, 2, this.orientation, false); + + for (q = 0; q < list.size(); ++q) { + super.worldObj.playSoundEffect( + (double) super.xCoord + 0.5, + (double) super.yCoord + 0.5, + (double) super.zCoord + 0.5, + "thaummach:pclose", + 0.4F, + 1.0F + super.worldObj.rand.nextFloat() * 0.2F + ); + } + } + + this.pOpen = false; + } + + this.teleport(); + } + + // TODO: implement portal rendering with looking glass + //private void renderTeleportDest() { + // if (this.txRender == null) { + // this.txRender = new PortalRenderer(); + // } + + // new ArrayList(); + // Collection p = mod_ThaumCraft.SpecialTileHM.values(); + // int count = -1; + // boolean skipped = true; + // boolean playsound = false; + // Iterator i$ = p.iterator(); + + // while (i$.hasNext()) { + // SISpecialTile pd = (SISpecialTile) i$.next(); + // if (pd.type == 0 + // && pd.dimension == ModLoader.getMinecraftInstance().thePlayer.dimension + // && pd.rune == this.runes[2] + // && (pd.x != super.xCoord || pd.y != super.yCoord || pd.z != super.zCoord + // )) { + // if (!(super.worldObj.getBlockTileEntity(pd.x, pd.y, pd.z) + // instanceof TileSeal)) { + // mod_ThaumCraft.DeleteSpecialTileFromList(pd); + // break; + // } + + // ++count; + // if (count >= this.portalWindow) { + // skipped = false; + // TileEntity ts = super.worldObj.getBlockTileEntity(pd.x, pd.y, + // pd.z);Api if (ts != null && ts instanceof TileSeal) { + // PortalRenderer.createPortalView( + // this.txRender, this, (TileSeal) ts + // ); + // break; + // } + // } + // } + // } + + // if (skipped) { + // this.portalWindow = 0; + // } + //} + + public boolean teleport() { + List list = super.worldObj.getEntitiesWithinAABB( + Entity.class, + AxisAlignedBB.getBoundingBox( + (double) super.xCoord, + (double) super.yCoord, + (double) super.zCoord, + (double) (super.xCoord + 1), + (double) (super.yCoord + 1), + (double) (super.zCoord + 1) + ) + ); + + if (list.isEmpty()) { + return false; + } else { + Entity entity = (Entity) list.get(0); + if (entity instanceof EntityFX) { + return false; + } else { + if (this.otherSeal == null) { + return false; + } else { + SealData targetDest = this.otherSeal; + TileEntity ts = super.worldObj.getTileEntity( + targetDest.x, targetDest.y, targetDest.z + ); + if (ts != null && ts instanceof TileSeal) { + TileSeal target = (TileSeal) ts; + if (target.runes[0] == 0 && target.runes[1] == 1) { + target.delay = 40; + float tYaw = entity.rotationYaw; + switch (target.orientation) { + case 2: + tYaw = 180.0F; + break; + case 3: + tYaw = 0.0F; + break; + case 4: + tYaw = 90.0F; + break; + case 5: + tYaw = 270.0F; + } + + int diff = this.orientation - target.orientation; + double t; + if (diff == -3 || diff == 2 + || diff == -1 + && this.orientation + target.orientation != 5 + && this.orientation + target.orientation != 9) { + t = entity.motionX; + entity.motionX = entity.motionZ; + entity.motionZ = -t; + if (entity.ridingEntity != null) { + entity.ridingEntity.motionX + = entity.ridingEntity.motionZ; + entity.ridingEntity.motionZ = -t; + } + } else if (diff == -2 || diff == 3 || diff == 1 && + this.orientation + target.orientation != 5 && + this.orientation + target.orientation != 9) { + t = entity.motionX; + entity.motionX = -entity.motionZ; + entity.motionZ = t; + if (entity.ridingEntity != null) { + entity.ridingEntity.motionX + = -entity.ridingEntity.motionZ; + entity.ridingEntity.motionZ = t; + } + } else if (diff == 0) { + entity.motionX = -entity.motionX; + entity.motionZ = -entity.motionZ; + if (entity.ridingEntity != null) { + entity.ridingEntity.motionX + = -entity.ridingEntity.motionX; + entity.ridingEntity.motionZ + = -entity.ridingEntity.motionZ; + } + } + + if (diff == 0 + && (this.orientation == 1 || this.orientation == 0)) { + entity.motionY = -entity.motionY; + if (entity.ridingEntity != null) { + entity.ridingEntity.motionY + = -entity.ridingEntity.motionY; + } + } + + UtilsFX.poof( + super.worldObj, + (float) entity.posX - 0.5F, + (float) entity.posY - 0.5F, + (float) entity.posZ - 0.5F + ); + super.worldObj.playSoundEffect( + entity.posX, + entity.posY, + entity.posZ, + "mob.endermen.portal", + 1.0F, + 1.0F + ); + int xm = 0; + int zm = 0; + int ym = 0; + switch (target.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; + } + + if (target.orientation > 1 + && super.worldObj.isAirBlock( + target.xCoord + xm, + target.yCoord + ym - 1, + target.zCoord + zm + )) { + --ym; + } + + entity.setLocationAndAngles( + (double) target.xCoord + 0.5 + (double) xm, + (double) target.yCoord + 0.5 + (double) ym, + (double) target.zCoord + 0.5 + (double) zm, + tYaw, + entity.rotationPitch + ); + if (entity.ridingEntity != null) { + entity.ridingEntity.setLocationAndAngles( + (double) target.xCoord + 0.5 + (double) xm, + (double) target.yCoord + 0.5 + (double) ym, + (double) target.zCoord + 0.5 + (double) zm, + tYaw, + entity.ridingEntity.rotationPitch + ); + } + + UtilsFX.poof( + super.worldObj, + (float) entity.posX - 0.5F, + (float) entity.posY - 0.5F, + (float) entity.posZ - 0.5F + ); + super.worldObj.playSoundEffect( + entity.posX, + entity.posY, + entity.posZ, + "mob.endermen.portal", + 1.0F, + 1.0F + ); + + // TODO: use specific aspect for flux + int thisAura = AuraManager.getClosestAuraWithinRange( + this.worldObj, this.xCoord, this.yCoord, this.zCoord, 512 + ); + + if (thisAura >= 0) { + AuraManager.addRandomFlux( + this.worldObj, + AuraManager.getNode(thisAura), + (entity instanceof EntityItem) ? 1 : 4 + ); + } + + int otherAura = AuraManager.getClosestAuraWithinRange( + target.worldObj, + target.xCoord, + target.yCoord, + target.zCoord, + 512 + ); + + if (otherAura >= 0) { + AuraManager.addRandomFlux( + this.worldObj, + AuraManager.getNode(otherAura), + (entity instanceof EntityItem) ? 1 : 4 + ); + } + + if (entity instanceof EntityPlayer) { + ((EntityPlayerMP) entity) + .playerNetServerHandler.sendPacket( + new S08PacketPlayerPosLook( + entity.posX, + entity.posY + 1.6, + entity.posZ, + entity.rotationYaw, + entity.rotationPitch, + false + ) + ); + } else { + System.out.println(entity.posX + " " + entity.posY + " " + entity.posZ); + Packet pkt1 + = new S18PacketEntityTeleport( + entity.getEntityId(), + MathHelper.floor_double(entity.posX * 32.0D), + MathHelper.floor_double(entity.posY * 32.0D), + MathHelper.floor_double(entity.posZ * 32.0D), + (byte + ) ((int) (entity.rotationYaw * 256.0F / 360.0F)), + (byte + ) ((int) (entity.rotationPitch * 256.0F / 360.0F)) + ); + Packet pkt2 = new S12PacketEntityVelocity(entity); + + for (EntityPlayerMP pl : (List) this + .worldObj.playerEntities) { + pl.playerNetServerHandler.sendPacket(pkt1); + pl.playerNetServerHandler.sendPacket(pkt2); + } + } + + this.worked = true; + return true; + } else { + return false; + } + } else { + return false; + } + } + } + } + } + + private void beam( + int range, + int damage, + boolean push, + boolean homing, + boolean motes, + boolean core, + float speed1, + float speed2 + ) { + List list + = this.getEntitiesSorted(super.worldObj, range, this.orientation, true); + + for (int a = 0; a < list.size(); ++a) { + Entity entity = (Entity) list.get(a); + if (entity instanceof EntityLivingBase && !(entity instanceof EntityPlayer) + && !(entity instanceof EntityTameable)) { + //FXBeam ef = new FXBeam( + // super.worldObj, + // (double) this.sealX(false), + // (double) this.sealY(false), + // (double) this.sealZ(false), + // entity, + // damage + //); + //ef.drawCore = core; + //ef.drawMotes = motes; + //ef.push = push; + //ef.speed = speed2; + //ef.moteSpeed = speed1; + //ef.homing = homing; + //ModLoader.getMinecraftInstance().effectRenderer.addEffect(ef); + //if (this.soundDelay <= 0) { + // super.worldObj.playSoundEffect( + // (double) super.xCoord + 0.5, + // (double) super.yCoord + 0.5, + // (double) super.zCoord + 0.5, + // "thaummach:beamloop", + // 0.6F, + // 1.0F + // ); + // this.soundDelay = 5; + //} + + //this.worked = true; + //break; + } + } + } + + private void + heal(int range, boolean mobs, boolean animals, boolean player, boolean buff) { + List list + = this.getEntitiesSorted(super.worldObj, range, this.orientation, true); + + for (int a = list.size() - 1; a >= 0; --a) { + Entity entity = (Entity) list.get(a); + if (entity instanceof EntityLivingBase + && (animals + && (entity instanceof EntityAnimal + || entity instanceof EntityVillager) + || mobs && (entity instanceof EntityMob || entity instanceof IMob) + || player + && (entity instanceof EntityPlayer + || entity instanceof EntityTameable))) { + if (!(entity instanceof EntityPlayer) + && ((EntityLivingBase) entity).getActivePotionEffect(Potion.hunger) + != null) { + break; + } + + if (((EntityLivingBase) entity).getHealth() + != ((EntityLivingBase) entity).getMaxHealth()) { + ((EntityLivingBase) entity).heal(1); + if (buff) { + ((EntityLivingBase) entity) + .addPotionEffect( + new PotionEffect(Potion.regeneration.id, 60, 1) + ); + } + + super.worldObj.playSoundAtEntity( + entity, "thaumcraft.heal", 1.0F, 1.0F + ); + + for (int qq = 0; qq < 5; ++qq) { + FXWisp ef = new FXWisp( + super.worldObj, + (double) this.sealX(false), + (double) this.sealY(false), + (double) this.sealZ(false), + entity.posX + + (double + ) ((super.worldObj.rand.nextFloat() + - super.worldObj.rand.nextFloat()) + * 0.5F), + entity.boundingBox.minY + (double) (entity.height / 2.0F) + + (double + ) ((super.worldObj.rand.nextFloat() + - super.worldObj.rand.nextFloat()) + * 0.5F), + entity.posZ + + (double + ) ((super.worldObj.rand.nextFloat() + - super.worldObj.rand.nextFloat()) + * 0.5F), + 0.2F, + super.worldObj.rand.nextBoolean() ? 0 : 2 + ); + Minecraft.getMinecraft().effectRenderer.addEffect(ef); + } + + this.worked = true; + if (this.runes[2] != 4) { + break; + } + } + } + } + } + + private void + scorch(int range, int damage, boolean mobs, boolean animals, boolean pvp) { + List list + = this.getEntitiesSorted(super.worldObj, range, this.orientation, true); + + for (int a = list.size() - 1; a >= 0; --a) { + Entity entity = (Entity) list.get(a); + if (entity instanceof EntityLivingBase + && (animals && entity instanceof EntityAnimal + && !(entity instanceof EntityTameable) + || mobs && (entity instanceof EntityMob || entity instanceof IMob) + || pvp && entity instanceof EntityPlayer)) { + for (int q = 0; q < damage; ++q) { + entity.attackEntityFrom(DamageSource.onFire, damage); + FXScorch ef = new FXScorch( + super.worldObj, + (double) this.sealX(false), + (double) this.sealY(false), + (double) this.sealZ(false), + Vec3.createVectorHelper( + entity.posX - this.sealX(false), + entity.posY - this.sealY(false), + entity.posZ - this.sealZ(false) + ), + (float) damage * 0.5F, + this.runeAmount(1) > 0 + ); + ef.mobs = mobs; + ef.pvp = pvp; + ef.animals = animals; + Minecraft.getMinecraft().effectRenderer.addEffect(ef); + } + + if (this.soundDelay <= 0) { + super.worldObj.playSoundEffect( + (double) super.xCoord + 0.5, + (double) super.yCoord + 0.5, + (double) super.zCoord + 0.5, + "thaumcraft:fireloop", + 0.33F, + 1.0F + ); + this.soundDelay = 20; + } + + this.worked = true; + break; + } + } + } + + private boolean shock() { + int range = 6 + this.runeAmount(1) * 2; + boolean shocked = false; + boolean mobs = this.runeAmount(3) == 0; + boolean animals = this.runeAmount(0) == 0; + boolean pvp = this.runeAmount(5) > 0; + if (pvp) { + mobs = false; + animals = false; + } + + List list + = this.getEntitiesSorted(super.worldObj, range, this.orientation, true); + + for (int a = 0; a < list.size(); ++a) { + if (list.get(a) instanceof EntityLivingBase + && this.canEntityBeSeen((Entity) list.get(a))) { + EntityLivingBase entity = (EntityLivingBase) list.get(a); + if (animals && entity instanceof EntityAnimal + && !(entity instanceof EntityTameable) + || mobs && (entity instanceof EntityMob || entity instanceof IMob) + || pvp && entity instanceof EntityPlayer) { + shocked = true; + FXLightningBolt bolt = new FXLightningBolt( + super.worldObj, + this.sealPos(false), + new WRVector3(entity), + super.worldObj.rand.nextLong() + ); + bolt.defaultFractal(); + bolt.setType(2); + bolt.finalizeBolt(); + entity.attackEntityFrom(DamageSource.magic, 3); + entity.addPotionEffect(new PotionEffect( + Potion.moveSlowdown.id, 100, this.runeAmount(2) * 4 + )); + this.worked = true; + if (this.runeAmount(4) < 2) { + break; + } + } + } + } + + if (shocked) { + super.worldObj.playSoundEffect( + (double) super.xCoord + 0.5, + (double) super.yCoord + 0.5, + (double) super.zCoord + 0.5, + "thaumcraft:shock", + 0.33F, + 1.0F + ); + } + + return false; + } + + private void pushEntity( + boolean pull, boolean creatures, boolean items, int range, float strength + ) { + boolean pushed = false; + List list + = this.getEntities(super.worldObj, (float) range, this.orientation, false); + + for (int a = 0; a < list.size(); ++a) { + Entity entity = (Entity) list.get(a); + if (!(entity instanceof IProjectile) && !(entity instanceof EntityXPOrb) + && !(entity instanceof EntityPlayer) + && !(entity instanceof EntityTameable) + && (creatures || !(entity instanceof EntityLivingBase)) + && (items || !(entity instanceof EntityItem))) { + double d6 = entity.posX - (double) this.sealX(false); + double d8 = entity.posY - (double) this.sealY(false); + double d10 = entity.posZ - (double) this.sealZ(false); + double d11 + = (double) MathHelper.sqrt_double(d6 * d6 + d8 * d8 + d10 * d10); + d6 /= d11; + d8 /= d11; + d10 /= d11; + if (pull) { + entity.motionX -= d6 * (double) strength * 2.0; + if (this.orientation <= 1 || this.runes[2] == 4 + || this.runes[2] == 5) { + entity.motionY -= d8 * (double) strength * 3.0; + } + + entity.motionZ -= d10 * (double) strength * 2.0; + } else { + float power = entity.onGround ? strength * 2.0F : strength; + entity.motionX += d6 * (double) power; + entity.motionZ += d10 * (double) power; + if (this.orientation <= 1) { + entity.motionY += d8 * (double) strength * 3.0; + } + } + + pushed = true; + } + } + + if (pushed) { + this.worked = true; + if (this.soundDelay <= 0) { + if (pull) { + super.worldObj.playSoundEffect( + (double) ((float) super.xCoord + 0.5F), + (double) ((float) super.yCoord + 0.5F), + (double) ((float) super.zCoord + 0.5F), + "thaumcraft.suck", + 0.1F, + strength * 3.0F + 0.9F + super.worldObj.rand.nextFloat() * 0.1F + ); + this.soundDelay = 30; + } else { + super.worldObj.playSoundEffect( + (double) ((float) super.xCoord + 0.5F), + (double) ((float) super.yCoord + 0.5F), + (double) ((float) super.zCoord + 0.5F), + "thaumcraft.wind", + 0.1F, + strength * 3.0F + 0.9F + super.worldObj.rand.nextFloat() * 0.1F + ); + this.soundDelay = 25; + } + } + + float q = 0.0F; + float w = 0.0F; + float e = 0.0F; + switch (this.orientation) { + case 0: + w = -1.0F; + q = super.worldObj.rand.nextFloat() - super.worldObj.rand.nextFloat(); + e = super.worldObj.rand.nextFloat() - super.worldObj.rand.nextFloat(); + break; + case 1: + w = 1.0F; + q = super.worldObj.rand.nextFloat() - super.worldObj.rand.nextFloat(); + e = super.worldObj.rand.nextFloat() - super.worldObj.rand.nextFloat(); + break; + case 2: + e = -1.0F; + q = super.worldObj.rand.nextFloat() - super.worldObj.rand.nextFloat(); + w = super.worldObj.rand.nextFloat() - super.worldObj.rand.nextFloat(); + break; + case 3: + e = 1.0F; + q = super.worldObj.rand.nextFloat() - super.worldObj.rand.nextFloat(); + w = super.worldObj.rand.nextFloat() - super.worldObj.rand.nextFloat(); + break; + case 4: + q = -1.0F; + w = super.worldObj.rand.nextFloat() - super.worldObj.rand.nextFloat(); + e = super.worldObj.rand.nextFloat() - super.worldObj.rand.nextFloat(); + break; + case 5: + q = 1.0F; + w = super.worldObj.rand.nextFloat() - super.worldObj.rand.nextFloat(); + e = super.worldObj.rand.nextFloat() - super.worldObj.rand.nextFloat(); + } + + // TODO: more effects! + //FXWind ef = new FXWind( + // super.worldObj, + // (double) this.sealX(false), + // (double) this.sealY(false), + // (double) this.sealZ(false), + // (double) (this.sealX(false) + q), + // (double) (this.sealY(false) + w), + // (double) (this.sealZ(false) + e), + // pull + //); + //ModLoader.getMinecraftInstance().effectRenderer.addEffect(ef); + } + } + + protected void attemptItemPickup(EntityItem entity) { + ItemStack items = entity.getEntityItem(); + + for (int x = -2; x <= 2; ++x) { + for (int y = -2; y <= 2; ++y) { + for (int z = -2; z <= 2; ++z) { + if ((x != 0 || y != 0 || z != 0) && super.yCoord + y >= 0) { + TileEntity block = super.worldObj.getTileEntity( + super.xCoord + x, super.yCoord + y, super.zCoord + z + ); + if (block instanceof IInventory) { + IInventory chest = (IInventory) block; + + for (int a = 0; a < chest.getSizeInventory(); ++a) { + int j; + FXSparkle ef1; + FXSparkle ef2; + if (chest.getStackInSlot(a) == null) { + chest.setInventorySlotContents(a, items); + entity.setDead(); + super.worldObj.playSoundAtEntity( + entity, + "random.pop", + 0.15F, + 2.0F + super.worldObj.rand.nextFloat() * 0.45F + ); + + for (j = 0; j < 5; ++j) { + ef1 = new FXSparkle( + super.worldObj, + entity.posX, + entity.posY, + entity.posZ, + entity.posX + + (double + ) ((super.worldObj.rand.nextFloat() + - super.worldObj.rand.nextFloat()) + * 0.5F), + entity.posY + + (double + ) ((super.worldObj.rand.nextFloat() + - super.worldObj.rand.nextFloat()) + * 0.5F), + entity.posZ + + (double + ) ((super.worldObj.rand.nextFloat() + - super.worldObj.rand.nextFloat()) + * 0.5F), + 2.0F, + 1, + 3 + ); + Minecraft.getMinecraft().effectRenderer.addEffect( + ef1 + ); + ef2 = new FXSparkle( + super.worldObj, + entity.posX + + (double + ) ((super.worldObj.rand.nextFloat() + - super.worldObj.rand.nextFloat()) + * 0.2F), + entity.posY + + (double + ) ((super.worldObj.rand.nextFloat() + - super.worldObj.rand.nextFloat()) + * 0.2F), + entity.posZ + + (double + ) ((super.worldObj.rand.nextFloat() + - super.worldObj.rand.nextFloat()) + * 0.2F), + (double) ((float) block.xCoord + 0.5F), + (double) ((float) block.yCoord + 0.5F), + (double) ((float) block.zCoord + 0.5F), + 1.0F, + 1, + 3 + ); + Minecraft.getMinecraft().effectRenderer.addEffect( + ef2 + ); + } + + return; + } + + if (chest.getStackInSlot(a).isItemEqual(items) + && chest.getStackInSlot(a).stackSize + items.stackSize + <= items.getMaxStackSize()) { + items.stackSize += chest.getStackInSlot(a).stackSize; + chest.setInventorySlotContents(a, items); + entity.setDead(); + super.worldObj.playSoundAtEntity( + entity, + "random.pop", + 0.15F, + 2.0F + super.worldObj.rand.nextFloat() * 0.45F + ); + + for (j = 0; j < 5; ++j) { + ef1 = new FXSparkle( + super.worldObj, + entity.posX, + entity.posY, + entity.posZ, + entity.posX + + (double + ) ((super.worldObj.rand.nextFloat() + - super.worldObj.rand.nextFloat()) + * 0.5F), + entity.posY + + (double + ) ((super.worldObj.rand.nextFloat() + - super.worldObj.rand.nextFloat()) + * 0.5F), + entity.posZ + + (double + ) ((super.worldObj.rand.nextFloat() + - super.worldObj.rand.nextFloat()) + * 0.5F), + 2.0F, + 1, + 3 + ); + Minecraft.getMinecraft().effectRenderer.addEffect( + ef1 + ); + ef2 = new FXSparkle( + super.worldObj, + entity.posX + + (double + ) ((super.worldObj.rand.nextFloat() + - super.worldObj.rand.nextFloat()) + * 0.2F), + entity.posY + + (double + ) ((super.worldObj.rand.nextFloat() + - super.worldObj.rand.nextFloat()) + * 0.2F), + entity.posZ + + (double + ) ((super.worldObj.rand.nextFloat() + - super.worldObj.rand.nextFloat()) + * 0.2F), + (double) ((float) block.xCoord + 0.5F), + (double) ((float) block.yCoord + 0.5F), + (double) ((float) block.zCoord + 0.5F), + 1.0F, + 1, + 3 + ); + Minecraft.getMinecraft().effectRenderer.addEffect( + ef2 + ); + } + + return; + } + } + } + } + } + } + } + } + + private float sealX(boolean reverse) { + float calc = (float) super.xCoord; + switch (this.orientation) { + case 0: + calc += 0.5F; + break; + case 1: + calc += 0.5F; + break; + case 2: + calc += 0.5F; + break; + case 3: + calc += 0.5F; + break; + case 4: + calc += reverse ? 0.0F : 1.0F; + break; + case 5: + calc += reverse ? 1.0F : 0.0F; + } + + return calc; + } + + private float sealY(boolean reverse) { + float calc = (float) super.yCoord; + switch (this.orientation) { + case 0: + calc += reverse ? 0.0F : 1.0F; + break; + case 1: + calc += reverse ? 1.0F : 0.0F; + break; + case 2: + case 3: + case 4: + case 5: + calc += 0.5F; + } + + return calc; + } + + private float sealZ(boolean reverse) { + float calc = (float) super.zCoord; + switch (this.orientation) { + case 0: + calc += 0.5F; + break; + case 1: + calc += 0.5F; + break; + case 2: + calc += reverse ? 0.0F : 1.0F; + break; + case 3: + calc += reverse ? 1.0F : 0.0F; + break; + case 4: + calc += 0.5F; + break; + case 5: + calc += 0.5F; + } + + return calc; + } + + private WRVector3 sealPos(boolean reverse) { + return new WRVector3( + this.sealX(reverse), this.sealY(reverse), this.sealZ(reverse) + ); + } + + public int runeAmount(int type) { + int count = 0; + if (this.runes[1] == type) { + ++count; + } + + if (this.runes[2] == type) { + ++count; + } + + return count; + } + + public int runeCount() { + int count = 0; + if (this.runes[0] != -1) { + ++count; + } + + if (this.runes[1] != -1) { + ++count; + } + + if (this.runes[2] != -1) { + ++count; + } + + return count; + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + this.orientation = nbt.getShort("orientation"); + this.runes = nbt.getByteArray("runes"); + this.portalWindow = nbt.getInteger("window"); + if (nbt.hasKey("other")) + this.otherSeal = SealData.readFromNbt(nbt.getCompoundTag("other")); + else + this.otherSeal = null; + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setShort("orientation", this.orientation); + nbt.setByteArray("runes", this.runes); + nbt.setInteger("window", this.portalWindow); + if (this.otherSeal != null) + nbt.setTag("other", this.otherSeal.writeToNbt(new NBTTagCompound())); + } + + @Override + public Packet getDescriptionPacket() { + NBTTagCompound nbt = new NBTTagCompound(); + + nbt.setShort("orientation", this.orientation); + nbt.setByteArray("runes", this.runes); + nbt.setInteger("window", this.portalWindow); + if (this.otherSeal != null) + nbt.setTag("other", this.otherSeal.writeToNbt(new NBTTagCompound())); + //nbt.setFloat("pSize", this.pSize); + nbt.setBoolean("pOpen", this.pOpen); + + return new S35PacketUpdateTileEntity( + this.xCoord, this.yCoord, this.zCoord, this.getBlockMetadata(), nbt + ); + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + NBTTagCompound nbt = pkt.func_148857_g(); + + this.orientation = nbt.getShort("orientation"); + this.runes = nbt.getByteArray("runes"); + this.portalWindow = nbt.getInteger("window"); + if (nbt.hasKey("other")) + this.otherSeal = SealData.readFromNbt(nbt.getCompoundTag("other")); + else + this.otherSeal = null; + //this.pSize = nbt.getFloat("pSize"); + this.pOpen = nbt.getBoolean("pOpen"); + } + + public List + getEntities(World world, float range, int orientation, boolean visibleonly) { + double xm = 0.0; + double xp = 0.0; + double ym = 0.0; + double yp = 0.0; + double zm = 0.0; + double zp = 0.0; + if (orientation == 0) { + xm = zm = (double) (-range); + xp = zp = (double) range; + ym = (double) (-(range * 2.0F)); + } else if (orientation == 1) { + xm = zm = (double) (-range); + xp = zp = (double) range; + yp = (double) (range * 2.0F); + } else if (orientation == 2) { + xm = ym = (double) (-range); + xp = yp = (double) range; + zm = (double) (-(range * 2.0F)); + } else if (orientation == 3) { + xm = ym = (double) (-range); + xp = yp = (double) range; + zp = (double) (range * 2.0F); + } else if (orientation == 4) { + zm = ym = (double) (-range); + zp = yp = (double) range; + xm = (double) (-(range * 2.0F)); + } else if (orientation == 5) { + zm = ym = (double) (-range); + zp = yp = (double) range; + xp = (double) (range * 2.0F); + } + + List list = world.getEntitiesWithinAABB( + Entity.class, + AxisAlignedBB.getBoundingBox( + (double) this.xCoord + xm, + (double) this.yCoord + ym, + (double) this.zCoord + zm, + (double) this.xCoord + 1.0 + xp, + (double) this.yCoord + 1.0 + yp, + (double) this.zCoord + 1.0 + zp + ) + ); + if (visibleonly) { + for (int q = 0; q < list.size(); ++q) { + if (!this.canEntityBeSeen((Entity) list.get(q))) { + list.remove(q); + --q; + } + } + } + + return list; + } + + @Override + public void invalidate() { + super.invalidate(); + if (!this.worldObj.isRemote) + 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) { + return this.worldObj.rayTraceBlocks( + Vec3.createVectorHelper( + (double) this.xCoord + 0.5, + (double) this.yCoord + 0.5, + (double) this.zCoord + 0.5 + ), + Vec3.createVectorHelper( + entity.posX, + entity.posY + (double) entity.getEyeHeight(), + entity.posZ + ), + true + ) + == null; + } + + public List + getEntitiesSorted(World world, int range, int orientation, boolean visibleonly) { + List ws + = this.getEntities(world, (float) range, orientation, visibleonly); + boolean didSort = false; + + do { + didSort = false; + + for (int a = 0; a < ws.size() - 1; ++a) { + Entity entity = (Entity) ws.get(a); + double dist = this.getDistanceFrom(entity.posX, entity.posY, entity.posZ); + Entity entity2 = (Entity) ws.get(a + 1); + double dist2 + = this.getDistanceFrom(entity2.posX, entity2.posY, entity2.posZ); + if (dist > dist2) { + ws.remove(a); + ws.add(entity); + didSort = true; + break; + } + } + } while (didSort); + + return ws; + } +} diff --git a/src/main/java/net/anvilcraft/thaummach/utils/HelperFacing.java b/src/main/java/net/anvilcraft/thaummach/utils/HelperFacing.java new file mode 100644 index 0000000..f57bbc1 --- /dev/null +++ b/src/main/java/net/anvilcraft/thaummach/utils/HelperFacing.java @@ -0,0 +1,90 @@ +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; + } + } + } +} diff --git a/src/main/java/net/anvilcraft/thaummach/utils/HelperLocation.java b/src/main/java/net/anvilcraft/thaummach/utils/HelperLocation.java new file mode 100644 index 0000000..27f764d --- /dev/null +++ b/src/main/java/net/anvilcraft/thaummach/utils/HelperLocation.java @@ -0,0 +1,253 @@ +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; + } +} diff --git a/src/main/java/net/anvilcraft/thaummach/utils/UtilsFX.java b/src/main/java/net/anvilcraft/thaummach/utils/UtilsFX.java new file mode 100644 index 0000000..560e87e --- /dev/null +++ b/src/main/java/net/anvilcraft/thaummach/utils/UtilsFX.java @@ -0,0 +1,275 @@ +package net.anvilcraft.thaummach.utils; + +import dev.tilera.auracore.client.FXSparkle; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.world.World; +import thaumcraft.client.fx.particles.FXWisp; + +public class UtilsFX { + public static void poof(World worldObj, float x, float y, float z) { + int puffs = 6; + + for (int a = 0; a < puffs; ++a) { + worldObj.spawnParticle( + "explode", + (double) (x + worldObj.rand.nextFloat()), + (double) (y + worldObj.rand.nextFloat()), + (double) (z + worldObj.rand.nextFloat()), + -0.0, + -0.0, + -0.0 + ); + } + } + + public static void poofUpwards(World w, int x, int y, int z, int color) { + int puffs = 10; + + for (int a = 0; a < puffs; ++a) { + float xx = (float) x + w.rand.nextFloat(); + float zz = (float) z + w.rand.nextFloat(); + FXWisp ef = new FXWisp( + w, + (double) xx, + (double) y, + (double) zz, + (double) xx, + (double) ((float) y + 0.5F + w.rand.nextFloat()), + (double) zz, + 0.3F, + color + ); + ef.tinkle = false; + ef.shrink = true; + Minecraft.getMinecraft().effectRenderer.addEffect(ef); + } + } + + public static void sparkleDown(World w, int x, int y, int z, int color) { + int puffs = 16; + + for (int a = 0; a < puffs; ++a) { + float xx = (float) x + w.rand.nextFloat(); + float zz = (float) z + w.rand.nextFloat(); + FXSparkle ef = new FXSparkle( + w, + (double) xx, + (double) ((float) y + w.rand.nextFloat() * 0.5F), + (double) zz, + (double) xx, + (double) y, + (double) zz, + 2.0F, + color, + 5 + ); + ef.tinkle = true; + Minecraft.getMinecraft().effectRenderer.addEffect(ef); + } + } + + public static void sparkleUp(World w, int x, int y, int z, int color) { + int puffs = 16; + + for (int a = 0; a < puffs; ++a) { + float xx = (float) x + w.rand.nextFloat(); + float zz = (float) z + w.rand.nextFloat(); + FXSparkle ef = new FXSparkle( + w, + (double) xx, + (double) y, + (double) zz, + (double) xx, + (double) ((float) y + w.rand.nextFloat() * 0.5F), + (double) zz, + 2.0F, + color, + 5 + ); + ef.tinkle = true; + Minecraft.getMinecraft().effectRenderer.addEffect(ef); + } + } + + public static void renderItemIn2D( + Tessellator tes, + float p_78439_1_, + float p_78439_2_, + float p_78439_3_, + float p_78439_4_, + int p_78439_5_, + int p_78439_6_, + float p_78439_7_, + int brightness + ) { + tes.startDrawingQuads(); + tes.setBrightness(brightness); + tes.setNormal(0.0F, 0.0F, 1.0F); + tes.addVertexWithUV(0.0D, 0.0D, 0.0D, (double) p_78439_1_, (double) p_78439_4_); + tes.addVertexWithUV(1.0D, 0.0D, 0.0D, (double) p_78439_3_, (double) p_78439_4_); + tes.addVertexWithUV(1.0D, 1.0D, 0.0D, (double) p_78439_3_, (double) p_78439_2_); + tes.addVertexWithUV(0.0D, 1.0D, 0.0D, (double) p_78439_1_, (double) p_78439_2_); + tes.draw(); + tes.startDrawingQuads(); + tes.setBrightness(brightness); + tes.setNormal(0.0F, 0.0F, -1.0F); + tes.addVertexWithUV( + 0.0D, + 1.0D, + (double) (0.0F - p_78439_7_), + (double) p_78439_1_, + (double) p_78439_2_ + ); + tes.addVertexWithUV( + 1.0D, + 1.0D, + (double) (0.0F - p_78439_7_), + (double) p_78439_3_, + (double) p_78439_2_ + ); + tes.addVertexWithUV( + 1.0D, + 0.0D, + (double) (0.0F - p_78439_7_), + (double) p_78439_3_, + (double) p_78439_4_ + ); + tes.addVertexWithUV( + 0.0D, + 0.0D, + (double) (0.0F - p_78439_7_), + (double) p_78439_1_, + (double) p_78439_4_ + ); + tes.draw(); + float f5 = 0.5F * (p_78439_1_ - p_78439_3_) / (float) p_78439_5_; + float f6 = 0.5F * (p_78439_4_ - p_78439_2_) / (float) p_78439_6_; + tes.startDrawingQuads(); + tes.setBrightness(brightness); + tes.setNormal(-1.0F, 0.0F, 0.0F); + int k; + float f7; + float f8; + + for (k = 0; k < p_78439_5_; ++k) { + f7 = (float) k / (float) p_78439_5_; + f8 = p_78439_1_ + (p_78439_3_ - p_78439_1_) * f7 - f5; + tes.addVertexWithUV( + (double) f7, + 0.0D, + (double) (0.0F - p_78439_7_), + (double) f8, + (double) p_78439_4_ + ); + tes.addVertexWithUV( + (double) f7, 0.0D, 0.0D, (double) f8, (double) p_78439_4_ + ); + tes.addVertexWithUV( + (double) f7, 1.0D, 0.0D, (double) f8, (double) p_78439_2_ + ); + tes.addVertexWithUV( + (double) f7, + 1.0D, + (double) (0.0F - p_78439_7_), + (double) f8, + (double) p_78439_2_ + ); + } + + tes.draw(); + tes.startDrawingQuads(); + tes.setBrightness(brightness); + tes.setNormal(1.0F, 0.0F, 0.0F); + float f9; + + for (k = 0; k < p_78439_5_; ++k) { + f7 = (float) k / (float) p_78439_5_; + f8 = p_78439_1_ + (p_78439_3_ - p_78439_1_) * f7 - f5; + f9 = f7 + 1.0F / (float) p_78439_5_; + tes.addVertexWithUV( + (double) f9, + 1.0D, + (double) (0.0F - p_78439_7_), + (double) f8, + (double) p_78439_2_ + ); + tes.addVertexWithUV( + (double) f9, 1.0D, 0.0D, (double) f8, (double) p_78439_2_ + ); + tes.addVertexWithUV( + (double) f9, 0.0D, 0.0D, (double) f8, (double) p_78439_4_ + ); + tes.addVertexWithUV( + (double) f9, + 0.0D, + (double) (0.0F - p_78439_7_), + (double) f8, + (double) p_78439_4_ + ); + } + + tes.draw(); + tes.startDrawingQuads(); + tes.setBrightness(brightness); + tes.setNormal(0.0F, 1.0F, 0.0F); + + for (k = 0; k < p_78439_6_; ++k) { + f7 = (float) k / (float) p_78439_6_; + f8 = p_78439_4_ + (p_78439_2_ - p_78439_4_) * f7 - f6; + f9 = f7 + 1.0F / (float) p_78439_6_; + tes.addVertexWithUV( + 0.0D, (double) f9, 0.0D, (double) p_78439_1_, (double) f8 + ); + tes.addVertexWithUV( + 1.0D, (double) f9, 0.0D, (double) p_78439_3_, (double) f8 + ); + tes.addVertexWithUV( + 1.0D, + (double) f9, + (double) (0.0F - p_78439_7_), + (double) p_78439_3_, + (double) f8 + ); + tes.addVertexWithUV( + 0.0D, + (double) f9, + (double) (0.0F - p_78439_7_), + (double) p_78439_1_, + (double) f8 + ); + } + + tes.draw(); + tes.startDrawingQuads(); + tes.setBrightness(brightness); + tes.setNormal(0.0F, -1.0F, 0.0F); + + for (k = 0; k < p_78439_6_; ++k) { + f7 = (float) k / (float) p_78439_6_; + f8 = p_78439_4_ + (p_78439_2_ - p_78439_4_) * f7 - f6; + tes.addVertexWithUV( + 1.0D, (double) f7, 0.0D, (double) p_78439_3_, (double) f8 + ); + tes.addVertexWithUV( + 0.0D, (double) f7, 0.0D, (double) p_78439_1_, (double) f8 + ); + tes.addVertexWithUV( + 0.0D, + (double) f7, + (double) (0.0F - p_78439_7_), + (double) p_78439_1_, + (double) f8 + ); + tes.addVertexWithUV( + 1.0D, + (double) f7, + (double) (0.0F - p_78439_7_), + (double) p_78439_3_, + (double) f8 + ); + } + + tes.draw(); + } +} diff --git a/src/main/resources/assets/thaummach/lang/en_US.lang b/src/main/resources/assets/thaummach/lang/en_US.lang index 7c90f60..1aeeeaf 100644 --- a/src/main/resources/assets/thaummach/lang/en_US.lang +++ b/src/main/resources/assets/thaummach/lang/en_US.lang @@ -2,6 +2,8 @@ itemGroup.thaummach=Thaumic Machinery # ---- BLOCKS ---- +tile.thaummach:seal.name=Arcane Seal + tile.thaummach:apparatus_fragile_conduit.name=Vis Conduit tile.thaummach:apparatus_fragile_conduit_pump.name=Vis Pump tile.thaummach:apparatus_fragile_conduit_tank.name=Vis Tank @@ -32,3 +34,10 @@ item.thaummach:focus_3.name=Arcane Focus: Earth item.thaummach:focus_4.name=Arcane Focus: Fire item.thaummach:singularity.name=Arcane Singularity + +thaummach:runic_essence.0.name=Runic Essence: Magic +thaummach:runic_essence.1.name=Runic Essence: Air +thaummach:runic_essence.2.name=Runic Essence: Water +thaummach:runic_essence.3.name=Runic Essence: Earth +thaummach:runic_essence.4.name=Runic Essence: Fire +thaummach:runic_essence.5.name=Runic Essence: Dark diff --git a/src/main/resources/assets/thaummach/sounds.json b/src/main/resources/assets/thaummach/sounds.json new file mode 100644 index 0000000..e3bc3ec --- /dev/null +++ b/src/main/resources/assets/thaummach/sounds.json @@ -0,0 +1,20 @@ +{ + "popen": { + "category": "master", + "sounds": [ + { + "name": "popen", + "stream": false + } + ] + }, + "pclose": { + "category": "master", + "sounds": [ + { + "name": "pclose", + "stream": false + } + ] + } +} diff --git a/src/main/resources/assets/thaummach/sounds/pclose.ogg b/src/main/resources/assets/thaummach/sounds/pclose.ogg new file mode 100644 index 0000000..92e2925 Binary files /dev/null and b/src/main/resources/assets/thaummach/sounds/pclose.ogg differ diff --git a/src/main/resources/assets/thaummach/sounds/popen.ogg b/src/main/resources/assets/thaummach/sounds/popen.ogg new file mode 100644 index 0000000..13a0378 Binary files /dev/null and b/src/main/resources/assets/thaummach/sounds/popen.ogg differ diff --git a/src/main/resources/assets/thaummach/textures/blocks/seal.png b/src/main/resources/assets/thaummach/textures/blocks/seal.png new file mode 100644 index 0000000..079f5f7 Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/blocks/seal.png differ diff --git a/src/main/resources/assets/thaummach/textures/items/runic_essence_0.png b/src/main/resources/assets/thaummach/textures/items/runic_essence_0.png new file mode 100644 index 0000000..e867006 Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/items/runic_essence_0.png differ diff --git a/src/main/resources/assets/thaummach/textures/items/runic_essence_1.png b/src/main/resources/assets/thaummach/textures/items/runic_essence_1.png new file mode 100644 index 0000000..28d4b84 Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/items/runic_essence_1.png differ diff --git a/src/main/resources/assets/thaummach/textures/items/runic_essence_2.png b/src/main/resources/assets/thaummach/textures/items/runic_essence_2.png new file mode 100644 index 0000000..5889934 Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/items/runic_essence_2.png differ diff --git a/src/main/resources/assets/thaummach/textures/items/runic_essence_3.png b/src/main/resources/assets/thaummach/textures/items/runic_essence_3.png new file mode 100644 index 0000000..793059f Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/items/runic_essence_3.png differ diff --git a/src/main/resources/assets/thaummach/textures/items/runic_essence_4.png b/src/main/resources/assets/thaummach/textures/items/runic_essence_4.png new file mode 100644 index 0000000..1764fa4 Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/items/runic_essence_4.png differ diff --git a/src/main/resources/assets/thaummach/textures/items/runic_essence_5.png b/src/main/resources/assets/thaummach/textures/items/runic_essence_5.png new file mode 100644 index 0000000..d65a9b6 Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/items/runic_essence_5.png differ diff --git a/src/main/resources/assets/thaummach/textures/misc/portal.png b/src/main/resources/assets/thaummach/textures/misc/portal.png new file mode 100644 index 0000000..d7a434c Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/misc/portal.png differ diff --git a/src/main/resources/assets/thaummach/textures/misc/portal2.png b/src/main/resources/assets/thaummach/textures/misc/portal2.png new file mode 100644 index 0000000..562ab3c Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/misc/portal2.png differ diff --git a/src/main/resources/assets/thaummach/textures/misc/s_0_0.png b/src/main/resources/assets/thaummach/textures/misc/s_0_0.png new file mode 100644 index 0000000..2747efc Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/misc/s_0_0.png differ diff --git a/src/main/resources/assets/thaummach/textures/misc/s_0_1.png b/src/main/resources/assets/thaummach/textures/misc/s_0_1.png new file mode 100644 index 0000000..40bc8a1 Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/misc/s_0_1.png differ diff --git a/src/main/resources/assets/thaummach/textures/misc/s_0_2.png b/src/main/resources/assets/thaummach/textures/misc/s_0_2.png new file mode 100644 index 0000000..efe948e Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/misc/s_0_2.png differ diff --git a/src/main/resources/assets/thaummach/textures/misc/s_0_3.png b/src/main/resources/assets/thaummach/textures/misc/s_0_3.png new file mode 100644 index 0000000..f69cdf9 Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/misc/s_0_3.png differ diff --git a/src/main/resources/assets/thaummach/textures/misc/s_0_4.png b/src/main/resources/assets/thaummach/textures/misc/s_0_4.png new file mode 100644 index 0000000..6a083e1 Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/misc/s_0_4.png differ diff --git a/src/main/resources/assets/thaummach/textures/misc/s_0_5.png b/src/main/resources/assets/thaummach/textures/misc/s_0_5.png new file mode 100644 index 0000000..d657713 Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/misc/s_0_5.png differ diff --git a/src/main/resources/assets/thaummach/textures/misc/s_1_0.png b/src/main/resources/assets/thaummach/textures/misc/s_1_0.png new file mode 100644 index 0000000..981fb59 Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/misc/s_1_0.png differ diff --git a/src/main/resources/assets/thaummach/textures/misc/s_1_1.png b/src/main/resources/assets/thaummach/textures/misc/s_1_1.png new file mode 100644 index 0000000..2c3b8a9 Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/misc/s_1_1.png differ diff --git a/src/main/resources/assets/thaummach/textures/misc/s_1_2.png b/src/main/resources/assets/thaummach/textures/misc/s_1_2.png new file mode 100644 index 0000000..b27c09e Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/misc/s_1_2.png differ diff --git a/src/main/resources/assets/thaummach/textures/misc/s_1_3.png b/src/main/resources/assets/thaummach/textures/misc/s_1_3.png new file mode 100644 index 0000000..f26adf3 Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/misc/s_1_3.png differ diff --git a/src/main/resources/assets/thaummach/textures/misc/s_1_4.png b/src/main/resources/assets/thaummach/textures/misc/s_1_4.png new file mode 100644 index 0000000..5f05b81 Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/misc/s_1_4.png differ diff --git a/src/main/resources/assets/thaummach/textures/misc/s_1_5.png b/src/main/resources/assets/thaummach/textures/misc/s_1_5.png new file mode 100644 index 0000000..c67e2a0 Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/misc/s_1_5.png differ diff --git a/src/main/resources/assets/thaummach/textures/misc/seal5.png b/src/main/resources/assets/thaummach/textures/misc/seal5.png new file mode 100644 index 0000000..8f561e1 Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/misc/seal5.png differ