diff --git a/src/main/java/makeo/gadomancy/client/ClientProxy.java b/src/main/java/makeo/gadomancy/client/ClientProxy.java index 930a361..2d1dc4d 100644 --- a/src/main/java/makeo/gadomancy/client/ClientProxy.java +++ b/src/main/java/makeo/gadomancy/client/ClientProxy.java @@ -25,6 +25,7 @@ import makeo.gadomancy.client.renderers.item.ItemRenderTileEntityMulti; import makeo.gadomancy.client.renderers.tile.*; import makeo.gadomancy.common.CommonProxy; import makeo.gadomancy.common.blocks.tiles.*; +import makeo.gadomancy.common.entities.fake.EntityPermNoClipItem; import makeo.gadomancy.common.registration.RegisteredBlocks; import makeo.gadomancy.common.registration.RegisteredItems; import makeo.gadomancy.common.utils.Injector; @@ -42,6 +43,7 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.ForgeDirection; import thaumcraft.client.gui.GuiGolem; import thaumcraft.client.renderers.entity.RenderGolemBase; +import thaumcraft.client.renderers.entity.RenderSpecialItem; import thaumcraft.client.renderers.tile.TileEldritchPortalRenderer; import thaumcraft.common.config.ConfigBlocks; import thaumcraft.common.entities.golems.EntityGolemBase; @@ -117,9 +119,9 @@ public class ClientProxy extends CommonProxy { MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ConfigBlocks.blockAiry), new ItemExNodeRenderer()); - //ItemRenderTileEntityMulti multi = new ItemRenderTileEntityMulti(new ItemRenderTileEntityMulti.RenderSet(renderTileAuraPylon, new TileAuraPylon(), 0), - // new ItemRenderTileEntityMulti.RenderSet(renderTileAuraPylon, new TileAuraPylonTop(), 1)); - //MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockAuraPylon), multi); + ItemRenderTileEntityMulti multi = new ItemRenderTileEntityMulti(new ItemRenderTileEntityMulti.RenderSet(renderTileAuraPylon, new TileAuraPylon(), 0), + new ItemRenderTileEntityMulti.RenderSet(renderTileAuraPylon, new TileAuraPylonTop(), 1)); + MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockAuraPylon), multi); MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemExtendedNodeJar, new ItemJarExtendedNodeRenderer()); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockRemoteJar), new ItemRenderRemoteJar(renderTileRemoteJar)); @@ -137,6 +139,8 @@ public class ClientProxy extends CommonProxy { MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemFamiliar, new ItemRenderFamiliar()); MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemCreativeNode, new ItemCreativeNodeRenderer()); + RenderingRegistry.registerEntityRenderingHandler(EntityPermNoClipItem.class, new RenderSpecialItem()); + //Blocks RegisteredBlocks.rendererTransparentBlock = registerBlockRenderer(new RenderBlockTransparent()); RegisteredBlocks.rendererExtendedNodeJarBlock = registerBlockRenderer(new BlockExtendedNodeJarRenderer()); diff --git a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileAuraPylon.java b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileAuraPylon.java index f8dd42d..3663f64 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileAuraPylon.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileAuraPylon.java @@ -68,21 +68,36 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer { Aspect a = ((TileAuraPylonTop) tile).getAspect(); if(a == null) a = Aspect.WEATHER; Color c = new Color(a.getColor()); - if(tile.getWorldObj().rand.nextInt(9) == 0) spawnWispParticles((TileAuraPylonTop) tile, c, 0.5F, false); + if(tile.getWorldObj().rand.nextInt(9) == 0) { + if(a == Aspect.ENTROPY || a == Aspect.DARKNESS || a == Aspect.UNDEAD) { + spawnWispParticles((TileAuraPylonTop) tile, 5, 0.5F, false); + } else { + spawnWispParticles((TileAuraPylonTop) tile, c, 0.5F, false); + } + } c = c.darker().darker(); - if(tile.getWorldObj().rand.nextInt(15) == 0) spawnWispParticles((TileAuraPylonTop) tile, c, 0.25F, true); + if(tile.getWorldObj().rand.nextInt(15) == 0) { + if(a == Aspect.ENTROPY || a == Aspect.DARKNESS || a == Aspect.UNDEAD) { + spawnWispParticles((TileAuraPylonTop) tile, 5, 0.25F, false); + } else { + spawnWispParticles((TileAuraPylonTop) tile, c, 0.25F, false); + } + } } - if(tile instanceof TileAuraPylon && ((TileAuraPylon) tile).isInputTile() && ((TileAuraPylon) tile).isPartOfMultiblock() && ((TileAuraPylon) tile).getAspectType() != null) { - Aspect a = ((TileAuraPylon) tile).getAspectType(); - TileAuraPylon master = ((TileAuraPylon) tile).getMasterTile(); - if(master == null) return; - if(a == null) return; - FXEssentiaTrail essentiaTrail = new FXEssentiaTrail(tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, master.xCoord, master.yCoord, master.zCoord, 1, a.getColor(), 0.2F); - essentiaTrail.noClip = true; - ParticleEngine.instance.addEffect(tile.getWorldObj(), essentiaTrail); - } + } + private void spawnWispParticles(TileAuraPylonTop tile, int type, float size, boolean inner) { + World worldObj = tile.getWorldObj(); + int xCoord = tile.xCoord; + int yCoord = tile.yCoord; + int zCoord = tile.zCoord; + float offset1 = inner ? 0.4F : 0.3F; + float offset2 = inner ? 0.2F : 0.4F; + FXWisp ef = new FXWisp(worldObj, xCoord + 0.55F, yCoord + 0.7F, zCoord + 0.55F, xCoord + offset1 + worldObj.rand.nextFloat() * offset2, yCoord + 0.7F, zCoord + offset1 + worldObj.rand.nextFloat() * offset2, size, type); + ef.setGravity(-0.04F); + ef.shrink = true; + ParticleEngine.instance.addEffect(worldObj, ef); } private void spawnWispParticles(TileAuraPylonTop tile, Color c, float size, boolean inner) { @@ -92,7 +107,10 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer { int zCoord = tile.zCoord; float offset1 = inner ? 0.4F : 0.3F; float offset2 = inner ? 0.2F : 0.4F; - FXWisp ef = new FXWisp(worldObj, xCoord + 0.55F, yCoord + 0.7F, zCoord + 0.55F, xCoord + offset1 + worldObj.rand.nextFloat() * offset2, yCoord + 0.7F, zCoord + offset1 + worldObj.rand.nextFloat() * offset2, size, c.getRed(), c.getGreen(), c.getBlue()); + float red = c.getRed() / 255F; + float green = c.getGreen() / 255F; + float blue = c.getBlue() / 255F; + FXWisp ef = new FXWisp(worldObj, xCoord + 0.55F, yCoord + 0.7F, zCoord + 0.55F, xCoord + offset1 + worldObj.rand.nextFloat() * offset2, yCoord + 0.7F, zCoord + offset1 + worldObj.rand.nextFloat() * offset2, size, red, green, blue); ef.setGravity(-0.04F); ef.shrink = true; ParticleEngine.instance.addEffect(worldObj, ef); diff --git a/src/main/java/makeo/gadomancy/common/CommonProxy.java b/src/main/java/makeo/gadomancy/common/CommonProxy.java index 6e78d7f..c9be316 100644 --- a/src/main/java/makeo/gadomancy/common/CommonProxy.java +++ b/src/main/java/makeo/gadomancy/common/CommonProxy.java @@ -3,11 +3,13 @@ package makeo.gadomancy.common; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.NetworkRegistry; +import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.relauncher.Side; import makeo.gadomancy.client.ClientProxy; import makeo.gadomancy.common.containers.ContainerArcanePackager; import makeo.gadomancy.common.containers.ContainerInfusionClaw; import makeo.gadomancy.common.data.ModConfig; +import makeo.gadomancy.common.entities.fake.EntityPermNoClipItem; import makeo.gadomancy.common.events.EventHandlerEntity; import makeo.gadomancy.common.events.EventHandlerGolem; import makeo.gadomancy.common.events.EventHandlerNetwork; @@ -84,6 +86,8 @@ public class CommonProxy implements IGuiHandler { DimensionManager.registerProviderType(ModConfig.dimOuterId, WorldProviderTCEldrich.class, true); DimensionManager.registerDimension(ModConfig.dimOuterId, ModConfig.dimOuterId); + + EntityRegistry.registerModEntity(EntityPermNoClipItem.class, "EntityPermItem", EntityRegistry.findGlobalUniqueEntityId(), Gadomancy.instance, 32, 10, true); } public void postInitalize() { diff --git a/src/main/java/makeo/gadomancy/common/Gadomancy.java b/src/main/java/makeo/gadomancy/common/Gadomancy.java index e78cf18..45457a4 100644 --- a/src/main/java/makeo/gadomancy/common/Gadomancy.java +++ b/src/main/java/makeo/gadomancy/common/Gadomancy.java @@ -22,8 +22,7 @@ import thaumcraft.common.Thaumcraft; * Created by makeo @ 29.11.2014 14:07 */ @Mod(modid = Gadomancy.MODID, name = Gadomancy.NAME, version = Gadomancy.VERSION, dependencies="required-after:Thaumcraft@[4.1.1.11,);after:Waila;after:Automagy") -public class Gadomancy -{ +public class Gadomancy { public static final String MODID = "gadomancy"; public static final String NAME = "Gadomancy"; diff --git a/src/main/java/makeo/gadomancy/common/blocks/BlockAuraPylon.java b/src/main/java/makeo/gadomancy/common/blocks/BlockAuraPylon.java index 50a39fc..5abe7e9 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/BlockAuraPylon.java +++ b/src/main/java/makeo/gadomancy/common/blocks/BlockAuraPylon.java @@ -19,6 +19,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import thaumcraft.api.ThaumcraftApiHelper; import thaumcraft.common.items.wands.ItemWandCasting; @@ -63,6 +64,15 @@ public class BlockAuraPylon extends BlockContainer implements IBlockTransparent list.add(new ItemStack(item, 1, 1)); } + @Override + public int getLightValue(IBlockAccess world, int x, int y, int z) { + int meta = world.getBlockMetadata(x, y, z); + if(meta == 1) { + return 10; + } + return super.getLightValue(world, x, y, z); + } + @Override public int damageDropped(int meta) { return meta; @@ -96,7 +106,7 @@ public class BlockAuraPylon extends BlockContainer implements IBlockTransparent ThaumcraftApiHelper.consumeVisFromWandCrafting(player.getCurrentEquippedItem(), player, RegisteredRecipes.costsAuraPylonMultiblock, true)) { TileAuraPylon ta = (TileAuraPylon) world.getTileEntity(x, y - 1, z); ta.setTileInformation(true, false); - ta = (TileAuraPylon) world.getTileEntity(x, y - 4, z); + ta = (TileAuraPylon) world.getTileEntity(x, y - 3, z); ta.setTileInformation(false, true); int count = 1; TileEntity iter = world.getTileEntity(x, y - count, z); diff --git a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileAuraPylon.java b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileAuraPylon.java index 9629a9b..b7d82e0 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileAuraPylon.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileAuraPylon.java @@ -1,7 +1,9 @@ package makeo.gadomancy.common.blocks.tiles; import makeo.gadomancy.common.blocks.BlockAuraPylon; +import makeo.gadomancy.common.entities.fake.EntityPermNoClipItem; import makeo.gadomancy.common.utils.ItemUtils; +import makeo.gadomancy.common.utils.NBTHelper; import net.minecraft.block.Block; import net.minecraft.command.IEntitySelector; import net.minecraft.entity.Entity; @@ -11,12 +13,15 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.MathHelper; import net.minecraftforge.common.util.ForgeDirection; import thaumcraft.api.ThaumcraftApiHelper; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.aspects.IAspectContainer; import thaumcraft.api.aspects.IEssentiaTransport; +import thaumcraft.client.fx.ParticleEngine; +import thaumcraft.client.fx.particles.FXEssentiaTrail; import thaumcraft.common.Thaumcraft; import thaumcraft.common.entities.EntityPermanentItem; import thaumcraft.common.entities.EntitySpecialItem; @@ -47,9 +52,8 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont //Master tile updates effects all 8 ticks if there is an internal aspect present. //Input tile handles Essentia IO all 8 ticks and thus provides needed amount information. - private EntityPermanentItem tcPermItem; + private ItemStack crystalEssentiaStack = null; private boolean isPartOfMultiblock = false; - private boolean searchingForItem = false; private int ticksExisted = 0; private Aspect holdingAspect; @@ -63,7 +67,7 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont public void updateEntity() { ticksExisted++; - if(!worldObj.isRemote) { + if (!worldObj.isRemote) { if ((ticksExisted & 7) == 0) { if (checkComponents()) return; } @@ -71,27 +75,65 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont if (isInputTile()) { handleIO(); } + if (isMasterTile()) { - boolean hasChanged = handleCrystal(); - if (hasChanged) { + if(holdingAspect != null) { handleEffectDistribution(); } } } else { - if(isMasterTile() && searchingForItem) { - tryVortexPossibleItemsClient(); - } - if(isInputTile() && holdingAspect != null) { + if( isInputTile() && holdingAspect != null) { doEssentiaTrail(); } } + + if (isMasterTile()) { + if (crystalEssentiaStack == null) { + tryVortexPossibleItems(); + } + } } - private void tryVortexPossibleItemsClient() { + //Client-Side input tile only! + private void doEssentiaTrail() { + if((ticksExisted & 1) == 0) return; + TileAuraPylon tile = getMasterTile(); + if(tile == null) return; + TileAuraPylon inputTile = getInputTile(); + if(inputTile == null) return; + Aspect a = getAspectType(); + if(a == null) return; + + int count = 5; + FXEssentiaTrail essentiaTrail = new FXEssentiaTrail(tile.getWorldObj(), inputTile.xCoord + 0.5, inputTile.yCoord + 0.2, inputTile.zCoord + 0.5, tile.xCoord + 0.5, tile.yCoord + 1.7, tile.zCoord + 0.5, count, a.getColor(), 1); + essentiaTrail.noClip = true; + essentiaTrail.motionY = (0.1F + MathHelper.sin(count / 3.0F) * 0.01F); + essentiaTrail.motionX = (MathHelper.sin(count / 10.0F) * 0.001F + worldObj.rand.nextGaussian() * 0.002000000094994903D); + essentiaTrail.motionX = (MathHelper.sin(count / 10.0F) * 0.001F + worldObj.rand.nextGaussian() * 0.002000000094994903D); + ParticleEngine.instance.addEffect(tile.getWorldObj(), essentiaTrail); + } + + //Special to masterTile only! + private void handleEffectDistribution() { + int count = 1; + TileEntity iter = worldObj.getTileEntity(xCoord, yCoord - count, zCoord); + while(iter != null && iter instanceof TileAuraPylon) { + ((TileAuraPylon) iter).holdingAspect = holdingAspect; + worldObj.markBlockForUpdate(xCoord, yCoord - count, zCoord); + iter.markDirty(); + count++; + iter = worldObj.getTileEntity(xCoord, yCoord - count, zCoord); + } + } + + //Special to masterTile only! + private void tryVortexPossibleItems() { TileAuraPylon io = getInputTile(); if (io == null) return; - ChunkCoordinates rel = new ChunkCoordinates(xCoord, yCoord - (yCoord - io.yCoord), zCoord); + int masterY = yCoord + 1; + int dst = (masterY - io.yCoord) / 2; + ChunkCoordinates rel = new ChunkCoordinates(xCoord, masterY - dst, zCoord); List entityItems = worldObj.selectEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(rel.posX - 0.5, rel.posY - 0.5, rel.posZ - 0.5, rel.posX + 0.5, rel.posY + 0.5, rel.posZ + 0.5).expand(8, 8, 8), new IEntitySelector() { @Override @@ -120,132 +162,25 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont } } if(entity == null) return; - if(dummy.getDistanceSqToEntity(entity) >= 4) { - entity.noClip = true; - applyMovementVectors(entity); - } - } + if(dummy.getDistanceToEntity(entity) < 3 && !worldObj.isRemote) { + this.crystalEssentiaStack = entity.getEntityItem(); - //Client-Side input tile only! - private void doEssentiaTrail() { - if((ticksExisted & 1) == 0) return; - TileAuraPylon masterTile = getMasterTile(); - if(masterTile == null) return; - Thaumcraft.proxy.essentiaTrailFx(worldObj, xCoord, yCoord, zCoord, masterTile.xCoord, masterTile.yCoord, masterTile.zCoord, 10, holdingAspect.getColor(), 1); - } - - //Special to masterTile only! - private void handleEffectDistribution() { - int count = 1; - TileEntity iter = worldObj.getTileEntity(xCoord, yCoord - count, zCoord); - while(iter != null && iter instanceof TileAuraPylon) { - ((TileAuraPylon) iter).holdingAspect = holdingAspect; - worldObj.markBlockForUpdate(xCoord, yCoord - count, zCoord); - iter.markDirty(); - count++; - iter = worldObj.getTileEntity(xCoord, yCoord - count, zCoord); - } - } - - //Special to masterTile only! - private boolean handleCrystal() { - if ((ticksExisted & 3) != 0) return false; - - boolean hasAspect = holdingAspect != null; - boolean hasItem = tcPermItem != null; - boolean isSearching = searchingForItem; - - tcPermItem = searchForPermItem(); - - if (holdingAspect == null) { - if(tcPermItem != null) { - holdingAspect = ((ItemCrystalEssence) tcPermItem.getEntityItem().getItem()).getAspects(tcPermItem.getEntityItem()).getAspects()[0]; - } - } else { - if(tcPermItem == null) { - holdingAspect = null; - } - } - - if(tcPermItem == null) { - if(!searchingForItem) { - searchingForItem = true; - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } - } else { - if(searchingForItem) { - searchingForItem = false; - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } - } - - if((holdingAspect == null) != hasAspect) { - return true; - } else if((tcPermItem == null) != hasItem) { - return true; - } else if(searchingForItem != isSearching) { - return true; - } - return false; - } - - //Special to masterTile only! - private EntityPermanentItem searchForPermItem() { - if(tcPermItem != null) return tcPermItem; - EntityPermanentItem tcPermItem = tryFindPermItem(); - if (tcPermItem == null) { - tcPermItem = tryVortexPossibleItems(); - } - return tcPermItem; - } - - //Special to masterTile only! - private EntityPermanentItem tryVortexPossibleItems() { - TileAuraPylon io = getInputTile(); - if (io == null) return null; - ChunkCoordinates rel = new ChunkCoordinates(xCoord, yCoord - (yCoord - io.yCoord), zCoord); - List entityItems = worldObj.selectEntitiesWithinAABB(EntityItem.class, - AxisAlignedBB.getBoundingBox(rel.posX - 0.5, rel.posY - 0.5, rel.posZ - 0.5, rel.posX + 0.5, rel.posY + 0.5, rel.posZ + 0.5).expand(8, 8, 8), new IEntitySelector() { - @Override - public boolean isEntityApplicable(Entity e) { - return !(e instanceof EntityPermanentItem) && !(e instanceof EntitySpecialItem) && - e instanceof EntityItem && ((EntityItem) e).getEntityItem() != null && - ((EntityItem) e).getEntityItem().getItem() instanceof ItemCrystalEssence; - } - }); - Entity dummy = new EntityItem(worldObj); - dummy.posX = rel.posX + 0.5; - dummy.posY = rel.posY + 0.5; - dummy.posZ = rel.posZ + 0.5; - - //MC code. - EntityItem entity = null; - double d0 = Double.MAX_VALUE; - for (Object entityItem : entityItems) { - EntityItem entityIt = (EntityItem) entityItem; - if (entityIt != dummy) { - double d1 = dummy.getDistanceSqToEntity(entityIt); - if (d1 <= d0) { - entity = entityIt; - d0 = d1; - } - } - } - if(entity == null) return null; - if(dummy.getDistanceToEntity(entity) < 4) { - EntityPermanentItem item = new EntityPermanentItem(entity.worldObj, entity.posX, entity.posY, entity.posZ, entity.getEntityItem()); + EntityPermNoClipItem item = new EntityPermNoClipItem(entity.worldObj, rel.posX + 0.5F, rel.posY + 0.5F, rel.posZ + 0.5F, crystalEssentiaStack, xCoord, yCoord, zCoord); entity.worldObj.spawnEntityInWorld(item); item.setVelocity(0, 0, 0); item.hoverStart = entity.hoverStart; item.age = entity.age; item.noClip = true; + + holdingAspect = ((ItemCrystalEssence) crystalEssentiaStack.getItem()).getAspects(crystalEssentiaStack).getAspects()[0]; + entity.setDead(); - return item; + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + markDirty(); } else { entity.noClip = true; applyMovementVectors(entity); } - return null; } //Special to masterTile only! @@ -263,24 +198,6 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont } } - //Special to masterTile only! - private EntityPermanentItem tryFindPermItem() { - TileAuraPylon io = getInputTile(); - if (io == null) return null; - ChunkCoordinates rel = new ChunkCoordinates(xCoord, yCoord - (yCoord - io.yCoord), zCoord); - Entity dummy = new EntityItem(worldObj); - dummy.posX = rel.posX + 0.5; - dummy.posY = rel.posY + 0.5; - dummy.posZ = rel.posZ + 0.5; - Entity permItem = worldObj.findNearestEntityWithinAABB(EntityPermanentItem.class, - AxisAlignedBB.getBoundingBox(rel.posX - 0.5, rel.posY - 0.5, rel.posZ - 0.5, rel.posX + 0.5, rel.posY + 0.5, rel.posZ + 0.5), dummy); - if (permItem == null) return null; - if (((EntityPermanentItem) permItem).getEntityItem() != null && ((EntityPermanentItem) permItem).getEntityItem().getItem() instanceof ItemCrystalEssence) { - return (EntityPermanentItem) permItem; - } - return null; - } - //Special to inputTile only! private void handleIO() { if ((!worldObj.isRemote) && ((ticksExisted & 7) == 0) && (getEssentiaAmount() < getMaxAmount())) { @@ -298,6 +215,13 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont } } + public void informItemPickup() { + if(!isMasterTile()) return; + this.crystalEssentiaStack = null; + this.holdingAspect = null; + handleEffectDistribution(); + } + //Individual. //Returns true, if state has changed, false if still complete state. private boolean checkComponents() { @@ -334,8 +258,8 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont if(pylon != null) { ArrayList stacks = pylon.getDrops(worldObj, xCoord, yCoord, zCoord, meta, 0); for(ItemStack i : stacks) { - EntityItem item = new EntityItem(worldObj, xCoord, yCoord, zCoord, i); - ItemUtils.applyRandomDropOffset(item, worldObj.rand); + EntityItem item = new EntityItem(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, i); + //ItemUtils.applyRandomDropOffset(item, worldObj.rand); worldObj.spawnEntityInWorld(item); } } @@ -435,7 +359,7 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont this.amount = compound.getInteger("amount"); this.maxAmount = compound.getInteger("maxAmount"); this.isPartOfMultiblock = compound.getBoolean("partOfMultiblock"); - this.searchingForItem = compound.getBoolean("searchingItem"); + this.crystalEssentiaStack = NBTHelper.getStack(compound, "crystalStack"); } @Override @@ -448,7 +372,8 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont compound.setInteger("amount", amount); compound.setInteger("maxAmount", maxAmount); compound.setBoolean("partOfMultiblock", isPartOfMultiblock); - compound.setBoolean("searchingItem", searchingForItem); + if(crystalEssentiaStack != null) + NBTHelper.setStack(compound, "crystalStack", crystalEssentiaStack); } /////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/main/java/makeo/gadomancy/common/data/ModConfig.java b/src/main/java/makeo/gadomancy/common/data/ModConfig.java index f935dae..f8874b5 100644 --- a/src/main/java/makeo/gadomancy/common/data/ModConfig.java +++ b/src/main/java/makeo/gadomancy/common/data/ModConfig.java @@ -16,6 +16,15 @@ public class ModConfig { private static Configuration config; + @Sync + public static int entityNoClipItemDatawatcherMasterId = 19; + @Sync + public static int entityNoClipItemDatawatcherFixedXId = 20; + @Sync + public static int entityNoClipItemDatawatcherFixedYId = 21; + @Sync + public static int entityNoClipItemDatawatcherFixedZId = 22; + @Sync public static int golemDatawatcherId = 29; @Sync @@ -40,6 +49,11 @@ public class ModConfig { } private static void loadFromConfig() { + entityNoClipItemDatawatcherMasterId = config.getInt("itemNoClipDatawatcherMasterId", "entities", 19, 0, 31, "Do not edit unless you know what are you doing! - Datawatcher ID of the Master-Coordinates for EntityNoClipItem"); + entityNoClipItemDatawatcherFixedXId = config.getInt("itemNoClipDatawatchetFixXId", "entities", 20, 0, 31, "Do not edit unless you know what are you doing! - Datawatcher ID of the X-Coordinates for EntityNoClipItem"); + entityNoClipItemDatawatcherFixedYId = config.getInt("itemNoClipDatawatchetFixYId", "entities", 21, 0, 31, "Do not edit unless you know what are you doing! - Datawatcher ID of the Y-Coordinates for EntityNoClipItem"); + entityNoClipItemDatawatcherFixedZId = config.getInt("itemNoClipDatawatchetFixZId", "entities", 22, 0, 31, "Do not edit unless you know what are you doing! - Datawatcher ID of the Z-Coordinates for EntityNoClipItem"); + golemDatawatcherId = config.getInt("datawatcherId", "golem", 29, 0, 31, "Do not edit unless you know what are you doing!"); dimOuterId = config.getInt("dimOuterId", "dimension", -73, Integer.MIN_VALUE, Integer.MAX_VALUE, "Dimension Id for the eldrich mazes accessed via Node Manipulator"); doLightCalculations = config.getBoolean("calculateEldritchLight", "dimension", true, "TRUE = Calculating Light values for the Gadomancy-Eldritch Mazes; FALSE = No calculation, but some Light Bugs - Calculating the Light takes ~2 seconds -> Can be measured when trying to enter the eldritch mazed via Gadomancy Eldritch portal."); diff --git a/src/main/java/makeo/gadomancy/common/entities/fake/EntityAuraCore.java b/src/main/java/makeo/gadomancy/common/entities/fake/EntityAuraCore.java new file mode 100644 index 0000000..5b99e11 --- /dev/null +++ b/src/main/java/makeo/gadomancy/common/entities/fake/EntityAuraCore.java @@ -0,0 +1,59 @@ +package makeo.gadomancy.common.entities.fake; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.world.World; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.common.entities.EntitySpecialItem; + +/** + * This class is part of the Gadomancy Mod + * Gadomancy is Open Source and distributed under the + * GNU LESSER GENERAL PUBLIC LICENSE + * for more read the LICENSE file + * + * Created by HellFirePvP @ 16.11.2015 14:42 + */ +public class EntityAuraCore extends EntitySpecialItem { + + private int ticksExisted = 0; + private AspectList internalAuraList = new AspectList(); + + public EntityAuraCore(World world) { + super(world); + } + + @Override + public void onUpdate() {} + + @Override + public void readEntityFromNBT(NBTTagCompound compound) { + super.readEntityFromNBT(compound); + + ticksExisted = compound.getInteger("ticksExisted"); + NBTTagList list = compound.getTagList("auraList", compound.getId()); + for (int i = 0; i < list.tagCount(); i++) { + NBTTagCompound cmp = list.getCompoundTagAt(i); + if(cmp.hasKey("tag") && cmp.hasKey("amt")) { + internalAuraList.add(Aspect.getAspect(cmp.getString("tag")), cmp.getInteger("amt")); + } + } + } + + @Override + public void writeEntityToNBT(NBTTagCompound compound) { + super.writeEntityToNBT(compound); + + compound.setInteger("ticksExisted", ticksExisted); + NBTTagList list = new NBTTagList(); + for(Aspect a : internalAuraList.getAspects()) { + NBTTagCompound aspectCompound = new NBTTagCompound(); + aspectCompound.setString("tag", a.getTag()); + aspectCompound.setInteger("amt", internalAuraList.getAmount(a)); + list.appendTag(aspectCompound); + } + compound.setTag("auraList", list); + } + +} diff --git a/src/main/java/makeo/gadomancy/common/entities/fake/EntityPermNoClipItem.java b/src/main/java/makeo/gadomancy/common/entities/fake/EntityPermNoClipItem.java new file mode 100644 index 0000000..878da25 --- /dev/null +++ b/src/main/java/makeo/gadomancy/common/entities/fake/EntityPermNoClipItem.java @@ -0,0 +1,115 @@ +package makeo.gadomancy.common.entities.fake; + +import makeo.gadomancy.common.blocks.tiles.TileAuraPylon; +import makeo.gadomancy.common.data.ModConfig; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.World; +import thaumcraft.common.entities.EntityPermanentItem; + +/** + * This class is part of the Gadomancy Mod + * Gadomancy is Open Source and distributed under the + * GNU LESSER GENERAL PUBLIC LICENSE + * for more read the LICENSE file + * + * Created by HellFirePvP @ 16.11.2015 19:59 + */ +public class EntityPermNoClipItem extends EntityPermanentItem { + + private float fixPosX = -1, fixPosY = -1, fixPosZ = -1; //Can never actually get those values since pylon coords are never .0 + + private int masterX, masterY, masterZ; //Coords of its master tile. + + public EntityPermNoClipItem(World world) { + super(world); + } + + public EntityPermNoClipItem(World world, float x, float y, float z, ItemStack stack, int masterX, int masterY, int masterZ) { + super(world, x, y, z, stack); + this.fixPosX = x; + this.fixPosY = y; + this.fixPosZ = z; + this.masterX = masterX; + this.masterY = masterY; + this.masterZ = masterZ; + + ChunkCoordinates masterCoords = new ChunkCoordinates(this.masterX, this.masterY, this.masterZ); + getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherMasterId, masterCoords); + getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedXId, x); + getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedYId, y); + getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedZId, z); + } + + @Override + protected void entityInit() { + super.entityInit(); + + getDataWatcher().addObjectByDataType(ModConfig.entityNoClipItemDatawatcherMasterId, 6); + getDataWatcher().addObjectByDataType(ModConfig.entityNoClipItemDatawatcherFixedXId, 3); + getDataWatcher().addObjectByDataType(ModConfig.entityNoClipItemDatawatcherFixedYId, 3); + getDataWatcher().addObjectByDataType(ModConfig.entityNoClipItemDatawatcherFixedZId, 3); + + getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherMasterId, new ChunkCoordinates(0, 0, 0)); + getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedXId, -1F); + getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedYId, -1F); + getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedZId, -1F); + } + + @Override + public void onUpdate() { + noClip = true; + super.onUpdate(); + setVelocity(0, 0, 0); + if(getDataWatcher().getWatchedObject(ModConfig.entityNoClipItemDatawatcherFixedXId).getObject() == null) return; + + float fX = getDataWatcher().getWatchableObjectFloat(ModConfig.entityNoClipItemDatawatcherFixedXId); + float fY = getDataWatcher().getWatchableObjectFloat(ModConfig.entityNoClipItemDatawatcherFixedYId); + float fZ = getDataWatcher().getWatchableObjectFloat(ModConfig.entityNoClipItemDatawatcherFixedZId); + setPositionAndRotation(fX, fY, fZ, 0, 0); + + if((ticksExisted & 7) == 0 && !worldObj.isRemote) { + ChunkCoordinates masterCoords = (ChunkCoordinates) getDataWatcher().getWatchedObject(ModConfig.entityNoClipItemDatawatcherMasterId).getObject(); + TileEntity te = worldObj.getTileEntity(masterCoords.posX, masterCoords.posY, masterCoords.posZ); + if(te == null || !(te instanceof TileAuraPylon) || !((TileAuraPylon) te).isMasterTile()) { + EntityItem item = new EntityItem(worldObj, posX, posY, posZ, getEntityItem()); + worldObj.spawnEntityInWorld(item); + setDead(); + } + } + } + + @Override + public void readEntityFromNBT(NBTTagCompound com) { + super.readEntityFromNBT(com); + + this.fixPosX = com.getFloat("fX"); + this.fixPosY = com.getFloat("fY"); + this.fixPosZ = com.getFloat("fZ"); + + this.masterX = com.getInteger("mX"); + this.masterY = com.getInteger("mY"); + this.masterZ = com.getInteger("mZ"); + + getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherMasterId, new ChunkCoordinates(masterX, masterY, masterZ)); + getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedXId, fixPosX); + getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedYId, fixPosY); + getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedZId, fixPosZ); + } + + @Override + public void writeEntityToNBT(NBTTagCompound com) { + super.writeEntityToNBT(com); + + com.setFloat("fX", fixPosX); + com.setFloat("fY", fixPosY); + com.setFloat("fZ", fixPosZ); + + com.setInteger("mX", masterX); + com.setInteger("mY", masterY); + com.setInteger("mZ", masterZ); + } +} diff --git a/src/main/java/makeo/gadomancy/common/events/EventHandlerEntity.java b/src/main/java/makeo/gadomancy/common/events/EventHandlerEntity.java index 8cf19e5..3d1aa6a 100644 --- a/src/main/java/makeo/gadomancy/common/events/EventHandlerEntity.java +++ b/src/main/java/makeo/gadomancy/common/events/EventHandlerEntity.java @@ -2,14 +2,18 @@ package makeo.gadomancy.common.events; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import makeo.gadomancy.common.blocks.tiles.TileAuraPylon; import makeo.gadomancy.common.blocks.tiles.TileBlockProtector; import makeo.gadomancy.common.data.ModConfig; +import makeo.gadomancy.common.entities.fake.EntityPermNoClipItem; import makeo.gadomancy.common.familiar.FamiliarAIController; import makeo.gadomancy.common.utils.world.TCMazeHandler; import net.minecraft.entity.boss.IBossDisplayData; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraftforge.event.entity.EntityEvent; @@ -69,8 +73,12 @@ public class EventHandlerEntity { @SubscribeEvent public void on(EntityItemPickupEvent event) { if(!event.entityPlayer.worldObj.isRemote) { - if(event.item != null && event.item instanceof EntityPermanentItem) { - //TODO inform TileAuraPylon... + if(event.item != null && event.item instanceof EntityPermNoClipItem) { + EntityPermNoClipItem item = (EntityPermNoClipItem) event.item; + ChunkCoordinates master = (ChunkCoordinates) item.getDataWatcher().getWatchedObject(ModConfig.entityNoClipItemDatawatcherMasterId).getObject(); + TileEntity te = event.entityPlayer.worldObj.getTileEntity(master.posX, master.posY, master.posZ); + if(te == null || !(te instanceof TileAuraPylon)) return; + ((TileAuraPylon) te).informItemPickup(); } } } diff --git a/src/main/java/makeo/gadomancy/common/events/EventHandlerWorld.java b/src/main/java/makeo/gadomancy/common/events/EventHandlerWorld.java index e2f4981..05142e6 100644 --- a/src/main/java/makeo/gadomancy/common/events/EventHandlerWorld.java +++ b/src/main/java/makeo/gadomancy/common/events/EventHandlerWorld.java @@ -11,7 +11,7 @@ import makeo.gadomancy.common.data.ModConfig; import makeo.gadomancy.common.registration.RegisteredBlocks; import makeo.gadomancy.common.registration.RegisteredItems; import makeo.gadomancy.common.utils.GolemEnumHelper; -import makeo.gadomancy.common.utils.JarMultiblockHandler; +import makeo.gadomancy.common.utils.WandHandler; import makeo.gadomancy.common.utils.world.TCMazeHandler; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -58,7 +58,6 @@ public class EventHandlerWorld { @SubscribeEvent(priority = EventPriority.NORMAL) public void on(WorldEvent.Load e) { if (!e.world.isRemote && e.world.provider.dimensionId == 0) { - System.out.println("initWorld"); Gadomancy.loadModData(); GolemEnumHelper.validateSavedMapping(); @@ -184,7 +183,7 @@ public class EventHandlerWorld { if (e.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { ItemStack i = e.entityPlayer.getHeldItem(); if (i != null && (i.getItem() instanceof ItemWandCasting)) { - JarMultiblockHandler.handleWandInteract(e.world, e.x, e.y, e.z, e.entityPlayer, i); + WandHandler.handleWandInteract(e.world, e.x, e.y, e.z, e.entityPlayer, i); } } } diff --git a/src/main/java/makeo/gadomancy/common/items/ItemAuraCore.java b/src/main/java/makeo/gadomancy/common/items/ItemAuraCore.java new file mode 100644 index 0000000..806ec21 --- /dev/null +++ b/src/main/java/makeo/gadomancy/common/items/ItemAuraCore.java @@ -0,0 +1,87 @@ +package makeo.gadomancy.common.items; + +import makeo.gadomancy.common.utils.NBTHelper; +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.EnumChatFormatting; +import net.minecraft.util.StatCollector; + +import java.util.List; + +/** + * This class is part of the Gadomancy Mod + * Gadomancy is Open Source and distributed under the + * GNU LESSER GENERAL PUBLIC LICENSE + * for more read the LICENSE file + * + * Created by HellFirePvP @ 16.11.2015 15:23 + */ +public class ItemAuraCore extends Item { + + public ItemAuraCore() { + setMaxDamage(0); + setHasSubtypes(true); + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean flag) { + AuraCoreType type = getCoreType(stack); + if(type != null) { + list.add(EnumChatFormatting.GRAY + type.getLocalizedName()); + } + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (int i = 0; i < AuraCoreType.values().length; i++) { + ItemStack stack = new ItemStack(item); + setCoreType(stack, AuraCoreType.values()[i]); + list.add(stack); + } + } + + public void setCoreType(ItemStack itemStack, AuraCoreType type) { + if(itemStack == null || !(itemStack.getItem() instanceof ItemAuraCore)) return; + if(type == null) return; + NBTHelper.getData(itemStack).setInteger("type", type.ordinal()); + } + + public AuraCoreType getCoreType(ItemStack itemStack) { + if(itemStack == null || !(itemStack.getItem() instanceof ItemAuraCore)) return null; + int ordinal = NBTHelper.getData(itemStack).getInteger("type"); + return AuraCoreType.values()[ordinal]; + } + + public boolean isBlank(ItemStack itemStack) { + AuraCoreType type = getCoreType(itemStack); + return type == AuraCoreType.BLANK || type == null; + } + + public static enum AuraCoreType { + + BLANK("Blank", "blank"), + + AIR("Aer", "aer"), + FIRE("Ignis", "ignis"), + WATER("Aqua", "aqua"), + EARTH("Terra", "terra"), + ORDER("Ordo", "ordo"), + ENTROPY("Perditio", "perditio"), + + BALANCE("Balanced", "balanced"); + + public final String unlocName, fallback; + + AuraCoreType(String fallback, String unlocName) { + this.unlocName = "gadomancy.auracore." + unlocName; + this.fallback = fallback; + } + + public String getLocalizedName() { + return StatCollector.canTranslate(unlocName) ? StatCollector.translateToLocal(unlocName) : fallback; + } + } + +} diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredBlocks.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredBlocks.java index e9f63ab..b1307e8 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredBlocks.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredBlocks.java @@ -87,7 +87,7 @@ public class RegisteredBlocks { blockNodeManipulator = registerBlock(new BlockNodeManipulator(), ItemNodeManipulator.class); blockStoneMachine = registerBlock(new BlockStoneMachine(), ItemBlockStoneMachine.class); blockAdditionalEldrichPortal = registerBlock(new BlockAdditionalEldritchPortal(), ItemBlockAdditionalEldritchPortal.class); - //blockAuraPylon = registerBlock(new BlockAuraPylon(), ItemBlockAuraPylon.class); + blockAuraPylon = registerBlock(new BlockAuraPylon(), ItemBlockAuraPylon.class); } private static T registerBlock(String name, T block) { @@ -125,8 +125,8 @@ public class RegisteredBlocks { registerTile(TileManipulationFocus.class); registerTile(TileAdditionalEldritchPortal.class); registerTile(TileBlockProtector.class); - //registerTile(TileAuraPylon.class); - //registerTile(TileAuraPylonTop.class); + registerTile(TileAuraPylon.class); + registerTile(TileAuraPylonTop.class); } private static void registerTile(Class tile, String name) { diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredMultiblocks.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredMultiblocks.java index 5b0de91..cecde0c 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredMultiblocks.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredMultiblocks.java @@ -39,6 +39,5 @@ public class RegisteredMultiblocks { public static final MultiblockHelper.MultiblockPattern auraPylonPattern = new MultiblockHelper.MultiblockPattern(RegisteredBlocks.blockAuraPylon, 1) .addBlock(0, -1, 0, RegisteredBlocks.blockAuraPylon, 0) .addBlock(0, -2, 0, RegisteredBlocks.blockAuraPylon, 0) - .addBlock(0, -3, 0, RegisteredBlocks.blockAuraPylon, 0) - .addBlock(0, -4, 0, RegisteredBlocks.blockAuraPylon, 0); + .addBlock(0, -3, 0, RegisteredBlocks.blockAuraPylon, 0); } diff --git a/src/main/java/makeo/gadomancy/common/utils/JarMultiblockHandler.java b/src/main/java/makeo/gadomancy/common/utils/WandHandler.java similarity index 77% rename from src/main/java/makeo/gadomancy/common/utils/JarMultiblockHandler.java rename to src/main/java/makeo/gadomancy/common/utils/WandHandler.java index 909e870..0505748 100644 --- a/src/main/java/makeo/gadomancy/common/utils/JarMultiblockHandler.java +++ b/src/main/java/makeo/gadomancy/common/utils/WandHandler.java @@ -2,15 +2,18 @@ package makeo.gadomancy.common.utils; import makeo.gadomancy.common.blocks.tiles.TileExtendedNode; import makeo.gadomancy.common.blocks.tiles.TileExtendedNodeJar; +import makeo.gadomancy.common.items.ItemAuraCore; import makeo.gadomancy.common.node.ExtendedNodeType; import makeo.gadomancy.common.registration.RegisteredBlocks; import makeo.gadomancy.common.registration.RegisteredIntegrations; import net.minecraft.block.Block; +import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; import thaumcraft.api.ThaumcraftApiHelper; @@ -26,6 +29,7 @@ import thaumcraft.common.tiles.TileJarNode; import thaumcraft.common.tiles.TileOwned; import thaumcraft.common.tiles.TileWarded; +import java.util.Iterator; import java.util.List; /** @@ -33,13 +37,15 @@ import java.util.List; * Gadomancy is Open Source and distributed under the * GNU LESSER GENERAL PUBLIC LICENSE * for more read the LICENSE file - *

