From 66f9c06753005944d3157e76ae58da53d807cb4b Mon Sep 17 00:00:00 2001 From: HellFirePvP Date: Thu, 9 Jun 2016 15:34:47 +0200 Subject: [PATCH] - AI Shutdown: Finished. Doesn't have text or model+textures yet. welp. --- .../renderers/tile/RenderTileAIShutdown.java | 4 +- .../common/blocks/tiles/TileAIShutdown.java | 52 ++++--------------- .../gadomancy/common/items/ItemAuraCore.java | 2 +- .../registration/RegisteredMultiblocks.java | 10 ---- .../registration/RegisteredRecipes.java | 15 ++++++ .../registration/RegisteredResearches.java | 12 ++++- .../assets/gadomancy/lang/en_US.lang | 5 ++ 7 files changed, 45 insertions(+), 55 deletions(-) diff --git a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileAIShutdown.java b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileAIShutdown.java index 26e52cc..9fa5edd 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileAIShutdown.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileAIShutdown.java @@ -29,7 +29,7 @@ public class RenderTileAIShutdown extends TileEntitySpecialRenderer { if(tileEntity == null || !(tileEntity instanceof TileAIShutdown)) return; TileAIShutdown ta = (TileAIShutdown) tileEntity; - if(ta.hasMultiblock() && ta.getStoredEssentia() > 0) { + if(ta.getStoredEssentia() > 0) { handleOrbital(ta); } } @@ -45,7 +45,7 @@ public class RenderTileAIShutdown extends TileEntitySpecialRenderer { if(ta.orbital != null) ta.orbital.lastRenderCall = System.currentTimeMillis(); - if(ta.hasMultiblock() && ta.getStoredEssentia() > 0) { + if(ta.getStoredEssentia() > 0) { if(ta.orbital != null && ta.orbital.orbitalsSize() == 0) { fillOrbital(ta.orbital); } diff --git a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileAIShutdown.java b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileAIShutdown.java index 2197c97..3c33c37 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileAIShutdown.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileAIShutdown.java @@ -53,7 +53,6 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon private int ticksExisted = 0; private int storedAmount = 0; - private boolean foundMultiblock = false; @Override public boolean canUpdate() { @@ -67,34 +66,27 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon if(!worldObj.isRemote) { ChunkCoordinates cc = getCoords(); - if(!trackedEntities.containsKey(cc)) trackedEntities.put(cc, Lists.newLinkedList()); + if (!trackedEntities.containsKey(cc)) trackedEntities.put(cc, Lists.newLinkedList()); - if((ticksExisted & 7) == 0) { - if(!foundMultiblock) { - setMultiblock(checkGrassBlocks()); - } else { - if(!checkGrassBlocks()) { - setMultiblock(false); - } - } - } - - if(!foundMultiblock) return; - - if((ticksExisted & 15) == 0) { + if ((ticksExisted & 15) == 0) { killAI(); } - if(((ticksExisted & 7) == 0)) { + if (((ticksExisted & 7) == 0)) { handleIO(); } - } else { - if(foundMultiblock && storedAmount > 0) { - //Effects? + if (((ticksExisted & 31) == 0)) { + drainDefaultEssentia(); } } } + private void drainDefaultEssentia() { + storedAmount = Math.max(0, storedAmount - 1); + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + markDirty(); + } + private void handleIO() { if (storedAmount < MAX_AMT) { TileEntity te = ThaumcraftApiHelper.getConnectableTile(this.worldObj, this.xCoord, this.yCoord, this.zCoord, ForgeDirection.UP); @@ -171,21 +163,6 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon return new AffectedEntity(uu, tasks, targetTasks); } - public void setMultiblock(boolean state) { - if(foundMultiblock != state) { - this.foundMultiblock = state; - markDirty(); - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } - if(!foundMultiblock) { - storedAmount = 0; - } - } - - public boolean hasMultiblock() { - return foundMultiblock; - } - public int getStoredEssentia() { return storedAmount; } @@ -200,21 +177,14 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon return true; } - private boolean checkGrassBlocks() { - boolean mbPresent = MultiblockHelper.isMultiblockPresent(worldObj, xCoord, yCoord, zCoord, RegisteredMultiblocks.aiShutdownPattern); - return mbPresent; - } - @Override public void readCustomNBT(NBTTagCompound compound) { this.storedAmount = compound.getInteger("amount"); - this.foundMultiblock = compound.getBoolean("multiblock"); } @Override public void writeCustomNBT(NBTTagCompound compound) { compound.setInteger("amount", storedAmount); - compound.setBoolean("multiblock", foundMultiblock); } diff --git a/src/main/java/makeo/gadomancy/common/items/ItemAuraCore.java b/src/main/java/makeo/gadomancy/common/items/ItemAuraCore.java index fef838b..6d4e8d1 100644 --- a/src/main/java/makeo/gadomancy/common/items/ItemAuraCore.java +++ b/src/main/java/makeo/gadomancy/common/items/ItemAuraCore.java @@ -119,7 +119,7 @@ public class ItemAuraCore extends Item { AIR(Aspect.AIR), FIRE(Aspect.FIRE), WATER(Aspect.WATER), - EARTH(Aspect.EARTH, true), + EARTH(Aspect.EARTH), ORDER(Aspect.ORDER), ENTROPY(Aspect.ENTROPY, true); diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredMultiblocks.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredMultiblocks.java index dc18a15..7aaa2a5 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredMultiblocks.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredMultiblocks.java @@ -43,14 +43,4 @@ public class RegisteredMultiblocks { .addBlock(0, -2, 0, RegisteredBlocks.blockAuraPylon, 0) .addBlock(0, -3, 0, RegisteredBlocks.blockAuraPylon, 0); - public static final MultiblockHelper.MultiblockPattern aiShutdownPattern = new MultiblockHelper.MultiblockPattern(RegisteredBlocks.blockStoneMachine, 5); - - static { - for (int xx = -3; xx <= 3; xx++) { - for (int zz = -3; zz <= 3; zz++) { - aiShutdownPattern.addBlock(xx, -1, zz, Blocks.grass, 0); - } - } - } - } diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredRecipes.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredRecipes.java index 414e3a9..0f7a098 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredRecipes.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredRecipes.java @@ -67,6 +67,7 @@ public class RegisteredRecipes { public static InfusionRecipe recipeGolemCoreBodyguard; public static InfusionRecipe recipePortalFocus; public static InfusionRecipe recipeElementVoid; + public static InfusionRecipe recipeAiShutdown; //For indexing, look below... public static InfusionRecipe[][] recipesFamiliarAugmentation; @@ -275,6 +276,20 @@ public class RegisteredRecipes { new ItemStack(RegisteredBlocks.blockEssentiaCompressor) )); + ItemStack earthCore = new ItemStack(RegisteredItems.itemAuraCore); + RegisteredItems.itemAuraCore.setCoreType(earthCore, ItemAuraCore.AuraCoreType.EARTH); + + recipeAiShutdown = ThaumcraftApi.addInfusionCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".AI_SHUTDOWN", new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 5), 9, + new AspectList().add(Aspect.ENTROPY, 16).add(Aspect.BEAST, 23).add(Aspect.EARTH, 22).add(Aspect.AURA, 12).add(Aspect.MIND, 17), + earthCore, new ItemStack[] { + new ItemStack(ConfigItems.itemZombieBrain), new ItemStack(ConfigBlocks.blockTube), + new ItemStack(ConfigItems.itemWandRod), new ItemStack(ConfigItems.itemShard, 1, 5), + new ItemStack(ConfigBlocks.blockJar), new ItemStack(ConfigBlocks.blockTube), + new ItemStack(ConfigItems.itemZombieBrain), new ItemStack(ConfigBlocks.blockTube), + new ItemStack(ConfigBlocks.blockJar), new ItemStack(ConfigItems.itemShard, 1, 5), + new ItemStack(ConfigItems.itemWandRod), new ItemStack(ConfigBlocks.blockTube) + }); + auraCoreRecipes = createAuraCoreRecipes(); diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredResearches.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredResearches.java index bf5b0d0..fc0de50 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredResearches.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredResearches.java @@ -51,7 +51,6 @@ public class RegisteredResearches { public static ResearchItem researchNodeManipulator; public static ResearchItem researchEldritchPortalCreator; public static ResearchItem researchBlockProtector; - public static ResearchItem researchEssentiaCompressor; //Enchantment stuff public static ResearchItem researchRevealer; @@ -64,6 +63,8 @@ public class RegisteredResearches { public static ResearchItem researchAuraPylon; public static ResearchItem researchAuraEffects; public static ResearchItem researchKnowledgeBook; + public static ResearchItem researchEssentiaCompressor; + public static ResearchItem researchAiShutdown; //Skyblock Helper public static ResearchItem researchAncientStones; @@ -332,6 +333,15 @@ public class RegisteredResearches { new ResearchPage(RegisteredRecipes.multiblockEssentiaCompressor), new ResearchPage("gadomancy.research_page.ESSENTIA_COMPRESSOR.8"), new ResearchPage("gadomancy.research_page.ESSENTIA_COMPRESSOR.9")).registerResearchItem(); + researchAiShutdown = new SimpleResearchItem("AI_SHUTDOWN", + -3, 5, 2, new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 5), + new AspectList().add(Aspect.MIND, 10).add(Aspect.ENTROPY, 20).add(Aspect.AURA, 12).add(Aspect.BEAST, 16).add(Aspect.MECHANISM, 12)) + .setHidden() + .setParents(researchAuraCore.key, "ROD_greatwood") + .setItemTriggers(new ItemStack(RegisteredItems.itemAuraCore, 1, ItemAuraCore.AuraCoreType.EARTH.ordinal())) + .setPages(new ResearchPage("gadomancy.research_page.AI_SHUTDOWN.1"), new ResearchPage(RegisteredRecipes.recipeAiShutdown)) + .registerResearchItem(); + String[] packagerParents = Config.wardedStone ? new String[] { researchAuraCore.key, "WARDEDARCANA" } : new String[] { researchAuraCore.key }; researchArcanePackager = new SimpleResearchItem("ARCANE_PACKAGER", 2, 7, 2, new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 4), diff --git a/src/main/resources/assets/gadomancy/lang/en_US.lang b/src/main/resources/assets/gadomancy/lang/en_US.lang index b6f9285..fce4f47 100644 --- a/src/main/resources/assets/gadomancy/lang/en_US.lang +++ b/src/main/resources/assets/gadomancy/lang/en_US.lang @@ -86,6 +86,10 @@ tc.research_name.GADOMANCY.KNOWLEDGE_BOOK=Book of Knowledge tc.research_text.GADOMANCY.KNOWLEDGE_BOOK=Knowledge is power gadomancy.research_page.KNOWLEDGE_BOOK.1=TEXT +tc.research_name.GADOMANCY.AI_SHUTDOWN=NULL +tc.research_text.GADOMANCY.AI_SHUTDOWN=NULL +gadomancy.research_page.AI_SHUTDOWN.1=NULL + tc.research_name.GADOMANCY.ESSENTIA_COMPRESSOR=Essentia Condenser tc.research_text.GADOMANCY.ESSENTIA_COMPRESSOR=NON-noisy Essentia Storage gadomancy.research_page.ESSENTIA_COMPRESSOR.1= While experimenting with void materials, you discovered an odd reaction between void seeds and liquid essentia. When a void seed is left in close proximity with a warded jar for an extended period of time, the energy it releases has the odd tendency to make the essentia in the jar condense into a slightly more dense state, freeing up a small amount of space in the jar without actually destroying any essentia. After some further testing, you found that the seed alone was not powerful enough to make any major difference, but with enhancements to increase the potency of the energy released by the seed, a device that can compress essentia into a super dense state could be made. @@ -207,6 +211,7 @@ tile.BlockStoneMachine.1.name=Ancient Pedestal tile.BlockStoneMachine.2.name=Arcane Enervation Emitter tile.BlockStoneMachine.3.name=Redirection Focus tile.BlockStoneMachine.4.name=Arcane Packager +tile.BlockStoneMachine.5.name=Ai Shutdown (WIP) tile.BlockStoneMachine.11.name=Manipulation Pillar tile.BlockStoneMachine.15.name=Manipulation Pillar tile.BlockAuraPylon.0.name=Aura Pylon