diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..93c852a --- /dev/null +++ b/settings.gradle @@ -0,0 +1,10 @@ +plugins { + id 'com.diffplug.blowdryerSetup' version '1.6.0' +} + +apply plugin: 'com.diffplug.blowdryerSetup' + +blowdryerSetup { + github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.5') + //devLocal '.' // Use this when testing config updates locally +} diff --git a/src/main/java/makeo/gadomancy/api/AuraEffect.java b/src/main/java/makeo/gadomancy/api/AuraEffect.java index 45c23b0..a6fbf2a 100644 --- a/src/main/java/makeo/gadomancy/api/AuraEffect.java +++ b/src/main/java/makeo/gadomancy/api/AuraEffect.java @@ -1,12 +1,11 @@ package makeo.gadomancy.api; +import java.util.Random; import net.minecraft.entity.Entity; import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; import thaumcraft.api.aspects.Aspect; -import java.util.Random; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -137,14 +136,10 @@ public abstract class AuraEffect { @Override public final void doEntityEffect(ChunkCoordinates originTile, Entity e) {} - } public enum EffectType { - ENTITY_EFFECT, BLOCK_EFFECT - } - } diff --git a/src/main/java/makeo/gadomancy/api/ClickBehavior.java b/src/main/java/makeo/gadomancy/api/ClickBehavior.java index 2e7d25b..7f22d9b 100644 --- a/src/main/java/makeo/gadomancy/api/ClickBehavior.java +++ b/src/main/java/makeo/gadomancy/api/ClickBehavior.java @@ -44,7 +44,7 @@ public abstract class ClickBehavior { */ public abstract boolean isValidForBlock(); - //TODO not handled as expected. + // TODO not handled as expected. public boolean hasVisCost() { return this.hasVisCost; } @@ -53,5 +53,5 @@ public abstract class ClickBehavior { return 0; } - public void addInstability(int instability) { } + public void addInstability(int instability) {} } diff --git a/src/main/java/makeo/gadomancy/api/GadomancyApi.java b/src/main/java/makeo/gadomancy/api/GadomancyApi.java index dc2feee..df088df 100644 --- a/src/main/java/makeo/gadomancy/api/GadomancyApi.java +++ b/src/main/java/makeo/gadomancy/api/GadomancyApi.java @@ -1,5 +1,6 @@ package makeo.gadomancy.api; +import java.util.List; import makeo.gadomancy.api.golems.AdditionalGolemType; import makeo.gadomancy.api.golems.cores.AdditionalGolemCore; import makeo.gadomancy.api.internal.IApiHandler; @@ -8,8 +9,6 @@ import thaumcraft.api.aspects.Aspect; import thaumcraft.common.entities.golems.EntityGolemBase; import thaumcraft.common.entities.golems.EnumGolemType; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -20,12 +19,13 @@ import java.util.List; */ public abstract class GadomancyApi { private static IApiHandler handler; + public static void setInstance(IApiHandler handler) { GadomancyApi.handler = handler; } @Deprecated - public static boolean registerAdditionalGolemType(String name, String modId, AdditionalGolemType newType){ + public static boolean registerAdditionalGolemType(String name, String modId, AdditionalGolemType newType) { return GadomancyApi.handler.registerAdditionalGolemType(name, modId, newType); } diff --git a/src/main/java/makeo/gadomancy/api/golems/AdditionalGolemType.java b/src/main/java/makeo/gadomancy/api/golems/AdditionalGolemType.java index 9735bc2..266d369 100644 --- a/src/main/java/makeo/gadomancy/api/golems/AdditionalGolemType.java +++ b/src/main/java/makeo/gadomancy/api/golems/AdditionalGolemType.java @@ -29,7 +29,15 @@ public abstract class AdditionalGolemType { public final int regenDelay; public final int strength; - public AdditionalGolemType(int maxHealth, int armor, float movementSpeed, boolean fireResist, int upgradeAmount, int carryLimit, int regenDelay, int strength) { + public AdditionalGolemType( + int maxHealth, + int armor, + float movementSpeed, + boolean fireResist, + int upgradeAmount, + int carryLimit, + int regenDelay, + int strength) { this.maxHealth = maxHealth; this.armor = armor; this.movementSpeed = movementSpeed; @@ -43,9 +51,12 @@ public abstract class AdditionalGolemType { public abstract String getUnlocalizedName(); public abstract void registerIcons(IIconRegister ir); + public abstract IIcon getIcon(ItemStack stack, int pass); - public int getRenderPasses() { return 1; } + public int getRenderPasses() { + return 1; + } public abstract ResourceLocation getEntityTexture(); diff --git a/src/main/java/makeo/gadomancy/api/internal/IApiHandler.java b/src/main/java/makeo/gadomancy/api/internal/IApiHandler.java index 1f1a8f4..4eaeb85 100644 --- a/src/main/java/makeo/gadomancy/api/internal/IApiHandler.java +++ b/src/main/java/makeo/gadomancy/api/internal/IApiHandler.java @@ -1,5 +1,6 @@ package makeo.gadomancy.api.internal; +import java.util.List; import makeo.gadomancy.api.AuraEffect; import makeo.gadomancy.api.ClickBehavior; import makeo.gadomancy.api.golems.AdditionalGolemType; @@ -8,8 +9,6 @@ import net.minecraft.item.ItemStack; import thaumcraft.api.aspects.Aspect; import thaumcraft.common.entities.golems.EntityGolemBase; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the diff --git a/src/main/java/makeo/gadomancy/client/ClientProxy.java b/src/main/java/makeo/gadomancy/client/ClientProxy.java index d38abc3..515dd31 100644 --- a/src/main/java/makeo/gadomancy/client/ClientProxy.java +++ b/src/main/java/makeo/gadomancy/client/ClientProxy.java @@ -5,6 +5,9 @@ import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLLog; +import java.util.ArrayDeque; +import java.util.List; +import java.util.Queue; import makeo.gadomancy.client.effect.EffectHandler; import makeo.gadomancy.client.events.ClientHandler; import makeo.gadomancy.client.events.RenderEventHandler; @@ -48,10 +51,6 @@ import thaumcraft.common.tiles.TileEldritchAltar; import thaumcraft.common.tiles.TileEldritchCap; import thaumcraft.common.tiles.TileEldritchObelisk; -import java.util.ArrayDeque; -import java.util.List; -import java.util.Queue; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -72,7 +71,7 @@ public class ClientProxy extends CommonProxy { ClientProxy.injectGolemTextures(); - //Tiles + // Tiles ClientRegistry.bindTileEntitySpecialRenderer(TileStickyJar.class, new RenderTileStickyJar()); RenderTileRemoteJar renderTileRemoteJar = new RenderTileRemoteJar(); @@ -96,15 +95,18 @@ public class ClientProxy extends CommonProxy { RenderTileManipulationFocus renderTileManipulationFocus = new RenderTileManipulationFocus(); ClientRegistry.bindTileEntitySpecialRenderer(TileManipulationFocus.class, renderTileManipulationFocus); - ClientRegistry.bindTileEntitySpecialRenderer(TileAdditionalEldritchPortal.class, new TileEldritchPortalRenderer()); + ClientRegistry.bindTileEntitySpecialRenderer( + TileAdditionalEldritchPortal.class, new TileEldritchPortalRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileEldritchObelisk.class, new RenderTileObelisk()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEldritchAltar.class, new RenderTileCapEldritch("textures/models/obelisk_cap_altar.png")); - ClientRegistry.bindTileEntitySpecialRenderer(TileEldritchCap.class, new RenderTileCapEldritch("textures/models/obelisk_cap.png")); + ClientRegistry.bindTileEntitySpecialRenderer( + TileEldritchAltar.class, new RenderTileCapEldritch("textures/models/obelisk_cap_altar.png")); + ClientRegistry.bindTileEntitySpecialRenderer( + TileEldritchCap.class, new RenderTileCapEldritch("textures/models/obelisk_cap.png")); RenderTileEssentiaCompressor renderTileEssentiaCompressor = new RenderTileEssentiaCompressor(); ClientRegistry.bindTileEntitySpecialRenderer(TileEssentiaCompressor.class, renderTileEssentiaCompressor); - //ClientRegistry.bindTileEntitySpecialRenderer(TileAIShutdown.class, new RenderTileAIShutdown()); + // ClientRegistry.bindTileEntitySpecialRenderer(TileAIShutdown.class, new RenderTileAIShutdown()); RenderTileAuraPylon renderTileAuraPylon = new RenderTileAuraPylon(); ClientRegistry.bindTileEntitySpecialRenderer(TileAuraPylon.class, renderTileAuraPylon); @@ -119,28 +121,41 @@ public class ClientProxy extends CommonProxy { RenderTileKnowledgeBook bookRender = new RenderTileKnowledgeBook(); ClientRegistry.bindTileEntitySpecialRenderer(TileKnowledgeBook.class, bookRender); - //Items + // Items TileArcaneDropper fakeTile = new TileArcaneDropper(); fakeTile.blockMetadata = 8 | ForgeDirection.SOUTH.ordinal(); - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockArcaneDropper), new ItemRenderTileEntity(renderTileArcaneDropper, fakeTile)); + MinecraftForgeClient.registerItemRenderer( + Item.getItemFromBlock(RegisteredBlocks.blockArcaneDropper), + new ItemRenderTileEntity(renderTileArcaneDropper, fakeTile)); - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockInfusionClaw), new ItemRenderTileEntity(renderTileInfusionClaw, new TileInfusionClaw())); + MinecraftForgeClient.registerItemRenderer( + Item.getItemFromBlock(RegisteredBlocks.blockInfusionClaw), + new ItemRenderTileEntity(renderTileInfusionClaw, new TileInfusionClaw())); - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockEssentiaCompressor), new ItemRenderTileEntity(renderTileEssentiaCompressor, new TileEssentiaCompressor())); + MinecraftForgeClient.registerItemRenderer( + Item.getItemFromBlock(RegisteredBlocks.blockEssentiaCompressor), + new ItemRenderTileEntity( + renderTileEssentiaCompressor, new TileEssentiaCompressor())); - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ConfigBlocks.blockAiry), new ItemExNodeRenderer()); + MinecraftForgeClient.registerItemRenderer( + Item.getItemFromBlock(ConfigBlocks.blockAiry), new ItemExNodeRenderer()); - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockKnowledgeBook), new ItemRenderTEKnowledgeBook(bookRender)); + MinecraftForgeClient.registerItemRenderer( + Item.getItemFromBlock(RegisteredBlocks.blockKnowledgeBook), new ItemRenderTEKnowledgeBook(bookRender)); - ItemRenderTileEntityMulti multi = new ItemRenderTileEntityMulti(new ItemRenderTileEntityMulti.RenderSet(renderTileAuraPylon, new TileAuraPylon(), 0), - new ItemRenderTileEntityMulti.RenderSet(renderTileAuraPylon, new TileAuraPylonTop(), 1)); + 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)); + MinecraftForgeClient.registerItemRenderer( + RegisteredItems.itemExtendedNodeJar, new ItemJarExtendedNodeRenderer()); + MinecraftForgeClient.registerItemRenderer( + Item.getItemFromBlock(RegisteredBlocks.blockRemoteJar), new ItemRenderRemoteJar(renderTileRemoteJar)); ItemRenderStoneMachine itemRenderStoneMachine = new ItemRenderStoneMachine(); - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockStoneMachine), itemRenderStoneMachine); + MinecraftForgeClient.registerItemRenderer( + Item.getItemFromBlock(RegisteredBlocks.blockStoneMachine), itemRenderStoneMachine); itemRenderStoneMachine.registerRenderer(0, new TileManipulationFocus(), renderTileManipulationFocus); TileManipulationFocus tileManipulationFocus = new TileManipulationFocus(); tileManipulationFocus.blockMetadata = 3; @@ -153,11 +168,11 @@ public class ClientProxy extends CommonProxy { MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemEtherealFamiliar, new ItemRenderFamiliar()); MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemCreativeNode, new ItemCreativeNodeRenderer()); - //Entities + // Entities RenderingRegistry.registerEntityRenderingHandler(EntityPermNoClipItem.class, new RenderSpecialItem()); RenderingRegistry.registerEntityRenderingHandler(EntityAuraCore.class, new RenderEntityAuraCore()); - //Blocks + // Blocks RegisteredBlocks.rendererTransparentBlock = this.registerBlockRenderer(new RenderBlockTransparent()); RegisteredBlocks.rendererExtendedNodeJarBlock = this.registerBlockRenderer(new BlockExtendedNodeJarRenderer()); RegisteredBlocks.rendererBlockStoneMachine = this.registerBlockRenderer(new RenderBlockStoneMachine()); @@ -166,7 +181,7 @@ public class ClientProxy extends CommonProxy { @Override public void postInitalize() { IResourceManager manager = Minecraft.getMinecraft().getResourceManager(); - if(manager instanceof SimpleReloadableResourceManager) { + if (manager instanceof SimpleReloadableResourceManager) { SimpleReloadableResourceManager rm = (SimpleReloadableResourceManager) manager; rm.registerReloadListener(ResourceReloadListener.getInstance()); } @@ -188,9 +203,8 @@ public class ClientProxy extends CommonProxy { @Override public void spawnBubbles(World world, float posX, float posY, float posZ, float rangeAroundItem) { - MultiTickEffectDispatcher.BubbleFXInfo bubbles = - new MultiTickEffectDispatcher.BubbleFXInfo(Minecraft.getMinecraft().theWorld.provider.dimensionId, - posX, posY, posZ, 10, rangeAroundItem); + MultiTickEffectDispatcher.BubbleFXInfo bubbles = new MultiTickEffectDispatcher.BubbleFXInfo( + Minecraft.getMinecraft().theWorld.provider.dimensionId, posX, posY, posZ, 10, rangeAroundItem); MultiTickEffectDispatcher.registerBubbles(bubbles); } @@ -199,7 +213,7 @@ public class ClientProxy extends CommonProxy { switch (ID) { case 0: return new GuiGolem(player, (EntityGolemBase) world.getEntityByID(x)); - //return new AdditionalGolemGui(player, (EntityGolemBase)world.getEntityByID(x)); + // return new AdditionalGolemGui(player, (EntityGolemBase)world.getEntityByID(x)); case 1: return new InfusionClawGui(player.inventory, (IInventory) world.getTileEntity(x, y, z)); case 2: @@ -210,7 +224,7 @@ public class ClientProxy extends CommonProxy { public static void injectGolemTextures() { RenderGolemBase render = ClientProxy.unregisterRenderer(EntityGolemBase.class, RenderGolemBase.class); - if(render != null) { + if (render != null) { RenderingRegistry.registerEntityRenderingHandler(EntityGolemBase.class, new RenderAdditionalGolemBase()); } } @@ -219,21 +233,21 @@ public class ClientProxy extends CommonProxy { Injector registry = new Injector(RenderingRegistry.instance()); List entityRenderers = registry.getField("entityRenderers"); - if(entityRenderers == null) { + if (entityRenderers == null) { FMLLog.severe("Failed to get entityRenderers field in RenderingRegistry!"); return null; } - for(int i = 0; i < entityRenderers.size(); i++) { + for (int i = 0; i < entityRenderers.size(); i++) { Injector pair = new Injector(entityRenderers.get(i)); Class target = pair.getField("target"); - if(entityClass.equals(target)) { + if (entityClass.equals(target)) { Render render = pair.getField("renderer"); - if(renderClass.isInstance(render)) { + if (renderClass.isInstance(render)) { entityRenderers.remove(i); - return (T)render; + return (T) render; } } } diff --git a/src/main/java/makeo/gadomancy/client/effect/CheckpointingSet.java b/src/main/java/makeo/gadomancy/client/effect/CheckpointingSet.java index f737316..4231b72 100644 --- a/src/main/java/makeo/gadomancy/client/effect/CheckpointingSet.java +++ b/src/main/java/makeo/gadomancy/client/effect/CheckpointingSet.java @@ -59,8 +59,7 @@ class CheckpointingSet implements Iterable { @Override public void remove() { - if (!initialized) - throw new IllegalStateException(); + if (!initialized) throw new IllegalStateException(); toRemove.add(cur); } }; diff --git a/src/main/java/makeo/gadomancy/client/effect/fx/EntityFXFlowPolicy.java b/src/main/java/makeo/gadomancy/client/effect/fx/EntityFXFlowPolicy.java index a54aa74..8c7e43a 100644 --- a/src/main/java/makeo/gadomancy/client/effect/fx/EntityFXFlowPolicy.java +++ b/src/main/java/makeo/gadomancy/client/effect/fx/EntityFXFlowPolicy.java @@ -1,11 +1,10 @@ package makeo.gadomancy.client.effect.fx; -import makeo.gadomancy.common.utils.Vector3; -import net.minecraft.client.Minecraft; -import net.minecraft.world.World; - import java.awt.*; import java.util.Random; +import makeo.gadomancy.common.utils.Vector3; +import net.minecraft.client.Minecraft; +import net.minecraft.world.World; /** * This class is part of the Gadomancy Mod @@ -17,10 +16,17 @@ import java.util.Random; */ public abstract class EntityFXFlowPolicy { - public abstract void doSubParticles(FXFlow fxFlow, int policyCounter, double posX, double posY, double posZ, double lastPosX, double lastPosY, double lastPosZ); + public abstract void doSubParticles( + FXFlow fxFlow, + int policyCounter, + double posX, + double posY, + double posZ, + double lastPosX, + double lastPosY, + double lastPosZ); public enum Policies { - NO_OP(null), CIRCLE_MIX(new CircularMixPolicy()), CIRCLE(new CircularPolicy()), @@ -35,22 +41,40 @@ public abstract class EntityFXFlowPolicy { public EntityFXFlowPolicy getPolicy() { return this.policy; } - } static class DefaultPolicy extends EntityFXFlowPolicy { @Override - public void doSubParticles(FXFlow fxFlow, int policyCounter, double posX, double posY, double posZ, double lastPosX, double lastPosY, double lastPosZ) { - this.doParticles(fxFlow, policyCounter, posX, posY, posZ, fxFlow.getRand().nextInt(3) + 1); + public void doSubParticles( + FXFlow fxFlow, + int policyCounter, + double posX, + double posY, + double posZ, + double lastPosX, + double lastPosY, + double lastPosZ) { + this.doParticles( + fxFlow, policyCounter, posX, posY, posZ, fxFlow.getRand().nextInt(3) + 1); } public void doParticles(FXFlow fxFlow, int policyCounter, double posX, double posY, double posZ, int count) { Random rand = fxFlow.getOriginWorld().rand; for (int i = 0; i < count; i++) { Vector3 subOffset = this.genSubOffset(rand, fxFlow.getSurroundingDistance()); - Color c = (fxFlow.getFadingColor() != null && rand.nextBoolean()) ? fxFlow.getFadingColor() : fxFlow.getColor(); - FXFlow.FXFlowBase flow = new FXFlow.FXFlowBase(fxFlow.getOriginWorld(), posX + subOffset.getX(), posY + subOffset.getY(), posZ + subOffset.getZ(), c, rand.nextInt(1) + fxFlow.getSurroundingParticleSize(), 6, 240); + Color c = (fxFlow.getFadingColor() != null && rand.nextBoolean()) + ? fxFlow.getFadingColor() + : fxFlow.getColor(); + FXFlow.FXFlowBase flow = new FXFlow.FXFlowBase( + fxFlow.getOriginWorld(), + posX + subOffset.getX(), + posY + subOffset.getY(), + posZ + subOffset.getZ(), + c, + rand.nextInt(1) + fxFlow.getSurroundingParticleSize(), + 6, + 240); Minecraft.getMinecraft().effectRenderer.addEffect(flow); } } @@ -68,14 +92,24 @@ public abstract class EntityFXFlowPolicy { public static final int TICKS_PER_FULL_TURN = 40; @Override - public void doSubParticles(FXFlow fxFlow, int policyCounter, double posX, double posY, double posZ, double lastPosX, double lastPosY, double lastPosZ) { + public void doSubParticles( + FXFlow fxFlow, + int policyCounter, + double posX, + double posY, + double posZ, + double lastPosX, + double lastPosY, + double lastPosZ) { Vector3 rotationAxis = fxFlow.getMovementVector(); - Vector3 perpendicular = rotationAxis.clone().perpendicular().normalize().multiply(fxFlow.getSurroundingDistance()); + Vector3 perpendicular = + rotationAxis.clone().perpendicular().normalize().multiply(fxFlow.getSurroundingDistance()); Vector3 counterSide = perpendicular.clone().rotate(Math.toRadians(180), rotationAxis); int currentDividedPolicyTick = policyCounter % CircularPolicy.TICKS_PER_FULL_TURN; - float currentDegree = 360F * (((float) currentDividedPolicyTick) / ((float) CircularPolicy.TICKS_PER_FULL_TURN)); + float currentDegree = + 360F * (((float) currentDividedPolicyTick) / ((float) CircularPolicy.TICKS_PER_FULL_TURN)); double currentRad = Math.toRadians(currentDegree); perpendicular = perpendicular.rotate(currentRad, rotationAxis); @@ -83,22 +117,51 @@ public abstract class EntityFXFlowPolicy { World w = fxFlow.getOriginWorld(); Color c = (fxFlow.getFadingColor() != null) ? fxFlow.getFadingColor() : fxFlow.getColor(); - FXFlow.FXFlowBase flow = new FXFlow.FXFlowBase(w, posX + perpendicular.getX(), posY + perpendicular.getY(), posZ + perpendicular.getZ(), c, fxFlow.getSurroundingParticleSize(), 6, 240); + FXFlow.FXFlowBase flow = new FXFlow.FXFlowBase( + w, + posX + perpendicular.getX(), + posY + perpendicular.getY(), + posZ + perpendicular.getZ(), + c, + fxFlow.getSurroundingParticleSize(), + 6, + 240); Minecraft.getMinecraft().effectRenderer.addEffect(flow); - FXFlow.FXFlowBase flow2 = new FXFlow.FXFlowBase(w, posX + counterSide.getX(), posY + counterSide.getY(), posZ + counterSide.getZ(), c, fxFlow.getSurroundingParticleSize(), 6, 240); + FXFlow.FXFlowBase flow2 = new FXFlow.FXFlowBase( + w, + posX + counterSide.getX(), + posY + counterSide.getY(), + posZ + counterSide.getZ(), + c, + fxFlow.getSurroundingParticleSize(), + 6, + 240); Minecraft.getMinecraft().effectRenderer.addEffect(flow2); } - } static class CircularMixPolicy extends CircularPolicy { @Override - public void doSubParticles(FXFlow fxFlow, int policyCounter, double posX, double posY, double posZ, double lastPosX, double lastPosY, double lastPosZ) { + public void doSubParticles( + FXFlow fxFlow, + int policyCounter, + double posX, + double posY, + double posZ, + double lastPosX, + double lastPosY, + double lastPosZ) { super.doSubParticles(fxFlow, policyCounter, posX, posY, posZ, lastPosX, lastPosY, lastPosZ); - ((DefaultPolicy) Policies.DEFAULT.getPolicy()).doParticles(fxFlow, policyCounter, posX, posY, posZ, fxFlow.getRand().nextInt(2)); + ((DefaultPolicy) Policies.DEFAULT.getPolicy()) + .doParticles( + fxFlow, + policyCounter, + posX, + posY, + posZ, + fxFlow.getRand().nextInt(2)); } } - } diff --git a/src/main/java/makeo/gadomancy/client/effect/fx/FXFlow.java b/src/main/java/makeo/gadomancy/client/effect/fx/FXFlow.java index 6f448d3..4f40988 100644 --- a/src/main/java/makeo/gadomancy/client/effect/fx/FXFlow.java +++ b/src/main/java/makeo/gadomancy/client/effect/fx/FXFlow.java @@ -1,5 +1,9 @@ package makeo.gadomancy.client.effect.fx; +import java.awt.*; +import java.util.ArrayDeque; +import java.util.Queue; +import java.util.Random; import makeo.gadomancy.client.effect.EffectHandler; import makeo.gadomancy.common.data.config.ModConfig; import makeo.gadomancy.common.utils.MiscUtils; @@ -12,11 +16,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import org.lwjgl.opengl.GL11; -import java.awt.*; -import java.util.ArrayDeque; -import java.util.Queue; -import java.util.Random; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -135,7 +134,7 @@ public class FXFlow { private void calculateVelocity() { if (this.target == null) return; - if (this.livingTicks <= 0) return; //Never happens.. + if (this.livingTicks <= 0) return; // Never happens.. Vector3 pos = this.getPositionVector(); double motDirX = this.target.getX() - pos.getX(); @@ -167,16 +166,19 @@ public class FXFlow { return; } - FXFlowBase flow = new FXFlowBase(this.origin, this.posX, this.posY, this.posZ, this.color, this.mainParticleSize, 9, 240); - Minecraft.getMinecraft().effectRenderer.addEffect(flow); //Initial position. + FXFlowBase flow = + new FXFlowBase(this.origin, this.posX, this.posY, this.posZ, this.color, this.mainParticleSize, 9, 240); + Minecraft.getMinecraft().effectRenderer.addEffect(flow); // Initial position. double lastPosX = this.posX - (this.posX - this.lastTickPosX) / 2.0D; double lastPosY = this.posY - (this.posY - this.lastTickPosY) / 2.0D; double lastPosZ = this.posZ - (this.posZ - this.lastTickPosZ) / 2.0D; - FXFlowBase flow2 = new FXFlowBase(this.origin, lastPosX, lastPosY, lastPosZ, this.color, (float) (this.mainParticleSize * 0.8), 8, 240); - Minecraft.getMinecraft().effectRenderer.addEffect(flow2); //Consistency to last position + FXFlowBase flow2 = new FXFlowBase( + this.origin, lastPosX, lastPosY, lastPosZ, this.color, (float) (this.mainParticleSize * 0.8), 8, 240); + Minecraft.getMinecraft().effectRenderer.addEffect(flow2); // Consistency to last position if (this.policy != null) - this.policy.doSubParticles(this, this.policyCounter, this.posX, this.posY, this.posZ, lastPosX, lastPosY, lastPosZ); + this.policy.doSubParticles( + this, this.policyCounter, this.posX, this.posY, this.posZ, lastPosX, lastPosY, lastPosZ); } public Color getColor() { @@ -242,12 +244,9 @@ public class FXFlow { this.setColor(properties.fading); } } - if (properties.livingTicks != -1) - this.setLivingTicks(properties.livingTicks); - if (properties.mainParticleSize != -1) - this.setMainParticleSize(properties.mainParticleSize); - if (properties.surroundingDistance != -1) - this.setSurroundingDistance(properties.surroundingDistance); + if (properties.livingTicks != -1) this.setLivingTicks(properties.livingTicks); + if (properties.mainParticleSize != -1) this.setMainParticleSize(properties.mainParticleSize); + if (properties.surroundingDistance != -1) this.setSurroundingDistance(properties.surroundingDistance); if (properties.surroundingParticleSize != -1) this.setSurroundingParticleSize(properties.surroundingParticleSize); if (properties.motionMultiplier != Float.MAX_VALUE) { @@ -279,8 +278,7 @@ public class FXFlow { protected int livingTicks = -1; protected float motionMultiplier = Float.MAX_VALUE; - public EntityFlowProperties() { - } + public EntityFlowProperties() {} public EntityFlowProperties setTarget(Vector3 target) { this.hasTarget = target != null; @@ -332,7 +330,6 @@ public class FXFlow { this.livingTicks = livingTicks; return this; } - } public static class FXFlowBase extends EntityFX { @@ -341,7 +338,7 @@ public class FXFlow { private float partBlue, partGreen, partRed, partAlpha; - //Queue variables + // Queue variables private float partialTicks; private float rendArg1, rendArg2, rendArg3, rendArg4, rendArg5; private int rendBrightness; @@ -349,7 +346,8 @@ public class FXFlow { private ResourceLocation texture = new SimpleResourceLocation("fx/flow_large.png"); private float buffHalfLife, buffParticleScale; - public FXFlowBase(World world, double x, double y, double z, Color color, float size, int multiplier, int brightness) { + public FXFlowBase( + World world, double x, double y, double z, Color color, float size, int multiplier, int brightness) { super(world, x, y, z); if (color != null) { this.partBlue = color.getBlue() / 255F; @@ -381,8 +379,7 @@ public class FXFlow { GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F); - if (isLightingEnabled) - GL11.glDisable(GL11.GL_LIGHTING); + if (isLightingEnabled) GL11.glDisable(GL11.GL_LIGHTING); GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F); @@ -394,8 +391,7 @@ public class FXFlow { GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F); - if (isLightingEnabled) - GL11.glEnable(GL11.GL_LIGHTING); + if (isLightingEnabled) GL11.glEnable(GL11.GL_LIGHTING); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); @@ -416,16 +412,44 @@ public class FXFlow { float f12 = (float) (this.prevPosY + (this.posY - this.prevPosY) * this.partialTicks - EntityFX.interpPosY); float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * this.partialTicks - EntityFX.interpPosZ); - tessellator.addVertexWithUV(f11 - this.rendArg1 * f10 - this.rendArg4 * f10, f12 - this.rendArg2 * f10, f13 - this.rendArg3 * f10 - this.rendArg5 * f10, 0, 1); - tessellator.addVertexWithUV(f11 - this.rendArg1 * f10 + this.rendArg4 * f10, f12 + this.rendArg2 * f10, f13 - this.rendArg3 * f10 + this.rendArg5 * f10, 1, 1); - tessellator.addVertexWithUV(f11 + this.rendArg1 * f10 + this.rendArg4 * f10, f12 + this.rendArg2 * f10, f13 + this.rendArg3 * f10 + this.rendArg5 * f10, 1, 0); - tessellator.addVertexWithUV(f11 + this.rendArg1 * f10 - this.rendArg4 * f10, f12 - this.rendArg2 * f10, f13 + this.rendArg3 * f10 - this.rendArg5 * f10, 0, 0); + tessellator.addVertexWithUV( + f11 - this.rendArg1 * f10 - this.rendArg4 * f10, + f12 - this.rendArg2 * f10, + f13 - this.rendArg3 * f10 - this.rendArg5 * f10, + 0, + 1); + tessellator.addVertexWithUV( + f11 - this.rendArg1 * f10 + this.rendArg4 * f10, + f12 + this.rendArg2 * f10, + f13 - this.rendArg3 * f10 + this.rendArg5 * f10, + 1, + 1); + tessellator.addVertexWithUV( + f11 + this.rendArg1 * f10 + this.rendArg4 * f10, + f12 + this.rendArg2 * f10, + f13 + this.rendArg3 * f10 + this.rendArg5 * f10, + 1, + 0); + tessellator.addVertexWithUV( + f11 + this.rendArg1 * f10 - this.rendArg4 * f10, + f12 - this.rendArg2 * f10, + f13 + this.rendArg3 * f10 - this.rendArg5 * f10, + 0, + 0); } @Override - public void renderParticle(Tessellator tessellator, float partialTicks, float par3, float par4, float par5, float par6, float par7) { - if (MiscUtils.getPositionVector(Minecraft.getMinecraft().renderViewEntity).distance(new Vector3(this.posX, this.posY, this.posZ)) > ModConfig.renderParticleDistance) - return; + public void renderParticle( + Tessellator tessellator, + float partialTicks, + float par3, + float par4, + float par5, + float par6, + float par7) { + if (MiscUtils.getPositionVector(Minecraft.getMinecraft().renderViewEntity) + .distance(new Vector3(this.posX, this.posY, this.posZ)) + > ModConfig.renderParticleDistance) return; this.partialTicks = partialTicks; this.rendArg1 = par3; @@ -436,7 +460,5 @@ public class FXFlow { FXFlowBase.fxQueue.add(this); } - } - } 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 2031dd0..45a722a 100644 --- a/src/main/java/makeo/gadomancy/client/effect/fx/FXVortex.java +++ b/src/main/java/makeo/gadomancy/client/effect/fx/FXVortex.java @@ -1,5 +1,6 @@ package makeo.gadomancy.client.effect.fx; +import java.util.Random; import makeo.gadomancy.client.effect.EffectHandler; import makeo.gadomancy.client.events.ClientHandler; import makeo.gadomancy.common.blocks.tiles.TileEssentiaCompressor; @@ -14,8 +15,6 @@ import org.lwjgl.opengl.GL11; import thaumcraft.client.lib.QuadHelper; import thaumcraft.client.lib.UtilsFX; -import java.util.Random; - /** * HellFirePvP@Admin * Date: 24.04.2016 / 00:45 @@ -25,7 +24,8 @@ import java.util.Random; public class FXVortex { private static final Random RAND = new Random(); - public static final ResourceLocation TC_VORTEX_TEXTURE = new ResourceLocation("thaumcraft", "textures/misc/vortex.png"); + 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; @@ -124,7 +124,7 @@ public class FXVortex { public static void tickVortexes(Iterable vortexes) { for (FXVortex vortex : vortexes) { if ((System.currentTimeMillis() - vortex.lastUpdateCall) > 100L) { - //System.out.println("tickTimeout"); + // System.out.println("tickTimeout"); EffectHandler.getInstance().unregisterVortex(vortex); } } @@ -133,5 +133,4 @@ public class FXVortex { public void notify(long timeMillis) { this.lastUpdateCall = timeMillis; } - } diff --git a/src/main/java/makeo/gadomancy/client/effect/fx/Orbital.java b/src/main/java/makeo/gadomancy/client/effect/fx/Orbital.java index 85ea6ac..a47bb9e 100644 --- a/src/main/java/makeo/gadomancy/client/effect/fx/Orbital.java +++ b/src/main/java/makeo/gadomancy/client/effect/fx/Orbital.java @@ -1,5 +1,9 @@ package makeo.gadomancy.client.effect.fx; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; import makeo.gadomancy.client.effect.EffectHandler; import makeo.gadomancy.common.data.config.ModConfig; import makeo.gadomancy.common.utils.MiscUtils; @@ -7,11 +11,6 @@ import makeo.gadomancy.common.utils.Vector3; import net.minecraft.client.Minecraft; import net.minecraft.world.World; -import java.awt.*; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -26,7 +25,7 @@ public final class Orbital { private final World world; private int orbitalCounter; public boolean registered; - //INFO: Needs to be updated when its "owner" gets rendered. + // INFO: Needs to be updated when its "owner" gets rendered. public long lastRenderCall = System.currentTimeMillis(); private List orbitals = new ArrayList(); @@ -55,8 +54,9 @@ public final class Orbital { } public void doRender(float partialTicks) { - if (MiscUtils.getPositionVector(Minecraft.getMinecraft().renderViewEntity).distance(this.center) > ModConfig.renderParticleDistance) - return; + if (MiscUtils.getPositionVector(Minecraft.getMinecraft().renderViewEntity) + .distance(this.center) + > ModConfig.renderParticleDistance) return; if (Minecraft.getMinecraft().isGamePaused()) return; for (OrbitalRenderProperties orbitalNode : this.orbitals) { @@ -64,10 +64,17 @@ public final class Orbital { int counterOffset = orbitalNode.getOffsetTicks() % orbitalNode.getTicksForFullCircle(); int currentDividedPolicyTick = (this.orbitalCounter + counterOffset) % orbitalNode.getTicksForFullCircle(); - float currentDegree = 360F * (((float) currentDividedPolicyTick) / ((float) orbitalNode.getTicksForFullCircle())); + float currentDegree = + 360F * (((float) currentDividedPolicyTick) / ((float) orbitalNode.getTicksForFullCircle())); double currentRad = Math.toRadians(currentDegree); - Vector3 point = axis.getAxis().clone().perpendicular().normalize().multiply(orbitalNode.getOffset()).rotate(currentRad, axis.getAxis()).add(this.center); + Vector3 point = axis.getAxis() + .clone() + .perpendicular() + .normalize() + .multiply(orbitalNode.getOffset()) + .rotate(currentRad, axis.getAxis()) + .add(this.center); if (orbitalNode.getRunnable() != null) { orbitalNode.getRunnable().onRender(this.world, point, orbitalNode, this.orbitalCounter, partialTicks); @@ -75,15 +82,28 @@ public final class Orbital { if (orbitalNode.getParticleSize() <= 0) continue; - FXFlow.FXFlowBase flow = new FXFlow.FXFlowBase(this.world, point.getX(), point.getY(), point.getZ(), - orbitalNode.getColor(), orbitalNode.getParticleSize(), orbitalNode.getMultiplier(), orbitalNode.getBrightness()); + FXFlow.FXFlowBase flow = new FXFlow.FXFlowBase( + this.world, + point.getX(), + point.getY(), + point.getZ(), + orbitalNode.getColor(), + orbitalNode.getParticleSize(), + orbitalNode.getMultiplier(), + orbitalNode.getBrightness()); if (orbitalNode.getSubParticleColor() != null && this.world.rand.nextInt(3) == 0) { Vector3 subOffset = this.genSubOffset(this.world.rand, 0.8F); Color c = (this.world.rand.nextBoolean()) ? orbitalNode.getSubParticleColor() : orbitalNode.getColor(); - FXFlow.FXFlowBase flow2 = new FXFlow.FXFlowBase(this.world, - point.getX() + subOffset.getX(), point.getY() + subOffset.getY(), point.getZ() + subOffset.getZ(), - c, orbitalNode.getSubSizeRunnable().getSubParticleSize(this.world.rand, this.orbitalCounter), 6, 240); + FXFlow.FXFlowBase flow2 = new FXFlow.FXFlowBase( + this.world, + point.getX() + subOffset.getX(), + point.getY() + subOffset.getY(), + point.getZ() + subOffset.getZ(), + c, + orbitalNode.getSubSizeRunnable().getSubParticleSize(this.world.rand, this.orbitalCounter), + 6, + 240); Minecraft.getMinecraft().effectRenderer.addEffect(flow2); } @@ -118,10 +138,17 @@ public final class Orbital { int counterOffset = property.getOffsetTicks() % property.getTicksForFullCircle(); int currentDividedPolicyTick = (this.orbitalCounter + counterOffset) % property.getTicksForFullCircle(); - float currentDegree = 360F * (((float) currentDividedPolicyTick) / ((float) property.getTicksForFullCircle())); + float currentDegree = + 360F * (((float) currentDividedPolicyTick) / ((float) property.getTicksForFullCircle())); double currentRad = Math.toRadians(currentDegree); - arr[i] = axis.getAxis().clone().perpendicular().normalize().multiply(property.getOffset()).rotate(currentRad, axis.getAxis()).add(this.center); + arr[i] = axis.getAxis() + .clone() + .perpendicular() + .normalize() + .multiply(property.getOffset()) + .rotate(currentRad, axis.getAxis()) + .add(this.center); } return arr; } @@ -217,7 +244,7 @@ public final class Orbital { return this; } - //Percent from 0.0F to 1.0F + // Percent from 0.0F to 1.0F public void reduceOffset(float percent) { this.offset = this.originalOffset * percent; } @@ -272,7 +299,12 @@ public final class Orbital { } public abstract static class OrbitalRenderRunnable { - public abstract void onRender(World world, Vector3 selectedPosition, OrbitalRenderProperties properties, int orbitalExisted, float partialTicks); + public abstract void onRender( + World world, + Vector3 selectedPosition, + OrbitalRenderProperties properties, + int orbitalExisted, + float partialTicks); } public static class Axis { @@ -288,10 +320,10 @@ public final class Orbital { } public static Axis persisentRandomAxis() { - //Actually quite important to use only Y-positive here since if we - //would use negative y, the axis may turn counter- - //clockwise, what's intended to be set in another variable, which - //may cause bugs if we want to use only clockwise axis'. + // Actually quite important to use only Y-positive here since if we + // would use negative y, the axis may turn counter- + // clockwise, what's intended to be set in another variable, which + // may cause bugs if we want to use only clockwise axis'. return new Axis(Vector3.positiveYRandom()); } @@ -299,5 +331,4 @@ public final class Orbital { return this.axis.clone(); } } - } diff --git a/src/main/java/makeo/gadomancy/client/events/ClientHandler.java b/src/main/java/makeo/gadomancy/client/events/ClientHandler.java index 5677cfc..b146381 100644 --- a/src/main/java/makeo/gadomancy/client/events/ClientHandler.java +++ b/src/main/java/makeo/gadomancy/client/events/ClientHandler.java @@ -3,6 +3,7 @@ package makeo.gadomancy.client.events; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.common.network.FMLNetworkEvent; +import java.util.Queue; import makeo.gadomancy.client.ClientProxy; import makeo.gadomancy.client.effect.EffectHandler; import makeo.gadomancy.client.renderers.tile.RenderTileEssentiaCompressor; @@ -10,8 +11,6 @@ import makeo.gadomancy.client.util.FamiliarHandlerClient; import makeo.gadomancy.common.Gadomancy; import net.minecraft.client.Minecraft; -import java.util.Queue; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -26,15 +25,15 @@ public class ClientHandler { @SubscribeEvent public void onClientTick(TickEvent.ClientTickEvent event) { - if(event.phase.equals(TickEvent.Phase.END) && !Minecraft.getMinecraft().isGamePaused()) { + if (event.phase.equals(TickEvent.Phase.END) && !Minecraft.getMinecraft().isGamePaused()) { FamiliarHandlerClient.playerTickEvent(); ClientHandler.ticks++; EffectHandler.getInstance().tick(); } - Queue actions = ((ClientProxy)Gadomancy.proxy).clientActions; - while(actions.peek() != null) { + Queue actions = ((ClientProxy) Gadomancy.proxy).clientActions; + while (actions.peek() != null) { actions.poll().run(); } } @@ -44,5 +43,4 @@ public class ClientHandler { EffectHandler.getInstance().clear(); RenderTileEssentiaCompressor.ownedVortex.clear(); } - } diff --git a/src/main/java/makeo/gadomancy/client/events/FakeArchitectItem.java b/src/main/java/makeo/gadomancy/client/events/FakeArchitectItem.java index 3c37aa5..712e288 100644 --- a/src/main/java/makeo/gadomancy/client/events/FakeArchitectItem.java +++ b/src/main/java/makeo/gadomancy/client/events/FakeArchitectItem.java @@ -1,5 +1,6 @@ package makeo.gadomancy.client.events; +import java.util.ArrayList; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -7,8 +8,6 @@ import net.minecraft.world.World; import thaumcraft.api.BlockCoordinates; import thaumcraft.api.IArchitect; -import java.util.ArrayList; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -25,12 +24,18 @@ public class FakeArchitectItem extends Item implements IArchitect { } @Override - public ArrayList getArchitectBlocks(ItemStack stack, World world, int x, int y, int z, int side, EntityPlayer player) { + public ArrayList getArchitectBlocks( + ItemStack stack, World world, int x, int y, int z, int side, EntityPlayer player) { return this.coords; } @Override - public boolean showAxis(ItemStack paramItemStack, World paramWorld, EntityPlayer paramEntityPlayer, int paramInt, EnumAxis paramEnumAxis) { + public boolean showAxis( + ItemStack paramItemStack, + World paramWorld, + EntityPlayer paramEntityPlayer, + int paramInt, + EnumAxis paramEnumAxis) { return false; } } diff --git a/src/main/java/makeo/gadomancy/client/events/RenderEventHandler.java b/src/main/java/makeo/gadomancy/client/events/RenderEventHandler.java index 1be659b..8a2c7ef 100644 --- a/src/main/java/makeo/gadomancy/client/events/RenderEventHandler.java +++ b/src/main/java/makeo/gadomancy/client/events/RenderEventHandler.java @@ -2,6 +2,9 @@ package makeo.gadomancy.client.events; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.zip.GZIPInputStream; import makeo.gadomancy.api.GadomancyApi; import makeo.gadomancy.api.golems.cores.AdditionalGolemCore; import makeo.gadomancy.client.gui.GuiResearchRecipeAuraEffects; @@ -46,11 +49,6 @@ import thaumcraft.common.entities.golems.EntityGolemBase; import thaumcraft.common.items.relics.ItemThaumometer; import thaumcraft.common.items.wands.ItemWandCasting; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.zip.GZIPInputStream; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -68,16 +66,17 @@ public class RenderEventHandler { @SubscribeEvent public void on(GuiScreenEvent.DrawScreenEvent.Pre e) { - if(e.gui instanceof GuiGolem) { + if (e.gui instanceof GuiGolem) { GuiGolem gui = (GuiGolem) e.gui; EntityGolemBase golem = new Injector(gui, GuiGolem.class).getField("golem"); - if(golem != null) { + if (golem != null) { AdditionalGolemCore core = GadomancyApi.getAdditionalGolemCore(golem); - if(core != null) { + if (core != null) { this.blurbId = core.getBaseCore(); String key = "golemblurb." + this.blurbId + ".text"; this.oldGolemblurb = ResourceReloadListener.languageList.get(key); - ResourceReloadListener.languageList.put(key, StatCollector.translateToLocal(core.getUnlocalizedGuiText())); + ResourceReloadListener.languageList.put( + key, StatCollector.translateToLocal(core.getUnlocalizedGuiText())); } } } @@ -85,7 +84,7 @@ public class RenderEventHandler { @SubscribeEvent public void on(GuiScreenEvent.DrawScreenEvent.Post e) { - if(this.oldGolemblurb != null) { + if (this.oldGolemblurb != null) { String key = "golemblurb." + this.blurbId + ".text"; ResourceReloadListener.languageList.put(key, this.oldGolemblurb); this.oldGolemblurb = null; @@ -94,46 +93,56 @@ public class RenderEventHandler { @SubscribeEvent public void on(DrawBlockHighlightEvent e) { - if(e.currentItem == null) return; - if(e.currentItem.getItem() instanceof ItemWandCasting) { + if (e.currentItem == null) return; + if (e.currentItem.getItem() instanceof ItemWandCasting) { ItemFocusBasic focus = ((ItemWandCasting) e.currentItem.getItem()).getFocus(e.currentItem); - if(focus == null || !(focus instanceof IArchitect)) { + if (focus == null || !(focus instanceof IArchitect)) { Block block = e.player.worldObj.getBlock(e.target.blockX, e.target.blockY, e.target.blockZ); - if(block != null && block == RegisteredBlocks.blockArcaneDropper) { - ForgeDirection dir = ForgeDirection.getOrientation(e.player.worldObj.getBlockMetadata(e.target.blockX, e.target.blockY, e.target.blockZ) & 7); + if (block != null && block == RegisteredBlocks.blockArcaneDropper) { + ForgeDirection dir = ForgeDirection.getOrientation( + e.player.worldObj.getBlockMetadata(e.target.blockX, e.target.blockY, e.target.blockZ) & 7); ArrayList coords = new ArrayList(); - for(int x = -1; x < 2; x++) { - for(int y = -1; y < 2; y++) { - for(int z = -1; z < 2; z++) { - coords.add(new BlockCoordinates(e.target.blockX + 2*dir.offsetX + x, e.target.blockY + 2*dir.offsetY + y, e.target.blockZ + 2*dir.offsetZ + z)); + for (int x = -1; x < 2; x++) { + for (int y = -1; y < 2; y++) { + for (int z = -1; z < 2; z++) { + coords.add(new BlockCoordinates( + e.target.blockX + 2 * dir.offsetX + x, + e.target.blockY + 2 * dir.offsetY + y, + e.target.blockZ + 2 * dir.offsetZ + z)); } } } - coords.add(new BlockCoordinates(e.target.blockX + dir.offsetX, e.target.blockY + dir.offsetY, e.target.blockZ + dir.offsetZ)); + coords.add(new BlockCoordinates( + e.target.blockX + dir.offsetX, + e.target.blockY + dir.offsetY, + e.target.blockZ + dir.offsetZ)); RenderEventHandler.ARCHITECT_ITEM.setCoords(coords); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); - RenderEventHandler.WAND_HANDLER.handleArchitectOverlay(new ItemStack(RenderEventHandler.ARCHITECT_ITEM), e, e.player.ticksExisted, e.target); + RenderEventHandler.WAND_HANDLER.handleArchitectOverlay( + new ItemStack(RenderEventHandler.ARCHITECT_ITEM), e, e.player.ticksExisted, e.target); GL11.glPopAttrib(); } } - } else if(e.currentItem.getItem() instanceof ItemThaumometer) { - if(e.target.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) return; + } else if (e.currentItem.getItem() instanceof ItemThaumometer) { + if (e.target.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) return; int blockX = e.target.blockX; int blockY = e.target.blockY; int blockZ = e.target.blockZ; - if(Minecraft.getMinecraft().gameSettings.thirdPersonView == 0) { + if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 0) { TileEntity tile = e.player.worldObj.getTileEntity(blockX, blockY, blockZ); - if(tile instanceof TileExtendedNode) { + if (tile instanceof TileExtendedNode) { TileExtendedNode node = (TileExtendedNode) tile; - if(node.getExtendedNodeType() == null) return; - ExtendedTypeDisplayManager.notifyDisplayTick(node.getId(), node.getNodeType(), node.getExtendedNodeType()); - } else if(tile instanceof TileExtendedNodeJar) { + if (node.getExtendedNodeType() == null) return; + ExtendedTypeDisplayManager.notifyDisplayTick( + node.getId(), node.getNodeType(), node.getExtendedNodeType()); + } else if (tile instanceof TileExtendedNodeJar) { TileExtendedNodeJar nodeJar = (TileExtendedNodeJar) tile; - if(nodeJar.getExtendedNodeType() == null) return; - ExtendedTypeDisplayManager.notifyDisplayTick(nodeJar.getId(), nodeJar.getNodeType(), nodeJar.getExtendedNodeType()); + if (nodeJar.getExtendedNodeType() == null) return; + ExtendedTypeDisplayManager.notifyDisplayTick( + nodeJar.getId(), nodeJar.getNodeType(), nodeJar.getExtendedNodeType()); } } } @@ -141,10 +150,11 @@ public class RenderEventHandler { @SubscribeEvent public void guiOpen(GuiOpenEvent event) { - if(event.gui != null && event.gui instanceof GuiResearchRecipe) { + if (event.gui != null && event.gui instanceof GuiResearchRecipe) { GuiResearchRecipe gui = (GuiResearchRecipe) event.gui; ResearchItem research = new Injector(gui, GuiResearchRecipe.class).getField("research"); - if(research.key.equals(Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS") && !(gui instanceof GuiResearchRecipeAuraEffects)) { + if (research.key.equals(Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS") + && !(gui instanceof GuiResearchRecipeAuraEffects)) { event.gui = GuiResearchRecipeAuraEffects.create(gui); } } @@ -161,9 +171,10 @@ public class RenderEventHandler { @SubscribeEvent(priority = EventPriority.LOWEST) public void renderEntityPre(RenderLivingEvent.Pre event) { - if(event.entity instanceof EntityPlayer) { + if (event.entity instanceof EntityPlayer) { EntityPlayer p = (EntityPlayer) event.entity; - if(((DataAchromatic)SyncDataHolder.getDataClient("AchromaticData")).isAchromatic((EntityPlayer) event.entity)) { + if (((DataAchromatic) SyncDataHolder.getDataClient("AchromaticData")) + .isAchromatic((EntityPlayer) event.entity)) { this.current = p; GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.15F); GL11.glDepthMask(false); @@ -177,12 +188,12 @@ public class RenderEventHandler { System.arraycopy(this.armor, 0, p.inventory.armorInventory, 0, this.armor.length); boolean changed = false; - for(int i = 0; i < this.armor.length; i++) { - if(this.armor[i] != null && NBTHelper.hasPersistentData(this.armor[i])) { + for (int i = 0; i < this.armor.length; i++) { + if (this.armor[i] != null && NBTHelper.hasPersistentData(this.armor[i])) { NBTTagCompound compound = NBTHelper.getPersistentData(this.armor[i]); - if(compound.hasKey("disguise")) { + if (compound.hasKey("disguise")) { NBTBase base = compound.getTag("disguise"); - if(base instanceof NBTTagCompound) { + if (base instanceof NBTTagCompound) { p.inventory.armorInventory[i] = ItemStack.loadItemStackFromNBT((NBTTagCompound) base); } else { p.inventory.armorInventory[i] = null; @@ -192,7 +203,7 @@ public class RenderEventHandler { } } - if(!changed) { + if (!changed) { p.inventory.armorInventory = this.armor; this.armor = null; } @@ -201,9 +212,9 @@ public class RenderEventHandler { @SubscribeEvent(priority = EventPriority.LOWEST, receiveCanceled = true) public void renderPost(RenderLivingEvent.Post event) { - if(event.entity instanceof EntityPlayer) { + if (event.entity instanceof EntityPlayer) { EntityPlayer p = (EntityPlayer) event.entity; - if(this.armor != null) { + if (this.armor != null) { p.inventory.armorInventory = this.armor; } } @@ -211,7 +222,7 @@ public class RenderEventHandler { @SubscribeEvent(priority = EventPriority.HIGHEST, receiveCanceled = true) public void onSetArmor(RenderPlayerEvent.SetArmorModel event) { - if(event.entityPlayer == this.current) { + if (event.entityPlayer == this.current) { GL11.glDisable(GL11.GL_BLEND); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glDepthMask(true); @@ -219,26 +230,43 @@ public class RenderEventHandler { } static { - ResourceLocation mod = new ResourceLocation(Gadomancy.MODID.toLowerCase() + new String(new byte[] {58, 116, 101, 120, 116, 117, 114, 101, 115, 47, 109, 111, 100, 101, 108, 115, 47, 109, 111, 100, 101, 108, 65, 115, 115, 101, 99, 46, 111, 98, 106}, StandardCharsets.UTF_8)); + ResourceLocation mod = new ResourceLocation(Gadomancy.MODID.toLowerCase() + + new String( + new byte[] { + 58, 116, 101, 120, 116, 117, 114, 101, 115, 47, 109, 111, 100, 101, 108, 115, 47, 109, 111, + 100, 101, 108, 65, 115, 115, 101, 99, 46, 111, 98, 106 + }, + StandardCharsets.UTF_8)); IModelCustom buf; try { - buf = new WavefrontObject("gadomancy:wRender", new GZIPInputStream(Minecraft.getMinecraft().getResourceManager().getResource(mod).getInputStream())); + buf = new WavefrontObject( + "gadomancy:wRender", + new GZIPInputStream(Minecraft.getMinecraft() + .getResourceManager() + .getResource(mod) + .getInputStream())); } catch (Exception exc) { - //shush. + // shush. buf = null; } obj = buf; } private static final IModelCustom obj; - private static final ResourceLocation tex = new ResourceLocation(new String(new byte[] {103, 97, 100, 111, 109, 97, 110, 99, 121, 58, 116, 101, 120, 116, 117, 114, 101, 115, 47, 109, 105, 115, 99, 47, 116, 101, 120, 87, 46, 112, 110, 103}, StandardCharsets.UTF_8)); + private static final ResourceLocation tex = new ResourceLocation(new String( + new byte[] { + 103, 97, 100, 111, 109, 97, 110, 99, 121, 58, 116, 101, 120, 116, 117, 114, 101, 115, 47, 109, 105, 115, + 99, 47, 116, 101, 120, 87, 46, 112, 110, 103 + }, + StandardCharsets.UTF_8)); private static int dList = -1; + @SubscribeEvent public void onRender(RenderPlayerEvent.Specials.Post event) { - if(event.entityPlayer == null) return; - if(RenderEventHandler.obj == null) return; - if(!CommonProxy.serverOnlineState) return; - if(!MiscUtils.isMisunderstood(event.entityPlayer)) return; + if (event.entityPlayer == null) return; + if (RenderEventHandler.obj == null) return; + if (!CommonProxy.serverOnlineState) return; + if (!MiscUtils.isMisunderstood(event.entityPlayer)) return; GL11.glColor4f(1f, 1f, 1f, 1f); @@ -246,12 +274,18 @@ public class RenderEventHandler { Minecraft.getMinecraft().renderEngine.bindTexture(RenderEventHandler.tex); boolean f = event.entityPlayer.capabilities.isFlying; double ma = f ? 15 : 5; - double r = (ma * (Math.abs((ClientHandler.ticks % 80) - 40) / 40D)) + - ((65 - ma) * Math.max(0, Math.min(1, new Vector3(event.entityPlayer.motionX, 0, event.entityPlayer.motionZ).length()))); + double r = (ma * (Math.abs((ClientHandler.ticks % 80) - 40) / 40D)) + + ((65 - ma) + * Math.max( + 0, + Math.min( + 1, + new Vector3(event.entityPlayer.motionX, 0, event.entityPlayer.motionZ) + .length()))); GL11.glScaled(0.07, 0.07, 0.07); GL11.glRotatef(180, 0, 0, 1); GL11.glTranslated(0, -12.7, 0.7 - (((float) (r / ma)) * (f ? 0.5D : 0.2D))); - if(RenderEventHandler.dList == -1) { + if (RenderEventHandler.dList == -1) { RenderEventHandler.dList = GLAllocation.generateDisplayLists(2); GL11.glNewList(RenderEventHandler.dList, GL11.GL_COMPILE); RenderEventHandler.obj.renderOnly("wR"); diff --git a/src/main/java/makeo/gadomancy/client/events/ResourceReloadListener.java b/src/main/java/makeo/gadomancy/client/events/ResourceReloadListener.java index 5ed0e38..fc1cc30 100644 --- a/src/main/java/makeo/gadomancy/client/events/ResourceReloadListener.java +++ b/src/main/java/makeo/gadomancy/client/events/ResourceReloadListener.java @@ -1,5 +1,6 @@ package makeo.gadomancy.client.events; +import java.util.Map; import makeo.gadomancy.api.GadomancyApi; import makeo.gadomancy.api.golems.AdditionalGolemType; import makeo.gadomancy.client.textures.GolemGuiTexture; @@ -12,8 +13,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraft.util.StringTranslate; -import java.util.Map; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -25,6 +24,7 @@ import java.util.Map; public class ResourceReloadListener implements IResourceManagerReloadListener { public static final ResourceReloadListener instance = new ResourceReloadListener(); + public static ResourceReloadListener getInstance() { return ResourceReloadListener.instance; } @@ -32,8 +32,8 @@ public class ResourceReloadListener implements IResourceManagerReloadListener { public static Map languageList; private ResourceReloadListener() { - Injector inner = new Injector(StringTranslate.class); - Object O = inner.getField(Injector.findField(StringTranslate.class, StringTranslate.class)); + Injector inner = new Injector(StringTranslate.class); + Object O = inner.getField(Injector.findField(StringTranslate.class, StringTranslate.class)); Injector instance = new Injector(O); ResourceReloadListener.languageList = instance.getField(instance.findField(Map.class)); } @@ -55,17 +55,23 @@ public class ResourceReloadListener implements IResourceManagerReloadListener { } private void manipulateLanguageFile() { - if(ResourceReloadListener.languageList != null) { - for(AdditionalGolemType type : GadomancyApi.getAdditionalGolemTypes()) { - ResourceReloadListener.languageList.put("item.ItemGolemPlacer." + type.getEnumEntry().ordinal() + ".name", + if (ResourceReloadListener.languageList != null) { + for (AdditionalGolemType type : GadomancyApi.getAdditionalGolemTypes()) { + ResourceReloadListener.languageList.put( + "item.ItemGolemPlacer." + type.getEnumEntry().ordinal() + ".name", StatCollector.translateToLocal(type.getUnlocalizedName() + ".name")); } } } - private static final ResourceLocation TC_GOLEM_GUI_TEXTURE = new ResourceLocation("thaumcraft", "textures/gui/guigolem.png"); + private static final ResourceLocation TC_GOLEM_GUI_TEXTURE = + new ResourceLocation("thaumcraft", "textures/gui/guigolem.png"); private void registerTextureOverride() { - Minecraft.getMinecraft().renderEngine.loadTexture(ResourceReloadListener.TC_GOLEM_GUI_TEXTURE, new GolemGuiTexture(ResourceReloadListener.TC_GOLEM_GUI_TEXTURE)); + Minecraft.getMinecraft() + .renderEngine + .loadTexture( + ResourceReloadListener.TC_GOLEM_GUI_TEXTURE, + new GolemGuiTexture(ResourceReloadListener.TC_GOLEM_GUI_TEXTURE)); } } diff --git a/src/main/java/makeo/gadomancy/client/gui/ArcanePackagerGui.java b/src/main/java/makeo/gadomancy/client/gui/ArcanePackagerGui.java index 453ea10..53d8f8c 100644 --- a/src/main/java/makeo/gadomancy/client/gui/ArcanePackagerGui.java +++ b/src/main/java/makeo/gadomancy/client/gui/ArcanePackagerGui.java @@ -1,5 +1,6 @@ package makeo.gadomancy.client.gui; +import java.awt.*; import makeo.gadomancy.common.blocks.tiles.TileArcanePackager; import makeo.gadomancy.common.containers.ContainerArcanePackager; import makeo.gadomancy.common.utils.ColorHelper; @@ -12,8 +13,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11; -import java.awt.*; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -40,7 +39,7 @@ public class ArcanePackagerGui extends GuiContainer { @Override protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { - if(this.tile.isInvalid()) { + if (this.tile.isInvalid()) { Minecraft.getMinecraft().displayGuiScreen(null); return; } @@ -50,19 +49,19 @@ public class ArcanePackagerGui extends GuiContainer { GL11.glColor3f(1, 1, 1); - if(this.tile.progress > 0) { + if (this.tile.progress > 0) { this.drawTexturedModalRect(89, 67, 210, 0, this.tile.progress, 9); } - if(this.tile.useEssentia) { + if (this.tile.useEssentia) { this.drawTexturedModalRect(91, 97, 249, 10, 8, 8); } - if(this.tile.autoStart) { + if (this.tile.autoStart) { this.drawTexturedModalRect(91, 110, 249, 10, 8, 8); } - if(this.tile.disguise) { + if (this.tile.disguise) { this.drawTexturedModalRect(91, 123, 249, 10, 8, 8); } @@ -78,11 +77,17 @@ public class ArcanePackagerGui extends GuiContainer { int var6 = (this.height - this.ySize) / 2; this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize); - this.drawString(100, 98, "gadomancy.info.ArcanePackager.useEssentia", this.tile.useEssentia ? Color.WHITE : Color.GRAY); + this.drawString( + 100, 98, "gadomancy.info.ArcanePackager.useEssentia", this.tile.useEssentia ? Color.WHITE : Color.GRAY); - this.drawString(100, 111, "gadomancy.info.ArcanePackager.autoStart", this.tile.autoStart ? Color.WHITE : Color.GRAY); + this.drawString( + 100, 111, "gadomancy.info.ArcanePackager.autoStart", this.tile.autoStart ? Color.WHITE : Color.GRAY); - this.drawString(100, 124, "gadomancy.info.ArcanePackager.disguisePackage", this.tile.disguise ? Color.WHITE : Color.GRAY); + this.drawString( + 100, + 124, + "gadomancy.info.ArcanePackager.disguisePackage", + this.tile.disguise ? Color.WHITE : Color.GRAY); GL11.glDisable(GL11.GL_BLEND); } @@ -105,25 +110,23 @@ public class ArcanePackagerGui extends GuiContainer { int checkX = x - baseX - 90; int checkY = y - baseY - 97; - if(checkX >= 0 && checkX < 8 && checkY >= 0 && checkY < 8) { + if (checkX >= 0 && checkX < 8 && checkY >= 0 && checkY < 8) { this.tile.useEssentia = !this.tile.useEssentia; this.mc.playerController.sendEnchantPacket(this.inventorySlots.windowId, this.tile.useEssentia ? 0 : 1); } checkY = y - baseY - 110; - if(checkX >= 0 && checkX < 8 && checkY >= 0 && checkY < 8) { + if (checkX >= 0 && checkX < 8 && checkY >= 0 && checkY < 8) { this.tile.autoStart = !this.tile.autoStart; this.mc.playerController.sendEnchantPacket(this.inventorySlots.windowId, this.tile.autoStart ? 2 : 3); } checkY = y - baseY - 123; - if(checkX >= 0 && checkX < 8 && checkY >= 0 && checkY < 8) { + if (checkX >= 0 && checkX < 8 && checkY >= 0 && checkY < 8) { this.tile.disguise = !this.tile.disguise; this.mc.playerController.sendEnchantPacket(this.inventorySlots.windowId, this.tile.disguise ? 4 : 5); } } - - } diff --git a/src/main/java/makeo/gadomancy/client/gui/GuiResearchRecipeAuraEffects.java b/src/main/java/makeo/gadomancy/client/gui/GuiResearchRecipeAuraEffects.java index 4b25676..a029288 100644 --- a/src/main/java/makeo/gadomancy/client/gui/GuiResearchRecipeAuraEffects.java +++ b/src/main/java/makeo/gadomancy/client/gui/GuiResearchRecipeAuraEffects.java @@ -1,5 +1,9 @@ package makeo.gadomancy.client.gui; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.aura.AuraResearchManager; import makeo.gadomancy.common.aura.ResearchPageAuraAspects; @@ -21,11 +25,6 @@ import thaumcraft.common.Thaumcraft; import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager; import thaumcraft.common.lib.utils.InventoryUtils; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -43,7 +42,8 @@ public class GuiResearchRecipeAuraEffects extends GuiResearchRecipe { Injector inj = new Injector(this, GuiResearchRecipe.class); - ResearchPage[] additionalPages = ResearchPageAuraAspects.createAllAuraPagesFor(Minecraft.getMinecraft().thePlayer); + ResearchPage[] additionalPages = + ResearchPageAuraAspects.createAllAuraPagesFor(Minecraft.getMinecraft().thePlayer); ResearchPage[] pages = inj.getField("pages"); ResearchPage[] newPages = new ResearchPage[pages.length + additionalPages.length]; System.arraycopy(pages, 0, newPages, 0, pages.length); @@ -51,7 +51,9 @@ public class GuiResearchRecipeAuraEffects extends GuiResearchRecipe { inj.setField("pages", newPages); inj.setField("maxPages", newPages.length); - List list = Thaumcraft.proxy.getScannedObjects().get(Minecraft.getMinecraft().thePlayer.getCommandSenderName()); + List list = Thaumcraft.proxy + .getScannedObjects() + .get(Minecraft.getMinecraft().thePlayer.getCommandSenderName()); if ((list != null) && (list.size() > 0)) { for (String s : list) { try { @@ -73,7 +75,8 @@ public class GuiResearchRecipeAuraEffects extends GuiResearchRecipe { } } } - } catch (NumberFormatException e) {} + } catch (NumberFormatException e) { + } } } } @@ -122,9 +125,17 @@ public class GuiResearchRecipeAuraEffects extends GuiResearchRecipe { ResearchPage rPage = pages[a]; if (rPage instanceof ResearchPageAuraAspects) { this.drawAuraAspectPagePre(rPage, current % 2, sw, sh, par1, par2, page); - } else if(rPage != null) { + } else if (rPage != null) { try { - Method m = Injector.getMethod("drawPage", GuiResearchRecipe.class, ResearchPage.class, int.class, int.class, int.class, int.class, int.class); + Method m = Injector.getMethod( + "drawPage", + GuiResearchRecipe.class, + ResearchPage.class, + int.class, + int.class, + int.class, + int.class, + int.class); m.setAccessible(true); m.invoke(this, pages[a], current % 2, sw, sh, par1, par2); } catch (Exception e) { @@ -157,7 +168,7 @@ public class GuiResearchRecipeAuraEffects extends GuiResearchRecipe { private void drawAuraAspectPagePre(ResearchPage page, int side, int x, int y, int mx, int my, int thisPage) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); - String researchName = Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS"; //We know the name of that research. + String researchName = Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS"; // We know the name of that research. researchName = StatCollector.translateToLocal(researchName); if ((thisPage == 0) && (side == 0)) { this.drawTexturedModalRect(x + 4, y - 13, 24, 184, 96, 4); @@ -204,7 +215,8 @@ public class GuiResearchRecipeAuraEffects extends GuiResearchRecipe { GL11.glPopMatrix(); } GL11.glScalef(2.0F, 2.0F, 2.0F); - UtilsFX.drawTag((x + start) / 2, (y + count * 50) / 2, aspect, aspects.getAmount(aspect), 0, this.zLevel); + UtilsFX.drawTag( + (x + start) / 2, (y + count * 50) / 2, aspect, aspects.getAmount(aspect), 0, this.zLevel); GL11.glPopMatrix(); String text = aspect.getName(); int offset = fr.getStringWidth(text) / 2; @@ -240,8 +252,18 @@ public class GuiResearchRecipeAuraEffects extends GuiResearchRecipe { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); RenderHelper.enableGUIStandardItemLighting(); GL11.glEnable(GL11.GL_LIGHTING); - GuiResearchRecipe.itemRenderer.renderItemAndEffectIntoGUI(this.mc.fontRenderer, this.mc.renderEngine, InventoryUtils.cycleItemStack(item), mx + 8 + xcount * 17, 17 * ycount + (my - (4 + items.size() / 8 * 8))); - GuiResearchRecipe.itemRenderer.renderItemOverlayIntoGUI(this.mc.fontRenderer, this.mc.renderEngine, InventoryUtils.cycleItemStack(item), mx + 8 + xcount * 17, 17 * ycount + (my - (4 + items.size() / 8 * 8))); + GuiResearchRecipe.itemRenderer.renderItemAndEffectIntoGUI( + this.mc.fontRenderer, + this.mc.renderEngine, + InventoryUtils.cycleItemStack(item), + mx + 8 + xcount * 17, + 17 * ycount + (my - (4 + items.size() / 8 * 8))); + GuiResearchRecipe.itemRenderer.renderItemOverlayIntoGUI( + this.mc.fontRenderer, + this.mc.renderEngine, + InventoryUtils.cycleItemStack(item), + mx + 8 + xcount * 17, + 17 * ycount + (my - (4 + items.size() / 8 * 8))); RenderHelper.disableStandardItemLighting(); GL11.glPopMatrix(); xcount++; diff --git a/src/main/java/makeo/gadomancy/client/gui/InfusionClawGui.java b/src/main/java/makeo/gadomancy/client/gui/InfusionClawGui.java index baa33ec..cb5537f 100644 --- a/src/main/java/makeo/gadomancy/client/gui/InfusionClawGui.java +++ b/src/main/java/makeo/gadomancy/client/gui/InfusionClawGui.java @@ -2,6 +2,7 @@ package makeo.gadomancy.client.gui; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.awt.*; import makeo.gadomancy.common.blocks.tiles.TileInfusionClaw; import makeo.gadomancy.common.containers.ContainerInfusionClaw; import makeo.gadomancy.common.utils.ColorHelper; @@ -15,8 +16,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11; -import java.awt.*; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -38,13 +37,16 @@ public class InfusionClawGui extends GuiContainer { @Override protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { - if(((TileInfusionClaw) this.container.clawInv).isInvalid()) { + if (((TileInfusionClaw) this.container.clawInv).isInvalid()) { Minecraft.getMinecraft().displayGuiScreen(null); return; } ItemStack cursorStack = this.container.playerInv.getItemStack(); - if(((TileInfusionClaw) this.container.clawInv).isRunning() || (cursorStack != null && cursorStack.stackSize > 0 && !this.container.clawInv.isItemValidForSlot(0, cursorStack))) { + if (((TileInfusionClaw) this.container.clawInv).isRunning() + || (cursorStack != null + && cursorStack.stackSize > 0 + && !this.container.clawInv.isItemValidForSlot(0, cursorStack))) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glEnable(GL11.GL_BLEND); @@ -79,14 +81,18 @@ public class InfusionClawGui extends GuiContainer { this.drawTexturedModalRect(baseX + 114, baseY + 36, 244, 19, 8, 8); boolean isLocked = ((TileInfusionClaw) this.container.clawInv).isLocked(); - if(isLocked) { + if (isLocked) { this.drawTexturedModalRect(baseX + 114, baseY + 36, 244, 27, 8, 8); } GL11.glPushMatrix(); GL11.glTranslatef(baseX + 124, baseY + 38, 0); GL11.glScalef(0.5F, 0.5F, 0.0F); - this.fontRendererObj.drawString(StatCollector.translateToLocal("gadomancy.info.InfusionClaw.lock"), 0, 0, ColorHelper.toHex(isLocked ? Color.WHITE : Color.GRAY)); + this.fontRendererObj.drawString( + StatCollector.translateToLocal("gadomancy.info.InfusionClaw.lock"), + 0, + 0, + ColorHelper.toHex(isLocked ? Color.WHITE : Color.GRAY)); GL11.glPopMatrix(); GL11.glDisable(GL11.GL_BLEND); @@ -102,7 +108,7 @@ public class InfusionClawGui extends GuiContainer { int checkX = x - baseX - 114; int checkY = y - baseY - 36; - if(checkX >= 0 && checkX < 8 && checkY >= 0 && checkY < 8) { + if (checkX >= 0 && checkX < 8 && checkY >= 0 && checkY < 8) { TileInfusionClaw tile = ((TileInfusionClaw) this.container.clawInv); this.mc.playerController.sendEnchantPacket(this.inventorySlots.windowId, tile.isLocked() ? 0 : 1); tile.setIsLocked(!tile.isLocked()); diff --git a/src/main/java/makeo/gadomancy/client/models/ModelArcaneDropper.java b/src/main/java/makeo/gadomancy/client/models/ModelArcaneDropper.java index e64768e..c0ecab6 100644 --- a/src/main/java/makeo/gadomancy/client/models/ModelArcaneDropper.java +++ b/src/main/java/makeo/gadomancy/client/models/ModelArcaneDropper.java @@ -14,7 +14,7 @@ import net.minecraft.entity.Entity; * using Techne: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-tools/1261123 */ public class ModelArcaneDropper extends ModelBase { - //fields + // fields ModelRenderer shape1; ModelRenderer shape2; ModelRenderer shape3; diff --git a/src/main/java/makeo/gadomancy/client/models/ModelAuraPylon.java b/src/main/java/makeo/gadomancy/client/models/ModelAuraPylon.java index c1b3873..0ebe327 100644 --- a/src/main/java/makeo/gadomancy/client/models/ModelAuraPylon.java +++ b/src/main/java/makeo/gadomancy/client/models/ModelAuraPylon.java @@ -5,7 +5,7 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelAuraPylon extends ModelBase { - //fields + // fields ModelRenderer outerpylon; ModelRenderer lowerconduit; ModelRenderer inlower1; @@ -22,8 +22,7 @@ public class ModelAuraPylon extends ModelBase { ModelRenderer inlowersmooth1; ModelRenderer inlowersmooth2; - public ModelAuraPylon() - { + public ModelAuraPylon() { this.textureWidth = 32; this.textureHeight = 32; @@ -119,8 +118,7 @@ public class ModelAuraPylon extends ModelBase { this.setRotation(this.inlowersmooth2, 0F, 1.22173F, 0F); } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); this.outerpylon.render(f5); @@ -140,15 +138,13 @@ public class ModelAuraPylon extends ModelBase { this.inlowersmooth2.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } } diff --git a/src/main/java/makeo/gadomancy/client/models/ModelAuraPylonBottom.java b/src/main/java/makeo/gadomancy/client/models/ModelAuraPylonBottom.java index 36e869b..f6d4ea9 100644 --- a/src/main/java/makeo/gadomancy/client/models/ModelAuraPylonBottom.java +++ b/src/main/java/makeo/gadomancy/client/models/ModelAuraPylonBottom.java @@ -5,7 +5,7 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelAuraPylonBottom extends ModelBase { - //fields + // fields ModelRenderer outerpylon; ModelRenderer lowerconduit; ModelRenderer inlower1; diff --git a/src/main/java/makeo/gadomancy/client/models/ModelAuraPylonTop.java b/src/main/java/makeo/gadomancy/client/models/ModelAuraPylonTop.java index 296d987..bfb4c57 100644 --- a/src/main/java/makeo/gadomancy/client/models/ModelAuraPylonTop.java +++ b/src/main/java/makeo/gadomancy/client/models/ModelAuraPylonTop.java @@ -5,7 +5,7 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelAuraPylonTop extends ModelBase { - //fields + // fields ModelRenderer outerpylon; ModelRenderer lowerconduit; ModelRenderer inlower1; @@ -18,8 +18,7 @@ public class ModelAuraPylonTop extends ModelBase { ModelRenderer outerpylonmiddle2; ModelRenderer outerpylonupper; - public ModelAuraPylonTop() - { + public ModelAuraPylonTop() { this.textureWidth = 32; this.textureHeight = 32; @@ -91,8 +90,7 @@ public class ModelAuraPylonTop extends ModelBase { this.setRotation(this.outerpylonupper, 0F, 0F, 0F); } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); this.outerpylon.render(f5); @@ -108,15 +106,13 @@ public class ModelAuraPylonTop extends ModelBase { this.outerpylonupper.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } } diff --git a/src/main/java/makeo/gadomancy/client/models/ModelBlockProtector.java b/src/main/java/makeo/gadomancy/client/models/ModelBlockProtector.java index 0cd502b..87806de 100644 --- a/src/main/java/makeo/gadomancy/client/models/ModelBlockProtector.java +++ b/src/main/java/makeo/gadomancy/client/models/ModelBlockProtector.java @@ -13,7 +13,7 @@ import net.minecraft.entity.Entity; * Created by makeo @ 11.11.2015 17:15 */ public class ModelBlockProtector extends ModelBase { - //fields + // fields ModelRenderer Shape1; ModelRenderer Shape2; ModelRenderer Shape3; diff --git a/src/main/java/makeo/gadomancy/client/models/ModelEssentiaCompressor.java b/src/main/java/makeo/gadomancy/client/models/ModelEssentiaCompressor.java index 81e8f9b..0aae1af 100644 --- a/src/main/java/makeo/gadomancy/client/models/ModelEssentiaCompressor.java +++ b/src/main/java/makeo/gadomancy/client/models/ModelEssentiaCompressor.java @@ -12,7 +12,7 @@ import net.minecraft.entity.Entity; */ public class ModelEssentiaCompressor extends ModelBase { - //Ugh techne... + // Ugh techne... ModelRenderer Plate1; ModelRenderer Plate2; ModelRenderer Plate3; @@ -252,5 +252,4 @@ public class ModelEssentiaCompressor extends ModelBase { public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } - } diff --git a/src/main/java/makeo/gadomancy/client/models/ModelFocusPortalPart.java b/src/main/java/makeo/gadomancy/client/models/ModelFocusPortalPart.java index 2ff6893..b9b9bf0 100644 --- a/src/main/java/makeo/gadomancy/client/models/ModelFocusPortalPart.java +++ b/src/main/java/makeo/gadomancy/client/models/ModelFocusPortalPart.java @@ -13,7 +13,7 @@ import net.minecraft.entity.Entity; * Created by makeo @ 09.11.2015 23:08 */ public class ModelFocusPortalPart extends ModelBase { - //fields + // fields ModelRenderer shape1; ModelRenderer shape2; ModelRenderer shape3; diff --git a/src/main/java/makeo/gadomancy/client/models/ModelInfusionClawPart.java b/src/main/java/makeo/gadomancy/client/models/ModelInfusionClawPart.java index c6188ff..c8052bc 100644 --- a/src/main/java/makeo/gadomancy/client/models/ModelInfusionClawPart.java +++ b/src/main/java/makeo/gadomancy/client/models/ModelInfusionClawPart.java @@ -13,14 +13,14 @@ import net.minecraft.entity.Entity; * Created by makeo @ 08.10.2015 16:14 */ public class ModelInfusionClawPart extends ModelBase { - //fields + // fields ModelRenderer shape1; public ModelInfusionClawPart(int num) { this.textureWidth = 32; this.textureHeight = 64; - this.shape1 = new ModelRenderer(this, 0, 8*num); + this.shape1 = new ModelRenderer(this, 0, 8 * num); this.shape1.addBox(-3F, -1F, -3F, 6, 2, 6); this.shape1.setRotationPoint(0F, 0F, 0F); this.shape1.setTextureSize(32, 64); diff --git a/src/main/java/makeo/gadomancy/client/models/ModelJarPot.java b/src/main/java/makeo/gadomancy/client/models/ModelJarPot.java index 012701e..b194139 100644 --- a/src/main/java/makeo/gadomancy/client/models/ModelJarPot.java +++ b/src/main/java/makeo/gadomancy/client/models/ModelJarPot.java @@ -13,7 +13,7 @@ import net.minecraft.entity.Entity; * Created by makeo @ 23.10.2015 23:13 */ public class ModelJarPot extends ModelBase { - //fields + // fields ModelRenderer shape1; ModelRenderer shape2; ModelRenderer shape3; diff --git a/src/main/java/makeo/gadomancy/client/models/ModelManipulatorPart.java b/src/main/java/makeo/gadomancy/client/models/ModelManipulatorPart.java index 5e977a5..ae14684 100644 --- a/src/main/java/makeo/gadomancy/client/models/ModelManipulatorPart.java +++ b/src/main/java/makeo/gadomancy/client/models/ModelManipulatorPart.java @@ -13,7 +13,7 @@ import net.minecraft.entity.Entity; * Created by makeo @ 28.10.2015 12:31 */ public class ModelManipulatorPart extends ModelBase { - //fields + // fields ModelRenderer shape2; ModelRenderer shape3; ModelRenderer shape4; diff --git a/src/main/java/makeo/gadomancy/client/models/ModelPackagerPiston.java b/src/main/java/makeo/gadomancy/client/models/ModelPackagerPiston.java index f5d3ebc..b9c0e9c 100644 --- a/src/main/java/makeo/gadomancy/client/models/ModelPackagerPiston.java +++ b/src/main/java/makeo/gadomancy/client/models/ModelPackagerPiston.java @@ -16,8 +16,7 @@ public class ModelPackagerPiston extends ModelBase { ModelRenderer shape1; ModelRenderer shape2; - public ModelPackagerPiston(boolean cut) - { + public ModelPackagerPiston(boolean cut) { this.textureWidth = 64; this.textureHeight = 32; @@ -34,8 +33,7 @@ public class ModelPackagerPiston extends ModelBase { this.shape2.mirror = true; } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); this.shape1.render(f5); this.shape2.render(f5); diff --git a/src/main/java/makeo/gadomancy/client/models/ModelPackedCompressorBlock.java b/src/main/java/makeo/gadomancy/client/models/ModelPackedCompressorBlock.java index dc0944d..394c63e 100644 --- a/src/main/java/makeo/gadomancy/client/models/ModelPackedCompressorBlock.java +++ b/src/main/java/makeo/gadomancy/client/models/ModelPackedCompressorBlock.java @@ -21,7 +21,7 @@ public class ModelPackedCompressorBlock extends ModelBase { this.block = new ModelRenderer(this, 0, 0); this.block.addBox(0F, 0F, 0F, 16, 16, 16); this.block.setRotationPoint(-8F, 22F, -8F); - //block.setTextureSize(16, 16); + // block.setTextureSize(16, 16); this.block.mirror = true; } @@ -36,5 +36,4 @@ public class ModelPackedCompressorBlock extends ModelBase { public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } - -} \ No newline at end of file +} diff --git a/src/main/java/makeo/gadomancy/client/models/ModelSmallCube.java b/src/main/java/makeo/gadomancy/client/models/ModelSmallCube.java index f60c514..add5de6 100644 --- a/src/main/java/makeo/gadomancy/client/models/ModelSmallCube.java +++ b/src/main/java/makeo/gadomancy/client/models/ModelSmallCube.java @@ -13,7 +13,7 @@ import net.minecraft.entity.Entity; * Created by makeo @ 27.10.2015 23:40 */ public class ModelSmallCube extends ModelBase { - //fields + // fields ModelRenderer shape1; public ModelSmallCube() { diff --git a/src/main/java/makeo/gadomancy/client/models/ModelWandPart.java b/src/main/java/makeo/gadomancy/client/models/ModelWandPart.java index 662bd86..46eb54c 100644 --- a/src/main/java/makeo/gadomancy/client/models/ModelWandPart.java +++ b/src/main/java/makeo/gadomancy/client/models/ModelWandPart.java @@ -1,5 +1,6 @@ package makeo.gadomancy.client.models; +import java.awt.*; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.renderer.ItemRenderer; @@ -20,8 +21,6 @@ import thaumcraft.client.renderers.models.gear.ModelWand; import thaumcraft.common.Thaumcraft; import thaumcraft.common.items.wands.ItemWandCasting; -import java.awt.*; - /** * This class is NOT part of the Gadomancy Mod * This file is copied from Azanors thaumcraft.client.renderers.models.gear.ModelWand.java and contains small modifications @@ -34,7 +33,7 @@ public class ModelWandPart extends ModelWand { ModelRenderer Rod; ModelRenderer Focus; ModelRenderer Cap; - //ModelRenderer CapBottom; + // ModelRenderer CapBottom; private int runeCount; @@ -51,16 +50,16 @@ public class ModelWandPart extends ModelWand { this.Cap.mirror = true; this.setRotation(this.Cap, 0.0F, 0.0F, 0.0F); - //this.CapBottom = new ModelRenderer(this, 0, 0); - //this.CapBottom.addBox(-1.0F, -1.0F, -1.0F, 2, 2, 2); - //this.CapBottom.setRotationPoint(0.0F, 20.0F, 0.0F); - //this.CapBottom.setTextureSize(64, 32); - //this.CapBottom.mirror = true; - //setRotation(this.CapBottom, 0.0F, 0.0F, 0.0F); + // this.CapBottom = new ModelRenderer(this, 0, 0); + // this.CapBottom.addBox(-1.0F, -1.0F, -1.0F, 2, 2, 2); + // this.CapBottom.setRotationPoint(0.0F, 20.0F, 0.0F); + // this.CapBottom.setTextureSize(64, 32); + // this.CapBottom.mirror = true; + // setRotation(this.CapBottom, 0.0F, 0.0F, 0.0F); this.Rod = new ModelRenderer(this, 0, 8); - //this.Rod.addBox(-1.0F, -1.0F, -1.0F, 2, 18, 2); + // this.Rod.addBox(-1.0F, -1.0F, -1.0F, 2, 18, 2); this.Rod.addBox(-1.0F, -1.0F, -1.0F, 2, height, 2); @@ -140,7 +139,7 @@ public class ModelWandPart extends ModelWand { GL11.glPopMatrix(); GL11.glTranslated(0.0D, 0.65D, 0.0D); } - //this.CapBottom.render(0.0625F); + // this.CapBottom.render(0.0625F); GL11.glPopMatrix(); if (wand.getFocus(wandStack) != null) { if (wand.getFocus(wandStack).getOrnament(focusStack) != null) { @@ -158,13 +157,15 @@ public class ModelWandPart extends ModelWand { GL11.glPushMatrix(); GL11.glTranslatef(-0.25F, -0.1F, 0.0275F); GL11.glScaled(0.5D, 0.5D, 0.5D); - ItemRenderer.renderItemIn2D(tessellator, f1, f2, f3, f4, icon.getIconWidth(), icon.getIconHeight(), 0.1F); + ItemRenderer.renderItemIn2D( + tessellator, f1, f2, f3, f4, icon.getIconWidth(), icon.getIconHeight(), 0.1F); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.25F, -0.1F, 0.0275F); GL11.glScaled(0.5D, 0.5D, 0.5D); - ItemRenderer.renderItemIn2D(tessellator, f1, f2, f3, f4, icon.getIconWidth(), icon.getIconHeight(), 0.1F); + ItemRenderer.renderItemIn2D( + tessellator, f1, f2, f3, f4, icon.getIconWidth(), icon.getIconHeight(), 0.1F); GL11.glPopMatrix(); GL11.glPopMatrix(); } @@ -180,7 +181,8 @@ public class ModelWandPart extends ModelWand { } Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); this.renderBlocks.setRenderBoundsFromBlock(Blocks.stone); - BlockRenderer.drawFaces(this.renderBlocks, null, wand.getFocus(wandStack).getFocusDepthLayerIcon(focusStack), false); + BlockRenderer.drawFaces( + this.renderBlocks, null, wand.getFocus(wandStack).getFocusDepthLayerIcon(focusStack), false); GL11.glPopMatrix(); alpha = 0.6F; } @@ -236,11 +238,11 @@ public class ModelWandPart extends ModelWand { for (int a = 0; a < 14; a++) { int rune = (a + rot * 3) % 16; - //edit start - if(a < this.runeCount) { + // edit start + if (a < this.runeCount) { this.drawRune(0.36D + a * 0.14D, -0.009999999776482582D, -0.08D, rune, player); } - //edit end + // edit end } } GL11.glBlendFunc(770, 771); diff --git a/src/main/java/makeo/gadomancy/client/renderers/block/BlockExtendedNodeJarRenderer.java b/src/main/java/makeo/gadomancy/client/renderers/block/BlockExtendedNodeJarRenderer.java index 5bc4890..22d6039 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/block/BlockExtendedNodeJarRenderer.java +++ b/src/main/java/makeo/gadomancy/client/renderers/block/BlockExtendedNodeJarRenderer.java @@ -50,23 +50,50 @@ public class BlockExtendedNodeJarRenderer implements ISimpleBlockRenderingHandle Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); IIcon i1 = ((BlockJar) ConfigBlocks.blockJar).iconJarTop; IIcon i2 = ((BlockJar) ConfigBlocks.blockJar).iconJarSide; - block.setBlockBounds(BlockExtendedNodeJarRenderer.W3, 0.0F, BlockExtendedNodeJarRenderer.W3, BlockExtendedNodeJarRenderer.W13, BlockExtendedNodeJarRenderer.W12, BlockExtendedNodeJarRenderer.W13); + block.setBlockBounds( + BlockExtendedNodeJarRenderer.W3, + 0.0F, + BlockExtendedNodeJarRenderer.W3, + BlockExtendedNodeJarRenderer.W13, + BlockExtendedNodeJarRenderer.W12, + BlockExtendedNodeJarRenderer.W13); renderer.setRenderBoundsFromBlock(block); - BlockExtendedNodeJarRenderer.drawFaces(renderer, block, ((BlockJar) ConfigBlocks.blockJar).iconJarBottom, i1, i2, i2, i2, i2, true); - block.setBlockBounds(BlockExtendedNodeJarRenderer.W5, BlockExtendedNodeJarRenderer.W12, BlockExtendedNodeJarRenderer.W5, BlockExtendedNodeJarRenderer.W11, BlockExtendedNodeJarRenderer.W14, BlockExtendedNodeJarRenderer.W11); + BlockExtendedNodeJarRenderer.drawFaces( + renderer, block, ((BlockJar) ConfigBlocks.blockJar).iconJarBottom, i1, i2, i2, i2, i2, true); + block.setBlockBounds( + BlockExtendedNodeJarRenderer.W5, + BlockExtendedNodeJarRenderer.W12, + BlockExtendedNodeJarRenderer.W5, + BlockExtendedNodeJarRenderer.W11, + BlockExtendedNodeJarRenderer.W14, + BlockExtendedNodeJarRenderer.W11); renderer.setRenderBoundsFromBlock(block); - BlockExtendedNodeJarRenderer.drawFaces(renderer, block, ((BlockJar) ConfigBlocks.blockJar).iconJarBottom, i1, i2, i2, i2, i2, true); + BlockExtendedNodeJarRenderer.drawFaces( + renderer, block, ((BlockJar) ConfigBlocks.blockJar).iconJarBottom, i1, i2, i2, i2, i2, true); GL11.glPopMatrix(); } @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + public boolean renderWorldBlock( + IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { int bb = this.setBrightness(world, x, y, z, block); int metadata = world.getBlockMetadata(x, y, z); - block.setBlockBounds(BlockExtendedNodeJarRenderer.W3, 0.0F, BlockExtendedNodeJarRenderer.W3, BlockExtendedNodeJarRenderer.W13, BlockExtendedNodeJarRenderer.W12, BlockExtendedNodeJarRenderer.W13); + block.setBlockBounds( + BlockExtendedNodeJarRenderer.W3, + 0.0F, + BlockExtendedNodeJarRenderer.W3, + BlockExtendedNodeJarRenderer.W13, + BlockExtendedNodeJarRenderer.W12, + BlockExtendedNodeJarRenderer.W13); renderer.setRenderBoundsFromBlock(block); renderer.renderStandardBlock(block, x, y, z); - block.setBlockBounds(BlockExtendedNodeJarRenderer.W5, BlockExtendedNodeJarRenderer.W12, BlockExtendedNodeJarRenderer.W5, BlockExtendedNodeJarRenderer.W11, BlockExtendedNodeJarRenderer.W14, BlockExtendedNodeJarRenderer.W11); + block.setBlockBounds( + BlockExtendedNodeJarRenderer.W5, + BlockExtendedNodeJarRenderer.W12, + BlockExtendedNodeJarRenderer.W5, + BlockExtendedNodeJarRenderer.W11, + BlockExtendedNodeJarRenderer.W14, + BlockExtendedNodeJarRenderer.W11); renderer.setRenderBoundsFromBlock(block); renderer.renderStandardBlock(block, x, y, z); @@ -76,7 +103,16 @@ public class BlockExtendedNodeJarRenderer implements ISimpleBlockRenderingHandle return true; } - public static void drawFaces(RenderBlocks renderblocks, Block block, IIcon i1, IIcon i2, IIcon i3, IIcon i4, IIcon i5, IIcon i6, boolean solidtop) { + public static void drawFaces( + RenderBlocks renderblocks, + Block block, + IIcon i1, + IIcon i2, + IIcon i3, + IIcon i4, + IIcon i5, + IIcon i6, + boolean solidtop) { Tessellator tessellator = Tessellator.instance; GL11.glTranslatef(-0.5F, -0.5F, -0.5F); tessellator.startDrawingQuads(); @@ -144,5 +180,4 @@ public class BlockExtendedNodeJarRenderer implements ISimpleBlockRenderingHandle public int getRenderId() { return RegisteredBlocks.rendererExtendedNodeJarBlock; } - } diff --git a/src/main/java/makeo/gadomancy/client/renderers/block/BlockRenderingHandler.java b/src/main/java/makeo/gadomancy/client/renderers/block/BlockRenderingHandler.java index ba4c591..98c99ce 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/block/BlockRenderingHandler.java +++ b/src/main/java/makeo/gadomancy/client/renderers/block/BlockRenderingHandler.java @@ -26,16 +26,29 @@ public abstract class BlockRenderingHandler implements ISimpleBlockRenderingHand protected void renderFace(int side, RenderBlocks renderer, Block block, int x, int y, int z, IIcon icon) { switch (side) { - case 0: renderer.renderFaceYNeg(block, x, y, z, icon); break; - case 1: renderer.renderFaceYPos(block, x, y, z, icon); break; - case 2: renderer.renderFaceZNeg(block, x, y, z, icon); break; - case 3: renderer.renderFaceZPos(block, x, y, z, icon); break; - case 4: renderer.renderFaceXNeg(block, x, y, z, icon); break; - case 5: renderer.renderFaceXPos(block, x, y, z, icon); break; + case 0: + renderer.renderFaceYNeg(block, x, y, z, icon); + break; + case 1: + renderer.renderFaceYPos(block, x, y, z, icon); + break; + case 2: + renderer.renderFaceZNeg(block, x, y, z, icon); + break; + case 3: + renderer.renderFaceZPos(block, x, y, z, icon); + break; + case 4: + renderer.renderFaceXNeg(block, x, y, z, icon); + break; + case 5: + renderer.renderFaceXPos(block, x, y, z, icon); + break; } } - protected void renderFace(ForgeDirection side, RenderBlocks renderer, Block block, int x, int y, int z, IIcon icon) { + protected void renderFace( + ForgeDirection side, RenderBlocks renderer, Block block, int x, int y, int z, IIcon icon) { this.renderFace(side.ordinal(), renderer, block, x, y, z, icon); } diff --git a/src/main/java/makeo/gadomancy/client/renderers/block/RenderBlockStoneMachine.java b/src/main/java/makeo/gadomancy/client/renderers/block/RenderBlockStoneMachine.java index 3a1ef99..5feaa36 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/block/RenderBlockStoneMachine.java +++ b/src/main/java/makeo/gadomancy/client/renderers/block/RenderBlockStoneMachine.java @@ -23,18 +23,20 @@ public class RenderBlockStoneMachine implements ISimpleBlockRenderingHandler { @Override public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { - if(metadata == 1) { - BlockStoneMachine blockStoneMachine = (BlockStoneMachine)block; + if (metadata == 1) { + BlockStoneMachine blockStoneMachine = (BlockStoneMachine) block; RenderBlockStoneMachine.DEVICE_BLOCK.iconPedestal[0] = blockStoneMachine.pedestalSideIcon; RenderBlockStoneMachine.DEVICE_BLOCK.iconPedestal[1] = blockStoneMachine.pedestalTopIcon; - RenderBlockStoneMachine.DEVICE_RENDERER.renderInventoryBlock(RenderBlockStoneMachine.DEVICE_BLOCK, 1, modelId, renderer); + RenderBlockStoneMachine.DEVICE_RENDERER.renderInventoryBlock( + RenderBlockStoneMachine.DEVICE_BLOCK, 1, modelId, renderer); } } @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + public boolean renderWorldBlock( + IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { int metadata = world.getBlockMetadata(x, y, z); - if(metadata == 1) { + if (metadata == 1) { RenderBlockStoneMachine.DEVICE_RENDERER.renderWorldBlock(world, x, y, z, block, modelId, renderer); return true; } diff --git a/src/main/java/makeo/gadomancy/client/renderers/block/RenderBlockTransparent.java b/src/main/java/makeo/gadomancy/client/renderers/block/RenderBlockTransparent.java index 707ac31..5e9f6fe 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/block/RenderBlockTransparent.java +++ b/src/main/java/makeo/gadomancy/client/renderers/block/RenderBlockTransparent.java @@ -16,13 +16,12 @@ import net.minecraft.world.IBlockAccess; */ public class RenderBlockTransparent extends BlockRenderingHandler { @Override - public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { - - } + public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {} @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - if(block instanceof IBlockTransparent) { + public boolean renderWorldBlock( + IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + if (block instanceof IBlockTransparent) { this.renderAllFaces(renderer, block, x, y, z, ((IBlockTransparent) block).getTransparentIcon()); } return false; diff --git a/src/main/java/makeo/gadomancy/client/renderers/entity/PlayerCameraRenderer.java b/src/main/java/makeo/gadomancy/client/renderers/entity/PlayerCameraRenderer.java index 61685e3..9862635 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/entity/PlayerCameraRenderer.java +++ b/src/main/java/makeo/gadomancy/client/renderers/entity/PlayerCameraRenderer.java @@ -49,11 +49,14 @@ public class PlayerCameraRenderer extends EntityRenderer { } private boolean canChangeView() { - return !this.isMarkedForRemoval && this.minecraft.thePlayer != null && !this.minecraft.thePlayer.isRiding() && !this.minecraft.thePlayer.isPlayerSleeping(); + return !this.isMarkedForRemoval + && this.minecraft.thePlayer != null + && !this.minecraft.thePlayer.isRiding() + && !this.minecraft.thePlayer.isPlayerSleeping(); } private void removeIfMarked() { - if(this.isMarkedForRemoval && this.equals(Minecraft.getMinecraft().entityRenderer)) { + if (this.isMarkedForRemoval && this.equals(Minecraft.getMinecraft().entityRenderer)) { Minecraft.getMinecraft().entityRenderer = this.prevRenderer; this.isRemoved = true; } @@ -63,12 +66,12 @@ public class PlayerCameraRenderer extends EntityRenderer { public void updateCameraAndRender(float partialTicks) { this.removeIfMarked(); - if(this.canChangeView()) { + if (this.canChangeView()) { this.moveCam(-1); - //float tempEyeHeight = minecraft.thePlayer.eyeHeight; - //minecraft.thePlayer.eyeHeight = minecraft.thePlayer.getDefaultEyeHeight(); + // float tempEyeHeight = minecraft.thePlayer.eyeHeight; + // minecraft.thePlayer.eyeHeight = minecraft.thePlayer.getDefaultEyeHeight(); super.updateCameraAndRender(partialTicks); - //minecraft.thePlayer.eyeHeight = tempEyeHeight; + // minecraft.thePlayer.eyeHeight = tempEyeHeight; this.moveCam(1); return; @@ -97,7 +100,7 @@ public class PlayerCameraRenderer extends EntityRenderer { public void getMouseOver(float partialTicks) { this.removeIfMarked(); - if(this.canChangeView()) { + if (this.canChangeView()) { this.moveCam(-1); super.getMouseOver(partialTicks); this.moveCam(1); diff --git a/src/main/java/makeo/gadomancy/client/renderers/entity/RenderAdditionalGolemBase.java b/src/main/java/makeo/gadomancy/client/renderers/entity/RenderAdditionalGolemBase.java index f2cd30f..4478ebb 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/entity/RenderAdditionalGolemBase.java +++ b/src/main/java/makeo/gadomancy/client/renderers/entity/RenderAdditionalGolemBase.java @@ -40,11 +40,11 @@ public class RenderAdditionalGolemBase extends RenderGolemBase { int ret = super.shouldRenderPass(entity, pass, par3); - //fix for render bug in tc + // fix for render bug in tc if (RenderGolemHelper.requiresRenderFix((EntityGolemBase) entity)) { RenderGolemHelper.renderCarriedItemsFix(golem); - if(this.toolItem != null) { + if (this.toolItem != null) { RenderGolemHelper.renderToolItem(golem, this.toolItem, this.mainModel, this.renderManager); } } @@ -60,7 +60,7 @@ public class RenderAdditionalGolemBase extends RenderGolemBase { @Override protected void renderCarriedItems(EntityGolemBase golem, float par2) { if (!RenderGolemHelper.requiresRenderFix(golem)) { - if(this.toolItem != null) { + if (this.toolItem != null) { RenderGolemHelper.renderToolItem(golem, this.toolItem, this.mainModel, this.renderManager); } super.renderCarriedItems(golem, par2); @@ -71,7 +71,7 @@ public class RenderAdditionalGolemBase extends RenderGolemBase { public void render(EntityGolemBase golem, double par2, double par4, double par6, float par8, float par9) { AdditionalGolemCore core = GadomancyApi.getAdditionalGolemCore(golem); ItemStack carriedItem = null; - if(core != null) { + if (core != null) { this.toolItem = core.getToolItem(golem); carriedItem = golem.getCarriedForDisplay(); @@ -80,7 +80,7 @@ public class RenderAdditionalGolemBase extends RenderGolemBase { super.render(golem, par2, par4, par6, par8, par9); - if(carriedItem != null) { + if (carriedItem != null) { golem.getDataWatcher().getWatchedObject(16).setObject(carriedItem); this.toolItem = null; } diff --git a/src/main/java/makeo/gadomancy/client/renderers/entity/RenderEffectHelper.java b/src/main/java/makeo/gadomancy/client/renderers/entity/RenderEffectHelper.java index da37c4e..ec2dd68 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/entity/RenderEffectHelper.java +++ b/src/main/java/makeo/gadomancy/client/renderers/entity/RenderEffectHelper.java @@ -1,7 +1,3 @@ package makeo.gadomancy.client.renderers.entity; -public class RenderEffectHelper { - - - -} +public class RenderEffectHelper {} diff --git a/src/main/java/makeo/gadomancy/client/renderers/entity/RenderEntityAuraCore.java b/src/main/java/makeo/gadomancy/client/renderers/entity/RenderEntityAuraCore.java index eab33a8..e583403 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/entity/RenderEntityAuraCore.java +++ b/src/main/java/makeo/gadomancy/client/renderers/entity/RenderEntityAuraCore.java @@ -18,11 +18,11 @@ public class RenderEntityAuraCore extends RenderEntityItem { public void doRender(Entity entity, double x, double y, double z, float parf1, float parf2) { super.doRender(entity, x, y, z, parf1, parf2); - if(!(entity instanceof EntityAuraCore)) return; + if (!(entity instanceof EntityAuraCore)) return; EntityAuraCore ea = (EntityAuraCore) entity; - if(ea.auraOrbital != null) { + if (ea.auraOrbital != null) { ea.auraOrbital.lastRenderCall = System.currentTimeMillis(); ea.auraOrbital.updateCenter(MiscUtils.getPositionVector(ea)); } diff --git a/src/main/java/makeo/gadomancy/client/renderers/entity/RenderEntityItem.java b/src/main/java/makeo/gadomancy/client/renderers/entity/RenderEntityItem.java index 0417125..3b9b94e 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/entity/RenderEntityItem.java +++ b/src/main/java/makeo/gadomancy/client/renderers/entity/RenderEntityItem.java @@ -22,7 +22,7 @@ public class RenderEntityItem extends Render { @Override public void doRender(Entity entity, double x, double y, double z, float parf1, float parf2) { - if(!(entity instanceof EntityItem)) return; + if (!(entity instanceof EntityItem)) return; RenderEntityItem.ri.doRender(entity, x, y, z, parf1, parf2); } @@ -35,5 +35,4 @@ public class RenderEntityItem extends Render { RenderEntityItem.ri = new RenderItem(); RenderEntityItem.ri.setRenderManager(RenderManager.instance); } - } diff --git a/src/main/java/makeo/gadomancy/client/renderers/entity/RenderGolemHelper.java b/src/main/java/makeo/gadomancy/client/renderers/entity/RenderGolemHelper.java index ffa415f..c2e6c0c 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/entity/RenderGolemHelper.java +++ b/src/main/java/makeo/gadomancy/client/renderers/entity/RenderGolemHelper.java @@ -1,5 +1,6 @@ package makeo.gadomancy.client.renderers.entity; +import java.awt.*; import makeo.gadomancy.api.golems.cores.AdditionalGolemCore; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; @@ -18,8 +19,6 @@ import org.lwjgl.opengl.GL11; import thaumcraft.client.renderers.models.entities.ModelGolem; import thaumcraft.common.entities.golems.EntityGolemBase; -import java.awt.*; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -46,7 +45,8 @@ public class RenderGolemHelper { float f3 = icon.getMinU(); float f4 = icon.getMaxV(); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); - ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f3, f4, icon.getIconWidth(), icon.getIconHeight(), 0.2F); + ItemRenderer.renderItemIn2D( + Tessellator.instance, f1, f2, f3, f4, icon.getIconWidth(), icon.getIconHeight(), 0.2F); GL11.glPopMatrix(); } @@ -74,8 +74,15 @@ public class RenderGolemHelper { Color color = new Color(item.getItem().getColorFromItemStack(item, renderPass)); GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()); - ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), - icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F); + ItemRenderer.renderItemIn2D( + Tessellator.instance, + icon.getMaxU(), + icon.getMinV(), + icon.getMinU(), + icon.getMaxV(), + icon.getIconWidth(), + icon.getIconHeight(), + 0.0625F); GL11.glColor3f(1.0F, 1.0F, 1.0F); } @@ -85,7 +92,8 @@ public class RenderGolemHelper { GL11.glPopMatrix(); } - public static void renderToolItem(EntityGolemBase golem, ItemStack itemstack, ModelBase mainModel, RenderManager renderManager) { + public static void renderToolItem( + EntityGolemBase golem, ItemStack itemstack, ModelBase mainModel, RenderManager renderManager) { GL11.glPushMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); @@ -101,36 +109,39 @@ public class RenderGolemHelper { float fs = 0.66F; GL11.glScalef(fs, fs, fs); - net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient.getItemRenderer(itemstack, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED); - boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, itemstack, net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D)); + net.minecraftforge.client.IItemRenderer customRenderer = + net.minecraftforge.client.MinecraftForgeClient.getItemRenderer( + itemstack, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED); + boolean is3D = (customRenderer != null + && customRenderer.shouldUseRenderHelper( + net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, + itemstack, + net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D)); Item item = itemstack.getItem(); float f1; - if (item instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item).getRenderType()))) - { + if (item instanceof ItemBlock + && (is3D + || RenderBlocks.renderItemIn3d( + Block.getBlockFromItem(item).getRenderType()))) { f1 = 0.5F; GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); f1 *= 0.75F; GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(-f1, -f1, f1); - } - else if (item == Items.bow) - { + } else if (item == Items.bow) { f1 = 0.625F; GL11.glTranslatef(0.0F, 0.125F, 0.3125F); GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(f1, -f1, f1); GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); - } - else if (item.isFull3D()) - { + } else if (item.isFull3D()) { f1 = 0.625F; - if (item.shouldRotateAroundWhenRendering()) - { + if (item.shouldRotateAroundWhenRendering()) { GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(0.0F, -0.125F, 0.0F); } @@ -140,9 +151,7 @@ public class RenderGolemHelper { GL11.glScalef(f1, -f1, f1); GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); - } - else - { + } else { f1 = 0.375F; GL11.glTranslatef(0.25F, 0.1875F, -0.1875F); GL11.glScalef(f1, f1, f1); @@ -155,31 +164,26 @@ public class RenderGolemHelper { int i; float f5; - if (itemstack.getItem().requiresMultipleRenderPasses()) - { - for (i = 0; i < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++i) - { + if (itemstack.getItem().requiresMultipleRenderPasses()) { + for (i = 0; i < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++i) { int j = itemstack.getItem().getColorFromItemStack(itemstack, i); - f5 = (float)(j >> 16 & 255) / 255.0F; - f2 = (float)(j >> 8 & 255) / 255.0F; - float f3 = (float)(j & 255) / 255.0F; + f5 = (float) (j >> 16 & 255) / 255.0F; + f2 = (float) (j >> 8 & 255) / 255.0F; + float f3 = (float) (j & 255) / 255.0F; GL11.glColor4f(f5, f2, f3, 1.0F); renderManager.itemRenderer.renderItem(golem, itemstack, i); } - } - else - { + } else { i = itemstack.getItem().getColorFromItemStack(itemstack, 0); - float f4 = (float)(i >> 16 & 255) / 255.0F; - f5 = (float)(i >> 8 & 255) / 255.0F; - f2 = (float)(i & 255) / 255.0F; + float f4 = (float) (i >> 16 & 255) / 255.0F; + f5 = (float) (i >> 8 & 255) / 255.0F; + f2 = (float) (i & 255) / 255.0F; GL11.glColor4f(f4, f5, f2, 1.0F); renderManager.itemRenderer.renderItem(golem, itemstack, 0); } - GL11.glScaled(1.0D, 1.0D, 1.0D); GL11.glPopMatrix(); diff --git a/src/main/java/makeo/gadomancy/client/renderers/item/ItemCreativeNodeRenderer.java b/src/main/java/makeo/gadomancy/client/renderers/item/ItemCreativeNodeRenderer.java index ffffd37..01475a9 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/item/ItemCreativeNodeRenderer.java +++ b/src/main/java/makeo/gadomancy/client/renderers/item/ItemCreativeNodeRenderer.java @@ -15,7 +15,11 @@ import thaumcraft.api.nodes.NodeType; * Created by makeo @ 04.11.2015 20:41 */ public class ItemCreativeNodeRenderer extends ItemExNodeRenderer { - private static final AspectList ASPECTS = new AspectList().add(Aspect.AIR, 50).add(Aspect.FIRE, 50).add(Aspect.EARTH, 50).add(Aspect.WATER, 50); + private static final AspectList ASPECTS = new AspectList() + .add(Aspect.AIR, 50) + .add(Aspect.FIRE, 50) + .add(Aspect.EARTH, 50) + .add(Aspect.WATER, 50); @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { @@ -24,6 +28,7 @@ public class ItemCreativeNodeRenderer extends ItemExNodeRenderer { @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - makeo.gadomancy.client.renderers.item.ItemNodeRenderer.renderNodeItem(type, item, ItemCreativeNodeRenderer.ASPECTS, NodeType.values()[item.getItemDamage()], null, data); + makeo.gadomancy.client.renderers.item.ItemNodeRenderer.renderNodeItem( + type, item, ItemCreativeNodeRenderer.ASPECTS, NodeType.values()[item.getItemDamage()], null, data); } } diff --git a/src/main/java/makeo/gadomancy/client/renderers/item/ItemExNodeRenderer.java b/src/main/java/makeo/gadomancy/client/renderers/item/ItemExNodeRenderer.java index 66da3e9..ee6384e 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/item/ItemExNodeRenderer.java +++ b/src/main/java/makeo/gadomancy/client/renderers/item/ItemExNodeRenderer.java @@ -17,7 +17,9 @@ public class ItemExNodeRenderer extends ItemNodeRenderer { @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return (item != null) && (item.getItem() == Item.getItemFromBlock(RegisteredBlocks.blockNode)) && ((item.getItemDamage() == 0) || item.getItemDamage() == 5); + return (item != null) + && (item.getItem() == Item.getItemFromBlock(RegisteredBlocks.blockNode)) + && ((item.getItemDamage() == 0) || item.getItemDamage() == 5); } @Override diff --git a/src/main/java/makeo/gadomancy/client/renderers/item/ItemJarExtendedNodeRenderer.java b/src/main/java/makeo/gadomancy/client/renderers/item/ItemJarExtendedNodeRenderer.java index bade39a..b752efe 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/item/ItemJarExtendedNodeRenderer.java +++ b/src/main/java/makeo/gadomancy/client/renderers/item/ItemJarExtendedNodeRenderer.java @@ -26,13 +26,14 @@ import thaumcraft.common.tiles.TileJarNode; */ public class ItemJarExtendedNodeRenderer implements IItemRenderer { - //Copied and modified to allow compatibility to the ExtendedNodes + // Copied and modified to allow compatibility to the ExtendedNodes public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) { return (item != null) && (item.getItem() == RegisteredItems.itemExtendedNodeJar); } - public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) { + public boolean shouldUseRenderHelper( + IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) { return helper != ItemRendererHelper.EQUIPPED_BLOCK; } @@ -68,7 +69,6 @@ public class ItemJarExtendedNodeRenderer implements IItemRenderer { ItemNodeRenderer.renderItemNode(tjf); GL11.glPopMatrix(); - GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glEnable(3042); @@ -79,7 +79,6 @@ public class ItemJarExtendedNodeRenderer implements IItemRenderer { this.rb.renderBlockAsItem(RegisteredBlocks.blockExtendedNodeJar, item.getItemDamage(), 1.0F); GL11.glPopMatrix(); - GL11.glEnable(32826); } } diff --git a/src/main/java/makeo/gadomancy/client/renderers/item/ItemNodeRenderer.java b/src/main/java/makeo/gadomancy/client/renderers/item/ItemNodeRenderer.java index 4d2e483..6ceb38c 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/item/ItemNodeRenderer.java +++ b/src/main/java/makeo/gadomancy/client/renderers/item/ItemNodeRenderer.java @@ -29,21 +29,30 @@ import thaumcraft.common.tiles.TileNode; public class ItemNodeRenderer implements IItemRenderer { public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) { - return (item != null) && (item.getItem() == Item.getItemFromBlock(ConfigBlocks.blockAiry)) && ((item.getItemDamage() == 0) || (item.getItemDamage() == 5)); + return (item != null) + && (item.getItem() == Item.getItemFromBlock(ConfigBlocks.blockAiry)) + && ((item.getItemDamage() == 0) || (item.getItemDamage() == 5)); } - public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) { + public boolean shouldUseRenderHelper( + IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) { return helper != ItemRendererHelper.EQUIPPED_BLOCK; } @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - //Gadomancy: Redirect. + // Gadomancy: Redirect. ItemNodeRenderer.renderNodeItem(type, item, data); } - //Gadomancy: Renamed to access it static from another class and added aspects, nodeType and nodeModifier as params - public static void renderNodeItem(IItemRenderer.ItemRenderType type, ItemStack item, AspectList aspects, NodeType nodeType, NodeModifier nodeModifier, Object... data) { + // Gadomancy: Renamed to access it static from another class and added aspects, nodeType and nodeModifier as params + public static void renderNodeItem( + IItemRenderer.ItemRenderType type, + ItemStack item, + AspectList aspects, + NodeType nodeType, + NodeModifier nodeModifier, + Object... data) { if (type == IItemRenderer.ItemRenderType.ENTITY) { GL11.glTranslatef(-0.5F, -0.25F, -0.5F); } else if ((type == IItemRenderer.ItemRenderType.EQUIPPED) && ((data[1] instanceof EntityPlayer))) { @@ -66,12 +75,15 @@ public class ItemNodeRenderer implements IItemRenderer { GL11.glEnable(32826); } - public static void renderNodeItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) { ItemNodeRenderer.renderNodeItem(type, item, ItemNodeRenderer.aspects, NodeType.NORMAL, null, data); } - private static AspectList aspects = new AspectList().add(Aspect.AIR, 40).add(Aspect.FIRE, 40).add(Aspect.EARTH, 40).add(Aspect.WATER, 40); + private static AspectList aspects = new AspectList() + .add(Aspect.AIR, 40) + .add(Aspect.FIRE, 40) + .add(Aspect.EARTH, 40) + .add(Aspect.WATER, 40); public static void renderItemNode(INode node) { if (node.getAspects().size() > 0) { @@ -118,7 +130,8 @@ public class ItemNodeRenderer implements IItemRenderer { GL11.glBlendFunc(770, aspect.getBlend()); scale = MathHelper.sin(viewer.ticksExisted / (14.0F - count)) * bscale + bscale * 2.0F; scale = 0.2F + scale * (node.getAspects().getAmount(aspect) / 50.0F); - UtilsFX.renderAnimatedQuadStrip(scale, alpha / node.getAspects().size(), frames, 0, i, 0.0F, aspect.getColor()); + UtilsFX.renderAnimatedQuadStrip( + scale, alpha / node.getAspects().size(), frames, 0, i, 0.0F, aspect.getColor()); GL11.glDisable(3042); GL11.glPopMatrix(); count++; @@ -171,5 +184,4 @@ public class ItemNodeRenderer implements IItemRenderer { GL11.glPopMatrix(); } } - } diff --git a/src/main/java/makeo/gadomancy/client/renderers/item/ItemRenderFamiliar.java b/src/main/java/makeo/gadomancy/client/renderers/item/ItemRenderFamiliar.java index 54becd1..bf8c207 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/item/ItemRenderFamiliar.java +++ b/src/main/java/makeo/gadomancy/client/renderers/item/ItemRenderFamiliar.java @@ -1,5 +1,7 @@ package makeo.gadomancy.client.renderers.item; +import java.awt.*; +import java.util.Random; import makeo.gadomancy.client.util.FamiliarHandlerClient; import makeo.gadomancy.common.items.baubles.ItemEtherealFamiliar; import makeo.gadomancy.common.utils.MiscUtils; @@ -19,9 +21,6 @@ import thaumcraft.client.lib.UtilsFX; import thaumcraft.common.Thaumcraft; import thaumcraft.common.entities.monster.EntityWisp; -import java.awt.*; -import java.util.Random; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -47,23 +46,26 @@ public class ItemRenderFamiliar implements IItemRenderer { @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - if(item == null || !(item.getItem() instanceof ItemEtherealFamiliar)) return; + if (item == null || !(item.getItem() instanceof ItemEtherealFamiliar)) return; GL11.glPushMatrix(); - if(type == ItemRenderType.EQUIPPED) { + if (type == ItemRenderType.EQUIPPED) { GL11.glTranslatef(0.5F, 0.5F, 0.7F); - } else if(type == ItemRenderType.EQUIPPED_FIRST_PERSON) { + } else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) { GL11.glTranslatef(0, 1F, 0.8F); - } else if(type == ItemRenderType.INVENTORY) { + } else if (type == ItemRenderType.INVENTORY) { GL11.glTranslatef(0, -0.45F, 0); } try { this.cleanActiveRenderInfo(type); GL11.glScalef(1.3F, 1.3F, 1.3F); - if(ItemEtherealFamiliar.hasFamiliarAspect(item)) { - if(ItemRenderFamiliar.ENTITY_WISP == null) ItemRenderFamiliar.ENTITY_WISP = new EntityWisp(new FakeWorld()); - ItemRenderFamiliar.ENTITY_WISP.ticksExisted = FamiliarHandlerClient.PartialEntityFamiliar.DUMMY_FAMILIAR.ticksExisted; - ItemRenderFamiliar.ENTITY_WISP.setType(ItemEtherealFamiliar.getFamiliarAspect(item).getTag()); + if (ItemEtherealFamiliar.hasFamiliarAspect(item)) { + if (ItemRenderFamiliar.ENTITY_WISP == null) + ItemRenderFamiliar.ENTITY_WISP = new EntityWisp(new FakeWorld()); + ItemRenderFamiliar.ENTITY_WISP.ticksExisted = + FamiliarHandlerClient.PartialEntityFamiliar.DUMMY_FAMILIAR.ticksExisted; + ItemRenderFamiliar.ENTITY_WISP.setType( + ItemEtherealFamiliar.getFamiliarAspect(item).getTag()); ItemRenderFamiliar.renderEntityWispFor(null, ItemRenderFamiliar.ENTITY_WISP, 0, 0, 0, 0, 0); } } finally { @@ -108,18 +110,20 @@ public class ItemRenderFamiliar implements IItemRenderer { } private void restoreActiveRenderInfo() { - if(this.renderInfo[0] != -1) ActiveRenderInfo.rotationX = this.renderInfo[0]; - if(this.renderInfo[1] != -1) ActiveRenderInfo.rotationXZ = this.renderInfo[1]; - if(this.renderInfo[2] != -1) ActiveRenderInfo.rotationZ = this.renderInfo[2]; - if(this.renderInfo[3] != -1) ActiveRenderInfo.rotationYZ = this.renderInfo[3]; - if(this.renderInfo[4] != -1) ActiveRenderInfo.rotationXY = this.renderInfo[4]; + if (this.renderInfo[0] != -1) ActiveRenderInfo.rotationX = this.renderInfo[0]; + if (this.renderInfo[1] != -1) ActiveRenderInfo.rotationXZ = this.renderInfo[1]; + if (this.renderInfo[2] != -1) ActiveRenderInfo.rotationZ = this.renderInfo[2]; + if (this.renderInfo[3] != -1) ActiveRenderInfo.rotationYZ = this.renderInfo[3]; + if (this.renderInfo[4] != -1) ActiveRenderInfo.rotationXY = this.renderInfo[4]; for (int i = 0; i < this.renderInfo.length; i++) { this.renderInfo[i] = -1; } } private static int size1; - public static void renderEntityWispFor(EntityPlayer owner, EntityWisp wisp, double x, double y, double z, float fq, float pticks) { + + public static void renderEntityWispFor( + EntityPlayer owner, EntityWisp wisp, double x, double y, double z, float fq, float pticks) { if (ItemRenderFamiliar.size1 == 0) { ItemRenderFamiliar.size1 = UtilsFX.getTextureSize("textures/misc/wisp.png", 64); } @@ -130,24 +134,24 @@ public class ItemRenderFamiliar implements IItemRenderer { float f4 = ActiveRenderInfo.rotationYZ; float f5 = ActiveRenderInfo.rotationXY; float f10 = 1.0F; - float f11 = (float)x; - float f12 = (float)y + 0.45F; - float f13 = (float)z; + float f11 = (float) x; + float f12 = (float) y + 0.45F; + float f13 = (float) z; Tessellator tessellator = Tessellator.instance; boolean priv = owner != null && MiscUtils.isPrivilegedUser(owner); Color color = new Color(0); - if(priv) { + if (priv) { color = new Color(Color.HSBtoRGB((System.currentTimeMillis() % 3240) / 3240F, 1F, 1F)); - if(owner.worldObj.rand.nextInt(3) == 0) { + if (owner.worldObj.rand.nextInt(3) == 0) { EntityPlayer thisPlayer = Minecraft.getMinecraft().thePlayer; boolean isThisOwner = thisPlayer.equals(owner); World world = owner.worldObj; Random rand = world.rand; double oX, oY, oZ; - if(isThisOwner) { + if (isThisOwner) { oX = owner.posX + f11; oY = owner.posY + f12; oZ = owner.posZ + f13; @@ -156,10 +160,15 @@ public class ItemRenderFamiliar implements IItemRenderer { oY = thisPlayer.posY + (f12); oZ = thisPlayer.posZ + (f13); } - Thaumcraft.proxy.wispFX(world, oX + (rand.nextFloat() - rand.nextFloat()) * 0.3F, - oY + (rand.nextFloat() - rand.nextFloat()) * 0.3F, - oZ + (rand.nextFloat() - rand.nextFloat()) * 0.3F, - 0.1F, color.getRed() / 255.0F, color.getGreen() / 255.0F, color.getBlue() / 255.0F); + Thaumcraft.proxy.wispFX( + world, + oX + (rand.nextFloat() - rand.nextFloat()) * 0.3F, + oY + (rand.nextFloat() - rand.nextFloat()) * 0.3F, + oZ + (rand.nextFloat() - rand.nextFloat()) * 0.3F, + 0.1F, + color.getRed() / 255.0F, + color.getGreen() / 255.0F, + color.getBlue() / 255.0F); } } else { if (Aspect.getAspect(wisp.getType()) != null) { @@ -207,7 +216,6 @@ public class ItemRenderFamiliar implements IItemRenderer { int qq = wisp.ticksExisted % 16; - float size8 = 16.0F; x0 = qq / size8; x1 = (qq + 1) / size8; @@ -233,5 +241,4 @@ public class ItemRenderFamiliar implements IItemRenderer { GL11.glAlphaFunc(516, 0.1F); GL11.glPopMatrix(); } - } diff --git a/src/main/java/makeo/gadomancy/client/renderers/item/ItemRenderRemoteJar.java b/src/main/java/makeo/gadomancy/client/renderers/item/ItemRenderRemoteJar.java index 4e88dda..37a6ace 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/item/ItemRenderRemoteJar.java +++ b/src/main/java/makeo/gadomancy/client/renderers/item/ItemRenderRemoteJar.java @@ -30,8 +30,8 @@ public class ItemRenderRemoteJar extends ItemRenderTileEntity { public void renderItem(IItemRenderer.ItemRenderType type, ItemStack stack, Object... data) { GL11.glEnable(GL11.GL_ALPHA_TEST); - AspectList aspects = ((ItemJarFilled)ConfigItems.itemJarFilled).getAspects(stack); - if(aspects != null) { + AspectList aspects = ((ItemJarFilled) ConfigItems.itemJarFilled).getAspects(stack); + if (aspects != null) { this.tile.aspect = aspects.getAspects()[0]; this.tile.amount = aspects.getAmount(this.tile.aspect); } else { @@ -39,7 +39,7 @@ public class ItemRenderRemoteJar extends ItemRenderTileEntity { this.tile.amount = 0; } - if(stack.hasTagCompound()) { + if (stack.hasTagCompound()) { this.tile.networkId = NBTHelper.getUUID(stack.getTagCompound(), "networkId"); } @@ -48,7 +48,12 @@ public class ItemRenderRemoteJar extends ItemRenderTileEntity { GL11.glPushMatrix(); GL11.glTranslatef(0.5f, 0.5f, 0.5f); - RenderingRegistry.instance().renderInventoryBlock(RenderBlocks.getInstance(), RegisteredBlocks.blockRemoteJar, 0, RegisteredBlocks.blockRemoteJar.getRenderType()); + RenderingRegistry.instance() + .renderInventoryBlock( + RenderBlocks.getInstance(), + RegisteredBlocks.blockRemoteJar, + 0, + RegisteredBlocks.blockRemoteJar.getRenderType()); GL11.glPopMatrix(); } } diff --git a/src/main/java/makeo/gadomancy/client/renderers/item/ItemRenderStoneMachine.java b/src/main/java/makeo/gadomancy/client/renderers/item/ItemRenderStoneMachine.java index 4003c3e..8f37eb1 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/item/ItemRenderStoneMachine.java +++ b/src/main/java/makeo/gadomancy/client/renderers/item/ItemRenderStoneMachine.java @@ -1,13 +1,12 @@ package makeo.gadomancy.client.renderers.item; +import java.util.HashMap; +import java.util.Map; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import org.lwjgl.opengl.GL11; -import java.util.HashMap; -import java.util.Map; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -19,7 +18,7 @@ import java.util.Map; public class ItemRenderStoneMachine extends ItemRenderTileEntity { private final Map renderers = new HashMap(); - public ItemRenderStoneMachine() { } + public ItemRenderStoneMachine() {} private static class RenderInfo { private TileEntity tile; @@ -32,7 +31,7 @@ public class ItemRenderStoneMachine extends ItemRenderTileEntity { info.tile = tile; this.renderers.put(metadata, info); - if(tile.getWorldObj() == null) { + if (tile.getWorldObj() == null) { tile.setWorldObj(ItemRenderTileEntity.FAKE_WORLD); } } @@ -44,8 +43,8 @@ public class ItemRenderStoneMachine extends ItemRenderTileEntity { this.tile = info.tile; this.renderer = info.renderer; - if(stack.getItemDamage() == 0) { - GL11.glTranslatef(0, 2/16f, 0); + if (stack.getItemDamage() == 0) { + GL11.glTranslatef(0, 2 / 16f, 0); } super.renderItem(type, stack, data); diff --git a/src/main/java/makeo/gadomancy/client/renderers/item/ItemRenderTEKnowledgeBook.java b/src/main/java/makeo/gadomancy/client/renderers/item/ItemRenderTEKnowledgeBook.java index f35de61..1033124 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/item/ItemRenderTEKnowledgeBook.java +++ b/src/main/java/makeo/gadomancy/client/renderers/item/ItemRenderTEKnowledgeBook.java @@ -20,16 +20,16 @@ public class ItemRenderTEKnowledgeBook extends ItemRenderTileEntity implements IItemRenderer this.renderer = renderer; this.tile = tile; - if(tile.getWorldObj() == null) { + if (tile.getWorldObj() == null) { tile.setWorldObj(ItemRenderTileEntity.FAKE_WORLD); } } - protected ItemRenderTileEntity() { } + protected ItemRenderTileEntity() {} @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { @@ -46,13 +46,11 @@ public class ItemRenderTileEntity implements IItemRenderer @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - if(type == IItemRenderer.ItemRenderType.ENTITY) - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + if (type == IItemRenderer.ItemRenderType.ENTITY) GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - if(type == ItemRenderType.INVENTORY) - GL11.glTranslatef(0, -0.1F, 0); + if (type == ItemRenderType.INVENTORY) GL11.glTranslatef(0, -0.1F, 0); - if(type == ItemRenderType.EQUIPPED_FIRST_PERSON && this.tile instanceof TileManipulationFocus) + if (type == ItemRenderType.EQUIPPED_FIRST_PERSON && this.tile instanceof TileManipulationFocus) GL11.glTranslatef(0, 0.6F, 0); this.renderer.renderTileEntityAt(this.tile, 0.0D, 0.0D, 0.0D, 0.0F); diff --git a/src/main/java/makeo/gadomancy/client/renderers/item/ItemRenderTileEntityMulti.java b/src/main/java/makeo/gadomancy/client/renderers/item/ItemRenderTileEntityMulti.java index bfedbff..2f25cb7 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/item/ItemRenderTileEntityMulti.java +++ b/src/main/java/makeo/gadomancy/client/renderers/item/ItemRenderTileEntityMulti.java @@ -1,14 +1,13 @@ package makeo.gadomancy.client.renderers.item; +import java.util.HashMap; +import java.util.Map; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; -import java.util.HashMap; -import java.util.Map; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -22,8 +21,8 @@ public class ItemRenderTileEntityMulti implements IItemRenderer { private Map renderMap = new HashMap(); public ItemRenderTileEntityMulti(RenderSet... renderSets) { - for(RenderSet set : renderSets) { - if(set != null) { + for (RenderSet set : renderSets) { + if (set != null) { this.renderMap.put(set.meta, set); } } @@ -42,13 +41,11 @@ public class ItemRenderTileEntityMulti implements IItemRenderer { @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glPushMatrix(); - if(type == IItemRenderer.ItemRenderType.ENTITY) - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + if (type == IItemRenderer.ItemRenderType.ENTITY) GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - if(type == ItemRenderType.INVENTORY) - GL11.glTranslatef(0, -0.1F, 0); + if (type == ItemRenderType.INVENTORY) GL11.glTranslatef(0, -0.1F, 0); - if(this.renderMap.containsKey(item.getItemDamage())) { + if (this.renderMap.containsKey(item.getItemDamage())) { RenderSet set = this.renderMap.get(item.getItemDamage()); set.renderer.renderTileEntityAt(set.te, 0, 0, 0, 0); } @@ -68,5 +65,4 @@ public class ItemRenderTileEntityMulti implements IItemRenderer { this.meta = meta; } } - } 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 6ebaab0..5888ff5 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileAIShutdown.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileAIShutdown.java @@ -1,5 +1,6 @@ package makeo.gadomancy.client.renderers.tile; +import java.util.Random; import makeo.gadomancy.client.effect.EffectHandler; import makeo.gadomancy.client.effect.fx.Orbital; import makeo.gadomancy.common.blocks.tiles.TileAIShutdown; @@ -10,8 +11,6 @@ import net.minecraft.world.World; import thaumcraft.client.fx.ParticleEngine; import thaumcraft.client.fx.particles.FXWisp; -import java.util.Random; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -26,31 +25,31 @@ public class RenderTileAIShutdown extends TileEntitySpecialRenderer { @Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float parTicks) { - if(tileEntity == null || !(tileEntity instanceof TileAIShutdown)) return; + if (tileEntity == null || !(tileEntity instanceof TileAIShutdown)) return; TileAIShutdown ta = (TileAIShutdown) tileEntity; - if(ta.getStoredEssentia() > 0) { + if (ta.getStoredEssentia() > 0) { this.handleOrbital(ta); } } private void handleOrbital(TileAIShutdown ta) { - if(ta.orbital == null && ta.getWorldObj() != null) { + if (ta.orbital == null && ta.getWorldObj() != null) { ta.orbital = new Orbital(new Vector3(ta.xCoord + 0.5, ta.yCoord + 0.2, ta.zCoord + 0.5), ta.getWorldObj()); } - if(ta.orbital != null && !ta.orbital.registered) { + if (ta.orbital != null && !ta.orbital.registered) { EffectHandler.getInstance().registerOrbital(ta.orbital); } - if(ta.orbital != null) ta.orbital.lastRenderCall = System.currentTimeMillis(); + if (ta.orbital != null) ta.orbital.lastRenderCall = System.currentTimeMillis(); - if(ta.getStoredEssentia() > 0) { - if(ta.orbital != null && ta.orbital.orbitalsSize() == 0) { + if (ta.getStoredEssentia() > 0) { + if (ta.orbital != null && ta.orbital.orbitalsSize() == 0) { this.fillOrbital(ta.orbital); } } else { - if(ta.orbital != null && ta.orbital.orbitalsSize() > 0) { + if (ta.orbital != null && ta.orbital.orbitalsSize() > 0) { ta.orbital.clearOrbitals(); } } @@ -62,11 +61,20 @@ public class RenderTileAIShutdown extends TileEntitySpecialRenderer { prop.setParticleSize(0F); prop.setRenderRunnable(new Orbital.OrbitalRenderRunnable() { @Override - public void onRender(World world, Vector3 pos, Orbital.OrbitalRenderProperties properties, int orbitalExisted, float partialTicks) { - if(RenderTileAIShutdown.rand.nextInt(3) == 0) { - FXWisp ef = new FXWisp(world, - pos.getX() + RenderTileAIShutdown.randomOffset(), pos.getY() + RenderTileAIShutdown.randomOffset(), pos.getZ() + RenderTileAIShutdown.randomOffset(), - 0.2F, 3); + public void onRender( + World world, + Vector3 pos, + Orbital.OrbitalRenderProperties properties, + int orbitalExisted, + float partialTicks) { + if (RenderTileAIShutdown.rand.nextInt(3) == 0) { + FXWisp ef = new FXWisp( + world, + pos.getX() + RenderTileAIShutdown.randomOffset(), + pos.getY() + RenderTileAIShutdown.randomOffset(), + pos.getZ() + RenderTileAIShutdown.randomOffset(), + 0.2F, + 3); ef.setGravity(-0.08F); ParticleEngine.instance.addEffect(world, ef); } @@ -79,11 +87,20 @@ public class RenderTileAIShutdown extends TileEntitySpecialRenderer { prop.setParticleSize(0F); prop.setRenderRunnable(new Orbital.OrbitalRenderRunnable() { @Override - public void onRender(World world, Vector3 pos, Orbital.OrbitalRenderProperties properties, int orbitalExisted, float partialTicks) { - if(RenderTileAIShutdown.rand.nextInt(3) == 0) { - FXWisp ef = new FXWisp(world, - pos.getX() + RenderTileAIShutdown.randomOffset(), pos.getY() + RenderTileAIShutdown.randomOffset(), pos.getZ() + RenderTileAIShutdown.randomOffset(), - 0.2F, 3); + public void onRender( + World world, + Vector3 pos, + Orbital.OrbitalRenderProperties properties, + int orbitalExisted, + float partialTicks) { + if (RenderTileAIShutdown.rand.nextInt(3) == 0) { + FXWisp ef = new FXWisp( + world, + pos.getX() + RenderTileAIShutdown.randomOffset(), + pos.getY() + RenderTileAIShutdown.randomOffset(), + pos.getZ() + RenderTileAIShutdown.randomOffset(), + 0.2F, + 3); ef.setGravity(-0.08F); ParticleEngine.instance.addEffect(world, ef); } @@ -96,11 +113,20 @@ public class RenderTileAIShutdown extends TileEntitySpecialRenderer { prop.setParticleSize(0F); prop.setRenderRunnable(new Orbital.OrbitalRenderRunnable() { @Override - public void onRender(World world, Vector3 pos, Orbital.OrbitalRenderProperties properties, int orbitalExisted, float partialTicks) { - if(RenderTileAIShutdown.rand.nextBoolean()) { - FXWisp ef = new FXWisp(world, - pos.getX() + RenderTileAIShutdown.randomOffset(), pos.getY() + RenderTileAIShutdown.randomOffset(), pos.getZ() + RenderTileAIShutdown.randomOffset(), - 0.15F, 5); + public void onRender( + World world, + Vector3 pos, + Orbital.OrbitalRenderProperties properties, + int orbitalExisted, + float partialTicks) { + if (RenderTileAIShutdown.rand.nextBoolean()) { + FXWisp ef = new FXWisp( + world, + pos.getX() + RenderTileAIShutdown.randomOffset(), + pos.getY() + RenderTileAIShutdown.randomOffset(), + pos.getZ() + RenderTileAIShutdown.randomOffset(), + 0.15F, + 5); ef.setGravity(-0.08F); ParticleEngine.instance.addEffect(world, ef); } @@ -113,11 +139,20 @@ public class RenderTileAIShutdown extends TileEntitySpecialRenderer { prop.setParticleSize(0F); prop.setRenderRunnable(new Orbital.OrbitalRenderRunnable() { @Override - public void onRender(World world, Vector3 pos, Orbital.OrbitalRenderProperties properties, int orbitalExisted, float partialTicks) { - if(RenderTileAIShutdown.rand.nextBoolean()) { - FXWisp ef = new FXWisp(world, - pos.getX() + RenderTileAIShutdown.randomOffset(), pos.getY() + RenderTileAIShutdown.randomOffset(), pos.getZ() + RenderTileAIShutdown.randomOffset(), - 0.15F, 5); + public void onRender( + World world, + Vector3 pos, + Orbital.OrbitalRenderProperties properties, + int orbitalExisted, + float partialTicks) { + if (RenderTileAIShutdown.rand.nextBoolean()) { + FXWisp ef = new FXWisp( + world, + pos.getX() + RenderTileAIShutdown.randomOffset(), + pos.getY() + RenderTileAIShutdown.randomOffset(), + pos.getZ() + RenderTileAIShutdown.randomOffset(), + 0.15F, + 5); ef.setGravity(-0.08F); ParticleEngine.instance.addEffect(world, ef); } @@ -130,22 +165,29 @@ public class RenderTileAIShutdown extends TileEntitySpecialRenderer { prop.setParticleSize(0F); prop.setRenderRunnable(new Orbital.OrbitalRenderRunnable() { @Override - public void onRender(World world, Vector3 pos, Orbital.OrbitalRenderProperties properties, int orbitalExisted, float partialTicks) { - if(RenderTileAIShutdown.rand.nextBoolean()) { - FXWisp ef = new FXWisp(world, - pos.getX() + RenderTileAIShutdown.randomOffset(), pos.getY() + RenderTileAIShutdown.randomOffset(), pos.getZ() + RenderTileAIShutdown.randomOffset(), - 0.15F, 5); + public void onRender( + World world, + Vector3 pos, + Orbital.OrbitalRenderProperties properties, + int orbitalExisted, + float partialTicks) { + if (RenderTileAIShutdown.rand.nextBoolean()) { + FXWisp ef = new FXWisp( + world, + pos.getX() + RenderTileAIShutdown.randomOffset(), + pos.getY() + RenderTileAIShutdown.randomOffset(), + pos.getZ() + RenderTileAIShutdown.randomOffset(), + 0.15F, + 5); ef.setGravity(-0.08F); ParticleEngine.instance.addEffect(world, ef); } } }); orbital.addOrbitalPoint(prop); - } private static float randomOffset() { return RenderTileAIShutdown.rand.nextFloat() * 0.2F; } - } diff --git a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileArcaneDropper.java b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileArcaneDropper.java index f2ca49e..aa86522 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileArcaneDropper.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileArcaneDropper.java @@ -36,20 +36,20 @@ public class RenderTileArcaneDropper extends TileEntitySpecialRenderer { ForgeDirection side = ForgeDirection.getOrientation(metadata & 7); - if(side == ForgeDirection.UP) { + if (side == ForgeDirection.UP) { GL11.glRotatef(180, 1, 0, 0); GL11.glTranslatef(0, -2, 0); - } else if(side != ForgeDirection.DOWN) { - GL11.glRotatef(-90, side.offsetZ, 0, -1*side.offsetX); + } else if (side != ForgeDirection.DOWN) { + GL11.glRotatef(-90, side.offsetZ, 0, -1 * side.offsetX); GL11.glTranslatef(side.offsetX, -1, side.offsetZ); } boolean flipped = (metadata & 8) == 8; - if(side == ForgeDirection.WEST || side == ForgeDirection.EAST) { + if (side == ForgeDirection.WEST || side == ForgeDirection.EAST) { flipped = !flipped; } - if(flipped) { + if (flipped) { GL11.glRotatef(90, 0, 1, 0); } diff --git a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileArcanePackager.java b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileArcanePackager.java index 8f5f75e..b784d81 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileArcanePackager.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileArcanePackager.java @@ -32,21 +32,21 @@ public class RenderTileArcanePackager extends TileEntitySpecialRenderer { GL11.glTranslated(x, y, z); - GL11.glRotatef(180 , 1, 0, 0); + GL11.glRotatef(180, 1, 0, 0); GL11.glTranslatef(0.5f, -1.5f, -0.5f); - GL11.glRotatef(-90*((TileJarFillable)tile).facing + 270, 0, 1, 0); + GL11.glRotatef(-90 * ((TileJarFillable) tile).facing + 270, 0, 1, 0); GL11.glPushMatrix(); float pistonOffset; - int pixelProgress = ((TileArcanePackager)tile).progress; - if(pixelProgress <= 40) { - pistonOffset = (pixelProgress / 40f) * (3/16f); + int pixelProgress = ((TileArcanePackager) tile).progress; + if (pixelProgress <= 40) { + pistonOffset = (pixelProgress / 40f) * (3 / 16f); } else { pixelProgress -= 41; float progress = pixelProgress / 5f; - pistonOffset = (3/16f) - (progress * (3/16f)); + pistonOffset = (3 / 16f) - (progress * (3 / 16f)); } GL11.glTranslatef(0, pistonOffset, 0); @@ -56,7 +56,7 @@ public class RenderTileArcanePackager extends TileEntitySpecialRenderer { this.bindTexture(RenderTileArcanePackager.TEXTURE_PISTON); - if(pistonOffset < 1/16f) { + if (pistonOffset < 1 / 16f) { RenderTileArcanePackager.MODEL_PISTON_CUT.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); } else { RenderTileArcanePackager.MODEL_PISTON.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); 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 6b7e233..ad888f6 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileAuraPylon.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileAuraPylon.java @@ -1,5 +1,7 @@ package makeo.gadomancy.client.renderers.tile; +import java.awt.*; +import java.util.Random; import makeo.gadomancy.client.effect.EffectHandler; import makeo.gadomancy.client.effect.fx.Orbital; import makeo.gadomancy.client.models.ModelAuraPylon; @@ -19,9 +21,6 @@ import thaumcraft.api.aspects.Aspect; import thaumcraft.client.fx.ParticleEngine; import thaumcraft.client.fx.particles.FXWisp; -import java.awt.*; -import java.util.Random; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -35,9 +34,11 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer { public static final ModelBase MODEL_AURA_PYLON = new ModelAuraPylon(); public static final ModelBase MODEL_AURA_PYLON_TOP = new ModelAuraPylonTop(); public static final ModelBase MODEL_AURA_PYLON_BOTTOM = new ModelAuraPylonBottom(); - public static final SimpleResourceLocation PYLON_TEXTURE_TOP = new SimpleResourceLocation("models/aura_pylon_peak.png"); + public static final SimpleResourceLocation PYLON_TEXTURE_TOP = + new SimpleResourceLocation("models/aura_pylon_peak.png"); public static final SimpleResourceLocation PYLON_TEXTURE = new SimpleResourceLocation("models/aura_pylon.png"); - public static final SimpleResourceLocation PYLON_TEXTURE_BOTTOM = new SimpleResourceLocation("models/aura_pylon_base.png"); + public static final SimpleResourceLocation PYLON_TEXTURE_BOTTOM = + new SimpleResourceLocation("models/aura_pylon_base.png"); public void renderTileEntity(TileEntity tile, double x, double y, double z, float partTicks) { GL11.glPushMatrix(); @@ -45,32 +46,32 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer { GL11.glPushMatrix(); ResourceLocation textureToBind; - if(tile instanceof TileAuraPylonTop) { + if (tile instanceof TileAuraPylonTop) { textureToBind = RenderTileAuraPylon.PYLON_TEXTURE_TOP; - } else if(((TileAuraPylon) tile).isInputTile() || ((TileAuraPylon) tile).isLowestTile()) { + } else if (((TileAuraPylon) tile).isInputTile() || ((TileAuraPylon) tile).isLowestTile()) { textureToBind = RenderTileAuraPylon.PYLON_TEXTURE_BOTTOM; } else { textureToBind = RenderTileAuraPylon.PYLON_TEXTURE; } this.bindTexture(textureToBind); - for(int i = 0; i < 4; i++) { - if(tile instanceof TileAuraPylonTop) { + for (int i = 0; i < 4; i++) { + if (tile instanceof TileAuraPylonTop) { GL11.glPushMatrix(); GL11.glRotatef(180, 1, 0, 0); GL11.glTranslatef(0, -2F, 0); - //bindTexture(PYLON_TEXTURE_TOP); + // bindTexture(PYLON_TEXTURE_TOP); RenderTileAuraPylon.MODEL_AURA_PYLON_TOP.render(null, 0, 0, 0, 0, 0, 0.0625f); GL11.glPopMatrix(); } else { - if(((TileAuraPylon) tile).isInputTile() || ((TileAuraPylon) tile).isLowestTile()) { + if (((TileAuraPylon) tile).isInputTile() || ((TileAuraPylon) tile).isLowestTile()) { GL11.glPushMatrix(); GL11.glRotatef(180, 1, 0, 0); GL11.glTranslatef(0, -2F, 0); - //bindTexture(PYLON_TEXTURE_BOTTOM); + // bindTexture(PYLON_TEXTURE_BOTTOM); RenderTileAuraPylon.MODEL_AURA_PYLON_BOTTOM.render(null, 0, 0, 0, 0, 0, 0.0625f); GL11.glPopMatrix(); } else { - //bindTexture(PYLON_TEXTURE); + // bindTexture(PYLON_TEXTURE); RenderTileAuraPylon.MODEL_AURA_PYLON.render(null, 0, 0, 0, 0, 0, 0.0625f); } } @@ -80,30 +81,31 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer { GL11.glPopMatrix(); GL11.glPopMatrix(); - if(tile instanceof TileAuraPylonTop) { + if (tile instanceof TileAuraPylonTop) { TileAuraPylonTop ta = (TileAuraPylonTop) tile; - if(ta.orbital == null && tile.getWorldObj() != null) { - ta.orbital = new Orbital(new Vector3(tile.xCoord + 0.5, tile.yCoord + 0.7, tile.zCoord + 0.5), tile.getWorldObj()); + if (ta.orbital == null && tile.getWorldObj() != null) { + ta.orbital = new Orbital( + new Vector3(tile.xCoord + 0.5, tile.yCoord + 0.7, tile.zCoord + 0.5), tile.getWorldObj()); } - if(ta.orbital != null && !ta.orbital.registered) { + if (ta.orbital != null && !ta.orbital.registered) { EffectHandler.getInstance().registerOrbital(ta.orbital); } - if(ta.shouldRenderEffect()) { + if (ta.shouldRenderEffect()) { Aspect a = ta.getAspect(); - if(a == null) a = Aspect.WEATHER; + if (a == null) a = Aspect.WEATHER; Color c = new Color(a.getColor()); - if(tile.getWorldObj().rand.nextInt(12) == 0) { - if(a == Aspect.ENTROPY || a == Aspect.DARKNESS || a == Aspect.UNDEAD) { + if (tile.getWorldObj().rand.nextInt(12) == 0) { + if (a == Aspect.ENTROPY || a == Aspect.DARKNESS || a == Aspect.UNDEAD) { this.spawnWispParticles((TileAuraPylonTop) tile, 5, 0.5F, false); } else { this.spawnWispParticles((TileAuraPylonTop) tile, c, 0.5F, false); } } c = c.darker().darker(); - if(tile.getWorldObj().rand.nextInt(20) == 0) { - if(a == Aspect.ENTROPY || a == Aspect.DARKNESS || a == Aspect.UNDEAD) { + if (tile.getWorldObj().rand.nextInt(20) == 0) { + if (a == Aspect.ENTROPY || a == Aspect.DARKNESS || a == Aspect.UNDEAD) { this.spawnWispParticles((TileAuraPylonTop) tile, 5, 0.25F, false); } else { this.spawnWispParticles((TileAuraPylonTop) tile, c, 0.25F, false); @@ -111,12 +113,12 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer { } } - if(ta.orbital != null) ta.orbital.lastRenderCall = System.currentTimeMillis(); + if (ta.orbital != null) ta.orbital.lastRenderCall = System.currentTimeMillis(); - if(ta.shouldRenderAuraEffect() && ta.getAspect() != null) { - if(ta.orbital != null && ta.orbital.orbitalsSize() == 0) { + if (ta.shouldRenderAuraEffect() && ta.getAspect() != null) { + if (ta.orbital != null && ta.orbital.orbitalsSize() == 0) { Aspect a = ta.getAspect(); - if(a != null) { + if (a != null) { int col = a.getColor(); col |= (0x55 << 24); Color c = new Color(col, true); @@ -127,7 +129,7 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer { } } } else { - if(ta.orbital != null && ta.orbital.orbitalsSize() > 0) { + if (ta.orbital != null && ta.orbital.orbitalsSize() > 0) { ta.orbital.clearOrbitals(); } } @@ -135,7 +137,8 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer { } private void addNewOrbitalPoint(Orbital orbital, Random rand, Color color) { - Orbital.OrbitalRenderProperties properties = new Orbital.OrbitalRenderProperties(Orbital.Axis.persisentRandomAxis(), rand.nextDouble() + 2D); + Orbital.OrbitalRenderProperties properties = + new Orbital.OrbitalRenderProperties(Orbital.Axis.persisentRandomAxis(), rand.nextDouble() + 2D); properties.setColor(color).setTicksForFullCircle(60 + rand.nextInt(40)).setOffsetTicks(rand.nextInt(80)); properties.setSubParticleColor(color.brighter().brighter()); orbital.addOrbitalPoint(properties); @@ -148,7 +151,16 @@ 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, type); + 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); @@ -164,7 +176,18 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer { 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); + 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); @@ -174,5 +197,4 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer { public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partTicks) { this.renderTileEntity(tileEntity, x, y, z, partTicks); } - } diff --git a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileBlockProtector.java b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileBlockProtector.java index 58d31a8..d34f359 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileBlockProtector.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileBlockProtector.java @@ -23,7 +23,7 @@ public class RenderTileBlockProtector extends TileJarRenderer { @Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) { - this.renderTileEntityAt((TileBlockProtector)tile, x, y, z, partialTicks); + this.renderTileEntityAt((TileBlockProtector) tile, x, y, z, partialTicks); } public void renderTileEntityAt(TileBlockProtector tile, double x, double y, double z, float partialTicks) { @@ -31,11 +31,11 @@ public class RenderTileBlockProtector extends TileJarRenderer { GL11.glTranslated(x, y, z); GL11.glTranslatef(0.5f, 0, 0.5f); - GL11.glRotatef(90*tile.facing, 0, 1, 0); + GL11.glRotatef(90 * tile.facing, 0, 1, 0); GL11.glTranslatef(-0.5f, 0, -0.5f); GL11.glPushMatrix(); - GL11.glTranslatef(0, -2/16f - 0.03f, 0); + GL11.glTranslatef(0, -2 / 16f - 0.03f, 0); GL11.glScalef(0.4f, 0.4f, 0.4f); GL11.glTranslatef(0.75f, 0.75f, 0.75f); @@ -46,17 +46,16 @@ public class RenderTileBlockProtector extends TileJarRenderer { GL11.glPopMatrix(); - GL11.glPushMatrix(); GL11.glTranslatef(0.5f, 1.5f, 0.5f); GL11.glRotatef(180, 1, 0, 0); - this.bindTexture(tile.getPowerLevel() > 0 ? RenderTileBlockProtector.TEXTURE_ON : RenderTileBlockProtector.TEXTURE_OFF); + this.bindTexture( + tile.getPowerLevel() > 0 ? RenderTileBlockProtector.TEXTURE_ON : RenderTileBlockProtector.TEXTURE_OFF); new ModelBlockProtector().render(null, 0, 0, 0, 0, 0, 0.0625f); GL11.glPopMatrix(); - - GL11.glTranslatef(0, -2/16f - 0.03f, 0); + GL11.glTranslatef(0, -2 / 16f - 0.03f, 0); GL11.glScalef(0.4f, 0.4f, 0.4f); GL11.glTranslatef(0.75f, 0.75f, 0.75f); diff --git a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileCapEldritch.java b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileCapEldritch.java index c93aacc..21a094b 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileCapEldritch.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileCapEldritch.java @@ -21,7 +21,7 @@ public class RenderTileCapEldritch extends TileEldritchCapRenderer { @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) { - if(te.getWorldObj().provider.dimensionId == ModConfig.dimOuterId) { + if (te.getWorldObj().provider.dimensionId == ModConfig.dimOuterId) { int old = Config.dimensionOuterId; Config.dimensionOuterId = ModConfig.dimOuterId; super.renderTileEntityAt(te, x, y, z, f); 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 61e83b4..b6b7b0e 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileEssentiaCompressor.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileEssentiaCompressor.java @@ -1,5 +1,7 @@ package makeo.gadomancy.client.renderers.tile; +import java.util.HashMap; +import java.util.Map; import makeo.gadomancy.client.effect.EffectHandler; import makeo.gadomancy.client.effect.fx.FXVortex; import makeo.gadomancy.client.models.ModelEssentiaCompressor; @@ -13,9 +15,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; import org.lwjgl.opengl.GL11; -import java.util.HashMap; -import java.util.Map; - /** * HellFirePvP@Admin * Date: 22.04.2016 / 21:39 @@ -26,19 +25,21 @@ public class RenderTileEssentiaCompressor extends TileEntitySpecialRenderer { public static final ModelBase MODEL_ESSENTIA_COMPRESSOR = new ModelEssentiaCompressor(); public static final ModelBase MODEL_PACKED_COMPRESSOR = new ModelPackedCompressorBlock(); - public static final SimpleResourceLocation COMPRESSOR_TEXTURE = new SimpleResourceLocation("models/essentia_compressor.png"); - public static final SimpleResourceLocation PACKED_COMPRESSOR_TEXTURE = new SimpleResourceLocation("blocks/block_packed_compressor.png"); + public static final SimpleResourceLocation COMPRESSOR_TEXTURE = + new SimpleResourceLocation("models/essentia_compressor.png"); + public static final SimpleResourceLocation PACKED_COMPRESSOR_TEXTURE = + new SimpleResourceLocation("blocks/block_packed_compressor.png"); @Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) { - if(tileEntity == null || !(tileEntity instanceof TileEssentiaCompressor)) return; + if (tileEntity == null || !(tileEntity instanceof TileEssentiaCompressor)) return; boolean isRenderedAsItem = false; - if(tileEntity.getWorldObj() instanceof FakeWorld) { //LUL + if (tileEntity.getWorldObj() instanceof FakeWorld) { // LUL isRenderedAsItem = true; } - if(!isRenderedAsItem && ((TileEssentiaCompressor) tileEntity).isMultiblockFormed()) { + if (!isRenderedAsItem && ((TileEssentiaCompressor) tileEntity).isMultiblockFormed()) { int yOffset = ((TileEssentiaCompressor) tileEntity).getMultiblockYIndex(); GL11.glPushMatrix(); GL11.glTranslated(x + 0.5, y - yOffset - 0.5, z + 0.5); @@ -51,16 +52,21 @@ public class RenderTileEssentiaCompressor extends TileEntitySpecialRenderer { GL11.glPopMatrix(); GL11.glPushMatrix(); - if(yOffset == 1) { //The middle one. - well. the one where the blackhole is. - this.renderBlackHoleEffect(tileEntity.xCoord + 0.5, tileEntity.yCoord + 0.5, tileEntity.zCoord + 0.5, - (TileEssentiaCompressor) tileEntity.getWorldObj().getTileEntity(tileEntity.xCoord, tileEntity.yCoord - 1, tileEntity.zCoord)); + if (yOffset == 1) { // The middle one. - well. the one where the blackhole is. + this.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 { GL11.glPushMatrix(); GL11.glTranslated(x + 0.5, y - 0.5, z + 0.5); GL11.glRotatef(180, 1, 0, 0); - if(isRenderedAsItem) { + if (isRenderedAsItem) { GL11.glTranslatef(0, -2.9F, 0); } else { GL11.glTranslatef(0, -2.877F, 0); @@ -69,7 +75,6 @@ public class RenderTileEssentiaCompressor extends TileEntitySpecialRenderer { RenderTileEssentiaCompressor.MODEL_PACKED_COMPRESSOR.render(null, 0, 0, 0, 0, 0, 0.0625f); GL11.glPopMatrix(); } - } public static Map ownedVortex = new HashMap(); @@ -85,10 +90,9 @@ public class RenderTileEssentiaCompressor extends TileEntitySpecialRenderer { v.registered = true; EffectHandler.getInstance().registerVortex(v); } - if(!v.registered) { + if (!v.registered) { EffectHandler.getInstance().registerVortex(v); } v.notify(System.currentTimeMillis()); } - } diff --git a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileExtendedNode.java b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileExtendedNode.java index 0d73ae2..aa4c3d2 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileExtendedNode.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileExtendedNode.java @@ -23,7 +23,7 @@ public class RenderTileExtendedNode extends TileEntitySpecialRenderer { double rY = node.yCoord + 0.5; double rZ = node.zCoord + 0.5; float size = 1.0F; - if(node.getExtendedNodeType() != null && node.getExtendedNodeType() == ExtendedNodeType.GROWING) { + if (node.getExtendedNodeType() != null && node.getExtendedNodeType() == ExtendedNodeType.GROWING) { size *= 1.5F; } RenderTileNodeBasic.renderTileEntityAt(tile, rX, rY, rZ, partialTicks, size); diff --git a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileInfusionClaw.java b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileInfusionClaw.java index d94746b..95fd916 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileInfusionClaw.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileInfusionClaw.java @@ -1,5 +1,6 @@ package makeo.gadomancy.client.renderers.tile; +import java.util.Random; import makeo.gadomancy.client.models.ModelInfusionClawPart; import makeo.gadomancy.client.models.ModelWandPart; import makeo.gadomancy.common.blocks.tiles.TileInfusionClaw; @@ -23,8 +24,6 @@ import thaumcraft.common.config.ConfigItems; import thaumcraft.common.entities.projectile.EntityPrimalOrb; import thaumcraft.common.items.wands.ItemWandCasting; -import java.util.Random; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -104,8 +103,8 @@ public class RenderTileInfusionClaw extends TileEntitySpecialRenderer { tile.animationStates[9] = -tile.animationStates[9]; ItemStack wandStack = tile.getStackInSlot(0); - if(wandStack != null) { - tile.animationStates[11] = ((ItemWandCasting)wandStack.getItem()).isStaff(wandStack) ? 0.5f : 0.1f; + if (wandStack != null) { + tile.animationStates[11] = ((ItemWandCasting) wandStack.getItem()).isStaff(wandStack) ? 0.5f : 0.1f; } } } else if (tile.animationStates[9] < 0) { @@ -116,7 +115,6 @@ public class RenderTileInfusionClaw extends TileEntitySpecialRenderer { } } - for (int i = 0; i < 4; i++) { GL11.glPushMatrix(); @@ -140,7 +138,7 @@ public class RenderTileInfusionClaw extends TileEntitySpecialRenderer { } private void renderWand(ItemStack wandStack, float ticks) { - GL11.glRotatef(((ticks/3) / 20.0F) * (180F / (float)Math.PI), 0, 1f, 0); + GL11.glRotatef(((ticks / 3) / 20.0F) * (180F / (float) Math.PI), 0, 1f, 0); this.renderTopPart(); @@ -156,7 +154,7 @@ public class RenderTileInfusionClaw extends TileEntitySpecialRenderer { GL11.glTranslatef(0, MathHelper.sin((ticks / 3) / 10.0F) * 0.08F + 0.08F, 0); GL11.glTranslatef(0, -1.4924f, 0); - if(item.isStaff(wandFocusStack)) { + if (item.isStaff(wandFocusStack)) { GL11.glTranslatef(0, -0.5f, 0); RenderTileInfusionClaw.STAFF_RENDERER.renderItem(IItemRenderer.ItemRenderType.ENTITY, wandFocusStack); @@ -178,7 +176,7 @@ public class RenderTileInfusionClaw extends TileEntitySpecialRenderer { } private void renderPrimalOrb(TileInfusionClaw tile, float elapsed) { - if(tile.animationStates[11] > 0) { + if (tile.animationStates[11] > 0) { tile.animationStates[11] += elapsed / 70f; GL11.glPushMatrix(); @@ -193,27 +191,50 @@ public class RenderTileInfusionClaw extends TileEntitySpecialRenderer { GL11.glPopMatrix(); - if(0.75f - tile.animationStates[11] < -0.5f) { + if (0.75f - tile.animationStates[11] < -0.5f) { tile.animationStates[11] = 0; } } } private void createSideZap(TileInfusionClaw tile) { - for(int i = 2; i < 6; i++) { + for (int i = 2; i < 6; i++) { ForgeDirection dir = ForgeDirection.getOrientation(i); - this.createZap(tile, 0.5f + 0.5f*(float)dir.offsetX, 0.6f, 0.5f + 0.5f*(float)dir.offsetZ, 0.5f + dir.offsetX*0.2f, 0.2f, 0.5f + dir.offsetZ*0.2f); + this.createZap( + tile, + 0.5f + 0.5f * (float) dir.offsetX, + 0.6f, + 0.5f + 0.5f * (float) dir.offsetZ, + 0.5f + dir.offsetX * 0.2f, + 0.2f, + 0.5f + dir.offsetZ * 0.2f); this.playZapSound(tile.xCoord, tile.yCoord, tile.zCoord); } } - private void createZap(TileEntity tile, float startX, float startY, float startZ, float endX, float endY, float endZ) { - Thaumcraft.proxy.nodeBolt(Thaumcraft.proxy.getClientWorld(), tile.xCoord + startX, tile.yCoord + startY, tile.zCoord + startZ, - tile.xCoord + endX, tile.yCoord + endY, tile.zCoord + endZ); + private void createZap( + TileEntity tile, float startX, float startY, float startZ, float endX, float endY, float endZ) { + Thaumcraft.proxy.nodeBolt( + Thaumcraft.proxy.getClientWorld(), + tile.xCoord + startX, + tile.yCoord + startY, + tile.zCoord + startZ, + tile.xCoord + endX, + tile.yCoord + endY, + tile.zCoord + endZ); } private void playZapSound(float x, float y, float z) { - Thaumcraft.proxy.getClientWorld().playSound(x, y, z, "thaumcraft:zap", 0.1F, 1.0F + Thaumcraft.proxy.getClientWorld().rand.nextFloat() * 0.2F, false); + Thaumcraft.proxy + .getClientWorld() + .playSound( + x, + y, + z, + "thaumcraft:zap", + 0.1F, + 1.0F + Thaumcraft.proxy.getClientWorld().rand.nextFloat() * 0.2F, + false); } private void renderSides(TileInfusionClaw tile, World world, int x, int y, int z, float elapsed) { @@ -242,7 +263,8 @@ public class RenderTileInfusionClaw extends TileEntitySpecialRenderer { float widthMove = this.getNextMoveOffset(tile, i + 4, speed, elapsed); ForgeDirection dir = ForgeDirection.getOrientation(i + 2); - boolean powered = world != null && world.getIndirectPowerLevelTo(x + dir.offsetX, y, z + dir.offsetZ, dir.ordinal()) > 0; + boolean powered = world != null + && world.getIndirectPowerLevelTo(x + dir.offsetX, y, z + dir.offsetZ, dir.ordinal()) > 0; GL11.glPushMatrix(); diff --git a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileKnowledgeBook.java b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileKnowledgeBook.java index 6d87f19..0aa4bfe 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileKnowledgeBook.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileKnowledgeBook.java @@ -16,12 +16,13 @@ import org.lwjgl.opengl.GL11; */ public class RenderTileKnowledgeBook extends TileEntitySpecialRenderer { - private static final ResourceLocation bookTexture = new ResourceLocation("minecraft", "textures/entity/enchanting_table_book.png"); + private static final ResourceLocation bookTexture = + new ResourceLocation("minecraft", "textures/entity/enchanting_table_book.png"); private static final ModelBook modelBook = new ModelBook(); @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTicks) { - if(te == null || !(te instanceof TileKnowledgeBook)) return; + if (te == null || !(te instanceof TileKnowledgeBook)) return; this.renderFloatingBook((TileKnowledgeBook) te, x, y, z, partialTicks); } @@ -30,51 +31,52 @@ public class RenderTileKnowledgeBook extends TileEntitySpecialRenderer { TileKnowledgeBook.FloatingBookAttributes attributes = te.getBookAttributes(); GL11.glPushMatrix(); - GL11.glTranslatef((float)x + 0.5F, (float)y + 0.1F, (float)z + 0.5F); - float f1 = (float)attributes.field_145926_a + partialTicks; + GL11.glTranslatef((float) x + 0.5F, (float) y + 0.1F, (float) z + 0.5F); + float f1 = (float) attributes.field_145926_a + partialTicks; GL11.glTranslatef(0.0F, 0.1F + MathHelper.sin(f1 * 0.1F) * 0.03F, 0.0F); float f2; - for (f2 = attributes.field_145928_o - attributes.field_145925_p; f2 >= (float)Math.PI; f2 -= ((float)Math.PI * 2F)) {} + for (f2 = attributes.field_145928_o - attributes.field_145925_p; + f2 >= (float) Math.PI; + f2 -= ((float) Math.PI * 2F)) {} - while (f2 < -(float)Math.PI) - { - f2 += ((float)Math.PI * 2F); + while (f2 < -(float) Math.PI) { + f2 += ((float) Math.PI * 2F); } float f3 = attributes.field_145925_p + f2 * partialTicks; - GL11.glRotatef(-f3 * 180.0F / (float)Math.PI, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-f3 * 180.0F / (float) Math.PI, 0.0F, 1.0F, 0.0F); GL11.glRotatef(80.0F, 0.0F, 0.0F, 1.0F); this.bindTexture(RenderTileKnowledgeBook.bookTexture); - float f4 = attributes.field_145931_j + (attributes.field_145933_i - attributes.field_145931_j) * partialTicks + 0.25F; - float f5 = attributes.field_145931_j + (attributes.field_145933_i - attributes.field_145931_j) * partialTicks + 0.75F; - f4 = (f4 - (float)MathHelper.truncateDoubleToInt(f4)) * 1.6F - 0.3F; - f5 = (f5 - (float)MathHelper.truncateDoubleToInt(f5)) * 1.6F - 0.3F; + float f4 = attributes.field_145931_j + + (attributes.field_145933_i - attributes.field_145931_j) * partialTicks + + 0.25F; + float f5 = attributes.field_145931_j + + (attributes.field_145933_i - attributes.field_145931_j) * partialTicks + + 0.75F; + f4 = (f4 - (float) MathHelper.truncateDoubleToInt(f4)) * 1.6F - 0.3F; + f5 = (f5 - (float) MathHelper.truncateDoubleToInt(f5)) * 1.6F - 0.3F; - if (f4 < 0.0F) - { + if (f4 < 0.0F) { f4 = 0.0F; } - if (f5 < 0.0F) - { + if (f5 < 0.0F) { f5 = 0.0F; } - if (f4 > 1.0F) - { + if (f4 > 1.0F) { f4 = 1.0F; } - if (f5 > 1.0F) - { + if (f5 > 1.0F) { f5 = 1.0F; } - //float f6 = attributes.field_145927_n + (attributes.field_145930_m - attributes.field_145927_n) * partialTicks; We don't want it to close.. + // float f6 = attributes.field_145927_n + (attributes.field_145930_m - attributes.field_145927_n) * + // partialTicks; We don't want it to close.. GL11.glEnable(GL11.GL_CULL_FACE); RenderTileKnowledgeBook.modelBook.render(null, 45F, f4, f5, 0.9F, 0.0F, 0.0625F); GL11.glPopMatrix(); } - } diff --git a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileManipulationFocus.java b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileManipulationFocus.java index eb457c7..973728f 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileManipulationFocus.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileManipulationFocus.java @@ -27,12 +27,12 @@ public class RenderTileManipulationFocus extends TileEntitySpecialRenderer { this.bindTexture(new SimpleResourceLocation("models/manipulation_focus_" + tile.getBlockMetadata() + ".png")); GL11.glRotatef(180, 1, 0, 0); - GL11.glTranslatef(0.5f, -1.5f + (2/16f), -0.5f); + GL11.glTranslatef(0.5f, -1.5f + (2 / 16f), -0.5f); - if(tile.getBlockMetadata() == 0 || tile.getBlockMetadata() == 3) { + if (tile.getBlockMetadata() == 0 || tile.getBlockMetadata() == 3) { GL11.glPushMatrix(); - for(int i = 0; i < 4; i++) { - if(tile.getBlockMetadata() == 0) { + for (int i = 0; i < 4; i++) { + if (tile.getBlockMetadata() == 0) { RenderTileManipulationFocus.RANDOM_FOCUS.render(null, 0, 0, 0, 0, 0, 0.0625f); } else { RenderTileManipulationFocus.PORTAL_FOCUS.render(null, 0, 0, 0, 0, 0, 0.0625f); @@ -48,6 +48,6 @@ public class RenderTileManipulationFocus extends TileEntitySpecialRenderer { @Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) { - this.renderTileEntityAt((TileManipulationFocus)tile, x, y, z, partialTicks); + this.renderTileEntityAt((TileManipulationFocus) tile, x, y, z, partialTicks); } } diff --git a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileManipulatorPillar.java b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileManipulatorPillar.java index 0f3144d..a6c0cb8 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileManipulatorPillar.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileManipulatorPillar.java @@ -1,5 +1,6 @@ package makeo.gadomancy.client.renderers.tile; +import java.util.Map; import makeo.gadomancy.common.utils.Injector; import makeo.gadomancy.common.utils.SimpleResourceLocation; import net.minecraft.tileentity.TileEntity; @@ -7,8 +8,6 @@ import net.minecraft.util.ResourceLocation; import thaumcraft.client.lib.UtilsFX; import thaumcraft.client.renderers.tile.TileInfusionPillarRenderer; -import java.util.Map; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -20,15 +19,18 @@ import java.util.Map; public class RenderTileManipulatorPillar extends TileInfusionPillarRenderer { private static final String TC_TEXTURE = "textures/models/pillar.png"; private static final ResourceLocation TEXTURE = new SimpleResourceLocation("models/manipulator_pillar.png"); - private static final Map BOUND_TEXTURES = new Injector(UtilsFX.class).getField("boundTextures"); + private static final Map BOUND_TEXTURES = + new Injector(UtilsFX.class).getField("boundTextures"); @Override public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8) { - ResourceLocation originalTexture = RenderTileManipulatorPillar.BOUND_TEXTURES.get(RenderTileManipulatorPillar.TC_TEXTURE); - RenderTileManipulatorPillar.BOUND_TEXTURES.put(RenderTileManipulatorPillar.TC_TEXTURE, RenderTileManipulatorPillar.TEXTURE); + ResourceLocation originalTexture = + RenderTileManipulatorPillar.BOUND_TEXTURES.get(RenderTileManipulatorPillar.TC_TEXTURE); + RenderTileManipulatorPillar.BOUND_TEXTURES.put( + RenderTileManipulatorPillar.TC_TEXTURE, RenderTileManipulatorPillar.TEXTURE); super.renderTileEntityAt(par1TileEntity, par2, par4, par6, par8); - if(originalTexture != null) { + if (originalTexture != null) { RenderTileManipulatorPillar.BOUND_TEXTURES.put(RenderTileManipulatorPillar.TC_TEXTURE, originalTexture); } else { RenderTileManipulatorPillar.BOUND_TEXTURES.remove(RenderTileManipulatorPillar.TC_TEXTURE); diff --git a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileNodeBasic.java b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileNodeBasic.java index cdd9538..fe589a9 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileNodeBasic.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileNodeBasic.java @@ -45,14 +45,26 @@ public class RenderTileNodeBasic { public static final ResourceLocation nodetex = new ResourceLocation("thaumcraft", "textures/misc/nodes.png"); - //Gadomancy: changed params x, y, z from int to double - public static void renderNode(EntityLivingBase viewer, double viewDistance, boolean visible, boolean depthIgnore, float size, double x, double y, double z, float partialTicks, AspectList aspects, NodeType type, NodeModifier mod) { + // Gadomancy: changed params x, y, z from int to double + public static void renderNode( + EntityLivingBase viewer, + double viewDistance, + boolean visible, + boolean depthIgnore, + float size, + double x, + double y, + double z, + float partialTicks, + AspectList aspects, + NodeType type, + NodeModifier mod) { long nt = System.nanoTime(); UtilsFX.bindTexture(RenderTileNodeBasic.nodetex); int frames = 32; if ((aspects.size() > 0) && (visible)) { - double distance = viewer.getDistance(x, y, z); //Gadomancy: Removed '+ 0.5D' to coords. + double distance = viewer.getDistance(x, y, z); // Gadomancy: Removed '+ 0.5D' to coords. if (distance > viewDistance) { return; } @@ -84,7 +96,6 @@ public class RenderTileNodeBasic { float rad = 6.283186F; GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha); - int i = (int) ((nt / 40000000L + x) % frames); int count = 0; @@ -103,8 +114,19 @@ public class RenderTileNodeBasic { scale = 0.2F + scale * (aspects.getAmount(aspect) / 50.0F); scale *= size; angle = (float) (time % (5000 + 500 * count)) / (5000.0F + 500 * count) * rad; - //Gadomancy (following line): Removed '+ 0.5D' to coords. - UtilsFX.renderFacingStrip(x, y, z, angle, scale, alpha / Math.max(1.0F, aspects.size() / 2.0F), frames, 0, i, partialTicks, aspect.getColor()); + // Gadomancy (following line): Removed '+ 0.5D' to coords. + UtilsFX.renderFacingStrip( + x, + y, + z, + angle, + scale, + alpha / Math.max(1.0F, aspects.size() / 2.0F), + frames, + 0, + i, + partialTicks, + aspect.getColor()); GL11.glDisable(3042); GL11.glPopMatrix(); count++; @@ -146,7 +168,7 @@ public class RenderTileNodeBasic { strip = 3; } GL11.glColor4f(1.0F, 0.0F, 1.0F, alpha); - //Gadomancy (following line): Removed '+ 0.5D' to coords. + // Gadomancy (following line): Removed '+ 0.5D' to coords. UtilsFX.renderFacingStrip(x, y, z, angle, scale, alpha, frames, strip, i, partialTicks, 16777215); GL11.glDisable(3042); GL11.glPopMatrix(); @@ -169,7 +191,7 @@ public class RenderTileNodeBasic { int i = (int) ((nt / 40000000L + x) % frames); GL11.glColor4f(1.0F, 0.0F, 1.0F, 0.1F); - //Gadomancy (following line): Removed '+ 0.5D' to coords. + // Gadomancy (following line): Removed '+ 0.5D' to coords. UtilsFX.renderFacingStrip(x, y, z, 0.0F, 0.5F, 0.1F, frames, 1, i, partialTicks, 16777215); GL11.glDepthMask(true); @@ -179,19 +201,20 @@ public class RenderTileNodeBasic { } } - //Gadomancy START + // Gadomancy START public static void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) { RenderTileNodeBasic.renderTileEntityAt(tile, x, y, z, partialTicks, 1.0F); } - //Gadomancy END + // Gadomancy END - //Gadomancy: Added dynamic size - public static void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks, float size) { - //Gadomancy Added event hook + // Gadomancy: Added dynamic size + public static void renderTileEntityAt( + TileEntity tile, double x, double y, double z, float partialTicks, float size) { + // Gadomancy Added event hook EventHandlerRedirect.preNodeRender(tile); if (!(tile instanceof INode)) { - //Gadomancy Added event hook + // Gadomancy Added event hook EventHandlerRedirect.postNodeRender(tile); return; } @@ -203,12 +226,21 @@ public class RenderTileNodeBasic { if ((viewer instanceof EntityPlayer)) { if ((tile != null) && ((tile instanceof TileJarNode))) { condition = true; - size = (float) ((size * 7D) / 10D); //Gadomancy: Node size is 70% of the default size in standart TC. calculating the same here. - } else if ((((EntityPlayer) viewer).inventory.armorItemInSlot(3) != null) && ((((EntityPlayer) viewer).inventory.armorItemInSlot(3).getItem() instanceof IRevealer)) && (((IRevealer) ((EntityPlayer) viewer).inventory.armorItemInSlot(3).getItem()).showNodes(((EntityPlayer) viewer).inventory.armorItemInSlot(3), viewer))) { + size = (float) ((size * 7D) + / 10D); // Gadomancy: Node size is 70% of the default size in standart TC. calculating the same + // here. + } else if ((((EntityPlayer) viewer).inventory.armorItemInSlot(3) != null) + && ((((EntityPlayer) viewer).inventory.armorItemInSlot(3).getItem() instanceof IRevealer)) + && (((IRevealer) ((EntityPlayer) viewer) + .inventory + .armorItemInSlot(3) + .getItem()) + .showNodes(((EntityPlayer) viewer).inventory.armorItemInSlot(3), viewer))) { condition = true; depthIgnore = true; - } else if ((((EntityPlayer) viewer).inventory.getCurrentItem() != null) && ((((EntityPlayer) viewer).inventory.getCurrentItem().getItem() instanceof ItemThaumometer))) { - //Gadomancy: Changed from tile.xCoord, ... to x, y, z to make it dependent from params + } else if ((((EntityPlayer) viewer).inventory.getCurrentItem() != null) + && ((((EntityPlayer) viewer).inventory.getCurrentItem().getItem() instanceof ItemThaumometer))) { + // Gadomancy: Changed from tile.xCoord, ... to x, y, z to make it dependent from params if (UtilsFX.isVisibleTo(0.44F, viewer, x, y, z)) { condition = true; depthIgnore = true; @@ -216,15 +248,29 @@ public class RenderTileNodeBasic { } } } - //Gadomancy: Changed from tile.xCoord, ... to x, y, z to make it dependent from params - RenderTileNodeBasic.renderNode(viewer, viewDistance, condition, depthIgnore, size, x, y, z, partialTicks, ((INode) tile).getAspects(), ((INode) tile).getNodeType(), ((INode) tile).getNodeModifier()); - if (((tile instanceof TileNode)) && (((TileNode) tile).drainEntity != null) && (((TileNode) tile).drainCollision != null)) { + // Gadomancy: Changed from tile.xCoord, ... to x, y, z to make it dependent from params + RenderTileNodeBasic.renderNode( + viewer, + viewDistance, + condition, + depthIgnore, + size, + x, + y, + z, + partialTicks, + ((INode) tile).getAspects(), + ((INode) tile).getNodeType(), + ((INode) tile).getNodeModifier()); + if (((tile instanceof TileNode)) + && (((TileNode) tile).drainEntity != null) + && (((TileNode) tile).drainCollision != null)) { Entity drainEntity = ((TileNode) tile).drainEntity; if (((drainEntity instanceof EntityPlayer)) && (!((EntityPlayer) drainEntity).isUsingItem())) { ((TileNode) tile).drainEntity = null; ((TileNode) tile).drainCollision = null; - //Gadomancy Added event hook + // Gadomancy Added event hook EventHandlerRedirect.postNodeRender(tile); return; } @@ -237,8 +283,14 @@ public class RenderTileNodeBasic { f10 = MathHelper.sin(iiud / 10.0F) * 10.0F; } Vec3 vec3 = Vec3.createVectorHelper(-0.1D, -0.1D, 0.5D); - vec3.rotateAroundX(-(drainEntity.prevRotationPitch + (drainEntity.rotationPitch - drainEntity.prevRotationPitch) * partialTicks) * 3.141593F / 180.0F); - vec3.rotateAroundY(-(drainEntity.prevRotationYaw + (drainEntity.rotationYaw - drainEntity.prevRotationYaw) * partialTicks) * 3.141593F / 180.0F); + vec3.rotateAroundX(-(drainEntity.prevRotationPitch + + (drainEntity.rotationPitch - drainEntity.prevRotationPitch) * partialTicks) + * 3.141593F + / 180.0F); + vec3.rotateAroundY(-(drainEntity.prevRotationYaw + + (drainEntity.rotationYaw - drainEntity.prevRotationYaw) * partialTicks) + * 3.141593F + / 180.0F); vec3.rotateAroundY(-f10 * 0.01F); vec3.rotateAroundX(-f10 * 0.015F); double d3 = drainEntity.prevPosX + (drainEntity.posX - drainEntity.prevPosX) * partialTicks + vec3.xCoord; @@ -246,13 +298,23 @@ public class RenderTileNodeBasic { double d5 = drainEntity.prevPosZ + (drainEntity.posZ - drainEntity.prevPosZ) * partialTicks + vec3.zCoord; double d6 = drainEntity == Minecraft.getMinecraft().thePlayer ? 0.0D : drainEntity.getEyeHeight(); - UtilsFX.drawFloatyLine(d3, d4 + d6, d5, drainCollision.blockX + 0.5D, drainCollision.blockY + 0.5D, drainCollision.blockZ + 0.5D, partialTicks, ((TileNode) tile).color.getRGB(), "textures/misc/wispy.png", -0.02F, Math.min(iiud, 10) / 10.0F); + UtilsFX.drawFloatyLine( + d3, + d4 + d6, + d5, + drainCollision.blockX + 0.5D, + drainCollision.blockY + 0.5D, + drainCollision.blockZ + 0.5D, + partialTicks, + ((TileNode) tile).color.getRGB(), + "textures/misc/wispy.png", + -0.02F, + Math.min(iiud, 10) / 10.0F); GL11.glPopMatrix(); } - //Gadomancy Added event hook + // Gadomancy Added event hook EventHandlerRedirect.postNodeRender(tile); } - } diff --git a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileNodeManipulator.java b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileNodeManipulator.java index 65415ae..709d2f7 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileNodeManipulator.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileNodeManipulator.java @@ -31,11 +31,11 @@ public class RenderTileNodeManipulator extends TileWandPedestalRenderer { Minecraft.getMinecraft().renderEngine.bindTexture(RenderTileNodeManipulator.TEXTURE); - for(int i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { GL11.glPushMatrix(); ForgeDirection dir = ForgeDirection.getOrientation(i + 2); - GL11.glTranslatef(dir.offsetX * (-6/16f), 0, dir.offsetZ * (-6/16f)); + GL11.glTranslatef(dir.offsetX * (-6 / 16f), 0, dir.offsetZ * (-6 / 16f)); RenderTileNodeManipulator.MODEL.render(null, 0, 0, 0, 0, 0, 0.0625f); GL11.glPopMatrix(); diff --git a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileObelisk.java b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileObelisk.java index 6f999a9..d38ec8d 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileObelisk.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileObelisk.java @@ -16,7 +16,7 @@ import thaumcraft.common.config.Config; public class RenderTileObelisk extends TileEldritchObeliskRenderer { @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) { - if(te.getWorldObj().provider.dimensionId == ModConfig.dimOuterId) { + if (te.getWorldObj().provider.dimensionId == ModConfig.dimOuterId) { int old = Config.dimensionOuterId; Config.dimensionOuterId = ModConfig.dimOuterId; super.renderTileEntityAt(te, x, y, z, f); diff --git a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileRemoteJar.java b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileRemoteJar.java index 736b101..2822725 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileRemoteJar.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileRemoteJar.java @@ -33,15 +33,20 @@ public class RenderTileRemoteJar extends TileJarRenderer { GL11.glPushMatrix(); - GL11.glTranslatef(0.45f/2, 0.003f, 0.45f/2); + GL11.glTranslatef(0.45f / 2, 0.003f, 0.45f / 2); GL11.glScalef(0.55f, 1, 0.55f); TileMirrorRenderer renderer = new TileMirrorRenderer(); renderer.func_147497_a(this.field_147501_a); - if(this.field_147501_a.field_147553_e != null) { - renderer.renderTileEntityAt(this.createFakeTile(tile, BlockRemoteJar.getJarTile(tile).networkId != null), 0, 0, 0, partialTicks); + if (this.field_147501_a.field_147553_e != null) { + renderer.renderTileEntityAt( + this.createFakeTile(tile, BlockRemoteJar.getJarTile(tile).networkId != null), + 0, + 0, + 0, + partialTicks); } GL11.glPopMatrix(); @@ -55,9 +60,8 @@ public class RenderTileRemoteJar extends TileJarRenderer { GL11.glScalef(1.002f, 1f, 1.002f); - GL11.glTranslatef(0, -1.5f, 0); - //GL11.glRotatef(180, 1f, 0, 0); + // GL11.glRotatef(180, 1f, 0, 0); RenderTileRemoteJar.MODEL_JAR_POT.render(null, 0f, 0f, 0f, 0f, 0f, 0.0625f); @@ -72,13 +76,13 @@ public class RenderTileRemoteJar extends TileJarRenderer { fake.linked = linked; fake.blockMetadata = 7; - if(tile.getWorldObj() == null) { + if (tile.getWorldObj() == null) { fake.setWorldObj(new FakeWorld()); } else { fake.setWorldObj(tile.getWorldObj()); } - if(tile.getWorldObj() instanceof FakeWorld) { + if (tile.getWorldObj() instanceof FakeWorld) { EntityPlayer p = Minecraft.getMinecraft().thePlayer; fake.xCoord = (int) p.posX; fake.yCoord = (int) p.posY; diff --git a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileStickyJar.java b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileStickyJar.java index 4ee9d1b..6ae9663 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileStickyJar.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileStickyJar.java @@ -26,7 +26,7 @@ public class RenderTileStickyJar extends TileEntitySpecialRenderer { @Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) { - if(tile != null && tile instanceof TileStickyJar && ((TileStickyJar) tile).isValid()) { + if (tile != null && tile instanceof TileStickyJar && ((TileStickyJar) tile).isValid()) { TileStickyJar stickyJar = (TileStickyJar) tile; TileJarFillable parent = stickyJar.getParent(); @@ -38,9 +38,9 @@ public class RenderTileStickyJar extends TileEntitySpecialRenderer { GL11.glTranslated(x, y, z); this.rotateJar(stickyJar.placedOn, ForgeDirection.getOrientation(stickyJar.facing)); - //TESR + // TESR TileEntitySpecialRenderer renderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(parent); - if(renderer != null) { + if (renderer != null) { stickyJar.syncToParent(); renderer.renderTileEntityAt(parent, 0, 0, 0, partialTicks); @@ -48,7 +48,7 @@ public class RenderTileStickyJar extends TileEntitySpecialRenderer { stickyJar.syncFromParent(); } - //ISimpleBlockHandler + // ISimpleBlockHandler GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); @@ -62,7 +62,8 @@ public class RenderTileStickyJar extends TileEntitySpecialRenderer { Tessellator tess = Tessellator.instance; tess.startDrawingQuads(); - tess.setNormal(0, -stickyJar.placedOn.offsetY, -Math.abs(stickyJar.placedOn.offsetZ + stickyJar.placedOn.offsetX)); + tess.setNormal( + 0, -stickyJar.placedOn.offsetY, -Math.abs(stickyJar.placedOn.offsetZ + stickyJar.placedOn.offsetX)); tess.setTranslation(-tile.xCoord, -tile.yCoord, -tile.zCoord); @@ -79,20 +80,28 @@ public class RenderTileStickyJar extends TileEntitySpecialRenderer { } private void rotateJar(ForgeDirection placedOn, ForgeDirection facing) { - if(placedOn == ForgeDirection.UP) { + if (placedOn == ForgeDirection.UP) { GL11.glTranslatef(Math.abs(facing.offsetZ), 1, Math.abs(facing.offsetX)); GL11.glRotatef(180, facing.offsetX, 0, facing.offsetZ); - } else if(placedOn != ForgeDirection.DOWN) { + } else if (placedOn != ForgeDirection.DOWN) { GL11.glTranslatef(0.5f, 0.5f, 0.5f); GL11.glRotatef(90, placedOn.offsetZ * -1, 0, placedOn.offsetX); switch (placedOn) { - case NORTH: GL11.glRotatef(0, 0, 1, 0); break; - case EAST: GL11.glRotatef(-90, 0, 1, 0); break; - case SOUTH: GL11.glRotatef(180, 0, 1, 0); break; - case WEST: GL11.glRotatef(90, 0, 1, 0); break; - default: - break; + case NORTH: + GL11.glRotatef(0, 0, 1, 0); + break; + case EAST: + GL11.glRotatef(-90, 0, 1, 0); + break; + case SOUTH: + GL11.glRotatef(180, 0, 1, 0); + break; + case WEST: + GL11.glRotatef(90, 0, 1, 0); + break; + default: + break; } GL11.glTranslatef(-0.5f, -0.5f, -0.5f); diff --git a/src/main/java/makeo/gadomancy/client/textures/BaseTexture.java b/src/main/java/makeo/gadomancy/client/textures/BaseTexture.java index 56defa9..a0a4eb0 100644 --- a/src/main/java/makeo/gadomancy/client/textures/BaseTexture.java +++ b/src/main/java/makeo/gadomancy/client/textures/BaseTexture.java @@ -1,15 +1,14 @@ package makeo.gadomancy.client.textures; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; +import javax.imageio.ImageIO; import net.minecraft.client.renderer.texture.SimpleTexture; import net.minecraft.client.resources.IResource; import net.minecraft.client.resources.IResourceManager; import net.minecraft.util.ResourceLocation; -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.io.InputStream; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -30,8 +29,7 @@ public abstract class BaseTexture extends SimpleTexture { IResource iresource = resourceManager.getResource(location); inputstream = iresource.getInputStream(); return ImageIO.read(inputstream); - } - finally { + } finally { if (inputstream != null) { inputstream.close(); } diff --git a/src/main/java/makeo/gadomancy/client/textures/GolemGuiTexture.java b/src/main/java/makeo/gadomancy/client/textures/GolemGuiTexture.java index b792500..0a062eb 100644 --- a/src/main/java/makeo/gadomancy/client/textures/GolemGuiTexture.java +++ b/src/main/java/makeo/gadomancy/client/textures/GolemGuiTexture.java @@ -1,5 +1,11 @@ package makeo.gadomancy.client.textures; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import javax.imageio.ImageIO; import makeo.gadomancy.api.GadomancyApi; import makeo.gadomancy.api.golems.AdditionalGolemType; import net.minecraft.client.renderer.texture.TextureUtil; @@ -11,13 +17,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import thaumcraft.common.entities.golems.EnumGolemType; -import javax.imageio.ImageIO; -import java.awt.*; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -43,8 +42,7 @@ public class GolemGuiTexture extends BaseTexture { this.deleteGlTexture(); InputStream inputstream = null; - try - { + try { IResource iresource = resourceManager.getResource(this.textureLocation); inputstream = iresource.getInputStream(); BufferedImage bufferedimage = this.manipulateImage(resourceManager, ImageIO.read(inputstream)); @@ -52,30 +50,24 @@ public class GolemGuiTexture extends BaseTexture { boolean flag = false; boolean flag1 = false; - if (iresource.hasMetadata()) - { - try - { - TextureMetadataSection texturemetadatasection = (TextureMetadataSection)iresource.getMetadata("texture"); + if (iresource.hasMetadata()) { + try { + TextureMetadataSection texturemetadatasection = + (TextureMetadataSection) iresource.getMetadata("texture"); - if (texturemetadatasection != null) - { + if (texturemetadatasection != null) { flag = texturemetadatasection.getTextureBlur(); flag1 = texturemetadatasection.getTextureClamp(); } - } - catch (RuntimeException runtimeexception) - { - GolemGuiTexture.LOGGER.warn("Failed reading metadata of: " + this.textureLocation, runtimeexception); + } catch (RuntimeException runtimeexception) { + GolemGuiTexture.LOGGER.warn( + "Failed reading metadata of: " + this.textureLocation, runtimeexception); } } TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1); - } - finally - { - if (inputstream != null) - { + } finally { + if (inputstream != null) { inputstream.close(); } } @@ -86,41 +78,43 @@ public class GolemGuiTexture extends BaseTexture { List types = GadomancyApi.getAdditionalGolemTypes(); - int newHeight = (24*scale) * (this.getMaxOrdinal() + 1); - BufferedImage newImg = new BufferedImage(image.getWidth(), newHeight < image.getHeight() ? image.getHeight() : newHeight, image.getType()); + int newHeight = (24 * scale) * (this.getMaxOrdinal() + 1); + BufferedImage newImg = new BufferedImage( + image.getWidth(), newHeight < image.getHeight() ? image.getHeight() : newHeight, image.getType()); - for(int x = 0; x < image.getWidth(); x++) { - for(int y = 0; y < image.getHeight(); y++) { + for (int x = 0; x < image.getWidth(); x++) { + for (int y = 0; y < image.getHeight(); y++) { newImg.setRGB(x, y, image.getRGB(x, y)); } } - for(AdditionalGolemType type : types) { + for (AdditionalGolemType type : types) { try { int ordinal = type.getEnumEntry().ordinal(); BufferedImage slotImg = this.loadImage(resourceManager, type.getInvSlotTexture()); - float slotScale = (24*scale) / (float)slotImg.getWidth(); + float slotScale = (24 * scale) / (float) slotImg.getWidth(); - if(slotScale > 1) { + if (slotScale > 1) { slotImg = this.scaleImage(slotImg, slotScale, slotScale); } - for(int x = 0; x < slotImg.getWidth(); x++) { - for(int y = 0; y < slotImg.getHeight(); y++) { - newImg.setRGB((184*scale) + x, ordinal * (24*scale) + y, slotImg.getRGB(x, y)); + for (int x = 0; x < slotImg.getWidth(); x++) { + for (int y = 0; y < slotImg.getHeight(); y++) { + newImg.setRGB((184 * scale) + x, ordinal * (24 * scale) + y, slotImg.getRGB(x, y)); } } } catch (IOException e) { - GolemGuiTexture.LOGGER.warn("Failed loading golem inventory slot texture of: " + type.getModId() + ":" + type.getName()); + GolemGuiTexture.LOGGER.warn( + "Failed loading golem inventory slot texture of: " + type.getModId() + ":" + type.getName()); } } return newImg; } private BufferedImage scaleImage(BufferedImage input, float xScale, float yScale) { - int newX = (int) (input.getWidth()*xScale); - int newY = (int) (input.getHeight()*yScale); + int newX = (int) (input.getWidth() * xScale); + int newY = (int) (input.getHeight() * yScale); Image temp = input.getScaledInstance(newX, newY, Image.SCALE_REPLICATE); @@ -135,33 +129,11 @@ public class GolemGuiTexture extends BaseTexture { private int getMaxOrdinal() { int max = 0; - for(EnumGolemType type : EnumGolemType.values()) { - if(type.ordinal() > max) { + for (EnumGolemType type : EnumGolemType.values()) { + if (type.ordinal() > max) { max = type.ordinal(); } } return max; } } - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/java/makeo/gadomancy/client/transformation/FakeEntityGolemBase.java b/src/main/java/makeo/gadomancy/client/transformation/FakeEntityGolemBase.java index f04d2fe..95c2bc6 100644 --- a/src/main/java/makeo/gadomancy/client/transformation/FakeEntityGolemBase.java +++ b/src/main/java/makeo/gadomancy/client/transformation/FakeEntityGolemBase.java @@ -31,7 +31,7 @@ public class FakeEntityGolemBase extends EntityGolemBase { this.player = player; } - //Golem stuff + // Golem stuff @Override public String getGolemDecoration() { return this.golem.getGolemDecoration(); @@ -62,7 +62,7 @@ public class FakeEntityGolemBase extends EntityGolemBase { return this.golem.getUpgradeAmount(type); } - //Player stuff + // Player stuff @Override public float getEyeHeight() { return this.player.getEyeHeight(); @@ -161,11 +161,11 @@ public class FakeEntityGolemBase extends EntityGolemBase { this.itemCarried = this.player.getHeldItem(); - if(this.player.isSwingInProgress) { - if(this.player.getHeldItem() == null) { + if (this.player.isSwingInProgress) { + if (this.player.getHeldItem() == null) { this.action = 6 - this.player.swingProgressInt; } else { - this.rightArm = 5 - (int)(this.player.swingProgress * 5); + this.rightArm = 5 - (int) (this.player.swingProgress * 5); } } else { this.action = 0; diff --git a/src/main/java/makeo/gadomancy/client/transformation/TransformationHelper.java b/src/main/java/makeo/gadomancy/client/transformation/TransformationHelper.java index efacefd..12704dc 100644 --- a/src/main/java/makeo/gadomancy/client/transformation/TransformationHelper.java +++ b/src/main/java/makeo/gadomancy/client/transformation/TransformationHelper.java @@ -2,6 +2,9 @@ package makeo.gadomancy.client.transformation; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import makeo.gadomancy.client.renderers.entity.PlayerCameraRenderer; import makeo.gadomancy.common.network.PacketHandler; import makeo.gadomancy.common.network.packets.PacketAbortTransform; @@ -12,10 +15,6 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import thaumcraft.common.entities.golems.EntityGolemBase; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -48,7 +47,8 @@ public class TransformationHelper { public static boolean isTransformable() { Minecraft mc = Minecraft.getMinecraft(); - return mc.thePlayer.equals(mc.renderViewEntity) && !RegisteredIntegrations.morph.isMorphed() + return mc.thePlayer.equals(mc.renderViewEntity) + && !RegisteredIntegrations.morph.isMorphed() && mc.entityRenderer.getClass().equals(EntityRenderer.class) && (TransformationHelper.renderer == null || TransformationHelper.renderer.isRemoved()); } @@ -58,7 +58,7 @@ public class TransformationHelper { return !mc.renderViewEntity.equals(mc.thePlayer) || RegisteredIntegrations.morph.isMorphed() || (!mc.entityRenderer.getClass().equals(EntityRenderer.class) - && !(mc.entityRenderer instanceof PlayerCameraRenderer)); + && !(mc.entityRenderer instanceof PlayerCameraRenderer)); } public static boolean isTransformed() { @@ -66,24 +66,23 @@ public class TransformationHelper { } public static boolean isTransformed(EntityPlayer player) { - if(player.equals(Minecraft.getMinecraft().thePlayer)) - return TransformationHelper.isTransformed(); + if (player.equals(Minecraft.getMinecraft().thePlayer)) return TransformationHelper.isTransformed(); return TransformationHelper.getTransformedEntityId(player) != -1; } public static FakeEntityGolemBase getTransformedEntity(EntityPlayer player) { Integer entityId = TransformationHelper.transformedPlayers.get(player.getEntityId()); - if(entityId != null) { + if (entityId != null) { FakeEntityGolemBase golem = TransformationHelper.entityCache.get(entityId); - if(golem == null) { + if (golem == null) { EntityGolemBase rawGolem = TransformationHelper.findGolem(entityId); - if(rawGolem != null) { + if (rawGolem != null) { golem = new FakeEntityGolemBase(rawGolem, player); TransformationHelper.entityCache.put(entityId, golem); } } - if(golem != null) { + if (golem != null) { return golem; } } @@ -92,9 +91,9 @@ public class TransformationHelper { private static EntityGolemBase findGolem(int entityId) { List loaded = Minecraft.getMinecraft().thePlayer.worldObj.getLoadedEntityList(); - for(int i = 0; i < loaded.size(); i++) { + for (int i = 0; i < loaded.size(); i++) { Entity entity = loaded.get(i); - if(entity instanceof EntityGolemBase && entity.getEntityId() == entityId) { + if (entity instanceof EntityGolemBase && entity.getEntityId() == entityId) { return (EntityGolemBase) entity; } } @@ -115,15 +114,16 @@ public class TransformationHelper { } public static void cancelTransformation(PacketAbortTransform.AbortReason reason) { - if(TransformationHelper.isTransformed()) { + if (TransformationHelper.isTransformed()) { PacketHandler.INSTANCE.sendToServer(new PacketAbortTransform(reason)); - TransformationHelper.onAbortTransformation(Minecraft.getMinecraft().thePlayer.getEntityId()); + TransformationHelper.onAbortTransformation( + Minecraft.getMinecraft().thePlayer.getEntityId()); } } public static void onStartTransformation(int targetId, int appearanceId) { - if(Minecraft.getMinecraft().thePlayer.getEntityId() == targetId) { - if(TransformationHelper.isTransformable()) { + if (Minecraft.getMinecraft().thePlayer.getEntityId() == targetId) { + if (TransformationHelper.isTransformable()) { TransformationHelper.transformedPlayers.put(targetId, appearanceId); Minecraft mc = Minecraft.getMinecraft(); @@ -141,8 +141,8 @@ public class TransformationHelper { TransformationHelper.transformedPlayers.remove(targetId); TransformationHelper.entityCache.remove(targetId); - if(Minecraft.getMinecraft().thePlayer.getEntityId() == targetId && TransformationHelper.isTransformed()) { + if (Minecraft.getMinecraft().thePlayer.getEntityId() == targetId && TransformationHelper.isTransformed()) { TransformationHelper.renderer.markForRemoval(); } } -} \ No newline at end of file +} diff --git a/src/main/java/makeo/gadomancy/client/util/ExtendedTypeDisplayManager.java b/src/main/java/makeo/gadomancy/client/util/ExtendedTypeDisplayManager.java index 2c80f90..bfae71b 100644 --- a/src/main/java/makeo/gadomancy/client/util/ExtendedTypeDisplayManager.java +++ b/src/main/java/makeo/gadomancy/client/util/ExtendedTypeDisplayManager.java @@ -24,8 +24,8 @@ public class ExtendedTypeDisplayManager { private static String oldName; public static void notifyRenderTick() { - if(ExtendedTypeDisplayManager.currTime > ExtendedTypeDisplayManager.timeout) { - if(ExtendedTypeDisplayManager.changedLanguageFile) { + if (ExtendedTypeDisplayManager.currTime > ExtendedTypeDisplayManager.timeout) { + if (ExtendedTypeDisplayManager.changedLanguageFile) { ExtendedTypeDisplayManager.resetLanguageFile(); } } else { @@ -35,19 +35,20 @@ public class ExtendedTypeDisplayManager { private static void resetLanguageFile() { ExtendedTypeDisplayManager.currentNodeId = null; - ResourceReloadListener.languageList.put(ExtendedTypeDisplayManager.changedEntry, ExtendedTypeDisplayManager.oldName); + ResourceReloadListener.languageList.put( + ExtendedTypeDisplayManager.changedEntry, ExtendedTypeDisplayManager.oldName); ExtendedTypeDisplayManager.changedLanguageFile = false; } public static void notifyDisplayTick(String id, NodeType nodeType, ExtendedNodeType extendedNodeType) { ExtendedTypeDisplayManager.currTime = 0; - if(ExtendedTypeDisplayManager.currentNodeId != null && !ExtendedTypeDisplayManager.currentNodeId.equals(id)) { - //New node. + if (ExtendedTypeDisplayManager.currentNodeId != null && !ExtendedTypeDisplayManager.currentNodeId.equals(id)) { + // New node. ExtendedTypeDisplayManager.resetLanguageFile(); } - if(!ExtendedTypeDisplayManager.changedLanguageFile) { + if (!ExtendedTypeDisplayManager.changedLanguageFile) { String toChance = "nodetype." + nodeType + ".name"; String name = StatCollector.translateToLocal(toChance); String growingStr = StatCollector.translateToLocal("gadomancy.nodes." + extendedNodeType.name()); diff --git a/src/main/java/makeo/gadomancy/client/util/FamiliarHandlerClient.java b/src/main/java/makeo/gadomancy/client/util/FamiliarHandlerClient.java index 350a020..d56ce75 100644 --- a/src/main/java/makeo/gadomancy/client/util/FamiliarHandlerClient.java +++ b/src/main/java/makeo/gadomancy/client/util/FamiliarHandlerClient.java @@ -2,6 +2,10 @@ package makeo.gadomancy.client.util; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.lang.ref.WeakReference; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import makeo.gadomancy.client.renderers.item.ItemRenderFamiliar; import makeo.gadomancy.common.data.DataFamiliar; import makeo.gadomancy.common.network.packets.PacketFamiliarBolt; @@ -19,11 +23,6 @@ import thaumcraft.client.fx.bolt.FXLightningBolt; import thaumcraft.client.renderers.entity.RenderWisp; import thaumcraft.common.entities.monster.EntityWisp; -import java.lang.ref.WeakReference; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -43,15 +42,26 @@ public class FamiliarHandlerClient { @SideOnly(Side.CLIENT) public static void processBoltPacket(PacketFamiliarBolt pkt) { EntityPlayer p = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(pkt.owner); - if(p == null || p.getDistanceSqToEntity(Minecraft.getMinecraft().thePlayer) > 1024) return; //32^2 + if (p == null || p.getDistanceSqToEntity(Minecraft.getMinecraft().thePlayer) > 1024) return; // 32^2 ExFamiliarData data = FamiliarHandlerClient.clientFamiliars.get(p.getCommandSenderName()); - if(data == null) return; + if (data == null) return; PartialEntityFamiliar fam = data.familiar; float y = (float) (fam.posY + 1.22F); if (!Minecraft.getMinecraft().thePlayer.getCommandSenderName().equalsIgnoreCase(pkt.owner)) { y += 0.2F; } - FXLightningBolt bolt = new FXLightningBolt(Minecraft.getMinecraft().theWorld, (float) fam.posX, y, (float) fam.posZ, pkt.targetX, pkt.targetY, pkt.targetZ, Minecraft.getMinecraft().theWorld.rand.nextLong(), 10, 4.0F, 5); + FXLightningBolt bolt = new FXLightningBolt( + Minecraft.getMinecraft().theWorld, + (float) fam.posX, + y, + (float) fam.posZ, + pkt.targetX, + pkt.targetY, + pkt.targetZ, + Minecraft.getMinecraft().theWorld.rand.nextLong(), + 10, + 4.0F, + 5); bolt.defaultFractal(); bolt.setType(pkt.type); bolt.finalizeBolt(); @@ -60,18 +70,19 @@ public class FamiliarHandlerClient { @SideOnly(Side.CLIENT) public static void playerRenderEvent(EntityPlayer player, float partialTicks) { String ownerName = player.getCommandSenderName(); - if(!FamiliarHandlerClient.clientFamiliars.containsKey(ownerName)) return; + if (!FamiliarHandlerClient.clientFamiliars.containsKey(ownerName)) return; ExFamiliarData data = FamiliarHandlerClient.clientFamiliars.get(ownerName); PartialEntityFamiliar fam = data.familiar; Aspect aspect = Aspect.getAspect(data.data.aspectTag); - if(FamiliarHandlerClient.ENTITY_WISP == null) FamiliarHandlerClient.ENTITY_WISP = new EntityWisp(new FakeWorld()); + if (FamiliarHandlerClient.ENTITY_WISP == null) + FamiliarHandlerClient.ENTITY_WISP = new EntityWisp(new FakeWorld()); FamiliarHandlerClient.ENTITY_WISP.setType(aspect.getTag()); FamiliarHandlerClient.ENTITY_WISP.ticksExisted = fam.dummyEntity.ticksExisted; GL11.glPushMatrix(); - if(fam.owner == null || fam.owner.get() == null) { + if (fam.owner == null || fam.owner.get() == null) { fam.owner = new WeakReference(player); } EntityPlayer current = Minecraft.getMinecraft().thePlayer; @@ -82,7 +93,7 @@ public class FamiliarHandlerClient { String currentPl = current.getCommandSenderName(); String otherPl = player.getCommandSenderName(); - if(!currentPl.equals(otherPl)) { + if (!currentPl.equals(otherPl)) { diffY += 1.32; EntityLivingBase entity = Minecraft.getMinecraft().renderViewEntity; @@ -91,14 +102,15 @@ public class FamiliarHandlerClient { diffZ -= ((entity.posZ - entity.lastTickPosZ) * partialTicks); } - ItemRenderFamiliar.renderEntityWispFor(fam.owner.get(), FamiliarHandlerClient.ENTITY_WISP, diffX, diffY, diffZ, 0, partialTicks); + ItemRenderFamiliar.renderEntityWispFor( + fam.owner.get(), FamiliarHandlerClient.ENTITY_WISP, diffX, diffY, diffZ, 0, partialTicks); GL11.glPopMatrix(); } @SideOnly(Side.CLIENT) public static void playerTickEvent() { - if(Minecraft.getMinecraft().theWorld == null) return; - for(ExFamiliarData data : FamiliarHandlerClient.clientFamiliars.values()) { + if (Minecraft.getMinecraft().theWorld == null) return; + for (ExFamiliarData data : FamiliarHandlerClient.clientFamiliars.values()) { data.familiar.tick(); } PartialEntityFamiliar.DUMMY_FAMILIAR.tick(); @@ -110,15 +122,16 @@ public class FamiliarHandlerClient { } public static void handleAdditions(List toAdd) { - for(DataFamiliar.FamiliarData data : toAdd) { - PartialEntityFamiliar familiar = new PartialEntityFamiliar(Minecraft.getMinecraft().theWorld.getPlayerEntityByName(data.owner), data.owner); + for (DataFamiliar.FamiliarData data : toAdd) { + PartialEntityFamiliar familiar = new PartialEntityFamiliar( + Minecraft.getMinecraft().theWorld.getPlayerEntityByName(data.owner), data.owner); ExFamiliarData exData = new ExFamiliarData(data, familiar); FamiliarHandlerClient.clientFamiliars.put(data.owner, exData); } } public static void handleRemovals(List toRemove) { - for(DataFamiliar.FamiliarData data : toRemove) { + for (DataFamiliar.FamiliarData data : toRemove) { FamiliarHandlerClient.clientFamiliars.remove(data.owner); } } @@ -140,8 +153,8 @@ public class FamiliarHandlerClient { ExFamiliarData that = (ExFamiliarData) o; - return (this.data != null ? this.data.equals(that.data) : that.data == null) && (this.familiar != null ? this.familiar.equals(that.familiar) : that.familiar == null); - + return (this.data != null ? this.data.equals(that.data) : that.data == null) + && (this.familiar != null ? this.familiar.equals(that.familiar) : that.familiar == null); } @Override @@ -193,10 +206,11 @@ public class FamiliarHandlerClient { this.ticksExisted++; this.dummyEntity.ticksExisted = this.ticksExisted; - if(this.owner.get() == null) { - if(this.potentialOwnerName != null) { - EntityPlayer player = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(this.potentialOwnerName); - if(player != null) { + if (this.owner.get() == null) { + if (this.potentialOwnerName != null) { + EntityPlayer player = + Minecraft.getMinecraft().theWorld.getPlayerEntityByName(this.potentialOwnerName); + if (player != null) { this.owner = new WeakReference(player); } else { return; @@ -205,7 +219,8 @@ public class FamiliarHandlerClient { return; } } else { - if(this.owner.get().worldObj.provider.dimensionId != Minecraft.getMinecraft().renderViewEntity.worldObj.provider.dimensionId) { + if (this.owner.get().worldObj.provider.dimensionId + != Minecraft.getMinecraft().renderViewEntity.worldObj.provider.dimensionId) { this.owner = new WeakReference(null); return; } @@ -226,5 +241,4 @@ public class FamiliarHandlerClient { this.posY = this.owner.get().posY + this.renderY; } } - } diff --git a/src/main/java/makeo/gadomancy/client/util/MultiTickEffectDispatcher.java b/src/main/java/makeo/gadomancy/client/util/MultiTickEffectDispatcher.java index 25009c2..729e892 100644 --- a/src/main/java/makeo/gadomancy/client/util/MultiTickEffectDispatcher.java +++ b/src/main/java/makeo/gadomancy/client/util/MultiTickEffectDispatcher.java @@ -1,5 +1,9 @@ package makeo.gadomancy.client.util; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.concurrent.locks.ReentrantLock; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; @@ -9,11 +13,6 @@ import thaumcraft.client.fx.particles.FXBubble; import thaumcraft.client.lib.UtilsFX; import thaumcraft.common.Thaumcraft; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.concurrent.locks.ReentrantLock; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -42,22 +41,25 @@ public class MultiTickEffectDispatcher { private static void handleBubbleSpawnings(World world) { Iterator it = MultiTickEffectDispatcher.bubbleInfos.iterator(); - while(it.hasNext()) { + while (it.hasNext()) { BubbleFXInfo info = it.next(); - if(info.dimId != world.provider.dimensionId) { + if (info.dimId != world.provider.dimensionId) { it.remove(); continue; } info.renderTicks++; - if(info.renderTicks > info.overallTicks) { + if (info.renderTicks > info.overallTicks) { it.remove(); continue; } - if(world.rand.nextInt(3) == 0) { - float x = info.posX + (world.rand.nextBoolean() ? 1 : -1) * (world.rand.nextFloat() * info.rangeAroundItem); - float y = info.posY + (world.rand.nextBoolean() ? 1 : -1) * (world.rand.nextFloat() * info.rangeAroundItem); - float z = info.posZ + (world.rand.nextBoolean() ? 1 : -1) * (world.rand.nextFloat() * info.rangeAroundItem); + if (world.rand.nextInt(3) == 0) { + float x = info.posX + + (world.rand.nextBoolean() ? 1 : -1) * (world.rand.nextFloat() * info.rangeAroundItem); + float y = info.posY + + (world.rand.nextBoolean() ? 1 : -1) * (world.rand.nextFloat() * info.rangeAroundItem); + float z = info.posZ + + (world.rand.nextBoolean() ? 1 : -1) * (world.rand.nextFloat() * info.rangeAroundItem); FXBubble fb = new FXBubble(world, x, y, z, 0.0D, 0.0D, 0.0D, 0); fb.setAlphaF(0.25F); fb.setRGB(1.0F, 1.0F, 1.0F); @@ -69,42 +71,62 @@ public class MultiTickEffectDispatcher { private static void handleWispyLineEffects(World currentRenderWorld, float partialTicks) { Tessellator tessellator; Iterator it = MultiTickEffectDispatcher.floatyLineInfos.iterator(); - while(it.hasNext()) { + while (it.hasNext()) { FloatyLineInfo info = it.next(); - if(info.dimId != currentRenderWorld.provider.dimensionId) { + if (info.dimId != currentRenderWorld.provider.dimensionId) { it.remove(); continue; } info.renderTicks++; - if(info.renderTicks > info.tickCap) { + if (info.renderTicks > info.tickCap) { it.remove(); continue; } - if(info.randomOffset == -1) { + if (info.randomOffset == -1) { info.randomOffset = currentRenderWorld.rand.nextInt(20); } float ticks = Minecraft.getMinecraft().renderViewEntity.ticksExisted + info.randomOffset + partialTicks; - UtilsFX.drawFloatyLine(info.pedestalX, info.pedestalY, info.pedestalZ, info.originX, info.originY, info.originZ, partialTicks, info.colorAsInt, "textures/misc/wispy.png", -0.02F, Math.min(ticks, 10.0F) / 10.0F); + UtilsFX.drawFloatyLine( + info.pedestalX, + info.pedestalY, + info.pedestalZ, + info.originX, + info.originY, + info.originZ, + partialTicks, + info.colorAsInt, + "textures/misc/wispy.png", + -0.02F, + Math.min(ticks, 10.0F) / 10.0F); } } private static void handleVortexDiggingEffects(World currentRenderWorld) { Iterator it = MultiTickEffectDispatcher.vortexDigInfos.iterator(); - while(it.hasNext()) { + while (it.hasNext()) { VortexDigInfo info = it.next(); - if(info.dimId != currentRenderWorld.provider.dimensionId) { + if (info.dimId != currentRenderWorld.provider.dimensionId) { it.remove(); continue; } info.renderTicks++; - if(info.renderTicks > info.tickCap) { + if (info.renderTicks > info.tickCap) { it.remove(); continue; } - Thaumcraft.proxy.boreDigFx(currentRenderWorld, info.tX, info.tY, info.tZ, info.oX, info.oY, info.oZ, info.blockInstance, info.meta); + Thaumcraft.proxy.boreDigFx( + currentRenderWorld, + info.tX, + info.tY, + info.tZ, + info.oX, + info.oY, + info.oZ, + info.blockInstance, + info.meta); } } @@ -145,7 +167,16 @@ public class MultiTickEffectDispatcher { private int colorAsInt; private int randomOffset = -1; - public FloatyLineInfo(int dimId, double pedestalX, double pedestalY, double pedestalZ, double originX, double originY, double originZ, int tickCap, int colorAsInt) { + public FloatyLineInfo( + int dimId, + double pedestalX, + double pedestalY, + double pedestalZ, + double originX, + double originY, + double originZ, + int tickCap, + int colorAsInt) { this.dimId = dimId; this.pedestalX = pedestalX; this.pedestalY = pedestalY; @@ -185,7 +216,17 @@ public class MultiTickEffectDispatcher { private int renderTicks; private int tickCap; - public VortexDigInfo(int dimId, int oX, int oY, int oZ, int tX, int tY, int tZ, Block blockInstance, int meta, int tickDuration) { + public VortexDigInfo( + int dimId, + int oX, + int oY, + int oZ, + int tX, + int tY, + int tZ, + Block blockInstance, + int meta, + int tickDuration) { this.dimId = dimId; this.oX = oX; this.oY = oY; @@ -198,5 +239,4 @@ public class MultiTickEffectDispatcher { this.tickCap = tickDuration; } } - } diff --git a/src/main/java/makeo/gadomancy/client/util/UtilsFX.java b/src/main/java/makeo/gadomancy/client/util/UtilsFX.java index 16baeef..d977740 100644 --- a/src/main/java/makeo/gadomancy/client/util/UtilsFX.java +++ b/src/main/java/makeo/gadomancy/client/util/UtilsFX.java @@ -1,5 +1,7 @@ package makeo.gadomancy.client.util; +import java.awt.*; +import java.util.Random; import makeo.gadomancy.common.utils.MiscUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntitySmokeFX; @@ -7,9 +9,6 @@ import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; import thaumcraft.common.Thaumcraft; -import java.awt.*; -import java.util.Random; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -20,25 +19,44 @@ import java.util.Random; */ public class UtilsFX { - private static final Color[] RUNE_COLORS_RED = { new Color(0xB60707), new Color(0xEE3782), new Color(0xF37B20), new Color(0xFF6722), new Color(0xFF6D30), new Color(0xFF0000) }; - private static final Color[] RUNE_COLORS_GREEN = { new Color(0x015629), new Color(0x0E9C00), new Color(0x010000), new Color(0x01FF00), new Color(0x014C3E)}; - private static final Color[] RUNE_COLORS_BLUE = { new Color(0x060956), new Color(0x012578), new Color(0x0C1556), new Color(0x0100FF), new Color(0x01018C)}; + private static final Color[] RUNE_COLORS_RED = { + new Color(0xB60707), + new Color(0xEE3782), + new Color(0xF37B20), + new Color(0xFF6722), + new Color(0xFF6D30), + new Color(0xFF0000) + }; + private static final Color[] RUNE_COLORS_GREEN = { + new Color(0x015629), new Color(0x0E9C00), new Color(0x010000), new Color(0x01FF00), new Color(0x014C3E) + }; + private static final Color[] RUNE_COLORS_BLUE = { + new Color(0x060956), new Color(0x012578), new Color(0x0C1556), new Color(0x0100FF), new Color(0x01018C) + }; public static void doRuneEffects(World world, int x, int y, int z, int colorFlag) { - if(world.isRemote) { + if (world.isRemote) { int cnt = 20; - while(cnt > 0) { + while (cnt > 0) { cnt--; Color rand = UtilsFX.evaluateRandomColor(world.rand, colorFlag); - Thaumcraft.proxy.blockRunes(world, x + UtilsFX.randomOffset(world), y + UtilsFX.randomOffset(world), z + UtilsFX.randomOffset(world), - rand.getRed() / 255F, rand.getGreen() / 255F, rand.getBlue() / 255F, world.rand.nextInt(10) + 30, -0.01F - (world.rand.nextBoolean() ? world.rand.nextBoolean() ? 0.02F : 0.01F : 0F)); + Thaumcraft.proxy.blockRunes( + world, + x + UtilsFX.randomOffset(world), + y + UtilsFX.randomOffset(world), + z + UtilsFX.randomOffset(world), + rand.getRed() / 255F, + rand.getGreen() / 255F, + rand.getBlue() / 255F, + world.rand.nextInt(10) + 30, + -0.01F - (world.rand.nextBoolean() ? world.rand.nextBoolean() ? 0.02F : 0.01F : 0F)); } } } private static Color evaluateRandomColor(Random rand, int colorFlag) { Color[] possibleColors; - if(colorFlag == 1) { + if (colorFlag == 1) { possibleColors = UtilsFX.RUNE_COLORS_BLUE; } else { possibleColors = UtilsFX.RUNE_COLORS_RED; @@ -51,7 +69,7 @@ public class UtilsFX { } public static void doSparkleEffectsAround(World world, int x, int y, int z) { - for(ChunkCoordinates cc : MiscUtils.getCoordinatesAround(new ChunkCoordinates(x, y, z))) { + for (ChunkCoordinates cc : MiscUtils.getCoordinatesAround(new ChunkCoordinates(x, y, z))) { UtilsFX.doSparkleEffects(world, cc.posX, cc.posY, cc.posZ); } } @@ -63,14 +81,22 @@ public class UtilsFX { public static void doSmokeEffects(World world, int x, int y, int z, float size) { int count = world.rand.nextInt(6) + 2; for (int i = 0; i < count; i++) { - Minecraft.getMinecraft().effectRenderer.addEffect( - new EntitySmokeFX(world, x + 0.5 + UtilsFX.randEffectOffset(world.rand), y + 0.5 + UtilsFX.randEffectOffset(world.rand), z + 0.5 + UtilsFX.randEffectOffset(world.rand), - UtilsFX.randEffectOffset(world.rand) * 0.01F, UtilsFX.randEffectOffset(world.rand) * 0.1F, UtilsFX.randEffectOffset(world.rand) * 0.01F, size)); + Minecraft.getMinecraft() + .effectRenderer + .addEffect(new EntitySmokeFX( + world, + x + 0.5 + UtilsFX.randEffectOffset(world.rand), + y + 0.5 + UtilsFX.randEffectOffset(world.rand), + z + 0.5 + UtilsFX.randEffectOffset(world.rand), + UtilsFX.randEffectOffset(world.rand) * 0.01F, + UtilsFX.randEffectOffset(world.rand) * 0.1F, + UtilsFX.randEffectOffset(world.rand) * 0.01F, + size)); } } public static void doSmokeEffectsAround(World world, int x, int y, int z, float size) { - for(ChunkCoordinates cc : MiscUtils.getCoordinatesAround(new ChunkCoordinates(x, y, z))) { + for (ChunkCoordinates cc : MiscUtils.getCoordinatesAround(new ChunkCoordinates(x, y, z))) { UtilsFX.doSmokeEffects(world, cc.posX, cc.posY, cc.posZ, size); } } diff --git a/src/main/java/makeo/gadomancy/common/CommonProxy.java b/src/main/java/makeo/gadomancy/common/CommonProxy.java index 8c40348..7e076eb 100644 --- a/src/main/java/makeo/gadomancy/common/CommonProxy.java +++ b/src/main/java/makeo/gadomancy/common/CommonProxy.java @@ -4,6 +4,9 @@ import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.relauncher.Side; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; import makeo.gadomancy.client.ClientProxy; import makeo.gadomancy.common.aura.AuraEffects; import makeo.gadomancy.common.containers.ContainerArcanePackager; @@ -29,10 +32,6 @@ import thaumcraft.api.wands.WandTriggerRegistry; import thaumcraft.common.entities.golems.ContainerGolem; import thaumcraft.common.entities.golems.EntityGolemBase; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -47,7 +46,7 @@ public class CommonProxy implements IGuiHandler { public static final EventHandlerGolem EVENT_HANDLER_GOLEM = new EventHandlerGolem(); - public void onConstruct() { } + public void onConstruct() {} public void preInitalize() { PacketHandler.init(); @@ -85,7 +84,7 @@ public class CommonProxy implements IGuiHandler { public void postInitalize() { RegisteredPotions.init(); - AuraEffects.AER.getTickInterval(); //initalize AuraEffects + AuraEffects.AER.getTickInterval(); // initalize AuraEffects RegisteredResearches.init(); RegisteredIntegrations.init(); @@ -100,25 +99,28 @@ public class CommonProxy implements IGuiHandler { public static void unregisterWandHandler(String modid, Block block, int metadata) { HashMap> triggers = new Injector(WandTriggerRegistry.class).getField("triggers"); HashMap modTriggers = triggers.get(modid); - if(modTriggers == null) return; + if (modTriggers == null) return; List arrKey = Arrays.asList(block, metadata); modTriggers.remove(arrKey); triggers.put(modid, modTriggers); } public void spawnBubbles(World world, float posX, float posY, float posZ, float rangeAroundItem) { - PacketStartAnimation pkt = new PacketStartAnimation(PacketStartAnimation.ID_BUBBLES, - Float.floatToIntBits(posX), Float.floatToIntBits(posY), Float.floatToIntBits(posZ), + PacketStartAnimation pkt = new PacketStartAnimation( + PacketStartAnimation.ID_BUBBLES, + Float.floatToIntBits(posX), + Float.floatToIntBits(posY), + Float.floatToIntBits(posZ), Float.floatToIntBits(rangeAroundItem)); - PacketHandler.INSTANCE.sendToAllAround(pkt, new NetworkRegistry.TargetPoint(world.provider.dimensionId, - posX, posY, posZ, 32)); + PacketHandler.INSTANCE.sendToAllAround( + pkt, new NetworkRegistry.TargetPoint(world.provider.dimensionId, posX, posY, posZ, 32)); } @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { switch (ID) { case 0: - return new ContainerGolem(player.inventory, ((EntityGolemBase)world.getEntityByID(x)).inventory); + return new ContainerGolem(player.inventory, ((EntityGolemBase) world.getEntityByID(x)).inventory); case 1: return new ContainerInfusionClaw(player.inventory, (IInventory) world.getTileEntity(x, y, z)); case 2: @@ -132,7 +134,7 @@ public class CommonProxy implements IGuiHandler { return null; } - public void runDelayedClientSide(Runnable run) { } + public void runDelayedClientSide(Runnable run) {} public Side getSide() { return this instanceof ClientProxy ? Side.CLIENT : Side.SERVER; diff --git a/src/main/java/makeo/gadomancy/common/Gadomancy.java b/src/main/java/makeo/gadomancy/common/Gadomancy.java index c66fd80..9c7a7a2 100644 --- a/src/main/java/makeo/gadomancy/common/Gadomancy.java +++ b/src/main/java/makeo/gadomancy/common/Gadomancy.java @@ -19,7 +19,11 @@ 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") +@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 static final String MODID = "gadomancy"; public static final String NAME = "Gadomancy"; @@ -48,7 +52,7 @@ public class Gadomancy { } public static void unloadModData() { - if(Gadomancy.modData != null) { + if (Gadomancy.modData != null) { Gadomancy.modData.save(); Gadomancy.modData = null; } diff --git a/src/main/java/makeo/gadomancy/common/api/DefaultApiHandler.java b/src/main/java/makeo/gadomancy/common/api/DefaultApiHandler.java index 461923b..1f306e8 100644 --- a/src/main/java/makeo/gadomancy/common/api/DefaultApiHandler.java +++ b/src/main/java/makeo/gadomancy/common/api/DefaultApiHandler.java @@ -1,6 +1,10 @@ package makeo.gadomancy.common.api; import cpw.mods.fml.common.registry.GameRegistry; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import makeo.gadomancy.api.AuraEffect; import makeo.gadomancy.api.ClickBehavior; import makeo.gadomancy.api.golems.AdditionalGolemType; @@ -22,11 +26,6 @@ import org.apache.logging.log4j.Logger; import thaumcraft.api.aspects.Aspect; import thaumcraft.common.entities.golems.EntityGolemBase; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -44,11 +43,12 @@ public class DefaultApiHandler implements IApiHandler { @Override public boolean registerAdditionalGolemType(String name, String modId, AdditionalGolemType newType) { String uniqueName = name.toUpperCase(); - if(!DefaultApiHandler.additionalGolemTypes.containsKey(uniqueName)) { + if (!DefaultApiHandler.additionalGolemTypes.containsKey(uniqueName)) { GolemEnumHelper.addGolemType(uniqueName, newType); ItemAdditionalGolemPlacer placerItem = new ItemAdditionalGolemPlacer(newType); - GameRegistry.registerItem(placerItem, "item" + StringHelper.firstToUpper(name.toLowerCase()) + "GolemPlacer"); + GameRegistry.registerItem( + placerItem, "item" + StringHelper.firstToUpper(name.toLowerCase()) + "GolemPlacer"); newType.setModId(modId); newType.setPlacerItem(placerItem); @@ -73,7 +73,7 @@ public class DefaultApiHandler implements IApiHandler { @Override public AdditionalGolemCore getAdditionalGolemCore(EntityGolemBase golem) { String coreName = golem.getDataWatcher().getWatchableObjectString(ModConfig.golemDatawatcherId); - if(!coreName.isEmpty()) { + if (!coreName.isEmpty()) { return DefaultApiHandler.additionalGolemCores.get(coreName); } return null; @@ -81,9 +81,9 @@ public class DefaultApiHandler implements IApiHandler { @Override public AdditionalGolemCore getAdditionalGolemCore(ItemStack placer) { - if(NBTHelper.hasPersistentData(placer)) { + if (NBTHelper.hasPersistentData(placer)) { NBTTagCompound persistent = NBTHelper.getPersistentData(placer); - if(persistent.hasKey("Core")) { + if (persistent.hasKey("Core")) { return DefaultApiHandler.additionalGolemCores.get(persistent.getString("Core")); } } @@ -92,7 +92,7 @@ public class DefaultApiHandler implements IApiHandler { @Override public boolean registerAdditionalGolemCore(String name, AdditionalGolemCore core) { - if(!DefaultApiHandler.additionalGolemCores.containsKey(name)) { + if (!DefaultApiHandler.additionalGolemCores.containsKey(name)) { core.setName(name); DefaultApiHandler.additionalGolemCores.put(name, core); return true; @@ -107,15 +107,15 @@ public class DefaultApiHandler implements IApiHandler { golem.setCore(core == null ? -1 : core.getBaseCore()); golem.getDataWatcher().updateObject(ModConfig.golemDatawatcherId, coreName); - if(!golem.worldObj.isRemote) { + if (!golem.worldObj.isRemote) { NBTHelper.getPersistentData(golem).setString("Core", coreName); - ((ExtendedGolemProperties)golem.getExtendedProperties(Gadomancy.MODID)).updateGolem(); + ((ExtendedGolemProperties) golem.getExtendedProperties(Gadomancy.MODID)).updateGolem(); } else { golem.setupGolem(); golem.setupGolemInventory(); } - golem.worldObj.setEntityState(golem, (byte)7); + golem.worldObj.setEntityState(golem, (byte) 7); } @Override @@ -130,8 +130,8 @@ public class DefaultApiHandler implements IApiHandler { @Override public void registerAdditionalAuraEffect(Aspect aspect, AuraEffect effect) { - if(aspect == null || effect == null) return; - if(AuraEffectHandler.registeredEffects.containsKey(aspect)) { + if (aspect == null || effect == null) return; + if (AuraEffectHandler.registeredEffects.containsKey(aspect)) { DefaultApiHandler.log.warn("AuraEffect for '" + aspect.getTag() + "' is already registered!"); } else { AuraEffectHandler.registeredEffects.put(aspect, effect); diff --git a/src/main/java/makeo/gadomancy/common/aura/AuraEffectHandler.java b/src/main/java/makeo/gadomancy/common/aura/AuraEffectHandler.java index b6918d7..06cb570 100644 --- a/src/main/java/makeo/gadomancy/common/aura/AuraEffectHandler.java +++ b/src/main/java/makeo/gadomancy/common/aura/AuraEffectHandler.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.aura; +import java.util.*; import makeo.gadomancy.api.AuraEffect; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -8,8 +9,6 @@ import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; import thaumcraft.api.aspects.Aspect; -import java.util.*; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -23,12 +22,14 @@ public class AuraEffectHandler { public static Map registeredEffects = new HashMap(); public static void distributeEffects(Aspect aspect, World worldObj, double x, double y, double z, int tick) { - if(!AuraEffectHandler.registeredEffects.containsKey(aspect) || worldObj.isRemote || AuraResearchManager.isBlacklisted(aspect)) return; + if (!AuraEffectHandler.registeredEffects.containsKey(aspect) + || worldObj.isRemote + || AuraResearchManager.isBlacklisted(aspect)) return; AuraEffect effect = AuraEffectHandler.registeredEffects.get(aspect); - if((tick % effect.getTickInterval()) != 0) return; + if ((tick % effect.getTickInterval()) != 0) return; AuraEffect.EffectType type = effect.getEffectType(); - if(type != null) { + if (type != null) { switch (type) { case ENTITY_EFFECT: AuraEffectHandler.doEntityEffects(effect, worldObj, x, y, z); @@ -42,11 +43,14 @@ public class AuraEffectHandler { AuraEffectHandler.doBlockEffects(effect, worldObj, x, y, z); } - //Distribute research + // Distribute research double range = effect.getRange(); - List players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x - 0.5, y - 0.5, z - 0.5, x + 0.5, y + 0.5, z + 0.5).expand(range, range, range)); - for(Object p : players) { - if(p == null || !(p instanceof EntityPlayer)) continue; + List players = worldObj.getEntitiesWithinAABB( + EntityPlayer.class, + AxisAlignedBB.getBoundingBox(x - 0.5, y - 0.5, z - 0.5, x + 0.5, y + 0.5, z + 0.5) + .expand(range, range, range)); + for (Object p : players) { + if (p == null || !(p instanceof EntityPlayer)) continue; EntityPlayer player = (EntityPlayer) p; AuraResearchManager.tryUnlockAuraEffect(player, aspect); } @@ -64,7 +68,7 @@ public class AuraEffectHandler { int zz = worldObj.rand.nextInt(intRange) - worldObj.rand.nextInt(intRange); ChunkCoordinates blockCC = new ChunkCoordinates((int) x + xx, (int) y + yy, (int) z + zz); - if(foundBlocks.contains(blockCC)) { + if (foundBlocks.contains(blockCC)) { count++; } else { foundBlocks.add(blockCC); @@ -75,20 +79,22 @@ public class AuraEffectHandler { private static void doEntityEffects(AuraEffect effect, World worldObj, double x, double y, double z) { double range = effect.getRange(); - List entitiesInRange = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(x - 0.5, y - 0.5, z - 0.5, x + 0.5, y + 0.5, z + 0.5).expand(range, range, range)); + List entitiesInRange = worldObj.getEntitiesWithinAABB( + Entity.class, + AxisAlignedBB.getBoundingBox(x - 0.5, y - 0.5, z - 0.5, x + 0.5, y + 0.5, z + 0.5) + .expand(range, range, range)); Iterator it = entitiesInRange.iterator(); - while(it.hasNext()) { + while (it.hasNext()) { Entity e = (Entity) it.next(); - if(e == null || e.isDead) { + if (e == null || e.isDead) { it.remove(); continue; } - if(!effect.isEntityApplicable(e)) it.remove(); + if (!effect.isEntityApplicable(e)) it.remove(); } ChunkCoordinates origin = new ChunkCoordinates((int) x, (int) y, (int) z); - for(Object e : entitiesInRange) { + for (Object e : entitiesInRange) { effect.doEntityEffect(origin, (Entity) e); } } - } diff --git a/src/main/java/makeo/gadomancy/common/aura/AuraEffects.java b/src/main/java/makeo/gadomancy/common/aura/AuraEffects.java index 5b1df44..7a2597c 100644 --- a/src/main/java/makeo/gadomancy/common/aura/AuraEffects.java +++ b/src/main/java/makeo/gadomancy/common/aura/AuraEffects.java @@ -1,5 +1,9 @@ package makeo.gadomancy.common.aura; +import static makeo.gadomancy.common.utils.MiscUtils.ticksForMinutes; +import static makeo.gadomancy.common.utils.MiscUtils.ticksForSeconds; + +import java.util.Random; import makeo.gadomancy.api.AuraEffect; import makeo.gadomancy.common.events.EventHandlerEntity; import makeo.gadomancy.common.integration.IntegrationThaumicTinkerer; @@ -42,11 +46,6 @@ import thaumcraft.common.lib.utils.EntityUtils; import thaumcraft.common.lib.utils.Utils; import thaumcraft.common.lib.world.ThaumcraftWorldGenerator; -import java.util.Random; - -import static makeo.gadomancy.common.utils.MiscUtils.ticksForMinutes; -import static makeo.gadomancy.common.utils.MiscUtils.ticksForSeconds; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -56,35 +55,79 @@ import static makeo.gadomancy.common.utils.MiscUtils.ticksForSeconds; * Created by HellFirePvP @ 29.11.2015 19:09 */ public class AuraEffects { - private static final ItemStack[][] ITEMS_SOUL = {{new ItemStack(Items.bow), new ItemStack(Items.wooden_sword), new ItemStack(Items.stone_sword), new ItemStack(Items.iron_sword), new ItemStack(Items.stone_axe), new ItemStack(Items.iron_axe)},{new ItemStack(Items.leather_boots), new ItemStack(Items.chainmail_boots), new ItemStack(Items.iron_boots)},{new ItemStack(Items.leather_leggings), new ItemStack(Items.chainmail_leggings), new ItemStack(Items.iron_leggings)},{new ItemStack(Items.leather_chestplate), new ItemStack(Items.chainmail_chestplate), new ItemStack(Items.iron_chestplate)},{new ItemStack(Blocks.lit_pumpkin), new ItemStack(Blocks.pumpkin)}}; + private static final ItemStack[][] ITEMS_SOUL = { + { + new ItemStack(Items.bow), + new ItemStack(Items.wooden_sword), + new ItemStack(Items.stone_sword), + new ItemStack(Items.iron_sword), + new ItemStack(Items.stone_axe), + new ItemStack(Items.iron_axe) + }, + {new ItemStack(Items.leather_boots), new ItemStack(Items.chainmail_boots), new ItemStack(Items.iron_boots)}, + { + new ItemStack(Items.leather_leggings), + new ItemStack(Items.chainmail_leggings), + new ItemStack(Items.iron_leggings) + }, + { + new ItemStack(Items.leather_chestplate), + new ItemStack(Items.chainmail_chestplate), + new ItemStack(Items.iron_chestplate) + }, + {new ItemStack(Blocks.lit_pumpkin), new ItemStack(Blocks.pumpkin)} + }; - //Potion amplifiers start with 0 == lvl 1! + // Potion amplifiers start with 0 == lvl 1! - //Std. potion effects - public static final AuraEffect AER = new PotionDistributionEffect(Potion.moveSpeed, 4, 6, ticksForMinutes(6), 1).register(Aspect.AIR); - public static final AuraEffect AQUA = new PotionDistributionEffect(Potion.waterBreathing, 4, 10, ticksForMinutes(10), 0).register(Aspect.WATER); - public static final AuraEffect TERRA = new PotionDistributionEffect(Potion.resistance, 4, 8, ticksForMinutes(5), 0).register(Aspect.EARTH); - public static final AuraEffect ORDO = new PotionDistributionEffect(Potion.regeneration, 4, 6, ticksForMinutes(3), 0).register(Aspect.ORDER); - public static final AuraEffect PERDITIO = new PotionDistributionEffect(Potion.weakness, 4, 8, ticksForMinutes(3), 0).register(Aspect.ENTROPY); - public static final AuraEffect TELUM = new PotionDistributionEffect(Potion.damageBoost, 4, 6, ticksForMinutes(6), 2).register(Aspect.WEAPON); - public static final AuraEffect TUTAMEN = new PotionDistributionEffect(Potion.resistance, 4, 6, ticksForMinutes(6), 1).register(Aspect.ARMOR); - public static final AuraEffect MOTUS = new PotionDistributionEffect(Potion.moveSpeed, 4, 6, ticksForMinutes(2), 2).register(Aspect.MOTION); //Fast speed for short duration, long charge time - public static final AuraEffect ITER = new PotionDistributionEffect(Potion.moveSpeed, 2, 10, ticksForMinutes(15), 0).register(Aspect.TRAVEL); //Slower speed for long duration, fast charge time - public static final AuraEffect FAMES = new PotionDistributionEffect(Potion.hunger, 4, 6, ticksForMinutes(2), 0).register(Aspect.HUNGER); - public static final AuraEffect SENSUS = new PotionDistributionEffect(Potion.nightVision, 2, 8, ticksForMinutes(8), 0).register(Aspect.SENSES); - public static final AuraEffect VOLATUS = new PotionDistributionEffect(Potion.jump, 2, 5, ticksForMinutes(4), 0).register(Aspect.FLIGHT); - public static final AuraEffect POTENTIA = new PotionDistributionEffect(Potion.damageBoost, 4, 6, ticksForMinutes(4), 0).register(Aspect.ENERGY); - public static final AuraEffect TENEBRAE = new PotionDistributionEffect(Potion.blindness, 4, 6, ticksForMinutes(1), 0).register(Aspect.DARKNESS); - public static final AuraEffect SANO = new PotionDistributionEffect(Potion.regeneration, 8, 10, ticksForMinutes(5), 1).register(Aspect.HEAL); - public static final AuraEffect MORTUUS = new PotionDistributionEffect(Potion.wither, 4, 6, ticksForMinutes(3), 1).register(Aspect.DEATH); - public static final AuraEffect HUMANUS = new PotionDistributionEffect(Potion.field_76434_w, 2, 5, ticksForMinutes(4), 1).register(Aspect.MAN); - public static final AuraEffect INSTRUMENTUM = new PotionDistributionEffect(Potion.digSpeed, 2, 7, ticksForMinutes(6), 0).register(Aspect.TOOL); - public static final AuraEffect PERFODIO = new PotionDistributionEffect(Potion.digSpeed, 2, 7, ticksForMinutes(5), 2).register(Aspect.MINE); - public static final AuraEffect VENENUM = new PotionDistributionEffect(Potion.poison, 2, 6, ticksForMinutes(1), 0).register(Aspect.POISON); - public static final AuraEffect VINCULUM = new PotionDistributionEffect(Potion.moveSlowdown, 4, 6, ticksForMinutes(3), 0).register(Aspect.TRAP); + // Std. potion effects + public static final AuraEffect AER = + new PotionDistributionEffect(Potion.moveSpeed, 4, 6, ticksForMinutes(6), 1).register(Aspect.AIR); + public static final AuraEffect AQUA = + new PotionDistributionEffect(Potion.waterBreathing, 4, 10, ticksForMinutes(10), 0).register(Aspect.WATER); + public static final AuraEffect TERRA = + new PotionDistributionEffect(Potion.resistance, 4, 8, ticksForMinutes(5), 0).register(Aspect.EARTH); + public static final AuraEffect ORDO = + new PotionDistributionEffect(Potion.regeneration, 4, 6, ticksForMinutes(3), 0).register(Aspect.ORDER); + public static final AuraEffect PERDITIO = + new PotionDistributionEffect(Potion.weakness, 4, 8, ticksForMinutes(3), 0).register(Aspect.ENTROPY); + public static final AuraEffect TELUM = + new PotionDistributionEffect(Potion.damageBoost, 4, 6, ticksForMinutes(6), 2).register(Aspect.WEAPON); + public static final AuraEffect TUTAMEN = + new PotionDistributionEffect(Potion.resistance, 4, 6, ticksForMinutes(6), 1).register(Aspect.ARMOR); + public static final AuraEffect MOTUS = new PotionDistributionEffect(Potion.moveSpeed, 4, 6, ticksForMinutes(2), 2) + .register(Aspect.MOTION); // Fast speed for short duration, long charge time + public static final AuraEffect ITER = new PotionDistributionEffect(Potion.moveSpeed, 2, 10, ticksForMinutes(15), 0) + .register(Aspect.TRAVEL); // Slower speed for long duration, fast charge time + public static final AuraEffect FAMES = + new PotionDistributionEffect(Potion.hunger, 4, 6, ticksForMinutes(2), 0).register(Aspect.HUNGER); + public static final AuraEffect SENSUS = + new PotionDistributionEffect(Potion.nightVision, 2, 8, ticksForMinutes(8), 0).register(Aspect.SENSES); + public static final AuraEffect VOLATUS = + new PotionDistributionEffect(Potion.jump, 2, 5, ticksForMinutes(4), 0).register(Aspect.FLIGHT); + public static final AuraEffect POTENTIA = + new PotionDistributionEffect(Potion.damageBoost, 4, 6, ticksForMinutes(4), 0).register(Aspect.ENERGY); + public static final AuraEffect TENEBRAE = + new PotionDistributionEffect(Potion.blindness, 4, 6, ticksForMinutes(1), 0).register(Aspect.DARKNESS); + public static final AuraEffect SANO = + new PotionDistributionEffect(Potion.regeneration, 8, 10, ticksForMinutes(5), 1).register(Aspect.HEAL); + public static final AuraEffect MORTUUS = + new PotionDistributionEffect(Potion.wither, 4, 6, ticksForMinutes(3), 1).register(Aspect.DEATH); + public static final AuraEffect HUMANUS = + new PotionDistributionEffect(Potion.field_76434_w, 2, 5, ticksForMinutes(4), 1).register(Aspect.MAN); + public static final AuraEffect INSTRUMENTUM = + new PotionDistributionEffect(Potion.digSpeed, 2, 7, ticksForMinutes(6), 0).register(Aspect.TOOL); + public static final AuraEffect PERFODIO = + new PotionDistributionEffect(Potion.digSpeed, 2, 7, ticksForMinutes(5), 2).register(Aspect.MINE); + public static final AuraEffect VENENUM = + new PotionDistributionEffect(Potion.poison, 2, 6, ticksForMinutes(1), 0).register(Aspect.POISON); + public static final AuraEffect VINCULUM = + new PotionDistributionEffect(Potion.moveSlowdown, 4, 6, ticksForMinutes(3), 0).register(Aspect.TRAP); - //Special effects.. - public static final AuraEffect LUCRUM = new PotionDistributionEffect(RegisteredPotions.POTION_LUCK, 4, 6, ticksForMinutes(5), 1).register(Aspect.GREED); //Mining luck (Adding fortune) + // Special effects.. + public static final AuraEffect LUCRUM = new PotionDistributionEffect( + RegisteredPotions.POTION_LUCK, 4, 6, ticksForMinutes(5), 1) + .register(Aspect.GREED); // Mining luck (Adding fortune) public static final AuraEffect VICTUS = new AuraEffect.EntityAuraEffect() { @Override public boolean isEntityApplicable(Entity e) { @@ -93,9 +136,9 @@ public class AuraEffects { @Override public void doEntityEffect(ChunkCoordinates originTile, Entity e) { - if(e instanceof EntityPlayer) return; + if (e instanceof EntityPlayer) return; EntityAgeable ageable = (EntityAgeable) e; - if(ageable.worldObj.rand.nextInt(20) == 0) ageable.setGrowingAge(0); //setAdult + if (ageable.worldObj.rand.nextInt(20) == 0) ageable.setGrowingAge(0); // setAdult } }.register(Aspect.LIFE); public static final AuraEffect PANNUS = new AuraEffect.EntityAuraEffect() { @@ -107,7 +150,7 @@ public class AuraEffects { @Override public void doEntityEffect(ChunkCoordinates originTile, Entity e) { EntitySheep sheep = (EntitySheep) e; - if(sheep.worldObj.rand.nextInt(10) == 0) sheep.setSheared(false); + if (sheep.worldObj.rand.nextInt(10) == 0) sheep.setSheared(false); } @Override @@ -123,7 +166,7 @@ public class AuraEffects { @Override public void doEntityEffect(ChunkCoordinates originTile, Entity e) { - if(!EventHandlerEntity.registeredLuxPylons.contains(originTile)) + if (!EventHandlerEntity.registeredLuxPylons.contains(originTile)) EventHandlerEntity.registeredLuxPylons.add(originTile); } @@ -146,7 +189,8 @@ public class AuraEffects { @Override public void doBlockEffect(ChunkCoordinates originTile, ChunkCoordinates selectedBlock, World world) { int highestY = world.getTopSolidOrLiquidBlock(selectedBlock.posX, selectedBlock.posZ); - EntityLightningBolt entityLightning = new EntityLightningBolt(world, selectedBlock.posX + 0.5, highestY, selectedBlock.posZ + 0.5); + EntityLightningBolt entityLightning = + new EntityLightningBolt(world, selectedBlock.posX + 0.5, highestY, selectedBlock.posZ + 0.5); world.addWeatherEffect(entityLightning); } }.register(Aspect.WEATHER); @@ -163,8 +207,10 @@ public class AuraEffects { @Override public void doEntityEffect(ChunkCoordinates originTile, Entity e) { - if(e.worldObj.rand.nextInt(20) == 0 && !((EntityLivingBase) e).isPotionActive(Config.potionTaintPoisonID)) { - ((EntityLivingBase) e).addPotionEffect(new PotionEffect(Config.potionTaintPoisonID, ticksForSeconds(20), 0, true)); + if (e.worldObj.rand.nextInt(20) == 0 + && !((EntityLivingBase) e).isPotionActive(Config.potionTaintPoisonID)) { + ((EntityLivingBase) e) + .addPotionEffect(new PotionEffect(Config.potionTaintPoisonID, ticksForSeconds(20), 0, true)); } } @@ -175,12 +221,12 @@ public class AuraEffects { @Override public void doBlockEffect(ChunkCoordinates originTile, ChunkCoordinates selectedBlock, World world) { - if(!Config.genTaint) return; + if (!Config.genTaint) return; int x = selectedBlock.posX; int y = selectedBlock.posY; int z = selectedBlock.posZ; BlockTaintFibres.spreadFibres(world, x, y, z); - if(world.rand.nextInt(12) == 0) { + if (world.rand.nextInt(12) == 0) { Utils.setBiomeAt(world, x, z, ThaumcraftWorldGenerator.biomeTaint); world.addBlockEvent(x, y, z, world.getBlock(x, y, z), 1, 0); } @@ -206,13 +252,13 @@ public class AuraEffects { public void doEntityEffect(ChunkCoordinates originTile, Entity e) { EntityLivingBase living = (EntityLivingBase) e; int activeDuration = 0; - if(living.isPotionActive(Potion.moveSlowdown)) { + if (living.isPotionActive(Potion.moveSlowdown)) { PotionEffect effect = living.getActivePotionEffect(Potion.moveSlowdown); activeDuration = effect.getDuration(); } boolean canAdd = (ticksForMinutes(3) - activeDuration) >= 5; - if(canAdd) { + if (canAdd) { living.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), activeDuration + 5, 1, true)); } } @@ -230,7 +276,8 @@ public class AuraEffects { @Override public void doBlockEffect(ChunkCoordinates originTile, ChunkCoordinates selectedBlock, World world) { Block selected = world.getBlock(selectedBlock.posX, selectedBlock.posY, selectedBlock.posZ); - if(selected.equals(Blocks.water) && world.getBlockMetadata(selectedBlock.posX, selectedBlock.posY, selectedBlock.posZ) == 0) { + if (selected.equals(Blocks.water) + && world.getBlockMetadata(selectedBlock.posX, selectedBlock.posY, selectedBlock.posZ) == 0) { world.setBlock(selectedBlock.posX, selectedBlock.posY, selectedBlock.posZ, Blocks.ice); } } @@ -248,9 +295,12 @@ public class AuraEffects { @Override public void doEntityEffect(ChunkCoordinates originTile, Entity e) { - AuraEffects.addOrExtendPotionEffect(Potion.damageBoost, (EntityLivingBase) e, ticksForMinutes(3), 30, 1, false); - AuraEffects.addOrExtendPotionEffect(Potion.moveSpeed, (EntityLivingBase) e, ticksForMinutes(3), 30, 0, false); - AuraEffects.addOrExtendPotionEffect(Potion.regeneration, (EntityLivingBase) e, ticksForMinutes(3), 30, 0, false); + AuraEffects.addOrExtendPotionEffect( + Potion.damageBoost, (EntityLivingBase) e, ticksForMinutes(3), 30, 1, false); + AuraEffects.addOrExtendPotionEffect( + Potion.moveSpeed, (EntityLivingBase) e, ticksForMinutes(3), 30, 0, false); + AuraEffects.addOrExtendPotionEffect( + Potion.regeneration, (EntityLivingBase) e, ticksForMinutes(3), 30, 0, false); } @Override @@ -266,8 +316,9 @@ public class AuraEffects { @Override public void doBlockEffect(ChunkCoordinates originTile, ChunkCoordinates selectedBlock, World world) { EntityBrainyZombie zombie = new EntityBrainyZombie(world); - boolean canSpawn = AuraEffects.setAndCheckPosition(zombie, selectedBlock, world, true) && zombie.getCanSpawnHere(); //Position for getCanSpawn here is updated. - if(canSpawn) { + boolean canSpawn = AuraEffects.setAndCheckPosition(zombie, selectedBlock, world, true) + && zombie.getCanSpawnHere(); // Position for getCanSpawn here is updated. + if (canSpawn) { ChunkCoordinates pos = new ChunkCoordinates((int) zombie.posX, (int) zombie.posY, (int) zombie.posZ); pos = AuraEffects.iterateDown(pos, world); zombie.setPosition(pos.posX + 0.5, pos.posY, pos.posZ + 0.5); @@ -290,12 +341,14 @@ public class AuraEffects { public void doEntityEffect(ChunkCoordinates originTile, Entity e) { EntityPlayer player = (EntityPlayer) e; - if(player.getHeldItem() != null && player.getHeldItem().getItem() != null && player.getHeldItem().getItem() instanceof ItemWandCasting) { + if (player.getHeldItem() != null + && player.getHeldItem().getItem() != null + && player.getHeldItem().getItem() instanceof ItemWandCasting) { ItemStack wand = player.getHeldItem(); ItemWandCasting wandCasting = (ItemWandCasting) wand.getItem(); AspectList al = wandCasting.getAspectsWithRoom(wand); - for(Aspect a : al.getAspects()) { - if(a != null) wandCasting.addRealVis(wand, a, 4, true); + for (Aspect a : al.getAspects()) { + if (a != null) wandCasting.addRealVis(wand, a, 4, true); } } } @@ -315,10 +368,10 @@ public class AuraEffects { public void doEntityEffect(ChunkCoordinates originTile, Entity e) { EntityPlayer player = (EntityPlayer) e; - for(Aspect a : Aspect.getPrimalAspects()) { - if(a != null && e.worldObj.rand.nextInt(40) == 0) { - if(e.worldObj.rand.nextInt(20) == 0) { - //1 temp warp. + for (Aspect a : Aspect.getPrimalAspects()) { + if (a != null && e.worldObj.rand.nextInt(40) == 0) { + if (e.worldObj.rand.nextInt(20) == 0) { + // 1 temp warp. Thaumcraft.addWarpToPlayer(player, 1, true); } ScanManager.checkAndSyncAspectKnowledge(player, a, 1); @@ -399,7 +452,7 @@ public class AuraEffects { @Override public void doEntityEffect(ChunkCoordinates originTile, Entity e) { - if(!e.isImmuneToFire()) { + if (!e.isImmuneToFire()) { e.setFire(10); } } @@ -407,10 +460,12 @@ public class AuraEffects { public static final AuraEffect ELDRITCH = new AuraEffect.EntityAuraEffect() { @Override public boolean isEntityApplicable(Entity e) { - if(e instanceof EntityMob) { + if (e instanceof EntityMob) { EntityMob mob = (EntityMob) e; - if(mob.getEntityAttribute(EntityUtils.CHAMPION_MOD).getAttributeValue() < 0 - && mob.getEntityAttribute(SharedMonsterAttributes.maxHealth).getBaseValue() >= 10.0D) { + if (mob.getEntityAttribute(EntityUtils.CHAMPION_MOD).getAttributeValue() < 0 + && mob.getEntityAttribute(SharedMonsterAttributes.maxHealth) + .getBaseValue() + >= 10.0D) { boolean whitelisted = false; for (Class clazz : ConfigEntities.championModWhitelist.keySet()) { if (clazz.isAssignableFrom(e.getClass())) { @@ -430,15 +485,18 @@ public class AuraEffects { @Override public void doEntityEffect(ChunkCoordinates originTile, Entity e) { - if(e.worldObj.rand.nextInt(4) == 0) { + if (e.worldObj.rand.nextInt(4) == 0) { EntityMob mob = (EntityMob) e; PotionEffect effect = mob.getActivePotionEffect(RegisteredPotions.ELDRITCH); - if(effect != null && effect.getAmplifier() > 4) { + if (effect != null && effect.getAmplifier() > 4) { EntityUtils.makeChampion(mob, false); mob.removePotionEffect(RegisteredPotions.ELDRITCH.getId()); } else { - mob.addPotionEffect(new PotionEffect(RegisteredPotions.ELDRITCH.getId(), MiscUtils.ticksForMinutes(1), effect == null ? 1 : effect.getAmplifier() + 1)); + mob.addPotionEffect(new PotionEffect( + RegisteredPotions.ELDRITCH.getId(), + MiscUtils.ticksForMinutes(1), + effect == null ? 1 : effect.getAmplifier() + 1)); } } } @@ -457,19 +515,22 @@ public class AuraEffects { @Override public void doBlockEffect(ChunkCoordinates originTile, ChunkCoordinates selectedBlock, World world) { EntityLiving mob = world.rand.nextBoolean() ? new EntitySkeleton(world) : new EntityZombie(world); - if(AuraEffects.setAndCheckPosition(mob, selectedBlock, world, true) && world.difficultySetting != EnumDifficulty.PEACEFUL) { - for(int i = 0; i < 5; i++) { + if (AuraEffects.setAndCheckPosition(mob, selectedBlock, world, true) + && world.difficultySetting != EnumDifficulty.PEACEFUL) { + for (int i = 0; i < 5; i++) { mob.setCurrentItemOrArmor(i, null); } int timeout = 40; int totalCount = (world.rand.nextInt(3) == 0 ? 1 : 0) + 2; do { - int slot = mob.getEquipmentInSlot(0) == null ? 0 : (mob.getEquipmentInSlot(4) == null ? 4 : (world.rand.nextInt(3)+1)); - if(mob.getEquipmentInSlot(slot) == null) { + int slot = mob.getEquipmentInSlot(0) == null + ? 0 + : (mob.getEquipmentInSlot(4) == null ? 4 : (world.rand.nextInt(3) + 1)); + if (mob.getEquipmentInSlot(slot) == null) { ItemStack[] items = AuraEffects.ITEMS_SOUL[slot]; ItemStack stack = items[world.rand.nextInt(items.length)]; - if(stack.getItem() != Items.bow || mob instanceof EntitySkeleton) { + if (stack.getItem() != Items.bow || mob instanceof EntitySkeleton) { totalCount--; mob.setCurrentItemOrArmor(slot, stack); mob.setEquipmentDropChance(slot, 0); @@ -478,8 +539,9 @@ public class AuraEffects { timeout--; } while (totalCount > 0 && timeout > 0); - if(timeout > 0) { - mob.addPotionEffect(new PotionEffect(Potion.invisibility.getId(), MiscUtils.ticksForMinutes(60*24*365), 1, true)); + if (timeout > 0) { + mob.addPotionEffect(new PotionEffect( + Potion.invisibility.getId(), MiscUtils.ticksForMinutes(60 * 24 * 365), 1, true)); ChunkCoordinates pos = new ChunkCoordinates((int) mob.posX, (int) mob.posY, (int) mob.posZ); pos = AuraEffects.iterateDown(pos, world); @@ -489,7 +551,9 @@ public class AuraEffects { } } }.register(Aspect.SOUL); - public static final AuraEffect PRAECANTATIO = new PotionDistributionEffect(RegisteredPotions.VIS_DISCOUNT, 4, 6, ticksForMinutes(5), 1).register(Aspect.MAGIC); + public static final AuraEffect PRAECANTATIO = new PotionDistributionEffect( + RegisteredPotions.VIS_DISCOUNT, 4, 6, ticksForMinutes(5), 1) + .register(Aspect.MAGIC); public static final AuraEffect LIMUS = new AuraEffect.BlockAuraEffect() { @Override public int getBlockCount(Random random) { @@ -503,8 +567,9 @@ public class AuraEffects { slime.writeEntityToNBT(data); data.setInteger("Size", 0); slime.readEntityFromNBT(data); - boolean canSpawn = AuraEffects.setAndCheckPosition(slime, selectedBlock, world, true) && world.difficultySetting != EnumDifficulty.PEACEFUL; - if(canSpawn) { + boolean canSpawn = AuraEffects.setAndCheckPosition(slime, selectedBlock, world, true) + && world.difficultySetting != EnumDifficulty.PEACEFUL; + if (canSpawn) { ChunkCoordinates pos = new ChunkCoordinates((int) slime.posX, (int) slime.posY, (int) slime.posZ); pos = AuraEffects.iterateDown(pos, world); slime.setPosition(pos.posX + 0.5, pos.posY, pos.posZ + 0.5); @@ -519,7 +584,8 @@ public class AuraEffects { }.register(Aspect.SLIME); public static final AuraEffect BESTIA = new AuraEffect.BlockAuraEffect() { - private final Class[] animalClasses = { EntitySheep.class, EntityCow.class, EntityChicken.class, EntityPig.class }; + private final Class[] animalClasses = {EntitySheep.class, EntityCow.class, EntityChicken.class, EntityPig.class + }; @Override public int getBlockCount(Random random) { @@ -531,12 +597,13 @@ public class AuraEffects { Class animalClass = this.animalClasses[world.rand.nextInt(this.animalClasses.length)]; EntityLivingBase animal; try { - animal = (EntityLivingBase) animalClass.getConstructor(World.class).newInstance(world); + animal = (EntityLivingBase) + animalClass.getConstructor(World.class).newInstance(world); } catch (Exception e) { return; } boolean canSpawn = AuraEffects.setAndCheckPosition(animal, selectedBlock, world, true); - if(canSpawn) { + if (canSpawn) { ChunkCoordinates pos = new ChunkCoordinates((int) animal.posX, (int) animal.posY, (int) animal.posZ); pos = AuraEffects.iterateDown(pos, world); animal.setPosition(pos.posX + 0.5, pos.posY, pos.posZ + 0.5); @@ -550,19 +617,21 @@ public class AuraEffects { } }.register(Aspect.BEAST); - public static final AuraEffect VITREUS = new PotionDistributionEffect(RegisteredPotions.ACHROMATIC, 4, 6, ticksForMinutes(5), 0) { - @Override - public boolean isEntityApplicable(Entity e) { - return e instanceof EntityPlayer; - } - }.register(Aspect.CRYSTAL); + public static final AuraEffect VITREUS = + new PotionDistributionEffect(RegisteredPotions.ACHROMATIC, 4, 6, ticksForMinutes(5), 0) { + @Override + public boolean isEntityApplicable(Entity e) { + return e instanceof EntityPlayer; + } + }.register(Aspect.CRYSTAL); public static class PotionDistributionEffect extends AuraEffect.EntityAuraEffect { private Potion potion; private int tickInterval, addedDuration, durationCap, amplifier; - public PotionDistributionEffect(Potion potion, int tickInterval, int addedDuration, int durationCap, int amplifier) { + public PotionDistributionEffect( + Potion potion, int tickInterval, int addedDuration, int durationCap, int amplifier) { this.potion = potion; this.tickInterval = tickInterval; this.addedDuration = addedDuration; @@ -580,7 +649,8 @@ public class AuraEffects { if (e == null || !(e instanceof EntityLivingBase)) return; EntityLivingBase living = (EntityLivingBase) e; - AuraEffects.addOrExtendPotionEffect(this.potion, living, this.durationCap, this.addedDuration, this.amplifier); + AuraEffects.addOrExtendPotionEffect( + this.potion, living, this.durationCap, this.addedDuration, this.amplifier); } @Override @@ -592,74 +662,80 @@ public class AuraEffects { private static void waterLocation(ChunkCoordinates coordinates, World world) { Block block = world.getBlock(coordinates.posX, coordinates.posY, coordinates.posZ); if (block.getTickRandomly()) { - world.scheduleBlockUpdate(coordinates.posX, coordinates.posY, coordinates.posZ, block, world.rand.nextInt(8) + 2); + world.scheduleBlockUpdate( + coordinates.posX, coordinates.posY, coordinates.posZ, block, world.rand.nextInt(8) + 2); } - if(IntegrationThaumicTinkerer.isCropBlock(block)) { + if (IntegrationThaumicTinkerer.isCropBlock(block)) { TileEntity te = world.getTileEntity(coordinates.posX, coordinates.posY, coordinates.posZ); - if(te != null && IntegrationThaumicTinkerer.isCropTile(te)) { + if (te != null && IntegrationThaumicTinkerer.isCropTile(te)) { for (int i = 0; i < 10; i++) { - te.updateEntity(); //Badumm tss.. + te.updateEntity(); // Badumm tss.. } } } } - private static void addOrExtendPotionEffect(Potion potion, EntityLivingBase entityLiving, int cap, int durToAdd, int amplifier, boolean ambient) { + private static void addOrExtendPotionEffect( + Potion potion, EntityLivingBase entityLiving, int cap, int durToAdd, int amplifier, boolean ambient) { int activeDuration = 0; - if(entityLiving.isPotionActive(potion)) { + if (entityLiving.isPotionActive(potion)) { PotionEffect effect = entityLiving.getActivePotionEffect(potion); activeDuration = effect.getDuration(); } boolean canAdd = (cap - activeDuration) >= durToAdd; - if(canAdd) { - entityLiving.addPotionEffect(new PotionEffect(potion.getId(), activeDuration + durToAdd, amplifier, ambient)); + if (canAdd) { + entityLiving.addPotionEffect( + new PotionEffect(potion.getId(), activeDuration + durToAdd, amplifier, ambient)); } } - private static void addOrExtendPotionEffect(Potion potion, EntityLivingBase entityLiving, int cap, int durToAdd, int amplifier) { + private static void addOrExtendPotionEffect( + Potion potion, EntityLivingBase entityLiving, int cap, int durToAdd, int amplifier) { AuraEffects.addOrExtendPotionEffect(potion, entityLiving, cap, durToAdd, amplifier, true); } private static ChunkCoordinates iterateDown(ChunkCoordinates pos, World world) { - while(world.isAirBlock(pos.posX, pos.posY, pos.posZ)) { + while (world.isAirBlock(pos.posX, pos.posY, pos.posZ)) { pos.posY -= 1; } pos.posY += 1; return pos; } - //Designed for spawning. Looks in 1 block radius for possible location, and if one location is found, teleporting the entity there. - //Call with mayVary == true to search in 1 block radius, call with mayVary == false for only checking the current block. - private static boolean setAndCheckPosition(EntityLivingBase entity, ChunkCoordinates cc, World world, boolean mayVary) { - if(!world.isAirBlock(cc.posX, cc.posY, cc.posZ)) { - if(!mayVary) return false; + // Designed for spawning. Looks in 1 block radius for possible location, and if one location is found, teleporting + // the entity there. + // Call with mayVary == true to search in 1 block radius, call with mayVary == false for only checking the current + // block. + private static boolean setAndCheckPosition( + EntityLivingBase entity, ChunkCoordinates cc, World world, boolean mayVary) { + if (!world.isAirBlock(cc.posX, cc.posY, cc.posZ)) { + if (!mayVary) return false; ChunkCoordinates up = new ChunkCoordinates(cc.posX, cc.posY + 1, cc.posZ); - if(AuraEffects.setAndCheckPosition(entity, up, world, false)) { + if (AuraEffects.setAndCheckPosition(entity, up, world, false)) { return true; } ChunkCoordinates down = new ChunkCoordinates(cc.posX, cc.posY - 1, cc.posZ); return AuraEffects.setAndCheckPosition(entity, down, world, false); } ChunkCoordinates up = new ChunkCoordinates(cc.posX, cc.posY + 1, cc.posZ); - if(world.isAirBlock(up.posX, up.posY, up.posZ)) { + if (world.isAirBlock(up.posX, up.posY, up.posZ)) { entity.setPosition(up.posX, up.posY, up.posZ); return true; } ChunkCoordinates down = new ChunkCoordinates(cc.posX, cc.posY - 1, cc.posZ); - if(world.isAirBlock(down.posX, down.posY, down.posZ)) { + if (world.isAirBlock(down.posX, down.posY, down.posZ)) { entity.setPosition(down.posX, down.posY, down.posZ); return true; } - if(!mayVary) return false; - ChunkCoordinates hMove = new ChunkCoordinates(cc.posX + 1, cc.posY, cc.posZ ); - if(AuraEffects.setAndCheckPosition(entity, hMove, world, false)) return true; - hMove = new ChunkCoordinates(cc.posX , cc.posY, cc.posZ + 1); - if(AuraEffects.setAndCheckPosition(entity, hMove, world, false)) return true; - hMove = new ChunkCoordinates(cc.posX - 1, cc.posY, cc.posZ ); - if(AuraEffects.setAndCheckPosition(entity, hMove, world, false)) return true; - hMove = new ChunkCoordinates(cc.posX , cc.posY, cc.posZ - 1); + if (!mayVary) return false; + ChunkCoordinates hMove = new ChunkCoordinates(cc.posX + 1, cc.posY, cc.posZ); + if (AuraEffects.setAndCheckPosition(entity, hMove, world, false)) return true; + hMove = new ChunkCoordinates(cc.posX, cc.posY, cc.posZ + 1); + if (AuraEffects.setAndCheckPosition(entity, hMove, world, false)) return true; + hMove = new ChunkCoordinates(cc.posX - 1, cc.posY, cc.posZ); + if (AuraEffects.setAndCheckPosition(entity, hMove, world, false)) return true; + hMove = new ChunkCoordinates(cc.posX, cc.posY, cc.posZ - 1); return AuraEffects.setAndCheckPosition(entity, hMove, world, false); } - } diff --git a/src/main/java/makeo/gadomancy/common/aura/AuraResearchManager.java b/src/main/java/makeo/gadomancy/common/aura/AuraResearchManager.java index 3eda4a9..69d51c0 100644 --- a/src/main/java/makeo/gadomancy/common/aura/AuraResearchManager.java +++ b/src/main/java/makeo/gadomancy/common/aura/AuraResearchManager.java @@ -1,5 +1,7 @@ package makeo.gadomancy.common.aura; +import java.util.ArrayList; +import java.util.List; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.data.config.ModConfig; import makeo.gadomancy.common.network.PacketHandler; @@ -12,9 +14,6 @@ import thaumcraft.api.research.ResearchItem; import thaumcraft.common.Thaumcraft; import thaumcraft.common.lib.research.ResearchManager; -import java.util.ArrayList; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -28,14 +27,15 @@ public class AuraResearchManager { public static final String TC_AURA_RESEARCH_STR = "GADOMANCY.AURA.%s"; public static void tryUnlockAuraEffect(EntityPlayer player, Aspect aspect) { - if(!AuraEffectHandler.registeredEffects.containsKey(aspect)) return; - if(AuraResearchManager.isBlacklisted(aspect)) return; + if (!AuraEffectHandler.registeredEffects.containsKey(aspect)) return; + if (AuraResearchManager.isBlacklisted(aspect)) return; - if(!ResearchManager.isResearchComplete(player.getCommandSenderName(), Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS")) return; - if(!Thaumcraft.proxy.getPlayerKnowledge().hasDiscoveredAspect(player.getCommandSenderName(), aspect)) return; + if (!ResearchManager.isResearchComplete( + player.getCommandSenderName(), Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS")) return; + if (!Thaumcraft.proxy.getPlayerKnowledge().hasDiscoveredAspect(player.getCommandSenderName(), aspect)) return; String res = String.format(AuraResearchManager.TC_AURA_RESEARCH_STR, aspect.getTag()); - if(ResearchManager.isResearchComplete(player.getCommandSenderName(), res)) return; + if (ResearchManager.isResearchComplete(player.getCommandSenderName(), res)) return; Thaumcraft.proxy.getResearchManager().completeResearch(player, res); PacketTCNotificationText text = new PacketTCNotificationText("gadomancy.aura.research.unlock", aspect.getTag()); @@ -45,12 +45,12 @@ public class AuraResearchManager { public static List getLines(String aspectTag) { List lines = new ArrayList(); String base = "gadomancy.aura.effect." + aspectTag; - if(StatCollector.canTranslate(base)) { + if (StatCollector.canTranslate(base)) { lines.add(StatCollector.translateToLocal(base)); return lines; } int count = 0; - while(StatCollector.canTranslate(base + "_" + count)) { + while (StatCollector.canTranslate(base + "_" + count)) { lines.add(StatCollector.translateToLocal(base + "_" + count)); count++; } @@ -59,25 +59,28 @@ public class AuraResearchManager { public static List getKnowledge(EntityPlayer player) { List lines = new ArrayList(); - for(Aspect a : AuraEffectHandler.registeredEffects.keySet()) { - if(ResearchManager.isResearchComplete(player.getCommandSenderName(), String.format(AuraResearchManager.TC_AURA_RESEARCH_STR, a.getTag()))) { - if(!AuraResearchManager.isBlacklisted(a)) lines.add(a.getTag()); + for (Aspect a : AuraEffectHandler.registeredEffects.keySet()) { + if (ResearchManager.isResearchComplete( + player.getCommandSenderName(), + String.format(AuraResearchManager.TC_AURA_RESEARCH_STR, a.getTag()))) { + if (!AuraResearchManager.isBlacklisted(a)) lines.add(a.getTag()); } } return lines; } public static boolean isBlacklisted(Aspect a) { - for(String aspectTag : ModConfig.blacklistAuraEffects) { - if(aspectTag == null) continue; - if(aspectTag.equals(a.getTag())) return true; + for (String aspectTag : ModConfig.blacklistAuraEffects) { + if (aspectTag == null) continue; + if (aspectTag.equals(a.getTag())) return true; } return false; } public static void registerAuraResearches() { - for(Aspect a : AuraEffectHandler.registeredEffects.keySet()) { - new ResearchItem(String.format(AuraResearchManager.TC_AURA_RESEARCH_STR, a.getTag()), Gadomancy.MODID).registerResearchItem(); + for (Aspect a : AuraEffectHandler.registeredEffects.keySet()) { + new ResearchItem(String.format(AuraResearchManager.TC_AURA_RESEARCH_STR, a.getTag()), Gadomancy.MODID) + .registerResearchItem(); } } } diff --git a/src/main/java/makeo/gadomancy/common/aura/ResearchPageAuraAspects.java b/src/main/java/makeo/gadomancy/common/aura/ResearchPageAuraAspects.java index 8a67014..97fa52e 100644 --- a/src/main/java/makeo/gadomancy/common/aura/ResearchPageAuraAspects.java +++ b/src/main/java/makeo/gadomancy/common/aura/ResearchPageAuraAspects.java @@ -1,5 +1,8 @@ package makeo.gadomancy.common.aura; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import makeo.gadomancy.common.utils.SimpleResourceLocation; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; @@ -8,10 +11,6 @@ import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.research.ResearchPage; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -42,34 +41,37 @@ public class ResearchPageAuraAspects extends ResearchPage { public static int getAdditionalPagesFor(EntityPlayer player) { List knowledge = AuraResearchManager.getKnowledge(player); - if(knowledge.size() == 0) return 0; + if (knowledge.size() == 0) return 0; return ((knowledge.size() & 3) == 0) ? (knowledge.size() >> 2) : ((knowledge.size() >> 2) + 1); } public static List getAspectTagsForPageIndex(EntityPlayer player, int pageIndex) { List knowledge = AuraResearchManager.getKnowledge(player); - if(knowledge.size() <= 0) return new ArrayList(); + if (knowledge.size() <= 0) return new ArrayList(); Collections.sort(knowledge); int startIndex = pageIndex << 2; - if(knowledge.size() <= startIndex) return new ArrayList(); //Should not happen, because getAdditionalPages should only return indexes within range + if (knowledge.size() <= startIndex) + return new ArrayList< + String>(); // Should not happen, because getAdditionalPages should only return indexes within range return knowledge.subList(startIndex, (startIndex + 4 > knowledge.size()) ? knowledge.size() : startIndex + 4); } public static AspectList createPageAspectList(List tagList) { AspectList list = new AspectList(); - for(String tag : tagList) { + for (String tag : tagList) { Aspect a = ResearchPageAuraAspects.createAuraFakeAspect(tag); - if(a != null) list.add(a, 0); + if (a != null) list.add(a, 0); } return list; } private static Aspect createAuraFakeAspect(String tag) { Aspect original = Aspect.getAspect(tag); - if(original == null) return null; + if (original == null) return null; String fakeTemp = "GADOMANCY_TEMP_" + tag; - Aspect fake = new FakeAspect(fakeTemp, original.getColor(), null, original.getImage(), original.getBlend(), true); + Aspect fake = + new FakeAspect(fakeTemp, original.getColor(), null, original.getImage(), original.getBlend(), true); fake.setTag(original.getTag()); return fake; } @@ -78,7 +80,8 @@ public class ResearchPageAuraAspects extends ResearchPage { private boolean headAspect; - public FakeAspect(String tag, int color, Aspect[] components, ResourceLocation image, int blend, boolean isHead) { + public FakeAspect( + String tag, int color, Aspect[] components, ResourceLocation image, int blend, boolean isHead) { super(tag, color, components, image, blend); Aspect.aspects.remove(tag); this.headAspect = isHead; @@ -86,11 +89,10 @@ public class ResearchPageAuraAspects extends ResearchPage { @Override public String getName() { - if(this.headAspect) return super.getName(); + if (this.headAspect) return super.getName(); String tag = super.getTag(); - if(tag == null || tag.isEmpty() || tag.equals("")) return ""; + if (tag == null || tag.isEmpty() || tag.equals("")) return ""; return StatCollector.translateToLocal(tag); } } - } diff --git a/src/main/java/makeo/gadomancy/common/blocks/BlockArcaneDropper.java b/src/main/java/makeo/gadomancy/common/blocks/BlockArcaneDropper.java index 4d8b3b1..3aa7fa7 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/BlockArcaneDropper.java +++ b/src/main/java/makeo/gadomancy/common/blocks/BlockArcaneDropper.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.blocks; +import java.util.List; import makeo.gadomancy.common.blocks.tiles.TileArcaneDropper; import makeo.gadomancy.common.registration.RegisteredItems; import net.minecraft.block.material.Material; @@ -14,8 +15,6 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -48,7 +47,7 @@ public class BlockArcaneDropper extends BlockTransparent { } @Override - public boolean isOpaqueCube(){ + public boolean isOpaqueCube() { return false; } @@ -59,18 +58,21 @@ public class BlockArcaneDropper extends BlockTransparent { ForgeDirection direction = ForgeDirection.getOrientation(metadata & 7); boolean flipped = (metadata & 8) == 8; - if(direction == ForgeDirection.SOUTH - || direction == ForgeDirection.NORTH) { + if (direction == ForgeDirection.SOUTH || direction == ForgeDirection.NORTH) { flipped = !flipped; } - ForgeDirection rotated = direction.getRotation(flipped ? ForgeDirection.getOrientation((direction.ordinal() + 4) % 6) : ForgeDirection.getOrientation((direction.ordinal() + 2) % 6)); + ForgeDirection rotated = direction.getRotation( + flipped + ? ForgeDirection.getOrientation((direction.ordinal() + 4) % 6) + : ForgeDirection.getOrientation((direction.ordinal() + 2) % 6)); return direction != side && rotated != side && rotated.getOpposite() != side; } @Override - public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) { + public int onBlockPlaced( + World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) { return side; } @@ -84,30 +86,30 @@ public class BlockArcaneDropper extends BlockTransparent { } private static final AxisAlignedBB[] COLLISION_BOXES = { - AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 0.3125f, 1),//down - AxisAlignedBB.getBoundingBox(0, 0.6875f, 0, 1, 1, 1),//up - - AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 0.3125f),//north - AxisAlignedBB.getBoundingBox(0, 0, 0.6875f, 1, 1, 1),//south - - AxisAlignedBB.getBoundingBox(0, 0, 0, 0.3125f, 1, 1),//west - AxisAlignedBB.getBoundingBox(0.6875f, 0, 0, 1, 1, 1), //east + AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 0.3125f, 1), // down + AxisAlignedBB.getBoundingBox(0, 0.6875f, 0, 1, 1, 1), // up + AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 0.3125f), // north + AxisAlignedBB.getBoundingBox(0, 0, 0.6875f, 1, 1, 1), // south + AxisAlignedBB.getBoundingBox(0, 0, 0, 0.3125f, 1, 1), // west + AxisAlignedBB.getBoundingBox(0.6875f, 0, 0, 1, 1, 1), // east }; - public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB boundingBox, List list, Entity entity) { + public void addCollisionBoxesToList( + World world, int x, int y, int z, AxisAlignedBB boundingBox, List list, Entity entity) { ForgeDirection side = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z) & 7); - for(int i = 0; i < BlockArcaneDropper.COLLISION_BOXES.length; i++) { - if(i != side.ordinal()) { + for (int i = 0; i < BlockArcaneDropper.COLLISION_BOXES.length; i++) { + if (i != side.ordinal()) { this.setBlockBounds(BlockArcaneDropper.COLLISION_BOXES[i]); super.addCollisionBoxesToList(world, x, y, z, boundingBox, list, entity); } } - if(side.offsetX + side.offsetY + side.offsetZ < 0) { + if (side.offsetX + side.offsetY + side.offsetZ < 0) { this.setBlockBounds(side.offsetX * -0.125f, side.offsetY * -0.125f, side.offsetZ * -0.125f, 1f, 1f, 1f); } else { - this.setBlockBounds(0f, 0f, 0f, 1 - side.offsetX * 0.125f, 1 - side.offsetY * 0.125f, 1 - side.offsetZ * 0.125f); + this.setBlockBounds( + 0f, 0f, 0f, 1 - side.offsetX * 0.125f, 1 - side.offsetY * 0.125f, 1 - side.offsetZ * 0.125f); } super.addCollisionBoxesToList(world, x, y, z, boundingBox, list, entity); @@ -124,7 +126,7 @@ public class BlockArcaneDropper extends BlockTransparent { float pitch = entity.rotationPitch; boolean flipped; - if(side == ForgeDirection.UP || side == ForgeDirection.DOWN) { + if (side == ForgeDirection.UP || side == ForgeDirection.DOWN) { yaw += 180; flipped = yaw > 315 || yaw < 45 || (yaw < 225 && yaw > 135); } else { @@ -138,8 +140,8 @@ public class BlockArcaneDropper extends BlockTransparent { case EAST: yaw += 90; break; - default: - break; + default: + break; } flipped = Math.abs(yaw) < Math.abs(pitch); } diff --git a/src/main/java/makeo/gadomancy/common/blocks/BlockAuraPylon.java b/src/main/java/makeo/gadomancy/common/blocks/BlockAuraPylon.java index b85fd1a..6874422 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/BlockAuraPylon.java +++ b/src/main/java/makeo/gadomancy/common/blocks/BlockAuraPylon.java @@ -1,6 +1,7 @@ package makeo.gadomancy.common.blocks; import cpw.mods.fml.common.network.NetworkRegistry; +import java.util.List; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.blocks.tiles.TileAuraPylon; import makeo.gadomancy.common.blocks.tiles.TileAuraPylonTop; @@ -27,8 +28,6 @@ import thaumcraft.api.ThaumcraftApiHelper; import thaumcraft.common.items.wands.ItemWandCasting; import thaumcraft.common.lib.research.ResearchManager; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -70,7 +69,7 @@ public class BlockAuraPylon extends BlockContainer implements IBlockTransparent @Override public int getLightValue(IBlockAccess world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); - if(meta == 1) { + if (meta == 1) { return 10; } return super.getLightValue(world, x, y, z); @@ -84,7 +83,10 @@ public class BlockAuraPylon extends BlockContainer implements IBlockTransparent @Override public boolean canReplace(World world, int x, int y, int z, int side, ItemStack stack) { int damage = stack.getItemDamage(); - if (damage == 1 && (y < 1 || world.getBlock(x, y - 1, z) != RegisteredBlocks.blockAuraPylon || world.getBlockMetadata(x, y - 1, z) != 0)) { + if (damage == 1 + && (y < 1 + || world.getBlock(x, y - 1, z) != RegisteredBlocks.blockAuraPylon + || world.getBlockMetadata(x, y - 1, z) != 0)) { return false; } return super.canReplace(world, x, y, z, side, stack); @@ -92,7 +94,7 @@ public class BlockAuraPylon extends BlockContainer implements IBlockTransparent @Override public TileEntity createNewTileEntity(World world, int meta) { - if(meta == 0) { + if (meta == 0) { return new TileAuraPylon(); } else { return new TileAuraPylonTop(); @@ -100,20 +102,30 @@ public class BlockAuraPylon extends BlockContainer implements IBlockTransparent } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) { - if(world.getBlockMetadata(x, y, z) != 1) { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) { + if (world.getBlockMetadata(x, y, z) != 1) { Block up = world.getBlock(x, y + 1, z); - return up instanceof BlockAuraPylon && up.onBlockActivated(world, x, y + 1, z, player, side, par7, par8, par9); + return up instanceof BlockAuraPylon + && up.onBlockActivated(world, x, y + 1, z, player, side, par7, par8, par9); } ItemStack heldItem = player.getHeldItem(); - if(!world.isRemote && heldItem != null && heldItem.getItem() instanceof ItemWandCasting && - ResearchManager.isResearchComplete(player.getCommandSenderName(), Gadomancy.MODID.toUpperCase() + ".AURA_PYLON")) { + if (!world.isRemote + && heldItem != null + && heldItem.getItem() instanceof ItemWandCasting + && ResearchManager.isResearchComplete( + player.getCommandSenderName(), Gadomancy.MODID.toUpperCase() + ".AURA_PYLON")) { TileAuraPylon tileAuraPylon = (TileAuraPylon) world.getTileEntity(x, y - 1, z); - if(MultiblockHelper.isMultiblockPresent(world, x, y, z, RegisteredMultiblocks.auraPylonPattern) && - !tileAuraPylon.isPartOfMultiblock() && - ThaumcraftApiHelper.consumeVisFromWandCrafting(player.getCurrentEquippedItem(), player, RegisteredRecipes.costsAuraPylonMultiblock, true)) { + if (MultiblockHelper.isMultiblockPresent(world, x, y, z, RegisteredMultiblocks.auraPylonPattern) + && !tileAuraPylon.isPartOfMultiblock() + && ThaumcraftApiHelper.consumeVisFromWandCrafting( + player.getCurrentEquippedItem(), + player, + RegisteredRecipes.costsAuraPylonMultiblock, + true)) { PacketStartAnimation pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, x, y, z); - NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32); + NetworkRegistry.TargetPoint point = + new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32); PacketHandler.INSTANCE.sendToAllAround(pkt, point); TileAuraPylon ta = (TileAuraPylon) world.getTileEntity(x, y - 1, z); ta.setTileInformation(true, false); diff --git a/src/main/java/makeo/gadomancy/common/blocks/BlockEssentiaCompressor.java b/src/main/java/makeo/gadomancy/common/blocks/BlockEssentiaCompressor.java index 2905417..97a26c6 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/BlockEssentiaCompressor.java +++ b/src/main/java/makeo/gadomancy/common/blocks/BlockEssentiaCompressor.java @@ -69,11 +69,10 @@ public class BlockEssentiaCompressor extends BlockContainer implements IBlockTra @Override public int getLightValue(IBlockAccess world, int x, int y, int z) { TileEntity te = world.getTileEntity(x, y, z); - if(te == null || !(te instanceof TileEssentiaCompressor)) { + if (te == null || !(te instanceof TileEssentiaCompressor)) { return 0; } else { - if(((TileEssentiaCompressor) te).isMultiblockFormed() && - ((TileEssentiaCompressor) te).isMasterTile()) { + if (((TileEssentiaCompressor) te).isMultiblockFormed() && ((TileEssentiaCompressor) te).isMasterTile()) { return 8; } } @@ -85,11 +84,11 @@ public class BlockEssentiaCompressor extends BlockContainer implements IBlockTra super.breakBlock(world, x, y, z, block, meta); TileEntity te = world.getTileEntity(x, y, z); - if(te == null || !(te instanceof TileEssentiaCompressor)) return; + if (te == null || !(te instanceof TileEssentiaCompressor)) return; TileEssentiaCompressor compressor = (TileEssentiaCompressor) te; - if(compressor.isMultiblockFormed()) { + if (compressor.isMultiblockFormed()) { AspectList al = compressor.getAspects(); - if(al.visSize() > 0) { + if (al.visSize() > 0) { ExplosionHelper.taintplosion(world, x, y, z, true, 2, 2.0F, 4, 20); world.setBlockToAir(x, y, z); } else { @@ -102,13 +101,13 @@ public class BlockEssentiaCompressor extends BlockContainer implements IBlockTra @Override public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { TileEntity te = world.getTileEntity(x, y, z); - if(te == null || !(te instanceof TileEssentiaCompressor)) { + if (te == null || !(te instanceof TileEssentiaCompressor)) { super.setBlockBoundsBasedOnState(world, x, y, z); return; } - if(((TileEssentiaCompressor) te).isMultiblockFormed()) { - if(((TileEssentiaCompressor) te).isMasterTile()) { - this.setBlockBounds(0, 0, 0, 1, 3, 1); //master is lowest tile here. + if (((TileEssentiaCompressor) te).isMultiblockFormed()) { + if (((TileEssentiaCompressor) te).isMasterTile()) { + this.setBlockBounds(0, 0, 0, 1, 3, 1); // master is lowest tile here. } else { int yM = ((TileEssentiaCompressor) te).getMultiblockYIndex(); this.setBlockBounds(0, -yM, 0, 1, 3 - yM, 1); @@ -119,37 +118,63 @@ public class BlockEssentiaCompressor extends BlockContainer implements IBlockTra } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int these, float are, float some, float variables) { //LUL side, hitx, hity, hitz - if(world.isRemote) return false; + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int these, + float are, + float some, + float variables) { // LUL side, hitx, hity, hitz + if (world.isRemote) return false; TileEntity te = world.getTileEntity(x, y, z); - if(te == null || !(te instanceof TileEssentiaCompressor)) return false; - if(((TileEssentiaCompressor) te).isMultiblockFormed()) { - if(!((TileEssentiaCompressor) te).isMasterTile()) { + if (te == null || !(te instanceof TileEssentiaCompressor)) return false; + if (((TileEssentiaCompressor) te).isMultiblockFormed()) { + if (!((TileEssentiaCompressor) te).isMasterTile()) { int yOffset = ((TileEssentiaCompressor) te).getMultiblockYIndex(); - return RegisteredBlocks.blockEssentiaCompressor.onBlockActivated(world, x, y - yOffset, z, player, these, are, some, variables); + return RegisteredBlocks.blockEssentiaCompressor.onBlockActivated( + world, x, y - yOffset, z, player, these, are, some, variables); } } else { ItemStack heldItem = player.getHeldItem(); - if(heldItem != null && heldItem.getItem() instanceof ItemWandCasting && - ResearchManager.isResearchComplete(player.getCommandSenderName(), SimpleResearchItem.getFullName("ESSENTIA_COMPRESSOR"))) { + if (heldItem != null + && heldItem.getItem() instanceof ItemWandCasting + && ResearchManager.isResearchComplete( + player.getCommandSenderName(), SimpleResearchItem.getFullName("ESSENTIA_COMPRESSOR"))) { ChunkCoordinates lowest = this.findLowestCompressorBlock(world, x, y, z); boolean canForm = lowest != null && this.isMuliblockPossible(world, lowest); - if(canForm && ThaumcraftApiHelper.consumeVisFromWandCrafting(player.getCurrentEquippedItem(), player, RegisteredRecipes.costsCompressorMultiblock, true)) { + if (canForm + && ThaumcraftApiHelper.consumeVisFromWandCrafting( + player.getCurrentEquippedItem(), + player, + RegisteredRecipes.costsCompressorMultiblock, + true)) { int multiblockID = TileEssentiaCompressor.getAndIncrementNewMultiblockId(); - TileEssentiaCompressor compressor = (TileEssentiaCompressor) world.getTileEntity(lowest.posX, lowest.posY, lowest.posZ); + TileEssentiaCompressor compressor = + (TileEssentiaCompressor) world.getTileEntity(lowest.posX, lowest.posY, lowest.posZ); compressor.setInMultiblock(true, 0, multiblockID); - PacketStartAnimation pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, lowest.posX, lowest.posY, lowest.posZ); - NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, lowest.posX, lowest.posY, lowest.posZ, 32); + PacketStartAnimation pkt = new PacketStartAnimation( + PacketStartAnimation.ID_SPARKLE_SPREAD, lowest.posX, lowest.posY, lowest.posZ); + NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint( + world.provider.dimensionId, lowest.posX, lowest.posY, lowest.posZ, 32); PacketHandler.INSTANCE.sendToAllAround(pkt, point); - compressor = (TileEssentiaCompressor) world.getTileEntity(lowest.posX, lowest.posY + 1, lowest.posZ); + compressor = + (TileEssentiaCompressor) world.getTileEntity(lowest.posX, lowest.posY + 1, lowest.posZ); compressor.setInMultiblock(false, 1, multiblockID); - pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, lowest.posX, lowest.posY + 1, lowest.posZ); - point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, lowest.posX, lowest.posY + 1, lowest.posZ, 32); + pkt = new PacketStartAnimation( + PacketStartAnimation.ID_SPARKLE_SPREAD, lowest.posX, lowest.posY + 1, lowest.posZ); + point = new NetworkRegistry.TargetPoint( + world.provider.dimensionId, lowest.posX, lowest.posY + 1, lowest.posZ, 32); PacketHandler.INSTANCE.sendToAllAround(pkt, point); - compressor = (TileEssentiaCompressor) world.getTileEntity(lowest.posX, lowest.posY + 2, lowest.posZ); + compressor = + (TileEssentiaCompressor) world.getTileEntity(lowest.posX, lowest.posY + 2, lowest.posZ); compressor.setInMultiblock(false, 2, multiblockID); - pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, lowest.posX, lowest.posY + 2, lowest.posZ); - point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, lowest.posX, lowest.posY + 2, lowest.posZ, 32); + pkt = new PacketStartAnimation( + PacketStartAnimation.ID_SPARKLE_SPREAD, lowest.posX, lowest.posY + 2, lowest.posZ); + point = new NetworkRegistry.TargetPoint( + world.provider.dimensionId, lowest.posX, lowest.posY + 2, lowest.posZ, 32); PacketHandler.INSTANCE.sendToAllAround(pkt, point); } } @@ -158,16 +183,16 @@ public class BlockEssentiaCompressor extends BlockContainer implements IBlockTra } private boolean isMuliblockPossible(World world, ChunkCoordinates lowest) { - return lowest != null && - this.isMultiblockable(world, lowest.posX, lowest.posY , lowest.posZ) && - this.isMultiblockable(world, lowest.posX, lowest.posY + 1, lowest.posZ) && - this.isMultiblockable(world, lowest.posX, lowest.posY + 2, lowest.posZ); + return lowest != null + && this.isMultiblockable(world, lowest.posX, lowest.posY, lowest.posZ) + && this.isMultiblockable(world, lowest.posX, lowest.posY + 1, lowest.posZ) + && this.isMultiblockable(world, lowest.posX, lowest.posY + 2, lowest.posZ); } private ChunkCoordinates findLowestCompressorBlock(World world, int x, int y, int z) { ChunkCoordinates result = null; for (int i = 0; i <= y; i++) { - if(!this.isMultiblockable(world, x, y - i, z)) break; + if (!this.isMultiblockable(world, x, y - i, z)) break; result = new ChunkCoordinates(x, y - i, z); } return result; @@ -176,8 +201,8 @@ public class BlockEssentiaCompressor extends BlockContainer implements IBlockTra private boolean isMultiblockable(World world, int x, int y, int z) { Block block = world.getBlock(x, y, z); TileEntity te = world.getTileEntity(x, y, z); - if(!block.equals(RegisteredBlocks.blockEssentiaCompressor)) return false; - if(te == null || !(te instanceof TileEssentiaCompressor)) return false; + if (!block.equals(RegisteredBlocks.blockEssentiaCompressor)) return false; + if (te == null || !(te instanceof TileEssentiaCompressor)) return false; TileEssentiaCompressor compressor = (TileEssentiaCompressor) te; return !compressor.isMultiblockFormed(); } diff --git a/src/main/java/makeo/gadomancy/common/blocks/BlockExtendedNodeJar.java b/src/main/java/makeo/gadomancy/common/blocks/BlockExtendedNodeJar.java index 05fee77..9f0ec82 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/BlockExtendedNodeJar.java +++ b/src/main/java/makeo/gadomancy/common/blocks/BlockExtendedNodeJar.java @@ -2,6 +2,8 @@ package makeo.gadomancy.common.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import makeo.gadomancy.common.blocks.tiles.TileExtendedNodeJar; import makeo.gadomancy.common.items.ItemExtendedNodeJar; import makeo.gadomancy.common.registration.RegisteredBlocks; @@ -22,9 +24,6 @@ import thaumcraft.common.blocks.BlockJar; import thaumcraft.common.blocks.CustomStepSound; import thaumcraft.common.config.ConfigBlocks; -import java.util.ArrayList; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -76,8 +75,8 @@ public class BlockExtendedNodeJar extends BlockContainer { return RegisteredBlocks.rendererExtendedNodeJarBlock; } - - public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) { + public void onBlockHarvested( + World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) { this.dropBlockAsItem(par1World, par2, par3, par4, par5, 0); super.onBlockHarvested(par1World, par2, par3, par4, par5, par6EntityPlayer); } @@ -85,12 +84,22 @@ public class BlockExtendedNodeJar extends BlockContainer { public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { ArrayList drops = new ArrayList(); TileEntity te = world.getTileEntity(x, y, z); - if ((te != null) && ((te instanceof TileExtendedNodeJar)) && (((TileExtendedNodeJar) te).drop) && - (((TileExtendedNodeJar) te).getAspects() != null)) { + if ((te != null) + && ((te instanceof TileExtendedNodeJar)) + && (((TileExtendedNodeJar) te).drop) + && (((TileExtendedNodeJar) te).getAspects() != null)) { ItemStack drop = new ItemStack(RegisteredItems.itemExtendedNodeJar); - ((ItemExtendedNodeJar) drop.getItem()).setAspects(drop, ((TileExtendedNodeJar) te).getAspects().copy()); - ((ItemExtendedNodeJar) drop.getItem()).setNodeAttributes(drop, ((TileExtendedNodeJar) te).getNodeType(), ((TileExtendedNodeJar) te).getNodeModifier(), ((TileExtendedNodeJar) te).getExtendedNodeType(), ((TileExtendedNodeJar) te).getId()); - ((ItemExtendedNodeJar) drop.getItem()).setBehaviorSnapshot(drop, ((TileExtendedNodeJar) te).getBehaviorSnapshot()); + ((ItemExtendedNodeJar) drop.getItem()) + .setAspects(drop, ((TileExtendedNodeJar) te).getAspects().copy()); + ((ItemExtendedNodeJar) drop.getItem()) + .setNodeAttributes( + drop, + ((TileExtendedNodeJar) te).getNodeType(), + ((TileExtendedNodeJar) te).getNodeModifier(), + ((TileExtendedNodeJar) te).getExtendedNodeType(), + ((TileExtendedNodeJar) te).getId()); + ((ItemExtendedNodeJar) drop.getItem()) + .setBehaviorSnapshot(drop, ((TileExtendedNodeJar) te).getBehaviorSnapshot()); drops.add(drop); } return drops; @@ -106,7 +115,8 @@ public class BlockExtendedNodeJar extends BlockContainer { super.setBlockBoundsBasedOnState(world, i, j, k); } - public void addCollisionBoxesToList(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List arraylist, Entity par7Entity) { + public void addCollisionBoxesToList( + World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List arraylist, Entity par7Entity) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); } @@ -114,5 +124,4 @@ public class BlockExtendedNodeJar extends BlockContainer { public int getLightValue(IBlockAccess world, int x, int y, int z) { return 11; } - } diff --git a/src/main/java/makeo/gadomancy/common/blocks/BlockInfusionClaw.java b/src/main/java/makeo/gadomancy/common/blocks/BlockInfusionClaw.java index 1f3de34..bc13cb2 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/BlockInfusionClaw.java +++ b/src/main/java/makeo/gadomancy/common/blocks/BlockInfusionClaw.java @@ -39,7 +39,7 @@ public class BlockInfusionClaw extends BlockTransparent { @Override public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { - if(!world.isRemote) { + if (!world.isRemote) { TileInfusionClaw tile = (TileInfusionClaw) world.getTileEntity(x, y, z); tile.updateRedstone(world.isBlockIndirectlyGettingPowered(x, y, z)); } @@ -47,7 +47,7 @@ public class BlockInfusionClaw extends BlockTransparent { @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) { - if(entity instanceof EntityPlayer) { + if (entity instanceof EntityPlayer) { TileInfusionClaw tile = (TileInfusionClaw) world.getTileEntity(x, y, z); tile.setOwner((EntityPlayer) entity); } @@ -69,12 +69,21 @@ public class BlockInfusionClaw extends BlockTransparent { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { - if(!world.isRemote) { + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int p_149727_6_, + float p_149727_7_, + float p_149727_8_, + float p_149727_9_) { + if (!world.isRemote) { TileInfusionClaw tile = (TileInfusionClaw) world.getTileEntity(x, y, z); - if(tile.hasOwner()) { + if (tile.hasOwner()) { player.openGui(Gadomancy.instance, 1, world, x, y, z); - } else if(tile.setOwner(player)) { + } else if (tile.setOwner(player)) { player.addChatComponentMessage(new ChatComponentTranslation("gadomancy.info.InfusionClaw.owner")); } } @@ -85,7 +94,7 @@ public class BlockInfusionClaw extends BlockTransparent { public void breakBlock(World world, int x, int y, int z, Block block, int metadata) { TileInfusionClaw tile = (TileInfusionClaw) world.getTileEntity(x, y, z); ItemStack wandStack = tile.getStackInSlot(0); - if(wandStack != null && wandStack.stackSize > 0) { + if (wandStack != null && wandStack.stackSize > 0) { float f = world.rand.nextFloat() * 0.8F + 0.1F; float f1 = world.rand.nextFloat() * 0.8F + 0.1F; float f2 = world.rand.nextFloat() * 0.8F + 0.1F; @@ -104,9 +113,9 @@ public class BlockInfusionClaw extends BlockTransparent { @Override public int getComparatorInputOverride(World world, int x, int y, int z, int side) { - if(y > 0) { + if (y > 0) { ClickBehavior behavior = RegisteredBlocks.getClawClickBehavior(world, x, y - 1, z); - if(behavior != null) { + if (behavior != null) { return behavior.getComparatorOutput(); } } diff --git a/src/main/java/makeo/gadomancy/common/blocks/BlockKnowledgeBook.java b/src/main/java/makeo/gadomancy/common/blocks/BlockKnowledgeBook.java index 8aa195c..454fb6c 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/BlockKnowledgeBook.java +++ b/src/main/java/makeo/gadomancy/common/blocks/BlockKnowledgeBook.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.blocks; +import java.util.ArrayList; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.blocks.tiles.TileKnowledgeBook; import makeo.gadomancy.common.registration.RegisteredBlocks; @@ -18,15 +19,14 @@ import net.minecraft.world.World; import thaumcraft.common.config.ConfigBlocks; import thaumcraft.common.config.ConfigItems; -import java.util.ArrayList; - /** * HellFirePvP@Admin * Date: 19.04.2016 / 14:52 * on Gadomancy * BlockKnowledgeBook */ -public class BlockKnowledgeBook extends BlockContainer implements IBlockTransparent, TileKnowledgeBook.IKnowledgeProvider { +public class BlockKnowledgeBook extends BlockContainer + implements IBlockTransparent, TileKnowledgeBook.IKnowledgeProvider { private IIcon icon; @@ -54,7 +54,16 @@ public class BlockKnowledgeBook extends BlockContainer implements IBlockTranspar } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int p_149727_6_, + float p_149727_7_, + float p_149727_8_, + float p_149727_9_) { ItemStack thaumonomicon = new ItemStack(ConfigItems.itemThaumonomicon); ConfigItems.itemThaumonomicon.onItemRightClick(thaumonomicon, world, player); /*if(world.isRemote) { @@ -70,21 +79,21 @@ public class BlockKnowledgeBook extends BlockContainer implements IBlockTranspar @Override public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) { - if(world.isRemote) return; + if (world.isRemote) return; Block lower = world.getBlock(x, y - 1, z); int metaLower = world.getBlockMetadata(x, y - 1, z); - if(!lower.equals(ConfigBlocks.blockStoneDevice) || metaLower != 1) { + if (!lower.equals(ConfigBlocks.blockStoneDevice) || metaLower != 1) { this.breakThisBlock(world, x, y, z); } - if(!world.isAirBlock(x, y + 1, z)) { + if (!world.isAirBlock(x, y + 1, z)) { this.breakThisBlock(world, x, y, z); } } private void breakThisBlock(World world, int x, int y, int z) { - if(world.isRemote) return; + if (world.isRemote) return; ArrayList stacks = this.getDrops(world, x, y, z, 0, 0); - for(ItemStack i : stacks) { + for (ItemStack i : stacks) { EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, i); world.spawnEntityInWorld(item); } @@ -103,8 +112,8 @@ public class BlockKnowledgeBook extends BlockContainer implements IBlockTranspar public int getComparatorInputOverride(World world, int x, int y, int z, int p_149736_5_) { TileEntity te = world.getTileEntity(x, y, z); if (te instanceof TileKnowledgeBook) { - if(((TileKnowledgeBook) te).isResearching()) { - if(((TileKnowledgeBook) te).hasCognitio()) { + if (((TileKnowledgeBook) te).isResearching()) { + if (((TileKnowledgeBook) te).hasCognitio()) { return 15; } return 1; diff --git a/src/main/java/makeo/gadomancy/common/blocks/BlockNode.java b/src/main/java/makeo/gadomancy/common/blocks/BlockNode.java index a2e8207..327bac1 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/BlockNode.java +++ b/src/main/java/makeo/gadomancy/common/blocks/BlockNode.java @@ -16,7 +16,7 @@ public class BlockNode extends thaumcraft.common.blocks.BlockAiry { @Override public TileEntity createTileEntity(World world, int metadata) { - if(metadata == 0) { + if (metadata == 0) { return new TileExtendedNode(); } return super.createTileEntity(world, metadata); diff --git a/src/main/java/makeo/gadomancy/common/blocks/BlockNodeManipulator.java b/src/main/java/makeo/gadomancy/common/blocks/BlockNodeManipulator.java index bf391d5..e9775a3 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/BlockNodeManipulator.java +++ b/src/main/java/makeo/gadomancy/common/blocks/BlockNodeManipulator.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.blocks; +import java.util.List; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.blocks.tiles.TileNodeManipulator; import makeo.gadomancy.common.registration.RegisteredItems; @@ -15,8 +16,6 @@ import thaumcraft.common.blocks.BlockStoneDevice; import thaumcraft.common.items.wands.ItemWandCasting; import thaumcraft.common.lib.research.ResearchManager; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -50,11 +49,10 @@ public class BlockNodeManipulator extends BlockStoneDevice { return null; } - //TC stuff... + // TC stuff... @Override public TileEntity createTileEntity(World world, int metadata) { - if (metadata == 5) - return new TileNodeManipulator(); + if (metadata == 5) return new TileNodeManipulator(); return null; } @@ -73,17 +71,22 @@ public class BlockNodeManipulator extends BlockStoneDevice { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) { TileNodeManipulator tile = (TileNodeManipulator) world.getTileEntity(x, y, z); ItemStack heldItem = player.getHeldItem(); - if(tile.isInMultiblock()) { + if (tile.isInMultiblock()) { super.onBlockActivated(world, x, y, z, player, side, par7, par8, par9); - } else if(!world.isRemote && heldItem != null && heldItem.getItem() instanceof ItemWandCasting) { + } else if (!world.isRemote && heldItem != null && heldItem.getItem() instanceof ItemWandCasting) { tile.checkMultiblock(); if (tile.isMultiblockStructurePresent()) { String research = tile.getMultiblockType().getResearchNeeded(); - if(!ResearchManager.isResearchComplete(player.getCommandSenderName(), research)) return false; - if (ThaumcraftApiHelper.consumeVisFromWandCrafting(player.getCurrentEquippedItem(), player, tile.getMultiblockType().getMultiblockCosts(), true)) { + if (!ResearchManager.isResearchComplete(player.getCommandSenderName(), research)) return false; + if (ThaumcraftApiHelper.consumeVisFromWandCrafting( + player.getCurrentEquippedItem(), + player, + tile.getMultiblockType().getMultiblockCosts(), + true)) { tile.formMultiblock(); return true; } diff --git a/src/main/java/makeo/gadomancy/common/blocks/BlockRemoteJar.java b/src/main/java/makeo/gadomancy/common/blocks/BlockRemoteJar.java index 72823d5..0e5e99e 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/BlockRemoteJar.java +++ b/src/main/java/makeo/gadomancy/common/blocks/BlockRemoteJar.java @@ -1,5 +1,7 @@ package makeo.gadomancy.common.blocks; +import java.util.ArrayList; +import java.util.List; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.blocks.tiles.TileRemoteJar; import makeo.gadomancy.common.blocks.tiles.TileStickyJar; @@ -16,9 +18,6 @@ import thaumcraft.common.blocks.BlockJar; import thaumcraft.common.config.ConfigItems; import thaumcraft.common.tiles.TileJarFillable; -import java.util.ArrayList; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -55,12 +54,12 @@ public class BlockRemoteJar extends BlockJar { public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { ArrayList drops = super.getDrops(world, x, y, z, metadata, fortune); - for(ItemStack drop : drops) { - if(drop.getItem() == ConfigItems.itemJarFilled || drop.getItem() == Item.getItemFromBlock(this)) { + for (ItemStack drop : drops) { + if (drop.getItem() == ConfigItems.itemJarFilled || drop.getItem() == Item.getItemFromBlock(this)) { drop.func_150996_a(Item.getItemFromBlock(this)); TileRemoteJar tile = BlockRemoteJar.getJarTile(world, x, y, z); - if(tile.networkId != null) { + if (tile.networkId != null) { NBTHelper.setUUID(NBTHelper.getData(drop), "networkId", tile.networkId); } } @@ -69,11 +68,13 @@ public class BlockRemoteJar extends BlockJar { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float these, float are, float variables) { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float these, float are, float variables) { ItemStack heldItem = player.getHeldItem(); if (heldItem != null && heldItem.getItem() == ConfigItems.itemEssence) { - if(!world.isRemote) { - BlockStickyJar.handlePhial(world, x, y, z, player, heldItem, (TileJarFillable) world.getTileEntity(x, y, z)); + if (!world.isRemote) { + BlockStickyJar.handlePhial( + world, x, y, z, player, heldItem, (TileJarFillable) world.getTileEntity(x, y, z)); } return true; } diff --git a/src/main/java/makeo/gadomancy/common/blocks/BlockStickyJar.java b/src/main/java/makeo/gadomancy/common/blocks/BlockStickyJar.java index 403e602..718478f 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/BlockStickyJar.java +++ b/src/main/java/makeo/gadomancy/common/blocks/BlockStickyJar.java @@ -1,5 +1,7 @@ package makeo.gadomancy.common.blocks; +import java.util.ArrayList; +import java.util.Map; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.blocks.tiles.TileStickyJar; import makeo.gadomancy.common.registration.RegisteredBlocks; @@ -27,9 +29,6 @@ import thaumcraft.common.config.ConfigItems; import thaumcraft.common.items.ItemEssence; import thaumcraft.common.tiles.TileJarFillable; -import java.util.ArrayList; -import java.util.Map; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -49,9 +48,9 @@ public class BlockStickyJar extends BlockJar implements IBlockTransparent { @Override public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { TileEntity tile = world.getTileEntity(x, y, z); - if(tile instanceof TileStickyJar) { + if (tile instanceof TileStickyJar) { TileStickyJar stickyJar = (TileStickyJar) tile; - if(stickyJar.isValid()) { + if (stickyJar.isValid()) { return stickyJar.getParentBlock().getIcon(world, x, y, z, side); } } @@ -176,8 +175,8 @@ public class BlockStickyJar extends BlockJar implements IBlockTransparent { case EAST: yaw += 90; break; - default: - break; + default: + break; } if (Math.abs(yaw) < Math.abs(pitch)) { @@ -212,14 +211,15 @@ public class BlockStickyJar extends BlockJar implements IBlockTransparent { TileEntity tile = world.getTileEntity(x, y, z); if (tile != null && tile instanceof TileStickyJar && ((TileStickyJar) tile).isValid()) { - ((TileStickyJar) tile).getParent().validate(); //Ugh... - world.setTileEntity(x, y, z, ((TileStickyJar) tile).getParent()); //Ugh. that fix... + ((TileStickyJar) tile).getParent().validate(); // Ugh... + world.setTileEntity(x, y, z, ((TileStickyJar) tile).getParent()); // Ugh. that fix... - ArrayList drops = ((TileStickyJar) tile).getParentBlock() + ArrayList drops = ((TileStickyJar) tile) + .getParentBlock() .getDrops(world, x, y, z, ((TileStickyJar) tile).getParentMetadata(), fortune); - ((TileStickyJar) tile).getParent().invalidate(); //Uhm... - world.setTileEntity(x, y, z, tile); //Revert. xD + ((TileStickyJar) tile).getParent().invalidate(); // Uhm... + world.setTileEntity(x, y, z, tile); // Revert. xD boolean found = false; for (ItemStack drop : drops) { @@ -240,28 +240,36 @@ public class BlockStickyJar extends BlockJar implements IBlockTransparent { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float these, float are, float variables) { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float these, float are, float variables) { TileEntity tile = world.getTileEntity(x, y, z); if (tile instanceof TileStickyJar) { TileStickyJar tileStickyJar = (TileStickyJar) tile; - StickyJarInfo info = RegisteredBlocks.getStickyJarInfo(tileStickyJar.getParentBlock(), world.getBlockMetadata(x, y, z)); + StickyJarInfo info = + RegisteredBlocks.getStickyJarInfo(tileStickyJar.getParentBlock(), world.getBlockMetadata(x, y, z)); ItemStack heldItem = player.getHeldItem(); if (info.needsPhialHandling() && heldItem != null && heldItem.getItem() == ConfigItems.itemEssence) { - if(!world.isRemote) { + if (!world.isRemote) { BlockStickyJar.handlePhial(world, x, y, z, player, heldItem, tileStickyJar); } return true; } - boolean handleAspectFilter = info.needsLabelHandling() && heldItem != null && heldItem.getItem() == ConfigItems.itemResource - && heldItem.getItemDamage() == 13 && tileStickyJar.aspectFilter == null - && (((IEssentiaContainerItem) heldItem.getItem()).getAspects(heldItem) != null || tileStickyJar.amount != 0); + boolean handleAspectFilter = info.needsLabelHandling() + && heldItem != null + && heldItem.getItem() == ConfigItems.itemResource + && heldItem.getItemDamage() == 13 + && tileStickyJar.aspectFilter == null + && (((IEssentiaContainerItem) heldItem.getItem()).getAspects(heldItem) != null + || tileStickyJar.amount != 0); ForgeDirection newDir = tileStickyJar.changeDirection(ForgeDirection.getOrientation(side)); - boolean result = ((TileStickyJar) tile).getParentBlock().onBlockActivated(world, x, y, z, player, newDir.ordinal(), these, are, variables); + boolean result = ((TileStickyJar) tile) + .getParentBlock() + .onBlockActivated(world, x, y, z, player, newDir.ordinal(), these, are, variables); if (handleAspectFilter) { tileStickyJar.facing = newDir.ordinal(); @@ -273,16 +281,19 @@ public class BlockStickyJar extends BlockJar implements IBlockTransparent { return false; } - public static void handlePhial(World world, int x, int y, int z, EntityPlayer player, ItemStack stack, TileJarFillable tile) { + public static void handlePhial( + World world, int x, int y, int z, EntityPlayer player, ItemStack stack, TileJarFillable tile) { ItemEssence itemEssence = (ItemEssence) ConfigItems.itemEssence; AspectList aspects = itemEssence.getAspects(stack); - if(aspects != null) { - Map.Entry entry = aspects.aspects.entrySet().iterator().next(); + if (aspects != null) { + Map.Entry entry = + aspects.aspects.entrySet().iterator().next(); Aspect jarAspect = tile.aspectFilter == null ? tile.aspect : tile.aspectFilter; - if((jarAspect == null || entry.getKey() == jarAspect) && tile.amount + entry.getValue() <= tile.maxAmount) { + if ((jarAspect == null || entry.getKey() == jarAspect) + && tile.amount + entry.getValue() <= tile.maxAmount) { tile.addToContainer(entry.getKey(), entry.getValue()); stack.stackSize--; @@ -294,7 +305,7 @@ public class BlockStickyJar extends BlockJar implements IBlockTransparent { } } else { Aspect aspect = tile.aspect; - if(aspect != null && tile.takeFromContainer(aspect, 8)) { + if (aspect != null && tile.takeFromContainer(aspect, 8)) { stack.stackSize--; ItemStack essenceStack = new ItemStack(itemEssence, 1, 1); diff --git a/src/main/java/makeo/gadomancy/common/blocks/BlockStoneMachine.java b/src/main/java/makeo/gadomancy/common/blocks/BlockStoneMachine.java index b641008..dc05059 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/BlockStoneMachine.java +++ b/src/main/java/makeo/gadomancy/common/blocks/BlockStoneMachine.java @@ -1,5 +1,7 @@ package makeo.gadomancy.common.blocks; +import java.util.List; +import java.util.Random; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.blocks.tiles.TileArcanePackager; import makeo.gadomancy.common.blocks.tiles.TileBlockProtector; @@ -30,9 +32,6 @@ import thaumcraft.common.lib.utils.InventoryUtils; import thaumcraft.common.tiles.TileJarFillable; import thaumcraft.common.tiles.TilePedestal; -import java.util.List; -import java.util.Random; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -82,7 +81,7 @@ public class BlockStoneMachine extends Block { } } else if (metadata == 2) { return this.protectorIcon; - } else if(metadata == 4) { + } else if (metadata == 4) { return this.packagerIcon; } @@ -91,7 +90,13 @@ public class BlockStoneMachine extends Block { @Override public boolean hasTileEntity(int metadata) { - return metadata == 15 || metadata == 0 || metadata == 1 || metadata == 2 || metadata == 3 || metadata == 4 || metadata == 5; + return metadata == 15 + || metadata == 0 + || metadata == 1 + || metadata == 2 + || metadata == 3 + || metadata == 4 + || metadata == 5; } @Override @@ -123,11 +128,11 @@ public class BlockStoneMachine extends Block { return new TileBlockProtector(); } else if (metadata == 3) { return new TileManipulationFocus(); - } else if(metadata == 4) { + } else if (metadata == 4) { return new TileArcanePackager(); - }/* else if(metadata == 5) { - return new TileAIShutdown(); - }*/ + } /* else if(metadata == 5) { + return new TileAIShutdown(); + }*/ return null; } @@ -148,13 +153,13 @@ public class BlockStoneMachine extends Block { public void breakBlock(World world, int x, int y, int z, Block block, int metadata) { if (metadata == 1) { InventoryUtils.dropItems(world, x, y, z); - } else if(metadata == 4) { - if(!world.isRemote) { + } else if (metadata == 4) { + if (!world.isRemote) { TileArcanePackager tile = (TileArcanePackager) world.getTileEntity(x, y, z); - for(int i = 0; i < tile.getSizeInventory(); i++) { + for (int i = 0; i < tile.getSizeInventory(); i++) { ItemStack stack = tile.getStackInSlot(i); - if(stack != null && stack.stackSize > 0) { + if (stack != null && stack.stackSize > 0) { float f = world.rand.nextFloat() * 0.8F + 0.1F; float f1 = world.rand.nextFloat() * 0.8F + 0.1F; float f2 = world.rand.nextFloat() * 0.8F + 0.1F; @@ -169,14 +174,14 @@ public class BlockStoneMachine extends Block { } } - super.breakBlock(world, x, y, z, block, metadata); } @Override public boolean canReplace(World world, int x, int y, int z, int side, ItemStack stack) { int damage = stack.getItemDamage(); - if ((damage == 0 || damage == 3) && (y < 1 || world.getBlock(x, y - 1, z) != RegisteredBlocks.blockNodeManipulator)) { + if ((damage == 0 || damage == 3) + && (y < 1 || world.getBlock(x, y - 1, z) != RegisteredBlocks.blockNodeManipulator)) { return false; } return super.canReplace(world, x, y, z, side, stack); @@ -186,7 +191,8 @@ public class BlockStoneMachine extends Block { public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase ent, ItemStack stack) { int metadata = world.getBlockMetadata(x, y, z); if (metadata == 2 || metadata == 4) { - ((TileJarFillable) world.getTileEntity(x, y, z)).facing = MathHelper.floor_double(-ent.rotationYaw * 4.0F / 360.0F + 0.5D) & 0x3; + ((TileJarFillable) world.getTileEntity(x, y, z)).facing = + MathHelper.floor_double(-ent.rotationYaw * 4.0F / 360.0F + 0.5D) & 0x3; } } @@ -204,16 +210,17 @@ public class BlockStoneMachine extends Block { world.setBlockToAir(x, y, z); } } else if (metadata == 0 || metadata == 3) { - if (world.getBlock(x, y - 1, z) != RegisteredBlocks.blockNodeManipulator || world.getBlockMetadata(x, y - 1, z) != 5) { + if (world.getBlock(x, y - 1, z) != RegisteredBlocks.blockNodeManipulator + || world.getBlockMetadata(x, y - 1, z) != 5) { this.dropBlockAsItem(world, x, y, z, metadata, 0); world.setBlockToAir(x, y, z); } - } else if(metadata == 1) { + } else if (metadata == 1) { if (!world.isAirBlock(x, y + 1, z)) { InventoryUtils.dropItems(world, x, y, z); } - } else if(metadata == 4) { - if(!world.isRemote) { + } else if (metadata == 4) { + if (!world.isRemote) { TileArcanePackager tile = (TileArcanePackager) world.getTileEntity(x, y, z); tile.updateRedstone(world.isBlockIndirectlyGettingPowered(x, y, z)); } @@ -223,7 +230,7 @@ public class BlockStoneMachine extends Block { @Override public int getLightValue(IBlockAccess world, int x, int y, int z) { int metadata = world.getBlockMetadata(x, y, z); - if(metadata == 2) { + if (metadata == 2) { TileBlockProtector protector = (TileBlockProtector) world.getTileEntity(x, y, z); return protector.getCurrentRange(); } @@ -238,7 +245,7 @@ public class BlockStoneMachine extends Block { @Override public int getComparatorInputOverride(World world, int x, int y, int z, int side) { int metadata = world.getBlockMetadata(x, y, z); - if(metadata == 2) { + if (metadata == 2) { TileBlockProtector protector = (TileBlockProtector) world.getTileEntity(x, y, z); return protector.getCurrentRange(); } @@ -246,19 +253,21 @@ public class BlockStoneMachine extends Block { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { int metadata = world.getBlockMetadata(x, y, z); if (metadata == 0 || metadata == 3) { - if (world.getBlock(x, y - 1, z).equals(RegisteredBlocks.blockNodeManipulator) && world.getBlockMetadata(x, y - 1, z) == 5) { + if (world.getBlock(x, y - 1, z).equals(RegisteredBlocks.blockNodeManipulator) + && world.getBlockMetadata(x, y - 1, z) == 5) { return world.getBlock(x, y - 1, z).onBlockActivated(world, x, y - 1, z, player, side, hitX, hitY, hitZ); } } else if (metadata == 1) { - if(world.isAirBlock(x, y + 1, z)) { + if (world.isAirBlock(x, y + 1, z)) { return ConfigBlocks.blockStoneDevice.onBlockActivated(world, x, y, z, player, side, hitX, hitY, hitZ); } return true; - } else if(metadata == 4) { + } else if (metadata == 4) { player.openGui(Gadomancy.instance, 2, world, x, y, z); return true; } @@ -277,23 +286,24 @@ public class BlockStoneMachine extends Block { this.setBlockBounds(3 / 16f, 0, 3 / 16f, 1 - (3 / 16f), 6 / 16f, 1 - (3 / 16f)); } else if (metadata == 1) { this.setBlockBounds(0.25f, 0, 0.25f, 0.75f, 0.99f, 0.75f); - } else if(metadata == 2) { - this.setBlockBounds(0, 0, 0, 1, 3/16f, 1); - } else if(metadata == 4) { - this.setBlockBounds(0, 0, 0, 1, 12/16f, 1); - }/* else if(metadata == 5) { - setBlockBounds(0, 0, 0, 1, 1, 1); - }*/ + } else if (metadata == 2) { + this.setBlockBounds(0, 0, 0, 1, 3 / 16f, 1); + } else if (metadata == 4) { + this.setBlockBounds(0, 0, 0, 1, 12 / 16f, 1); + } /* else if(metadata == 5) { + setBlockBounds(0, 0, 0, 1, 1, 1); + }*/ super.setBlockBoundsBasedOnState(world, x, y, z); } @Override - public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axisalignedbb, List list, Entity entity) { + public void addCollisionBoxesToList( + World world, int x, int y, int z, AxisAlignedBB axisalignedbb, List list, Entity entity) { int metadata = world.getBlockMetadata(x, y, z); if (metadata == 11 || metadata == 15 || metadata == 1) { this.setBlockBounds(0, 0, 0, 1, 1, 1); - } else if(metadata == 2) { - this.setBlockBounds(3 / 16f, 0, 3 / 16f, 1 - (3 / 16f), 9.5f/16f, 1 - (3 / 16f)); + } else if (metadata == 2) { + this.setBlockBounds(3 / 16f, 0, 3 / 16f, 1 - (3 / 16f), 9.5f / 16f, 1 - (3 / 16f)); super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, list, entity); this.setBlockBoundsBasedOnState(world, x, y, z); } else { 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 83e0a7e..47aedd0 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileAIShutdown.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileAIShutdown.java @@ -2,6 +2,7 @@ package makeo.gadomancy.common.blocks.tiles; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import java.util.*; import makeo.gadomancy.client.effect.fx.Orbital; import makeo.gadomancy.common.registration.AIShutdownWhitelist; import makeo.gadomancy.common.utils.Injector; @@ -21,8 +22,6 @@ import thaumcraft.api.aspects.AspectList; import thaumcraft.api.aspects.IAspectContainer; import thaumcraft.api.aspects.IEssentiaTransport; -import java.util.*; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -53,12 +52,13 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon @Override public void updateEntity() { - if(this.worldObj == null) return; + if (this.worldObj == null) return; this.ticksExisted++; - if(!this.worldObj.isRemote) { + if (!this.worldObj.isRemote) { ChunkCoordinates cc = this.getCoords(); - if (!TileAIShutdown.trackedEntities.containsKey(cc)) TileAIShutdown.trackedEntities.put(cc, Lists.newLinkedList()); + if (!TileAIShutdown.trackedEntities.containsKey(cc)) + TileAIShutdown.trackedEntities.put(cc, Lists.newLinkedList()); if ((this.ticksExisted & 15) == 0) { this.killAI(); @@ -70,7 +70,6 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon this.drainDefaultEssentia(); } } - } private void drainDefaultEssentia() { @@ -81,7 +80,8 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon private void handleIO() { if (this.storedAmount < TileAIShutdown.MAX_AMT) { - TileEntity te = ThaumcraftApiHelper.getConnectableTile(this.worldObj, this.xCoord, this.yCoord, this.zCoord, ForgeDirection.UP); + TileEntity te = ThaumcraftApiHelper.getConnectableTile( + this.worldObj, this.xCoord, this.yCoord, this.zCoord, ForgeDirection.UP); if (te != null) { IEssentiaTransport ic = (IEssentiaTransport) te; if (!ic.canOutputTo(ForgeDirection.DOWN)) { @@ -97,12 +97,15 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon private void killAI() { ChunkCoordinates cc = this.getCoords(); - List objEntityList = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, TileAIShutdown.BOX.copy().offset(this.xCoord, this.yCoord, this.zCoord)); + List objEntityList = this.worldObj.getEntitiesWithinAABB( + EntityLivingBase.class, TileAIShutdown.BOX.copy().offset(this.xCoord, this.yCoord, this.zCoord)); for (Object o : objEntityList) { - if(o != null && o instanceof EntityLiving && - !((EntityLiving) o).isDead && this.canAffect((EntityLiving) o)) { + if (o != null + && o instanceof EntityLiving + && !((EntityLiving) o).isDead + && this.canAffect((EntityLiving) o)) { EntityLiving el = (EntityLiving) o; - if(this.storedAmount <= 0) return; + if (this.storedAmount <= 0) return; AffectedEntity affected = this.removeAI(el); TileAIShutdown.trackedEntities.get(cc).add(affected); } @@ -110,7 +113,7 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon } private AffectedEntity removeAI(EntityLiving el) { - if(TileAIShutdown.RAND.nextInt(4) == 0) { + if (TileAIShutdown.RAND.nextInt(4) == 0) { this.storedAmount = Math.max(0, this.storedAmount - 1); this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); this.markDirty(); @@ -130,9 +133,10 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon if (entry == null || !(entry instanceof EntityAITasks.EntityAITaskEntry)) continue; boolean needsRemoval = true; for (Class aiClass : entries) { - if(aiClass.isAssignableFrom(((EntityAITasks.EntityAITaskEntry) entry).action.getClass())) needsRemoval = false; + if (aiClass.isAssignableFrom(((EntityAITasks.EntityAITaskEntry) entry).action.getClass())) + needsRemoval = false; } - if(needsRemoval) { + if (needsRemoval) { iterator.remove(); } } @@ -143,9 +147,10 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon if (entry == null || !(entry instanceof EntityAITasks.EntityAITaskEntry)) continue; boolean needsRemoval = true; for (Class aiClass : entries) { - if(aiClass.isAssignableFrom(((EntityAITasks.EntityAITaskEntry) entry).action.getClass())) needsRemoval = false; + if (aiClass.isAssignableFrom(((EntityAITasks.EntityAITaskEntry) entry).action.getClass())) + needsRemoval = false; } - if(needsRemoval) { + if (needsRemoval) { iterator.remove(); } } @@ -161,10 +166,10 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon public boolean canAffect(EntityLiving el) { ChunkCoordinates cc = this.getCoords(); - if(!TileAIShutdown.trackedEntities.containsKey(cc)) return false; + if (!TileAIShutdown.trackedEntities.containsKey(cc)) return false; UUID uu = el.getUniqueID(); for (AffectedEntity ae : TileAIShutdown.trackedEntities.get(cc)) { - if(ae.eUUID.equals(uu)) return false; + if (ae.eUUID.equals(uu)) return false; } return true; } @@ -179,14 +184,13 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon compound.setInteger("amount", this.storedAmount); } - /////////////////////////////////////////////////////////////////////////////////////////////// // IAspectContainer & IEssentiaTransport /////////////////////////////////////////////////////////////////////////////////////////////// @Override public AspectList getAspects() { - if(this.storedAmount <= 0) return new AspectList(); + if (this.storedAmount <= 0) return new AspectList(); return new AspectList().add(Aspect.ENTROPY, this.storedAmount); } @@ -224,7 +228,7 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon @Override @Deprecated public boolean takeFromContainer(AspectList list) { - return false; //NO-OP + return false; // NO-OP } @Override @@ -235,7 +239,7 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon @Override @Deprecated public boolean doesContainerContain(AspectList list) { - return false; //NO-OP + return false; // NO-OP } @Override @@ -263,13 +267,13 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon @Override public Aspect getSuctionType(ForgeDirection direction) { - if(!this.isConnectable(direction)) return null; + if (!this.isConnectable(direction)) return null; return Aspect.ENTROPY; } @Override public int getSuctionAmount(ForgeDirection direction) { - if(!this.isConnectable(direction)) return 0; + if (!this.isConnectable(direction)) return 0; return this.getMinimumSuction(); } @@ -290,7 +294,7 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon @Override public int getEssentiaAmount(ForgeDirection direction) { - if(!this.isConnectable(direction)) return 0; + if (!this.isConnectable(direction)) return 0; return this.storedAmount; } @@ -304,12 +308,12 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon return false; } - //Tracker methods + // Tracker methods public static void removeTrackedEntity(EntityLiving entityLiving) { for (ChunkCoordinates cc : TileAIShutdown.trackedEntities.keySet()) { for (AffectedEntity ae : TileAIShutdown.trackedEntities.get(cc)) { - if(ae.eUUID.equals(entityLiving.getUniqueID())) { + if (ae.eUUID.equals(entityLiving.getUniqueID())) { TileAIShutdown.trackedEntities.get(cc).remove(ae); entityLiving.tasks.taskEntries = ae.tasks; entityLiving.targetTasks.taskEntries = ae.targetTasks; @@ -324,12 +328,13 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon public static void removeTrackedEntities(World world, int x, int y, int z) { ChunkCoordinates cc = new ChunkCoordinates(x, y, z); - if(TileAIShutdown.trackedEntities.containsKey(cc)) { + if (TileAIShutdown.trackedEntities.containsKey(cc)) { for (AffectedEntity ae : TileAIShutdown.trackedEntities.get(cc)) { for (Object objE : world.getLoadedEntityList()) { - if(objE != null && objE instanceof EntityLiving && - !((EntityLiving) objE).isDead && - ((EntityLiving) objE).getUniqueID().equals(ae.eUUID)) { + if (objE != null + && objE instanceof EntityLiving + && !((EntityLiving) objE).isDead + && ((EntityLiving) objE).getUniqueID().equals(ae.eUUID)) { ((EntityLiving) objE).tasks.taskEntries = ae.tasks; ((EntityLiving) objE).targetTasks.taskEntries = ae.targetTasks; TileAIShutdown.injEntityLivingBase.setObject(objE); @@ -348,9 +353,10 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon public List tasks; public List targetTasks; - public AffectedEntity(UUID eUUID, - List tasks, - List targetTasks) { + public AffectedEntity( + UUID eUUID, + List tasks, + List targetTasks) { this.eUUID = eUUID; this.tasks = tasks; this.targetTasks = targetTasks; @@ -368,7 +374,5 @@ public class TileAIShutdown extends SynchronizedTileEntity implements IAspectCon public int hashCode() { return this.eUUID != null ? this.eUUID.hashCode() : 0; } - } - } diff --git a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileAdditionalEldritchPortal.java b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileAdditionalEldritchPortal.java index 149d33b..912bed5 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileAdditionalEldritchPortal.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileAdditionalEldritchPortal.java @@ -1,5 +1,8 @@ package makeo.gadomancy.common.blocks.tiles; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import makeo.gadomancy.common.data.config.ModConfig; import makeo.gadomancy.common.utils.world.TCMazeHandler; import net.minecraft.entity.player.EntityPlayer; @@ -11,10 +14,6 @@ import net.minecraft.world.WorldServer; import thaumcraft.common.lib.research.ResearchManager; import thaumcraft.common.tiles.TileEldritchPortal; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -25,7 +24,8 @@ import java.util.Map; */ public class TileAdditionalEldritchPortal extends TileEldritchPortal { - private static Map trackedPortalActivity = new HashMap(); + private static Map trackedPortalActivity = + new HashMap(); private EntityPlayer toTeleport; private int count; @@ -33,34 +33,56 @@ public class TileAdditionalEldritchPortal extends TileEldritchPortal { public void updateEntity() { this.count += 1; if ((this.worldObj.isRemote) && ((this.count % 250 == 0) || (this.count == 0))) { - this.worldObj.playSound(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, "thaumcraft:evilportal", 1.0F, 1.0F, false); + this.worldObj.playSound( + this.xCoord + 0.5D, + this.yCoord + 0.5D, + this.zCoord + 0.5D, + "thaumcraft:evilportal", + 1.0F, + 1.0F, + false); } if ((this.worldObj.isRemote) && (this.opencount < 30)) { this.opencount += 1; } if ((!this.worldObj.isRemote) && (this.count % 5 == 0) && this.toTeleport == null) { - List players = this.worldObj.getEntitiesWithinAABB(EntityPlayerMP.class, AxisAlignedBB.getBoundingBox(this.xCoord, this.yCoord, this.zCoord, this.xCoord + 1, this.yCoord + 1, this.zCoord + 1).expand(0.5D, 1.0D, 0.5D)); - if(players != null && !players.isEmpty()) { + List players = this.worldObj.getEntitiesWithinAABB( + EntityPlayerMP.class, + AxisAlignedBB.getBoundingBox( + this.xCoord, + this.yCoord, + this.zCoord, + this.xCoord + 1, + this.yCoord + 1, + this.zCoord + 1) + .expand(0.5D, 1.0D, 0.5D)); + if (players != null && !players.isEmpty()) { EntityPlayerMP toTeleport = players.get(0); - if(toTeleport.timeUntilPortal > 0) return; + if (toTeleport.timeUntilPortal > 0) return; - if(!ResearchManager.isResearchComplete(toTeleport.getCommandSenderName(), TileNodeManipulator.MultiblockType.E_PORTAL_CREATOR.getResearchNeeded())) { + if (!ResearchManager.isResearchComplete( + toTeleport.getCommandSenderName(), + TileNodeManipulator.MultiblockType.E_PORTAL_CREATOR.getResearchNeeded())) { return; } this.toTeleport = toTeleport; toTeleport.timeUntilPortal = 200; - if(toTeleport.dimension != ModConfig.dimOuterId) { - //Teleporting there. + if (toTeleport.dimension != ModConfig.dimOuterId) { + // Teleporting there. - if(TCMazeHandler.createSessionWaitForTeleport(toTeleport)) { - TileAdditionalEldritchPortal.startTracking(toTeleport, new ExtendedChunkCoordinates(new ChunkCoordinates(this.xCoord, this.yCoord, this.zCoord), toTeleport.dimension)); + if (TCMazeHandler.createSessionWaitForTeleport(toTeleport)) { + TileAdditionalEldritchPortal.startTracking( + toTeleport, + new ExtendedChunkCoordinates( + new ChunkCoordinates(this.xCoord, this.yCoord, this.zCoord), + toTeleport.dimension)); } } else { - //Teleporting back. + // Teleporting back. TCMazeHandler.closeSession(toTeleport, true); } @@ -69,16 +91,16 @@ public class TileAdditionalEldritchPortal extends TileEldritchPortal { } public static void startTracking(EntityPlayer player, ExtendedChunkCoordinates tileCoords) { - if(!TileAdditionalEldritchPortal.trackedPortalActivity.containsKey(player)) { + if (!TileAdditionalEldritchPortal.trackedPortalActivity.containsKey(player)) { TileAdditionalEldritchPortal.trackedPortalActivity.put(player, tileCoords); } } public static void informSessionStart(EntityPlayer player) { - if(TileAdditionalEldritchPortal.trackedPortalActivity.containsKey(player)) { + if (TileAdditionalEldritchPortal.trackedPortalActivity.containsKey(player)) { ExtendedChunkCoordinates tileCoords = TileAdditionalEldritchPortal.trackedPortalActivity.get(player); TileAdditionalEldritchPortal.trackedPortalActivity.remove(player); - if(tileCoords != null) { + if (tileCoords != null) { ChunkCoordinates cc = tileCoords.coordinates; WorldServer ws = MinecraftServer.getServer().worldServerForDimension(tileCoords.dimId); ws.removeTileEntity(cc.posX, cc.posY, cc.posZ); @@ -98,5 +120,4 @@ public class TileAdditionalEldritchPortal extends TileEldritchPortal { this.dimId = dimId; } } - } diff --git a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileArcaneDropper.java b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileArcaneDropper.java index 492ec7e..3b8bb92 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileArcaneDropper.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileArcaneDropper.java @@ -1,5 +1,7 @@ package makeo.gadomancy.common.blocks.tiles; +import java.util.ArrayList; +import java.util.List; import makeo.gadomancy.common.registration.RegisteredBlocks; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -12,9 +14,6 @@ import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.ForgeDirection; import thaumcraft.common.lib.utils.InventoryUtils; -import java.util.ArrayList; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -40,10 +39,10 @@ public class TileArcaneDropper extends TileEntity implements ISidedInventory { this.removedCount = 0; this.removedEntity = null; - if(this.dropQueue.size() > 0) { - for(int i = 0; i < this.dropQueue.size(); i++) { + if (this.dropQueue.size() > 0) { + for (int i = 0; i < this.dropQueue.size(); i++) { EntityItem item = this.dropQueue.get(i); - if(!item.isDead && !this.worldObj.loadedEntityList.contains(item)) { + if (!item.isDead && !this.worldObj.loadedEntityList.contains(item)) { this.getWorldObj().spawnEntityInWorld(item); this.dropQueue.remove(i); i--; @@ -51,15 +50,15 @@ public class TileArcaneDropper extends TileEntity implements ISidedInventory { } } - if(this.count > 20) { + if (this.count > 20) { this.count = 0; World world = this.getWorldObj(); - if(!world.isRemote) { + if (!world.isRemote) { int oldSize = this.items.size(); this.updateInventory(); - if(oldSize != 0 || this.items.size() != 0) { - //Comparator... + if (oldSize != 0 || this.items.size() != 0) { + // Comparator... world.notifyBlockChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); } } @@ -70,24 +69,25 @@ public class TileArcaneDropper extends TileEntity implements ISidedInventory { private void updateInventory() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() & 7); - double x = this.xCoord + dir.offsetX*2 + 0.5; - double y = this.yCoord + dir.offsetY*2 + 0.5; - double z = this.zCoord + dir.offsetZ*2 + 0.5; + double x = this.xCoord + dir.offsetX * 2 + 0.5; + double y = this.yCoord + dir.offsetY * 2 + 0.5; + double z = this.zCoord + dir.offsetZ * 2 + 0.5; - AxisAlignedBB box = AxisAlignedBB.getBoundingBox(x, y, z, x, y, z).expand(TileArcaneDropper.RADIUS, TileArcaneDropper.RADIUS, TileArcaneDropper.RADIUS); + AxisAlignedBB box = AxisAlignedBB.getBoundingBox(x, y, z, x, y, z) + .expand(TileArcaneDropper.RADIUS, TileArcaneDropper.RADIUS, TileArcaneDropper.RADIUS); this.items = this.getWorldObj().getEntitiesWithinAABB(EntityItem.class, box); - //Add 10 empty slots - for(int i = 0; i < 10; i++) { + // Add 10 empty slots + for (int i = 0; i < 10; i++) { this.items.add(null); } } private EntityItem dropItem(ItemStack stack) { - if(this.removedEntity != null && this.removedEntity.isDead) { - for(EntityItem entityItem : this.items) { - if(entityItem == this.removedEntity) { - if(InventoryUtils.areItemStacksEqualStrict(this.removedEntity.getEntityItem(), stack) + if (this.removedEntity != null && this.removedEntity.isDead) { + for (EntityItem entityItem : this.items) { + if (entityItem == this.removedEntity) { + if (InventoryUtils.areItemStacksEqualStrict(this.removedEntity.getEntityItem(), stack) && this.removedEntity.getEntityItem().stackSize + this.removedCount == stack.stackSize) { this.removedEntity.getEntityItem().stackSize += this.removedCount; this.removedEntity.isDead = false; @@ -103,19 +103,19 @@ public class TileArcaneDropper extends TileEntity implements ISidedInventory { ForgeDirection side = ForgeDirection.getOrientation(this.getBlockMetadata() & 7); - double x = this.xCoord + 0.5 + side.offsetX*0.5; - double y = this.yCoord + 0.25 + side.offsetY*0.5; - double z = this.zCoord + 0.5 + side.offsetZ*0.5; + double x = this.xCoord + 0.5 + side.offsetX * 0.5; + double y = this.yCoord + 0.25 + side.offsetY * 0.5; + double z = this.zCoord + 0.5 + side.offsetZ * 0.5; - EntityItem entityItem = new EntityItem(this.getWorldObj(), x, y, z, stack.copy());// + EntityItem entityItem = new EntityItem(this.getWorldObj(), x, y, z, stack.copy()); // - entityItem.motionX = side.offsetX*0.1; - entityItem.motionY = side.offsetY*0.1; - entityItem.motionZ = side.offsetZ*0.1; + entityItem.motionX = side.offsetX * 0.1; + entityItem.motionY = side.offsetY * 0.1; + entityItem.motionZ = side.offsetZ * 0.1; entityItem.delayBeforeCanPickup = 3; - //prevent stackOverflows + // prevent stackOverflows this.dropQueue.add(entityItem); return entityItem; @@ -131,7 +131,7 @@ public class TileArcaneDropper extends TileEntity implements ISidedInventory { public ItemStack getStackInSlot(int slot) { this.updateInventory(); - if(slot >= this.items.size()) return null; //Get rekt. nothing here on this slot. + if (slot >= this.items.size()) return null; // Get rekt. nothing here on this slot. EntityItem entity = this.items.get(slot); return entity == null || entity.isDead ? null : entity.getEntityItem(); @@ -141,7 +141,7 @@ public class TileArcaneDropper extends TileEntity implements ISidedInventory { public ItemStack decrStackSize(int slot, int amount) { ItemStack stack = this.getStackInSlot(slot); - if(stack.stackSize - amount <= 0) { + if (stack.stackSize - amount <= 0) { this.setInventorySlotContents(slot, null); return stack.copy(); } @@ -160,12 +160,12 @@ public class TileArcaneDropper extends TileEntity implements ISidedInventory { public void setInventorySlotContents(int slot, ItemStack stack) { EntityItem oldEntity = this.items.get(slot); - if(oldEntity != null) { + if (oldEntity != null) { oldEntity.setDead(); } - if(stack != null && stack.stackSize > 0) { - if(oldEntity != null && InventoryUtils.areItemStacksEqualStrict(oldEntity.getEntityItem(), stack)) { + if (stack != null && stack.stackSize > 0) { + if (oldEntity != null && InventoryUtils.areItemStacksEqualStrict(oldEntity.getEntityItem(), stack)) { oldEntity.getEntityItem().stackSize = stack.stackSize; oldEntity.isDead = false; } else { @@ -205,19 +205,15 @@ public class TileArcaneDropper extends TileEntity implements ISidedInventory { } @Override - public void openInventory() { - - } + public void openInventory() {} @Override - public void closeInventory() { - - } + public void closeInventory() {} @Override public int[] getAccessibleSlotsFromSide(int side) { int[] slots = new int[this.getSizeInventory()]; - for(int i = 0; i < slots.length; i++) { + for (int i = 0; i < slots.length; i++) { slots[i] = i; } return slots; @@ -225,13 +221,13 @@ public class TileArcaneDropper extends TileEntity implements ISidedInventory { @Override public boolean canInsertItem(int slot, ItemStack stack, int side) { - return RegisteredBlocks.blockArcaneDropper - .isSideSolid(this.getWorldObj(), this.xCoord, this.yCoord, this.zCoord, ForgeDirection.getOrientation(side)); + return RegisteredBlocks.blockArcaneDropper.isSideSolid( + this.getWorldObj(), this.xCoord, this.yCoord, this.zCoord, ForgeDirection.getOrientation(side)); } @Override public boolean canExtractItem(int slot, ItemStack stack, int side) { - if(this.canInsertItem(slot, stack, side)) { + if (this.canInsertItem(slot, stack, side)) { EntityItem entityItem = this.items.get(slot); return entityItem == null || entityItem.delayBeforeCanPickup <= 0; } diff --git a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileArcaneHand.java b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileArcaneHand.java index cb69cc8..b660098 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileArcaneHand.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileArcaneHand.java @@ -3,10 +3,12 @@ package makeo.gadomancy.common.blocks.tiles; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.ModContainer; import cpw.mods.fml.common.network.NetworkRegistry; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; import makeo.gadomancy.common.entities.fake.AdvancedFakePlayer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -17,10 +19,6 @@ import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.common.util.ForgeDirection; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -38,7 +36,7 @@ public class TileArcaneHand extends SynchronizedTileEntity implements ISidedInve @Override public void updateEntity() { - if(this.im == null) { + if (this.im == null) { this.updateConnection(); } } @@ -55,7 +53,7 @@ public class TileArcaneHand extends SynchronizedTileEntity implements ISidedInve TileEntity tile = this.getWorldObj().getTileEntity(this.xCoord, this.yCoord - 1, this.zCoord); if (tile != null && this.worldObj instanceof WorldServer) { - if(this.fakePlayer == null) { + if (this.fakePlayer == null) { this.fakePlayer = new GuiFakePlayer(this); } @@ -63,18 +61,28 @@ public class TileArcaneHand extends SynchronizedTileEntity implements ISidedInve this.fakePlayer.posY = this.yCoord; this.fakePlayer.posZ = this.zCoord; - this.im.activateBlockOrUseItem(this.fakePlayer, this.worldObj, null, this.xCoord, this.yCoord - 1, this.zCoord, ForgeDirection.UP.ordinal(), 0.5F, 0.5F, 0.5F); + this.im.activateBlockOrUseItem( + this.fakePlayer, + this.worldObj, + null, + this.xCoord, + this.yCoord - 1, + this.zCoord, + ForgeDirection.UP.ordinal(), + 0.5F, + 0.5F, + 0.5F); } } @Override public int[] getAccessibleSlotsFromSide(int side) { - if(this.container == null) { + if (this.container == null) { return new int[0]; } int[] slots = new int[this.slots.size()]; - for(int i = 0; i < slots.length; i++) { + for (int i = 0; i < slots.length; i++) { slots[i] = i; } return slots; @@ -104,7 +112,7 @@ public class TileArcaneHand extends SynchronizedTileEntity implements ISidedInve if (this.tile.container != null) { this.tile.slots = new ArrayList(); for (Slot slot : (List) this.tile.container.inventorySlots) { - if(!this.inventory.equals(slot.inventory)) { + if (!this.inventory.equals(slot.inventory)) { this.tile.slots.add(slot); } } @@ -188,14 +196,10 @@ public class TileArcaneHand extends SynchronizedTileEntity implements ISidedInve } @Override - public void openInventory() { - - } + public void openInventory() {} @Override - public void closeInventory() { - - } + public void closeInventory() {} @Override public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) { diff --git a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileArcanePackager.java b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileArcanePackager.java index db2d647..640e080 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileArcanePackager.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileArcanePackager.java @@ -1,11 +1,12 @@ package makeo.gadomancy.common.blocks.tiles; +import java.util.ArrayList; +import java.util.List; import makeo.gadomancy.common.registration.RegisteredItems; import makeo.gadomancy.common.utils.ItemUtils; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; -import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -14,9 +15,6 @@ import net.minecraftforge.common.util.ForgeDirection; import thaumcraft.api.aspects.Aspect; import thaumcraft.common.tiles.TileJarFillable; -import java.util.ArrayList; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -30,7 +28,7 @@ public class TileArcanePackager extends TileJarFillable implements ISidedInvento private ItemStack[] contents = new ItemStack[12]; - //0 - 46 + // 0 - 46 public byte progress = -1; public boolean autoStart; public boolean useEssentia; @@ -86,7 +84,8 @@ public class TileArcanePackager extends TileJarFillable implements ISidedInvento } } else { if (this.redstoneState == null) { - this.redstoneState = this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord); + this.redstoneState = + this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord); } if (this.progress >= 47) { @@ -108,7 +107,7 @@ public class TileArcanePackager extends TileJarFillable implements ISidedInvento } public void updateRedstone(boolean state) { - if(this.redstoneState != null && state && !this.redstoneState) { + if (this.redstoneState != null && state && !this.redstoneState) { if (this.canPack()) { this.progress = 0; this.markForUpdate(); @@ -145,7 +144,6 @@ public class TileArcanePackager extends TileJarFillable implements ISidedInvento ItemStack string = this.getStackInSlot(10); return string != null && string.stackSize >= 1 && string.getItem() == Items.string; } - } private void doPack() { @@ -158,7 +156,10 @@ public class TileArcanePackager extends TileJarFillable implements ISidedInvento } } - ItemStack pack = new ItemStack(this.disguise ? RegisteredItems.itemFakeLootbag : RegisteredItems.itemPackage, 1, this.useEssentia ? 1 : 0); + ItemStack pack = new ItemStack( + this.disguise ? RegisteredItems.itemFakeLootbag : RegisteredItems.itemPackage, + 1, + this.useEssentia ? 1 : 0); boolean success = RegisteredItems.itemPackage.setContents(pack, contents); if (success) { @@ -174,12 +175,14 @@ public class TileArcanePackager extends TileJarFillable implements ISidedInvento this.setInventorySlotContents(i, null); } } else { - this.worldObj.newExplosion(null, this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, 1, false, false); + this.worldObj.newExplosion( + null, this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, 1, false, false); - for(int i = 0; i < 9; i++) { + for (int i = 0; i < 9; i++) { ItemStack stack = this.contents[i]; - if(stack != null) { - EntityItem entityItem = new EntityItem(this.worldObj, this.xCoord + 0.5, this.yCoord + (13/16f), this.zCoord + 0.5, stack); + if (stack != null) { + EntityItem entityItem = new EntityItem( + this.worldObj, this.xCoord + 0.5, this.yCoord + (13 / 16f), this.zCoord + 0.5, stack); ItemUtils.applyRandomDropOffset(entityItem, this.worldObj.rand); this.worldObj.spawnEntityInWorld(entityItem); this.contents[i] = null; @@ -301,14 +304,10 @@ public class TileArcanePackager extends TileJarFillable implements ISidedInvento } @Override - public void openInventory() { - - } + public void openInventory() {} @Override - public void closeInventory() { - - } + public void closeInventory() {} @Override public boolean isItemValidForSlot(int slot, ItemStack stack) { @@ -324,11 +323,11 @@ public class TileArcanePackager extends TileJarFillable implements ISidedInvento @Override public int[] getAccessibleSlotsFromSide(int side) { if (side == 0) { - return new int[]{11}; + return new int[] {11}; } if (TileArcanePackager.ORIENTATION_MAPPING[side] == super.facing) { - return new int[]{9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8}; + return new int[] {9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8}; } return new int[0]; 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 4f8f270..e8ea56c 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileAuraPylon.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileAuraPylon.java @@ -2,6 +2,8 @@ package makeo.gadomancy.common.blocks.tiles; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import makeo.gadomancy.common.aura.AuraEffectHandler; import makeo.gadomancy.common.entities.EntityPermNoClipItem; import makeo.gadomancy.common.utils.NBTHelper; @@ -26,9 +28,6 @@ import thaumcraft.common.entities.EntityPermanentItem; import thaumcraft.common.entities.EntitySpecialItem; import thaumcraft.common.items.ItemCrystalEssence; -import java.util.ArrayList; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -37,7 +36,8 @@ import java.util.List; *

* Created by HellFirePvP @ 11.11.2015 14:30 */ -public class TileAuraPylon extends SynchronizedTileEntity implements IAspectContainer, IEssentiaTransport, EntityPermNoClipItem.IItemMasterTile { +public class TileAuraPylon extends SynchronizedTileEntity + implements IAspectContainer, IEssentiaTransport, EntityPermNoClipItem.IItemMasterTile { private ItemStack crystalEssentiaStack; private boolean isPartOfMultiblock; @@ -51,7 +51,7 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont private boolean isMasterTile; private boolean isInputTile; - //Individual. + // Individual. @Override public void updateEntity() { this.ticksExisted++; @@ -68,19 +68,19 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont if (this.isMasterTile()) { TileAuraPylon io = this.getInputTile(); - if(io != null && io.amount > 0) { + if (io != null && io.amount > 0) { if ((this.ticksExisted & 31) == 0) { this.drainEssentia(io); } this.doAuraEffects(this.holdingAspect); } - if(this.holdingAspect != null && this.timeSinceLastItemInfo > 8) { + if (this.holdingAspect != null && this.timeSinceLastItemInfo > 8) { this.informItemRemoval(); } } } else { - if(this.isInputTile() && this.holdingAspect != null) { + if (this.isInputTile() && this.holdingAspect != null) { this.doEssentiaTrail(); } } @@ -103,46 +103,59 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont } private void doAuraEffects(Aspect aspect) { - if(aspect == null) return; - if(!this.isMasterTile()) return; - if(this.worldObj.isRemote) return; - AuraEffectHandler.distributeEffects(aspect, this.worldObj, this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, this.ticksExisted); + if (aspect == null) return; + if (!this.isMasterTile()) return; + if (this.worldObj.isRemote) return; + AuraEffectHandler.distributeEffects( + aspect, this.worldObj, this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, this.ticksExisted); } private void drainEssentia(TileAuraPylon io) { - if(!this.isMasterTile()) return; + if (!this.isMasterTile()) return; io.amount--; this.worldObj.markBlockForUpdate(io.xCoord, io.yCoord, io.zCoord); io.markDirty(); } - //Client-Side input tile only! + // Client-Side input tile only! @SideOnly(Side.CLIENT) private void doEssentiaTrail() { - if((this.ticksExisted & 1) == 0) return; + if ((this.ticksExisted & 1) == 0) return; TileAuraPylon tile = this.getMasterTile(); - if(tile == null) return; + if (tile == null) return; TileAuraPylon inputTile = this.getInputTile(); - if(inputTile == null) return; + if (inputTile == null) return; Aspect a = inputTile.getAspectType(); - if(a == null) return; - if(inputTile.amount <= 0) return; + if (a == null) return; + if (inputTile.amount <= 0) 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); + 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 + this.worldObj.rand.nextGaussian() * 0.002000000094994903D); - essentiaTrail.motionZ = (MathHelper.sin(count / 10.0F) * 0.001F + this.worldObj.rand.nextGaussian() * 0.002000000094994903D); + essentiaTrail.motionX = + (MathHelper.sin(count / 10.0F) * 0.001F + this.worldObj.rand.nextGaussian() * 0.002000000094994903D); + essentiaTrail.motionZ = + (MathHelper.sin(count / 10.0F) * 0.001F + this.worldObj.rand.nextGaussian() * 0.002000000094994903D); ParticleEngine.instance.addEffect(tile.getWorldObj(), essentiaTrail); } - //Special to masterTile only! + // Special to masterTile only! private void distributeAspectInformation() { - if(!this.isMasterTile()) return; + if (!this.isMasterTile()) return; int count = 1; TileEntity iter = this.worldObj.getTileEntity(this.xCoord, this.yCoord - count, this.zCoord); - while(iter != null && iter instanceof TileAuraPylon) { + while (iter != null && iter instanceof TileAuraPylon) { ((TileAuraPylon) iter).holdingAspect = this.holdingAspect; this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord - count, this.zCoord); iter.markDirty(); @@ -151,7 +164,7 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont } } - //Special to masterTile only! + // Special to masterTile only! private void tryVortexPossibleItems() { TileAuraPylon io = this.getInputTile(); if (io == null) return; @@ -159,14 +172,29 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont int masterY = this.yCoord + 1; float dst = ((float) (masterY - io.yCoord)) / 2F; float yC = masterY - dst; - List entityItems = this.worldObj.selectEntitiesWithinAABB(EntityItem.class, - AxisAlignedBB.getBoundingBox(this.xCoord - 0.5, yC - 0.5, this.zCoord - 0.5, this.xCoord + 0.5, yC + 0.5, this.zCoord + 0.5).expand(8, 8, 8), new IEntitySelector() { + List entityItems = this.worldObj.selectEntitiesWithinAABB( + EntityItem.class, + AxisAlignedBB.getBoundingBox( + this.xCoord - 0.5, + yC - 0.5, + this.zCoord - 0.5, + this.xCoord + 0.5, + yC + 0.5, + this.zCoord + 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 && - ((ItemCrystalEssence) ((EntityItem) e).getEntityItem().getItem()).getAspects(((EntityItem) e).getEntityItem()) != null; + return !(e instanceof EntityPermanentItem) + && !(e instanceof EntitySpecialItem) + && e instanceof EntityItem + && ((EntityItem) e).getEntityItem() != null + && ((EntityItem) e).getEntityItem().getItem() instanceof ItemCrystalEssence + && ((ItemCrystalEssence) ((EntityItem) e) + .getEntityItem() + .getItem()) + .getAspects(((EntityItem) e).getEntityItem()) + != null; } }); Entity dummy = new EntityItem(this.worldObj); @@ -174,7 +202,7 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont dummy.posY = yC + 0.5; dummy.posZ = this.zCoord + 0.5; - //MC code. + // MC code. EntityItem entity = null; double d0 = Double.MAX_VALUE; for (Object entityItem : entityItems) { @@ -187,14 +215,22 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont } } } - if(entity == null) return; - if(dummy.getDistanceToEntity(entity) < 1 && !this.worldObj.isRemote) { + if (entity == null) return; + if (dummy.getDistanceToEntity(entity) < 1 && !this.worldObj.isRemote) { ItemStack inter = entity.getEntityItem(); inter.stackSize--; this.crystalEssentiaStack = inter.copy(); this.crystalEssentiaStack.stackSize = 1; - EntityPermNoClipItem item = new EntityPermNoClipItem(entity.worldObj, this.xCoord + 0.5F, yC + 0.3F, this.zCoord + 0.5F, this.crystalEssentiaStack, this.xCoord, this.yCoord, this.zCoord); + EntityPermNoClipItem item = new EntityPermNoClipItem( + entity.worldObj, + this.xCoord + 0.5F, + yC + 0.3F, + this.zCoord + 0.5F, + this.crystalEssentiaStack, + this.xCoord, + this.yCoord, + this.zCoord); entity.worldObj.spawnEntityInWorld(item); item.motionX = 0; item.motionY = 0; @@ -205,10 +241,12 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont this.timeSinceLastItemInfo = 0; - this.holdingAspect = ((ItemCrystalEssence) this.crystalEssentiaStack.getItem()).getAspects(this.crystalEssentiaStack).getAspects()[0]; + this.holdingAspect = ((ItemCrystalEssence) this.crystalEssentiaStack.getItem()) + .getAspects(this.crystalEssentiaStack) + .getAspects()[0]; this.distributeAspectInformation(); - if(inter.stackSize <= 0) entity.setDead(); + if (inter.stackSize <= 0) entity.setDead(); entity.noClip = false; item.delayBeforeCanPickup = 60; this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); @@ -219,7 +257,7 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont } } - //Special to masterTile only! + // Special to masterTile only! private void applyMovementVectors(EntityItem entity) { double var3 = (this.xCoord + 0.5D - entity.posX) / 15.0D; double var5 = (this.yCoord + 0.5D - entity.posY) / 15.0D; @@ -234,17 +272,21 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont } } - //Special to inputTile only! + // Special to inputTile only! private void handleIO() { - if ((!this.worldObj.isRemote) && ((this.ticksExisted & 15) == 0) && (this.getEssentiaAmount() < this.getMaxAmount())) { - TileEntity te = ThaumcraftApiHelper.getConnectableTile(this.worldObj, this.xCoord, this.yCoord, this.zCoord, ForgeDirection.DOWN); + if ((!this.worldObj.isRemote) + && ((this.ticksExisted & 15) == 0) + && (this.getEssentiaAmount() < this.getMaxAmount())) { + TileEntity te = ThaumcraftApiHelper.getConnectableTile( + this.worldObj, this.xCoord, this.yCoord, this.zCoord, ForgeDirection.DOWN); if (te != null) { IEssentiaTransport ic = (IEssentiaTransport) te; if (!ic.canOutputTo(ForgeDirection.UP)) { return; } - if ((this.holdingAspect != null) && (ic.getSuctionAmount(ForgeDirection.UP) < this.getSuctionAmount(ForgeDirection.DOWN))) { + if ((this.holdingAspect != null) + && (ic.getSuctionAmount(ForgeDirection.UP) < this.getSuctionAmount(ForgeDirection.DOWN))) { this.addToContainer(this.holdingAspect, ic.takeEssentia(this.holdingAspect, 1, ForgeDirection.UP)); } } @@ -253,20 +295,20 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont @Override public void informItemRemoval() { - if(!this.isMasterTile()) return; + if (!this.isMasterTile()) return; this.crystalEssentiaStack = null; this.holdingAspect = null; this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); this.markDirty(); this.distributeAspectInformation(); TileAuraPylon io = this.getInputTile(); - if(io == null) return; + if (io == null) return; io.amount = 0; this.worldObj.markBlockForUpdate(io.xCoord, io.yCoord, io.zCoord); io.markDirty(); } - //We don't want the item to change at any given point... + // We don't want the item to change at any given point... @Override public EntityPermNoClipItem.ItemChangeTask getAndRemoveScheduledChangeTask() { return null; @@ -277,8 +319,8 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont this.crystalEssentiaStack = itemStack; } - //Individual. - //Returns true, if state has changed, false if still complete state. + // Individual. + // Returns true, if state has changed, false if still complete state. private boolean checkComponents() { TileAuraPylon te = this.getMasterTile(); if (te == null) { @@ -290,7 +332,7 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont this.breakTile(); return true; } - if(!this.hasTopTile()) { + if (!this.hasTopTile()) { this.breakTile(); return true; } @@ -299,22 +341,23 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont private boolean hasTopTile() { TileAuraPylon master = this.getMasterTile(); - if(master == null) return false; + if (master == null) return false; TileEntity te = this.worldObj.getTileEntity(master.xCoord, master.yCoord + 1, master.zCoord); return !(te == null || !(te instanceof TileAuraPylonTop)); } - //Individual. + // Individual. private void breakTile() { - if(!this.isPartOfMultiblock || this.worldObj.isRemote) return; + if (!this.isPartOfMultiblock || this.worldObj.isRemote) return; int meta = this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord); Block pylon = this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord); - if(pylon != null) { + if (pylon != null) { ArrayList stacks = pylon.getDrops(this.worldObj, this.xCoord, this.yCoord, this.zCoord, meta, 0); - for(ItemStack i : stacks) { - EntityItem item = new EntityItem(this.worldObj, this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, i); - //ItemUtils.applyRandomDropOffset(item, worldObj.rand); + for (ItemStack i : stacks) { + EntityItem item = + new EntityItem(this.worldObj, this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, i); + // ItemUtils.applyRandomDropOffset(item, worldObj.rand); this.worldObj.spawnEntityInWorld(item); } } @@ -323,71 +366,71 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); } - //Individual + // Individual public boolean isPartOfMultiblock() { return this.isPartOfMultiblock; } - //Individual. + // Individual. public void setPartOfMultiblock(boolean isPartOfMultiblock) { this.isPartOfMultiblock = isPartOfMultiblock; } - //Individual. + // Individual. @Override public boolean canUpdate() { return true; } - //Individual. + // Individual. public void setTileInformation(boolean isMaster, boolean isInput) { this.isMasterTile = isMaster; this.isInputTile = isInput; } - //Individual. + // Individual. public boolean isInputTile() { return this.isInputTile; } - //Individual. + // Individual. public TileAuraPylon getInputTile() { if (this.isInputTile()) return this; - if(this.worldObj == null) return null; + if (this.worldObj == null) return null; TileEntity superTile = this.worldObj.getTileEntity(this.xCoord, this.yCoord - 1, this.zCoord); if (superTile == null || !(superTile instanceof TileAuraPylon)) return null; return ((TileAuraPylon) superTile).getInputTile(); } - //Individual. + // Individual. public boolean isMasterTile() { return this.isMasterTile; } - //Individual. + // Individual. public TileAuraPylon getMasterTile() { if (this.isMasterTile()) return this; - if(this.worldObj == null) return null; + if (this.worldObj == null) return null; TileEntity superTile = this.worldObj.getTileEntity(this.xCoord, this.yCoord + 1, this.zCoord); if (superTile == null || !(superTile instanceof TileAuraPylon)) return null; return ((TileAuraPylon) superTile).getMasterTile(); } - //Dynamic. + // Dynamic. public int getEssentiaAmount() { TileAuraPylon io = this.getInputTile(); if (io == null) return 0; return io.amount; } - //Dynamic. + // Dynamic. public Aspect getAspectType() { TileAuraPylon io = this.getInputTile(); if (io == null) return null; return io.holdingAspect; } - //Dynamic. + // Dynamic. public int getMaxAmount() { TileAuraPylon io = this.getInputTile(); if (io == null) return 0; @@ -429,15 +472,14 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont compound.setInteger("amount", this.amount); compound.setInteger("maxAmount", this.maxAmount); compound.setBoolean("partOfMultiblock", this.isPartOfMultiblock); - if(this.crystalEssentiaStack != null) - NBTHelper.setStack(compound, "crystalStack", this.crystalEssentiaStack); + if (this.crystalEssentiaStack != null) NBTHelper.setStack(compound, "crystalStack", this.crystalEssentiaStack); } /////////////////////////////////////////////////////////////////////////////////////////////// // IAspectContainer /////////////////////////////////////////////////////////////////////////////////////////////// - //Dynamic. + // Dynamic. @Override public AspectList getAspects() { TileAuraPylon io = this.getInputTile(); @@ -448,18 +490,17 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont return al; } - //NO-OP + // NO-OP @Override - public void setAspects(AspectList aspectList) { - } + public void setAspects(AspectList aspectList) {} - //Individual. + // Individual. @Override public boolean doesContainerAccept(Aspect aspect) { return this.isInputTile() && this.holdingAspect != null && this.holdingAspect.equals(aspect); } - //Individual. + // Individual. @Override public int addToContainer(Aspect aspect, int amount) { if (amount == 0) { @@ -479,7 +520,7 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont return amount; } - //Individual. + // Individual. @Override public boolean takeFromContainer(Aspect aspect, int i) { if (!this.isInputTile()) return false; @@ -498,20 +539,20 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont return false; } - //Individual. - //You may only extract 1 at a time. + // Individual. + // You may only extract 1 at a time. @Override public boolean takeFromContainer(AspectList aspectList) { return false; } - //Individual. + // Individual. @Override public boolean doesContainerContainAmount(Aspect aspect, int i) { return this.isInputTile() && this.holdingAspect != null && this.amount >= i && aspect == this.holdingAspect; } - //Individual. + // Individual. @Override public boolean doesContainerContain(AspectList list) { if (!this.isInputTile()) return false; @@ -521,7 +562,7 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont return false; } - //Individual. + // Individual. @Override public int containerContains(Aspect aspect) { return 0; @@ -531,30 +572,29 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont // IEssentiaTransport /////////////////////////////////////////////////////////////////////////////////////////////// - //Individual. + // Individual. @Override public boolean isConnectable(ForgeDirection face) { return this.isInputTile() && face == ForgeDirection.DOWN; } - //Individual. + // Individual. @Override public boolean canInputFrom(ForgeDirection face) { return this.isInputTile() && face == ForgeDirection.DOWN; } - //Individual. + // Individual. @Override public boolean canOutputTo(ForgeDirection face) { return false; } - //NO-OP + // NO-OP @Override - public void setSuction(Aspect aspect, int i) { - } + public void setSuction(Aspect aspect, int i) {} - //Individual. + // Individual. @Override public Aspect getSuctionType(ForgeDirection forgeDirection) { return this.isInputTile() ? this.holdingAspect : null; @@ -578,13 +618,13 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont return this.canInputFrom(direction) ? this.amount - this.addToContainer(aspect, this.amount) : 0; } - //Individual. + // Individual. @Override public Aspect getEssentiaType(ForgeDirection forgeDirection) { return this.isInputTile() ? this.holdingAspect : null; } - //Individual. + // Individual. @Override public int getEssentiaAmount(ForgeDirection forgeDirection) { return this.isInputTile() ? this.amount : 0; @@ -595,16 +635,15 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont return 64; } - //Individual. + // Individual. @Override public boolean renderExtendedTube() { return false; } public boolean isLowestTile() { - if(this.worldObj == null) return false; + if (this.worldObj == null) return false; TileEntity te = this.worldObj.getTileEntity(this.xCoord, this.yCoord - 1, this.zCoord); return te == null || !(te instanceof TileAuraPylon); } - } diff --git a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileAuraPylonTop.java b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileAuraPylonTop.java index a2fefbb..986ca5a 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileAuraPylonTop.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileAuraPylonTop.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.blocks.tiles; +import java.util.ArrayList; import makeo.gadomancy.client.effect.EffectHandler; import makeo.gadomancy.client.effect.fx.Orbital; import makeo.gadomancy.common.registration.RegisteredBlocks; @@ -11,8 +12,6 @@ import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.aspects.IAspectContainer; -import java.util.ArrayList; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -30,26 +29,28 @@ public class TileAuraPylonTop extends SynchronizedTileEntity implements IAspectC @Override public void updateEntity() { TileEntity te = this.worldObj.getTileEntity(this.xCoord, this.yCoord - 1, this.zCoord); - if(!this.worldObj.isRemote) { - if(te == null || !(te instanceof TileAuraPylon)) { + if (!this.worldObj.isRemote) { + if (te == null || !(te instanceof TileAuraPylon)) { this.breakTile(); return; } - if(this.worldObj.getBlock(this.xCoord, this.yCoord - 1, this.zCoord) != RegisteredBlocks.blockAuraPylon || this.worldObj.getBlockMetadata(this.xCoord, this.yCoord - 1, this.zCoord) != 0) { + if (this.worldObj.getBlock(this.xCoord, this.yCoord - 1, this.zCoord) != RegisteredBlocks.blockAuraPylon + || this.worldObj.getBlockMetadata(this.xCoord, this.yCoord - 1, this.zCoord) != 0) { this.breakTile(); return; } TileAuraPylon pylon = (TileAuraPylon) te; - if(pylon.isPartOfMultiblock() && !pylon.isMasterTile()) this.breakTile(); + if (pylon.isPartOfMultiblock() && !pylon.isMasterTile()) this.breakTile(); } else { this.shouldRender = te != null && te instanceof TileAuraPylon && ((TileAuraPylon) te).isPartOfMultiblock(); - this.shouldRenderAura = te != null && te instanceof TileAuraPylon && ((TileAuraPylon) te).getEssentiaAmount() > 0; + this.shouldRenderAura = + te != null && te instanceof TileAuraPylon && ((TileAuraPylon) te).getEssentiaAmount() > 0; } } public Aspect getAspect() { TileEntity te = this.worldObj.getTileEntity(this.xCoord, this.yCoord - 1, this.zCoord); - if(te == null || !(te instanceof TileAuraPylon)) { + if (te == null || !(te instanceof TileAuraPylon)) { return null; } return ((TileAuraPylon) te).getAspectType(); @@ -58,9 +59,9 @@ public class TileAuraPylonTop extends SynchronizedTileEntity implements IAspectC private void breakTile() { int meta = this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord); Block pylon = this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord); - if(pylon != null) { + if (pylon != null) { ArrayList stacks = pylon.getDrops(this.worldObj, this.xCoord, this.yCoord, this.zCoord, meta, 0); - for(ItemStack i : stacks) { + for (ItemStack i : stacks) { EntityItem item = new EntityItem(this.worldObj, this.xCoord, this.yCoord, this.zCoord, i); this.worldObj.spawnEntityInWorld(item); } @@ -81,10 +82,9 @@ public class TileAuraPylonTop extends SynchronizedTileEntity implements IAspectC @Override public void invalidate() { super.invalidate(); - if(this.orbital != null) { + if (this.orbital != null) { this.orbital.clearOrbitals(); - if(this.orbital.registered) - EffectHandler.getInstance().unregisterOrbital(this.orbital); + if (this.orbital.registered) EffectHandler.getInstance().unregisterOrbital(this.orbital); } } @@ -96,7 +96,7 @@ public class TileAuraPylonTop extends SynchronizedTileEntity implements IAspectC @Override public AspectList getAspects() { TileEntity master = this.worldObj.getTileEntity(this.xCoord, this.yCoord - 1, this.zCoord); - if(master == null || !(master instanceof TileAuraPylon)) return null; + if (master == null || !(master instanceof TileAuraPylon)) return null; return ((TileAuraPylon) master).getAspects(); } diff --git a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileBlockProtector.java b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileBlockProtector.java index eb8a7e9..5a2fe9e 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileBlockProtector.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileBlockProtector.java @@ -1,5 +1,7 @@ package makeo.gadomancy.common.blocks.tiles; +import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityCreeper; @@ -17,9 +19,6 @@ import thaumcraft.api.aspects.IEssentiaTransport; import thaumcraft.common.Thaumcraft; import thaumcraft.common.tiles.TileJarFillable; -import java.util.ArrayList; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -47,7 +46,9 @@ public class TileBlockProtector extends TileJarFillable { } public int getPowerLevel() { - return Math.min(this.worldObj.getStrongestIndirectPower(this.xCoord, this.yCoord, this.zCoord), TileBlockProtector.MAX_RANGE); + return Math.min( + this.worldObj.getStrongestIndirectPower(this.xCoord, this.yCoord, this.zCoord), + TileBlockProtector.MAX_RANGE); } @Override @@ -70,7 +71,7 @@ public class TileBlockProtector extends TileJarFillable { int oldRange = this.range; this.range = compound.getInteger("ProtectRange"); - if(this.worldObj != null && this.worldObj.isRemote && oldRange != this.range) { + if (this.worldObj != null && this.worldObj.isRemote && oldRange != this.range) { this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord, this.yCoord, this.zCoord); } } @@ -94,7 +95,7 @@ public class TileBlockProtector extends TileJarFillable { } if (this.count % TileBlockProtector.UPDATE_TICKS == 0) { - if(this.range == 0) { + if (this.range == 0) { this.saturation = 0; } @@ -106,7 +107,7 @@ public class TileBlockProtector extends TileJarFillable { int powerLevel = this.getPowerLevel(); boolean executeDecrease = this.range > powerLevel; - if(this.range <= powerLevel && powerLevel > 0) { + if (this.range <= powerLevel && powerLevel > 0) { executeDecrease = true; if (this.takeFromContainer(TileBlockProtector.ASPECT, 1)) { @@ -128,23 +129,46 @@ public class TileBlockProtector extends TileJarFillable { this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); } } - } else if(this.range > 0) { + } else if (this.range > 0) { float sizeMod = 1 - (this.range / 15f); if (this.worldObj.rand.nextInt(9 - Thaumcraft.proxy.particleCount(2)) == 0) { - Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.68F, this.zCoord + 0.5F, this.xCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, this.yCoord + 0.68F, this.zCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, 0.3F - (0.15f*sizeMod), 6, true, -0.025F); + Thaumcraft.proxy.wispFX3( + this.worldObj, + this.xCoord + 0.5F, + this.yCoord + 0.68F, + this.zCoord + 0.5F, + this.xCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, + this.yCoord + 0.68F, + this.zCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, + 0.3F - (0.15f * sizeMod), + 6, + true, + -0.025F); } if (this.worldObj.rand.nextInt(15 - Thaumcraft.proxy.particleCount(4)) == 0) { - Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.68F, this.zCoord + 0.5F, this.xCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, this.yCoord + 0.68F, this.zCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, 0.2F - (0.15f*sizeMod), 6, true, -0.02F); + Thaumcraft.proxy.wispFX3( + this.worldObj, + this.xCoord + 0.5F, + this.yCoord + 0.68F, + this.zCoord + 0.5F, + this.xCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, + this.yCoord + 0.68F, + this.zCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, + 0.2F - (0.15f * sizeMod), + 6, + true, + -0.02F); } } - if(this.range > 0) { - for(EntityLivingBase entity : (List) this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, this.getProtectedAABB())) { - if(entity instanceof EntityCreeper) { + if (this.range > 0) { + for (EntityLivingBase entity : (List) + this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, this.getProtectedAABB())) { + if (entity instanceof EntityCreeper) { ((EntityCreeper) entity).timeSinceIgnited = 0; } - if(this.worldObj.isRemote && !(entity instanceof EntityPlayer)) { + if (this.worldObj.isRemote && !(entity instanceof EntityPlayer)) { this.spawnEntityParticles(entity); } } @@ -153,25 +177,47 @@ public class TileBlockProtector extends TileJarFillable { private void spawnEntityParticles(EntityLivingBase entity) { AxisAlignedBB cube = entity.boundingBox; - if(cube != null && this.worldObj.rand.nextInt(20) == 0) { + if (cube != null && this.worldObj.rand.nextInt(20) == 0) { double posX = this.worldObj.rand.nextDouble() * (cube.maxX - cube.minX) + cube.minX; double posY = this.worldObj.rand.nextDouble() * (cube.maxX - cube.minX) + cube.minY; double posZ = this.worldObj.rand.nextDouble() * (cube.maxX - cube.minX) + cube.minZ; switch (this.worldObj.rand.nextInt(5)) { - case 0: posX = cube.maxX; break; - case 1: posY = cube.maxY; break; - case 2: posZ = cube.maxZ; break; - case 3: posX = cube.minX; break; - case 4: posZ = cube.minZ; break; + case 0: + posX = cube.maxX; + break; + case 1: + posY = cube.maxY; + break; + case 2: + posZ = cube.maxZ; + break; + case 3: + posX = cube.minX; + break; + case 4: + posZ = cube.minZ; + break; } - Thaumcraft.proxy.wispFX3(this.worldObj, posX, posY, posZ, posX + this.worldObj.rand.nextFloat() * 0.2F, posY, posZ + this.worldObj.rand.nextFloat() * 0.2F, 0.2F, 6, true, -0.02F); + Thaumcraft.proxy.wispFX3( + this.worldObj, + posX, + posY, + posZ, + posX + this.worldObj.rand.nextFloat() * 0.2F, + posY, + posZ + this.worldObj.rand.nextFloat() * 0.2F, + 0.2F, + 6, + true, + -0.02F); } } private void fillJar() { - TileEntity te = ThaumcraftApiHelper.getConnectableTile(this.worldObj, this.xCoord, this.yCoord, this.zCoord, ForgeDirection.DOWN); + TileEntity te = ThaumcraftApiHelper.getConnectableTile( + this.worldObj, this.xCoord, this.yCoord, this.zCoord, ForgeDirection.DOWN); if (te != null) { IEssentiaTransport ic = (IEssentiaTransport) te; if (!ic.canOutputTo(ForgeDirection.UP)) { @@ -182,8 +228,9 @@ public class TileBlockProtector extends TileJarFillable { ta = this.aspectFilter; } else if ((this.aspect != null) && (this.amount > 0)) { ta = this.aspect; - } else if ((ic.getEssentiaAmount(ForgeDirection.UP) > 0) && - (ic.getSuctionAmount(ForgeDirection.UP) < this.getSuctionAmount(ForgeDirection.DOWN)) && (this.getSuctionAmount(ForgeDirection.DOWN) >= ic.getMinimumSuction())) { + } else if ((ic.getEssentiaAmount(ForgeDirection.UP) > 0) + && (ic.getSuctionAmount(ForgeDirection.UP) < this.getSuctionAmount(ForgeDirection.DOWN)) + && (this.getSuctionAmount(ForgeDirection.DOWN) >= ic.getMinimumSuction())) { ta = ic.getEssentiaType(ForgeDirection.UP); } if ((ta != null) && (ic.getSuctionAmount(ForgeDirection.UP) < this.getSuctionAmount(ForgeDirection.DOWN))) { @@ -243,8 +290,7 @@ public class TileBlockProtector extends TileJarFillable { if (protector.isInvalid()) { TileBlockProtector.protectors.remove(i); i--; - } else if (protector.worldObj.isRemote == world.isRemote - && helper.checkProtection(protector)) { + } else if (protector.worldObj.isRemote == world.isRemote && helper.checkProtection(protector)) { return true; } } @@ -264,7 +310,13 @@ public class TileBlockProtector extends TileJarFillable { } private AxisAlignedBB getProtectedAABB() { - return AxisAlignedBB.getBoundingBox(this.xCoord - this.range, this.yCoord - this.range, this.zCoord - this.range, this.xCoord + this.range, this.yCoord + this.range, this.zCoord + this.range); + return AxisAlignedBB.getBoundingBox( + this.xCoord - this.range, + this.yCoord - this.range, + this.zCoord - this.range, + this.xCoord + this.range, + this.yCoord + this.range, + this.zCoord + this.range); } private static boolean isSpotProtected(TileBlockProtector tile, double x, double y, double z) { 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 a809443..17387b0 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileEssentiaCompressor.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileEssentiaCompressor.java @@ -4,6 +4,9 @@ import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.awt.*; +import java.util.*; +import java.util.List; import makeo.gadomancy.client.events.ClientHandler; import makeo.gadomancy.common.network.packets.PacketAnimationAbsorb; import makeo.gadomancy.common.registration.RegisteredBlocks; @@ -41,10 +44,6 @@ import thaumcraft.common.tiles.TilePedestal; import tuhljin.automagy.api.essentia.IAspectContainerWithMax; import tuhljin.automagy.api.essentia.IEssentiaLocusReadable; -import java.awt.*; -import java.util.List; -import java.util.*; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -54,10 +53,11 @@ import java.util.*; * Created by HellFirePvP @ 22.04.2016 21:42 */ @Optional.InterfaceList({ - @Optional.Interface(iface = "tuhljin.automagy.api.essentia.IEssentiaLocusReadable", modid = "Automagy"), - @Optional.Interface(iface = "tuhljin.automagy.api.essentia.IAspectContainerWithMax", modid = "Automagy") + @Optional.Interface(iface = "tuhljin.automagy.api.essentia.IEssentiaLocusReadable", modid = "Automagy"), + @Optional.Interface(iface = "tuhljin.automagy.api.essentia.IAspectContainerWithMax", modid = "Automagy") }) -public class TileEssentiaCompressor extends SynchronizedTileEntity implements IEssentiaTransport,IEssentiaLocusReadable, IAspectContainerWithMax { +public class TileEssentiaCompressor extends SynchronizedTileEntity + implements IEssentiaTransport, IEssentiaLocusReadable, IAspectContainerWithMax { public static final int MAX_SIZE = 8; public static final int MAX_ASPECT_STORAGE = 3000, STD_ASPECT_STORAGE = 200; @@ -65,8 +65,8 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE private static Injector injEssentiaHandler = new Injector(EssentiaHandler.class); private static int multiblockIDCounter; - //Standard multiblock stuff - private boolean isMasterTile; //For debugging + // Standard multiblock stuff + private boolean isMasterTile; // For debugging private int multiblockYIndex = -1, multiblockId = -1; private boolean isMultiblockPresent; @@ -84,12 +84,12 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE super.updateEntity(); this.ticksExisted++; - if(!this.worldObj.isRemote) { - if(this.isMultiblockFormed()) { + if (!this.worldObj.isRemote) { + if (this.isMultiblockFormed()) { this.checkMultiblock(); } - if(!this.isMultiblockFormed()) return; + if (!this.isMultiblockFormed()) return; if (this.isMasterTile() && (this.prevFound || (this.ticksExisted % 100) == 0)) { List coords = this.searchAndGetSources(); @@ -100,51 +100,59 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE } } - if(this.isMasterTile() && ((this.incSize < TileEssentiaCompressor.MAX_SIZE && (this.ticksExisted % 40) == 0) || (this.coordPedestal != null))) { + if (this.isMasterTile() + && ((this.incSize < TileEssentiaCompressor.MAX_SIZE && (this.ticksExisted % 40) == 0) + || (this.coordPedestal != null))) { this.consumeElements(); } } else { - if(this.isMasterTile() && this.isMultiblockFormed()) { + if (this.isMasterTile() && this.isMultiblockFormed()) { this.playLightningEffects(); this.playVortexEffects(); - if(this.al.visSize() > 0) { + if (this.al.visSize() > 0) { this.playEssentiaEffects(); } } } - if(this.isMasterTile() && this.isMultiblockFormed()) { + if (this.isMasterTile() && this.isMultiblockFormed()) { this.vortexEntities(); } } @Optional.Method(modid = "Automagy") public AspectList getAspectsBase() { - if(this.isMultiblockFormed() && this.multiblockYIndex == 1) { + if (this.isMultiblockFormed() && this.multiblockYIndex == 1) { TileEssentiaCompressor master = this.tryFindMasterTile(); - if (master == null) - return null; + if (master == null) return null; return master.al; } return this.al; } private void consumeElements() { - if(this.coordPedestal != null) { - if(!this.checkPedestal(this.coordPedestal)) { + if (this.coordPedestal != null) { + if (!this.checkPedestal(this.coordPedestal)) { this.consumeTick = 0; this.coordPedestal = null; return; } this.consumeTick++; - if(this.consumeTick <= 400) { + if (this.consumeTick <= 400) { PacketAnimationAbsorb absorb = new PacketAnimationAbsorb( - this.xCoord, this.yCoord + 1, this.zCoord, - this.coordPedestal.getBlockX(), this.coordPedestal.getBlockY() + 1, this.coordPedestal.getBlockZ(), - 5, Block.getIdFromBlock(ConfigBlocks.blockCosmeticSolid), 1); - makeo.gadomancy.common.network.PacketHandler.INSTANCE.sendToAllAround(absorb, new NetworkRegistry.TargetPoint( - this.getWorldObj().provider.dimensionId, - this.xCoord, this.yCoord, this.zCoord, 16)); + this.xCoord, + this.yCoord + 1, + this.zCoord, + this.coordPedestal.getBlockX(), + this.coordPedestal.getBlockY() + 1, + this.coordPedestal.getBlockZ(), + 5, + Block.getIdFromBlock(ConfigBlocks.blockCosmeticSolid), + 1); + makeo.gadomancy.common.network.PacketHandler.INSTANCE.sendToAllAround( + absorb, + new NetworkRegistry.TargetPoint( + this.getWorldObj().provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, 16)); } else { TilePedestal te = (TilePedestal) this.worldObj.getTileEntity( this.coordPedestal.getBlockX(), this.coordPedestal.getBlockY(), this.coordPedestal.getBlockZ()); @@ -162,7 +170,7 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE for (int xx = -3; xx <= 3; xx++) { for (int zz = -3; zz <= 3; zz++) { Vector3 offset = new Vector3(this.xCoord + xx, this.yCoord, this.zCoord + zz); - if(this.checkPedestal(offset)) { + if (this.checkPedestal(offset)) { this.coordPedestal = offset; this.consumeTick = 0; return; @@ -175,22 +183,22 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE } private boolean checkPedestal(Vector3 coordPedestal) { - Block at = this.worldObj.getBlock( - coordPedestal.getBlockX(), coordPedestal.getBlockY(), coordPedestal.getBlockZ()); + Block at = + this.worldObj.getBlock(coordPedestal.getBlockX(), coordPedestal.getBlockY(), coordPedestal.getBlockZ()); int md = this.worldObj.getBlockMetadata( coordPedestal.getBlockX(), coordPedestal.getBlockY(), coordPedestal.getBlockZ()); TileEntity te = this.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; + 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; + if (st == null || st.getItem() == null) return false; return st.getItem().equals(RegisteredItems.itemElement) && st.getItemDamage() == 0; } - //only call from master tile. + // only call from master tile. private boolean searchForEssentia(List coordinates) { - if(this.ticksExisted % 10 != 0) return this.prevFound; + if (this.ticksExisted % 10 != 0) return this.prevFound; for (Aspect a : Aspect.aspects.values()) { if (this.doDrain(a, coordinates)) { this.al.add(a, 1); @@ -202,25 +210,30 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE return false; } - //only call from master tile. + // only call from master tile. private boolean doDrain(Aspect a, List coordinates) { for (WorldCoordinates coordinate : coordinates) { TileEntity sourceTile = this.worldObj.getTileEntity(coordinate.x, coordinate.y, coordinate.z); if (!(sourceTile instanceof IAspectSource)) { continue; } - if(sourceTile instanceof TileEssentiaCompressor) - continue; - IAspectSource as = (IAspectSource)sourceTile; + if (sourceTile instanceof TileEssentiaCompressor) continue; + IAspectSource as = (IAspectSource) sourceTile; AspectList contains = as.getAspects(); - if(contains == null || contains.visSize() > this.al.visSize()) - continue; - if(!this.canAccept(a)) - continue; + if (contains == null || contains.visSize() > this.al.visSize()) continue; + if (!this.canAccept(a)) continue; if (as.takeFromContainer(a, 1)) { - PacketHandler.INSTANCE.sendToAllAround(new PacketFXEssentiaSource(this.xCoord, this.yCoord + 1, this.zCoord, - (byte)(this.xCoord - coordinate.x), (byte)(this.yCoord - coordinate.y + 1), (byte)(this.zCoord - coordinate.z), - a.getColor()), new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.xCoord, this.yCoord + 1, this.zCoord, 32.0D)); + PacketHandler.INSTANCE.sendToAllAround( + new PacketFXEssentiaSource( + this.xCoord, + this.yCoord + 1, + this.zCoord, + (byte) (this.xCoord - coordinate.x), + (byte) (this.yCoord - coordinate.y + 1), + (byte) (this.zCoord - coordinate.z), + a.getColor()), + new NetworkRegistry.TargetPoint( + this.worldObj.provider.dimensionId, this.xCoord, this.yCoord + 1, this.zCoord, 32.0D)); return true; } } @@ -228,7 +241,10 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE } private int currentStorageSize() { - return TileEssentiaCompressor.STD_ASPECT_STORAGE + this.incSize * ((TileEssentiaCompressor.MAX_ASPECT_STORAGE - TileEssentiaCompressor.STD_ASPECT_STORAGE) / TileEssentiaCompressor.MAX_SIZE); + return TileEssentiaCompressor.STD_ASPECT_STORAGE + + this.incSize + * ((TileEssentiaCompressor.MAX_ASPECT_STORAGE - TileEssentiaCompressor.STD_ASPECT_STORAGE) + / TileEssentiaCompressor.MAX_SIZE); } private boolean canAccept(Aspect a) { @@ -252,7 +268,7 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE public float cb = 1.0F; public Aspect displayAspect; - //Thanks @TileEssentiaReservoir :P + // Thanks @TileEssentiaReservoir :P @SideOnly(Side.CLIENT) private void playEssentiaEffects() { if ((ClientHandler.ticks % 20 == 0) && (this.al.size() > 0)) { @@ -277,14 +293,34 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE this.cr = Math.min(1.0F, Math.max(0.0F, this.cr)); this.cg = Math.min(1.0F, Math.max(0.0F, this.cg)); this.cb = Math.min(1.0F, Math.max(0.0F, this.cb)); - FXEssentiaTrail essentiaTrail = new FXEssentiaTrail(this.worldObj, this.xCoord + 0.5, this.yCoord + 0.4, this.zCoord + 0.5, this.xCoord + 0.5, this.yCoord + 1.5, this.zCoord + 0.5, count, new Color(this.cr, this.cg, this.cb).getRGB(), 0.8F); + FXEssentiaTrail essentiaTrail = new FXEssentiaTrail( + this.worldObj, + this.xCoord + 0.5, + this.yCoord + 0.4, + this.zCoord + 0.5, + this.xCoord + 0.5, + this.yCoord + 1.5, + this.zCoord + 0.5, + count, + new Color(this.cr, this.cg, this.cb).getRGB(), + 0.8F); essentiaTrail.noClip = true; essentiaTrail.motionY = (0.01F + MathHelper.sin(count / 3.0F) * 0.001F); essentiaTrail.motionX = (MathHelper.sin(count / 10.0F) * 0.01F + this.worldObj.rand.nextGaussian() * 0.01D); essentiaTrail.motionZ = (MathHelper.sin(count / 10.0F) * 0.01F + this.worldObj.rand.nextGaussian() * 0.01D); ParticleEngine.instance.addEffect(this.worldObj, essentiaTrail); - essentiaTrail = new FXEssentiaTrail(this.worldObj, this.xCoord + 0.5, this.yCoord + 2.6, this.zCoord + 0.5, this.xCoord + 0.5, this.yCoord + 1.5, this.zCoord + 0.5, count, new Color(this.cr, this.cg, this.cb).getRGB(), 0.8F); + essentiaTrail = new FXEssentiaTrail( + this.worldObj, + this.xCoord + 0.5, + this.yCoord + 2.6, + this.zCoord + 0.5, + this.xCoord + 0.5, + this.yCoord + 1.5, + this.zCoord + 0.5, + count, + new Color(this.cr, this.cg, this.cb).getRGB(), + 0.8F); essentiaTrail.noClip = true; essentiaTrail.motionY = -(0.01F + MathHelper.sin(count / 3.0F) * 0.001F); essentiaTrail.motionX = (MathHelper.sin(count / 10.0F) * 0.01F + this.worldObj.rand.nextGaussian() * 0.01D); @@ -294,38 +330,55 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE private List searchAndGetSources() { WorldCoordinates thisCoordinates = new WorldCoordinates(this); - Map> teSources = new HashMap>(); + Map> teSources = + new HashMap>(); this.getSourcesField(teSources); - if(!teSources.containsKey(thisCoordinates)) { + if (!teSources.containsKey(thisCoordinates)) { this.searchSources(); this.getSourcesField(teSources); - if(teSources.containsKey(thisCoordinates)) { + if (teSources.containsKey(thisCoordinates)) { return this.searchAndGetSources(); } return new ArrayList(); } List result = teSources.get(thisCoordinates); - ((Map>) TileEssentiaCompressor.injEssentiaHandler.getField("sources")).remove(thisCoordinates); + ((Map>) TileEssentiaCompressor.injEssentiaHandler.getField("sources")) + .remove(thisCoordinates); return result; } private void searchSources() { - WorldCoordinates thisCoord = new WorldCoordinates(this.xCoord, this.yCoord, this.zCoord, this.worldObj.provider.dimensionId); + WorldCoordinates thisCoord = + new WorldCoordinates(this.xCoord, this.yCoord, this.zCoord, this.worldObj.provider.dimensionId); List coords = new LinkedList(); for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { this.unsafe_search(thisCoord, direction, coords); } - ((Map>) TileEssentiaCompressor.injEssentiaHandler.getField("sources")).put(thisCoord, coords); + ((Map>) TileEssentiaCompressor.injEssentiaHandler.getField("sources")) + .put(thisCoord, coords); } private void unsafe_search(WorldCoordinates coord, ForgeDirection direction, List out) { - ((HashMap) TileEssentiaCompressor.injEssentiaHandler.getField("sourcesDelay")).remove(coord); - TileEssentiaCompressor.injEssentiaHandler.invokeMethod("getSources", new Class[]{ World.class, WorldCoordinates.class, ForgeDirection.class, int.class }, this.worldObj, coord, direction, 5); - List coords = ((Map>) TileEssentiaCompressor.injEssentiaHandler.getField("sources")).get(coord); - if(coords != null) { - out.addAll(((Map>) TileEssentiaCompressor.injEssentiaHandler.getField("sources")).get(coord)); - ((Map>) TileEssentiaCompressor.injEssentiaHandler.getField("sources")).remove(coord); + ((HashMap) TileEssentiaCompressor.injEssentiaHandler.getField("sourcesDelay")) + .remove(coord); + TileEssentiaCompressor.injEssentiaHandler.invokeMethod( + "getSources", + new Class[] {World.class, WorldCoordinates.class, ForgeDirection.class, int.class}, + this.worldObj, + coord, + direction, + 5); + List coords = ((Map>) + TileEssentiaCompressor.injEssentiaHandler.getField("sources")) + .get(coord); + if (coords != null) { + out.addAll(((Map>) + TileEssentiaCompressor.injEssentiaHandler.getField("sources")) + .get(coord)); + ((Map>) + TileEssentiaCompressor.injEssentiaHandler.getField("sources")) + .remove(coord); } } @@ -345,7 +398,8 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE Vec3 v1 = Vec3.createVectorHelper(this.xCoord + 0.5D, this.yCoord + 1.5D, this.zCoord + 0.5D); Vec3 v2 = Vec3.createVectorHelper(tx + 0.5D, ty + 0.5D, tz + 0.5D); - MovingObjectPosition mop = ThaumcraftApiHelper.rayTraceIgnoringSource(this.worldObj, v1, v2, true, false, false); + MovingObjectPosition mop = + ThaumcraftApiHelper.rayTraceIgnoringSource(this.worldObj, v1, v2, true, false, false); if ((mop != null) && (this.getDistanceFrom(mop.blockX, mop.blockY, mop.blockZ) < 16.0D)) { tx = mop.blockX; ty = mop.blockY; @@ -353,7 +407,8 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE Block bi = this.worldObj.getBlock(tx, ty, tz); int md = this.worldObj.getBlockMetadata(tx, ty, tz); if (!bi.isAir(this.worldObj, tx, ty, tz)) { - Thaumcraft.proxy.hungryNodeFX(this.worldObj, tx, ty, tz, this.xCoord, this.yCoord + 1, this.zCoord, bi, md); + Thaumcraft.proxy.hungryNodeFX( + this.worldObj, tx, ty, tz, this.xCoord, this.yCoord + 1, this.zCoord, bi, md); } } } @@ -361,11 +416,11 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE @SideOnly(Side.CLIENT) private void playLightningEffects() { - if(this.incSize < 6) { - if(this.incSize < 2) { - if(this.worldObj.rand.nextInt(6) != 0) return; + if (this.incSize < 6) { + if (this.incSize < 2) { + if (this.worldObj.rand.nextInt(6) != 0) return; } else { - if(this.worldObj.rand.nextBoolean()) return; + if (this.worldObj.rand.nextBoolean()) return; } } double originX = this.xCoord + 0.5; @@ -374,22 +429,37 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE double targetX = this.xCoord + 0.4 + this.worldObj.rand.nextFloat() * 0.2; double targetY = this.yCoord + 0.4 + (this.worldObj.rand.nextBoolean() ? 2.2 : 0); double targetZ = this.zCoord + 0.4 + this.worldObj.rand.nextFloat() * 0.2; - FXLightningBolt bolt = new FXLightningBolt(Minecraft.getMinecraft().theWorld, originX, originY, originZ, - targetX, targetY, targetZ, Minecraft.getMinecraft().theWorld.rand.nextLong(), 10, 4.0F, 5); + FXLightningBolt bolt = new FXLightningBolt( + Minecraft.getMinecraft().theWorld, + originX, + originY, + originZ, + targetX, + targetY, + targetZ, + Minecraft.getMinecraft().theWorld.rand.nextLong(), + 10, + 4.0F, + 5); bolt.defaultFractal(); bolt.setType(5); bolt.finalizeBolt(); } private void vortexEntities() { - if(this.incSize <= 0) return; - List entities = this.worldObj.getEntitiesWithinAABB(Entity.class, - AxisAlignedBB.getBoundingBox(this.xCoord - 0.5, this.yCoord - 0.5, this.zCoord - 0.5, - this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5).expand(4, 4, 4)); + if (this.incSize <= 0) return; + List entities = this.worldObj.getEntitiesWithinAABB( + Entity.class, + AxisAlignedBB.getBoundingBox( + this.xCoord - 0.5, + this.yCoord - 0.5, + this.zCoord - 0.5, + this.xCoord + 0.5, + this.yCoord + 0.5, + this.zCoord + 0.5) + .expand(4, 4, 4)); for (Object o : entities) { - if(o == null || - !(o instanceof Entity) || - ((Entity) o).isDead) continue; + if (o == null || !(o instanceof Entity) || ((Entity) o).isDead) continue; this.applyMovementVectors((Entity) o); } } @@ -411,17 +481,17 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE } public void checkMultiblock() { - if(this.isMasterTile) { + if (this.isMasterTile) { boolean canSustain = this.isMultiblockableBlock(1); - if(!this.isMultiblockableBlock(2)) canSustain = false; - if(!canSustain) { + if (!this.isMultiblockableBlock(2)) canSustain = false; + if (!canSustain) { this.breakMultiblock(); this.isMultiblockPresent = false; } } else { TileEssentiaCompressor master = this.tryFindMasterTile(); - if(master != null) { - if(!master.isMultiblockPresent) { + if (master != null) { + if (!master.isMultiblockPresent) { this.breakMultiblock(); } } else { @@ -431,27 +501,22 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE } public TileEssentiaCompressor tryFindMasterTile() { - if(!this.isMultiblockFormed()) - return null; - if(this.isMasterTile()) - return this; //lul.. check before plz. + if (!this.isMultiblockFormed()) return null; + if (this.isMasterTile()) return this; // lul.. check before plz. Block down = this.worldObj.getBlock(this.xCoord, this.yCoord - this.multiblockYIndex, this.zCoord); - if(!down.equals(RegisteredBlocks.blockEssentiaCompressor)) - return null; + if (!down.equals(RegisteredBlocks.blockEssentiaCompressor)) return null; TileEntity te = this.worldObj.getTileEntity(this.xCoord, this.yCoord - this.multiblockYIndex, this.zCoord); - if(!(te instanceof TileEssentiaCompressor)) - return null; + if (!(te instanceof TileEssentiaCompressor)) return null; TileEssentiaCompressor compressor = (TileEssentiaCompressor) te; - if(compressor.multiblockId != this.multiblockId || !compressor.isMasterTile()) - return null; + if (compressor.multiblockId != this.multiblockId || !compressor.isMasterTile()) return null; return compressor; } private boolean isMultiblockableBlock(int yOffset) { Block block = this.worldObj.getBlock(this.xCoord, this.yCoord + yOffset, this.zCoord); TileEntity te = this.worldObj.getTileEntity(this.xCoord, this.yCoord + yOffset, this.zCoord); - if(!block.equals(RegisteredBlocks.blockEssentiaCompressor)) return false; - if(!(te instanceof TileEssentiaCompressor)) return false; + if (!block.equals(RegisteredBlocks.blockEssentiaCompressor)) return false; + if (!(te instanceof TileEssentiaCompressor)) return false; TileEssentiaCompressor compressor = (TileEssentiaCompressor) te; return compressor.multiblockId == this.multiblockId; } @@ -468,7 +533,7 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE private void doExplosion() { AspectList al = this.getAspects(); - if(al.visSize() > 0) { + if (al.visSize() > 0) { ExplosionHelper.taintplosion(this.worldObj, this.xCoord, this.yCoord, this.zCoord, true, 2, 2.0F, 4, 20); this.worldObj.setBlockToAir(this.xCoord, this.yCoord, this.zCoord); } else { @@ -486,8 +551,8 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE this.multiblockId = multiblockId; this.isMasterTile = isMaster; this.multiblockYIndex = yIndex; - if(isMaster) { - this.isMultiblockPresent = true; //Initial state. + if (isMaster) { + this.isMultiblockPresent = true; // Initial state. } this.al = new AspectList(); this.markDirty(); @@ -543,14 +608,14 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE @Override public AspectList getAspects() { - if(!this.isMultiblockFormed()) { + if (!this.isMultiblockFormed()) { return new AspectList(); } else { - if(this.isMasterTile()) { + if (this.isMasterTile()) { return this.al; } else { TileEssentiaCompressor master = this.tryFindMasterTile(); - if(master == null) return new AspectList(); + if (master == null) return new AspectList(); return master.getAspects(); } } @@ -566,11 +631,11 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE @Override public int addToContainer(Aspect aspect, int i) { - if(this.doesContainerAccept(aspect) && this.canAccept(aspect)) { + if (this.doesContainerAccept(aspect) && this.canAccept(aspect)) { TileEssentiaCompressor master = this.tryFindMasterTile(); - if(master == null) return 0; + if (master == null) return 0; int diff = master.currentStorageSize() - master.al.getAmount(aspect); - if(diff <= 0) return 0; + if (diff <= 0) return 0; i = master.currentStorageSize() >= master.al.getAmount(aspect) + i ? i : diff; master.al.add(aspect, i); this.worldObj.markBlockForUpdate(master.xCoord, master.yCoord, master.zCoord); @@ -580,12 +645,11 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE return 0; } - @Override public boolean takeFromContainer(Aspect aspect, int i) { - if(this.isMultiblockFormed() && this.multiblockYIndex == 1) { + if (this.isMultiblockFormed() && this.multiblockYIndex == 1) { TileEssentiaCompressor master = this.tryFindMasterTile(); - if(master == null) return false; + if (master == null) return false; boolean couldTake = master.al.reduce(aspect, i); master.al.remove(aspect, 0); this.worldObj.markBlockForUpdate(master.xCoord, master.yCoord, master.zCoord); @@ -603,9 +667,9 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE @Override public boolean doesContainerContainAmount(Aspect aspect, int i) { - if(this.isMultiblockFormed() && this.multiblockYIndex == 1) { + if (this.isMultiblockFormed() && this.multiblockYIndex == 1) { TileEssentiaCompressor master = this.tryFindMasterTile(); - if(master == null) return false; + if (master == null) return false; return master.al.getAmount(aspect) >= i; } return false; @@ -619,16 +683,14 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE @Override public int containerContains(Aspect aspect) { - if(this.isMultiblockFormed() && this.multiblockYIndex == 1) { + if (this.isMultiblockFormed() && this.multiblockYIndex == 1) { TileEssentiaCompressor master = this.tryFindMasterTile(); - if(master == null) return 0; + if (master == null) return 0; return master.al.getAmount(aspect); } return 0; } - - @Override public boolean isConnectable(ForgeDirection direction) { return false; @@ -636,22 +698,22 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE @Override public boolean canInputFrom(ForgeDirection direction) { - if(this.isMultiblockFormed() && this.multiblockYIndex == 1) { //The middle one - return direction == ForgeDirection.SOUTH || - direction == ForgeDirection.NORTH || - direction == ForgeDirection.EAST || - direction == ForgeDirection.WEST; + if (this.isMultiblockFormed() && this.multiblockYIndex == 1) { // The middle one + return direction == ForgeDirection.SOUTH + || direction == ForgeDirection.NORTH + || direction == ForgeDirection.EAST + || direction == ForgeDirection.WEST; } return false; } @Override public boolean canOutputTo(ForgeDirection direction) { - if(this.isMultiblockFormed() && this.multiblockYIndex == 1) { //The middle one - return direction == ForgeDirection.SOUTH || - direction == ForgeDirection.NORTH || - direction == ForgeDirection.EAST || - direction == ForgeDirection.WEST; + if (this.isMultiblockFormed() && this.multiblockYIndex == 1) { // The middle one + return direction == ForgeDirection.SOUTH + || direction == ForgeDirection.NORTH + || direction == ForgeDirection.EAST + || direction == ForgeDirection.WEST; } return false; } @@ -670,7 +732,7 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE @Override public int getSuctionAmount(ForgeDirection direction) { - if(this.canInputFrom(direction)) { + if (this.canInputFrom(direction)) { return 16; } return 0; @@ -678,10 +740,10 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE @Override public int takeEssentia(Aspect aspect, int i, ForgeDirection direction) { - if(this.isMultiblockFormed() && this.multiblockYIndex == 1) { - if(!this.canOutputTo(direction)) return 0; + if (this.isMultiblockFormed() && this.multiblockYIndex == 1) { + if (!this.canOutputTo(direction)) return 0; TileEssentiaCompressor master = this.tryFindMasterTile(); - if(master == null) return 0; + if (master == null) return 0; int amt = master.al.getAmount(aspect); int taken = amt - master.al.remove(aspect, i).getAmount(aspect); this.worldObj.markBlockForUpdate(master.xCoord, master.yCoord, master.zCoord); @@ -693,11 +755,11 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE @Override public int addEssentia(Aspect aspect, int i, ForgeDirection direction) { - if(this.canInputFrom(direction) && this.canAccept(aspect)) { + if (this.canInputFrom(direction) && this.canAccept(aspect)) { TileEssentiaCompressor master = this.tryFindMasterTile(); - if(master == null) return 0; + if (master == null) return 0; int diff = master.currentStorageSize() - master.al.getAmount(aspect); - if(diff <= 0) return 0; + if (diff <= 0) return 0; i = master.currentStorageSize() >= master.al.getAmount(aspect) + i ? i : diff; master.al.add(aspect, i); this.worldObj.markBlockForUpdate(master.xCoord, master.yCoord, master.zCoord); @@ -709,9 +771,9 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE @Override public Aspect getEssentiaType(ForgeDirection direction) { - if(this.isMultiblockFormed() && this.multiblockYIndex == 1) { + if (this.isMultiblockFormed() && this.multiblockYIndex == 1) { TileEssentiaCompressor master = this.tryFindMasterTile(); - if(master == null) return null; + if (master == null) return null; return new ArrayList(master.al.aspects.keySet()).get(this.worldObj.rand.nextInt(master.al.size())); } return null; @@ -719,9 +781,9 @@ public class TileEssentiaCompressor extends SynchronizedTileEntity implements IE @Override public int getEssentiaAmount(ForgeDirection direction) { - if(this.isMultiblockFormed() && this.multiblockYIndex == 1) { + if (this.isMultiblockFormed() && this.multiblockYIndex == 1) { TileEssentiaCompressor master = this.tryFindMasterTile(); - if(master == null) return 0; + if (master == null) return 0; return master.al.visSize(); } return 0; diff --git a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileExtendedNode.java b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileExtendedNode.java index 5d10ad6..68b9cc8 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileExtendedNode.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileExtendedNode.java @@ -1,6 +1,7 @@ package makeo.gadomancy.common.blocks.tiles; import cpw.mods.fml.common.network.NetworkRegistry; +import java.util.List; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.network.PacketHandler; import makeo.gadomancy.common.network.packets.PacketTCNodeBolt; @@ -19,7 +20,6 @@ import net.minecraft.util.DamageSource; import net.minecraft.world.EnumDifficulty; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.IEssentiaContainerItem; -import thaumcraft.api.nodes.INode; import thaumcraft.common.entities.EntityAspectOrb; import thaumcraft.common.entities.monster.EntityWisp; import thaumcraft.common.items.ItemCrystalEssence; @@ -27,8 +27,6 @@ import thaumcraft.common.items.ItemManaBean; import thaumcraft.common.items.ItemWispEssence; import thaumcraft.common.tiles.TileNode; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -46,7 +44,6 @@ public class TileExtendedNode extends TileNode { private boolean doingVortexExplosion; private ExplosionHelper.VortexExplosion vortexExplosion; - public TileExtendedNode() { this.behavior = new GrowingNodeBehavior(this); } @@ -57,11 +54,11 @@ public class TileExtendedNode extends TileNode { this.ticksExisted++; - if(this.doingVortexExplosion) { - if(this.vortexExplosion == null) { + if (this.doingVortexExplosion) { + if (this.vortexExplosion == null) { this.vortexExplosion = new ExplosionHelper.VortexExplosion(this); } - if(this.vortexExplosion.isFinished()) { + if (this.vortexExplosion.isFinished()) { this.vortexExplosion = null; this.doingVortexExplosion = false; } else { @@ -74,35 +71,63 @@ public class TileExtendedNode extends TileNode { needUpdate = this.handleGrowingNodeFirst(false); needUpdate = this.handleGrowingNodeSecond(needUpdate); - if(!this.worldObj.isRemote && needUpdate) { + if (!this.worldObj.isRemote && needUpdate) { this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); this.markDirty(); } } private boolean handleGrowingNodeSecond(boolean needUpdate) { - if(this.extendedNodeType == null || this.extendedNodeType != ExtendedNodeType.GROWING) return needUpdate; + if (this.extendedNodeType == null || this.extendedNodeType != ExtendedNodeType.GROWING) return needUpdate; - if(this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) return needUpdate; - if(this.worldObj.isRemote) return needUpdate; - if(this.ticksExisted % 8 != 0) return needUpdate; + if (this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) return needUpdate; + if (this.worldObj.isRemote) return needUpdate; + if (this.ticksExisted % 8 != 0) return needUpdate; - List livingEntities = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(this.xCoord, this.yCoord, this.zCoord, this.xCoord + 1, this.yCoord + 1, this.zCoord + 1).expand(6.0D, 6.0D, 6.0D)); + List livingEntities = this.worldObj.getEntitiesWithinAABB( + EntityLivingBase.class, + AxisAlignedBB.getBoundingBox( + this.xCoord, + this.yCoord, + this.zCoord, + this.xCoord + 1, + this.yCoord + 1, + this.zCoord + 1) + .expand(6.0D, 6.0D, 6.0D)); if ((livingEntities != null) && (livingEntities.size() > 0)) { for (Object e : livingEntities) { EntityLivingBase livingEntity = (EntityLivingBase) e; if ((livingEntity.isEntityAlive()) && (!livingEntity.isEntityInvulnerable())) { - if(livingEntity instanceof EntityPlayer && ((EntityPlayer) livingEntity).capabilities.isCreativeMode) continue; - if(!this.behavior.mayZapNow()) continue; + if (livingEntity instanceof EntityPlayer + && ((EntityPlayer) livingEntity).capabilities.isCreativeMode) continue; + if (!this.behavior.mayZapNow()) continue; - ResearchHelper.distributeResearch(Gadomancy.MODID.toUpperCase() + ".GROWING_AGGRESSION", this.worldObj, this.xCoord, this.yCoord, this.zCoord, 6); + ResearchHelper.distributeResearch( + Gadomancy.MODID.toUpperCase() + ".GROWING_AGGRESSION", + this.worldObj, + this.xCoord, + this.yCoord, + this.zCoord, + 6); livingEntity.attackEntityFrom(DamageSource.magic, this.behavior.getZapDamage()); - this.worldObj.playSoundEffect(this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, "thaumcraft:zap", 0.8F, 1.0F); + this.worldObj.playSoundEffect( + this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, "thaumcraft:zap", 0.8F, 1.0F); - PacketTCNodeBolt packet = new PacketTCNodeBolt(this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, (float) livingEntity.posX, (float) (livingEntity.posY + livingEntity.height), (float) livingEntity.posZ, 0, false); - PacketHandler.INSTANCE.sendToAllAround(packet, new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, 32.0D)); + PacketTCNodeBolt packet = new PacketTCNodeBolt( + this.xCoord + 0.5F, + this.yCoord + 0.5F, + this.zCoord + 0.5F, + (float) livingEntity.posX, + (float) (livingEntity.posY + livingEntity.height), + (float) livingEntity.posZ, + 0, + false); + PacketHandler.INSTANCE.sendToAllAround( + packet, + new NetworkRegistry.TargetPoint( + this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, 32.0D)); } } } @@ -111,7 +136,7 @@ public class TileExtendedNode extends TileNode { } private boolean handleGrowingNodeFirst(boolean needUpdate) { - if(this.extendedNodeType == null || this.extendedNodeType != ExtendedNodeType.GROWING) return needUpdate; + if (this.extendedNodeType == null || this.extendedNodeType != ExtendedNodeType.GROWING) return needUpdate; needUpdate = this.doVortex(EntityAspectOrb.class, needUpdate, new GrowingNodeVortexRunnable() { @Override @@ -127,18 +152,27 @@ public class TileExtendedNode extends TileNode { needUpdate = this.doVortex(EntityItem.class, needUpdate, new GrowingNodeVortexRunnable() { @Override public boolean doesVortex(EntityItem entity) { - return entity.getEntityItem().getItem() instanceof ItemWispEssence || entity.getEntityItem().getItem() instanceof ItemManaBean || entity.getEntityItem().getItem() instanceof ItemCrystalEssence; + return entity.getEntityItem().getItem() instanceof ItemWispEssence + || entity.getEntityItem().getItem() instanceof ItemManaBean + || entity.getEntityItem().getItem() instanceof ItemCrystalEssence; } @Override public Aspect getAspect(EntityItem entity) { - IEssentiaContainerItem container = (IEssentiaContainerItem) entity.getEntityItem().getItem(); - return container.getAspects(entity.getEntityItem()).getAspects().length > 0 ? container.getAspects(entity.getEntityItem()).getAspects()[0] : null; + IEssentiaContainerItem container = + (IEssentiaContainerItem) entity.getEntityItem().getItem(); + return container.getAspects(entity.getEntityItem()).getAspects().length > 0 + ? container.getAspects(entity.getEntityItem()).getAspects()[0] + : null; } @Override public GrowingNodeBehavior.AspectType getAspectType(EntityItem entity) { - return entity.getEntityItem().getItem() instanceof ItemWispEssence ? GrowingNodeBehavior.AspectType.WISP_ESSENCE : entity.getEntityItem().getItem() instanceof ItemCrystalEssence ? GrowingNodeBehavior.AspectType.CRYSTAL_ESSENCE : GrowingNodeBehavior.AspectType.MANA_BEAN; + return entity.getEntityItem().getItem() instanceof ItemWispEssence + ? GrowingNodeBehavior.AspectType.WISP_ESSENCE + : entity.getEntityItem().getItem() instanceof ItemCrystalEssence + ? GrowingNodeBehavior.AspectType.CRYSTAL_ESSENCE + : GrowingNodeBehavior.AspectType.MANA_BEAN; } }); needUpdate = this.doVortex(EntityWisp.class, needUpdate, new GrowingNodeVortexRunnable() { @@ -152,18 +186,18 @@ public class TileExtendedNode extends TileNode { return GrowingNodeBehavior.AspectType.WISP; } }); - if(this.worldObj.isRemote) return needUpdate; + if (this.worldObj.isRemote) return needUpdate; - if(this.behavior.lookingForNode()) { + if (this.behavior.lookingForNode()) { int xx = this.worldObj.rand.nextInt(8) - this.worldObj.rand.nextInt(8); int yy = this.worldObj.rand.nextInt(8) - this.worldObj.rand.nextInt(8); int zz = this.worldObj.rand.nextInt(8) - this.worldObj.rand.nextInt(8); TileEntity t = this.worldObj.getTileEntity(this.xCoord + xx, this.yCoord + yy, this.zCoord + zz); - if(t != null && t instanceof TileNode && !(xx == 0 && yy == 0 && zz == 0)) { + if (t != null && t instanceof TileNode && !(xx == 0 && yy == 0 && zz == 0)) { TileNode node = (TileNode) t; int thisSize = this.getAspectsBase().visSize(); int othersSize = node.getAspectsBase().visSize(); - if(thisSize >= othersSize) { + if (thisSize >= othersSize) { this.behavior.lockOnTo(node); this.worldObj.markBlockForUpdate(this.xCoord + xx, this.yCoord + yy, this.zCoord + zz); node.markDirty(); @@ -190,22 +224,32 @@ public class TileExtendedNode extends TileNode { } } - private boolean doVortex(Class entityClass, boolean needUpdate, GrowingNodeVortexRunnable runnable) { - List entities = this.worldObj.getEntitiesWithinAABB(entityClass, AxisAlignedBB.getBoundingBox(this.xCoord, this.yCoord, this.zCoord, this.xCoord + 1, this.yCoord + 1, this.zCoord + 1).expand(15.0D, 15.0D, 15.0D)); + private boolean doVortex( + Class entityClass, boolean needUpdate, GrowingNodeVortexRunnable runnable) { + List entities = this.worldObj.getEntitiesWithinAABB( + entityClass, + AxisAlignedBB.getBoundingBox( + this.xCoord, + this.yCoord, + this.zCoord, + this.xCoord + 1, + this.yCoord + 1, + this.zCoord + 1) + .expand(15.0D, 15.0D, 15.0D)); if ((entities != null) && (entities.size() > 0)) { for (Object eObj : entities) { E entity = (E) eObj; - if(!runnable.doesVortex(entity)) continue; + if (!runnable.doesVortex(entity)) continue; if ((entity.isEntityAlive()) && (!entity.isEntityInvulnerable())) { double d = this.getDistanceTo(entity.posX, entity.posY, entity.posZ); - if (d < 0.5D) { //prev: 2.0D + if (d < 0.5D) { // prev: 2.0D Aspect a = runnable.getAspect(entity); - if(a != null) { + if (a != null) { if (this.getAspects().getAmount(a) < this.getNodeVisBase(a)) { this.addToContainer(a, 1); } else { - //Adding it permanently - if(!this.worldObj.isRemote && this.behavior.doesAccept(a)) { + // Adding it permanently + if (!this.worldObj.isRemote && this.behavior.doesAccept(a)) { this.behavior.addAspect(runnable.getAspectType(entity), a, 1); } } @@ -229,7 +273,7 @@ public class TileExtendedNode extends TileNode { } public NBTTagCompound getBehaviorSnapshot() { - if(this.extendedNodeType != null && this.extendedNodeType == ExtendedNodeType.GROWING) { + if (this.extendedNodeType != null && this.extendedNodeType == ExtendedNodeType.GROWING) { NBTTagCompound behaviorCompound = new NBTTagCompound(); this.behavior.writeToNBT(behaviorCompound); return behaviorCompound; @@ -238,7 +282,7 @@ public class TileExtendedNode extends TileNode { } public void readBehaviorSnapshot(NBTTagCompound tagCompound) { - if(tagCompound != null && this.extendedNodeType != null && this.extendedNodeType == ExtendedNodeType.GROWING) { + if (tagCompound != null && this.extendedNodeType != null && this.extendedNodeType == ExtendedNodeType.GROWING) { this.behavior.readFromNBT(tagCompound); } } @@ -250,13 +294,13 @@ public class TileExtendedNode extends TileNode { NBTTagCompound compound = nbttagcompound.getCompoundTag("Gadomancy"); String exName = compound.getString("exNodeType"); - if(exName != null && !exName.isEmpty()) { + if (exName != null && !exName.isEmpty()) { this.extendedNodeType = ExtendedNodeType.valueOf(exName); } else { this.extendedNodeType = null; } - if(this.extendedNodeType != null && this.extendedNodeType == ExtendedNodeType.GROWING) { + if (this.extendedNodeType != null && this.extendedNodeType == ExtendedNodeType.GROWING) { NBTTagCompound growingNodeBehavior = compound.getCompoundTag("NodeBehavior"); this.behavior.readFromNBT(growingNodeBehavior); } @@ -268,10 +312,10 @@ public class TileExtendedNode extends TileNode { NBTTagCompound compound = new NBTTagCompound(); - if(this.extendedNodeType != null) { + if (this.extendedNodeType != null) { compound.setString("exNodeType", this.extendedNodeType.name()); - if(this.extendedNodeType == ExtendedNodeType.GROWING) { + if (this.extendedNodeType == ExtendedNodeType.GROWING) { NBTTagCompound behaviorCompound = new NBTTagCompound(); this.behavior.writeToNBT(behaviorCompound); compound.setTag("NodeBehavior", behaviorCompound); @@ -294,7 +338,5 @@ public class TileExtendedNode extends TileNode { public abstract Aspect getAspect(E entity); public abstract GrowingNodeBehavior.AspectType getAspectType(E entity); - } - } diff --git a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileExtendedNodeJar.java b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileExtendedNodeJar.java index c4b3ac1..4619ec9 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileExtendedNodeJar.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileExtendedNodeJar.java @@ -72,10 +72,12 @@ public class TileExtendedNodeJar extends TileJarNode { } this.setNodeType(NodeType.values()[nbttagcompound.getByte("type")]); byte mod = nbttagcompound.getByte("modifier"); - if(mod >= 0) this.setNodeModifier(NodeModifier.values()[mod]); else this.setNodeModifier(null); + if (mod >= 0) this.setNodeModifier(NodeModifier.values()[mod]); + else this.setNodeModifier(null); byte exType = nbttagcompound.getByte("extendedNodeType"); - if(exType >= 0) this.setExtendedNodeType(ExtendedNodeType.values()[exType]); else this.setExtendedNodeType(null); - if(nbttagcompound.hasKey("Behavior")) { + if (exType >= 0) this.setExtendedNodeType(ExtendedNodeType.values()[exType]); + else this.setExtendedNodeType(null); + if (nbttagcompound.hasKey("Behavior")) { this.behaviorSnapshot = nbttagcompound.getCompoundTag("Behavior"); } } @@ -94,9 +96,17 @@ public class TileExtendedNodeJar extends TileJarNode { } } nbttagcompound.setByte("type", (byte) this.getNodeType().ordinal()); - nbttagcompound.setByte("modifier", this.getNodeModifier() == null ? -1 : (byte) this.getNodeModifier().ordinal()); - nbttagcompound.setByte("extendedNodeType", this.getExtendedNodeType() == null ? -1 : (byte) this.getExtendedNodeType().ordinal()); - if(this.behaviorSnapshot != null) { + nbttagcompound.setByte( + "modifier", + this.getNodeModifier() == null + ? -1 + : (byte) this.getNodeModifier().ordinal()); + nbttagcompound.setByte( + "extendedNodeType", + this.getExtendedNodeType() == null + ? -1 + : (byte) this.getExtendedNodeType().ordinal()); + if (this.behaviorSnapshot != null) { nbttagcompound.setTag("Behavior", this.behaviorSnapshot); } } @@ -214,7 +224,8 @@ public class TileExtendedNodeJar extends TileJarNode { for (int yy = -1; yy < 3; yy++) { for (int xx = -1; xx < 2; xx++) { for (int zz = -1; zz < 2; zz++) { - Thaumcraft.proxy.blockSparkle(this.worldObj, this.xCoord + xx, this.yCoord + yy, this.zCoord + zz, -9999, 5); + Thaumcraft.proxy.blockSparkle( + this.worldObj, this.xCoord + xx, this.yCoord + yy, this.zCoord + zz, -9999, 5); } } } @@ -227,7 +238,8 @@ public class TileExtendedNodeJar extends TileJarNode { public boolean drop = true; - public int onWandRightClick(World world, ItemStack wandstack, EntityPlayer player, int x, int y, int z, int side, int md) { + public int onWandRightClick( + World world, ItemStack wandstack, EntityPlayer player, int x, int y, int z, int side, int md) { if (!world.isRemote) { this.drop = false; world.setBlock(x, y, z, ConfigBlocks.blockAiry, 0, 3); @@ -244,7 +256,14 @@ public class TileExtendedNodeJar extends TileJarNode { } } world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(ConfigBlocks.blockJar) + 61440); - player.worldObj.playSound(x + 0.5D, y + 0.5D, z + 0.5D, "random.glass", 1.0F, 0.9F + player.worldObj.rand.nextFloat() * 0.2F, false); + player.worldObj.playSound( + x + 0.5D, + y + 0.5D, + z + 0.5D, + "random.glass", + 1.0F, + 0.9F + player.worldObj.rand.nextFloat() * 0.2F, + false); player.swingItem(); return 0; } @@ -253,14 +272,11 @@ public class TileExtendedNodeJar extends TileJarNode { return null; } - public void onUsingWandTick(ItemStack wandstack, EntityPlayer player, int count) { - } + public void onUsingWandTick(ItemStack wandstack, EntityPlayer player, int count) {} - public void onWandStoppedUsing(ItemStack wandstack, World world, EntityPlayer player, int count) { - } + public void onWandStoppedUsing(ItemStack wandstack, World world, EntityPlayer player, int count) {} public boolean doesContainerAccept(Aspect tag) { return true; } - } diff --git a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileInfusionClaw.java b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileInfusionClaw.java index fe4ec46..4644d73 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileInfusionClaw.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileInfusionClaw.java @@ -4,6 +4,10 @@ import cpw.mods.fml.common.ObfuscationReflectionHelper; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.io.File; +import java.util.ArrayList; +import java.util.Random; +import java.util.UUID; import makeo.gadomancy.api.ClickBehavior; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.entities.fake.AdvancedFakePlayer; @@ -14,7 +18,6 @@ import makeo.gadomancy.common.utils.NBTHelper; import net.minecraft.client.Minecraft; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -33,11 +36,6 @@ import thaumcraft.common.items.wands.ItemWandCasting; import thaumcraft.common.items.wands.foci.ItemFocusPrimal; import thaumcraft.common.lib.research.ResearchManager; -import java.io.File; -import java.util.ArrayList; -import java.util.Random; -import java.util.UUID; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -52,7 +50,13 @@ public class TileInfusionClaw extends SynchronizedTileEntity implements ISidedIn private static final ItemWandCasting WAND_ITEM = (ItemWandCasting) ConfigItems.itemWandCasting; private static final ItemFocusPrimal WAND_FOCUS = (ItemFocusPrimal) ConfigItems.itemFocusPrimal; - private static final AspectList MAX_WAND_COST = new AspectList().add(Aspect.WATER, 250).add(Aspect.AIR, 250).add(Aspect.EARTH, 250).add(Aspect.FIRE, 250).add(Aspect.ORDER, 250).add(Aspect.ENTROPY, 250); + private static final AspectList MAX_WAND_COST = new AspectList() + .add(Aspect.WATER, 250) + .add(Aspect.AIR, 250) + .add(Aspect.EARTH, 250) + .add(Aspect.FIRE, 250) + .add(Aspect.ORDER, 250) + .add(Aspect.ENTROPY, 250); private ItemInWorldManager im; private Boolean redstoneState; @@ -80,7 +84,7 @@ public class TileInfusionClaw extends SynchronizedTileEntity implements ISidedIn public float[] animationStates; public TileInfusionClaw() { - if(Gadomancy.proxy.getSide() == Side.CLIENT) { + if (Gadomancy.proxy.getSide() == Side.CLIENT) { this.animationStates = new float[12]; EntityLivingBase entity = Minecraft.getMinecraft().renderViewEntity; this.lastRenderTick = entity == null ? 0 : entity.ticksExisted; @@ -91,22 +95,22 @@ public class TileInfusionClaw extends SynchronizedTileEntity implements ISidedIn public void updateEntity() { World world = this.getWorldObj(); - if(!world.isRemote) { - if(this.redstoneState == null) { + if (!world.isRemote) { + if (this.redstoneState == null) { this.redstoneState = world.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord); } - if(this.cooldown > 0) { + if (this.cooldown > 0) { this.cooldown--; - if(this.cooldown == (int)(7.5f*20)) { + if (this.cooldown == (int) (7.5f * 20)) { this.performClickBlock(); } } - if(this.count > 20) { + if (this.count > 20) { this.count = 0; - if(this.yCoord > 0) { - //Comparator... + if (this.yCoord > 0) { + // Comparator... world.notifyBlockChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); } } @@ -116,7 +120,7 @@ public class TileInfusionClaw extends SynchronizedTileEntity implements ISidedIn @Override public void readCustomNBT(NBTTagCompound compound) { - if(compound.hasKey("player")) { + if (compound.hasKey("player")) { this.player = compound.getString("player"); } this.wandStack = NBTHelper.getStack(compound, "wandStack"); @@ -125,10 +129,10 @@ public class TileInfusionClaw extends SynchronizedTileEntity implements ISidedIn @Override public void writeCustomNBT(NBTTagCompound compound) { - if(this.hasOwner()) { + if (this.hasOwner()) { compound.setString("player", this.player); } - if(this.wandStack != null) { + if (this.wandStack != null) { NBTHelper.setStack(compound, "wandStack", this.wandStack); } compound.setBoolean("isLocked", this.isLocked); @@ -140,7 +144,7 @@ public class TileInfusionClaw extends SynchronizedTileEntity implements ISidedIn } public void updateRedstone(boolean state) { - if(this.redstoneState != null && state && !this.redstoneState) { + if (this.redstoneState != null && state && !this.redstoneState) { this.startClickBlock(); } this.redstoneState = state; @@ -152,14 +156,14 @@ public class TileInfusionClaw extends SynchronizedTileEntity implements ISidedIn public void setIsLocked(boolean isLocked) { this.isLocked = isLocked; - if(!this.getWorldObj().isRemote) { + if (!this.getWorldObj().isRemote) { this.markForUpdate(); } } public boolean setOwner(EntityPlayer player) { World world = this.getWorldObj(); - if(!world.isRemote && this.isValidOwner(player)) { + if (!world.isRemote && this.isValidOwner(player)) { this.player = player.getCommandSenderName(); this.markForUpdate(); @@ -177,22 +181,26 @@ public class TileInfusionClaw extends SynchronizedTileEntity implements ISidedIn private void loadResearch(EntityPlayer fakePlayer) { boolean online = false; - for(String username : MinecraftServer.getServer().getAllUsernames()) { - if(username.equals(this.player)) { + for (String username : MinecraftServer.getServer().getAllUsernames()) { + if (username.equals(this.player)) { online = true; break; } } - if(online) { + if (online) { this.research = ResearchManager.getResearchForPlayer(this.player); } else { - if(this.research == null) { + if (this.research == null) { Thaumcraft.proxy.getCompletedResearch().put(fakePlayer.getCommandSenderName(), new ArrayList()); - IPlayerFileData playerNBTManagerObj = MinecraftServer.getServer().worldServerForDimension(0).getSaveHandler().getSaveHandler(); - SaveHandler sh = (SaveHandler)playerNBTManagerObj; - File dir = ObfuscationReflectionHelper.getPrivateValue(SaveHandler.class, sh, "playersDirectory", "field_75771_c"); + IPlayerFileData playerNBTManagerObj = MinecraftServer.getServer() + .worldServerForDimension(0) + .getSaveHandler() + .getSaveHandler(); + SaveHandler sh = (SaveHandler) playerNBTManagerObj; + File dir = ObfuscationReflectionHelper.getPrivateValue( + SaveHandler.class, sh, "playersDirectory", "field_75771_c"); File file1 = new File(dir, this.player + ".thaum"); File file2 = new File(dir, this.player + ".thaumbak"); ResearchManager.loadPlayerData(fakePlayer, file1, file2, false); @@ -201,7 +209,11 @@ public class TileInfusionClaw extends SynchronizedTileEntity implements ISidedIn } } - Thaumcraft.proxy.getCompletedResearch().put(fakePlayer.getCommandSenderName(), this.research == null ? new ArrayList() : this.research); + Thaumcraft.proxy + .getCompletedResearch() + .put( + fakePlayer.getCommandSenderName(), + this.research == null ? new ArrayList() : this.research); } public String getOwner() { @@ -213,81 +225,94 @@ public class TileInfusionClaw extends SynchronizedTileEntity implements ISidedIn } private void startClickBlock() { - if(!this.isRunning()) { - ClickBehavior behavior = this.getClickBehavior(this.getWorldObj(), this.xCoord, this.yCoord -1, this.zCoord); - if(behavior != null && (!behavior.hasVisCost() || this.hasSufficientVis())) { + if (!this.isRunning()) { + ClickBehavior behavior = + this.getClickBehavior(this.getWorldObj(), this.xCoord, this.yCoord - 1, this.zCoord); + if (behavior != null && (!behavior.hasVisCost() || this.hasSufficientVis())) { this.startRunning(); } } } @SuppressWarnings("unused") - private void performClickBlock() { + private void performClickBlock() { World world = this.getWorldObj(); int x = this.xCoord; int y = this.yCoord - 1; int z = this.zCoord; ClickBehavior behavior = this.getClickBehavior(world, x, y, z); - if(behavior != null) { - - if (world == null){ - try { + if (behavior != null) { + + if (world == null) { + try { world = this.getWorldObj(); - } - catch(NullPointerException e){ + } catch (NullPointerException e) { makeo.gadomancy.common.Gadomancy.log.error("fatal error, world == null! at InfusionClaw"); return; } } - + AdvancedFakePlayer fakePlayer = new AdvancedFakePlayer((WorldServer) world, TileInfusionClaw.FAKE_UUID); this.loadResearch(fakePlayer); - if(behavior.hasVisCost()) { - if(this.hasSufficientVis()) { + if (behavior.hasVisCost()) { + if (this.hasSufficientVis()) { this.consumeVis(fakePlayer); } else { return; } } - if(this.im == null) { + if (this.im == null) { this.im = new ItemInWorldManager(world); } else { this.im.setWorld((WorldServer) world); } - if(fakePlayer == null){ - makeo.gadomancy.common.Gadomancy.log.warn("Infusion Claw was build inside of a protected area! You need to allow FakePlayers here!"); + if (fakePlayer == null) { + makeo.gadomancy.common.Gadomancy.log.warn( + "Infusion Claw was build inside of a protected area! You need to allow FakePlayers here!"); return; } - + fakePlayer.setHeldItem(this.wandStack); - this.im.activateBlockOrUseItem(fakePlayer, world, this.wandStack, x, y, z, ForgeDirection.UP.ordinal(), 0.5F, 0.5F, 0.5F); + this.im.activateBlockOrUseItem( + fakePlayer, world, this.wandStack, x, y, z, ForgeDirection.UP.ordinal(), 0.5F, 0.5F, 0.5F); this.addInstability(behavior); } } private ClickBehavior getClickBehavior(World world, int x, int y, int z) { - if(y >= 0 && !world.isRemote && world instanceof WorldServer && this.hasOwner() - && !world.isAirBlock(x, y, z) && this.wandStack != null && this.wandStack.stackSize > 0) { + if (y >= 0 + && !world.isRemote + && world instanceof WorldServer + && this.hasOwner() + && !world.isAirBlock(x, y, z) + && this.wandStack != null + && this.wandStack.stackSize > 0) { return RegisteredBlocks.getClawClickBehavior(world, x, y, z); } return null; } public boolean isRunning() { - if(this.getWorldObj().isRemote) { + if (this.getWorldObj().isRemote) { return this.animationStates[8] + this.animationStates[9] + this.animationStates[11] != 0; } return this.cooldown > 0; } private void startRunning() { - PacketHandler.INSTANCE.sendToAllAround(new PacketStartAnimation(PacketStartAnimation.ID_INFUSIONCLAW, this.xCoord, this.yCoord, this.zCoord), - new NetworkRegistry.TargetPoint(this.getWorldObj().provider.dimensionId, this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, 48)); - this.cooldown = 22*20; + PacketHandler.INSTANCE.sendToAllAround( + new PacketStartAnimation(PacketStartAnimation.ID_INFUSIONCLAW, this.xCoord, this.yCoord, this.zCoord), + new NetworkRegistry.TargetPoint( + this.getWorldObj().provider.dimensionId, + this.xCoord + 0.5, + this.yCoord + 0.5, + this.zCoord + 0.5, + 48)); + this.cooldown = 22 * 20; } private void addInstability(ClickBehavior behavior) { @@ -299,7 +324,8 @@ public class TileInfusionClaw extends SynchronizedTileEntity implements ISidedIn instability -= Math.floor((maxVis > 300 ? 300 : maxVis) / 300f * 10f); instability -= TileInfusionClaw.WAND_ITEM.isStaff(this.wandStack) ? 6 : -1; - instability += Math.floor((TileInfusionClaw.WAND_ITEM.getCap(this.wandStack).getBaseCostModifier() - 0.4) * 3); + instability += + Math.floor((TileInfusionClaw.WAND_ITEM.getCap(this.wandStack).getBaseCostModifier() - 0.4) * 3); instability -= TileInfusionClaw.WAND_ITEM.getCap(this.wandStack) == ConfigItems.WAND_CAP_VOID ? 3 : 0; instability -= TileInfusionClaw.WAND_ITEM.getRod(this.wandStack) == ConfigItems.STAFF_ROD_PRIMAL ? 6 : 0; @@ -308,11 +334,15 @@ public class TileInfusionClaw extends SynchronizedTileEntity implements ISidedIn } private boolean hasSufficientVis() { - return this.wandStack != null && this.wandStack.stackSize > 0 && TileInfusionClaw.WAND_ITEM.consumeAllVis(this.wandStack, null, TileInfusionClaw.MAX_WAND_COST, false, false); + return this.wandStack != null + && this.wandStack.stackSize > 0 + && TileInfusionClaw.WAND_ITEM.consumeAllVis( + this.wandStack, null, TileInfusionClaw.MAX_WAND_COST, false, false); } private void consumeVis(EntityPlayer player) { - TileInfusionClaw.WAND_ITEM.consumeAllVis(this.wandStack, player, TileInfusionClaw.WAND_FOCUS.getVisCost(this.wandStack), true, false); + TileInfusionClaw.WAND_ITEM.consumeAllVis( + this.wandStack, player, TileInfusionClaw.WAND_FOCUS.getVisCost(this.wandStack), true, false); this.markForUpdate(); } @@ -328,11 +358,11 @@ public class TileInfusionClaw extends SynchronizedTileEntity implements ISidedIn @Override public ItemStack decrStackSize(int slot, int amount) { - if(this.isRunning()) { + if (this.isRunning()) { return null; } - if(amount > 0) { + if (amount > 0) { ItemStack result = this.wandStack.copy(); this.wandStack = null; this.markForUpdate(); @@ -373,22 +403,18 @@ public class TileInfusionClaw extends SynchronizedTileEntity implements ISidedIn } @Override - public void openInventory() { - - } + public void openInventory() {} @Override - public void closeInventory() { - - } + public void closeInventory() {} @Override public boolean isItemValidForSlot(int slot, ItemStack stack) { - if(this.isRunning()) { + if (this.isRunning()) { return false; } - if(stack.getItem() == TileInfusionClaw.WAND_ITEM) { + if (stack.getItem() == TileInfusionClaw.WAND_ITEM) { return !TileInfusionClaw.WAND_ITEM.isSceptre(stack) && TileInfusionClaw.WAND_ITEM.getFocus(stack) == null; } return false; @@ -396,7 +422,7 @@ public class TileInfusionClaw extends SynchronizedTileEntity implements ISidedIn @Override public int[] getAccessibleSlotsFromSide(int side) { - return new int[]{0}; + return new int[] {0}; } @Override diff --git a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileKnowledgeBook.java b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileKnowledgeBook.java index 8408591..0a5084b 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileKnowledgeBook.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileKnowledgeBook.java @@ -3,6 +3,7 @@ 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 java.util.*; import makeo.gadomancy.client.util.UtilsFX; import makeo.gadomancy.common.entities.EntityPermNoClipItem; import makeo.gadomancy.common.network.PacketHandler; @@ -33,15 +34,14 @@ import thaumcraft.common.lib.events.EssentiaHandler; import thaumcraft.common.lib.research.ResearchManager; import thaumcraft.common.lib.research.ResearchNoteData; -import java.util.*; - /** * HellFirePvP@Admin * Date: 19.04.2016 / 14:53 * on Gadomancy * TileKnowledgeBook */ -public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityPermNoClipItem.IItemMasterTile, IAspectContainer { +public class TileKnowledgeBook extends SynchronizedTileEntity + implements EntityPermNoClipItem.IItemMasterTile, IAspectContainer { private static final Random rand = new Random(); private static final int LOWEST_AMOUNT = 10; @@ -56,21 +56,21 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP private FloatingBookAttributes bookAttributes = new FloatingBookAttributes(); - //The itemstack this is connected to. + // The itemstack this is connected to. private ItemStack storedResearchNote; private EntityPermNoClipItem.ItemChangeTask scheduledTask; - //Ticks + // Ticks private int timeSinceLastItemInfo; private int ticksExisted; private int ticksCognitio; private int ticksEnvironmentCheck; private int ticksResearchSearch; - //Sound effect stuff. I didn't like it when it's like changing pages 4 times in a row... + // Sound effect stuff. I didn't like it when it's like changing pages 4 times in a row... private boolean turnedPagesLastTick; - //General research stuff + // General research stuff private boolean researching; private AspectList workResearchAspects; private int surroundingKnowledge; @@ -83,20 +83,20 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP this.timeSinceLastItemInfo++; if (!this.worldObj.isRemote) { - if(this.timeSinceLastItemInfo > 8) { + if (this.timeSinceLastItemInfo > 8) { this.informItemRemoval(); } - if(this.updateResearchStatus()) { + if (this.updateResearchStatus()) { this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); this.markDirty(); } - if(this.researching) { + if (this.researching) { this.doResearchCycle(); } } else { - if(this.researching && this.hasCognitio()) { + if (this.researching && this.hasCognitio()) { this.doResearchEffects(); } } @@ -117,13 +117,13 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP private void doResearchCycle() { this.drainCognitio(); - if(!this.hasCognitio()) { + if (!this.hasCognitio()) { return; } this.checkSurroundings(); int chance = Math.max(0, TileKnowledgeBook.MAX_NEEDED_KNOWLEDGE - this.surroundingKnowledge) + 100; - if(TileKnowledgeBook.rand.nextInt(chance) == 0) { + if (TileKnowledgeBook.rand.nextInt(chance) == 0) { this.doResearchProgress(); this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); this.markDirty(); @@ -132,19 +132,19 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP private void doResearchProgress() { List aspects = new ArrayList(this.workResearchAspects.aspects.keySet()); - if(aspects.isEmpty()) { + if (aspects.isEmpty()) { this.finishResearch(); return; } Aspect a = aspects.get(TileKnowledgeBook.rand.nextInt(aspects.size())); int value = this.workResearchAspects.aspects.get(a); value--; - if(value <= 0) { + if (value <= 0) { this.workResearchAspects.aspects.remove(a); } else { this.workResearchAspects.aspects.put(a, value); } - if(this.workResearchAspects.aspects.isEmpty()) { + if (this.workResearchAspects.aspects.isEmpty()) { this.finishResearch(); } } @@ -157,25 +157,31 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP this.ticksEnvironmentCheck = 200; this.surroundingKnowledge = 0; for (int xx = -TileKnowledgeBook.SURROUNDINGS_SEARCH_XZ; xx <= TileKnowledgeBook.SURROUNDINGS_SEARCH_XZ; xx++) { - for (int zz = -TileKnowledgeBook.SURROUNDINGS_SEARCH_XZ; zz <= TileKnowledgeBook.SURROUNDINGS_SEARCH_XZ; zz++) { + for (int zz = -TileKnowledgeBook.SURROUNDINGS_SEARCH_XZ; + zz <= TileKnowledgeBook.SURROUNDINGS_SEARCH_XZ; + zz++) { lblYLoop: - for (int yy = -TileKnowledgeBook.SURROUNDINGS_SEARCH_Y; yy <= TileKnowledgeBook.SURROUNDINGS_SEARCH_Y; yy++) { + for (int yy = -TileKnowledgeBook.SURROUNDINGS_SEARCH_Y; + yy <= TileKnowledgeBook.SURROUNDINGS_SEARCH_Y; + yy++) { int absX = xx + this.xCoord; int absY = yy + this.yCoord; int absZ = zz + this.zCoord; Block at = this.worldObj.getBlock(absX, absY, absZ); int meta = this.worldObj.getBlockMetadata(absX, absY, absZ); TileEntity te = this.worldObj.getTileEntity(absX, absY, absZ); - if(at.equals(Blocks.bookshelf)) { + if (at.equals(Blocks.bookshelf)) { this.surroundingKnowledge += 1; - } else if(te != null && te instanceof IKnowledgeProvider) { - this.surroundingKnowledge += ((IKnowledgeProvider) te).getProvidedKnowledge(this.worldObj, absX, absY, absZ); - } else if(at instanceof IKnowledgeProvider) { - this.surroundingKnowledge += ((IKnowledgeProvider) at).getProvidedKnowledge(this.worldObj, absX, absY, absZ); + } else if (te != null && te instanceof IKnowledgeProvider) { + this.surroundingKnowledge += + ((IKnowledgeProvider) te).getProvidedKnowledge(this.worldObj, absX, absY, absZ); + } else if (at instanceof IKnowledgeProvider) { + this.surroundingKnowledge += + ((IKnowledgeProvider) at).getProvidedKnowledge(this.worldObj, absX, absY, absZ); } else { for (BlockSnapshot sn : TileKnowledgeBook.knowledgeIncreaseMap.keySet()) { - if(sn.block.equals(at) && sn.metadata == meta) { + if (sn.block.equals(at) && sn.metadata == meta) { this.surroundingKnowledge += TileKnowledgeBook.knowledgeIncreaseMap.get(sn); continue lblYLoop; } @@ -187,14 +193,14 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP } private void drainCognitio() { - if(this.ticksCognitio <= 0) { + if (this.ticksCognitio <= 0) { this.searchForCognitio(); } else { this.ticksCognitio--; - if(this.ticksCognitio <= 40) { + if (this.ticksCognitio <= 40) { this.searchForCognitio(); } - if(this.ticksCognitio <= 0) { + if (this.ticksCognitio <= 0) { this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); this.markDirty(); } @@ -202,12 +208,12 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP } private void searchForCognitio() { - if((this.ticksExisted & 31) == 0) { + if ((this.ticksExisted & 31) == 0) { int drainRange = 4; ForgeDirection[] toTry = ForgeDirection.VALID_DIRECTIONS; for (ForgeDirection dir : toTry) { - if(dir == null) continue; //LUL should not happen... - if(EssentiaHandler.drainEssentia(this, Aspect.MIND, dir, drainRange)) { + if (dir == null) continue; // LUL should not happen... + if (EssentiaHandler.drainEssentia(this, Aspect.MIND, dir, drainRange)) { this.ticksCognitio += TileKnowledgeBook.COGNITIO_TICKS; this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); this.markDirty(); @@ -219,21 +225,35 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP @SideOnly(Side.CLIENT) private void doResearchEffects() { - if((this.ticksExisted & 15) == 0) { + if ((this.ticksExisted & 15) == 0) { UtilsFX.doRuneEffects(Minecraft.getMinecraft().theWorld, this.xCoord, this.yCoord - 1, this.zCoord, 0); } - if((this.ticksExisted & 31) == 0) { + if ((this.ticksExisted & 31) == 0) { switch (TileKnowledgeBook.rand.nextInt(5)) { case 0: - if(!this.turnedPagesLastTick) { - this.worldObj.playSound(this.xCoord + 0.5, this.yCoord + 0.3, this.zCoord + 0.5, "thaumcraft:page", 0.4F, 1.0F, false); + if (!this.turnedPagesLastTick) { + this.worldObj.playSound( + this.xCoord + 0.5, + this.yCoord + 0.3, + this.zCoord + 0.5, + "thaumcraft:page", + 0.4F, + 1.0F, + false); this.turnedPagesLastTick = true; break; } case 1: case 2: case 3: - this.worldObj.playSound(this.xCoord + 0.5, this.yCoord + 0.3, this.zCoord + 0.5, "thaumcraft:write", 0.2F, 1.0F, false); + this.worldObj.playSound( + this.xCoord + 0.5, + this.yCoord + 0.3, + this.zCoord + 0.5, + "thaumcraft:write", + 0.2F, + 1.0F, + false); this.turnedPagesLastTick = false; break; } @@ -243,14 +263,16 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP private void finishResearch() { this.stopResearch(); this.scheduleFinishItemChange(); - PacketStartAnimation packet = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, this.xCoord, this.yCoord, this.zCoord); + PacketStartAnimation packet = + new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, this.xCoord, this.yCoord, this.zCoord); PacketHandler.INSTANCE.sendToAllAround(packet, this.getTargetPoint(32)); this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); this.markDirty(); } private NetworkRegistry.TargetPoint getTargetPoint(double radius) { - return new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, radius); + return new NetworkRegistry.TargetPoint( + this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, radius); } private void scheduleFinishItemChange() { @@ -264,12 +286,12 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP }; } - //Returns true, if updating/sync is required. + // Returns true, if updating/sync is required. private boolean updateResearchStatus() { - if(this.researching) { - if(this.storedResearchNote != null) { + if (this.researching) { + if (this.storedResearchNote != null) { ResearchNoteData nd = ResearchManager.getData(this.storedResearchNote); - if(nd == null || nd.isComplete()) { + if (nd == null || nd.isComplete()) { this.stopResearch(); return true; } @@ -278,11 +300,11 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP return true; } } else { - if(this.storedResearchNote != null) { + if (this.storedResearchNote != null) { ResearchNoteData nd = ResearchManager.getData(this.storedResearchNote); - if(nd != null && !nd.isComplete()) { + if (nd != null && !nd.isComplete()) { ResearchItem ri = ResearchCategories.getResearch(nd.key); - if(ri != null) { + if (ri != null) { this.beginResearch(ri.tags); return true; } @@ -296,7 +318,8 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP AspectList workResearchList = new AspectList(); for (Aspect a : researchTags.aspects.keySet()) { int value = researchTags.aspects.get(a); - int newVal = (int) Math.max(TileKnowledgeBook.LOWEST_AMOUNT, ((double) value) * TileKnowledgeBook.MULTIPLIER); + int newVal = + (int) Math.max(TileKnowledgeBook.LOWEST_AMOUNT, ((double) value) * TileKnowledgeBook.MULTIPLIER); workResearchList.add(a, newVal); } this.workResearchAspects = workResearchList; @@ -329,7 +352,7 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP @Override public EntityPermNoClipItem.ItemChangeTask getAndRemoveScheduledChangeTask() { - if(this.scheduledTask != null) { + if (this.scheduledTask != null) { EntityPermNoClipItem.ItemChangeTask buffer = this.scheduledTask; this.scheduledTask = null; return buffer; @@ -348,14 +371,25 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP return; } float centerY = this.yCoord + 0.4F; - List entityItems = this.worldObj.selectEntitiesWithinAABB(EntityItem.class, - AxisAlignedBB.getBoundingBox(this.xCoord - 0.5, centerY - 0.5, this.zCoord - 0.5, this.xCoord + 0.5, centerY + 0.5, this.zCoord + 0.5).expand(8, 8, 8), new IEntitySelector() { + List entityItems = this.worldObj.selectEntitiesWithinAABB( + EntityItem.class, + AxisAlignedBB.getBoundingBox( + this.xCoord - 0.5, + centerY - 0.5, + this.zCoord - 0.5, + this.xCoord + 0.5, + centerY + 0.5, + this.zCoord + 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 ItemResearchNotes && - TileKnowledgeBook.this.shouldVortexResearchNote(((EntityItem) e).getEntityItem()); + return !(e instanceof EntityPermanentItem) + && !(e instanceof EntitySpecialItem) + && e instanceof EntityItem + && ((EntityItem) e).getEntityItem() != null + && ((EntityItem) e).getEntityItem().getItem() instanceof ItemResearchNotes + && TileKnowledgeBook.this.shouldVortexResearchNote(((EntityItem) e).getEntityItem()); } }); @@ -364,7 +398,7 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP dummy.posY = centerY + 0.5; dummy.posZ = this.zCoord + 0.5; - //MC code. + // MC code. EntityItem entity = null; double d0 = Double.MAX_VALUE; for (Object entityItem : entityItems) { @@ -377,17 +411,25 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP } } } - if(entity == null) { + if (entity == null) { this.ticksResearchSearch = 50; return; } - if(dummy.getDistanceToEntity(entity) < 1 && !this.worldObj.isRemote) { + if (dummy.getDistanceToEntity(entity) < 1 && !this.worldObj.isRemote) { ItemStack inter = entity.getEntityItem(); inter.stackSize--; this.storedResearchNote = inter.copy(); this.storedResearchNote.stackSize = 1; - EntityPermNoClipItem item = new EntityPermNoClipItem(entity.worldObj, this.xCoord + 0.5F, centerY + 0.3F, this.zCoord + 0.5F, this.storedResearchNote, this.xCoord, this.yCoord, this.zCoord); + EntityPermNoClipItem item = new EntityPermNoClipItem( + entity.worldObj, + this.xCoord + 0.5F, + centerY + 0.3F, + this.zCoord + 0.5F, + this.storedResearchNote, + this.xCoord, + this.yCoord, + this.zCoord); entity.worldObj.spawnEntityInWorld(item); item.motionX = 0; item.motionY = 0; @@ -398,7 +440,7 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP this.timeSinceLastItemInfo = 0; - if(inter.stackSize <= 0) entity.setDead(); + if (inter.stackSize <= 0) entity.setDead(); entity.noClip = false; item.delayBeforeCanPickup = 60; this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); @@ -409,7 +451,7 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP } } - //Special to masterTile only! + // Special to masterTile only! private void applyMovementVectors(EntityItem entity) { double var3 = (this.xCoord + 0.5D - entity.posX) / 15.0D; double var5 = (this.yCoord + 0.5D - entity.posY) / 15.0D; @@ -426,8 +468,8 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP private boolean shouldVortexResearchNote(ItemStack stack) { ResearchNoteData nd = ResearchManager.getData(stack); - if(nd == null) return false; - if(nd.isComplete()) return false; + if (nd == null) return false; + if (nd.isComplete()) return false; ResearchItem ri = ResearchCategories.getResearch(nd.key); return ri != null; } @@ -446,13 +488,12 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP @Override public void writeCustomNBT(NBTTagCompound compound) { - if(this.workResearchAspects != null) { + if (this.workResearchAspects != null) { NBTHelper.setAspectList(compound, "workAspects", this.workResearchAspects); } compound.setInteger("cognitio", this.ticksCognitio); compound.setBoolean("researching", this.researching); - if(this.storedResearchNote != null) - NBTHelper.setStack(compound, "crystalStack", this.storedResearchNote); + if (this.storedResearchNote != null) NBTHelper.setStack(compound, "crystalStack", this.storedResearchNote); } @Override @@ -512,13 +553,12 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP public interface IKnowledgeProvider { int getProvidedKnowledge(World world, int blockX, int blockY, int blockZ); - } public class FloatingBookAttributes { - //Ugh. EnchantmentTable stuff... I DON'T UNDERSTAND THIS FLOATING BOOK - //Well not that i tried... copy pasta please. + // Ugh. EnchantmentTable stuff... I DON'T UNDERSTAND THIS FLOATING BOOK + // Well not that i tried... copy pasta please. public int field_145926_a; public float field_145933_i; public float field_145931_j; @@ -530,74 +570,65 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP public float field_145925_p; public float field_145924_q; - private void updateFloatingBook() { this.field_145927_n = this.field_145930_m; this.field_145925_p = this.field_145928_o; - EntityPlayer entityplayer = TileKnowledgeBook.this.worldObj.getClosestPlayer((float)TileKnowledgeBook.this.xCoord + 0.5F, (float)TileKnowledgeBook.this.yCoord + 0.5F, (float)TileKnowledgeBook.this.zCoord + 0.5F, 3.0D); + EntityPlayer entityplayer = TileKnowledgeBook.this.worldObj.getClosestPlayer( + (float) TileKnowledgeBook.this.xCoord + 0.5F, + (float) TileKnowledgeBook.this.yCoord + 0.5F, + (float) TileKnowledgeBook.this.zCoord + 0.5F, + 3.0D); - if (entityplayer != null) - { - double d0 = entityplayer.posX - (double)((float)TileKnowledgeBook.this.xCoord + 0.5F); - double d1 = entityplayer.posZ - (double)((float)TileKnowledgeBook.this.zCoord + 0.5F); - this.field_145924_q = (float)Math.atan2(d1, d0); + if (entityplayer != null) { + double d0 = entityplayer.posX - (double) ((float) TileKnowledgeBook.this.xCoord + 0.5F); + double d1 = entityplayer.posZ - (double) ((float) TileKnowledgeBook.this.zCoord + 0.5F); + this.field_145924_q = (float) Math.atan2(d1, d0); this.field_145930_m += 0.1F; - if (this.field_145930_m < 0.5F || TileKnowledgeBook.rand.nextInt(40) == 0) - { + if (this.field_145930_m < 0.5F || TileKnowledgeBook.rand.nextInt(40) == 0) { float f1 = this.field_145932_k; - do - { - this.field_145932_k += (float)(TileKnowledgeBook.rand.nextInt(4) - TileKnowledgeBook.rand.nextInt(4)); - } - while (f1 == this.field_145932_k); + do { + this.field_145932_k += + (float) (TileKnowledgeBook.rand.nextInt(4) - TileKnowledgeBook.rand.nextInt(4)); + } while (f1 == this.field_145932_k); } - } - else - { + } else { this.field_145924_q += 0.02F; this.field_145930_m -= 0.1F; } - while (this.field_145928_o >= (float)Math.PI) - { - this.field_145928_o -= ((float)Math.PI * 2F); + while (this.field_145928_o >= (float) Math.PI) { + this.field_145928_o -= ((float) Math.PI * 2F); } - while (this.field_145928_o < -(float)Math.PI) - { - this.field_145928_o += ((float)Math.PI * 2F); + while (this.field_145928_o < -(float) Math.PI) { + this.field_145928_o += ((float) Math.PI * 2F); } - while (this.field_145924_q >= (float)Math.PI) - { - this.field_145924_q -= ((float)Math.PI * 2F); + while (this.field_145924_q >= (float) Math.PI) { + this.field_145924_q -= ((float) Math.PI * 2F); } - while (this.field_145924_q < -(float)Math.PI) - { - this.field_145924_q += ((float)Math.PI * 2F); + while (this.field_145924_q < -(float) Math.PI) { + this.field_145924_q += ((float) Math.PI * 2F); } float f2; - for (f2 = this.field_145924_q - this.field_145928_o; f2 >= (float)Math.PI; f2 -= ((float)Math.PI * 2F)) {} + for (f2 = this.field_145924_q - this.field_145928_o; f2 >= (float) Math.PI; f2 -= ((float) Math.PI * 2F)) {} - while (f2 < -(float)Math.PI) - { - f2 += ((float)Math.PI * 2F); + while (f2 < -(float) Math.PI) { + f2 += ((float) Math.PI * 2F); } this.field_145928_o += f2 * 0.4F; - if (this.field_145930_m < 0.0F) - { + if (this.field_145930_m < 0.0F) { this.field_145930_m = 0.0F; } - if (this.field_145930_m > 1.0F) - { + if (this.field_145930_m > 1.0F) { this.field_145930_m = 1.0F; } @@ -606,13 +637,11 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP float f = (this.field_145932_k - this.field_145933_i) * 0.4F; float f3 = 0.2F; - if (f < -f3) - { + if (f < -f3) { f = -f3; } - if (f > f3) - { + if (f > f3) { f = f3; } @@ -620,5 +649,4 @@ public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityP this.field_145933_i += this.field_145929_l; } } - } diff --git a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileManipulatorPillar.java b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileManipulatorPillar.java index 352d817..316ba88 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileManipulatorPillar.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileManipulatorPillar.java @@ -17,4 +17,4 @@ public class TileManipulatorPillar extends TileInfusionPillar { this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); this.markDirty(); } -} \ No newline at end of file +} diff --git a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileNodeManipulator.java b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileNodeManipulator.java index 6b4b315..63d30b0 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileNodeManipulator.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileNodeManipulator.java @@ -1,6 +1,7 @@ package makeo.gadomancy.common.blocks.tiles; import cpw.mods.fml.common.network.NetworkRegistry; +import java.util.*; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.network.PacketHandler; import makeo.gadomancy.common.network.packets.PacketStartAnimation; @@ -23,7 +24,6 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; -import thaumcraft.api.aspects.IAspectContainer; import thaumcraft.api.nodes.INode; import thaumcraft.api.wands.IWandable; import thaumcraft.common.config.ConfigItems; @@ -32,8 +32,6 @@ import thaumcraft.common.lib.utils.InventoryUtils; import thaumcraft.common.tiles.TilePedestal; import thaumcraft.common.tiles.TileWandPedestal; -import java.util.*; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -50,7 +48,7 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { private static final int ELDRITCH_PORTAL_CREATOR_WORK_START = 120; private static final int ELDRITCH_PORTAL_CREATOR_ASPECT_CAP = 150; - //Already set when only multiblock would be present. aka is set, if 'isMultiblockPresent()' returns true. + // Already set when only multiblock would be present. aka is set, if 'isMultiblockPresent()' returns true. private MultiblockType multiblockType; private boolean multiblockStructurePresent; private boolean isMultiblock; @@ -65,42 +63,57 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { @Override public void updateEntity() { - if(this.worldObj.isRemote) return; + if (this.worldObj.isRemote) return; - if(this.isInMultiblock()) { + if (this.isInMultiblock()) { this.checkMultiblockTick(); } - if(this.isInMultiblock()) { + if (this.isInMultiblock()) { this.multiblockTick(); } } private void multiblockTick() { - if(this.multiblockType == null) { - if(MultiblockHelper.isMultiblockPresent(this.worldObj, this.xCoord, this.yCoord, this.zCoord, RegisteredMultiblocks.completeNodeManipulatorMultiblock)) { + if (this.multiblockType == null) { + if (MultiblockHelper.isMultiblockPresent( + this.worldObj, + this.xCoord, + this.yCoord, + this.zCoord, + RegisteredMultiblocks.completeNodeManipulatorMultiblock)) { this.multiblockType = MultiblockType.NODE_MANIPULATOR; - } else if(MultiblockHelper.isMultiblockPresent(this.worldObj, this.xCoord, this.yCoord, this.zCoord, RegisteredMultiblocks.completeEldritchPortalCreator) && this.checkEldritchEyes(false)) { + } else if (MultiblockHelper.isMultiblockPresent( + this.worldObj, + this.xCoord, + this.yCoord, + this.zCoord, + RegisteredMultiblocks.completeEldritchPortalCreator) + && this.checkEldritchEyes(false)) { this.multiblockType = MultiblockType.E_PORTAL_CREATOR; } } - if(this.multiblockType == null) { + if (this.multiblockType == null) { this.breakMultiblock(); return; } switch (this.multiblockType) { case NODE_MANIPULATOR: - if(!this.isWorking) { - this.doAspectChecks(TileNodeManipulator.NODE_MANIPULATION_WORK_ASPECT_CAP, TileNodeManipulator.NODE_MANIPULATION_POSSIBLE_WORK_START); + if (!this.isWorking) { + this.doAspectChecks( + TileNodeManipulator.NODE_MANIPULATION_WORK_ASPECT_CAP, + TileNodeManipulator.NODE_MANIPULATION_POSSIBLE_WORK_START); } else { this.manipulationTick(); } break; case E_PORTAL_CREATOR: - if(!this.isWorking) { - this.doAspectChecks(TileNodeManipulator.ELDRITCH_PORTAL_CREATOR_ASPECT_CAP, TileNodeManipulator.ELDRITCH_PORTAL_CREATOR_WORK_START); + if (!this.isWorking) { + this.doAspectChecks( + TileNodeManipulator.ELDRITCH_PORTAL_CREATOR_ASPECT_CAP, + TileNodeManipulator.ELDRITCH_PORTAL_CREATOR_WORK_START); } else { - if(!this.checkEldritchEyes(true)) { - if(this.workTick > 1) { + if (!this.checkEldritchEyes(true)) { + if (this.workTick > 1) { this.workAspectList = new AspectList(); this.workTick = 0; this.isWorking = false; @@ -120,8 +133,10 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { int validPedestalsFound = 0; - labelIt: for (int xDiff = -8; xDiff <= 8; xDiff++) { - labelZ: for (int zDiff = -8; zDiff <= 8; zDiff++) { + labelIt: + for (int xDiff = -8; xDiff <= 8; xDiff++) { + labelZ: + for (int zDiff = -8; zDiff <= 8; zDiff++) { for (int yDiff = -5; yDiff <= 10; yDiff++) { int itX = this.xCoord + xDiff; int itY = this.yCoord + yDiff; @@ -130,11 +145,15 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { Block block = this.worldObj.getBlock(itX, itY, itZ); int meta = this.worldObj.getBlockMetadata(itX, itY, itZ); TileEntity te = this.worldObj.getTileEntity(itX, itY, itZ); - if(block != null && block.equals(RegisteredBlocks.blockStoneMachine) && meta == 1 - && te != null && te instanceof TilePedestal && (!checkForEyes || this.checkTile((TilePedestal) te))) { + if (block != null + && block.equals(RegisteredBlocks.blockStoneMachine) + && meta == 1 + && te != null + && te instanceof TilePedestal + && (!checkForEyes || this.checkTile((TilePedestal) te))) { validPedestalsFound++; this.bufferedCCPedestals.add(new ChunkCoordinates(itX, itY, itZ)); - if(validPedestalsFound >= 4) { + if (validPedestalsFound >= 4) { break labelIt; } continue labelZ; @@ -152,27 +171,46 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { private void eldritchPortalCreationTick() { this.workTick++; - if(this.workTick < 400) { - if((this.workTick & 15) == 0) { - PacketStartAnimation packet = new PacketStartAnimation(PacketStartAnimation.ID_RUNES, this.xCoord, this.yCoord, this.zCoord, (byte) 1); + if (this.workTick < 400) { + if ((this.workTick & 15) == 0) { + PacketStartAnimation packet = new PacketStartAnimation( + PacketStartAnimation.ID_RUNES, this.xCoord, this.yCoord, this.zCoord, (byte) 1); PacketHandler.INSTANCE.sendToAllAround(packet, this.getTargetPoint(32)); } - if((this.workTick & 7) == 0) { + if ((this.workTick & 7) == 0) { int index = (this.workTick >> 3) & 3; try { ChunkCoordinates cc = this.bufferedCCPedestals.get(index); - PacketStartAnimation packet = new PacketStartAnimation(PacketStartAnimation.ID_RUNES, cc.posX, cc.posY, cc.posZ, (byte) 1); + PacketStartAnimation packet = new PacketStartAnimation( + PacketStartAnimation.ID_RUNES, cc.posX, cc.posY, cc.posZ, (byte) 1); PacketHandler.INSTANCE.sendToAllAround(packet, this.getTargetPoint(32)); - } catch (Exception exc) {} + } catch (Exception exc) { + } } - if(this.worldObj.rand.nextBoolean()) { + if (this.worldObj.rand.nextBoolean()) { Vec3 rel = this.getRelPillarLoc(this.worldObj.rand.nextInt(4)); - PacketTCNodeBolt bolt = new PacketTCNodeBolt(this.xCoord + 0.5F, this.yCoord + 2.5F, this.zCoord + 0.5F, (float) (this.xCoord + 0.5F + rel.xCoord), (float) (this.yCoord + 2.5F + rel.yCoord), (float) (this.zCoord + 0.5F + rel.zCoord), 2, false); + PacketTCNodeBolt bolt = new PacketTCNodeBolt( + this.xCoord + 0.5F, + this.yCoord + 2.5F, + this.zCoord + 0.5F, + (float) (this.xCoord + 0.5F + rel.xCoord), + (float) (this.yCoord + 2.5F + rel.yCoord), + (float) (this.zCoord + 0.5F + rel.zCoord), + 2, + false); PacketHandler.INSTANCE.sendToAllAround(bolt, this.getTargetPoint(32)); } - if(this.worldObj.rand.nextInt(4) == 0) { + if (this.worldObj.rand.nextInt(4) == 0) { Vec3 relPed = this.getRelPedestalLoc(this.worldObj.rand.nextInt(4)); - PacketTCNodeBolt bolt = new PacketTCNodeBolt(this.xCoord + 0.5F, this.yCoord + 2.5F, this.zCoord + 0.5F, (float) (this.xCoord + 0.5F - relPed.xCoord), (float) (this.yCoord + 1.5 + relPed.yCoord), (float) (this.zCoord + 0.5F - relPed.zCoord), 2, false); + PacketTCNodeBolt bolt = new PacketTCNodeBolt( + this.xCoord + 0.5F, + this.yCoord + 2.5F, + this.zCoord + 0.5F, + (float) (this.xCoord + 0.5F - relPed.xCoord), + (float) (this.yCoord + 1.5 + relPed.yCoord), + (float) (this.zCoord + 0.5F - relPed.zCoord), + 2, + false); PacketHandler.INSTANCE.sendToAllAround(bolt, this.getTargetPoint(32)); } } else { @@ -186,13 +224,14 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { this.workAspectList = new AspectList(); TileEntity te = this.worldObj.getTileEntity(this.xCoord, this.yCoord + 2, this.zCoord); - if(te == null || !(te instanceof INode)) return; + if (te == null || !(te instanceof INode)) return; this.consumeEldritchEyes(); this.worldObj.removeTileEntity(this.xCoord, this.yCoord + 2, this.zCoord); this.worldObj.setBlockToAir(this.xCoord, this.yCoord + 2, this.zCoord); - this.worldObj.setBlock(this.xCoord, this.yCoord + 2, this.zCoord, RegisteredBlocks.blockAdditionalEldrichPortal); + this.worldObj.setBlock( + this.xCoord, this.yCoord + 2, this.zCoord, RegisteredBlocks.blockAdditionalEldrichPortal); this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord + 2, this.zCoord); @@ -204,22 +243,33 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { try { TilePedestal pedestal = (TilePedestal) this.worldObj.getTileEntity(cc.posX, cc.posY, cc.posZ); pedestal.setInventorySlotContents(0, null); - PacketStartAnimation packet = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, cc.posX, cc.posY, cc.posZ); + PacketStartAnimation packet = + new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, cc.posX, cc.posY, cc.posZ); PacketHandler.INSTANCE.sendToAllAround(packet, this.getTargetPoint(32)); - } catch (Exception exc) {} + } catch (Exception exc) { + } } } private void manipulationTick() { this.workTick++; - if(this.workTick < 300) { - if(this.workTick % 16 == 0) { - PacketStartAnimation packet = new PacketStartAnimation(PacketStartAnimation.ID_RUNES, this.xCoord, this.yCoord, this.zCoord); + if (this.workTick < 300) { + if (this.workTick % 16 == 0) { + PacketStartAnimation packet = + new PacketStartAnimation(PacketStartAnimation.ID_RUNES, this.xCoord, this.yCoord, this.zCoord); PacketHandler.INSTANCE.sendToAllAround(packet, this.getTargetPoint(32)); } - if(this.worldObj.rand.nextInt(4) == 0) { + if (this.worldObj.rand.nextInt(4) == 0) { Vec3 rel = this.getRelPillarLoc(this.worldObj.rand.nextInt(4)); - PacketTCNodeBolt bolt = new PacketTCNodeBolt(this.xCoord + 0.5F, this.yCoord + 2.5F, this.zCoord + 0.5F, (float) (this.xCoord + 0.5F + rel.xCoord), (float) (this.yCoord + 2.5F + rel.yCoord), (float) (this.zCoord + 0.5F + rel.zCoord), 0, false); + PacketTCNodeBolt bolt = new PacketTCNodeBolt( + this.xCoord + 0.5F, + this.yCoord + 2.5F, + this.zCoord + 0.5F, + (float) (this.xCoord + 0.5F + rel.xCoord), + (float) (this.yCoord + 2.5F + rel.yCoord), + (float) (this.zCoord + 0.5F + rel.zCoord), + 0, + false); PacketHandler.INSTANCE.sendToAllAround(bolt, this.getTargetPoint(32)); } } else { @@ -231,7 +281,8 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { try { ChunkCoordinates cc = this.bufferedCCPedestals.get(pedestalId); return Vec3.createVectorHelper(this.xCoord - cc.posX, this.yCoord - cc.posY, this.zCoord - cc.posZ); - } catch (Exception exc) {} + } catch (Exception exc) { + } return Vec3.createVectorHelper(0, 0, 0); } @@ -257,18 +308,20 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { this.workAspectList = new AspectList(); TileEntity te = this.worldObj.getTileEntity(this.xCoord, this.yCoord + 2, this.zCoord); - if(te == null || !(te instanceof INode)) return; + if (te == null || !(te instanceof INode)) return; INode node = (INode) te; - int areaRange = TileNodeManipulator.NODE_MANIPULATION_WORK_ASPECT_CAP - TileNodeManipulator.NODE_MANIPULATION_POSSIBLE_WORK_START; + int areaRange = TileNodeManipulator.NODE_MANIPULATION_WORK_ASPECT_CAP + - TileNodeManipulator.NODE_MANIPULATION_POSSIBLE_WORK_START; int percChanceForBetter = 0; - if(areaRange > 0) { + if (areaRange > 0) { percChanceForBetter = (int) ((overSized / ((float) areaRange)) * 100); } NodeManipulatorResult result; do { result = NodeManipulatorResultHandler.getRandomResult(this.worldObj, node, percChanceForBetter); } while (!result.affect(this.worldObj, node)); - PacketStartAnimation packet = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, this.xCoord, this.yCoord + 2, this.zCoord); + PacketStartAnimation packet = new PacketStartAnimation( + PacketStartAnimation.ID_SPARKLE_SPREAD, this.xCoord, this.yCoord + 2, this.zCoord); PacketHandler.INSTANCE.sendToAllAround(packet, this.getTargetPoint(32)); this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord + 2, this.zCoord); @@ -278,16 +331,16 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { private float calcOversize(int neededAspects) { int overall = 0; - for(Aspect a : Aspect.getPrimalAspects()) { + for (Aspect a : Aspect.getPrimalAspects()) { overall += this.workAspectList.getAmount(a) - neededAspects; } return ((float) overall) / 6F; } private void doAspectChecks(int aspectCap, int possibleWorkStart) { - if(this.canDrainFromWand(aspectCap)) { + if (this.canDrainFromWand(aspectCap)) { Aspect a = this.drainAspectFromWand(aspectCap); - if(a != null) { + if (a != null) { this.playAspectDrainFromWand(a); this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); this.markDirty(); @@ -299,23 +352,23 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { private void checkIfEnoughVis(int start) { boolean enough = true; - for(Aspect a : Aspect.getPrimalAspects()) { - if(this.workAspectList.getAmount(a) < start) { + for (Aspect a : Aspect.getPrimalAspects()) { + if (this.workAspectList.getAmount(a) < start) { enough = false; break; } } - if(enough) { + if (enough) { this.isWorking = true; } } private Aspect drainAspectFromWand(int cap) { ItemStack stack = this.getStackInSlot(0); - if(stack == null || !(stack.getItem() instanceof ItemWandCasting)) return null; //Should never happen.. + if (stack == null || !(stack.getItem() instanceof ItemWandCasting)) return null; // Should never happen.. AspectList aspects = ((ItemWandCasting) stack.getItem()).getAllVis(stack); - for(Aspect a : this.getRandomlyOrderedPrimalAspectList()) { - if(aspects.getAmount(a) >= 100 && this.workAspectList.getAmount(a) < cap) { + for (Aspect a : this.getRandomlyOrderedPrimalAspectList()) { + if (aspects.getAmount(a) >= 100 && this.workAspectList.getAmount(a) < cap) { int amt = aspects.getAmount(a); ((ItemWandCasting) stack.getItem()).storeVis(stack, a, amt - 100); this.workAspectList.add(a, 1); @@ -326,25 +379,26 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { } private List getRandomlyOrderedPrimalAspectList() { - ArrayList primals = (ArrayList) Aspect.getPrimalAspects().clone(); + ArrayList primals = + (ArrayList) Aspect.getPrimalAspects().clone(); Collections.shuffle(primals); return primals; } private boolean canDrainFromWand(int cap) { ItemStack stack = this.getStackInSlot(0); - if(stack == null || !(stack.getItem() instanceof ItemWandCasting)) return false; + if (stack == null || !(stack.getItem() instanceof ItemWandCasting)) return false; AspectList aspects = ((ItemWandCasting) stack.getItem()).getAllVis(stack); - for(Aspect a : Aspect.getPrimalAspects()) { - if(aspects.getAmount(a) < 100) continue; - if(this.workAspectList.getAmount(a) < cap) return true; + for (Aspect a : Aspect.getPrimalAspects()) { + if (aspects.getAmount(a) < 100) continue; + if (this.workAspectList.getAmount(a) < cap) return true; } return false; } private void checkMultiblockTick() { this.checkMultiblock(); - if(!this.isMultiblockStructurePresent()) { + if (!this.isMultiblockStructurePresent()) { this.breakMultiblock(); this.isMultiblock = false; this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); @@ -353,21 +407,29 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { } private void playAspectDrainFromWand(Aspect drained) { - if(drained == null) return; + if (drained == null) return; NetworkRegistry.TargetPoint point = this.getTargetPoint(32); - PacketTCWispyLine line = new PacketTCWispyLine(this.worldObj.provider.dimensionId, this.xCoord + 0.5, this.yCoord + 0.8, this.zCoord + 0.5, - this.xCoord + 0.5, this.yCoord + 1.4 + (((double) this.worldObj.rand.nextInt(4)) / 10D), this.zCoord + 0.5, 40, drained.getColor()); + PacketTCWispyLine line = new PacketTCWispyLine( + this.worldObj.provider.dimensionId, + this.xCoord + 0.5, + this.yCoord + 0.8, + this.zCoord + 0.5, + this.xCoord + 0.5, + this.yCoord + 1.4 + (((double) this.worldObj.rand.nextInt(4)) / 10D), + this.zCoord + 0.5, + 40, + drained.getColor()); PacketHandler.INSTANCE.sendToAllAround(line, point); } private void dropWand() { - if(this.getStackInSlot(0) != null) + if (this.getStackInSlot(0) != null) InventoryUtils.dropItems(this.worldObj, this.xCoord, this.yCoord, this.zCoord); } public void breakMultiblock() { MultiblockHelper.MultiblockPattern compareableCompleteStructure, toRestore; - if(this.multiblockType == null) { + if (this.multiblockType == null) { this.workAspectList = new AspectList(); this.dropWand(); this.workTick = 0; @@ -386,15 +448,18 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { default: return; } - for(MultiblockHelper.IntVec3 v : compareableCompleteStructure.keySet()) { + for (MultiblockHelper.IntVec3 v : compareableCompleteStructure.keySet()) { MultiblockHelper.BlockInfo info = compareableCompleteStructure.get(v); MultiblockHelper.BlockInfo restoreInfo = toRestore.get(v); - if(info.block == RegisteredBlocks.blockNode || (info.block == RegisteredBlocks.blockStoneMachine && (info.meta == 0 || info.meta == 3)) - || info.block == Blocks.air || info.block == RegisteredBlocks.blockNodeManipulator) continue; + if (info.block == RegisteredBlocks.blockNode + || (info.block == RegisteredBlocks.blockStoneMachine && (info.meta == 0 || info.meta == 3)) + || info.block == Blocks.air + || info.block == RegisteredBlocks.blockNodeManipulator) continue; int absX = v.x + this.xCoord; int absY = v.y + this.yCoord; int absZ = v.z + this.zCoord; - if(this.worldObj.getBlock(absX, absY, absZ) == info.block && this.worldObj.getBlockMetadata(absX, absY, absZ) == info.meta) { + if (this.worldObj.getBlock(absX, absY, absZ) == info.block + && this.worldObj.getBlockMetadata(absX, absY, absZ) == info.meta) { this.worldObj.setBlock(absX, absY, absZ, Blocks.air, 0, 0); this.worldObj.setBlock(absX, absY, absZ, restoreInfo.block, restoreInfo.meta, 0); this.worldObj.markBlockForUpdate(absX, absY, absZ); @@ -410,7 +475,7 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { public void formMultiblock() { MultiblockHelper.MultiblockPattern toBuild; - if(this.multiblockType == null) return; + if (this.multiblockType == null) return; switch (this.multiblockType) { case NODE_MANIPULATOR: toBuild = RegisteredMultiblocks.completeNodeManipulatorMultiblock; @@ -421,10 +486,13 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { default: return; } - for(MultiblockHelper.IntVec3 v : toBuild.keySet()) { + for (MultiblockHelper.IntVec3 v : toBuild.keySet()) { MultiblockHelper.BlockInfo info = toBuild.get(v); - if(info.block == RegisteredBlocks.blockNode || (info.block == RegisteredBlocks.blockStoneMachine && (info.meta == 0 || info.meta == 1 || info.meta == 3)) - || info.block == Blocks.air || info.block == RegisteredBlocks.blockNodeManipulator) continue; + if (info.block == RegisteredBlocks.blockNode + || (info.block == RegisteredBlocks.blockStoneMachine + && (info.meta == 0 || info.meta == 1 || info.meta == 3)) + || info.block == Blocks.air + || info.block == RegisteredBlocks.blockNodeManipulator) continue; int absX = v.x + this.xCoord; int absY = v.y + this.yCoord; int absZ = v.z + this.zCoord; @@ -433,19 +501,26 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { this.worldObj.markBlockForUpdate(absX, absY, absZ); } NetworkRegistry.TargetPoint target = this.getTargetPoint(32); - TileManipulatorPillar pillar = (TileManipulatorPillar) this.worldObj.getTileEntity(this.xCoord + 1, this.yCoord, this.zCoord + 1); //wrong + TileManipulatorPillar pillar = (TileManipulatorPillar) + this.worldObj.getTileEntity(this.xCoord + 1, this.yCoord, this.zCoord + 1); // wrong pillar.setOrientation((byte) 5); - PacketStartAnimation animation = new PacketStartAnimation(PacketStartAnimation.ID_RUNES, pillar.xCoord, pillar.yCoord, pillar.zCoord); + PacketStartAnimation animation = + new PacketStartAnimation(PacketStartAnimation.ID_RUNES, pillar.xCoord, pillar.yCoord, pillar.zCoord); PacketHandler.INSTANCE.sendToAllAround(animation, target); - TileManipulatorPillar pillar2 = (TileManipulatorPillar) this.worldObj.getTileEntity(this.xCoord - 1, this.yCoord, this.zCoord + 1); + TileManipulatorPillar pillar2 = + (TileManipulatorPillar) this.worldObj.getTileEntity(this.xCoord - 1, this.yCoord, this.zCoord + 1); pillar2.setOrientation((byte) 3); - animation = new PacketStartAnimation(PacketStartAnimation.ID_RUNES, pillar2.xCoord, pillar2.yCoord, pillar2.zCoord); + animation = + new PacketStartAnimation(PacketStartAnimation.ID_RUNES, pillar2.xCoord, pillar2.yCoord, pillar2.zCoord); PacketHandler.INSTANCE.sendToAllAround(animation, target); - TileManipulatorPillar pillar3 = (TileManipulatorPillar) this.worldObj.getTileEntity(this.xCoord + 1, this.yCoord, this.zCoord - 1); //wrong + TileManipulatorPillar pillar3 = (TileManipulatorPillar) + this.worldObj.getTileEntity(this.xCoord + 1, this.yCoord, this.zCoord - 1); // wrong pillar3.setOrientation((byte) 4); - animation = new PacketStartAnimation(PacketStartAnimation.ID_RUNES, pillar3.xCoord, pillar3.yCoord, pillar3.zCoord); + animation = + new PacketStartAnimation(PacketStartAnimation.ID_RUNES, pillar3.xCoord, pillar3.yCoord, pillar3.zCoord); PacketHandler.INSTANCE.sendToAllAround(animation, target); - animation = new PacketStartAnimation(PacketStartAnimation.ID_RUNES, this.xCoord - 1, this.yCoord, this.zCoord - 1); + animation = + new PacketStartAnimation(PacketStartAnimation.ID_RUNES, this.xCoord - 1, this.yCoord, this.zCoord - 1); PacketHandler.INSTANCE.sendToAllAround(animation, target); this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); this.markDirty(); @@ -461,7 +536,7 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { this.isMultiblock = tag.getBoolean("mBlockState"); this.isWorking = tag.getBoolean("manipulating"); this.workTick = tag.getInteger("workTick"); - if(tag.hasKey("multiblockType")) { + if (tag.hasKey("multiblockType")) { this.multiblockType = MultiblockType.values()[tag.getInteger("multiblockType")]; } this.workAspectList.readFromNBT(tag, "workAspectList"); @@ -476,7 +551,7 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { tag.setBoolean("mBlockState", this.isMultiblock); tag.setBoolean("manipulating", this.isWorking); tag.setInteger("workTick", this.workTick); - if(this.multiblockType != null) { + if (this.multiblockType != null) { tag.setInteger("multiblockType", this.multiblockType.ordinal()); } this.workAspectList.writeToNBT(tag, "workAspectList"); @@ -497,52 +572,79 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { public boolean checkMultiblock() { boolean prevState = this.isMultiblockStructurePresent(); - if(prevState) { //If there is already a multiblock formed... - if(this.isInMultiblock()) { //If we were actually in multiblock before - if(this.multiblockType == null) { - if(MultiblockHelper.isMultiblockPresent(this.worldObj, this.xCoord, this.yCoord, this.zCoord, RegisteredMultiblocks.completeNodeManipulatorMultiblock)) { + if (prevState) { // If there is already a multiblock formed... + if (this.isInMultiblock()) { // If we were actually in multiblock before + if (this.multiblockType == null) { + if (MultiblockHelper.isMultiblockPresent( + this.worldObj, + this.xCoord, + this.yCoord, + this.zCoord, + RegisteredMultiblocks.completeNodeManipulatorMultiblock)) { this.multiblockType = MultiblockType.NODE_MANIPULATOR; - } else if(MultiblockHelper.isMultiblockPresent(this.worldObj, this.xCoord, this.yCoord, this.zCoord, RegisteredMultiblocks.completeEldritchPortalCreator) && this.checkEldritchEyes(false)) { + } else if (MultiblockHelper.isMultiblockPresent( + this.worldObj, + this.xCoord, + this.yCoord, + this.zCoord, + RegisteredMultiblocks.completeEldritchPortalCreator) + && this.checkEldritchEyes(false)) { this.multiblockType = MultiblockType.E_PORTAL_CREATOR; } } - if(this.multiblockType == null) { + if (this.multiblockType == null) { this.breakMultiblock(); return false; } switch (this.multiblockType) { case NODE_MANIPULATOR: - this.setMultiblockStructurePresent(MultiblockHelper.isMultiblockPresent(this.worldObj, this.xCoord, this.yCoord, this.zCoord, RegisteredMultiblocks.completeNodeManipulatorMultiblock), MultiblockType.NODE_MANIPULATOR); + this.setMultiblockStructurePresent( + MultiblockHelper.isMultiblockPresent( + this.worldObj, + this.xCoord, + this.yCoord, + this.zCoord, + RegisteredMultiblocks.completeNodeManipulatorMultiblock), + MultiblockType.NODE_MANIPULATOR); break; case E_PORTAL_CREATOR: - this.setMultiblockStructurePresent(MultiblockHelper.isMultiblockPresent(this.worldObj, this.xCoord, this.yCoord, this.zCoord, RegisteredMultiblocks.completeEldritchPortalCreator) && this.checkEldritchEyes(false), MultiblockType.E_PORTAL_CREATOR); + this.setMultiblockStructurePresent( + MultiblockHelper.isMultiblockPresent( + this.worldObj, + this.xCoord, + this.yCoord, + this.zCoord, + RegisteredMultiblocks.completeEldritchPortalCreator) + && this.checkEldritchEyes(false), + MultiblockType.E_PORTAL_CREATOR); break; } - } else { //If we weren't in multiblock eventhough it would be possible. + } else { // If we weren't in multiblock eventhough it would be possible. this.checkForNonExistingMultiblock(); } - } else { //If there was no multiblock formed before.. + } else { // If there was no multiblock formed before.. this.checkForNonExistingMultiblock(); } return this.isMultiblockStructurePresent(); } private void setMultiblockStructurePresent(boolean present, MultiblockType type) { - if(present) { + if (present) { this.multiblockType = type; } this.multiblockStructurePresent = present; } private void checkForNonExistingMultiblock() { - Map patternMap = new HashMap(); + Map patternMap = + new HashMap(); patternMap.put(RegisteredMultiblocks.incompleteEldritchPortalCreator, MultiblockType.E_PORTAL_CREATOR); patternMap.put(RegisteredMultiblocks.incompleteNodeManipulatorMultiblock, MultiblockType.NODE_MANIPULATOR); - for(MultiblockHelper.MultiblockPattern pattern : patternMap.keySet()) { - if(MultiblockHelper.isMultiblockPresent(this.worldObj, this.xCoord, this.yCoord, this.zCoord, pattern)) { - if(pattern == RegisteredMultiblocks.incompleteEldritchPortalCreator) { - if(!this.checkEldritchEyes(false)) return; + for (MultiblockHelper.MultiblockPattern pattern : patternMap.keySet()) { + if (MultiblockHelper.isMultiblockPresent(this.worldObj, this.xCoord, this.yCoord, this.zCoord, pattern)) { + if (pattern == RegisteredMultiblocks.incompleteEldritchPortalCreator) { + if (!this.checkEldritchEyes(false)) return; } this.setMultiblockStructurePresent(true, patternMap.get(pattern)); return; @@ -556,7 +658,8 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { } public NetworkRegistry.TargetPoint getTargetPoint(double radius) { - return new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, radius); + return new NetworkRegistry.TargetPoint( + this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, radius); } @Override @@ -603,7 +706,8 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { } @Override - public int onWandRightClick(World world, ItemStack stack, EntityPlayer player, int i, int i2, int i3, int i4, int i5) { + public int onWandRightClick( + World world, ItemStack stack, EntityPlayer player, int i, int i2, int i3, int i4, int i5) { return 0; } @@ -619,9 +723,11 @@ public class TileNodeManipulator extends TileWandPedestal implements IWandable { public void onWandStoppedUsing(ItemStack stack, World world, EntityPlayer player, int i) {} public enum MultiblockType { - - NODE_MANIPULATOR(Gadomancy.MODID.toUpperCase() + ".NODE_MANIPULATOR", RegisteredRecipes.costsNodeManipulatorMultiblock), - E_PORTAL_CREATOR(Gadomancy.MODID.toUpperCase() + ".E_PORTAL_CREATOR", RegisteredRecipes.costsEldritchPortalCreatorMultiblock); + NODE_MANIPULATOR( + Gadomancy.MODID.toUpperCase() + ".NODE_MANIPULATOR", RegisteredRecipes.costsNodeManipulatorMultiblock), + E_PORTAL_CREATOR( + Gadomancy.MODID.toUpperCase() + ".E_PORTAL_CREATOR", + RegisteredRecipes.costsEldritchPortalCreatorMultiblock); private String research; private AspectList costs; diff --git a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileOverrideEldritchLock.java b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileOverrideEldritchLock.java index 52fa5a5..237c45a 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileOverrideEldritchLock.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileOverrideEldritchLock.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.blocks.tiles; +import java.util.concurrent.ConcurrentHashMap; import makeo.gadomancy.common.utils.world.TCMazeHandler; import makeo.gadomancy.common.utils.world.TCMazeSession; import net.minecraft.entity.Entity; @@ -7,8 +8,6 @@ import thaumcraft.common.lib.world.dim.CellLoc; import thaumcraft.common.lib.world.dim.MazeHandler; import thaumcraft.common.tiles.TileEldritchLock; -import java.util.concurrent.ConcurrentHashMap; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -33,13 +32,15 @@ public class TileOverrideEldritchLock extends TileEldritchLock { int count = Entity.nextEntityID - nextEntityId; Entity[] bosses = new Entity[count]; - for(int i = 0; i < count; i++) { + for (int i = 0; i < count; i++) { bosses[i] = this.worldObj.getEntityByID(nextEntityId + i); } MazeHandler.labyrinth = old; - for(TCMazeSession session : TCMazeHandler.getSessions().values()) { - if(session.chunksAffected != null && session.chunksAffected.containsKey(new CellLoc(this.xCoord >> 4, this.zCoord >> 4))) { + for (TCMazeSession session : TCMazeHandler.getSessions().values()) { + if (session.chunksAffected != null + && session.chunksAffected.containsKey( + new CellLoc(this.xCoord >> 4, this.zCoord >> 4))) { TCMazeHandler.putBosses(session, bosses); break; } diff --git a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileRemoteJar.java b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileRemoteJar.java index f9f044e..bd7e64f 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileRemoteJar.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileRemoteJar.java @@ -1,12 +1,11 @@ package makeo.gadomancy.common.blocks.tiles; +import java.util.*; import makeo.gadomancy.common.utils.NBTHelper; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import thaumcraft.common.tiles.TileJarFillable; -import java.util.*; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -25,13 +24,16 @@ public class TileRemoteJar extends TileJarFillable { @Override public void updateEntity() { super.updateEntity(); - if (this.count % 3 == 0 && !this.getWorldObj().isRemote && this.networkId != null && (!this.registered_to_network || this.amount < this.maxAmount)) { + if (this.count % 3 == 0 + && !this.getWorldObj().isRemote + && this.networkId != null + && (!this.registered_to_network || this.amount < this.maxAmount)) { this.count = 0; JarNetwork network = TileRemoteJar.getNetwork(this.networkId); this.registered_to_network = true; - if(!network.jars.contains(this)) { + if (!network.jars.contains(this)) { network.jars.add((TileJarFillable) this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord)); } @@ -51,7 +53,7 @@ public class TileRemoteJar extends TileJarFillable { public void writeCustomNBT(NBTTagCompound compound) { super.writeCustomNBT(compound); - if(this.networkId != null) { + if (this.networkId != null) { NBTHelper.setUUID(compound, "networkId", this.networkId); } } @@ -64,8 +66,8 @@ public class TileRemoteJar extends TileJarFillable { private void update() { long time = MinecraftServer.getServer().getEntityWorld().getTotalWorldTime(); - if(time > this.lastTime) { - if(this.jars.size() > 1) { + if (time > this.lastTime) { + if (this.jars.size() > 1) { Collections.sort(this.jars, new Comparator() { @Override public int compare(TileJarFillable o1, TileJarFillable o2) { @@ -74,18 +76,18 @@ public class TileRemoteJar extends TileJarFillable { }); TileJarFillable jar1 = this.jars.get(0); - if(!JarNetwork.isValid(jar1)) { + if (!JarNetwork.isValid(jar1)) { this.jars.remove(0); return; } TileJarFillable jar2 = this.jars.get(this.jars.size() - 1); - if(!JarNetwork.isValid(jar2)) { + if (!JarNetwork.isValid(jar2)) { this.jars.remove(this.jars.size() - 1); return; } - if((jar2.amount+1) < jar1.amount && jar2.addToContainer(jar1.aspect, 1) == 0) { + if ((jar2.amount + 1) < jar1.amount && jar2.addToContainer(jar1.aspect, 1) == 0) { jar1.takeFromContainer(jar1.aspect, 1); } } @@ -94,7 +96,9 @@ public class TileRemoteJar extends TileJarFillable { } private static boolean isValid(TileJarFillable jar) { - return jar != null && jar.getWorldObj() != null && !jar.isInvalid() + return jar != null + && jar.getWorldObj() != null + && !jar.isInvalid() && jar.getWorldObj().blockExists(jar.xCoord, jar.yCoord, jar.zCoord); } } @@ -102,7 +106,7 @@ public class TileRemoteJar extends TileJarFillable { private static JarNetwork getNetwork(UUID id) { JarNetwork network = TileRemoteJar.networks.get(id); - if(network == null) { + if (network == null) { network = new JarNetwork(); TileRemoteJar.networks.put(id, network); } diff --git a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileStickyJar.java b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileStickyJar.java index 6a3d5e3..ebffcc4 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileStickyJar.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileStickyJar.java @@ -1,6 +1,7 @@ package makeo.gadomancy.common.blocks.tiles; import cpw.mods.fml.common.registry.GameData; +import java.lang.reflect.Field; import makeo.gadomancy.common.utils.Injector; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; @@ -16,8 +17,6 @@ import thaumcraft.api.aspects.IEssentiaTransport; import thaumcraft.common.tiles.TileJarFillable; import thaumcraft.common.tiles.TileJarFillableVoid; -import java.lang.reflect.Field; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -86,11 +85,11 @@ public class TileStickyJar extends TileJarFillable { to.forgeLiquid = from.forgeLiquid; to.lid = from.lid; } - + public void syncToParent() { this.sync(this, this.parent); } - + public void syncFromParent() { this.sync(this.parent, this); } @@ -103,14 +102,14 @@ public class TileStickyJar extends TileJarFillable { @Override public void updateEntity() { - if(!this.isValid()) { - if(!this.getWorldObj().isRemote) { + if (!this.isValid()) { + if (!this.getWorldObj().isRemote) { this.getWorldObj().setBlock(this.xCoord, this.yCoord, this.zCoord, Blocks.air); } return; } - if(this.getWorldObj().isRemote && this.needsRenderUpdate) { + if (this.getWorldObj().isRemote && this.needsRenderUpdate) { this.needsRenderUpdate = false; Minecraft.getMinecraft().renderGlobal.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); } @@ -118,7 +117,7 @@ public class TileStickyJar extends TileJarFillable { this.syncToParent(); boolean canTakeEssentia = this.amount < this.maxAmount; - if(this.parent instanceof TileJarFillableVoid) canTakeEssentia = true; + if (this.parent instanceof TileJarFillableVoid) canTakeEssentia = true; if ((!this.worldObj.isRemote) && (++this.count % 5 == 0) && canTakeEssentia) { this.fillJar(); @@ -134,17 +133,16 @@ public class TileStickyJar extends TileJarFillable { @Override public void setWorldObj(World world) { super.setWorldObj(world); - if(this.parent != null) - this.parent.setWorldObj(this.worldObj); + if (this.parent != null) this.parent.setWorldObj(this.worldObj); } private void fillJar() { ForgeDirection inputDir = this.placedOn.getOpposite(); - TileEntity te = ThaumcraftApiHelper.getConnectableTile(this.parent.getWorldObj(), this.parent.xCoord, this.parent.yCoord, this.parent.zCoord, inputDir); - if (te != null) - { - IEssentiaTransport ic = (IEssentiaTransport)te; + TileEntity te = ThaumcraftApiHelper.getConnectableTile( + this.parent.getWorldObj(), this.parent.xCoord, this.parent.yCoord, this.parent.zCoord, inputDir); + if (te != null) { + IEssentiaTransport ic = (IEssentiaTransport) te; if (!ic.canOutputTo(ForgeDirection.DOWN)) { return; } @@ -153,11 +151,13 @@ public class TileStickyJar extends TileJarFillable { ta = this.parent.aspectFilter; } else if ((this.parent.aspect != null) && (this.parent.amount > 0)) { ta = this.parent.aspect; - } else if ((ic.getEssentiaAmount(inputDir.getOpposite()) > 0) && - (ic.getSuctionAmount(inputDir.getOpposite()) < this.getSuctionAmount(ForgeDirection.UP)) && (this.getSuctionAmount(ForgeDirection.UP) >= ic.getMinimumSuction())) { + } else if ((ic.getEssentiaAmount(inputDir.getOpposite()) > 0) + && (ic.getSuctionAmount(inputDir.getOpposite()) < this.getSuctionAmount(ForgeDirection.UP)) + && (this.getSuctionAmount(ForgeDirection.UP) >= ic.getMinimumSuction())) { ta = ic.getEssentiaType(inputDir.getOpposite()); } - if ((ta != null) && (ic.getSuctionAmount(inputDir.getOpposite()) < this.getSuctionAmount(ForgeDirection.UP))) { + if ((ta != null) + && (ic.getSuctionAmount(inputDir.getOpposite()) < this.getSuctionAmount(ForgeDirection.UP))) { this.addToContainer(ta, ic.takeEssentia(ta, 1, inputDir.getOpposite())); } } @@ -166,13 +166,13 @@ public class TileStickyJar extends TileJarFillable { @Override public void readCustomNBT(NBTTagCompound compound) { String parentType = compound.getString("parentType"); - if(parentType.length() > 0) { + if (parentType.length() > 0) { Block block = GameData.getBlockRegistry().getObject(parentType); - if(block != null && compound.hasKey("parent") && compound.hasKey("parentMetadata")) { + if (block != null && compound.hasKey("parent") && compound.hasKey("parentMetadata")) { NBTTagCompound data = compound.getCompoundTag("parent"); int metadata = compound.getInteger("parentMetadata"); TileEntity tile = block.createTileEntity(this.getWorldObj(), metadata); - if(tile instanceof TileJarFillable) { + if (tile instanceof TileJarFillable) { this.placedOn = ForgeDirection.getOrientation(compound.getInteger("placedOn")); tile.readFromNBT(data); this.init((TileJarFillable) tile, block, metadata, this.placedOn); @@ -180,14 +180,14 @@ public class TileStickyJar extends TileJarFillable { } } - if(!this.isValid() && !this.getWorldObj().isRemote) { + if (!this.isValid() && !this.getWorldObj().isRemote) { this.getWorldObj().setBlockToAir(this.xCoord, this.yCoord, this.zCoord); } } @Override public void writeCustomNBT(NBTTagCompound compound) { - if(this.isValid()) { + if (this.isValid()) { compound.setString("parentType", GameData.getBlockRegistry().getNameForObject(this.parentBlock)); compound.setInteger("parentMetadata", this.parentMetadata); @@ -203,7 +203,7 @@ public class TileStickyJar extends TileJarFillable { @Override public AspectList getAspects() { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); AspectList result = this.parent.getAspects(); this.syncFromParent(); @@ -214,7 +214,7 @@ public class TileStickyJar extends TileJarFillable { @Override public void setAspects(AspectList paramAspectList) { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); this.parent.getAspects(); this.syncFromParent(); @@ -223,7 +223,7 @@ public class TileStickyJar extends TileJarFillable { @Override public boolean doesContainerAccept(Aspect paramAspect) { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); boolean result = this.parent.doesContainerAccept(paramAspect); this.syncFromParent(); @@ -234,7 +234,7 @@ public class TileStickyJar extends TileJarFillable { @Override public int addToContainer(Aspect paramAspect, int paramInt) { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); int result = this.parent.addToContainer(paramAspect, paramInt); this.syncFromParent(); @@ -245,7 +245,7 @@ public class TileStickyJar extends TileJarFillable { @Override public boolean takeFromContainer(Aspect paramAspect, int paramInt) { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); boolean result = this.parent.takeFromContainer(paramAspect, paramInt); this.syncFromParent(); @@ -256,7 +256,7 @@ public class TileStickyJar extends TileJarFillable { @Override public boolean takeFromContainer(AspectList paramAspectList) { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); boolean result = this.parent.takeFromContainer(paramAspectList); this.syncFromParent(); @@ -267,7 +267,7 @@ public class TileStickyJar extends TileJarFillable { @Override public boolean doesContainerContainAmount(Aspect paramAspect, int paramInt) { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); boolean result = this.parent.doesContainerContainAmount(paramAspect, paramInt); this.syncFromParent(); @@ -278,7 +278,7 @@ public class TileStickyJar extends TileJarFillable { @Override public boolean doesContainerContain(AspectList paramAspectList) { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); boolean result = this.parent.doesContainerContain(paramAspectList); this.syncFromParent(); @@ -289,7 +289,7 @@ public class TileStickyJar extends TileJarFillable { @Override public int containerContains(Aspect paramAspect) { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); int result = this.parent.containerContains(paramAspect); this.syncFromParent(); @@ -300,7 +300,7 @@ public class TileStickyJar extends TileJarFillable { @Override public boolean isConnectable(ForgeDirection face) { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); return this.parent.isConnectable(this.changeDirection(face)); } @@ -309,7 +309,7 @@ public class TileStickyJar extends TileJarFillable { @Override public boolean canInputFrom(ForgeDirection face) { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); boolean result = this.parent.canInputFrom(this.changeDirection(face)); this.syncFromParent(); @@ -320,7 +320,7 @@ public class TileStickyJar extends TileJarFillable { @Override public boolean canOutputTo(ForgeDirection face) { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); boolean result = this.parent.canOutputTo(this.changeDirection(face)); this.syncFromParent(); @@ -330,38 +330,39 @@ public class TileStickyJar extends TileJarFillable { } public ForgeDirection changeDirection(ForgeDirection face) { - if(this.placedOn == ForgeDirection.UP) { - if(face == ForgeDirection.UP || face == ForgeDirection.DOWN) { + if (this.placedOn == ForgeDirection.UP) { + if (face == ForgeDirection.UP || face == ForgeDirection.DOWN) { return face.getOpposite(); } return face; } - if(this.placedOn == ForgeDirection.DOWN) { + if (this.placedOn == ForgeDirection.DOWN) { return face; } - - if(face == ForgeDirection.UP) { + if (face == ForgeDirection.UP) { return ForgeDirection.NORTH; } - if(face == ForgeDirection.DOWN) { + if (face == ForgeDirection.DOWN) { return ForgeDirection.SOUTH; } - if(face == this.placedOn) { + if (face == this.placedOn) { return ForgeDirection.DOWN; } - if(face == this.placedOn.getOpposite()) { + if (face == this.placedOn.getOpposite()) { return ForgeDirection.UP; } - switch (this.placedOn) { - case EAST: return face == ForgeDirection.NORTH ? ForgeDirection.WEST : ForgeDirection.EAST; - case SOUTH: return face.getOpposite(); - case WEST: return face == ForgeDirection.SOUTH ? ForgeDirection.WEST : ForgeDirection.EAST; - default: - break; + case EAST: + return face == ForgeDirection.NORTH ? ForgeDirection.WEST : ForgeDirection.EAST; + case SOUTH: + return face.getOpposite(); + case WEST: + return face == ForgeDirection.SOUTH ? ForgeDirection.WEST : ForgeDirection.EAST; + default: + break; } return face; @@ -369,7 +370,7 @@ public class TileStickyJar extends TileJarFillable { @Override public void setSuction(Aspect paramAspect, int paramInt) { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); this.parent.setSuction(paramAspect, paramInt); this.syncFromParent(); @@ -378,7 +379,7 @@ public class TileStickyJar extends TileJarFillable { @Override public Aspect getSuctionType(ForgeDirection paramForgeDirection) { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); Aspect result = this.parent.getSuctionType(this.changeDirection(paramForgeDirection)); this.syncFromParent(); @@ -389,7 +390,7 @@ public class TileStickyJar extends TileJarFillable { @Override public int getSuctionAmount(ForgeDirection paramForgeDirection) { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); int result = this.parent.getSuctionAmount(this.changeDirection(paramForgeDirection)); this.syncFromParent(); @@ -400,7 +401,7 @@ public class TileStickyJar extends TileJarFillable { @Override public int takeEssentia(Aspect paramAspect, int paramInt, ForgeDirection paramForgeDirection) { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); int result = this.parent.takeEssentia(paramAspect, paramInt, this.changeDirection(paramForgeDirection)); this.syncFromParent(); @@ -411,7 +412,7 @@ public class TileStickyJar extends TileJarFillable { @Override public int addEssentia(Aspect paramAspect, int paramInt, ForgeDirection paramForgeDirection) { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); int result = this.parent.addEssentia(paramAspect, paramInt, this.changeDirection(paramForgeDirection)); this.syncFromParent(); @@ -422,7 +423,7 @@ public class TileStickyJar extends TileJarFillable { @Override public Aspect getEssentiaType(ForgeDirection paramForgeDirection) { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); Aspect result = this.parent.getEssentiaType(this.changeDirection(paramForgeDirection)); this.syncFromParent(); @@ -433,7 +434,7 @@ public class TileStickyJar extends TileJarFillable { @Override public int getEssentiaAmount(ForgeDirection paramForgeDirection) { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); int result = this.parent.getEssentiaAmount(this.changeDirection(paramForgeDirection)); this.syncFromParent(); @@ -444,7 +445,7 @@ public class TileStickyJar extends TileJarFillable { @Override public int getMinimumSuction() { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); int result = this.parent.getMinimumSuction(); this.syncFromParent(); @@ -455,7 +456,7 @@ public class TileStickyJar extends TileJarFillable { @Override public boolean renderExtendedTube() { - if(this.isValid()) { + if (this.isValid()) { this.syncToParent(); boolean result = this.parent.renderExtendedTube(); this.syncFromParent(); diff --git a/src/main/java/makeo/gadomancy/common/containers/ContainerArcanePackager.java b/src/main/java/makeo/gadomancy/common/containers/ContainerArcanePackager.java index 4e637ea..ba8a868 100644 --- a/src/main/java/makeo/gadomancy/common/containers/ContainerArcanePackager.java +++ b/src/main/java/makeo/gadomancy/common/containers/ContainerArcanePackager.java @@ -64,11 +64,14 @@ public class ContainerArcanePackager extends Container { return null; } } else { - int specialSlot = itemstack1.getItem() == Items.leather ? 9 : itemstack1.getItem() == Items.string ? 10 : -1; - if(specialSlot != -1 && (this.packagerInv.getStackInSlot(specialSlot) == null || this.packagerInv.getStackInSlot(specialSlot).stackSize < 64)) { + int specialSlot = + itemstack1.getItem() == Items.leather ? 9 : itemstack1.getItem() == Items.string ? 10 : -1; + if (specialSlot != -1 + && (this.packagerInv.getStackInSlot(specialSlot) == null + || this.packagerInv.getStackInSlot(specialSlot).stackSize < 64)) { this.mergeItemStack(itemstack1, specialSlot, specialSlot + 1, false); - if(itemstack1.stackSize == 0) { + if (itemstack1.stackSize == 0) { slot.putStack(null); } diff --git a/src/main/java/makeo/gadomancy/common/containers/ContainerInfusionClaw.java b/src/main/java/makeo/gadomancy/common/containers/ContainerInfusionClaw.java index 449ce81..fb4a018 100644 --- a/src/main/java/makeo/gadomancy/common/containers/ContainerInfusionClaw.java +++ b/src/main/java/makeo/gadomancy/common/containers/ContainerInfusionClaw.java @@ -41,7 +41,7 @@ public class ContainerInfusionClaw extends Container { @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) { - if(((TileInfusionClaw) this.clawInv).isRunning()) { + if (((TileInfusionClaw) this.clawInv).isRunning()) { return null; } @@ -57,7 +57,7 @@ public class ContainerInfusionClaw extends Container { return null; } } else { - if(!((Slot) this.inventorySlots.get(0)).isItemValid(itemstack1)) { + if (!((Slot) this.inventorySlots.get(0)).isItemValid(itemstack1)) { return null; } diff --git a/src/main/java/makeo/gadomancy/common/crafting/DeprecationItemPaybacks.java b/src/main/java/makeo/gadomancy/common/crafting/DeprecationItemPaybacks.java index 82c490f..06cda8e 100644 --- a/src/main/java/makeo/gadomancy/common/crafting/DeprecationItemPaybacks.java +++ b/src/main/java/makeo/gadomancy/common/crafting/DeprecationItemPaybacks.java @@ -1,5 +1,7 @@ package makeo.gadomancy.common.crafting; +import java.util.ArrayList; +import java.util.List; import makeo.gadomancy.common.registration.RegisteredItems; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -10,9 +12,6 @@ import thaumcraft.common.config.ConfigItems; import thaumcraft.common.items.ItemEssence; import thaumcraft.common.items.ItemWispEssence; -import java.util.ArrayList; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -27,7 +26,7 @@ public class DeprecationItemPaybacks { Aspect aspect = RegisteredItems.itemFamiliar_old.getAspect(oldFamiliarStack); ItemWispEssence itemEssence = (ItemWispEssence) ConfigItems.itemWispEssence; ItemStack wispyEssence = null; - if(aspect != null) { + if (aspect != null) { wispyEssence = new ItemStack(ConfigItems.itemWispEssence, 1, 0); itemEssence.setAspects(wispyEssence, new AspectList().add(aspect, 2)); } @@ -36,7 +35,7 @@ public class DeprecationItemPaybacks { reward.add(new ItemStack(ConfigItems.itemResource, 2, 17)); reward.add(new ItemStack(ConfigItems.itemResource, 2, 0)); - if(wispyEssence != null) { + if (wispyEssence != null) { ItemStack add = wispyEssence.copy(); add.stackSize = 4; reward.add(add); @@ -46,12 +45,12 @@ public class DeprecationItemPaybacks { int magic = 51; int other = 37; ItemStack phials = DeprecationItemPaybacks.getPhialStack(Aspect.AURA, auram); - if(phials != null) reward.add(phials); + if (phials != null) reward.add(phials); phials = DeprecationItemPaybacks.getPhialStack(Aspect.MAGIC, magic); - if(phials != null) reward.add(phials); - if(aspect != null) { + if (phials != null) reward.add(phials); + if (aspect != null) { phials = DeprecationItemPaybacks.getPhialStack(aspect, other); - if(phials != null) reward.add(phials); + if (phials != null) reward.add(phials); } ItemStack craftingPackage = new ItemStack(RegisteredItems.itemPackage, 1, 1); @@ -63,7 +62,7 @@ public class DeprecationItemPaybacks { Aspect aspect = RegisteredItems.itemFamiliar_old.getAspect(oldFamiliarStack); ItemWispEssence itemEssence = (ItemWispEssence) ConfigItems.itemWispEssence; ItemStack wispyEssence = null; - if(aspect != null) { + if (aspect != null) { wispyEssence = new ItemStack(ConfigItems.itemWispEssence, 1, 0); itemEssence.setAspects(wispyEssence, new AspectList().add(aspect, 2)); } @@ -74,7 +73,7 @@ public class DeprecationItemPaybacks { reward.add(new ItemStack(ConfigItems.itemFocusPrimal)); reward.add(new ItemStack(ConfigItems.itemBathSalts, 2, 0)); - if(wispyEssence != null) { + if (wispyEssence != null) { ItemStack add = wispyEssence.copy(); add.stackSize = 2; reward.add(add); @@ -85,14 +84,14 @@ public class DeprecationItemPaybacks { int permutatio = 54; int other = 81; ItemStack phials = DeprecationItemPaybacks.getPhialStack(Aspect.AURA, auram); - if(phials != null) reward.add(phials); + if (phials != null) reward.add(phials); phials = DeprecationItemPaybacks.getPhialStack(Aspect.EXCHANGE, permutatio); - if(phials != null) reward.add(phials); + if (phials != null) reward.add(phials); phials = DeprecationItemPaybacks.getPhialStack(Aspect.MAGIC, magic); - if(phials != null) reward.add(phials); - if(aspect != null) { + if (phials != null) reward.add(phials); + if (aspect != null) { phials = DeprecationItemPaybacks.getPhialStack(aspect, other); - if(phials != null) reward.add(phials); + if (phials != null) reward.add(phials); } ItemStack craftingPackage = new ItemStack(RegisteredItems.itemPackage, 1, 1); @@ -104,7 +103,7 @@ public class DeprecationItemPaybacks { Aspect aspect = RegisteredItems.itemFamiliar_old.getAspect(oldFamiliarStack); ItemWispEssence itemEssence = (ItemWispEssence) ConfigItems.itemWispEssence; ItemStack wispyEssence = null; - if(aspect != null) { + if (aspect != null) { wispyEssence = new ItemStack(ConfigItems.itemWispEssence, 1, 0); itemEssence.setAspects(wispyEssence, new AspectList().add(aspect, 2)); } @@ -114,7 +113,7 @@ public class DeprecationItemPaybacks { reward.add(new ItemStack(Items.nether_star)); reward.add(new ItemStack(ConfigBlocks.blockCustomPlant, 2, 4)); - if(wispyEssence != null) { + if (wispyEssence != null) { ItemStack add = wispyEssence.copy(); add.stackSize = 4; reward.add(add); @@ -125,14 +124,14 @@ public class DeprecationItemPaybacks { int telum = 49; int other = 104; ItemStack phials = DeprecationItemPaybacks.getPhialStack(Aspect.AURA, auram); - if(phials != null) reward.add(phials); + if (phials != null) reward.add(phials); phials = DeprecationItemPaybacks.getPhialStack(Aspect.WEAPON, telum); - if(phials != null) reward.add(phials); + if (phials != null) reward.add(phials); phials = DeprecationItemPaybacks.getPhialStack(Aspect.MAGIC, magic); - if(phials != null) reward.add(phials); - if(aspect != null) { + if (phials != null) reward.add(phials); + if (aspect != null) { phials = DeprecationItemPaybacks.getPhialStack(aspect, other); - if(phials != null) reward.add(phials); + if (phials != null) reward.add(phials); } ItemStack craftingPackage = new ItemStack(RegisteredItems.itemPackage, 1, 1); @@ -144,7 +143,7 @@ public class DeprecationItemPaybacks { Aspect aspect = RegisteredItems.itemFamiliar_old.getAspect(oldFamiliarStack); ItemWispEssence itemEssence = (ItemWispEssence) ConfigItems.itemWispEssence; ItemStack wispyEssence = null; - if(aspect != null) { + if (aspect != null) { wispyEssence = new ItemStack(ConfigItems.itemWispEssence, 1, 0); itemEssence.setAspects(wispyEssence, new AspectList().add(aspect, 2)); } @@ -153,7 +152,7 @@ public class DeprecationItemPaybacks { reward.add(new ItemStack(ConfigBlocks.blockCrystal, 4, 6)); reward.add(new ItemStack(ConfigItems.itemResource, 2, 15)); reward.add(new ItemStack(ConfigItems.itemResource, 2, 17)); - if(wispyEssence != null) { + if (wispyEssence != null) { ItemStack add = wispyEssence.copy(); add.stackSize = 4; reward.add(add); @@ -164,14 +163,14 @@ public class DeprecationItemPaybacks { int other = 59; int eldritch = 37; ItemStack phials = DeprecationItemPaybacks.getPhialStack(Aspect.AURA, auram); - if(phials != null) reward.add(phials); + if (phials != null) reward.add(phials); phials = DeprecationItemPaybacks.getPhialStack(Aspect.ELDRITCH, eldritch); - if(phials != null) reward.add(phials); + if (phials != null) reward.add(phials); phials = DeprecationItemPaybacks.getPhialStack(Aspect.MAGIC, magic); - if(phials != null) reward.add(phials); - if(aspect != null) { + if (phials != null) reward.add(phials); + if (aspect != null) { phials = DeprecationItemPaybacks.getPhialStack(aspect, other); - if(phials != null) reward.add(phials); + if (phials != null) reward.add(phials); } ItemStack craftingPackage = new ItemStack(RegisteredItems.itemPackage, 1, 1); RegisteredItems.itemPackage.setContents(craftingPackage, reward); @@ -182,7 +181,7 @@ public class DeprecationItemPaybacks { Aspect aspect = RegisteredItems.itemFamiliar_old.getAspect(oldFamiliarStack); ItemWispEssence itemEssence = (ItemWispEssence) ConfigItems.itemWispEssence; ItemStack wispyEssence = null; - if(aspect != null) { + if (aspect != null) { wispyEssence = new ItemStack(ConfigItems.itemWispEssence, 1, 0); itemEssence.setAspects(wispyEssence, new AspectList().add(aspect, 2)); } @@ -190,7 +189,7 @@ public class DeprecationItemPaybacks { List reward = new ArrayList(); reward.add(new ItemStack(ConfigItems.itemResource, 2, 4)); reward.add(new ItemStack(ConfigItems.itemResource, 2, 6)); - if(wispyEssence != null) { + if (wispyEssence != null) { ItemStack add = wispyEssence.copy(); add.stackSize = 4; reward.add(add); @@ -199,12 +198,12 @@ public class DeprecationItemPaybacks { int magic = 53; int other = 35; ItemStack phials = DeprecationItemPaybacks.getPhialStack(Aspect.AURA, auram); - if(phials != null) reward.add(phials); + if (phials != null) reward.add(phials); phials = DeprecationItemPaybacks.getPhialStack(Aspect.MAGIC, magic); - if(phials != null) reward.add(phials); - if(aspect != null) { + if (phials != null) reward.add(phials); + if (aspect != null) { phials = DeprecationItemPaybacks.getPhialStack(aspect, other); - if(phials != null) reward.add(phials); + if (phials != null) reward.add(phials); } ItemStack craftingPackage = new ItemStack(RegisteredItems.itemPackage, 1, 1); RegisteredItems.itemPackage.setContents(craftingPackage, reward); @@ -215,7 +214,7 @@ public class DeprecationItemPaybacks { Aspect aspect = RegisteredItems.itemFamiliar_old.getAspect(oldFamiliar); ItemWispEssence itemEssence = (ItemWispEssence) ConfigItems.itemWispEssence; ItemStack wispyEssence = null; - if(aspect != null) { + if (aspect != null) { wispyEssence = new ItemStack(ConfigItems.itemWispEssence, 1, 0); itemEssence.setAspects(wispyEssence, new AspectList().add(aspect, 2)); } @@ -226,7 +225,7 @@ public class DeprecationItemPaybacks { rewardCrafting.add(new ItemStack(ConfigItems.itemResource, 2, 14)); rewardCrafting.add(new ItemStack(ConfigItems.itemResource, 2, 1)); rewardCrafting.add(new ItemStack(ConfigItems.itemAmuletRunic, 1, 0)); - if(wispyEssence != null) { + if (wispyEssence != null) { ItemStack add = wispyEssence.copy(); add.stackSize = 4; rewardCrafting.add(add); @@ -235,12 +234,12 @@ public class DeprecationItemPaybacks { int magic = 51; int otherAspect = 46; ItemStack phials = DeprecationItemPaybacks.getPhialStack(Aspect.AURA, auram); - if(phials != null) rewardCrafting.add(phials); + if (phials != null) rewardCrafting.add(phials); phials = DeprecationItemPaybacks.getPhialStack(Aspect.MAGIC, magic); - if(phials != null) rewardCrafting.add(phials); - if(aspect != null) { + if (phials != null) rewardCrafting.add(phials); + if (aspect != null) { phials = DeprecationItemPaybacks.getPhialStack(aspect, otherAspect); - if(phials != null) rewardCrafting.add(phials); + if (phials != null) rewardCrafting.add(phials); } ItemStack craftingPackage = new ItemStack(RegisteredItems.itemPackage, 1, 1); RegisteredItems.itemPackage.setContents(craftingPackage, rewardCrafting); @@ -250,7 +249,7 @@ public class DeprecationItemPaybacks { private static ItemStack getPhialStack(Aspect aspect, int aspectAmount) { ItemEssence phial = (ItemEssence) ConfigItems.itemEssence; ItemStack phialStack = new ItemStack(phial, DeprecationItemPaybacks.getPhialAmount(aspectAmount), 1); - if(phialStack.stackSize > 0) { + if (phialStack.stackSize > 0) { phial.setAspects(phialStack, new AspectList().add(aspect, 8)); return phialStack; } diff --git a/src/main/java/makeo/gadomancy/common/crafting/EtherealFamiliarUpgradeRecipe.java b/src/main/java/makeo/gadomancy/common/crafting/EtherealFamiliarUpgradeRecipe.java index ed30dba..84a97a1 100644 --- a/src/main/java/makeo/gadomancy/common/crafting/EtherealFamiliarUpgradeRecipe.java +++ b/src/main/java/makeo/gadomancy/common/crafting/EtherealFamiliarUpgradeRecipe.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.crafting; +import java.util.ArrayList; import makeo.gadomancy.common.familiar.FamiliarAugment; import makeo.gadomancy.common.items.baubles.ItemEtherealFamiliar; import net.minecraft.entity.player.EntityPlayer; @@ -9,8 +10,6 @@ import thaumcraft.api.ThaumcraftApiHelper; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.crafting.InfusionRecipe; -import java.util.ArrayList; - /** * HellFirePvP@Admin * Date: 19.04.2016 / 02:02 @@ -22,7 +21,14 @@ public class EtherealFamiliarUpgradeRecipe extends InfusionRecipe { private FamiliarAugment toAdd; private int requiredPreviousLevel; - public EtherealFamiliarUpgradeRecipe(String research, int inst, AspectList aspects2, ItemStack familiarIn, FamiliarAugment toAdd, int reqPrev, ItemStack... surroundings) { + public EtherealFamiliarUpgradeRecipe( + String research, + int inst, + AspectList aspects2, + ItemStack familiarIn, + FamiliarAugment toAdd, + int reqPrev, + ItemStack... surroundings) { super(research, null, inst, aspects2, familiarIn, surroundings); this.toAdd = toAdd; this.requiredPreviousLevel = reqPrev; @@ -30,28 +36,31 @@ public class EtherealFamiliarUpgradeRecipe extends InfusionRecipe { @Override public boolean matches(ArrayList input, ItemStack in, World world, EntityPlayer player) { - if(in == null || !(in.getItem() instanceof ItemEtherealFamiliar)) return false; //We call it "FamiliarAugment" Recipe for a reason.. - if(this.getRecipeInput() == null || !(this.getRecipeInput().getItem() instanceof ItemEtherealFamiliar)) return false; //A bit late but still working.. + if (in == null || !(in.getItem() instanceof ItemEtherealFamiliar)) + return false; // We call it "FamiliarAugment" Recipe for a reason.. + if (this.getRecipeInput() == null || !(this.getRecipeInput().getItem() instanceof ItemEtherealFamiliar)) + return false; // A bit late but still working.. - if((this.research.length() > 0) && (!ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), this.research))) { + if ((this.research.length() > 0) + && (!ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), this.research))) { return false; } FamiliarAugment.FamiliarAugmentList list = ItemEtherealFamiliar.getAugments(in); int level; - if(list.contains(this.toAdd)) { + if (list.contains(this.toAdd)) { level = list.getLevel(this.toAdd); } else { level = 0; } - if(this.requiredPreviousLevel > level) return false; //Requires higher level to do this infusion. + if (this.requiredPreviousLevel > level) return false; // Requires higher level to do this infusion. - if(!this.toAdd.checkConditions(list, level + 1)) { - return false; //Preconditions not met. + if (!this.toAdd.checkConditions(list, level + 1)) { + return false; // Preconditions not met. } - //Normal infusionrecipe stuff... + // Normal infusionrecipe stuff... ItemStack inCopy; ArrayList ii = new ArrayList(); diff --git a/src/main/java/makeo/gadomancy/common/crafting/FamiliarUndoRecipe.java b/src/main/java/makeo/gadomancy/common/crafting/FamiliarUndoRecipe.java index 26ea9c8..89dee57 100644 --- a/src/main/java/makeo/gadomancy/common/crafting/FamiliarUndoRecipe.java +++ b/src/main/java/makeo/gadomancy/common/crafting/FamiliarUndoRecipe.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.crafting; +import java.util.ArrayList; import makeo.gadomancy.common.items.baubles.ItemFamiliar_Old; import makeo.gadomancy.common.registration.RegisteredItems; import net.minecraft.inventory.InventoryCrafting; @@ -8,8 +9,6 @@ import net.minecraft.item.crafting.ShapelessRecipes; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import java.util.ArrayList; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -21,11 +20,14 @@ import java.util.ArrayList; public class FamiliarUndoRecipe extends ShapelessRecipes { public FamiliarUndoRecipe() { - super(new ItemStack(RegisteredItems.itemPackage, 1, 2).setStackDisplayName(EnumChatFormatting.GOLD + "Used Familiar Items"), new ArrayList() { - { - this.add(new ItemStack(RegisteredItems.itemFamiliar_old)); - } - }); + super( + new ItemStack(RegisteredItems.itemPackage, 1, 2) + .setStackDisplayName(EnumChatFormatting.GOLD + "Used Familiar Items"), + new ArrayList() { + { + this.add(new ItemStack(RegisteredItems.itemFamiliar_old)); + } + }); } @Override @@ -37,10 +39,12 @@ public class FamiliarUndoRecipe extends ShapelessRecipes { for (int j = 0; j < 3; ++j) { ItemStack itemstack = inv.getStackInRowAndColumn(j, i); - if(itemstack != null && itemstack.getItem() != null && itemstack.getItem() instanceof ItemFamiliar_Old) { - if(foundOldFamiliar) return false; + if (itemstack != null + && itemstack.getItem() != null + && itemstack.getItem() instanceof ItemFamiliar_Old) { + if (foundOldFamiliar) return false; foundOldFamiliar = true; - } else if(itemstack != null && itemstack.getItem() != null) { + } else if (itemstack != null && itemstack.getItem() != null) { return false; } } @@ -55,7 +59,9 @@ public class FamiliarUndoRecipe extends ShapelessRecipes { for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { ItemStack itemstack = inv.getStackInRowAndColumn(j, i); - if(itemstack != null && itemstack.getItem() != null && itemstack.getItem() instanceof ItemFamiliar_Old) { + if (itemstack != null + && itemstack.getItem() != null + && itemstack.getItem() instanceof ItemFamiliar_Old) { return ItemFamiliar_Old.getPaybackPackage(itemstack); } } diff --git a/src/main/java/makeo/gadomancy/common/crafting/Familiar_Old_AugmentInfusion.java b/src/main/java/makeo/gadomancy/common/crafting/Familiar_Old_AugmentInfusion.java index 3c28f68..a4c89a0 100644 --- a/src/main/java/makeo/gadomancy/common/crafting/Familiar_Old_AugmentInfusion.java +++ b/src/main/java/makeo/gadomancy/common/crafting/Familiar_Old_AugmentInfusion.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.crafting; +import java.util.ArrayList; import makeo.gadomancy.common.items.baubles.ItemFamiliar_Old; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -8,8 +9,6 @@ import thaumcraft.api.ThaumcraftApiHelper; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.crafting.InfusionRecipe; -import java.util.ArrayList; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -22,22 +21,32 @@ public class Familiar_Old_AugmentInfusion extends InfusionRecipe { private ItemFamiliar_Old.FamiliarUpgrade upgradeToAdd; - public Familiar_Old_AugmentInfusion(String research, int inst, AspectList aspects2, ItemStack input, ItemFamiliar_Old.FamiliarUpgrade upgradeToAdd, ItemStack[] recipe) { + public Familiar_Old_AugmentInfusion( + String research, + int inst, + AspectList aspects2, + ItemStack input, + ItemFamiliar_Old.FamiliarUpgrade upgradeToAdd, + ItemStack[] recipe) { super(research, null, inst, aspects2, input, recipe); this.upgradeToAdd = upgradeToAdd; } @Override public boolean matches(ArrayList input, ItemStack central, World world, EntityPlayer player) { - if(central == null || !(central.getItem() instanceof ItemFamiliar_Old)) return false; //We call it "FamiliarAugment" Recipe for a reason.. - if(this.getRecipeInput() == null || !(this.getRecipeInput().getItem() instanceof ItemFamiliar_Old)) return false; //A bit late but still working.. + if (central == null || !(central.getItem() instanceof ItemFamiliar_Old)) + return false; // We call it "FamiliarAugment" Recipe for a reason.. + if (this.getRecipeInput() == null || !(this.getRecipeInput().getItem() instanceof ItemFamiliar_Old)) + return false; // A bit late but still working.. - if ((this.research.length() > 0) && (!ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), this.research))) { + if ((this.research.length() > 0) + && (!ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), this.research))) { return false; } ItemStack centralCopy = central.copy(); - if(!((ItemFamiliar_Old) centralCopy.getItem()).hasUpgrade(centralCopy, this.getUpgradeToAdd().getNeededPreviousUpgrade())) return false; + if (!((ItemFamiliar_Old) centralCopy.getItem()) + .hasUpgrade(centralCopy, this.getUpgradeToAdd().getNeededPreviousUpgrade())) return false; ArrayList ii = new ArrayList(); for (ItemStack is : input) { diff --git a/src/main/java/makeo/gadomancy/common/crafting/InfusionDisguiseArmor.java b/src/main/java/makeo/gadomancy/common/crafting/InfusionDisguiseArmor.java index 3556a99..9c0ec8a 100644 --- a/src/main/java/makeo/gadomancy/common/crafting/InfusionDisguiseArmor.java +++ b/src/main/java/makeo/gadomancy/common/crafting/InfusionDisguiseArmor.java @@ -1,5 +1,9 @@ package makeo.gadomancy.common.crafting; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import makeo.gadomancy.common.research.SimpleResearchItem; import makeo.gadomancy.common.utils.NBTHelper; import net.minecraft.entity.EntityLiving; @@ -17,11 +21,6 @@ import thaumcraft.common.config.ConfigItems; import thaumcraft.common.lib.crafting.InfusionRunicAugmentRecipe; import thaumcraft.common.lib.research.ResearchManager; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -31,36 +30,44 @@ import java.util.Map; * Created by makeo @ 25.12.2015 15:35 */ public class InfusionDisguiseArmor extends InfusionRunicAugmentRecipe { - public static final ItemStack[] COMPONENTS = {new ItemStack(Items.slime_ball), new ItemStack(ConfigItems.itemResource, 1, 3), new ItemStack(Items.slime_ball), new ItemStack(ConfigItems.itemResource, 1, 3)}; - public static final AspectList ASPECTS = new AspectList().add(Aspect.SLIME, 12).add(Aspect.ARMOR, 10).add(Aspect.MAGIC, 8); + public static final ItemStack[] COMPONENTS = { + new ItemStack(Items.slime_ball), + new ItemStack(ConfigItems.itemResource, 1, 3), + new ItemStack(Items.slime_ball), + new ItemStack(ConfigItems.itemResource, 1, 3) + }; + public static final AspectList ASPECTS = + new AspectList().add(Aspect.SLIME, 12).add(Aspect.ARMOR, 10).add(Aspect.MAGIC, 8); private Map> cachedItems = new HashMap>(); @Override public boolean matches(ArrayList input, ItemStack central, World world, EntityPlayer player) { - if(input.size() != InfusionDisguiseArmor.COMPONENTS.length + 1 || !ResearchManager.isResearchComplete(player.getCommandSenderName(), SimpleResearchItem.getFullName("ARMORDISGUISE"))) { + if (input.size() != InfusionDisguiseArmor.COMPONENTS.length + 1 + || !ResearchManager.isResearchComplete( + player.getCommandSenderName(), SimpleResearchItem.getFullName("ARMORDISGUISE"))) { return false; } List copy = (List) input.clone(); List result = new ArrayList(copy.size()); - for(ItemStack required : InfusionDisguiseArmor.COMPONENTS) { + for (ItemStack required : InfusionDisguiseArmor.COMPONENTS) { boolean contains = false; - for(int i = 0; i < copy.size(); i++) { - if(InfusionRecipe.areItemStacksEqual(required, copy.get(i), true)) { + for (int i = 0; i < copy.size(); i++) { + if (InfusionRecipe.areItemStacksEqual(required, copy.get(i), true)) { contains = true; result.add(copy.get(i)); copy.remove(i); break; } } - if(!contains) { + if (!contains) { return false; } } ItemStack disguise = copy.get(0); - if(!this.isValidDisguise(central, disguise)) { + if (!this.isValidDisguise(central, disguise)) { return false; } @@ -72,7 +79,7 @@ public class InfusionDisguiseArmor extends InfusionRunicAugmentRecipe { @Override public ItemStack[] getComponents(ItemStack input) { List components = this.cachedItems.get(input); - if(components != null) { + if (components != null) { return components.toArray(new ItemStack[components.size()]); } return new ItemStack[0]; @@ -92,7 +99,7 @@ public class InfusionDisguiseArmor extends InfusionRunicAugmentRecipe { @Override public Object getRecipeOutput(ItemStack input) { List components = this.cachedItems.get(input); - if(components != null) { + if (components != null) { return InfusionDisguiseArmor.disguiseStack(input, components.get(0)); } return input; @@ -101,7 +108,7 @@ public class InfusionDisguiseArmor extends InfusionRunicAugmentRecipe { public static ItemStack disguiseStack(ItemStack stack, ItemStack disguise) { ItemStack out = stack.copy(); NBTTagCompound compound = NBTHelper.getPersistentData(out); - if(disguise.getItem() == Items.potionitem) { + if (disguise.getItem() == Items.potionitem) { compound.setBoolean("disguise", true); } else { compound.setTag("disguise", disguise.writeToNBT(new NBTTagCompound())); @@ -110,7 +117,7 @@ public class InfusionDisguiseArmor extends InfusionRunicAugmentRecipe { } private boolean isValidDisguise(ItemStack armor, ItemStack disguise) { - if(this.isDisguised(armor) || this.isDisguised(disguise)) { + if (this.isDisguised(armor) || this.isDisguised(disguise)) { return false; } @@ -119,15 +126,16 @@ public class InfusionDisguiseArmor extends InfusionRunicAugmentRecipe { } private boolean isDisguised(ItemStack stack) { - return NBTHelper.hasPersistentData(stack) && NBTHelper.getPersistentData(stack).hasKey("disguise"); + return NBTHelper.hasPersistentData(stack) + && NBTHelper.getPersistentData(stack).hasKey("disguise"); } private boolean isInvisItem(ItemStack disguise) { - if(disguise.getItem() == Items.potionitem) { + if (disguise.getItem() == Items.potionitem) { List effects = Items.potionitem.getEffects(disguise); - for(Object obj : effects) { - if(obj instanceof PotionEffect) { - if(((PotionEffect)obj).getPotionID() == Potion.invisibility.getId()) { + for (Object obj : effects) { + if (obj instanceof PotionEffect) { + if (((PotionEffect) obj).getPotionID() == Potion.invisibility.getId()) { return true; } } diff --git a/src/main/java/makeo/gadomancy/common/crafting/InfusionUpgradeRecipe.java b/src/main/java/makeo/gadomancy/common/crafting/InfusionUpgradeRecipe.java index b0720f3..7dc6fa3 100644 --- a/src/main/java/makeo/gadomancy/common/crafting/InfusionUpgradeRecipe.java +++ b/src/main/java/makeo/gadomancy/common/crafting/InfusionUpgradeRecipe.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.crafting; +import java.util.ArrayList; import makeo.gadomancy.api.GadomancyApi; import makeo.gadomancy.api.golems.AdditionalGolemType; import makeo.gadomancy.common.entities.golems.upgrades.GolemUpgrade; @@ -13,8 +14,6 @@ import thaumcraft.api.crafting.InfusionRecipe; import thaumcraft.common.config.ConfigItems; import thaumcraft.common.entities.golems.EnumGolemType; -import java.util.ArrayList; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -28,7 +27,8 @@ public class InfusionUpgradeRecipe extends InfusionRecipe { private final GolemUpgrade upgrade; - private InfusionUpgradeRecipe(String research, GolemUpgrade upgrade, int inst, AspectList aspects2, ItemStack input, ItemStack[] recipe) { + private InfusionUpgradeRecipe( + String research, GolemUpgrade upgrade, int inst, AspectList aspects2, ItemStack input, ItemStack[] recipe) { super(research, InfusionUpgradeRecipe.DEFAULT_OUTPUT, inst, aspects2, input, recipe); this.upgrade = upgrade; @@ -46,15 +46,17 @@ public class InfusionUpgradeRecipe extends InfusionRecipe { return output; } - public static InfusionUpgradeRecipe[] createRecipes(String research, GolemUpgrade upgrade, int inst, AspectList aspects, ItemStack[] recipe) { + public static InfusionUpgradeRecipe[] createRecipes( + String research, GolemUpgrade upgrade, int inst, AspectList aspects, ItemStack[] recipe) { InfusionUpgradeRecipe[] recipes = new InfusionUpgradeRecipe[EnumGolemType.values().length]; - for(int i = 0; i < EnumGolemType.values().length ; i++) { + for (int i = 0; i < EnumGolemType.values().length; i++) { EnumGolemType type = EnumGolemType.values()[i]; - if(type.health > 0) { + if (type.health > 0) { AdditionalGolemType addType = GadomancyApi.getAdditionalGolemType(type); Item input = addType == null ? ConfigItems.itemGolemPlacer : addType.getPlacerItem(); - recipes[i] = new InfusionUpgradeRecipe(research, upgrade, inst, aspects, new ItemStack(input, 1, type.ordinal()), recipe); + recipes[i] = new InfusionUpgradeRecipe( + research, upgrade, inst, aspects, new ItemStack(input, 1, type.ordinal()), recipe); } } return recipes; diff --git a/src/main/java/makeo/gadomancy/common/crafting/InfusionVisualDisguiseArmor.java b/src/main/java/makeo/gadomancy/common/crafting/InfusionVisualDisguiseArmor.java index 06682c2..3002bf8 100644 --- a/src/main/java/makeo/gadomancy/common/crafting/InfusionVisualDisguiseArmor.java +++ b/src/main/java/makeo/gadomancy/common/crafting/InfusionVisualDisguiseArmor.java @@ -2,6 +2,9 @@ package makeo.gadomancy.common.crafting; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; import makeo.gadomancy.common.Gadomancy; import net.minecraft.client.Minecraft; import net.minecraft.entity.EntityLiving; @@ -15,10 +18,6 @@ import thaumcraft.api.internal.DummyInternalMethodHandler; import thaumcraft.api.internal.IInternalMethodHandler; import thaumcraft.common.lib.research.ResearchManager; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -37,13 +36,20 @@ public class InfusionVisualDisguiseArmor extends InfusionRecipe { private final boolean transparent; public InfusionVisualDisguiseArmor(boolean transparent) { - super("", new ItemStack(Blocks.cobblestone), 0, InfusionDisguiseArmor.ASPECTS, new ItemStack(Blocks.dirt), new ItemStack[0]); + super( + "", + new ItemStack(Blocks.cobblestone), + 0, + InfusionDisguiseArmor.ASPECTS, + new ItemStack(Blocks.dirt), + new ItemStack[0]); this.transparent = transparent; this.components = new ItemStack[InfusionDisguiseArmor.COMPONENTS.length + 1]; - System.arraycopy(InfusionDisguiseArmor.COMPONENTS, 0, this.components, 1, InfusionDisguiseArmor.COMPONENTS.length); + System.arraycopy( + InfusionDisguiseArmor.COMPONENTS, 0, this.components, 1, InfusionDisguiseArmor.COMPONENTS.length); - if(InfusionVisualDisguiseArmor.armorItems == null && Gadomancy.proxy.getSide() == Side.CLIENT) { + if (InfusionVisualDisguiseArmor.armorItems == null && Gadomancy.proxy.getSide() == Side.CLIENT) { this.findArmorItems(); } } @@ -60,8 +66,7 @@ public class InfusionVisualDisguiseArmor extends InfusionRecipe { } for (Object o2 : list) { - if (o2 != null && o2 instanceof ItemStack - && EntityLiving.getArmorPosition((ItemStack) o2) != 0) { + if (o2 != null && o2 instanceof ItemStack && EntityLiving.getArmorPosition((ItemStack) o2) != 0) { items.add((ItemStack) o2); } } @@ -72,12 +77,19 @@ public class InfusionVisualDisguiseArmor extends InfusionRecipe { private boolean canSee(ItemStack stack) { String research = InfusionVisualDisguiseArmor.getResearchKey(stack); - return research == null || ResearchManager.isResearchComplete(Minecraft.getMinecraft().thePlayer.getCommandSenderName(), research); + return research == null + || ResearchManager.isResearchComplete( + Minecraft.getMinecraft().thePlayer.getCommandSenderName(), research); } public ItemStack getCurrentDisguise() { - if(this.transparent) { - return new ItemStack(Items.potionitem, 1, InfusionVisualDisguiseArmor.POTION_METAS[(int)((System.currentTimeMillis() / 1000) % InfusionVisualDisguiseArmor.POTION_METAS.length)]); + if (this.transparent) { + return new ItemStack( + Items.potionitem, + 1, + InfusionVisualDisguiseArmor.POTION_METAS[ + (int) ((System.currentTimeMillis() / 1000) + % InfusionVisualDisguiseArmor.POTION_METAS.length)]); } Random random = new Random(System.currentTimeMillis() / 1000); @@ -87,18 +99,20 @@ public class InfusionVisualDisguiseArmor extends InfusionRecipe { int next; do { next = random.nextInt(InfusionVisualDisguiseArmor.armorItems.length); - } - while (next == first || EntityLiving.getArmorPosition(InfusionVisualDisguiseArmor.armorItems[next]) != firstPos || !this.canSee(InfusionVisualDisguiseArmor.armorItems[next])); + } while (next == first + || EntityLiving.getArmorPosition(InfusionVisualDisguiseArmor.armorItems[next]) != firstPos + || !this.canSee(InfusionVisualDisguiseArmor.armorItems[next])); return InfusionVisualDisguiseArmor.armorItems[next]; } @Override @SideOnly(Side.CLIENT) public ItemStack getRecipeInput() { - if(Minecraft.getMinecraft().thePlayer == null) { + if (Minecraft.getMinecraft().thePlayer == null) { return new ItemStack(Items.cookie); } - return InfusionVisualDisguiseArmor.armorItems[this.getRecipeInput(new Random(System.currentTimeMillis() / 1000))]; + return InfusionVisualDisguiseArmor.armorItems[ + this.getRecipeInput(new Random(System.currentTimeMillis() / 1000))]; } private int getRecipeInput(Random random) { @@ -112,7 +126,7 @@ public class InfusionVisualDisguiseArmor extends InfusionRecipe { @Override @SideOnly(Side.CLIENT) public Object getRecipeOutput(ItemStack input) { - if(Minecraft.getMinecraft().thePlayer == null) { + if (Minecraft.getMinecraft().thePlayer == null) { return new ItemStack(Items.cookie); } return InfusionDisguiseArmor.disguiseStack(input, this.getCurrentDisguise()); @@ -131,7 +145,7 @@ public class InfusionVisualDisguiseArmor extends InfusionRecipe { ThaumcraftApi.internalMethods = InfusionVisualDisguiseArmor.FAKE_HANDLER; Object[] result = ThaumcraftApi.getCraftingRecipeKey(Minecraft.getMinecraft().thePlayer, stack); ThaumcraftApi.internalMethods = old; - return result == null ? null : (String)result[0]; + return result == null ? null : (String) result[0]; } private static class FakeMethodHandler extends DummyInternalMethodHandler { diff --git a/src/main/java/makeo/gadomancy/common/crafting/RecipeStickyJar.java b/src/main/java/makeo/gadomancy/common/crafting/RecipeStickyJar.java index 42d09a0..67986f4 100644 --- a/src/main/java/makeo/gadomancy/common/crafting/RecipeStickyJar.java +++ b/src/main/java/makeo/gadomancy/common/crafting/RecipeStickyJar.java @@ -25,13 +25,15 @@ public class RecipeStickyJar implements IArcaneRecipe { @Override public boolean matches(IInventory inv, World world, EntityPlayer player) { - return ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), SimpleResearchItem.getFullName("STICKYJAR")) && this.getJarItem(inv) != null; + return ThaumcraftApiHelper.isResearchComplete( + player.getCommandSenderName(), SimpleResearchItem.getFullName("STICKYJAR")) + && this.getJarItem(inv) != null; } @Override public ItemStack getCraftingResult(IInventory inv) { ItemStack jarItem = this.getJarItem(inv); - if(jarItem != null) { + if (jarItem != null) { ItemStack result = jarItem.copy(); result.stackSize = 1; NBTHelper.getData(result).setBoolean("isStickyJar", true); @@ -48,35 +50,35 @@ public class RecipeStickyJar implements IArcaneRecipe { ItemStack jarItem = null; - for(int i = 0; i < invWidth*invWidth; i++) { + for (int i = 0; i < invWidth * invWidth; i++) { ItemStack current = inv.getStackInSlot(i); - if(current != null) { + if (current != null) { itemCount++; - if(itemCount > 2) { + if (itemCount > 2) { return null; } - if(jarItem == null) { - if(current.getItem() == Items.slime_ball) { + if (jarItem == null) { + if (current.getItem() == Items.slime_ball) { return null; } - boolean isSticky = RegisteredItems.isStickyableJar(current) && (!current.hasTagCompound() - || !current.getTagCompound().getBoolean("isStickyJar")); - if(current.getItem() != Items.slime_ball && !isSticky) { + boolean isSticky = RegisteredItems.isStickyableJar(current) + && (!current.hasTagCompound() + || !current.getTagCompound().getBoolean("isStickyJar")); + if (current.getItem() != Items.slime_ball && !isSticky) { return null; } - - if(isSticky) { + if (isSticky) { int slimeSlot = i + invWidth; - if(slimeSlot < 0 || slimeSlot > inv.getSizeInventory()) { + if (slimeSlot < 0 || slimeSlot > inv.getSizeInventory()) { return null; } ItemStack slime = inv.getStackInSlot(slimeSlot); - if(slime == null || slime.getItem() != Items.slime_ball) { + if (slime == null || slime.getItem() != Items.slime_ball) { return null; } diff --git a/src/main/java/makeo/gadomancy/common/crafting/RecipeVisualStickyJar.java b/src/main/java/makeo/gadomancy/common/crafting/RecipeVisualStickyJar.java index c016954..5caa06e 100644 --- a/src/main/java/makeo/gadomancy/common/crafting/RecipeVisualStickyJar.java +++ b/src/main/java/makeo/gadomancy/common/crafting/RecipeVisualStickyJar.java @@ -2,6 +2,7 @@ package makeo.gadomancy.common.crafting; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import makeo.gadomancy.common.registration.RegisteredItems; import makeo.gadomancy.common.utils.NBTHelper; import net.minecraft.client.Minecraft; @@ -12,8 +13,6 @@ import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.crafting.ShapedArcaneRecipe; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -24,7 +23,15 @@ import java.util.List; */ public class RecipeVisualStickyJar extends ShapedArcaneRecipe { public RecipeVisualStickyJar() { - super("Mirror mirror on the wall, who is the fairest one of all?", new ItemStack(Blocks.dirt), new AspectList().add(Aspect.WATER, 10).add(Aspect.EARTH, 10), " ", " A ", " ", 'A', new ItemStack(Items.diamond)); + super( + "Mirror mirror on the wall, who is the fairest one of all?", + new ItemStack(Blocks.dirt), + new AspectList().add(Aspect.WATER, 10).add(Aspect.EARTH, 10), + " ", + " A ", + " ", + 'A', + new ItemStack(Items.diamond)); } @Override @@ -37,8 +44,8 @@ public class RecipeVisualStickyJar extends ShapedArcaneRecipe { @SideOnly(Side.CLIENT) private void updateVisualStickyJarRecipes() { List stacks = RegisteredItems.getStickyJarStacks(Minecraft.getMinecraft().thePlayer); - if(stacks.size() > 0) { - ItemStack stack = stacks.get((int)(System.currentTimeMillis() / 1000L % stacks.size())); + if (stacks.size() > 0) { + ItemStack stack = stacks.get((int) (System.currentTimeMillis() / 1000L % stacks.size())); this.output = stack.copy(); NBTHelper.getData(this.output).setBoolean("isStickyJar", true); diff --git a/src/main/java/makeo/gadomancy/common/data/AbstractData.java b/src/main/java/makeo/gadomancy/common/data/AbstractData.java index 960e575..d963407 100644 --- a/src/main/java/makeo/gadomancy/common/data/AbstractData.java +++ b/src/main/java/makeo/gadomancy/common/data/AbstractData.java @@ -1,9 +1,8 @@ package makeo.gadomancy.common.data; -import net.minecraft.nbt.NBTTagCompound; - import java.util.HashMap; import java.util.Map; +import net.minecraft.nbt.NBTTagCompound; /** * This class is part of the Gadomancy Mod @@ -19,7 +18,7 @@ public abstract class AbstractData { public final void markDirty() { AbstractDataProvider provider = Registry.getProvider(this.getProviderID()); - if(provider != null) { + if (provider != null) { SyncDataHolder.markForUpdate(provider.getKey()); } } @@ -44,7 +43,8 @@ public abstract class AbstractData { public static class Registry { - private static Map> registry = new HashMap>(); + private static Map> registry = + new HashMap>(); public static void register(AbstractDataProvider provider) { Registry.registry.put(provider.getProviderId(), provider); @@ -74,7 +74,6 @@ public abstract class AbstractData { public final byte getProviderId() { return this.providerId; } - } public abstract static class ProviderAutoAllocate extends AbstractDataProvider { @@ -82,7 +81,5 @@ public abstract class AbstractData { public ProviderAutoAllocate(String key) { super(key, SyncDataHolder.allocateNewId()); } - } - } diff --git a/src/main/java/makeo/gadomancy/common/data/DataAchromatic.java b/src/main/java/makeo/gadomancy/common/data/DataAchromatic.java index e7a56c9..6fd77cb 100644 --- a/src/main/java/makeo/gadomancy/common/data/DataAchromatic.java +++ b/src/main/java/makeo/gadomancy/common/data/DataAchromatic.java @@ -1,5 +1,7 @@ package makeo.gadomancy.common.data; +import java.util.ArrayList; +import java.util.List; import makeo.gadomancy.common.registration.RegisteredPotions; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -7,9 +9,6 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagIntArray; -import java.util.ArrayList; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -30,49 +29,49 @@ public class DataAchromatic extends AbstractData { } public void handleApplication(EntityLivingBase entity) { - if(entity.worldObj.isRemote) return; + if (entity.worldObj.isRemote) return; int entityId = entity.getEntityId(); boolean needsUpdate = false; - if(!this.addClientQueue.contains(entityId) && !this.achromaticEntities.contains(entityId)) { + if (!this.addClientQueue.contains(entityId) && !this.achromaticEntities.contains(entityId)) { this.addClientQueue.add(entityId); this.achromaticEntities.add(entityId); needsUpdate = true; } - if(this.removeClientQueue.contains(entityId)) { + if (this.removeClientQueue.contains(entityId)) { this.removeClientQueue.remove(Integer.valueOf(entityId)); this.addClientQueue.remove(Integer.valueOf(entityId)); needsUpdate = false; } - if(needsUpdate) { + if (needsUpdate) { this.markDirty(); } } public void handleRemoval(EntityLivingBase entity) { - if(entity.worldObj.isRemote) return; + if (entity.worldObj.isRemote) return; int entityId = entity.getEntityId(); boolean needsUpdate = false; - if(!this.removeClientQueue.contains(entityId) && this.achromaticEntities.contains(entityId)) { + if (!this.removeClientQueue.contains(entityId) && this.achromaticEntities.contains(entityId)) { this.removeClientQueue.add(entityId); this.achromaticEntities.remove(Integer.valueOf(entityId)); needsUpdate = true; } - if(this.addClientQueue.contains(entityId)) { + if (this.addClientQueue.contains(entityId)) { this.addClientQueue.remove(Integer.valueOf(entityId)); this.removeClientQueue.remove(Integer.valueOf(entityId)); needsUpdate = false; } - if(needsUpdate) { + if (needsUpdate) { this.markDirty(); } } public void checkPotionEffect(EntityPlayerMP p) { - if(p.isPotionActive(RegisteredPotions.ACHROMATIC)) { + if (p.isPotionActive(RegisteredPotions.ACHROMATIC)) { this.handleApplication(p); } } @@ -112,14 +111,14 @@ public class DataAchromatic extends AbstractData { @Override public void readRawFromPacket(NBTTagCompound compound) { int[] array = compound.getIntArray("removals"); - if(array != null && array.length > 0) { - for(int i : array) { + if (array != null && array.length > 0) { + for (int i : array) { this.removeClientQueue.add(i); } } array = compound.getIntArray("additions"); - if(array != null && array.length > 0) { - for(int i : array) { + if (array != null && array.length > 0) { + for (int i : array) { this.addClientQueue.add(i); } } @@ -145,5 +144,4 @@ public class DataAchromatic extends AbstractData { return new DataAchromatic(); } } - } diff --git a/src/main/java/makeo/gadomancy/common/data/DataFamiliar.java b/src/main/java/makeo/gadomancy/common/data/DataFamiliar.java index 78c5f87..2854a6a 100644 --- a/src/main/java/makeo/gadomancy/common/data/DataFamiliar.java +++ b/src/main/java/makeo/gadomancy/common/data/DataFamiliar.java @@ -1,6 +1,10 @@ package makeo.gadomancy.common.data; import baubles.api.BaublesApi; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import makeo.gadomancy.client.util.FamiliarHandlerClient; import makeo.gadomancy.common.familiar.FamiliarController; import makeo.gadomancy.common.items.baubles.ItemEtherealFamiliar; @@ -12,11 +16,6 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.world.World; import thaumcraft.api.aspects.Aspect; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -34,35 +33,35 @@ public class DataFamiliar extends AbstractData { private List removeClientQueue = new ArrayList(); public boolean hasFamiliar(EntityPlayer player) { - for(FamiliarData fam : this.playersWithFamiliar) { - if(fam.owner.equals(player.getCommandSenderName())) return true; + for (FamiliarData fam : this.playersWithFamiliar) { + if (fam.owner.equals(player.getCommandSenderName())) return true; } return false; } public void handleEquip(World world, EntityPlayer player, Aspect aspect) { - if(world.isRemote) return; + if (world.isRemote) return; String playerName = player.getCommandSenderName(); FamiliarData data = new FamiliarData(playerName, aspect.getTag()); - if(!this.addClientQueue.contains(data)) this.addClientQueue.add(data); - if(!this.playersWithFamiliar.contains(data)) this.playersWithFamiliar.add(data); + if (!this.addClientQueue.contains(data)) this.addClientQueue.add(data); + if (!this.playersWithFamiliar.contains(data)) this.playersWithFamiliar.add(data); this.markDirty(); - if(!this.familiarControllers.containsKey(player)) { + if (!this.familiarControllers.containsKey(player)) { FamiliarController controller = new FamiliarController(player); this.familiarControllers.put(player, controller); } } public void handleUnequip(World world, EntityPlayer player, Aspect aspect) { - if(world.isRemote) return; + if (world.isRemote) return; String playerName = player.getCommandSenderName(); FamiliarData data = new FamiliarData(playerName, aspect.getTag()); - if(!this.removeClientQueue.contains(data)) this.removeClientQueue.add(data); + if (!this.removeClientQueue.contains(data)) this.removeClientQueue.add(data); this.playersWithFamiliar.remove(data); this.markDirty(); @@ -70,17 +69,17 @@ public class DataFamiliar extends AbstractData { } public void equipTick(World world, EntityPlayer player, Aspect aspect) { - if(world.isRemote) return; + if (world.isRemote) return; FamiliarData data = new FamiliarData(player.getCommandSenderName(), aspect.getTag()); IInventory baublesInv = BaublesApi.getBaubles(player); - if(baublesInv.getStackInSlot(0) == null) { + if (baublesInv.getStackInSlot(0) == null) { this.handleUnequip(world, player, aspect); return; } - if(this.familiarControllers.get(player) == null || !this.playersWithFamiliar.contains(data)) { + if (this.familiarControllers.get(player) == null || !this.playersWithFamiliar.contains(data)) { this.handleEquip(world, player, aspect); } @@ -89,11 +88,11 @@ public class DataFamiliar extends AbstractData { public void checkPlayerEquipment(EntityPlayer p) { IInventory baublesInv = BaublesApi.getBaubles(p); - if(baublesInv.getStackInSlot(0) != null) { + if (baublesInv.getStackInSlot(0) != null) { ItemStack amulet = baublesInv.getStackInSlot(0); - if(amulet.getItem() != null && amulet.getItem() instanceof ItemEtherealFamiliar) { + if (amulet.getItem() != null && amulet.getItem() instanceof ItemEtherealFamiliar) { Aspect a = ItemEtherealFamiliar.getFamiliarAspect(amulet); - if(a != null) { + if (a != null) { this.handleEquip(p.worldObj, p, a); } } @@ -108,7 +107,7 @@ public class DataFamiliar extends AbstractData { @Override public void writeAllDataToPacket(NBTTagCompound compound) { NBTTagList list = new NBTTagList(); - for(FamiliarData data : this.playersWithFamiliar) { + for (FamiliarData data : this.playersWithFamiliar) { NBTTagCompound cmp = new NBTTagCompound(); cmp.setString("owner", data.owner); cmp.setString("aspect", data.aspectTag); @@ -121,7 +120,7 @@ public class DataFamiliar extends AbstractData { @Override public void writeToPacket(NBTTagCompound compound) { NBTTagList removal = new NBTTagList(); - for(FamiliarData data : this.removeClientQueue) { + for (FamiliarData data : this.removeClientQueue) { NBTTagCompound cmp = new NBTTagCompound(); cmp.setString("owner", data.owner); cmp.setString("aspect", data.aspectTag); @@ -130,7 +129,7 @@ public class DataFamiliar extends AbstractData { compound.setTag("removals", removal); NBTTagList additions = new NBTTagList(); - for(FamiliarData data : this.addClientQueue) { + for (FamiliarData data : this.addClientQueue) { NBTTagCompound cmp = new NBTTagCompound(); cmp.setString("owner", data.owner); cmp.setString("aspect", data.aspectTag); @@ -173,12 +172,12 @@ public class DataFamiliar extends AbstractData { public void handleUnsafeUnequip(EntityPlayer player) { FamiliarData data = null; - for(FamiliarData fam : this.playersWithFamiliar) { - if(fam.owner.equals(player.getCommandSenderName())) { + for (FamiliarData fam : this.playersWithFamiliar) { + if (fam.owner.equals(player.getCommandSenderName())) { data = fam; } } - if(data != null) { + if (data != null) { this.handleUnequip(player.worldObj, player, Aspect.getAspect(data.aspectTag)); } } @@ -200,8 +199,8 @@ public class DataFamiliar extends AbstractData { FamiliarData that = (FamiliarData) o; - return (this.aspectTag != null ? this.aspectTag.equals(that.aspectTag) : that.aspectTag == null) && (this.owner != null ? this.owner.equals(that.owner) : that.owner == null); - + return (this.aspectTag != null ? this.aspectTag.equals(that.aspectTag) : that.aspectTag == null) + && (this.owner != null ? this.owner.equals(that.owner) : that.owner == null); } @Override @@ -223,5 +222,4 @@ public class DataFamiliar extends AbstractData { return new DataFamiliar(); } } - } diff --git a/src/main/java/makeo/gadomancy/common/data/SyncDataHolder.java b/src/main/java/makeo/gadomancy/common/data/SyncDataHolder.java index ca15cce..1fedf33 100644 --- a/src/main/java/makeo/gadomancy/common/data/SyncDataHolder.java +++ b/src/main/java/makeo/gadomancy/common/data/SyncDataHolder.java @@ -1,13 +1,12 @@ package makeo.gadomancy.common.data; -import makeo.gadomancy.common.network.PacketHandler; -import makeo.gadomancy.common.network.packets.PacketSyncData; -import net.minecraft.entity.player.EntityPlayer; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import makeo.gadomancy.common.network.PacketHandler; +import makeo.gadomancy.common.network.packets.PacketSyncData; +import net.minecraft.entity.player.EntityPlayer; /** * This class is part of the Gadomancy Mod @@ -50,7 +49,7 @@ public class SyncDataHolder { } public static void markForUpdate(String key) { - if(!SyncDataHolder.dirtyData.contains(key)) { + if (!SyncDataHolder.dirtyData.contains(key)) { SyncDataHolder.dirtyData.add(key); } } @@ -61,20 +60,20 @@ public class SyncDataHolder { } public static void receiveServerPacket(Map data) { - for(String key : data.keySet()) { + for (String key : data.keySet()) { AbstractData dat = SyncDataHolder.clientData.get(key); - if(dat != null) { + if (dat != null) { dat.handleIncomingData(data.get(key)); } } } public static void doNecessaryUpdates() { - if(SyncDataHolder.dirtyData.isEmpty()) return; + if (SyncDataHolder.dirtyData.isEmpty()) return; Map pktData = new HashMap(); - for(String s : SyncDataHolder.dirtyData) { + for (String s : SyncDataHolder.dirtyData) { AbstractData d = SyncDataHolder.getDataServer(s); - if(d.needsUpdate()) { + if (d.needsUpdate()) { pktData.put(s, d); } } @@ -87,5 +86,4 @@ public class SyncDataHolder { SyncDataHolder.register(new DataFamiliar.Provider("FamiliarData")); SyncDataHolder.register(new DataAchromatic.Provider("AchromaticData")); } - } diff --git a/src/main/java/makeo/gadomancy/common/data/config/ModConfig.java b/src/main/java/makeo/gadomancy/common/data/config/ModConfig.java index 25c52a2..14b932a 100644 --- a/src/main/java/makeo/gadomancy/common/data/config/ModConfig.java +++ b/src/main/java/makeo/gadomancy/common/data/config/ModConfig.java @@ -1,15 +1,14 @@ package makeo.gadomancy.common.data.config; +import java.io.File; +import java.util.ArrayList; +import java.util.List; import makeo.gadomancy.common.registration.RegisteredEnchantments; import makeo.gadomancy.common.registration.RegisteredPotions; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import thaumcraft.api.aspects.Aspect; -import java.io.File; -import java.util.ArrayList; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -24,6 +23,7 @@ public class ModConfig { @Sync public static int entityNoClipItemDatawatcherMasterId = 19; + @Sync public static int entityNoClipItemDatawatcherFixedId = 20; @@ -32,6 +32,7 @@ public class ModConfig { @Sync public static int golemDatawatcherId = 29; + @Sync public static int dimOuterId = -73; @@ -44,7 +45,7 @@ public class ModConfig { public static boolean enableAdditionalNodeTypes; - //Skyblock stuff + // Skyblock stuff public static boolean ancientStoneRecipes; private ModConfig() {} @@ -60,30 +61,87 @@ public class ModConfig { } private static void loadFromConfig() { - //Datawatcher entity stuff - ModConfig.entityNoClipItemDatawatcherMasterId = ModConfig.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"); - ModConfig.entityNoClipItemDatawatcherFixedId = ModConfig.config.getInt("itemNoClipDatawatcherFixId", "entities", 20, 0, 31, "Do not edit unless you know what are you doing! - Datawatcher ID of the Fixed-Coordinates for EntityNoClipItem"); + // Datawatcher entity stuff + ModConfig.entityNoClipItemDatawatcherMasterId = ModConfig.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"); + ModConfig.entityNoClipItemDatawatcherFixedId = ModConfig.config.getInt( + "itemNoClipDatawatcherFixId", + "entities", + 20, + 0, + 31, + "Do not edit unless you know what are you doing! - Datawatcher ID of the Fixed-Coordinates for EntityNoClipItem"); - ModConfig.entityAuraCoreDatawatcherAspectsId = ModConfig.config.getInt("auraCoreDatawatcherAuraId", "entities", 21, 0, 31, "Do not edit unless you know what are you doing! - Datawatcher ID of the Auracore's current aspects"); + ModConfig.entityAuraCoreDatawatcherAspectsId = ModConfig.config.getInt( + "auraCoreDatawatcherAuraId", + "entities", + 21, + 0, + 31, + "Do not edit unless you know what are you doing! - Datawatcher ID of the Auracore's current aspects"); - ModConfig.golemDatawatcherId = ModConfig.config.getInt("datawatcherId", "golem", 29, 0, 31, "Do not edit unless you know what are you doing!"); + ModConfig.golemDatawatcherId = ModConfig.config.getInt( + "datawatcherId", "golem", 29, 0, 31, "Do not edit unless you know what are you doing!"); - //Dimension stuff - ModConfig.dimOuterId = ModConfig.config.getInt("dimOuterId", "dimension", -73, Integer.MIN_VALUE, Integer.MAX_VALUE, "Dimension Id for the eldrich mazes accessed via Node Manipulator"); - ModConfig.doLightCalculations = ModConfig.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."); - ModConfig.maxMazeCount = ModConfig.config.getInt("maxMazeCount", "dimension", -1, -1, Integer.MAX_VALUE, "Defines how many Eldritch mazes may exist at the same time using the Gadomancy Eldritch ritual. (-1 = infinite) Note that 1 maze = 1 player; Once the player finishes the maze, the maze closes itself and teleports the player out."); + // Dimension stuff + ModConfig.dimOuterId = ModConfig.config.getInt( + "dimOuterId", + "dimension", + -73, + Integer.MIN_VALUE, + Integer.MAX_VALUE, + "Dimension Id for the eldrich mazes accessed via Node Manipulator"); + ModConfig.doLightCalculations = ModConfig.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."); + ModConfig.maxMazeCount = ModConfig.config.getInt( + "maxMazeCount", + "dimension", + -1, + -1, + Integer.MAX_VALUE, + "Defines how many Eldritch mazes may exist at the same time using the Gadomancy Eldritch ritual. (-1 = infinite) Note that 1 maze = 1 player; Once the player finishes the maze, the maze closes itself and teleports the player out."); - //Skyblock stuff - ModConfig.ancientStoneRecipes = ModConfig.config.getBoolean("ancientStoneRecipes", "skyblock", false, "TRUE = Adds recipes for Ancient Stone and Ancient Stone Pedestal (This may be usefull for severs and skyblock packs to craft the Node Manipulator and get more primodial pearls). You have to change this client- and server-side!"); + // Skyblock stuff + ModConfig.ancientStoneRecipes = ModConfig.config.getBoolean( + "ancientStoneRecipes", + "skyblock", + false, + "TRUE = Adds recipes for Ancient Stone and Ancient Stone Pedestal (This may be usefull for severs and skyblock packs to craft the Node Manipulator and get more primodial pearls). You have to change this client- and server-side!"); - //General stuff - ModConfig.renderParticleDistance = ModConfig.config.getInt("particleRenderDistance", "general", 100, 5, 1000, "Defines, how close a player has to be towards the particle origin to see the particles created by it."); - ModConfig.enableAdditionalNodeTypes = ModConfig.config.getBoolean("enableAdditionalNodeTypes", "general", true, "Enables our custom node types. This might solve some compatibility issues (e.g. WitchingGadgets). You have to change this client- and server-side! Only change when you experience issues with special mods' features ONLY not working when using the mod together with Gadomancy."); - String listOfAspects = ModConfig.config.getString("auraPylonBlacklist", "general", "", "Write a list of aspects (e.g. aura,aer) here that should not be active/obtainable with the aura pylon. Multiple aspects can be seperated with ','. Leave it empty to blacklist nothing"); + // General stuff + ModConfig.renderParticleDistance = ModConfig.config.getInt( + "particleRenderDistance", + "general", + 100, + 5, + 1000, + "Defines, how close a player has to be towards the particle origin to see the particles created by it."); + ModConfig.enableAdditionalNodeTypes = ModConfig.config.getBoolean( + "enableAdditionalNodeTypes", + "general", + true, + "Enables our custom node types. This might solve some compatibility issues (e.g. WitchingGadgets). You have to change this client- and server-side! Only change when you experience issues with special mods' features ONLY not working when using the mod together with Gadomancy."); + String listOfAspects = ModConfig.config.getString( + "auraPylonBlacklist", + "general", + "", + "Write a list of aspects (e.g. aura,aer) here that should not be active/obtainable with the aura pylon. Multiple aspects can be seperated with ','. Leave it empty to blacklist nothing"); ModConfig.blacklistAuraEffects = ModConfig.refactorAspects(listOfAspects); - ModConfig.config.addCustomCategoryComment("potions", "Use the following if you have problems with conflicting potion ids. If the entry is set to '-1' it will try to automatically find the lowest free potion id."); - ModConfig.config.addCustomCategoryComment("enchantments", "Use the following if you have problems with conflicting enchantment ids. If the entry is set to '-1' it will try to automatically find the lowest free enchantment id."); + ModConfig.config.addCustomCategoryComment( + "potions", + "Use the following if you have problems with conflicting potion ids. If the entry is set to '-1' it will try to automatically find the lowest free potion id."); + ModConfig.config.addCustomCategoryComment( + "enchantments", + "Use the following if you have problems with conflicting enchantment ids. If the entry is set to '-1' it will try to automatically find the lowest free enchantment id."); RegisteredPotions.createConfigEntries(); RegisteredEnchantments.createConfigEntries(); @@ -91,10 +149,10 @@ public class ModConfig { private static String[] refactorAspects(String listOfAspects) { List aspects = new ArrayList(); - if(listOfAspects != null && listOfAspects.length() > 0) { + if (listOfAspects != null && listOfAspects.length() > 0) { String[] aspectTags = listOfAspects.split(","); for (String s : aspectTags) { - if(Aspect.getAspect(s) != null) aspects.add(s); + if (Aspect.getAspect(s) != null) aspects.add(s); } } return aspects.toArray(new String[aspects.size()]); diff --git a/src/main/java/makeo/gadomancy/common/data/config/ModData.java b/src/main/java/makeo/gadomancy/common/data/config/ModData.java index 280609a..d5ea2d8 100644 --- a/src/main/java/makeo/gadomancy/common/data/config/ModData.java +++ b/src/main/java/makeo/gadomancy/common/data/config/ModData.java @@ -4,12 +4,11 @@ import com.google.gson.Gson; import com.google.gson.JsonIOException; import com.google.gson.JsonSyntaxException; import cpw.mods.fml.common.FMLLog; -import makeo.gadomancy.common.Gadomancy; -import net.minecraft.server.MinecraftServer; - import java.io.*; import java.util.HashMap; import java.util.Map; +import makeo.gadomancy.common.Gadomancy; +import net.minecraft.server.MinecraftServer; /** * This class is part of the Gadomancy Mod @@ -29,8 +28,7 @@ public class ModData { private Map data = new HashMap(); public ModData(String name, File directory) { - if(directory == null) - throw new IllegalArgumentException("Directory is null!"); + if (directory == null) throw new IllegalArgumentException("Directory is null!"); this.name = name; this.file = new File(directory, name + ".dat"); @@ -42,9 +40,9 @@ public class ModData { private static File geDefaultDirectory() { MinecraftServer server = MinecraftServer.getServer(); - if(server != null && server.getEntityWorld() != null) { + if (server != null && server.getEntityWorld() != null) { File file = server.getEntityWorld().getSaveHandler().getWorldDirectory(); - if(file != null) { + if (file != null) { return new File(file, Gadomancy.MODID); } } @@ -52,7 +50,7 @@ public class ModData { } public T get(String key, T defaultValue) { - if(this.data.containsKey(key)) { + if (this.data.containsKey(key)) { return (T) this.data.get(key); } this.data.put(key, defaultValue); @@ -72,8 +70,8 @@ public class ModData { } public boolean load() { - if(this.file != null && this.file.exists()) { - ObjectInputStream inOBJ = null; + if (this.file != null && this.file.exists()) { + ObjectInputStream inOBJ = null; FileInputStream in = null; try { in = new FileInputStream(this.file); @@ -82,29 +80,26 @@ public class ModData { } catch (IOException | ClassCastException | JsonSyntaxException | ClassNotFoundException e) { // e.printStackTrace(); try { - if (inOBJ != null) - inOBJ.close(); - if (in != null) - in.close(); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } + if (inOBJ != null) inOBJ.close(); + if (in != null) in.close(); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } return false; } finally { - try { - if (inOBJ != null) - inOBJ.close(); - if (in != null) - in.close(); - } catch (IOException ignored) { } + try { + if (inOBJ != null) inOBJ.close(); + if (in != null) in.close(); + } catch (IOException ignored) { + } } } return true; } public boolean save() { - if(!this.file.getParentFile().exists() && !this.file.getParentFile().mkdirs()) { + if (!this.file.getParentFile().exists() && !this.file.getParentFile().mkdirs()) { FMLLog.warning("Failed to create directory: \"" + this.file.toString() + "\"!"); return false; } @@ -112,8 +107,7 @@ public class ModData { FileOutputStream out = null; ObjectOutputStream outOBJ = null; try { - if(!this.file.exists()) - this.file.createNewFile(); + if (!this.file.exists()) this.file.createNewFile(); out = new FileOutputStream(this.file); outOBJ = new ObjectOutputStream(out); @@ -121,21 +115,18 @@ public class ModData { } catch (JsonIOException | IOException e) { e.printStackTrace(); try { - if (outOBJ != null) - outOBJ.close(); - if(out != null) - out.close(); - } catch (IOException e1) { - e1.printStackTrace(); - } + if (outOBJ != null) outOBJ.close(); + if (out != null) out.close(); + } catch (IOException e1) { + e1.printStackTrace(); + } return false; } finally { - try { - if(outOBJ != null) - outOBJ.close(); - if(out != null) - out.close(); - } catch (IOException ignored) { } + try { + if (outOBJ != null) outOBJ.close(); + if (out != null) out.close(); + } catch (IOException ignored) { + } } return true; } diff --git a/src/main/java/makeo/gadomancy/common/data/config/Sync.java b/src/main/java/makeo/gadomancy/common/data/config/Sync.java index 42aa2ce..2be086e 100644 --- a/src/main/java/makeo/gadomancy/common/data/config/Sync.java +++ b/src/main/java/makeo/gadomancy/common/data/config/Sync.java @@ -1,11 +1,11 @@ package makeo.gadomancy.common.data.config; +import static java.lang.annotation.ElementType.FIELD; + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.FIELD; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -16,5 +16,4 @@ import static java.lang.annotation.ElementType.FIELD; */ @Retention(RetentionPolicy.RUNTIME) @Target(FIELD) -public @interface Sync { -} +public @interface Sync {} diff --git a/src/main/java/makeo/gadomancy/common/entities/EntityAuraCore.java b/src/main/java/makeo/gadomancy/common/entities/EntityAuraCore.java index f6bdd65..661be35 100644 --- a/src/main/java/makeo/gadomancy/common/entities/EntityAuraCore.java +++ b/src/main/java/makeo/gadomancy/common/entities/EntityAuraCore.java @@ -2,6 +2,11 @@ package makeo.gadomancy.common.entities; import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; import io.netty.buffer.ByteBuf; +import java.awt.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Random; import makeo.gadomancy.client.effect.EffectHandler; import makeo.gadomancy.client.effect.fx.EntityFXFlowPolicy; import makeo.gadomancy.client.effect.fx.FXFlow; @@ -33,12 +38,6 @@ import thaumcraft.api.research.ScanResult; import thaumcraft.common.lib.research.ScanManager; import thaumcraft.common.lib.utils.BlockUtils; -import java.awt.*; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Random; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -52,16 +51,17 @@ public class EntityAuraCore extends EntityItem implements IEntityAdditionalSpawn private static final String SPLIT = ";"; private static final int PRE_GATHER_EFFECT_LENGTH = 50; - private static final int GATHER_EFFECT_LENGTH = 500; //20 + 430 + private static final int GATHER_EFFECT_LENGTH = 500; // 20 + 430 private static final int GATHER_RANGE = 4; - private static final int CLUSTER_WEIGHT = 10; //Counts as 10 'blocks' 'scanned' with the given aspect. - public static final int CLUSTER_RANGE = 10; //Defines how close the clicked cluster has to be. - private static final int REQUIRED_BLOCKS = (int) Math.round(Math.pow(EntityAuraCore.GATHER_RANGE *2+1, 3) * 0.15); + private static final int CLUSTER_WEIGHT = 10; // Counts as 10 'blocks' 'scanned' with the given aspect. + public static final int CLUSTER_RANGE = 10; // Defines how close the clicked cluster has to be. + private static final int REQUIRED_BLOCKS = + (int) Math.round(Math.pow(EntityAuraCore.GATHER_RANGE * 2 + 1, 3) * 0.15); public PrimalAspectList internalAuraList = new PrimalAspectList(); public Orbital auraOrbital; - //Effect stuff ResidentSleeper + // Effect stuff ResidentSleeper private Aspect[] effectAspects = new Aspect[6]; private Orbital.OrbitalRenderProperties[] effectProperties = new Orbital.OrbitalRenderProperties[6]; private FXFlow[] flows = new FXFlow[6]; @@ -75,14 +75,21 @@ public class EntityAuraCore extends EntityItem implements IEntityAdditionalSpawn super(world); } - public EntityAuraCore(World world, double x, double y, double z, ItemStack stack, ChunkCoordinates startingCoords, Aspect[] aspects) { + public EntityAuraCore( + World world, + double x, + double y, + double z, + ItemStack stack, + ChunkCoordinates startingCoords, + Aspect[] aspects) { super(world, x, y, z, stack); this.activationLocation = startingCoords; - if(aspects.length == 1) { + if (aspects.length == 1) { this.internalAuraList.add(aspects[0], EntityAuraCore.CLUSTER_WEIGHT * 6); } else { - for(Aspect a : aspects) { - if(a == null) continue; + for (Aspect a : aspects) { + if (a == null) continue; this.internalAuraList.add(a, EntityAuraCore.CLUSTER_WEIGHT); } } @@ -103,18 +110,20 @@ public class EntityAuraCore extends EntityItem implements IEntityAdditionalSpawn public void onUpdate() { super.onUpdate(); - if(this.auraOrbital == null && !MiscUtils.getPositionVector(this).equals(Vector3.ZERO) + if (this.auraOrbital == null + && !MiscUtils.getPositionVector(this).equals(Vector3.ZERO) && this.worldObj.isRemote) { this.auraOrbital = new Orbital(MiscUtils.getPositionVector(this), this.worldObj); } - if(this.auraOrbital != null && this.worldObj.isRemote) { - if(!this.auraOrbital.registered) { + if (this.auraOrbital != null && this.worldObj.isRemote) { + if (!this.auraOrbital.registered) { EffectHandler.getInstance().registerOrbital(this.auraOrbital); } this.auraOrbital.updateCenter(MiscUtils.getPositionVector(this)); - if(this.ticksExisted > EntityAuraCore.PRE_GATHER_EFFECT_LENGTH) { + if (this.ticksExisted > EntityAuraCore.PRE_GATHER_EFFECT_LENGTH) { int part = this.ticksExisted - EntityAuraCore.PRE_GATHER_EFFECT_LENGTH; - float perc = ((float) EntityAuraCore.GATHER_EFFECT_LENGTH - part) / ((float) EntityAuraCore.GATHER_EFFECT_LENGTH); + float perc = ((float) EntityAuraCore.GATHER_EFFECT_LENGTH - part) + / ((float) EntityAuraCore.GATHER_EFFECT_LENGTH); this.auraOrbital.reduceAllOffsets(perc); } } @@ -123,23 +132,25 @@ public class EntityAuraCore extends EntityItem implements IEntityAdditionalSpawn this.age = 0; } - if(!this.worldObj.isRemote) { - if(this.ticksExisted > EntityAuraCore.GATHER_EFFECT_LENGTH) { + if (!this.worldObj.isRemote) { + if (this.ticksExisted > EntityAuraCore.GATHER_EFFECT_LENGTH) { this.finishCore(); - } else if(this.ticksExisted > EntityAuraCore.PRE_GATHER_EFFECT_LENGTH) { + } else if (this.ticksExisted > EntityAuraCore.PRE_GATHER_EFFECT_LENGTH) { this.auraGatherCycle(); } } else { boolean changed = this.recieveAspectData(); for (int i = 0; i < this.effectProperties.length; i++) { Orbital.OrbitalRenderProperties node = this.effectProperties[i]; - if(node == null) { - if(this.effectAspects[i] == null) { + if (node == null) { + if (this.effectAspects[i] == null) { continue; } - node = new Orbital.OrbitalRenderProperties(Orbital.Axis.persisentRandomAxis(), 1D);//rand.nextDouble() - node.setColor(new Color(this.effectAspects[i].getColor())).setTicksForFullCircle(120 + this.rand.nextInt(40)); + node = new Orbital.OrbitalRenderProperties( + Orbital.Axis.persisentRandomAxis(), 1D); // rand.nextDouble() + node.setColor(new Color(this.effectAspects[i].getColor())) + .setTicksForFullCircle(120 + this.rand.nextInt(40)); node.setOffsetTicks(this.rand.nextInt(80)); Color c = this.getSubParticleColor(this.effectAspects[i]); node.setSubParticleColor(c); @@ -150,36 +161,45 @@ public class EntityAuraCore extends EntityItem implements IEntityAdditionalSpawn return 0.05F + (rand.nextBoolean() ? 0.0F : 0.025F); } }); - //node.setMultiplier() + // node.setMultiplier() this.effectProperties[i] = node; } - if(this.flows[i] == null && this.ticksExisted < EntityAuraCore.PRE_GATHER_EFFECT_LENGTH) { - Vector3 v = new Vector3(this.activationLocation.posX + 0.5D, this.activationLocation.posY + 0.5D, this.activationLocation.posZ + 0.5D); - this.flows[i] = EffectHandler.getInstance().effectFlow(this.worldObj, - v, new FXFlow.EntityFlowProperties().setPolicy(EntityFXFlowPolicy.Policies.DEFAULT) - .setTarget(this.auraOrbital.getOrbitalStartPoints(node)[0]) - .setColor(new Color(this.effectAspects[i].getColor())).setFading(this.getSubParticleColor(this.effectAspects[i]))); + if (this.flows[i] == null && this.ticksExisted < EntityAuraCore.PRE_GATHER_EFFECT_LENGTH) { + Vector3 v = new Vector3( + this.activationLocation.posX + 0.5D, + this.activationLocation.posY + 0.5D, + this.activationLocation.posZ + 0.5D); + this.flows[i] = EffectHandler.getInstance() + .effectFlow( + this.worldObj, + v, + new FXFlow.EntityFlowProperties() + .setPolicy(EntityFXFlowPolicy.Policies.DEFAULT) + .setTarget(this.auraOrbital.getOrbitalStartPoints(node)[0]) + .setColor(new Color(this.effectAspects[i].getColor())) + .setFading(this.getSubParticleColor(this.effectAspects[i]))); this.flows[i].setLivingTicks(EntityAuraCore.PRE_GATHER_EFFECT_LENGTH - this.ticksExisted); } - if(this.flows[i] != null) this.flows[i].applyTarget(this.auraOrbital.getOrbitalStartPoints(node)[0]); + if (this.flows[i] != null) + this.flows[i].applyTarget(this.auraOrbital.getOrbitalStartPoints(node)[0]); - if(changed) { - if(this.effectProperties[i] != null) { + if (changed) { + if (this.effectProperties[i] != null) { this.effectProperties[i].setColor(new Color(this.effectAspects[i].getColor())); Color c = this.getSubParticleColor(this.effectAspects[i]); node.setSubParticleColor(c); } - if(this.flows[i] != null) { + if (this.flows[i] != null) { this.flows[i].setColor(this.getSubParticleColor(this.effectAspects[i])); this.flows[i].setColor(new Color(this.effectAspects[i].getColor())); } } } - if(this.ticksExisted >= (EntityAuraCore.PRE_GATHER_EFFECT_LENGTH - 1)) { - if(this.auraOrbital.orbitalsSize() == 0) { + if (this.ticksExisted >= (EntityAuraCore.PRE_GATHER_EFFECT_LENGTH - 1)) { + if (this.auraOrbital.orbitalsSize() == 0) { for (int i = 0; i < 6; i++) { Orbital.OrbitalRenderProperties node = this.effectProperties[i]; this.auraOrbital.addOrbitalPoint(node); @@ -187,7 +207,7 @@ public class EntityAuraCore extends EntityItem implements IEntityAdditionalSpawn } } else { for (int i = 0; i < 6; i++) { - if(this.flows[i] != null) { + if (this.flows[i] != null) { this.flows[i].lastUpdateCall = System.currentTimeMillis(); } } @@ -198,27 +218,27 @@ public class EntityAuraCore extends EntityItem implements IEntityAdditionalSpawn private void finishCore() { ItemStack auraCore = new ItemStack(RegisteredItems.itemAuraCore, 1, 0); boolean success = false; - if(this.blockCount >= EntityAuraCore.REQUIRED_BLOCKS) { + if (this.blockCount >= EntityAuraCore.REQUIRED_BLOCKS) { double avg = ((double) this.internalAuraList.visSize()) / ((double) this.internalAuraList.size()); Aspect[] sortedHtL = this.internalAuraList.getAspectsSortedAmount(); AspectList al = new AspectList(); - for(Aspect a : sortedHtL) { - if(a == null) return; + for (Aspect a : sortedHtL) { + if (a == null) return; int am = this.internalAuraList.getAmount(a); - if(am >= avg) { + if (am >= avg) { al.add(a, am); } } List rand = new ArrayList(); - for(Aspect a : al.getAspects()) { - if(a == null) continue; + for (Aspect a : al.getAspects()) { + if (a == null) continue; rand.add(new AspectWRItem(al.getAmount(a), a)); } Aspect aura = ((AspectWRItem) WeightedRandom.getRandomItem(this.worldObj.rand, rand)).getAspect(); - for(ItemAuraCore.AuraCoreType type : ItemAuraCore.AuraCoreType.values()) { - if(type.isAspect() && type.getAspect().equals(aura)) { + for (ItemAuraCore.AuraCoreType type : ItemAuraCore.AuraCoreType.values()) { + if (type.isAspect() && type.getAspect().equals(aura)) { RegisteredItems.itemAuraCore.setCoreType(auraCore, type); success = true; } @@ -226,10 +246,17 @@ public class EntityAuraCore extends EntityItem implements IEntityAdditionalSpawn } PacketStartAnimation animationPacket; - if(!success) { - animationPacket = new PacketStartAnimation(PacketStartAnimation.ID_SMOKE_SPREAD, (int) this.posX, (int) this.posY, (int) this.posZ, Float.floatToIntBits(2F)); + if (!success) { + animationPacket = new PacketStartAnimation( + PacketStartAnimation.ID_SMOKE_SPREAD, + (int) this.posX, + (int) this.posY, + (int) this.posZ, + Float.floatToIntBits(2F)); } else { - animationPacket = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, (int) this.posX, (int) this.posY, (int) this.posZ, (byte) 0); + animationPacket = new PacketStartAnimation( + PacketStartAnimation.ID_SPARKLE_SPREAD, (int) this.posX, (int) this.posY, (int) this.posZ, (byte) + 0); } PacketHandler.INSTANCE.sendToAllAround(animationPacket, MiscUtils.getTargetPoint(this.worldObj, this, 32)); @@ -244,10 +271,10 @@ public class EntityAuraCore extends EntityItem implements IEntityAdditionalSpawn private List markedLocations; private void initGathering() { - this.markedLocations = new ArrayList((int) Math.pow(EntityAuraCore.GATHER_RANGE *2+1, 3)); - for(int x = -EntityAuraCore.GATHER_RANGE; x <= EntityAuraCore.GATHER_RANGE; x++) { - for(int y = -EntityAuraCore.GATHER_RANGE; y <= EntityAuraCore.GATHER_RANGE; y++) { - for(int z = -EntityAuraCore.GATHER_RANGE; z <= EntityAuraCore.GATHER_RANGE; z++) { + this.markedLocations = new ArrayList((int) Math.pow(EntityAuraCore.GATHER_RANGE * 2 + 1, 3)); + for (int x = -EntityAuraCore.GATHER_RANGE; x <= EntityAuraCore.GATHER_RANGE; x++) { + for (int y = -EntityAuraCore.GATHER_RANGE; y <= EntityAuraCore.GATHER_RANGE; y++) { + for (int z = -EntityAuraCore.GATHER_RANGE; z <= EntityAuraCore.GATHER_RANGE; z++) { this.markedLocations.add(new ChunkCoordinates(x, y, z)); } } @@ -256,15 +283,16 @@ public class EntityAuraCore extends EntityItem implements IEntityAdditionalSpawn } private void auraGatherCycle() { - if(this.ticksExisted >= EntityAuraCore.PRE_GATHER_EFFECT_LENGTH) { + if (this.ticksExisted >= EntityAuraCore.PRE_GATHER_EFFECT_LENGTH) { int elapsed = this.ticksExisted - EntityAuraCore.PRE_GATHER_EFFECT_LENGTH - 1; - float dist = (EntityAuraCore.GATHER_EFFECT_LENGTH - EntityAuraCore.PRE_GATHER_EFFECT_LENGTH) / (float) this.markedLocations.size(); + float dist = (EntityAuraCore.GATHER_EFFECT_LENGTH - EntityAuraCore.PRE_GATHER_EFFECT_LENGTH) + / (float) this.markedLocations.size(); int index = (int) (elapsed / dist); - int lastIndex = (int)((elapsed - 1) / dist); - if(index < this.markedLocations.size() && index > lastIndex) { + int lastIndex = (int) ((elapsed - 1) / dist); + if (index < this.markedLocations.size() && index > lastIndex) { int diff = index - lastIndex; - for(int i = 0; i < diff; i++) { + for (int i = 0; i < diff; i++) { ChunkCoordinates coord = this.markedLocations.get(index + i); int x = (int) (coord.posX + this.posX); @@ -272,35 +300,36 @@ public class EntityAuraCore extends EntityItem implements IEntityAdditionalSpawn int z = (int) (coord.posZ + this.posZ); Block block = this.worldObj.getBlock(x, y, z); - if(block != Blocks.air) { + if (block != Blocks.air) { int meta = this.worldObj.getBlockMetadata(x, y, z); ScanResult result = null; - MovingObjectPosition pos = new MovingObjectPosition(x, y, z, ForgeDirection.UP.ordinal(), - Vec3.createVectorHelper(0, 0, 0), true); + MovingObjectPosition pos = new MovingObjectPosition( + x, y, z, ForgeDirection.UP.ordinal(), Vec3.createVectorHelper(0, 0, 0), true); ItemStack is = null; try { is = block.getPickBlock(pos, this.worldObj, x, y, z); } catch (Throwable ignored) { } try { - if(is == null) { + if (is == null) { is = BlockUtils.createStackedBlock(block, meta); } } catch (Exception ignored) { } try { if (is == null) { - result = new ScanResult((byte)1, Block.getIdFromBlock(block), meta, null, ""); + result = new ScanResult((byte) 1, Block.getIdFromBlock(block), meta, null, ""); } else { - result = new ScanResult((byte)1, Item.getIdFromItem(is.getItem()), is.getItemDamage(), null, ""); + result = new ScanResult( + (byte) 1, Item.getIdFromItem(is.getItem()), is.getItemDamage(), null, ""); } } catch (Exception ignored) { } - if(result == null) continue; //We can't scan it BibleThump + if (result == null) continue; // We can't scan it BibleThump AspectList aspects = ScanManager.getScanAspects(result, this.worldObj); - if(aspects.size() > 0) { + if (aspects.size() > 0) { this.internalAuraList.add(aspects); this.blockCount++; } @@ -319,27 +348,27 @@ public class EntityAuraCore extends EntityItem implements IEntityAdditionalSpawn int totalSize = this.internalAuraList.visSize(); int availableSeats = 6; - for(Aspect aspect : aspects) { - float percent = this.internalAuraList.getAmount(aspect) / (float)totalSize; + for (Aspect aspect : aspects) { + float percent = this.internalAuraList.getAmount(aspect) / (float) totalSize; int seats = (int) Math.ceil(availableSeats * percent); seats = Math.min(seats, availableSeats); availableSeats -= seats; - for(int i = 0; i < colors.length && seats > 0; i++) { - if(colors[i] == null) { + for (int i = 0; i < colors.length && seats > 0; i++) { + if (colors[i] == null) { colors[i] = aspect; seats--; } } - if(availableSeats <= 0) { + if (availableSeats <= 0) { break; } } - for(int i = 0; i < colors.length; i++) { - if(colors[i] == null) { + for (int i = 0; i < colors.length; i++) { + if (colors[i] == null) { colors[i] = aspects[0]; } } @@ -348,36 +377,37 @@ public class EntityAuraCore extends EntityItem implements IEntityAdditionalSpawn private Color getSubParticleColor(Aspect a) { Color c = null; - if(a.equals(Aspect.AIR)) { + if (a.equals(Aspect.AIR)) { c = new Color(0xFEFFC9); - } else if(a.equals(Aspect.FIRE)) { + } else if (a.equals(Aspect.FIRE)) { c = new Color(0xFFAA3C); - } else if(a.equals(Aspect.EARTH)) { + } else if (a.equals(Aspect.EARTH)) { c = new Color(0x7EE35F); - } else if(a.equals(Aspect.WATER)) { + } else if (a.equals(Aspect.WATER)) { c = new Color(0x78CFCC); - } else if(a.equals(Aspect.ORDER)) { + } else if (a.equals(Aspect.ORDER)) { c = new Color(0xFFFFFF); - } else if(a.equals(Aspect.ENTROPY)) { + } else if (a.equals(Aspect.ENTROPY)) { c = new Color(0x000000); } return c; } - //Client side only. + // Client side only. private boolean recieveAspectData() { String rec = this.getDataWatcher().getWatchableObjectString(ModConfig.entityAuraCoreDatawatcherAspectsId); - if(this.oldAspectDataSent == null || !this.oldAspectDataSent.equals(rec)) { + if (this.oldAspectDataSent == null || !this.oldAspectDataSent.equals(rec)) { this.oldAspectDataSent = rec; } else { return false; } - if(rec.equals("")) return false; + if (rec.equals("")) return false; String[] arr = rec.split(EntityAuraCore.SPLIT); - if(arr.length != 6) throw new IllegalStateException("Server sent wrong Aura Data! '" - + rec + "' Please report this error to the mod authors!"); + if (arr.length != 6) + throw new IllegalStateException( + "Server sent wrong Aura Data! '" + rec + "' Please report this error to the mod authors!"); for (int i = 0; i < arr.length; i++) { String s = arr[i]; Aspect a = Aspect.getAspect(s); @@ -393,11 +423,10 @@ public class EntityAuraCore extends EntityItem implements IEntityAdditionalSpawn sb.append(EntityAuraCore.SPLIT); } sb.append(aspect.getTag()); - } String toSend = sb.toString(); - if(!toSend.equals(this.oldAspectDataSent)) { + if (!toSend.equals(this.oldAspectDataSent)) { this.oldAspectDataSent = toSend; this.getDataWatcher().updateObject(ModConfig.entityAuraCoreDatawatcherAspectsId, toSend); } @@ -413,11 +442,13 @@ public class EntityAuraCore extends EntityItem implements IEntityAdditionalSpawn 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")) { + if (cmp.hasKey("tag") && cmp.hasKey("amt")) { this.internalAuraList.add(Aspect.getAspect(cmp.getString("tag")), cmp.getInteger("amt")); } } - if(compound.hasKey("activationVecX") && compound.hasKey("activationVecY") && compound.hasKey("activationVecZ")) { + if (compound.hasKey("activationVecX") + && compound.hasKey("activationVecY") + && compound.hasKey("activationVecZ")) { int x = compound.getInteger("activationVecX"); int y = compound.getInteger("activationVecY"); int z = compound.getInteger("activationVecZ"); @@ -436,15 +467,15 @@ public class EntityAuraCore extends EntityItem implements IEntityAdditionalSpawn compound.setInteger("ticksExisted", this.ticksExisted); NBTTagList list = new NBTTagList(); - for(Aspect a : this.internalAuraList.getAspects()) { - if(a == null) continue; + for (Aspect a : this.internalAuraList.getAspects()) { + if (a == null) continue; NBTTagCompound aspectCompound = new NBTTagCompound(); aspectCompound.setString("tag", a.getTag()); aspectCompound.setInteger("amt", this.internalAuraList.getAmount(a)); list.appendTag(aspectCompound); } compound.setTag("auraList", list); - if(this.activationLocation != null) { + if (this.activationLocation != null) { compound.setInteger("activationVecX", this.activationLocation.posX); compound.setInteger("activationVecY", this.activationLocation.posY); compound.setInteger("activationVecZ", this.activationLocation.posZ); @@ -485,5 +516,4 @@ public class EntityAuraCore extends EntityItem implements IEntityAdditionalSpawn return this.aspect; } } - } diff --git a/src/main/java/makeo/gadomancy/common/entities/EntityItemElement.java b/src/main/java/makeo/gadomancy/common/entities/EntityItemElement.java index de45984..df6b0c3 100644 --- a/src/main/java/makeo/gadomancy/common/entities/EntityItemElement.java +++ b/src/main/java/makeo/gadomancy/common/entities/EntityItemElement.java @@ -2,6 +2,7 @@ package makeo.gadomancy.common.entities; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import makeo.gadomancy.common.items.ItemElement; import net.minecraft.client.Minecraft; import net.minecraft.entity.EntityLivingBase; @@ -11,8 +12,6 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import thaumcraft.client.fx.bolt.FXLightningBolt; -import java.util.List; - /** * HellFirePvP@Admin * Date: 23.04.2016 / 13:45 @@ -37,11 +36,12 @@ public class EntityItemElement extends EntityItem { public void onUpdate() { super.onUpdate(); ItemStack stack = this.getEntityItem(); - if(stack == null || !(stack.getItem() instanceof ItemElement)) return; + if (stack == null || !(stack.getItem() instanceof ItemElement)) return; int meta = stack.getItemDamage(); - ItemElement.EnumElementType element = ItemElement.EnumElementType.values()[meta % ItemElement.EnumElementType.values().length]; + ItemElement.EnumElementType element = + ItemElement.EnumElementType.values()[meta % ItemElement.EnumElementType.values().length]; - if(!this.worldObj.isRemote && (this.ticksExisted & 15) == 0) { + if (!this.worldObj.isRemote && (this.ticksExisted & 15) == 0) { EntityItemElement.doElementServerEffects(element, this.worldObj, this.posX, this.posY, this.posZ); } @@ -49,44 +49,54 @@ public class EntityItemElement extends EntityItem { this.age = 0; } - if(this.worldObj.isRemote && this.worldObj.rand.nextInt(4) == 0) { + if (this.worldObj.isRemote && this.worldObj.rand.nextInt(4) == 0) { EntityItemElement.playClientElementEffect(element, this.worldObj, this.posX, this.posY, this.posZ); } } - public static void doElementServerEffects(ItemElement.EnumElementType type, World world, double posX, double posY, double posZ) { - List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, - AxisAlignedBB.getBoundingBox(posX - 0.5, posY - 0.5, posZ - 0.5, - posX + 0.5, posY + 0.5, posZ + 0.5).expand(8, 8, 8)); + public static void doElementServerEffects( + ItemElement.EnumElementType type, World world, double posX, double posY, double posZ) { + List entities = world.getEntitiesWithinAABB( + EntityLivingBase.class, + AxisAlignedBB.getBoundingBox(posX - 0.5, posY - 0.5, posZ - 0.5, posX + 0.5, posY + 0.5, posZ + 0.5) + .expand(8, 8, 8)); for (Object o : entities) { - if(o == null || - !(o instanceof EntityLivingBase) || - ((EntityLivingBase) o).isDead) continue; + if (o == null || !(o instanceof EntityLivingBase) || ((EntityLivingBase) o).isDead) continue; type.getRunnable().affectEntity((EntityLivingBase) o); } } @SideOnly(Side.CLIENT) - public static void playClientElementEffect(ItemElement.EnumElementType element, World worldObj, double posX, double posY, double posZ) { + public static void playClientElementEffect( + ItemElement.EnumElementType element, World worldObj, double posX, double posY, double posZ) { float randOffsetX = worldObj.rand.nextFloat() * (worldObj.rand.nextBoolean() ? 1 : -1); float randOffsetY = worldObj.rand.nextFloat() * (worldObj.rand.nextBoolean() ? 1 : -1); float randOffsetZ = worldObj.rand.nextFloat() * (worldObj.rand.nextBoolean() ? 1 : -1); switch (element) { case DARKNESS: - FXLightningBolt bolt = new FXLightningBolt(Minecraft.getMinecraft().theWorld, posX, posY + 0.2F, posZ, - posX + randOffsetX / 2, posY + randOffsetY / 2, posZ + randOffsetZ / 2, Minecraft.getMinecraft().theWorld.rand.nextLong(), 10, 4.0F, 5); + FXLightningBolt bolt = new FXLightningBolt( + Minecraft.getMinecraft().theWorld, + posX, + posY + 0.2F, + posZ, + posX + randOffsetX / 2, + posY + randOffsetY / 2, + posZ + randOffsetZ / 2, + Minecraft.getMinecraft().theWorld.rand.nextLong(), + 10, + 4.0F, + 5); bolt.defaultFractal(); bolt.setType(5); bolt.finalizeBolt(); break; - /*case ORDER: - Thaumcraft.proxy.wispFX(worldObj, posX + randOffsetX / 4, posY + 0.2F + randOffsetY / 4, posZ + randOffsetZ / 4, 0.1F, 0xFF, 0xFF, 0xFF); - break; - case FIRE: - Minecraft.getMinecraft().effectRenderer.addEffect( - new EntityFlameFX(worldObj, posX + randOffsetX / 4, posY + 0.2F + randOffsetY / 4, posZ + randOffsetZ / 4, 0, 0, 0)); - break;*/ + /*case ORDER: + Thaumcraft.proxy.wispFX(worldObj, posX + randOffsetX / 4, posY + 0.2F + randOffsetY / 4, posZ + randOffsetZ / 4, 0.1F, 0xFF, 0xFF, 0xFF); + break; + case FIRE: + Minecraft.getMinecraft().effectRenderer.addEffect( + new EntityFlameFX(worldObj, posX + randOffsetX / 4, posY + 0.2F + randOffsetY / 4, posZ + randOffsetZ / 4, 0, 0, 0)); + break;*/ } } - } diff --git a/src/main/java/makeo/gadomancy/common/entities/EntityPermNoClipItem.java b/src/main/java/makeo/gadomancy/common/entities/EntityPermNoClipItem.java index a2052c5..90bb22b 100644 --- a/src/main/java/makeo/gadomancy/common/entities/EntityPermNoClipItem.java +++ b/src/main/java/makeo/gadomancy/common/entities/EntityPermNoClipItem.java @@ -20,15 +20,17 @@ import thaumcraft.common.entities.EntityPermanentItem; */ 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. + 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) { + 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; @@ -53,7 +55,8 @@ public class EntityPermNoClipItem extends EntityPermanentItem { this.getDataWatcher().addObjectByDataType(ModConfig.entityNoClipItemDatawatcherMasterId, 6); this.getDataWatcher().addObjectByDataType(ModConfig.entityNoClipItemDatawatcherFixedId, 6); - this.getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherMasterId, new ChunkCoordinates(0, 0, 0)); + this.getDataWatcher() + .updateObject(ModConfig.entityNoClipItemDatawatcherMasterId, new ChunkCoordinates(0, 0, 0)); this.getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedId, new ChunkCoordinates(0, 0, 0)); } @@ -64,33 +67,39 @@ public class EntityPermNoClipItem extends EntityPermanentItem { this.motionX = 0; this.motionY = 0; this.motionZ = 0; - if (this.getDataWatcher().getWatchedObject(ModConfig.entityNoClipItemDatawatcherFixedId).getObject() == null) - return; + if (this.getDataWatcher() + .getWatchedObject(ModConfig.entityNoClipItemDatawatcherFixedId) + .getObject() + == null) return; - if((this.ticksExisted & 1) == 0) { - ChunkCoordinates cc = (ChunkCoordinates) this.getDataWatcher().getWatchedObject(ModConfig.entityNoClipItemDatawatcherMasterId).getObject(); - if(cc == null) return; + if ((this.ticksExisted & 1) == 0) { + ChunkCoordinates cc = (ChunkCoordinates) this.getDataWatcher() + .getWatchedObject(ModConfig.entityNoClipItemDatawatcherMasterId) + .getObject(); + if (cc == null) return; TileEntity te = this.worldObj.getTileEntity(cc.posX, cc.posY, cc.posZ); if (te instanceof IItemMasterTile) { ((IItemMasterTile) te).informMaster(); ItemChangeTask task = ((IItemMasterTile) te).getAndRemoveScheduledChangeTask(); - if(task != null) { + if (task != null) { task.changeItem(this); } ((IItemMasterTile) te).broadcastItemStack(this.getEntityItem()); } } - ChunkCoordinates fixC = (ChunkCoordinates) this.getDataWatcher().getWatchedObject(ModConfig.entityNoClipItemDatawatcherFixedId).getObject(); + ChunkCoordinates fixC = (ChunkCoordinates) this.getDataWatcher() + .getWatchedObject(ModConfig.entityNoClipItemDatawatcherFixedId) + .getObject(); float fX = Float.intBitsToFloat(fixC.posX); float fY = Float.intBitsToFloat(fixC.posY); float fZ = Float.intBitsToFloat(fixC.posZ); this.setPositionAndRotation(fX, fY, fZ, 0, 0); - - if ((this.ticksExisted & 7) == 0 && !this.worldObj.isRemote) { - ChunkCoordinates masterCoords = (ChunkCoordinates) this.getDataWatcher().getWatchedObject(ModConfig.entityNoClipItemDatawatcherMasterId).getObject(); + ChunkCoordinates masterCoords = (ChunkCoordinates) this.getDataWatcher() + .getWatchedObject(ModConfig.entityNoClipItemDatawatcherMasterId) + .getObject(); TileEntity te = this.worldObj.getTileEntity(masterCoords.posX, masterCoords.posY, masterCoords.posZ); if (!(te instanceof IItemMasterTile) || !((IItemMasterTile) te).canStillHoldItem()) { EntityItem item = new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, this.getEntityItem()); @@ -102,12 +111,18 @@ public class EntityPermNoClipItem extends EntityPermanentItem { @Override public boolean attackEntityFrom(DamageSource ds, float p_70097_2_) { - if(ds.equals(DamageSource.inFire) || ds.equals(DamageSource.onFire)) return false; + if (ds.equals(DamageSource.inFire) || ds.equals(DamageSource.onFire)) return false; return super.attackEntityFrom(ds, p_70097_2_); } @Override - public void setPositionAndRotation2(double p_70056_1_, double p_70056_3_, double p_70056_5_, float p_70056_7_, float p_70056_8_, int p_70056_9_) { + public void setPositionAndRotation2( + double p_70056_1_, + double p_70056_3_, + double p_70056_5_, + float p_70056_7_, + float p_70056_8_, + int p_70056_9_) { this.setPosition(p_70056_1_, p_70056_3_, p_70056_5_); this.setRotation(p_70056_7_, p_70056_8_); } @@ -124,8 +139,14 @@ public class EntityPermNoClipItem extends EntityPermanentItem { this.masterY = com.getInteger("mY"); this.masterZ = com.getInteger("mZ"); - this.getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherMasterId, new ChunkCoordinates(this.masterX, this.masterY, this.masterZ)); - ChunkCoordinates cc = new ChunkCoordinates(Float.floatToIntBits(this.fixPosX), Float.floatToIntBits(this.fixPosY), Float.floatToIntBits(this.fixPosZ)); + this.getDataWatcher() + .updateObject( + ModConfig.entityNoClipItemDatawatcherMasterId, + new ChunkCoordinates(this.masterX, this.masterY, this.masterZ)); + ChunkCoordinates cc = new ChunkCoordinates( + Float.floatToIntBits(this.fixPosX), + Float.floatToIntBits(this.fixPosY), + Float.floatToIntBits(this.fixPosZ)); this.getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedId, cc); } @@ -153,13 +174,10 @@ public class EntityPermNoClipItem extends EntityPermanentItem { ItemChangeTask getAndRemoveScheduledChangeTask(); void broadcastItemStack(ItemStack itemStack); - } public abstract static class ItemChangeTask { public abstract void changeItem(EntityPermNoClipItem item); - } - } diff --git a/src/main/java/makeo/gadomancy/common/entities/ai/AIBreakBlock.java b/src/main/java/makeo/gadomancy/common/entities/ai/AIBreakBlock.java index 55a5c87..7f388ae 100644 --- a/src/main/java/makeo/gadomancy/common/entities/ai/AIBreakBlock.java +++ b/src/main/java/makeo/gadomancy/common/entities/ai/AIBreakBlock.java @@ -1,5 +1,9 @@ package makeo.gadomancy.common.entities.ai; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import makeo.gadomancy.common.entities.fake.AdvancedFakePlayer; import makeo.gadomancy.common.entities.fake.GolemFakePlayer; import net.minecraft.block.Block; @@ -18,11 +22,6 @@ import thaumcraft.common.entities.golems.EntityGolemBase; import thaumcraft.common.entities.golems.Marker; import thaumcraft.common.lib.utils.InventoryUtils; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -32,7 +31,7 @@ import java.util.Map; * Created by makeo @ 17.09.2015 20:22 */ public class AIBreakBlock extends EntityAIBase { - private static final int BLACKLIST_TICKS = 20*40; + private static final int BLACKLIST_TICKS = 20 * 40; private EntityGolemBase golem; private AdvancedFakePlayer player; @@ -61,7 +60,7 @@ public class AIBreakBlock extends EntityAIBase { this.currentMarker = this.getNextMarker(); - if(!this.hasValidTool()) { + if (!this.hasValidTool()) { return this.isInHomeRange(); } @@ -73,34 +72,46 @@ public class AIBreakBlock extends EntityAIBase { @Override public boolean continueExecuting() { - if(this.hasValidTool) { - if(!this.hasBlock(this.currentMarker)) { + if (this.hasValidTool) { + if (!this.hasBlock(this.currentMarker)) { return false; } - if(this.distanceSquaredToGolem(this.currentMarker) < 1) { - if(this.golem.getCarried() == null) { + if (this.distanceSquaredToGolem(this.currentMarker) < 1) { + if (this.golem.getCarried() == null) { this.golem.startActionTimer(); } else { this.golem.startRightArmTimer(); } - if(this.clickCount % (7 - Math.min(6, this.golem.getGolemStrength())) == 0) { + if (this.clickCount % (7 - Math.min(6, this.golem.getGolemStrength())) == 0) { this.doLeftClick(); } this.clickCount++; - - this.golem.getLookHelper().setLookPosition(this.currentMarker.x + 0.5D, this.currentMarker.y + 0.5D, this.currentMarker.z + 0.5D, 30.0F, 30.0F); + this.golem + .getLookHelper() + .setLookPosition( + this.currentMarker.x + 0.5D, + this.currentMarker.y + 0.5D, + this.currentMarker.z + 0.5D, + 30.0F, + 30.0F); this.count = 0; } else { - if(this.count == 20) { + if (this.count == 20) { this.count = 0; ForgeDirection dir = ForgeDirection.getOrientation(this.currentMarker.side); - boolean path = this.golem.getNavigator().tryMoveToXYZ(this.currentMarker.x + 0.5D + dir.offsetX, this.currentMarker.y + 0.5D + dir.offsetY, this.currentMarker.z + 0.5D + dir.offsetZ, this.golem.getAIMoveSpeed()); - if(!path) { + boolean path = this.golem + .getNavigator() + .tryMoveToXYZ( + this.currentMarker.x + 0.5D + dir.offsetX, + this.currentMarker.y + 0.5D + dir.offsetY, + this.currentMarker.z + 0.5D + dir.offsetZ, + this.golem.getAIMoveSpeed()); + if (!path) { if (this.blacklistCount > 10) { this.blacklist.put(this.currentMarker, this.golem.ticksExisted); return false; @@ -112,10 +123,10 @@ public class AIBreakBlock extends EntityAIBase { this.clickCount = 0; } } else { - if(this.golem.ticksExisted % Config.golemDelay > 0) { - if(this.isInHomeRange()) { + if (this.golem.ticksExisted % Config.golemDelay > 0) { + if (this.isInHomeRange()) { IInventory homeChest = this.getHomeChest(); - if(homeChest != null) { + if (homeChest != null) { this.trySwitchTool(homeChest); } } else { @@ -140,18 +151,27 @@ public class AIBreakBlock extends EntityAIBase { this.player.theItemInWorldManager.updateBlockRemoving(); - if (this.player.theItemInWorldManager.durabilityRemainingOnBlock == -1 || !this.player.theItemInWorldManager.isDestroyingBlock) - { - this.player.theItemInWorldManager.onBlockClicked(this.currentMarker.x, this.currentMarker.y, this.currentMarker.z, this.currentMarker.side); - } - else if (this.player.theItemInWorldManager.durabilityRemainingOnBlock >= 9) - { - this.player.theItemInWorldManager.uncheckedTryHarvestBlock(this.currentMarker.x, this.currentMarker.y, this.currentMarker.z); + if (this.player.theItemInWorldManager.durabilityRemainingOnBlock == -1 + || !this.player.theItemInWorldManager.isDestroyingBlock) { + this.player.theItemInWorldManager.onBlockClicked( + this.currentMarker.x, this.currentMarker.y, this.currentMarker.z, this.currentMarker.side); + } else if (this.player.theItemInWorldManager.durabilityRemainingOnBlock >= 9) { + this.player.theItemInWorldManager.uncheckedTryHarvestBlock( + this.currentMarker.x, this.currentMarker.y, this.currentMarker.z); this.player.theItemInWorldManager.durabilityRemainingOnBlock = -1; if (tool != null) { - Block block = this.golem.worldObj.getBlock(this.currentMarker.x, this.currentMarker.y, this.currentMarker.z); - tool.getItem().onBlockDestroyed(tool, this.golem.worldObj, block, this.currentMarker.x, this.currentMarker.y, this.currentMarker.z, this.player); + Block block = + this.golem.worldObj.getBlock(this.currentMarker.x, this.currentMarker.y, this.currentMarker.z); + tool.getItem() + .onBlockDestroyed( + tool, + this.golem.worldObj, + block, + this.currentMarker.x, + this.currentMarker.y, + this.currentMarker.z, + this.player); } } this.hasValidTool(); @@ -160,8 +180,11 @@ public class AIBreakBlock extends EntityAIBase { private void cancelLeftClick() { ItemInWorldManager manager = this.player.theItemInWorldManager; - if(manager.isDestroyingBlock) - this.player.theItemInWorldManager.cancelDestroyingBlock(manager.partiallyDestroyedBlockX, manager.partiallyDestroyedBlockY, manager.partiallyDestroyedBlockZ); + if (manager.isDestroyingBlock) + this.player.theItemInWorldManager.cancelDestroyingBlock( + manager.partiallyDestroyedBlockX, + manager.partiallyDestroyedBlockY, + manager.partiallyDestroyedBlockZ); } private Marker getNextMarker() { @@ -169,8 +192,8 @@ public class AIBreakBlock extends EntityAIBase { markers.sort(Comparator.comparingDouble(this::distanceSquaredToGolem)); - for(Marker marker : markers) { - if(this.isValid(marker)) { + for (Marker marker : markers) { + if (this.isValid(marker)) { return marker; } } @@ -183,8 +206,8 @@ public class AIBreakBlock extends EntityAIBase { private double distanceSquaredToGolem(double x, double y, double z, int facing) { ForgeDirection dir = ForgeDirection.getOrientation(facing); - return this.golem.getDistanceSq(x + 0.5 + (0.5*dir.offsetX), - y + 0.5 + (0.5*dir.offsetY), z + 0.5 + (0.5*dir.offsetZ)); + return this.golem.getDistanceSq( + x + 0.5 + (0.5 * dir.offsetX), y + 0.5 + (0.5 * dir.offsetY), z + 0.5 + (0.5 * dir.offsetZ)); } private boolean isInHomeRange() { @@ -197,10 +220,10 @@ public class AIBreakBlock extends EntityAIBase { } private boolean isValid(Marker marker) { - if(marker == null) return false; + if (marker == null) return false; - if(this.blacklist.containsKey(marker)) { - if(this.blacklist.get(marker) + AIBreakBlock.BLACKLIST_TICKS >= this.golem.ticksExisted) { + if (this.blacklist.containsKey(marker)) { + if (this.blacklist.get(marker) + AIBreakBlock.BLACKLIST_TICKS >= this.golem.ticksExisted) { return false; } else { this.blacklist.remove(marker); @@ -208,23 +231,27 @@ public class AIBreakBlock extends EntityAIBase { } float range = this.golem.getRange(); - if(this.golem.getHomePosition().getDistanceSquared(marker.x, marker.y, marker.z) > range * range) { + if (this.golem.getHomePosition().getDistanceSquared(marker.x, marker.y, marker.z) > range * range) { return false; } Block block = this.golem.worldObj.getBlock(marker.x, marker.y, marker.z); - if(!block.isAir(this.golem.worldObj, marker.x, marker.y, marker.z)) { + if (!block.isAir(this.golem.worldObj, marker.x, marker.y, marker.z)) { ItemStack blockStack = new ItemStack(Item.getItemFromBlock(block)); boolean empty = true; - for(int slot = 0; slot < this.golem.inventory.slotCount; slot++) { + for (int slot = 0; slot < this.golem.inventory.slotCount; slot++) { ItemStack stack = this.golem.inventory.inventory[slot]; - if(stack != null && Block.getBlockFromItem(stack.getItem()) != Blocks.air) { + if (stack != null && Block.getBlockFromItem(stack.getItem()) != Blocks.air) { empty = false; - if((marker.color == -1 || marker.color == this.golem.colors[slot]) - && InventoryUtils.areItemStacksEqual(blockStack, stack, - this.golem.checkOreDict(), this.golem.ignoreDamage(), this.golem.ignoreNBT())) { + if ((marker.color == -1 || marker.color == this.golem.colors[slot]) + && InventoryUtils.areItemStacksEqual( + blockStack, + stack, + this.golem.checkOreDict(), + this.golem.ignoreDamage(), + this.golem.ignoreNBT())) { return true; } } @@ -237,7 +264,8 @@ public class AIBreakBlock extends EntityAIBase { private IInventory getHomeChest() { ChunkCoordinates coords = this.golem.getHomePosition(); ForgeDirection facing = ForgeDirection.getOrientation(this.golem.homeFacing); - TileEntity tile = this.golem.worldObj.getTileEntity(coords.posX - facing.offsetX, coords.posY - facing.offsetY, coords.posZ - facing.offsetZ); + TileEntity tile = this.golem.worldObj.getTileEntity( + coords.posX - facing.offsetX, coords.posY - facing.offsetY, coords.posZ - facing.offsetZ); if (tile instanceof IInventory) { return (IInventory) tile; } @@ -245,30 +273,30 @@ public class AIBreakBlock extends EntityAIBase { } private void trySwitchTool(IInventory inv) { - for(int slot = 0; slot < inv.getSizeInventory(); slot++) { + for (int slot = 0; slot < inv.getSizeInventory(); slot++) { ItemStack stack = inv.getStackInSlot(slot); ItemStack current = this.golem.getCarried(); - if(current != null) { + if (current != null) { current = InventoryUtils.insertStack(inv, current, this.golem.homeFacing, true); - if(current != null) { + if (current != null) { return; } this.golem.setCarried(null); - if(this.hasValidTool()) { + if (this.hasValidTool()) { this.hasValidTool = true; return; } } - if(stack != null && this.isValidTool(stack)) { + if (stack != null && this.isValidTool(stack)) { stack = stack.copy(); stack.stackSize = 1; stack = InventoryUtils.extractStack(inv, stack, this.golem.homeFacing, false, false, false, true); - if(stack != null) { + if (stack != null) { this.golem.setCarried(stack); this.golem.updateCarried(); this.player.setHeldItem(stack); @@ -286,20 +314,28 @@ public class AIBreakBlock extends EntityAIBase { } private boolean isValidTool(ItemStack tool) { - if(tool == null || Block.getBlockFromItem(tool.getItem()) == Blocks.air) { + if (tool == null || Block.getBlockFromItem(tool.getItem()) == Blocks.air) { boolean empty = true; - for(int slot = 0; slot < this.golem.inventory.slotCount; slot++) { + for (int slot = 0; slot < this.golem.inventory.slotCount; slot++) { ItemStack stack = this.golem.inventory.inventory[slot]; - if(stack != null && Block.getBlockFromItem(stack.getItem()) == Blocks.air - && (this.currentMarker == null || this.golem.colors[slot] == -1 || this.currentMarker.color == -1 || this.golem.colors[slot] == this.currentMarker.color)) { + if (stack != null + && Block.getBlockFromItem(stack.getItem()) == Blocks.air + && (this.currentMarker == null + || this.golem.colors[slot] == -1 + || this.currentMarker.color == -1 + || this.golem.colors[slot] == this.currentMarker.color)) { empty = false; - if(tool == null) { + if (tool == null) { return false; } - if(InventoryUtils.areItemStacksEqual(tool, stack, - this.golem.checkOreDict(), this.golem.ignoreDamage(), this.golem.ignoreNBT())) { + if (InventoryUtils.areItemStacksEqual( + tool, + stack, + this.golem.checkOreDict(), + this.golem.ignoreDamage(), + this.golem.ignoreNBT())) { return true; } } diff --git a/src/main/java/makeo/gadomancy/common/entities/ai/AIUncheckedAttackOnCollide.java b/src/main/java/makeo/gadomancy/common/entities/ai/AIUncheckedAttackOnCollide.java index da78dc8..ac5e655 100644 --- a/src/main/java/makeo/gadomancy/common/entities/ai/AIUncheckedAttackOnCollide.java +++ b/src/main/java/makeo/gadomancy/common/entities/ai/AIUncheckedAttackOnCollide.java @@ -31,7 +31,7 @@ public class AIUncheckedAttackOnCollide extends AIGolemAttackOnCollide { } PathEntity pathEntity = this.golem.getNavigator().getPathToEntityLiving(target); - if(pathEntity != null) { + if (pathEntity != null) { AIUncheckedAttackOnCollide.INJECTOR.setObject(this); AIUncheckedAttackOnCollide.INJECTOR.setField("entityPathEntity", pathEntity); AIUncheckedAttackOnCollide.INJECTOR.setField("entityTarget", target); diff --git a/src/main/java/makeo/gadomancy/common/entities/ai/AIUncheckedDartAttack.java b/src/main/java/makeo/gadomancy/common/entities/ai/AIUncheckedDartAttack.java index 72b44b9..27c9ce8 100644 --- a/src/main/java/makeo/gadomancy/common/entities/ai/AIUncheckedDartAttack.java +++ b/src/main/java/makeo/gadomancy/common/entities/ai/AIUncheckedDartAttack.java @@ -38,6 +38,5 @@ public class AIUncheckedDartAttack extends AIDartAttack { AIUncheckedDartAttack.INJECTOR.setField("attackTarget", target); return true; - } } diff --git a/src/main/java/makeo/gadomancy/common/entities/fake/AdvancedFakePlayer.java b/src/main/java/makeo/gadomancy/common/entities/fake/AdvancedFakePlayer.java index 30ae81f..1c517a5 100644 --- a/src/main/java/makeo/gadomancy/common/entities/fake/AdvancedFakePlayer.java +++ b/src/main/java/makeo/gadomancy/common/entities/fake/AdvancedFakePlayer.java @@ -1,6 +1,7 @@ package makeo.gadomancy.common.entities.fake; import com.mojang.authlib.GameProfile; +import java.util.UUID; import makeo.gadomancy.common.Gadomancy; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -9,8 +10,6 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.world.WorldServer; import net.minecraftforge.common.util.FakePlayer; -import java.util.UUID; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -42,15 +41,19 @@ public class AdvancedFakePlayer extends FakePlayer { } public static boolean isFakePlayer(EntityPlayer player) { - if(!player.worldObj.isRemote) { - if(player.getClass() != EntityPlayerMP.class) { + if (!player.worldObj.isRemote) { + if (player.getClass() != EntityPlayerMP.class) { return true; } EntityPlayerMP mp = (EntityPlayerMP) player; - if(mp.playerNetServerHandler == null - || !MinecraftServer.getServer().getConfigurationManager().playerEntityList.contains(player) - || mp.getPlayerIP() == null || mp.getPlayerIP().trim().isEmpty()) { + if (mp.playerNetServerHandler == null + || !MinecraftServer.getServer() + .getConfigurationManager() + .playerEntityList + .contains(player) + || mp.getPlayerIP() == null + || mp.getPlayerIP().trim().isEmpty()) { return true; } diff --git a/src/main/java/makeo/gadomancy/common/entities/fake/FakeNetServerHandler.java b/src/main/java/makeo/gadomancy/common/entities/fake/FakeNetServerHandler.java index 51f9706..1cd7e1c 100644 --- a/src/main/java/makeo/gadomancy/common/entities/fake/FakeNetServerHandler.java +++ b/src/main/java/makeo/gadomancy/common/entities/fake/FakeNetServerHandler.java @@ -3,15 +3,14 @@ package makeo.gadomancy.common.entities.fake; import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.util.concurrent.GenericFutureListener; +import java.net.SocketAddress; +import javax.crypto.SecretKey; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.*; import net.minecraft.network.play.client.*; import net.minecraft.server.MinecraftServer; import net.minecraft.util.IChatComponent; -import javax.crypto.SecretKey; -import java.net.SocketAddress; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -26,112 +25,86 @@ public class FakeNetServerHandler extends NetHandlerPlayServer { } @Override - public void onNetworkTick() { - } + public void onNetworkTick() {} @Override - public void setPlayerLocation(double p_147364_1_, double p_147364_3_, double p_147364_5_, float p_147364_7_, float p_147364_8_) { - } + public void setPlayerLocation( + double p_147364_1_, double p_147364_3_, double p_147364_5_, float p_147364_7_, float p_147364_8_) {} @Override - public void onDisconnect(IChatComponent p_147231_1_) { - } + public void onDisconnect(IChatComponent p_147231_1_) {} @Override - public void onConnectionStateTransition(EnumConnectionState p_147232_1_, EnumConnectionState p_147232_2_) { - } + public void onConnectionStateTransition(EnumConnectionState p_147232_1_, EnumConnectionState p_147232_2_) {} @Override - public void kickPlayerFromServer(String p_147360_1_) { - } + public void kickPlayerFromServer(String p_147360_1_) {} @Override - public void sendPacket(Packet p_147359_1_) { - } + public void sendPacket(Packet p_147359_1_) {} @Override - public void processInput(C0CPacketInput p_147358_1_) { - } + public void processInput(C0CPacketInput p_147358_1_) {} @Override - public void processPlayer(C03PacketPlayer p_147347_1_) { - } + public void processPlayer(C03PacketPlayer p_147347_1_) {} @Override - public void processPlayerDigging(C07PacketPlayerDigging p_147345_1_) { - } + public void processPlayerDigging(C07PacketPlayerDigging p_147345_1_) {} @Override - public void processPlayerBlockPlacement(C08PacketPlayerBlockPlacement p_147346_1_) { - } + public void processPlayerBlockPlacement(C08PacketPlayerBlockPlacement p_147346_1_) {} @Override - public void processVanilla250Packet(C17PacketCustomPayload p_147349_1_) { - } + public void processVanilla250Packet(C17PacketCustomPayload p_147349_1_) {} @Override - public void processClientSettings(C15PacketClientSettings p_147352_1_) { - } + public void processClientSettings(C15PacketClientSettings p_147352_1_) {} @Override - public void processTabComplete(C14PacketTabComplete p_147341_1_) { - } + public void processTabComplete(C14PacketTabComplete p_147341_1_) {} @Override - public void processPlayerAbilities(C13PacketPlayerAbilities p_147348_1_) { - } + public void processPlayerAbilities(C13PacketPlayerAbilities p_147348_1_) {} @Override - public void processKeepAlive(C00PacketKeepAlive p_147353_1_) { - } + public void processKeepAlive(C00PacketKeepAlive p_147353_1_) {} @Override - public void processUpdateSign(C12PacketUpdateSign p_147343_1_) { - } + public void processUpdateSign(C12PacketUpdateSign p_147343_1_) {} @Override - public void processConfirmTransaction(C0FPacketConfirmTransaction p_147339_1_) { - } + public void processConfirmTransaction(C0FPacketConfirmTransaction p_147339_1_) {} @Override - public void processCreativeInventoryAction(C10PacketCreativeInventoryAction p_147344_1_) { - } + public void processCreativeInventoryAction(C10PacketCreativeInventoryAction p_147344_1_) {} @Override - public void processEnchantItem(C11PacketEnchantItem p_147338_1_) { - } + public void processEnchantItem(C11PacketEnchantItem p_147338_1_) {} @Override - public void processClickWindow(C0EPacketClickWindow p_147351_1_) { - } + public void processClickWindow(C0EPacketClickWindow p_147351_1_) {} @Override - public void processCloseWindow(C0DPacketCloseWindow p_147356_1_) { - } + public void processCloseWindow(C0DPacketCloseWindow p_147356_1_) {} @Override - public void processClientStatus(C16PacketClientStatus p_147342_1_) { - } + public void processClientStatus(C16PacketClientStatus p_147342_1_) {} @Override - public void processUseEntity(C02PacketUseEntity p_147340_1_) { - } + public void processUseEntity(C02PacketUseEntity p_147340_1_) {} @Override - public void processEntityAction(C0BPacketEntityAction p_147357_1_) { - } + public void processEntityAction(C0BPacketEntityAction p_147357_1_) {} @Override - public void processAnimation(C0APacketAnimation p_147350_1_) { - } + public void processAnimation(C0APacketAnimation p_147350_1_) {} @Override - public void processChatMessage(C01PacketChatMessage p_147354_1_) { - } + public void processChatMessage(C01PacketChatMessage p_147354_1_) {} @Override - public void processHeldItemChange(C09PacketHeldItemChange p_147355_1_) { - } + public void processHeldItemChange(C09PacketHeldItemChange p_147355_1_) {} private static class NetworkManagerFake extends NetworkManager { public NetworkManagerFake() { @@ -139,36 +112,28 @@ public class FakeNetServerHandler extends NetHandlerPlayServer { } @Override - public void channelActive(ChannelHandlerContext p_channelActive_1_) throws Exception { - } + public void channelActive(ChannelHandlerContext p_channelActive_1_) throws Exception {} @Override - public void setConnectionState(EnumConnectionState p_150723_1_) { - } + public void setConnectionState(EnumConnectionState p_150723_1_) {} @Override - public void channelInactive(ChannelHandlerContext p_channelInactive_1_) { - } + public void channelInactive(ChannelHandlerContext p_channelInactive_1_) {} @Override - public void exceptionCaught(ChannelHandlerContext p_exceptionCaught_1_, Throwable p_exceptionCaught_2_) { - } + public void exceptionCaught(ChannelHandlerContext p_exceptionCaught_1_, Throwable p_exceptionCaught_2_) {} @Override - protected void channelRead0(ChannelHandlerContext p_channelRead0_1_, Packet p_channelRead0_2_) { - } + protected void channelRead0(ChannelHandlerContext p_channelRead0_1_, Packet p_channelRead0_2_) {} @Override - public void setNetHandler(INetHandler p_150719_1_) { - } + public void setNetHandler(INetHandler p_150719_1_) {} @Override - public void scheduleOutboundPacket(Packet p_150725_1_, GenericFutureListener... p_150725_2_) { - } + public void scheduleOutboundPacket(Packet p_150725_1_, GenericFutureListener... p_150725_2_) {} @Override - public void processReceivedPackets() { - } + public void processReceivedPackets() {} @Override public SocketAddress getSocketAddress() { @@ -176,8 +141,7 @@ public class FakeNetServerHandler extends NetHandlerPlayServer { } @Override - public void closeChannel(IChatComponent p_150718_1_) { - } + public void closeChannel(IChatComponent p_150718_1_) {} @Override public boolean isLocalChannel() { @@ -185,8 +149,7 @@ public class FakeNetServerHandler extends NetHandlerPlayServer { } @Override - public void enableEncryption(SecretKey p_150727_1_) { - } + public void enableEncryption(SecretKey p_150727_1_) {} @Override public boolean isChannelOpen() { @@ -204,12 +167,10 @@ public class FakeNetServerHandler extends NetHandlerPlayServer { } @Override - public void disableAutoRead() { - } + public void disableAutoRead() {} @Override - protected void channelRead0(ChannelHandlerContext p_channelRead0_1_, Object p_channelRead0_2_) { - } + protected void channelRead0(ChannelHandlerContext p_channelRead0_1_, Object p_channelRead0_2_) {} @Override public Channel channel() { diff --git a/src/main/java/makeo/gadomancy/common/entities/fake/GolemFakePlayer.java b/src/main/java/makeo/gadomancy/common/entities/fake/GolemFakePlayer.java index 689f3c7..b2fe7cf 100644 --- a/src/main/java/makeo/gadomancy/common/entities/fake/GolemFakePlayer.java +++ b/src/main/java/makeo/gadomancy/common/entities/fake/GolemFakePlayer.java @@ -1,14 +1,13 @@ package makeo.gadomancy.common.entities.fake; +import java.util.Collection; +import java.util.UUID; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.WorldServer; import thaumcraft.common.entities.golems.EntityGolemBase; -import java.util.Collection; -import java.util.UUID; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -81,6 +80,5 @@ public class GolemFakePlayer extends AdvancedFakePlayer { } @Override - protected void updatePotionEffects() { - } + protected void updatePotionEffects() {} } diff --git a/src/main/java/makeo/gadomancy/common/entities/golems/ItemAdditionalGolemPlacer.java b/src/main/java/makeo/gadomancy/common/entities/golems/ItemAdditionalGolemPlacer.java index 01f6295..59b2b59 100644 --- a/src/main/java/makeo/gadomancy/common/entities/golems/ItemAdditionalGolemPlacer.java +++ b/src/main/java/makeo/gadomancy/common/entities/golems/ItemAdditionalGolemPlacer.java @@ -2,6 +2,7 @@ package makeo.gadomancy.common.entities.golems; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import makeo.gadomancy.api.golems.AdditionalGolemType; import makeo.gadomancy.common.registration.RegisteredItems; import net.minecraft.client.renderer.texture.IIconRegister; @@ -13,8 +14,6 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; import thaumcraft.common.entities.golems.ItemGolemPlacer; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -46,12 +45,13 @@ public class ItemAdditionalGolemPlacer extends Item { @Override public void getSubItems(Item item, CreativeTabs tab, List list) { - list.add(new ItemStack(this.type.getPlacerItem(), 1, this.type.getEnumEntry().ordinal())); + list.add(new ItemStack( + this.type.getPlacerItem(), 1, this.type.getEnumEntry().ordinal())); } public IIcon getIcon(ItemStack stack, int pass) { int typePasses = this.type.getRenderPasses(); - if(pass < typePasses) { + if (pass < typePasses) { return this.type.getIcon(stack, pass); } return this.placer.getIcon(stack, pass - typePasses + 1); @@ -95,7 +95,17 @@ public class ItemAdditionalGolemPlacer extends Item { } @Override - public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { + public boolean onItemUseFirst( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float hitX, + float hitY, + float hitZ) { return this.placer.onItemUseFirst(stack, player, world, x, y, z, side, hitX, hitY, hitZ); } -} \ No newline at end of file +} diff --git a/src/main/java/makeo/gadomancy/common/entities/golems/cores/BodyguardGolemCore.java b/src/main/java/makeo/gadomancy/common/entities/golems/cores/BodyguardGolemCore.java index 572d897..4a9910d 100644 --- a/src/main/java/makeo/gadomancy/common/entities/golems/cores/BodyguardGolemCore.java +++ b/src/main/java/makeo/gadomancy/common/entities/golems/cores/BodyguardGolemCore.java @@ -1,5 +1,7 @@ package makeo.gadomancy.common.entities.golems.cores; +import java.util.ArrayList; +import java.util.Random; import makeo.gadomancy.api.golems.cores.AdditionalGolemCore; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.entities.ai.AIFollowOwner; @@ -22,9 +24,6 @@ import thaumcraft.common.entities.ai.misc.AIOpenDoor; import thaumcraft.common.entities.golems.EntityGolemBase; import thaumcraft.common.entities.golems.Marker; -import java.util.ArrayList; -import java.util.Random; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -104,7 +103,7 @@ public class BodyguardGolemCore extends AdditionalGolemCore { @Override public IAttributeInstance getEntityAttribute(IAttribute p_110148_1_) { - if(this.golem != null) { + if (this.golem != null) { return this.golem.getEntityAttribute(p_110148_1_); } return super.getEntityAttribute(p_110148_1_); diff --git a/src/main/java/makeo/gadomancy/common/entities/golems/cores/EntityAITasksWrapper.java b/src/main/java/makeo/gadomancy/common/entities/golems/cores/EntityAITasksWrapper.java index 5147d09..6736d45 100644 --- a/src/main/java/makeo/gadomancy/common/entities/golems/cores/EntityAITasksWrapper.java +++ b/src/main/java/makeo/gadomancy/common/entities/golems/cores/EntityAITasksWrapper.java @@ -1,5 +1,7 @@ package makeo.gadomancy.common.entities.golems.cores; +import java.util.ArrayList; +import java.util.Collection; import makeo.gadomancy.api.GadomancyApi; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.entities.golems.nbt.ExtendedGolemProperties; @@ -7,9 +9,6 @@ import net.minecraft.entity.ai.EntityAIBase; import net.minecraft.entity.ai.EntityAITasks; import thaumcraft.common.entities.golems.EntityGolemBase; -import java.util.ArrayList; -import java.util.Collection; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -44,10 +43,11 @@ public class EntityAITasksWrapper extends EntityAITasks { @Override public void clear() { - if(!EntityAITasksWrapper.this.isLocked()) { + if (!EntityAITasksWrapper.this.isLocked()) { super.clear(); - } else if(EntityAITasksWrapper.this.scheduleUpdate) { - ((ExtendedGolemProperties) EntityAITasksWrapper.this.golem.getExtendedProperties(Gadomancy.MODID)).updateGolem(); + } else if (EntityAITasksWrapper.this.scheduleUpdate) { + ((ExtendedGolemProperties) EntityAITasksWrapper.this.golem.getExtendedProperties(Gadomancy.MODID)) + .updateGolem(); } } } @@ -66,7 +66,7 @@ public class EntityAITasksWrapper extends EntityAITasks { @Override public void addTask(int index, EntityAIBase ai) { - if(!this.isLocked()) { + if (!this.isLocked()) { this.original.addTask(index, ai); } } diff --git a/src/main/java/makeo/gadomancy/common/entities/golems/nbt/ExtendedGolemProperties.java b/src/main/java/makeo/gadomancy/common/entities/golems/nbt/ExtendedGolemProperties.java index dc3b927..615a148 100644 --- a/src/main/java/makeo/gadomancy/common/entities/golems/nbt/ExtendedGolemProperties.java +++ b/src/main/java/makeo/gadomancy/common/entities/golems/nbt/ExtendedGolemProperties.java @@ -62,9 +62,9 @@ public class ExtendedGolemProperties implements IExtendedEntityProperties { @Override public void saveNBTData(NBTTagCompound compound) { AdditionalGolemType type = GadomancyApi.getAdditionalGolemType(this.golem.getGolemType()); - if(type != null) { + if (type != null) { NBTTagCompound entityData; - if(compound.hasKey(ExtendedGolemProperties.FORGE_TAG)) { + if (compound.hasKey(ExtendedGolemProperties.FORGE_TAG)) { entityData = compound.getCompoundTag(ExtendedGolemProperties.FORGE_TAG); } else { entityData = new NBTTagCompound(); @@ -80,7 +80,7 @@ public class ExtendedGolemProperties implements IExtendedEntityProperties { private static void writeAdvancedGolemType(NBTTagCompound base, AdditionalGolemType type) { NBTTagCompound compound; - if(base.hasKey(Gadomancy.MODID)) { + if (base.hasKey(Gadomancy.MODID)) { compound = base.getCompoundTag(Gadomancy.MODID); } else { compound = new NBTTagCompound(); @@ -91,11 +91,12 @@ public class ExtendedGolemProperties implements IExtendedEntityProperties { @Override public void loadNBTData(NBTTagCompound compound) { - if(compound.hasKey("GolemType")) { + if (compound.hasKey("GolemType")) { AdditionalGolemType type = ExtendedGolemProperties.readAdvancedGolemType(this.golem.getEntityData()); - if(type != null) { + if (type != null) { byte lastType = compound.getByte("GolemType"); - compound.setTag("GolemType", new OverrideNBTTagByte(lastType, (byte)type.getEnumEntry().ordinal())); + compound.setTag("GolemType", new OverrideNBTTagByte(lastType, (byte) + type.getEnumEntry().ordinal())); this.health = compound.getFloat("HealF") * -1; this.updateHealth = true; @@ -108,12 +109,12 @@ public class ExtendedGolemProperties implements IExtendedEntityProperties { } public void updateGolemCore() { - if(!this.golem.worldObj.isRemote) { - if(NBTHelper.hasPersistentData(this.golem)) { + if (!this.golem.worldObj.isRemote) { + if (NBTHelper.hasPersistentData(this.golem)) { NBTTagCompound persistent = NBTHelper.getPersistentData(this.golem); - if(persistent.hasKey("Core")) { - for(AdditionalGolemCore core : GadomancyApi.getAdditionalGolemCores()) { - if(core.getName().equals(persistent.getString("Core"))) { + if (persistent.hasKey("Core")) { + for (AdditionalGolemCore core : GadomancyApi.getAdditionalGolemCores()) { + if (core.getName().equals(persistent.getString("Core"))) { this.golem.getDataWatcher().updateObject(ModConfig.golemDatawatcherId, core.getName()); break; } @@ -125,21 +126,21 @@ public class ExtendedGolemProperties implements IExtendedEntityProperties { public void setWrapperIfNeeded() { boolean needsUpdate = false; - if(this.taskWrapper == null) { + if (this.taskWrapper == null) { this.taskWrapper = new EntityAITasksWrapper(this.golem, this.golem.tasks, true); this.golem.tasks = this.taskWrapper; needsUpdate = true; } - if(this.targetWrapper == null) { + if (this.targetWrapper == null) { this.targetWrapper = new EntityAITasksWrapper(this.golem, this.golem.targetTasks, false); this.golem.targetTasks = this.targetWrapper; needsUpdate = true; } - if(needsUpdate) { + if (needsUpdate) { this.updateGolem(); } } @@ -152,7 +153,7 @@ public class ExtendedGolemProperties implements IExtendedEntityProperties { this.golem.setupGolemInventory(); AdditionalGolemCore core = GadomancyApi.getAdditionalGolemCore(this.golem); - if(core != null) { + if (core != null) { this.taskWrapper.taskEntries.clear(); this.targetWrapper.taskEntries.clear(); @@ -164,9 +165,9 @@ public class ExtendedGolemProperties implements IExtendedEntityProperties { } private static AdditionalGolemType readAdvancedGolemType(NBTTagCompound base) { - if(base.hasKey(Gadomancy.MODID)) { + if (base.hasKey(Gadomancy.MODID)) { NBTTagCompound compound = base.getCompoundTag(Gadomancy.MODID); - if(compound.hasKey(ExtendedGolemProperties.TYPE_TAG)) { + if (compound.hasKey(ExtendedGolemProperties.TYPE_TAG)) { return GadomancyApi.getAdditionalGolemType(compound.getString(ExtendedGolemProperties.TYPE_TAG)); } } @@ -174,7 +175,5 @@ public class ExtendedGolemProperties implements IExtendedEntityProperties { } @Override - public void init(Entity entity, World world) { - - } + public void init(Entity entity, World world) {} } diff --git a/src/main/java/makeo/gadomancy/common/entities/golems/nbt/OverrideNBTTagByte.java b/src/main/java/makeo/gadomancy/common/entities/golems/nbt/OverrideNBTTagByte.java index a0d1d67..56e5044 100644 --- a/src/main/java/makeo/gadomancy/common/entities/golems/nbt/OverrideNBTTagByte.java +++ b/src/main/java/makeo/gadomancy/common/entities/golems/nbt/OverrideNBTTagByte.java @@ -14,7 +14,6 @@ public class OverrideNBTTagByte extends NBTTagByte { private boolean override = true; private byte overrideData; - public OverrideNBTTagByte(byte data, byte overrideData) { super(data); this.overrideData = overrideData; @@ -22,7 +21,7 @@ public class OverrideNBTTagByte extends NBTTagByte { @Override public byte func_150290_f() { - if(this.override) { + if (this.override) { this.override = false; return this.overrideData; } diff --git a/src/main/java/makeo/gadomancy/common/entities/golems/nbt/OverrideRidingEntity.java b/src/main/java/makeo/gadomancy/common/entities/golems/nbt/OverrideRidingEntity.java index 4436abf..e6e98bd 100644 --- a/src/main/java/makeo/gadomancy/common/entities/golems/nbt/OverrideRidingEntity.java +++ b/src/main/java/makeo/gadomancy/common/entities/golems/nbt/OverrideRidingEntity.java @@ -35,7 +35,7 @@ public class OverrideRidingEntity extends Entity { this.compound.setByte("GolemType", (byte) OverrideRidingEntity.DEFAULT_TYPE.ordinal()); boolean result = false; - if(this.ridingEntity != null) { + if (this.ridingEntity != null) { result = this.ridingEntity.writeMountToNBT(compound); } @@ -44,17 +44,11 @@ public class OverrideRidingEntity extends Entity { } @Override - protected void entityInit() { - - } + protected void entityInit() {} @Override - protected void readEntityFromNBT(NBTTagCompound p_70037_1_) { - - } + protected void readEntityFromNBT(NBTTagCompound p_70037_1_) {} @Override - protected void writeEntityToNBT(NBTTagCompound p_70014_1_) { - - } + protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {} } diff --git a/src/main/java/makeo/gadomancy/common/entities/golems/types/ObsidianGolemType.java b/src/main/java/makeo/gadomancy/common/entities/golems/types/ObsidianGolemType.java index 07e4ea1..8d550ad 100644 --- a/src/main/java/makeo/gadomancy/common/entities/golems/types/ObsidianGolemType.java +++ b/src/main/java/makeo/gadomancy/common/entities/golems/types/ObsidianGolemType.java @@ -27,6 +27,7 @@ public class ObsidianGolemType extends AdditionalGolemType { } private IIcon icon; + @Override public void registerIcons(IIconRegister ir) { this.icon = ir.registerIcon(Gadomancy.MODID + ":golem_obsidian"); diff --git a/src/main/java/makeo/gadomancy/common/entities/golems/types/RemovedGolemType.java b/src/main/java/makeo/gadomancy/common/entities/golems/types/RemovedGolemType.java index 4f392cb..833923a 100644 --- a/src/main/java/makeo/gadomancy/common/entities/golems/types/RemovedGolemType.java +++ b/src/main/java/makeo/gadomancy/common/entities/golems/types/RemovedGolemType.java @@ -25,6 +25,7 @@ public class RemovedGolemType extends AdditionalGolemType { } private IIcon icon; + @Override public void registerIcons(IIconRegister ir) { this.icon = ir.registerIcon(""); diff --git a/src/main/java/makeo/gadomancy/common/entities/golems/types/SilverwoodGolemType.java b/src/main/java/makeo/gadomancy/common/entities/golems/types/SilverwoodGolemType.java index 5990b94..94aa14c 100644 --- a/src/main/java/makeo/gadomancy/common/entities/golems/types/SilverwoodGolemType.java +++ b/src/main/java/makeo/gadomancy/common/entities/golems/types/SilverwoodGolemType.java @@ -27,6 +27,7 @@ public class SilverwoodGolemType extends AdditionalGolemType { } private IIcon icon; + @Override public void registerIcons(IIconRegister ir) { this.icon = ir.registerIcon(Gadomancy.MODID + ":golem_silverwood"); diff --git a/src/main/java/makeo/gadomancy/common/entities/golems/upgrades/GolemUpgrade.java b/src/main/java/makeo/gadomancy/common/entities/golems/upgrades/GolemUpgrade.java index 6e893fa..d8ccccc 100644 --- a/src/main/java/makeo/gadomancy/common/entities/golems/upgrades/GolemUpgrade.java +++ b/src/main/java/makeo/gadomancy/common/entities/golems/upgrades/GolemUpgrade.java @@ -46,11 +46,12 @@ public abstract class GolemUpgrade { } protected T getUpgradeData(NBTTagCompound compound) { - if(compound.hasKey(GolemUpgrade.UPGRADE_COMPOUND)) { + if (compound.hasKey(GolemUpgrade.UPGRADE_COMPOUND)) { NBTTagCompound upgrades = compound.getCompoundTag(GolemUpgrade.UPGRADE_COMPOUND); try { return (T) upgrades.getTag(this.getTagName()); - } catch (ClassCastException ignored) {} + } catch (ClassCastException ignored) { + } } return null; } @@ -77,12 +78,12 @@ public abstract class GolemUpgrade { protected void addUpgrade(NBTTagCompound compound) { NBTTagCompound upgrades = compound.getCompoundTag(GolemUpgrade.UPGRADE_COMPOUND); - if(!compound.hasKey(GolemUpgrade.UPGRADE_COMPOUND)) { + if (!compound.hasKey(GolemUpgrade.UPGRADE_COMPOUND)) { compound.setTag(GolemUpgrade.UPGRADE_COMPOUND, upgrades); } NBTBase data = this.createUpgradeData(); - upgrades.setTag(this.getTagName(), data == null ? new NBTTagByte((byte)1) : data); + upgrades.setTag(this.getTagName(), data == null ? new NBTTagByte((byte) 1) : data); } public void removeUpgrade(ItemStack stack) { @@ -94,7 +95,7 @@ public abstract class GolemUpgrade { } protected void removeUpgrade(NBTTagCompound compound) { - if(compound.hasKey(GolemUpgrade.UPGRADE_COMPOUND)) { + if (compound.hasKey(GolemUpgrade.UPGRADE_COMPOUND)) { compound.removeTag(this.getTagName()); } } diff --git a/src/main/java/makeo/gadomancy/common/entities/golems/upgrades/GolemUpgradeRunicShield.java b/src/main/java/makeo/gadomancy/common/entities/golems/upgrades/GolemUpgradeRunicShield.java index c647b46..a0ce141 100644 --- a/src/main/java/makeo/gadomancy/common/entities/golems/upgrades/GolemUpgradeRunicShield.java +++ b/src/main/java/makeo/gadomancy/common/entities/golems/upgrades/GolemUpgradeRunicShield.java @@ -29,17 +29,17 @@ public class GolemUpgradeRunicShield extends GolemUpgrade { public float absorb(EntityGolemBase golem, float amount, DamageSource source) { float charge = this.getCharge(golem); - if(Math.floor(charge) > 0) { + if (Math.floor(charge) > 0) { this.sendShieldEffect(golem, source); - float rest = (float)(Math.floor(charge) - amount); - float chargeRest = charge - (float)Math.floor(charge); + float rest = (float) (Math.floor(charge) - amount); + float chargeRest = charge - (float) Math.floor(charge); - if(rest <= 0) { + if (rest <= 0) { this.setCharge(golem, chargeRest); return rest * -1; } else { - this.setCharge(golem, (float)Math.floor(rest) + chargeRest); + this.setCharge(golem, (float) Math.floor(rest) + chargeRest); return 0; } } @@ -56,8 +56,10 @@ public class GolemUpgradeRunicShield extends GolemUpgrade { target = -3; } - PacketHandler.INSTANCE.sendToAllAround(new PacketFXShield(golem.getEntityId(), target), - new NetworkRegistry.TargetPoint(golem.worldObj.provider.dimensionId, golem.posX, golem.posY, golem.posZ, 64.0D)); + PacketHandler.INSTANCE.sendToAllAround( + new PacketFXShield(golem.getEntityId(), target), + new NetworkRegistry.TargetPoint( + golem.worldObj.provider.dimensionId, golem.posX, golem.posY, golem.posZ, 64.0D)); } public float getCharge(EntityGolemBase golem) { @@ -78,7 +80,7 @@ public class GolemUpgradeRunicShield extends GolemUpgrade { private int getLastDischarge(EntityGolemBase golem) { NBTTagCompound compound = golem.getEntityData(); - if(!compound.hasKey(GolemUpgradeRunicShield.LAST_DISCHARGE_TAG)) { + if (!compound.hasKey(GolemUpgradeRunicShield.LAST_DISCHARGE_TAG)) { compound.setInteger(GolemUpgradeRunicShield.LAST_DISCHARGE_TAG, golem.ticksExisted); return golem.ticksExisted; } @@ -96,7 +98,8 @@ public class GolemUpgradeRunicShield extends GolemUpgrade { public int getChargeLimit(ItemStack stack) { EnumGolemType type = EnumGolemType.getType(stack.getItemDamage()); float maxHealth = type.health; - if(stack.hasTagCompound() && stack.getTagCompound().hasKey("deco") + if (stack.hasTagCompound() + && stack.getTagCompound().hasKey("deco") && stack.getTagCompound().getString("deco").contains("H")) { maxHealth += 5; } @@ -104,9 +107,9 @@ public class GolemUpgradeRunicShield extends GolemUpgrade { } private int getChargeLimit(EnumGolemType type, float maxHealth) { - if(type == RegisteredGolemStuff.typeSilverwood.getEnumEntry()) { - return (int)maxHealth; + if (type == RegisteredGolemStuff.typeSilverwood.getEnumEntry()) { + return (int) maxHealth; } - return (int)(maxHealth / 2.6); + return (int) (maxHealth / 2.6); } } diff --git a/src/main/java/makeo/gadomancy/common/entities/player/ExtendedPlayerProperties.java b/src/main/java/makeo/gadomancy/common/entities/player/ExtendedPlayerProperties.java index c3b87b4..53ab00f 100644 --- a/src/main/java/makeo/gadomancy/common/entities/player/ExtendedPlayerProperties.java +++ b/src/main/java/makeo/gadomancy/common/entities/player/ExtendedPlayerProperties.java @@ -39,7 +39,8 @@ public class ExtendedPlayerProperties implements IExtendedEntityProperties { public void loadNBTData(NBTTagCompound compound) { NBTTagCompound modData = NBTHelper.getPersistentData(compound); - this.isTransformed = NBTHelper.getBoolean(modData, "isTransformed", ExtendedPlayerProperties.DEFAULTS.isTransformed); + this.isTransformed = + NBTHelper.getBoolean(modData, "isTransformed", ExtendedPlayerProperties.DEFAULTS.isTransformed); this.player.getDataWatcher().updateObject(ExtendedPlayerProperties.TRANSFORM_INDEX, this.isTransformed); } @@ -50,7 +51,6 @@ public class ExtendedPlayerProperties implements IExtendedEntityProperties { public static boolean isTransformed(EntityPlayer player) { return false; - } public void setTransformed(boolean isTransformed) { diff --git a/src/main/java/makeo/gadomancy/common/entities/player/FakePlayerEntity.java b/src/main/java/makeo/gadomancy/common/entities/player/FakePlayerEntity.java index b8ff515..18f8077 100644 --- a/src/main/java/makeo/gadomancy/common/entities/player/FakePlayerEntity.java +++ b/src/main/java/makeo/gadomancy/common/entities/player/FakePlayerEntity.java @@ -1,14 +1,13 @@ package makeo.gadomancy.common.entities.player; import com.mojang.authlib.GameProfile; +import java.util.UUID; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.IChatComponent; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -import java.util.UUID; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -23,9 +22,7 @@ public class FakePlayerEntity extends EntityPlayer { } @Override - public void addChatMessage(IChatComponent component) { - - } + public void addChatMessage(IChatComponent component) {} @Override public boolean canCommandSenderUseCommand(int p_70003_1_, String p_70003_2_) { @@ -34,6 +31,9 @@ public class FakePlayerEntity extends EntityPlayer { @Override public ChunkCoordinates getPlayerCoordinates() { - return new ChunkCoordinates(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY + 0.5D), MathHelper.floor_double(this.posZ)); + return new ChunkCoordinates( + MathHelper.floor_double(this.posX), + MathHelper.floor_double(this.posY + 0.5D), + MathHelper.floor_double(this.posZ)); } } diff --git a/src/main/java/makeo/gadomancy/common/events/EventHandlerEntity.java b/src/main/java/makeo/gadomancy/common/events/EventHandlerEntity.java index 1edc712..4fcc71a 100644 --- a/src/main/java/makeo/gadomancy/common/events/EventHandlerEntity.java +++ b/src/main/java/makeo/gadomancy/common/events/EventHandlerEntity.java @@ -2,6 +2,8 @@ package makeo.gadomancy.common.events; import cpw.mods.fml.common.eventhandler.Event; import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import java.util.ArrayList; +import java.util.List; import makeo.gadomancy.common.aura.AuraEffects; import makeo.gadomancy.common.blocks.tiles.TileAIShutdown; import makeo.gadomancy.common.blocks.tiles.TileBlockProtector; @@ -26,9 +28,6 @@ import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.event.entity.player.EntityItemPickupEvent; import thaumcraft.common.items.armor.Hover; -import java.util.ArrayList; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -50,12 +49,12 @@ public class EventHandlerEntity { @SubscribeEvent public void on(LivingSpawnEvent.CheckSpawn event) { - if(event.entityLiving.isCreatureType(EnumCreatureType.monster, false)) { + if (event.entityLiving.isCreatureType(EnumCreatureType.monster, false)) { double rangeSq = AuraEffects.LUX.getRange() * AuraEffects.LUX.getRange(); Vector3 entityPos = MiscUtils.getPositionVector(event.entity); - for(ChunkCoordinates luxPylons : EventHandlerEntity.registeredLuxPylons) { + for (ChunkCoordinates luxPylons : EventHandlerEntity.registeredLuxPylons) { Vector3 pylon = Vector3.fromCC(luxPylons); - if(entityPos.distanceSquared(pylon) <= rangeSq) { + if (entityPos.distanceSquared(pylon) <= rangeSq) { event.setResult(Event.Result.DENY); return; } @@ -82,10 +81,10 @@ public class EventHandlerEntity { @SubscribeEvent public void on(LivingDeathEvent event) { if (!event.entity.worldObj.isRemote) { - if(event.entityLiving instanceof EntityPlayer) { + if (event.entityLiving instanceof EntityPlayer) { TCMazeHandler.closeSession((EntityPlayer) event.entityLiving, false); } - if(event.entityLiving instanceof EntityLiving) { + if (event.entityLiving instanceof EntityLiving) { TileAIShutdown.removeTrackedEntity((EntityLiving) event.entityLiving); } } @@ -96,7 +95,9 @@ public class EventHandlerEntity { if (!event.entityPlayer.worldObj.isRemote) { if (event.item instanceof EntityPermNoClipItem) { EntityPermNoClipItem item = (EntityPermNoClipItem) event.item; - ChunkCoordinates master = (ChunkCoordinates) item.getDataWatcher().getWatchedObject(ModConfig.entityNoClipItemDatawatcherMasterId).getObject(); + ChunkCoordinates master = (ChunkCoordinates) item.getDataWatcher() + .getWatchedObject(ModConfig.entityNoClipItemDatawatcherMasterId) + .getObject(); TileEntity te = event.entityPlayer.worldObj.getTileEntity(master.posX, master.posY, master.posZ); if (!(te instanceof EntityPermNoClipItem.IItemMasterTile)) return; ((EntityPermNoClipItem.IItemMasterTile) te).informItemRemoval(); @@ -108,8 +109,11 @@ public class EventHandlerEntity { public void on(LivingEvent.LivingUpdateEvent event) { if (!(event.entityLiving instanceof EntityPlayer)) return; EntityPlayer player = (EntityPlayer) event.entity; - if ((event.entity.worldObj.provider.dimensionId == ModConfig.dimOuterId) && ((player.ticksExisted & 7) == 0) && ((player.capabilities.isFlying) || (Hover.getHover(player.getEntityId())))) { - if(player.capabilities.isCreativeMode && MiscUtils.isANotApprovedOrMisunderstoodPersonFromMoreDoor(player)) return; + if ((event.entity.worldObj.provider.dimensionId == ModConfig.dimOuterId) + && ((player.ticksExisted & 7) == 0) + && ((player.capabilities.isFlying) || (Hover.getHover(player.getEntityId())))) { + if (player.capabilities.isCreativeMode && MiscUtils.isANotApprovedOrMisunderstoodPersonFromMoreDoor(player)) + return; player.capabilities.isFlying = false; Hover.setHover(player.getEntityId(), false); if (!((EntityPlayer) event.entityLiving).worldObj.isRemote) { @@ -117,9 +121,9 @@ public class EventHandlerEntity { if (player.capabilities.isCreativeMode) { msg += " " + StatCollector.translateToLocal("gadomancy.eldritch.noflyCreative"); } - player.addChatMessage(new ChatComponentText(EnumChatFormatting.ITALIC + "" + EnumChatFormatting.GRAY + msg)); + player.addChatMessage( + new ChatComponentText(EnumChatFormatting.ITALIC + "" + EnumChatFormatting.GRAY + msg)); } } } - } diff --git a/src/main/java/makeo/gadomancy/common/events/EventHandlerGolem.java b/src/main/java/makeo/gadomancy/common/events/EventHandlerGolem.java index 6522fd0..d182775 100644 --- a/src/main/java/makeo/gadomancy/common/events/EventHandlerGolem.java +++ b/src/main/java/makeo/gadomancy/common/events/EventHandlerGolem.java @@ -2,6 +2,8 @@ package makeo.gadomancy.common.events; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import java.util.HashMap; +import java.util.Map; import makeo.gadomancy.api.GadomancyApi; import makeo.gadomancy.api.golems.AdditionalGolemType; import makeo.gadomancy.api.golems.cores.AdditionalGolemCore; @@ -38,9 +40,6 @@ import thaumcraft.common.entities.golems.EnumGolemType; import thaumcraft.common.entities.golems.ItemGolemPlacer; import thaumcraft.common.items.wands.ItemWandCasting; -import java.util.HashMap; -import java.util.Map; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -52,7 +51,7 @@ import java.util.Map; public class EventHandlerGolem { @SubscribeEvent(priority = EventPriority.LOWEST) public void on(EntityEvent.EntityConstructing e) { - if(e.entity instanceof EntityGolemBase) { + if (e.entity instanceof EntityGolemBase) { EntityGolemBase golem = (EntityGolemBase) e.entity; golem.registerExtendedProperties(Gadomancy.MODID, new ExtendedGolemProperties(golem)); @@ -63,11 +62,12 @@ public class EventHandlerGolem { @SubscribeEvent(priority = EventPriority.HIGHEST) public void on(EntityEvent.EnteringChunk event) { - if(event.entity instanceof EntityGolemBase) { + if (event.entity instanceof EntityGolemBase) { EntityGolemBase golem = (EntityGolemBase) event.entity; - if(GadomancyApi.isAdditionalGolemType(golem.getGolemType())) { - ExtendedGolemProperties props = (ExtendedGolemProperties)event.entity.getExtendedProperties(Gadomancy.MODID); - if(props.shouldUpdateHealth()) { + if (GadomancyApi.isAdditionalGolemType(golem.getGolemType())) { + ExtendedGolemProperties props = + (ExtendedGolemProperties) event.entity.getExtendedProperties(Gadomancy.MODID); + if (props.shouldUpdateHealth()) { props.resetUpdateHealth(); golem.setHealth(props.getHealth()); } @@ -77,10 +77,10 @@ public class EventHandlerGolem { @SubscribeEvent(priority = EventPriority.LOWEST, receiveCanceled = true) public void on(EntityJoinWorldEvent event) { - if(!event.entity.worldObj.isRemote && event.entity instanceof EntityGolemBase) { + if (!event.entity.worldObj.isRemote && event.entity instanceof EntityGolemBase) { EntityGolemBase golem = (EntityGolemBase) event.entity; ExtendedGolemProperties props = (ExtendedGolemProperties) golem.getExtendedProperties(Gadomancy.MODID); - if(props != null) { + if (props != null) { props.setWrapperIfNeeded(); } } @@ -90,7 +90,8 @@ public class EventHandlerGolem { ItemStack stack = item.getEntityItem(); if (stack.getItem() == ConfigItems.itemGolemPlacer) { - AdditionalGolemType type = GadomancyApi.getAdditionalGolemType(EnumGolemType.getType(stack.getItemDamage())); + AdditionalGolemType type = + GadomancyApi.getAdditionalGolemType(EnumGolemType.getType(stack.getItemDamage())); if (type != null) { ItemStack fakePlacer = new ItemStack(type.getPlacerItem()); fakePlacer.setTagCompound(stack.getTagCompound()); @@ -101,39 +102,47 @@ public class EventHandlerGolem { } } - if(!event.world.isRemote && event.entity instanceof EntityLivingBase) { - if(((EntityLivingBase) event.entity).isPotionActive(RegisteredPotions.ACHROMATIC)) { - ((DataAchromatic) SyncDataHolder.getDataServer("AchromaticData")).handleApplication((EntityLivingBase) event.entity); + if (!event.world.isRemote && event.entity instanceof EntityLivingBase) { + if (((EntityLivingBase) event.entity).isPotionActive(RegisteredPotions.ACHROMATIC)) { + ((DataAchromatic) SyncDataHolder.getDataServer("AchromaticData")) + .handleApplication((EntityLivingBase) event.entity); } } } @SubscribeEvent(priority = EventPriority.LOWEST) public void on(PlayerInteractEvent e) { - if(!e.world.isRemote && e.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { + if (!e.world.isRemote && e.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { ItemStack itemInHand = e.entityPlayer.getHeldItem(); - if(itemInHand != null && (itemInHand.getItem() instanceof ItemGolemPlacer - || itemInHand.getItem() instanceof ItemAdditionalGolemPlacer)) { + if (itemInHand != null + && (itemInHand.getItem() instanceof ItemGolemPlacer + || itemInHand.getItem() instanceof ItemAdditionalGolemPlacer)) { int entityId = Entity.nextEntityID; - if(itemInHand.getItem().onItemUseFirst(itemInHand, e.entityPlayer, e.world, e.x, e.y, e.z, e.face, 0, 0, 0)) { + if (itemInHand + .getItem() + .onItemUseFirst(itemInHand, e.entityPlayer, e.world, e.x, e.y, e.z, e.face, 0, 0, 0)) { e.setCanceled(true); Entity entity = e.world.getEntityByID(entityId); - if(entity != null && entity instanceof EntityGolemBase) { + if (entity != null && entity instanceof EntityGolemBase) { EntityGolemBase golem = (EntityGolemBase) entity; - //move persistent data to entity - golem.getEntityData().setTag(Gadomancy.MODID, NBTHelper.getPersistentData(itemInHand).copy()); + // move persistent data to entity + golem.getEntityData() + .setTag( + Gadomancy.MODID, + NBTHelper.getPersistentData(itemInHand).copy()); MinecraftForge.EVENT_BUS.post(new PlacerCreateGolemEvent(e.entityPlayer, golem, itemInHand)); - ExtendedGolemProperties props = (ExtendedGolemProperties) golem.getExtendedProperties(Gadomancy.MODID); - if(props != null) { + ExtendedGolemProperties props = + (ExtendedGolemProperties) golem.getExtendedProperties(Gadomancy.MODID); + if (props != null) { props.updateGolemCore(); props.updateGolem(); } - //update runic shielding - if(RegisteredGolemStuff.upgradeRunicShield.hasUpgrade(golem)) { + // update runic shielding + if (RegisteredGolemStuff.upgradeRunicShield.hasUpgrade(golem)) { RegisteredGolemStuff.upgradeRunicShield.getCharge(golem); } } @@ -146,10 +155,13 @@ public class EventHandlerGolem { @SubscribeEvent(priority = EventPriority.HIGHEST, receiveCanceled = true) public void on(PlaySoundAtEntityEvent event) { - if(!event.entity.worldObj.isRemote && event.entity instanceof EntityGolemBase - && event.name.equals("thaumcraft:zap") && event.volume == 0.5F && event.pitch == 1.0F) { + if (!event.entity.worldObj.isRemote + && event.entity instanceof EntityGolemBase + && event.name.equals("thaumcraft:zap") + && event.volume == 0.5F + && event.pitch == 1.0F) { EntityGolemBase golem = (EntityGolemBase) event.entity; - if(this.markedGolems.containsKey(golem)) { + if (this.markedGolems.containsKey(golem)) { EntityPlayer player = this.markedGolems.get(golem); this.markedGolems.remove(golem); @@ -158,18 +170,19 @@ public class EventHandlerGolem { boolean movedPlacer = false; boolean movedCore = core == null || !player.isSneaking(); - for(EntityItem entityItem : golem.capturedDrops) { + for (EntityItem entityItem : golem.capturedDrops) { ItemStack item = entityItem.getEntityItem(); - if(!movedCore && item.getItem() == ConfigItems.itemGolemCore) { + if (!movedCore && item.getItem() == ConfigItems.itemGolemCore) { entityItem.setEntityItemStack(core.getItem()); } - if(!movedPlacer && item.getItem() instanceof ItemGolemPlacer + if (!movedPlacer && item.getItem() instanceof ItemGolemPlacer || item.getItem() instanceof ItemAdditionalGolemPlacer) { - //move persistent data to item - NBTTagCompound persistent = (NBTTagCompound) NBTHelper.getPersistentData(golem).copy(); - if(player.isSneaking()) { + // move persistent data to item + NBTTagCompound persistent = (NBTTagCompound) + NBTHelper.getPersistentData(golem).copy(); + if (player.isSneaking()) { persistent.removeTag("Core"); } NBTHelper.getData(item).setTag(Gadomancy.MODID, persistent); @@ -191,8 +204,11 @@ public class EventHandlerGolem { @SubscribeEvent(priority = EventPriority.LOWEST) public void on(AttackEntityEvent event) { ItemStack heldItem = event.entityPlayer.getHeldItem(); - if(heldItem != null && heldItem.getItem() == ConfigItems.itemGolemBell && event.target instanceof EntityGolemBase - && !event.target.worldObj.isRemote && !event.target.isDead) { + if (heldItem != null + && heldItem.getItem() == ConfigItems.itemGolemBell + && event.target instanceof EntityGolemBase + && !event.target.worldObj.isRemote + && !event.target.isDead) { event.target.captureDrops = true; this.markedGolems.put((EntityGolemBase) event.target, event.entityPlayer); } @@ -201,9 +217,9 @@ public class EventHandlerGolem { @SubscribeEvent(priority = EventPriority.NORMAL) public void on(LivingHurtEvent event) { if (!event.entity.worldObj.isRemote) { - if(event.entity instanceof EntityGolemBase) { + if (event.entity instanceof EntityGolemBase) { EntityGolemBase golem = (EntityGolemBase) event.entity; - if(event.ammount > 0 && RegisteredGolemStuff.upgradeRunicShield.hasUpgrade(golem)) { + if (event.ammount > 0 && RegisteredGolemStuff.upgradeRunicShield.hasUpgrade(golem)) { event.ammount = RegisteredGolemStuff.upgradeRunicShield.absorb(golem, event.ammount, event.source); } } @@ -219,46 +235,47 @@ public class EventHandlerGolem { @SubscribeEvent(priority = EventPriority.LOWEST) public void on(EntityInteractEvent event) { ItemStack heldItem = event.entityPlayer.getHeldItem(); - if(event.target instanceof EntityGolemBase) { + if (event.target instanceof EntityGolemBase) { EntityGolemBase golem = (EntityGolemBase) event.target; - if(golem.getCore() < 0) { - if(heldItem != null) { + if (golem.getCore() < 0) { + if (heldItem != null) { AdditionalGolemCore core = null; - for(AdditionalGolemCore entry : GadomancyApi.getAdditionalGolemCores()) { - if(entry.getItem().isItemEqual(heldItem)) { + for (AdditionalGolemCore entry : GadomancyApi.getAdditionalGolemCores()) { + if (entry.getItem().isItemEqual(heldItem)) { core = entry; break; } } - if(core != null && heldItem.stackSize > 0) { + if (core != null && heldItem.stackSize > 0) { GadomancyApi.setAdditionalGolemCore(golem, core); event.setCanceled(true); - if(!event.entityPlayer.capabilities.isCreativeMode) { + if (!event.entityPlayer.capabilities.isCreativeMode) { heldItem.stackSize--; } } } } else { - if(!event.target.worldObj.isRemote) { - if(heldItem == null + if (!event.target.worldObj.isRemote) { + if (heldItem == null || (heldItem.getItem() != ConfigItems.itemGolemBell - && heldItem.getItem() != ConfigItems.itemGolemUpgrade - && heldItem.getItem() != ConfigItems.itemGolemDecoration - && !(heldItem.getItem() instanceof ItemWandCasting))) { + && heldItem.getItem() != ConfigItems.itemGolemUpgrade + && heldItem.getItem() != ConfigItems.itemGolemDecoration + && !(heldItem.getItem() instanceof ItemWandCasting))) { AdditionalGolemCore core = GadomancyApi.getAdditionalGolemCore(golem); - if(core != null) { - if(core.hasGui() && !core.openGui(event.entityPlayer, golem)) { - event.entityPlayer.openGui(Gadomancy.instance, 0, golem.worldObj, golem.getEntityId(), 0, 0); + if (core != null) { + if (core.hasGui() && !core.openGui(event.entityPlayer, golem)) { + event.entityPlayer.openGui( + Gadomancy.instance, 0, golem.worldObj, golem.getEntityId(), 0, 0); } event.setCanceled(true); } } } - if(heldItem != null && heldItem.getItem() == ConfigItems.itemGolemBell) { + if (heldItem != null && heldItem.getItem() == ConfigItems.itemGolemBell) { AdditionalGolemCore core = GadomancyApi.getAdditionalGolemCore(golem); - if(core != null && !core.hasMarkers()) { + if (core != null && !core.hasMarkers()) { event.setCanceled(true); } } @@ -268,22 +285,26 @@ public class EventHandlerGolem { @SubscribeEvent(priority = EventPriority.LOWEST) public void on(ItemTooltipEvent event) { - if(event.itemStack != null) { - if(event.itemStack.getItem() instanceof ItemGolemPlacer + if (event.itemStack != null) { + if (event.itemStack.getItem() instanceof ItemGolemPlacer || event.itemStack.getItem() instanceof ItemAdditionalGolemPlacer) { - if(RegisteredGolemStuff.upgradeRunicShield.hasUpgrade(event.itemStack)) { - event.toolTip.add("\u00a76" + StatCollector.translateToLocal("item.runic.charge") + " +" + RegisteredGolemStuff.upgradeRunicShield.getChargeLimit(event.itemStack)); + if (RegisteredGolemStuff.upgradeRunicShield.hasUpgrade(event.itemStack)) { + event.toolTip.add("\u00a76" + StatCollector.translateToLocal("item.runic.charge") + " +" + + RegisteredGolemStuff.upgradeRunicShield.getChargeLimit(event.itemStack)); } AdditionalGolemCore core = GadomancyApi.getAdditionalGolemCore(event.itemStack); - if(core != null) { + if (core != null) { String searchStr = StatCollector.translateToLocal("item.ItemGolemCore.name"); - for(int i = 0; i < event.toolTip.size(); i++) { + for (int i = 0; i < event.toolTip.size(); i++) { String line = event.toolTip.get(i); - if(line.contains(searchStr)) { + if (line.contains(searchStr)) { int index = line.indexOf('\u00a7', searchStr.length()) + 2; event.toolTip.remove(i); - event.toolTip.add(i, line.substring(0, index) + StatCollector.translateToLocal(core.getUnlocalizedName())); + event.toolTip.add( + i, + line.substring(0, index) + + StatCollector.translateToLocal(core.getUnlocalizedName())); break; } } diff --git a/src/main/java/makeo/gadomancy/common/events/EventHandlerNetwork.java b/src/main/java/makeo/gadomancy/common/events/EventHandlerNetwork.java index 912bc89..2f1d080 100644 --- a/src/main/java/makeo/gadomancy/common/events/EventHandlerNetwork.java +++ b/src/main/java/makeo/gadomancy/common/events/EventHandlerNetwork.java @@ -25,13 +25,14 @@ import net.minecraft.server.MinecraftServer; */ public class EventHandlerNetwork { - //TODO Restore old client configs on server leave again. + // TODO Restore old client configs on server leave again. @SubscribeEvent public void on(PlayerEvent.PlayerLoggedInEvent e) { EntityPlayerMP p = (EntityPlayerMP) e.player; PacketHandler.INSTANCE.sendTo(new PacketUpdateGolemTypeOrder(GolemEnumHelper.getCurrentMapping()), p); PacketHandler.INSTANCE.sendTo(new PacketSyncConfigs(), p); - PacketHandler.INSTANCE.sendTo(new PacketUpdateOnlineState(MinecraftServer.getServer().isServerInOnlineMode()), p); + PacketHandler.INSTANCE.sendTo( + new PacketUpdateOnlineState(MinecraftServer.getServer().isServerInOnlineMode()), p); ((DataFamiliar) SyncDataHolder.getDataServer("FamiliarData")).checkPlayerEquipment(p); ((DataAchromatic) SyncDataHolder.getDataServer("AchromaticData")).checkPotionEffect(p); SyncDataHolder.syncAllDataTo(p); @@ -41,7 +42,7 @@ public class EventHandlerNetwork { public void on(PlayerEvent.PlayerLoggedOutEvent e) { EntityPlayer player = e.player; DataFamiliar familiarData = SyncDataHolder.getDataServer("FamiliarData"); - if(familiarData.hasFamiliar(player)) { + if (familiarData.hasFamiliar(player)) { familiarData.handleUnsafeUnequip(player); } diff --git a/src/main/java/makeo/gadomancy/common/events/EventHandlerRedirect.java b/src/main/java/makeo/gadomancy/common/events/EventHandlerRedirect.java index 6dfa688..aedb172 100644 --- a/src/main/java/makeo/gadomancy/common/events/EventHandlerRedirect.java +++ b/src/main/java/makeo/gadomancy/common/events/EventHandlerRedirect.java @@ -2,6 +2,7 @@ package makeo.gadomancy.common.events; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import makeo.gadomancy.common.registration.RegisteredEnchantments; import makeo.gadomancy.common.registration.RegisteredPotions; import makeo.gadomancy.common.utils.MiscUtils; @@ -19,8 +20,6 @@ import net.minecraftforge.client.event.DrawBlockHighlightEvent; import thaumcraft.api.aspects.Aspect; import thaumcraft.common.config.ConfigItems; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -34,9 +33,10 @@ public class EventHandlerRedirect { private static boolean hasChanged; private static ItemStack oldItem; + public static void addGoggles(Entity entity) { - if(entity instanceof EntityPlayer && EventHandlerRedirect.hasGoggles((EntityPlayer) entity)) { - ItemStack[] armorInv = ((EntityPlayer)entity).inventory.armorInventory; + if (entity instanceof EntityPlayer && EventHandlerRedirect.hasGoggles((EntityPlayer) entity)) { + ItemStack[] armorInv = ((EntityPlayer) entity).inventory.armorInventory; EventHandlerRedirect.oldItem = armorInv[3]; EventHandlerRedirect.hasChanged = true; armorInv[3] = EventHandlerRedirect.ITEM_GOGGLES; @@ -44,8 +44,8 @@ public class EventHandlerRedirect { } public static void removeGoggles(Entity entity) { - if(EventHandlerRedirect.hasChanged && entity instanceof EntityPlayer) { - ((EntityPlayer)entity).inventory.armorInventory[3] = EventHandlerRedirect.oldItem; + if (EventHandlerRedirect.hasChanged && entity instanceof EntityPlayer) { + ((EntityPlayer) entity).inventory.armorInventory[3] = EventHandlerRedirect.oldItem; EventHandlerRedirect.oldItem = null; EventHandlerRedirect.hasChanged = false; } @@ -53,8 +53,9 @@ public class EventHandlerRedirect { private static boolean hasGoggles(EntityPlayer player) { ItemStack stack = player.inventory.armorItemInSlot(3); - if(MiscUtils.isANotApprovedOrMisunderstoodPersonFromMoreDoor(player)) return true; - return stack != null && EnchantmentHelper.getEnchantmentLevel(RegisteredEnchantments.revealer.effectId, stack) > 0; + if (MiscUtils.isANotApprovedOrMisunderstoodPersonFromMoreDoor(player)) return true; + return stack != null + && EnchantmentHelper.getEnchantmentLevel(RegisteredEnchantments.revealer.effectId, stack) > 0; } @SideOnly(Side.CLIENT) @@ -76,25 +77,34 @@ public class EventHandlerRedirect { } public static int getAdditionalVisDiscount(EntityPlayer player, Aspect aspect, int currentTotalDiscount) { - if(player.isPotionActive(RegisteredPotions.VIS_DISCOUNT)) { - currentTotalDiscount += (player.getActivePotionEffect(RegisteredPotions.VIS_DISCOUNT).getAmplifier() + 1) * 8; + if (player.isPotionActive(RegisteredPotions.VIS_DISCOUNT)) { + currentTotalDiscount += (player.getActivePotionEffect(RegisteredPotions.VIS_DISCOUNT) + .getAmplifier() + + 1) + * 8; } return currentTotalDiscount; } public static int getFortuneLevel(EntityLivingBase entity) { - int fortuneLevel = EventHandlerRedirect.getRealEnchantmentLevel(Enchantment.fortune.effectId, entity.getHeldItem()); - if(entity.isPotionActive(RegisteredPotions.POTION_LUCK)) { - int lvl = entity.getActivePotionEffect(RegisteredPotions.POTION_LUCK).getAmplifier() + 1; //Amplifier 0-indexed + int fortuneLevel = + EventHandlerRedirect.getRealEnchantmentLevel(Enchantment.fortune.effectId, entity.getHeldItem()); + if (entity.isPotionActive(RegisteredPotions.POTION_LUCK)) { + int lvl = + entity.getActivePotionEffect(RegisteredPotions.POTION_LUCK).getAmplifier() + + 1; // Amplifier 0-indexed fortuneLevel += lvl; } return fortuneLevel; } public static int getLootingLevel(EntityLivingBase entity) { - int lootingLevel = EventHandlerRedirect.getRealEnchantmentLevel(Enchantment.looting.effectId, entity.getHeldItem()); - if(entity.isPotionActive(RegisteredPotions.POTION_LUCK)) { - int lvl = entity.getActivePotionEffect(RegisteredPotions.POTION_LUCK).getAmplifier() + 1; //Amplifier 0-indexed + int lootingLevel = + EventHandlerRedirect.getRealEnchantmentLevel(Enchantment.looting.effectId, entity.getHeldItem()); + if (entity.isPotionActive(RegisteredPotions.POTION_LUCK)) { + int lvl = + entity.getActivePotionEffect(RegisteredPotions.POTION_LUCK).getAmplifier() + + 1; // Amplifier 0-indexed lootingLevel += lvl; } return lootingLevel; @@ -102,11 +112,11 @@ public class EventHandlerRedirect { public static int onGetEnchantmentLevel(int enchantmentId, ItemStack stack) { EntityPlayer possiblePlayer = null; - if(stack != null) { + if (stack != null) { MinecraftServer server = MinecraftServer.getServer(); - if(server != null && server.getConfigurationManager() != null) { - for(EntityPlayer player : (List) server.getConfigurationManager().playerEntityList) { - if(player != null && player.getHeldItem() == stack) { + if (server != null && server.getConfigurationManager() != null) { + for (EntityPlayer player : (List) server.getConfigurationManager().playerEntityList) { + if (player != null && player.getHeldItem() == stack) { possiblePlayer = player; break; } @@ -114,13 +124,12 @@ public class EventHandlerRedirect { } } - if(possiblePlayer != null) { - if(enchantmentId == Enchantment.fortune.effectId) { + if (possiblePlayer != null) { + if (enchantmentId == Enchantment.fortune.effectId) { return EventHandlerRedirect.getFortuneLevel(possiblePlayer); - } else if(enchantmentId == Enchantment.looting.effectId) { + } else if (enchantmentId == Enchantment.looting.effectId) { return EventHandlerRedirect.getLootingLevel(possiblePlayer); } - } return EventHandlerRedirect.getRealEnchantmentLevel(enchantmentId, stack); @@ -144,5 +153,4 @@ public class EventHandlerRedirect { } } } - } diff --git a/src/main/java/makeo/gadomancy/common/events/EventHandlerWorld.java b/src/main/java/makeo/gadomancy/common/events/EventHandlerWorld.java index 816a8e9..cc78bea 100644 --- a/src/main/java/makeo/gadomancy/common/events/EventHandlerWorld.java +++ b/src/main/java/makeo/gadomancy/common/events/EventHandlerWorld.java @@ -3,6 +3,9 @@ package makeo.gadomancy.common.events; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.blocks.tiles.TileAIShutdown; import makeo.gadomancy.common.blocks.tiles.TileBlockProtector; @@ -17,7 +20,6 @@ import makeo.gadomancy.common.registration.RegisteredItems; import makeo.gadomancy.common.utils.*; import makeo.gadomancy.common.utils.world.TCMazeHandler; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -42,10 +44,6 @@ import thaumcraft.common.config.ConfigBlocks; import thaumcraft.common.items.wands.ItemWandCasting; import thaumcraft.common.tiles.TileJarFillable; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -55,20 +53,23 @@ import java.util.Map; * Created by makeo @ 05.07.2015 13:20 */ public class EventHandlerWorld { - public Map trackedItems = new HashMap(); + public Map trackedItems = new HashMap(); @SubscribeEvent(priority = EventPriority.LOW) public void on(EntityJoinWorldEvent event) { - if(!event.world.isRemote && event.entity instanceof EntityItem) { + if (!event.world.isRemote && event.entity instanceof EntityItem) { ItemStack stack = ((EntityItem) event.entity).getEntityItem(); - if(this.isDisguised(stack)) { + if (this.isDisguised(stack)) { long time = event.world.getTotalWorldTime() + event.world.rand.nextInt(60) + 40; this.trackedItems.put((EntityItem) event.entity, time); } - if(stack.getItem() instanceof ItemElement && !(event.entity instanceof EntityItemElement)) { + if (stack.getItem() instanceof ItemElement && !(event.entity instanceof EntityItemElement)) { event.setCanceled(true); - EntityItem newItem = new EntityItemElement(event.world, - event.entity.posX, event.entity.posY, event.entity.posZ, + EntityItem newItem = new EntityItemElement( + event.world, + event.entity.posX, + event.entity.posY, + event.entity.posZ, ((EntityItem) event.entity).getEntityItem()); newItem.delayBeforeCanPickup = ((EntityItem) event.entity).delayBeforeCanPickup; newItem.motionX = event.entity.motionX; @@ -81,15 +82,18 @@ public class EventHandlerWorld { @SubscribeEvent public void on(TickEvent.WorldTickEvent event) { - if(event.phase == TickEvent.Phase.START && !event.world.isRemote && event.world.getTotalWorldTime() % 10 == 0) { + if (event.phase == TickEvent.Phase.START + && !event.world.isRemote + && event.world.getTotalWorldTime() % 10 == 0) { - Iterator> iterator = this.trackedItems.entrySet().iterator(); - while(iterator.hasNext()) { + Iterator> iterator = + this.trackedItems.entrySet().iterator(); + while (iterator.hasNext()) { Map.Entry entry = iterator.next(); EntityItem entity = entry.getKey(); - if(event.world == entity.worldObj) { - if(entity.isDead || !this.isDisguised(entity.getEntityItem())) { + if (event.world == entity.worldObj) { + if (entity.isDead || !this.isDisguised(entity.getEntityItem())) { iterator.remove(); continue; } @@ -98,28 +102,31 @@ public class EventHandlerWorld { int y = MathHelper.floor_double(entity.posY); int z = MathHelper.floor_double(entity.posZ); - if(entity.delayBeforeCanPickup <= 0 && entity.worldObj.getTotalWorldTime() - entry.getValue() > 0) { - if(ConfigBlocks.blockFluidPure == event.world.getBlock(x, y, z) + if (entity.delayBeforeCanPickup <= 0 + && entity.worldObj.getTotalWorldTime() - entry.getValue() > 0) { + if (ConfigBlocks.blockFluidPure == event.world.getBlock(x, y, z) && event.world.getBlockMetadata(x, y, z) == 0) { NBTTagCompound compound = NBTHelper.getPersistentData(entity.getEntityItem()); NBTBase base = compound.getTag("disguise"); - if(base instanceof NBTTagCompound) { + if (base instanceof NBTTagCompound) { ItemStack stack = ItemStack.loadItemStackFromNBT((NBTTagCompound) base); - EntityItem newEntity = new EntityItem(event.world, entity.posX, entity.posY, entity.posZ, stack); + EntityItem newEntity = + new EntityItem(event.world, entity.posX, entity.posY, entity.posZ, stack); ItemUtils.applyRandomDropOffset(newEntity, event.world.rand); event.world.spawnEntityInWorld(newEntity); } compound.removeTag("disguise"); - if(compound.hasNoTags()) { + if (compound.hasNoTags()) { NBTHelper.removePersistentData(entity.getEntityItem()); - if(entity.getEntityItem().getTagCompound().hasNoTags()) { + if (entity.getEntityItem().getTagCompound().hasNoTags()) { entity.getEntityItem().setTagCompound(null); } } event.world.setBlockToAir(x, y, z); } } else { - Gadomancy.proxy.spawnBubbles(event.world, (float)entity.posX, (float)entity.posY, (float)entity.posZ, 0.2f); + Gadomancy.proxy.spawnBubbles( + event.world, (float) entity.posX, (float) entity.posY, (float) entity.posZ, 0.2f); } } } @@ -127,7 +134,8 @@ public class EventHandlerWorld { } private boolean isDisguised(ItemStack stack) { - return NBTHelper.hasPersistentData(stack) && NBTHelper.getPersistentData(stack).hasKey("disguise"); + return NBTHelper.hasPersistentData(stack) + && NBTHelper.getPersistentData(stack).hasKey("disguise"); } private int serverTick; @@ -135,7 +143,7 @@ public class EventHandlerWorld { @SubscribeEvent(priority = EventPriority.LOWEST) public void on(LivingEvent.LivingUpdateEvent e) { - if(!e.entityLiving.worldObj.isRemote) { + if (!e.entityLiving.worldObj.isRemote) { this.lastUpdated = e.entityLiving; } } @@ -152,19 +160,29 @@ public class EventHandlerWorld { } GameRules rules = e.world.getGameRules(); - rules.theGameRules.put("mobGriefing", new ValueOverride(this, String.valueOf(rules.getGameRuleBooleanValue("mobGriefing")))); + rules.theGameRules.put( + "mobGriefing", new ValueOverride(this, String.valueOf(rules.getGameRuleBooleanValue("mobGriefing")))); } @SubscribeEvent(priority = EventPriority.HIGH) public void on(ExplosionEvent.Start e) { Explosion expl = e.explosion; - if(expl.isSmoking - && (expl.exploder != null ? TileBlockProtector.isSpotProtected(e.world, expl.exploder) : - TileBlockProtector.isSpotProtected(e.world, expl.explosionX, expl.explosionY, expl.explosionZ))) { - //why? - //expl.isSmoking = false; + if (expl.isSmoking + && (expl.exploder != null + ? TileBlockProtector.isSpotProtected(e.world, expl.exploder) + : TileBlockProtector.isSpotProtected( + e.world, expl.explosionX, expl.explosionY, expl.explosionZ))) { + // why? + // expl.isSmoking = false; e.setCanceled(true); - e.world.newExplosion(expl.exploder, expl.explosionX, expl.explosionY, expl.explosionZ, expl.explosionSize, expl.isFlaming, false); + e.world.newExplosion( + expl.exploder, + expl.explosionX, + expl.explosionY, + expl.explosionZ, + expl.explosionSize, + expl.isFlaming, + false); } } @@ -179,12 +197,12 @@ public class EventHandlerWorld { @SubscribeEvent public void on(TickEvent.ServerTickEvent event) { - if(event.phase != TickEvent.Phase.END) return; + if (event.phase != TickEvent.Phase.END) return; TCMazeHandler.scheduleTick(); SyncDataHolder.doNecessaryUpdates(); this.serverTick++; - if((this.serverTick & 15) == 0) { + if ((this.serverTick & 15) == 0) { EventHandlerEntity.registeredLuxPylons.clear(); } } @@ -194,8 +212,7 @@ public class EventHandlerWorld { @SubscribeEvent(priority = EventPriority.LOWEST, receiveCanceled = true) public void on(BlockEvent.PlaceEvent e) { if (e.isCanceled()) { - if (this.interacts != null) - this.interacts.remove(e.player); + if (this.interacts != null) this.interacts.remove(e.player); } else { if (!e.world.isRemote && this.isStickyJar(e.itemInHand)) { TileEntity parent = e.world.getTileEntity(e.x, e.y, e.z); @@ -206,8 +223,13 @@ public class EventHandlerWorld { TileEntity tile = e.world.getTileEntity(e.x, e.y, e.z); if (tile instanceof TileStickyJar) { Integer sideHit = this.interacts.get(e.player); - ((TileStickyJar) tile).init((TileJarFillable) parent, e.placedBlock, metadata, - ForgeDirection.getOrientation(sideHit == null ? 1 : sideHit).getOpposite()); + ((TileStickyJar) tile) + .init( + (TileJarFillable) parent, + e.placedBlock, + metadata, + ForgeDirection.getOrientation(sideHit == null ? 1 : sideHit) + .getOpposite()); RegisteredBlocks.blockStickyJar.onBlockPlacedBy(e.world, e.x, e.y, e.z, e.player, e.itemInHand); } } @@ -221,18 +243,21 @@ public class EventHandlerWorld { if (event.block == RegisteredBlocks.blockNodeManipulator) { TileEntity te = event.world.getTileEntity(event.x, event.y, event.z); if (te != null && te instanceof TileNodeManipulator) { - if (((TileNodeManipulator) te).isInMultiblock()) - ((TileNodeManipulator) te).breakMultiblock(); + if (((TileNodeManipulator) te).isInMultiblock()) ((TileNodeManipulator) te).breakMultiblock(); } } if (event.block == RegisteredBlocks.blockStoneMachine && event.blockMetadata == 5) { TileAIShutdown.removeTrackedEntities(event.world, event.x, event.y, event.z); } if (event.world.provider.dimensionId == ModConfig.dimOuterId) { - if(event.block == ConfigBlocks.blockEldritchNothing) { - if(event.getPlayer().capabilities.isCreativeMode && MiscUtils.isANotApprovedOrMisunderstoodPersonFromMoreDoor(event.getPlayer())) return; + if (event.block == ConfigBlocks.blockEldritchNothing) { + if (event.getPlayer().capabilities.isCreativeMode + && MiscUtils.isANotApprovedOrMisunderstoodPersonFromMoreDoor(event.getPlayer())) return; event.setCanceled(true); - event.getPlayer().addChatMessage(new ChatComponentText(EnumChatFormatting.ITALIC + "" + EnumChatFormatting.GRAY + StatCollector.translateToLocal("gadomancy.eldritch.nobreakPortalNothing"))); + event.getPlayer() + .addChatMessage(new ChatComponentText(EnumChatFormatting.ITALIC + "" + + EnumChatFormatting.GRAY + + StatCollector.translateToLocal("gadomancy.eldritch.nobreakPortalNothing"))); } } } @@ -240,7 +265,8 @@ public class EventHandlerWorld { @SubscribeEvent(priority = EventPriority.LOWEST) public void on(PlayerInteractEvent e) { - if (!e.world.isRemote && e.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK + if (!e.world.isRemote + && e.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK && this.isStickyJar(e.entityPlayer.getHeldItem())) { if (this.interacts == null) { this.interacts = new HashMap(); @@ -257,8 +283,10 @@ public class EventHandlerWorld { } private boolean isStickyJar(ItemStack stack) { - return stack != null && RegisteredItems.isStickyableJar(stack) - && stack.hasTagCompound() && stack.stackTagCompound.getBoolean("isStickyJar"); + return stack != null + && RegisteredItems.isStickyableJar(stack) + && stack.hasTagCompound() + && stack.stackTagCompound.getBoolean("isStickyJar"); } @SubscribeEvent(priority = EventPriority.NORMAL) @@ -269,14 +297,16 @@ public class EventHandlerWorld { } } - if(e.toolTip.size() > 0 && NBTHelper.hasPersistentData(e.itemStack)) { + if (e.toolTip.size() > 0 && NBTHelper.hasPersistentData(e.itemStack)) { NBTTagCompound compound = NBTHelper.getPersistentData(e.itemStack); - if(compound.hasKey("disguise")) { + if (compound.hasKey("disguise")) { NBTBase base = compound.getTag("disguise"); String lore; - if(base instanceof NBTTagCompound) { + if (base instanceof NBTTagCompound) { ItemStack stack = ItemStack.loadItemStackFromNBT((NBTTagCompound) base); - lore = String.format(StatCollector.translateToLocal("gadomancy.lore.disguise.item"), EnumChatFormatting.getTextWithoutFormattingCodes(stack.getDisplayName())); + lore = String.format( + StatCollector.translateToLocal("gadomancy.lore.disguise.item"), + EnumChatFormatting.getTextWithoutFormattingCodes(stack.getDisplayName())); } else { lore = StatCollector.translateToLocal("gadomancy.lore.disguise.none"); } @@ -287,6 +317,7 @@ public class EventHandlerWorld { private static class ValueOverride extends GameRules.Value { private final EventHandlerWorld handler; + public ValueOverride(EventHandlerWorld handler, String value) { super(value); this.handler = handler; diff --git a/src/main/java/makeo/gadomancy/common/familiar/FamiliarAIController_Old.java b/src/main/java/makeo/gadomancy/common/familiar/FamiliarAIController_Old.java index 3d86e91..7e16adf 100644 --- a/src/main/java/makeo/gadomancy/common/familiar/FamiliarAIController_Old.java +++ b/src/main/java/makeo/gadomancy/common/familiar/FamiliarAIController_Old.java @@ -1,13 +1,12 @@ package makeo.gadomancy.common.familiar; import baubles.api.BaublesApi; +import java.util.*; import makeo.gadomancy.common.registration.RegisteredFamiliarAI_Old; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import java.util.*; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -20,7 +19,8 @@ public class FamiliarAIController_Old { private static final Random RAND = new Random(); - private static Map> targetMap = new HashMap>(); + private static Map> targetMap = + new HashMap>(); private List availableTasks = new ArrayList(); private Map cooldownProcesses = new HashMap(); @@ -40,15 +40,17 @@ public class FamiliarAIController_Old { public void scheduleTick() { this.reduceRunningCooldowns(); - if(this.runningTask == null) { + if (this.runningTask == null) { this.selectNewTask(); } else { ItemStack famStack = BaublesApi.getBaubles(this.owningPlayer).getStackInSlot(0); this.runningTask.tick(this.ticksInTask, this.owningPlayer.worldObj, this.owningPlayer, famStack); this.ticksInTask++; - if(this.ticksInTask >= this.runningTask.getDuration()) { - if(this.runningTask.getCooldownDuration(famStack) > 0) this.cooldownProcesses.put(this.runningTask, this.runningTask.getCooldownDuration(famStack)); - if(this.runningTask.tryLoop() && !this.requestedLoop.contains(this.runningTask)) this.requestedLoop.addLast(this.runningTask); + if (this.ticksInTask >= this.runningTask.getDuration()) { + if (this.runningTask.getCooldownDuration(famStack) > 0) + this.cooldownProcesses.put(this.runningTask, this.runningTask.getCooldownDuration(famStack)); + if (this.runningTask.tryLoop() && !this.requestedLoop.contains(this.runningTask)) + this.requestedLoop.addLast(this.runningTask); this.runningTask = null; this.ticksInTask = 0; } @@ -56,11 +58,11 @@ public class FamiliarAIController_Old { } private void selectNewTask() { - if(!this.requestedLoop.isEmpty()) { + if (!this.requestedLoop.isEmpty()) { Iterator it = this.requestedLoop.iterator(); - while(it.hasNext()) { + while (it.hasNext()) { FamiliarAIProcess_Old process = it.next(); - if(!this.cooldownProcesses.containsKey(process)) { + if (!this.cooldownProcesses.containsKey(process)) { this.runningTask = process; it.remove(); return; @@ -72,19 +74,26 @@ public class FamiliarAIController_Old { for (int i = 0; i < size; i++) { int index = (randIndex + i) % size; FamiliarAIProcess_Old process = this.availableTasks.get(index); - if(process.canRun(this.owningPlayer.worldObj, this.owningPlayer.posX, this.owningPlayer.posY, this.owningPlayer.posZ, this.owningPlayer, BaublesApi.getBaubles(this.owningPlayer).getStackInSlot(0)) && - !this.cooldownProcesses.containsKey(process)) { + if (process.canRun( + this.owningPlayer.worldObj, + this.owningPlayer.posX, + this.owningPlayer.posY, + this.owningPlayer.posZ, + this.owningPlayer, + BaublesApi.getBaubles(this.owningPlayer).getStackInSlot(0)) + && !this.cooldownProcesses.containsKey(process)) { this.runningTask = process; } } } private void reduceRunningCooldowns() { - Iterator itProcesses = this.cooldownProcesses.keySet().iterator(); - while(itProcesses.hasNext()) { + Iterator itProcesses = + this.cooldownProcesses.keySet().iterator(); + while (itProcesses.hasNext()) { FamiliarAIProcess_Old process = itProcesses.next(); int cd = this.cooldownProcesses.get(process) - 1; - if(cd <= 0) { + if (cd <= 0) { itProcesses.remove(); } else { this.cooldownProcesses.put(process, cd); @@ -97,38 +106,40 @@ public class FamiliarAIController_Old { } public static boolean hasLastTargetter(EntityPlayer player) { - return FamiliarAIController_Old.targetMap.containsKey(player) && FamiliarAIController_Old.targetMap.get(player).size() >= 1; + return FamiliarAIController_Old.targetMap.containsKey(player) + && FamiliarAIController_Old.targetMap.get(player).size() >= 1; } public static LinkedList getLastTargetters(EntityPlayer player) { - if(!FamiliarAIController_Old.targetMap.containsKey(player)) return null; - if(FamiliarAIController_Old.targetMap.get(player).size() < 1) return null; + if (!FamiliarAIController_Old.targetMap.containsKey(player)) return null; + if (FamiliarAIController_Old.targetMap.get(player).size() < 1) return null; return FamiliarAIController_Old.targetMap.get(player); } public static void cleanTargetterList(EntityPlayer player) { - if(!FamiliarAIController_Old.targetMap.containsKey(player)) return; - Iterator it = FamiliarAIController_Old.targetMap.get(player).iterator(); - while(it.hasNext()) { + if (!FamiliarAIController_Old.targetMap.containsKey(player)) return; + Iterator it = + FamiliarAIController_Old.targetMap.get(player).iterator(); + while (it.hasNext()) { EntityLivingBase living = it.next(); - if(living.isDead) it.remove(); + if (living.isDead) it.remove(); } } public static void notifyTargetEvent(EntityLivingBase targetter, EntityPlayer targetted) { LinkedList targetters; boolean needsUpdate = false; - if(FamiliarAIController_Old.targetMap.containsKey(targetted)) { + if (FamiliarAIController_Old.targetMap.containsKey(targetted)) { targetters = FamiliarAIController_Old.targetMap.get(targetted); } else { targetters = new LinkedList(); needsUpdate = true; } - if(!targetters.contains(targetter)) { + if (!targetters.contains(targetter)) { targetters.addLast(targetter); } - if(needsUpdate) { + if (needsUpdate) { FamiliarAIController_Old.targetMap.put(targetted, targetters); } } diff --git a/src/main/java/makeo/gadomancy/common/familiar/FamiliarAIProcess_Old.java b/src/main/java/makeo/gadomancy/common/familiar/FamiliarAIProcess_Old.java index 24d65dd..7c68f52 100644 --- a/src/main/java/makeo/gadomancy/common/familiar/FamiliarAIProcess_Old.java +++ b/src/main/java/makeo/gadomancy/common/familiar/FamiliarAIProcess_Old.java @@ -43,7 +43,6 @@ public abstract class FamiliarAIProcess_Old { if (o == null || this.getClass() != o.getClass()) return false; FamiliarAIProcess_Old that = (FamiliarAIProcess_Old) o; return this.id == that.id; - } @Override diff --git a/src/main/java/makeo/gadomancy/common/familiar/FamiliarAugment.java b/src/main/java/makeo/gadomancy/common/familiar/FamiliarAugment.java index 79a9247..5c38a8a 100644 --- a/src/main/java/makeo/gadomancy/common/familiar/FamiliarAugment.java +++ b/src/main/java/makeo/gadomancy/common/familiar/FamiliarAugment.java @@ -1,13 +1,12 @@ package makeo.gadomancy.common.familiar; -import net.minecraft.util.StatCollector; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.aspects.AspectList; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import net.minecraft.util.StatCollector; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; /** * This class is part of the Gadomancy Mod @@ -21,17 +20,34 @@ public class FamiliarAugment { private static final String FORMAT_NAME = "familiar.augment.%s.name"; - //Main effects - public static final FamiliarAugment SHOCK = new FamiliarAugment("shock", new AspectList().add(Aspect.AIR, 3).add(Aspect.ENTROPY, 2)); - public static final FamiliarAugment POISON = new FamiliarAugment("poison", new AspectList().add(Aspect.WATER, 3).add(Aspect.ENTROPY, 4)).addConflict(FamiliarAugment.SHOCK); - public static final FamiliarAugment FIRE = new FamiliarAugment("fire", new AspectList().add(Aspect.FIRE, 4).add(Aspect.ORDER, 2)).addConflict(FamiliarAugment.SHOCK, FamiliarAugment.POISON); - public static final FamiliarAugment WEAKNESS = new FamiliarAugment("weakness", new AspectList().add(Aspect.ENTROPY, 3).add(Aspect.EARTH, 3)).addConflict(FamiliarAugment.SHOCK, FamiliarAugment.POISON, FamiliarAugment.FIRE); - - //Side effects - public static final FamiliarAugment DAMAGE_INCREASE = new FamiliarAugment("damage", new AspectList().add(Aspect.FIRE, 3)).addCondition(new PreconditionAny(FamiliarAugment.SHOCK, FamiliarAugment.POISON, FamiliarAugment.FIRE, FamiliarAugment.WEAKNESS)); - public static final FamiliarAugment RANGE_INCREASE = new FamiliarAugment("range", new AspectList().add(Aspect.AIR, 2).add(Aspect.ORDER, 1)).addConflict(FamiliarAugment.DAMAGE_INCREASE).addCondition(new PreconditionAny(FamiliarAugment.SHOCK, FamiliarAugment.POISON, FamiliarAugment.FIRE, FamiliarAugment.WEAKNESS)); - public static final FamiliarAugment ATTACK_SPEED = new FamiliarAugment("speed", new AspectList().add(Aspect.ORDER, 2).add(Aspect.FIRE, 1)).addConflict(FamiliarAugment.DAMAGE_INCREASE, FamiliarAugment.RANGE_INCREASE).addCondition(new PreconditionAny(FamiliarAugment.SHOCK, FamiliarAugment.POISON, FamiliarAugment.FIRE, FamiliarAugment.WEAKNESS)); + // Main effects + public static final FamiliarAugment SHOCK = + new FamiliarAugment("shock", new AspectList().add(Aspect.AIR, 3).add(Aspect.ENTROPY, 2)); + public static final FamiliarAugment POISON = new FamiliarAugment( + "poison", new AspectList().add(Aspect.WATER, 3).add(Aspect.ENTROPY, 4)) + .addConflict(FamiliarAugment.SHOCK); + public static final FamiliarAugment FIRE = new FamiliarAugment( + "fire", new AspectList().add(Aspect.FIRE, 4).add(Aspect.ORDER, 2)) + .addConflict(FamiliarAugment.SHOCK, FamiliarAugment.POISON); + public static final FamiliarAugment WEAKNESS = new FamiliarAugment( + "weakness", new AspectList().add(Aspect.ENTROPY, 3).add(Aspect.EARTH, 3)) + .addConflict(FamiliarAugment.SHOCK, FamiliarAugment.POISON, FamiliarAugment.FIRE); + // Side effects + public static final FamiliarAugment DAMAGE_INCREASE = new FamiliarAugment( + "damage", new AspectList().add(Aspect.FIRE, 3)) + .addCondition(new PreconditionAny( + FamiliarAugment.SHOCK, FamiliarAugment.POISON, FamiliarAugment.FIRE, FamiliarAugment.WEAKNESS)); + public static final FamiliarAugment RANGE_INCREASE = new FamiliarAugment( + "range", new AspectList().add(Aspect.AIR, 2).add(Aspect.ORDER, 1)) + .addConflict(FamiliarAugment.DAMAGE_INCREASE) + .addCondition(new PreconditionAny( + FamiliarAugment.SHOCK, FamiliarAugment.POISON, FamiliarAugment.FIRE, FamiliarAugment.WEAKNESS)); + public static final FamiliarAugment ATTACK_SPEED = new FamiliarAugment( + "speed", new AspectList().add(Aspect.ORDER, 2).add(Aspect.FIRE, 1)) + .addConflict(FamiliarAugment.DAMAGE_INCREASE, FamiliarAugment.RANGE_INCREASE) + .addCondition(new PreconditionAny( + FamiliarAugment.SHOCK, FamiliarAugment.POISON, FamiliarAugment.FIRE, FamiliarAugment.WEAKNESS)); private final String unlocalizedName; private List preconditions = new ArrayList(); @@ -57,16 +73,16 @@ public class FamiliarAugment { } private FamiliarAugment addConflict(FamiliarAugment... others) { - for(FamiliarAugment augment : others) { - if(augment == null) continue; + for (FamiliarAugment augment : others) { + if (augment == null) continue; this.addConflict(augment); } return this; } private FamiliarAugment addConflict(FamiliarAugment other) { - if(!this.conflicts.contains(other)) this.conflicts.add(other); - if(!other.conflicts.contains(this)) other.conflicts.add(this); + if (!this.conflicts.contains(other)) this.conflicts.add(other); + if (!other.conflicts.contains(this)) other.conflicts.add(this); return this; } @@ -86,30 +102,30 @@ public class FamiliarAugment { return FamiliarAugment.BY_NAME.get(name.toLowerCase()); } - //Returns true, if the current conditions for application are fulfilled for a familiar with given augments. + // Returns true, if the current conditions for application are fulfilled for a familiar with given augments. public boolean checkConditions(FamiliarAugmentList currentAugments, int levelToSet) { - if(levelToSet <= 0) return false; - for(FamiliarAugmentPair current : currentAugments) { - if(this.conflicts.contains(current.augment)) return false; + if (levelToSet <= 0) return false; + for (FamiliarAugmentPair current : currentAugments) { + if (this.conflicts.contains(current.augment)) return false; } - if(this.requiresPrevLevel) { + if (this.requiresPrevLevel) { boolean containsAtAll = false; int foundLevel = -1; - for(FamiliarAugmentPair pair : currentAugments) { - if(pair.augment.equals(FamiliarAugment.this)) { + for (FamiliarAugmentPair pair : currentAugments) { + if (pair.augment.equals(FamiliarAugment.this)) { containsAtAll = true; foundLevel = pair.level; } } - if(!containsAtAll) { - if(levelToSet != 1) return false; + if (!containsAtAll) { + if (levelToSet != 1) return false; } else { - if(foundLevel != (levelToSet - 1)) return false; + if (foundLevel != (levelToSet - 1)) return false; } } - for(FamiliarAugmentPrecondition precondition : this.preconditions) { - if(precondition == null) continue; - if(!precondition.isFulfilled(currentAugments, levelToSet)) return false; + for (FamiliarAugmentPrecondition precondition : this.preconditions) { + if (precondition == null) continue; + if (!precondition.isFulfilled(currentAugments, levelToSet)) return false; } return true; } @@ -132,7 +148,6 @@ public class FamiliarAugment { private abstract static class FamiliarAugmentPrecondition { public abstract boolean isFulfilled(FamiliarAugmentList currentAugments, int levelToSet); - } public static class PreconditionAny extends FamiliarAugmentPrecondition { @@ -145,10 +160,10 @@ public class FamiliarAugment { @Override public boolean isFulfilled(FamiliarAugmentList currentAugments, int levelToSet) { - if(this.anyPrevAugment == null) return true; - for(FamiliarAugment augment : this.anyPrevAugment) { - if(augment == null) continue; - if(currentAugments.contains(augment)) return true; + if (this.anyPrevAugment == null) return true; + for (FamiliarAugment augment : this.anyPrevAugment) { + if (augment == null) continue; + if (currentAugments.contains(augment)) return true; } return false; } @@ -164,10 +179,10 @@ public class FamiliarAugment { @Override public boolean isFulfilled(FamiliarAugmentList currentAugments, int levelToSet) { - if(this.prevAugments == null) return true; - for(FamiliarAugment augment : this.prevAugments) { - if(augment == null) continue; - if(!currentAugments.contains(augment)) return false; + if (this.prevAugments == null) return true; + for (FamiliarAugment augment : this.prevAugments) { + if (augment == null) continue; + if (!currentAugments.contains(augment)) return false; } return true; } @@ -181,16 +196,15 @@ public class FamiliarAugment { public FamiliarAugmentPair getAugmentPair(FamiliarAugment augment) { for (FamiliarAugmentPair pair : this) { - if(pair.augment.equals(augment)) return pair; + if (pair.augment.equals(augment)) return pair; } return null; } public int getLevel(FamiliarAugment augment) { - if(!this.contains(augment)) return -1; + if (!this.contains(augment)) return -1; return this.getAugmentPair(augment).level; } - } public static class FamiliarAugmentPair { @@ -210,7 +224,8 @@ public class FamiliarAugment { FamiliarAugmentPair that = (FamiliarAugmentPair) o; - return this.level == that.level && (this.augment != null ? this.augment.equals(that.augment) : that.augment == null); + return this.level == that.level + && (this.augment != null ? this.augment.equals(that.augment) : that.augment == null); } @Override @@ -220,5 +235,4 @@ public class FamiliarAugment { return result; } } - } diff --git a/src/main/java/makeo/gadomancy/common/familiar/FamiliarController.java b/src/main/java/makeo/gadomancy/common/familiar/FamiliarController.java index 5e15b49..4b844ab 100644 --- a/src/main/java/makeo/gadomancy/common/familiar/FamiliarController.java +++ b/src/main/java/makeo/gadomancy/common/familiar/FamiliarController.java @@ -2,6 +2,10 @@ package makeo.gadomancy.common.familiar; import baubles.api.BaublesApi; import cpw.mods.fml.common.network.NetworkRegistry; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Random; import makeo.gadomancy.common.items.baubles.ItemEtherealFamiliar; import makeo.gadomancy.common.network.PacketHandler; import makeo.gadomancy.common.network.packets.PacketFamiliarBolt; @@ -21,11 +25,6 @@ import thaumcraft.common.config.Config; import thaumcraft.common.items.baubles.ItemAmuletVis; import thaumcraft.common.items.wands.ItemWandCasting; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -77,8 +76,10 @@ public class FamiliarController { FamiliarAugment.FamiliarAugmentPair effectElement = null; for (FamiliarAugment.FamiliarAugmentPair pair : augments) { FamiliarAugment augment = pair.augment; - if (augment.equals(FamiliarAugment.SHOCK) || augment.equals(FamiliarAugment.FIRE) - || augment.equals(FamiliarAugment.POISON) || augment.equals(FamiliarAugment.WEAKNESS)) { + if (augment.equals(FamiliarAugment.SHOCK) + || augment.equals(FamiliarAugment.FIRE) + || augment.equals(FamiliarAugment.POISON) + || augment.equals(FamiliarAugment.WEAKNESS)) { effectElement = pair; break; } @@ -108,30 +109,33 @@ public class FamiliarController { } double damage = FamiliarController.DMG_DEF + (dmgLevel != -1 ? FamiliarController.DMG_INC * dmgLevel : 0); - int ticksUntilNextAttack = FamiliarController.AS_DELAY_DEF - (attackSpeedLevel != -1 ? FamiliarController.AS_INC * attackSpeedLevel : 0); - double range = FamiliarController.RANGE_DEF + (rangeLevel != -1 ? FamiliarController.RANGE_INC * rangeLevel : 0); - - if(effectElement != null) { + int ticksUntilNextAttack = FamiliarController.AS_DELAY_DEF + - (attackSpeedLevel != -1 ? FamiliarController.AS_INC * attackSpeedLevel : 0); + double range = + FamiliarController.RANGE_DEF + (rangeLevel != -1 ? FamiliarController.RANGE_INC * rangeLevel : 0); + + if (effectElement != null) { for (int i = 0; i < effectElement.level; i++) { costs.add(effectElement.augment.getCostsPerLevel()); } } - if (!this.owningPlayer.capabilities.isCreativeMode && !FamiliarController.consumeVisFromInventory(this.owningPlayer, costs, false)) { + if (!this.owningPlayer.capabilities.isCreativeMode + && !FamiliarController.consumeVisFromInventory(this.owningPlayer, costs, false)) { return; } if (effectElement == null) { if (this.doEnhancedDefaultAttack(damage, range)) { this.tickLastEffect = ticksUntilNextAttack; - if(!this.owningPlayer.capabilities.isCreativeMode && FamiliarController.RAND.nextInt(3) == 0) { + if (!this.owningPlayer.capabilities.isCreativeMode && FamiliarController.RAND.nextInt(3) == 0) { FamiliarController.consumeVisFromInventory(this.owningPlayer, costs, true); } } } else { if (this.doAttack(effectElement, damage, range)) { this.tickLastEffect = ticksUntilNextAttack; - if(!this.owningPlayer.capabilities.isCreativeMode && FamiliarController.RAND.nextInt(3) == 0) { + if (!this.owningPlayer.capabilities.isCreativeMode && FamiliarController.RAND.nextInt(3) == 0) { FamiliarController.consumeVisFromInventory(this.owningPlayer, costs, true); } } @@ -167,8 +171,11 @@ public class FamiliarController { if (augment.equals(FamiliarAugment.SHOCK)) { for (EntityLivingBase entity : toAttack) { if (FamiliarController.RAND.nextBoolean()) { - Vector3 vel = MiscUtils.getPositionVector(entity).subtract(MiscUtils.getPositionVector(this.owningPlayer)) - .normalize().divide(2).multiply(0.8 * effectLevel); + Vector3 vel = MiscUtils.getPositionVector(entity) + .subtract(MiscUtils.getPositionVector(this.owningPlayer)) + .normalize() + .divide(2) + .multiply(0.8 * effectLevel); if (vel.getY() < 0) vel.setY(-vel.getY()); entity.motionX += vel.getX(); entity.motionY += vel.getY(); @@ -183,14 +190,16 @@ public class FamiliarController { for (EntityLivingBase entity : toAttack) { entity.setFire(fireDur); if (effectLevel == 3) { - entity.addPotionEffect(new PotionEffect(Config.potionSunScornedID, MiscUtils.ticksForMinutes(1), 2)); + entity.addPotionEffect( + new PotionEffect(Config.potionSunScornedID, MiscUtils.ticksForMinutes(1), 2)); } } } else if (augment.equals(FamiliarAugment.POISON)) { int potionLvl = 0; if (effectLevel > 1) potionLvl += 1; for (EntityLivingBase entity : toAttack) { - entity.addPotionEffect(new PotionEffect(Potion.poison.getId(), MiscUtils.ticksForSeconds(30), potionLvl)); + entity.addPotionEffect( + new PotionEffect(Potion.poison.getId(), MiscUtils.ticksForSeconds(30), potionLvl)); if (effectLevel == 3) { entity.addPotionEffect(new PotionEffect(Potion.hunger.getId(), MiscUtils.ticksForMinutes(2), 3)); } @@ -210,8 +219,10 @@ public class FamiliarController { public static boolean consumeVisFromInventory(EntityPlayer player, AspectList cost, boolean doit) { IInventory baubles = BaublesApi.getBaubles(player); for (int a = 0; a < 4; a++) { - if ((baubles.getStackInSlot(a) != null) && ((baubles.getStackInSlot(a).getItem() instanceof ItemAmuletVis))) { - boolean done = ((ItemAmuletVis) baubles.getStackInSlot(a).getItem()).consumeAllVis(baubles.getStackInSlot(a), player, cost, doit, true); + if ((baubles.getStackInSlot(a) != null) + && ((baubles.getStackInSlot(a).getItem() instanceof ItemAmuletVis))) { + boolean done = ((ItemAmuletVis) baubles.getStackInSlot(a).getItem()) + .consumeAllVis(baubles.getStackInSlot(a), player, cost, doit, true); if (done) { return true; } @@ -247,10 +258,23 @@ public class FamiliarController { private void attack(EntityLivingBase toAttack, double damage, int boltType) { toAttack.attackEntityFrom(DamageSource.magic, (float) damage); - toAttack.worldObj.playSoundEffect(toAttack.posX + 0.5, toAttack.posY + 0.5, toAttack.posZ + 0.5, "thaumcraft:zap", 0.8F, 1.0F); - PacketFamiliarBolt bolt = new PacketFamiliarBolt(this.owningPlayer.getCommandSenderName(), (float) toAttack.posX, (float) toAttack.posY, (float) toAttack.posZ, boltType, true); - PacketHandler.INSTANCE.sendToAllAround(bolt, new NetworkRegistry.TargetPoint(toAttack.worldObj.provider.dimensionId, this.owningPlayer.posX, - this.owningPlayer.posY, this.owningPlayer.posZ, 16)); + toAttack.worldObj.playSoundEffect( + toAttack.posX + 0.5, toAttack.posY + 0.5, toAttack.posZ + 0.5, "thaumcraft:zap", 0.8F, 1.0F); + PacketFamiliarBolt bolt = new PacketFamiliarBolt( + this.owningPlayer.getCommandSenderName(), + (float) toAttack.posX, + (float) toAttack.posY, + (float) toAttack.posZ, + boltType, + true); + PacketHandler.INSTANCE.sendToAllAround( + bolt, + new NetworkRegistry.TargetPoint( + toAttack.worldObj.provider.dimensionId, + this.owningPlayer.posX, + this.owningPlayer.posY, + this.owningPlayer.posZ, + 16)); } private List selectEntityToAttack(double rad, int amountToSelectMax) { @@ -271,17 +295,18 @@ public class FamiliarController { double x = this.owningPlayer.posX; double y = this.owningPlayer.posY; double z = this.owningPlayer.posZ; - List entities = this.owningPlayer.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, - AxisAlignedBB.getBoundingBox(x - 0.5, y - 0.5, z - 0.5, x + 0.5, y + 0.5, z + 0.5).expand(rad, rad, rad)); + List entities = this.owningPlayer.worldObj.getEntitiesWithinAABB( + EntityLivingBase.class, + AxisAlignedBB.getBoundingBox(x - 0.5, y - 0.5, z - 0.5, x + 0.5, y + 0.5, z + 0.5) + .expand(rad, rad, rad)); Iterator it = entities.iterator(); while (it.hasNext()) { EntityLivingBase base = it.next(); if (base == null || base.isDead || base instanceof EntityPlayer || !(base instanceof IMob)) it.remove(); - //TODO remove entities we don't want to attack... + // TODO remove entities we don't want to attack... } return entities; } - } diff --git a/src/main/java/makeo/gadomancy/common/integration/IntegrationAutomagy.java b/src/main/java/makeo/gadomancy/common/integration/IntegrationAutomagy.java index 09c4a22..763d4d7 100644 --- a/src/main/java/makeo/gadomancy/common/integration/IntegrationAutomagy.java +++ b/src/main/java/makeo/gadomancy/common/integration/IntegrationAutomagy.java @@ -28,8 +28,14 @@ import thaumcraft.common.config.ConfigBlocks; */ public class IntegrationAutomagy extends IntegrationMod { - //TODO sync with Automagy some time... - private static final AspectList visCostAdvNodeJar = new AspectList().add(Aspect.FIRE, 125).add(Aspect.EARTH, 125).add(Aspect.ORDER, 125).add(Aspect.AIR, 125).add(Aspect.ENTROPY, 125).add(Aspect.WATER, 125); + // TODO sync with Automagy some time... + private static final AspectList visCostAdvNodeJar = new AspectList() + .add(Aspect.FIRE, 125) + .add(Aspect.EARTH, 125) + .add(Aspect.ORDER, 125) + .add(Aspect.AIR, 125) + .add(Aspect.ENTROPY, 125) + .add(Aspect.WATER, 125); @Override public String getModId() { @@ -39,25 +45,26 @@ public class IntegrationAutomagy extends IntegrationMod { @Override protected void doInit() { Block infinityJar = Block.getBlockFromName("Automagy:blockCreativeJar"); - if(infinityJar != null) { + if (infinityJar != null) { RegisteredBlocks.registerStickyJar(infinityJar, 3, false, true); RegisteredItems.registerStickyJar(Item.getItemFromBlock(infinityJar), 3); } - if(ModConfig.enableAdditionalNodeTypes) { + if (ModConfig.enableAdditionalNodeTypes) { CommonProxy.unregisterWandHandler("Automagy", ConfigBlocks.blockWarded, -1); } - //Better bookshelves -> MOAR knowledge + // Better bookshelves -> MOAR knowledge Block betterBookshelf = Block.getBlockFromName("Automagy:blockBookshelfEnchanted"); - if(betterBookshelf != null) { + if (betterBookshelf != null) { TileKnowledgeBook.knowledgeIncreaseMap.put(new TileKnowledgeBook.BlockSnapshot(betterBookshelf, 0), 2); TileKnowledgeBook.knowledgeIncreaseMap.put(new TileKnowledgeBook.BlockSnapshot(betterBookshelf, 1), 4); } } public boolean handleNodeJarVisCost(ItemStack wandStack, EntityPlayer player) { - return ThaumcraftApiHelper.consumeVisFromWandCrafting(wandStack, player, IntegrationAutomagy.visCostAdvNodeJar, true); + return ThaumcraftApiHelper.consumeVisFromWandCrafting( + wandStack, player, IntegrationAutomagy.visCostAdvNodeJar, true); } public void tryFillGolemCrafttable(ChunkCoordinates cc, World world) { @@ -69,15 +76,16 @@ public class IntegrationAutomagy extends IntegrationMod { } TileEntity te = world.getTileEntity(cc.posX, cc.posY, cc.posZ); - if(te != null && workbenchTileClazz.isAssignableFrom(te.getClass())) { //method instanceof checking.. + if (te != null && workbenchTileClazz.isAssignableFrom(te.getClass())) { // method instanceof checking.. try { Injector i = new Injector(te, workbenchTileClazz); int heat = i.getField("craftingHeat"); int impact = i.getField("heatImpactsAt"); - if(heat > impact) { + if (heat > impact) { i.setField("craftingHeat", heat - 700); } - } catch (Exception e) {} + } catch (Exception e) { + } } } } diff --git a/src/main/java/makeo/gadomancy/common/integration/IntegrationMod.java b/src/main/java/makeo/gadomancy/common/integration/IntegrationMod.java index 6f98b9c..dea8b30 100644 --- a/src/main/java/makeo/gadomancy/common/integration/IntegrationMod.java +++ b/src/main/java/makeo/gadomancy/common/integration/IntegrationMod.java @@ -20,7 +20,7 @@ public abstract class IntegrationMod { } public final void init() { - if(Loader.isModLoaded(this.getModId())) { + if (Loader.isModLoaded(this.getModId())) { this.isPresent = true; this.doInit(); } diff --git a/src/main/java/makeo/gadomancy/common/integration/IntegrationMorph.java b/src/main/java/makeo/gadomancy/common/integration/IntegrationMorph.java index ed273d9..c8e8896 100644 --- a/src/main/java/makeo/gadomancy/common/integration/IntegrationMorph.java +++ b/src/main/java/makeo/gadomancy/common/integration/IntegrationMorph.java @@ -2,12 +2,11 @@ package makeo.gadomancy.common.integration; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.lang.reflect.Method; import makeo.gadomancy.common.utils.Injector; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; -import java.lang.reflect.Method; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -28,18 +27,19 @@ public class IntegrationMorph extends IntegrationMod { @Override protected void doInit() { - //methodHasMorph = Injector.getMethod("hasMorph", "morph.common.core.ApiHandler", String.class, Boolean.class); + // methodHasMorph = Injector.getMethod("hasMorph", "morph.common.core.ApiHandler", String.class, Boolean.class); - //if(methodHasMorph == null) { + // if(methodHasMorph == null) { // FMLLog.severe("Morph mod is loaded but failed to find method \"hasMorph\"!"); - //} + // } } @SideOnly(Side.CLIENT) public boolean isMorphed() { - if(this.methodHasMorph != null) { + if (this.methodHasMorph != null) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; - Boolean result = IntegrationMorph.INJECTOR.invokeMethod(this.methodHasMorph, player.getCommandSenderName(), true); + Boolean result = + IntegrationMorph.INJECTOR.invokeMethod(this.methodHasMorph, player.getCommandSenderName(), true); return result != null ? result : false; } return false; diff --git a/src/main/java/makeo/gadomancy/common/integration/IntegrationNEI.java b/src/main/java/makeo/gadomancy/common/integration/IntegrationNEI.java index 9f4f822..939e488 100644 --- a/src/main/java/makeo/gadomancy/common/integration/IntegrationNEI.java +++ b/src/main/java/makeo/gadomancy/common/integration/IntegrationNEI.java @@ -1,5 +1,7 @@ package makeo.gadomancy.common.integration; +import java.util.ArrayList; +import java.util.Iterator; import makeo.gadomancy.common.items.ItemFakeGolemPlacer; import makeo.gadomancy.common.registration.RegisteredBlocks; import makeo.gadomancy.common.registration.RegisteredItems; @@ -8,9 +10,6 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import java.util.ArrayList; -import java.util.Iterator; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -37,7 +36,8 @@ public class IntegrationNEI extends IntegrationMod { this.hideItem(new ItemStack(RegisteredItems.itemFakeLootbag, 1, Short.MAX_VALUE)); this.hideItem(new ItemStack(RegisteredBlocks.blockExtendedNodeJar, 1, Short.MAX_VALUE)); this.hideItem(new ItemStack(RegisteredItems.itemExtendedNodeJar, 1, Short.MAX_VALUE)); - this.hideItem(new ItemStack(RegisteredItems.itemFakeGolemPlacer, 1, Short.MAX_VALUE)); //This does... nothing? ffs. + this.hideItem( + new ItemStack(RegisteredItems.itemFakeGolemPlacer, 1, Short.MAX_VALUE)); // This does... nothing? ffs. this.hideItem(new ItemStack(RegisteredItems.itemTransformationFocus, 1, Short.MAX_VALUE)); this.hideItem(new ItemStack(RegisteredItems.itemFamiliar_old, 1, Short.MAX_VALUE)); } @@ -46,8 +46,10 @@ public class IntegrationNEI extends IntegrationMod { Iterator iterator = items.iterator(); while (iterator.hasNext()) { Object item = iterator.next(); - if (item != null && item instanceof ItemStack && ((ItemStack) item).getItem() != null && - ((ItemStack) item).getItem() instanceof ItemFakeGolemPlacer) { + if (item != null + && item instanceof ItemStack + && ((ItemStack) item).getItem() != null + && ((ItemStack) item).getItem() instanceof ItemFakeGolemPlacer) { iterator.remove(); } } @@ -62,6 +64,6 @@ public class IntegrationNEI extends IntegrationMod { } public void setItemListEntries(Item item, Iterable items) { - this.nei.invokeMethod("setItemListEntries", new Class[]{Item.class, Iterable.class}, item, items); + this.nei.invokeMethod("setItemListEntries", new Class[] {Item.class, Iterable.class}, item, items); } } diff --git a/src/main/java/makeo/gadomancy/common/integration/IntegrationThaumicExploration.java b/src/main/java/makeo/gadomancy/common/integration/IntegrationThaumicExploration.java index b58e5f9..ee475e4 100644 --- a/src/main/java/makeo/gadomancy/common/integration/IntegrationThaumicExploration.java +++ b/src/main/java/makeo/gadomancy/common/integration/IntegrationThaumicExploration.java @@ -23,7 +23,7 @@ public class IntegrationThaumicExploration extends IntegrationMod { @Override protected void doInit() { Block trashJar = Block.getBlockFromName("ThaumicExploration:trashJar"); - if(trashJar != null) { + if (trashJar != null) { RegisteredBlocks.registerStickyJar(trashJar, 0, false, true); RegisteredItems.registerStickyJar(Item.getItemFromBlock(trashJar), 0, new ItemStack(trashJar), "TRASHJAR"); } diff --git a/src/main/java/makeo/gadomancy/common/integration/IntegrationThaumicTinkerer.java b/src/main/java/makeo/gadomancy/common/integration/IntegrationThaumicTinkerer.java index 497881a..72f177e 100644 --- a/src/main/java/makeo/gadomancy/common/integration/IntegrationThaumicTinkerer.java +++ b/src/main/java/makeo/gadomancy/common/integration/IntegrationThaumicTinkerer.java @@ -22,22 +22,27 @@ public class IntegrationThaumicTinkerer extends IntegrationMod { @Override public void doInit() { try { - IntegrationThaumicTinkerer.infusedCropBlockClass = Class.forName("thaumic.tinkerer.common.block.BlockInfusedGrain"); - IntegrationThaumicTinkerer.infusedCropTile = Class.forName("thaumic.tinkerer.common.block.tile.TileInfusedGrain"); - if(IntegrationThaumicTinkerer.infusedCropBlockClass != null && IntegrationThaumicTinkerer.infusedCropTile != null) { + IntegrationThaumicTinkerer.infusedCropBlockClass = + Class.forName("thaumic.tinkerer.common.block.BlockInfusedGrain"); + IntegrationThaumicTinkerer.infusedCropTile = + Class.forName("thaumic.tinkerer.common.block.tile.TileInfusedGrain"); + if (IntegrationThaumicTinkerer.infusedCropBlockClass != null + && IntegrationThaumicTinkerer.infusedCropTile != null) { Gadomancy.log.info("Hooked TTinkerer magic-crops"); } - } catch (Throwable tr) {} + } catch (Throwable tr) { + } } public static boolean isCropBlock(Block block) { - if(IntegrationThaumicTinkerer.infusedCropBlockClass == null) return false; - return block.getClass().equals(IntegrationThaumicTinkerer.infusedCropBlockClass) || IntegrationThaumicTinkerer.infusedCropBlockClass.isAssignableFrom(block.getClass()); + if (IntegrationThaumicTinkerer.infusedCropBlockClass == null) return false; + return block.getClass().equals(IntegrationThaumicTinkerer.infusedCropBlockClass) + || IntegrationThaumicTinkerer.infusedCropBlockClass.isAssignableFrom(block.getClass()); } public static boolean isCropTile(TileEntity te) { - if(IntegrationThaumicTinkerer.infusedCropTile == null) return false; - return te.getClass().equals(IntegrationThaumicTinkerer.infusedCropTile) || IntegrationThaumicTinkerer.infusedCropTile.isAssignableFrom(te.getClass()); + if (IntegrationThaumicTinkerer.infusedCropTile == null) return false; + return te.getClass().equals(IntegrationThaumicTinkerer.infusedCropTile) + || IntegrationThaumicTinkerer.infusedCropTile.isAssignableFrom(te.getClass()); } - } diff --git a/src/main/java/makeo/gadomancy/common/integration/mystcraft/EventHandlerMystcraft.java b/src/main/java/makeo/gadomancy/common/integration/mystcraft/EventHandlerMystcraft.java index bbb60a1..2200341 100644 --- a/src/main/java/makeo/gadomancy/common/integration/mystcraft/EventHandlerMystcraft.java +++ b/src/main/java/makeo/gadomancy/common/integration/mystcraft/EventHandlerMystcraft.java @@ -16,12 +16,11 @@ public class EventHandlerMystcraft { @SubscribeEvent public void onLink(LinkEvent.LinkEventAllow event) { - if(event.origin != null && event.origin.provider.dimensionId == ModConfig.dimOuterId) { + if (event.origin != null && event.origin.provider.dimensionId == ModConfig.dimOuterId) { event.setCanceled(true); } - if(event.destination != null && event.destination.provider.dimensionId == ModConfig.dimOuterId) { + if (event.destination != null && event.destination.provider.dimensionId == ModConfig.dimOuterId) { event.setCanceled(true); } } - } diff --git a/src/main/java/makeo/gadomancy/common/integration/thaumichorizions/IntegrationThaumicHorizions.java b/src/main/java/makeo/gadomancy/common/integration/thaumichorizions/IntegrationThaumicHorizions.java index f775a59..3b61dfd 100644 --- a/src/main/java/makeo/gadomancy/common/integration/thaumichorizions/IntegrationThaumicHorizions.java +++ b/src/main/java/makeo/gadomancy/common/integration/thaumichorizions/IntegrationThaumicHorizions.java @@ -40,10 +40,11 @@ public class IntegrationThaumicHorizions extends IntegrationMod { @Override protected void doInit() { - if(Gadomancy.proxy.getSide() == Side.CLIENT) { + if (Gadomancy.proxy.getSide() == Side.CLIENT) { RendererLivingEntity render = ClientProxy.unregisterRenderer(EntityGolemTH.class, RenderGolemTH.class); - if(render != null) { - RenderingRegistry.registerEntityRenderingHandler(EntityGolemTH.class, new RenderAdditionalGolemTH(render.mainModel)); + if (render != null) { + RenderingRegistry.registerEntityRenderingHandler( + EntityGolemTH.class, new RenderAdditionalGolemTH(render.mainModel)); } IntegrationThaumicHorizions.modMatrix = Block.getBlockFromName("ThaumicHorizons:modMatrix"); @@ -78,13 +79,11 @@ public class IntegrationThaumicHorizions extends IntegrationMod { @SubscribeEvent(priority = EventPriority.LOWEST) public void on(AttackEntityEvent e) { EntityPlayer player = e.entityPlayer; - if(!e.target.worldObj.isRemote && e.target instanceof EntityGolemTH - && player.isSneaking()) { + if (!e.target.worldObj.isRemote && e.target instanceof EntityGolemTH && player.isSneaking()) { e.setCanceled(true); ItemStack stack = player.getCurrentEquippedItem(); - if (stack != null && stack.getItem().onLeftClickEntity(stack, player, e.target) - && e.target.isDead) { + if (stack != null && stack.getItem().onLeftClickEntity(stack, player, e.target) && e.target.isDead) { CommonProxy.EVENT_HANDLER_GOLEM.on(new PlaySoundAtEntityEvent(e.target, "thaumcraft:zap", 0.5f, 1.0f)); } } diff --git a/src/main/java/makeo/gadomancy/common/integration/thaumichorizions/RenderAdditionalGolemTH.java b/src/main/java/makeo/gadomancy/common/integration/thaumichorizions/RenderAdditionalGolemTH.java index e76c5af..4c47367 100644 --- a/src/main/java/makeo/gadomancy/common/integration/thaumichorizions/RenderAdditionalGolemTH.java +++ b/src/main/java/makeo/gadomancy/common/integration/thaumichorizions/RenderAdditionalGolemTH.java @@ -44,11 +44,11 @@ public class RenderAdditionalGolemTH extends RenderGolemTH { int ret = super.shouldRenderPass(entity, pass, par3); - //fix for render bug in tc + // fix for render bug in tc if (RenderGolemHelper.requiresRenderFix((EntityGolemBase) entity)) { RenderGolemHelper.renderCarriedItemsFix(golem); - if(this.toolItem != null) { + if (this.toolItem != null) { RenderGolemHelper.renderToolItem(golem, this.toolItem, this.mainModel, this.renderManager); } } @@ -64,7 +64,7 @@ public class RenderAdditionalGolemTH extends RenderGolemTH { @Override protected void renderCarriedItems(EntityGolemBase golem, float par2) { if (!RenderGolemHelper.requiresRenderFix(golem)) { - if(this.toolItem != null) { + if (this.toolItem != null) { RenderGolemHelper.renderToolItem(golem, this.toolItem, this.mainModel, this.renderManager); } super.renderCarriedItems(golem, par2); @@ -75,7 +75,7 @@ public class RenderAdditionalGolemTH extends RenderGolemTH { public void render(EntityGolemBase golem, double par2, double par4, double par6, float par8, float par9) { AdditionalGolemCore core = GadomancyApi.getAdditionalGolemCore(golem); ItemStack carriedItem = null; - if(core != null) { + if (core != null) { this.toolItem = core.getToolItem(golem); carriedItem = golem.getCarriedForDisplay(); @@ -84,7 +84,7 @@ public class RenderAdditionalGolemTH extends RenderGolemTH { super.render(golem, par2, par4, par6, par8, par9); - if(carriedItem != null) { + if (carriedItem != null) { golem.getDataWatcher().getWatchedObject(16).setObject(carriedItem); this.toolItem = null; } diff --git a/src/main/java/makeo/gadomancy/common/integration/waila/AdvancedGolemProvider.java b/src/main/java/makeo/gadomancy/common/integration/waila/AdvancedGolemProvider.java index dced808..733603f 100644 --- a/src/main/java/makeo/gadomancy/common/integration/waila/AdvancedGolemProvider.java +++ b/src/main/java/makeo/gadomancy/common/integration/waila/AdvancedGolemProvider.java @@ -2,6 +2,7 @@ package makeo.gadomancy.common.integration.waila; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.ModContainer; +import java.util.List; import makeo.gadomancy.api.GadomancyApi; import makeo.gadomancy.api.golems.AdditionalGolemType; import makeo.gadomancy.common.utils.ColorHelper; @@ -14,8 +15,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import thaumcraft.common.entities.golems.EntityGolemBase; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -31,24 +30,28 @@ public class AdvancedGolemProvider implements IWailaEntityProvider { } @Override - public List getWailaHead(Entity paramEntity, List strings, IWailaEntityAccessor data, IWailaConfigHandler config) { + public List getWailaHead( + Entity paramEntity, List strings, IWailaEntityAccessor data, IWailaConfigHandler config) { return null; } @Override - public List getWailaBody(Entity paramEntity, List strings, IWailaEntityAccessor data, IWailaConfigHandler config) { + public List getWailaBody( + Entity paramEntity, List strings, IWailaEntityAccessor data, IWailaConfigHandler config) { return null; } @Override - public List getWailaTail(Entity paramEntity, List strings, IWailaEntityAccessor data, IWailaConfigHandler config) { - if(data.getEntity() instanceof EntityGolemBase) { - AdditionalGolemType type = GadomancyApi.getAdditionalGolemType(((EntityGolemBase) data.getEntity()).getGolemType()); - if(type != null && strings.size() > 0) { + public List getWailaTail( + Entity paramEntity, List strings, IWailaEntityAccessor data, IWailaConfigHandler config) { + if (data.getEntity() instanceof EntityGolemBase) { + AdditionalGolemType type = + GadomancyApi.getAdditionalGolemType(((EntityGolemBase) data.getEntity()).getGolemType()); + if (type != null && strings.size() > 0) { String oldMod = strings.get(strings.size() - 1); ModContainer container = Loader.instance().getIndexedModList().get(type.getModId()); - if(container != null) { + if (container != null) { String mod = ColorHelper.extractColors(oldMod) + container.getName(); strings.remove(strings.size() - 1); @@ -60,7 +63,11 @@ public class AdvancedGolemProvider implements IWailaEntityProvider { } @Override - public NBTTagCompound getNBTData(EntityPlayerMP paramEntityPlayerMP, Entity paramEntity, NBTTagCompound paramNBTTagCompound, World paramWorld) { + public NBTTagCompound getNBTData( + EntityPlayerMP paramEntityPlayerMP, + Entity paramEntity, + NBTTagCompound paramNBTTagCompound, + World paramWorld) { return null; } } diff --git a/src/main/java/makeo/gadomancy/common/integration/waila/InfusionClawProvider.java b/src/main/java/makeo/gadomancy/common/integration/waila/InfusionClawProvider.java index d652539..63868a6 100644 --- a/src/main/java/makeo/gadomancy/common/integration/waila/InfusionClawProvider.java +++ b/src/main/java/makeo/gadomancy/common/integration/waila/InfusionClawProvider.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.integration.waila; +import java.util.List; import makeo.gadomancy.common.blocks.tiles.TileInfusionClaw; import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; @@ -11,8 +12,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -23,31 +22,51 @@ import java.util.List; */ public class InfusionClawProvider implements IWailaDataProvider { @Override - public ItemStack getWailaStack(IWailaDataAccessor paramIWailaDataAccessor, IWailaConfigHandler paramIWailaConfigHandler) { + public ItemStack getWailaStack( + IWailaDataAccessor paramIWailaDataAccessor, IWailaConfigHandler paramIWailaConfigHandler) { return null; } @Override - public List getWailaHead(ItemStack paramItemStack, List paramList, IWailaDataAccessor paramIWailaDataAccessor, IWailaConfigHandler paramIWailaConfigHandler) { + public List getWailaHead( + ItemStack paramItemStack, + List paramList, + IWailaDataAccessor paramIWailaDataAccessor, + IWailaConfigHandler paramIWailaConfigHandler) { return null; } @Override - public List getWailaBody(ItemStack paramItemStack, List strings, IWailaDataAccessor dataAccessor, IWailaConfigHandler paramIWailaConfigHandler) { + public List getWailaBody( + ItemStack paramItemStack, + List strings, + IWailaDataAccessor dataAccessor, + IWailaConfigHandler paramIWailaConfigHandler) { TileInfusionClaw tile = (TileInfusionClaw) dataAccessor.getTileEntity(); - if(tile.hasOwner()) { + if (tile.hasOwner()) { strings.add(StatCollector.translateToLocal("gadomancy.info.InfusionClaw.waila") + " " + tile.getOwner()); } return strings; } @Override - public List getWailaTail(ItemStack paramItemStack, List paramList, IWailaDataAccessor dataAccessor, IWailaConfigHandler paramIWailaConfigHandler) { + public List getWailaTail( + ItemStack paramItemStack, + List paramList, + IWailaDataAccessor dataAccessor, + IWailaConfigHandler paramIWailaConfigHandler) { return null; } @Override - public NBTTagCompound getNBTData(EntityPlayerMP paramEntityPlayerMP, TileEntity paramTileEntity, NBTTagCompound paramNBTTagCompound, World paramWorld, int paramInt1, int paramInt2, int paramInt3) { + public NBTTagCompound getNBTData( + EntityPlayerMP paramEntityPlayerMP, + TileEntity paramTileEntity, + NBTTagCompound paramNBTTagCompound, + World paramWorld, + int paramInt1, + int paramInt2, + int paramInt3) { return null; } } diff --git a/src/main/java/makeo/gadomancy/common/integration/waila/RemoteJarProvider.java b/src/main/java/makeo/gadomancy/common/integration/waila/RemoteJarProvider.java index a7400d2..7bf9f71 100644 --- a/src/main/java/makeo/gadomancy/common/integration/waila/RemoteJarProvider.java +++ b/src/main/java/makeo/gadomancy/common/integration/waila/RemoteJarProvider.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.integration.waila; +import java.util.List; import makeo.gadomancy.common.blocks.BlockRemoteJar; import makeo.gadomancy.common.blocks.tiles.TileRemoteJar; import makeo.gadomancy.common.items.ItemBlockRemoteJar; @@ -13,8 +14,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -30,26 +29,47 @@ public class RemoteJarProvider implements IWailaDataProvider { } @Override - public List getWailaHead(ItemStack stack, List strings, IWailaDataAccessor dataAccessor, IWailaConfigHandler iWailaConfigHandler) { + public List getWailaHead( + ItemStack stack, + List strings, + IWailaDataAccessor dataAccessor, + IWailaConfigHandler iWailaConfigHandler) { return null; } @Override - public List getWailaBody(ItemStack stack, List strings, IWailaDataAccessor dataAccessor, IWailaConfigHandler iWailaConfigHandler) { + public List getWailaBody( + ItemStack stack, + List strings, + IWailaDataAccessor dataAccessor, + IWailaConfigHandler iWailaConfigHandler) { TileRemoteJar tile = BlockRemoteJar.getJarTile(dataAccessor.getTileEntity()); - if(tile.networkId != null) { - strings.add(String.format(StatCollector.translateToLocal("gadomancy.lore.remotejar"), ItemBlockRemoteJar.generateName(tile.networkId))); + if (tile.networkId != null) { + strings.add(String.format( + StatCollector.translateToLocal("gadomancy.lore.remotejar"), + ItemBlockRemoteJar.generateName(tile.networkId))); } return strings; } @Override - public List getWailaTail(ItemStack stack, List strings, IWailaDataAccessor dataAccessor, IWailaConfigHandler iWailaConfigHandler) { + public List getWailaTail( + ItemStack stack, + List strings, + IWailaDataAccessor dataAccessor, + IWailaConfigHandler iWailaConfigHandler) { return null; } @Override - public NBTTagCompound getNBTData(EntityPlayerMP entityPlayerMP, TileEntity tileEntity, NBTTagCompound compound, World world, int i, int i2, int i3) { + public NBTTagCompound getNBTData( + EntityPlayerMP entityPlayerMP, + TileEntity tileEntity, + NBTTagCompound compound, + World world, + int i, + int i2, + int i3) { return null; } } diff --git a/src/main/java/makeo/gadomancy/common/integration/waila/StickyJarProvider.java b/src/main/java/makeo/gadomancy/common/integration/waila/StickyJarProvider.java index a7c42dc..1a9016d 100644 --- a/src/main/java/makeo/gadomancy/common/integration/waila/StickyJarProvider.java +++ b/src/main/java/makeo/gadomancy/common/integration/waila/StickyJarProvider.java @@ -1,5 +1,9 @@ package makeo.gadomancy.common.integration.waila; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.blocks.tiles.TileStickyJar; import makeo.gadomancy.common.utils.ColorHelper; @@ -13,11 +17,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -29,12 +28,15 @@ import java.util.Map; public class StickyJarProvider implements IWailaDataProvider { @Override public ItemStack getWailaStack(final IWailaDataAccessor data, final IWailaConfigHandler config) { - if(data.getTileEntity() instanceof TileStickyJar) { + if (data.getTileEntity() instanceof TileStickyJar) { TileStickyJar stickyJar = (TileStickyJar) data.getTileEntity(); - if(stickyJar.isValid()) { + if (stickyJar.isValid()) { ItemStack stack = new ItemStack(stickyJar.getParentBlock(), 1, stickyJar.getBlockMetadata()); - for(IWailaDataProvider provider : this.getParentProviders(ModuleRegistrar.instance().stackBlockProviders, stickyJar.getParentBlock().getClass(), stickyJar.getParent().getClass())) { + for (IWailaDataProvider provider : this.getParentProviders( + ModuleRegistrar.instance().stackBlockProviders, + stickyJar.getParentBlock().getClass(), + stickyJar.getParent().getClass())) { stack = provider.getWailaStack(data, config); } return stack; @@ -43,58 +45,76 @@ public class StickyJarProvider implements IWailaDataProvider { return null; } - private List getParentProviders(LinkedHashMap> providerMap, Class... classes) { + private List getParentProviders( + LinkedHashMap> providerMap, Class... classes) { List providers = new ArrayList(); - for(Class parent : classes) { + for (Class parent : classes) { ArrayList providerList = providerMap.get(parent); - if(providerList != null) - providers.addAll(providerList); + if (providerList != null) providers.addAll(providerList); } return providers; } @Override - public List getWailaHead(final ItemStack stack, final List strings, final IWailaDataAccessor data, final IWailaConfigHandler config) { + public List getWailaHead( + final ItemStack stack, + final List strings, + final IWailaDataAccessor data, + final IWailaConfigHandler config) { TileStickyJar tile = (TileStickyJar) data.getTileEntity(); - if(tile != null && tile.isValid()) { - this.callParentProviders(ModuleRegistrar.instance().getBodyProviders(tile.getParentBlock()), new Callable() { - @Override - public void call(IWailaDataProvider provider) { - provider.getWailaHead(stack, strings, data, config); - } - }); + if (tile != null && tile.isValid()) { + this.callParentProviders( + ModuleRegistrar.instance().getBodyProviders(tile.getParentBlock()), + new Callable() { + @Override + public void call(IWailaDataProvider provider) { + provider.getWailaHead(stack, strings, data, config); + } + }); } return strings; } @Override - public List getWailaBody(final ItemStack stack, final List strings, final IWailaDataAccessor data, final IWailaConfigHandler config) { + public List getWailaBody( + final ItemStack stack, + final List strings, + final IWailaDataAccessor data, + final IWailaConfigHandler config) { TileStickyJar tile = (TileStickyJar) data.getTileEntity(); - if(tile != null && tile.isValid()) { - this.callParentProviders(ModuleRegistrar.instance().getBodyProviders(tile.getParentBlock()), new Callable() { - @Override - public void call(IWailaDataProvider provider) { - provider.getWailaBody(stack, strings, data, config); - } - }); + if (tile != null && tile.isValid()) { + this.callParentProviders( + ModuleRegistrar.instance().getBodyProviders(tile.getParentBlock()), + new Callable() { + @Override + public void call(IWailaDataProvider provider) { + provider.getWailaBody(stack, strings, data, config); + } + }); } return strings; } @Override - public List getWailaTail(final ItemStack stack, final List strings, final IWailaDataAccessor data, final IWailaConfigHandler config) { + public List getWailaTail( + final ItemStack stack, + final List strings, + final IWailaDataAccessor data, + final IWailaConfigHandler config) { TileStickyJar tile = (TileStickyJar) data.getTileEntity(); - if(tile != null && tile.isValid()) { - this.callParentProviders(ModuleRegistrar.instance().getBodyProviders(tile.getParentBlock()), new Callable() { - @Override - public void call(IWailaDataProvider provider) { - provider.getWailaTail(stack, strings, data, config); - } - }); + if (tile != null && tile.isValid()) { + this.callParentProviders( + ModuleRegistrar.instance().getBodyProviders(tile.getParentBlock()), + new Callable() { + @Override + public void call(IWailaDataProvider provider) { + provider.getWailaTail(stack, strings, data, config); + } + }); } - if(data.getTileEntity() instanceof TileStickyJar) { - if(strings.size() > 0) { + if (data.getTileEntity() instanceof TileStickyJar) { + if (strings.size() > 0) { String oldMod = strings.get(strings.size() - 1); String mod = ColorHelper.extractColors(oldMod) + Gadomancy.NAME; strings.remove(strings.size() - 1); @@ -105,13 +125,21 @@ public class StickyJarProvider implements IWailaDataProvider { } @Override - public NBTTagCompound getNBTData(EntityPlayerMP paramEntityPlayerMP, TileEntity paramTileEntity, NBTTagCompound paramNBTTagCompound, World paramWorld, int paramInt1, int paramInt2, int paramInt3) { + public NBTTagCompound getNBTData( + EntityPlayerMP paramEntityPlayerMP, + TileEntity paramTileEntity, + NBTTagCompound paramNBTTagCompound, + World paramWorld, + int paramInt1, + int paramInt2, + int paramInt3) { return null; } - private void callParentProviders(Map> providers, Callable callable) { - for(Map.Entry> entry : providers.entrySet()) { - for(IWailaDataProvider provider : entry.getValue()) { + private void callParentProviders( + Map> providers, Callable callable) { + for (Map.Entry> entry : providers.entrySet()) { + for (IWailaDataProvider provider : entry.getValue()) { callable.call(provider); } } diff --git a/src/main/java/makeo/gadomancy/common/items/ItemArcanePackage.java b/src/main/java/makeo/gadomancy/common/items/ItemArcanePackage.java index 845e6d9..a68975f 100644 --- a/src/main/java/makeo/gadomancy/common/items/ItemArcanePackage.java +++ b/src/main/java/makeo/gadomancy/common/items/ItemArcanePackage.java @@ -1,5 +1,10 @@ package makeo.gadomancy.common.items; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.registration.RegisteredItems; import makeo.gadomancy.common.utils.NBTHelper; @@ -15,12 +20,6 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import thaumcraft.common.lib.utils.InventoryUtils; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -56,9 +55,9 @@ public class ItemArcanePackage extends ItemFakeLootbag { items = new ArrayList(tempInv.getSizeInventory()); - for(int i = 0; i < tempInv.getSizeInventory(); i++) { + for (int i = 0; i < tempInv.getSizeInventory(); i++) { ItemStack item = tempInv.getStackInSlot(i); - if(item != null) { + if (item != null) { items.add(item); } } @@ -66,18 +65,18 @@ public class ItemArcanePackage extends ItemFakeLootbag { Collections.sort(items, new Comparator() { @Override public int compare(ItemStack i1, ItemStack i2) { - return i1.writeToNBT(new NBTTagCompound()).hashCode() - i2.writeToNBT(new NBTTagCompound()).hashCode(); + return i1.writeToNBT(new NBTTagCompound()).hashCode() + - i2.writeToNBT(new NBTTagCompound()).hashCode(); } }); NBTTagList stackList = new NBTTagList(); for (ItemStack item : items) { - //Prevent depth of more then 2 packages - if(item.getItem() == RegisteredItems.itemPackage - || item.getItem() == RegisteredItems.itemFakeLootbag) { + // Prevent depth of more then 2 packages + if (item.getItem() == RegisteredItems.itemPackage || item.getItem() == RegisteredItems.itemFakeLootbag) { List packedItems = this.getContents(item); - for(ItemStack packedItem : packedItems) { - if(packedItem.getItem() == RegisteredItems.itemPackage) { + for (ItemStack packedItem : packedItems) { + if (packedItem.getItem() == RegisteredItems.itemPackage) { return false; } } @@ -89,8 +88,8 @@ public class ItemArcanePackage extends ItemFakeLootbag { compound.setTag("data", stackList); try { byte[] data = CompressedStreamTools.compress(compound); - //If the compound is too long it will not work to prevent lag - if(data.length > ItemArcanePackage.MAX_PACKAGE_SIZE) { + // If the compound is too long it will not work to prevent lag + if (data.length > ItemArcanePackage.MAX_PACKAGE_SIZE) { return false; } NBTHelper.getData(stack).setByteArray("items", data); @@ -104,10 +103,12 @@ public class ItemArcanePackage extends ItemFakeLootbag { List contents = new ArrayList(); if (stack.hasTagCompound()) { byte[] data = stack.getTagCompound().getByteArray("items"); - if(data.length > 0) { + if (data.length > 0) { NBTTagList stackList; try { - stackList = (NBTTagList) CompressedStreamTools.func_152457_a(data, new NBTSizeTracker(Long.MAX_VALUE)).getTag("data"); + stackList = + (NBTTagList) CompressedStreamTools.func_152457_a(data, new NBTSizeTracker(Long.MAX_VALUE)) + .getTag("data"); } catch (Exception e) { return contents; } diff --git a/src/main/java/makeo/gadomancy/common/items/ItemAuraCore.java b/src/main/java/makeo/gadomancy/common/items/ItemAuraCore.java index 1c63f33..29c8ddb 100644 --- a/src/main/java/makeo/gadomancy/common/items/ItemAuraCore.java +++ b/src/main/java/makeo/gadomancy/common/items/ItemAuraCore.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.items; +import java.util.List; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.registration.RegisteredItems; import net.minecraft.client.renderer.texture.IIconRegister; @@ -15,8 +16,6 @@ import org.lwjgl.opengl.GL11; import thaumcraft.api.aspects.Aspect; import thaumcraft.common.blocks.BlockCustomOreItem; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -43,7 +42,7 @@ public class ItemAuraCore extends Item { @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean flag) { AuraCoreType type = this.getCoreType(stack); - if(type != null) { + if (type != null) { list.add(EnumChatFormatting.GRAY + type.getLocalizedName()); } } @@ -70,11 +69,11 @@ public class ItemAuraCore extends Item { @Override public IIcon getIcon(ItemStack stack, int pass) { - //shhhhh don't tell anyone! + // shhhhh don't tell anyone! GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - if(this.getCoreType(stack) == AuraCoreType.BLANK && pass == 0) { + if (this.getCoreType(stack) == AuraCoreType.BLANK && pass == 0) { return this.coreBlankIcon; } return pass == 0 ? this.coreIcon : this.borderIcon; @@ -87,10 +86,10 @@ public class ItemAuraCore extends Item { @Override public int getColorFromItemStack(ItemStack stack, int pass) { - if(pass == 0) { + if (pass == 0) { AuraCoreType type = this.getCoreType(stack); - if(type.isAspect()) { - if(type.ordinal() < 7) { + if (type.isAspect()) { + if (type.ordinal() < 7) { return BlockCustomOreItem.colors[type.ordinal()]; } return type.getAspect().getColor(); @@ -156,8 +155,10 @@ public class ItemAuraCore extends Item { } public String getLocalizedName() { - String name = this.isAspect() ? this.aspect.getName() : StatCollector.translateToLocal("gadomancy.auracore." + this.unlocName); - if(this.unused) { + String name = this.isAspect() + ? this.aspect.getName() + : StatCollector.translateToLocal("gadomancy.auracore." + this.unlocName); + if (this.unused) { name += " " + StatCollector.translateToLocal("gadomancy.auracore.unused"); } return name; diff --git a/src/main/java/makeo/gadomancy/common/items/ItemBlockAdditionalEldritchPortal.java b/src/main/java/makeo/gadomancy/common/items/ItemBlockAdditionalEldritchPortal.java index 7fef5e6..1e03692 100644 --- a/src/main/java/makeo/gadomancy/common/items/ItemBlockAdditionalEldritchPortal.java +++ b/src/main/java/makeo/gadomancy/common/items/ItemBlockAdditionalEldritchPortal.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.items; +import java.util.List; import makeo.gadomancy.common.Gadomancy; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; @@ -10,8 +11,6 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; 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 @@ -35,7 +34,8 @@ public class ItemBlockAdditionalEldritchPortal extends ItemBlock { @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean flag) { - list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("gadomancy.eldritch.portalPlacerCreative")); + list.add(EnumChatFormatting.DARK_PURPLE + + StatCollector.translateToLocal("gadomancy.eldritch.portalPlacerCreative")); super.addInformation(stack, player, list, flag); } diff --git a/src/main/java/makeo/gadomancy/common/items/ItemBlockKnowledgeBook.java b/src/main/java/makeo/gadomancy/common/items/ItemBlockKnowledgeBook.java index 891725b..96c7fa8 100644 --- a/src/main/java/makeo/gadomancy/common/items/ItemBlockKnowledgeBook.java +++ b/src/main/java/makeo/gadomancy/common/items/ItemBlockKnowledgeBook.java @@ -30,12 +30,24 @@ public class ItemBlockKnowledgeBook extends ItemBlock { } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float hitX, + float hitY, + float hitZ) { ForgeDirection placedAgainstDir = ForgeDirection.getOrientation(side); Block placedAgainst = world.getBlock(x, y, z); int againstMeta = world.getBlockMetadata(x, y, z); - if(placedAgainstDir.equals(ForgeDirection.UP) && placedAgainst.equals(ConfigBlocks.blockStoneDevice) && againstMeta == 1) { - if(world.isAirBlock(x, y + 2, z)) { + if (placedAgainstDir.equals(ForgeDirection.UP) + && placedAgainst.equals(ConfigBlocks.blockStoneDevice) + && againstMeta == 1) { + if (world.isAirBlock(x, y + 2, z)) { return super.onItemUse(stack, player, world, x, y, z, side, hitX, hitY, hitZ); } else { return false; diff --git a/src/main/java/makeo/gadomancy/common/items/ItemBlockRemoteJar.java b/src/main/java/makeo/gadomancy/common/items/ItemBlockRemoteJar.java index 93cc379..ae6fcdc 100644 --- a/src/main/java/makeo/gadomancy/common/items/ItemBlockRemoteJar.java +++ b/src/main/java/makeo/gadomancy/common/items/ItemBlockRemoteJar.java @@ -2,6 +2,10 @@ package makeo.gadomancy.common.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.UUID; import makeo.gadomancy.client.events.ResourceReloadListener; import makeo.gadomancy.common.blocks.BlockRemoteJar; import makeo.gadomancy.common.blocks.tiles.TileRemoteJar; @@ -21,11 +25,6 @@ import thaumcraft.api.aspects.AspectList; import thaumcraft.common.blocks.ItemJarFilled; import thaumcraft.common.config.ConfigItems; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; -import java.util.UUID; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -45,13 +44,13 @@ public class ItemBlockRemoteJar extends ItemBlock { @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { - if(!world.isRemote) { - if(player.isSneaking()) { + if (!world.isRemote) { + if (player.isSneaking()) { NBTTagCompound compound = NBTHelper.getData(stack); - if(compound.hasKey("networkId")) { + if (compound.hasKey("networkId")) { compound.removeTag("networkId"); - if(compound.hasNoTags()) { + if (compound.hasNoTags()) { stack.setTagCompound(null); } @@ -64,32 +63,63 @@ public class ItemBlockRemoteJar extends ItemBlock { } @Override - public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { - return super.onItemUse(p_77648_1_, p_77648_2_, p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_8_, p_77648_9_, p_77648_10_); + public boolean onItemUse( + ItemStack p_77648_1_, + EntityPlayer p_77648_2_, + World p_77648_3_, + int p_77648_4_, + int p_77648_5_, + int p_77648_6_, + int p_77648_7_, + float p_77648_8_, + float p_77648_9_, + float p_77648_10_) { + return super.onItemUse( + p_77648_1_, + p_77648_2_, + p_77648_3_, + p_77648_4_, + p_77648_5_, + p_77648_6_, + p_77648_7_, + p_77648_8_, + p_77648_9_, + p_77648_10_); } @Override - public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { + public boolean onItemUseFirst( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float hitX, + float hitY, + float hitZ) { TileRemoteJar tile = BlockRemoteJar.getJarTile(world, x, y, z); if (tile != null) { - if(!world.isRemote) { + if (!world.isRemote) { NBTTagCompound compound = NBTHelper.getData(stack); - if(!player.isSneaking()) { + if (!player.isSneaking()) { UUID networkId = null; - if(tile.networkId == null) { + if (tile.networkId == null) { player.addChatComponentMessage(new ChatComponentTranslation("gadomancy.info.RemoteJar.new")); networkId = UUID.randomUUID(); tile.networkId = networkId; tile.markForUpdate(); } else { UUID current = NBTHelper.getUUID(compound, "networkId"); - if(current == null || !current.equals(tile.networkId)) { - player.addChatComponentMessage(new ChatComponentTranslation("gadomancy.info.RemoteJar.connected")); + if (current == null || !current.equals(tile.networkId)) { + player.addChatComponentMessage( + new ChatComponentTranslation("gadomancy.info.RemoteJar.connected")); networkId = tile.networkId; } } - if(networkId != null) { + if (networkId != null) { NBTHelper.setUUID(compound, "networkId", networkId); } } @@ -101,21 +131,30 @@ public class ItemBlockRemoteJar extends ItemBlock { return false; } - - @Override - public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) { + public boolean placeBlockAt( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float hitX, + float hitY, + float hitZ, + int metadata) { boolean placed = super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata); if (placed && stack.hasTagCompound()) { TileRemoteJar tile = (TileRemoteJar) world.getTileEntity(x, y, z); AspectList aspects = ((ItemJarFilled) ConfigItems.itemJarFilled).getAspects(stack); - if(aspects != null) { + if (aspects != null) { tile.aspect = aspects.getAspects()[0]; tile.amount = aspects.getAmount(tile.aspect); } - if(!world.isRemote) { + if (!world.isRemote) { tile.networkId = NBTHelper.getUUID(stack.getTagCompound(), "networkId"); tile.markForUpdate(); } @@ -132,8 +171,10 @@ public class ItemBlockRemoteJar extends ItemBlock { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advancedItemTooltips) { if (stack.hasTagCompound()) { UUID networkId = NBTHelper.getUUID(stack.getTagCompound(), "networkId"); - if(networkId != null) { - list.add(String.format(StatCollector.translateToLocal("gadomancy.lore.remotejar"), ItemBlockRemoteJar.generateName(networkId))); + if (networkId != null) { + list.add(String.format( + StatCollector.translateToLocal("gadomancy.lore.remotejar"), + ItemBlockRemoteJar.generateName(networkId))); } } ConfigItems.itemJarFilled.addInformation(stack, player, list, advancedItemTooltips); @@ -146,12 +187,12 @@ public class ItemBlockRemoteJar extends ItemBlock { StringBuilder result = new StringBuilder(); - for(int i = 0; i < 2; i++) { + for (int i = 0; i < 2; i++) { int entryIndex = random.nextInt(values.size()); String[] split = values.get(entryIndex).split(" "); String part = split[random.nextInt(split.length)]; - if(!ItemBlockRemoteJar.isValidName(part)) { + if (!ItemBlockRemoteJar.isValidName(part)) { i--; continue; } @@ -161,9 +202,9 @@ public class ItemBlockRemoteJar extends ItemBlock { } private static boolean isValidName(String name) { - if(name.length() <= 8 && name.length() >= 4) { - for(char c : name.toCharArray()) { - if(!Character.isAlphabetic(c)) { + if (name.length() <= 8 && name.length() >= 4) { + for (char c : name.toCharArray()) { + if (!Character.isAlphabetic(c)) { return false; } } @@ -171,4 +212,4 @@ public class ItemBlockRemoteJar extends ItemBlock { } return false; } -} \ No newline at end of file +} diff --git a/src/main/java/makeo/gadomancy/common/items/ItemBlockStoneMachine.java b/src/main/java/makeo/gadomancy/common/items/ItemBlockStoneMachine.java index 42031f8..90d6460 100644 --- a/src/main/java/makeo/gadomancy/common/items/ItemBlockStoneMachine.java +++ b/src/main/java/makeo/gadomancy/common/items/ItemBlockStoneMachine.java @@ -22,7 +22,7 @@ public class ItemBlockStoneMachine extends ItemBlock { @Override public IIcon getIconFromDamage(int metadata) { - if(metadata == 11 || metadata == 15) { + if (metadata == 11 || metadata == 15) { return this.field_150939_a.getIcon(0, metadata); } return super.getIconFromDamage(metadata); diff --git a/src/main/java/makeo/gadomancy/common/items/ItemCreativeNode.java b/src/main/java/makeo/gadomancy/common/items/ItemCreativeNode.java index fcbfb37..bbd5fc4 100644 --- a/src/main/java/makeo/gadomancy/common/items/ItemCreativeNode.java +++ b/src/main/java/makeo/gadomancy/common/items/ItemCreativeNode.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.items; +import java.util.List; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.registration.RegisteredItems; import net.minecraft.creativetab.CreativeTabs; @@ -17,8 +18,6 @@ import thaumcraft.common.config.ConfigBlocks; import thaumcraft.common.lib.world.ThaumcraftWorldGenerator; import thaumcraft.common.tiles.TileNode; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -36,33 +35,44 @@ public class ItemCreativeNode extends Item { @Override public void getSubItems(Item item, CreativeTabs tab, List list) { - for(int i = 0; i < NodeType.values().length; i++) { + for (int i = 0; i < NodeType.values().length; i++) { list.add(new ItemStack(item, 1, i)); } } @Override public String getUnlocalizedNameInefficiently(ItemStack stack) { - return Item.getItemFromBlock(ConfigBlocks.blockAiry).getUnlocalizedName(new ItemStack(ConfigBlocks.blockAiry, 1, 0)); + return Item.getItemFromBlock(ConfigBlocks.blockAiry) + .getUnlocalizedName(new ItemStack(ConfigBlocks.blockAiry, 1, 0)); } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float hitX, + float hitY, + float hitZ) { ForgeDirection dir = ForgeDirection.getOrientation(side); x += dir.offsetX; y += dir.offsetY; z += dir.offsetZ; - if(this.placeRandomNode(world, x, y, z)) { + if (this.placeRandomNode(world, x, y, z)) { int metadata = stack.getItemDamage(); TileNode node = (TileNode) world.getTileEntity(x, y, z); - if(metadata == 0) { + if (metadata == 0) { node.setNodeType(NodeType.NORMAL); node.setNodeModifier(NodeModifier.BRIGHT); AspectList aspects = new AspectList(); - for(Aspect primal : Aspect.getPrimalAspects()) { + for (Aspect primal : Aspect.getPrimalAspects()) { aspects.add(primal, 500); } node.setAspects(aspects); @@ -78,7 +88,7 @@ public class ItemCreativeNode extends Item { } private boolean placeRandomNode(World world, int x, int y, int z) { - if(world.getBlock(x, y, z) == Blocks.air) { + if (world.getBlock(x, y, z) == Blocks.air) { ThaumcraftWorldGenerator.createRandomNodeAt(world, x, y, z, world.rand, false, false, false); return world.getBlock(x, y, z) == ConfigBlocks.blockAiry; } @@ -88,10 +98,11 @@ public class ItemCreativeNode extends Item { @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advancedItemTooltips) { int metadata = stack.getItemDamage(); - if(metadata == 0) { + if (metadata == 0) { list.add("\u00a75Place a huge and bright aura node"); } else { - list.add("\u00a75Place a node of type " + NodeType.values()[metadata].name().toLowerCase()); + list.add("\u00a75Place a node of type " + + NodeType.values()[metadata].name().toLowerCase()); } list.add("\u00a7oCreative Mode Only"); } diff --git a/src/main/java/makeo/gadomancy/common/items/ItemElement.java b/src/main/java/makeo/gadomancy/common/items/ItemElement.java index 55698bb..862fa22 100644 --- a/src/main/java/makeo/gadomancy/common/items/ItemElement.java +++ b/src/main/java/makeo/gadomancy/common/items/ItemElement.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.items; +import java.util.List; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.entities.EntityItemElement; import makeo.gadomancy.common.registration.RegisteredItems; @@ -13,8 +14,6 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -import java.util.List; - /** * HellFirePvP@Admin * Date: 23.04.2016 / 01:52 @@ -43,12 +42,13 @@ public class ItemElement extends Item { @Override public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean isHolding) { - if(stack == null || !(stack.getItem() instanceof ItemElement)) return; + if (stack == null || !(stack.getItem() instanceof ItemElement)) return; int meta = stack.getItemDamage(); - ItemElement.EnumElementType element = ItemElement.EnumElementType.values()[meta % ItemElement.EnumElementType.values().length]; + ItemElement.EnumElementType element = + ItemElement.EnumElementType.values()[meta % ItemElement.EnumElementType.values().length]; - if(!world.isRemote) { - if((world.getTotalWorldTime() & 15) == 0) { + if (!world.isRemote) { + if ((world.getTotalWorldTime() & 15) == 0) { EntityItemElement.doElementServerEffects(element, world, entity.posX, entity.posY, entity.posZ); } } @@ -69,7 +69,7 @@ public class ItemElement extends Item { @Override public int getColorFromItemStack(ItemStack stack, int pass) { int dmg = stack.getItemDamage(); - if(dmg < EnumElementType.values().length) { + if (dmg < EnumElementType.values().length) { return EnumElementType.values()[dmg].getRenderColor(); } return 0xFFFFFF; @@ -78,11 +78,9 @@ public class ItemElement extends Item { public abstract static class ElementRunnable { public abstract void affectEntity(EntityLivingBase livingBase); - } public enum EnumElementType { - DARKNESS(0x000000, new ElementRunnable() { @Override public void affectEntity(EntityLivingBase livingBase) { @@ -118,5 +116,4 @@ public class ItemElement extends Item { return this.renderColor; } } - } diff --git a/src/main/java/makeo/gadomancy/common/items/ItemExtendedNodeJar.java b/src/main/java/makeo/gadomancy/common/items/ItemExtendedNodeJar.java index e2c0546..724f4f9 100644 --- a/src/main/java/makeo/gadomancy/common/items/ItemExtendedNodeJar.java +++ b/src/main/java/makeo/gadomancy/common/items/ItemExtendedNodeJar.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.items; +import java.util.List; import makeo.gadomancy.common.blocks.tiles.TileExtendedNodeJar; import makeo.gadomancy.common.node.ExtendedNodeType; import makeo.gadomancy.common.registration.RegisteredBlocks; @@ -25,8 +26,6 @@ import thaumcraft.common.Thaumcraft; import thaumcraft.common.blocks.ItemJarNode; import thaumcraft.common.config.ConfigItems; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -66,7 +65,7 @@ public class ItemExtendedNodeJar extends Item implements IEssentiaContainerItem @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { String desc = "§9" + StatCollector.translateToLocal("nodetype." + this.getNodeType(stack) + ".name"); - if(this.getExtendedNodeType(stack) != null) { + if (this.getExtendedNodeType(stack) != null) { desc = desc + ", " + StatCollector.translateToLocal("gadomancy.nodes." + this.getExtendedNodeType(stack)); } if (this.getNodeModifier(stack) != null) { @@ -86,11 +85,24 @@ public class ItemExtendedNodeJar extends Item implements IEssentiaContainerItem super.addInformation(stack, player, list, par4); } - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float par8, float par9, float par10) { + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float par8, + float par9, + float par10) { Block var11 = world.getBlock(x, y, z); if (var11 == Blocks.snow_layer) { side = 1; - } else if ((var11 != Blocks.vine) && (var11 != Blocks.tallgrass) && (var11 != Blocks.deadbush) && ((var11.isAir(world, x, y, z)) || (!var11.isReplaceable(world, x, y, z)))) { + } else if ((var11 != Blocks.vine) + && (var11 != Blocks.tallgrass) + && (var11 != Blocks.deadbush) + && ((var11.isAir(world, x, y, z)) || (!var11.isReplaceable(world, x, y, z)))) { if (side == 0) { y--; } @@ -122,7 +134,8 @@ public class ItemExtendedNodeJar extends Item implements IEssentiaContainerItem if (world.canPlaceEntityOnSide(RegisteredBlocks.blockExtendedNodeJar, x, y, z, false, side, player, stack)) { Block var12 = RegisteredBlocks.blockExtendedNodeJar; int var13 = 2; - int var14 = RegisteredBlocks.blockExtendedNodeJar.onBlockPlaced(world, x, y, z, side, par8, par9, par10, var13); + int var14 = + RegisteredBlocks.blockExtendedNodeJar.onBlockPlaced(world, x, y, z, side, par8, par9, par10, var13); if (this.placeBlockAt(stack, player, world, x, y, z, side, par8, par9, par10, var14)) { TileEntity te = world.getTileEntity(x, y, z); @@ -140,8 +153,13 @@ public class ItemExtendedNodeJar extends Item implements IEssentiaContainerItem } } - - world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, var12.stepSound.getStepResourcePath(), (var12.stepSound.getVolume() + 1.0F) / 2.0F, var12.stepSound.getPitch() * 0.8F); + world.playSoundEffect( + x + 0.5F, + y + 0.5F, + z + 0.5F, + var12.stepSound.getStepResourcePath(), + (var12.stepSound.getVolume() + 1.0F) / 2.0F, + var12.stepSound.getPitch() * 0.8F); stack.stackSize -= 1; } return true; @@ -149,7 +167,18 @@ public class ItemExtendedNodeJar extends Item implements IEssentiaContainerItem return false; } - public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) { + public boolean placeBlockAt( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float hitX, + float hitY, + float hitZ, + int metadata) { if (!world.setBlock(x, y, z, RegisteredBlocks.blockExtendedNodeJar, metadata, 3)) { return false; } @@ -178,7 +207,8 @@ public class ItemExtendedNodeJar extends Item implements IEssentiaContainerItem aspects.writeToNBT(itemstack.getTagCompound()); } - public void setNodeAttributes(ItemStack itemstack, NodeType type, NodeModifier mod, ExtendedNodeType extendedNodeType, String id) { + public void setNodeAttributes( + ItemStack itemstack, NodeType type, NodeModifier mod, ExtendedNodeType extendedNodeType, String id) { if (!itemstack.hasTagCompound()) { itemstack.setTagCompound(new NBTTagCompound()); } @@ -186,14 +216,14 @@ public class ItemExtendedNodeJar extends Item implements IEssentiaContainerItem if (mod != null) { itemstack.setTagInfo("nodemod", new NBTTagInt(mod.ordinal())); } - if(extendedNodeType != null) { + if (extendedNodeType != null) { itemstack.setTagInfo("nodeExMod", new NBTTagInt(extendedNodeType.ordinal())); } itemstack.setTagInfo("nodeid", new NBTTagString(id)); } public void setBehaviorSnapshot(ItemStack itemstack, NBTTagCompound tagCompound) { - if(tagCompound == null) return; + if (tagCompound == null) return; if (!itemstack.hasTagCompound()) { itemstack.setTagCompound(new NBTTagCompound()); } @@ -234,5 +264,4 @@ public class ItemExtendedNodeJar extends Item implements IEssentiaContainerItem } return itemstack.getTagCompound().getString("nodeid"); } - } diff --git a/src/main/java/makeo/gadomancy/common/items/ItemFakeGolemPlacer.java b/src/main/java/makeo/gadomancy/common/items/ItemFakeGolemPlacer.java index 04bf649..d9b52a2 100644 --- a/src/main/java/makeo/gadomancy/common/items/ItemFakeGolemPlacer.java +++ b/src/main/java/makeo/gadomancy/common/items/ItemFakeGolemPlacer.java @@ -2,6 +2,7 @@ package makeo.gadomancy.common.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import makeo.gadomancy.api.GadomancyApi; import makeo.gadomancy.api.golems.AdditionalGolemType; import net.minecraft.client.renderer.texture.IIconRegister; @@ -12,8 +13,6 @@ import net.minecraft.util.IIcon; import thaumcraft.common.entities.golems.EnumGolemType; import thaumcraft.common.entities.golems.ItemGolemPlacer; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -42,8 +41,8 @@ public class ItemFakeGolemPlacer extends Item { @Override public void getSubItems(Item item, CreativeTabs tab, List list) { - for(EnumGolemType type : EnumGolemType.values()) { - if(type.health > 0) { + for (EnumGolemType type : EnumGolemType.values()) { + if (type.health > 0) { list.add(new ItemStack(this, 1, type.ordinal())); } } @@ -52,7 +51,7 @@ public class ItemFakeGolemPlacer extends Item { @Override public void registerIcons(IIconRegister ir) { ItemFakeGolemPlacer.PLACER.registerIcons(ir); - for(AdditionalGolemType type : GadomancyApi.getAdditionalGolemTypes()) { + for (AdditionalGolemType type : GadomancyApi.getAdditionalGolemTypes()) { type.registerIcons(ir); } } @@ -60,7 +59,7 @@ public class ItemFakeGolemPlacer extends Item { @Override public IIcon getIcon(ItemStack stack, int pass) { AdditionalGolemType type = this.getAdditonalType(stack); - if(type != null) { + if (type != null) { return type.getPlacerItem().getIcon(stack, pass); } return ItemFakeGolemPlacer.PLACER.getIcon(stack, pass); @@ -68,7 +67,7 @@ public class ItemFakeGolemPlacer extends Item { private AdditionalGolemType getAdditonalType(ItemStack stack) { EnumGolemType type = EnumGolemType.getType(stack.getItemDamage()); - if(type != null) { + if (type != null) { return GadomancyApi.getAdditionalGolemType(type); } return null; diff --git a/src/main/java/makeo/gadomancy/common/items/ItemFakeGolemShield.java b/src/main/java/makeo/gadomancy/common/items/ItemFakeGolemShield.java index 4722830..dbe3604 100644 --- a/src/main/java/makeo/gadomancy/common/items/ItemFakeGolemShield.java +++ b/src/main/java/makeo/gadomancy/common/items/ItemFakeGolemShield.java @@ -2,6 +2,7 @@ package makeo.gadomancy.common.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import makeo.gadomancy.common.Gadomancy; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -9,8 +10,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -55,7 +54,7 @@ public class ItemFakeGolemShield extends Item { @Override public IIcon getIcon(ItemStack stack, int pass) { - if(pass == this.getRenderPasses(stack.getItemDamage()) - 1) { + if (pass == this.getRenderPasses(stack.getItemDamage()) - 1) { return this.shieldIcon; } else { return this.golemItem.getIcon(stack, pass); diff --git a/src/main/java/makeo/gadomancy/common/items/ItemFakeLootbag.java b/src/main/java/makeo/gadomancy/common/items/ItemFakeLootbag.java index bcb2489..02192e5 100644 --- a/src/main/java/makeo/gadomancy/common/items/ItemFakeLootbag.java +++ b/src/main/java/makeo/gadomancy/common/items/ItemFakeLootbag.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.items; +import java.util.List; import makeo.gadomancy.common.registration.RegisteredItems; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -9,8 +10,6 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; import thaumcraft.common.items.ItemLootBag; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -31,8 +30,7 @@ public class ItemFakeLootbag extends ItemLootBag { } @Override - public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) { - } + public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {} @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { diff --git a/src/main/java/makeo/gadomancy/common/items/ItemFakeModIcon.java b/src/main/java/makeo/gadomancy/common/items/ItemFakeModIcon.java index 1e524f7..2fbf4af 100644 --- a/src/main/java/makeo/gadomancy/common/items/ItemFakeModIcon.java +++ b/src/main/java/makeo/gadomancy/common/items/ItemFakeModIcon.java @@ -33,8 +33,7 @@ public class ItemFakeModIcon extends Item { @Override public IIcon getIconFromDamage(int damage) { - if(damage < 0 || damage >= this.icons.length) return null; + if (damage < 0 || damage >= this.icons.length) return null; return this.icons[damage]; } - } diff --git a/src/main/java/makeo/gadomancy/common/items/ItemGolemCoreBreak.java b/src/main/java/makeo/gadomancy/common/items/ItemGolemCoreBreak.java index 7e91a6e..9d64f19 100644 --- a/src/main/java/makeo/gadomancy/common/items/ItemGolemCoreBreak.java +++ b/src/main/java/makeo/gadomancy/common/items/ItemGolemCoreBreak.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.items; +import java.util.List; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.registration.RegisteredItems; import net.minecraft.client.renderer.texture.IIconRegister; @@ -11,8 +12,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; 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 @@ -21,7 +20,7 @@ import java.util.List; * * Created by makeo @ 02.10.2015 19:40 */ -//TODO rename when updating to 1.8 +// TODO rename when updating to 1.8 public class ItemGolemCoreBreak extends Item { public ItemGolemCoreBreak() { @@ -40,9 +39,9 @@ public class ItemGolemCoreBreak extends Item { @Override public IIcon getIconFromDamage(int damage) { - if(damage == 0) { + if (damage == 0) { return this.breakIcon; - } else if(damage == 1) { + } else if (damage == 1) { return this.bodyguardIcon; } @@ -68,9 +67,9 @@ public class ItemGolemCoreBreak extends Item { @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean showAdvanced) { int damage = stack.getItemDamage(); - if(damage == 0) { + if (damage == 0) { list.add(StatCollector.translateToLocal("gadomancy.golem.breakcore")); - } else if(damage == 1) { + } else if (damage == 1) { list.add(StatCollector.translateToLocal("gadomancy.golem.bodyguardcore")); } } diff --git a/src/main/java/makeo/gadomancy/common/items/ItemNodeManipulator.java b/src/main/java/makeo/gadomancy/common/items/ItemNodeManipulator.java index 9b86095..ea0ea06 100644 --- a/src/main/java/makeo/gadomancy/common/items/ItemNodeManipulator.java +++ b/src/main/java/makeo/gadomancy/common/items/ItemNodeManipulator.java @@ -16,5 +16,4 @@ public class ItemNodeManipulator extends BlockStoneDeviceItem { public ItemNodeManipulator(Block par1) { super(par1); } - } diff --git a/src/main/java/makeo/gadomancy/common/items/ItemTransformationFocus.java b/src/main/java/makeo/gadomancy/common/items/ItemTransformationFocus.java index e1bf6ce..486391d 100644 --- a/src/main/java/makeo/gadomancy/common/items/ItemTransformationFocus.java +++ b/src/main/java/makeo/gadomancy/common/items/ItemTransformationFocus.java @@ -24,28 +24,28 @@ import thaumcraft.api.wands.ItemFocusBasic; * Created by makeo @ 13.07.2015 02:14 */ public class ItemTransformationFocus extends ItemFocusBasic { - private static final AspectList VIS_USAGE = new AspectList().add(Aspect.AIR, 15).add(Aspect.EARTH, 15).add(Aspect.ORDER, 15); + private static final AspectList VIS_USAGE = + new AspectList().add(Aspect.AIR, 15).add(Aspect.EARTH, 15).add(Aspect.ORDER, 15); private IIcon iconOrnament; private IIcon iconDepth; public ItemTransformationFocus() { - //setCreativeTab(RegisteredItems.creativeTab); + // setCreativeTab(RegisteredItems.creativeTab); this.setCreativeTab(null); this.setUnlocalizedName("ItemTransformationFocus"); } @Override - public ItemStack onFocusRightClick(ItemStack wandStack, World world, EntityPlayer player, MovingObjectPosition movingobjectposition) { + public ItemStack onFocusRightClick( + ItemStack wandStack, World world, EntityPlayer player, MovingObjectPosition movingobjectposition) { player.setItemInUse(wandStack, 2147483647); - //WandManager.setCooldown(player, -1); + // WandManager.setCooldown(player, -1); return wandStack; } @Override - public void onUsingFocusTick(ItemStack wandstack, EntityPlayer player, int count) { - - } + public void onUsingFocusTick(ItemStack wandstack, EntityPlayer player, int count) {} @Override public EnumRarity getRarity(ItemStack focusstack) { diff --git a/src/main/java/makeo/gadomancy/common/items/baubles/ItemEtherealFamiliar.java b/src/main/java/makeo/gadomancy/common/items/baubles/ItemEtherealFamiliar.java index f6f11de..7de0f76 100644 --- a/src/main/java/makeo/gadomancy/common/items/baubles/ItemEtherealFamiliar.java +++ b/src/main/java/makeo/gadomancy/common/items/baubles/ItemEtherealFamiliar.java @@ -2,6 +2,9 @@ package makeo.gadomancy.common.items.baubles; import baubles.api.BaubleType; import baubles.api.IBauble; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.data.DataFamiliar; import makeo.gadomancy.common.data.SyncDataHolder; @@ -22,10 +25,6 @@ import org.lwjgl.input.Keyboard; import thaumcraft.api.aspects.Aspect; import thaumcraft.common.lib.research.ResearchManager; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -80,20 +79,23 @@ public class ItemEtherealFamiliar extends Item implements IBauble { public void addInformation(ItemStack stack, EntityPlayer player, List lore, boolean flag) { List newLore = new ArrayList(); - if(ItemEtherealFamiliar.hasFamiliarAspect(stack)) { - newLore.add(EnumChatFormatting.GRAY + ItemEtherealFamiliar.getFamiliarAspect(stack).getName()); + if (ItemEtherealFamiliar.hasFamiliarAspect(stack)) { + newLore.add(EnumChatFormatting.GRAY + + ItemEtherealFamiliar.getFamiliarAspect(stack).getName()); } List augments = ItemEtherealFamiliar.getAugments(stack); for (FamiliarAugment.FamiliarAugmentPair pair : augments) { - newLore.add(EnumChatFormatting.GRAY + pair.augment.getLocalizedName() + " " + MiscUtils.toRomanNumeral(pair.level)); + newLore.add(EnumChatFormatting.GRAY + pair.augment.getLocalizedName() + " " + + MiscUtils.toRomanNumeral(pair.level)); } - - if(Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54)) { + if (Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54)) { lore.addAll(newLore); } else { - if(!newLore.isEmpty()) lore.add(EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("gadomancy.lore.hasAdditionalLore")); + if (!newLore.isEmpty()) + lore.add(EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC + + StatCollector.translateToLocal("gadomancy.lore.hasAdditionalLore")); } } @@ -112,32 +114,33 @@ public class ItemEtherealFamiliar extends Item implements IBauble { } public static void setFamiliarAspect(ItemStack stack, Aspect aspect) { - if(stack == null || !(stack.getItem() instanceof ItemEtherealFamiliar)) return; + if (stack == null || !(stack.getItem() instanceof ItemEtherealFamiliar)) return; NBTHelper.getData(stack).setString("aspect", aspect.getTag()); } public static Aspect getFamiliarAspect(ItemStack stack) { - if(stack == null || !(stack.getItem() instanceof ItemEtherealFamiliar)) return null; + if (stack == null || !(stack.getItem() instanceof ItemEtherealFamiliar)) return null; String tag = NBTHelper.getData(stack).getString("aspect"); - if(tag == null || tag.equalsIgnoreCase("")) return null; + if (tag == null || tag.equalsIgnoreCase("")) return null; return Aspect.getAspect(tag); } public static boolean hasAugment(ItemStack stack, FamiliarAugment augment) { List pairs = ItemEtherealFamiliar.getAugments(stack); for (FamiliarAugment.FamiliarAugmentPair pair : pairs) { - if(pair.augment.equals(augment)) return true; + if (pair.augment.equals(augment)) return true; } return false; } public static FamiliarAugment.FamiliarAugmentList getAugments(ItemStack stack) { - if(stack == null || !(stack.getItem() instanceof ItemEtherealFamiliar)) return new FamiliarAugment.FamiliarAugmentList(); + if (stack == null || !(stack.getItem() instanceof ItemEtherealFamiliar)) + return new FamiliarAugment.FamiliarAugmentList(); NBTTagCompound augmentTag = NBTHelper.getData(stack).getCompoundTag("augments"); Set strKeySet = augmentTag.func_150296_c(); - if(strKeySet == null || strKeySet.size() <= 0) return new FamiliarAugment.FamiliarAugmentList(); + if (strKeySet == null || strKeySet.size() <= 0) return new FamiliarAugment.FamiliarAugmentList(); FamiliarAugment.FamiliarAugmentList augmentList = new FamiliarAugment.FamiliarAugmentList(); - for(String key : strKeySet) { + for (String key : strKeySet) { FamiliarAugment augment = FamiliarAugment.getByUnlocalizedName(key); int level = augmentTag.getInteger(key); augmentList.add(new FamiliarAugment.FamiliarAugmentPair(augment, level)); @@ -155,7 +158,7 @@ public class ItemEtherealFamiliar extends Item implements IBauble { }*/ public static boolean incrementAugmentLevel(ItemStack stack, FamiliarAugment toAdd) { - if(!ItemEtherealFamiliar.hasAugment(stack, toAdd)) { + if (!ItemEtherealFamiliar.hasAugment(stack, toAdd)) { return ItemEtherealFamiliar.addAugmentUnsafe(stack, toAdd, 1); } else { int current = ItemEtherealFamiliar.getAugments(stack).getLevel(toAdd); @@ -169,7 +172,7 @@ public class ItemEtherealFamiliar extends Item implements IBauble { }*/ public static boolean addAugmentUnsafe(ItemStack stack, FamiliarAugment augment, int level) { - if(stack == null || !(stack.getItem() instanceof ItemEtherealFamiliar) || level <= 0) return false; + if (stack == null || !(stack.getItem() instanceof ItemEtherealFamiliar) || level <= 0) return false; NBTTagCompound tag = NBTHelper.getData(stack); NBTTagCompound augmentTag = NBTHelper.getData(stack).getCompoundTag("augments"); @@ -181,8 +184,8 @@ public class ItemEtherealFamiliar extends Item implements IBauble { @Override public void onWornTick(ItemStack itemStack, EntityLivingBase entity) { - if(itemStack == null) return; - if(entity instanceof EntityPlayer && itemStack.getItem() instanceof ItemEtherealFamiliar) { + if (itemStack == null) return; + if (entity instanceof EntityPlayer && itemStack.getItem() instanceof ItemEtherealFamiliar) { DataFamiliar familiarData = SyncDataHolder.getDataServer("FamiliarData"); Aspect a = ItemEtherealFamiliar.getFamiliarAspect(itemStack); if (a != null) { @@ -193,11 +196,11 @@ public class ItemEtherealFamiliar extends Item implements IBauble { @Override public void onEquipped(ItemStack itemStack, EntityLivingBase entity) { - if(itemStack == null) return; - if(entity instanceof EntityPlayer && itemStack.getItem() instanceof ItemEtherealFamiliar) { + if (itemStack == null) return; + if (entity instanceof EntityPlayer && itemStack.getItem() instanceof ItemEtherealFamiliar) { DataFamiliar familiarData = SyncDataHolder.getDataServer("FamiliarData"); Aspect a = ItemEtherealFamiliar.getFamiliarAspect(itemStack); - if(a != null) { + if (a != null) { familiarData.handleEquip(((EntityPlayer) entity).worldObj, (EntityPlayer) entity, a); } } @@ -205,11 +208,11 @@ public class ItemEtherealFamiliar extends Item implements IBauble { @Override public void onUnequipped(ItemStack itemStack, EntityLivingBase entity) { - if(itemStack == null) return; - if(entity instanceof EntityPlayer && itemStack.getItem() instanceof ItemEtherealFamiliar) { + if (itemStack == null) return; + if (entity instanceof EntityPlayer && itemStack.getItem() instanceof ItemEtherealFamiliar) { DataFamiliar familiarData = SyncDataHolder.getDataServer("FamiliarData"); Aspect a = ItemEtherealFamiliar.getFamiliarAspect(itemStack); - if(a != null) { + if (a != null) { familiarData.handleUnequip(((EntityPlayer) entity).worldObj, (EntityPlayer) entity, a); } } @@ -217,13 +220,13 @@ public class ItemEtherealFamiliar extends Item implements IBauble { @Override public boolean canEquip(ItemStack itemStack, EntityLivingBase entityLivingBase) { - if(!(entityLivingBase instanceof EntityPlayer)) return false; - return ResearchManager.isResearchComplete(entityLivingBase.getCommandSenderName(), Gadomancy.MODID.toUpperCase() + ".ETHEREAL_FAMILIAR"); + if (!(entityLivingBase instanceof EntityPlayer)) return false; + return ResearchManager.isResearchComplete( + entityLivingBase.getCommandSenderName(), Gadomancy.MODID.toUpperCase() + ".ETHEREAL_FAMILIAR"); } @Override public boolean canUnequip(ItemStack itemStack, EntityLivingBase entityLivingBase) { return true; } - } diff --git a/src/main/java/makeo/gadomancy/common/items/baubles/ItemFamiliar_Old.java b/src/main/java/makeo/gadomancy/common/items/baubles/ItemFamiliar_Old.java index b290d60..2b8ff20 100644 --- a/src/main/java/makeo/gadomancy/common/items/baubles/ItemFamiliar_Old.java +++ b/src/main/java/makeo/gadomancy/common/items/baubles/ItemFamiliar_Old.java @@ -2,6 +2,8 @@ package makeo.gadomancy.common.items.baubles; import baubles.api.BaubleType; import baubles.api.IBauble; +import java.util.ArrayList; +import java.util.List; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.crafting.DeprecationItemPaybacks; import makeo.gadomancy.common.registration.RegisteredItems; @@ -17,9 +19,6 @@ import net.minecraft.util.StatCollector; import org.lwjgl.input.Keyboard; import thaumcraft.api.aspects.Aspect; -import java.util.ArrayList; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -36,7 +35,7 @@ public class ItemFamiliar_Old extends Item implements IBauble { this.setFull3D(); this.setCreativeTab(RegisteredItems.creativeTab); - //Shut up FML. + // Shut up FML. this.setTextureName(Gadomancy.MODID + ":category_icon"); } @@ -47,30 +46,33 @@ public class ItemFamiliar_Old extends Item implements IBauble { public void addInformation(ItemStack stack, EntityPlayer player, List lore, boolean flag) { lore.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("gadomancy.lore.deprecation.back")); - if(stack.hasTagCompound()) { - if(this.hasAspect(stack)) { + if (stack.hasTagCompound()) { + if (this.hasAspect(stack)) { lore.add(this.getAspect(stack).getName()); } - if(Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54)) { - if(this.hasUpgrade(stack, FamiliarUpgrade.ATTACK_1) || this.hasUpgrade(stack, FamiliarUpgrade.ATTACK_2) || this.hasUpgrade(stack, FamiliarUpgrade.ATTACK_3)) { + if (Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54)) { + if (this.hasUpgrade(stack, FamiliarUpgrade.ATTACK_1) + || this.hasUpgrade(stack, FamiliarUpgrade.ATTACK_2) + || this.hasUpgrade(stack, FamiliarUpgrade.ATTACK_3)) { String strength = EnumChatFormatting.DARK_RED + "Strength "; - if(this.hasUpgrade(stack, FamiliarUpgrade.ATTACK_1)) strength += "I"; - if(this.hasUpgrade(stack, FamiliarUpgrade.ATTACK_2)) strength += "I"; - if(this.hasUpgrade(stack, FamiliarUpgrade.ATTACK_3)) strength += "I"; + if (this.hasUpgrade(stack, FamiliarUpgrade.ATTACK_1)) strength += "I"; + if (this.hasUpgrade(stack, FamiliarUpgrade.ATTACK_2)) strength += "I"; + if (this.hasUpgrade(stack, FamiliarUpgrade.ATTACK_3)) strength += "I"; lore.add(strength); } - if(this.hasUpgrade(stack, FamiliarUpgrade.RANGE_1)) { + if (this.hasUpgrade(stack, FamiliarUpgrade.RANGE_1)) { lore.add(EnumChatFormatting.GOLD + "Reach I"); } - if(this.hasUpgrade(stack, FamiliarUpgrade.COOLDOWN_1)) { + if (this.hasUpgrade(stack, FamiliarUpgrade.COOLDOWN_1)) { lore.add(EnumChatFormatting.AQUA + "Swiftness I"); } } else { - if(this.hasAnyUpgrade(stack)) { - lore.add(EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("gadomancy.lore.hasAdditionalLore")); + if (this.hasAnyUpgrade(stack)) { + lore.add(EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC + + StatCollector.translateToLocal("gadomancy.lore.hasAdditionalLore")); } } } @@ -78,8 +80,8 @@ public class ItemFamiliar_Old extends Item implements IBauble { } public boolean hasAnyUpgrade(ItemStack stack) { - for(FamiliarUpgrade upgrade : FamiliarUpgrade.values()) { - if(this.hasUpgrade(stack, upgrade)) return true; + for (FamiliarUpgrade upgrade : FamiliarUpgrade.values()) { + if (this.hasUpgrade(stack, upgrade)) return true; } return false; } @@ -95,25 +97,26 @@ public class ItemFamiliar_Old extends Item implements IBauble { } public Aspect getAspect(ItemStack stack) { - if(!this.hasAspect(stack)) return null; - if(stack == null || !(stack.getItem() instanceof ItemFamiliar_Old)) return null; - if(!stack.hasTagCompound() || !stack.getTagCompound().hasKey("aspect")) return null; + if (!this.hasAspect(stack)) return null; + if (stack == null || !(stack.getItem() instanceof ItemFamiliar_Old)) return null; + if (!stack.hasTagCompound() || !stack.getTagCompound().hasKey("aspect")) return null; return Aspect.getAspect(stack.getTagCompound().getString("aspect")); } public boolean hasAspect(ItemStack stack) { - if(stack == null || !(stack.getItem() instanceof ItemFamiliar_Old)) return false; - if(!stack.hasTagCompound() || !stack.getTagCompound().hasKey("aspect")) return false; + if (stack == null || !(stack.getItem() instanceof ItemFamiliar_Old)) return false; + if (!stack.hasTagCompound() || !stack.getTagCompound().hasKey("aspect")) return false; return Aspect.getAspect(stack.getTagCompound().getString("aspect")) != null; } public void setAspect(ItemStack stack, Aspect aspect) { - if(stack == null || !(stack.getItem() instanceof ItemFamiliar_Old)) return; + if (stack == null || !(stack.getItem() instanceof ItemFamiliar_Old)) return; NBTHelper.getData(stack).setString("aspect", aspect.getTag()); } @Override - public void onWornTick(ItemStack itemStack, EntityLivingBase entity) {/* + public void onWornTick(ItemStack itemStack, EntityLivingBase entity) { + /* if(itemStack == null) return; if(entity instanceof EntityPlayer && itemStack.getItem() instanceof ItemFamiliar_Old) { DataFamiliar familiarData = SyncDataHolder.getDataServer("FamiliarData"); @@ -137,7 +140,8 @@ public class ItemFamiliar_Old extends Item implements IBauble { } @Override - public void onEquipped(ItemStack itemStack, EntityLivingBase entity) {/* + public void onEquipped(ItemStack itemStack, EntityLivingBase entity) { + /* if(itemStack == null) return; if(entity instanceof EntityPlayer && itemStack.getItem() instanceof ItemFamiliar_Old) { DataFamiliar familiarData = SyncDataHolder.getDataServer("FamiliarData"); @@ -149,7 +153,8 @@ public class ItemFamiliar_Old extends Item implements IBauble { } @Override - public void onUnequipped(ItemStack itemStack, EntityLivingBase entity) {/* + public void onUnequipped(ItemStack itemStack, EntityLivingBase entity) { + /* if(itemStack == null) return; if(entity instanceof EntityPlayer && itemStack.getItem() instanceof ItemFamiliar_Old) { DataFamiliar familiarData = SyncDataHolder.getDataServer("FamiliarData"); @@ -170,74 +175,74 @@ public class ItemFamiliar_Old extends Item implements IBauble { return true; } - //Infusion stuff. + // Infusion stuff. public int getAttackRangeIncrease(ItemStack itemStack) { - if(!(itemStack.getItem() instanceof ItemFamiliar_Old)) return 0; + if (!(itemStack.getItem() instanceof ItemFamiliar_Old)) return 0; int range = 0; - if(this.hasUpgrade(itemStack, FamiliarUpgrade.RANGE_1)) { + if (this.hasUpgrade(itemStack, FamiliarUpgrade.RANGE_1)) { range += 3; } return range; } public int getAttackCooldownReduction(ItemStack itemStack) { - if(!(itemStack.getItem() instanceof ItemFamiliar_Old)) return 0; + if (!(itemStack.getItem() instanceof ItemFamiliar_Old)) return 0; return this.hasUpgrade(itemStack, FamiliarUpgrade.COOLDOWN_1) ? 10 : 0; } public float getAttackStrength(ItemStack itemStack) { - if(!(itemStack.getItem() instanceof ItemFamiliar_Old)) return 0F; + if (!(itemStack.getItem() instanceof ItemFamiliar_Old)) return 0F; float attack = 1F; - if(this.hasUpgrade(itemStack, FamiliarUpgrade.ATTACK_1)) { + if (this.hasUpgrade(itemStack, FamiliarUpgrade.ATTACK_1)) { attack += 1F; } - if(this.hasUpgrade(itemStack, FamiliarUpgrade.ATTACK_2)) { + if (this.hasUpgrade(itemStack, FamiliarUpgrade.ATTACK_2)) { attack += 2F; } - if(this.hasUpgrade(itemStack, FamiliarUpgrade.ATTACK_3)) { + if (this.hasUpgrade(itemStack, FamiliarUpgrade.ATTACK_3)) { attack += 4F; } return attack; } public boolean hasUpgrade(ItemStack stack, FamiliarUpgrade upgrade) { - if(stack == null || !(stack.getItem() instanceof ItemFamiliar_Old)) return false; - if(upgrade == null) return true; - if(!stack.hasTagCompound() || !stack.getTagCompound().hasKey(upgrade.getTag())) return false; + if (stack == null || !(stack.getItem() instanceof ItemFamiliar_Old)) return false; + if (upgrade == null) return true; + if (!stack.hasTagCompound() || !stack.getTagCompound().hasKey(upgrade.getTag())) return false; return stack.getTagCompound().getBoolean(upgrade.getTag()); } public void addUpgrade(ItemStack stack, FamiliarUpgrade upgrade) { - if(stack == null || !(stack.getItem() instanceof ItemFamiliar_Old)) return; + if (stack == null || !(stack.getItem() instanceof ItemFamiliar_Old)) return; NBTHelper.getData(stack).setBoolean(upgrade.getTag(), true); } public static ItemStack getPaybackPackage(ItemStack oldFamiliarStack) { - if(oldFamiliarStack == null || !(oldFamiliarStack.getItem() instanceof ItemFamiliar_Old)) return null; + if (oldFamiliarStack == null || !(oldFamiliarStack.getItem() instanceof ItemFamiliar_Old)) return null; ItemStack arcPackage = new ItemStack(RegisteredItems.itemPackage, 1, 2); List contents = new ArrayList(); arcPackage.setStackDisplayName(EnumChatFormatting.GOLD + "Used Familiar Items"); DeprecationItemPaybacks.addFamiliarCraftingPaybackStack(contents, oldFamiliarStack); - if(RegisteredItems.itemFamiliar_old.hasUpgrade(oldFamiliarStack, FamiliarUpgrade.ATTACK_1)) { + if (RegisteredItems.itemFamiliar_old.hasUpgrade(oldFamiliarStack, FamiliarUpgrade.ATTACK_1)) { DeprecationItemPaybacks.addFamiliarAttack1Payback(contents, oldFamiliarStack); } - if(RegisteredItems.itemFamiliar_old.hasUpgrade(oldFamiliarStack, FamiliarUpgrade.ATTACK_2)) { + if (RegisteredItems.itemFamiliar_old.hasUpgrade(oldFamiliarStack, FamiliarUpgrade.ATTACK_2)) { DeprecationItemPaybacks.addFamiliarAttack2Payback(contents, oldFamiliarStack); } - if(RegisteredItems.itemFamiliar_old.hasUpgrade(oldFamiliarStack, FamiliarUpgrade.ATTACK_3)) { + if (RegisteredItems.itemFamiliar_old.hasUpgrade(oldFamiliarStack, FamiliarUpgrade.ATTACK_3)) { DeprecationItemPaybacks.addFamiliarAttack3Payback(contents, oldFamiliarStack); } - if(RegisteredItems.itemFamiliar_old.hasUpgrade(oldFamiliarStack, FamiliarUpgrade.COOLDOWN_1)) { + if (RegisteredItems.itemFamiliar_old.hasUpgrade(oldFamiliarStack, FamiliarUpgrade.COOLDOWN_1)) { DeprecationItemPaybacks.addFamiliarCooldownPayback(contents, oldFamiliarStack); } - if(RegisteredItems.itemFamiliar_old.hasUpgrade(oldFamiliarStack, FamiliarUpgrade.RANGE_1)) { + if (RegisteredItems.itemFamiliar_old.hasUpgrade(oldFamiliarStack, FamiliarUpgrade.RANGE_1)) { DeprecationItemPaybacks.addFamiliarRangePayback(contents, oldFamiliarStack); } @@ -247,7 +252,6 @@ public class ItemFamiliar_Old extends Item implements IBauble { } public enum FamiliarUpgrade { - ATTACK_1("AttackUpgrade1"), ATTACK_2("AttackUpgrade2", FamiliarUpgrade.ATTACK_1), ATTACK_3("AttackUpgrade3", FamiliarUpgrade.ATTACK_2), @@ -274,5 +278,4 @@ public class ItemFamiliar_Old extends Item implements IBauble { return this.neededUpgrade; } } - } diff --git a/src/main/java/makeo/gadomancy/common/network/PacketHandler.java b/src/main/java/makeo/gadomancy/common/network/PacketHandler.java index 0c77b56..cbf41e8 100644 --- a/src/main/java/makeo/gadomancy/common/network/PacketHandler.java +++ b/src/main/java/makeo/gadomancy/common/network/PacketHandler.java @@ -15,27 +15,33 @@ import makeo.gadomancy.common.network.packets.*; * Created by makeo @ 03.07.2015 19:13 */ public class PacketHandler { - public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Gadomancy.MODID.toLowerCase()); + public static final SimpleNetworkWrapper INSTANCE = + NetworkRegistry.INSTANCE.newSimpleChannel(Gadomancy.MODID.toLowerCase()); public static void init() { int id = 0; - //Random stuff - PacketHandler.INSTANCE.registerMessage(PacketUpdateGolemTypeOrder.class, PacketUpdateGolemTypeOrder.class, id++, Side.CLIENT); - PacketHandler.INSTANCE.registerMessage(PacketStartAnimation.class, PacketStartAnimation.class, id++, Side.CLIENT); - PacketHandler.INSTANCE.registerMessage(PacketAnimationAbsorb.class, PacketAnimationAbsorb.class, id++, Side.CLIENT); + // Random stuff + PacketHandler.INSTANCE.registerMessage( + PacketUpdateGolemTypeOrder.class, PacketUpdateGolemTypeOrder.class, id++, Side.CLIENT); + PacketHandler.INSTANCE.registerMessage( + PacketStartAnimation.class, PacketStartAnimation.class, id++, Side.CLIENT); + PacketHandler.INSTANCE.registerMessage( + PacketAnimationAbsorb.class, PacketAnimationAbsorb.class, id++, Side.CLIENT); - //Using TC Clientside content + // Using TC Clientside content PacketHandler.INSTANCE.registerMessage(PacketTCNodeBolt.class, PacketTCNodeBolt.class, id++, Side.CLIENT); PacketHandler.INSTANCE.registerMessage(PacketTCWispyLine.class, PacketTCWispyLine.class, id++, Side.CLIENT); - PacketHandler.INSTANCE.registerMessage(PacketTCNotificationText.class, PacketTCNotificationText.class, id++, Side.CLIENT); + PacketHandler.INSTANCE.registerMessage( + PacketTCNotificationText.class, PacketTCNotificationText.class, id++, Side.CLIENT); - //Familiar + // Familiar PacketHandler.INSTANCE.registerMessage(PacketFamiliarBolt.class, PacketFamiliarBolt.class, id++, Side.CLIENT); - //Sync data + // Sync data PacketHandler.INSTANCE.registerMessage(PacketSyncConfigs.class, PacketSyncConfigs.class, id++, Side.CLIENT); PacketHandler.INSTANCE.registerMessage(PacketSyncData.class, PacketSyncData.class, id++, Side.CLIENT); - PacketHandler.INSTANCE.registerMessage(PacketUpdateOnlineState.class, PacketUpdateOnlineState.class, id++, Side.CLIENT); + PacketHandler.INSTANCE.registerMessage( + PacketUpdateOnlineState.class, PacketUpdateOnlineState.class, id++, Side.CLIENT); } } diff --git a/src/main/java/makeo/gadomancy/common/network/packets/PacketAbortTransform.java b/src/main/java/makeo/gadomancy/common/network/packets/PacketAbortTransform.java index b0b3593..d3d6c98 100644 --- a/src/main/java/makeo/gadomancy/common/network/packets/PacketAbortTransform.java +++ b/src/main/java/makeo/gadomancy/common/network/packets/PacketAbortTransform.java @@ -20,6 +20,7 @@ public class PacketAbortTransform implements IMessage, IMessageHandler fieldData = new ArrayList(); - for(Field field : ModConfig.class.getFields()) { - if(Modifier.isStatic(field.getModifiers()) && field.isAnnotationPresent(Sync.class)) { + for (Field field : ModConfig.class.getFields()) { + if (Modifier.isStatic(field.getModifiers()) && field.isAnnotationPresent(Sync.class)) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { new DataOutputStream(baos).writeUTF(field.getName()); @@ -72,7 +71,7 @@ public class PacketSyncConfigs implements IMessage, IMessageHandler provider = AbstractData.Registry.getProvider(providerId); - if(provider == null) { + AbstractData.AbstractDataProvider provider = + AbstractData.Registry.getProvider(providerId); + if (provider == null) { Gadomancy.log.warn("Provider for ID " + providerId + " doesn't exist! Skipping..."); continue; } @@ -73,10 +73,10 @@ public class PacketSyncData implements IMessage, IMessageHandler * Created by HellFirePvP @ 28.10.2015 23:28 */ -public class PacketTCWispyLine implements IMessage, IMessageHandler { +public class PacketTCWispyLine implements IMessage, IMessageHandler { private int dimId; private double pedestalX, pedestalY, pedestalZ; @@ -24,7 +24,16 @@ public class PacketTCWispyLine implements IMessage, IMessageHandler mapping; public PacketUpdateGolemTypeOrder() {} + public PacketUpdateGolemTypeOrder(Map mapping) { this.mapping = mapping; } @@ -34,7 +34,8 @@ public class PacketUpdateGolemTypeOrder implements IMessage, IMessageHandler) new ObjectInputStream(in).readObject(); in.close(); - } catch (Exception ignored) { }//IOException | ClassNotFoundException ignored + } catch (Exception ignored) { + } // IOException | ClassNotFoundException ignored } @Override @@ -42,7 +43,8 @@ public class PacketUpdateGolemTypeOrder implements IMessage, IMessageHandler aspectSaturation = new LinkedHashMap(); - //Ensures that the node gets fed up faster if you feed it the same aspect over and over again. + // Ensures that the node gets fed up faster if you feed it the same aspect over and over again. private Aspect lastFedAspect; private int lastFedRow; - //If this is true, the node stops growing. + // If this is true, the node stops growing. private boolean isSaturated; public GrowingNodeBehavior(TileExtendedNode owningNode) { @@ -61,50 +60,60 @@ public class GrowingNodeBehavior { } public void addAspect(AspectType type, Aspect aspect, int value) { - if(this.isSaturated) return; + if (this.isSaturated) return; double increasedSaturation = this.getSaturation(type, aspect); this.addSaturation(aspect, increasedSaturation); this.owningNode.getAspectsBase().add(aspect, value); - ResearchHelper.distributeResearch(Gadomancy.MODID.toUpperCase() + ".GROWING_GROWTH", this.owningNode.getWorldObj(), this.owningNode.xCoord, this.owningNode.yCoord, this.owningNode.zCoord, 6); + ResearchHelper.distributeResearch( + Gadomancy.MODID.toUpperCase() + ".GROWING_GROWTH", + this.owningNode.getWorldObj(), + this.owningNode.xCoord, + this.owningNode.yCoord, + this.owningNode.zCoord, + 6); this.computeOverallSaturation(); } - //Computes the saturation of all current aspects and calculates the overall happiness as well as if the - //Node will stop growing. + // Computes the saturation of all current aspects and calculates the overall happiness as well as if the + // Node will stop growing. private void computeOverallSaturation() { - if(this.isSaturated) return; + if (this.isSaturated) return; double completeSaturation = 0D; int aspects = this.aspectSaturation.keySet().size(); - for(Aspect a : this.aspectSaturation.keySet()) { + for (Aspect a : this.aspectSaturation.keySet()) { completeSaturation += this.aspectSaturation.get(a); } - //Not just 0.0-1.0! - //Values vary from 0.0 to SATURATION_CAP (or a bit higher) + // Not just 0.0-1.0! + // Values vary from 0.0 to SATURATION_CAP (or a bit higher) double percentSaturation = completeSaturation / ((double) aspects); double satCmp = GrowingNodeBehavior.SATURATION_CAP; satCmp *= 8.5; - satCmp /= 10; + satCmp /= 10; - if(this.overallHappiness > GrowingNodeBehavior.HAPPINESS_CAP) { + if (this.overallHappiness > GrowingNodeBehavior.HAPPINESS_CAP) { this.overallHappiness /= 10; this.owningNode.triggerVortexExplosion(); } - //If the saturation is in the upper 85% - if(percentSaturation > satCmp) { + // If the saturation is in the upper 85% + if (percentSaturation > satCmp) { this.isSaturated = true; } } public boolean mayZapNow() { - return this.overallHappiness > this.owningNode.getWorldObj().rand.nextInt(GrowingNodeBehavior.HAPPINESS_CAP * GrowingNodeBehavior.HAPPINESS_CAP); + return this.overallHappiness + > this.owningNode + .getWorldObj() + .rand + .nextInt(GrowingNodeBehavior.HAPPINESS_CAP * GrowingNodeBehavior.HAPPINESS_CAP); } public float getZapDamage() { @@ -114,13 +123,13 @@ public class GrowingNodeBehavior { private void addSaturation(Aspect aspect, double increasedSaturation) { double overallReduction = 1D / GrowingNodeBehavior.SATURATION_DIFFICULTY; - if(this.aspectSaturation.containsKey(aspect)) { + if (this.aspectSaturation.containsKey(aspect)) { this.aspectSaturation.put(aspect, this.aspectSaturation.get(aspect) + increasedSaturation); } else { this.aspectSaturation.put(aspect, increasedSaturation); } - for(Aspect a : this.aspectSaturation.keySet()) { - if(a.equals(aspect)) continue; + for (Aspect a : this.aspectSaturation.keySet()) { + if (a.equals(aspect)) continue; double newSaturation = this.aspectSaturation.get(a) - overallReduction; newSaturation = newSaturation < 0 ? 0 : newSaturation; this.aspectSaturation.put(a, newSaturation); @@ -131,20 +140,21 @@ public class GrowingNodeBehavior { double mult = 1D; switch (type) { case WISP: - mult -= 0.2D; //Growing node doesn't get saturated by wisps that fast. + mult -= 0.2D; // Growing node doesn't get saturated by wisps that fast. break; case WISP_ESSENCE: - mult += 0.2D; //Growing node doesn't like essences all the time.. + mult += 0.2D; // Growing node doesn't like essences all the time.. break; case ASPECT_ORB: - mult -= 0.3D; //Growing node prefers aspects in their most natural form. + mult -= 0.3D; // Growing node prefers aspects in their most natural form. break; case MANA_BEAN: case CRYSTAL_ESSENCE: - mult += 0.4D; //Mana beans are hard to breed but easy to multiply.. thus growing node doesn't like. Same goes for crystallized essentia + mult += 0.4D; // Mana beans are hard to breed but easy to multiply.. thus growing node doesn't like. + // Same goes for crystallized essentia } - if(this.lastFedAspect != null) { - if(this.lastFedAspect.equals(aspect)) { + if (this.lastFedAspect != null) { + if (this.lastFedAspect.equals(aspect)) { mult += 0.4D; this.lastFedRow++; } @@ -155,25 +165,32 @@ public class GrowingNodeBehavior { } public boolean updateBehavior(boolean needUpdate) { - if(this.fixedNode != null && this.owningNode.ticksExisted % 3 == 0) { - if(this.owningNode.getWorldObj().getBlock(this.fixedNode.xCoord, this.fixedNode.yCoord, this.fixedNode.zCoord) != RegisteredBlocks.blockNode || - this.owningNode.getWorldObj().getTileEntity(this.fixedNode.xCoord, this.fixedNode.yCoord, this.fixedNode.zCoord) == null || - this.fixedNode.isInvalid()) { + if (this.fixedNode != null && this.owningNode.ticksExisted % 3 == 0) { + if (this.owningNode + .getWorldObj() + .getBlock(this.fixedNode.xCoord, this.fixedNode.yCoord, this.fixedNode.zCoord) + != RegisteredBlocks.blockNode + || this.owningNode + .getWorldObj() + .getTileEntity(this.fixedNode.xCoord, this.fixedNode.yCoord, this.fixedNode.zCoord) + == null + || this.fixedNode.isInvalid()) { this.fixedNode = null; return needUpdate; } AspectList currentAspects = this.fixedNode.getAspects(); AspectList baseAspects = this.fixedNode.getAspectsBase(); - if(baseAspects.getAspects().length == 0) { + if (baseAspects.getAspects().length == 0) { int x = this.fixedNode.xCoord; int y = this.fixedNode.yCoord; int z = this.fixedNode.zCoord; this.removeFixedNode(x, y, z); return needUpdate; } - Aspect a = baseAspects.getAspects()[this.owningNode.getWorldObj().rand.nextInt(baseAspects.getAspects().length)]; - if(baseAspects.getAmount(a) > 0) { - if(baseAspects.reduce(a, 1)) { + Aspect a = baseAspects + .getAspects()[this.owningNode.getWorldObj().rand.nextInt(baseAspects.getAspects().length)]; + if (baseAspects.getAmount(a) > 0) { + if (baseAspects.reduce(a, 1)) { World world = this.owningNode.getWorldObj(); int fx = this.fixedNode.xCoord; int fy = this.fixedNode.yCoord; @@ -183,18 +200,29 @@ public class GrowingNodeBehavior { int oz = this.owningNode.zCoord; currentAspects.reduce(a, 1); - ResearchHelper.distributeResearch(Gadomancy.MODID.toUpperCase() + ".GROWING_ATTACK", this.owningNode.getWorldObj(), this.owningNode.xCoord, this.owningNode.yCoord, this.owningNode.zCoord, 16); + ResearchHelper.distributeResearch( + Gadomancy.MODID.toUpperCase() + ".GROWING_ATTACK", + this.owningNode.getWorldObj(), + this.owningNode.xCoord, + this.owningNode.yCoord, + this.owningNode.zCoord, + 16); EntityAspectOrb aspectOrb = new EntityAspectOrb(world, fx + 0.5D, fy + 0.5D, fz + 0.5D, a, 1); - Vec3 dir = Vec3.createVectorHelper(fx + 0.5D, fy + 0.5D, fz + 0.5D).subtract(Vec3.createVectorHelper(ox + 0.5D, oy + 0.5D, oz + 0.5D)).normalize(); - dir.addVector(this.randOffset(), this.randOffset(), this.randOffset()).normalize(); + Vec3 dir = Vec3.createVectorHelper(fx + 0.5D, fy + 0.5D, fz + 0.5D) + .subtract(Vec3.createVectorHelper(ox + 0.5D, oy + 0.5D, oz + 0.5D)) + .normalize(); + dir.addVector(this.randOffset(), this.randOffset(), this.randOffset()) + .normalize(); aspectOrb.motionX = dir.xCoord; aspectOrb.motionY = dir.yCoord; aspectOrb.motionZ = dir.zCoord; this.fixedNode.getWorldObj().spawnEntityInWorld(aspectOrb); - NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, ox + 0.5F, oy + 0.5F, oz + 0.5F, 32); - PacketTCNodeBolt bolt = new PacketTCNodeBolt(ox + 0.5F, oy + 0.5F, oz + 0.5F, fx + 0.5F, fy + 0.5F, fz + 0.5F, 0, false); + NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint( + world.provider.dimensionId, ox + 0.5F, oy + 0.5F, oz + 0.5F, 32); + PacketTCNodeBolt bolt = new PacketTCNodeBolt( + ox + 0.5F, oy + 0.5F, oz + 0.5F, fx + 0.5F, fy + 0.5F, fz + 0.5F, 0, false); PacketHandler.INSTANCE.sendToAllAround(bolt, point); PacketAnimationAbsorb packet = new PacketAnimationAbsorb(ox, oy, oz, fx, fy, fz, 7); @@ -204,7 +232,7 @@ public class GrowingNodeBehavior { this.fixedNode.markDirty(); needUpdate = true; } else { - if(baseAspects.size() <= 1) { + if (baseAspects.size() <= 1) { int x = this.fixedNode.xCoord; int y = this.fixedNode.yCoord; int z = this.fixedNode.zCoord; @@ -216,7 +244,7 @@ public class GrowingNodeBehavior { return needUpdate; } } else { - if(baseAspects.size() <= 1) { + if (baseAspects.size() <= 1) { int x = this.fixedNode.xCoord; int y = this.fixedNode.yCoord; int z = this.fixedNode.zCoord; @@ -243,31 +271,32 @@ public class GrowingNodeBehavior { } public boolean doesAccept(Aspect aspect) { - if(this.isSaturated) { + if (this.isSaturated) { this.handleOverfeed(); return false; } - if(this.aspectSaturation.containsKey(aspect)) { - double percentageToSaturation = this.aspectSaturation.get(aspect) / GrowingNodeBehavior.SATURATION_CAP; // 0.0 - 1.0 + if (this.aspectSaturation.containsKey(aspect)) { + double percentageToSaturation = + this.aspectSaturation.get(aspect) / GrowingNodeBehavior.SATURATION_CAP; // 0.0 - 1.0 boolean mayAdd = this.owningNode.getWorldObj().rand.nextFloat() > percentageToSaturation; - if(mayAdd) { + if (mayAdd) { double inc = 1D / (1D - percentageToSaturation); - if(this.lastFedAspect != null) { - if(aspect.equals(this.lastFedAspect)) { + if (this.lastFedAspect != null) { + if (aspect.equals(this.lastFedAspect)) { inc *= this.evaluateFeedingDenialFunc((this.lastFedRow > 0 ? this.lastFedRow : 1)); } else { inc *= -10; this.lastFedRow = 0; } } - this.overallHappiness += inc; //The node doesn't like to be forced to eat the same every time. - if(this.overallHappiness < 0) this.overallHappiness = 0; + this.overallHappiness += inc; // The node doesn't like to be forced to eat the same every time. + if (this.overallHappiness < 0) this.overallHappiness = 0; } return mayAdd; } else { - //The node does not know that aspect yet/hasn't created an immunity to it yet. - //The node gets to know a new aspect, thus the happiness increases. + // The node does not know that aspect yet/hasn't created an immunity to it yet. + // The node gets to know a new aspect, thus the happiness increases. this.overallHappiness = this.overallHappiness / GrowingNodeBehavior.SATURATION_DIFFICULTY; return true; } @@ -278,14 +307,14 @@ public class GrowingNodeBehavior { } private void handleOverfeed() { - //TODO handle transformation into STARVING + // TODO handle transformation into STARVING } public void readFromNBT(NBTTagCompound nbtTagCompound) { this.isSaturated = nbtTagCompound.getBoolean("overallSaturated"); this.overallHappiness = nbtTagCompound.getDouble("overallHappiness"); - if(nbtTagCompound.hasKey("lastFed")) { + if (nbtTagCompound.hasKey("lastFed")) { this.lastFedAspect = Aspect.getAspect(nbtTagCompound.getString("lastFedAspect")); this.lastFedRow = nbtTagCompound.getInteger("lastFedRow"); } @@ -296,7 +325,7 @@ public class GrowingNodeBehavior { String name = aspectCompound.getString("aspectName"); double saturation = aspectCompound.getDouble("aspectSaturation"); Aspect a = Aspect.getAspect(name); - if(a != null) { + if (a != null) { this.aspectSaturation.put(a, saturation); } } @@ -305,13 +334,13 @@ public class GrowingNodeBehavior { public void writeToNBT(NBTTagCompound nbtTagCompound) { nbtTagCompound.setBoolean("overallSaturated", this.isSaturated); nbtTagCompound.setDouble("overallHappiness", this.overallHappiness); - if(this.lastFedAspect != null) { + if (this.lastFedAspect != null) { nbtTagCompound.setString("lastFedAspect", this.lastFedAspect.getTag()); nbtTagCompound.setInteger("lastFedRow", this.lastFedRow); } NBTTagList list = new NBTTagList(); - for(Aspect a : this.aspectSaturation.keySet()) { + for (Aspect a : this.aspectSaturation.keySet()) { double saturation = this.aspectSaturation.get(a); NBTTagCompound compound = new NBTTagCompound(); compound.setString("aspectName", a.getTag()); @@ -326,14 +355,14 @@ public class GrowingNodeBehavior { } public void lockOnTo(TileNode node) { - if(this.fixedNode == null) - this.fixedNode = node; + if (this.fixedNode == null) this.fixedNode = node; } public enum AspectType { - - WISP, WISP_ESSENCE, ASPECT_ORB, MANA_BEAN, CRYSTAL_ESSENCE - + WISP, + WISP_ESSENCE, + ASPECT_ORB, + MANA_BEAN, + CRYSTAL_ESSENCE } - } diff --git a/src/main/java/makeo/gadomancy/common/node/NodeManipulatorResult.java b/src/main/java/makeo/gadomancy/common/node/NodeManipulatorResult.java index 1ece391..a1b6bda 100644 --- a/src/main/java/makeo/gadomancy/common/node/NodeManipulatorResult.java +++ b/src/main/java/makeo/gadomancy/common/node/NodeManipulatorResult.java @@ -30,5 +30,4 @@ public abstract class NodeManipulatorResult extends WeightedRandom.Item { } public abstract boolean affect(World world, INode node); - } diff --git a/src/main/java/makeo/gadomancy/common/node/NodeManipulatorResultHandler.java b/src/main/java/makeo/gadomancy/common/node/NodeManipulatorResultHandler.java index e0d6d39..2c1d48c 100644 --- a/src/main/java/makeo/gadomancy/common/node/NodeManipulatorResultHandler.java +++ b/src/main/java/makeo/gadomancy/common/node/NodeManipulatorResultHandler.java @@ -1,5 +1,8 @@ package makeo.gadomancy.common.node; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; import makeo.gadomancy.common.data.config.ModConfig; import makeo.gadomancy.common.registration.RegisteredManipulations; import net.minecraft.util.WeightedRandom; @@ -8,10 +11,6 @@ import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.nodes.INode; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -30,28 +29,29 @@ public class NodeManipulatorResultHandler { return NodeManipulatorResultHandler.getRandomResult(world, world.rand, affectedNode, percChance); } - public static NodeManipulatorResult getRandomResult(World world, Random random, INode affectedNode, int percChance) { + public static NodeManipulatorResult getRandomResult( + World world, Random random, INode affectedNode, int percChance) { int resultPositiveChance = Math.round(((float) percChance) / 5F); List localResults = new ArrayList(); - for(NodeManipulatorResult result : NodeManipulatorResultHandler.possibleResults) { - if(result.canAffect(world, affectedNode)) { + for (NodeManipulatorResult result : NodeManipulatorResultHandler.possibleResults) { + if (result.canAffect(world, affectedNode)) { ResultType type = result.getResultType(); - if(type == ResultType.NEGATIVE) { - if(random.nextInt(100) < resultPositiveChance) continue; + if (type == ResultType.NEGATIVE) { + if (random.nextInt(100) < resultPositiveChance) continue; } localResults.add(result); } } - if(localResults.isEmpty()) return null; + if (localResults.isEmpty()) return null; return (NodeManipulatorResult) WeightedRandom.getRandomItem(random, localResults); } public static void combine(AspectList containingList, Aspect a, Aspect b, int addition) { - if(!NodeManipulatorResultHandler.canCombine(a, b)) return; + if (!NodeManipulatorResultHandler.canCombine(a, b)) return; Aspect combination = NodeManipulatorResultHandler.getCombination(a, b); int lowerAmount; - if(containingList.getAmount(a) < containingList.getAmount(b)) { + if (containingList.getAmount(a) < containingList.getAmount(b)) { lowerAmount = containingList.getAmount(a); } else { lowerAmount = containingList.getAmount(b); @@ -66,10 +66,9 @@ public class NodeManipulatorResultHandler { } public static Aspect getCombination(Aspect a, Aspect b) { - for(Aspect aspect : Aspect.getCompoundAspects()) { + for (Aspect aspect : Aspect.getCompoundAspects()) { Aspect[] components = aspect.getComponents(); - if((components[0] == a && components[1] == b) || - components[0] == b && components[1] == a) { + if ((components[0] == a && components[1] == b) || components[0] == b && components[1] == a) { return aspect; } } @@ -77,32 +76,29 @@ public class NodeManipulatorResultHandler { } static { - //Aspect combination pair + // Aspect combination pair NodeManipulatorResultHandler.possibleResults.add(RegisteredManipulations.resultBreakCompounds); NodeManipulatorResultHandler.possibleResults.add(RegisteredManipulations.resultCombineAspects); - //Modifier pair + // Modifier pair NodeManipulatorResultHandler.possibleResults.add(RegisteredManipulations.resultIncreaseModifier); NodeManipulatorResultHandler.possibleResults.add(RegisteredManipulations.resultDecreaseModifier); - //Switch node Type + // Switch node Type NodeManipulatorResultHandler.possibleResults.add(RegisteredManipulations.resultSwitchType); - if(ModConfig.enableAdditionalNodeTypes) { - //Almighty Growing + if (ModConfig.enableAdditionalNodeTypes) { + // Almighty Growing NodeManipulatorResultHandler.possibleResults.add(RegisteredManipulations.resultApplyGrowing); } - //Let the node gain primals + // Let the node gain primals NodeManipulatorResultHandler.possibleResults.add(RegisteredManipulations.resultGainPrimal); } public enum ResultType { - POSITIVE, NEGATIVE, NEUTRAL - } - } diff --git a/src/main/java/makeo/gadomancy/common/potions/PotionAchromatic.java b/src/main/java/makeo/gadomancy/common/potions/PotionAchromatic.java index 38cb6a0..3e3c29d 100644 --- a/src/main/java/makeo/gadomancy/common/potions/PotionAchromatic.java +++ b/src/main/java/makeo/gadomancy/common/potions/PotionAchromatic.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.potions; +import java.util.List; import makeo.gadomancy.common.data.DataAchromatic; import makeo.gadomancy.common.data.SyncDataHolder; import makeo.gadomancy.common.utils.Vector3; @@ -10,8 +11,6 @@ import net.minecraft.entity.ai.attributes.BaseAttributeMap; import net.minecraft.util.AxisAlignedBB; import thaumcraft.api.aspects.Aspect; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -27,14 +26,16 @@ public class PotionAchromatic extends PotionCustomTexture { } @Override - public void applyAttributesModifiersToEntity(EntityLivingBase entity, BaseAttributeMap p_111185_2_, int p_111185_3_) { + public void applyAttributesModifiersToEntity( + EntityLivingBase entity, BaseAttributeMap p_111185_2_, int p_111185_3_) { super.applyAttributesModifiersToEntity(entity, p_111185_2_, p_111185_3_); ((DataAchromatic) SyncDataHolder.getDataServer("AchromaticData")).handleApplication(entity); } @Override - public void removeAttributesModifiersFromEntity(EntityLivingBase entity, BaseAttributeMap p_111187_2_, int p_111187_3_) { + public void removeAttributesModifiersFromEntity( + EntityLivingBase entity, BaseAttributeMap p_111187_2_, int p_111187_3_) { super.removeAttributesModifiersFromEntity(entity, p_111187_2_, p_111187_3_); ((DataAchromatic) SyncDataHolder.getDataServer("AchromaticData")).handleRemoval(entity); @@ -89,9 +90,22 @@ public class PotionAchromatic extends PotionCustomTexture { } }*/ - List projectiles = entity.worldObj.getEntitiesWithinAABB(IProjectile.class, AxisAlignedBB.getBoundingBox(entity.posX - 4.0D, entity.posY - 4.0D, entity.posZ - 4.0D, entity.posX + 3.0D, entity.posY + 3.0D, entity.posZ + 3.0D)); + List projectiles = entity.worldObj.getEntitiesWithinAABB( + IProjectile.class, + AxisAlignedBB.getBoundingBox( + entity.posX - 4.0D, + entity.posY - 4.0D, + entity.posZ - 4.0D, + entity.posX + 3.0D, + entity.posY + 3.0D, + entity.posZ + 3.0D)); for (Entity e : projectiles) { - Vector3 motionVec = new Vector3(e.motionX, e.motionY, e.motionZ).normalize().multiply(Math.sqrt((e.posX - entity.posX) * (e.posX - entity.posX) + (e.posY - entity.posY) * (e.posY - entity.posY) + (e.posZ - entity.posZ) * (e.posZ - entity.posZ)) * 2.0D); + Vector3 motionVec = new Vector3(e.motionX, e.motionY, e.motionZ) + .normalize() + .multiply(Math.sqrt((e.posX - entity.posX) * (e.posX - entity.posX) + + (e.posY - entity.posY) * (e.posY - entity.posY) + + (e.posZ - entity.posZ) * (e.posZ - entity.posZ)) + * 2.0D); e.posX += motionVec.getX(); e.posY += motionVec.getY(); e.posZ += motionVec.getZ(); diff --git a/src/main/java/makeo/gadomancy/common/potions/PotionBuffGolem.java b/src/main/java/makeo/gadomancy/common/potions/PotionBuffGolem.java index 1533d35..c79099e 100644 --- a/src/main/java/makeo/gadomancy/common/potions/PotionBuffGolem.java +++ b/src/main/java/makeo/gadomancy/common/potions/PotionBuffGolem.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.potions; +import java.util.UUID; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; @@ -8,8 +9,6 @@ import net.minecraft.entity.ai.attributes.IAttributeInstance; import thaumcraft.api.aspects.Aspect; import thaumcraft.common.entities.golems.EntityGolemBase; -import java.util.UUID; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -24,9 +23,21 @@ public class PotionBuffGolem extends PotionCustomTexture { public static final double HEALTH_INCREASE = 0.5; public static final double DAMAGE_INCREASE = 1; - public static final AttributeModifier SPEED_INC_PERCENT = new AttributeModifier(UUID.fromString("9f76335f-2952-46e9-b91a-c555ca983ada"), "POTION_GOLEM_SPEED", PotionBuffGolem.SPEED_INCREASE, 1); - public static final AttributeModifier HEALTH_INC_PERCENT = new AttributeModifier(UUID.fromString("fafcbdc2-9c24-45a1-b832-4b6c4a5df9c7"), "POTION_GOLEM_HEALTH", PotionBuffGolem.HEALTH_INCREASE, 1); - public static final AttributeModifier DAMAGE_INC_PERCENT = new AttributeModifier(UUID.fromString("6e562261-dccf-4421-ac6f-c742989c7dfb"), "POTION_GOLEM_DAMAGE", PotionBuffGolem.DAMAGE_INCREASE, 1); + public static final AttributeModifier SPEED_INC_PERCENT = new AttributeModifier( + UUID.fromString("9f76335f-2952-46e9-b91a-c555ca983ada"), + "POTION_GOLEM_SPEED", + PotionBuffGolem.SPEED_INCREASE, + 1); + public static final AttributeModifier HEALTH_INC_PERCENT = new AttributeModifier( + UUID.fromString("fafcbdc2-9c24-45a1-b832-4b6c4a5df9c7"), + "POTION_GOLEM_HEALTH", + PotionBuffGolem.HEALTH_INCREASE, + 1); + public static final AttributeModifier DAMAGE_INC_PERCENT = new AttributeModifier( + UUID.fromString("6e562261-dccf-4421-ac6f-c742989c7dfb"), + "POTION_GOLEM_DAMAGE", + PotionBuffGolem.DAMAGE_INCREASE, + 1); public PotionBuffGolem(int id) { super(id, false, Aspect.CRAFT.getColor(), Aspect.CRAFT.getImage()); @@ -37,21 +48,21 @@ public class PotionBuffGolem extends PotionCustomTexture { public void applyAttributesModifiersToEntity(EntityLivingBase entity, BaseAttributeMap attrMap, int amplifier) { super.applyAttributesModifiersToEntity(entity, attrMap, amplifier); - if(entity instanceof EntityGolemBase) { + if (entity instanceof EntityGolemBase) { EntityGolemBase golem = (EntityGolemBase) entity; IAttributeInstance inst = golem.getEntityAttribute(SharedMonsterAttributes.movementSpeed); - if(inst.getModifier(PotionBuffGolem.SPEED_INC_PERCENT.getID()) != null) { + if (inst.getModifier(PotionBuffGolem.SPEED_INC_PERCENT.getID()) != null) { inst.applyModifier(PotionBuffGolem.SPEED_INC_PERCENT); } inst = golem.getEntityAttribute(SharedMonsterAttributes.maxHealth); - if(inst.getModifier(PotionBuffGolem.HEALTH_INC_PERCENT.getID()) != null) { + if (inst.getModifier(PotionBuffGolem.HEALTH_INC_PERCENT.getID()) != null) { inst.applyModifier(PotionBuffGolem.HEALTH_INC_PERCENT); } inst = golem.getEntityAttribute(SharedMonsterAttributes.attackDamage); - if(inst.getModifier(PotionBuffGolem.DAMAGE_INC_PERCENT.getID()) != null) { + if (inst.getModifier(PotionBuffGolem.DAMAGE_INC_PERCENT.getID()) != null) { inst.applyModifier(PotionBuffGolem.DAMAGE_INC_PERCENT); } } @@ -61,21 +72,21 @@ public class PotionBuffGolem extends PotionCustomTexture { public void removeAttributesModifiersFromEntity(EntityLivingBase entity, BaseAttributeMap attrMap, int amplifier) { super.removeAttributesModifiersFromEntity(entity, attrMap, amplifier); - if(entity instanceof EntityGolemBase) { + if (entity instanceof EntityGolemBase) { EntityGolemBase golem = (EntityGolemBase) entity; IAttributeInstance inst = golem.getEntityAttribute(SharedMonsterAttributes.movementSpeed); - if(inst.getModifier(PotionBuffGolem.SPEED_INC_PERCENT.getID()) != null) { + if (inst.getModifier(PotionBuffGolem.SPEED_INC_PERCENT.getID()) != null) { inst.removeModifier(PotionBuffGolem.SPEED_INC_PERCENT); } inst = golem.getEntityAttribute(SharedMonsterAttributes.maxHealth); - if(inst.getModifier(PotionBuffGolem.HEALTH_INC_PERCENT.getID()) != null) { + if (inst.getModifier(PotionBuffGolem.HEALTH_INC_PERCENT.getID()) != null) { inst.removeModifier(PotionBuffGolem.HEALTH_INC_PERCENT); } inst = golem.getEntityAttribute(SharedMonsterAttributes.attackDamage); - if(inst.getModifier(PotionBuffGolem.DAMAGE_INC_PERCENT.getID()) != null) { + if (inst.getModifier(PotionBuffGolem.DAMAGE_INC_PERCENT.getID()) != null) { inst.removeModifier(PotionBuffGolem.DAMAGE_INC_PERCENT); } } diff --git a/src/main/java/makeo/gadomancy/common/potions/PotionCustomTexture.java b/src/main/java/makeo/gadomancy/common/potions/PotionCustomTexture.java index 4719a40..60b6e15 100644 --- a/src/main/java/makeo/gadomancy/common/potions/PotionCustomTexture.java +++ b/src/main/java/makeo/gadomancy/common/potions/PotionCustomTexture.java @@ -1,13 +1,12 @@ package makeo.gadomancy.common.potions; +import java.awt.*; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.ResourceLocation; -import java.awt.*; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -38,10 +37,9 @@ public abstract class PotionCustomTexture extends Potion { Color c = new Color(this.getLiquidColor()); tes.setColorRGBA(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()); tes.addVertexWithUV(x + 6, y + 7, 0, 0, 0); - tes.addVertexWithUV(x + 6, y + 7 + 18, 0, 0, 1); + tes.addVertexWithUV(x + 6, y + 7 + 18, 0, 0, 1); tes.addVertexWithUV(x + 6 + 18, y + 7 + 18, 0, 1, 1); tes.addVertexWithUV(x + 6 + 18, y + 7, 0, 1, 0); tes.draw(); } - } diff --git a/src/main/java/makeo/gadomancy/common/potions/PotionInactiveGolem.java b/src/main/java/makeo/gadomancy/common/potions/PotionInactiveGolem.java index a91bd69..085e9bf 100644 --- a/src/main/java/makeo/gadomancy/common/potions/PotionInactiveGolem.java +++ b/src/main/java/makeo/gadomancy/common/potions/PotionInactiveGolem.java @@ -1,12 +1,11 @@ package makeo.gadomancy.common.potions; +import java.awt.*; import makeo.gadomancy.common.utils.ColorHelper; import net.minecraft.entity.EntityLivingBase; import net.minecraft.potion.Potion; import thaumcraft.common.entities.golems.EntityGolemBase; -import java.awt.*; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -22,7 +21,7 @@ public class PotionInactiveGolem extends Potion { @Override public void performEffect(EntityLivingBase entity, int par2) { - if(entity instanceof EntityGolemBase) { + if (entity instanceof EntityGolemBase) { ((EntityGolemBase) entity).inactive = true; } } diff --git a/src/main/java/makeo/gadomancy/common/potions/PotionMiningLuck.java b/src/main/java/makeo/gadomancy/common/potions/PotionMiningLuck.java index 13d16d0..f348da3 100644 --- a/src/main/java/makeo/gadomancy/common/potions/PotionMiningLuck.java +++ b/src/main/java/makeo/gadomancy/common/potions/PotionMiningLuck.java @@ -16,5 +16,4 @@ public class PotionMiningLuck extends PotionCustomTexture { super(id, false, Aspect.GREED.getColor(), Aspect.GREED.getImage()); this.setPotionName("potion.luck"); } - } diff --git a/src/main/java/makeo/gadomancy/common/potions/PotionVisAffinity.java b/src/main/java/makeo/gadomancy/common/potions/PotionVisAffinity.java index 48857ba..cdc9174 100644 --- a/src/main/java/makeo/gadomancy/common/potions/PotionVisAffinity.java +++ b/src/main/java/makeo/gadomancy/common/potions/PotionVisAffinity.java @@ -16,5 +16,4 @@ public class PotionVisAffinity extends PotionCustomTexture { super(id, false, Aspect.MAGIC.getColor(), Aspect.MAGIC.getImage()); this.setPotionName("potion.visdiscount"); } - } diff --git a/src/main/java/makeo/gadomancy/common/registration/AIShutdownWhitelist.java b/src/main/java/makeo/gadomancy/common/registration/AIShutdownWhitelist.java index 9490260..a494369 100644 --- a/src/main/java/makeo/gadomancy/common/registration/AIShutdownWhitelist.java +++ b/src/main/java/makeo/gadomancy/common/registration/AIShutdownWhitelist.java @@ -1,15 +1,14 @@ package makeo.gadomancy.common.registration; import com.google.common.collect.Lists; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.ai.EntityAIBase; -import net.minecraft.entity.ai.EntityAIEatGrass; -import net.minecraft.entity.passive.EntitySheep; - import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.entity.ai.EntityAIEatGrass; +import net.minecraft.entity.passive.EntitySheep; /** * This class is part of the Gadomancy Mod @@ -26,8 +25,9 @@ public class AIShutdownWhitelist { private static Map, List>> whitelistedAI = new HashMap, List>>(); - public static void whitelistAIClass(Class entityClass, Class aiClass) { - if(!AIShutdownWhitelist.whitelistedAI.containsKey(entityClass)) { + public static void whitelistAIClass( + Class entityClass, Class aiClass) { + if (!AIShutdownWhitelist.whitelistedAI.containsKey(entityClass)) { AIShutdownWhitelist.whitelistedAI.put(entityClass, new LinkedList>()); } AIShutdownWhitelist.whitelistedAI.get(entityClass).add(aiClass); @@ -38,12 +38,11 @@ public class AIShutdownWhitelist { } public static List> getWhitelistedAIClasses(EntityLiving entity) { - if(!AIShutdownWhitelist.whitelistedAI.containsKey(entity.getClass())) return Lists.newArrayList(); + if (!AIShutdownWhitelist.whitelistedAI.containsKey(entity.getClass())) return Lists.newArrayList(); return AIShutdownWhitelist.whitelistedAI.get(entity.getClass()); } static { AIShutdownWhitelist.whitelistAIClass(EntitySheep.class, EntityAIEatGrass.class); } - } diff --git a/src/main/java/makeo/gadomancy/common/registration/ModSubstitutions.java b/src/main/java/makeo/gadomancy/common/registration/ModSubstitutions.java index cb265fb..d1151fc 100644 --- a/src/main/java/makeo/gadomancy/common/registration/ModSubstitutions.java +++ b/src/main/java/makeo/gadomancy/common/registration/ModSubstitutions.java @@ -22,17 +22,20 @@ import thaumcraft.common.config.ConfigBlocks; public class ModSubstitutions { public static void preInit() { - if(ModConfig.enableAdditionalNodeTypes) { + if (ModConfig.enableAdditionalNodeTypes) { try { ItemBlock item = (ItemBlock) Item.getItemFromBlock(ConfigBlocks.blockAiry); item.field_150939_a = RegisteredBlocks.blockNode; - //Hacky way + // Hacky way FMLControlledNamespacedRegistry registry = GameData.getBlockRegistry(); - registry.underlyingIntegerMap.field_148749_a.put(RegisteredBlocks.blockNode, Block.getIdFromBlock(ConfigBlocks.blockAiry)); - registry.underlyingIntegerMap.field_148748_b.set(Block.getIdFromBlock(ConfigBlocks.blockAiry), RegisteredBlocks.blockNode); - ((BiMap)registry.field_148758_b).forcePut(RegisteredBlocks.blockNode, registry.field_148758_b.get(ConfigBlocks.blockAiry)); + registry.underlyingIntegerMap.field_148749_a.put( + RegisteredBlocks.blockNode, Block.getIdFromBlock(ConfigBlocks.blockAiry)); + registry.underlyingIntegerMap.field_148748_b.set( + Block.getIdFromBlock(ConfigBlocks.blockAiry), RegisteredBlocks.blockNode); + ((BiMap) registry.field_148758_b) + .forcePut(RegisteredBlocks.blockNode, registry.field_148758_b.get(ConfigBlocks.blockAiry)); registry.underlyingIntegerMap.field_148749_a.remove(ConfigBlocks.blockAiry); @@ -41,14 +44,12 @@ public class ModSubstitutions { e.printStackTrace(); } } -} - - public static void init() { - } + public static void init() {} + public static void postInit() { - if(ModConfig.enableAdditionalNodeTypes) { + if (ModConfig.enableAdditionalNodeTypes) { CommonProxy.unregisterWandHandler("Thaumcraft", Blocks.glass, -1); } } diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredBlocks.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredBlocks.java index c775d2a..c43b046 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredBlocks.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredBlocks.java @@ -1,6 +1,8 @@ package makeo.gadomancy.common.registration; import cpw.mods.fml.common.registry.GameRegistry; +import java.util.ArrayList; +import java.util.List; import makeo.gadomancy.api.ClickBehavior; import makeo.gadomancy.common.blocks.*; import makeo.gadomancy.common.blocks.tiles.*; @@ -15,9 +17,6 @@ import thaumcraft.common.blocks.BlockAiry; import thaumcraft.common.config.ConfigBlocks; import thaumcraft.common.tiles.TileInfusionMatrix; -import java.util.ArrayList; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -55,20 +54,29 @@ public class RegisteredBlocks { RegisteredBlocks.registerDefaultClawBehaviors(); } - //Blocks + // Blocks private static void registerBlocks() { RegisteredBlocks.blockStickyJar = RegisteredBlocks.registerBlock(new BlockStickyJar()); RegisteredBlocks.blockArcaneDropper = RegisteredBlocks.registerBlock(new BlockArcaneDropper()); RegisteredBlocks.blockInfusionClaw = RegisteredBlocks.registerBlock(new BlockInfusionClaw()); - RegisteredBlocks.blockRemoteJar = RegisteredBlocks.registerBlock(new BlockRemoteJar(), ItemBlockRemoteJar.class); - RegisteredBlocks.blockNode = ModConfig.enableAdditionalNodeTypes ? (BlockAiry) new BlockNode().setBlockName("blockAiry") : (BlockAiry) ConfigBlocks.blockAiry; + RegisteredBlocks.blockRemoteJar = + RegisteredBlocks.registerBlock(new BlockRemoteJar(), ItemBlockRemoteJar.class); + RegisteredBlocks.blockNode = ModConfig.enableAdditionalNodeTypes + ? (BlockAiry) new BlockNode().setBlockName("blockAiry") + : (BlockAiry) ConfigBlocks.blockAiry; RegisteredBlocks.blockExtendedNodeJar = RegisteredBlocks.registerBlock(new BlockExtendedNodeJar()); - RegisteredBlocks.blockNodeManipulator = RegisteredBlocks.registerBlock(new BlockNodeManipulator(), ItemNodeManipulator.class); - RegisteredBlocks.blockStoneMachine = RegisteredBlocks.registerBlock(new BlockStoneMachine(), ItemBlockStoneMachine.class); - RegisteredBlocks.blockAdditionalEldrichPortal = RegisteredBlocks.registerBlock(new BlockAdditionalEldritchPortal(), ItemBlockAdditionalEldritchPortal.class); - RegisteredBlocks.blockAuraPylon = RegisteredBlocks.registerBlock(new BlockAuraPylon(), ItemBlockAuraPylon.class); - RegisteredBlocks.blockKnowledgeBook = RegisteredBlocks.registerBlock(new BlockKnowledgeBook(), ItemBlockKnowledgeBook.class); - RegisteredBlocks.blockEssentiaCompressor = RegisteredBlocks.registerBlock(new BlockEssentiaCompressor(), ItemBlockEssentiaCompressor.class); + RegisteredBlocks.blockNodeManipulator = + RegisteredBlocks.registerBlock(new BlockNodeManipulator(), ItemNodeManipulator.class); + RegisteredBlocks.blockStoneMachine = + RegisteredBlocks.registerBlock(new BlockStoneMachine(), ItemBlockStoneMachine.class); + RegisteredBlocks.blockAdditionalEldrichPortal = RegisteredBlocks.registerBlock( + new BlockAdditionalEldritchPortal(), ItemBlockAdditionalEldritchPortal.class); + RegisteredBlocks.blockAuraPylon = + RegisteredBlocks.registerBlock(new BlockAuraPylon(), ItemBlockAuraPylon.class); + RegisteredBlocks.blockKnowledgeBook = + RegisteredBlocks.registerBlock(new BlockKnowledgeBook(), ItemBlockKnowledgeBook.class); + RegisteredBlocks.blockEssentiaCompressor = + RegisteredBlocks.registerBlock(new BlockEssentiaCompressor(), ItemBlockEssentiaCompressor.class); } private static T registerBlock(String name, T block) { @@ -93,7 +101,7 @@ public class RegisteredBlocks { return block; } - //Tiles + // Tiles private static void registerTileEntities() { RegisteredBlocks.registerTile(TileStickyJar.class); RegisteredBlocks.registerTile(TileArcaneDropper.class); @@ -111,7 +119,7 @@ public class RegisteredBlocks { RegisteredBlocks.registerTile(TileArcanePackager.class); RegisteredBlocks.registerTile(TileKnowledgeBook.class); RegisteredBlocks.registerTile(TileEssentiaCompressor.class); - //registerTile(TileAIShutdown.class); + // registerTile(TileAIShutdown.class); } private static void registerTile(Class tile, String name) { @@ -122,8 +130,7 @@ public class RegisteredBlocks { RegisteredBlocks.registerTile(tile, tile.getSimpleName()); } - - //Sticky Jars + // Sticky Jars private static void registerDefaultStickyJars() { RegisteredBlocks.registerStickyJar(ConfigBlocks.blockJar, 0, true, true); RegisteredBlocks.registerStickyJar(ConfigBlocks.blockJar, 3, true, true); @@ -138,15 +145,15 @@ public class RegisteredBlocks { } public static StickyJarInfo getStickyJarInfo(Block block, int metadata) { - for(StickyJarInfo info : RegisteredBlocks.stickyJars) { - if(info.getBlock() == block && info.getMetadata() == metadata) { + for (StickyJarInfo info : RegisteredBlocks.stickyJars) { + if (info.getBlock() == block && info.getMetadata() == metadata) { return info; } } return null; } - //Infusion Claw + // Infusion Claw private static void registerDefaultClawBehaviors() { RegisteredBlocks.registerClawClickBehavior(new ClickBehavior() { @Override @@ -161,7 +168,7 @@ public class RegisteredBlocks { @Override public boolean isValidForBlock() { - if(this.block == ConfigBlocks.blockStoneDevice && this.metadata == 2) { + if (this.block == ConfigBlocks.blockStoneDevice && this.metadata == 2) { this.matrix = (TileInfusionMatrix) this.world.getTileEntity(this.x, this.y, this.z); return true; } @@ -202,9 +209,9 @@ public class RegisteredBlocks { Block block = world.getBlock(x, y, z); int metadata = world.getBlockMetadata(x, y, z); - for(ClickBehavior behavior : RegisteredBlocks.clawBehaviors) { + for (ClickBehavior behavior : RegisteredBlocks.clawBehaviors) { behavior.init(world, block, x, y, z, metadata); - if(behavior.isValidForBlock()) { + if (behavior.isValidForBlock()) { return behavior; } } diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredEnchantments.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredEnchantments.java index 5187786..d03f465 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredEnchantments.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredEnchantments.java @@ -1,13 +1,12 @@ package makeo.gadomancy.common.registration; +import java.lang.reflect.Field; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.data.config.ModConfig; import makeo.gadomancy.common.enchantments.EnchantmentRevealer; import makeo.gadomancy.common.utils.Injector; import net.minecraft.enchantment.Enchantment; -import java.lang.reflect.Field; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -24,8 +23,8 @@ public class RegisteredEnchantments { } public static void createConfigEntries() { - for(Field field : RegisteredEnchantments.class.getFields()) { - if(Enchantment.class.isAssignableFrom(field.getType())) { + for (Field field : RegisteredEnchantments.class.getFields()) { + if (Enchantment.class.isAssignableFrom(field.getType())) { ModConfig.loadEnchantmentId(field.getType().getSimpleName()); } } @@ -33,18 +32,19 @@ public class RegisteredEnchantments { public static T registerEnchantment(Class enchClass) { int id = ModConfig.loadEnchantmentId(enchClass.getSimpleName()); - if(id == -1) { + if (id == -1) { id = RegisteredEnchantments.getUnassignedId(enchClass); } return new Injector(enchClass).invokeConstructor(int.class, id); } private static int getUnassignedId(Class enchClass) { - for(int i = 0; i < Enchantment.enchantmentsList.length; i++) { - if(Enchantment.enchantmentsList[i] == null) { + for (int i = 0; i < Enchantment.enchantmentsList.length; i++) { + if (Enchantment.enchantmentsList[i] == null) { return i; } } - throw new RuntimeException("Failed to find free id for " + Gadomancy.NAME + " enchantment (" + enchClass.getName() + ")! Please consider using the config option to change the enchantment id."); + throw new RuntimeException("Failed to find free id for " + Gadomancy.NAME + " enchantment (" + + enchClass.getName() + ")! Please consider using the config option to change the enchantment id."); } } diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredEntities.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredEntities.java index 34848ce..687f452 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredEntities.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredEntities.java @@ -25,9 +25,15 @@ public class RegisteredEntities { RegisteredEntities.registerEntity(EntityItemElement.class, "EntityItemElement", 32, 40, true); } - private static void registerEntity(Class entityClass, String name, int trackingRange, int updateFreq, boolean sendVelUpdates) { + private static void registerEntity( + Class entityClass, + String name, + int trackingRange, + int updateFreq, + boolean sendVelUpdates) { int id = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(entityClass, name, id); - EntityRegistry.registerModEntity(entityClass, name, id, Gadomancy.instance, trackingRange, updateFreq, sendVelUpdates); + EntityRegistry.registerModEntity( + entityClass, name, id, Gadomancy.instance, trackingRange, updateFreq, sendVelUpdates); } } diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredFamiliarAI_Old.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredFamiliarAI_Old.java index f19b2d1..25164dc 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredFamiliarAI_Old.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredFamiliarAI_Old.java @@ -1,6 +1,10 @@ package makeo.gadomancy.common.registration; import cpw.mods.fml.common.network.NetworkRegistry; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; import makeo.gadomancy.common.familiar.FamiliarAIController_Old; import makeo.gadomancy.common.familiar.FamiliarAIProcess_Old; import makeo.gadomancy.common.items.baubles.ItemFamiliar_Old; @@ -13,11 +17,6 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -56,22 +55,27 @@ public class RegisteredFamiliarAI_Old { int rangeInc = ((ItemFamiliar_Old) itemStack.getItem()).getAttackRangeIncrease(itemStack); List lastTargetters = this.getPotentialTargets(world, parent, rangeInc); - if(lastTargetters.size() == 0) { + if (lastTargetters.size() == 0) { FamiliarAIController_Old.cleanTargetterList(parent); return; } EntityLivingBase mob = lastTargetters.get(world.rand.nextInt(lastTargetters.size())); - if(mob.isDead || mob instanceof EntityPlayer) { + if (mob.isDead || mob instanceof EntityPlayer) { FamiliarAIController_Old.cleanTargetterList(parent); return; } - mob.attackEntityFrom(DamageSource.magic, ((ItemFamiliar_Old) itemStack.getItem()).getAttackStrength(itemStack)); + mob.attackEntityFrom( + DamageSource.magic, ((ItemFamiliar_Old) itemStack.getItem()).getAttackStrength(itemStack)); world.playSoundEffect(mob.posX + 0.5, mob.posY + 0.5, mob.posZ + 0.5, "thaumcraft:zap", 0.8F, 1.0F); - PacketFamiliarBolt bolt = new PacketFamiliarBolt(parent.getCommandSenderName(), (float) mob.posX, (float) mob.posY, (float) mob.posZ, 6, true); - PacketHandler.INSTANCE.sendToAllAround(bolt, new NetworkRegistry.TargetPoint(mob.worldObj.provider.dimensionId, mob.posX, mob.posY, mob.posZ, 32)); + PacketFamiliarBolt bolt = new PacketFamiliarBolt( + parent.getCommandSenderName(), (float) mob.posX, (float) mob.posY, (float) mob.posZ, 6, true); + PacketHandler.INSTANCE.sendToAllAround( + bolt, + new NetworkRegistry.TargetPoint( + mob.worldObj.provider.dimensionId, mob.posX, mob.posY, mob.posZ, 32)); FamiliarAIController_Old.cleanTargetterList(parent); } @@ -80,27 +84,39 @@ public class RegisteredFamiliarAI_Old { EntityLivingBase attacker = player.getLastAttacker(); int range = 8 + rangeInc; - if(attacker != null && !validTargets.contains(attacker) && !attacker.isDead && attacker.getDistanceSq(player.posX, player.posY, player.posZ) <= range * range) { + if (attacker != null + && !validTargets.contains(attacker) + && !attacker.isDead + && attacker.getDistanceSq(player.posX, player.posY, player.posZ) <= range * range) { validTargets.add(attacker); } Iterator it = validTargets.iterator(); - while(it.hasNext()) { + while (it.hasNext()) { EntityLivingBase e = it.next(); - if(e.isDead || e instanceof EntityPlayer) it.remove(); + if (e.isDead || e instanceof EntityPlayer) it.remove(); } return validTargets; } private List getCloseEnoughTargetters(World world, EntityPlayer parent, int rangeInc) { LinkedList lastTargetters = FamiliarAIController_Old.getLastTargetters(parent); - if(lastTargetters == null || lastTargetters.isEmpty()) return new ArrayList(); + if (lastTargetters == null || lastTargetters.isEmpty()) return new ArrayList(); List closeEnoughLastTargetters = new ArrayList(); int range = 8 + rangeInc; - List livingAround = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(parent.posX - 0.5, parent.posY - 0.5, parent.posZ - 0.5, parent.posX + 0.5, parent.posY + 0.5, parent.posZ + 0.5).expand(range, range, range)); - for(Object living : livingAround) { - if(!(living instanceof EntityLivingBase)) continue; - if(lastTargetters.contains(living)) closeEnoughLastTargetters.add((EntityLivingBase) living); + List livingAround = world.getEntitiesWithinAABB( + EntityLivingBase.class, + AxisAlignedBB.getBoundingBox( + parent.posX - 0.5, + parent.posY - 0.5, + parent.posZ - 0.5, + parent.posX + 0.5, + parent.posY + 0.5, + parent.posZ + 0.5) + .expand(range, range, range)); + for (Object living : livingAround) { + if (!(living instanceof EntityLivingBase)) continue; + if (lastTargetters.contains(living)) closeEnoughLastTargetters.add((EntityLivingBase) living); } return closeEnoughLastTargetters; } @@ -115,5 +131,4 @@ public class RegisteredFamiliarAI_Old { return 20 - ((ItemFamiliar_Old) itemStack.getItem()).getAttackCooldownReduction(itemStack); } }; - } diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredGolemStuff.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredGolemStuff.java index 2f97a67..6579912 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredGolemStuff.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredGolemStuff.java @@ -1,5 +1,7 @@ package makeo.gadomancy.common.registration; +import java.util.ArrayList; +import java.util.List; import makeo.gadomancy.api.GadomancyApi; import makeo.gadomancy.api.golems.AdditionalGolemType; import makeo.gadomancy.api.golems.cores.AdditionalGolemCore; @@ -10,9 +12,6 @@ import makeo.gadomancy.common.entities.golems.types.SilverwoodGolemType; import makeo.gadomancy.common.entities.golems.upgrades.GolemUpgrade; import makeo.gadomancy.common.entities.golems.upgrades.GolemUpgradeRunicShield; -import java.util.ArrayList; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -28,19 +27,22 @@ public class RegisteredGolemStuff { public static GolemUpgradeRunicShield upgradeRunicShield; public static SilverwoodGolemType typeSilverwood; - //public static ObsidianGolemType typeObsidian; + // public static ObsidianGolemType typeObsidian; public static AdditionalGolemCore breakCore; public static AdditionalGolemCore bodyguardCore; public static void init() { - RegisteredGolemStuff.typeSilverwood = RegisteredGolemStuff.registerGolemType("SILVERWOOD", new SilverwoodGolemType()); - //typeObsidian = registerGolemType("OBSIDIAN", new ObsidianGolemType()); + RegisteredGolemStuff.typeSilverwood = + RegisteredGolemStuff.registerGolemType("SILVERWOOD", new SilverwoodGolemType()); + // typeObsidian = registerGolemType("OBSIDIAN", new ObsidianGolemType()); RegisteredGolemStuff.breakCore = RegisteredGolemStuff.registerGolemCore("breakCore", new BreakGolemCore()); - RegisteredGolemStuff.bodyguardCore = RegisteredGolemStuff.registerGolemCore("bodyguardCore", new BodyguardGolemCore()); + RegisteredGolemStuff.bodyguardCore = + RegisteredGolemStuff.registerGolemCore("bodyguardCore", new BodyguardGolemCore()); - RegisteredGolemStuff.upgradeRunicShield = RegisteredGolemStuff.registerGolemUpgrade(new GolemUpgradeRunicShield()); + RegisteredGolemStuff.upgradeRunicShield = + RegisteredGolemStuff.registerGolemUpgrade(new GolemUpgradeRunicShield()); } private static T registerGolemType(String name, T type) { diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredIntegrations.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredIntegrations.java index c1f4770..7c7f228 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredIntegrations.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredIntegrations.java @@ -26,45 +26,48 @@ public class RegisteredIntegrations { public static void init() { RegisteredIntegrations.morph = RegisteredIntegrations.registerIndependent(IntegrationMorph.class); - RegisteredIntegrations.thaumicExploration = RegisteredIntegrations.registerIndependent(IntegrationThaumicExploration.class); + RegisteredIntegrations.thaumicExploration = + RegisteredIntegrations.registerIndependent(IntegrationThaumicExploration.class); RegisteredIntegrations.automagy = RegisteredIntegrations.registerIndependent(IntegrationAutomagy.class); RegisteredIntegrations.nei = RegisteredIntegrations.registerIndependent(IntegrationNEI.class); RegisteredIntegrations.mystcraft = RegisteredIntegrations.registerIndependent(IntegrationMystcraft.class); - RegisteredIntegrations.thaumicTinkerer = RegisteredIntegrations.registerIndependent(IntegrationThaumicTinkerer.class); + RegisteredIntegrations.thaumicTinkerer = + RegisteredIntegrations.registerIndependent(IntegrationThaumicTinkerer.class); - RegisteredIntegrations.registerDependent("ThaumicHorizons", "makeo.gadomancy.common.integration.thaumichorizions.IntegrationThaumicHorizions"); + RegisteredIntegrations.registerDependent( + "ThaumicHorizons", "makeo.gadomancy.common.integration.thaumichorizions.IntegrationThaumicHorizions"); RegisteredIntegrations.registerDependent("Waila", "makeo.gadomancy.common.integration.waila.IntegrationWaila"); } private static void registerDependent(String modId, String clazz) { - if(!Loader.isModLoaded(modId)) { + if (!Loader.isModLoaded(modId)) { return; } Object integration; try { integration = Injector.getClass(clazz).newInstance(); - } catch (Throwable e) {//InstantiationException | IllegalAccessException + } catch (Throwable e) { // InstantiationException | IllegalAccessException return; } - if(integration instanceof IntegrationMod) { + if (integration instanceof IntegrationMod) { ((IntegrationMod) integration).init(); } } - private static T registerIndependent(Class clazz) { + private static T registerIndependent(Class clazz) { T integration; try { integration = clazz.newInstance(); - } catch (Exception e) {//InstantiationException | IllegalAccessException + } catch (Exception e) { // InstantiationException | IllegalAccessException return null; } integration.init(); - if(integration.isPresent()) { + if (integration.isPresent()) { Gadomancy.log.info("Initialized hook for mod \"" + integration.getModId() + "\"!"); } return integration; } -} \ No newline at end of file +} diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredItems.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredItems.java index 18d9e30..3585c28 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredItems.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredItems.java @@ -3,6 +3,8 @@ package makeo.gadomancy.common.registration; import cpw.mods.fml.common.LoadController; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; +import java.util.ArrayList; +import java.util.List; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.items.*; import makeo.gadomancy.common.items.baubles.ItemEtherealFamiliar; @@ -25,9 +27,6 @@ import thaumcraft.common.config.ConfigItems; import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager; import thaumcraft.common.lib.research.ResearchManager; -import java.util.ArrayList; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -77,7 +76,7 @@ public class RegisteredItems { RegisteredItems.registerItemAspects(); } - //Items + // Items private static void registerItems() { RegisteredItems.itemTransformationFocus = RegisteredItems.registerItem(new ItemTransformationFocus()); RegisteredItems.itemGolemCoreBreak = RegisteredItems.registerItem(new ItemGolemCoreBreak()); @@ -109,9 +108,11 @@ public class RegisteredItems { } private static T registerItem(String modId, T item, String name) { - Injector modController = new Injector(new Injector(Loader.instance(), Loader.class).getField("modController"), LoadController.class); + Injector modController = new Injector( + new Injector(Loader.instance(), Loader.class).getField("modController"), LoadController.class); Object old = modController.getField("activeContainer"); - modController.setField("activeContainer", Loader.instance().getIndexedModList().get(modId)); + modController.setField( + "activeContainer", Loader.instance().getIndexedModList().get(modId)); GameRegistry.registerItem(item, name); @@ -120,38 +121,89 @@ public class RegisteredItems { } private static void registerItemAspects() { - AspectList oldAspects = ThaumcraftCraftingManager.getObjectTags(new ItemStack(RegisteredBlocks.blockStoneMachine)); + AspectList oldAspects = + ThaumcraftCraftingManager.getObjectTags(new ItemStack(RegisteredBlocks.blockStoneMachine)); - ThaumcraftApi.registerObjectTag(new ItemStack(Item.getItemFromBlock(RegisteredBlocks.blockStoneMachine)), new int[]{11, 15}, new AspectList()); - ThaumcraftApi.registerObjectTag(new ItemStack(Item.getItemFromBlock(RegisteredBlocks.blockStoneMachine)), new int[]{0}, oldAspects); + ThaumcraftApi.registerObjectTag( + new ItemStack(Item.getItemFromBlock(RegisteredBlocks.blockStoneMachine)), + new int[] {11, 15}, + new AspectList()); + ThaumcraftApi.registerObjectTag( + new ItemStack(Item.getItemFromBlock(RegisteredBlocks.blockStoneMachine)), new int[] {0}, oldAspects); - AspectList pylon = new AspectList().add(Aspect.WATER, 10).add(Aspect.MAGIC, 12).add(Aspect.VOID, 4).add(Aspect.MECHANISM, 4); - ThaumcraftApi.registerObjectTag(new ItemStack(Item.getItemFromBlock(RegisteredBlocks.blockAuraPylon)), new int[]{0}, pylon); - pylon = new AspectList().add(Aspect.FIRE, 10).add(Aspect.AURA, 12).add(Aspect.MAGIC, 8).add(Aspect.LIGHT, 4).add(Aspect.MECHANISM, 4); - ThaumcraftApi.registerObjectTag(new ItemStack(Item.getItemFromBlock(RegisteredBlocks.blockAuraPylon)), new int[]{1}, pylon); + AspectList pylon = new AspectList() + .add(Aspect.WATER, 10) + .add(Aspect.MAGIC, 12) + .add(Aspect.VOID, 4) + .add(Aspect.MECHANISM, 4); + ThaumcraftApi.registerObjectTag( + new ItemStack(Item.getItemFromBlock(RegisteredBlocks.blockAuraPylon)), new int[] {0}, pylon); + pylon = new AspectList() + .add(Aspect.FIRE, 10) + .add(Aspect.AURA, 12) + .add(Aspect.MAGIC, 8) + .add(Aspect.LIGHT, 4) + .add(Aspect.MECHANISM, 4); + ThaumcraftApi.registerObjectTag( + new ItemStack(Item.getItemFromBlock(RegisteredBlocks.blockAuraPylon)), new int[] {1}, pylon); - AspectList packager = new AspectList().add(Aspect.TREE, 10).add(Aspect.MECHANISM, 8).add(Aspect.CRAFT, 8).add(Aspect.AURA, 12); - ThaumcraftApi.registerObjectTag(new ItemStack(Item.getItemFromBlock(RegisteredBlocks.blockStoneMachine)), new int[]{4}, packager); + AspectList packager = new AspectList() + .add(Aspect.TREE, 10) + .add(Aspect.MECHANISM, 8) + .add(Aspect.CRAFT, 8) + .add(Aspect.AURA, 12); + ThaumcraftApi.registerObjectTag( + new ItemStack(Item.getItemFromBlock(RegisteredBlocks.blockStoneMachine)), new int[] {4}, packager); AspectList aspect = new AspectList(); aspect.add(Aspect.MAGIC, 6).add(Aspect.AURA, 12).add(Aspect.ELDRITCH, 4).add(Aspect.VOID, 10); - ThaumcraftApi.registerObjectTag(new ItemStack(RegisteredItems.itemAuraCore), new int[]{0}, aspect.copy()); - ThaumcraftApi.registerObjectTag(new ItemStack(RegisteredItems.itemAuraCore), new int[]{1}, aspect.copy().add(Aspect.AIR, 26)); - ThaumcraftApi.registerObjectTag(new ItemStack(RegisteredItems.itemAuraCore), new int[]{2}, aspect.copy().add(Aspect.FIRE, 26)); - ThaumcraftApi.registerObjectTag(new ItemStack(RegisteredItems.itemAuraCore), new int[]{3}, aspect.copy().add(Aspect.WATER, 26)); - ThaumcraftApi.registerObjectTag(new ItemStack(RegisteredItems.itemAuraCore), new int[]{4}, aspect.copy().add(Aspect.EARTH, 26)); - ThaumcraftApi.registerObjectTag(new ItemStack(RegisteredItems.itemAuraCore), new int[]{5}, aspect.copy().add(Aspect.ORDER, 26)); - ThaumcraftApi.registerObjectTag(new ItemStack(RegisteredItems.itemAuraCore), new int[]{6}, aspect.copy().add(Aspect.ENTROPY, 26)); + ThaumcraftApi.registerObjectTag(new ItemStack(RegisteredItems.itemAuraCore), new int[] {0}, aspect.copy()); + ThaumcraftApi.registerObjectTag( + new ItemStack(RegisteredItems.itemAuraCore), + new int[] {1}, + aspect.copy().add(Aspect.AIR, 26)); + ThaumcraftApi.registerObjectTag( + new ItemStack(RegisteredItems.itemAuraCore), + new int[] {2}, + aspect.copy().add(Aspect.FIRE, 26)); + ThaumcraftApi.registerObjectTag( + new ItemStack(RegisteredItems.itemAuraCore), + new int[] {3}, + aspect.copy().add(Aspect.WATER, 26)); + ThaumcraftApi.registerObjectTag( + new ItemStack(RegisteredItems.itemAuraCore), + new int[] {4}, + aspect.copy().add(Aspect.EARTH, 26)); + ThaumcraftApi.registerObjectTag( + new ItemStack(RegisteredItems.itemAuraCore), + new int[] {5}, + aspect.copy().add(Aspect.ORDER, 26)); + ThaumcraftApi.registerObjectTag( + new ItemStack(RegisteredItems.itemAuraCore), + new int[] {6}, + aspect.copy().add(Aspect.ENTROPY, 26)); - ThaumcraftApi.registerObjectTag(new ItemStack(RegisteredItems.itemPackage, 1, 0), new AspectList().add(Aspect.CLOTH, 2).add(Aspect.BEAST, 2).add(Aspect.ARMOR, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(RegisteredItems.itemPackage, 1, 1), new AspectList().add(Aspect.CLOTH, 4)); - ThaumcraftApi.registerObjectTag(new ItemStack(RegisteredItems.itemFakeLootbag, 1, 0), new AspectList().add(Aspect.CLOTH, 2).add(Aspect.BEAST, 2).add(Aspect.ARMOR, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(RegisteredItems.itemFakeLootbag, 1, 1), new AspectList().add(Aspect.CLOTH, 4)); + ThaumcraftApi.registerObjectTag( + new ItemStack(RegisteredItems.itemPackage, 1, 0), + new AspectList().add(Aspect.CLOTH, 2).add(Aspect.BEAST, 2).add(Aspect.ARMOR, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(RegisteredItems.itemPackage, 1, 1), new AspectList().add(Aspect.CLOTH, 4)); + ThaumcraftApi.registerObjectTag( + new ItemStack(RegisteredItems.itemFakeLootbag, 1, 0), + new AspectList().add(Aspect.CLOTH, 2).add(Aspect.BEAST, 2).add(Aspect.ARMOR, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(RegisteredItems.itemFakeLootbag, 1, 1), new AspectList().add(Aspect.CLOTH, 4)); - ThaumcraftApi.registerObjectTag(new ItemStack(RegisteredBlocks.blockKnowledgeBook), new AspectList().add(Aspect.MIND, 8).add(Aspect.MECHANISM, 4).add(Aspect.MAGIC, 6).add(Aspect.ORDER, 4)); + ThaumcraftApi.registerObjectTag( + new ItemStack(RegisteredBlocks.blockKnowledgeBook), + new AspectList() + .add(Aspect.MIND, 8) + .add(Aspect.MECHANISM, 4) + .add(Aspect.MAGIC, 6) + .add(Aspect.ORDER, 4)); } - //Sticky jars + // Sticky jars private static void registerDefaultStickyJars() { RegisteredItems.registerStickyJar(ConfigItems.itemJarFilled, 0); RegisteredItems.registerStickyJar(ConfigItems.itemJarFilled, 3); @@ -161,7 +213,8 @@ public class RegisteredItems { RegisteredItems.registerStickyJar(itemBlockJar, 3, new ItemStack(itemBlockJar, 1, 3), "JARVOID"); Item itemRemoteJar = Item.getItemFromBlock(RegisteredBlocks.blockRemoteJar); - RegisteredItems.registerStickyJar(itemRemoteJar, 0, new ItemStack(itemRemoteJar), SimpleResearchItem.getFullName("REMOTEJAR")); + RegisteredItems.registerStickyJar( + itemRemoteJar, 0, new ItemStack(itemRemoteJar), SimpleResearchItem.getFullName("REMOTEJAR")); } private static List stickyJarItems = new ArrayList(); @@ -188,8 +241,8 @@ public class RegisteredItems { } public static boolean isStickyableJar(Item item, int damage) { - for(StickyJarItemInfo info : RegisteredItems.stickyJarItems) { - if(info.item == item && (info.damage == damage || info.damage == Short.MAX_VALUE)) { + for (StickyJarItemInfo info : RegisteredItems.stickyJarItems) { + if (info.item == item && (info.damage == damage || info.damage == Short.MAX_VALUE)) { return true; } } @@ -206,9 +259,11 @@ public class RegisteredItems { public static List getStickyJarStacks(EntityPlayer player) { List stacks = new ArrayList(); - for(StickyJarItemInfo info : RegisteredItems.stickyJarItems) { - if(info.recipeStack != null && (player == null || info.research == null - || ResearchManager.isResearchComplete(player.getCommandSenderName(), info.research))) { + for (StickyJarItemInfo info : RegisteredItems.stickyJarItems) { + if (info.recipeStack != null + && (player == null + || info.research == null + || ResearchManager.isResearchComplete(player.getCommandSenderName(), info.research))) { stacks.add(info.recipeStack); } } diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredManipulations.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredManipulations.java index ad7aba1..04b21e4 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredManipulations.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredManipulations.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.registration; +import java.util.List; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.blocks.tiles.TileExtendedNode; import makeo.gadomancy.common.node.ExtendedNodeType; @@ -13,8 +14,6 @@ import thaumcraft.api.nodes.INode; import thaumcraft.api.nodes.NodeModifier; import thaumcraft.api.nodes.NodeType; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -25,202 +24,217 @@ import java.util.List; */ public class RegisteredManipulations { - public static NodeManipulatorResult resultBreakCompounds = new NodeManipulatorResult(4, NodeManipulatorResultHandler.ResultType.NEGATIVE) { - @Override - public boolean affect(World world, INode node) { - AspectList baseList = node.getAspectsBase(); - AspectList list = node.getAspects(); - for(Aspect a : baseList.getAspects()) { - if(!a.isPrimal()) { - Aspect[] subComponents = a.getComponents(); - int initialValue = baseList.getAmount(a); - list.remove(a); - baseList.remove(a); - baseList.add(subComponents[0], initialValue); - list.add(subComponents[0], initialValue); - baseList.add(subComponents[1], initialValue); - list.add(subComponents[1], initialValue); - return true; - } - } - return false; - } - }; - - public static NodeManipulatorResult resultCombineAspects = new NodeManipulatorResult(5, NodeManipulatorResultHandler.ResultType.POSITIVE) { - @Override - public boolean affect(World world, INode node) { - AspectList base = node.getAspectsBase(); - if(base.getAspects().length < 2) - return false; - if(base.getAspects().length == 2) { - if(!NodeManipulatorResultHandler.canCombine(base.getAspects()[0], base.getAspects()[1])) return false; - int addition = world.rand.nextInt(4); - NodeManipulatorResultHandler.combine(base, base.getAspects()[0], base.getAspects()[1], addition); - NodeManipulatorResultHandler.combine(node.getAspects(), base.getAspects()[0], base.getAspects()[1], addition); - return true; - } - if(base.getAspects().length > 2) { - int actuallyCombined = 0; - int combineCount = world.rand.nextInt(1) + 1; - doLabel: - do { - if(base.getAspects().length < 2) break; - - int randIndexForA = world.rand.nextInt(base.getAspects().length); - for (int i = 0; i < base.getAspects().length; i++) { - int indexA = (i + randIndexForA) % base.getAspects().length; - Aspect a = base.getAspects()[indexA]; - int randIndexForB = world.rand.nextInt(base.getAspects().length); - for (int j = 0; j < base.getAspects().length; j++) { - int indexB = (j + randIndexForB) % base.getAspects().length; - Aspect b = base.getAspects()[indexB]; - - if(NodeManipulatorResultHandler.canCombine(a, b)) { - int addition = world.rand.nextInt(4); - NodeManipulatorResultHandler.combine(base, a, b, addition); - NodeManipulatorResultHandler.combine(node.getAspects(), a, b, addition); - combineCount--; - actuallyCombined++; - continue doLabel; - } else if(base.getAspects().length <= 2) { - break doLabel; - } - + public static NodeManipulatorResult resultBreakCompounds = + new NodeManipulatorResult(4, NodeManipulatorResultHandler.ResultType.NEGATIVE) { + @Override + public boolean affect(World world, INode node) { + AspectList baseList = node.getAspectsBase(); + AspectList list = node.getAspects(); + for (Aspect a : baseList.getAspects()) { + if (!a.isPrimal()) { + Aspect[] subComponents = a.getComponents(); + int initialValue = baseList.getAmount(a); + list.remove(a); + baseList.remove(a); + baseList.add(subComponents[0], initialValue); + list.add(subComponents[0], initialValue); + baseList.add(subComponents[1], initialValue); + list.add(subComponents[1], initialValue); + return true; } } - combineCount--; - } while (combineCount > 0); - return actuallyCombined > 0; - } - return false; - } - }; - - public static NodeManipulatorResult resultIncreaseModifier = new NodeManipulatorResult(4, NodeManipulatorResultHandler.ResultType.POSITIVE) { - - @Override - public boolean canAffect(World world, INode node) { - return node.getNodeModifier() != NodeModifier.BRIGHT; - } - - @Override - public boolean affect(World world, INode node) { - if(node.getNodeModifier() == null) { - node.setNodeModifier(NodeModifier.BRIGHT); - return true; - } - switch (node.getNodeModifier()) { - case BRIGHT: return false; - case PALE: - node.setNodeModifier(null); - break; - case FADING: - node.setNodeModifier(NodeModifier.PALE); - break; - } - return true; - } - }; + } + }; - public static NodeManipulatorResult resultDecreaseModifier = new NodeManipulatorResult(5, NodeManipulatorResultHandler.ResultType.NEGATIVE) { - - @Override - public boolean canAffect(World world, INode node) { - return node.getNodeModifier() != NodeModifier.FADING; - } - - @Override - public boolean affect(World world, INode node) { - if(node.getNodeModifier() == null) { - node.setNodeModifier(NodeModifier.PALE); - return true; - } - switch (node.getNodeModifier()) { - case BRIGHT: - node.setNodeModifier(null); - break; - case PALE: - node.setNodeModifier(NodeModifier.FADING); - break; - case FADING: - return false; - } - return true; - } - }; - - public static NodeManipulatorResult resultGainPrimal = new NodeManipulatorResult(3, NodeManipulatorResultHandler.ResultType.POSITIVE) { - @Override - public boolean affect(World world, INode node) { - List primals = Aspect.getPrimalAspects(); - int visSize = node.getAspectsBase().visSize(); - int size = node.getAspectsBase().size(); - int modulo = primals.size(); - int index = world.rand.nextInt(primals.size()); - for (int i = 0; i < primals.size(); i++) { - int get = (index + i) % modulo; - Aspect rand = primals.get(get); - if(node.getAspectsBase().getAmount(rand) <= 0) { - int randGain = visSize / (size * 2); - if(randGain > 0) { - node.getAspectsBase().add(rand, randGain); - node.getAspects().add(rand, randGain); + public static NodeManipulatorResult resultCombineAspects = + new NodeManipulatorResult(5, NodeManipulatorResultHandler.ResultType.POSITIVE) { + @Override + public boolean affect(World world, INode node) { + AspectList base = node.getAspectsBase(); + if (base.getAspects().length < 2) return false; + if (base.getAspects().length == 2) { + if (!NodeManipulatorResultHandler.canCombine(base.getAspects()[0], base.getAspects()[1])) + return false; + int addition = world.rand.nextInt(4); + NodeManipulatorResultHandler.combine( + base, base.getAspects()[0], base.getAspects()[1], addition); + NodeManipulatorResultHandler.combine( + node.getAspects(), base.getAspects()[0], base.getAspects()[1], addition); return true; } + if (base.getAspects().length > 2) { + int actuallyCombined = 0; + int combineCount = world.rand.nextInt(1) + 1; + doLabel: + do { + if (base.getAspects().length < 2) break; + + int randIndexForA = world.rand.nextInt(base.getAspects().length); + for (int i = 0; i < base.getAspects().length; i++) { + int indexA = (i + randIndexForA) % base.getAspects().length; + Aspect a = base.getAspects()[indexA]; + int randIndexForB = world.rand.nextInt(base.getAspects().length); + for (int j = 0; j < base.getAspects().length; j++) { + int indexB = (j + randIndexForB) % base.getAspects().length; + Aspect b = base.getAspects()[indexB]; + + if (NodeManipulatorResultHandler.canCombine(a, b)) { + int addition = world.rand.nextInt(4); + NodeManipulatorResultHandler.combine(base, a, b, addition); + NodeManipulatorResultHandler.combine(node.getAspects(), a, b, addition); + combineCount--; + actuallyCombined++; + continue doLabel; + } else if (base.getAspects().length <= 2) { + break doLabel; + } + } + } + combineCount--; + } while (combineCount > 0); + return actuallyCombined > 0; + } return false; } - } - return false; - } - }; + }; - public static NodeManipulatorResult resultSwitchType = new NodeManipulatorResult(2, NodeManipulatorResultHandler.ResultType.NEUTRAL) { - @Override - public boolean affect(World world, INode node) { - NodeType newType = node.getNodeType(); - int random = world.rand.nextInt(40); - if(random > 38) { - if(node instanceof TileExtendedNode) { - TileExtendedNode tNode = (TileExtendedNode) node; - if(!(tNode.getExtendedNodeType() != null && tNode.getExtendedNodeType().equals(ExtendedNodeType.GROWING))) { - newType = NodeType.HUNGRY; //1 of 40 - } - } else { - newType = NodeType.HUNGRY; //1 of 40 + public static NodeManipulatorResult resultIncreaseModifier = + new NodeManipulatorResult(4, NodeManipulatorResultHandler.ResultType.POSITIVE) { + + @Override + public boolean canAffect(World world, INode node) { + return node.getNodeModifier() != NodeModifier.BRIGHT; } - } else if(random > 37) { - newType = NodeType.TAINTED; //1 of 40 - } else if(random > 34) { - newType = NodeType.UNSTABLE; //3 of 40 - } else if(random > 29) { - newType = NodeType.DARK; //5 of 40 - } else if(random > 24) { - newType = NodeType.PURE; //5 of 40 - } else if(random > 14) { - newType = NodeType.NORMAL; //10 of 40 - } - //15 of 40 chance nothing happens - boolean changed = !newType.equals(node.getNodeType()); - if(changed) node.setNodeType(newType); - return changed; - } - }; - public static NodeManipulatorResult resultApplyGrowing = new NodeManipulatorResult(1, NodeManipulatorResultHandler.ResultType.POSITIVE) { - @Override - public boolean affect(World world, INode inode) { - if(!(inode instanceof TileExtendedNode)) return false; - TileExtendedNode node = (TileExtendedNode) inode; - boolean isGrowingAlready = node.getExtendedNodeType() != null && node.getExtendedNodeType().equals(ExtendedNodeType.GROWING); - if(isGrowingAlready) if(node.getNodeType().equals(NodeType.HUNGRY)) isGrowingAlready = false; - if(!isGrowingAlready) { - node.setExtendedNodeType(ExtendedNodeType.GROWING); - ResearchHelper.distributeResearch(Gadomancy.MODID.toUpperCase() + ".GROWING", node.getWorldObj(), node.xCoord, node.yCoord, node.zCoord, 12); - } - return isGrowingAlready; - } - }; + @Override + public boolean affect(World world, INode node) { + if (node.getNodeModifier() == null) { + node.setNodeModifier(NodeModifier.BRIGHT); + return true; + } + switch (node.getNodeModifier()) { + case BRIGHT: + return false; + case PALE: + node.setNodeModifier(null); + break; + case FADING: + node.setNodeModifier(NodeModifier.PALE); + break; + } + return true; + } + }; + public static NodeManipulatorResult resultDecreaseModifier = + new NodeManipulatorResult(5, NodeManipulatorResultHandler.ResultType.NEGATIVE) { + + @Override + public boolean canAffect(World world, INode node) { + return node.getNodeModifier() != NodeModifier.FADING; + } + + @Override + public boolean affect(World world, INode node) { + if (node.getNodeModifier() == null) { + node.setNodeModifier(NodeModifier.PALE); + return true; + } + switch (node.getNodeModifier()) { + case BRIGHT: + node.setNodeModifier(null); + break; + case PALE: + node.setNodeModifier(NodeModifier.FADING); + break; + case FADING: + return false; + } + return true; + } + }; + + public static NodeManipulatorResult resultGainPrimal = + new NodeManipulatorResult(3, NodeManipulatorResultHandler.ResultType.POSITIVE) { + @Override + public boolean affect(World world, INode node) { + List primals = Aspect.getPrimalAspects(); + int visSize = node.getAspectsBase().visSize(); + int size = node.getAspectsBase().size(); + int modulo = primals.size(); + int index = world.rand.nextInt(primals.size()); + for (int i = 0; i < primals.size(); i++) { + int get = (index + i) % modulo; + Aspect rand = primals.get(get); + if (node.getAspectsBase().getAmount(rand) <= 0) { + int randGain = visSize / (size * 2); + if (randGain > 0) { + node.getAspectsBase().add(rand, randGain); + node.getAspects().add(rand, randGain); + return true; + } + return false; + } + } + return false; + } + }; + + public static NodeManipulatorResult resultSwitchType = + new NodeManipulatorResult(2, NodeManipulatorResultHandler.ResultType.NEUTRAL) { + @Override + public boolean affect(World world, INode node) { + NodeType newType = node.getNodeType(); + int random = world.rand.nextInt(40); + if (random > 38) { + if (node instanceof TileExtendedNode) { + TileExtendedNode tNode = (TileExtendedNode) node; + if (!(tNode.getExtendedNodeType() != null + && tNode.getExtendedNodeType().equals(ExtendedNodeType.GROWING))) { + newType = NodeType.HUNGRY; // 1 of 40 + } + } else { + newType = NodeType.HUNGRY; // 1 of 40 + } + } else if (random > 37) { + newType = NodeType.TAINTED; // 1 of 40 + } else if (random > 34) { + newType = NodeType.UNSTABLE; // 3 of 40 + } else if (random > 29) { + newType = NodeType.DARK; // 5 of 40 + } else if (random > 24) { + newType = NodeType.PURE; // 5 of 40 + } else if (random > 14) { + newType = NodeType.NORMAL; // 10 of 40 + } + // 15 of 40 chance nothing happens + boolean changed = !newType.equals(node.getNodeType()); + if (changed) node.setNodeType(newType); + return changed; + } + }; + + public static NodeManipulatorResult resultApplyGrowing = + new NodeManipulatorResult(1, NodeManipulatorResultHandler.ResultType.POSITIVE) { + @Override + public boolean affect(World world, INode inode) { + if (!(inode instanceof TileExtendedNode)) return false; + TileExtendedNode node = (TileExtendedNode) inode; + boolean isGrowingAlready = node.getExtendedNodeType() != null + && node.getExtendedNodeType().equals(ExtendedNodeType.GROWING); + if (isGrowingAlready) if (node.getNodeType().equals(NodeType.HUNGRY)) isGrowingAlready = false; + if (!isGrowingAlready) { + node.setExtendedNodeType(ExtendedNodeType.GROWING); + ResearchHelper.distributeResearch( + Gadomancy.MODID.toUpperCase() + ".GROWING", + node.getWorldObj(), + node.xCoord, + node.yCoord, + node.zCoord, + 12); + } + return isGrowingAlready; + } + }; } diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredMultiblocks.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredMultiblocks.java index c756c36..7ed35e9 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredMultiblocks.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredMultiblocks.java @@ -13,33 +13,69 @@ import thaumcraft.common.config.ConfigBlocks; */ public class RegisteredMultiblocks { - public static final MultiblockHelper.MultiblockPattern incompleteNodeManipulatorMultiblock = new MultiblockHelper.MultiblockPattern(RegisteredBlocks.blockNodeManipulator, 5) - .addBlock(0, 2, 0, RegisteredBlocks.blockNode, 0).addBlock(0, 1, 0, RegisteredBlocks.blockStoneMachine, 0) - .addBlock(1, 0, 1, ConfigBlocks.blockCosmeticSolid, 15).addBlock(-1, 0, 1, ConfigBlocks.blockCosmeticSolid, 15).addBlock(-1, 0, -1, ConfigBlocks.blockCosmeticSolid, 15).addBlock(1, 0, -1, ConfigBlocks.blockCosmeticSolid, 15) - .addBlock(1, 1, 1, ConfigBlocks.blockCosmeticSolid, 11).addBlock(-1, 1, 1, ConfigBlocks.blockCosmeticSolid, 11).addBlock(-1, 1, -1, ConfigBlocks.blockCosmeticSolid, 11).addBlock(1, 1, -1, ConfigBlocks.blockCosmeticSolid, 11); + public static final MultiblockHelper.MultiblockPattern incompleteNodeManipulatorMultiblock = + new MultiblockHelper.MultiblockPattern(RegisteredBlocks.blockNodeManipulator, 5) + .addBlock(0, 2, 0, RegisteredBlocks.blockNode, 0) + .addBlock(0, 1, 0, RegisteredBlocks.blockStoneMachine, 0) + .addBlock(1, 0, 1, ConfigBlocks.blockCosmeticSolid, 15) + .addBlock(-1, 0, 1, ConfigBlocks.blockCosmeticSolid, 15) + .addBlock(-1, 0, -1, ConfigBlocks.blockCosmeticSolid, 15) + .addBlock(1, 0, -1, ConfigBlocks.blockCosmeticSolid, 15) + .addBlock(1, 1, 1, ConfigBlocks.blockCosmeticSolid, 11) + .addBlock(-1, 1, 1, ConfigBlocks.blockCosmeticSolid, 11) + .addBlock(-1, 1, -1, ConfigBlocks.blockCosmeticSolid, 11) + .addBlock(1, 1, -1, ConfigBlocks.blockCosmeticSolid, 11); - public static final MultiblockHelper.MultiblockPattern completeNodeManipulatorMultiblock = new MultiblockHelper.MultiblockPattern(RegisteredBlocks.blockNodeManipulator, 5) - .addBlock(0, 2, 0, RegisteredBlocks.blockNode, 0).addBlock(0, 1, 0, RegisteredBlocks.blockStoneMachine, 0) - .addBlock(1, 0, 1, RegisteredBlocks.blockStoneMachine, 15).addBlock(-1, 0, 1, RegisteredBlocks.blockStoneMachine, 15).addBlock(-1, 0, -1, RegisteredBlocks.blockStoneMachine, 15).addBlock(1, 0, -1, RegisteredBlocks.blockStoneMachine, 15) - .addBlock(1, 1, 1, RegisteredBlocks.blockStoneMachine, 11).addBlock(-1, 1, 1, RegisteredBlocks.blockStoneMachine, 11).addBlock(-1, 1, -1, RegisteredBlocks.blockStoneMachine, 11).addBlock(1, 1, -1, RegisteredBlocks.blockStoneMachine, 11); + public static final MultiblockHelper.MultiblockPattern completeNodeManipulatorMultiblock = + new MultiblockHelper.MultiblockPattern(RegisteredBlocks.blockNodeManipulator, 5) + .addBlock(0, 2, 0, RegisteredBlocks.blockNode, 0) + .addBlock(0, 1, 0, RegisteredBlocks.blockStoneMachine, 0) + .addBlock(1, 0, 1, RegisteredBlocks.blockStoneMachine, 15) + .addBlock(-1, 0, 1, RegisteredBlocks.blockStoneMachine, 15) + .addBlock(-1, 0, -1, RegisteredBlocks.blockStoneMachine, 15) + .addBlock(1, 0, -1, RegisteredBlocks.blockStoneMachine, 15) + .addBlock(1, 1, 1, RegisteredBlocks.blockStoneMachine, 11) + .addBlock(-1, 1, 1, RegisteredBlocks.blockStoneMachine, 11) + .addBlock(-1, 1, -1, RegisteredBlocks.blockStoneMachine, 11) + .addBlock(1, 1, -1, RegisteredBlocks.blockStoneMachine, 11); - public static final MultiblockHelper.MultiblockPattern incompleteEldritchPortalCreator = new MultiblockHelper.MultiblockPattern(RegisteredBlocks.blockNodeManipulator, 5) - .addBlock(0, 2, 0, RegisteredBlocks.blockNode, 0).addBlock(0, 1, 0, RegisteredBlocks.blockStoneMachine, 3) - //.addBlock(3, 0, 0, RegisteredBlocks.blockStoneMachine, 1).addBlock(0, 0, 3, RegisteredBlocks.blockStoneMachine, 1) - //.addBlock(-3, 0, 0, RegisteredBlocks.blockStoneMachine, 1).addBlock(0, 0, -3, RegisteredBlocks.blockStoneMachine, 1) - .addBlock(1, 0, 1, ConfigBlocks.blockCosmeticSolid, 15).addBlock(-1, 0, 1, ConfigBlocks.blockCosmeticSolid, 15).addBlock(-1, 0, -1, ConfigBlocks.blockCosmeticSolid, 15).addBlock(1, 0, -1, ConfigBlocks.blockCosmeticSolid, 15) - .addBlock(1, 1, 1, ConfigBlocks.blockCosmeticSolid, 11).addBlock(-1, 1, 1, ConfigBlocks.blockCosmeticSolid, 11).addBlock(-1, 1, -1, ConfigBlocks.blockCosmeticSolid, 11).addBlock(1, 1, -1, ConfigBlocks.blockCosmeticSolid, 11); + public static final MultiblockHelper.MultiblockPattern incompleteEldritchPortalCreator = + new MultiblockHelper.MultiblockPattern(RegisteredBlocks.blockNodeManipulator, 5) + .addBlock(0, 2, 0, RegisteredBlocks.blockNode, 0) + .addBlock(0, 1, 0, RegisteredBlocks.blockStoneMachine, 3) + // .addBlock(3, 0, 0, RegisteredBlocks.blockStoneMachine, 1).addBlock(0, 0, 3, + // RegisteredBlocks.blockStoneMachine, 1) + // .addBlock(-3, 0, 0, RegisteredBlocks.blockStoneMachine, 1).addBlock(0, 0, -3, + // RegisteredBlocks.blockStoneMachine, 1) + .addBlock(1, 0, 1, ConfigBlocks.blockCosmeticSolid, 15) + .addBlock(-1, 0, 1, ConfigBlocks.blockCosmeticSolid, 15) + .addBlock(-1, 0, -1, ConfigBlocks.blockCosmeticSolid, 15) + .addBlock(1, 0, -1, ConfigBlocks.blockCosmeticSolid, 15) + .addBlock(1, 1, 1, ConfigBlocks.blockCosmeticSolid, 11) + .addBlock(-1, 1, 1, ConfigBlocks.blockCosmeticSolid, 11) + .addBlock(-1, 1, -1, ConfigBlocks.blockCosmeticSolid, 11) + .addBlock(1, 1, -1, ConfigBlocks.blockCosmeticSolid, 11); - public static final MultiblockHelper.MultiblockPattern completeEldritchPortalCreator = new MultiblockHelper.MultiblockPattern(RegisteredBlocks.blockNodeManipulator, 5) - .addBlock(0, 2, 0, RegisteredBlocks.blockNode, 0).addBlock(0, 1, 0, RegisteredBlocks.blockStoneMachine, 3) - //.addBlock(3, 0, 0, RegisteredBlocks.blockStoneMachine, 1).addBlock(0, 0, 3, RegisteredBlocks.blockStoneMachine, 1) - //.addBlock(-3, 0, 0, RegisteredBlocks.blockStoneMachine, 1).addBlock(0, 0, -3, RegisteredBlocks.blockStoneMachine, 1) - .addBlock(1, 0, 1, RegisteredBlocks.blockStoneMachine, 15).addBlock(-1, 0, 1, RegisteredBlocks.blockStoneMachine, 15).addBlock(-1, 0, -1, RegisteredBlocks.blockStoneMachine, 15).addBlock(1, 0, -1, RegisteredBlocks.blockStoneMachine, 15) - .addBlock(1, 1, 1, RegisteredBlocks.blockStoneMachine, 11).addBlock(-1, 1, 1, RegisteredBlocks.blockStoneMachine, 11).addBlock(-1, 1, -1, RegisteredBlocks.blockStoneMachine, 11).addBlock(1, 1, -1, RegisteredBlocks.blockStoneMachine, 11); + public static final MultiblockHelper.MultiblockPattern completeEldritchPortalCreator = + new MultiblockHelper.MultiblockPattern(RegisteredBlocks.blockNodeManipulator, 5) + .addBlock(0, 2, 0, RegisteredBlocks.blockNode, 0) + .addBlock(0, 1, 0, RegisteredBlocks.blockStoneMachine, 3) + // .addBlock(3, 0, 0, RegisteredBlocks.blockStoneMachine, 1).addBlock(0, 0, 3, + // RegisteredBlocks.blockStoneMachine, 1) + // .addBlock(-3, 0, 0, RegisteredBlocks.blockStoneMachine, 1).addBlock(0, 0, -3, + // RegisteredBlocks.blockStoneMachine, 1) + .addBlock(1, 0, 1, RegisteredBlocks.blockStoneMachine, 15) + .addBlock(-1, 0, 1, RegisteredBlocks.blockStoneMachine, 15) + .addBlock(-1, 0, -1, RegisteredBlocks.blockStoneMachine, 15) + .addBlock(1, 0, -1, RegisteredBlocks.blockStoneMachine, 15) + .addBlock(1, 1, 1, RegisteredBlocks.blockStoneMachine, 11) + .addBlock(-1, 1, 1, RegisteredBlocks.blockStoneMachine, 11) + .addBlock(-1, 1, -1, RegisteredBlocks.blockStoneMachine, 11) + .addBlock(1, 1, -1, RegisteredBlocks.blockStoneMachine, 11); - public static final MultiblockHelper.MultiblockPattern auraPylonPattern = new MultiblockHelper.MultiblockPattern(RegisteredBlocks.blockAuraPylon, 1) + 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); - } diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredPotions.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredPotions.java index 8f5cc7f..8abc3ad 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredPotions.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredPotions.java @@ -1,14 +1,13 @@ package makeo.gadomancy.common.registration; import cpw.mods.fml.common.FMLLog; +import java.lang.reflect.Field; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.data.config.ModConfig; import makeo.gadomancy.common.potions.*; import makeo.gadomancy.common.utils.Injector; import net.minecraft.potion.Potion; -import java.lang.reflect.Field; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -33,8 +32,8 @@ public class RegisteredPotions { } public static void createConfigEntries() { - for(Field field : RegisteredPotions.class.getFields()) { - if(Potion.class.isAssignableFrom(field.getType())) { + for (Field field : RegisteredPotions.class.getFields()) { + if (Potion.class.isAssignableFrom(field.getType())) { ModConfig.loadPotionId(field.getType().getSimpleName()); } } @@ -42,33 +41,37 @@ public class RegisteredPotions { private static T registerPotion(Class potionClass) { int id = ModConfig.loadPotionId(potionClass.getSimpleName()); - if(id == -1) { - for(int i = 0; i < Potion.potionTypes.length; i++) { - if(Potion.potionTypes[i] == null) { + if (id == -1) { + for (int i = 0; i < Potion.potionTypes.length; i++) { + if (Potion.potionTypes[i] == null) { id = i; break; } } - if(id == -1) { + if (id == -1) { id = Potion.potionTypes.length; - FMLLog.warning("Gadomancy could not find a free potion id and will extend the potionTypes array! This might cause fatal errors. Please consider changing the config!"); + FMLLog.warning( + "Gadomancy could not find a free potion id and will extend the potionTypes array! This might cause fatal errors. Please consider changing the config!"); } } - if(id > 127) { - FMLLog.warning("The potion id '" + id + "' of potion '" + Gadomancy.NAME + ":" + potionClass.getSimpleName() + "' is bigger then 127 this might cause errors as well. Please consider changing the config."); + if (id > 127) { + FMLLog.warning("The potion id '" + id + "' of potion '" + Gadomancy.NAME + ":" + potionClass.getSimpleName() + + "' is bigger then 127 this might cause errors as well. Please consider changing the config."); } - if(id >= Potion.potionTypes.length) { + if (id >= Potion.potionTypes.length) { Potion[] potions = new Potion[Potion.potionTypes.length + 1]; System.arraycopy(Potion.potionTypes, 0, potions, 0, Potion.potionTypes.length); Potion.potionTypes = potions; - } else if(Potion.potionTypes[id] != null) { + } else if (Potion.potionTypes[id] != null) { Potion conflict = Potion.potionTypes[id]; - throw new RuntimeException("Potion id conflict! Do not report this bug you just have to change the configuration files. Failed to register potion '" - + Gadomancy.NAME + ":" + potionClass.getSimpleName() + "' with id '" + id - + "'. Another potion with this id already exists: " + conflict.getName() + " (as " + conflict.getClass().getName() + ")"); + throw new RuntimeException( + "Potion id conflict! Do not report this bug you just have to change the configuration files. Failed to register potion '" + + Gadomancy.NAME + ":" + potionClass.getSimpleName() + "' with id '" + id + + "'. Another potion with this id already exists: " + conflict.getName() + " (as " + + conflict.getClass().getName() + ")"); } return new Injector(potionClass).invokeConstructor(int.class, id); diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredRecipes.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredRecipes.java index 27ddcd7..a467827 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredRecipes.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredRecipes.java @@ -1,6 +1,9 @@ package makeo.gadomancy.common.registration; import cpw.mods.fml.common.registry.GameRegistry; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import makeo.gadomancy.api.golems.AdditionalGolemType; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.crafting.*; @@ -29,10 +32,6 @@ import thaumcraft.common.config.ConfigItems; import thaumcraft.common.items.ItemWispEssence; import thaumcraft.common.items.wands.ItemWandCasting; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -44,11 +43,35 @@ import java.util.List; public class RegisteredRecipes { private RegisteredRecipes() {} - public static AspectList costsNodeManipulatorMultiblock = new AspectList().add(Aspect.FIRE, 100).add(Aspect.WATER, 100).add(Aspect.EARTH, 100).add(Aspect.AIR, 100).add(Aspect.ORDER, 100).add(Aspect.ENTROPY, 100); - public static AspectList costsEldritchPortalCreatorMultiblock = new AspectList().add(Aspect.FIRE, 150).add(Aspect.WATER, 150).add(Aspect.EARTH, 150).add(Aspect.AIR, 150).add(Aspect.ORDER, 150).add(Aspect.ENTROPY, 150); - public static AspectList costsAuraPylonMultiblock = new AspectList().add(Aspect.FIRE, 150).add(Aspect.WATER, 150).add(Aspect.EARTH, 150).add(Aspect.AIR, 150).add(Aspect.ORDER, 150).add(Aspect.ENTROPY, 150); - public static AspectList costsCompressorMultiblock = new AspectList().add(Aspect.WATER, 140).add(Aspect.EARTH, 80).add(Aspect.AIR, 150).add(Aspect.ORDER, 20).add(Aspect.ENTROPY, 140); - //public static AspectList costsAuraCoreStart = new AspectList().add(Aspect.FIRE, 70).add(Aspect.WATER, 70).add(Aspect.EARTH, 70).add(Aspect.AIR, 70).add(Aspect.ORDER, 70).add(Aspect.ENTROPY, 70); + public static AspectList costsNodeManipulatorMultiblock = new AspectList() + .add(Aspect.FIRE, 100) + .add(Aspect.WATER, 100) + .add(Aspect.EARTH, 100) + .add(Aspect.AIR, 100) + .add(Aspect.ORDER, 100) + .add(Aspect.ENTROPY, 100); + public static AspectList costsEldritchPortalCreatorMultiblock = new AspectList() + .add(Aspect.FIRE, 150) + .add(Aspect.WATER, 150) + .add(Aspect.EARTH, 150) + .add(Aspect.AIR, 150) + .add(Aspect.ORDER, 150) + .add(Aspect.ENTROPY, 150); + public static AspectList costsAuraPylonMultiblock = new AspectList() + .add(Aspect.FIRE, 150) + .add(Aspect.WATER, 150) + .add(Aspect.EARTH, 150) + .add(Aspect.AIR, 150) + .add(Aspect.ORDER, 150) + .add(Aspect.ENTROPY, 150); + public static AspectList costsCompressorMultiblock = new AspectList() + .add(Aspect.WATER, 140) + .add(Aspect.EARTH, 80) + .add(Aspect.AIR, 150) + .add(Aspect.ORDER, 20) + .add(Aspect.ENTROPY, 140); + // public static AspectList costsAuraCoreStart = new AspectList().add(Aspect.FIRE, 70).add(Aspect.WATER, + // 70).add(Aspect.EARTH, 70).add(Aspect.AIR, 70).add(Aspect.ORDER, 70).add(Aspect.ENTROPY, 70); public static List multiblockNodeManipulator; public static List multiblockEldritchPortalCreator; @@ -68,7 +91,7 @@ public class RegisteredRecipes { public static InfusionRecipe recipeElementVoid; public static InfusionRecipe recipeAiShutdown; - //For indexing, look below... + // For indexing, look below... public static InfusionRecipe[][] recipesFamiliarAugmentation; public static IArcaneRecipe recipeStickyJar; @@ -93,117 +116,542 @@ public class RegisteredRecipes { public static void init() { AdditionalGolemType typeSilverwood = RegisteredGolemStuff.typeSilverwood; - RegisteredRecipes.recipeGolemSilverwood = ThaumcraftApi.addInfusionCraftingRecipe(SimpleResearchItem.getFullName("GOLEMSILVERWOOD"), - /*new ItemStack(Items.bread, 1, 0),*/new ItemStack(typeSilverwood.getPlacerItem(), 1, typeSilverwood.getEnumEntry().ordinal()), - 7, new AspectList().add(Aspect.MOTION, 16).add(Aspect.MAGIC, 16).add(Aspect.MAN, 16).add(Aspect.SENSES, 16), - new ItemStack(ConfigBlocks.blockMagicalLog, 1, 1), new ItemStack[]{ new ItemStack(ConfigItems.itemResource, 1, 15), new ItemStack(ConfigItems.itemResource, 1, 14), new ItemStack(ConfigItems.itemResource, 1, 9), new ItemStack(ConfigItems.itemResource, 1, 3), new ItemStack(ConfigItems.itemResource, 1, 14), new ItemStack(ConfigItems.itemResource, 1, 9), new ItemStack(ConfigItems.itemResource, 1, 3)}); + RegisteredRecipes.recipeGolemSilverwood = ThaumcraftApi.addInfusionCraftingRecipe( + SimpleResearchItem.getFullName("GOLEMSILVERWOOD"), + /*new ItemStack(Items.bread, 1, 0),*/ new ItemStack( + typeSilverwood.getPlacerItem(), + 1, + typeSilverwood.getEnumEntry().ordinal()), + 7, + new AspectList() + .add(Aspect.MOTION, 16) + .add(Aspect.MAGIC, 16) + .add(Aspect.MAN, 16) + .add(Aspect.SENSES, 16), + new ItemStack(ConfigBlocks.blockMagicalLog, 1, 1), + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 15), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 9), + new ItemStack(ConfigItems.itemResource, 1, 3), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 9), + new ItemStack(ConfigItems.itemResource, 1, 3) + }); - RegisteredRecipes.recipesGolemRunicShield = InfusionUpgradeRecipe.createRecipes(SimpleResearchItem.getFullName("GOLEMRUNICSHIELD"), RegisteredGolemStuff.upgradeRunicShield, 5, - new AspectList().add(Aspect.MAGIC, 16).add(Aspect.ENERGY, 16).add(Aspect.ARMOR, 8).add(Aspect.AURA, 4), - new ItemStack[]{new ItemStack(ConfigItems.itemGirdleRunic, 1, 0), new ItemStack(ConfigItems.itemResource, 1, 14), new ItemStack(ConfigItems.itemResource, 1, 14)}); + RegisteredRecipes.recipesGolemRunicShield = InfusionUpgradeRecipe.createRecipes( + SimpleResearchItem.getFullName("GOLEMRUNICSHIELD"), + RegisteredGolemStuff.upgradeRunicShield, + 5, + new AspectList() + .add(Aspect.MAGIC, 16) + .add(Aspect.ENERGY, 16) + .add(Aspect.ARMOR, 8) + .add(Aspect.AURA, 4), + new ItemStack[] { + new ItemStack(ConfigItems.itemGirdleRunic, 1, 0), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 14) + }); ThaumcraftApi.getCraftingRecipes().addAll(Arrays.asList(RegisteredRecipes.recipesGolemRunicShield)); RegisteredRecipes.recipeStickyJar = new RecipeStickyJar(); ThaumcraftApi.getCraftingRecipes().add(RegisteredRecipes.recipeStickyJar); - RegisteredRecipes.recipeArcaneDropper = ThaumcraftApi.addArcaneCraftingRecipe(SimpleResearchItem.getFullName("ARCANEDROPPER"), new ItemStack(RegisteredBlocks.blockArcaneDropper), new AspectList().add(Aspect.ORDER, 14).add(Aspect.AIR, 14).add(Aspect.EARTH, 10), - "SDS", "BAB", "SSS", 'S', new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 6), 'D', new ItemStack(Blocks.dropper), 'A', new ItemStack(ConfigBlocks.blockMetalDevice, 1, 9), 'B', new ItemStack(ConfigBlocks.blockWoodenDevice)); + RegisteredRecipes.recipeArcaneDropper = ThaumcraftApi.addArcaneCraftingRecipe( + SimpleResearchItem.getFullName("ARCANEDROPPER"), + new ItemStack(RegisteredBlocks.blockArcaneDropper), + new AspectList().add(Aspect.ORDER, 14).add(Aspect.AIR, 14).add(Aspect.EARTH, 10), + "SDS", + "BAB", + "SSS", + 'S', + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 6), + 'D', + new ItemStack(Blocks.dropper), + 'A', + new ItemStack(ConfigBlocks.blockMetalDevice, 1, 9), + 'B', + new ItemStack(ConfigBlocks.blockWoodenDevice)); - RegisteredRecipes.recipeGolemCoreBreak = ThaumcraftApi.addInfusionCraftingRecipe(SimpleResearchItem.getFullName("GOLEMCOREBREAK"), + RegisteredRecipes.recipeGolemCoreBreak = ThaumcraftApi.addInfusionCraftingRecipe( + SimpleResearchItem.getFullName("GOLEMCOREBREAK"), new ItemStack(RegisteredItems.itemGolemCoreBreak), - 3, new AspectList().add(Aspect.ENTROPY, 16).add(Aspect.TOOL, 24).add(Aspect.MECHANISM, 16), - new ItemStack(ConfigItems.itemGolemCore, 1, 3), new ItemStack[] {new ItemStack(ConfigItems.itemShovelElemental), new ItemStack(ConfigItems.itemPickElemental), new ItemStack(ConfigItems.itemAxeElemental)}); + 3, + new AspectList().add(Aspect.ENTROPY, 16).add(Aspect.TOOL, 24).add(Aspect.MECHANISM, 16), + new ItemStack(ConfigItems.itemGolemCore, 1, 3), + new ItemStack[] { + new ItemStack(ConfigItems.itemShovelElemental), + new ItemStack(ConfigItems.itemPickElemental), + new ItemStack(ConfigItems.itemAxeElemental) + }); - RegisteredRecipes.recipeInfusionClaw = ThaumcraftApi.addInfusionCraftingRecipe(SimpleResearchItem.getFullName("INFUSIONCLAW"), + RegisteredRecipes.recipeInfusionClaw = ThaumcraftApi.addInfusionCraftingRecipe( + SimpleResearchItem.getFullName("INFUSIONCLAW"), new ItemStack(RegisteredBlocks.blockInfusionClaw), - 10, new AspectList().add(Aspect.ELDRITCH, 25).add(Aspect.MECHANISM, 20).add(Aspect.MAGIC, 16).add(Aspect.ORDER, 20).add(Aspect.DARKNESS, 12), - new ItemStack(ConfigBlocks.blockStoneDevice, 1, 5), new ItemStack[]{new ItemStack(ConfigItems.itemFocusPrimal), /*new ItemStack(Items.redstone),*/ new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 6), new ItemStack(ConfigItems.itemGolemCore, 1, 8), new ItemStack(ConfigItems.itemResource, 1, 16), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 6), new ItemStack(ConfigItems.itemResource, 1, 15), /*new ItemStack(Items.redstone),*/ new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 6), new ItemStack(ConfigItems.itemZombieBrain), new ItemStack(ConfigItems.itemResource, 1, 16), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 6)}); - - RegisteredRecipes.recipeRemoteJar = ThaumcraftApi.addArcaneCraftingRecipe(SimpleResearchItem.getFullName("REMOTEJAR"), new ItemStack(RegisteredBlocks.blockRemoteJar), new AspectList().add(Aspect.WATER, 10).add(Aspect.EARTH, 10).add(Aspect.ORDER, 10), "GJG", "GMG", 'G', new ItemStack(ConfigBlocks.blockMagicalLog), 'J', new ItemStack(ConfigBlocks.blockJar), 'M', (Config.allowMirrors ? new ItemStack(ConfigBlocks.blockMirror, 1, 6) : new ItemStack(ConfigItems.itemResource, 1, 10) )); - - RegisteredRecipes.recipeNodeManipulator = ThaumcraftApi.addInfusionCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".NODE_MANIPULATOR", - new ItemStack(RegisteredBlocks.blockNodeManipulator, 1, 5), 10, - new AspectList().add(Aspect.AURA, 42).add(Aspect.ELDRITCH, 22).add(Aspect.MAGIC, 38).add(Aspect.MECHANISM, 28).add(Aspect.DARKNESS, 14), + 10, + new AspectList() + .add(Aspect.ELDRITCH, 25) + .add(Aspect.MECHANISM, 20) + .add(Aspect.MAGIC, 16) + .add(Aspect.ORDER, 20) + .add(Aspect.DARKNESS, 12), new ItemStack(ConfigBlocks.blockStoneDevice, 1, 5), - new ItemStack[] {new ItemStack(ConfigBlocks.blockStoneDevice, 1, 9), new ItemStack(ConfigBlocks.blockCrystal, 1, 6), new ItemStack(ConfigItems.itemResource, 1, 17), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), new ItemStack(ConfigItems.itemResource, 1, 1), new ItemStack(ConfigItems.itemResource, 1, 15), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 3), new ItemStack(ConfigBlocks.blockCrystal, 1, 6), new ItemStack(ConfigItems.itemResource, 1, 17), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), new ItemStack(ConfigItems.itemResource, 1, 1), new ItemStack(ConfigItems.itemResource, 1, 15)}); + new ItemStack[] { + new ItemStack(ConfigItems.itemFocusPrimal), /*new ItemStack(Items.redstone),*/ + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 6), + new ItemStack(ConfigItems.itemGolemCore, 1, 8), + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 6), + new ItemStack(ConfigItems.itemResource, 1, 15), /*new ItemStack(Items.redstone),*/ + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 6), + new ItemStack(ConfigItems.itemZombieBrain), + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 6) + }); - RegisteredRecipes.recipeRandomizationFocus = ThaumcraftApi.addInfusionCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".NODE_MANIPULATOR", - new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 0), 7, - new AspectList().add(Aspect.ELDRITCH, 18).add(Aspect.MAGIC, 18).add(Aspect.MECHANISM, 20).add(Aspect.DARKNESS, 28).add(Aspect.ORDER, 30), + RegisteredRecipes.recipeRemoteJar = ThaumcraftApi.addArcaneCraftingRecipe( + SimpleResearchItem.getFullName("REMOTEJAR"), + new ItemStack(RegisteredBlocks.blockRemoteJar), + new AspectList().add(Aspect.WATER, 10).add(Aspect.EARTH, 10).add(Aspect.ORDER, 10), + "GJG", + "GMG", + 'G', + new ItemStack(ConfigBlocks.blockMagicalLog), + 'J', + new ItemStack(ConfigBlocks.blockJar), + 'M', + (Config.allowMirrors + ? new ItemStack(ConfigBlocks.blockMirror, 1, 6) + : new ItemStack(ConfigItems.itemResource, 1, 10))); + + RegisteredRecipes.recipeNodeManipulator = ThaumcraftApi.addInfusionCraftingRecipe( + Gadomancy.MODID.toUpperCase() + ".NODE_MANIPULATOR", + new ItemStack(RegisteredBlocks.blockNodeManipulator, 1, 5), + 10, + new AspectList() + .add(Aspect.AURA, 42) + .add(Aspect.ELDRITCH, 22) + .add(Aspect.MAGIC, 38) + .add(Aspect.MECHANISM, 28) + .add(Aspect.DARKNESS, 14), + new ItemStack(ConfigBlocks.blockStoneDevice, 1, 5), + new ItemStack[] { + new ItemStack(ConfigBlocks.blockStoneDevice, 1, 9), + new ItemStack(ConfigBlocks.blockCrystal, 1, 6), + new ItemStack(ConfigItems.itemResource, 1, 17), + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), + new ItemStack(ConfigItems.itemResource, 1, 1), + new ItemStack(ConfigItems.itemResource, 1, 15), + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 3), + new ItemStack(ConfigBlocks.blockCrystal, 1, 6), + new ItemStack(ConfigItems.itemResource, 1, 17), + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), + new ItemStack(ConfigItems.itemResource, 1, 1), + new ItemStack(ConfigItems.itemResource, 1, 15) + }); + + RegisteredRecipes.recipeRandomizationFocus = ThaumcraftApi.addInfusionCraftingRecipe( + Gadomancy.MODID.toUpperCase() + ".NODE_MANIPULATOR", + new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 0), + 7, + new AspectList() + .add(Aspect.ELDRITCH, 18) + .add(Aspect.MAGIC, 18) + .add(Aspect.MECHANISM, 20) + .add(Aspect.DARKNESS, 28) + .add(Aspect.ORDER, 30), new ItemStack(ConfigBlocks.blockStoneDevice, 1, 8), - new ItemStack[] {new ItemStack(ConfigItems.itemResource, 1, 15), new ItemStack(ConfigItems.itemResource, 1, 16), new ItemStack(ConfigBlocks.blockCrystal, 1, 6), new ItemStack(ConfigItems.itemResource, 1, 16), new ItemStack(ConfigItems.itemResource, 1, 15), new ItemStack(ConfigItems.itemResource, 1, 16), new ItemStack(ConfigBlocks.blockCrystal, 1, 6), new ItemStack(ConfigItems.itemResource, 1, 16)}); + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 15), + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(ConfigBlocks.blockCrystal, 1, 6), + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(ConfigItems.itemResource, 1, 15), + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(ConfigBlocks.blockCrystal, 1, 6), + new ItemStack(ConfigItems.itemResource, 1, 16) + }); - RegisteredRecipes.recipePortalFocus = ThaumcraftApi.addInfusionCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".E_PORTAL_CREATOR", - new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 3), 7, - new AspectList().add(Aspect.ELDRITCH, 22).add(Aspect.VOID, 38).add(Aspect.MECHANISM, 30).add(Aspect.DARKNESS, 28).add(Aspect.EXCHANGE, 38), + RegisteredRecipes.recipePortalFocus = ThaumcraftApi.addInfusionCraftingRecipe( + Gadomancy.MODID.toUpperCase() + ".E_PORTAL_CREATOR", + new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 3), + 7, + new AspectList() + .add(Aspect.ELDRITCH, 22) + .add(Aspect.VOID, 38) + .add(Aspect.MECHANISM, 30) + .add(Aspect.DARKNESS, 28) + .add(Aspect.EXCHANGE, 38), new ItemStack(ConfigBlocks.blockStoneDevice, 1, 8), - new ItemStack[] {new ItemStack(ConfigItems.itemEldritchObject, 1, 0), new ItemStack(ConfigBlocks.blockCrystal, 1, 5), new ItemStack(ConfigItems.itemResource, 1, 16), new ItemStack(ConfigBlocks.blockCrystal, 1, 5), new ItemStack(ConfigItems.itemEldritchObject, 1, 0), new ItemStack(ConfigBlocks.blockCrystal, 1, 5), new ItemStack(ConfigItems.itemResource, 1, 16), new ItemStack(ConfigBlocks.blockCrystal, 1, 5)} ); + new ItemStack[] { + new ItemStack(ConfigItems.itemEldritchObject, 1, 0), + new ItemStack(ConfigBlocks.blockCrystal, 1, 5), + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(ConfigBlocks.blockCrystal, 1, 5), + new ItemStack(ConfigItems.itemEldritchObject, 1, 0), + new ItemStack(ConfigBlocks.blockCrystal, 1, 5), + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(ConfigBlocks.blockCrystal, 1, 5) + }); - RegisteredRecipes.multiblockNodeManipulator = Arrays.asList(RegisteredRecipes.costsNodeManipulatorMultiblock, 3, 3, 3, + RegisteredRecipes.multiblockNodeManipulator = Arrays.asList( + RegisteredRecipes.costsNodeManipulatorMultiblock, + 3, + 3, + 3, Arrays.asList( - null, null, null, null, new ItemStack(RegisteredBlocks.blockNode, 1, 5), null, null, null, null, - new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), null, new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), null, new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 0), null, new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), null, new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), - new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15), null, new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15), null, new ItemStack(RegisteredBlocks.blockNodeManipulator, 1, 5), null, new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15), null, new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15))); + null, + null, + null, + null, + new ItemStack(RegisteredBlocks.blockNode, 1, 5), + null, + null, + null, + null, + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), + null, + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), + null, + new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 0), + null, + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), + null, + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15), + null, + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15), + null, + new ItemStack(RegisteredBlocks.blockNodeManipulator, 1, 5), + null, + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15), + null, + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15))); // x y z - RegisteredRecipes.multiblockEldritchPortalCreator = Arrays.asList(RegisteredRecipes.costsEldritchPortalCreatorMultiblock, 7, 3, 7, + RegisteredRecipes.multiblockEldritchPortalCreator = Arrays.asList( + RegisteredRecipes.costsEldritchPortalCreatorMultiblock, + 7, + 3, + 7, Arrays.asList( - null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, new ItemStack(RegisteredBlocks.blockNode, 1, 5), null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), null, new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), null, null, null, null, null, new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 3), null, null, null, null, null, new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), null, new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 1), null, null, null, null, null, null, null, null, null, null, null, null, new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15), null, new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15), null, null, new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 1), null, null, new ItemStack(RegisteredBlocks.blockNodeManipulator, 1, 5), null, null, new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 1), null, null, new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15), null, new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15), null, null, null, null, null, null, null, null, null, null, null, null, new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 1), null, null, null - )); + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + new ItemStack(RegisteredBlocks.blockNode, 1, 5), + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), + null, + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), + null, + null, + null, + null, + null, + new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 3), + null, + null, + null, + null, + null, + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), + null, + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 1), + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15), + null, + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15), + null, + null, + new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 1), + null, + null, + new ItemStack(RegisteredBlocks.blockNodeManipulator, 1, 5), + null, + null, + new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 1), + null, + null, + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15), + null, + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15), + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 1), + null, + null, + null)); - RegisteredRecipes.multiblockAuraPylon = Arrays.asList(RegisteredRecipes.costsAuraPylonMultiblock, 1, 4, 1, + RegisteredRecipes.multiblockAuraPylon = Arrays.asList( + RegisteredRecipes.costsAuraPylonMultiblock, + 1, + 4, + 1, Arrays.asList( new ItemStack(RegisteredBlocks.blockAuraPylon, 1, 1), new ItemStack(RegisteredBlocks.blockAuraPylon), new ItemStack(RegisteredBlocks.blockAuraPylon), - new ItemStack(RegisteredBlocks.blockAuraPylon) - )); + new ItemStack(RegisteredBlocks.blockAuraPylon))); - RegisteredRecipes.recipeGolemCoreBodyguard = ThaumcraftApi.addInfusionCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".GOLEMCOREBODYGUARD", new ItemStack(RegisteredItems.itemGolemCoreBreak, 1, 1), 3, new AspectList().add(Aspect.TOOL, 28).add(Aspect.MECHANISM, 20).add(Aspect.WEAPON, 10).add(Aspect.ARMOR, 16), - new ItemStack(ConfigItems.itemGolemCore, 1, 4), new ItemStack[] { new ItemStack(ConfigItems.itemBootsTraveller, 1, 0), new ItemStack(Items.ender_pearl, 1, 0), new ItemStack(ConfigItems.itemSwordElemental, 1, 0), new ItemStack(Items.ender_pearl, 1, 0) } ); + RegisteredRecipes.recipeGolemCoreBodyguard = ThaumcraftApi.addInfusionCraftingRecipe( + Gadomancy.MODID.toUpperCase() + ".GOLEMCOREBODYGUARD", + new ItemStack(RegisteredItems.itemGolemCoreBreak, 1, 1), + 3, + new AspectList() + .add(Aspect.TOOL, 28) + .add(Aspect.MECHANISM, 20) + .add(Aspect.WEAPON, 10) + .add(Aspect.ARMOR, 16), + new ItemStack(ConfigItems.itemGolemCore, 1, 4), + new ItemStack[] { + new ItemStack(ConfigItems.itemBootsTraveller, 1, 0), + new ItemStack(Items.ender_pearl, 1, 0), + new ItemStack(ConfigItems.itemSwordElemental, 1, 0), + new ItemStack(Items.ender_pearl, 1, 0) + }); - RegisteredRecipes.recipeAncientPedestal = ThaumcraftApi.addArcaneCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".E_PORTAL_CREATOR", new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 1), + RegisteredRecipes.recipeAncientPedestal = ThaumcraftApi.addArcaneCraftingRecipe( + Gadomancy.MODID.toUpperCase() + ".E_PORTAL_CREATOR", + new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 1), new AspectList().add(Aspect.ENTROPY, 25).add(Aspect.ORDER, 25), - "SPS", " S ", "SPS", 'S', new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), 'P', new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15)); + "SPS", + " S ", + "SPS", + 'S', + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), + 'P', + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15)); RegisteredRecipes.recipesFamiliar = RegisteredRecipes.createFamiliarRecipes(); RegisteredRecipes.recipesFamiliarAugmentation = RegisteredRecipes.createEtherealFamiliarUpgradeRecipes(); RegisteredRecipes.recipeBlockProtector = new IArcaneRecipe[4]; - RegisteredRecipes.recipeBlockProtector[0] = ThaumcraftApi.addArcaneCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".BLOCK_PROTECTOR", new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 2), + RegisteredRecipes.recipeBlockProtector[0] = ThaumcraftApi.addArcaneCraftingRecipe( + Gadomancy.MODID.toUpperCase() + ".BLOCK_PROTECTOR", + new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 2), new AspectList().add(Aspect.ORDER, 120).add(Aspect.EARTH, 120), - "WNW", "PJP", "GRG", 'W', new ItemStack(Items.potionitem, 1, 8232), 'N', new ItemStack(ConfigItems.itemResource, 1, 1), 'P', new ItemStack(ConfigBlocks.blockTube), 'J', new ItemStack(ConfigBlocks.blockJar), 'G', new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6), 'R', new ItemStack(Items.redstone)); - RegisteredRecipes.recipeBlockProtector[1] = ThaumcraftApi.addArcaneCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".BLOCK_PROTECTOR", new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 2), + "WNW", + "PJP", + "GRG", + 'W', + new ItemStack(Items.potionitem, 1, 8232), + 'N', + new ItemStack(ConfigItems.itemResource, 1, 1), + 'P', + new ItemStack(ConfigBlocks.blockTube), + 'J', + new ItemStack(ConfigBlocks.blockJar), + 'G', + new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6), + 'R', + new ItemStack(Items.redstone)); + RegisteredRecipes.recipeBlockProtector[1] = ThaumcraftApi.addArcaneCraftingRecipe( + Gadomancy.MODID.toUpperCase() + ".BLOCK_PROTECTOR", + new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 2), new AspectList().add(Aspect.ORDER, 120).add(Aspect.EARTH, 120), - "WNW", "PJP", "GRG", 'W', new ItemStack(Items.potionitem, 1, 8200), 'N', new ItemStack(ConfigItems.itemResource, 1, 1), 'P', new ItemStack(ConfigBlocks.blockTube), 'J', new ItemStack(ConfigBlocks.blockJar), 'G', new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6), 'R', new ItemStack(Items.redstone)); + "WNW", + "PJP", + "GRG", + 'W', + new ItemStack(Items.potionitem, 1, 8200), + 'N', + new ItemStack(ConfigItems.itemResource, 1, 1), + 'P', + new ItemStack(ConfigBlocks.blockTube), + 'J', + new ItemStack(ConfigBlocks.blockJar), + 'G', + new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6), + 'R', + new ItemStack(Items.redstone)); - RegisteredRecipes.recipeBlockProtector[2] = ThaumcraftApi.addArcaneCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".BLOCK_PROTECTOR", new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 2), + RegisteredRecipes.recipeBlockProtector[2] = ThaumcraftApi.addArcaneCraftingRecipe( + Gadomancy.MODID.toUpperCase() + ".BLOCK_PROTECTOR", + new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 2), new AspectList().add(Aspect.ORDER, 120).add(Aspect.EARTH, 120), - "WNV", "PJP", "GRG", 'W', new ItemStack(Items.potionitem, 1, 8232), 'V', new ItemStack(Items.potionitem, 1, 8200), 'N', new ItemStack(ConfigItems.itemResource, 1, 1), 'P', new ItemStack(ConfigBlocks.blockTube), 'J', new ItemStack(ConfigBlocks.blockJar), 'G', new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6), 'R', new ItemStack(Items.redstone)); - RegisteredRecipes.recipeBlockProtector[3] = ThaumcraftApi.addArcaneCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".BLOCK_PROTECTOR", new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 2), + "WNV", + "PJP", + "GRG", + 'W', + new ItemStack(Items.potionitem, 1, 8232), + 'V', + new ItemStack(Items.potionitem, 1, 8200), + 'N', + new ItemStack(ConfigItems.itemResource, 1, 1), + 'P', + new ItemStack(ConfigBlocks.blockTube), + 'J', + new ItemStack(ConfigBlocks.blockJar), + 'G', + new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6), + 'R', + new ItemStack(Items.redstone)); + RegisteredRecipes.recipeBlockProtector[3] = ThaumcraftApi.addArcaneCraftingRecipe( + Gadomancy.MODID.toUpperCase() + ".BLOCK_PROTECTOR", + new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 2), new AspectList().add(Aspect.ORDER, 120).add(Aspect.EARTH, 120), - "WNV", "PJP", "GRG", 'W', new ItemStack(Items.potionitem, 1, 8200), 'V', new ItemStack(Items.potionitem, 1, 8232), 'N', new ItemStack(ConfigItems.itemResource, 1, 1), 'P', new ItemStack(ConfigBlocks.blockTube), 'J', new ItemStack(ConfigBlocks.blockJar), 'G', new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6), 'R', new ItemStack(Items.redstone)); + "WNV", + "PJP", + "GRG", + 'W', + new ItemStack(Items.potionitem, 1, 8200), + 'V', + new ItemStack(Items.potionitem, 1, 8232), + 'N', + new ItemStack(ConfigItems.itemResource, 1, 1), + 'P', + new ItemStack(ConfigBlocks.blockTube), + 'J', + new ItemStack(ConfigBlocks.blockJar), + 'G', + new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6), + 'R', + new ItemStack(Items.redstone)); - if(ModConfig.ancientStoneRecipes) { - RegisteredRecipes.recipeAncientStone = ThaumcraftApi.addArcaneCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".ANCIENT_STONES", new ItemStack(ConfigBlocks.blockCosmeticSolid, 4, 11), new AspectList().add(Aspect.ENTROPY, 16).add(Aspect.EARTH, 8), - "SSS", "SES", "SSS", 'S', new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 6), 'E', new ItemStack(ConfigItems.itemEldritchObject)); - RegisteredRecipes.recipeAncientStonePedestal = ThaumcraftApi.addCrucibleRecipe(Gadomancy.MODID.toUpperCase() + ".ANCIENT_STONES", new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 7), new AspectList().add(Aspect.ELDRITCH, 8).add(Aspect.EXCHANGE, 8).add(Aspect.ENTROPY, 12)); + if (ModConfig.ancientStoneRecipes) { + RegisteredRecipes.recipeAncientStone = ThaumcraftApi.addArcaneCraftingRecipe( + Gadomancy.MODID.toUpperCase() + ".ANCIENT_STONES", + new ItemStack(ConfigBlocks.blockCosmeticSolid, 4, 11), + new AspectList().add(Aspect.ENTROPY, 16).add(Aspect.EARTH, 8), + "SSS", + "SES", + "SSS", + 'S', + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 6), + 'E', + new ItemStack(ConfigItems.itemEldritchObject)); + RegisteredRecipes.recipeAncientStonePedestal = ThaumcraftApi.addCrucibleRecipe( + Gadomancy.MODID.toUpperCase() + ".ANCIENT_STONES", + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15), + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 7), + new AspectList() + .add(Aspect.ELDRITCH, 8) + .add(Aspect.EXCHANGE, 8) + .add(Aspect.ENTROPY, 12)); } ItemAuraCore.AuraCoreType[] auraCoreTypes = ItemAuraCore.AuraCoreType.values(); RegisteredRecipes.recipesWashAuraCore = new CrucibleRecipe[auraCoreTypes.length - 1]; List recipesUndoAuraCore = new ArrayList(); - for(int i = 1; i < auraCoreTypes.length; i++) { - RegisteredRecipes.recipesWashAuraCore[i-1] = ThaumcraftApi.addCrucibleRecipe(Gadomancy.MODID.toUpperCase() + ".CLEAN_AURA_CORE", new ItemStack(RegisteredItems.itemAuraCore), new ItemStack(RegisteredItems.itemAuraCore, 1, i), new AspectList().add(Aspect.MAGIC, 12).add(Aspect.WATER, 12).add(Aspect.HEAL, 18)); //damn those heal potions + for (int i = 1; i < auraCoreTypes.length; i++) { + RegisteredRecipes.recipesWashAuraCore[i - 1] = ThaumcraftApi.addCrucibleRecipe( + Gadomancy.MODID.toUpperCase() + ".CLEAN_AURA_CORE", + new ItemStack(RegisteredItems.itemAuraCore), + new ItemStack(RegisteredItems.itemAuraCore, 1, i), + new AspectList() + .add(Aspect.MAGIC, 12) + .add(Aspect.WATER, 12) + .add(Aspect.HEAL, 18)); // damn those heal potions - if(auraCoreTypes[i].isUnused()) { - GameRegistry.addShapelessRecipe(new ItemStack(RegisteredItems.itemAuraCore), new ItemStack(RegisteredItems.itemAuraCore, 1, i)); + if (auraCoreTypes[i].isUnused()) { + GameRegistry.addShapelessRecipe( + new ItemStack(RegisteredItems.itemAuraCore), new ItemStack(RegisteredItems.itemAuraCore, 1, i)); List list = CraftingManager.getInstance().getRecipeList(); - recipesUndoAuraCore.add((IRecipe)list.get(list.size() - 1)); + recipesUndoAuraCore.add((IRecipe) list.get(list.size() - 1)); } } @@ -211,107 +659,243 @@ public class RegisteredRecipes { ItemStack blankCore = new ItemStack(RegisteredItems.itemAuraCore); RegisteredItems.itemAuraCore.setCoreType(blankCore, ItemAuraCore.AuraCoreType.BLANK); - RegisteredRecipes.recipeAuraCore = ThaumcraftApi.addInfusionCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".AURA_CORE", blankCore, 6, - new RandomizedAspectList().setHalfCap(true).addAspectRandomBase(Aspect.AURA, 9).addAspectRandomBase(Aspect.MAGIC, 19).addAspectRandomBase(Aspect.ELDRITCH, 17).addAspectRandomBase(Aspect.VOID, 34), + RegisteredRecipes.recipeAuraCore = ThaumcraftApi.addInfusionCraftingRecipe( + Gadomancy.MODID.toUpperCase() + ".AURA_CORE", + blankCore, + 6, + new RandomizedAspectList() + .setHalfCap(true) + .addAspectRandomBase(Aspect.AURA, 9) + .addAspectRandomBase(Aspect.MAGIC, 19) + .addAspectRandomBase(Aspect.ELDRITCH, 17) + .addAspectRandomBase(Aspect.VOID, 34), new ItemStack(ConfigItems.itemResource, 1, 15), - new ItemStack[] { new ItemStack(ConfigItems.itemShard, 1, 6), new ItemStack(ConfigItems.itemResource, 1, 2), new ItemStack(ConfigItems.itemResource, 1, 2), - new ItemStack(ConfigItems.itemShard, 1, 6), new ItemStack(ConfigItems.itemResource, 1, 2), new ItemStack(ConfigItems.itemResource, 1, 2), - new ItemStack(ConfigItems.itemShard, 1, 6), new ItemStack(ConfigItems.itemResource, 1, 2), new ItemStack(ConfigItems.itemResource, 1, 2), - new ItemStack(ConfigItems.itemShard, 1, 6), new ItemStack(ConfigItems.itemResource, 1, 2), new ItemStack(ConfigItems.itemResource, 1, 2)}); + new ItemStack[] { + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(ConfigItems.itemResource, 1, 2), + new ItemStack(ConfigItems.itemResource, 1, 2), + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(ConfigItems.itemResource, 1, 2), + new ItemStack(ConfigItems.itemResource, 1, 2), + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(ConfigItems.itemResource, 1, 2), + new ItemStack(ConfigItems.itemResource, 1, 2), + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(ConfigItems.itemResource, 1, 2), + new ItemStack(ConfigItems.itemResource, 1, 2) + }); - RegisteredRecipes.recipeAuraPylon = ThaumcraftApi.addArcaneCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".AURA_PYLON", new ItemStack(RegisteredBlocks.blockAuraPylon, 1, 0), - new AspectList().add(Aspect.ORDER, 80).add(Aspect.WATER, 50).add(Aspect.FIRE, 50).add(Aspect.AIR, 50), - "TST", "S S", "TJT", 'T', new ItemStack(ConfigBlocks.blockTube, 1, 6), 'S', new ItemStack(ConfigBlocks.blockMagicalLog, 1, 1), 'J', new ItemStack(ConfigBlocks.blockJar, 1, 0)); + RegisteredRecipes.recipeAuraPylon = ThaumcraftApi.addArcaneCraftingRecipe( + Gadomancy.MODID.toUpperCase() + ".AURA_PYLON", + new ItemStack(RegisteredBlocks.blockAuraPylon, 1, 0), + new AspectList() + .add(Aspect.ORDER, 80) + .add(Aspect.WATER, 50) + .add(Aspect.FIRE, 50) + .add(Aspect.AIR, 50), + "TST", + "S S", + "TJT", + 'T', + new ItemStack(ConfigBlocks.blockTube, 1, 6), + 'S', + new ItemStack(ConfigBlocks.blockMagicalLog, 1, 1), + 'J', + new ItemStack(ConfigBlocks.blockJar, 1, 0)); ItemStack ignisCore = new ItemStack(RegisteredItems.itemAuraCore); RegisteredItems.itemAuraCore.setCoreType(ignisCore, ItemAuraCore.AuraCoreType.FIRE); - RegisteredRecipes.recipeAuraPylonPeak = ThaumcraftApi.addArcaneCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".AURA_PYLON", new ItemStack(RegisteredBlocks.blockAuraPylon, 1, 1), + RegisteredRecipes.recipeAuraPylonPeak = ThaumcraftApi.addArcaneCraftingRecipe( + Gadomancy.MODID.toUpperCase() + ".AURA_PYLON", + new ItemStack(RegisteredBlocks.blockAuraPylon, 1, 1), new AspectList().add(Aspect.ORDER, 90).add(Aspect.FIRE, 120).add(Aspect.AIR, 70), - " N ", "ACA", " P ", 'A', new ItemStack(ConfigItems.itemResource, 1, 0), 'N', new ItemStack(ConfigItems.itemResource, 1, 1), 'C', ignisCore, 'P', new ItemStack(RegisteredBlocks.blockAuraPylon, 1, 0)); + " N ", + "ACA", + " P ", + 'A', + new ItemStack(ConfigItems.itemResource, 1, 0), + 'N', + new ItemStack(ConfigItems.itemResource, 1, 1), + 'C', + ignisCore, + 'P', + new ItemStack(RegisteredBlocks.blockAuraPylon, 1, 0)); ItemStack aerCore = new ItemStack(RegisteredItems.itemAuraCore); RegisteredItems.itemAuraCore.setCoreType(aerCore, ItemAuraCore.AuraCoreType.AIR); - RegisteredRecipes.recipeArcanePackager = ThaumcraftApi.addArcaneCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".ARCANE_PACKAGER", new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 4), + RegisteredRecipes.recipeArcanePackager = ThaumcraftApi.addArcaneCraftingRecipe( + Gadomancy.MODID.toUpperCase() + ".ARCANE_PACKAGER", + new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 4), new AspectList().add(Aspect.AIR, 100).add(Aspect.ORDER, 60).add(Aspect.ENTROPY, 50), - "PSP", "GCG", "JTJ", - 'P', new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6), 'S', new ItemStack(Blocks.piston), - 'G', (Config.wardedStone ? new ItemStack(ConfigBlocks.blockCosmeticOpaque, 1, 2) : new ItemStack(Blocks.glass)), 'C', aerCore, - 'J', new ItemStack(ConfigBlocks.blockJar), 'T', new ItemStack(ConfigBlocks.blockTable, 1, 15)); + "PSP", + "GCG", + "JTJ", + 'P', + new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6), + 'S', + new ItemStack(Blocks.piston), + 'G', + (Config.wardedStone + ? new ItemStack(ConfigBlocks.blockCosmeticOpaque, 1, 2) + : new ItemStack(Blocks.glass)), + 'C', + aerCore, + 'J', + new ItemStack(ConfigBlocks.blockJar), + 'T', + new ItemStack(ConfigBlocks.blockTable, 1, 15)); ItemStack ordoCore = new ItemStack(RegisteredItems.itemAuraCore); RegisteredItems.itemAuraCore.setCoreType(ordoCore, ItemAuraCore.AuraCoreType.ORDER); - RegisteredRecipes.recipeKnowledgeBook = ThaumcraftApi.addArcaneCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".KNOWLEDGE_BOOK", new ItemStack(RegisteredBlocks.blockKnowledgeBook), - new AspectList().add(Aspect.ORDER, 70).add(Aspect.ENTROPY, 20).add(Aspect.AIR, 20).add(Aspect.FIRE, 30), - "STS", "BOB", "MGM", - 'S', new ItemStack(ConfigItems.itemInkwell), 'T', new ItemStack(ConfigItems.itemThaumonomicon), - 'B', new ItemStack(Items.book), 'O', ordoCore, - 'M', new ItemStack(ConfigBlocks.blockMetalDevice, 1, 12), 'G', new ItemStack(ConfigItems.itemGoggles)); + RegisteredRecipes.recipeKnowledgeBook = ThaumcraftApi.addArcaneCraftingRecipe( + Gadomancy.MODID.toUpperCase() + ".KNOWLEDGE_BOOK", + new ItemStack(RegisteredBlocks.blockKnowledgeBook), + new AspectList() + .add(Aspect.ORDER, 70) + .add(Aspect.ENTROPY, 20) + .add(Aspect.AIR, 20) + .add(Aspect.FIRE, 30), + "STS", + "BOB", + "MGM", + 'S', + new ItemStack(ConfigItems.itemInkwell), + 'T', + new ItemStack(ConfigItems.itemThaumonomicon), + 'B', + new ItemStack(Items.book), + 'O', + ordoCore, + 'M', + new ItemStack(ConfigBlocks.blockMetalDevice, 1, 12), + 'G', + new ItemStack(ConfigItems.itemGoggles)); ItemStack voidMetalIngot = new ItemStack(ConfigItems.itemResource, 1, 16); ItemStack salisMundus = new ItemStack(ConfigItems.itemResource, 1, 14); ItemStack alumentum = new ItemStack(ConfigItems.itemResource); - RegisteredRecipes.recipeElementVoid = ThaumcraftApi.addInfusionCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".ESSENTIA_COMPRESSOR", new ItemStack(RegisteredItems.itemElement, 1, ItemElement.EnumElementType.DARKNESS.ordinal()), 6, - new RandomizedAspectList().setHalfCap(true).addAspectRandomBase(Aspect.VOID, 22).addAspectRandomBase(Aspect.DARKNESS, 18).addAspectRandomBase(Aspect.ELDRITCH, 20).addAspectRandomBase(Aspect.AURA, 10), + RegisteredRecipes.recipeElementVoid = ThaumcraftApi.addInfusionCraftingRecipe( + Gadomancy.MODID.toUpperCase() + ".ESSENTIA_COMPRESSOR", + new ItemStack(RegisteredItems.itemElement, 1, ItemElement.EnumElementType.DARKNESS.ordinal()), + 6, + new RandomizedAspectList() + .setHalfCap(true) + .addAspectRandomBase(Aspect.VOID, 22) + .addAspectRandomBase(Aspect.DARKNESS, 18) + .addAspectRandomBase(Aspect.ELDRITCH, 20) + .addAspectRandomBase(Aspect.AURA, 10), new ItemStack(ConfigItems.itemResource, 1, 17), - new ItemStack[] { alumentum, voidMetalIngot, voidMetalIngot, salisMundus, alumentum, voidMetalIngot, voidMetalIngot, salisMundus }); + new ItemStack[] { + alumentum, + voidMetalIngot, + voidMetalIngot, + salisMundus, + alumentum, + voidMetalIngot, + voidMetalIngot, + salisMundus + }); ItemStack waterCore = new ItemStack(RegisteredItems.itemAuraCore); RegisteredItems.itemAuraCore.setCoreType(waterCore, ItemAuraCore.AuraCoreType.WATER); - RegisteredRecipes.recipeEssentiaCompressor = ThaumcraftApi.addArcaneCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".ESSENTIA_COMPRESSOR", new ItemStack(RegisteredBlocks.blockEssentiaCompressor, 3), - new AspectList().add(Aspect.WATER, 190).add(Aspect.ORDER, 150).add(Aspect.ENTROPY, 120).add(Aspect.FIRE, 100).add(Aspect.AIR, 160).add(Aspect.EARTH, 60), - "LRL", "TET", "LCL", - 'L', new ItemStack(ConfigBlocks.blockMagicalLog), - 'R', new ItemStack(ConfigBlocks.blockCrystal, 1, 4), - 'T', new ItemStack(ConfigBlocks.blockTube, 1, 6), - 'E', new ItemStack(RegisteredItems.itemElement, 1, ItemElement.EnumElementType.DARKNESS.ordinal()), - 'C', waterCore); + RegisteredRecipes.recipeEssentiaCompressor = ThaumcraftApi.addArcaneCraftingRecipe( + Gadomancy.MODID.toUpperCase() + ".ESSENTIA_COMPRESSOR", + new ItemStack(RegisteredBlocks.blockEssentiaCompressor, 3), + new AspectList() + .add(Aspect.WATER, 190) + .add(Aspect.ORDER, 150) + .add(Aspect.ENTROPY, 120) + .add(Aspect.FIRE, 100) + .add(Aspect.AIR, 160) + .add(Aspect.EARTH, 60), + "LRL", + "TET", + "LCL", + 'L', + new ItemStack(ConfigBlocks.blockMagicalLog), + 'R', + new ItemStack(ConfigBlocks.blockCrystal, 1, 4), + 'T', + new ItemStack(ConfigBlocks.blockTube, 1, 6), + 'E', + new ItemStack(RegisteredItems.itemElement, 1, ItemElement.EnumElementType.DARKNESS.ordinal()), + 'C', + waterCore); - RegisteredRecipes.multiblockEssentiaCompressor = Arrays.asList(RegisteredRecipes.costsCompressorMultiblock, 1, 3, 1, + RegisteredRecipes.multiblockEssentiaCompressor = Arrays.asList( + RegisteredRecipes.costsCompressorMultiblock, + 1, + 3, + 1, Arrays.asList( new ItemStack(RegisteredBlocks.blockEssentiaCompressor), new ItemStack(RegisteredBlocks.blockEssentiaCompressor), - new ItemStack(RegisteredBlocks.blockEssentiaCompressor) - )); + 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) - });*/ - + 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) + });*/ RegisteredRecipes.auraCoreRecipes = RegisteredRecipes.createAuraCoreRecipes(); ThaumcraftApi.getCraftingRecipes().add(new InfusionDisguiseArmor()); - RegisteredRecipes.recipeRevealer = ThaumcraftApi.addInfusionEnchantmentRecipe(Gadomancy.MODID.toUpperCase() + ".REVEALER", RegisteredEnchantments.revealer, 4, new AspectList().add(Aspect.SENSES, 16).add(Aspect.MAGIC, 8), new ItemStack[]{new ItemStack(ConfigItems.itemGoggles), new ItemStack(ConfigItems.itemResource, 1, 14), new ItemStack(ConfigItems.itemResource, 1, 14)}); + RegisteredRecipes.recipeRevealer = ThaumcraftApi.addInfusionEnchantmentRecipe( + Gadomancy.MODID.toUpperCase() + ".REVEALER", + RegisteredEnchantments.revealer, + 4, + new AspectList().add(Aspect.SENSES, 16).add(Aspect.MAGIC, 8), + new ItemStack[] { + new ItemStack(ConfigItems.itemGoggles), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 14) + }); CraftingManager.getInstance().getRecipeList().add(new FamiliarUndoRecipe()); } private static List[] createAuraCoreRecipes() { List[] recipes = new List[7]; - for(int i = 0; i < 7; i++) { + for (int i = 0; i < 7; i++) { AspectList cost = new AspectList(); switch (i) { - case 0: cost.add(Aspect.AIR, 84); break; - case 1: cost.add(Aspect.FIRE, 84); break; - case 2: cost.add(Aspect.WATER, 84); break; - case 3: cost.add(Aspect.EARTH, 84); break; - case 4: cost.add(Aspect.ORDER, 84); break; - case 5: cost.add(Aspect.ENTROPY, 84); break; - case 6: cost.add(Aspect.AIR, 14).add(Aspect.FIRE, 14).add(Aspect.WATER, 14) - .add(Aspect.EARTH, 14).add(Aspect.ORDER, 14).add(Aspect.ENTROPY, 14); + case 0: + cost.add(Aspect.AIR, 84); + break; + case 1: + cost.add(Aspect.FIRE, 84); + break; + case 2: + cost.add(Aspect.WATER, 84); + break; + case 3: + cost.add(Aspect.EARTH, 84); + break; + case 4: + cost.add(Aspect.ORDER, 84); + break; + case 5: + cost.add(Aspect.ENTROPY, 84); + break; + case 6: + cost.add(Aspect.AIR, 14) + .add(Aspect.FIRE, 14) + .add(Aspect.WATER, 14) + .add(Aspect.EARTH, 14) + .add(Aspect.ORDER, 14) + .add(Aspect.ENTROPY, 14); } ItemWandCasting item = (ItemWandCasting) ConfigItems.itemWandCasting; @@ -319,12 +903,30 @@ public class RegisteredRecipes { item.setRod(wand, ConfigItems.WAND_ROD_GREATWOOD); item.setCap(wand, ConfigItems.WAND_CAP_GOLD); - recipes[i] = Arrays.asList(cost, 3, 2, 3, + recipes[i] = Arrays.asList( + cost, + 3, + 2, + 3, Arrays.asList( - null, null, null, null, wand, null, null, null, null, - null, null, null, null, new ItemStack(ConfigBlocks.blockCrystal, 1, i), - new ItemStack(RegisteredItems.itemAuraCore), null, null, null - )); + null, + null, + null, + null, + wand, + null, + null, + null, + null, + null, + null, + null, + null, + new ItemStack(ConfigBlocks.blockCrystal, 1, i), + new ItemStack(RegisteredItems.itemAuraCore), + null, + null, + null)); } return recipes; } @@ -344,7 +946,7 @@ public class RegisteredRecipes { */ private static InfusionRecipe[][] createEtherealFamiliarUpgradeRecipes() { List aspects = new ArrayList(Aspect.aspects.values()); - InfusionRecipe[][] recipes = new InfusionRecipe[19][aspects.size()]; //Ugh.. 19xAspectSize array... nice... + InfusionRecipe[][] recipes = new InfusionRecipe[19][aspects.size()]; // Ugh.. 19xAspectSize array... nice... ItemWispEssence wispEssence = (ItemWispEssence) ConfigItems.itemWispEssence; ItemEtherealFamiliar etherealFamiliar = RegisteredItems.itemEtherealFamiliar; @@ -363,29 +965,58 @@ public class RegisteredRecipes { ItemStack alumentum = new ItemStack(ConfigItems.itemResource, 1, 0); ItemStack amber = new ItemStack(ConfigItems.itemResource, 1, 6); - //Shock 0 -> 1 + // Shock 0 -> 1 famIn = new ItemStack(etherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(famIn, a); - infusion = new EtherealFamiliarUpgradeRecipe(modid + ".FAMILIAR_SHOCK", 3, + infusion = new EtherealFamiliarUpgradeRecipe( + modid + ".FAMILIAR_SHOCK", + 3, new AspectList().add(Aspect.MOTION, 14).add(a, 16).add(Aspect.AIR, 20), - famIn, FamiliarAugment.SHOCK, 0, - wispyEssence, alumentum, wispyEssence, amber, - wispyEssence, alumentum, wispyEssence, amber); + famIn, + FamiliarAugment.SHOCK, + 0, + wispyEssence, + alumentum, + wispyEssence, + amber, + wispyEssence, + alumentum, + wispyEssence, + amber); ThaumcraftApi.getCraftingRecipes().add(infusion); (recipes[0])[i] = infusion; ItemStack glowstone = new ItemStack(Items.glowstone_dust); ItemStack ghastTear = new ItemStack(Items.ghast_tear); - //Shock 1 -> 2 + // Shock 1 -> 2 famIn = new ItemStack(etherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(famIn, a); ItemEtherealFamiliar.addAugmentUnsafe(famIn, FamiliarAugment.SHOCK, 1); - infusion = new EtherealFamiliarUpgradeRecipe(modid + ".FAMILIAR_SHOCK", 5, - new AspectList().add(Aspect.MOTION, 22).add(a, 28).add(Aspect.AURA, 20).add(Aspect.WEAPON, 18).add(Aspect.AIR, 38), - famIn, FamiliarAugment.SHOCK, 1, - wispyEssence, alumentum, glowstone, wispyEssence, alumentum, ghastTear, - wispyEssence, alumentum, glowstone, wispyEssence, alumentum, ghastTear); + infusion = new EtherealFamiliarUpgradeRecipe( + modid + ".FAMILIAR_SHOCK", + 5, + new AspectList() + .add(Aspect.MOTION, 22) + .add(a, 28) + .add(Aspect.AURA, 20) + .add(Aspect.WEAPON, 18) + .add(Aspect.AIR, 38), + famIn, + FamiliarAugment.SHOCK, + 1, + wispyEssence, + alumentum, + glowstone, + wispyEssence, + alumentum, + ghastTear, + wispyEssence, + alumentum, + glowstone, + wispyEssence, + alumentum, + ghastTear); ThaumcraftApi.getCraftingRecipes().add(infusion); (recipes[1])[i] = infusion; @@ -393,28 +1024,61 @@ public class RegisteredRecipes { ItemStack airShard = new ItemStack(ConfigItems.itemShard, 1, 0); ItemStack quicksilver = new ItemStack(ConfigItems.itemResource, 1, 3); - //Shock 2 -> 3 + // Shock 2 -> 3 famIn = new ItemStack(etherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(famIn, a); ItemEtherealFamiliar.addAugmentUnsafe(famIn, FamiliarAugment.SHOCK, 2); - infusion = new EtherealFamiliarUpgradeRecipe(modid + ".FAMILIAR_SHOCK", 8, - new AspectList().add(Aspect.MOTION, 40).add(Aspect.AURA, 28).add(a, 38).add(Aspect.WEAPON, 20).add(Aspect.AIR, 36), - famIn, FamiliarAugment.SHOCK, 2, - wispyEssence, alumentum, airShard, alumentum, quicksilver, alumentum, netherStar, alumentum, - wispyEssence, alumentum, airShard, alumentum, quicksilver, alumentum, netherStar, alumentum); + infusion = new EtherealFamiliarUpgradeRecipe( + modid + ".FAMILIAR_SHOCK", + 8, + new AspectList() + .add(Aspect.MOTION, 40) + .add(Aspect.AURA, 28) + .add(a, 38) + .add(Aspect.WEAPON, 20) + .add(Aspect.AIR, 36), + famIn, + FamiliarAugment.SHOCK, + 2, + wispyEssence, + alumentum, + airShard, + alumentum, + quicksilver, + alumentum, + netherStar, + alumentum, + wispyEssence, + alumentum, + airShard, + alumentum, + quicksilver, + alumentum, + netherStar, + alumentum); ThaumcraftApi.getCraftingRecipes().add(infusion); (recipes[2])[i] = infusion; ItemStack blazePowder = new ItemStack(Items.blaze_powder); - //Fire 0 -> 1 + // Fire 0 -> 1 famIn = new ItemStack(etherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(famIn, a); - infusion = new EtherealFamiliarUpgradeRecipe(modid + ".FAMILIAR_FIRE", 4, + infusion = new EtherealFamiliarUpgradeRecipe( + modid + ".FAMILIAR_FIRE", + 4, new AspectList().add(Aspect.FIRE, 12).add(a, 14).add(Aspect.WEAPON, 8), - famIn, FamiliarAugment.FIRE, 0, - wispyEssence, blazePowder, wispyEssence, blazePowder, - wispyEssence, blazePowder, wispyEssence, blazePowder); + famIn, + FamiliarAugment.FIRE, + 0, + wispyEssence, + blazePowder, + wispyEssence, + blazePowder, + wispyEssence, + blazePowder, + wispyEssence, + blazePowder); ThaumcraftApi.getCraftingRecipes().add(infusion); (recipes[3])[i] = infusion; @@ -422,44 +1086,99 @@ public class RegisteredRecipes { ItemStack magmaCream = new ItemStack(Items.magma_cream); ItemStack coalBlock = new ItemStack(Blocks.coal_block); - //Fire 1 -> 2 + // Fire 1 -> 2 famIn = new ItemStack(etherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(famIn, a); ItemEtherealFamiliar.addAugmentUnsafe(famIn, FamiliarAugment.FIRE, 1); - infusion = new EtherealFamiliarUpgradeRecipe(modid + ".FAMILIAR_FIRE", 6, - new AspectList().add(Aspect.FIRE, 38).add(a, 24).add(Aspect.ENERGY, 32).add(Aspect.WEAPON, 18), - famIn, FamiliarAugment.FIRE, 1, - wispyEssence, redstone, coalBlock, wispyEssence, magmaCream, blazePowder, - wispyEssence, redstone, coalBlock, wispyEssence, magmaCream, blazePowder); + infusion = new EtherealFamiliarUpgradeRecipe( + modid + ".FAMILIAR_FIRE", + 6, + new AspectList() + .add(Aspect.FIRE, 38) + .add(a, 24) + .add(Aspect.ENERGY, 32) + .add(Aspect.WEAPON, 18), + famIn, + FamiliarAugment.FIRE, + 1, + wispyEssence, + redstone, + coalBlock, + wispyEssence, + magmaCream, + blazePowder, + wispyEssence, + redstone, + coalBlock, + wispyEssence, + magmaCream, + blazePowder); ThaumcraftApi.getCraftingRecipes().add(infusion); (recipes[4])[i] = infusion; ItemStack nitor = new ItemStack(ConfigItems.itemResource, 1, 1); ItemStack fireShard = new ItemStack(ConfigItems.itemShard, 1, 1); - //Fire 2 -> 3 + // Fire 2 -> 3 famIn = new ItemStack(etherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(famIn, a); ItemEtherealFamiliar.addAugmentUnsafe(famIn, FamiliarAugment.FIRE, 2); - infusion = new EtherealFamiliarUpgradeRecipe(modid + ".FAMILIAR_FIRE", 9, - new AspectList().add(Aspect.FIRE, 48).add(a, 32).add(Aspect.ENERGY, 42).add(Aspect.WEAPON, 32).add(Aspect.AURA, 30), - famIn, FamiliarAugment.FIRE, 2, - wispyEssence, blazePowder, fireShard, blazePowder, netherStar, blazePowder, nitor, blazePowder, - wispyEssence, blazePowder, fireShard, blazePowder, netherStar, blazePowder, nitor, blazePowder); + infusion = new EtherealFamiliarUpgradeRecipe( + modid + ".FAMILIAR_FIRE", + 9, + new AspectList() + .add(Aspect.FIRE, 48) + .add(a, 32) + .add(Aspect.ENERGY, 42) + .add(Aspect.WEAPON, 32) + .add(Aspect.AURA, 30), + famIn, + FamiliarAugment.FIRE, + 2, + wispyEssence, + blazePowder, + fireShard, + blazePowder, + netherStar, + blazePowder, + nitor, + blazePowder, + wispyEssence, + blazePowder, + fireShard, + blazePowder, + netherStar, + blazePowder, + nitor, + blazePowder); ThaumcraftApi.getCraftingRecipes().add(infusion); (recipes[5])[i] = infusion; ItemStack spiderEye = new ItemStack(Items.spider_eye); ItemStack rottenFlesh = new ItemStack(Items.rotten_flesh); - //Poison 0 -> 1 + // Poison 0 -> 1 famIn = new ItemStack(etherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(famIn, a); - infusion = new EtherealFamiliarUpgradeRecipe(modid + ".FAMILIAR_POISON", 5, - new AspectList().add(Aspect.WATER, 16).add(a, 14).add(Aspect.POISON, 8).add(Aspect.ELDRITCH, 4), - famIn, FamiliarAugment.POISON, 0, - wispyEssence, spiderEye, wispyEssence, rottenFlesh, - wispyEssence, spiderEye, wispyEssence, rottenFlesh); + infusion = new EtherealFamiliarUpgradeRecipe( + modid + ".FAMILIAR_POISON", + 5, + new AspectList() + .add(Aspect.WATER, 16) + .add(a, 14) + .add(Aspect.POISON, 8) + .add(Aspect.ELDRITCH, 4), + famIn, + FamiliarAugment.POISON, + 0, + wispyEssence, + spiderEye, + wispyEssence, + rottenFlesh, + wispyEssence, + spiderEye, + wispyEssence, + rottenFlesh); ThaumcraftApi.getCraftingRecipes().add(infusion); (recipes[6])[i] = infusion; @@ -468,86 +1187,197 @@ public class RegisteredRecipes { ItemStack sugarCane = new ItemStack(Items.reeds); ItemStack pumpkinSeeds = new ItemStack(Items.pumpkin_seeds); - //Poison 1 -> 2 + // Poison 1 -> 2 famIn = new ItemStack(etherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(famIn, a); ItemEtherealFamiliar.addAugmentUnsafe(famIn, FamiliarAugment.POISON, 1); - infusion = new EtherealFamiliarUpgradeRecipe(modid + ".FAMILIAR_POISON", 7, - new AspectList().add(a, 26).add(Aspect.POISON, 28).add(Aspect.ELDRITCH, 12).add(Aspect.WATER, 22).add(Aspect.AURA, 8), - famIn, FamiliarAugment.POISON, 1, - wispyEssence, fermentedSpiderEye, enderPearl, wispyEssence, sugarCane, pumpkinSeeds, - wispyEssence, fermentedSpiderEye, enderPearl, wispyEssence, sugarCane, pumpkinSeeds); + infusion = new EtherealFamiliarUpgradeRecipe( + modid + ".FAMILIAR_POISON", + 7, + new AspectList() + .add(a, 26) + .add(Aspect.POISON, 28) + .add(Aspect.ELDRITCH, 12) + .add(Aspect.WATER, 22) + .add(Aspect.AURA, 8), + famIn, + FamiliarAugment.POISON, + 1, + wispyEssence, + fermentedSpiderEye, + enderPearl, + wispyEssence, + sugarCane, + pumpkinSeeds, + wispyEssence, + fermentedSpiderEye, + enderPearl, + wispyEssence, + sugarCane, + pumpkinSeeds); ThaumcraftApi.getCraftingRecipes().add(infusion); (recipes[7])[i] = infusion; ItemStack netherWarts = new ItemStack(Items.nether_wart); - //Poison 2 -> 3 + // Poison 2 -> 3 famIn = new ItemStack(etherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(famIn, a); ItemEtherealFamiliar.addAugmentUnsafe(famIn, FamiliarAugment.POISON, 2); - infusion = new EtherealFamiliarUpgradeRecipe(modid + ".FAMILIAR_POISON", 9, - new AspectList().add(a, 36).add(Aspect.POISON, 38).add(Aspect.ELDRITCH, 22).add(Aspect.WATER, 48).add(Aspect.AURA, 36), - famIn, FamiliarAugment.POISON, 2, - wispyEssence, netherWarts, rottenFlesh, netherWarts, spiderEye, netherWarts, netherStar, netherWarts, - wispyEssence, netherWarts, rottenFlesh, netherWarts, spiderEye, netherWarts, netherStar, netherWarts); + infusion = new EtherealFamiliarUpgradeRecipe( + modid + ".FAMILIAR_POISON", + 9, + new AspectList() + .add(a, 36) + .add(Aspect.POISON, 38) + .add(Aspect.ELDRITCH, 22) + .add(Aspect.WATER, 48) + .add(Aspect.AURA, 36), + famIn, + FamiliarAugment.POISON, + 2, + wispyEssence, + netherWarts, + rottenFlesh, + netherWarts, + spiderEye, + netherWarts, + netherStar, + netherWarts, + wispyEssence, + netherWarts, + rottenFlesh, + netherWarts, + spiderEye, + netherWarts, + netherStar, + netherWarts); ThaumcraftApi.getCraftingRecipes().add(infusion); (recipes[8])[i] = infusion; ItemStack deadBush = new ItemStack(Blocks.deadbush); ItemStack string = new ItemStack(Items.string); - //Enervation 0 -> 1 + // Enervation 0 -> 1 famIn = new ItemStack(etherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(famIn, a); - infusion = new EtherealFamiliarUpgradeRecipe(modid + ".FAMILIAR_WEAKNESS", 6, - new AspectList().add(a, 12).add(Aspect.DEATH, 18).add(Aspect.AURA, 6).add(Aspect.ELDRITCH, 18).add(Aspect.ENTROPY, 8), - famIn, FamiliarAugment.WEAKNESS, 0, - wispyEssence, deadBush, wispyEssence, string, - wispyEssence, deadBush, wispyEssence, string); + infusion = new EtherealFamiliarUpgradeRecipe( + modid + ".FAMILIAR_WEAKNESS", + 6, + new AspectList() + .add(a, 12) + .add(Aspect.DEATH, 18) + .add(Aspect.AURA, 6) + .add(Aspect.ELDRITCH, 18) + .add(Aspect.ENTROPY, 8), + famIn, + FamiliarAugment.WEAKNESS, + 0, + wispyEssence, + deadBush, + wispyEssence, + string, + wispyEssence, + deadBush, + wispyEssence, + string); ThaumcraftApi.getCraftingRecipes().add(infusion); (recipes[9])[i] = infusion; ItemStack witherSkull = new ItemStack(Items.skull, 1, 1); - //Enervation 1 -> 2 + // Enervation 1 -> 2 famIn = new ItemStack(etherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(famIn, a); ItemEtherealFamiliar.addAugmentUnsafe(famIn, FamiliarAugment.WEAKNESS, 1); - infusion = new EtherealFamiliarUpgradeRecipe(modid + ".FAMILIAR_WEAKNESS", 8, - new AspectList().add(a, 30).add(Aspect.DEATH, 28).add(Aspect.AURA, 26).add(Aspect.ELDRITCH, 28).add(Aspect.ENTROPY, 48).add(Aspect.TRAP, 14), - famIn, FamiliarAugment.WEAKNESS, 1, - wispyEssence, rottenFlesh, witherSkull, rottenFlesh, - wispyEssence, rottenFlesh, witherSkull, rottenFlesh); + infusion = new EtherealFamiliarUpgradeRecipe( + modid + ".FAMILIAR_WEAKNESS", + 8, + new AspectList() + .add(a, 30) + .add(Aspect.DEATH, 28) + .add(Aspect.AURA, 26) + .add(Aspect.ELDRITCH, 28) + .add(Aspect.ENTROPY, 48) + .add(Aspect.TRAP, 14), + famIn, + FamiliarAugment.WEAKNESS, + 1, + wispyEssence, + rottenFlesh, + witherSkull, + rottenFlesh, + wispyEssence, + rottenFlesh, + witherSkull, + rottenFlesh); ThaumcraftApi.getCraftingRecipes().add(infusion); (recipes[10])[i] = infusion; ItemStack entropyShard = new ItemStack(ConfigItems.itemShard, 1, 5); ItemStack enderEye = new ItemStack(Items.ender_eye); - //Enervation 2 -> 3 + // Enervation 2 -> 3 famIn = new ItemStack(etherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(famIn, a); ItemEtherealFamiliar.addAugmentUnsafe(famIn, FamiliarAugment.WEAKNESS, 2); - infusion = new EtherealFamiliarUpgradeRecipe(modid + ".FAMILIAR_WEAKNESS", 10, - new AspectList().add(a, 46).add(Aspect.DEATH, 42).add(Aspect.AURA, 38).add(Aspect.ELDRITCH, 20).add(Aspect.ENTROPY, 56).add(Aspect.TRAP, 32), - famIn, FamiliarAugment.WEAKNESS, 2, - wispyEssence, enderEye, entropyShard, entropyShard, wispyEssence, enderEye, netherStar, entropyShard, - wispyEssence, enderEye, entropyShard, entropyShard, wispyEssence, enderEye, netherStar, entropyShard); + infusion = new EtherealFamiliarUpgradeRecipe( + modid + ".FAMILIAR_WEAKNESS", + 10, + new AspectList() + .add(a, 46) + .add(Aspect.DEATH, 42) + .add(Aspect.AURA, 38) + .add(Aspect.ELDRITCH, 20) + .add(Aspect.ENTROPY, 56) + .add(Aspect.TRAP, 32), + famIn, + FamiliarAugment.WEAKNESS, + 2, + wispyEssence, + enderEye, + entropyShard, + entropyShard, + wispyEssence, + enderEye, + netherStar, + entropyShard, + wispyEssence, + enderEye, + entropyShard, + entropyShard, + wispyEssence, + enderEye, + netherStar, + entropyShard); ThaumcraftApi.getCraftingRecipes().add(infusion); (recipes[11])[i] = infusion; ItemStack balancedShard = new ItemStack(ConfigItems.itemResource, 1, 6); ItemStack gunpowder = new ItemStack(Items.gunpowder); - //Damage 0 -> 1 + // Damage 0 -> 1 famIn = new ItemStack(etherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(famIn, a); - infusion = new EtherealFamiliarUpgradeRecipe(modid + ".FAMILIAR_DAMAGE", 6, - new AspectList().add(a, 14).add(Aspect.WEAPON, 10).add(Aspect.ENERGY, 12).add(Aspect.FIRE, 16), - famIn, FamiliarAugment.DAMAGE_INCREASE, 0, - wispyEssence, balancedShard, wispyEssence, gunpowder, - wispyEssence, balancedShard, wispyEssence, gunpowder); + infusion = new EtherealFamiliarUpgradeRecipe( + modid + ".FAMILIAR_DAMAGE", + 6, + new AspectList() + .add(a, 14) + .add(Aspect.WEAPON, 10) + .add(Aspect.ENERGY, 12) + .add(Aspect.FIRE, 16), + famIn, + FamiliarAugment.DAMAGE_INCREASE, + 0, + wispyEssence, + balancedShard, + wispyEssence, + gunpowder, + wispyEssence, + balancedShard, + wispyEssence, + gunpowder); ThaumcraftApi.getCraftingRecipes().add(infusion); (recipes[12])[i] = infusion; @@ -555,82 +1385,200 @@ public class RegisteredRecipes { ItemStack voidSeed = new ItemStack(ConfigItems.itemResource, 1, 17); ItemStack amberBlock = new ItemStack(ConfigBlocks.blockCosmeticOpaque, 1, 0); - //Damage 1 -> 2 + // Damage 1 -> 2 famIn = new ItemStack(etherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(famIn, a); ItemEtherealFamiliar.addAugmentUnsafe(famIn, FamiliarAugment.DAMAGE_INCREASE, 1); - infusion = new EtherealFamiliarUpgradeRecipe(modid + ".FAMILIAR_DAMAGE", 10, - new AspectList().add(a, 22).add(Aspect.WEAPON, 28).add(Aspect.ENERGY, 34).add(Aspect.FIRE, 30).add(Aspect.AURA, 14), - famIn, FamiliarAugment.DAMAGE_INCREASE, 1, - wispyEssence, balancedShard, primalCharm, wispyEssence, voidSeed, amberBlock, - wispyEssence, balancedShard, primalCharm, wispyEssence, voidSeed, amberBlock); + infusion = new EtherealFamiliarUpgradeRecipe( + modid + ".FAMILIAR_DAMAGE", + 10, + new AspectList() + .add(a, 22) + .add(Aspect.WEAPON, 28) + .add(Aspect.ENERGY, 34) + .add(Aspect.FIRE, 30) + .add(Aspect.AURA, 14), + famIn, + FamiliarAugment.DAMAGE_INCREASE, + 1, + wispyEssence, + balancedShard, + primalCharm, + wispyEssence, + voidSeed, + amberBlock, + wispyEssence, + balancedShard, + primalCharm, + wispyEssence, + voidSeed, + amberBlock); ThaumcraftApi.getCraftingRecipes().add(infusion); (recipes[13])[i] = infusion; ItemStack voidSword = new ItemStack(ConfigItems.itemSwordVoid); - //Damage 2 -> 3 + // Damage 2 -> 3 famIn = new ItemStack(etherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(famIn, a); ItemEtherealFamiliar.addAugmentUnsafe(famIn, FamiliarAugment.DAMAGE_INCREASE, 2); - infusion = new EtherealFamiliarUpgradeRecipe(modid + ".FAMILIAR_DAMAGE", 10, - new AspectList().add(a, 34).add(Aspect.WEAPON, 38).add(Aspect.ENERGY, 46).add(Aspect.FIRE, 58).add(Aspect.AURA, 38), - famIn, FamiliarAugment.DAMAGE_INCREASE, 2, - wispyEssence, blazePowder, voidSword, blazePowder, netherStar, blazePowder, alumentum, blazePowder, - wispyEssence, blazePowder, voidSword, blazePowder, netherStar, blazePowder, alumentum, blazePowder); + infusion = new EtherealFamiliarUpgradeRecipe( + modid + ".FAMILIAR_DAMAGE", + 10, + new AspectList() + .add(a, 34) + .add(Aspect.WEAPON, 38) + .add(Aspect.ENERGY, 46) + .add(Aspect.FIRE, 58) + .add(Aspect.AURA, 38), + famIn, + FamiliarAugment.DAMAGE_INCREASE, + 2, + wispyEssence, + blazePowder, + voidSword, + blazePowder, + netherStar, + blazePowder, + alumentum, + blazePowder, + wispyEssence, + blazePowder, + voidSword, + blazePowder, + netherStar, + blazePowder, + alumentum, + blazePowder); ThaumcraftApi.getCraftingRecipes().add(infusion); (recipes[14])[i] = infusion; ItemStack ordoShard = new ItemStack(ConfigItems.itemShard, 1, 4); - //Range 0 -> 1 + // Range 0 -> 1 famIn = new ItemStack(etherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(famIn, a); - infusion = new EtherealFamiliarUpgradeRecipe(modid + ".FAMILIAR_RANGE", 6, - new AspectList().add(a, 24).add(Aspect.AURA, 30).add(Aspect.ELDRITCH, 22).add(Aspect.WEAPON, 12), - famIn, FamiliarAugment.RANGE_INCREASE, 0, - wispyEssence, ordoShard, wispyEssence, primalCharm, - wispyEssence, ordoShard, wispyEssence, primalCharm); + infusion = new EtherealFamiliarUpgradeRecipe( + modid + ".FAMILIAR_RANGE", + 6, + new AspectList() + .add(a, 24) + .add(Aspect.AURA, 30) + .add(Aspect.ELDRITCH, 22) + .add(Aspect.WEAPON, 12), + famIn, + FamiliarAugment.RANGE_INCREASE, + 0, + wispyEssence, + ordoShard, + wispyEssence, + primalCharm, + wispyEssence, + ordoShard, + wispyEssence, + primalCharm); ThaumcraftApi.getCraftingRecipes().add(infusion); (recipes[15])[i] = infusion; - //Range 1 -> 2 + // Range 1 -> 2 famIn = new ItemStack(etherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(famIn, a); ItemEtherealFamiliar.addAugmentUnsafe(famIn, FamiliarAugment.RANGE_INCREASE, 1); - infusion = new EtherealFamiliarUpgradeRecipe(modid + ".FAMILIAR_RANGE", 9, - new AspectList().add(a, 42).add(Aspect.AURA, 36).add(Aspect.ELDRITCH, 34).add(Aspect.WEAPON, 28).add(Aspect.AIR, 40), - famIn, FamiliarAugment.RANGE_INCREASE, 1, - wispyEssence, nitor, balancedShard, quicksilver, netherStar, alumentum, balancedShard, quicksilver, - wispyEssence, nitor, balancedShard, quicksilver, netherStar, alumentum, balancedShard, quicksilver); + infusion = new EtherealFamiliarUpgradeRecipe( + modid + ".FAMILIAR_RANGE", + 9, + new AspectList() + .add(a, 42) + .add(Aspect.AURA, 36) + .add(Aspect.ELDRITCH, 34) + .add(Aspect.WEAPON, 28) + .add(Aspect.AIR, 40), + famIn, + FamiliarAugment.RANGE_INCREASE, + 1, + wispyEssence, + nitor, + balancedShard, + quicksilver, + netherStar, + alumentum, + balancedShard, + quicksilver, + wispyEssence, + nitor, + balancedShard, + quicksilver, + netherStar, + alumentum, + balancedShard, + quicksilver); ThaumcraftApi.getCraftingRecipes().add(infusion); (recipes[16])[i] = infusion; ItemStack elementalSword = new ItemStack(ConfigItems.itemSwordElemental); - //Speed 0 -> 1 + // Speed 0 -> 1 famIn = new ItemStack(etherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(famIn, a); - infusion = new EtherealFamiliarUpgradeRecipe(modid + ".FAMILIAR_SPEED", 6, - new AspectList().add(a, 30).add(Aspect.AURA, 28).add(Aspect.MOTION, 38).add(Aspect.ELDRITCH, 20).add(Aspect.AIR, 36), - famIn, FamiliarAugment.ATTACK_SPEED, 0, - elementalSword, balancedShard, wispyEssence, balancedShard, - wispyEssence, balancedShard, wispyEssence, balancedShard); + infusion = new EtherealFamiliarUpgradeRecipe( + modid + ".FAMILIAR_SPEED", + 6, + new AspectList() + .add(a, 30) + .add(Aspect.AURA, 28) + .add(Aspect.MOTION, 38) + .add(Aspect.ELDRITCH, 20) + .add(Aspect.AIR, 36), + famIn, + FamiliarAugment.ATTACK_SPEED, + 0, + elementalSword, + balancedShard, + wispyEssence, + balancedShard, + wispyEssence, + balancedShard, + wispyEssence, + balancedShard); ThaumcraftApi.getCraftingRecipes().add(infusion); (recipes[17])[i] = infusion; ItemStack primordialPearl = new ItemStack(ConfigItems.itemEldritchObject, 1, 3); ItemStack salisMundis = new ItemStack(ConfigItems.itemResource, 1, 14); - //Speed 1 -> 2 + // Speed 1 -> 2 famIn = new ItemStack(etherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(famIn, a); ItemEtherealFamiliar.addAugmentUnsafe(famIn, FamiliarAugment.ATTACK_SPEED, 1); - infusion = new EtherealFamiliarUpgradeRecipe(modid + ".FAMILIAR_SPEED", 9, - new AspectList().add(a, 46).add(Aspect.AURA, 38).add(Aspect.MOTION, 52).add(Aspect.ELDRITCH, 38).add(Aspect.AIR, 48).add(Aspect.WEAPON, 28), - famIn, FamiliarAugment.ATTACK_SPEED, 1, - wispyEssence, primalCharm, netherStar, salisMundis, wispyEssence, primalCharm, primordialPearl, salisMundis, - wispyEssence, primalCharm, netherStar, salisMundis, wispyEssence, primalCharm, primordialPearl, salisMundis); + infusion = new EtherealFamiliarUpgradeRecipe( + modid + ".FAMILIAR_SPEED", + 9, + new AspectList() + .add(a, 46) + .add(Aspect.AURA, 38) + .add(Aspect.MOTION, 52) + .add(Aspect.ELDRITCH, 38) + .add(Aspect.AIR, 48) + .add(Aspect.WEAPON, 28), + famIn, + FamiliarAugment.ATTACK_SPEED, + 1, + wispyEssence, + primalCharm, + netherStar, + salisMundis, + wispyEssence, + primalCharm, + primordialPearl, + salisMundis, + wispyEssence, + primalCharm, + netherStar, + salisMundis, + wispyEssence, + primalCharm, + primordialPearl, + salisMundis); ThaumcraftApi.getCraftingRecipes().add(infusion); (recipes[18])[i] = infusion; } @@ -651,9 +1599,20 @@ public class RegisteredRecipes { result = new ItemStack(RegisteredItems.itemEtherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(result, aspect); - recipes[i] = ThaumcraftApi.addInfusionCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".ETHEREAL_FAMILIAR", - result, 4, new AspectList().add(aspect, 10).add(Aspect.AURA, 12).add(Aspect.MAGIC, 18), new ItemStack(ConfigItems.itemAmuletRunic, 1, 0), - new ItemStack[] { wispyEssence, new ItemStack(ConfigItems.itemResource, 1, 14), new ItemStack(ConfigItems.itemResource, 1, 1), wispyEssence, new ItemStack(ConfigItems.itemResource, 1, 14), new ItemStack(ConfigItems.itemResource, 1, 1) }); + recipes[i] = ThaumcraftApi.addInfusionCraftingRecipe( + Gadomancy.MODID.toUpperCase() + ".ETHEREAL_FAMILIAR", + result, + 4, + new AspectList().add(aspect, 10).add(Aspect.AURA, 12).add(Aspect.MAGIC, 18), + new ItemStack(ConfigItems.itemAmuletRunic, 1, 0), + new ItemStack[] { + wispyEssence, + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 1), + wispyEssence, + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 1) + }); } return recipes; } diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredResearches.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredResearches.java index c9e39a1..9d54e98 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredResearches.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredResearches.java @@ -48,11 +48,11 @@ public class RegisteredResearches { public static ResearchItem researchEldritchPortalCreator; public static ResearchItem researchBlockProtector; - //Enchantment stuff + // Enchantment stuff public static ResearchItem researchRevealer; public static ResearchItem researchArmorDisguise; - //Aura core stuff + // Aura core stuff public static ResearchItem researchAuraCore; public static ResearchItem researchCleanAuraCore; public static ResearchItem researchArcanePackager; @@ -62,17 +62,17 @@ public class RegisteredResearches { public static ResearchItem researchEssentiaCompressor; public static ResearchItem researchAiShutdown; - //Skyblock Helper + // Skyblock Helper public static ResearchItem researchAncientStones; - //Growing nodes stuff + // Growing nodes stuff public static ResearchItem researchGrowingNodes; public static ResearchItem researchGrowingNodeAgression; public static ResearchItem researchGrowingNodeGrowth; public static ResearchItem researchGrowingNodeAttackNodes; public static ResearchItem researchGrowingNodeGrowthClue; - //Familiar + // Familiar public static ResearchItem researchEtherealFamiliar; public static ResearchItem researchFamiliarElementLightning; public static ResearchItem researchFamiliarElementFire; @@ -84,188 +84,514 @@ public class RegisteredResearches { public static void init() { - ResearchCategories.registerCategory(Gadomancy.MODID, RegisteredResearches.CATEGORY_ICON, RegisteredResearches.CATEGORY_BACKGROUND); + ResearchCategories.registerCategory( + Gadomancy.MODID, RegisteredResearches.CATEGORY_ICON, RegisteredResearches.CATEGORY_BACKGROUND); - ResearchItem researchTallowGolem = PseudoResearchItem.create("GOLEMTALLOW", 0, -5).registerResearchItem(); + ResearchItem researchTallowGolem = + PseudoResearchItem.create("GOLEMTALLOW", 0, -5).registerResearchItem(); - RegisteredResearches.researchGolemSilverwood = new SimpleResearchItem("GOLEMSILVERWOOD", 1, -2, 3, (ItemStack) RegisteredRecipes.recipeGolemSilverwood.getRecipeOutput(), - new AspectList().add(Aspect.MOTION, 10).add(Aspect.TREE, 10).add(Aspect.MAGIC, 8).add(Aspect.ORDER, 8).add(Aspect.FLESH, 6).add(Aspect.EXCHANGE, 5)) - .setParents(researchTallowGolem.key).setConcealed() - .setPages(new ResearchPage("gadomancy.research_page.GOLEMSILVERWOOD.1"), new ResearchPage(RegisteredRecipes.recipeGolemSilverwood)).registerResearchItem(); + RegisteredResearches.researchGolemSilverwood = new SimpleResearchItem( + "GOLEMSILVERWOOD", + 1, + -2, + 3, + (ItemStack) RegisteredRecipes.recipeGolemSilverwood.getRecipeOutput(), + new AspectList() + .add(Aspect.MOTION, 10) + .add(Aspect.TREE, 10) + .add(Aspect.MAGIC, 8) + .add(Aspect.ORDER, 8) + .add(Aspect.FLESH, 6) + .add(Aspect.EXCHANGE, 5)) + .setParents(researchTallowGolem.key) + .setConcealed() + .setPages( + new ResearchPage("gadomancy.research_page.GOLEMSILVERWOOD.1"), + new ResearchPage(RegisteredRecipes.recipeGolemSilverwood)) + .registerResearchItem(); - RegisteredResearches.researchGolemRunicShield = new SimpleResearchItem("GOLEMRUNICSHIELD", 0, 0, 4, new ItemStack(RegisteredItems.itemFakeGolemShield, 1, 32767), - new AspectList().add(Aspect.AURA, 16).add(Aspect.ARMOR, 6).add(Aspect.MAGIC, 4).add(Aspect.MOTION, 8)) - .setParents(RegisteredResearches.researchGolemSilverwood.key).setConcealed() - .setPages(new ResearchPage("gadomancy.research_page.GOLEMRUNICSHIELD.1"), new ResearchPage(RegisteredRecipes.recipesGolemRunicShield)).registerResearchItem(); + RegisteredResearches.researchGolemRunicShield = new SimpleResearchItem( + "GOLEMRUNICSHIELD", + 0, + 0, + 4, + new ItemStack(RegisteredItems.itemFakeGolemShield, 1, 32767), + new AspectList() + .add(Aspect.AURA, 16) + .add(Aspect.ARMOR, 6) + .add(Aspect.MAGIC, 4) + .add(Aspect.MOTION, 8)) + .setParents(RegisteredResearches.researchGolemSilverwood.key) + .setConcealed() + .setPages( + new ResearchPage("gadomancy.research_page.GOLEMRUNICSHIELD.1"), + new ResearchPage(RegisteredRecipes.recipesGolemRunicShield)) + .registerResearchItem(); - ResearchItem researchBellows = PseudoResearchItem.create("BELLOWS", -2, -5).registerResearchItem(); + ResearchItem researchBellows = + PseudoResearchItem.create("BELLOWS", -2, -5).registerResearchItem(); - RegisteredResearches.researchArcaneDropper = new SimpleResearchItem("ARCANEDROPPER", -1, -3, 2, new ItemStack(RegisteredBlocks.blockArcaneDropper), - new AspectList().add(Aspect.ORDER, 4).add(Aspect.AIR, 6).add(Aspect.EARTH, 5).add(Aspect.SENSES, 5).add(Aspect.MECHANISM, 7)) - .setParents("DISTILESSENTIA", researchBellows.key).setConcealed() - .setPages(new ResearchPage("gadomancy.research_page.ARCANEDROPPER.1"), new ResearchPage(RegisteredRecipes.recipeArcaneDropper)).registerResearchItem(); + RegisteredResearches.researchArcaneDropper = new SimpleResearchItem( + "ARCANEDROPPER", + -1, + -3, + 2, + new ItemStack(RegisteredBlocks.blockArcaneDropper), + new AspectList() + .add(Aspect.ORDER, 4) + .add(Aspect.AIR, 6) + .add(Aspect.EARTH, 5) + .add(Aspect.SENSES, 5) + .add(Aspect.MECHANISM, 7)) + .setParents("DISTILESSENTIA", researchBellows.key) + .setConcealed() + .setPages( + new ResearchPage("gadomancy.research_page.ARCANEDROPPER.1"), + new ResearchPage(RegisteredRecipes.recipeArcaneDropper)) + .registerResearchItem(); - ResearchItem researchHarvestGather = PseudoResearchItem.create("COREHARVEST", 2, -6).registerResearchItem(); - ResearchItem researchCoreGuard = PseudoResearchItem.create("COREGUARD", 4, -5).registerResearchItem(); + ResearchItem researchHarvestGather = + PseudoResearchItem.create("COREHARVEST", 2, -6).registerResearchItem(); + ResearchItem researchCoreGuard = + PseudoResearchItem.create("COREGUARD", 4, -5).registerResearchItem(); ResearchItem researchVEleToolAxe = new ResearchItem("ELEMENTALAXE", Gadomancy.MODID).registerResearchItem(); ResearchItem researchVEleToolPick = new ResearchItem("ELEMENTALPICK", Gadomancy.MODID).registerResearchItem(); - ResearchItem researchVEleToolShovel = new ResearchItem("ELEMENTALSHOVEL", Gadomancy.MODID).registerResearchItem(); + ResearchItem researchVEleToolShovel = + new ResearchItem("ELEMENTALSHOVEL", Gadomancy.MODID).registerResearchItem(); ResearchItem researchVEleSword = new ResearchItem("ELEMENTALSWORD", Gadomancy.MODID).registerResearchItem(); - RegisteredResearches.researchGolemCoreBreak = new SimpleResearchItem("GOLEMCOREBREAK", 3, -3, 3, new ItemStack(RegisteredItems.itemGolemCoreBreak), - new AspectList().add(Aspect.TOOL, 8).add(Aspect.ENTROPY, 8).add(Aspect.MECHANISM, 8)) - .setParents(researchHarvestGather.key, researchVEleToolAxe.key, researchVEleToolPick.key, researchVEleToolShovel.key).setConcealed() - .setPages(new ResearchPage("gadomancy.research_page.GOLEMCOREBREAK.1"), new ResearchPage(RegisteredRecipes.recipeGolemCoreBreak)).registerResearchItem(); + RegisteredResearches.researchGolemCoreBreak = new SimpleResearchItem( + "GOLEMCOREBREAK", + 3, + -3, + 3, + new ItemStack(RegisteredItems.itemGolemCoreBreak), + new AspectList() + .add(Aspect.TOOL, 8) + .add(Aspect.ENTROPY, 8) + .add(Aspect.MECHANISM, 8)) + .setParents( + researchHarvestGather.key, + researchVEleToolAxe.key, + researchVEleToolPick.key, + researchVEleToolShovel.key) + .setConcealed() + .setPages( + new ResearchPage("gadomancy.research_page.GOLEMCOREBREAK.1"), + new ResearchPage(RegisteredRecipes.recipeGolemCoreBreak)) + .registerResearchItem(); - ResearchItem researchVBootsTraveller = new ResearchItem("BOOTSTRAVELLER", Gadomancy.MODID).registerResearchItem(); + ResearchItem researchVBootsTraveller = + new ResearchItem("BOOTSTRAVELLER", Gadomancy.MODID).registerResearchItem(); - RegisteredResearches.researchGolemCoreBodyguard = new SimpleResearchItem("GOLEMCOREBODYGUARD", 5, -3, 2, new ItemStack(RegisteredItems.itemGolemCoreBreak, 1, 1), - new AspectList().add(Aspect.TOOL, 8).add(Aspect.ORDER, 8).add(Aspect.MECHANISM, 10).add(Aspect.ARMOR, 8).add(Aspect.WEAPON, 8)) - .setParents(researchVBootsTraveller.key, researchVEleSword.key, researchCoreGuard.key).setConcealed() - .setPages(new ResearchPage("gadomancy.research_page.GOLEMCOREBODYGUARD.1"), new ResearchPage(RegisteredRecipes.recipeGolemCoreBodyguard)).registerResearchItem(); + RegisteredResearches.researchGolemCoreBodyguard = new SimpleResearchItem( + "GOLEMCOREBODYGUARD", + 5, + -3, + 2, + new ItemStack(RegisteredItems.itemGolemCoreBreak, 1, 1), + new AspectList() + .add(Aspect.TOOL, 8) + .add(Aspect.ORDER, 8) + .add(Aspect.MECHANISM, 10) + .add(Aspect.ARMOR, 8) + .add(Aspect.WEAPON, 8)) + .setParents(researchVBootsTraveller.key, researchVEleSword.key, researchCoreGuard.key) + .setConcealed() + .setPages( + new ResearchPage("gadomancy.research_page.GOLEMCOREBODYGUARD.1"), + new ResearchPage(RegisteredRecipes.recipeGolemCoreBodyguard)) + .registerResearchItem(); ResearchItem researchVFocusPrimal = new ResearchItem("FOCUSPRIMAL", Gadomancy.MODID).registerResearchItem(); - ResearchItem researchItemVoidMetal = PseudoResearchItem.create("VOIDMETAL", -8, -6).registerResearchItem(); - ResearchItem researchWandPedestal = PseudoResearchItem.create("WANDPED", -9, -8).registerResearchItem(); + ResearchItem researchItemVoidMetal = + PseudoResearchItem.create("VOIDMETAL", -8, -6).registerResearchItem(); + ResearchItem researchWandPedestal = + PseudoResearchItem.create("WANDPED", -9, -8).registerResearchItem(); ResearchItem researchVWardingStone = new ResearchItem("PAVEWARD", Gadomancy.MODID).registerResearchItem(); ResearchItem researchVNodeStabilizer = new ResearchItem("WANDPEDFOC", Gadomancy.MODID).registerResearchItem(); ResearchItem researchVCoreUse = new ResearchItem("COREUSE", Gadomancy.MODID).registerResearchItem(); ResearchItem researchVRunicShielding = new ResearchItem("RUNICARMOR", Gadomancy.MODID).registerResearchItem(); - ResearchItem researchOculus = PseudoResearchItem.create("OCULUS", -11, -2).setRound().setSpecial().registerResearchItem(); + ResearchItem researchOculus = PseudoResearchItem.create("OCULUS", -11, -2) + .setRound() + .setSpecial() + .registerResearchItem(); - RegisteredResearches.researchInfusionClaw = new SimpleResearchItem("INFUSIONCLAW", -6, -7, 5, new ItemStack(RegisteredBlocks.blockInfusionClaw), - new AspectList().add(Aspect.ELDRITCH, 8).add(Aspect.MECHANISM, 8).add(Aspect.MAGIC, 8).add(Aspect.ORDER, 8).add(Aspect.DARKNESS, 4)) - .setParents(researchVFocusPrimal.key, researchItemVoidMetal.key, researchWandPedestal.key, researchVCoreUse.key).setConcealed() - .setPages(new ResearchPage("gadomancy.research_page.INFUSIONCLAW.1"), new ResearchPage(RegisteredRecipes.recipeInfusionClaw), new ResearchPage("gadomancy.research_page.INFUSIONCLAW.2")).registerResearchItem(); - - RegisteredResearches.researchNodeManipulator = new SimpleResearchItem("NODE_MANIPULATOR", -9, -4, 2, new ItemStack(RegisteredBlocks.blockNodeManipulator, 1, 5), - new AspectList().add(Aspect.ELDRITCH, 8).add(Aspect.AURA, 6).add(Aspect.DARKNESS, 4).add(Aspect.MAGIC, 8).add(Aspect.GREED, 4).add(Aspect.VOID, 10).add(Aspect.MECHANISM, 6).add(Aspect.EXCHANGE, 4)) - .setConcealed().setSpecial() - .setParents(researchItemVoidMetal.key, researchVNodeStabilizer.key, researchVWardingStone.key, researchWandPedestal.key) - .setPages(new ResearchPage("gadomancy.research_page.NODE_MANIPULATOR.1"), new ResearchPage(RegisteredRecipes.recipeNodeManipulator), new ResearchPage("gadomancy.research_page.NODE_MANIPULATOR.3"), new ResearchPage(RegisteredRecipes.recipeRandomizationFocus), new ResearchPage(RegisteredRecipes.multiblockNodeManipulator), new ResearchPage("gadomancy.research_page.NODE_MANIPULATOR.6")).registerResearchItem(); - - RegisteredResearches.researchEldritchPortalCreator = new SimpleResearchItem("E_PORTAL_CREATOR", -10, 0, 2, new ItemStack(RegisteredBlocks.blockAdditionalEldrichPortal, 1, 0), - new AspectList().add(Aspect.ELDRITCH, 6).add(Aspect.DARKNESS, 10).add(Aspect.TRAVEL, 8).add(Aspect.AURA, 10).add(Aspect.VOID, 6).add(Aspect.MECHANISM, 4)) - .setConcealed().setSpecial() - .setParents(RegisteredResearches.researchNodeManipulator.key, researchOculus.key) - .setPages(new ResearchPage("gadomancy.research_page.E_PORTAL_CREATOR.1"), new ResearchPage(RegisteredRecipes.recipeAncientPedestal), new ResearchPage("gadomancy.research_page.E_PORTAL_CREATOR.3"), new ResearchPage("gadomancy.research_page.E_PORTAL_CREATOR.4"), new ResearchPage(RegisteredRecipes.recipePortalFocus), new ResearchPage("gadomancy.research_page.E_PORTAL_CREATOR.6"), new ResearchPage(RegisteredRecipes.multiblockEldritchPortalCreator), new ResearchPage("gadomancy.research_page.E_PORTAL_CREATOR.8")).registerResearchItem(); - - RegisteredResearches.researchBlockProtector = new SimpleResearchItem("BLOCK_PROTECTOR", -6, -2, 2, new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 2), - new AspectList().add(Aspect.ORDER, 10).add(Aspect.ARMOR, 8).add(Aspect.EARTH, 12).add(Aspect.LIGHT, 10).add(Aspect.AURA, 8)) + RegisteredResearches.researchInfusionClaw = new SimpleResearchItem( + "INFUSIONCLAW", + -6, + -7, + 5, + new ItemStack(RegisteredBlocks.blockInfusionClaw), + new AspectList() + .add(Aspect.ELDRITCH, 8) + .add(Aspect.MECHANISM, 8) + .add(Aspect.MAGIC, 8) + .add(Aspect.ORDER, 8) + .add(Aspect.DARKNESS, 4)) + .setParents( + researchVFocusPrimal.key, + researchItemVoidMetal.key, + researchWandPedestal.key, + researchVCoreUse.key) .setConcealed() - .setPages(new ResearchPage("gadomancy.research_page.BLOCK_PROTECTOR.1"), new ResearchPage(RegisteredRecipes.recipeBlockProtector), new ResearchPage("gadomancy.research_page.BLOCK_PROTECTOR.3"), new ResearchPage("gadomancy.research_page.BLOCK_PROTECTOR.4")).registerResearchItem(); + .setPages( + new ResearchPage("gadomancy.research_page.INFUSIONCLAW.1"), + new ResearchPage(RegisteredRecipes.recipeInfusionClaw), + new ResearchPage("gadomancy.research_page.INFUSIONCLAW.2")) + .registerResearchItem(); + + RegisteredResearches.researchNodeManipulator = new SimpleResearchItem( + "NODE_MANIPULATOR", + -9, + -4, + 2, + new ItemStack(RegisteredBlocks.blockNodeManipulator, 1, 5), + new AspectList() + .add(Aspect.ELDRITCH, 8) + .add(Aspect.AURA, 6) + .add(Aspect.DARKNESS, 4) + .add(Aspect.MAGIC, 8) + .add(Aspect.GREED, 4) + .add(Aspect.VOID, 10) + .add(Aspect.MECHANISM, 6) + .add(Aspect.EXCHANGE, 4)) + .setConcealed() + .setSpecial() + .setParents( + researchItemVoidMetal.key, + researchVNodeStabilizer.key, + researchVWardingStone.key, + researchWandPedestal.key) + .setPages( + new ResearchPage("gadomancy.research_page.NODE_MANIPULATOR.1"), + new ResearchPage(RegisteredRecipes.recipeNodeManipulator), + new ResearchPage("gadomancy.research_page.NODE_MANIPULATOR.3"), + new ResearchPage(RegisteredRecipes.recipeRandomizationFocus), + new ResearchPage(RegisteredRecipes.multiblockNodeManipulator), + new ResearchPage("gadomancy.research_page.NODE_MANIPULATOR.6")) + .registerResearchItem(); + + RegisteredResearches.researchEldritchPortalCreator = new SimpleResearchItem( + "E_PORTAL_CREATOR", + -10, + 0, + 2, + new ItemStack(RegisteredBlocks.blockAdditionalEldrichPortal, 1, 0), + new AspectList() + .add(Aspect.ELDRITCH, 6) + .add(Aspect.DARKNESS, 10) + .add(Aspect.TRAVEL, 8) + .add(Aspect.AURA, 10) + .add(Aspect.VOID, 6) + .add(Aspect.MECHANISM, 4)) + .setConcealed() + .setSpecial() + .setParents(RegisteredResearches.researchNodeManipulator.key, researchOculus.key) + .setPages( + new ResearchPage("gadomancy.research_page.E_PORTAL_CREATOR.1"), + new ResearchPage(RegisteredRecipes.recipeAncientPedestal), + new ResearchPage("gadomancy.research_page.E_PORTAL_CREATOR.3"), + new ResearchPage("gadomancy.research_page.E_PORTAL_CREATOR.4"), + new ResearchPage(RegisteredRecipes.recipePortalFocus), + new ResearchPage("gadomancy.research_page.E_PORTAL_CREATOR.6"), + new ResearchPage(RegisteredRecipes.multiblockEldritchPortalCreator), + new ResearchPage("gadomancy.research_page.E_PORTAL_CREATOR.8")) + .registerResearchItem(); + + RegisteredResearches.researchBlockProtector = new SimpleResearchItem( + "BLOCK_PROTECTOR", + -6, + -2, + 2, + new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 2), + new AspectList() + .add(Aspect.ORDER, 10) + .add(Aspect.ARMOR, 8) + .add(Aspect.EARTH, 12) + .add(Aspect.LIGHT, 10) + .add(Aspect.AURA, 8)) + .setConcealed() + .setPages( + new ResearchPage("gadomancy.research_page.BLOCK_PROTECTOR.1"), + new ResearchPage(RegisteredRecipes.recipeBlockProtector), + new ResearchPage("gadomancy.research_page.BLOCK_PROTECTOR.3"), + new ResearchPage("gadomancy.research_page.BLOCK_PROTECTOR.4")) + .registerResearchItem(); ItemStack displayFamiliar = new ItemStack(RegisteredItems.itemEtherealFamiliar); ItemEtherealFamiliar.setFamiliarAspect(displayFamiliar, Aspect.MAGIC); - RegisteredResearches.researchEtherealFamiliar = new SimpleResearchItem("ETHEREAL_FAMILIAR", 5, 1, 2, displayFamiliar, - new AspectList().add(Aspect.MAGIC, 8).add(Aspect.FIRE, 6).add(Aspect.AURA, 4)) - .setConcealed().setSpecial() + RegisteredResearches.researchEtherealFamiliar = new SimpleResearchItem( + "ETHEREAL_FAMILIAR", + 5, + 1, + 2, + displayFamiliar, + new AspectList() + .add(Aspect.MAGIC, 8) + .add(Aspect.FIRE, 6) + .add(Aspect.AURA, 4)) + .setConcealed() + .setSpecial() .setParents(researchVRunicShielding.key) - .setPages(new ResearchPage("gadomancy.research_page.ETHEREAL_FAMILIAR.1"), new ResearchPage(RegisteredRecipes.recipesFamiliar), + .setPages( + new ResearchPage("gadomancy.research_page.ETHEREAL_FAMILIAR.1"), + new ResearchPage(RegisteredRecipes.recipesFamiliar), new ResearchPage("gadomancy.research_page.ETHEREAL_FAMILIAR.3")) .registerResearchItem(); - RegisteredResearches.researchFamiliarElementLightning = new SimpleResearchItem("FAMILIAR_SHOCK", 4, -1, 2, new ResourceLocation("gadomancy", "textures/misc/Fam_Lightning.png"), - new AspectList().add(Aspect.WEATHER, 4).add(Aspect.WEAPON, 4).add(Aspect.AIR, 8)) + RegisteredResearches.researchFamiliarElementLightning = new SimpleResearchItem( + "FAMILIAR_SHOCK", + 4, + -1, + 2, + new ResourceLocation("gadomancy", "textures/misc/Fam_Lightning.png"), + new AspectList() + .add(Aspect.WEATHER, 4) + .add(Aspect.WEAPON, 4) + .add(Aspect.AIR, 8)) .setConcealed() .setParents(RegisteredResearches.researchEtherealFamiliar.key) - .setPages(new ResearchPage("gadomancy.research_page.FAMILIAR_SHOCK.1"), new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[0]), - new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[1]), new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[2])) + .setPages( + new ResearchPage("gadomancy.research_page.FAMILIAR_SHOCK.1"), + new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[0]), + new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[1]), + new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[2])) .registerResearchItem(); - RegisteredResearches.researchFamiliarElementFire = new SimpleResearchItem("FAMILIAR_FIRE", 6, -1, 2, new ResourceLocation("gadomancy", "textures/misc/Fam_Fire.png"), - new AspectList().add(Aspect.FIRE, 8).add(Aspect.WEAPON, 4).add(Aspect.MAGIC, 4)) + RegisteredResearches.researchFamiliarElementFire = new SimpleResearchItem( + "FAMILIAR_FIRE", + 6, + -1, + 2, + new ResourceLocation("gadomancy", "textures/misc/Fam_Fire.png"), + new AspectList() + .add(Aspect.FIRE, 8) + .add(Aspect.WEAPON, 4) + .add(Aspect.MAGIC, 4)) .setConcealed() .setParents(RegisteredResearches.researchEtherealFamiliar.key) - .setPages(new ResearchPage("gadomancy.research_page.FAMILIAR_FIRE.1"), new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[3]), - new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[4]), new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[5])) + .setPages( + new ResearchPage("gadomancy.research_page.FAMILIAR_FIRE.1"), + new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[3]), + new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[4]), + new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[5])) .registerResearchItem(); - RegisteredResearches.researchFamiliarElementPoison = new SimpleResearchItem("FAMILIAR_POISON", 3, 2, 2, new ResourceLocation("gadomancy", "textures/misc/Fam_Poison.png"), - new AspectList().add(Aspect.POISON, 8).add(Aspect.WEAPON, 4).add(Aspect.ENTROPY, 4)) + RegisteredResearches.researchFamiliarElementPoison = new SimpleResearchItem( + "FAMILIAR_POISON", + 3, + 2, + 2, + new ResourceLocation("gadomancy", "textures/misc/Fam_Poison.png"), + new AspectList() + .add(Aspect.POISON, 8) + .add(Aspect.WEAPON, 4) + .add(Aspect.ENTROPY, 4)) .setConcealed() .setParents(RegisteredResearches.researchEtherealFamiliar.key) - .setPages(new ResearchPage("gadomancy.research_page.FAMILIAR_POISON.1"), new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[6]), - new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[7]), new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[8])) + .setPages( + new ResearchPage("gadomancy.research_page.FAMILIAR_POISON.1"), + new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[6]), + new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[7]), + new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[8])) .registerResearchItem(); - RegisteredResearches.researchFamiliarElementWeakness = new SimpleResearchItem("FAMILIAR_WEAKNESS", 2, 0, 2, new ResourceLocation("gadomancy", "textures/misc/Fam_Enervation.png"), - new AspectList().add(Aspect.TRAP, 8).add(Aspect.WEAPON, 8).add(Aspect.TAINT, 6)) + RegisteredResearches.researchFamiliarElementWeakness = new SimpleResearchItem( + "FAMILIAR_WEAKNESS", + 2, + 0, + 2, + new ResourceLocation("gadomancy", "textures/misc/Fam_Enervation.png"), + new AspectList() + .add(Aspect.TRAP, 8) + .add(Aspect.WEAPON, 8) + .add(Aspect.TAINT, 6)) .setConcealed() .setParents(RegisteredResearches.researchEtherealFamiliar.key) - .setPages(new ResearchPage("gadomancy.research_page.FAMILIAR_WEAKNESS.1"), new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[9]), - new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[10]), new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[11])) + .setPages( + new ResearchPage("gadomancy.research_page.FAMILIAR_WEAKNESS.1"), + new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[9]), + new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[10]), + new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[11])) .registerResearchItem(); - RegisteredResearches.researchFamiliarAugmentDamage = new IfAnyParentResearchItem("FAMILIAR_DAMAGE", 8, 2, 2, new ResourceLocation("gadomancy", "textures/misc/Fam_Damage.png"), - new AspectList().add(Aspect.WEAPON, 8).add(Aspect.ENERGY, 8).add(Aspect.MAGIC, 4)) - .setAnyParents(RegisteredResearches.researchFamiliarElementFire.key, RegisteredResearches.researchFamiliarElementLightning.key, - RegisteredResearches.researchFamiliarElementPoison.key, RegisteredResearches.researchFamiliarElementWeakness.key) + RegisteredResearches.researchFamiliarAugmentDamage = new IfAnyParentResearchItem( + "FAMILIAR_DAMAGE", + 8, + 2, + 2, + new ResourceLocation("gadomancy", "textures/misc/Fam_Damage.png"), + new AspectList() + .add(Aspect.WEAPON, 8) + .add(Aspect.ENERGY, 8) + .add(Aspect.MAGIC, 4)) + .setAnyParents( + RegisteredResearches.researchFamiliarElementFire.key, + RegisteredResearches.researchFamiliarElementLightning.key, + RegisteredResearches.researchFamiliarElementPoison.key, + RegisteredResearches.researchFamiliarElementWeakness.key) .setConcealed() .setParents(RegisteredResearches.researchEtherealFamiliar.key, "VOIDMETAL") - .setPages(new ResearchPage("gadomancy.research_page.FAMILIAR_DAMAGE.1"), new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[12]), - new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[13]), new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[14])) + .setPages( + new ResearchPage("gadomancy.research_page.FAMILIAR_DAMAGE.1"), + new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[12]), + new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[13]), + new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[14])) .registerResearchItem(); - RegisteredResearches.researchFamiliarAugmentRange = new IfAnyParentResearchItem("FAMILIAR_RANGE", 6, 4, 2, new ResourceLocation("gadomancy", "textures/misc/Fam_Range.png"), - new AspectList().add(Aspect.MAGIC, 8).add(Aspect.ELDRITCH, 8).add(Aspect.ORDER, 4)) - .setAnyParents(RegisteredResearches.researchFamiliarElementFire.key, RegisteredResearches.researchFamiliarElementLightning.key, - RegisteredResearches.researchFamiliarElementPoison.key, RegisteredResearches.researchFamiliarElementWeakness.key) + RegisteredResearches.researchFamiliarAugmentRange = new IfAnyParentResearchItem( + "FAMILIAR_RANGE", + 6, + 4, + 2, + new ResourceLocation("gadomancy", "textures/misc/Fam_Range.png"), + new AspectList() + .add(Aspect.MAGIC, 8) + .add(Aspect.ELDRITCH, 8) + .add(Aspect.ORDER, 4)) + .setAnyParents( + RegisteredResearches.researchFamiliarElementFire.key, + RegisteredResearches.researchFamiliarElementLightning.key, + RegisteredResearches.researchFamiliarElementPoison.key, + RegisteredResearches.researchFamiliarElementWeakness.key) .setConcealed() .setParents(RegisteredResearches.researchEtherealFamiliar.key) - .setPages(new ResearchPage("gadomancy.research_page.FAMILIAR_RANGE.1"), new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[15]), + .setPages( + new ResearchPage("gadomancy.research_page.FAMILIAR_RANGE.1"), + new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[15]), new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[16])) .registerResearchItem(); - RegisteredResearches.researchFamiliarAugmentSpeed = new SimpleResearchItem("FAMILIAR_SPEED", 8, 5, 2, new ResourceLocation("gadomancy", "textures/misc/Fam_Speed.png"), - new AspectList().add(Aspect.MOTION, 10).add(Aspect.MAGIC, 4).add(Aspect.AURA, 4)) + RegisteredResearches.researchFamiliarAugmentSpeed = new SimpleResearchItem( + "FAMILIAR_SPEED", + 8, + 5, + 2, + new ResourceLocation("gadomancy", "textures/misc/Fam_Speed.png"), + new AspectList() + .add(Aspect.MOTION, 10) + .add(Aspect.MAGIC, 4) + .add(Aspect.AURA, 4)) .setConcealed() - .setParents(RegisteredResearches.researchFamiliarAugmentDamage.key, RegisteredResearches.researchFamiliarAugmentRange.key, "PRIMPEARL") - .setPages(new ResearchPage("gadomancy.research_page.FAMILIAR_SPEED.1"), new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[17]), + .setParents( + RegisteredResearches.researchFamiliarAugmentDamage.key, + RegisteredResearches.researchFamiliarAugmentRange.key, + "PRIMPEARL") + .setPages( + new ResearchPage("gadomancy.research_page.FAMILIAR_SPEED.1"), + new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[17]), new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[18])) .registerResearchItem(); - - if(ModConfig.enableAdditionalNodeTypes) { - RegisteredResearches.researchGrowingNodes = new SimpleResearchItem("GROWING", -8, -1, 5, new ResourceLocation("thaumcraft", "textures/misc/r_nodes.png"), new AspectList()) - .setSpecial().setLost().setConcealed() + if (ModConfig.enableAdditionalNodeTypes) { + RegisteredResearches.researchGrowingNodes = new SimpleResearchItem( + "GROWING", + -8, + -1, + 5, + new ResourceLocation("thaumcraft", "textures/misc/r_nodes.png"), + new AspectList()) + .setSpecial() + .setLost() + .setConcealed() .setParents(Gadomancy.MODID.toUpperCase() + ".NODE_MANIPULATOR") - .setPages(new ResearchPage("gadomancy.research_page.GROWING.1"), new ResearchPage("gadomancy.research_page.GROWING.2")).registerResearchItem(); + .setPages( + new ResearchPage("gadomancy.research_page.GROWING.1"), + new ResearchPage("gadomancy.research_page.GROWING.2")) + .registerResearchItem(); - RegisteredResearches.researchGrowingNodeAgression = new SimpleResearchItem("GROWING_AGGRESSION", -5, 0, 6, new ItemStack(ConfigBlocks.blockAiry, 1, 5), new AspectList()) + RegisteredResearches.researchGrowingNodeAgression = new SimpleResearchItem( + "GROWING_AGGRESSION", + -5, + 0, + 6, + new ItemStack(ConfigBlocks.blockAiry, 1, 5), + new AspectList()) .setLost() .setParents(Gadomancy.MODID.toUpperCase() + ".GROWING") - .setPages(new ResearchPage("gadomancy.research_page.GROWING_AGGRESSION.1")).registerResearchItem(); + .setPages(new ResearchPage("gadomancy.research_page.GROWING_AGGRESSION.1")) + .registerResearchItem(); - RegisteredResearches.researchGrowingNodeGrowth = new SimpleResearchItem("GROWING_GROWTH", -7, 2, 6, new ResourceLocation("gadomancy", "textures/misc/r_node_star.png"), new AspectList()) + RegisteredResearches.researchGrowingNodeGrowth = new SimpleResearchItem( + "GROWING_GROWTH", + -7, + 2, + 6, + new ResourceLocation("gadomancy", "textures/misc/r_node_star.png"), + new AspectList()) .setLost() .setParents(Gadomancy.MODID.toUpperCase() + ".GROWING") - .setPages(new ResearchPage("gadomancy.research_page.GROWING_GROWTH.1"), new ResearchPage("gadomancy.research_page.GROWING_GROWTH.2")).registerResearchItem(); + .setPages( + new ResearchPage("gadomancy.research_page.GROWING_GROWTH.1"), + new ResearchPage("gadomancy.research_page.GROWING_GROWTH.2")) + .registerResearchItem(); - RegisteredResearches.researchGrowingNodeAttackNodes = new SimpleResearchItem("GROWING_ATTACK", -6, 1, 6, new ResourceLocation("gadomancy", "textures/misc/r_node_dark.png"), new AspectList()) + RegisteredResearches.researchGrowingNodeAttackNodes = new SimpleResearchItem( + "GROWING_ATTACK", + -6, + 1, + 6, + new ResourceLocation("gadomancy", "textures/misc/r_node_dark.png"), + new AspectList()) .setLost() .setParents(Gadomancy.MODID.toUpperCase() + ".GROWING") - .setPages(new ResearchPage("gadomancy.research_page.GROWING_ATTACK.1")).registerResearchItem(); - - RegisteredResearches.researchGrowingNodeGrowthClue = new SimpleResearchItem("GROWING_GROWTHCLUE", -4, 3, 2, new ItemStack(ConfigBlocks.blockAiry, 1, 5), - new AspectList().add(Aspect.AURA, 10).add(Aspect.MAGIC, 15).add(Aspect.ELDRITCH, 5).add(Aspect.VOID, 12).add(Aspect.ENERGY, 12).add(Aspect.ENTROPY, 8).add(Aspect.DEATH, 3) - .add(Aspect.GREED, 10).add(Aspect.HUNGER, 10).add(Aspect.MECHANISM, 12).add(Aspect.DARKNESS, 12)) - .setSpecial().setRound().setConcealed() - .setParents(Gadomancy.MODID.toUpperCase() + ".GROWING_AGGRESSION", Gadomancy.MODID.toUpperCase() + ".GROWING_GROWTH", Gadomancy.MODID.toUpperCase() + ".GROWING_ATTACK") - .setPages(new ResearchPage("gadomancy.research_page.GROWING_GROWTHCLUE.1"), new ResearchPage("gadomancy.research_page.GROWING_GROWTHCLUE.2")).registerResearchItem(); + .setPages(new ResearchPage("gadomancy.research_page.GROWING_ATTACK.1")) + .registerResearchItem(); + RegisteredResearches.researchGrowingNodeGrowthClue = new SimpleResearchItem( + "GROWING_GROWTHCLUE", + -4, + 3, + 2, + new ItemStack(ConfigBlocks.blockAiry, 1, 5), + new AspectList() + .add(Aspect.AURA, 10) + .add(Aspect.MAGIC, 15) + .add(Aspect.ELDRITCH, 5) + .add(Aspect.VOID, 12) + .add(Aspect.ENERGY, 12) + .add(Aspect.ENTROPY, 8) + .add(Aspect.DEATH, 3) + .add(Aspect.GREED, 10) + .add(Aspect.HUNGER, 10) + .add(Aspect.MECHANISM, 12) + .add(Aspect.DARKNESS, 12)) + .setSpecial() + .setRound() + .setConcealed() + .setParents( + Gadomancy.MODID.toUpperCase() + ".GROWING_AGGRESSION", + Gadomancy.MODID.toUpperCase() + ".GROWING_GROWTH", + Gadomancy.MODID.toUpperCase() + ".GROWING_ATTACK") + .setPages( + new ResearchPage("gadomancy.research_page.GROWING_GROWTHCLUE.1"), + new ResearchPage("gadomancy.research_page.GROWING_GROWTHCLUE.2")) + .registerResearchItem(); } - if(ModConfig.ancientStoneRecipes) - RegisteredResearches.researchAncientStones = new AlternatingResearchItem("ANCIENT_STONES", - -12, 1, 3, - new AspectList().add(Aspect.ELDRITCH, 10).add(Aspect.EARTH, 8).add(Aspect.EXCHANGE, 6).add(Aspect.ENTROPY, 8), - new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15)) - .setConcealed() - .setParents(researchOculus.key) - .setPages(new ResearchPage("gadomancy.research_page.ANCIENT_STONES.1"), new ResearchPage(RegisteredRecipes.recipeAncientStone), new ResearchPage(RegisteredRecipes.recipeAncientStonePedestal)).registerResearchItem(); + if (ModConfig.ancientStoneRecipes) + RegisteredResearches.researchAncientStones = new AlternatingResearchItem( + "ANCIENT_STONES", + -12, + 1, + 3, + new AspectList() + .add(Aspect.ELDRITCH, 10) + .add(Aspect.EARTH, 8) + .add(Aspect.EXCHANGE, 6) + .add(Aspect.ENTROPY, 8), + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15)) + .setConcealed() + .setParents(researchOculus.key) + .setPages( + new ResearchPage("gadomancy.research_page.ANCIENT_STONES.1"), + new ResearchPage(RegisteredRecipes.recipeAncientStone), + new ResearchPage(RegisteredRecipes.recipeAncientStonePedestal)) + .registerResearchItem(); ItemAuraCore.AuraCoreType[] coreTypes = ItemAuraCore.AuraCoreType.values(); ItemStack[] cores = new ItemStack[coreTypes.length]; @@ -275,93 +601,219 @@ public class RegisteredResearches { cores[i] = stack; } - //Cores and stuff related to it. - RegisteredResearches.researchAuraCore = new AlternatingResearchItem("AURA_CORE", - -1, 6, 2, - new AspectList().add(Aspect.AURA, 22).add(Aspect.MAGIC, 10).add(Aspect.AIR, 8).add(Aspect.WATER, 8) - .add(Aspect.EARTH, 8).add(Aspect.FIRE, 8).add(Aspect.ORDER, 8).add(Aspect.ENTROPY, 8), - cores) - .setConcealed().setSpecial() + // Cores and stuff related to it. + RegisteredResearches.researchAuraCore = new AlternatingResearchItem( + "AURA_CORE", + -1, + 6, + 2, + new AspectList() + .add(Aspect.AURA, 22) + .add(Aspect.MAGIC, 10) + .add(Aspect.AIR, 8) + .add(Aspect.WATER, 8) + .add(Aspect.EARTH, 8) + .add(Aspect.FIRE, 8) + .add(Aspect.ORDER, 8) + .add(Aspect.ENTROPY, 8), + cores) + .setConcealed() + .setSpecial() .setParents("INFUSION", "THAUMIUM") - .setPages(new ResearchPage("gadomancy.research_page.AURA_CORE.1"), new ResearchPage(RegisteredRecipes.recipeAuraCore), new ResearchPage("gadomancy.research_page.AURA_CORE.3"), new MultiResearchPage(RegisteredRecipes.auraCoreRecipes)).registerResearchItem(); + .setPages( + new ResearchPage("gadomancy.research_page.AURA_CORE.1"), + new ResearchPage(RegisteredRecipes.recipeAuraCore), + new ResearchPage("gadomancy.research_page.AURA_CORE.3"), + new MultiResearchPage(RegisteredRecipes.auraCoreRecipes)) + .registerResearchItem(); - RegisteredResearches.researchCleanAuraCore = new SimpleResearchItem("CLEAN_AURA_CORE", - 1, 5, 0, new ItemStack(RegisteredItems.itemAuraCore), - new AspectList().add(Aspect.HEAL, 8).add(Aspect.AURA, 6).add(Aspect.MAGIC, 8).add(Aspect.WATER, 10)) - .setConcealed().setSecondary() + RegisteredResearches.researchCleanAuraCore = new SimpleResearchItem( + "CLEAN_AURA_CORE", + 1, + 5, + 0, + new ItemStack(RegisteredItems.itemAuraCore), + new AspectList() + .add(Aspect.HEAL, 8) + .add(Aspect.AURA, 6) + .add(Aspect.MAGIC, 8) + .add(Aspect.WATER, 10)) + .setConcealed() + .setSecondary() .setParents(RegisteredResearches.researchAuraCore.key) - .setPages(new ResearchPage("gadomancy.research_page.CLEAN_AURA_CORE.1"), new ResearchPage(RegisteredRecipes.recipesWashAuraCore), new ResearchPage(RegisteredRecipes.recipesUndoAuraCore)).registerResearchItem(); + .setPages( + new ResearchPage("gadomancy.research_page.CLEAN_AURA_CORE.1"), + new ResearchPage(RegisteredRecipes.recipesWashAuraCore), + new ResearchPage(RegisteredRecipes.recipesUndoAuraCore)) + .registerResearchItem(); - RegisteredResearches.researchAuraPylon = new SimpleResearchItem("AURA_PYLON", - 0, 9, 2, new ItemStack(RegisteredBlocks.blockAuraPylon, 1, 1), - new AspectList().add(Aspect.ORDER, 12).add(Aspect.AURA, 20).add(Aspect.MAGIC, 12).add(Aspect.MECHANISM, 8)) + RegisteredResearches.researchAuraPylon = new SimpleResearchItem( + "AURA_PYLON", + 0, + 9, + 2, + new ItemStack(RegisteredBlocks.blockAuraPylon, 1, 1), + new AspectList() + .add(Aspect.ORDER, 12) + .add(Aspect.AURA, 20) + .add(Aspect.MAGIC, 12) + .add(Aspect.MECHANISM, 8)) .setHidden() .setParents(RegisteredResearches.researchAuraCore.key, "TUBEFILTER") - .setItemTriggers(new ItemStack(RegisteredItems.itemAuraCore, 1, ItemAuraCore.AuraCoreType.FIRE.ordinal())) - .setPages(new ResearchPage("gadomancy.research_page.AURA_PYLON.1"), new ResearchPage(RegisteredRecipes.recipeAuraPylon), new ResearchPage(RegisteredRecipes.recipeAuraPylonPeak), new ResearchPage("gadomancy.research_page.AURA_PYLON.4"), new ResearchPage(RegisteredRecipes.multiblockAuraPylon)).registerResearchItem(); + .setItemTriggers( + new ItemStack(RegisteredItems.itemAuraCore, 1, ItemAuraCore.AuraCoreType.FIRE.ordinal())) + .setPages( + new ResearchPage("gadomancy.research_page.AURA_PYLON.1"), + new ResearchPage(RegisteredRecipes.recipeAuraPylon), + new ResearchPage(RegisteredRecipes.recipeAuraPylonPeak), + new ResearchPage("gadomancy.research_page.AURA_PYLON.4"), + new ResearchPage(RegisteredRecipes.multiblockAuraPylon)) + .registerResearchItem(); - RegisteredResearches.researchAuraEffects = new SimpleResearchItem("AURA_EFFECTS", - 1, 10, 2, new ResourceLocation("thaumcraft", "textures/misc/r_aspects.png"), - new AspectList().add(Aspect.AURA, 6).add(Aspect.MIND, 8).add(Aspect.MAGIC, 4).add(Aspect.ORDER, 4)) - .setConcealed().setSecondary() + RegisteredResearches.researchAuraEffects = new SimpleResearchItem( + "AURA_EFFECTS", + 1, + 10, + 2, + new ResourceLocation("thaumcraft", "textures/misc/r_aspects.png"), + new AspectList() + .add(Aspect.AURA, 6) + .add(Aspect.MIND, 8) + .add(Aspect.MAGIC, 4) + .add(Aspect.ORDER, 4)) + .setConcealed() + .setSecondary() .setParents(RegisteredResearches.researchAuraPylon.key) - .setPages(new ResearchPage("gadomancy.research_page.AURA_EFFECTS.1")).registerResearchItem(); + .setPages(new ResearchPage("gadomancy.research_page.AURA_EFFECTS.1")) + .registerResearchItem(); - RegisteredResearches.researchKnowledgeBook = new SimpleResearchItem("KNOWLEDGE_BOOK", - -2, 8, 2, new ItemStack(RegisteredBlocks.blockKnowledgeBook), - new AspectList().add(Aspect.MIND, 12).add(Aspect.MAGIC, 8).add(Aspect.MOTION, 6).add(Aspect.ORDER, 10).add(Aspect.MECHANISM, 8).add(Aspect.CRAFT, 8)) + RegisteredResearches.researchKnowledgeBook = new SimpleResearchItem( + "KNOWLEDGE_BOOK", + -2, + 8, + 2, + new ItemStack(RegisteredBlocks.blockKnowledgeBook), + new AspectList() + .add(Aspect.MIND, 12) + .add(Aspect.MAGIC, 8) + .add(Aspect.MOTION, 6) + .add(Aspect.ORDER, 10) + .add(Aspect.MECHANISM, 8) + .add(Aspect.CRAFT, 8)) .setHidden() .setParents(RegisteredResearches.researchAuraCore.key, "GOGGLES", "THAUMATORIUM") - .setItemTriggers(new ItemStack(RegisteredItems.itemAuraCore, 1, ItemAuraCore.AuraCoreType.ORDER.ordinal())) - .setPages(new ResearchPage("gadomancy.research_page.KNOWLEDGE_BOOK.1"), new ResearchPage(RegisteredRecipes.recipeKnowledgeBook), - new ResearchPage("gadomancy.research_page.KNOWLEDGE_BOOK.3"), new ResearchPage("gadomancy.research_page.KNOWLEDGE_BOOK.4")).registerResearchItem(); + .setItemTriggers( + new ItemStack(RegisteredItems.itemAuraCore, 1, ItemAuraCore.AuraCoreType.ORDER.ordinal())) + .setPages( + new ResearchPage("gadomancy.research_page.KNOWLEDGE_BOOK.1"), + new ResearchPage(RegisteredRecipes.recipeKnowledgeBook), + new ResearchPage("gadomancy.research_page.KNOWLEDGE_BOOK.3"), + new ResearchPage("gadomancy.research_page.KNOWLEDGE_BOOK.4")) + .registerResearchItem(); - ResearchItem researchVReservoir = PseudoResearchItem.create("ESSENTIARESERVOIR", -5, 9).registerResearchItem(); + ResearchItem researchVReservoir = + PseudoResearchItem.create("ESSENTIARESERVOIR", -5, 9).registerResearchItem(); - RegisteredResearches.researchEssentiaCompressor = new SimpleResearchItem("ESSENTIA_COMPRESSOR", - -4, 7, 2, new ItemStack(RegisteredBlocks.blockEssentiaCompressor), - new AspectList().add(Aspect.VOID, 12).add(Aspect.WATER, 10).add(Aspect.ENTROPY, 12).add(Aspect.MAGIC, 6).add(Aspect.MECHANISM, 12)) + RegisteredResearches.researchEssentiaCompressor = new SimpleResearchItem( + "ESSENTIA_COMPRESSOR", + -4, + 7, + 2, + new ItemStack(RegisteredBlocks.blockEssentiaCompressor), + new AspectList() + .add(Aspect.VOID, 12) + .add(Aspect.WATER, 10) + .add(Aspect.ENTROPY, 12) + .add(Aspect.MAGIC, 6) + .add(Aspect.MECHANISM, 12)) .setHidden() .setParents(RegisteredResearches.researchAuraCore.key, researchVReservoir.key) - .setItemTriggers(new ItemStack(RegisteredItems.itemAuraCore, 1, ItemAuraCore.AuraCoreType.WATER.ordinal())) - .setPages(new ResearchPage("gadomancy.research_page.ESSENTIA_COMPRESSOR.1"), new ResearchPage("gadomancy.research_page.ESSENTIA_COMPRESSOR.2"), - new ResearchPage(RegisteredRecipes.recipeElementVoid), new ResearchPage("gadomancy.research_page.ESSENTIA_COMPRESSOR.4"), - new ResearchPage(RegisteredRecipes.recipeEssentiaCompressor), new ResearchPage("gadomancy.research_page.ESSENTIA_COMPRESSOR.6"), - new ResearchPage(RegisteredRecipes.multiblockEssentiaCompressor), new ResearchPage("gadomancy.research_page.ESSENTIA_COMPRESSOR.8"), - new ResearchPage("gadomancy.research_page.ESSENTIA_COMPRESSOR.9")).registerResearchItem(); + .setItemTriggers( + new ItemStack(RegisteredItems.itemAuraCore, 1, ItemAuraCore.AuraCoreType.WATER.ordinal())) + .setPages( + new ResearchPage("gadomancy.research_page.ESSENTIA_COMPRESSOR.1"), + new ResearchPage("gadomancy.research_page.ESSENTIA_COMPRESSOR.2"), + new ResearchPage(RegisteredRecipes.recipeElementVoid), + new ResearchPage("gadomancy.research_page.ESSENTIA_COMPRESSOR.4"), + new ResearchPage(RegisteredRecipes.recipeEssentiaCompressor), + new ResearchPage("gadomancy.research_page.ESSENTIA_COMPRESSOR.6"), + 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();*/ + -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[] {RegisteredResearches.researchAuraCore.key, "WARDEDARCANA" } : new String[] {RegisteredResearches.researchAuraCore.key }; - RegisteredResearches.researchArcanePackager = new SimpleResearchItem("ARCANE_PACKAGER", - 2, 7, 2, new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 4), - new AspectList().add(Aspect.AIR, 12).add(Aspect.MECHANISM, 16).add(Aspect.VOID, 10).add(Aspect.MAGIC, 10)) + String[] packagerParents = Config.wardedStone + ? new String[] {RegisteredResearches.researchAuraCore.key, "WARDEDARCANA"} + : new String[] {RegisteredResearches.researchAuraCore.key}; + RegisteredResearches.researchArcanePackager = new SimpleResearchItem( + "ARCANE_PACKAGER", + 2, + 7, + 2, + new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 4), + new AspectList() + .add(Aspect.AIR, 12) + .add(Aspect.MECHANISM, 16) + .add(Aspect.VOID, 10) + .add(Aspect.MAGIC, 10)) .setHidden() .setParents(packagerParents) - .setItemTriggers(new ItemStack(RegisteredItems.itemAuraCore, 1, ItemAuraCore.AuraCoreType.AIR.ordinal())) - .setPages(new ResearchPage("gadomancy.research_page.ARCANE_PACKAGER.1"), new ResearchPage(RegisteredRecipes.recipeArcanePackager), new ResearchPage("gadomancy.research_page.ARCANE_PACKAGER.3"), new ResearchPage("gadomancy.research_page.ARCANE_PACKAGER.4")).registerResearchItem(); + .setItemTriggers( + new ItemStack(RegisteredItems.itemAuraCore, 1, ItemAuraCore.AuraCoreType.AIR.ordinal())) + .setPages( + new ResearchPage("gadomancy.research_page.ARCANE_PACKAGER.1"), + new ResearchPage(RegisteredRecipes.recipeArcanePackager), + new ResearchPage("gadomancy.research_page.ARCANE_PACKAGER.3"), + new ResearchPage("gadomancy.research_page.ARCANE_PACKAGER.4")) + .registerResearchItem(); - - ResearchItem researchInfusionEnch = PseudoResearchItem.create("INFUSIONENCHANTMENT", -1, 2).registerResearchItem(); + ResearchItem researchInfusionEnch = + PseudoResearchItem.create("INFUSIONENCHANTMENT", -1, 2).registerResearchItem(); ItemStack goggles = new ItemStack(ConfigItems.itemGoggles); goggles.addEnchantment(Enchantment.protection, 1); - RegisteredResearches.researchRevealer = new SimpleResearchItem("REVEALER", 1, 3, 1, goggles, new AspectList().add(Aspect.SENSES, 4).add(Aspect.MAGIC, 4)) - .setParents(researchInfusionEnch.key, "GOGGLES").setConcealed() - .setPages(new ResearchPage("gadomancy.research_page.REVEALER.1"), new ResearchPage(RegisteredRecipes.recipeRevealer)).registerResearchItem(); + RegisteredResearches.researchRevealer = new SimpleResearchItem( + "REVEALER", + 1, + 3, + 1, + goggles, + new AspectList().add(Aspect.SENSES, 4).add(Aspect.MAGIC, 4)) + .setParents(researchInfusionEnch.key, "GOGGLES") + .setConcealed() + .setPages( + new ResearchPage("gadomancy.research_page.REVEALER.1"), + new ResearchPage(RegisteredRecipes.recipeRevealer)) + .registerResearchItem(); - RegisteredResearches.researchArmorDisguise = new DisguiseResearchItem("ARMORDISGUISE", -2, 0, 1, new AspectList().add(Aspect.SLIME, 8).add(Aspect.MAGIC, 4).add(Aspect.ARMOR, 4)) - .setParents(researchInfusionEnch.key).setConcealed() - .setPages(new ResearchPage("gadomancy.research_page.ARMORDISGUISE.1"), new ResearchPage(new InfusionVisualDisguiseArmor(false)), new ResearchPage(new InfusionVisualDisguiseArmor(true)), new ResearchPage("gadomancy.research_page.ARMORDISGUISE.4")).registerResearchItem(); + RegisteredResearches.researchArmorDisguise = new DisguiseResearchItem( + "ARMORDISGUISE", + -2, + 0, + 1, + new AspectList() + .add(Aspect.SLIME, 8) + .add(Aspect.MAGIC, 4) + .add(Aspect.ARMOR, 4)) + .setParents(researchInfusionEnch.key) + .setConcealed() + .setPages( + new ResearchPage("gadomancy.research_page.ARMORDISGUISE.1"), + new ResearchPage(new InfusionVisualDisguiseArmor(false)), + new ResearchPage(new InfusionVisualDisguiseArmor(true)), + new ResearchPage("gadomancy.research_page.ARMORDISGUISE.4")) + .registerResearchItem(); - //Warpy warpy + // Warpy warpy ThaumcraftApi.addWarpToResearch(Gadomancy.MODID.toUpperCase() + ".NODE_MANIPULATOR", 4); ThaumcraftApi.addWarpToResearch(Gadomancy.MODID.toUpperCase() + ".GROWING_GROWTHCLUE", 3); ThaumcraftApi.addWarpToResearch(Gadomancy.MODID.toUpperCase() + ".E_PORTAL_CREATOR", 4); @@ -375,23 +827,43 @@ public class RegisteredResearches { RecipeVisualStickyJar visualRecipe = new RecipeVisualStickyJar(); ResearchPage page = new ResearchPage(visualRecipe); - RegisteredResearches.researchStickyJar = new StickyJarResearchItem("STICKYJAR", -5, -5, 2, - new AspectList().add(Aspect.SLIME, 8).add(Aspect.EARTH, 8)) - .setParents(researchJar.key).setConcealed() - .setPages(new ResearchPage("gadomancy.research_page.STICKYJAR.1"), page).registerResearchItem(); + RegisteredResearches.researchStickyJar = new StickyJarResearchItem( + "STICKYJAR", + -5, + -5, + 2, + new AspectList().add(Aspect.SLIME, 8).add(Aspect.EARTH, 8)) + .setParents(researchJar.key) + .setConcealed() + .setPages(new ResearchPage("gadomancy.research_page.STICKYJAR.1"), page) + .registerResearchItem(); - if(RegisteredResearches.researchBlockProtector != null) { + if (RegisteredResearches.researchBlockProtector != null) { RegisteredResearches.researchBlockProtector.setParents(RegisteredResearches.researchStickyJar.key); } - String[] parents = Config.allowMirrors ? new String[] { researchJar.key, "MIRRORESSENTIA" } : new String[] { researchJar.key }; - RegisteredResearches.researchRemoteJar = new SimpleResearchItem("REMOTEJAR", -4, -3, 3, - RegisteredRecipes.recipeRemoteJar.getRecipeOutput(), - new AspectList().add(Aspect.WATER, 4).add(Aspect.MECHANISM, 8).add(Aspect.EARTH, 4).add(Aspect.ORDER, 8)) - .setParents(parents).setConcealed() - .setPages(new ResearchPage("gadomancy.research_page.REMOTEJAR.1"), new ResearchPage(RegisteredRecipes.recipeRemoteJar), new ResearchPage("gadomancy.research_page.REMOTEJAR.2")).registerResearchItem(); + String[] parents = + Config.allowMirrors ? new String[] {researchJar.key, "MIRRORESSENTIA"} : new String[] {researchJar.key}; + RegisteredResearches.researchRemoteJar = new SimpleResearchItem( + "REMOTEJAR", + -4, + -3, + 3, + RegisteredRecipes.recipeRemoteJar.getRecipeOutput(), + new AspectList() + .add(Aspect.WATER, 4) + .add(Aspect.MECHANISM, 8) + .add(Aspect.EARTH, 4) + .add(Aspect.ORDER, 8)) + .setParents(parents) + .setConcealed() + .setPages( + new ResearchPage("gadomancy.research_page.REMOTEJAR.1"), + new ResearchPage(RegisteredRecipes.recipeRemoteJar), + new ResearchPage("gadomancy.research_page.REMOTEJAR.2")) + .registerResearchItem(); - //Aura researches + // Aura researches AuraResearchManager.registerAuraResearches(); } } diff --git a/src/main/java/makeo/gadomancy/common/research/AlternatingResearchItem.java b/src/main/java/makeo/gadomancy/common/research/AlternatingResearchItem.java index d5bbcd5..f7dc263 100644 --- a/src/main/java/makeo/gadomancy/common/research/AlternatingResearchItem.java +++ b/src/main/java/makeo/gadomancy/common/research/AlternatingResearchItem.java @@ -1,13 +1,12 @@ package makeo.gadomancy.common.research; -import makeo.gadomancy.common.utils.Injector; -import net.minecraft.item.ItemStack; -import thaumcraft.api.aspects.AspectList; -import thaumcraft.api.research.ResearchItem; - import java.lang.reflect.Field; import java.util.Arrays; import java.util.List; +import makeo.gadomancy.common.utils.Injector; +import net.minecraft.item.ItemStack; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.api.research.ResearchItem; /** * This class is part of the Gadomancy Mod @@ -41,7 +40,7 @@ public class AlternatingResearchItem extends SimpleResearchItem { } private int calcIndex(int max) { - return (int)(System.currentTimeMillis() / 1000L % max); + return (int) (System.currentTimeMillis() / 1000L % max); } @Override diff --git a/src/main/java/makeo/gadomancy/common/research/DisguiseResearchItem.java b/src/main/java/makeo/gadomancy/common/research/DisguiseResearchItem.java index bfc17d2..75cbe4b 100644 --- a/src/main/java/makeo/gadomancy/common/research/DisguiseResearchItem.java +++ b/src/main/java/makeo/gadomancy/common/research/DisguiseResearchItem.java @@ -29,8 +29,8 @@ public class DisguiseResearchItem extends AlternatingResearchItem { @Override public ResearchItem setPages(ResearchPage... pages) { - for(ResearchPage page : pages) { - if(page.type == ResearchPage.PageType.INFUSION_CRAFTING + for (ResearchPage page : pages) { + if (page.type == ResearchPage.PageType.INFUSION_CRAFTING && page.recipe instanceof InfusionVisualDisguiseArmor) { this.recipe = (InfusionVisualDisguiseArmor) page.recipe; } diff --git a/src/main/java/makeo/gadomancy/common/research/IfAnyParentResearchItem.java b/src/main/java/makeo/gadomancy/common/research/IfAnyParentResearchItem.java index aaf4cf9..6d848c6 100644 --- a/src/main/java/makeo/gadomancy/common/research/IfAnyParentResearchItem.java +++ b/src/main/java/makeo/gadomancy/common/research/IfAnyParentResearchItem.java @@ -35,19 +35,21 @@ public class IfAnyParentResearchItem extends SimpleResearchItem { @Override @SideOnly(Side.CLIENT) public boolean isHidden() { - if(this.anyParents != null) { + if (this.anyParents != null) { boolean hasFoundAny = false; boolean doesAnyExist = false; - for(String res : this.anyParents) { + for (String res : this.anyParents) { ResearchItem ri = ResearchCategories.getResearch(res); - if(ri != null) { + if (ri != null) { doesAnyExist = true; - if(GuiResearchBrowser.completedResearch.get(Minecraft.getMinecraft().thePlayer.getCommandSenderName()).contains(ri.key)) { + if (GuiResearchBrowser.completedResearch + .get(Minecraft.getMinecraft().thePlayer.getCommandSenderName()) + .contains(ri.key)) { hasFoundAny = true; } } } - if(doesAnyExist) { + if (doesAnyExist) { return !hasFoundAny; } } @@ -58,5 +60,4 @@ public class IfAnyParentResearchItem extends SimpleResearchItem { this.anyParents = parents; return this; } - } diff --git a/src/main/java/makeo/gadomancy/common/research/MultiResearchPage.java b/src/main/java/makeo/gadomancy/common/research/MultiResearchPage.java index f0280d8..23db5e5 100644 --- a/src/main/java/makeo/gadomancy/common/research/MultiResearchPage.java +++ b/src/main/java/makeo/gadomancy/common/research/MultiResearchPage.java @@ -1,9 +1,8 @@ package makeo.gadomancy.common.research; -import thaumcraft.api.research.ResearchPage; - import java.util.ArrayList; import java.util.List; +import thaumcraft.api.research.ResearchPage; /** * This class is part of the Gadomancy Mod @@ -31,9 +30,9 @@ public class MultiResearchPage extends ResearchPage { @Override public Object get(int index) { int calcIndex; - if(index == 0 && (calcIndex = this.calcIndex()) != this.recipeIndex) { + if (index == 0 && (calcIndex = this.calcIndex()) != this.recipeIndex) { this.clear(); - for(Object o : this.recipes[calcIndex]) { + for (Object o : this.recipes[calcIndex]) { this.add(o); } this.recipeIndex = calcIndex; @@ -42,7 +41,7 @@ public class MultiResearchPage extends ResearchPage { } private int calcIndex() { - return (int)(System.currentTimeMillis() / 1000L % this.recipes.length); + return (int) (System.currentTimeMillis() / 1000L % this.recipes.length); } } } diff --git a/src/main/java/makeo/gadomancy/common/research/PseudoResearchItem.java b/src/main/java/makeo/gadomancy/common/research/PseudoResearchItem.java index 71bce7b..11e0b6e 100644 --- a/src/main/java/makeo/gadomancy/common/research/PseudoResearchItem.java +++ b/src/main/java/makeo/gadomancy/common/research/PseudoResearchItem.java @@ -2,6 +2,7 @@ package makeo.gadomancy.common.research; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.Arrays; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -12,8 +13,6 @@ import thaumcraft.api.research.ResearchCategories; import thaumcraft.api.research.ResearchItem; import thaumcraft.api.research.ResearchPage; -import java.util.Arrays; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -27,14 +26,28 @@ public class PseudoResearchItem extends SimpleResearchItem { private final ResearchItem original; - private PseudoResearchItem(ResearchItem original, String key, int col, int row, ResourceLocation icon, boolean doubleThisPage) { - super(PseudoResearchItem.PSEUDO_PREFIX + key + (doubleThisPage ? ".2" : ""), col, row, original.getComplexity(), icon, new AspectList()); + private PseudoResearchItem( + ResearchItem original, String key, int col, int row, ResourceLocation icon, boolean doubleThisPage) { + super( + PseudoResearchItem.PSEUDO_PREFIX + key + (doubleThisPage ? ".2" : ""), + col, + row, + original.getComplexity(), + icon, + new AspectList()); this.original = original; this.setStub().setHidden(); } - private PseudoResearchItem(ResearchItem original, String key, int col, int row, ItemStack icon, boolean doubleThisPage) { - super(PseudoResearchItem.PSEUDO_PREFIX + key + (doubleThisPage ? ".2" : ""), col, row, original.getComplexity(), icon, new AspectList()); + private PseudoResearchItem( + ResearchItem original, String key, int col, int row, ItemStack icon, boolean doubleThisPage) { + super( + PseudoResearchItem.PSEUDO_PREFIX + key + (doubleThisPage ? ".2" : ""), + col, + row, + original.getComplexity(), + icon, + new AspectList()); this.original = original; this.setStub().setHidden(); } @@ -58,8 +71,8 @@ public class PseudoResearchItem extends SimpleResearchItem { @SideOnly(Side.CLIENT) public boolean isHidden() { EntityPlayer p = Minecraft.getMinecraft().thePlayer; - if(p != null) { - if(!ThaumcraftApiHelper.isResearchComplete(p.getCommandSenderName(), this.key)) { + if (p != null) { + if (!ThaumcraftApiHelper.isResearchComplete(p.getCommandSenderName(), this.key)) { return false; } } @@ -73,18 +86,18 @@ public class PseudoResearchItem extends SimpleResearchItem { public static ResearchItem create(String original, int col, int row, boolean doubleInThisPage) { ResearchItem item = ResearchCategories.getResearch(original); - if(item != null) { + if (item != null) { ResearchItem pseudo; - if(item.icon_resource == null) { + if (item.icon_resource == null) { pseudo = new PseudoResearchItem(item, item.key, col, row, item.icon_item, doubleInThisPage); } else { pseudo = new PseudoResearchItem(item, item.key, col, row, item.icon_resource, doubleInThisPage); } String[] siblings = item.siblings; - if(siblings == null) { - siblings = new String[]{ pseudo.key }; + if (siblings == null) { + siblings = new String[] {pseudo.key}; } else { siblings = Arrays.copyOf(siblings, siblings.length + 1); siblings[siblings.length - 1] = pseudo.key; @@ -92,7 +105,7 @@ public class PseudoResearchItem extends SimpleResearchItem { item.setSiblings(siblings); - if(item.isSecondary()) { + if (item.isSecondary()) { pseudo.setSecondary(); } diff --git a/src/main/java/makeo/gadomancy/common/research/SimpleResearchItem.java b/src/main/java/makeo/gadomancy/common/research/SimpleResearchItem.java index acb0e87..f0b01a3 100644 --- a/src/main/java/makeo/gadomancy/common/research/SimpleResearchItem.java +++ b/src/main/java/makeo/gadomancy/common/research/SimpleResearchItem.java @@ -29,5 +29,4 @@ public class SimpleResearchItem extends ResearchItem { public static String getFullName(String name) { return SimpleResearchItem.PREFIX + name; } - } diff --git a/src/main/java/makeo/gadomancy/common/research/StickyJarResearchItem.java b/src/main/java/makeo/gadomancy/common/research/StickyJarResearchItem.java index 76c8925..bf1f10e 100644 --- a/src/main/java/makeo/gadomancy/common/research/StickyJarResearchItem.java +++ b/src/main/java/makeo/gadomancy/common/research/StickyJarResearchItem.java @@ -2,6 +2,7 @@ package makeo.gadomancy.common.research; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.registration.RegisteredItems; import net.minecraft.client.Minecraft; @@ -9,8 +10,6 @@ import net.minecraft.item.ItemStack; import thaumcraft.api.aspects.AspectList; import thaumcraft.common.config.ConfigBlocks; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -27,13 +26,12 @@ public class StickyJarResearchItem extends AlternatingResearchItem { @Override @SideOnly(Side.CLIENT) public boolean isSpecial() { - if(Gadomancy.proxy.getSide() == Side.CLIENT) { + if (Gadomancy.proxy.getSide() == Side.CLIENT) { List items = RegisteredItems.getStickyJarStacks(Minecraft.getMinecraft().thePlayer); - if(items.size() > 0) { + if (items.size() > 0) { this.itemIcons = items; } } return super.isSpecial(); } - } diff --git a/src/main/java/makeo/gadomancy/common/utils/ColorHelper.java b/src/main/java/makeo/gadomancy/common/utils/ColorHelper.java index a6ffb6d..f5c3262 100644 --- a/src/main/java/makeo/gadomancy/common/utils/ColorHelper.java +++ b/src/main/java/makeo/gadomancy/common/utils/ColorHelper.java @@ -27,10 +27,10 @@ public class ColorHelper { StringBuilder output = new StringBuilder(); boolean isColor = false; - for(char c : input.toCharArray()) { - if(c == ColorHelper.COLOR_CHAR) { + for (char c : input.toCharArray()) { + if (c == ColorHelper.COLOR_CHAR) { isColor = true; - } else if(isColor) { + } else if (isColor) { isColor = false; output.append(ColorHelper.COLOR_CHAR).append(c); } diff --git a/src/main/java/makeo/gadomancy/common/utils/ExplosionHelper.java b/src/main/java/makeo/gadomancy/common/utils/ExplosionHelper.java index 0c0c7b7..dda896e 100644 --- a/src/main/java/makeo/gadomancy/common/utils/ExplosionHelper.java +++ b/src/main/java/makeo/gadomancy/common/utils/ExplosionHelper.java @@ -1,6 +1,8 @@ package makeo.gadomancy.common.utils; import cpw.mods.fml.common.network.NetworkRegistry; +import java.util.ArrayList; +import java.util.List; import makeo.gadomancy.common.blocks.tiles.TileExtendedNode; import makeo.gadomancy.common.network.PacketHandler; import makeo.gadomancy.common.network.packets.PacketAnimationAbsorb; @@ -23,9 +25,6 @@ import thaumcraft.common.config.ConfigBlocks; import thaumcraft.common.lib.utils.Utils; import thaumcraft.common.lib.world.ThaumcraftWorldGenerator; -import java.util.ArrayList; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -40,8 +39,17 @@ public class ExplosionHelper { ExplosionHelper.taintplosion(world, x, y, z, taintBiome, chanceToTaint, 3.0F, 10, 80); } - public static void taintplosion(World world, int x, int y, int z, boolean taintBiome, int chanceToTaint, float str, int size, int blocksAffected) { - if(chanceToTaint < 1) chanceToTaint = 1; + public static void taintplosion( + World world, + int x, + int y, + int z, + boolean taintBiome, + int chanceToTaint, + float str, + int size, + int blocksAffected) { + if (chanceToTaint < 1) chanceToTaint = 1; world.createExplosion(null, x + 0.5D, y + 0.5D, z + 0.5D, str, false); for (int a = 0; a < blocksAffected; a++) { int xx = x + world.rand.nextInt(size) - world.rand.nextInt(size); @@ -54,9 +62,9 @@ public class ExplosionHelper { world.setBlock(xx, yy, zz, ConfigBlocks.blockFluxGas, 8, 3); } } - if(!Config.genTaint) continue; + if (!Config.genTaint) continue; - if(taintBiome && world.rand.nextInt(chanceToTaint) == 0) { + if (taintBiome && world.rand.nextInt(chanceToTaint) == 0) { Utils.setBiomeAt(world, xx, zz, ThaumcraftWorldGenerator.biomeTaint); } } @@ -82,28 +90,47 @@ public class ExplosionHelper { } public void update() { - List livingEntities = this.world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(this.x, this.y, this.z, this.x + 1, this.y + 1, this.z + 1).expand(6.0D, 6.0D, 6.0D)); + List livingEntities = this.world.getEntitiesWithinAABB( + EntityLivingBase.class, + AxisAlignedBB.getBoundingBox(this.x, this.y, this.z, this.x + 1, this.y + 1, this.z + 1) + .expand(6.0D, 6.0D, 6.0D)); if ((livingEntities != null) && (livingEntities.size() > 0)) { for (Object e : livingEntities) { EntityLivingBase livingEntity = (EntityLivingBase) e; if ((livingEntity.isEntityAlive()) && (!livingEntity.isEntityInvulnerable())) { - if(livingEntity instanceof EntityPlayer && ((EntityPlayer) livingEntity).capabilities.isCreativeMode) continue; - if(this.world.rand.nextInt(16) != 0) continue; + if (livingEntity instanceof EntityPlayer + && ((EntityPlayer) livingEntity).capabilities.isCreativeMode) continue; + if (this.world.rand.nextInt(16) != 0) continue; livingEntity.attackEntityFrom(DamageSource.magic, 4F); - PacketTCNodeBolt packet = new PacketTCNodeBolt(this.x + 0.5F, this.y + 0.5F, this.z + 0.5F, (float) livingEntity.posX, (float) (livingEntity.posY + livingEntity.height), (float) livingEntity.posZ, 0, false); - PacketHandler.INSTANCE.sendToAllAround(packet, new NetworkRegistry.TargetPoint(this.world.provider.dimensionId, this.x, this.y, this.z, 32.0D)); + PacketTCNodeBolt packet = new PacketTCNodeBolt( + this.x + 0.5F, + this.y + 0.5F, + this.z + 0.5F, + (float) livingEntity.posX, + (float) (livingEntity.posY + livingEntity.height), + (float) livingEntity.posZ, + 0, + false); + PacketHandler.INSTANCE.sendToAllAround( + packet, + new NetworkRegistry.TargetPoint( + this.world.provider.dimensionId, this.x, this.y, this.z, 32.0D)); } } } - if(this.phase < 2 && this.world.rand.nextInt(this.phase == 0 ? 8 : 4) == 0) { - PacketStartAnimation packet = new PacketStartAnimation(PacketStartAnimation.ID_BURST, this.x, this.y, this.z); - PacketHandler.INSTANCE.sendToAllAround(packet, new NetworkRegistry.TargetPoint(this.world.provider.dimensionId, this.x, this.y, this.z, 32.0D)); + if (this.phase < 2 && this.world.rand.nextInt(this.phase == 0 ? 8 : 4) == 0) { + PacketStartAnimation packet = + new PacketStartAnimation(PacketStartAnimation.ID_BURST, this.x, this.y, this.z); + PacketHandler.INSTANCE.sendToAllAround( + packet, + new NetworkRegistry.TargetPoint( + this.world.provider.dimensionId, this.x, this.y, this.z, 32.0D)); this.world.playSoundEffect(this.x + 0.5, this.y + 0.5, this.z + 0.5, "thaumcraft:ice", 0.8F, 1.0F); } switch (this.phase) { case 0: { this.tick++; - if(this.tick > 200) { + if (this.tick > 200) { this.tick = 0; this.phase = 1; ExplosionHelper.taintplosion(this.world, this.x, this.y, this.z, false, 1); @@ -114,15 +141,17 @@ public class ExplosionHelper { } case 1: { this.tick++; - int range = this.tick > 50 ? this.tick > 75 ? this.tick > 100 ? this.tick > 200 ? this.tick > 300 ? 9 : 7 : 6 : 5 : 4 : 3; - if(this.pastTickBlocks != null) { - for(Vec3 v : this.pastTickBlocks) { + int range = this.tick > 50 + ? this.tick > 75 ? this.tick > 100 ? this.tick > 200 ? this.tick > 300 ? 9 : 7 : 6 : 5 : 4 + : 3; + if (this.pastTickBlocks != null) { + for (Vec3 v : this.pastTickBlocks) { this.sendRandomVortexLightningPacket(this.world, this.x, this.y, this.z); this.world.setBlockToAir((int) v.xCoord, (int) v.yCoord, (int) v.zCoord); } } int ct = this.world.rand.nextInt(4); - while(ct > 0) { + while (ct > 0) { ct--; this.sendRandomVortexLightningPacket(this.world, this.x, this.y, this.z); } @@ -134,23 +163,27 @@ public class ExplosionHelper { int zz = this.z + this.world.rand.nextInt(range) - this.world.rand.nextInt(range); Block b = this.world.getBlock(xx, yy, zz); float hardness = b.getBlockHardness(this.world, xx, yy, zz); - if(b != Blocks.air && hardness > 0 && hardness <= 50 && b != RegisteredBlocks.blockNode) { - PacketAnimationAbsorb absorb = new PacketAnimationAbsorb(this.x, this.y, this.z, xx, yy, zz, 7); - PacketHandler.INSTANCE.sendToAllAround(absorb, new NetworkRegistry.TargetPoint(this.world.provider.dimensionId, this.x, this.y, this.z, 32D)); + if (b != Blocks.air && hardness > 0 && hardness <= 50 && b != RegisteredBlocks.blockNode) { + PacketAnimationAbsorb absorb = + new PacketAnimationAbsorb(this.x, this.y, this.z, xx, yy, zz, 7); + PacketHandler.INSTANCE.sendToAllAround( + absorb, + new NetworkRegistry.TargetPoint( + this.world.provider.dimensionId, this.x, this.y, this.z, 32D)); this.pastTickBlocks.add(Vec3.createVectorHelper(xx, yy, zz)); } cnt--; } while (cnt > 0); - if(this.tick == 200) { + if (this.tick == 200) { ExplosionHelper.taintplosion(this.world, this.x, this.y, this.z, false, 1); } - if(this.tick == 300) { + if (this.tick == 300) { ExplosionHelper.taintplosion(this.world, this.x, this.y, this.z, false, 1); } - if(this.tick > 400) { + if (this.tick > 400) { this.phase = 2; this.reduceAspects(this.causingNode); ExplosionHelper.taintplosion(this.world, this.x, this.y, this.z, true, 3); @@ -163,19 +196,19 @@ public class ExplosionHelper { private void reduceAspects(TileExtendedNode node) { List lostAspects = new ArrayList(); AspectList list = node.getAspectsBase(); - for(Aspect a : list.getAspects()) { - if(this.world.rand.nextInt(4) == 0) { + for (Aspect a : list.getAspects()) { + if (this.world.rand.nextInt(4) == 0) { lostAspects.add(a); } else { list.reduce(a, list.getAmount(a) / 2); } } - for(Aspect lost : lostAspects) { + for (Aspect lost : lostAspects) { node.getAspectsBase().remove(lost); node.getAspects().remove(lost); } list = node.getAspects(); - for(Aspect a : list.getAspects()) { + for (Aspect a : list.getAspects()) { list.reduce(a, list.getAmount(a) / 2); } node.getWorldObj().markBlockForUpdate(node.xCoord, node.yCoord, node.zCoord); @@ -184,7 +217,8 @@ public class ExplosionHelper { private void sendRandomVortexLightningPacket(World world, int x, int y, int z) { PacketStartAnimation animationPacket = new PacketStartAnimation(PacketStartAnimation.ID_EX_VORTEX, x, y, z); - NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32.0D); + NetworkRegistry.TargetPoint point = + new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32.0D); PacketHandler.INSTANCE.sendToAllAround(animationPacket, point); } @@ -205,7 +239,5 @@ public class ExplosionHelper { public boolean isFinished() { return this.phase > 1; } - } - } diff --git a/src/main/java/makeo/gadomancy/common/utils/GolemEnumHelper.java b/src/main/java/makeo/gadomancy/common/utils/GolemEnumHelper.java index d3d0d6a..8cbb321 100644 --- a/src/main/java/makeo/gadomancy/common/utils/GolemEnumHelper.java +++ b/src/main/java/makeo/gadomancy/common/utils/GolemEnumHelper.java @@ -1,6 +1,10 @@ package makeo.gadomancy.common.utils; import cpw.mods.fml.relauncher.Side; +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; import makeo.gadomancy.api.GadomancyApi; import makeo.gadomancy.api.golems.AdditionalGolemType; import makeo.gadomancy.client.events.ResourceReloadListener; @@ -9,11 +13,6 @@ import makeo.gadomancy.common.entities.golems.types.RemovedGolemType; import net.minecraftforge.common.util.EnumHelper; import thaumcraft.common.entities.golems.EnumGolemType; -import java.lang.reflect.Field; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -29,11 +28,15 @@ public class GolemEnumHelper { private static final Injector HELPER_INJECTOR = new Injector(EnumHelper.class); private static Field valuesField; + private static Field getValuesField() { - if(GolemEnumHelper.valuesField == null) { - for(Field field : EnumGolemType.class.getDeclaredFields()) { + if (GolemEnumHelper.valuesField == null) { + for (Field field : EnumGolemType.class.getDeclaredFields()) { String name = field.getName(); - if (name.equals("$VALUES") || name.equals("ENUM$VALUES")) //Added 'ENUM$VALUES' because Eclipse's internal compiler doesn't follow standards + if (name.equals("$VALUES") + || name.equals( + "ENUM$VALUES")) // Added 'ENUM$VALUES' because Eclipse's internal compiler doesn't + // follow standards { GolemEnumHelper.valuesField = field; GolemEnumHelper.valuesField.setAccessible(true); @@ -44,25 +47,43 @@ public class GolemEnumHelper { return GolemEnumHelper.valuesField; } - private static final Class[] ENUM_PARAMS = {int.class, int.class, float.class, boolean.class, int.class, - int.class, int.class, int.class}; + private static final Class[] ENUM_PARAMS = { + int.class, int.class, float.class, boolean.class, int.class, int.class, int.class, int.class + }; private static Field ordinalField; + public static Field getOrdinalField() { - if(GolemEnumHelper.ordinalField == null) { + if (GolemEnumHelper.ordinalField == null) { try { GolemEnumHelper.ordinalField = Enum.class.getDeclaredField("ordinal"); - } catch (NoSuchFieldException ignored) { } + } catch (NoSuchFieldException ignored) { + } } return GolemEnumHelper.ordinalField; } - private static final Class[] MAKE_ENUM_PARAMS = { Class.class, String.class, int.class, Class[].class, Object[].class }; + private static final Class[] MAKE_ENUM_PARAMS = {Class.class, String.class, int.class, Class[].class, Object[].class + }; private static EnumGolemType createEnum(String name, int ordinal, AdditionalGolemType type) { - return GolemEnumHelper.HELPER_INJECTOR.invokeMethod("makeEnum", GolemEnumHelper.MAKE_ENUM_PARAMS, - EnumGolemType.class, name, ordinal, GolemEnumHelper.ENUM_PARAMS, new Object[]{ type.maxHealth, type.armor, type.movementSpeed, - type.fireResist, type.upgradeAmount, type.carryLimit, type.regenDelay, type.strength }); + return GolemEnumHelper.HELPER_INJECTOR.invokeMethod( + "makeEnum", + GolemEnumHelper.MAKE_ENUM_PARAMS, + EnumGolemType.class, + name, + ordinal, + GolemEnumHelper.ENUM_PARAMS, + new Object[] { + type.maxHealth, + type.armor, + type.movementSpeed, + type.fireResist, + type.upgradeAmount, + type.carryLimit, + type.regenDelay, + type.strength + }); } private static void addEnum(int ordinal, EnumGolemType type) { @@ -79,11 +100,11 @@ public class GolemEnumHelper { private static EnumGolemType[] resizeValues(int size) { EnumGolemType[] values = GolemEnumHelper.INJECTOR.getField(GolemEnumHelper.getValuesField()); - if(size > values.length) { + if (size > values.length) { EnumGolemType[] newValues = new EnumGolemType[size]; System.arraycopy(values, 0, newValues, 0, values.length); - for(int i = values.length; i < newValues.length; i++) { + for (int i = values.length; i < newValues.length; i++) { newValues[i] = GolemEnumHelper.createEnum("REMOVED", i, GolemEnumHelper.REMOVED_GOLEM_TYPE); } GolemEnumHelper.setValues(newValues); @@ -95,7 +116,8 @@ public class GolemEnumHelper { private static void setValues(EnumGolemType[] values) { try { EnumHelper.setFailsafeFieldValue(GolemEnumHelper.getValuesField(), null, values); - } catch (Exception ignored) { } + } catch (Exception ignored) { + } } public static EnumGolemType addGolemType(String name, AdditionalGolemType type) { @@ -105,7 +127,7 @@ public class GolemEnumHelper { private static int getOrdinal(String name) { Map map = GolemEnumHelper.getCurrentMapping(); - if(map.containsKey(name)) { + if (map.containsKey(name)) { return map.get(name); } @@ -113,13 +135,13 @@ public class GolemEnumHelper { int i = GolemEnumHelper.calcDefaultGolemCount(); do { boolean contains = false; - for(Map.Entry entry : map.entrySet()) { - if(entry.getValue() == i) { + for (Map.Entry entry : map.entrySet()) { + if (entry.getValue() == i) { contains = true; } } - if(!contains) { + if (!contains) { returnVal = i; } i++; @@ -138,9 +160,9 @@ public class GolemEnumHelper { public static void reorderEnum(Map mapping) { EnumGolemType[] oldValues = EnumGolemType.values(); GolemEnumHelper.resetEnum(); - for(Map.Entry entry : mapping.entrySet()) { - for(EnumGolemType type : oldValues) { - if(type.name().equals(entry.getKey())) { + for (Map.Entry entry : mapping.entrySet()) { + for (EnumGolemType type : oldValues) { + if (type.name().equals(entry.getKey())) { GolemEnumHelper.ENUM_INJECTOR.setObject(type); GolemEnumHelper.ENUM_INJECTOR.setField(GolemEnumHelper.getOrdinalField(), entry.getValue()); GolemEnumHelper.addEnum(entry.getValue(), type); @@ -149,20 +171,21 @@ public class GolemEnumHelper { } new Injector(EnumGolemType.class).setField("codeToTypeMapping", null); - if(Gadomancy.proxy.getSide() == Side.CLIENT) { + if (Gadomancy.proxy.getSide() == Side.CLIENT) { ResourceReloadListener.getInstance().reloadGolemResources(); } } private static void resetEnum() { - EnumGolemType[] newValues = Arrays.copyOfRange(EnumGolemType.values(), 0, GolemEnumHelper.calcDefaultGolemCount()); + EnumGolemType[] newValues = + Arrays.copyOfRange(EnumGolemType.values(), 0, GolemEnumHelper.calcDefaultGolemCount()); GolemEnumHelper.setValues(newValues); } private static int calcDefaultGolemCount() { EnumGolemType[] values = EnumGolemType.values(); - for(int i = 0; i < values.length; i++) { - if(GadomancyApi.isAdditionalGolemType(values[i])) { + for (int i = 0; i < values.length; i++) { + if (GadomancyApi.isAdditionalGolemType(values[i])) { return i; } } @@ -170,10 +193,10 @@ public class GolemEnumHelper { } public static void validateSavedMapping() { - if(GolemEnumHelper.hasCurrentMapping()) { + if (GolemEnumHelper.hasCurrentMapping()) { Map mapping = GolemEnumHelper.getCurrentMapping(); - for(Map.Entry entry : GolemEnumHelper.defaultMapping.entrySet()) { - if(!mapping.containsKey(entry.getKey())) { + for (Map.Entry entry : GolemEnumHelper.defaultMapping.entrySet()) { + if (!mapping.containsKey(entry.getKey())) { mapping.put(entry.getKey(), GolemEnumHelper.getOrdinal(entry.getKey())); } } @@ -183,9 +206,9 @@ public class GolemEnumHelper { private static Map defaultMapping = new HashMap(); public static Map getCurrentMapping() { - if(GolemEnumHelper.hasCurrentMapping()) { + if (GolemEnumHelper.hasCurrentMapping()) { return Gadomancy.getModData().get("GolemTypeMapping", new HashMap()); - } else if(Gadomancy.getModData() != null) { + } else if (Gadomancy.getModData() != null) { Gadomancy.getModData().set("GolemTypeMapping", GolemEnumHelper.defaultMapping); } return GolemEnumHelper.defaultMapping; @@ -196,7 +219,7 @@ public class GolemEnumHelper { } private static void saveCurrentMapping(Map map) { - if(Gadomancy.getModData() != null) { + if (Gadomancy.getModData() != null) { Gadomancy.getModData().set("GolemTypeMapping", map); } } diff --git a/src/main/java/makeo/gadomancy/common/utils/Injector.java b/src/main/java/makeo/gadomancy/common/utils/Injector.java index 1ad518d..5bfcd70 100644 --- a/src/main/java/makeo/gadomancy/common/utils/Injector.java +++ b/src/main/java/makeo/gadomancy/common/utils/Injector.java @@ -1,7 +1,6 @@ package makeo.gadomancy.common.utils; import cpw.mods.fml.relauncher.ReflectionHelper; - import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -19,6 +18,7 @@ import java.util.Arrays; public class Injector { Class clazz; Object object; + public Injector(Object object, Class clazz) { this.object = object; this.clazz = clazz; @@ -67,7 +67,7 @@ public class Injector { } public T invokeConstructor(Class clazz, Object param) { - return this.invokeConstructor(new Class[]{clazz}, param); + return this.invokeConstructor(new Class[] {clazz}, param); } public T invokeConstructor(Class[] classes, Object... params) { @@ -75,7 +75,8 @@ public class Injector { Constructor constructor = this.clazz.getDeclaredConstructor(classes); this.object = constructor.newInstance(params); return (T) this.object; - } catch (Exception e) {//NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException + } catch (Exception e) { // NoSuchMethodException | InvocationTargetException | InstantiationException | + // IllegalAccessException e.printStackTrace(); } return null; @@ -86,14 +87,14 @@ public class Injector { } public T invokeMethod(String name, Class clazz, Object param) { - return this.invokeMethod(name, new Class[]{clazz}, param); + return this.invokeMethod(name, new Class[] {clazz}, param); } public T invokeMethod(String name, Class[] classes, Object... params) { try { Method method = this.clazz.getDeclaredMethod(name, classes); return this.invokeMethod(method, params); - } catch (Exception e) {//NoSuchMethodException | ClassCastException + } catch (Exception e) { // NoSuchMethodException | ClassCastException e.printStackTrace(); } return null; @@ -103,9 +104,8 @@ public class Injector { try { method.setAccessible(true); Object result = method.invoke(this.object, params); - if(result != null) - return (T) result; - } catch (Exception e) {//InvocationTargetException | IllegalAccessException | ClassCastException + if (result != null) return (T) result; + } catch (Exception e) { // InvocationTargetException | IllegalAccessException | ClassCastException e.printStackTrace(); } return null; @@ -113,8 +113,7 @@ public class Injector { private Class[] extractClasses(Object... objects) { Class[] classes = new Class[objects.length]; - for(int i = 0; i < objects.length; i++) - classes[i] = objects[i].getClass(); + for (int i = 0; i < objects.length; i++) classes[i] = objects[i].getClass(); return classes; } @@ -129,7 +128,7 @@ public class Injector { public boolean setField(Field field, Object value) { try { - if(Modifier.isFinal(field.getModifiers())) { + if (Modifier.isFinal(field.getModifiers())) { Field modifiers = Field.class.getDeclaredField("modifiers"); modifiers.setAccessible(true); modifiers.setInt(field, field.getModifiers() & ~Modifier.FINAL); @@ -138,7 +137,7 @@ public class Injector { field.setAccessible(true); field.set(this.object, value); return true; - } catch (Exception e) {//IllegalAccessException | NoSuchFieldException + } catch (Exception e) { // IllegalAccessException | NoSuchFieldException e.printStackTrace(); return false; } @@ -153,13 +152,12 @@ public class Injector { return null; } - public T getField(Field field) { + public T getField(Field field) { try { field.setAccessible(true); Object result = field.get(this.object); - if(result != null) - return (T) result; - } catch (Exception e) {//IllegalAccessException | ClassCastException + if (result != null) return (T) result; + } catch (Exception e) { // IllegalAccessException | ClassCastException e.printStackTrace(); } return null; @@ -174,8 +172,9 @@ public class Injector { } public static Method findMethod(Class clazz, Class returnType, Class[] paramTypes) { - for(Method m : clazz.getDeclaredMethods()) { - if(Arrays.equals(m.getParameterTypes(), paramTypes) && m.getReturnType().equals(returnType)) { + for (Method m : clazz.getDeclaredMethods()) { + if (Arrays.equals(m.getParameterTypes(), paramTypes) + && m.getReturnType().equals(returnType)) { return m; } } @@ -191,8 +190,8 @@ public class Injector { } public static Field findField(Class clazz, Class type) { - for(Field f : clazz.getDeclaredFields()) { - if(f.getType().equals(type)) { + for (Field f : clazz.getDeclaredFields()) { + if (f.getType().equals(type)) { return f; } } @@ -209,8 +208,7 @@ public class Injector { } public static Method getMethod(String name, Class clazz, Class... classes) { - if(clazz == null) - return null; + if (clazz == null) return null; try { return clazz.getDeclaredMethod(name, classes); diff --git a/src/main/java/makeo/gadomancy/common/utils/ItemUtils.java b/src/main/java/makeo/gadomancy/common/utils/ItemUtils.java index c56e94e..fe06e93 100644 --- a/src/main/java/makeo/gadomancy/common/utils/ItemUtils.java +++ b/src/main/java/makeo/gadomancy/common/utils/ItemUtils.java @@ -1,8 +1,7 @@ package makeo.gadomancy.common.utils; -import net.minecraft.entity.item.EntityItem; - import java.util.Random; +import net.minecraft.entity.item.EntityItem; /** * This class is part of the Gadomancy Mod @@ -19,5 +18,4 @@ public class ItemUtils { item.motionY = rand.nextFloat() * 0.7F - 0.35D; item.motionZ = rand.nextFloat() * 0.7F - 0.35D; } - } diff --git a/src/main/java/makeo/gadomancy/common/utils/MiscUtils.java b/src/main/java/makeo/gadomancy/common/utils/MiscUtils.java index 9835c73..8ff5f3b 100644 --- a/src/main/java/makeo/gadomancy/common/utils/MiscUtils.java +++ b/src/main/java/makeo/gadomancy/common/utils/MiscUtils.java @@ -1,6 +1,8 @@ package makeo.gadomancy.common.utils; import cpw.mods.fml.common.network.NetworkRegistry; +import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -11,9 +13,6 @@ import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; import net.minecraftforge.common.util.FakePlayer; -import java.util.ArrayList; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -26,11 +25,11 @@ public final class MiscUtils { private MiscUtils() {} - private static final int[] R_NUMBERS = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1}; + private static final int[] R_NUMBERS = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1}; private static final String[] R_CHARS = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"}; public static String toRomanNumeral(int number) { - if(number < 0 || number > 3999) { + if (number < 0 || number > 3999) { return String.valueOf(number); } String roman = ""; @@ -49,11 +48,11 @@ public final class MiscUtils { double iPz = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * partialTicks; return new Vector3(iPx, iPy, iPz); } - + public static int ticksForDays(int days) { return MiscUtils.ticksForHours(days * 24); } - + public static int ticksForHours(int hours) { return MiscUtils.ticksForMinutes(hours * 60); } @@ -69,12 +68,12 @@ public final class MiscUtils { public static List getCoordinatesAround(ChunkCoordinates center) { List coords = new ArrayList(); coords.add(new ChunkCoordinates(center.posX, center.posY, center.posZ)); - coords.add(new ChunkCoordinates(center.posX + 1, center.posY, center.posZ)); - coords.add(new ChunkCoordinates(center.posX, center.posY, center.posZ + 1)); - coords.add(new ChunkCoordinates(center.posX - 1, center.posY, center.posZ)); - coords.add(new ChunkCoordinates(center.posX, center.posY, center.posZ - 1)); - coords.add(new ChunkCoordinates(center.posX, center.posY - 1, center.posZ)); - coords.add(new ChunkCoordinates(center.posX, center.posY + 1, center.posZ)); + coords.add(new ChunkCoordinates(center.posX + 1, center.posY, center.posZ)); + coords.add(new ChunkCoordinates(center.posX, center.posY, center.posZ + 1)); + coords.add(new ChunkCoordinates(center.posX - 1, center.posY, center.posZ)); + coords.add(new ChunkCoordinates(center.posX, center.posY, center.posZ - 1)); + coords.add(new ChunkCoordinates(center.posX, center.posY - 1, center.posZ)); + coords.add(new ChunkCoordinates(center.posX, center.posY + 1, center.posZ)); return coords; } @@ -83,14 +82,16 @@ public final class MiscUtils { } public static NetworkRegistry.TargetPoint getTargetPoint(World world, TileEntity tileEntity, double range) { - return MiscUtils.getTargetPoint(world, range, new Vector3(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord)); + return MiscUtils.getTargetPoint( + world, range, new Vector3(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord)); } public static NetworkRegistry.TargetPoint getTargetPoint(World world, double range, Vector3 target) { - return new NetworkRegistry.TargetPoint(world.provider.dimensionId, target.getX(), target.getY(), target.getZ(), range); + return new NetworkRegistry.TargetPoint( + world.provider.dimensionId, target.getX(), target.getY(), target.getZ(), range); } - //Nothing to see here. Please move on. + // Nothing to see here. Please move on. public static boolean isANotApprovedOrMisunderstoodPersonFromMoreDoor(EntityPlayer player) { return MiscUtils.isNotApproved(player) || MiscUtils.isMisunderstood(player); } @@ -105,39 +106,41 @@ public final class MiscUtils { return uuHash == 1529485240; } - //For ppl we like. OK?!?!?!!!111111ELEVEN!!111 + // For ppl we like. OK?!?!?!!!111111ELEVEN!!111 public static boolean isPrivilegedUser(EntityPlayer player) { - if(MiscUtils.isANotApprovedOrMisunderstoodPersonFromMoreDoor(player)) return true; + if (MiscUtils.isANotApprovedOrMisunderstoodPersonFromMoreDoor(player)) return true; int uuHashOther = player.getUniqueID().hashCode(); switch (uuHashOther) { - case -1899266570: //SH_F - case -335313669: //RCNumbers - case 126020810: //Rk + case -1899266570: // SH_F + case -335313669: // RCNumbers + case 126020810: // Rk return true; } return false; } public static boolean isPlayerFakeMP(EntityPlayerMP player) { - if(player instanceof FakePlayer) return true; - if(player.getClass() != EntityPlayerMP.class) return true; - if(player.playerNetServerHandler == null) return true; + if (player instanceof FakePlayer) return true; + if (player.getClass() != EntityPlayerMP.class) return true; + if (player.playerNetServerHandler == null) return true; try { player.getPlayerIP().length(); player.playerNetServerHandler.netManager.getSocketAddress().toString(); } catch (Exception exc) { return true; } - if(MinecraftServer.getServer().getConfigurationManager().playerEntityList == null) return true; - return !MinecraftServer.getServer().getConfigurationManager().playerEntityList.contains(player); + if (MinecraftServer.getServer().getConfigurationManager().playerEntityList == null) return true; + return !MinecraftServer.getServer() + .getConfigurationManager() + .playerEntityList + .contains(player); } public static Vector3 getPositionVector(Entity e) { Vector3 v = new Vector3(e.posX, e.posY, e.posZ); - if(e instanceof EntityItem) { + if (e instanceof EntityItem) { v.setY(v.getY() + 0.2F); } return v; } - } diff --git a/src/main/java/makeo/gadomancy/common/utils/MultiblockHelper.java b/src/main/java/makeo/gadomancy/common/utils/MultiblockHelper.java index 323db09..63717c8 100644 --- a/src/main/java/makeo/gadomancy/common/utils/MultiblockHelper.java +++ b/src/main/java/makeo/gadomancy/common/utils/MultiblockHelper.java @@ -1,10 +1,9 @@ package makeo.gadomancy.common.utils; -import net.minecraft.block.Block; -import net.minecraft.world.World; - import java.util.LinkedHashMap; import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.world.World; /** * This class is part of the Gadomancy Mod @@ -16,19 +15,20 @@ import java.util.List; */ public class MultiblockHelper { - public static boolean isAnyMultiblockPresent(World world, int x, int y, int z, List patternList) { - for(MultiblockPattern pattern : patternList) { - if(MultiblockHelper.isMultiblockPresent(world, x, y, z, pattern)) return true; + public static boolean isAnyMultiblockPresent( + World world, int x, int y, int z, List patternList) { + for (MultiblockPattern pattern : patternList) { + if (MultiblockHelper.isMultiblockPresent(world, x, y, z, pattern)) return true; } return false; } public static boolean isMultiblockPresent(World world, int x, int y, int z, MultiblockPattern pattern) { - for(IntVec3 vec : pattern.keySet()) { + for (IntVec3 vec : pattern.keySet()) { BlockInfo expected = pattern.get(vec); Block realBlock = world.getBlock(x + vec.x, y + vec.y, z + vec.z); int realMeta = world.getBlockMetadata(x + vec.x, y + vec.y, z + vec.z); - if(expected.block != realBlock || expected.meta != realMeta) return false; + if (expected.block != realBlock || expected.meta != realMeta) return false; } return true; } @@ -39,7 +39,8 @@ public class MultiblockHelper { this.put(this.createIntVec3(0, 0, 0), new BlockInfo(originBlock, originMeta)); } - public MultiblockPattern addBlock(int relativeX, int relativeY, int relativeZ, Block expectedBlock, int expectedMeta) { + public MultiblockPattern addBlock( + int relativeX, int relativeY, int relativeZ, Block expectedBlock, int expectedMeta) { this.put(this.createIntVec3(relativeX, relativeY, relativeZ), new BlockInfo(expectedBlock, expectedMeta)); return this; } @@ -47,7 +48,6 @@ public class MultiblockHelper { private IntVec3 createIntVec3(int x, int y, int z) { return new IntVec3(x, y, z); } - } public static class IntVec3 { @@ -65,7 +65,6 @@ public class MultiblockHelper { if (o == null || this.getClass() != o.getClass()) return false; IntVec3 intVec3 = (IntVec3) o; return this.x == intVec3.x && this.y == intVec3.y && this.z == intVec3.z; - } @Override diff --git a/src/main/java/makeo/gadomancy/common/utils/NBTHelper.java b/src/main/java/makeo/gadomancy/common/utils/NBTHelper.java index b2c633e..df5912f 100644 --- a/src/main/java/makeo/gadomancy/common/utils/NBTHelper.java +++ b/src/main/java/makeo/gadomancy/common/utils/NBTHelper.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.utils; +import java.util.UUID; import makeo.gadomancy.common.Gadomancy; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; @@ -8,8 +9,6 @@ import net.minecraft.nbt.NBTTagCompound; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; -import java.util.UUID; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -31,7 +30,7 @@ public class NBTHelper { public static NBTTagCompound getPersistentData(NBTTagCompound base) { NBTTagCompound compound; - if(NBTHelper.hasPersistentData(base)) { + if (NBTHelper.hasPersistentData(base)) { compound = base.getCompoundTag(Gadomancy.MODID); } else { compound = new NBTTagCompound(); @@ -53,29 +52,27 @@ public class NBTHelper { return modData != null && modData instanceof NBTTagCompound; } - public static void removePersistentData(Entity entity) { NBTHelper.removePersistentData(entity.getEntityData()); } + public static void removePersistentData(ItemStack item) { - if(item.hasTagCompound()) NBTHelper.removePersistentData(item.getTagCompound()); + if (item.hasTagCompound()) NBTHelper.removePersistentData(item.getTagCompound()); } public static void removePersistentData(NBTTagCompound base) { base.removeTag(Gadomancy.MODID); } - public static NBTTagCompound getData(ItemStack stack) { NBTTagCompound compound = stack.getTagCompound(); - if(compound == null) { + if (compound == null) { compound = new NBTTagCompound(); stack.setTagCompound(compound); } return compound; } - public static void setStack(NBTTagCompound compound, String tag, ItemStack stack) { NBTTagCompound stackCompound = new NBTTagCompound(); stack.writeToNBT(stackCompound); @@ -96,13 +93,13 @@ public class NBTHelper { } public static AspectList getAspectList(NBTTagCompound compound, String tag, AspectList defaultValue) { - if(!compound.hasKey(tag)) return defaultValue; + if (!compound.hasKey(tag)) return defaultValue; NBTTagCompound cmp = compound.getCompoundTag(tag); AspectList out = new AspectList(); for (Object key : cmp.func_150296_c()) { String strKey = (String) key; Aspect a = Aspect.getAspect(strKey); - if(a != null) { + if (a != null) { out.add(a, cmp.getInteger(strKey)); } } @@ -124,16 +121,16 @@ public class NBTHelper { return NBTHelper.getUUID(compound, tag, null); } - //Get tags with default value + // Get tags with default value public static ItemStack getStack(NBTTagCompound compound, String tag, ItemStack defaultValue) { - if(compound.hasKey(tag)) { + if (compound.hasKey(tag)) { return ItemStack.loadItemStackFromNBT(compound.getCompoundTag(tag)); } return defaultValue; } public static UUID getUUID(NBTTagCompound compound, String tag, UUID defaultValue) { - if(compound.hasKey(tag)) { + if (compound.hasKey(tag)) { NBTTagCompound uuidComp = compound.getCompoundTag(tag); return new UUID(uuidComp.getLong("mostSigBits"), uuidComp.getLong("leastSigBits")); } diff --git a/src/main/java/makeo/gadomancy/common/utils/PrimalAspectList.java b/src/main/java/makeo/gadomancy/common/utils/PrimalAspectList.java index d22a6d2..bd0beab 100644 --- a/src/main/java/makeo/gadomancy/common/utils/PrimalAspectList.java +++ b/src/main/java/makeo/gadomancy/common/utils/PrimalAspectList.java @@ -29,7 +29,7 @@ public class PrimalAspectList extends AspectList { AspectList al = new AspectList(); al.add(aspect, amount); al = ResearchManager.reduceToPrimals(al); - for(Aspect a : al.getAspects()) { + for (Aspect a : al.getAspects()) { super.add(a, al.getAmount(a)); } return this; diff --git a/src/main/java/makeo/gadomancy/common/utils/RandomizedAspectList.java b/src/main/java/makeo/gadomancy/common/utils/RandomizedAspectList.java index d538f91..0888e61 100644 --- a/src/main/java/makeo/gadomancy/common/utils/RandomizedAspectList.java +++ b/src/main/java/makeo/gadomancy/common/utils/RandomizedAspectList.java @@ -1,11 +1,10 @@ package makeo.gadomancy.common.utils; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.aspects.AspectList; - import java.util.HashMap; import java.util.Map; import java.util.Random; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; /** * This class is part of the Gadomancy Mod @@ -33,18 +32,18 @@ public class RandomizedAspectList extends AspectList { } private void checkRandomization() { - if((System.currentTimeMillis() - this.lastRandomization) > 500) { + if ((System.currentTimeMillis() - this.lastRandomization) > 500) { super.aspects.clear(); - for(Aspect a : this.aspectMap.keySet()) { - if(a == null) continue; + for (Aspect a : this.aspectMap.keySet()) { + if (a == null) continue; int am; - if(this.halfCap) { + if (this.halfCap) { int c = this.aspectMap.get(a); am = (c / 2) + RandomizedAspectList.RANDOM.nextInt(c / 2); } else { am = RandomizedAspectList.RANDOM.nextInt(this.aspectMap.get(a)); } - if(am > 0) { + if (am > 0) { super.add(a, am); } } @@ -81,5 +80,4 @@ public class RandomizedAspectList extends AspectList { this.checkRandomization(); return super.getPrimalAspects(); } - } diff --git a/src/main/java/makeo/gadomancy/common/utils/ResearchHelper.java b/src/main/java/makeo/gadomancy/common/utils/ResearchHelper.java index 7c3f473..f4ce2dc 100644 --- a/src/main/java/makeo/gadomancy/common/utils/ResearchHelper.java +++ b/src/main/java/makeo/gadomancy/common/utils/ResearchHelper.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.utils; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.AxisAlignedBB; @@ -8,8 +9,6 @@ import thaumcraft.common.Thaumcraft; import thaumcraft.common.lib.network.playerdata.PacketResearchComplete; import thaumcraft.common.lib.research.ResearchManager; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -21,14 +20,17 @@ import java.util.List; public class ResearchHelper { public static void distributeResearch(String research, World world, double x, double y, double z, double radius) { - List players = world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(radius, radius, radius)); - for(Object pl : players) { + List players = world.getEntitiesWithinAABB( + EntityPlayer.class, + AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(radius, radius, radius)); + for (Object pl : players) { EntityPlayer player = (EntityPlayer) pl; - if(!ResearchManager.isResearchComplete(player.getCommandSenderName(), research) && ResearchManager.doesPlayerHaveRequisites(player.getCommandSenderName(), research)) { - thaumcraft.common.lib.network.PacketHandler.INSTANCE.sendTo(new PacketResearchComplete(research), (EntityPlayerMP)player); + if (!ResearchManager.isResearchComplete(player.getCommandSenderName(), research) + && ResearchManager.doesPlayerHaveRequisites(player.getCommandSenderName(), research)) { + thaumcraft.common.lib.network.PacketHandler.INSTANCE.sendTo( + new PacketResearchComplete(research), (EntityPlayerMP) player); Thaumcraft.proxy.getResearchManager().completeResearch(player, research); } } } - } diff --git a/src/main/java/makeo/gadomancy/common/utils/SimpleResourceLocation.java b/src/main/java/makeo/gadomancy/common/utils/SimpleResourceLocation.java index bae5c69..f473175 100644 --- a/src/main/java/makeo/gadomancy/common/utils/SimpleResourceLocation.java +++ b/src/main/java/makeo/gadomancy/common/utils/SimpleResourceLocation.java @@ -16,5 +16,4 @@ public class SimpleResourceLocation extends ResourceLocation { public SimpleResourceLocation(String file) { super(Gadomancy.MODID.toLowerCase(), "textures/" + (file.startsWith("/") ? file.substring(1) : file)); } - } diff --git a/src/main/java/makeo/gadomancy/common/utils/StringHelper.java b/src/main/java/makeo/gadomancy/common/utils/StringHelper.java index 6444d91..78e9286 100644 --- a/src/main/java/makeo/gadomancy/common/utils/StringHelper.java +++ b/src/main/java/makeo/gadomancy/common/utils/StringHelper.java @@ -14,8 +14,7 @@ public class StringHelper { private StringHelper() {} public static String firstToUpper(String input) { - if(input.length() > 0) - return Character.toUpperCase(input.charAt(0)) + input.substring(1); + if (input.length() > 0) return Character.toUpperCase(input.charAt(0)) + input.substring(1); return input; } @@ -31,5 +30,4 @@ public class StringHelper { buf.readBytes(strBytes, 0, length); return new String(strBytes); } - } diff --git a/src/main/java/makeo/gadomancy/common/utils/Vector3.java b/src/main/java/makeo/gadomancy/common/utils/Vector3.java index 4586cd8..af6ecbf 100644 --- a/src/main/java/makeo/gadomancy/common/utils/Vector3.java +++ b/src/main/java/makeo/gadomancy/common/utils/Vector3.java @@ -1,11 +1,10 @@ package makeo.gadomancy.common.utils; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.util.Vec3; - import java.util.Formatter; import java.util.Locale; import java.util.Random; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.Vec3; /** * This class is part of the Gadomancy Mod @@ -228,7 +227,10 @@ public class Vector3 { } public static Vector3 random() { - return new Vector3(Vector3.RAND.nextDouble() * (Vector3.RAND.nextBoolean() ? 1 : -1), Vector3.RAND.nextDouble() * (Vector3.RAND.nextBoolean() ? 1 : -1), Vector3.RAND.nextDouble() * (Vector3.RAND.nextBoolean() ? 1 : -1)); + return new Vector3( + Vector3.RAND.nextDouble() * (Vector3.RAND.nextBoolean() ? 1 : -1), + Vector3.RAND.nextDouble() * (Vector3.RAND.nextBoolean() ? 1 : -1), + Vector3.RAND.nextDouble() * (Vector3.RAND.nextBoolean() ? 1 : -1)); } public static Vector3 positiveYRandom() { @@ -240,7 +242,9 @@ public class Vector3 { } public ChunkCoordinates getAsFloatCC() { - return new ChunkCoordinates(Float.floatToIntBits((float) this.x), Float.floatToIntBits((float) this.y), Float.floatToIntBits((float) this.z)); + return new ChunkCoordinates( + Float.floatToIntBits((float) this.x), Float.floatToIntBits((float) this.y), Float.floatToIntBits((float) + this.z)); } public static Vector3 getFromFloatCC(ChunkCoordinates cc) { @@ -248,7 +252,12 @@ public class Vector3 { } public boolean isInAABB(Vector3 min, Vector3 max) { - return (this.x >= min.x) && (this.x <= max.x) && (this.y >= min.y) && (this.y <= max.y) && (this.z >= min.z) && (this.z <= max.z); + return (this.x >= min.x) + && (this.x <= max.x) + && (this.y >= min.y) + && (this.y <= max.y) + && (this.z >= min.z) + && (this.z <= max.z); } public boolean isInSphere(Vector3 origin, double radius) { @@ -337,7 +346,10 @@ public class Vector3 { } Vector3 other = (Vector3) obj; - return (Math.abs(this.x - other.x) < 1.0E-006D) && (Math.abs(this.y - other.y) < 1.0E-006D) && (Math.abs(this.z - other.z) < 1.0E-006D) && (this.getClass().equals(obj.getClass())); + return (Math.abs(this.x - other.x) < 1.0E-006D) + && (Math.abs(this.y - other.y) < 1.0E-006D) + && (Math.abs(this.z - other.z) < 1.0E-006D) + && (this.getClass().equals(obj.getClass())); } public int hashCode() { @@ -458,7 +470,5 @@ public class Vector3 { public static Quat aroundAxis(Vector3 axis, double angle) { return Quat.aroundAxis(axis.x, axis.y, axis.z, angle); } - } - } diff --git a/src/main/java/makeo/gadomancy/common/utils/WandHandler.java b/src/main/java/makeo/gadomancy/common/utils/WandHandler.java index 4cea380..2fd85ed 100644 --- a/src/main/java/makeo/gadomancy/common/utils/WandHandler.java +++ b/src/main/java/makeo/gadomancy/common/utils/WandHandler.java @@ -1,6 +1,8 @@ package makeo.gadomancy.common.utils; import cpw.mods.fml.common.network.NetworkRegistry; +import java.util.Iterator; +import java.util.List; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.blocks.tiles.TileExtendedNode; import makeo.gadomancy.common.blocks.tiles.TileExtendedNodeJar; @@ -37,9 +39,6 @@ import thaumcraft.common.tiles.TileJarNode; import thaumcraft.common.tiles.TileOwned; import thaumcraft.common.tiles.TileWarded; -import java.util.Iterator; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -50,91 +49,107 @@ import java.util.List; */ public class WandHandler { - //All wand interacts are redirected to this. + // 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 == null) return; - if(ModConfig.enableAdditionalNodeTypes) { + if (ModConfig.enableAdditionalNodeTypes) { if (target.equals(Blocks.glass)) { if (ResearchManager.isResearchComplete(entityPlayer.getCommandSenderName(), "NODEJAR")) { WandHandler.tryTCJarNodeCreation(i, entityPlayer, world, x, y, z); } } else if (target.equals(ConfigBlocks.blockWarded)) { - if (RegisteredIntegrations.automagy.isPresent() && - ResearchManager.isResearchComplete(entityPlayer.getCommandSenderName(), "ADVNODEJAR")) { + if (RegisteredIntegrations.automagy.isPresent() + && ResearchManager.isResearchComplete(entityPlayer.getCommandSenderName(), "ADVNODEJAR")) { WandHandler.tryAutomagyJarNodeCreation(i, entityPlayer, world, x, y, z); } } } - if(target.equals(ConfigBlocks.blockCrystal)) { - if (ResearchManager.isResearchComplete(entityPlayer.getCommandSenderName(), Gadomancy.MODID.toUpperCase() + ".AURA_CORE")) + if (target.equals(ConfigBlocks.blockCrystal)) { + if (ResearchManager.isResearchComplete( + entityPlayer.getCommandSenderName(), Gadomancy.MODID.toUpperCase() + ".AURA_CORE")) WandHandler.tryAuraCoreCreation(i, entityPlayer, world, x, y, z); } } private static void tryAuraCoreCreation(ItemStack i, EntityPlayer entityPlayer, World world, int x, int y, int z) { - if(world.isRemote) return; + if (world.isRemote) return; - List items = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1) - .expand(EntityAuraCore.CLUSTER_RANGE, EntityAuraCore.CLUSTER_RANGE, EntityAuraCore.CLUSTER_RANGE)); + List items = world.getEntitiesWithinAABB( + EntityItem.class, + AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1) + .expand( + EntityAuraCore.CLUSTER_RANGE, + EntityAuraCore.CLUSTER_RANGE, + EntityAuraCore.CLUSTER_RANGE)); Iterator it = items.iterator(); EntityItem itemAuraCore = null; - while(itemAuraCore == null && it.hasNext()) { + while (itemAuraCore == null && it.hasNext()) { Object item = it.next(); - if(item != null && item instanceof EntityItem && !((EntityItem) item).isDead) { + 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 && !(item instanceof EntityAuraCore)) { - if(((ItemAuraCore) entityItem.getEntityItem().getItem()).isBlank(entityItem.getEntityItem())) itemAuraCore = entityItem; + if (entityItem.getEntityItem() != null + && entityItem.getEntityItem().getItem() != null + && entityItem.getEntityItem().getItem() instanceof ItemAuraCore + && !(item instanceof EntityAuraCore)) { + if (((ItemAuraCore) entityItem.getEntityItem().getItem()).isBlank(entityItem.getEntityItem())) + itemAuraCore = entityItem; } } } - if(itemAuraCore == null) return; + if (itemAuraCore == null) return; int meta = world.getBlockMetadata(x, y, z); - if(meta <= 6) { + if (meta <= 6) { Aspect[] aspects; switch (meta) { case 0: - aspects = new Aspect[]{Aspect.AIR}; + aspects = new Aspect[] {Aspect.AIR}; break; case 1: - aspects = new Aspect[]{Aspect.FIRE}; + aspects = new Aspect[] {Aspect.FIRE}; break; case 2: - aspects = new Aspect[]{Aspect.WATER}; + aspects = new Aspect[] {Aspect.WATER}; break; case 3: - aspects = new Aspect[]{Aspect.EARTH}; + aspects = new Aspect[] {Aspect.EARTH}; break; case 4: - aspects = new Aspect[]{Aspect.ORDER}; + aspects = new Aspect[] {Aspect.ORDER}; break; case 5: - aspects = new Aspect[]{Aspect.ENTROPY}; + aspects = new Aspect[] {Aspect.ENTROPY}; break; case 6: - aspects = new Aspect[]{Aspect.AIR, Aspect.FIRE, Aspect.EARTH, Aspect.WATER, Aspect.ORDER, Aspect.ENTROPY}; + aspects = new Aspect[] { + Aspect.AIR, Aspect.FIRE, Aspect.EARTH, Aspect.WATER, Aspect.ORDER, Aspect.ENTROPY + }; break; default: return; } - if(!ThaumcraftApiHelper.consumeVisFromWandCrafting(i, entityPlayer, (AspectList)RegisteredRecipes.auraCoreRecipes[meta].get(0), true)) - return; - + if (!ThaumcraftApiHelper.consumeVisFromWandCrafting( + i, entityPlayer, (AspectList) RegisteredRecipes.auraCoreRecipes[meta].get(0), true)) return; PacketStartAnimation packet = new PacketStartAnimation(PacketStartAnimation.ID_BURST, x, y, z); - PacketHandler.INSTANCE.sendToAllAround(packet, new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32.0D)); + PacketHandler.INSTANCE.sendToAllAround( + packet, new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32.0D)); world.createExplosion(null, x + 0.5D, y + 0.5D, z + 0.5D, 1.5F, false); world.setBlockToAir(x, y, z); - EntityAuraCore ea = - new EntityAuraCore(itemAuraCore.worldObj, itemAuraCore.posX, itemAuraCore.posY, itemAuraCore.posZ, - itemAuraCore.getEntityItem(), new ChunkCoordinates(x, y, z), aspects); + EntityAuraCore ea = new EntityAuraCore( + itemAuraCore.worldObj, + itemAuraCore.posX, + itemAuraCore.posY, + itemAuraCore.posZ, + itemAuraCore.getEntityItem(), + new ChunkCoordinates(x, y, z), + aspects); ea.age = itemAuraCore.age; ea.hoverStart = itemAuraCore.hoverStart; ea.motionX = itemAuraCore.motionX; @@ -145,7 +160,8 @@ public class WandHandler { } } - private static void tryTCJarNodeCreation(ItemStack wandStack, EntityPlayer player, World world, int x, int y, int z) { + private static void tryTCJarNodeCreation( + ItemStack wandStack, EntityPlayer player, World world, int x, int y, int z) { WandHandler.JarPieceEvaluationRunnable slabRunnable = new WandHandler.JarPieceEvaluationRunnable() { @Override public boolean isValidPieceAt(World world, int absX, int absY, int absZ, EntityPlayer player) { @@ -167,27 +183,39 @@ public class WandHandler { return (tile != null) && (tile instanceof INode) && ((!(tile instanceof TileJarNode))); } }; - int[] result = WandHandler.evaluateIfValidJarIsPresent(world, x, y, z, player, slabRunnable, glassRunnable, nodeRunnable); + int[] result = WandHandler.evaluateIfValidJarIsPresent( + world, x, y, z, player, slabRunnable, glassRunnable, nodeRunnable); - if (result == null){ + if (result == null) { return; } - if(!ThaumcraftApiHelper.consumeVisFromWandCrafting(wandStack, player, new AspectList().add(Aspect.FIRE, 70).add(Aspect.EARTH, 70).add(Aspect.ORDER, 70).add(Aspect.AIR, 70).add(Aspect.ENTROPY, 70).add(Aspect.WATER, 70), true)) - return; + if (!ThaumcraftApiHelper.consumeVisFromWandCrafting( + wandStack, + player, + new AspectList() + .add(Aspect.FIRE, 70) + .add(Aspect.EARTH, 70) + .add(Aspect.ORDER, 70) + .add(Aspect.AIR, 70) + .add(Aspect.ENTROPY, 70) + .add(Aspect.WATER, 70), + true)) return; - if(world.isRemote) return; + if (world.isRemote) return; WandHandler.replaceJar(world, result[0], result[1], result[2], true); } - private static void tryAutomagyJarNodeCreation(ItemStack wandStack, EntityPlayer player, World world, int x, int y, int z) { + private static void tryAutomagyJarNodeCreation( + ItemStack wandStack, EntityPlayer player, World world, int x, int y, int z) { 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); if ((te instanceof TileWarded)) { TileWarded warded = (TileWarded) te; - if ((warded.block == ConfigBlocks.blockMagicalLog) && (BlockMagicalLog.limitToValidMetadata(warded.blockMd) == 1)) { + if ((warded.block == ConfigBlocks.blockMagicalLog) + && (BlockMagicalLog.limitToValidMetadata(warded.blockMd) == 1)) { return player.getCommandSenderName().hashCode() == warded.owner; } } @@ -197,7 +225,8 @@ public class WandHandler { 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)) { + if ((world.getBlock(absX, absY, absZ) == ConfigBlocks.blockCosmeticOpaque) + && (world.getBlockMetadata(absX, absY, absZ) == 2)) { TileEntity te = world.getTileEntity(absX, absY, absZ); if ((te instanceof TileOwned)) { return player.getCommandSenderName().equals(((TileOwned) te).owner); @@ -213,16 +242,17 @@ public class WandHandler { return (tile != null) && (tile instanceof INode) && ((!(tile instanceof TileJarNode))); } }; - int[] result = WandHandler.evaluateIfValidJarIsPresent(world, x, y, z, player, silverWoodRunnable, glassRunnable, nodeRunnable); + int[] result = WandHandler.evaluateIfValidJarIsPresent( + world, x, y, z, player, silverWoodRunnable, glassRunnable, nodeRunnable); - if (result == null){ + if (result == null) { return; } - if(!RegisteredIntegrations.automagy.handleNodeJarVisCost(wandStack, player)) return; + if (!RegisteredIntegrations.automagy.handleNodeJarVisCost(wandStack, player)) return; - if(world.isRemote) return; - if(!RegisteredIntegrations.automagy.isPresent()) return; + if (world.isRemote) return; + if (!RegisteredIntegrations.automagy.isPresent()) return; WandHandler.replaceJar(world, result[0], result[1], result[2], false); } @@ -237,11 +267,20 @@ public class WandHandler { return false; } - private static int[] evaluateIfValidJarIsPresent(World world, int x, int y, int z, EntityPlayer player, JarPieceEvaluationRunnable topRunnable, JarPieceEvaluationRunnable glassRunnable, JarPieceEvaluationRunnable centerRunnable) { + private static int[] evaluateIfValidJarIsPresent( + World world, + int x, + int y, + int z, + EntityPlayer player, + JarPieceEvaluationRunnable topRunnable, + JarPieceEvaluationRunnable glassRunnable, + JarPieceEvaluationRunnable centerRunnable) { for (int xx = x - 2; xx <= x; xx++) { for (int yy = y - 3; yy <= y; yy++) { for (int zz = z - 2; zz <= z; zz++) { - if (WandHandler.isValidJarAt(world, xx, yy, zz, player, topRunnable, glassRunnable, centerRunnable)) { + if (WandHandler.isValidJarAt( + world, xx, yy, zz, player, topRunnable, glassRunnable, centerRunnable)) { return new int[] {xx, yy, zz}; } } @@ -250,8 +289,21 @@ public class WandHandler { return null; } - private static boolean isValidJarAt(World world, int x, int y, int z, EntityPlayer player, JarPieceEvaluationRunnable topRunnable, JarPieceEvaluationRunnable glassRunnable, JarPieceEvaluationRunnable centerRunnable) { - int[][][] blueprint = {{{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}, {{2, 2, 2}, {2, 2, 2}, {2, 2, 2}}, {{2, 2, 2}, {2, 3, 2}, {2, 2, 2}}, {{2, 2, 2}, {2, 2, 2}, {2, 2, 2}}}; + private static boolean isValidJarAt( + World world, + int x, + int y, + int z, + EntityPlayer player, + JarPieceEvaluationRunnable topRunnable, + JarPieceEvaluationRunnable glassRunnable, + JarPieceEvaluationRunnable centerRunnable) { + int[][][] blueprint = { + {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}, + {{2, 2, 2}, {2, 2, 2}, {2, 2, 2}}, + {{2, 2, 2}, {2, 3, 2}, {2, 2, 2}}, + {{2, 2, 2}, {2, 2, 2}, {2, 2, 2}} + }; for (int yy = 0; yy < 4; yy++) { for (int xx = 0; xx < 3; xx++) { for (int zz = 0; zz < 3; zz++) { @@ -272,7 +324,12 @@ public class WandHandler { } private static void replaceJar(World world, int x, int y, int z, boolean isThaumcraft) { - int[][][] blueprint = {{{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}, {{2, 2, 2}, {2, 2, 2}, {2, 2, 2}}, {{2, 2, 2}, {2, 3, 2}, {2, 2, 2}}, {{2, 2, 2}, {2, 2, 2}, {2, 2, 2}}}; + int[][][] blueprint = { + {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}, + {{2, 2, 2}, {2, 2, 2}, {2, 2, 2}}, + {{2, 2, 2}, {2, 3, 2}, {2, 2, 2}}, + {{2, 2, 2}, {2, 2, 2}, {2, 2, 2}} + }; for (int yy = 0; yy < 4; yy++) { for (int xx = 0; xx < 3; xx++) { for (int zz = 0; zz < 3; zz++) { @@ -284,7 +341,7 @@ public class WandHandler { } } } - if(isThaumcraft) world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "thaumcraft:wand", 1.0F, 1.0F); + if (isThaumcraft) world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "thaumcraft:wand", 1.0F, 1.0F); } private static void handleJarForming(World world, int x, int y, int z, int xx, int yy, int zz, boolean degrade) { @@ -298,11 +355,11 @@ public class WandHandler { if (node.getNodeModifier() != null) { nm = node.getNodeModifier().ordinal(); } - if(tile instanceof TileExtendedNode && ((TileExtendedNode) tile).getExtendedNodeType() != null) { + if (tile instanceof TileExtendedNode && ((TileExtendedNode) tile).getExtendedNodeType() != null) { exNt = ((TileExtendedNode) tile).getExtendedNodeType().ordinal(); behaviorSnapshot = ((TileExtendedNode) tile).getBehaviorSnapshot(); } - if(degrade) { + if (degrade) { if (world.rand.nextFloat() < 0.75F) { if (node.getNodeModifier() == null) { nm = NodeModifier.PALE.ordinal(); @@ -316,7 +373,7 @@ public class WandHandler { String nid = node.getId(); node.setAspects(new AspectList()); world.removeTileEntity(x + xx, y - yy + 2, z + zz); - if(exNt != -1) { + if (exNt != -1) { world.setBlock(x + xx, y - yy + 2, z + zz, RegisteredBlocks.blockExtendedNodeJar, 0, 3); tile = world.getTileEntity(x + xx, y - yy + 2, z + zz); TileExtendedNodeJar exJar = (TileExtendedNodeJar) tile; @@ -326,7 +383,7 @@ public class WandHandler { } exJar.setNodeType(NodeType.values()[nt]); exJar.setExtendedNodeType(ExtendedNodeType.values()[exNt]); - if(behaviorSnapshot != null) { + if (behaviorSnapshot != null) { exJar.setBehaviorSnapshot(behaviorSnapshot); } exJar.setId(nid); @@ -348,7 +405,5 @@ public class WandHandler { public abstract static class JarPieceEvaluationRunnable { public abstract boolean isValidPieceAt(World world, int absX, int absY, int absZ, EntityPlayer player); - } - } diff --git a/src/main/java/makeo/gadomancy/common/utils/world/ChunkProviderTCOuter.java b/src/main/java/makeo/gadomancy/common/utils/world/ChunkProviderTCOuter.java index 336af74..2e7f8e7 100644 --- a/src/main/java/makeo/gadomancy/common/utils/world/ChunkProviderTCOuter.java +++ b/src/main/java/makeo/gadomancy/common/utils/world/ChunkProviderTCOuter.java @@ -1,5 +1,7 @@ package makeo.gadomancy.common.utils.world; +import java.util.Iterator; +import java.util.List; import makeo.gadomancy.common.blocks.tiles.TileOverrideEldritchLock; import makeo.gadomancy.common.utils.world.fake.FakeWorldTCGeneration; import net.minecraft.block.Block; @@ -26,9 +28,6 @@ import thaumcraft.common.tiles.TileEldritchCrabSpawner; import thaumcraft.common.tiles.TileEldritchLock; import thaumcraft.common.tiles.TileEldritchNothing; -import java.util.Iterator; -import java.util.List; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -56,12 +55,17 @@ public class ChunkProviderTCOuter implements IChunkProvider { public Chunk provideChunk(int x, int z) { Chunk chunk; long key = ((long) x) | ((long) z) << 32; - if(TCMazeHandler.GEN.chunks.containsKey(key)) { + if (TCMazeHandler.GEN.chunks.containsKey(key)) { FakeWorldTCGeneration.ChunkBuffer buf = TCMazeHandler.GEN.chunks.get(key); - for(int i = 0; i < buf.blockData.length; i++) { - if(buf.blockData[i] == ConfigBlocks.blockEldritchNothing) { - ConfigBlocks.blockEldritchNothing.onNeighborBlockChange(TCMazeHandler.GEN, (i >> 11 & 15) | (x << 4), i & 127, (i >> 7 & 15) | (z << 4), ConfigBlocks.blockEldritchNothing); + for (int i = 0; i < buf.blockData.length; i++) { + if (buf.blockData[i] == ConfigBlocks.blockEldritchNothing) { + ConfigBlocks.blockEldritchNothing.onNeighborBlockChange( + TCMazeHandler.GEN, + (i >> 11 & 15) | (x << 4), + i & 127, + (i >> 7 & 15) | (z << 4), + ConfigBlocks.blockEldritchNothing); } } @@ -72,10 +76,10 @@ public class ChunkProviderTCOuter implements IChunkProvider { byte[] abyte = chunk.getBiomeArray(); System.arraycopy(ChunkProviderTCOuter.biomeArr, 0, abyte, 0, ChunkProviderTCOuter.biomeArr.length); - for(Integer[] pos : buf.tiles) { + for (Integer[] pos : buf.tiles) { TileEntity te = buf.blockData[pos[3]].createTileEntity(this.worldObj, buf.metaBuffer[pos[3]]); - if(te != null) { - if(te instanceof TileEldritchLock) { + if (te != null) { + if (te instanceof TileEldritchLock) { te = new TileOverrideEldritchLock(); } @@ -86,26 +90,34 @@ public class ChunkProviderTCOuter implements IChunkProvider { } Iterator it = TCMazeHandler.GEN.gettedTE.keySet().iterator(); - while(it.hasNext()) { + while (it.hasNext()) { ChunkCoordinates cc = it.next(); TileEntity te = TCMazeHandler.GEN.gettedTE.get(cc); - if(te.xCoord >> 4 != x || te.zCoord >> 4 != z) continue; + if (te.xCoord >> 4 != x || te.zCoord >> 4 != z) continue; ChunkPosition pos = new ChunkPosition(te.xCoord & 15, te.yCoord, te.zCoord & 15); - if(!chunk.chunkTileEntityMap.containsKey(pos)) { - System.out.println("INVALID TE at: " + te.xCoord + ", " + te.yCoord + ", " + te.zCoord + " --- Not found in its parent chunk " + chunk.xPosition + ", " + chunk.zPosition); + if (!chunk.chunkTileEntityMap.containsKey(pos)) { + System.out.println("INVALID TE at: " + te.xCoord + ", " + te.yCoord + ", " + te.zCoord + + " --- Not found in its parent chunk " + chunk.xPosition + ", " + chunk.zPosition); throw new IllegalStateException("INVALID TE"); } TileEntity correspondingTE = (TileEntity) chunk.chunkTileEntityMap.get(pos); - if(te instanceof TileEntityMobSpawner) { - if(!(correspondingTE instanceof TileEntityMobSpawner)) { - System.out.println("DATA INCONSISTENCY - TE at " + te.xCoord + ", " + te.yCoord + ", " + te.zCoord + " EXPECTED: " + te.getClass().getSimpleName() + " GIVEN " + correspondingTE.getClass().getSimpleName()); + if (te instanceof TileEntityMobSpawner) { + if (!(correspondingTE instanceof TileEntityMobSpawner)) { + System.out.println("DATA INCONSISTENCY - TE at " + te.xCoord + ", " + te.yCoord + ", " + + te.zCoord + " EXPECTED: " + te.getClass().getSimpleName() + " GIVEN " + + correspondingTE.getClass().getSimpleName()); throw new IllegalStateException(); } - ((TileEntityMobSpawner) correspondingTE).func_145881_a().setEntityName(((TileEntityMobSpawner) te).func_145881_a().getEntityNameToSpawn()); - } else if(te instanceof TileEldritchLock) { - if(!(correspondingTE instanceof TileEldritchLock)) { - System.out.println("DATA INCONSISTENCY - TE at " + te.xCoord + ", " + te.yCoord + ", " + te.zCoord + " EXPECTED: " + te.getClass().getSimpleName() + " GIVEN " + correspondingTE.getClass().getSimpleName()); + ((TileEntityMobSpawner) correspondingTE) + .func_145881_a() + .setEntityName( + ((TileEntityMobSpawner) te).func_145881_a().getEntityNameToSpawn()); + } else if (te instanceof TileEldritchLock) { + if (!(correspondingTE instanceof TileEldritchLock)) { + System.out.println("DATA INCONSISTENCY - TE at " + te.xCoord + ", " + te.yCoord + ", " + + te.zCoord + " EXPECTED: " + te.getClass().getSimpleName() + " GIVEN " + + correspondingTE.getClass().getSimpleName()); throw new IllegalStateException(); } @@ -113,25 +125,31 @@ public class ChunkProviderTCOuter implements IChunkProvider { compound.setByte("facing", ((TileEldritchLock) te).getFacing()); compound.setShort("count", (short) -1); ((TileEldritchLock) correspondingTE).readCustomNBT(compound); - } else if(te instanceof TileCrystal) { - if(!(correspondingTE instanceof TileCrystal)) { - System.out.println("DATA INCONSISTENCY - TE at " + te.xCoord + ", " + te.yCoord + ", " + te.zCoord + " EXPECTED: " + te.getClass().getSimpleName() + " GIVEN " + correspondingTE.getClass().getSimpleName()); + } else if (te instanceof TileCrystal) { + if (!(correspondingTE instanceof TileCrystal)) { + System.out.println("DATA INCONSISTENCY - TE at " + te.xCoord + ", " + te.yCoord + ", " + + te.zCoord + " EXPECTED: " + te.getClass().getSimpleName() + " GIVEN " + + correspondingTE.getClass().getSimpleName()); throw new IllegalStateException(); } ((TileCrystal) correspondingTE).orientation = ((TileCrystal) te).orientation; - } else if(te instanceof TileEldritchCrabSpawner) { - if(!(correspondingTE instanceof TileEldritchCrabSpawner)) { - System.out.println("DATA INCONSISTENCY - TE at " + te.xCoord + ", " + te.yCoord + ", " + te.zCoord + " EXPECTED: " + te.getClass().getSimpleName() + " GIVEN " + correspondingTE.getClass().getSimpleName()); + } else if (te instanceof TileEldritchCrabSpawner) { + if (!(correspondingTE instanceof TileEldritchCrabSpawner)) { + System.out.println("DATA INCONSISTENCY - TE at " + te.xCoord + ", " + te.yCoord + ", " + + te.zCoord + " EXPECTED: " + te.getClass().getSimpleName() + " GIVEN " + + correspondingTE.getClass().getSimpleName()); throw new IllegalStateException(); } NBTTagCompound compound = new NBTTagCompound(); compound.setByte("facing", ((TileEldritchCrabSpawner) te).getFacing()); ((TileEldritchCrabSpawner) correspondingTE).readCustomNBT(compound); - } else if(te instanceof TileEldritchNothing) { + } else if (te instanceof TileEldritchNothing) { if (!(correspondingTE instanceof TileEldritchNothing)) { - System.out.println("DATA INCONSISTENCY - TE at " + te.xCoord + ", " + te.yCoord + ", " + te.zCoord + " EXPECTED: " + te.getClass().getSimpleName() + " GIVEN " + correspondingTE.getClass().getSimpleName()); + System.out.println("DATA INCONSISTENCY - TE at " + te.xCoord + ", " + te.yCoord + ", " + + te.zCoord + " EXPECTED: " + te.getClass().getSimpleName() + " GIVEN " + + correspondingTE.getClass().getSimpleName()); throw new IllegalStateException(); } } else { @@ -141,21 +159,21 @@ public class ChunkProviderTCOuter implements IChunkProvider { } Iterator itEntity = TCMazeHandler.GEN.bufferedEntities.iterator(); - while(itEntity.hasNext()) { + while (itEntity.hasNext()) { Object bufE = itEntity.next(); - if(bufE instanceof FakeWorldTCGeneration.EntityPermItem) { + if (bufE instanceof FakeWorldTCGeneration.EntityPermItem) { FakeWorldTCGeneration.EntityPermItem i = (FakeWorldTCGeneration.EntityPermItem) bufE; - if(((int) i.x >> 4) != x || ((int) i.z >> 4) != z) continue; + if (((int) i.x >> 4) != x || ((int) i.z >> 4) != z) continue; EntityPermanentItem item = new EntityPermanentItem(this.worldObj, i.x, i.y, i.z, i.buffItemStack); item.motionX = 0; item.motionY = 0; item.motionZ = 0; chunk.addEntity(item); itEntity.remove(); - } else if(bufE instanceof FakeWorldTCGeneration.EntityGuardianBuf) { + } else if (bufE instanceof FakeWorldTCGeneration.EntityGuardianBuf) { FakeWorldTCGeneration.EntityGuardianBuf b = (FakeWorldTCGeneration.EntityGuardianBuf) bufE; - if(((int) b.x >> 4) != x || ((int) b.z >> 4) != z) continue; + if (((int) b.x >> 4) != x || ((int) b.z >> 4) != z) continue; EntityEldritchGuardian guardian = new EntityEldritchGuardian(this.worldObj); guardian.setPosition(b.x, b.y, b.z); guardian.setHomeArea(b.coordinates.posX, b.coordinates.posY, b.coordinates.posZ, (int) b.dst); @@ -166,12 +184,12 @@ public class ChunkProviderTCOuter implements IChunkProvider { } } - for(int cX = 0; cX < 16; cX++) { - for(int cY = 50; cY < 64; cY++) { - for(int cZ = 0; cZ < 16; cZ++) { + for (int cX = 0; cX < 16; cX++) { + for (int cY = 50; cY < 64; cY++) { + for (int cZ = 0; cZ < 16; cZ++) { int lightKey = ((cX & 15) << 4 | (cZ & 15)) << 7 | cY; int lightVal = buf.lightData[lightKey]; - if(lightVal > 0) { + if (lightVal > 0) { chunk.setLightValue(EnumSkyBlock.Block, cX, cY, cZ, lightVal); } } @@ -200,14 +218,16 @@ public class ChunkProviderTCOuter implements IChunkProvider { public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) { net.minecraft.block.BlockFalling.fallInstantly = true; - MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, this.worldObj, this.worldObj.rand, p_73153_2_, p_73153_3_, false)); + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre( + p_73153_1_, this.worldObj, this.worldObj.rand, p_73153_2_, p_73153_3_, false)); int k = p_73153_2_ * 16; int l = p_73153_3_ * 16; BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16); biomegenbase.decorate(this.worldObj, this.worldObj.rand, k, l); - MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, this.worldObj, this.worldObj.rand, p_73153_2_, p_73153_3_, false)); + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post( + p_73153_1_, this.worldObj, this.worldObj.rand, p_73153_2_, p_73153_3_, false)); net.minecraft.block.BlockFalling.fallInstantly = false; } @@ -234,7 +254,8 @@ public class ChunkProviderTCOuter implements IChunkProvider { return biomegenbase.getSpawnableList(p_73155_1_); } - public ChunkPosition func_147416_a(World p_147416_1_, String p_147416_2_, int p_147416_3_, int p_147416_4_, int p_147416_5_) { + public ChunkPosition func_147416_a( + World p_147416_1_, String p_147416_2_, int p_147416_3_, int p_147416_4_, int p_147416_5_) { return null; } @@ -261,7 +282,7 @@ public class ChunkProviderTCOuter implements IChunkProvider { } } } - for(int i = 0; i < ChunkProviderTCOuter.biomeArr.length; i++) { + for (int i = 0; i < ChunkProviderTCOuter.biomeArr.length; i++) { ChunkProviderTCOuter.biomeArr[i] = (byte) ThaumcraftWorldGenerator.biomeEldritchLands.biomeID; } } diff --git a/src/main/java/makeo/gadomancy/common/utils/world/TCMazeHandler.java b/src/main/java/makeo/gadomancy/common/utils/world/TCMazeHandler.java index 1695aad..6127117 100644 --- a/src/main/java/makeo/gadomancy/common/utils/world/TCMazeHandler.java +++ b/src/main/java/makeo/gadomancy/common/utils/world/TCMazeHandler.java @@ -1,5 +1,7 @@ package makeo.gadomancy.common.utils.world; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import makeo.gadomancy.common.blocks.tiles.TileAdditionalEldritchPortal; import makeo.gadomancy.common.data.config.ModConfig; import makeo.gadomancy.common.registration.RegisteredBlocks; @@ -18,9 +20,6 @@ import thaumcraft.common.lib.world.dim.GenCommon; import thaumcraft.common.lib.world.dim.MazeHandler; import thaumcraft.common.lib.world.dim.MazeThread; -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -31,12 +30,12 @@ import java.util.concurrent.ConcurrentHashMap; */ public class TCMazeHandler { - //How maze gen works overall (for us): - //Defining what chunks are currently occupied with the 'labyrinthCopy' map. - //If a chunk is not listed in there, it's considered empty. - //level saving itself is disabled. Players without active session will get teleported out. + // How maze gen works overall (for us): + // Defining what chunks are currently occupied with the 'labyrinthCopy' map. + // If a chunk is not listed in there, it's considered empty. + // level saving itself is disabled. Players without active session will get teleported out. - //Our map to work with. + // Our map to work with. public static ConcurrentHashMap labyrinthCopy = new ConcurrentHashMap(); public static final int TELEPORT_LAYER_Y = 55; private static int tickCounter; @@ -73,12 +72,15 @@ public class TCMazeHandler { player.setPositionAndUpdate(cc.posX + 0.5, y, cc.posZ + 0.5); } } - Iterator> it = TCMazeHandler.runningSessions.entrySet().iterator(); - while(it.hasNext()) { + Iterator> it = + TCMazeHandler.runningSessions.entrySet().iterator(); + while (it.hasNext()) { Map.Entry entry = it.next(); EntityPlayer player = entry.getKey(); - if (player.worldObj.provider.dimensionId != ModConfig.dimOuterId) { //If the player left our dim, but he should still be in the session, ... - //We close the session. + if (player.worldObj.provider.dimensionId + != ModConfig + .dimOuterId) { // If the player left our dim, but he should still be in the session, ... + // We close the session. entry.getValue().closeSession(false); it.remove(); } @@ -94,7 +96,8 @@ public class TCMazeHandler { world.setBlock(lX, 52, lZ, ConfigBlocks.blockEldritch, 3, 3); world.setBlock(lX, 53, lZ, RegisteredBlocks.blockAdditionalEldrichPortal); GenCommon.genObelisk(world, lX, 54, lZ); - session.player.addChatMessage(new ChatComponentText(EnumChatFormatting.ITALIC + "" + EnumChatFormatting.GRAY + StatCollector.translateToLocal("gadomancy.eldritch.portalSpawned"))); + session.player.addChatMessage(new ChatComponentText(EnumChatFormatting.ITALIC + "" + EnumChatFormatting.GRAY + + StatCollector.translateToLocal("gadomancy.eldritch.portalSpawned"))); } /* @@ -122,14 +125,15 @@ public class TCMazeHandler { private static Map calculateCellLocs(WorldServer world) { ConcurrentHashMap oldDat = MazeHandler.labyrinth; - ConcurrentHashMap bufferOld = new ConcurrentHashMap(TCMazeHandler.labyrinthCopy); + ConcurrentHashMap bufferOld = + new ConcurrentHashMap(TCMazeHandler.labyrinthCopy); MazeHandler.labyrinth = TCMazeHandler.labyrinthCopy; - int chX = TCMazeHandler.getHighestPossibleRandWH(); //To ensure we're always +x and +z + int chX = TCMazeHandler.getHighestPossibleRandWH(); // To ensure we're always +x and +z int chZ = TCMazeHandler.getHighestPossibleRandWH(); int w = TCMazeHandler.randWH(world.rand); int h = TCMazeHandler.randWH(world.rand); while (MazeHandler.mazesInRange(chX, chZ, w, h)) { - chX++; //We grow the mazes in +x direction! + chX++; // We grow the mazes in +x direction! } MazeThread mt = new MazeThread(chX, chZ, w, h, world.rand.nextLong()); mt.run(); @@ -140,7 +144,8 @@ public class TCMazeHandler { } private static Map calculateDifferences(ConcurrentHashMap bufferOld) { - ConcurrentHashMap newDat = MazeHandler.labyrinth; //Only the new data has data, the old one doesn't have. + ConcurrentHashMap newDat = + MazeHandler.labyrinth; // Only the new data has data, the old one doesn't have. Map newlyEvaluatedMaze = new HashMap(); for (CellLoc loc : newDat.keySet()) { if (!bufferOld.containsKey(loc)) { @@ -162,8 +167,8 @@ public class TCMazeHandler { } private static int getHighestPossibleRandWH() { - //Add something to ensure 100% we never get in minus coordinates! - return 29; //21 + ensured 8 + // Add something to ensure 100% we never get in minus coordinates! + return 29; // 21 + ensured 8 } public static void init() { @@ -198,21 +203,23 @@ public class TCMazeHandler { TCMazeHandler.tickCounter++; Iterator it = TCMazeHandler.flaggedSessions.iterator(); - while(it.hasNext()) { + while (it.hasNext()) { TCMazeSession s = it.next(); it.remove(); s.startSession(); TCMazeHandler.runningSessions.put(s.player, s); } - if((TCMazeHandler.tickCounter & 15) == 0) { - Iterator> iterator = TCMazeHandler.watchedBosses.entrySet().iterator(); - labelWhile: while (iterator.hasNext()) { + if ((TCMazeHandler.tickCounter & 15) == 0) { + Iterator> iterator = + TCMazeHandler.watchedBosses.entrySet().iterator(); + labelWhile: + while (iterator.hasNext()) { Map.Entry entry = iterator.next(); TCMazeSession session = entry.getKey(); Entity[] bosses = entry.getValue(); - for(Entity entity : bosses) { - if(entity != null && !entity.isDead) { + for (Entity entity : bosses) { + if (entity != null && !entity.isDead) { continue labelWhile; } } @@ -239,7 +246,8 @@ public class TCMazeHandler { private final int originDimId; private final Vec3 originLocation; - public MazeBuilderThread(EntityPlayerMP player, Map chunksAffected, int originDimId, Vec3 originLocation) { + public MazeBuilderThread( + EntityPlayerMP player, Map chunksAffected, int originDimId, Vec3 originLocation) { this.player = player; this.chunksAffected = chunksAffected; this.originDimId = originDimId; @@ -256,12 +264,13 @@ public class TCMazeHandler { } MazeHandler.labyrinth = old; - if(ModConfig.doLightCalculations) { - for(CellLoc l : this.chunksAffected.keySet()) { - for(int cX = 0; cX < 16; cX++) { - for(int cY = 51; cY < 61; cY++) { - for(int cZ = 0; cZ < 16; cZ++) { - TCMazeHandler.GEN.updateLightByType(EnumSkyBlock.Block, (l.x << 4)+cX, cY, (l.z << 4)+cZ); + if (ModConfig.doLightCalculations) { + for (CellLoc l : this.chunksAffected.keySet()) { + for (int cX = 0; cX < 16; cX++) { + for (int cY = 51; cY < 61; cY++) { + for (int cZ = 0; cZ < 16; cZ++) { + TCMazeHandler.GEN.updateLightByType( + EnumSkyBlock.Block, (l.x << 4) + cX, cY, (l.z << 4) + cZ); } } } @@ -273,9 +282,9 @@ public class TCMazeHandler { private void finishBuild() { TileAdditionalEldritchPortal.informSessionStart(this.player); - TCMazeSession session = new TCMazeSession(this.player, this.chunksAffected, this.originDimId, this.originLocation); + TCMazeSession session = + new TCMazeSession(this.player, this.chunksAffected, this.originDimId, this.originLocation); TCMazeHandler.flagSessionForStart(session); } - } } diff --git a/src/main/java/makeo/gadomancy/common/utils/world/TCMazeSession.java b/src/main/java/makeo/gadomancy/common/utils/world/TCMazeSession.java index a8f434b..28db658 100644 --- a/src/main/java/makeo/gadomancy/common/utils/world/TCMazeSession.java +++ b/src/main/java/makeo/gadomancy/common/utils/world/TCMazeSession.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.utils.world; +import java.util.Map; import makeo.gadomancy.common.data.config.ModConfig; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -15,8 +16,6 @@ import thaumcraft.common.Thaumcraft; import thaumcraft.common.lib.world.dim.Cell; import thaumcraft.common.lib.world.dim.CellLoc; -import java.util.Map; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -51,10 +50,10 @@ public class TCMazeSession { } private CellLoc findPortal() { - for(CellLoc loc : this.chunksAffected.keySet()) { + for (CellLoc loc : this.chunksAffected.keySet()) { Short s = this.chunksAffected.get(loc); Cell c = new Cell(s); - if(c.feature == 1) { + if (c.feature == 1) { return loc; } } @@ -63,34 +62,39 @@ public class TCMazeSession { final void closeSession(boolean teleport) { TCMazeHandler.free(this.chunksAffected); - if(teleport) { + if (teleport) { WorldUtil.tryTeleportBack(this.player, this.originDimId); - this.player.setPositionAndUpdate(this.originLocation.xCoord, this.originLocation.yCoord, this.originLocation.zCoord); + this.player.setPositionAndUpdate( + this.originLocation.xCoord, this.originLocation.yCoord, this.originLocation.zCoord); } } final void startSession() { WorldServer ws = MinecraftServer.getServer().worldServerForDimension(ModConfig.dimOuterId); - for(CellLoc loc : this.chunksAffected.keySet()) { + for (CellLoc loc : this.chunksAffected.keySet()) { long k = ChunkCoordIntPair.chunkXZ2Int(loc.x, loc.z); - if(ws.theChunkProviderServer.loadedChunkHashMap.containsItem(k)) { + if (ws.theChunkProviderServer.loadedChunkHashMap.containsItem(k)) { Chunk c = (Chunk) ws.theChunkProviderServer.loadedChunkHashMap.getValueByKey(k); ws.theChunkProviderServer.loadedChunks.remove(c); ws.theChunkProviderServer.loadedChunkHashMap.remove(k); } } - if(this.portalCell == null) { - LogManager.getLogger().error("Thaumcraft didn't generate a portal! Stopping instance! PLEASE REPORT THIS ERROR!", new IllegalStateException()); + if (this.portalCell == null) { + LogManager.getLogger() + .error( + "Thaumcraft didn't generate a portal! Stopping instance! PLEASE REPORT THIS ERROR!", + new IllegalStateException()); this.closeSession(false); - this.player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Thaumcraft didn't generate a portal in the Eldritch dimension. Sorry, we can't teleport you..")); + this.player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + + "Thaumcraft didn't generate a portal in the Eldritch dimension. Sorry, we can't teleport you..")); } else { WorldUtil.teleportToFakeOuter(this.player); int x = this.portalCell.x * 16 + 8; int z = this.portalCell.z * 16 + 8; this.player.setPositionAndUpdate(x + 0.5, TCMazeHandler.TELEPORT_LAYER_Y, z + 0.5); - Thaumcraft.proxy.getResearchManager().completeResearch(this.player, "ENTEROUTER"); //badumm tss + Thaumcraft.proxy.getResearchManager().completeResearch(this.player, "ENTEROUTER"); // badumm tss } } diff --git a/src/main/java/makeo/gadomancy/common/utils/world/TeleporterNothing.java b/src/main/java/makeo/gadomancy/common/utils/world/TeleporterNothing.java index b8eac5e..d976183 100644 --- a/src/main/java/makeo/gadomancy/common/utils/world/TeleporterNothing.java +++ b/src/main/java/makeo/gadomancy/common/utils/world/TeleporterNothing.java @@ -22,10 +22,12 @@ public class TeleporterNothing extends Teleporter { public void removeStalePortalLocations(long p_85189_1_) {} @Override - public void placeInPortal(Entity p_77185_1_, double p_77185_2_, double p_77185_4_, double p_77185_6_, float p_77185_8_) {} + public void placeInPortal( + Entity p_77185_1_, double p_77185_2_, double p_77185_4_, double p_77185_6_, float p_77185_8_) {} @Override - public boolean placeInExistingPortal(Entity p_77184_1_, double p_77184_2_, double p_77184_4_, double p_77184_6_, float p_77184_8_) { + public boolean placeInExistingPortal( + Entity p_77184_1_, double p_77184_2_, double p_77184_4_, double p_77184_6_, float p_77184_8_) { return true; } diff --git a/src/main/java/makeo/gadomancy/common/utils/world/WorldUtil.java b/src/main/java/makeo/gadomancy/common/utils/world/WorldUtil.java index 83e7ac3..7ba0d46 100644 --- a/src/main/java/makeo/gadomancy/common/utils/world/WorldUtil.java +++ b/src/main/java/makeo/gadomancy/common/utils/world/WorldUtil.java @@ -17,15 +17,20 @@ public class WorldUtil { public static void teleportToFakeOuter(EntityPlayerMP player) { MinecraftServer mServer = FMLCommonHandler.instance().getMinecraftServerInstance(); - if(player.worldObj.provider.dimensionId != 0) { - mServer.getConfigurationManager().transferPlayerToDimension(player, 0, new TeleporterNothing(mServer.worldServerForDimension(0))); + if (player.worldObj.provider.dimensionId != 0) { + mServer.getConfigurationManager() + .transferPlayerToDimension(player, 0, new TeleporterNothing(mServer.worldServerForDimension(0))); } - mServer.getConfigurationManager().transferPlayerToDimension(player, ModConfig.dimOuterId, new TeleporterNothing(mServer.worldServerForDimension(ModConfig.dimOuterId))); + mServer.getConfigurationManager() + .transferPlayerToDimension( + player, + ModConfig.dimOuterId, + new TeleporterNothing(mServer.worldServerForDimension(ModConfig.dimOuterId))); } public static void tryTeleportBack(EntityPlayerMP player, int dim) { MinecraftServer mServer = FMLCommonHandler.instance().getMinecraftServerInstance(); - mServer.getConfigurationManager().transferPlayerToDimension(player, dim, new TeleporterNothing(mServer.worldServerForDimension(dim))); + mServer.getConfigurationManager() + .transferPlayerToDimension(player, dim, new TeleporterNothing(mServer.worldServerForDimension(dim))); } - } diff --git a/src/main/java/makeo/gadomancy/common/utils/world/fake/FakeWorld.java b/src/main/java/makeo/gadomancy/common/utils/world/fake/FakeWorld.java index ce8c73a..b2635b7 100644 --- a/src/main/java/makeo/gadomancy/common/utils/world/fake/FakeWorld.java +++ b/src/main/java/makeo/gadomancy/common/utils/world/fake/FakeWorld.java @@ -1,5 +1,6 @@ package makeo.gadomancy.common.utils.world.fake; +import java.io.File; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; @@ -12,8 +13,6 @@ import net.minecraft.world.storage.IPlayerFileData; import net.minecraft.world.storage.ISaveHandler; import net.minecraft.world.storage.WorldInfo; -import java.io.File; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -87,8 +86,7 @@ public class FakeWorld extends World { } @Override - public void checkSessionLock() throws MinecraftException { - } + public void checkSessionLock() throws MinecraftException {} @Override public IChunkLoader getChunkLoader(WorldProvider p_75763_1_) { @@ -96,12 +94,10 @@ public class FakeWorld extends World { } @Override - public void saveWorldInfoWithPlayer(WorldInfo p_75755_1_, NBTTagCompound p_75755_2_) { - } + public void saveWorldInfoWithPlayer(WorldInfo p_75755_1_, NBTTagCompound p_75755_2_) {} @Override - public void saveWorldInfo(WorldInfo p_75761_1_) { - } + public void saveWorldInfo(WorldInfo p_75761_1_) {} @Override public IPlayerFileData getSaveHandler() { diff --git a/src/main/java/makeo/gadomancy/common/utils/world/fake/FakeWorldTCGeneration.java b/src/main/java/makeo/gadomancy/common/utils/world/fake/FakeWorldTCGeneration.java index 62ec4f4..fdbf99c 100644 --- a/src/main/java/makeo/gadomancy/common/utils/world/fake/FakeWorldTCGeneration.java +++ b/src/main/java/makeo/gadomancy/common/utils/world/fake/FakeWorldTCGeneration.java @@ -1,5 +1,9 @@ package makeo.gadomancy.common.utils.world.fake; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import makeo.gadomancy.common.data.config.ModConfig; import net.minecraft.block.Block; import net.minecraft.entity.Entity; @@ -16,11 +20,6 @@ import thaumcraft.common.config.ConfigBlocks; import thaumcraft.common.entities.EntityPermanentItem; import thaumcraft.common.entities.monster.EntityEldritchGuardian; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -42,8 +41,8 @@ public class FakeWorldTCGeneration extends FakeWorld { @Override public boolean setBlock(int x, int y, int z, Block block, int meta, int flags) { - if(block == ConfigBlocks.blockEldritchPortal) return true; - if(block == ConfigBlocks.blockEldritch && (meta == 1 || meta == 2 || meta == 3)) return true; + if (block == ConfigBlocks.blockEldritchPortal) return true; + if (block == ConfigBlocks.blockEldritch && (meta == 1 || meta == 2 || meta == 3)) return true; this.blockCount++; @@ -53,7 +52,7 @@ public class FakeWorldTCGeneration extends FakeWorld { int keyZ = (z & 15) << 7; int key = keyX | keyZ | y; - if(buf.blockData[key] != null) { + if (buf.blockData[key] != null) { this.blockOverwriteCount++; ChunkCoordinates cc = new ChunkCoordinates(x, y, z); this.gettedTE.remove(cc); @@ -67,7 +66,7 @@ public class FakeWorldTCGeneration extends FakeWorld { buf.blockData[key] = block; buf.metaBuffer[key] = (byte) meta; - if(block.hasTileEntity(meta)) buf.tiles.add(new Integer[] {x, y, z, key}); + if (block.hasTileEntity(meta)) buf.tiles.add(new Integer[] {x, y, z, key}); return true; } @@ -90,7 +89,7 @@ public class FakeWorldTCGeneration extends FakeWorld { int keyX = (x & 15) << 7 << 4; int keyZ = (z & 15) << 7; int key = keyX | keyZ | y; - //int key = ((x & 15) << 4 | (z & 15)) << 7 | y; + // int key = ((x & 15) << 4 | (z & 15)) << 7 | y; Block b = buf.blockData[key]; return b == null ? Blocks.air : b; @@ -119,7 +118,7 @@ public class FakeWorldTCGeneration extends FakeWorld { @Override public Chunk getChunkFromChunkCoords(int x, int z) { - long key = ((long)x) | (((long)z) << 32); + long key = ((long) x) | (((long) z) << 32); return new FakeChunk(this, x, z, this.chunks.get(key)); } @@ -133,7 +132,7 @@ public class FakeWorldTCGeneration extends FakeWorld { @Override public void setLightValue(EnumSkyBlock type, int x, int y, int z, int light) { - if(type == EnumSkyBlock.Block) { + if (type == EnumSkyBlock.Block) { int key = ((x & 15) << 4 | (z & 15)) << 7 | y; this.buf.lightData[key] = light; } @@ -142,7 +141,7 @@ public class FakeWorldTCGeneration extends FakeWorld { @Override public int getSavedLightValue(EnumSkyBlock type, int x, int y, int z) { - if(type == EnumSkyBlock.Block) { + if (type == EnumSkyBlock.Block) { ChunkBuffer buf = this.chunks.get(((long) x >> 4) | ((long) z >> 4) << 32); int keyX = (x & 15) << 7 << 4; @@ -171,9 +170,9 @@ public class FakeWorldTCGeneration extends FakeWorld { @Override public TileEntity getTileEntity(int x, int y, int z) { TileEntity te = this.getBlock(x, y, z).createTileEntity(null, this.getBlockMetadata(x, y, z)); - if(te == null) return null; + if (te == null) return null; ChunkCoordinates cc = new ChunkCoordinates(x, y, z); - if(!this.gettedTE.containsKey(cc)) this.gettedTE.put(cc, te); + if (!this.gettedTE.containsKey(cc)) this.gettedTE.put(cc, te); te.setWorldObj(this); te.xCoord = x; te.yCoord = y; @@ -182,22 +181,29 @@ public class FakeWorldTCGeneration extends FakeWorld { } @Override - public void markTileEntityChunkModified(int p_147476_1_, int p_147476_2_, int p_147476_3_, TileEntity p_147476_4_) {} + public void markTileEntityChunkModified( + int p_147476_1_, int p_147476_2_, int p_147476_3_, TileEntity p_147476_4_) {} @Override public void func_147453_f(int p_147453_1_, int p_147453_2_, int p_147453_3_, Block p_147453_4_) {} @Override public boolean spawnEntityInWorld(Entity entity) { - if(entity instanceof EntityPermanentItem) { - this.bufferedEntities.add(new EntityPermItem(entity.posX, entity.posY, entity.posZ, ((EntityPermanentItem) entity).getEntityItem())); - } else if(entity instanceof EntityEldritchGuardian) { - this.bufferedEntities.add(new EntityGuardianBuf(((EntityEldritchGuardian) entity).getHomePosition(), entity.posX, entity.posY, entity.posZ, ((EntityEldritchGuardian) entity).func_110174_bM())); + if (entity instanceof EntityPermanentItem) { + this.bufferedEntities.add(new EntityPermItem( + entity.posX, entity.posY, entity.posZ, ((EntityPermanentItem) entity).getEntityItem())); + } else if (entity instanceof EntityEldritchGuardian) { + this.bufferedEntities.add(new EntityGuardianBuf( + ((EntityEldritchGuardian) entity).getHomePosition(), + entity.posX, + entity.posY, + entity.posZ, + ((EntityEldritchGuardian) entity).func_110174_bM())); } return true; } - //TC eldrich guardian on spawn egg + // TC eldrich guardian on spawn egg @Override public float func_147462_b(double p_147462_1_, double p_147462_3_, double p_147462_5_) { return 0; @@ -266,7 +272,7 @@ public class FakeWorldTCGeneration extends FakeWorld { public static class ChunkMap extends HashMap { @Override public ChunkBuffer get(Object key) { - if(!this.containsKey(key)) { + if (!this.containsKey(key)) { this.put((Long) key, new ChunkBuffer((Long) key)); } return super.get(key); @@ -287,5 +293,4 @@ public class FakeWorldTCGeneration extends FakeWorld { return "FAKEWORLD-TC"; } } - } diff --git a/src/main/java/makeo/gadomancy/coremod/GadomancyCore.java b/src/main/java/makeo/gadomancy/coremod/GadomancyCore.java index 6db78be..805466e 100644 --- a/src/main/java/makeo/gadomancy/coremod/GadomancyCore.java +++ b/src/main/java/makeo/gadomancy/coremod/GadomancyCore.java @@ -4,7 +4,6 @@ import cpw.mods.fml.relauncher.IFMLCallHook; import cpw.mods.fml.relauncher.IFMLLoadingPlugin; import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion; import cpw.mods.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions; - import java.util.Map; /** @@ -16,7 +15,7 @@ import java.util.Map; * Created by makeo @ 07.12.2015 21:17 */ @TransformerExclusions("makeo.gadomancy.coremod") -@MCVersion( "1.7.10" ) +@MCVersion("1.7.10") public class GadomancyCore implements IFMLLoadingPlugin, IFMLCallHook { @Override public Void call() throws Exception { diff --git a/src/main/java/makeo/gadomancy/coremod/GadomancyTransformer.java b/src/main/java/makeo/gadomancy/coremod/GadomancyTransformer.java index 3a04d2d..dbed499 100644 --- a/src/main/java/makeo/gadomancy/coremod/GadomancyTransformer.java +++ b/src/main/java/makeo/gadomancy/coremod/GadomancyTransformer.java @@ -2,13 +2,12 @@ package makeo.gadomancy.coremod; import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.asm.transformers.AccessTransformer; +import java.io.IOException; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.*; -import java.io.IOException; - /** * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the @@ -30,11 +29,13 @@ public class GadomancyTransformer extends AccessTransformer { @Override public byte[] transform(String name, String transformedName, byte[] bytes) { - boolean needsTransform = transformedName.equalsIgnoreCase(GadomancyTransformer.NAME_ENCHANTMENT_HELPER) || - transformedName.equalsIgnoreCase(GadomancyTransformer.NAME_WANDMANAGER) || transformedName.equalsIgnoreCase(GadomancyTransformer.NAME_NODE_RENDERER) - || transformedName.equalsIgnoreCase(GadomancyTransformer.NAME_RENDER_EVENT_HANDLER) || transformedName.equals(GadomancyTransformer.NAME_NEI_ITEMPANEL) || - transformedName.equalsIgnoreCase(GadomancyTransformer.NAME_ENTITY_LIVING_BASE); - if(!needsTransform) return super.transform(name, transformedName, bytes); + boolean needsTransform = transformedName.equalsIgnoreCase(GadomancyTransformer.NAME_ENCHANTMENT_HELPER) + || transformedName.equalsIgnoreCase(GadomancyTransformer.NAME_WANDMANAGER) + || transformedName.equalsIgnoreCase(GadomancyTransformer.NAME_NODE_RENDERER) + || transformedName.equalsIgnoreCase(GadomancyTransformer.NAME_RENDER_EVENT_HANDLER) + || transformedName.equals(GadomancyTransformer.NAME_NEI_ITEMPANEL) + || transformedName.equalsIgnoreCase(GadomancyTransformer.NAME_ENTITY_LIVING_BASE); + if (!needsTransform) return super.transform(name, transformedName, bytes); FMLLog.info("[GadomancyTransformer] Transforming " + name + ": " + transformedName); @@ -42,47 +43,63 @@ public class GadomancyTransformer extends AccessTransformer { ClassReader reader = new ClassReader(bytes); reader.accept(node, 0); - if(transformedName.equalsIgnoreCase(GadomancyTransformer.NAME_ENCHANTMENT_HELPER)) { + if (transformedName.equalsIgnoreCase(GadomancyTransformer.NAME_ENCHANTMENT_HELPER)) { for (MethodNode mn : node.methods) { - if(mn.name.equals("getFortuneModifier") || mn.name.equals("func_77517_e")) { + if (mn.name.equals("getFortuneModifier") || mn.name.equals("func_77517_e")) { mn.instructions = new InsnList(); mn.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); - mn.instructions.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "makeo/gadomancy/common/events/EventHandlerRedirect", - "getFortuneLevel", "(Lnet/minecraft/entity/EntityLivingBase;)I", false)); + mn.instructions.add(new MethodInsnNode( + Opcodes.INVOKESTATIC, + "makeo/gadomancy/common/events/EventHandlerRedirect", + "getFortuneLevel", + "(Lnet/minecraft/entity/EntityLivingBase;)I", + false)); mn.instructions.add(new InsnNode(Opcodes.IRETURN)); - } else if(mn.name.equals("getEnchantmentLevel") || mn.name.equals("func_77506_a")) { + } else if (mn.name.equals("getEnchantmentLevel") || mn.name.equals("func_77506_a")) { mn.instructions = new InsnList(); mn.instructions.add(new VarInsnNode(Opcodes.ILOAD, 0)); mn.instructions.add(new VarInsnNode(Opcodes.ALOAD, 1)); - mn.instructions.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "makeo/gadomancy/common/events/EventHandlerRedirect", - "onGetEnchantmentLevel", "(ILnet/minecraft/item/ItemStack;)I", false)); + mn.instructions.add(new MethodInsnNode( + Opcodes.INVOKESTATIC, + "makeo/gadomancy/common/events/EventHandlerRedirect", + "onGetEnchantmentLevel", + "(ILnet/minecraft/item/ItemStack;)I", + false)); mn.instructions.add(new InsnNode(Opcodes.IRETURN)); } } - } else if(transformedName.equalsIgnoreCase(GadomancyTransformer.NAME_WANDMANAGER)) { - for(MethodNode mn : node.methods) { - if(mn.name.equals("getTotalVisDiscount")) { + } else if (transformedName.equalsIgnoreCase(GadomancyTransformer.NAME_WANDMANAGER)) { + for (MethodNode mn : node.methods) { + if (mn.name.equals("getTotalVisDiscount")) { InsnList updateTotal = new InsnList(); updateTotal.add(new VarInsnNode(Opcodes.ALOAD, 0)); updateTotal.add(new VarInsnNode(Opcodes.ALOAD, 1)); updateTotal.add(new VarInsnNode(Opcodes.ILOAD, 2)); - updateTotal.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "makeo/gadomancy/common/events/EventHandlerRedirect", - "getAdditionalVisDiscount", "(Lnet/minecraft/entity/player/EntityPlayer;Lthaumcraft/api/aspects/Aspect;I)I", false)); + updateTotal.add(new MethodInsnNode( + Opcodes.INVOKESTATIC, + "makeo/gadomancy/common/events/EventHandlerRedirect", + "getAdditionalVisDiscount", + "(Lnet/minecraft/entity/player/EntityPlayer;Lthaumcraft/api/aspects/Aspect;I)I", + false)); mn.instructions.insertBefore(mn.instructions.get(mn.instructions.size() - 5), updateTotal); } } - } else if(transformedName.equalsIgnoreCase(GadomancyTransformer.NAME_NODE_RENDERER)) { + } else if (transformedName.equalsIgnoreCase(GadomancyTransformer.NAME_NODE_RENDERER)) { for (MethodNode mn : node.methods) { if (mn.name.equals("renderTileEntityAt")) { InsnList setBefore = new InsnList(); setBefore.add(new VarInsnNode(Opcodes.ALOAD, 1)); - setBefore.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "makeo/gadomancy/common/events/EventHandlerRedirect", - "preNodeRender", "(Lnet/minecraft/tileentity/TileEntity;)V", false)); + setBefore.add(new MethodInsnNode( + Opcodes.INVOKESTATIC, + "makeo/gadomancy/common/events/EventHandlerRedirect", + "preNodeRender", + "(Lnet/minecraft/tileentity/TileEntity;)V", + false)); mn.instructions.insertBefore(mn.instructions.get(0), setBefore); @@ -94,45 +111,61 @@ public class GadomancyTransformer extends AccessTransformer { if (insnNode.getOpcode() == Opcodes.RETURN) { InsnList setAfter = new InsnList(); setAfter.add(new VarInsnNode(Opcodes.ALOAD, 1)); - setAfter.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "makeo/gadomancy/common/events/EventHandlerRedirect", - "postNodeRender", "(Lnet/minecraft/tileentity/TileEntity;)V", false)); + setAfter.add(new MethodInsnNode( + Opcodes.INVOKESTATIC, + "makeo/gadomancy/common/events/EventHandlerRedirect", + "postNodeRender", + "(Lnet/minecraft/tileentity/TileEntity;)V", + false)); mn.instructions.insertBefore(insnNode, setAfter); } } } } - } else if(transformedName.equalsIgnoreCase(GadomancyTransformer.NAME_RENDER_EVENT_HANDLER)) { - for(MethodNode mn : node.methods) { + } else if (transformedName.equalsIgnoreCase(GadomancyTransformer.NAME_RENDER_EVENT_HANDLER)) { + for (MethodNode mn : node.methods) { if (mn.name.equals("blockHighlight")) { InsnList setBefore = new InsnList(); setBefore.add(new VarInsnNode(Opcodes.ALOAD, 1)); - setBefore.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "makeo/gadomancy/common/events/EventHandlerRedirect", - "preBlockHighlight", "(Lnet/minecraftforge/client/event/DrawBlockHighlightEvent;)V", false)); + setBefore.add(new MethodInsnNode( + Opcodes.INVOKESTATIC, + "makeo/gadomancy/common/events/EventHandlerRedirect", + "preBlockHighlight", + "(Lnet/minecraftforge/client/event/DrawBlockHighlightEvent;)V", + false)); mn.instructions.insertBefore(mn.instructions.get(0), setBefore); AbstractInsnNode next = mn.instructions.get(0); - while(next != null) { + while (next != null) { AbstractInsnNode insnNode = next; next = insnNode.getNext(); - if(insnNode.getOpcode() == Opcodes.RETURN) { + if (insnNode.getOpcode() == Opcodes.RETURN) { InsnList setAfter = new InsnList(); setAfter.add(new VarInsnNode(Opcodes.ALOAD, 1)); - setAfter.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "makeo/gadomancy/common/events/EventHandlerRedirect", - "postBlockHighlight", "(Lnet/minecraftforge/client/event/DrawBlockHighlightEvent;)V", false)); + setAfter.add(new MethodInsnNode( + Opcodes.INVOKESTATIC, + "makeo/gadomancy/common/events/EventHandlerRedirect", + "postBlockHighlight", + "(Lnet/minecraftforge/client/event/DrawBlockHighlightEvent;)V", + false)); mn.instructions.insertBefore(insnNode, setAfter); } } } } - } else if(transformedName.equalsIgnoreCase(GadomancyTransformer.NAME_NEI_ITEMPANEL)) { + } else if (transformedName.equalsIgnoreCase(GadomancyTransformer.NAME_NEI_ITEMPANEL)) { for (MethodNode mn : node.methods) { - if(mn.name.equals("updateItemList")) { + if (mn.name.equals("updateItemList")) { InsnList newInstructions = new InsnList(); newInstructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); - newInstructions.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "makeo/gadomancy/common/integration/IntegrationNEI", - "checkItems", "(Ljava/util/ArrayList;)V", false)); + newInstructions.add(new MethodInsnNode( + Opcodes.INVOKESTATIC, + "makeo/gadomancy/common/integration/IntegrationNEI", + "checkItems", + "(Ljava/util/ArrayList;)V", + false)); newInstructions.add(mn.instructions); mn.instructions = newInstructions; }