diff --git a/build.gradle b/build.gradle index d86f944..c61dc96 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.7.10-1.0.6.3" +version = "1.7.10-1.0.7" group= "makeo.gadomancy" archivesBaseName = "gadomancy" diff --git a/src/main/java/makeo/gadomancy/client/effect/fx/FXVortex.java b/src/main/java/makeo/gadomancy/client/effect/fx/FXVortex.java index 6171f8f..3cabcc3 100644 --- a/src/main/java/makeo/gadomancy/client/effect/fx/FXVortex.java +++ b/src/main/java/makeo/gadomancy/client/effect/fx/FXVortex.java @@ -2,6 +2,7 @@ package makeo.gadomancy.client.effect.fx; import makeo.gadomancy.client.effect.EffectHandler; import makeo.gadomancy.client.events.ClientHandler; +import makeo.gadomancy.common.blocks.tiles.TileEssentiaCompressor; import makeo.gadomancy.common.utils.MiscUtils; import makeo.gadomancy.common.utils.Vector3; import net.minecraft.client.Minecraft; @@ -14,6 +15,7 @@ import thaumcraft.client.lib.QuadHelper; import thaumcraft.client.lib.UtilsFX; import java.util.List; +import java.util.Random; /** * HellFirePvP@Admin @@ -23,9 +25,11 @@ import java.util.List; */ public class FXVortex { + private static final Random RAND = new Random(); public static final ResourceLocation TC_VORTEX_TEXTURE = new ResourceLocation("thaumcraft", "textures/misc/vortex.png"); private static final float RAD = (float) (Math.PI * 2); + private TileEssentiaCompressor parent = null; private long lastUpdateCall; private double x, y, z; public boolean registered = false; @@ -37,6 +41,14 @@ public class FXVortex { this.z = z; } + public FXVortex(double x, double y, double z, TileEssentiaCompressor parent) { + this.lastUpdateCall = System.currentTimeMillis(); + this.x = x; + this.y = y; + this.z = z; + this.parent = parent; + } + private void render(Tessellator tessellator, float pTicks) { float arX = ActiveRenderInfo.rotationX; float arXZ = ActiveRenderInfo.rotationXZ; @@ -45,7 +57,6 @@ public class FXVortex { float arXY = ActiveRenderInfo.rotationXY; GL11.glPushMatrix(); - //GL11.glDepthMask(true); GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); @@ -53,11 +64,22 @@ public class FXVortex { float agescale = (float) (ClientHandler.ticks % 800) / 400F; if(agescale >= 1.0F) agescale = 2 - agescale; float size = 0.2F + 0.1F * agescale; + if(parent != null) { + size += size * (((float) parent.getSizeStage()) * 0.1F); + } float anglePerc = (float) (ClientHandler.ticks % 300) / 300F; float angle = RAD - RAD * anglePerc; Vector3 iV = MiscUtils.interpolateEntityPosition(Minecraft.getMinecraft().renderViewEntity, pTicks); + if(parent != null && parent.getSizeStage() > 4) { + float mult = 0.001F * (parent.getSizeStage() - 4F); + Vector3 shake = new Vector3( + RAND.nextFloat() * mult * (RAND.nextBoolean() ? 1 : -1), + RAND.nextFloat() * mult * (RAND.nextBoolean() ? 1 : -1), + RAND.nextFloat() * mult * (RAND.nextBoolean() ? 1 : -1)); + iV.add(shake); + } GL11.glTranslated(-iV.getX(), -iV.getY(), -iV.getZ()); @@ -89,7 +111,6 @@ public class FXVortex { GL11.glDisable(GL11.GL_BLEND); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); - //GL11.glDepthMask(false); GL11.glPopMatrix(); } diff --git a/src/main/java/makeo/gadomancy/client/events/ClientHandler.java b/src/main/java/makeo/gadomancy/client/events/ClientHandler.java index 2daaa3b..3408ac2 100644 --- a/src/main/java/makeo/gadomancy/client/events/ClientHandler.java +++ b/src/main/java/makeo/gadomancy/client/events/ClientHandler.java @@ -5,6 +5,7 @@ import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.common.network.FMLNetworkEvent; import makeo.gadomancy.client.ClientProxy; import makeo.gadomancy.client.effect.EffectHandler; +import makeo.gadomancy.client.renderers.tile.RenderTileEssentiaCompressor; import makeo.gadomancy.client.util.FamiliarHandlerClient; import makeo.gadomancy.common.Gadomancy; import net.minecraft.client.Minecraft; @@ -42,6 +43,7 @@ public class ClientHandler { @SubscribeEvent public void onDc(FMLNetworkEvent.ClientDisconnectionFromServerEvent event) { EffectHandler.getInstance().clear(); + RenderTileEssentiaCompressor.ownedVortex.clear(); } } diff --git a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileEssentiaCompressor.java b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileEssentiaCompressor.java index ff70e08..0ad9cc7 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileEssentiaCompressor.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileEssentiaCompressor.java @@ -68,7 +68,8 @@ public class RenderTileEssentiaCompressor extends TileEntitySpecialRenderer { GL11.glPushMatrix(); if(yOffset == 1) { //The middle one. - well. the one where the blackhole is. - renderBlackHoleEffect(tileEntity.xCoord + 0.5, tileEntity.yCoord + 0.5, tileEntity.zCoord + 0.5); + renderBlackHoleEffect(tileEntity.xCoord + 0.5, tileEntity.yCoord + 0.5, tileEntity.zCoord + 0.5, + (TileEssentiaCompressor) tileEntity.getWorldObj().getTileEntity(tileEntity.xCoord, tileEntity.yCoord - 1, tileEntity.zCoord)); } GL11.glPopMatrix(); } else { @@ -78,7 +79,7 @@ public class RenderTileEssentiaCompressor extends TileEntitySpecialRenderer { if(isRenderedAsItem) { GL11.glTranslatef(0, -2.9F, 0); } else { - GL11.glTranslatef(0, -2.877F, 0); //Magic number FeelsBadMan + GL11.glTranslatef(0, -2.877F, 0); } bindTexture(PACKED_COMPRESSOR_TEXTURE); MODEL_PACKED_COMPRESSOR.render(null, 0, 0, 0, 0, 0, 0.0625f); @@ -87,15 +88,15 @@ public class RenderTileEssentiaCompressor extends TileEntitySpecialRenderer { } - private Map ownedVortex = new HashMap(); + public static Map ownedVortex = new HashMap(); - private void renderBlackHoleEffect(double x, double y, double z) { + private void renderBlackHoleEffect(double x, double y, double z, TileEssentiaCompressor te) { ChunkCoordinates cc = new ChunkCoordinates((int) x, (int) y, (int) z); FXVortex v; if (ownedVortex.containsKey(cc)) { v = ownedVortex.get(cc); } else { - v = new FXVortex(x, y, z); + v = new FXVortex(x, y, z, te); ownedVortex.put(cc, v); v.registered = true; EffectHandler.getInstance().registerVortex(v); diff --git a/src/main/java/makeo/gadomancy/common/Gadomancy.java b/src/main/java/makeo/gadomancy/common/Gadomancy.java index 85f4a08..7c6a893 100644 --- a/src/main/java/makeo/gadomancy/common/Gadomancy.java +++ b/src/main/java/makeo/gadomancy/common/Gadomancy.java @@ -28,7 +28,7 @@ public class Gadomancy { public static final String MODID = "gadomancy"; public static final String NAME = "Gadomancy"; - public static final String VERSION = "1.0.6.1"; + public static final String VERSION = "1.0.7"; private static final String PROXY_CLIENT = "makeo.gadomancy.client.ClientProxy"; private static final String PROXY_SERVER = "makeo.gadomancy.common.CommonProxy"; diff --git a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileEssentiaCompressor.java b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileEssentiaCompressor.java index a0b5fb3..e93366a 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileEssentiaCompressor.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileEssentiaCompressor.java @@ -3,18 +3,18 @@ package makeo.gadomancy.common.blocks.tiles; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import makeo.gadomancy.client.effect.fx.FXVortex; import makeo.gadomancy.client.events.ClientHandler; -import makeo.gadomancy.common.Gadomancy; -import makeo.gadomancy.common.data.config.ModConfig; -import makeo.gadomancy.common.network.packets.PacketTCNodeBolt; +import makeo.gadomancy.common.network.packets.PacketAnimationAbsorb; import makeo.gadomancy.common.registration.RegisteredBlocks; +import makeo.gadomancy.common.registration.RegisteredItems; import makeo.gadomancy.common.utils.ExplosionHelper; import makeo.gadomancy.common.utils.Injector; +import makeo.gadomancy.common.utils.Vector3; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; @@ -27,22 +27,20 @@ import thaumcraft.api.ThaumcraftApiHelper; import thaumcraft.api.WorldCoordinates; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; -import thaumcraft.api.aspects.IAspectContainer; import thaumcraft.api.aspects.IAspectSource; -import thaumcraft.api.aspects.IEssentiaContainerItem; import thaumcraft.api.aspects.IEssentiaTransport; import thaumcraft.client.fx.ParticleEngine; import thaumcraft.client.fx.bolt.FXLightningBolt; import thaumcraft.client.fx.particles.FXEssentiaTrail; import thaumcraft.common.Thaumcraft; +import thaumcraft.common.config.ConfigBlocks; +import thaumcraft.common.config.ConfigItems; import thaumcraft.common.lib.events.EssentiaHandler; import thaumcraft.common.lib.network.PacketHandler; import thaumcraft.common.lib.network.fx.PacketFXEssentiaSource; -import thaumcraft.common.tiles.TileJarFillable; -import thaumcraft.common.tiles.TileMirrorEssentia; +import thaumcraft.common.tiles.TilePedestal; import java.awt.*; -import java.lang.reflect.Field; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; @@ -57,6 +55,9 @@ import java.util.Map; */ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IAspectSource, IEssentiaTransport { + public static final int MAX_SIZE = 8; + public static final int MAX_ASPECT_STORAGE = 3000, STD_ASPECT_STORAGE = 200; + private static Injector injEssentiaHandler = new Injector(EssentiaHandler.class); private static int multiblockIDCounter = 0; @@ -66,6 +67,10 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IA private boolean isMultiblockPresent = false; + private int incSize = 0; + private Vector3 coordPedestal = null; + private int consumeTick = 0; + private AspectList al = new AspectList(); private int ticksExisted = 0; private boolean prevFound = false; @@ -90,6 +95,10 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IA prevFound = searchForEssentia(coords); } } + + if(isMasterTile() && ((incSize < MAX_SIZE && (ticksExisted % 40) == 0) || (coordPedestal != null))) { + consumeVoidmetal(); + } } else { if(isMasterTile() && isMultiblockFormed()) { playLightningEffects(); @@ -105,6 +114,65 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IA } } + private void consumeVoidmetal() { + if(coordPedestal != null) { + if(!checkPedestal(coordPedestal)) { + consumeTick = 0; + coordPedestal = null; + return; + } + consumeTick++; + if(consumeTick <= 400) { + PacketAnimationAbsorb absorb = new PacketAnimationAbsorb( + xCoord, yCoord + 1, zCoord, + coordPedestal.getBlockX(), coordPedestal.getBlockY() + 1, coordPedestal.getBlockZ(), + 5, Block.getIdFromBlock(ConfigBlocks.blockCosmeticSolid), 1); + makeo.gadomancy.common.network.PacketHandler.INSTANCE.sendToAllAround(absorb, new NetworkRegistry.TargetPoint( + getWorldObj().provider.dimensionId, + xCoord, yCoord, zCoord, 16)); + } else { + TilePedestal te = (TilePedestal) worldObj.getTileEntity( + coordPedestal.getBlockX(), coordPedestal.getBlockY(), coordPedestal.getBlockZ()); + te.setInventorySlotContents(0, null); + te.markDirty(); + worldObj.markBlockForUpdate( + coordPedestal.getBlockX(), coordPedestal.getBlockY(), coordPedestal.getBlockZ()); + consumeTick = 0; + coordPedestal = null; + incSize += 1; + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + markDirty(); + } + } else { + for (int xx = -3; xx <= 3; xx++) { + for (int zz = -3; zz <= 3; zz++) { + Vector3 offset = new Vector3(xCoord + xx, yCoord, zCoord + zz); + if(checkPedestal(offset)) { + this.coordPedestal = offset; + this.consumeTick = 0; + return; + } + } + } + this.coordPedestal = null; + this.consumeTick = 0; + } + } + + private boolean checkPedestal(Vector3 coordPedestal) { + Block at = worldObj.getBlock( + coordPedestal.getBlockX(), coordPedestal.getBlockY(), coordPedestal.getBlockZ()); + int md = worldObj.getBlockMetadata( + coordPedestal.getBlockX(), coordPedestal.getBlockY(), coordPedestal.getBlockZ()); + TileEntity te = worldObj.getTileEntity( + coordPedestal.getBlockX(), coordPedestal.getBlockY(), coordPedestal.getBlockZ()); + if(at == null || te == null || md != 1) return false; + if(!at.equals(RegisteredBlocks.blockStoneMachine) || !(te instanceof TilePedestal)) return false; + ItemStack st = ((TilePedestal) te).getStackInSlot(0); + if(st == null || st.getItem() == null) return false; + return st.getItem().equals(RegisteredItems.itemElement) && st.getItemDamage() == 0; + } + //only call from master tile. private boolean searchForEssentia(List coordinates) { if(ticksExisted % 10 != 0) return prevFound; @@ -130,6 +198,7 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IA IAspectSource as = (IAspectSource)sourceTile; AspectList contains = as.getAspects(); if(contains.visSize() > al.visSize()) continue; + if(!canAccept(a)) continue; if (as.takeFromContainer(a, 1)) { PacketHandler.INSTANCE.sendToAllAround(new PacketFXEssentiaSource(xCoord, yCoord + 1, zCoord, (byte)(xCoord - coordinate.x), (byte)(yCoord - coordinate.y + 1), (byte)(zCoord - coordinate.z), @@ -140,6 +209,16 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IA return false; } + private boolean canAccept(Aspect a) { + int current = al.getAmount(a); + int max = STD_ASPECT_STORAGE + incSize * ((MAX_ASPECT_STORAGE - STD_ASPECT_STORAGE) / MAX_SIZE); + return current < max; + } + + public int getSizeStage() { + return incSize; + } + float tr = 1.0F; float tri = 0.0F; float tg = 1.0F; @@ -260,7 +339,7 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IA @SideOnly(Side.CLIENT) private void playLightningEffects() { - if(worldObj.rand.nextBoolean()) { + if(incSize > 5 || worldObj.rand.nextBoolean()) { double originX = xCoord + 0.5; double originY = yCoord + 1.5; double originZ = zCoord + 0.5; @@ -400,6 +479,7 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IA this.isMasterTile = compound.getBoolean("isMasterTile"); this.multiblockId = compound.getInteger("multiblockId"); this.isMultiblockPresent = compound.getBoolean("multiblockPresent"); + this.incSize = compound.getInteger("sizeInc"); AspectList al = new AspectList(); NBTTagCompound cmp = compound.getCompoundTag("aspects"); for (Object tag : cmp.func_150296_c()) { @@ -418,6 +498,7 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IA compound.setInteger("multiblockId", this.multiblockId); compound.setInteger("multiblockYIndex", this.multiblockYIndex); compound.setBoolean("multiblockPresent", this.isMasterTile); + compound.setInteger("sizeInc", this.incSize); NBTTagCompound aspects = new NBTTagCompound(); for (Aspect a : al.aspects.keySet()) { aspects.setInteger(a.getTag(), al.aspects.get(a)); diff --git a/src/main/java/makeo/gadomancy/common/network/packets/PacketAnimationAbsorb.java b/src/main/java/makeo/gadomancy/common/network/packets/PacketAnimationAbsorb.java index 1f3edd0..ed37c34 100644 --- a/src/main/java/makeo/gadomancy/common/network/packets/PacketAnimationAbsorb.java +++ b/src/main/java/makeo/gadomancy/common/network/packets/PacketAnimationAbsorb.java @@ -23,6 +23,7 @@ public class PacketAnimationAbsorb implements IMessage, IMessageHandler