+ * * Created by HellFirePvP @ 24.10.2015 18:09 */ -public class JarMultiblockHandler { +public class WandHandler { + //All wand interacts are redirected to this. public static void handleWandInteract(World world, int x, int y, int z, EntityPlayer entityPlayer, ItemStack i) { Block target = world.getBlock(x, y, z); + if(target == null) return; if (target.equals(Blocks.glass)) { if (ResearchManager.isResearchComplete(entityPlayer.getCommandSenderName(), "NODEJAR")) { tryTCJarNodeCreation(i, entityPlayer, world, x, y, z); @@ -49,11 +55,56 @@ public class JarMultiblockHandler { ResearchManager.isResearchComplete(entityPlayer.getCommandSenderName(), "ADVNODEJAR")) { tryAutomagyJarNodeCreation(i, entityPlayer, world, x, y, z); } + } else if(target.equals(ConfigBlocks.blockCrystal)) { + List items = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(4, 4, 4)); + Iterator it = items.iterator(); + EntityItem itemAuraCore = null; + while(itemAuraCore == null && it.hasNext()) { + Object item = it.next(); + if(item != null && item instanceof EntityItem && !((EntityItem) item).isDead) { + EntityItem entityItem = (EntityItem) item; + if(entityItem.getEntityItem() != null && entityItem.getEntityItem().getItem() != null && entityItem.getEntityItem().getItem() instanceof ItemAuraCore) { + if(((ItemAuraCore) entityItem.getEntityItem().getItem()).isBlank(entityItem.getEntityItem())) itemAuraCore = entityItem; + } + } + } + + if(itemAuraCore == null) return; + + int meta = world.getBlockMetadata(x, y, z); + if(meta <= 6) { + AspectList aspects = new AspectList(); + switch (meta) { + case 0: + aspects.add(Aspect.AIR, 6); + break; + case 1: + aspects.add(Aspect.FIRE, 6); + break; + case 2: + aspects.add(Aspect.WATER, 6); + break; + case 3: + aspects.add(Aspect.EARTH, 6); + break; + case 4: + aspects.add(Aspect.ORDER, 6); + break; + case 5: + aspects.add(Aspect.ENTROPY, 6); + break; + case 6: + aspects.add(Aspect.AIR, 1).add(Aspect.EARTH, 1).add(Aspect.FIRE, 1).add(Aspect.WATER, 1).add(Aspect.ORDER, 1).add(Aspect.ENTROPY, 1); + break; + } + + //TODO replace entityitem with entityAuraCore and attach starting aspects. + } } } private static void tryTCJarNodeCreation(ItemStack wandStack, EntityPlayer player, World world, int x, int y, int z) { - JarMultiblockHandler.JarPieceEvaluationRunnable slabRunnable = new JarMultiblockHandler.JarPieceEvaluationRunnable() { + WandHandler.JarPieceEvaluationRunnable slabRunnable = new WandHandler.JarPieceEvaluationRunnable() { @Override public boolean isValidPieceAt(World world, int absX, int absY, int absZ, EntityPlayer player) { Block block = world.getBlock(absX, absY, absZ); @@ -61,13 +112,13 @@ public class JarMultiblockHandler { return containsMatch(false, OreDictionary.getOres("slabWood"), new ItemStack(block, 1, md)); } }; - JarMultiblockHandler.JarPieceEvaluationRunnable glassRunnable = new JarMultiblockHandler.JarPieceEvaluationRunnable() { + WandHandler.JarPieceEvaluationRunnable glassRunnable = new WandHandler.JarPieceEvaluationRunnable() { @Override public boolean isValidPieceAt(World world, int absX, int absY, int absZ, EntityPlayer player) { return world.getBlock(absX, absY, absZ) == Blocks.glass; } }; - JarMultiblockHandler.JarPieceEvaluationRunnable nodeRunnable = new JarMultiblockHandler.JarPieceEvaluationRunnable() { + WandHandler.JarPieceEvaluationRunnable nodeRunnable = new WandHandler.JarPieceEvaluationRunnable() { @Override public boolean isValidPieceAt(World world, int absX, int absY, int absZ, EntityPlayer player) { TileEntity tile = world.getTileEntity(absX, absY, absZ); @@ -77,7 +128,7 @@ public class JarMultiblockHandler { return true; } }; - int[] result = JarMultiblockHandler.evaluateIfValidJarIsPresent(world, x, y, z, player, slabRunnable, glassRunnable, nodeRunnable); + int[] result = WandHandler.evaluateIfValidJarIsPresent(world, x, y, z, player, slabRunnable, glassRunnable, nodeRunnable); if (result == null){ return; @@ -91,7 +142,7 @@ public class JarMultiblockHandler { } private static void tryAutomagyJarNodeCreation(ItemStack wandStack, EntityPlayer player, World world, int x, int y, int z) { - JarMultiblockHandler.JarPieceEvaluationRunnable silverWoodRunnable = new JarMultiblockHandler.JarPieceEvaluationRunnable() { + WandHandler.JarPieceEvaluationRunnable silverWoodRunnable = new WandHandler.JarPieceEvaluationRunnable() { @Override public boolean isValidPieceAt(World world, int absX, int absY, int absZ, EntityPlayer player) { TileEntity te = world.getTileEntity(absX, absY, absZ); @@ -104,7 +155,7 @@ public class JarMultiblockHandler { return false; } }; - JarMultiblockHandler.JarPieceEvaluationRunnable glassRunnable = new JarMultiblockHandler.JarPieceEvaluationRunnable() { + WandHandler.JarPieceEvaluationRunnable glassRunnable = new WandHandler.JarPieceEvaluationRunnable() { @Override public boolean isValidPieceAt(World world, int absX, int absY, int absZ, EntityPlayer player) { if ((world.getBlock(absX, absY, absZ) == ConfigBlocks.blockCosmeticOpaque) && (world.getBlockMetadata(absX, absY, absZ) == 2)) { @@ -116,7 +167,7 @@ public class JarMultiblockHandler { return false; } }; - JarMultiblockHandler.JarPieceEvaluationRunnable nodeRunnable = new JarMultiblockHandler.JarPieceEvaluationRunnable() { + WandHandler.JarPieceEvaluationRunnable nodeRunnable = new WandHandler.JarPieceEvaluationRunnable() { @Override public boolean isValidPieceAt(World world, int absX, int absY, int absZ, EntityPlayer player) { TileEntity tile = world.getTileEntity(absX, absY, absZ); @@ -126,7 +177,7 @@ public class JarMultiblockHandler { return true; } }; - int[] result = JarMultiblockHandler.evaluateIfValidJarIsPresent(world, x, y, z, player, silverWoodRunnable, glassRunnable, nodeRunnable); + int[] result = WandHandler.evaluateIfValidJarIsPresent(world, x, y, z, player, silverWoodRunnable, glassRunnable, nodeRunnable); if (result == null){ return; diff --git a/src/main/resources/assets/gadomancy/lang/en_US.lang b/src/main/resources/assets/gadomancy/lang/en_US.lang index 72ff266..a355cff 100644 --- a/src/main/resources/assets/gadomancy/lang/en_US.lang +++ b/src/main/resources/assets/gadomancy/lang/en_US.lang @@ -16,7 +16,7 @@ gadomancy.research_page.GOLEMRUNICSHIELD.1=After further experimenting with prot tc.research_name.GADOMANCY.STICKYJAR=Sticky Jars tc.research_text.GADOMANCY.STICKYJAR=Stick 'em up! -gadomancy.research_page.STICKYJAR.1=Warded jars are any thaumaturge's bread and butter, but they can be a bit difficult to arrange when large tangles of essentia tubes are involved. You decided to alleviate this minor difficulty by applying some adhesive to the bottom of the jar. Any jar that has its base coated will stick to the surface it is placed on, even if that surface is facing sideways or upside down. Breaking the jar does not remove the adhesive, allowing sticky jars to be reused. Also, many other types of essentia containing jars other than basic warded jars can accept this alteration. +gadomancy.research_page.STICKYJAR.1=Warded jars are any thaumaturge's bread and butter, but they can be a bit difficult to arrange when large tangles of essentia tubes get involved. You decided to alleviate this minor difficulty by applying some adhesive to the bottom of the jar. Any jar that has its base coated will stick to the surface it is placed on, even if that surface is facing sideways or upside down. Breaking the jar does not remove the adhesive, allowing sticky jars to be reused. Also, many other types of essentia containing jars other than basic warded jars can accept this alteration. tc.research_name.GADOMANCY.ARCANEDROPPER=Arcane Dropper tc.research_text.GADOMANCY.ARCANEDROPPER=When the pimps in the crib, ma @@ -43,7 +43,7 @@ gadomancy.research_page.REMOTEJAR.2=If a network already exists, then the jar wi tc.research_name.GADOMANCY.FAMILIAR=Ethereal Familiar tc.research_text.GADOMANCY.FAMILIAR=A arcane follower gadomancy.research_page.FAMILIAR.1=Wisps have intrigued you for some time now. Many of these sentient bits of ethereal magic seem to be passive, but when attacked, they retaliate with surprising speed and efficiency. Not only that, but sometimes just approaching a wisp too quickly will provoke an attack.This behavior gave you an unexpected inspiration. By exploiting the unusually responsive nature of a wisp, it may be possible to bend its defensive instincts to act as a personal protector. Unfortunately, wild wisps have proven to be far to unpredictable to capture. -gadomancy.research_page.FAMILIAR.3=By infusing large amounts of magic and a few binding agents into a sample of ethereal essence, an artificial wisp can be created. This Ethereal "Familiar" will anchor to its wearer's aura and act similarly to a turret when it is held in the amulet slot, shooting sparks any hostile entities that get too close. It is considerably weaker and slower than its wild counterparts, however you feel that there are definitely methods of strengthening it. +gadomancy.research_page.FAMILIAR.3=By infusing large amounts of magic and a few binding agents into a sample of ethereal essence, an artificial wisp can be created. This Ethereal "Familiar" will anchor to its wearer's aura and act similarly to a turret when it is held in the amulet slot, shooting sparks any hostile entities that attack its wearer. It is considerably weaker and slower than its wild counterparts, however you feel that there are definitely methods of strengthening it. tc.research_name.GADOMANCY.FAM_ATTACK_1=Attack Enhancement tc.research_text.GADOMANCY.FAM_ATTACK_1=Increasing the damage @@ -69,7 +69,7 @@ tc.research_name.GADOMANCY.NODE_MANIPULATOR=Node Manipulator tc.research_text.GADOMANCY.NODE_MANIPULATOR=Almost like roulette gadomancy.research_page.NODE_MANIPULATOR.1=Aura nodes have intrigued you for the longest time. Where do they come from? Why are there so many varieties? After some time, you found yourself asking another question entirely; would it be possible to change how a node functions? After journeying far across the world and into the depths of the ancient eldritch mazes, you found a set of materials capable of changing the way aura behaves. After carefully developing these materials, and using them to augment the only device you found to be capable of channeling pure vis directly from a node, one of the most dangerous machines you could fathom finally fell within your grasp. gadomancy.research_page.NODE_MANIPULATOR.3=The Node Manipulator is a device that essentially works in a manner opposite to that of a wand recharge pedestal. By drawing vis from a wand or staff and channeling it back into the node, the node manipulator will force a node to destabilize slightly. The manipulator's main pedestal is not stable enough to alter nodes on its own. By adding a specially modified focus to hold the wand/staff in place for vis extraction and a set of pillars to channel the extracted vis into the node, the device is finally ready for use. Just place a wand/staff on the pedestal, and the node manipulator will start automatically. -gadomancy.research_page.NODE_MANIPULATOR.6=The Node Manipulator needs at least 70 of all six primal aspects to begin manipulating a node, but allowing more that 70 seems to yield greater effects.
Despite all of your research into node behavior, you still haven't the slightest idea what the node manipulator will actually do to aura nodes. The only way to find out seems to be testing it out... +gadomancy.research_page.NODE_MANIPULATOR.6=The Node Manipulator needs at least 70 of all six primal aspects to begin manipulating a node, but allowing more that 70 seems to yield greater results.
Despite all of your research into node behavior, you still haven't the slightest idea what the node manipulator will actually do to aura nodes. The only way to find out seems to be testing it out... tc.research_name.GADOMANCY.E_PORTAL_CREATOR=Gate of the Voidwalkers tc.research_text.GADOMANCY.E_PORTAL_CREATOR=Into the abyss... @@ -83,11 +83,11 @@ tc.research_name.GADOMANCY.BLOCK_PROTECTOR=Enervation Field Emitter tc.research_text.GADOMANCY.BLOCK_PROTECTOR=ENOUGH OF THESE DAMN CREEPERS ALREADY!!!!! gadomancy.research_page.BLOCK_PROTECTOR.1=EVERYONE. HATES. CREEPERS. It is practically a given that at some point in a builder's career, one of these indescribably rage inducing freaks will sneak up from behind, above, below, or even right in front of them and explode, ruining the project in progress completely.Almost by chance, you discovered an interesting way to solve this problem with essential gas. By exposing gunpowder to a small trace of ordo essentia, you found could completely nullify its ability to explode when ignited. gadomancy.research_page.BLOCK_PROTECTOR.3=Turning essentia into gas directly without having it dissolve into flux is all but impossible, but some careful tinkering with various alchemical machinery components and redstone yields a device that can use a slightly different process to acquire the same effects as liquid essentia.
The Arcane Enervation Emitter diffuses a light aura of ordo across a limited area. Any creepers in that affected area will be unable to explode. The emitter is slow to start, and when it receives fuel in the form of ordo essentia and a redstone signal, it will gradually expand its area of effect until it reaches maximum size. -gadomancy.research_page.BLOCK_PROTECTOR.4=The size of its area can be controlled by changing the strength of the redstone signal used to activate the device, and monitored by placing a comparator running out of the device.
After using this device for some time, you noticed, much to your delight, that the field that the Arcane Enervation Emitter emits is strong enough to affect other mobs than just creepers. It appears to stop other mobs from breaking blocks. It isn’t strong enough to affect players though… +gadomancy.research_page.BLOCK_PROTECTOR.4=The size of its area can be controlled by changing the strength of the redstone signal used to activate the device, and monitored by placing a comparator running out of the device.
After using this device for some time, you noticed, much to your delight, that the field that the Arcane Enervation Emitter emits is strong enough to affect more than just creepers. It appears to stop a variety of destructive mob behaviors as well as inhibiting enderman teleportation. It isn’t strong enough to affect players though… tc.research_name.GADOMANCY.ANCIENT_STONES=Ancient Stones tc.research_text.GADOMANCY.ANCIENT_STONES=Decorations of the Eldritch -gadomancy.research_page.ANCIENT_STONES.1=Entering the mazes of the Eldritch is not only what an experienced thaumaturge such as yourself wants; the eldritch might not be the best room designers, but the stones they used to build show enormous magic potential.
Exposing your everyday arcane stones to eldritch energies might alter the stones magical properties to react more like their eldritch relatives. +gadomancy.research_page.ANCIENT_STONES.1=There is more to the mazes of the eldritch than meets the eye. The eldritch might not be the best room designers, but the stones they used to build show enormous magic potential.
Exposing your everyday arcane stones to eldritch energies alter the stones magical properties to react more like their eldritch relatives. tc.research_name.GADOMANCY.GROWING=Growing Nodes tc.research_text.GADOMANCY.GROWING=Feed me Semour @@ -146,6 +146,15 @@ tile.BlockStoneMachine.15.name=Manipulation Pillar gadomancy.nodes.GROWING=Growing gadomancy.nodes.STARVING=Starving +gadomancy.auracore.blank=Blank +gadomancy.auracore.aer=Aer +gadomancy.auracore.ignis=Ignis +gadomancy.auracore.aqua=Aqua +gadomancy.auracore.terra=Terra +gadomancy.auracore.ordo=Ordo +gadomancy.auracore.perditio=Perditio +gadomancy.auracore.balanced=Balanced + gadomancy.info.ArcanePackage=Click to open or put it in a unpackager gadomancy.info.InfusionClaw.owner=You are now the owner. gadomancy.info.InfusionClaw.waila=§7Owner: