From 53b6030ba948e71f408223f2fcf9cefec4b86606 Mon Sep 17 00:00:00 2001 From: Nicholas Ignoffo Date: Sun, 14 Apr 2019 08:22:42 -0700 Subject: [PATCH] Run code formatter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🦀 Way is gone 🦀 --- .../WayofTime/bloodmagic/ConfigHandler.java | 78 ++--- .../AlchemyArrayEffectArrowTurret.java | 102 ++---- .../AlchemyArrayEffectFurnaceFuel.java | 72 ++-- .../AlchemyArrayEffectLaputa.java | 60 ++-- .../AlchemyArrayEffectMobSacrifice.java | 84 ++--- .../alchemyArray/AlchemyArrayEffectSpike.java | 24 +- .../AlchemyArrayEffectTeleport.java | 42 +-- .../WayofTime/bloodmagic/altar/AltarTier.java | 2 +- .../bloodmagic/altar/BloodAltar.java | 260 +++++---------- .../api/impl/BloodMagicCorePlugin.java | 33 +- .../api/impl/BloodMagicRecipeRegistrar.java | 135 +++----- .../api/impl/recipe/RecipeSacrificeCraft.java | 15 +- .../bloodmagic/block/BlockDecorative.java | 2 +- .../bloodmagic/block/BlockMimic.java | 2 +- .../block/enums/EnumRitualController.java | 3 +- .../client/hud/ElementRegistry.java | 3 +- .../bloodmagic/client/hud/GuiEditHUD.java | 4 +- .../element/ElementDivinedInformation.java | 2 +- .../bloodmagic/client/key/KeyBindings.java | 3 +- .../LowAlchemyCircleRenderer.java | 12 +- .../LowStaticAlchemyCircleRenderer.java | 15 +- .../MobSacrificeAlchemyCircleRenderer.java | 160 ++++----- .../TurretAlchemyCircleRenderer.java | 143 +++----- .../command/sub/SubCommandRitual.java | 1 + .../compress/BaseCompressionHandler.java | 4 +- .../compress/StorageBlockCraftingManager.java | 2 +- .../bloodmagic/core/RegistrarBloodMagic.java | 21 +- .../core/RegistrarBloodMagicItems.java | 11 +- .../core/RegistrarBloodMagicRecipes.java | 36 +- .../entity/mob/EntitySentientSpecter.java | 6 +- .../item/ItemActivationCrystal.java | 3 +- .../bloodmagic/item/ItemAlchemicVial.java | 9 +- .../bloodmagic/item/ItemBloodOrb.java | 2 +- .../bloodmagic/item/ItemLavaCrystal.java | 2 +- .../item/ItemSacrificialDagger.java | 12 +- .../WayofTime/bloodmagic/item/ItemSlate.java | 3 +- .../item/ItemTelepositionFocus.java | 3 +- .../bloodmagic/item/block/ItemBlockMimic.java | 73 ++-- .../item/routing/ItemFluidRouterFilter.java | 70 ++-- .../item/routing/ItemRouterFilter.java | 106 +++--- .../item/sigil/ItemSigilBloodLight.java | 39 +-- .../item/sigil/ItemSigilTeleposition.java | 2 +- .../bloodmagic/item/soul/ItemMonsterSoul.java | 3 +- .../bloodmagic/item/soul/ItemSentientBow.java | 21 +- .../item/soulBreath/ItemFlightScroll.java | 159 +++------ .../soulBreath/ItemSoulBreathContainer.java | 30 +- .../item/types/AlchemicVialType.java | 24 +- .../bloodmagic/item/types/ComponentTypes.java | 3 +- .../bloodmagic/item/types/ShardType.java | 3 +- .../LivingArmourUpgradeFallProtect.java | 2 +- .../upgrade/LivingArmourUpgradeSpeed.java | 54 ++- .../bloodmagic/proxy/ClientProxy.java | 39 +-- .../bloodmagic/registry/ModRecipes.java | 114 +++---- .../bloodmagic/registry/ModRituals.java | 9 +- .../ritual/crushing/ICrushingHandler.java | 2 + .../ritual/types/RitualAltarBuilder.java | 2 +- .../ritual/types/RitualCobblestone.java | 10 +- .../ritual/types/RitualCrushing.java | 18 +- .../ritual/types/RitualCrystalSplit.java | 104 +++--- .../ritual/types/RitualEllipsoid.java | 69 ++-- .../routing/RoutingFluidFilter.java | 108 ++---- .../bloodmagic/soul/ISoulBreathContainer.java | 3 +- .../bloodmagic/tile/TileAlchemyArray.java | 90 ++--- .../bloodmagic/tile/TileAlchemyTable.java | 314 +++++++----------- .../bloodmagic/tile/TileDemonCrystal.java | 94 ++---- .../tile/TileDemonCrystallizer.java | 72 ++-- .../WayofTime/bloodmagic/tile/TileMimic.java | 12 +- .../bloodmagic/tile/TilePhantomBlock.java | 2 +- .../tile/routing/TileMasterRoutingNode.java | 255 +++++--------- .../WayofTime/bloodmagic/util/Constants.java | 18 +- .../bloodmagic/util/ISigilFluidItem.java | 2 + .../WayofTime/bloodmagic/util/PluginUtil.java | 5 +- .../util/handler/event/GenericHandler.java | 8 +- .../handler/event/LivingArmourHandler.java | 197 ++++------- .../bloodmagic/util/helper/IncenseHelper.java | 3 +- .../bloodmagic/util/helper/NetworkHelper.java | 9 +- .../util/helper/PlayerSacrificeHelper.java | 2 +- 77 files changed, 1289 insertions(+), 2232 deletions(-) diff --git a/src/main/java/WayofTime/bloodmagic/ConfigHandler.java b/src/main/java/WayofTime/bloodmagic/ConfigHandler.java index 3681b7af..c00b81d5 100644 --- a/src/main/java/WayofTime/bloodmagic/ConfigHandler.java +++ b/src/main/java/WayofTime/bloodmagic/ConfigHandler.java @@ -9,90 +9,82 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @Config(modid = BloodMagic.MODID, name = BloodMagic.MODID + "/" + BloodMagic.MODID, category = "") @Mod.EventBusSubscriber(modid = BloodMagic.MODID) -public class ConfigHandler -{ +public class ConfigHandler { - @Config.Comment({ "General settings" }) + @Config.Comment({"General settings"}) public static ConfigGeneral general = new ConfigGeneral(); - @Config.Comment({ "Blacklist options for various features" }) + @Config.Comment({"Blacklist options for various features"}) public static ConfigBlacklist blacklist = new ConfigBlacklist(); - @Config.Comment({ "Value modifiers for various features" }) + @Config.Comment({"Value modifiers for various features"}) public static ConfigValues values = new ConfigValues(); - @Config.Comment({ "Settings that only pertain to the client" }) + @Config.Comment({"Settings that only pertain to the client"}) public static ConfigClient client = new ConfigClient(); - @Config.Comment({ "Compatibility settings" }) + @Config.Comment({"Compatibility settings"}) public static ConfigCompat compat = new ConfigCompat(); @SubscribeEvent - public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) - { - if (event.getModID().equals(BloodMagic.MODID)) - { + public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) { + if (event.getModID().equals(BloodMagic.MODID)) { ConfigManager.sync(event.getModID(), Config.Type.INSTANCE); // Sync config values BloodMagic.RITUAL_MANAGER.syncConfig(); MeteorConfigHandler.handleMeteors(false); // Reload meteors } } - public static class ConfigGeneral - { - @Config.Comment({ "Enables extra information to be printed to the log.", "Warning: May drastically increase log size." }) + public static class ConfigGeneral { + @Config.Comment({"Enables extra information to be printed to the log.", "Warning: May drastically increase log size."}) public boolean enableDebugLogging = false; - @Config.Comment({ "Enables extra information to be printed to the log." }) + @Config.Comment({"Enables extra information to be printed to the log."}) public boolean enableAPILogging = false; - @Config.Comment({ "Enables extra information to be printed to the log.", "Warning: May drastically increase log size." }) + @Config.Comment({"Enables extra information to be printed to the log.", "Warning: May drastically increase log size."}) public boolean enableVerboseAPILogging = false; - @Config.Comment({ "Enables tier 6 related registrations. This is for pack makers."}) + @Config.Comment({"Enables tier 6 related registrations. This is for pack makers."}) @Config.RequiresMcRestart public boolean enableTierSixEvenThoughThereIsNoContent = false; } - public static class ConfigBlacklist - { - @Config.Comment({ "Stops listed blocks and entities from being teleposed.", "Use the registry name of the block or entity. Vanilla objects do not require the modid.", "If a block is specified, you can list the variants to only blacklist a given state." }) - public String[] teleposer = { "bedrock", "mob_spawner" }; - @Config.Comment({ "Stops listed blocks from being transposed.", "Use the registry name of the block. Vanilla blocks do not require the modid." }) - public String[] transposer = { "bedrock", "mob_spawner" }; - @Config.Comment({ "Stops the listed entities from being used in the Well of Suffering.", "Use the registry name of the entity. Vanilla entities do not require the modid." }) + public static class ConfigBlacklist { + @Config.Comment({"Stops listed blocks and entities from being teleposed.", "Use the registry name of the block or entity. Vanilla objects do not require the modid.", "If a block is specified, you can list the variants to only blacklist a given state."}) + public String[] teleposer = {"bedrock", "mob_spawner"}; + @Config.Comment({"Stops listed blocks from being transposed.", "Use the registry name of the block. Vanilla blocks do not require the modid."}) + public String[] transposer = {"bedrock", "mob_spawner"}; + @Config.Comment({"Stops the listed entities from being used in the Well of Suffering.", "Use the registry name of the entity. Vanilla entities do not require the modid."}) public String[] wellOfSuffering = {}; } - public static class ConfigValues - { - @Config.Comment({ "Declares the amount of LP gained per HP sacrificed for the given entity.", "Setting the value to 0 will blacklist it.", "Use the registry name of the entity followed by a ';' and then the value you want.", "Vanilla entities do not require the modid." }) - public String[] sacrificialValues = { "villager;100", "slime;15", "enderman;10", "cow;100", "chicken;100", "horse;100", "sheep;100", "wolf;100", "ocelot;100", "pig;100", "rabbit;100" }; - @Config.Comment({ "Amount of LP the Coat of Arms should provide for each damage dealt." }) + public static class ConfigValues { + @Config.Comment({"Declares the amount of LP gained per HP sacrificed for the given entity.", "Setting the value to 0 will blacklist it.", "Use the registry name of the entity followed by a ';' and then the value you want.", "Vanilla entities do not require the modid."}) + public String[] sacrificialValues = {"villager;100", "slime;15", "enderman;10", "cow;100", "chicken;100", "horse;100", "sheep;100", "wolf;100", "ocelot;100", "pig;100", "rabbit;100"}; + @Config.Comment({"Amount of LP the Coat of Arms should provide for each damage dealt."}) @Config.RangeInt(min = 0, max = 100) public int coatOfArmsConversion = 20; - @Config.Comment({ "Amount of LP the Sacrificial Dagger should provide for each damage dealt." }) + @Config.Comment({"Amount of LP the Sacrificial Dagger should provide for each damage dealt."}) @Config.RangeInt(min = 0, max = 10000) public int sacrificialDaggerConversion = 100; - @Config.Comment({ "Will rewrite any default meteor types with new versions.", "Disable this if you want any of your changes to stay, or do not want default meteor types regenerated." }) + @Config.Comment({"Will rewrite any default meteor types with new versions.", "Disable this if you want any of your changes to stay, or do not want default meteor types regenerated."}) public boolean shouldResyncMeteors = true; - @Config.Comment({ "Should mobs that die through the Well of Suffering Ritual drop items?"}) + @Config.Comment({"Should mobs that die through the Well of Suffering Ritual drop items?"}) public boolean wellOfSufferingDrops = true; } - public static class ConfigClient - { - @Config.Comment({ "Always render the beams between routing nodes.", "If disabled, the beams will only render while the Node Router is held." }) + public static class ConfigClient { + @Config.Comment({"Always render the beams between routing nodes.", "If disabled, the beams will only render while the Node Router is held."}) public boolean alwaysRenderRoutingLines = false; - @Config.Comment({ "Completely hide spectral blocks from view.", "If disabled, a transparent block will be displayed." }) + @Config.Comment({"Completely hide spectral blocks from view.", "If disabled, a transparent block will be displayed."}) public boolean invisibleSpectralBlocks = true; - @Config.Comment({ "When cycling through slots, the Sigil of Holding will skip over empty slots and move to the next occupied one.", "If disabled, it will behave identically to the default hotbar." }) + @Config.Comment({"When cycling through slots, the Sigil of Holding will skip over empty slots and move to the next occupied one.", "If disabled, it will behave identically to the default hotbar."}) public boolean sigilHoldingSkipsEmptySlots = false; } - public static class ConfigCompat - { - @Config.Comment({ "The display mode to use when looking at a Blood Altar.", "ALWAYS - Always display information.", "SIGIL_HELD - Only display information when a Divination or Seers sigil is held in either hand.", "SIGIL_CONTAINED - Only display information when a Divination or Seers sigil is somewhere in the inventory." }) + public static class ConfigCompat { + @Config.Comment({"The display mode to use when looking at a Blood Altar.", "ALWAYS - Always display information.", "SIGIL_HELD - Only display information when a Divination or Seers sigil is held in either hand.", "SIGIL_CONTAINED - Only display information when a Divination or Seers sigil is somewhere in the inventory."}) public AltarDisplayMode wailaAltarDisplayMode = AltarDisplayMode.SIGIL_HELD; - public enum AltarDisplayMode - { + public enum AltarDisplayMode { ALWAYS, SIGIL_HELD, - SIGIL_CONTAINED, ; + SIGIL_CONTAINED, + ; } } } diff --git a/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectArrowTurret.java b/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectArrowTurret.java index ccebac1f..67dc2ac6 100644 --- a/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectArrowTurret.java +++ b/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectArrowTurret.java @@ -22,8 +22,7 @@ import net.minecraft.world.World; import net.minecraftforge.items.IItemHandler; import WayofTime.bloodmagic.util.Utils; -public class AlchemyArrayEffectArrowTurret extends AlchemyArrayEffect -{ +public class AlchemyArrayEffectArrowTurret extends AlchemyArrayEffect { public EntityLiving target; public int arrowTimer; public static final int ARROW_WINDUP = 50; @@ -34,49 +33,39 @@ public class AlchemyArrayEffectArrowTurret extends AlchemyArrayEffect private double yaw = 0; private double lastYaw = 0; - public AlchemyArrayEffectArrowTurret(String key) - { + public AlchemyArrayEffectArrowTurret(String key) { super(key); } @Override - public boolean update(TileEntity tile, int ticksActive) - { + public boolean update(TileEntity tile, int ticksActive) { BlockPos pos = tile.getPos(); World world = tile.getWorld(); BlockPos chestPos = pos.down(); TileEntity chestTile = world.getTileEntity(chestPos); - if (chestTile == null) - { + if (chestTile == null) { return false; } IItemHandler itemHandler = Utils.getInventory(chestTile, EnumFacing.UP); - if (itemHandler == null) - { + if (itemHandler == null) { return false; } ItemStack arrowStack = new ItemStack(Items.AIR); - if (lastChestSlot >= 0 && lastChestSlot < itemHandler.getSlots()) - { + if (lastChestSlot >= 0 && lastChestSlot < itemHandler.getSlots()) { ItemStack testStack = itemHandler.extractItem(lastChestSlot, 1, true); - if (testStack.isEmpty() || !(testStack.getItem() instanceof ItemArrow)) - { + if (testStack.isEmpty() || !(testStack.getItem() instanceof ItemArrow)) { lastChestSlot = -1; - } else - { + } else { arrowStack = testStack; } } - if (lastChestSlot < 0) - { - for (int i = 0; i < itemHandler.getSlots(); i++) - { + if (lastChestSlot < 0) { + for (int i = 0; i < itemHandler.getSlots(); i++) { ItemStack testStack = itemHandler.extractItem(i, 1, true); - if (!testStack.isEmpty() && testStack.getItem() instanceof ItemArrow) - { + if (!testStack.isEmpty() && testStack.getItem() instanceof ItemArrow) { arrowStack = testStack; lastChestSlot = i; break; @@ -85,13 +74,11 @@ public class AlchemyArrayEffectArrowTurret extends AlchemyArrayEffect } - if (lastChestSlot < 0) - { + if (lastChestSlot < 0) { return false; //No arrows in the chest. Welp! } - if (canFireOnMob(world, pos, target)) - { + if (canFireOnMob(world, pos, target)) { Vector2d pitchYaw = getPitchYaw(pos, target); lastPitch = pitch; lastYaw = yaw; @@ -99,27 +86,23 @@ public class AlchemyArrayEffectArrowTurret extends AlchemyArrayEffect yaw = pitchYaw.y; arrowTimer++; - if (arrowTimer >= ARROW_WINDUP) - { + if (arrowTimer >= ARROW_WINDUP) { // ItemStack arrowStack = new ItemStack(Items.ARROW); fireOnTarget(world, pos, arrowStack, target); - if (!world.isRemote) - { + if (!world.isRemote) { itemHandler.extractItem(lastChestSlot, 1, false); } arrowTimer = 0; } return false; - } else - { + } else { target = null; arrowTimer = -1; } List mobsInRange = world.getEntitiesWithinAABB(EntityMob.class, getBounds(pos)); - for (EntityMob entity : mobsInRange) - { + for (EntityMob entity : mobsInRange) { if (canFireOnMob(world, pos, entity))// && isMobInFilter(ent)) { target = entity; @@ -133,34 +116,27 @@ public class AlchemyArrayEffectArrowTurret extends AlchemyArrayEffect return false; } - public double getPitch() - { + public double getPitch() { return pitch; } - public double getLastPitch() - { + public double getLastPitch() { return lastPitch; } - public double getYaw() - { + public double getYaw() { return yaw; } - public double getLastYaw() - { + public double getLastYaw() { return lastYaw; } - public void fireOnTarget(World world, BlockPos pos, ItemStack arrowStack, EntityLiving targetMob) - { + public void fireOnTarget(World world, BlockPos pos, ItemStack arrowStack, EntityLiving targetMob) { float vel = 3f; double damage = 2; - if (!world.isRemote) - { - if (arrowStack.getItem() instanceof ItemArrow) - { + if (!world.isRemote) { + if (arrowStack.getItem() instanceof ItemArrow) { // ItemArrow arrow = (ItemArrow) arrowStack.getItem(); // EntityArrow entityarrow = arrow.createArrow(world, arrowStack, targetMob); EntityTippedArrow entityarrow = new EntityTippedArrow(world); @@ -180,10 +156,8 @@ public class AlchemyArrayEffectArrowTurret extends AlchemyArrayEffect } } - public static Vector2d getPitchYaw(BlockPos pos, Entity entityIn) - { - if (entityIn == null) - { + public static Vector2d getPitchYaw(BlockPos pos, Entity entityIn) { + if (entityIn == null) { return new Vector2d(0, 0); } @@ -197,46 +171,38 @@ public class AlchemyArrayEffectArrowTurret extends AlchemyArrayEffect return new Vector2d(pitch, yaw); } - public boolean canEntityBeSeen(World world, BlockPos pos, Entity entityIn) - { + public boolean canEntityBeSeen(World world, BlockPos pos, Entity entityIn) { return world.rayTraceBlocks(new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5), new Vec3d(entityIn.posX, entityIn.posY + (double) entityIn.getEyeHeight(), entityIn.posZ), false, true, false) == null; } - public boolean canFireOnMob(World world, BlockPos pos, Entity entityIn) - { + public boolean canFireOnMob(World world, BlockPos pos, Entity entityIn) { return entityIn != null && !entityIn.isDead && entityIn.getDistanceSqToCenter(pos) <= getRange() * getRange() && entityIn.getDistanceSqToCenter(pos) >= getMinRange() * getMinRange() && canEntityBeSeen(world, pos, entityIn); } - public AxisAlignedBB getBounds(BlockPos pos) - { + public AxisAlignedBB getBounds(BlockPos pos) { return new AxisAlignedBB(pos).grow(getRange(), getRange(), getRange()); } - public float getRange() - { + public float getRange() { return 32; } - public float getMinRange() - { + public float getMinRange() { return 3; } @Override - public void writeToNBT(NBTTagCompound tag) - { + public void writeToNBT(NBTTagCompound tag) { } @Override - public void readFromNBT(NBTTagCompound tag) - { + public void readFromNBT(NBTTagCompound tag) { } @Override - public AlchemyArrayEffect getNewCopy() - { + public AlchemyArrayEffect getNewCopy() { return new AlchemyArrayEffectArrowTurret(key); } diff --git a/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectFurnaceFuel.java b/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectFurnaceFuel.java index c21135ac..16ce80b1 100644 --- a/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectFurnaceFuel.java +++ b/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectFurnaceFuel.java @@ -17,25 +17,21 @@ import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -public class AlchemyArrayEffectFurnaceFuel extends AlchemyArrayEffect -{ +public class AlchemyArrayEffectFurnaceFuel extends AlchemyArrayEffect { static double radius = 10; static int burnTicksAdded = 401; //Set to +1 more than it needs to be due to a hacky method - basically done so that the array doesn't double dip your health if you only add one item. - public AlchemyArrayEffectFurnaceFuel(String key) - { + public AlchemyArrayEffectFurnaceFuel(String key) { super(key); } @Override - public boolean update(TileEntity tile, int ticksActive) - { + public boolean update(TileEntity tile, int ticksActive) { BlockPos pos = tile.getPos(); World world = tile.getWorld(); EntityPlayer sacrifice = null; - for (EnumFacing face : EnumFacing.VALUES) - { + for (EnumFacing face : EnumFacing.VALUES) { BlockPos furnacePos = pos.offset(face); Block block = world.getBlockState(furnacePos).getBlock(); if (block != Blocks.FURNACE) //This will only work vanilla furnaces. No others! @@ -44,33 +40,25 @@ public class AlchemyArrayEffectFurnaceFuel extends AlchemyArrayEffect } TileEntity bottomTile = world.getTileEntity(furnacePos); - if (bottomTile instanceof TileEntityFurnace) - { + if (bottomTile instanceof TileEntityFurnace) { TileEntityFurnace furnaceTile = (TileEntityFurnace) bottomTile; - if (canFurnaceSmelt(furnaceTile) && !furnaceTile.isBurning()) - { - if (sacrifice == null || sacrifice.isDead) - { + if (canFurnaceSmelt(furnaceTile) && !furnaceTile.isBurning()) { + if (sacrifice == null || sacrifice.isDead) { AxisAlignedBB bb = new AxisAlignedBB(pos).grow(radius); List playerList = world.getEntitiesWithinAABB(EntityPlayer.class, bb); - for (EntityPlayer player : playerList) - { - if (!player.isDead) - { + for (EntityPlayer player : playerList) { + if (!player.isDead) { sacrifice = player; } } } - if (sacrifice == null || sacrifice.isDead) - { + if (sacrifice == null || sacrifice.isDead) { return false; } - if (addFuelTime(furnaceTile, world, furnacePos, burnTicksAdded)) - { - if (!sacrifice.capabilities.isCreativeMode) - { + if (addFuelTime(furnaceTile, world, furnacePos, burnTicksAdded)) { + if (!sacrifice.capabilities.isCreativeMode) { sacrifice.hurtResistantTime = 0; sacrifice.attackEntityFrom(DamageSourceBloodMagic.INSTANCE, 1.0F); //No. } @@ -82,41 +70,32 @@ public class AlchemyArrayEffectFurnaceFuel extends AlchemyArrayEffect return false; } - public static boolean addFuelTime(TileEntityFurnace furnaceTile, World world, BlockPos furnacePos, int cookTime) - { + public static boolean addFuelTime(TileEntityFurnace furnaceTile, World world, BlockPos furnacePos, int cookTime) { furnaceTile.setField(0, cookTime); BlockFurnace.setState(true, world, furnacePos); return true; } - public static boolean canFurnaceSmelt(TileEntityFurnace furnaceTile) - { + public static boolean canFurnaceSmelt(TileEntityFurnace furnaceTile) { ItemStack burnStack = furnaceTile.getStackInSlot(0); - if (burnStack.isEmpty()) - { + if (burnStack.isEmpty()) { return false; - } else - { + } else { ItemStack resultStack = FurnaceRecipes.instance().getSmeltingResult(burnStack); - if (resultStack.isEmpty()) - { + if (resultStack.isEmpty()) { return false; - } else - { + } else { ItemStack finishStack = furnaceTile.getStackInSlot(2); - if (finishStack.isEmpty()) - { + if (finishStack.isEmpty()) { return true; - } else if (!finishStack.isItemEqual(resultStack)) - { + } else if (!finishStack.isItemEqual(resultStack)) { return false; } else if (finishStack.getCount() + resultStack.getCount() <= furnaceTile.getInventoryStackLimit() && finishStack.getCount() + resultStack.getCount() <= finishStack.getMaxStackSize()) // Forge fix: make furnace respect stack sizes in furnace recipes { return true; - } else - { + } else { return finishStack.getCount() + resultStack.getCount() <= resultStack.getMaxStackSize(); // Forge fix: make furnace respect stack sizes in furnace recipes } } @@ -124,20 +103,17 @@ public class AlchemyArrayEffectFurnaceFuel extends AlchemyArrayEffect } @Override - public void writeToNBT(NBTTagCompound tag) - { + public void writeToNBT(NBTTagCompound tag) { } @Override - public void readFromNBT(NBTTagCompound tag) - { + public void readFromNBT(NBTTagCompound tag) { } @Override - public AlchemyArrayEffect getNewCopy() - { + public AlchemyArrayEffect getNewCopy() { return new AlchemyArrayEffectFurnaceFuel(key); } } \ No newline at end of file diff --git a/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectLaputa.java b/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectLaputa.java index ce64e7f3..1368cb50 100644 --- a/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectLaputa.java +++ b/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectLaputa.java @@ -13,8 +13,7 @@ import WayofTime.bloodmagic.tile.TileAlchemyArray; import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.util.Utils; -public class AlchemyArrayEffectLaputa extends AlchemyArrayEffect -{ +public class AlchemyArrayEffectLaputa extends AlchemyArrayEffect { public static final int TELEPOSE_DELAY = 4; private BlockPos currentPos = BlockPos.ORIGIN; @@ -22,20 +21,16 @@ public class AlchemyArrayEffectLaputa extends AlchemyArrayEffect private int radius = -1; private int teleportHeightOffset = 5; - public AlchemyArrayEffectLaputa(String key) - { + public AlchemyArrayEffectLaputa(String key) { super(key); } @Override - public boolean update(TileEntity tile, int ticksActive) - { - if (ticksActive >= 100) - { + public boolean update(TileEntity tile, int ticksActive) { + if (ticksActive >= 100) { World world = tile.getWorld(); - if (radius == -1) - { + if (radius == -1) { ((TileAlchemyArray) tile).setItemDrop(false); radius = getRandomRadius(world.rand); teleportHeightOffset = getRandomHeightOffset(world.rand); @@ -43,8 +38,7 @@ public class AlchemyArrayEffectLaputa extends AlchemyArrayEffect } BlockPos pos = tile.getPos(); - if (world.isRemote) - { + if (world.isRemote) { return false; } @@ -52,8 +46,7 @@ public class AlchemyArrayEffectLaputa extends AlchemyArrayEffect int i = -radius; int k = -radius; - if (currentPos != null) - { + if (currentPos != null) { j = currentPos.getY(); i = currentPos.getX(); k = currentPos.getZ(); @@ -61,34 +54,27 @@ public class AlchemyArrayEffectLaputa extends AlchemyArrayEffect int checks = 0; int maxChecks = 100; - while (j <= radius) - { - while (i <= radius) - { - while (k <= radius) - { - if (i == 0 && j == 0 && k == 0) - { + while (j <= radius) { + while (i <= radius) { + while (k <= radius) { + if (i == 0 && j == 0 && k == 0) { k++; continue; } checks++; - if (checks >= maxChecks) - { + if (checks >= maxChecks) { this.currentPos = new BlockPos(i, j, k); return false; } - if (checkIfSphere(radius, i, j, k)) - { + if (checkIfSphere(radius, i, j, k)) { BlockPos newPos = pos.add(i, j, k); BlockPos offsetPos = newPos.up(teleportHeightOffset); IBlockState state = world.getBlockState(newPos); TeleposeEvent event = new TeleposeEvent(world, newPos, world, offsetPos); - if (state.getBlockHardness(world, newPos) > 0 && !MinecraftForge.EVENT_BUS.post(event) && Utils.swapLocations(event.initalWorld, event.initialBlockPos, event.finalWorld, event.finalBlockPos)) - { + if (state.getBlockHardness(world, newPos) > 0 && !MinecraftForge.EVENT_BUS.post(event) && Utils.swapLocations(event.initalWorld, event.initialBlockPos, event.finalWorld, event.finalBlockPos)) { k++; this.currentPos = new BlockPos(i, j, k); @@ -112,25 +98,21 @@ public class AlchemyArrayEffectLaputa extends AlchemyArrayEffect return false; } - public boolean checkIfSphere(float radius, float xOff, float yOff, float zOff) - { + public boolean checkIfSphere(float radius, float xOff, float yOff, float zOff) { float possOffset = 0.5f; return xOff * xOff + yOff * yOff + zOff * zOff <= ((radius + possOffset) * (radius + possOffset)); } - public int getRandomRadius(Random rand) - { + public int getRandomRadius(Random rand) { return rand.nextInt(5) + 4; } - public int getRandomHeightOffset(Random rand) - { + public int getRandomHeightOffset(Random rand) { return radius * 2 + 1 + rand.nextInt(5); } @Override - public void writeToNBT(NBTTagCompound tag) - { + public void writeToNBT(NBTTagCompound tag) { tag.setInteger("radius", radius); tag.setInteger("teleportHeightOffset", teleportHeightOffset); tag.setInteger(Constants.NBT.X_COORD, currentPos.getX()); @@ -139,16 +121,14 @@ public class AlchemyArrayEffectLaputa extends AlchemyArrayEffect } @Override - public void readFromNBT(NBTTagCompound tag) - { + public void readFromNBT(NBTTagCompound tag) { radius = tag.getInteger("radius"); teleportHeightOffset = tag.getInteger("teleportHeightOffset"); currentPos = new BlockPos(tag.getInteger(Constants.NBT.X_COORD), tag.getInteger(Constants.NBT.Y_COORD), tag.getInteger(Constants.NBT.Z_COORD)); } @Override - public AlchemyArrayEffect getNewCopy() - { + public AlchemyArrayEffect getNewCopy() { return new AlchemyArrayEffectLaputa(key); } } diff --git a/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectMobSacrifice.java b/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectMobSacrifice.java index 77224e58..d0b08483 100644 --- a/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectMobSacrifice.java +++ b/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectMobSacrifice.java @@ -29,29 +29,24 @@ import WayofTime.bloodmagic.ritual.AreaDescriptor; import WayofTime.bloodmagic.util.DamageSourceBloodMagic; import WayofTime.bloodmagic.util.helper.PurificationHelper; -public class AlchemyArrayEffectMobSacrifice extends AlchemyArrayEffect -{ +public class AlchemyArrayEffectMobSacrifice extends AlchemyArrayEffect { public static final AreaDescriptor itemDescriptor = new AreaDescriptor.Rectangle(new BlockPos(-5, -5, -5), 11); public static final AreaDescriptor mobDescriptor = new AreaDescriptor.Rectangle(new BlockPos(-5, -5, -5), 11); public int craftTime = 0; public static final int REQUIRED_CRAFT_TIME = 200; - public AlchemyArrayEffectMobSacrifice(String key) - { + public AlchemyArrayEffectMobSacrifice(String key) { super(key); } @Override - public boolean update(TileEntity tile, int ticksActive) - { + public boolean update(TileEntity tile, int ticksActive) { World world = tile.getWorld(); - if (world.isRemote && ticksActive < 200 && ticksActive > 40) - { + if (world.isRemote && ticksActive < 200 && ticksActive > 40) { BlockPos pos = tile.getPos(); Random rand = world.rand; - for (int i = 0; i < 2; i++) - { + for (int i = 0; i < 2; i++) { double d0 = (double) pos.getX() + 0.5D + (rand.nextDouble() - 0.5D) * 2.5D; double d1 = (double) pos.getY() + 0.2D + (rand.nextDouble() - 0.5D) * 0.2D; double d2 = (double) pos.getZ() + 0.5D + (rand.nextDouble() - 0.5D) * 2.5D; @@ -61,26 +56,22 @@ public class AlchemyArrayEffectMobSacrifice extends AlchemyArrayEffect //We need to do the check on both sides to correctly do particles. - if (ticksActive >= 200) - { + if (ticksActive >= 200) { BlockPos pos = tile.getPos(); List itemList = world.getEntitiesWithinAABB(EntityItem.class, itemDescriptor.getAABB(pos)); List inputList = new ArrayList(); - for (EntityItem entityItem : itemList) - { - if (entityItem.isDead || entityItem.getItem().isEmpty()) - { + for (EntityItem entityItem : itemList) { + if (entityItem.isDead || entityItem.getItem().isEmpty()) { continue; } inputList.add(entityItem.getItem().copy()); } - if (inputList.isEmpty()) - { + if (inputList.isEmpty()) { return false; } @@ -90,52 +81,42 @@ public class AlchemyArrayEffectMobSacrifice extends AlchemyArrayEffect } RecipeSacrificeCraft recipe = BloodMagicAPI.INSTANCE.getRecipeRegistrar().getSacrificeCraft(inputList); - if (recipe != null) - { + if (recipe != null) { double healthRequired = recipe.getHealthRequired(); double healthAvailable = 0; List livingEntities = world.getEntitiesWithinAABB(EntityLivingBase.class, mobDescriptor.getAABB(pos)); - for (EntityLivingBase living : livingEntities) - { + for (EntityLivingBase living : livingEntities) { double health = getEffectiveHealth(living); - if (health > 0) - { + if (health > 0) { healthAvailable += health; } } - if (healthAvailable < healthRequired) - { + if (healthAvailable < healthRequired) { craftTime = 0; return false; } craftTime++; - if (craftTime >= REQUIRED_CRAFT_TIME) - { - if (!world.isRemote) - { - for (EntityLivingBase living : livingEntities) - { + if (craftTime >= REQUIRED_CRAFT_TIME) { + if (!world.isRemote) { + for (EntityLivingBase living : livingEntities) { double health = getEffectiveHealth(living); - if (healthAvailable > 0 && health > 0) - { + if (healthAvailable > 0 && health > 0) { healthAvailable -= health; living.getEntityWorld().playSound(null, living.posX, living.posY, living.posZ, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (living.getEntityWorld().rand.nextFloat() - living.getEntityWorld().rand.nextFloat()) * 0.8F); living.setHealth(-1); living.onDeath(DamageSourceBloodMagic.INSTANCE); } - if (healthAvailable <= 0) - { + if (healthAvailable <= 0) { break; } } - for (EntityItem itemEntity : itemList) - { + for (EntityItem itemEntity : itemList) { itemEntity.getItem().setCount(itemEntity.getItem().getCount() - 1); if (itemEntity.getItem().isEmpty()) //TODO: Check container { @@ -146,13 +127,10 @@ public class AlchemyArrayEffectMobSacrifice extends AlchemyArrayEffect world.spawnEntity(new EntityItem(world, pos.getX() + 0.5, pos.getY() + 2.5, pos.getZ() + 0.5, recipe.getOutput())); craftTime = 0; } - } else - { - if (world.isRemote) - { + } else { + if (world.isRemote) { Vec3d spawnPosition = new Vec3d(pos.getX() + 0.5, pos.getY() + 2.5, pos.getZ() + 0.5); - for (EntityItem itemEntity : itemList) - { + for (EntityItem itemEntity : itemList) { ItemStack stack = itemEntity.getItem(); double velocityFactor = 0.1; @@ -168,11 +146,9 @@ public class AlchemyArrayEffectMobSacrifice extends AlchemyArrayEffect // world.spawnParticle(EnumParticleTypes.ITEM_CRACK, spawnPosition.x, spawnPosition.y, spawnPosition.z, velVec2.x, velVec2.y, velVec2.z, Item.getIdFromItem(stack.getItem()), stack.getMetadata()); } - for (EntityLivingBase living : livingEntities) - { + for (EntityLivingBase living : livingEntities) { double health = getEffectiveHealth(living); - if (health <= 0) - { + if (health <= 0) { continue; } double d0 = (double) living.posX + (world.rand.nextDouble() - 0.5D) * 0.5D; @@ -189,8 +165,7 @@ public class AlchemyArrayEffectMobSacrifice extends AlchemyArrayEffect } //Future-proofing in case I want to make different mobs give different effective health - public double getEffectiveHealth(EntityLivingBase living) - { + public double getEffectiveHealth(EntityLivingBase living) { if (living == null) return 0; @@ -214,20 +189,17 @@ public class AlchemyArrayEffectMobSacrifice extends AlchemyArrayEffect } @Override - public void writeToNBT(NBTTagCompound tag) - { + public void writeToNBT(NBTTagCompound tag) { } @Override - public void readFromNBT(NBTTagCompound tag) - { + public void readFromNBT(NBTTagCompound tag) { } @Override - public AlchemyArrayEffect getNewCopy() - { + public AlchemyArrayEffect getNewCopy() { return new AlchemyArrayEffectMobSacrifice(key); } } diff --git a/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectSpike.java b/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectSpike.java index a0bbf514..57d7f774 100644 --- a/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectSpike.java +++ b/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectSpike.java @@ -10,43 +10,35 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import WayofTime.bloodmagic.iface.IAlchemyArray; -public class AlchemyArrayEffectSpike extends AlchemyArrayEffect -{ - public AlchemyArrayEffectSpike(String key) - { +public class AlchemyArrayEffectSpike extends AlchemyArrayEffect { + public AlchemyArrayEffectSpike(String key) { super(key); } @Override - public boolean update(TileEntity tile, int ticksActive) - { + public boolean update(TileEntity tile, int ticksActive) { return false; } @Override - public void onEntityCollidedWithBlock(IAlchemyArray array, World world, BlockPos pos, IBlockState state, Entity entity) - { - if (entity instanceof EntityLivingBase) - { + public void onEntityCollidedWithBlock(IAlchemyArray array, World world, BlockPos pos, IBlockState state, Entity entity) { + if (entity instanceof EntityLivingBase) { entity.attackEntityFrom(DamageSource.CACTUS, 2); } } @Override - public void writeToNBT(NBTTagCompound tag) - { + public void writeToNBT(NBTTagCompound tag) { } @Override - public void readFromNBT(NBTTagCompound tag) - { + public void readFromNBT(NBTTagCompound tag) { } @Override - public AlchemyArrayEffect getNewCopy() - { + public AlchemyArrayEffect getNewCopy() { return new AlchemyArrayEffectSpike(key); } } \ No newline at end of file diff --git a/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectTeleport.java b/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectTeleport.java index 9437e86b..82b16d12 100644 --- a/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectTeleport.java +++ b/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectTeleport.java @@ -17,58 +17,47 @@ import net.minecraft.world.WorldServer; import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks; import WayofTime.bloodmagic.iface.IAlchemyArray; -public class AlchemyArrayEffectTeleport extends AlchemyArrayEffect -{ +public class AlchemyArrayEffectTeleport extends AlchemyArrayEffect { public static final int MAX_SEARCH = 20; public static final int TELEPORT_DELAY = 40; - public AlchemyArrayEffectTeleport(String key) - { + public AlchemyArrayEffectTeleport(String key) { super(key); } @Override - public boolean update(TileEntity tile, int ticksActive) - { + public boolean update(TileEntity tile, int ticksActive) { return false; } @Override - public void onEntityCollidedWithBlock(IAlchemyArray array, World world, BlockPos pos, IBlockState state, Entity entity) - { + public void onEntityCollidedWithBlock(IAlchemyArray array, World world, BlockPos pos, IBlockState state, Entity entity) { EnumFacing direction = array.getRotation(); teleportEntityInDirection(world, pos, entity, direction); } - public void teleportEntityInDirection(World world, BlockPos currentPos, Entity entity, EnumFacing direction) - { - if (entity != null && entity.timeUntilPortal <= 0) - { - for (int i = 1; i <= MAX_SEARCH; i++) - { + public void teleportEntityInDirection(World world, BlockPos currentPos, Entity entity, EnumFacing direction) { + if (entity != null && entity.timeUntilPortal <= 0) { + for (int i = 1; i <= MAX_SEARCH; i++) { BlockPos offsetPos = currentPos.offset(direction, i); Block testBlock = world.getBlockState(offsetPos).getBlock(); - if (testBlock == RegistrarBloodMagicBlocks.ALCHEMY_ARRAY) - { + if (testBlock == RegistrarBloodMagicBlocks.ALCHEMY_ARRAY) { int x = offsetPos.getX(); int y = offsetPos.getY(); int z = offsetPos.getZ(); entity.getEntityWorld().playSound(x, y, z, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.AMBIENT, 1.0F, 1.0F, false); entity.timeUntilPortal = TELEPORT_DELAY; - if (!world.isRemote) - { - if (entity instanceof EntityPlayer) - { + if (!world.isRemote) { + if (entity instanceof EntityPlayer) { EntityPlayerMP player = (EntityPlayerMP) entity; player.setPositionAndUpdate(x + 0.5, y + 0.5, z + 0.5); player.getEntityWorld().updateEntityWithOptionalForce(player, false); player.connection.sendPacket(new SPacketUpdateHealth(player.getHealth(), player.getFoodStats().getFoodLevel(), player.getFoodStats().getSaturationLevel())); - } else - { + } else { WorldServer worldServer = (WorldServer) entity.getEntityWorld(); entity.setPosition(x + 0.5, y + 0.5, z + 0.5); @@ -82,20 +71,17 @@ public class AlchemyArrayEffectTeleport extends AlchemyArrayEffect } @Override - public void writeToNBT(NBTTagCompound tag) - { + public void writeToNBT(NBTTagCompound tag) { } @Override - public void readFromNBT(NBTTagCompound tag) - { + public void readFromNBT(NBTTagCompound tag) { } @Override - public AlchemyArrayEffect getNewCopy() - { + public AlchemyArrayEffect getNewCopy() { return new AlchemyArrayEffectTeleport(key); } } diff --git a/src/main/java/WayofTime/bloodmagic/altar/AltarTier.java b/src/main/java/WayofTime/bloodmagic/altar/AltarTier.java index 906c61e3..a347fa15 100644 --- a/src/main/java/WayofTime/bloodmagic/altar/AltarTier.java +++ b/src/main/java/WayofTime/bloodmagic/altar/AltarTier.java @@ -127,7 +127,7 @@ public enum AltarTier { } }; - public static final int MAXTIERS = ConfigHandler.general.enableTierSixEvenThoughThereIsNoContent ? values().length : values().length-1; + public static final int MAXTIERS = ConfigHandler.general.enableTierSixEvenThoughThereIsNoContent ? values().length : values().length - 1; private List altarComponents; diff --git a/src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java b/src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java index f92049e7..7a111dd0 100644 --- a/src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java +++ b/src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java @@ -31,8 +31,7 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; import net.minecraftforge.items.ItemHandlerHelper; -public class BloodAltar implements IFluidHandler -{ +public class BloodAltar implements IFluidHandler { public boolean isActive; protected FluidStack fluidOutput = new FluidStack(BlockLifeEssence.getLifeEssence(), 0); @@ -69,15 +68,12 @@ public class BloodAltar implements IFluidHandler private RecipeBloodAltar recipe; private AltarTier currentTierDisplayed = AltarTier.ONE; - public BloodAltar(TileAltar tileAltar) - { + public BloodAltar(TileAltar tileAltar) { this.tileAltar = tileAltar; } - public void readFromNBT(NBTTagCompound tagCompound) - { - if (!tagCompound.hasKey(Constants.NBT.EMPTY)) - { + public void readFromNBT(NBTTagCompound tagCompound) { + if (!tagCompound.hasKey(Constants.NBT.EMPTY)) { FluidStack fluid = FluidStack.loadFluidStackFromNBT(tagCompound); if (fluid != null) @@ -120,8 +116,7 @@ public class BloodAltar implements IFluidHandler currentTierDisplayed = Enums.getIfPresent(AltarTier.class, tagCompound.getString(Constants.NBT.ALTAR_CURRENT_TIER_DISPLAYED)).or(AltarTier.ONE); } - public void writeToNBT(NBTTagCompound tagCompound) - { + public void writeToNBT(NBTTagCompound tagCompound) { if (fluid != null) fluid.writeToNBT(tagCompound); @@ -164,8 +159,7 @@ public class BloodAltar implements IFluidHandler tagCompound.setString(Constants.NBT.ALTAR_CURRENT_TIER_DISPLAYED, currentTierDisplayed.name()); } - public void startCycle() - { + public void startCycle() { if (tileAltar.getWorld() != null) tileAltar.getWorld().notifyBlockUpdate(tileAltar.getPos(), tileAltar.getWorld().getBlockState(tileAltar.getPos()), tileAltar.getWorld().getBlockState(tileAltar.getPos()), 3); @@ -179,14 +173,11 @@ public class BloodAltar implements IFluidHandler ItemStack input = tileAltar.getStackInSlot(0); - if (!input.isEmpty()) - { + if (!input.isEmpty()) { // Do recipes RecipeBloodAltar recipe = BloodMagicAPI.INSTANCE.getRecipeRegistrar().getBloodAltar(input); - if (recipe != null) - { - if (recipe.getMinimumTier().ordinal() <= altarTier.ordinal()) - { + if (recipe != null) { + if (recipe.getMinimumTier().ordinal() <= altarTier.ordinal()) { this.isActive = true; this.recipe = recipe; this.liquidRequired = recipe.getSyphon(); @@ -195,8 +186,7 @@ public class BloodAltar implements IFluidHandler this.canBeFilled = false; return; } - } else if (input.getItem() instanceof IBloodOrb) - { + } else if (input.getItem() instanceof IBloodOrb) { BloodOrb orb = ((IBloodOrb) input.getItem()).getOrb(input); this.isActive = canBeFilled = orb != null && altarTier.toInt() >= orb.getTier(); return; @@ -206,8 +196,7 @@ public class BloodAltar implements IFluidHandler isActive = false; } - public void update() - { + public void update() { World world = tileAltar.getWorld(); BlockPos pos = tileAltar.getPos(); @@ -220,17 +209,14 @@ public class BloodAltar implements IFluidHandler if (lockdownDuration > 0) lockdownDuration--; - if (internalCounter % 20 == 0) - { - for (EnumFacing facing : EnumFacing.VALUES) - { + if (internalCounter % 20 == 0) { + for (EnumFacing facing : EnumFacing.VALUES) { BlockPos newPos = pos.offset(facing); IBlockState block = world.getBlockState(newPos); block.getBlock().onNeighborChange(world, newPos, pos); } } - if (internalCounter % (Math.max(20 - this.accelerationUpgrades, 1)) == 0) - { + if (internalCounter % (Math.max(20 - this.accelerationUpgrades, 1)) == 0) { int syphonMax = (int) (20 * this.dislocationMultiplier); int fluidInputted; int fluidOutputted; @@ -245,8 +231,7 @@ public class BloodAltar implements IFluidHandler tileAltar.getWorld().notifyBlockUpdate(tileAltar.getPos(), tileAltar.getWorld().getBlockState(tileAltar.getPos()), tileAltar.getWorld().getBlockState(tileAltar.getPos()), 3); } - if (internalCounter % this.getChargingFrequency() == 0 && !this.isActive) - { + if (internalCounter % this.getChargingFrequency() == 0 && !this.isActive) { int chargeInputted = Math.min(chargingRate, this.fluid.amount); chargeInputted = Math.min(chargeInputted, maxCharge - totalCharge); totalCharge += chargeInputted; @@ -260,17 +245,14 @@ public class BloodAltar implements IFluidHandler updateAltar(); } - private void updateAltar() - { - if (!isActive) - { + private void updateAltar() { + if (!isActive) { if (cooldownAfterCrafting > 0) cooldownAfterCrafting--; return; } - if (!canBeFilled && recipe == null) - { + if (!canBeFilled && recipe == null) { startCycle(); return; } @@ -286,13 +268,11 @@ public class BloodAltar implements IFluidHandler if (world.isRemote) return; - if (!canBeFilled) - { + if (!canBeFilled) { boolean hasOperated = false; int stackSize = input.getCount(); - if (totalCharge > 0) - { + if (totalCharge > 0) { int chargeDrained = Math.min(liquidRequired * stackSize - progress, totalCharge); totalCharge -= chargeDrained; @@ -300,8 +280,7 @@ public class BloodAltar implements IFluidHandler hasOperated = true; } - if (fluid != null && fluid.amount >= 1) - { + if (fluid != null && fluid.amount >= 1) { int liquidDrained = Math.min((int) (altarTier.ordinal() >= 2 ? consumptionRate * (1 + consumptionMultiplier) : consumptionRate), fluid.amount); if (liquidDrained > (liquidRequired * stackSize - progress)) @@ -312,27 +291,22 @@ public class BloodAltar implements IFluidHandler hasOperated = true; - if (internalCounter % 4 == 0 && world instanceof WorldServer) - { + if (internalCounter % 4 == 0 && world instanceof WorldServer) { WorldServer server = (WorldServer) world; server.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 1, 0.2, 0, 0.2, 0); } - } else if (!hasOperated && progress > 0) - { + } else if (!hasOperated && progress > 0) { progress -= (int) (efficiencyMultiplier * drainRate); - if (internalCounter % 2 == 0 && world instanceof WorldServer) - { + if (internalCounter % 2 == 0 && world instanceof WorldServer) { WorldServer server = (WorldServer) world; server.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 1, 0.1, 0, 0.1, 0); } } - if (hasOperated) - { - if (progress >= liquidRequired * stackSize) - { + if (hasOperated) { + if (progress >= liquidRequired * stackSize) { ItemStack result = ItemHandlerHelper.copyStackWithSize(recipe.getOutput(), stackSize); BloodMagicCraftedEvent.Altar event = new BloodMagicCraftedEvent.Altar(result, input.copy()); @@ -340,8 +314,7 @@ public class BloodAltar implements IFluidHandler tileAltar.setInventorySlotContents(0, event.getOutput()); progress = 0; - if (world instanceof WorldServer) - { + if (world instanceof WorldServer) { WorldServer server = (WorldServer) world; server.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 40, 0.3, 0, 0.3, 0); } @@ -350,8 +323,7 @@ public class BloodAltar implements IFluidHandler this.isActive = false; } } - } else - { + } else { ItemStack contained = tileAltar.getStackInSlot(0); if (contained.isEmpty() || !(contained.getItem() instanceof IBloodOrb) || !(contained.getItem() instanceof IBindable)) @@ -363,14 +335,12 @@ public class BloodAltar implements IFluidHandler if (binding == null || orb == null) return; - if (fluid != null && fluid.amount >= 1) - { + if (fluid != null && fluid.amount >= 1) { int liquidDrained = Math.min((int) (altarTier.ordinal() >= 2 ? orb.getFillRate() * (1 + consumptionMultiplier) : orb.getFillRate()), fluid.amount); int drain = NetworkHelper.getSoulNetwork(binding).add(SoulTicket.block(world, pos, liquidDrained), (int) (orb.getCapacity() * this.orbCapacityMultiplier)); fluid.amount = fluid.amount - drain; - if (drain > 0 && internalCounter % 4 == 0 && world instanceof WorldServer) - { + if (drain > 0 && internalCounter % 4 == 0 && world instanceof WorldServer) { WorldServer server = (WorldServer) world; server.spawnParticle(EnumParticleTypes.SPELL_WITCH, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 1, 0, 0, 0, 0.001); } @@ -380,8 +350,7 @@ public class BloodAltar implements IFluidHandler tileAltar.getWorld().notifyBlockUpdate(tileAltar.getPos(), tileAltar.getWorld().getBlockState(tileAltar.getPos()), tileAltar.getWorld().getBlockState(tileAltar.getPos()), 3); } - public void checkTier() - { + public void checkTier() { AltarTier tier = AltarUtil.getTier(tileAltar.getWorld(), tileAltar.getPos()); this.altarTier = tier; @@ -390,8 +359,7 @@ public class BloodAltar implements IFluidHandler if (tier.equals(currentTierDisplayed)) currentTierDisplayed = AltarTier.ONE; - if (tier.equals(AltarTier.ONE)) - { + if (tier.equals(AltarTier.ONE)) { upgrade = null; isUpgraded = false; this.consumptionMultiplier = 0; @@ -407,8 +375,7 @@ public class BloodAltar implements IFluidHandler this.maxCharge = 0; this.totalCharge = 0; return; - } else if (!tier.equals(AltarTier.ONE)) - { + } else if (!tier.equals(AltarTier.ONE)) { this.isUpgraded = true; this.accelerationUpgrades = upgrade.getLevel(BloodRuneType.ACCELERATION); this.consumptionMultiplier = (float) (0.20 * upgrade.getLevel(BloodRuneType.SPEED)); @@ -438,128 +405,103 @@ public class BloodAltar implements IFluidHandler tileAltar.getWorld().notifyBlockUpdate(tileAltar.getPos(), tileAltar.getWorld().getBlockState(tileAltar.getPos()), tileAltar.getWorld().getBlockState(tileAltar.getPos()), 3); } - public int fillMainTank(int amount) - { + public int fillMainTank(int amount) { int filledAmount = Math.min(capacity - fluid.amount, amount); fluid.amount += filledAmount; return filledAmount; } - public void sacrificialDaggerCall(int amount, boolean isSacrifice) - { - if (this.lockdownDuration > 0) - { + public void sacrificialDaggerCall(int amount, boolean isSacrifice) { + if (this.lockdownDuration > 0) { int amt = (int) Math.min(bufferCapacity - fluidInput.amount, (isSacrifice ? 1 + sacrificeEfficiencyMultiplier : 1 + selfSacrificeEfficiencyMultiplier) * amount); fluidInput.amount += amt; - } else - { + } else { fluid.amount += Math.min(capacity - fluid.amount, (isSacrifice ? 1 + sacrificeEfficiencyMultiplier : 1 + selfSacrificeEfficiencyMultiplier) * amount); } } - public void setMainFluid(FluidStack fluid) - { + public void setMainFluid(FluidStack fluid) { this.fluid = fluid; } - public void setOutputFluid(FluidStack fluid) - { + public void setOutputFluid(FluidStack fluid) { this.fluidOutput = fluid; } - public void setInputFluid(FluidStack fluid) - { + public void setInputFluid(FluidStack fluid) { this.fluidInput = fluid; } - public AltarUpgrade getUpgrade() - { + public AltarUpgrade getUpgrade() { return upgrade; } - public void setUpgrade(AltarUpgrade upgrade) - { + public void setUpgrade(AltarUpgrade upgrade) { this.upgrade = upgrade; } - public int getCapacity() - { + public int getCapacity() { return capacity; } - public FluidStack getFluid() - { + public FluidStack getFluid() { return fluid; } - public int getFluidAmount() - { + public int getFluidAmount() { return fluid.amount; } - public int getCurrentBlood() - { + public int getCurrentBlood() { return getFluidAmount(); } - public AltarTier getTier() - { + public AltarTier getTier() { return altarTier; } - public void setTier(AltarTier tier) - { + public void setTier(AltarTier tier) { this.altarTier = tier; } - public int getProgress() - { + public int getProgress() { return progress; } - public float getSacrificeMultiplier() - { + public float getSacrificeMultiplier() { return sacrificeEfficiencyMultiplier; } - public float getSelfSacrificeMultiplier() - { + public float getSelfSacrificeMultiplier() { return selfSacrificeEfficiencyMultiplier; } - public float getOrbMultiplier() - { + public float getOrbMultiplier() { return orbCapacityMultiplier; } - public float getDislocationMultiplier() - { + public float getDislocationMultiplier() { return dislocationMultiplier; } - public float getConsumptionMultiplier() - { + public float getConsumptionMultiplier() { return consumptionMultiplier; } - public float getConsumptionRate() - { + public float getConsumptionRate() { return consumptionRate; } - public int getLiquidRequired() - { + public int getLiquidRequired() { return liquidRequired; } - public int getBufferCapacity() - { + public int getBufferCapacity() { return bufferCapacity; } - public boolean setCurrentTierDisplayed(AltarTier altarTier) - { + public boolean setCurrentTierDisplayed(AltarTier altarTier) { if (currentTierDisplayed == altarTier) return false; else @@ -567,99 +509,79 @@ public class BloodAltar implements IFluidHandler return true; } - public void addToDemonBloodDuration(int dur) - { + public void addToDemonBloodDuration(int dur) { this.demonBloodDuration += dur; } - public boolean hasDemonBlood() - { + public boolean hasDemonBlood() { return this.demonBloodDuration > 0; } - public void decrementDemonBlood() - { + public void decrementDemonBlood() { this.demonBloodDuration = Math.max(0, this.demonBloodDuration - 1); } - public void setActive() - { - if (tileAltar.getStackInSlot(0).isEmpty()) - { + public void setActive() { + if (tileAltar.getStackInSlot(0).isEmpty()) { isActive = false; } } - public boolean isActive() - { + public boolean isActive() { return isActive; } - public void requestPauseAfterCrafting(int amount) - { - if (this.isActive) - { + public void requestPauseAfterCrafting(int amount) { + if (this.isActive) { this.cooldownAfterCrafting = amount; } } - public int getChargingRate() - { + public int getChargingRate() { return chargingRate; } - public int getTotalCharge() - { + public int getTotalCharge() { return totalCharge; } - public int getChargingFrequency() - { + public int getChargingFrequency() { return chargingFrequency == 0 ? 1 : chargingFrequency; } @Override - public int fill(FluidStack resource, boolean doFill) - { - if (resource == null || resource.getFluid() != BlockLifeEssence.getLifeEssence()) - { + public int fill(FluidStack resource, boolean doFill) { + if (resource == null || resource.getFluid() != BlockLifeEssence.getLifeEssence()) { return 0; } - if (!doFill) - { - if (fluidInput == null) - { + if (!doFill) { + if (fluidInput == null) { return Math.min(bufferCapacity, resource.amount); } - if (!fluidInput.isFluidEqual(resource)) - { + if (!fluidInput.isFluidEqual(resource)) { return 0; } return Math.min(bufferCapacity - fluidInput.amount, resource.amount); } - if (fluidInput == null) - { + if (fluidInput == null) { fluidInput = new FluidStack(resource, Math.min(bufferCapacity, resource.amount)); return fluidInput.amount; } - if (!fluidInput.isFluidEqual(resource)) - { + if (!fluidInput.isFluidEqual(resource)) { return 0; } int filled = bufferCapacity - fluidInput.amount; - if (resource.amount < filled) - { + if (resource.amount < filled) { fluidInput.amount += resource.amount; filled = resource.amount; - } else - { + } else { fluidInput.amount = bufferCapacity; } @@ -667,45 +589,37 @@ public class BloodAltar implements IFluidHandler } @Override - public FluidStack drain(FluidStack resource, boolean doDrain) - { - if (resource == null || !resource.isFluidEqual(fluidOutput)) - { + public FluidStack drain(FluidStack resource, boolean doDrain) { + if (resource == null || !resource.isFluidEqual(fluidOutput)) { return null; } return drain(resource.amount, doDrain); } @Override - public FluidStack drain(int maxDrain, boolean doDrain) - { - if (fluidOutput == null) - { + public FluidStack drain(int maxDrain, boolean doDrain) { + if (fluidOutput == null) { return null; } int drained = maxDrain; - if (fluidOutput.amount < drained) - { + if (fluidOutput.amount < drained) { drained = fluidOutput.amount; } FluidStack stack = new FluidStack(fluidOutput, drained); - if (doDrain) - { + if (doDrain) { fluidOutput.amount -= drained; } return stack; } @Override - public IFluidTankProperties[] getTankProperties() - { - return new IFluidTankProperties[] { new FluidTankPropertiesWrapper(new FluidTank(fluid, capacity)) }; + public IFluidTankProperties[] getTankProperties() { + return new IFluidTankProperties[]{new FluidTankPropertiesWrapper(new FluidTank(fluid, capacity))}; } - public AltarTier getCurrentTierDisplayed() - { + public AltarTier getCurrentTierDisplayed() { return currentTierDisplayed; } } diff --git a/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicCorePlugin.java b/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicCorePlugin.java index 1725d095..c59bbbe6 100644 --- a/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicCorePlugin.java +++ b/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicCorePlugin.java @@ -23,12 +23,10 @@ import net.minecraftforge.fml.common.registry.EntityEntry; import net.minecraftforge.fml.common.registry.ForgeRegistries; @BloodMagicPlugin -public class BloodMagicCorePlugin implements IBloodMagicPlugin -{ +public class BloodMagicCorePlugin implements IBloodMagicPlugin { @Override - public void register(IBloodMagicAPI apiInterface) - { + public void register(IBloodMagicAPI apiInterface) { BloodMagicAPI api = (BloodMagicAPI) apiInterface; // Add forced blacklistings api.getBlacklist().addTeleposer(RegistrarBloodMagicBlocks.INPUT_ROUTING_NODE); @@ -84,8 +82,7 @@ public class BloodMagicCorePlugin implements IBloodMagicPlugin } @Override - public void registerRecipes(IBloodMagicRecipeRegistrar recipeRegistrar) - { + public void registerRecipes(IBloodMagicRecipeRegistrar recipeRegistrar) { RegistrarBloodMagicRecipes.registerAltarRecipes((BloodMagicRecipeRegistrar) recipeRegistrar); RegistrarBloodMagicRecipes.registerAlchemyTableRecipes((BloodMagicRecipeRegistrar) recipeRegistrar); RegistrarBloodMagicRecipes.registerTartaricForgeRecipes((BloodMagicRecipeRegistrar) recipeRegistrar); @@ -93,10 +90,8 @@ public class BloodMagicCorePlugin implements IBloodMagicPlugin RegistrarBloodMagicRecipes.registerSacrificeCraftRecipes((BloodMagicRecipeRegistrar) recipeRegistrar); } - private static void handleConfigValues(BloodMagicAPI api) - { - for (String value : ConfigHandler.values.sacrificialValues) - { + private static void handleConfigValues(BloodMagicAPI api) { + for (String value : ConfigHandler.values.sacrificialValues) { String[] split = value.split(";"); if (split.length != 2) // Not valid format continue; @@ -104,18 +99,15 @@ public class BloodMagicCorePlugin implements IBloodMagicPlugin api.getValueManager().setSacrificialValue(new ResourceLocation(split[0]), Integer.parseInt(split[1])); } - for (String value : ConfigHandler.blacklist.teleposer) - { + for (String value : ConfigHandler.blacklist.teleposer) { EntityEntry entityEntry = ForgeRegistries.ENTITIES.getValue(new ResourceLocation(value)); - if (entityEntry == null) - { // It's not an entity (or at least not a valid one), so let's try a block. + if (entityEntry == null) { // It's not an entity (or at least not a valid one), so let's try a block. String[] blockData = value.split("\\["); Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(blockData[0])); if (block == Blocks.AIR || block == null) // Not a valid block either continue; - if (blockData.length > 1) - { // We have properties listed, so let's build a state. + if (blockData.length > 1) { // We have properties listed, so let's build a state. api.getBlacklist().addTeleposer(StateUtil.parseState(value)); continue; } @@ -127,15 +119,13 @@ public class BloodMagicCorePlugin implements IBloodMagicPlugin api.getBlacklist().addTeleposer(entityEntry.getRegistryName()); } - for (String value : ConfigHandler.blacklist.transposer) - { + for (String value : ConfigHandler.blacklist.transposer) { String[] blockData = value.split("\\["); Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(blockData[0])); if (block == Blocks.AIR || block == null) // Not a valid block continue; - if (blockData.length > 1) - { // We have properties listed, so let's build a state. + if (blockData.length > 1) { // We have properties listed, so let's build a state. api.getBlacklist().addTeleposer(StateUtil.parseState(value)); continue; } @@ -143,8 +133,7 @@ public class BloodMagicCorePlugin implements IBloodMagicPlugin api.getBlacklist().addTeleposer(block); } - for (String value : ConfigHandler.blacklist.wellOfSuffering) - { + for (String value : ConfigHandler.blacklist.wellOfSuffering) { EntityEntry entityEntry = ForgeRegistries.ENTITIES.getValue(new ResourceLocation(value)); if (entityEntry == null) // Not a valid entity continue; diff --git a/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicRecipeRegistrar.java b/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicRecipeRegistrar.java index 776d762d..215f3981 100644 --- a/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicRecipeRegistrar.java +++ b/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicRecipeRegistrar.java @@ -27,8 +27,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; import com.google.common.collect.Sets; -public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar -{ +public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar { private final Set altarRecipes; private final Set alchemyRecipes; @@ -36,8 +35,7 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar private final Set alchemyArrayRecipes; private final Set sacrificeCraftRecipes; - public BloodMagicRecipeRegistrar() - { + public BloodMagicRecipeRegistrar() { this.altarRecipes = Sets.newHashSet(); this.alchemyRecipes = Sets.newHashSet(); this.tartaricForgeRecipes = Sets.newHashSet(); @@ -46,8 +44,7 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar } @Override - public void addBloodAltar(@Nonnull Ingredient input, @Nonnull ItemStack output, @Nonnegative int minimumTier, @Nonnegative int syphon, @Nonnegative int consumeRate, @Nonnegative int drainRate) - { + public void addBloodAltar(@Nonnull Ingredient input, @Nonnull ItemStack output, @Nonnegative int minimumTier, @Nonnegative int syphon, @Nonnegative int consumeRate, @Nonnegative int drainRate) { Preconditions.checkNotNull(input, "input cannot be null."); Preconditions.checkNotNull(output, "output cannot be null."); Preconditions.checkArgument(minimumTier >= 0, "minimumTier cannot be negative."); @@ -59,16 +56,14 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar } @Override - public boolean removeBloodAltar(@Nonnull ItemStack input) - { + public boolean removeBloodAltar(@Nonnull ItemStack input) { Preconditions.checkNotNull(input, "input cannot be null."); return altarRecipes.remove(getBloodAltar(input)); } @Override - public void addAlchemyTable(@Nonnull ItemStack output, @Nonnegative int syphon, @Nonnegative int ticks, @Nonnegative int minimumTier, @Nonnull Ingredient... input) - { + public void addAlchemyTable(@Nonnull ItemStack output, @Nonnegative int syphon, @Nonnegative int ticks, @Nonnegative int minimumTier, @Nonnull Ingredient... input) { Preconditions.checkNotNull(output, "output cannot be null."); Preconditions.checkArgument(syphon >= 0, "syphon cannot be negative."); Preconditions.checkArgument(ticks >= 0, "ticks cannot be negative."); @@ -79,8 +74,7 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar alchemyRecipes.add(new RecipeAlchemyTable(inputs, output, syphon, ticks, minimumTier)); } - public void addAlchemyTable(@Nonnull ItemStack output, @Nonnegative int syphon, @Nonnegative int ticks, @Nonnegative int minimumTier, @Nonnull Object... input) - { + public void addAlchemyTable(@Nonnull ItemStack output, @Nonnegative int syphon, @Nonnegative int ticks, @Nonnegative int minimumTier, @Nonnull Object... input) { Preconditions.checkNotNull(output, "output cannot be null."); Preconditions.checkArgument(syphon >= 0, "syphon cannot be negative."); Preconditions.checkArgument(ticks >= 0, "ticks cannot be negative."); @@ -88,10 +82,8 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar Preconditions.checkNotNull(input, "input cannot be null."); List ingredients = Lists.newArrayList(); - for (Object object : input) - { - if (object instanceof ItemStack && ((ItemStack) object).getItem() instanceof IBloodOrb) - { + for (Object object : input) { + if (object instanceof ItemStack && ((ItemStack) object).getItem() instanceof IBloodOrb) { ingredients.add(new IngredientBloodOrb(((IBloodOrb) ((ItemStack) object).getItem()).getOrb((ItemStack) object))); continue; } @@ -102,14 +94,12 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar addAlchemyTable(output, syphon, ticks, minimumTier, ingredients.toArray(new Ingredient[0])); } - public void addAlchemyTable(RecipeAlchemyTable recipe) - { + public void addAlchemyTable(RecipeAlchemyTable recipe) { alchemyRecipes.add(recipe); } @Override - public boolean removeAlchemyTable(@Nonnull ItemStack... input) - { + public boolean removeAlchemyTable(@Nonnull ItemStack... input) { Preconditions.checkNotNull(input, "inputs cannot be null."); for (ItemStack stack : input) @@ -119,8 +109,7 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar } @Override - public void addTartaricForge(@Nonnull ItemStack output, @Nonnegative double minimumSouls, @Nonnegative double soulDrain, @Nonnull Ingredient... input) - { + public void addTartaricForge(@Nonnull ItemStack output, @Nonnegative double minimumSouls, @Nonnegative double soulDrain, @Nonnull Ingredient... input) { Preconditions.checkNotNull(output, "output cannot be null."); Preconditions.checkArgument(minimumSouls >= 0, "minimumSouls cannot be negative."); Preconditions.checkArgument(soulDrain >= 0, "soulDrain cannot be negative."); @@ -131,8 +120,7 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar } @Override - public boolean removeTartaricForge(@Nonnull ItemStack... input) - { + public boolean removeTartaricForge(@Nonnull ItemStack... input) { Preconditions.checkNotNull(input, "inputs cannot be null."); for (ItemStack stack : input) @@ -141,18 +129,15 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar return tartaricForgeRecipes.remove(getTartaricForge(Lists.newArrayList(input))); } - public void addTartaricForge(@Nonnull ItemStack output, @Nonnegative double minimumSouls, @Nonnegative double soulDrain, @Nonnull Object... input) - { + public void addTartaricForge(@Nonnull ItemStack output, @Nonnegative double minimumSouls, @Nonnegative double soulDrain, @Nonnull Object... input) { Preconditions.checkNotNull(output, "output cannot be null."); Preconditions.checkArgument(minimumSouls >= 0, "minimumSouls cannot be negative."); Preconditions.checkArgument(soulDrain >= 0, "soulDrain cannot be negative."); Preconditions.checkNotNull(input, "input cannot be null."); List ingredients = Lists.newArrayList(); - for (Object object : input) - { - if (object instanceof ItemStack && ((ItemStack) object).getItem() instanceof IBloodOrb) - { + for (Object object : input) { + if (object instanceof ItemStack && ((ItemStack) object).getItem() instanceof IBloodOrb) { ingredients.add(new IngredientBloodOrb(((IBloodOrb) ((ItemStack) object).getItem()).getOrb((ItemStack) object))); continue; } @@ -164,8 +149,7 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar } @Override - public void addAlchemyArray(@Nonnull Ingredient input, @Nonnull Ingredient catalyst, @Nonnull ItemStack output, @Nullable ResourceLocation circleTexture) - { + public void addAlchemyArray(@Nonnull Ingredient input, @Nonnull Ingredient catalyst, @Nonnull ItemStack output, @Nullable ResourceLocation circleTexture) { Preconditions.checkNotNull(input, "input cannot be null."); Preconditions.checkNotNull(catalyst, "catalyst cannot be null."); Preconditions.checkNotNull(output, "output cannot be null."); @@ -174,16 +158,14 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar } @Override - public boolean removeAlchemyArray(@Nonnull ItemStack input, @Nonnull ItemStack catalyst) - { + public boolean removeAlchemyArray(@Nonnull ItemStack input, @Nonnull ItemStack catalyst) { Preconditions.checkNotNull(input, "input cannot be null."); Preconditions.checkNotNull(catalyst, "catalyst cannot be null."); return alchemyArrayRecipes.remove(getAlchemyArray(input, catalyst)); } - public void addAlchemyArray(@Nonnull ItemStack input, @Nonnull ItemStack catalyst, @Nonnull ItemStack output, @Nullable ResourceLocation circleTexture) - { + public void addAlchemyArray(@Nonnull ItemStack input, @Nonnull ItemStack catalyst, @Nonnull ItemStack output, @Nullable ResourceLocation circleTexture) { Preconditions.checkNotNull(input, "input cannot be null."); Preconditions.checkNotNull(catalyst, "catalyst cannot be null."); Preconditions.checkNotNull(output, "output cannot be null."); @@ -191,17 +173,14 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar addAlchemyArray(Ingredient.fromStacks(input), Ingredient.fromStacks(catalyst), output, circleTexture); } - public void addSacrificeCraft(@Nonnull ItemStack output, @Nonnegative double healthRequired, @Nonnull Object... input) - { + public void addSacrificeCraft(@Nonnull ItemStack output, @Nonnegative double healthRequired, @Nonnull Object... input) { Preconditions.checkNotNull(output, "output cannot be null."); Preconditions.checkArgument(healthRequired >= 0, "healthRequired cannot be negative."); Preconditions.checkNotNull(input, "input cannot be null."); List ingredients = Lists.newArrayList(); - for (Object object : input) - { - if (object instanceof ItemStack && ((ItemStack) object).getItem() instanceof IBloodOrb) - { + for (Object object : input) { + if (object instanceof ItemStack && ((ItemStack) object).getItem() instanceof IBloodOrb) { ingredients.add(new IngredientBloodOrb(((IBloodOrb) ((ItemStack) object).getItem()).getOrb((ItemStack) object))); continue; } @@ -213,8 +192,7 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar } @Override - public boolean removeSacrificeCraft(@Nonnull ItemStack... input) - { + public boolean removeSacrificeCraft(@Nonnull ItemStack... input) { Preconditions.checkNotNull(input, "inputs cannot be null."); for (ItemStack stack : input) @@ -224,8 +202,7 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar } @Override - public void addSacrificeCraft(@Nonnull ItemStack output, @Nonnegative double healthRequired, @Nonnull Ingredient... input) - { + public void addSacrificeCraft(@Nonnull ItemStack output, @Nonnegative double healthRequired, @Nonnull Ingredient... input) { Preconditions.checkNotNull(output, "output cannot be null."); Preconditions.checkArgument(healthRequired >= 0, "healthRequired cannot be negative."); Preconditions.checkNotNull(input, "input cannot be null."); @@ -235,8 +212,7 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar } @Nullable - public RecipeBloodAltar getBloodAltar(@Nonnull ItemStack input) - { + public RecipeBloodAltar getBloodAltar(@Nonnull ItemStack input) { Preconditions.checkNotNull(input, "input cannot be null."); if (input.isEmpty()) return null; @@ -249,27 +225,23 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar } @Nullable - public RecipeAlchemyTable getAlchemyTable(@Nonnull List input) - { + public RecipeAlchemyTable getAlchemyTable(@Nonnull List input) { Preconditions.checkNotNull(input, "input cannot be null."); if (input.isEmpty()) return null; - mainLoop: for (RecipeAlchemyTable recipe : alchemyRecipes) - { + mainLoop: + for (RecipeAlchemyTable recipe : alchemyRecipes) { if (recipe.getInput().size() != input.size()) continue; List recipeInput = new ArrayList<>(recipe.getInput()); - for (int i = 0; i < input.size(); i++) - { + for (int i = 0; i < input.size(); i++) { boolean matched = false; - for (int j = 0; j < recipeInput.size(); j++) - { + for (int j = 0; j < recipeInput.size(); j++) { Ingredient ingredient = recipeInput.get(j); - if (ingredient.apply(input.get(i))) - { + if (ingredient.apply(input.get(i))) { matched = true; recipeInput.remove(j); break; @@ -287,27 +259,23 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar } @Nullable - public RecipeTartaricForge getTartaricForge(@Nonnull List input) - { + public RecipeTartaricForge getTartaricForge(@Nonnull List input) { Preconditions.checkNotNull(input, "input cannot be null."); if (input.isEmpty()) return null; - mainLoop: for (RecipeTartaricForge recipe : tartaricForgeRecipes) - { + mainLoop: + for (RecipeTartaricForge recipe : tartaricForgeRecipes) { if (recipe.getInput().size() != input.size()) continue; List recipeInput = new ArrayList<>(recipe.getInput()); - for (int i = 0; i < input.size(); i++) - { + for (int i = 0; i < input.size(); i++) { boolean matched = false; - for (int j = 0; j < recipeInput.size(); j++) - { + for (int j = 0; j < recipeInput.size(); j++) { Ingredient ingredient = recipeInput.get(j); - if (ingredient.apply(input.get(i))) - { + if (ingredient.apply(input.get(i))) { matched = true; recipeInput.remove(j); break; @@ -325,27 +293,23 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar } @Nullable - public RecipeSacrificeCraft getSacrificeCraft(@Nonnull List input) - { + public RecipeSacrificeCraft getSacrificeCraft(@Nonnull List input) { Preconditions.checkNotNull(input, "input cannot be null."); if (input.isEmpty()) return null; - mainLoop: for (RecipeSacrificeCraft recipe : sacrificeCraftRecipes) - { + mainLoop: + for (RecipeSacrificeCraft recipe : sacrificeCraftRecipes) { if (recipe.getInput().size() != input.size()) continue; List recipeInput = new ArrayList<>(recipe.getInput()); - for (int i = 0; i < input.size(); i++) - { + for (int i = 0; i < input.size(); i++) { boolean matched = false; - for (int j = 0; j < recipeInput.size(); j++) - { + for (int j = 0; j < recipeInput.size(); j++) { Ingredient ingredient = recipeInput.get(j); - if (ingredient.apply(input.get(i))) - { + if (ingredient.apply(input.get(i))) { matched = true; recipeInput.remove(j); break; @@ -363,8 +327,7 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar } @Nullable - public RecipeAlchemyArray getAlchemyArray(@Nonnull ItemStack input, @Nonnull ItemStack catalyst) - { + public RecipeAlchemyArray getAlchemyArray(@Nonnull ItemStack input, @Nonnull ItemStack catalyst) { Preconditions.checkNotNull(input, "input cannot be null."); if (input.isEmpty()) return null; @@ -376,23 +339,19 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar return null; } - public Set getAltarRecipes() - { + public Set getAltarRecipes() { return ImmutableSet.copyOf(altarRecipes); } - public Set getAlchemyRecipes() - { + public Set getAlchemyRecipes() { return ImmutableSet.copyOf(alchemyRecipes); } - public Set getTartaricForgeRecipes() - { + public Set getTartaricForgeRecipes() { return ImmutableSet.copyOf(tartaricForgeRecipes); } - public Set getAlchemyArrayRecipes() - { + public Set getAlchemyArrayRecipes() { return ImmutableSet.copyOf(alchemyArrayRecipes); } } diff --git a/src/main/java/WayofTime/bloodmagic/api/impl/recipe/RecipeSacrificeCraft.java b/src/main/java/WayofTime/bloodmagic/api/impl/recipe/RecipeSacrificeCraft.java index 95bf3354..f2e000f6 100644 --- a/src/main/java/WayofTime/bloodmagic/api/impl/recipe/RecipeSacrificeCraft.java +++ b/src/main/java/WayofTime/bloodmagic/api/impl/recipe/RecipeSacrificeCraft.java @@ -8,8 +8,7 @@ import net.minecraft.util.NonNullList; import javax.annotation.Nonnegative; import javax.annotation.Nonnull; -public class RecipeSacrificeCraft -{ +public class RecipeSacrificeCraft { @Nonnull private final NonNullList input; @Nonnull @@ -17,8 +16,7 @@ public class RecipeSacrificeCraft @Nonnegative private final double healthRequired; - public RecipeSacrificeCraft(@Nonnull NonNullList input, @Nonnull ItemStack output, @Nonnegative double healthRequired) - { + public RecipeSacrificeCraft(@Nonnull NonNullList input, @Nonnull ItemStack output, @Nonnegative double healthRequired) { Preconditions.checkNotNull(input, "input cannot be null."); Preconditions.checkNotNull(output, "output cannot be null."); Preconditions.checkArgument(healthRequired >= 0, "healthRequired cannot be negative."); @@ -29,20 +27,17 @@ public class RecipeSacrificeCraft } @Nonnull - public final NonNullList getInput() - { + public final NonNullList getInput() { return input; } @Nonnull - public final ItemStack getOutput() - { + public final ItemStack getOutput() { return output; } @Nonnegative - public final double getHealthRequired() - { + public final double getHealthRequired() { return healthRequired; } } diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockDecorative.java b/src/main/java/WayofTime/bloodmagic/block/BlockDecorative.java index 065f340e..12a14983 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockDecorative.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockDecorative.java @@ -24,7 +24,7 @@ public class BlockDecorative extends BlockEnum { @Override public void getSubBlocks(CreativeTabs tab, NonNullList subBlocks) { - for (EnumDecorative type : EnumDecorative.values()){ + for (EnumDecorative type : EnumDecorative.values()) { if (!ConfigHandler.general.enableTierSixEvenThoughThereIsNoContent && (type == EnumDecorative.CRYSTAL_TILE || type == EnumDecorative.CRYSTAL_BRICK)) continue; subBlocks.add(new ItemStack(this, 1, type.ordinal())); diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockMimic.java b/src/main/java/WayofTime/bloodmagic/block/BlockMimic.java index 38b9ac62..6675b63e 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockMimic.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockMimic.java @@ -219,7 +219,7 @@ public class BlockMimic extends BlockEnum implements IAltarComponent } return null; } - + @Override public ItemBlock getItem() { return new ItemBlockMimic(this); diff --git a/src/main/java/WayofTime/bloodmagic/block/enums/EnumRitualController.java b/src/main/java/WayofTime/bloodmagic/block/enums/EnumRitualController.java index 531ab6a2..bfc67190 100644 --- a/src/main/java/WayofTime/bloodmagic/block/enums/EnumRitualController.java +++ b/src/main/java/WayofTime/bloodmagic/block/enums/EnumRitualController.java @@ -7,7 +7,8 @@ import java.util.Locale; public enum EnumRitualController implements IStringSerializable { MASTER, IMPERFECT, - INVERTED,; + INVERTED, + ; @Override public String toString() { diff --git a/src/main/java/WayofTime/bloodmagic/client/hud/ElementRegistry.java b/src/main/java/WayofTime/bloodmagic/client/hud/ElementRegistry.java index d83cb03c..9c62ee31 100644 --- a/src/main/java/WayofTime/bloodmagic/client/hud/ElementRegistry.java +++ b/src/main/java/WayofTime/bloodmagic/client/hud/ElementRegistry.java @@ -98,7 +98,8 @@ public class ElementRegistry { return; try (FileReader reader = new FileReader(CONFIG)) { - Map toLoad = GSON.fromJson(reader, new TypeToken>() {}.getType()); + Map toLoad = GSON.fromJson(reader, new TypeToken>() { + }.getType()); for (Map.Entry entry : toLoad.entrySet()) { ElementInfo info = ELEMENT_INFO.get(new ResourceLocation(entry.getKey())); if (info != null) diff --git a/src/main/java/WayofTime/bloodmagic/client/hud/GuiEditHUD.java b/src/main/java/WayofTime/bloodmagic/client/hud/GuiEditHUD.java index a25a5b6c..94531576 100644 --- a/src/main/java/WayofTime/bloodmagic/client/hud/GuiEditHUD.java +++ b/src/main/java/WayofTime/bloodmagic/client/hud/GuiEditHUD.java @@ -34,7 +34,9 @@ public class GuiEditHUD extends GuiScreen { public void initGui() { super.initGui(); - addButton(new GuiButtonExt(0, width / 2 - 155, height - 30, 70, 20, I18n.format("gui.bloodmagic.toggle")){{enabled = false;}}); + addButton(new GuiButtonExt(0, width / 2 - 155, height - 30, 70, 20, I18n.format("gui.bloodmagic.toggle")) {{ + enabled = false; + }}); addButton(new GuiButtonExt(1, width / 2 - 75, height - 30, 70, 20, I18n.format("gui.bloodmagic.default"))); addButton(new GuiButtonExt(2, width / 2 + 5, height - 30, 70, 20, I18n.format("gui.bloodmagic.save"))); addButton(new GuiButtonExt(3, width / 2 + 90, height - 30, 70, 20, I18n.format("gui.bloodmagic.cancel"))); diff --git a/src/main/java/WayofTime/bloodmagic/client/hud/element/ElementDivinedInformation.java b/src/main/java/WayofTime/bloodmagic/client/hud/element/ElementDivinedInformation.java index c072b646..0d9beb6c 100644 --- a/src/main/java/WayofTime/bloodmagic/client/hud/element/ElementDivinedInformation.java +++ b/src/main/java/WayofTime/bloodmagic/client/hud/element/ElementDivinedInformation.java @@ -55,7 +55,7 @@ public abstract class ElementDivinedInformation extends El if (sigilStack.getItem() instanceof ItemSigilHolding) { List internalInv = ItemSigilHolding.getInternalInventory(sigilStack); int currentSlot = ItemSigilHolding.getCurrentItemOrdinal(sigilStack); - if(internalInv != null && !internalInv.get(currentSlot).isEmpty()) { + if (internalInv != null && !internalInv.get(currentSlot).isEmpty()) { return (internalInv.get(currentSlot).getItem() == RegistrarBloodMagicItems.SIGIL_SEER && !simple) || (internalInv.get(currentSlot).getItem() == RegistrarBloodMagicItems.SIGIL_DIVINATION && simple); } } diff --git a/src/main/java/WayofTime/bloodmagic/client/key/KeyBindings.java b/src/main/java/WayofTime/bloodmagic/client/key/KeyBindings.java index a9d8a8af..6fa069bd 100644 --- a/src/main/java/WayofTime/bloodmagic/client/key/KeyBindings.java +++ b/src/main/java/WayofTime/bloodmagic/client/key/KeyBindings.java @@ -46,7 +46,8 @@ public enum KeyBindings { if (player.getHeldItemMainhand().getItem() instanceof ItemSigilHolding) ClientHandler.cycleSigil(player.getHeldItemMainhand(), player, 1); } - },; + }, + ; // @formatter:on private final IKeyConflictContext keyConflictContext; diff --git a/src/main/java/WayofTime/bloodmagic/client/render/alchemyArray/LowAlchemyCircleRenderer.java b/src/main/java/WayofTime/bloodmagic/client/render/alchemyArray/LowAlchemyCircleRenderer.java index bce8f30f..687ecdc8 100644 --- a/src/main/java/WayofTime/bloodmagic/client/render/alchemyArray/LowAlchemyCircleRenderer.java +++ b/src/main/java/WayofTime/bloodmagic/client/render/alchemyArray/LowAlchemyCircleRenderer.java @@ -2,21 +2,17 @@ package WayofTime.bloodmagic.client.render.alchemyArray; import net.minecraft.util.ResourceLocation; -public class LowAlchemyCircleRenderer extends SingleAlchemyCircleRenderer -{ - public LowAlchemyCircleRenderer() - { +public class LowAlchemyCircleRenderer extends SingleAlchemyCircleRenderer { + public LowAlchemyCircleRenderer() { this(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SkeletonTurret1.png")); } - public LowAlchemyCircleRenderer(ResourceLocation arrayResource) - { + public LowAlchemyCircleRenderer(ResourceLocation arrayResource) { super(arrayResource); } @Override - public float getVerticalOffset(float craftTime) - { + public float getVerticalOffset(float craftTime) { return 0; } } diff --git a/src/main/java/WayofTime/bloodmagic/client/render/alchemyArray/LowStaticAlchemyCircleRenderer.java b/src/main/java/WayofTime/bloodmagic/client/render/alchemyArray/LowStaticAlchemyCircleRenderer.java index 0256ec93..8b57713b 100644 --- a/src/main/java/WayofTime/bloodmagic/client/render/alchemyArray/LowStaticAlchemyCircleRenderer.java +++ b/src/main/java/WayofTime/bloodmagic/client/render/alchemyArray/LowStaticAlchemyCircleRenderer.java @@ -2,25 +2,20 @@ package WayofTime.bloodmagic.client.render.alchemyArray; import net.minecraft.util.ResourceLocation; -public class LowStaticAlchemyCircleRenderer extends LowAlchemyCircleRenderer -{ - public LowStaticAlchemyCircleRenderer() - { +public class LowStaticAlchemyCircleRenderer extends LowAlchemyCircleRenderer { + public LowStaticAlchemyCircleRenderer() { this(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SkeletonTurret1.png")); } - public LowStaticAlchemyCircleRenderer(ResourceLocation arrayResource) - { + public LowStaticAlchemyCircleRenderer(ResourceLocation arrayResource) { super(arrayResource); } @Override - public float getRotation(float craftTime) - { + public float getRotation(float craftTime) { float offset = 2; float duration = 180; - if (craftTime >= offset && craftTime < offset + duration) - { + if (craftTime >= offset && craftTime < offset + duration) { float modifier = (craftTime - offset) * 2f; return modifier * 1f; } diff --git a/src/main/java/WayofTime/bloodmagic/client/render/alchemyArray/MobSacrificeAlchemyCircleRenderer.java b/src/main/java/WayofTime/bloodmagic/client/render/alchemyArray/MobSacrificeAlchemyCircleRenderer.java index 2f5bdfc7..76a98ab3 100644 --- a/src/main/java/WayofTime/bloodmagic/client/render/alchemyArray/MobSacrificeAlchemyCircleRenderer.java +++ b/src/main/java/WayofTime/bloodmagic/client/render/alchemyArray/MobSacrificeAlchemyCircleRenderer.java @@ -13,41 +13,33 @@ import net.minecraft.world.World; import WayofTime.bloodmagic.alchemyArray.AlchemyCircleRenderer; import WayofTime.bloodmagic.tile.TileAlchemyArray; -public class MobSacrificeAlchemyCircleRenderer extends AlchemyCircleRenderer -{ +public class MobSacrificeAlchemyCircleRenderer extends AlchemyCircleRenderer { private ResourceLocation bottomArrayResource = new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/MovementArray.png"); private ResourceLocation mobSacrificeSwirlResource = new ResourceLocation("bloodmagic", "textures/models/mobsacrificeswirl.png"); - public MobSacrificeAlchemyCircleRenderer(ResourceLocation location) - { + public MobSacrificeAlchemyCircleRenderer(ResourceLocation location) { super(location); } - public MobSacrificeAlchemyCircleRenderer() - { + public MobSacrificeAlchemyCircleRenderer() { this(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/mobsacrifice.png")); } @Override - public float getSizeModifier(float craftTime) - { - if (craftTime < 40) - { + public float getSizeModifier(float craftTime) { + if (craftTime < 40) { return 0; - } else if (craftTime > 40 && craftTime < 100) - { + } else if (craftTime > 40 && craftTime < 100) { return (craftTime - 40) / 60f; } return 1; } @Override - public float getRotation(float craftTime) - { + public float getRotation(float craftTime) { float offset = 50; - if (craftTime >= offset) - { + if (craftTime >= offset) { float modifier = (craftTime - offset) * 5f; return modifier * 1f; } @@ -55,16 +47,13 @@ public class MobSacrificeAlchemyCircleRenderer extends AlchemyCircleRenderer } @Override - public float getSecondaryRotation(float craftTime) - { + public float getSecondaryRotation(float craftTime) { return 0; } @Override - public void renderAt(TileEntity tile, double x, double y, double z, float craftTime) - { - if (!(tile instanceof TileAlchemyArray)) - { + public void renderAt(TileEntity tile, double x, double y, double z, float craftTime) { + if (!(tile instanceof TileAlchemyArray)) { return; } @@ -94,30 +83,29 @@ public class MobSacrificeAlchemyCircleRenderer extends AlchemyCircleRenderer GlStateManager.translate(sideHit.getXOffset() * offsetFromFace, sideHit.getYOffset() * offsetFromFace, sideHit.getZOffset() * offsetFromFace); - switch (sideHit) - { - case DOWN: - GlStateManager.translate(0, 0, 1); - GlStateManager.rotate(-90.0f, 1, 0, 0); - break; - case EAST: - GlStateManager.rotate(-90.0f, 0, 1, 0); - GlStateManager.translate(0, 0, -1); - break; - case NORTH: - break; - case SOUTH: - GlStateManager.rotate(180.0f, 0, 1, 0); - GlStateManager.translate(-1, 0, -1); - break; - case UP: - GlStateManager.translate(0, 1, 0); - GlStateManager.rotate(90.0f, 1, 0, 0); - break; - case WEST: - GlStateManager.translate(0, 0, 1); - GlStateManager.rotate(90.0f, 0, 1, 0); - break; + switch (sideHit) { + case DOWN: + GlStateManager.translate(0, 0, 1); + GlStateManager.rotate(-90.0f, 1, 0, 0); + break; + case EAST: + GlStateManager.rotate(-90.0f, 0, 1, 0); + GlStateManager.translate(0, 0, -1); + break; + case NORTH: + break; + case SOUTH: + GlStateManager.rotate(180.0f, 0, 1, 0); + GlStateManager.translate(-1, 0, -1); + break; + case UP: + GlStateManager.translate(0, 1, 0); + GlStateManager.rotate(90.0f, 1, 0, 0); + break; + case WEST: + GlStateManager.translate(0, 0, 1); + GlStateManager.rotate(90.0f, 0, 1, 0); + break; } GlStateManager.pushMatrix(); @@ -136,8 +124,7 @@ public class MobSacrificeAlchemyCircleRenderer extends AlchemyCircleRenderer // GlStateManager.rotate((float) (yaw + 360 * getStartupPitchYawRatio(craftTime)), 0, 0, 1); // GlStateManager.rotate((float) ((pitch + 90) * getStartupPitchYawRatio(craftTime)), 1, 0, 0); - for (int i = 1; i <= 3; i++) - { + for (int i = 1; i <= 3; i++) { GlStateManager.pushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(bottomArrayResource); translateAndRotateFloatingArray(tessellator, wr, size, rot, craftTime, i); @@ -153,11 +140,9 @@ public class MobSacrificeAlchemyCircleRenderer extends AlchemyCircleRenderer //Render the swirlz float swirlSize = 3; - if (craftTime <= 40) - { + if (craftTime <= 40) { swirlSize = 0; - } else if (craftTime <= 100) - { + } else if (craftTime <= 100) { swirlSize = 3 * (craftTime - 40) / 60; } GlStateManager.pushMatrix(); @@ -180,66 +165,58 @@ public class MobSacrificeAlchemyCircleRenderer extends AlchemyCircleRenderer GlStateManager.popMatrix(); } - public float getStartupPitchYawRatio(float craftTime) - { - if (craftTime <= 80) - { + public float getStartupPitchYawRatio(float craftTime) { + if (craftTime <= 80) { return 0; - } else if (craftTime > 80 && craftTime < 140) - { + } else if (craftTime > 80 && craftTime < 140) { return (craftTime - 80) / 60f; } return 1; } - private void translateAndRotateFloatingArray(Tessellator tessellator, BufferBuilder builder, double size, float rotation, float craftTime, int circle) - { + private void translateAndRotateFloatingArray(Tessellator tessellator, BufferBuilder builder, double size, float rotation, float craftTime, int circle) { double verticalOffset = 2; float primaryRotation = 0; float secondaryRotation = 0; - if (craftTime >= 40) - { + if (craftTime >= 40) { primaryRotation = (craftTime - 40) * 4f; secondaryRotation = (craftTime - 40) * 2f; } float translationOffset = 1; - if (craftTime < 80) - { + if (craftTime < 80) { translationOffset = 0; - } else if (craftTime < 140) - { + } else if (craftTime < 140) { translationOffset = (craftTime - 80) / 60; } - switch (circle) - { - case 1: - GlStateManager.translate(0, 0, -verticalOffset); - GlStateManager.rotate(rotation / 200, 1, 0, 0); - GlStateManager.rotate(rotation / 10, 0, 0, 1); - GlStateManager.translate(1.7 * translationOffset, 0, 0); - break; - case 2: - GlStateManager.translate(0, 0, -verticalOffset); + switch (circle) { + case 1: + GlStateManager.translate(0, 0, -verticalOffset); + GlStateManager.rotate(rotation / 200, 1, 0, 0); + GlStateManager.rotate(rotation / 10, 0, 0, 1); + GlStateManager.translate(1.7 * translationOffset, 0, 0); + break; + case 2: + GlStateManager.translate(0, 0, -verticalOffset); // GlStateManager.rotate(254, 0, 0, 1); - GlStateManager.rotate((float) (rotation / 150 + 120), 1, 0, 0); - GlStateManager.rotate(120, 0, 1, 0); - GlStateManager.rotate(-rotation / 10, 0, 0, 1); - GlStateManager.translate(1.2 * translationOffset, 0, 0); - break; - case 3: - GlStateManager.translate(0, 0, -verticalOffset); + GlStateManager.rotate((float) (rotation / 150 + 120), 1, 0, 0); + GlStateManager.rotate(120, 0, 1, 0); + GlStateManager.rotate(-rotation / 10, 0, 0, 1); + GlStateManager.translate(1.2 * translationOffset, 0, 0); + break; + case 3: + GlStateManager.translate(0, 0, -verticalOffset); // GlStateManager.rotate(130, 0, 0, 1); - GlStateManager.rotate((float) (rotation / 100 + 284), 1, 0, 0); - GlStateManager.rotate(240, 0, 1, 0); - GlStateManager.rotate(-rotation / 7 + 180, 0, 0, 1); - GlStateManager.translate(2 * translationOffset, 0, 0); - break; - default: - //What are you doing, Way??? + GlStateManager.rotate((float) (rotation / 100 + 284), 1, 0, 0); + GlStateManager.rotate(240, 0, 1, 0); + GlStateManager.rotate(-rotation / 7 + 180, 0, 0, 1); + GlStateManager.translate(2 * translationOffset, 0, 0); + break; + default: + //What are you doing, Way??? } GlStateManager.rotate(primaryRotation, 0, 1, 0); @@ -249,8 +226,7 @@ public class MobSacrificeAlchemyCircleRenderer extends AlchemyCircleRenderer renderStandardCircle(tessellator, builder, size); } - private void renderStandardCircle(Tessellator tessellator, BufferBuilder builder, double size) - { + private void renderStandardCircle(Tessellator tessellator, BufferBuilder builder, double size) { double var31 = 0.0D; double var33 = 1.0D; double var35 = 0; diff --git a/src/main/java/WayofTime/bloodmagic/client/render/alchemyArray/TurretAlchemyCircleRenderer.java b/src/main/java/WayofTime/bloodmagic/client/render/alchemyArray/TurretAlchemyCircleRenderer.java index 35702b83..b9967d3a 100644 --- a/src/main/java/WayofTime/bloodmagic/client/render/alchemyArray/TurretAlchemyCircleRenderer.java +++ b/src/main/java/WayofTime/bloodmagic/client/render/alchemyArray/TurretAlchemyCircleRenderer.java @@ -15,33 +15,27 @@ import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectArrowTurret; import WayofTime.bloodmagic.alchemyArray.AlchemyCircleRenderer; import WayofTime.bloodmagic.tile.TileAlchemyArray; -public class TurretAlchemyCircleRenderer extends AlchemyCircleRenderer -{ +public class TurretAlchemyCircleRenderer extends AlchemyCircleRenderer { private ResourceLocation bottomArrayResource = new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/MovementArray.png"); private ResourceLocation middleArrayResource = new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SkeletonTurret2.png"); - public TurretAlchemyCircleRenderer(ResourceLocation location) - { + public TurretAlchemyCircleRenderer(ResourceLocation location) { super(location); } - public TurretAlchemyCircleRenderer() - { + public TurretAlchemyCircleRenderer() { this(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/MovementArray.png")); } @Override - public float getSizeModifier(float craftTime) - { + public float getSizeModifier(float craftTime) { return 1; } @Override - public float getRotation(float craftTime) - { + public float getRotation(float craftTime) { float offset = 50; - if (craftTime >= offset) - { + if (craftTime >= offset) { float modifier = (craftTime - offset) * 5f; return modifier * 1f; } @@ -49,16 +43,13 @@ public class TurretAlchemyCircleRenderer extends AlchemyCircleRenderer } @Override - public float getSecondaryRotation(float craftTime) - { + public float getSecondaryRotation(float craftTime) { return 0; } @Override - public void renderAt(TileEntity tile, double x, double y, double z, float craftTime) - { - if (!(tile instanceof TileAlchemyArray)) - { + public void renderAt(TileEntity tile, double x, double y, double z, float craftTime) { + if (!(tile instanceof TileAlchemyArray)) { return; } @@ -69,8 +60,7 @@ public class TurretAlchemyCircleRenderer extends AlchemyCircleRenderer double pitch = 0; double yaw = 0; int arrowTimer = -1; - if (effect instanceof AlchemyArrayEffectArrowTurret) - { + if (effect instanceof AlchemyArrayEffectArrowTurret) { AlchemyArrayEffectArrowTurret turretEffect = (AlchemyArrayEffectArrowTurret) effect; pitch = (turretEffect.getPitch() - turretEffect.getLastPitch()) * f + turretEffect.getLastPitch(); yaw = (turretEffect.getYaw() - turretEffect.getLastYaw()) * f + turretEffect.getLastYaw(); @@ -103,30 +93,29 @@ public class TurretAlchemyCircleRenderer extends AlchemyCircleRenderer GlStateManager.translate(sideHit.getXOffset() * offsetFromFace, sideHit.getYOffset() * offsetFromFace, sideHit.getZOffset() * offsetFromFace); - switch (sideHit) - { - case DOWN: - GlStateManager.translate(0, 0, 1); - GlStateManager.rotate(-90.0f, 1, 0, 0); - break; - case EAST: - GlStateManager.rotate(-90.0f, 0, 1, 0); - GlStateManager.translate(0, 0, -1); - break; - case NORTH: - break; - case SOUTH: - GlStateManager.rotate(180.0f, 0, 1, 0); - GlStateManager.translate(-1, 0, -1); - break; - case UP: - GlStateManager.translate(0, 1, 0); - GlStateManager.rotate(90.0f, 1, 0, 0); - break; - case WEST: - GlStateManager.translate(0, 0, 1); - GlStateManager.rotate(90.0f, 0, 1, 0); - break; + switch (sideHit) { + case DOWN: + GlStateManager.translate(0, 0, 1); + GlStateManager.rotate(-90.0f, 1, 0, 0); + break; + case EAST: + GlStateManager.rotate(-90.0f, 0, 1, 0); + GlStateManager.translate(0, 0, -1); + break; + case NORTH: + break; + case SOUTH: + GlStateManager.rotate(180.0f, 0, 1, 0); + GlStateManager.translate(-1, 0, -1); + break; + case UP: + GlStateManager.translate(0, 1, 0); + GlStateManager.rotate(90.0f, 1, 0, 0); + break; + case WEST: + GlStateManager.translate(0, 0, 1); + GlStateManager.rotate(90.0f, 0, 1, 0); + break; } GlStateManager.pushMatrix(); @@ -177,93 +166,71 @@ public class TurretAlchemyCircleRenderer extends AlchemyCircleRenderer GlStateManager.popMatrix(); } - public float getStartupPitchYawRatio(float craftTime) - { - if (craftTime <= 80) - { + public float getStartupPitchYawRatio(float craftTime) { + if (craftTime <= 80) { return 0; - } else if (craftTime > 80 && craftTime < 140) - { + } else if (craftTime > 80 && craftTime < 140) { return (craftTime - 80) / 60f; } return 1; } - public double getBottomHeightOffset(double craftTime, double arrowAnimation) - { - if (craftTime <= 40) - { + public double getBottomHeightOffset(double craftTime, double arrowAnimation) { + if (craftTime <= 40) { return 0; - } else if (craftTime > 40 && craftTime < 100) - { + } else if (craftTime > 40 && craftTime < 100) { return -0.4 * (craftTime - 40) / 60d; - } else if (craftTime >= 100 && craftTime < 140) - { + } else if (craftTime >= 100 && craftTime < 140) { return -0.4 * (140 - craftTime) / 40d; } - if (arrowAnimation > 0 && arrowAnimation < 45) - { + if (arrowAnimation > 0 && arrowAnimation < 45) { return -0.4 * (arrowAnimation) / 45; - } else if (arrowAnimation >= 45 && arrowAnimation < 50) - { + } else if (arrowAnimation >= 45 && arrowAnimation < 50) { return -0.4 * (50 - arrowAnimation) / 5; } return 0; } - public double getMiddleHeightOffset(double craftTime, double arrowAnimation) - { - if (craftTime <= 40) - { + public double getMiddleHeightOffset(double craftTime, double arrowAnimation) { + if (craftTime <= 40) { return 0; - } else if (craftTime > 40 && craftTime < 100) - { + } else if (craftTime > 40 && craftTime < 100) { return 0.1 * (craftTime - 40) / 60d; - } else if (craftTime >= 100 && craftTime < 140) - { + } else if (craftTime >= 100 && craftTime < 140) { return 0.1 * (140 - craftTime) / 40d; } - if (arrowAnimation > 0 && arrowAnimation < 45) - { + if (arrowAnimation > 0 && arrowAnimation < 45) { return 0.1 * (arrowAnimation) / 45; - } else if (arrowAnimation >= 45 && arrowAnimation < 50) - { + } else if (arrowAnimation >= 45 && arrowAnimation < 50) { return 0.1 * (50 - arrowAnimation) / 5; } return 0; } - public double getTopHeightOffset(double craftTime, double arrowAnimation) - { - if (craftTime <= 40) - { + public double getTopHeightOffset(double craftTime, double arrowAnimation) { + if (craftTime <= 40) { return 0; - } else if (craftTime > 40 && craftTime < 100) - { + } else if (craftTime > 40 && craftTime < 100) { return 0.4 * (craftTime - 40) / 60d; - } else if (craftTime >= 100 && craftTime < 140) - { + } else if (craftTime >= 100 && craftTime < 140) { return 0.4 * (140 - craftTime) / 40d; } - if (arrowAnimation > 0 && arrowAnimation < 45) - { + if (arrowAnimation > 0 && arrowAnimation < 45) { return 0.4 * (arrowAnimation) / 45; - } else if (arrowAnimation >= 45 && arrowAnimation < 50) - { + } else if (arrowAnimation >= 45 && arrowAnimation < 50) { return 0.4 * (50 - arrowAnimation) / 5; } return 0; } - private void renderStandardCircle(Tessellator tessellator, BufferBuilder builder, double size) - { + private void renderStandardCircle(Tessellator tessellator, BufferBuilder builder, double size) { double var31 = 0.0D; double var33 = 1.0D; double var35 = 0; diff --git a/src/main/java/WayofTime/bloodmagic/command/sub/SubCommandRitual.java b/src/main/java/WayofTime/bloodmagic/command/sub/SubCommandRitual.java index db0ec96d..b64efcf9 100644 --- a/src/main/java/WayofTime/bloodmagic/command/sub/SubCommandRitual.java +++ b/src/main/java/WayofTime/bloodmagic/command/sub/SubCommandRitual.java @@ -49,6 +49,7 @@ public class SubCommandRitual extends CommandTreeBase { class RitualCreate extends CommandTreeBase { public List ritualList = new ArrayList<>(); + public RitualCreate() { for (Ritual ritual : BloodMagic.RITUAL_MANAGER.getRituals()) { ritualList.add(BloodMagic.RITUAL_MANAGER.getId(ritual)); diff --git a/src/main/java/WayofTime/bloodmagic/compress/BaseCompressionHandler.java b/src/main/java/WayofTime/bloodmagic/compress/BaseCompressionHandler.java index 94b4ddf6..59530a63 100644 --- a/src/main/java/WayofTime/bloodmagic/compress/BaseCompressionHandler.java +++ b/src/main/java/WayofTime/bloodmagic/compress/BaseCompressionHandler.java @@ -37,13 +37,13 @@ public class BaseCompressionHandler extends CompressionHandler { public int getRemainingNeeded(ItemStack[] inv) { int needed = this.required.getCount(); int kept = this.getLeftover(); - return iterateThroughInventory(this.required, kept, inv, needed, true); + return iterateThroughInventory(this.required, kept, inv, needed, true); } public int drainInventory(ItemStack[] inv) { int needed = this.required.getCount(); int kept = this.getLeftover(); - return iterateThroughInventory(this.required, kept, inv, needed, true); + return iterateThroughInventory(this.required, kept, inv, needed, true); } public int getLeftover() { diff --git a/src/main/java/WayofTime/bloodmagic/compress/StorageBlockCraftingManager.java b/src/main/java/WayofTime/bloodmagic/compress/StorageBlockCraftingManager.java index 96d31140..cfe039c1 100644 --- a/src/main/java/WayofTime/bloodmagic/compress/StorageBlockCraftingManager.java +++ b/src/main/java/WayofTime/bloodmagic/compress/StorageBlockCraftingManager.java @@ -16,7 +16,7 @@ public class StorageBlockCraftingManager { private static final StorageBlockCraftingManager instance = new StorageBlockCraftingManager(); private List recipes = new LinkedList<>(); - public void addRecipe(IRecipe recipe){ + public void addRecipe(IRecipe recipe) { this.recipes.add(recipe); } diff --git a/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagic.java b/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagic.java index 83a0a0e1..fb6269d2 100644 --- a/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagic.java +++ b/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagic.java @@ -29,8 +29,7 @@ import net.minecraftforge.registries.RegistryBuilder; @Mod.EventBusSubscriber(modid = BloodMagic.MODID) @GameRegistry.ObjectHolder(BloodMagic.MODID) -public class RegistrarBloodMagic -{ +public class RegistrarBloodMagic { private static final BloodOrb ORB_DEF = new BloodOrb("", 0, 0, 0); @GameRegistry.ObjectHolder("weak") @@ -67,8 +66,7 @@ public class RegistrarBloodMagic public static IForgeRegistry BLOOD_ORBS = null; @SubscribeEvent - public static void registerBloodOrbs(RegistryEvent.Register event) - { + public static void registerBloodOrbs(RegistryEvent.Register event) { ResourceLocation orb = RegistrarBloodMagicItems.BLOOD_ORB.getRegistryName(); event.getRegistry().registerAll( new BloodOrb("weak", 1, 5000, 2).withModel(new ModelResourceLocation(orb, "type=weak")).setRegistryName("weak"), @@ -85,8 +83,7 @@ public class RegistrarBloodMagic } @SubscribeEvent - public static void registerPotions(RegistryEvent.Register event) - { + public static void registerPotions(RegistryEvent.Register event) { event.getRegistry().registerAll( new PotionBloodMagic("Boost", false, 0xFFFFFF, 0, 0).setRegistryName("boost"), new PotionBloodMagic("Whirlwind", false, 0xFFFFFF, 0, 0).setRegistryName("whirlwind"), @@ -109,8 +106,7 @@ public class RegistrarBloodMagic } @SubscribeEvent - public static void registerEntities(RegistryEvent.Register event) - { + public static void registerEntities(RegistryEvent.Register event) { int entities = 0; event.getRegistry().registerAll( @@ -128,8 +124,7 @@ public class RegistrarBloodMagic } @SubscribeEvent - public static void onRegistryCreation(RegistryEvent.NewRegistry event) - { + public static void onRegistryCreation(RegistryEvent.NewRegistry event) { BLOOD_ORBS = new RegistryBuilder() .setName(new ResourceLocation(BloodMagic.MODID, "blood_orb")) .setIDRange(0, Short.MAX_VALUE) @@ -140,10 +135,8 @@ public class RegistrarBloodMagic @SideOnly(Side.CLIENT) @SubscribeEvent - public static void registerModels(ModelRegistryEvent event) - { - for (BloodOrb orb : BLOOD_ORBS) - { + public static void registerModels(ModelRegistryEvent event) { + for (BloodOrb orb : BLOOD_ORBS) { ModelResourceLocation modelLocation = orb.getModelLocation(); if (modelLocation == null) modelLocation = new ModelResourceLocation(orb.getRegistryName(), "inventory"); diff --git a/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicItems.java b/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicItems.java index e45190fb..0938c425 100644 --- a/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicItems.java +++ b/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicItems.java @@ -44,8 +44,7 @@ import java.util.Set; @Mod.EventBusSubscriber(modid = BloodMagic.MODID) @GameRegistry.ObjectHolder(BloodMagic.MODID) @SuppressWarnings("unchecked") -public class RegistrarBloodMagicItems -{ +public class RegistrarBloodMagicItems { public static final Item BLOOD_ORB = Items.AIR; public static final Item ACTIVATION_CRYSTAL = Items.AIR; @@ -129,8 +128,7 @@ public class RegistrarBloodMagicItems public static List items; @SubscribeEvent - public static void registerItems(RegistryEvent.Register event) - { + public static void registerItems(RegistryEvent.Register event) { items = Lists.newArrayList(); RegistrarBloodMagicBlocks.blocks.stream().filter(block -> block instanceof IBMBlock && ((IBMBlock) block).getItem() != null).forEach(block -> @@ -215,15 +213,14 @@ public class RegistrarBloodMagicItems new ItemPotionFlask().setRegistryName("potion_flask"), new ItemAlchemicVial().setRegistryName("alchemic_vial"), new ItemFlightScroll().setRegistryName("icarus_scroll") - )); + )); event.getRegistry().registerAll(items.toArray(new Item[0])); } @SideOnly(Side.CLIENT) @SubscribeEvent - public static void registerRenders(ModelRegistryEvent event) - { + public static void registerRenders(ModelRegistryEvent event) { items.stream().filter(i -> i instanceof IVariantProvider).forEach(i -> { Int2ObjectMap variants = new Int2ObjectOpenHashMap<>(); diff --git a/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicRecipes.java b/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicRecipes.java index 05f40732..d967e0b8 100644 --- a/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicRecipes.java +++ b/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicRecipes.java @@ -37,16 +37,12 @@ import java.util.List; import java.util.Set; @Mod.EventBusSubscriber(modid = BloodMagic.MODID) -public class RegistrarBloodMagicRecipes -{ +public class RegistrarBloodMagicRecipes { @SubscribeEvent - public static void registerRecipes(RegistryEvent.Register event) - { - for (int i = 0; i < ItemSoulGem.names.length; i++) - { - for (EnumDemonWillType willType : EnumDemonWillType.values()) - { + public static void registerRecipes(RegistryEvent.Register event) { + for (int i = 0; i < ItemSoulGem.names.length; i++) { + for (EnumDemonWillType willType : EnumDemonWillType.values()) { ItemStack baseGemStack = new ItemStack(RegistrarBloodMagicItems.SOUL_GEM, 1, i); ItemStack newGemStack = new ItemStack(RegistrarBloodMagicItems.SOUL_GEM, 1, i); @@ -65,8 +61,7 @@ public class RegistrarBloodMagicRecipes RegistrarBloodMagicItems.SOUL_TOOL_MATERIAL.setRepairItem(EnumDemonWillType.DEFAULT.getStack()); } - public static void registerAltarRecipes(BloodMagicRecipeRegistrar registrar) - { + public static void registerAltarRecipes(BloodMagicRecipeRegistrar registrar) { // ONE registrar.addBloodAltar(new OreIngredient("gemDiamond"), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_WEAK), AltarTier.ONE.ordinal(), 2000, 2, 1); registrar.addBloodAltar(new OreIngredient("stone"), ItemSlate.SlateType.BLANK.getStack(), AltarTier.ONE.ordinal(), 1000, 5, 5); @@ -105,8 +100,7 @@ public class RegistrarBloodMagicRecipes } } - public static void registerAlchemyTableRecipes(BloodMagicRecipeRegistrar registrar) - { + public static void registerAlchemyTableRecipes(BloodMagicRecipeRegistrar registrar) { registrar.addAlchemyTable(new ItemStack(Items.STRING, 4), 0, 100, 0, Blocks.WOOL, Items.FLINT); registrar.addAlchemyTable(new ItemStack(Items.FLINT, 2), 0, 20, 0, Blocks.GRAVEL, Items.FLINT); registrar.addAlchemyTable(new ItemStack(Items.LEATHER, 4), 100, 200, 1, Items.ROTTEN_FLESH, Items.ROTTEN_FLESH, Items.ROTTEN_FLESH, Items.ROTTEN_FLESH, Items.FLINT, Items.WATER_BUCKET); @@ -139,16 +133,13 @@ public class RegistrarBloodMagicRecipes Set addedOreRecipeList = Sets.newHashSet("oreIron", "oreGold", "oreCoal", "oreRedstone"); // We already added these above String[] oreList = OreDictionary.getOreNames().clone(); - for (String ore : oreList) - { - if (ore.startsWith("ore") && !addedOreRecipeList.contains(ore)) - { + for (String ore : oreList) { + if (ore.startsWith("ore") && !addedOreRecipeList.contains(ore)) { String dustName = ore.replaceFirst("ore", "dust"); List discoveredOres = OreDictionary.getOres(ore); List dustList = OreDictionary.getOres(dustName); - if (dustList != null && !dustList.isEmpty() && discoveredOres != null && !discoveredOres.isEmpty()) - { + if (dustList != null && !dustList.isEmpty() && discoveredOres != null && !discoveredOres.isEmpty()) { ItemStack dustStack = dustList.get(0).copy(); dustStack.setCount(2); registrar.addAlchemyTable(dustStack, 400, 200, 1, ore, ItemCuttingFluid.FluidType.BASIC.getStack()); @@ -158,8 +149,7 @@ public class RegistrarBloodMagicRecipes } } - public static void registerTartaricForgeRecipes(BloodMagicRecipeRegistrar registrar) - { + public static void registerTartaricForgeRecipes(BloodMagicRecipeRegistrar registrar) { registrar.addTartaricForge(new ItemStack(RegistrarBloodMagicItems.SOUL_GEM), 1, 1, "dustRedstone", "ingotGold", "blockGlass", "dyeBlue"); registrar.addTartaricForge(new ItemStack(RegistrarBloodMagicItems.SOUL_GEM, 1, 1), 60, 20, new ItemStack(RegistrarBloodMagicItems.SOUL_GEM), "gemDiamond", "blockRedstone", "blockLapis"); registrar.addTartaricForge(new ItemStack(RegistrarBloodMagicItems.SOUL_GEM, 1, 2), 240, 50, new ItemStack(RegistrarBloodMagicItems.SOUL_GEM, 1, 1), "gemDiamond", "blockGold", ItemSlate.SlateType.IMBUED.getStack()); @@ -216,8 +206,7 @@ public class RegistrarBloodMagicRecipes registrar.addTartaricForge(new ItemStack(RegistrarBloodMagicItems.RITUAL_DISMANTLER), 500, 100, new ItemStack(RegistrarBloodMagicItems.ITEM_DEMON_CRYSTAL, 1, 2), new ItemStack(RegistrarBloodMagicItems.ITEM_DEMON_CRYSTAL, 1, 2), new ItemStack(RegistrarBloodMagicItems.RITUAL_DIVINER), new ItemStack(RegistrarBloodMagicItems.BLOOD_SHARD)); } - public static void registerAlchemyArrayRecipes(BloodMagicRecipeRegistrar registrar) - { + public static void registerAlchemyArrayRecipes(BloodMagicRecipeRegistrar registrar) { registrar.addAlchemyArray(new ItemStack(Items.REDSTONE), ItemSlate.SlateType.BLANK.getStack(), new ItemStack(RegistrarBloodMagicItems.SIGIL_DIVINATION), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/DivinationSigil.png")); registrar.addAlchemyArray(ComponentTypes.REAGENT_WATER.getStack(), ItemSlate.SlateType.BLANK.getStack(), new ItemStack(RegistrarBloodMagicItems.SIGIL_WATER), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WaterSigil.png")); @@ -244,8 +233,7 @@ public class RegistrarBloodMagicRecipes } - public static void registerSacrificeCraftRecipes(BloodMagicRecipeRegistrar registrar) - { + public static void registerSacrificeCraftRecipes(BloodMagicRecipeRegistrar registrar) { registrar.addSacrificeCraft(new ItemStack(RegistrarBloodMagicBlocks.TELEPOSER), 10, Items.REDSTONE); } } diff --git a/src/main/java/WayofTime/bloodmagic/entity/mob/EntitySentientSpecter.java b/src/main/java/WayofTime/bloodmagic/entity/mob/EntitySentientSpecter.java index 21d5b273..321f3d30 100644 --- a/src/main/java/WayofTime/bloodmagic/entity/mob/EntitySentientSpecter.java +++ b/src/main/java/WayofTime/bloodmagic/entity/mob/EntitySentientSpecter.java @@ -385,9 +385,9 @@ public class EntitySentientSpecter extends EntityDemonBase { @Override public boolean shouldAttackEntity(EntityLivingBase attacker, EntityLivingBase owner) { if (!(attacker instanceof EntityCreeper) && !(attacker instanceof EntityGhast)) { - return super.shouldAttackEntity(attacker, owner); - } - return false; + return super.shouldAttackEntity(attacker, owner); + } + return false; } @Override diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemActivationCrystal.java b/src/main/java/WayofTime/bloodmagic/item/ItemActivationCrystal.java index 65c0c354..ca52fadd 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemActivationCrystal.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemActivationCrystal.java @@ -47,7 +47,8 @@ public class ItemActivationCrystal extends ItemEnum.Variant -{ - public ItemAlchemicVial() - { +public class ItemAlchemicVial extends ItemEnum.Variant { + public ItemAlchemicVial() { super(AlchemicVialType.class, "alchemic_vial"); } @Override - public void gatherVariants(Int2ObjectMap variants) - { + public void gatherVariants(Int2ObjectMap variants) { for (AlchemicVialType type : types) variants.put(type.ordinal(), "type=normal"); } diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemBloodOrb.java b/src/main/java/WayofTime/bloodmagic/item/ItemBloodOrb.java index 9e31e607..71d20e33 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemBloodOrb.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemBloodOrb.java @@ -82,7 +82,7 @@ public class ItemBloodOrb extends ItemBindableBase implements IBloodOrb { if (binding.getOwnerId().equals(player.getGameProfile().getId())) ownerNetwork.setOrbTier(orb.getTier()); - ownerNetwork.add(SoulTicket.item(stack, world, player,200), orb.getCapacity()); // Add LP to owner's network + ownerNetwork.add(SoulTicket.item(stack, world, player, 200), orb.getCapacity()); // Add LP to owner's network ownerNetwork.hurtPlayer(player, 200); // Hurt whoever is using it return super.onItemRightClick(world, player, hand); } diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemLavaCrystal.java b/src/main/java/WayofTime/bloodmagic/item/ItemLavaCrystal.java index a537d1ec..f99408df 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemLavaCrystal.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemLavaCrystal.java @@ -70,7 +70,7 @@ public class ItemLavaCrystal extends ItemBindableBase implements IVariantProvide return null; NBTTagCompound nbt = (NBTTagCompound) bindingTag; - return new Binding(NBTUtil.getUUIDFromTag(nbt.getCompoundTag("id")),nbt.getString("name")); + return new Binding(NBTUtil.getUUIDFromTag(nbt.getCompoundTag("id")), nbt.getString("name")); } @Override diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemSacrificialDagger.java b/src/main/java/WayofTime/bloodmagic/item/ItemSacrificialDagger.java index 5410758f..960b52a0 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemSacrificialDagger.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemSacrificialDagger.java @@ -53,7 +53,7 @@ public class ItemSacrificialDagger extends ItemEnum { REINFORCED, IMBUED, DEMONIC, - ETHEREAL,; + ETHEREAL, + ; @Nonnull @Override diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemTelepositionFocus.java b/src/main/java/WayofTime/bloodmagic/item/ItemTelepositionFocus.java index 2d645ba2..1cce2154 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemTelepositionFocus.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemTelepositionFocus.java @@ -93,7 +93,8 @@ public class ItemTelepositionFocus extends ItemEnum.Variant list) - { + public void getSubItems(CreativeTabs creativeTab, NonNullList list) { if (!isInCreativeTab(creativeTab)) return; @@ -55,35 +51,30 @@ public class ItemFluidRouterFilter extends Item implements IFluidFilterProvider, @Override @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, World world, List tooltip, ITooltipFlag flag) - { + public void addInformation(ItemStack stack, World world, List tooltip, ITooltipFlag flag) { tooltip.add(TextHelper.localize("tooltip.bloodmagic.fluidFilter." + names[stack.getItemDamage()])); super.addInformation(stack, world, tooltip, flag); } @Override - public IFluidFilter getInputFluidFilter(ItemStack filterStack, TileEntity tile, IFluidHandler handler) - { + public IFluidFilter getInputFluidFilter(ItemStack filterStack, TileEntity tile, IFluidHandler handler) { IFluidFilter testFilter; - switch (filterStack.getMetadata()) - { - case 0: - testFilter = new RoutingFluidFilter(); - break; + switch (filterStack.getMetadata()) { + case 0: + testFilter = new RoutingFluidFilter(); + break; - default: - testFilter = new RoutingFluidFilter(); + default: + testFilter = new RoutingFluidFilter(); } List filteredList = new ArrayList<>(); ItemInventory inv = new ItemInventory(filterStack, 9, ""); - for (int i = 0; i < inv.getSizeInventory(); i++) - { + for (int i = 0; i < inv.getSizeInventory(); i++) { ItemStack stack = inv.getStackInSlot(i); - if (stack.isEmpty()) - { + if (stack.isEmpty()) { continue; } @@ -96,32 +87,27 @@ public class ItemFluidRouterFilter extends Item implements IFluidFilterProvider, } @Override - public IFluidFilter getOutputFluidFilter(ItemStack filterStack, TileEntity tile, IFluidHandler handler) - { + public IFluidFilter getOutputFluidFilter(ItemStack filterStack, TileEntity tile, IFluidHandler handler) { IFluidFilter testFilter; - switch (filterStack.getMetadata()) - { - case 0: - testFilter = new RoutingFluidFilter(); - break; + switch (filterStack.getMetadata()) { + case 0: + testFilter = new RoutingFluidFilter(); + break; - default: - testFilter = new RoutingFluidFilter(); + default: + testFilter = new RoutingFluidFilter(); } List filteredList = new ArrayList<>(); ItemInventory inv = new ItemInventory(filterStack, 9, ""); //TODO: Change to grab the filter from the Item later. - for (int i = 0; i < inv.getSizeInventory(); i++) - { + for (int i = 0; i < inv.getSizeInventory(); i++) { ItemStack stack = inv.getStackInSlot(i); - if (stack.isEmpty()) - { + if (stack.isEmpty()) { continue; } ItemStack ghostStack = GhostItemHelper.getStackFromGhost(stack); - if (ghostStack.isEmpty()) - { + if (ghostStack.isEmpty()) { ghostStack.setCount(Integer.MAX_VALUE); } @@ -133,14 +119,12 @@ public class ItemFluidRouterFilter extends Item implements IFluidFilterProvider, } @Override - public void gatherVariants(@Nonnull Int2ObjectMap variants) - { + public void gatherVariants(@Nonnull Int2ObjectMap variants) { variants.put(0, "type=exact"); } @Override - public ItemStack getContainedStackForItem(ItemStack filterStack, ItemStack keyStack) - { + public ItemStack getContainedStackForItem(ItemStack filterStack, ItemStack keyStack) { ItemStack copyStack = keyStack.copy(); GhostItemHelper.setItemGhostAmount(copyStack, 0); copyStack.setCount(1); diff --git a/src/main/java/WayofTime/bloodmagic/item/routing/ItemRouterFilter.java b/src/main/java/WayofTime/bloodmagic/item/routing/ItemRouterFilter.java index e62a77be..70e55aec 100644 --- a/src/main/java/WayofTime/bloodmagic/item/routing/ItemRouterFilter.java +++ b/src/main/java/WayofTime/bloodmagic/item/routing/ItemRouterFilter.java @@ -22,12 +22,10 @@ import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; -public class ItemRouterFilter extends Item implements IItemFilterProvider, IVariantProvider -{ - public static String[] names = { "exact", "ignoreNBT", "modItems", "oreDict" }; +public class ItemRouterFilter extends Item implements IItemFilterProvider, IVariantProvider { + public static String[] names = {"exact", "ignoreNBT", "modItems", "oreDict"}; - public ItemRouterFilter() - { + public ItemRouterFilter() { super(); setTranslationKey(BloodMagic.MODID + ".itemFilter."); @@ -36,15 +34,13 @@ public class ItemRouterFilter extends Item implements IItemFilterProvider, IVari } @Override - public String getTranslationKey(ItemStack stack) - { + public String getTranslationKey(ItemStack stack) { return super.getTranslationKey(stack) + names[stack.getItemDamage()]; } @Override @SideOnly(Side.CLIENT) - public void getSubItems(CreativeTabs creativeTab, NonNullList list) - { + public void getSubItems(CreativeTabs creativeTab, NonNullList list) { if (!isInCreativeTab(creativeTab)) return; @@ -54,44 +50,39 @@ public class ItemRouterFilter extends Item implements IItemFilterProvider, IVari @Override @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, World world, List tooltip, ITooltipFlag flag) - { + public void addInformation(ItemStack stack, World world, List tooltip, ITooltipFlag flag) { tooltip.add(TextHelper.localize("tooltip.bloodmagic.itemFilter." + names[stack.getItemDamage()])); super.addInformation(stack, world, tooltip, flag); } @Override - public IItemFilter getInputItemFilter(ItemStack filterStack, TileEntity tile, IItemHandler handler) - { + public IItemFilter getInputItemFilter(ItemStack filterStack, TileEntity tile, IItemHandler handler) { IItemFilter testFilter = new TestItemFilter(); - switch (filterStack.getMetadata()) - { - case 0: - testFilter = new TestItemFilter(); - break; - case 1: - testFilter = new IgnoreNBTItemFilter(); - break; - case 2: - testFilter = new ModIdItemFilter(); - break; - case 3: - testFilter = new OreDictItemFilter(); - break; + switch (filterStack.getMetadata()) { + case 0: + testFilter = new TestItemFilter(); + break; + case 1: + testFilter = new IgnoreNBTItemFilter(); + break; + case 2: + testFilter = new ModIdItemFilter(); + break; + case 3: + testFilter = new OreDictItemFilter(); + break; - default: - testFilter = new DefaultItemFilter(); + default: + testFilter = new DefaultItemFilter(); } List filteredList = new ArrayList<>(); ItemInventory inv = new ItemInventory(filterStack, 9, ""); - for (int i = 0; i < inv.getSizeInventory(); i++) - { + for (int i = 0; i < inv.getSizeInventory(); i++) { ItemStack stack = inv.getStackInSlot(i); - if (stack.isEmpty()) - { + if (stack.isEmpty()) { continue; } @@ -105,42 +96,37 @@ public class ItemRouterFilter extends Item implements IItemFilterProvider, IVari } @Override - public IItemFilter getOutputItemFilter(ItemStack filterStack, TileEntity tile, IItemHandler handler) - { + public IItemFilter getOutputItemFilter(ItemStack filterStack, TileEntity tile, IItemHandler handler) { IItemFilter testFilter; - switch (filterStack.getMetadata()) - { - case 0: - testFilter = new TestItemFilter(); - break; - case 1: - testFilter = new IgnoreNBTItemFilter(); - break; - case 2: - testFilter = new ModIdItemFilter(); - break; - case 3: - testFilter = new OreDictItemFilter(); - break; + switch (filterStack.getMetadata()) { + case 0: + testFilter = new TestItemFilter(); + break; + case 1: + testFilter = new IgnoreNBTItemFilter(); + break; + case 2: + testFilter = new ModIdItemFilter(); + break; + case 3: + testFilter = new OreDictItemFilter(); + break; - default: - testFilter = new DefaultItemFilter(); + default: + testFilter = new DefaultItemFilter(); } List filteredList = new ArrayList<>(); ItemInventory inv = new ItemInventory(filterStack, 9, ""); //TODO: Change to grab the filter from the Item later. - for (int i = 0; i < inv.getSizeInventory(); i++) - { + for (int i = 0; i < inv.getSizeInventory(); i++) { ItemStack stack = inv.getStackInSlot(i); - if (stack.isEmpty()) - { + if (stack.isEmpty()) { continue; } ItemStack ghostStack = GhostItemHelper.getStackFromGhost(stack); - if (ghostStack.isEmpty()) - { + if (ghostStack.isEmpty()) { ghostStack.setCount(Integer.MAX_VALUE); } @@ -152,8 +138,7 @@ public class ItemRouterFilter extends Item implements IItemFilterProvider, IVari } @Override - public void gatherVariants(@Nonnull Int2ObjectMap variants) - { + public void gatherVariants(@Nonnull Int2ObjectMap variants) { variants.put(0, "type=exact"); variants.put(1, "type=ignorenbt"); variants.put(2, "type=moditems"); @@ -161,8 +146,7 @@ public class ItemRouterFilter extends Item implements IItemFilterProvider, IVari } @Override - public ItemStack getContainedStackForItem(ItemStack filterStack, ItemStack keyStack) - { + public ItemStack getContainedStackForItem(ItemStack filterStack, ItemStack keyStack) { ItemStack copyStack = keyStack.copy(); GhostItemHelper.setItemGhostAmount(copyStack, 0); copyStack.setCount(1); diff --git a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilBloodLight.java b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilBloodLight.java index 8c161786..957187bc 100644 --- a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilBloodLight.java +++ b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilBloodLight.java @@ -15,23 +15,19 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; -public class ItemSigilBloodLight extends ItemSigilBase -{ - public ItemSigilBloodLight() - { +public class ItemSigilBloodLight extends ItemSigilBase { + public ItemSigilBloodLight() { super("blood_light", 10); } @Override - public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) - { + public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { if (getCooldownRemainder(stack) > 0) reduceCooldown(stack); } @Override - public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) - { + public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { ItemStack stack = player.getHeldItem(hand); if (stack.getItem() instanceof ISigil.Holding) stack = ((Holding) stack.getItem()).getHeldItem(stack, player); @@ -43,15 +39,12 @@ public class ItemSigilBloodLight extends ItemSigilBase if (getCooldownRemainder(stack) > 0) return super.onItemRightClick(world, player, hand); - if (mop != null && mop.typeOfHit == RayTraceResult.Type.BLOCK) - { + if (mop != null && mop.typeOfHit == RayTraceResult.Type.BLOCK) { BlockPos blockPos = mop.getBlockPos().offset(mop.sideHit); - if (world.isAirBlock(blockPos)) - { + if (world.isAirBlock(blockPos)) { world.setBlockState(blockPos, RegistrarBloodMagicBlocks.BLOOD_LIGHT.getDefaultState()); - if (!world.isRemote) - { + if (!world.isRemote) { SoulNetwork network = NetworkHelper.getSoulNetwork(getBinding(stack)); network.syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed())); } @@ -59,10 +52,8 @@ public class ItemSigilBloodLight extends ItemSigilBase player.swingArm(hand); return super.onItemRightClick(world, player, hand); } - } else - { - if (!world.isRemote) - { + } else { + if (!world.isRemote) { SoulNetwork network = NetworkHelper.getSoulNetwork(getBinding(stack)); world.spawnEntity(new EntityBloodLight(world, player)); network.syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed())); @@ -74,23 +65,19 @@ public class ItemSigilBloodLight extends ItemSigilBase } @Override - public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) - { + public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { return oldStack.getItem() != newStack.getItem(); } - public int getCooldownRemainder(ItemStack stack) - { + public int getCooldownRemainder(ItemStack stack) { return NBTHelper.checkNBT(stack).getTagCompound().getInteger(Constants.NBT.TICKS_REMAINING); } - public void reduceCooldown(ItemStack stack) - { + public void reduceCooldown(ItemStack stack) { NBTHelper.checkNBT(stack).getTagCompound().setInteger(Constants.NBT.TICKS_REMAINING, getCooldownRemainder(stack) - 1); } - public void resetCooldown(ItemStack stack) - { + public void resetCooldown(ItemStack stack) { NBTHelper.checkNBT(stack).getTagCompound().setInteger(Constants.NBT.TICKS_REMAINING, 10); } } diff --git a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilTeleposition.java b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilTeleposition.java index 5a9ea8f0..7d25804c 100644 --- a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilTeleposition.java +++ b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilTeleposition.java @@ -71,8 +71,8 @@ public class ItemSigilTeleposition extends ItemSigilBase { TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(blockPos, player, bindingOwnerID, world, tile.getWorld().provider.getDimension(), true)); } } - } } + } return super.onItemRightClick(world, player, hand); } diff --git a/src/main/java/WayofTime/bloodmagic/item/soul/ItemMonsterSoul.java b/src/main/java/WayofTime/bloodmagic/item/soul/ItemMonsterSoul.java index 6e83eb7e..487f80a2 100644 --- a/src/main/java/WayofTime/bloodmagic/item/soul/ItemMonsterSoul.java +++ b/src/main/java/WayofTime/bloodmagic/item/soul/ItemMonsterSoul.java @@ -104,7 +104,8 @@ public class ItemMonsterSoul extends ItemEnum.Variant CORROSIVE, DESTRUCTIVE, VENGEFUL, - STEADFAST,; + STEADFAST, + ; @Nonnull @Override diff --git a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientBow.java b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientBow.java index 1b804351..4d72a199 100644 --- a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientBow.java +++ b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientBow.java @@ -44,12 +44,12 @@ import java.util.Locale; public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentientTool, IVariantProvider//, IMeshProvider { - public static int[] soulBracket = new int[] {16, 60, 200, 400, 1000, 2000, 4000}; - public static double[] defaultDamageAdded = new double[] {0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75}; - public static float[] velocityAdded = new float[] {0.25f, 0.5f, 0.75f, 1, 1.25f, 1.5f, 1.75f}; - public static double[] soulDrainPerSwing = new double[] {0.05, 0.1, 0.2, 0.4, 0.75, 1, 1.5}; //TODO - public static double[] soulDrop = new double[] {2, 4, 7, 10, 13, 16, 24}; - public static double[] staticDrop = new double[] {1, 1, 2, 3, 3, 3, 4}; + public static int[] soulBracket = new int[]{16, 60, 200, 400, 1000, 2000, 4000}; + public static double[] defaultDamageAdded = new double[]{0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75}; + public static float[] velocityAdded = new float[]{0.25f, 0.5f, 0.75f, 1, 1.25f, 1.5f, 1.75f}; + public static double[] soulDrainPerSwing = new double[]{0.05, 0.1, 0.2, 0.4, 0.75, 1, 1.5}; //TODO + public static double[] soulDrop = new double[]{2, 4, 7, 10, 13, 16, 24}; + public static double[] staticDrop = new double[]{1, 1, 2, 3, 3, 3, 4}; public static float soullessShotVelocity = 2.5F; public ItemSentientBow() { @@ -331,7 +331,7 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien player.addStat(StatList.getObjectUseStats(this)); return entityArrow; } - + @Override public void onPlayerStoppedUsing(ItemStack stack, World world, EntityLivingBase entityLiving, int timeLeft) { if (entityLiving instanceof EntityPlayer) { @@ -361,9 +361,9 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien ItemArrow itemarrow = ((ItemArrow) (itemstack.getItem() instanceof ItemArrow ? itemstack.getItem() : Items.ARROW)); EntityArrow entityArrow; double amount = (this.getDropOfActivatedBow(stack) * world.rand.nextDouble() + this.getStaticDropOfActivatedBow(stack)); - + float newArrowVelocity = arrowVelocity * getVelocityOfArrow(stack); - + if (getLevel(PlayerDemonWillHandler.getTotalDemonWill(type, player)) <= 0) { entityArrow = itemarrow.createArrow(world, itemstack, entityLiving); } else if (itemarrow == Items.ARROW) { @@ -382,8 +382,7 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien entityArrow.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, newArrowVelocity, 1.0F); - if (Float.compare(getVelocityOfArrow(stack), soullessShotVelocity) < Float.MIN_NORMAL) - { + if (Float.compare(getVelocityOfArrow(stack), soullessShotVelocity) < Float.MIN_NORMAL) { world.playSound(null, player.getPosition(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.NEUTRAL, 0.4F, 1.0F); } diff --git a/src/main/java/WayofTime/bloodmagic/item/soulBreath/ItemFlightScroll.java b/src/main/java/WayofTime/bloodmagic/item/soulBreath/ItemFlightScroll.java index 12073a87..b16fe78a 100644 --- a/src/main/java/WayofTime/bloodmagic/item/soulBreath/ItemFlightScroll.java +++ b/src/main/java/WayofTime/bloodmagic/item/soulBreath/ItemFlightScroll.java @@ -32,31 +32,26 @@ import WayofTime.bloodmagic.iface.IActivatable; import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.util.helper.NBTHelper; -public class ItemFlightScroll extends ItemSoulBreathContainer implements IMeshProvider, IActivatable -{ +public class ItemFlightScroll extends ItemSoulBreathContainer implements IMeshProvider, IActivatable { public static Map> floatMap = new HashMap>(); public static Map heldEntityMap = new HashMap(); public static Map heldEntityOffsetMap = new HashMap(); //TODO: A lot of this stuff could be moved to a toggle-able variant - public ItemFlightScroll() - { + public ItemFlightScroll() { super(); setTranslationKey(BloodMagic.MODID + ".icarusScroll"); setCreativeTab(BloodMagic.TAB_BM); } @Override - public boolean getActivated(ItemStack stack) - { + public boolean getActivated(ItemStack stack) { return !stack.isEmpty() && NBTHelper.checkNBT(stack).getTagCompound().getBoolean(Constants.NBT.ACTIVATED); } @Override - public ItemStack setActivatedState(ItemStack stack, boolean activated) - { - if (!stack.isEmpty()) - { + public ItemStack setActivatedState(ItemStack stack, boolean activated) { + if (!stack.isEmpty()) { NBTHelper.checkNBT(stack).getTagCompound().setBoolean(Constants.NBT.ACTIVATED, activated); return stack; } @@ -65,27 +60,20 @@ public class ItemFlightScroll extends ItemSoulBreathContainer implements IMeshPr } @Override - public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) - { + public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { ItemStack stack = player.getHeldItem(hand); - if (!world.isRemote) - { - if (player.isSneaking()) - { - if (!getActivated(stack)) - { + if (!world.isRemote) { + if (player.isSneaking()) { + if (!getActivated(stack)) { double drainNeeded = getBreathCostPerSecond(stack); - if (this.drainBreath(stack, drainNeeded, false) >= drainNeeded) - { + if (this.drainBreath(stack, drainNeeded, false) >= drainNeeded) { setActivatedState(stack, true); } - } else - { + } else { setActivatedState(stack, false); } - } else - { + } else { //TODO: Add an effect where it "draws back" like a bow in order to cast Levitation on a mob. //Only Levitated mobs can be grabbed. } @@ -95,27 +83,21 @@ public class ItemFlightScroll extends ItemSoulBreathContainer implements IMeshPr } @Override - public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity, EnumHand hand) - { - if (entity.world.isRemote) - { + public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity, EnumHand hand) { + if (entity.world.isRemote) { return false; } //TODO: Do check to see if the entity is levitating - will only "ensnare" a mob that is levitating. - if (player.isSneaking()) - { + if (player.isSneaking()) { //TODO: Release entity completely? removeEntity(player, entity); - } else - { + } else { EntityLivingBase heldEntity = getHeldEntity(player); - if (heldEntity != null && heldEntity.equals(entity)) - { + if (heldEntity != null && heldEntity.equals(entity)) { heldEntityMap.remove(player); - } else - { + } else { holdEntity(player, entity); //Hold the entity so you can place it around yourself where needed. } } @@ -124,18 +106,13 @@ public class ItemFlightScroll extends ItemSoulBreathContainer implements IMeshPr } @Override - public void onUpdate(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) - { - if (!world.isRemote && entity instanceof EntityPlayerMP && getActivated(stack)) - { - if (entity.ticksExisted % 20 == 0) - { + public void onUpdate(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) { + if (!world.isRemote && entity instanceof EntityPlayerMP && getActivated(stack)) { + if (entity.ticksExisted % 20 == 0) { double drainNeeded = getBreathCostPerSecond(stack); - if (this.drainBreath(stack, drainNeeded, false) >= drainNeeded) - { + if (this.drainBreath(stack, drainNeeded, false) >= drainNeeded) { this.drainBreath(stack, drainNeeded, true); - } else - { + } else { this.setActivatedState(stack, false); } } @@ -143,40 +120,32 @@ public class ItemFlightScroll extends ItemSoulBreathContainer implements IMeshPr onEffectUpdate(stack, world, (EntityPlayer) entity, itemSlot, isSelected); } - if (!world.isRemote) - { - if (entity instanceof EntityPlayer) - { + if (!world.isRemote) { + if (entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entity; updateHeldEntityPosition(player); - if (floatMap.containsKey(player)) - { + if (floatMap.containsKey(player)) { Map entityMap = floatMap.get(player); - if (entityMap == null) - { + if (entityMap == null) { return; } List removalList = new ArrayList(); - for (Entry entry : entityMap.entrySet()) - { + for (Entry entry : entityMap.entrySet()) { EntityLivingBase floatingEntity = entry.getKey(); - if (floatingEntity == null || floatingEntity.isDead || floatingEntity.dimension != player.dimension) - { + if (floatingEntity == null || floatingEntity.isDead || floatingEntity.dimension != player.dimension) { removalList.add(floatingEntity); } followOwner(player, floatingEntity, entry.getValue()); } - for (EntityLivingBase livingEntity : removalList) - { + for (EntityLivingBase livingEntity : removalList) { entityMap.remove(livingEntity); } - if (entityMap.isEmpty()) - { + if (entityMap.isEmpty()) { floatMap.remove(player); } @@ -185,16 +154,13 @@ public class ItemFlightScroll extends ItemSoulBreathContainer implements IMeshPr } } - public static boolean updateEntityOffset(EntityPlayer player, EntityLivingBase living, Vector3d updatedOffset) - { + public static boolean updateEntityOffset(EntityPlayer player, EntityLivingBase living, Vector3d updatedOffset) { //TODO: Check if this entity is contained in another player's map to prevent weird things. - if (floatMap.containsKey(player)) - { + if (floatMap.containsKey(player)) { Map entityMap = floatMap.get(player); entityMap.put(living, updatedOffset); return true; - } else - { + } else { Map entityMap = new HashMap(); entityMap.put(living, updatedOffset); floatMap.put(player, entityMap); @@ -203,28 +169,23 @@ public class ItemFlightScroll extends ItemSoulBreathContainer implements IMeshPr } @Nullable - public static EntityLivingBase getHeldEntity(EntityPlayer player) - { - if (heldEntityMap.containsKey(player)) - { + public static EntityLivingBase getHeldEntity(EntityPlayer player) { + if (heldEntityMap.containsKey(player)) { return heldEntityMap.get(player); } return null; } - public static double getHeldEntityOffset(EntityPlayer player) - { - if (heldEntityMap.containsKey(player)) - { + public static double getHeldEntityOffset(EntityPlayer player) { + if (heldEntityMap.containsKey(player)) { return heldEntityOffsetMap.get(player); } return 1; } - public static void holdEntity(EntityPlayer player, EntityLivingBase entityLiving) - { + public static void holdEntity(EntityPlayer player, EntityLivingBase entityLiving) { float distance = player.getDistance(entityLiving); Vec3d lookVec = player.getLookVec(); heldEntityMap.put(player, entityLiving); @@ -232,41 +193,33 @@ public class ItemFlightScroll extends ItemSoulBreathContainer implements IMeshPr updateEntityOffset(player, entityLiving, new Vector3d(lookVec.x * distance, lookVec.y * distance, lookVec.z * distance)); } - public static void updateHeldEntityPosition(EntityPlayer player) - { + public static void updateHeldEntityPosition(EntityPlayer player) { EntityLivingBase entityLiving = getHeldEntity(player); - if (entityLiving != null) - { + if (entityLiving != null) { double offset = getHeldEntityOffset(player); Vec3d lookVec = player.getLookVec(); updateEntityOffset(player, entityLiving, new Vector3d(lookVec.x * offset, lookVec.y * offset, lookVec.z * offset)); } } - public static void removeEntity(EntityPlayer player, EntityLivingBase living) - { - if (living == null) - { + public static void removeEntity(EntityPlayer player, EntityLivingBase living) { + if (living == null) { return; } - if (floatMap.containsKey(player)) - { + if (floatMap.containsKey(player)) { Map entityMap = floatMap.get(player); - if (entityMap.containsKey(living)) - { + if (entityMap.containsKey(living)) { entityMap.remove(living); } - if (entityMap.isEmpty()) - { + if (entityMap.isEmpty()) { floatMap.remove(player); } } } - public void followOwner(EntityPlayer owner, EntityLivingBase livingEntity, Vector3d offset) - { + public void followOwner(EntityPlayer owner, EntityLivingBase livingEntity, Vector3d offset) { double offsetX = offset.x; double offsetY = offset.y; double offsetZ = offset.z; @@ -287,40 +240,34 @@ public class ItemFlightScroll extends ItemSoulBreathContainer implements IMeshPr vec.normalize(); - if (speed <= 0.00001) - { + if (speed <= 0.00001) { return; } livingEntity.setVelocity(vec.x * speed, vec.y * speed, vec.z * speed); } - public void onEffectUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) - { + public void onEffectUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) { player.addPotionEffect(new PotionEffect(RegistrarBloodMagic.FLIGHT, 2, 0)); } @Override - public int getMaxBreath(ItemStack stack) - { + public int getMaxBreath(ItemStack stack) { return 20; } - public double getBreathCostPerSecond(ItemStack stack) - { + public double getBreathCostPerSecond(ItemStack stack) { return 0.01; } @Override @SideOnly(Side.CLIENT) - public ItemMeshDefinition getMeshDefinition() - { + public ItemMeshDefinition getMeshDefinition() { return new CustomMeshDefinitionActivatable("icarus_scroll"); } @Override - public void gatherVariants(Consumer variants) - { + public void gatherVariants(Consumer variants) { variants.accept("active=false"); variants.accept("active=true"); } diff --git a/src/main/java/WayofTime/bloodmagic/item/soulBreath/ItemSoulBreathContainer.java b/src/main/java/WayofTime/bloodmagic/item/soulBreath/ItemSoulBreathContainer.java index 1dfb41cd..43c3b3ed 100644 --- a/src/main/java/WayofTime/bloodmagic/item/soulBreath/ItemSoulBreathContainer.java +++ b/src/main/java/WayofTime/bloodmagic/item/soulBreath/ItemSoulBreathContainer.java @@ -6,33 +6,28 @@ import net.minecraft.nbt.NBTTagCompound; import WayofTime.bloodmagic.soul.ISoulBreathContainer; import WayofTime.bloodmagic.util.Constants; -public abstract class ItemSoulBreathContainer extends Item implements ISoulBreathContainer -{ +public abstract class ItemSoulBreathContainer extends Item implements ISoulBreathContainer { @Override - public double getBreath(ItemStack stack) - { + public double getBreath(ItemStack stack) { NBTTagCompound tag = stack.getTagCompound(); return tag.getDouble(Constants.NBT.BREATH); } @Override - public void setBreath(ItemStack stack, double amount) - { + public void setBreath(ItemStack stack, double amount) { NBTTagCompound tag = stack.getTagCompound(); tag.setDouble(Constants.NBT.BREATH, amount); } @Override - public double drainBreath(ItemStack stack, double drainAmount, boolean doDrain) - { + public double drainBreath(ItemStack stack, double drainAmount, boolean doDrain) { double breath = getBreath(stack); double breathDrained = Math.min(drainAmount, breath); - if (doDrain) - { + if (doDrain) { setBreath(stack, breath - breathDrained); } @@ -40,15 +35,13 @@ public abstract class ItemSoulBreathContainer extends Item implements ISoulBreat } @Override - public double fillBreath(ItemStack stack, double fillAmount, boolean doFill) - { + public double fillBreath(ItemStack stack, double fillAmount, boolean doFill) { double current = this.getBreath(stack); double maxBreath = this.getMaxBreath(stack); double filled = Math.min(fillAmount, maxBreath - current); - if (doFill) - { + if (doFill) { this.setBreath(stack, filled + current); } @@ -56,17 +49,14 @@ public abstract class ItemSoulBreathContainer extends Item implements ISoulBreat } @Override - public boolean showDurabilityBar(ItemStack stack) - { + public boolean showDurabilityBar(ItemStack stack) { return true; } @Override - public double getDurabilityForDisplay(ItemStack stack) - { + public double getDurabilityForDisplay(ItemStack stack) { double maxWill = getMaxBreath(stack); - if (maxWill <= 0) - { + if (maxWill <= 0) { return 1; } return 1.0 - (getBreath(stack) / maxWill); diff --git a/src/main/java/WayofTime/bloodmagic/item/types/AlchemicVialType.java b/src/main/java/WayofTime/bloodmagic/item/types/AlchemicVialType.java index db637b99..1539372c 100644 --- a/src/main/java/WayofTime/bloodmagic/item/types/AlchemicVialType.java +++ b/src/main/java/WayofTime/bloodmagic/item/types/AlchemicVialType.java @@ -6,44 +6,36 @@ import net.minecraft.item.ItemStack; import javax.annotation.Nonnull; import java.util.Locale; -public enum AlchemicVialType implements ISubItem -{ +public enum AlchemicVialType implements ISubItem { BASE(0x2e35ff); final int potionColour; - AlchemicVialType(int colour1) - { + AlchemicVialType(int colour1) { potionColour = colour1; } @Nonnull @Override - public String getInternalName() - { + public String getInternalName() { return name().toLowerCase(Locale.ROOT); } @Nonnull @Override - public ItemStack getStack(int count) - { + public ItemStack getStack(int count) { return new ItemStack(RegistrarBloodMagicItems.ALCHEMIC_VIAL, count, ordinal()); } - public int getColourForLayer(int layer) - { - if (layer == 0) - { + public int getColourForLayer(int layer) { + if (layer == 0) { return potionColour; } return -1; } - public static int getColourForLayer(int variant, int layer) - { - if (variant >= AlchemicVialType.values().length) - { + public static int getColourForLayer(int variant, int layer) { + if (variant >= AlchemicVialType.values().length) { return -1; } diff --git a/src/main/java/WayofTime/bloodmagic/item/types/ComponentTypes.java b/src/main/java/WayofTime/bloodmagic/item/types/ComponentTypes.java index 89474201..c49aa09b 100644 --- a/src/main/java/WayofTime/bloodmagic/item/types/ComponentTypes.java +++ b/src/main/java/WayofTime/bloodmagic/item/types/ComponentTypes.java @@ -40,7 +40,8 @@ public enum ComponentTypes implements ISubItem { CATALYST_POWER_1, REAGENT_CLAW, REAGENT_BOUNCE, - REAGENT_FROST,; + REAGENT_FROST, + ; @Nonnull @Override diff --git a/src/main/java/WayofTime/bloodmagic/item/types/ShardType.java b/src/main/java/WayofTime/bloodmagic/item/types/ShardType.java index f3ca9233..d3edd6e3 100644 --- a/src/main/java/WayofTime/bloodmagic/item/types/ShardType.java +++ b/src/main/java/WayofTime/bloodmagic/item/types/ShardType.java @@ -9,7 +9,8 @@ import java.util.Locale; public enum ShardType implements ISubItem { WEAK, - DEMONIC,; + DEMONIC, + ; @Nonnull @Override diff --git a/src/main/java/WayofTime/bloodmagic/livingArmour/upgrade/LivingArmourUpgradeFallProtect.java b/src/main/java/WayofTime/bloodmagic/livingArmour/upgrade/LivingArmourUpgradeFallProtect.java index 66b48fdc..79368bdb 100644 --- a/src/main/java/WayofTime/bloodmagic/livingArmour/upgrade/LivingArmourUpgradeFallProtect.java +++ b/src/main/java/WayofTime/bloodmagic/livingArmour/upgrade/LivingArmourUpgradeFallProtect.java @@ -14,7 +14,7 @@ public class LivingArmourUpgradeFallProtect extends LivingArmourUpgrade { super(level); } - + public float getDamageMultiplier() { return 1 - protectionLevel[this.level]; } diff --git a/src/main/java/WayofTime/bloodmagic/livingArmour/upgrade/LivingArmourUpgradeSpeed.java b/src/main/java/WayofTime/bloodmagic/livingArmour/upgrade/LivingArmourUpgradeSpeed.java index 8b9288a6..3a0a2890 100644 --- a/src/main/java/WayofTime/bloodmagic/livingArmour/upgrade/LivingArmourUpgradeSpeed.java +++ b/src/main/java/WayofTime/bloodmagic/livingArmour/upgrade/LivingArmourUpgradeSpeed.java @@ -16,45 +16,37 @@ import org.apache.commons.codec.binary.StringUtils; import java.util.UUID; -public class LivingArmourUpgradeSpeed extends LivingArmourUpgrade -{ - public static final int[] costs = new int[] { 3, 7, 13, 26, 42, 60, 90, 130, 180, 250 }; - public static final double[] speedModifier = new double[] { 0.1, 0.2, 0.3, 0.4, 0.5, 0.7, 0.9, 1.1, 1.3, 1.5 }; - public static final int[] sprintSpeedTime = new int[] { 0, 0, 0, 0, 0, 20, 60, 60, 100, 200 }; - public static final int[] sprintSpeedLevel = new int[] { 0, 0, 0, 0, 0, 0, 0, 1, 1, 2 }; - public static final int[] healthModifier = new int[] { 0, 0, 0, 0, 0, 0, 0, 4, 10, 20 }; - public static final int[] sprintRegenTime = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 25 }; +public class LivingArmourUpgradeSpeed extends LivingArmourUpgrade { + public static final int[] costs = new int[]{3, 7, 13, 26, 42, 60, 90, 130, 180, 250}; + public static final double[] speedModifier = new double[]{0.1, 0.2, 0.3, 0.4, 0.5, 0.7, 0.9, 1.1, 1.3, 1.5}; + public static final int[] sprintSpeedTime = new int[]{0, 0, 0, 0, 0, 20, 60, 60, 100, 200}; + public static final int[] sprintSpeedLevel = new int[]{0, 0, 0, 0, 0, 0, 0, 1, 1, 2}; + public static final int[] healthModifier = new int[]{0, 0, 0, 0, 0, 0, 0, 4, 10, 20}; + public static final int[] sprintRegenTime = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 25}; - public LivingArmourUpgradeSpeed(int level) - { + public LivingArmourUpgradeSpeed(int level) { super(level); } - public double getSpeedModifier() - { + public double getSpeedModifier() { return speedModifier[this.level]; } @Override - public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) - { - if (player.isSprinting()) - { - if (sprintSpeedTime[this.level] > 0) - { + public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) { + if (player.isSprinting()) { + if (sprintSpeedTime[this.level] > 0) { player.addPotionEffect(new PotionEffect(MobEffects.SPEED, sprintSpeedTime[this.level], sprintSpeedLevel[this.level], false, false)); } - if (sprintRegenTime[this.level] > 0 && !player.isPotionActive(MobEffects.REGENERATION)) - { + if (sprintRegenTime[this.level] > 0 && !player.isPotionActive(MobEffects.REGENERATION)) { player.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, sprintRegenTime[this.level], 0, false, false)); } } } @Override - public Multimap getAttributeModifiers() - { + public Multimap getAttributeModifiers() { Multimap modifierMap = HashMultimap.create(); // modifierMap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(895132, 1), "Speed modifier" + 1, speedModifier[this.level], 1)); @@ -68,38 +60,32 @@ public class LivingArmourUpgradeSpeed extends LivingArmourUpgrade } @Override - public String getUniqueIdentifier() - { + public String getUniqueIdentifier() { return BloodMagic.MODID + ".upgrade.movement"; } @Override - public int getMaxTier() - { + public int getMaxTier() { return 10; } @Override - public int getCostOfUpgrade() - { + public int getCostOfUpgrade() { return costs[this.level]; } @Override - public void writeToNBT(NBTTagCompound tag) - { + public void writeToNBT(NBTTagCompound tag) { // EMPTY } @Override - public void readFromNBT(NBTTagCompound tag) - { + public void readFromNBT(NBTTagCompound tag) { // EMPTY } @Override - public String getTranslationKey() - { + public String getTranslationKey() { return tooltipBase + "speed"; } } diff --git a/src/main/java/WayofTime/bloodmagic/proxy/ClientProxy.java b/src/main/java/WayofTime/bloodmagic/proxy/ClientProxy.java index f8dd774e..204d1db4 100644 --- a/src/main/java/WayofTime/bloodmagic/proxy/ClientProxy.java +++ b/src/main/java/WayofTime/bloodmagic/proxy/ClientProxy.java @@ -40,22 +40,18 @@ import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import java.awt.Color; import java.util.Map; -public class ClientProxy extends CommonProxy -{ +public class ClientProxy extends CommonProxy { public static DemonWillHolder currentAura = new DemonWillHolder(); @Override - public void preInit() - { + public void preInit() { super.preInit(); OBJLoader.INSTANCE.addDomain(BloodMagic.MODID); - ClientRegistry.bindTileEntitySpecialRenderer(TileInversionPillar.class, new AnimationTESR() - { + ClientRegistry.bindTileEntitySpecialRenderer(TileInversionPillar.class, new AnimationTESR() { @Override - public void handleEvents(TileInversionPillar chest, float time, Iterable pastEvents) - { + public void handleEvents(TileInversionPillar chest, float time, Iterable pastEvents) { chest.handleEvents(time, pastEvents); } }); @@ -73,8 +69,7 @@ public class ClientProxy extends CommonProxy } @Override - public void registerRenderers() - { + public void registerRenderers() { RenderingRegistry.registerEntityRenderingHandler(EntitySoulSnare.class, new SoulSnareRenderFactory()); RenderingRegistry.registerEntityRenderingHandler(EntitySentientArrow.class, new SentientArrowRenderFactory()); RenderingRegistry.registerEntityRenderingHandler(EntityBloodLight.class, new BloodLightRenderFactory()); @@ -90,18 +85,15 @@ public class ClientProxy extends CommonProxy } @Override - public void init() - { + public void init() { super.init(); Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) -> { - try - { + try { if (stack.hasTagCompound() && stack.getTagCompound().hasKey(Constants.NBT.COLOR)) if (tintIndex == 1) return Color.decode(stack.getTagCompound().getString(Constants.NBT.COLOR)).getRGB(); - } catch (NumberFormatException e) - { + } catch (NumberFormatException e) { return -1; } return -1; @@ -130,29 +122,24 @@ public class ClientProxy extends CommonProxy } @Override - public void postInit() - { + public void postInit() { Elements.registerElements(); } - private void addElytraLayer() - { + private void addElytraLayer() { RenderManager renderManager = Minecraft.getMinecraft().getRenderManager(); - try - { + try { Map skinMap = ObfuscationReflectionHelper.getPrivateValue(RenderManager.class, renderManager, "skinMap", "field_178636_l"); skinMap.get("default").addLayer(new LayerBloodElytra(skinMap.get("default"))); skinMap.get("slim").addLayer(new LayerBloodElytra(skinMap.get("slim"))); BMLog.DEBUG.info("Elytra layer added"); - } catch (Exception e) - { + } catch (Exception e) { BMLog.DEBUG.error("Failed to set custom Elytra Layer for Elytra Living Armour Upgrade: {}", e.getMessage()); } } @Override - public IAnimationStateMachine load(ResourceLocation location, ImmutableMap parameters) - { + public IAnimationStateMachine load(ResourceLocation location, ImmutableMap parameters) { return ModelLoaderRegistry.loadASM(location, parameters); } } diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java index 688c588a..6a748789 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java @@ -70,14 +70,12 @@ import WayofTime.bloodmagic.util.Utils; import com.google.common.base.Stopwatch; -public class ModRecipes -{ +public class ModRecipes { static ItemStack mundaneLengtheningStack = ComponentTypes.CATALYST_LENGTH_1.getStack(); static ItemStack mundanePowerStack = ComponentTypes.CATALYST_POWER_1.getStack(); - public static void init() - { + public static void init() { initOreDict(); addFurnaceRecipes(); addAltarRecipes(); @@ -88,8 +86,7 @@ public class ModRecipes addCompressionHandlers(); } - public static void initOreDict() - { + public static void initOreDict() { OreDictionary.registerOre("dustIron", ComponentTypes.SAND_IRON.getStack()); OreDictionary.registerOre("dustGold", ComponentTypes.SAND_GOLD.getStack()); OreDictionary.registerOre("dustCoal", ComponentTypes.SAND_COAL.getStack()); @@ -97,19 +94,16 @@ public class ModRecipes OreDictionary.registerOre("dustSaltpeter", ComponentTypes.SALTPETER.getStack()); } - public static void addFurnaceRecipes() - { + public static void addFurnaceRecipes() { FurnaceRecipes.instance().addSmeltingRecipe(ComponentTypes.SAND_IRON.getStack(), new ItemStack(Items.IRON_INGOT), (float) 0.15); FurnaceRecipes.instance().addSmeltingRecipe(ComponentTypes.SAND_GOLD.getStack(), new ItemStack(Items.GOLD_INGOT), (float) 0.15); } - public static void addAltarRecipes() - { + public static void addAltarRecipes() { } - public static void addAlchemyArrayRecipes() - { + public static void addAlchemyArrayRecipes() { AlchemyArrayRecipeRegistry.registerRecipe(ComponentTypes.REAGENT_BINDING.getStack(), new ItemStack(Items.DIAMOND_SWORD), new AlchemyArrayEffectBinding("boundSword", Utils.setUnbreakable(new ItemStack(RegistrarBloodMagicItems.BOUND_SWORD))), new BindingAlchemyCircleRenderer()); AlchemyArrayRecipeRegistry.registerRecipe(ComponentTypes.REAGENT_BINDING.getStack(), new ItemStack(Items.DIAMOND_AXE), new AlchemyArrayEffectBinding("boundAxe", Utils.setUnbreakable(new ItemStack(RegistrarBloodMagicItems.BOUND_AXE)))); AlchemyArrayRecipeRegistry.registerRecipe(ComponentTypes.REAGENT_BINDING.getStack(), new ItemStack(Items.DIAMOND_PICKAXE), new AlchemyArrayEffectBinding("boundPickaxe", Utils.setUnbreakable(new ItemStack(RegistrarBloodMagicItems.BOUND_PICKAXE)))); @@ -137,8 +131,7 @@ public class ModRecipes } - public static void addCompressionHandlers() - { + public static void addCompressionHandlers() { Stopwatch stopwatch = Stopwatch.createStarted(); StorageBlockCraftingManager.getInstance().addStorageBlockRecipes(); @@ -151,13 +144,11 @@ public class ModRecipes BMLog.DEBUG.info("Added compression recipes in {}", stopwatch); } - public static void addAlchemyTableRecipes() - { + public static void addAlchemyTableRecipes() { AlchemyTableRecipeRegistry.registerRecipe(new AlchemyTableDyeableRecipe(0, 100, 0, new ItemStack(RegistrarBloodMagicItems.SIGIL_HOLDING))); } - public static void addPotionRecipes() - { + public static void addPotionRecipes() { addPotionRecipe(1000, 1, new ItemStack(Items.GHAST_TEAR), new PotionEffect(MobEffects.REGENERATION, 450)); addPotionRecipe(1000, 1, new ItemStack(Items.GOLDEN_CARROT), new PotionEffect(MobEffects.NIGHT_VISION, 2 * 60 * 20)); addPotionRecipe(1000, 1, new ItemStack(Items.MAGMA_CREAM), new PotionEffect(MobEffects.FIRE_RESISTANCE, 2 * 60 * 20)); @@ -181,8 +172,7 @@ public class ModRecipes addPotionRecipe(1000, 1, new ItemStack(Items.BEETROOT), new PotionEffect(RegistrarBloodMagic.DEAFNESS, 450)); } - public static void addPotionRecipe(int lpDrained, int tier, ItemStack inputStack, PotionEffect baseEffect) - { + public static void addPotionRecipe(int lpDrained, int tier, ItemStack inputStack, PotionEffect baseEffect) { AlchemyTableRecipeRegistry.registerRecipe(new AlchemyTablePotionRecipe(lpDrained, 100, tier, inputStack, baseEffect)); List lengtheningList = new ArrayList<>(); @@ -196,8 +186,7 @@ public class ModRecipes AlchemyTableRecipeRegistry.registerRecipe(BMPotionUtils.getPowerAugmentRecipe(lpDrained, 100, tier, powerList, baseEffect, 1)); } - public static void addLivingArmourDowngradeRecipes() - { + public static void addLivingArmourDowngradeRecipes() { String messageBase = "ritual.bloodmagic.downgradeRitual.dialogue."; ItemStack bowStack = new ItemStack(Items.BOW); @@ -211,18 +200,16 @@ public class ModRecipes ItemStack stringStack = new ItemStack(Items.STRING); Map> dialogueMap = new HashMap<>(); - dialogueMap.put(bowStack, Pair.of("bow", new int[] { 1, 100, 300, 500 })); - dialogueMap.put(bottleStack, Pair.of("quenched", new int[] { 1, 100, 300, 500 })); - dialogueMap.put(swordStack, Pair.of("dulledBlade", new int[] { 1, 100, 300, 500, 700 })); - dialogueMap.put(goldenAppleStack, Pair.of("slowHeal", new int[] { 1, 100, 300, 500, 700 })); + dialogueMap.put(bowStack, Pair.of("bow", new int[]{1, 100, 300, 500})); + dialogueMap.put(bottleStack, Pair.of("quenched", new int[]{1, 100, 300, 500})); + dialogueMap.put(swordStack, Pair.of("dulledBlade", new int[]{1, 100, 300, 500, 700})); + dialogueMap.put(goldenAppleStack, Pair.of("slowHeal", new int[]{1, 100, 300, 500, 700})); - for (Entry> entry : dialogueMap.entrySet()) - { + for (Entry> entry : dialogueMap.entrySet()) { ItemStack keyStack = entry.getKey(); String str = entry.getValue().getKey(); Map> textMap = new HashMap<>(); - for (int tick : entry.getValue().getValue()) - { + for (int tick : entry.getValue().getValue()) { List textList = new ArrayList<>(); textList.add(new TextComponentTranslation("\u00A74%s", new TextComponentTranslation(messageBase + str + "." + tick))); textMap.put(tick, textList); @@ -240,8 +227,7 @@ public class ModRecipes LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeQuenched(0), bottleStack, Items.DRAGON_BREATH); LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeCrippledArm(0), shieldStack, "gemDiamond"); - for (int i = 0; i < 10; i++) - { + for (int i = 0; i < 10; i++) { addRecipeForTieredDowngrade(new LivingArmourUpgradeMeleeDecrease(i), swordStack, i); addRecipeForTieredDowngrade(new LivingArmourUpgradeSlowHeal(i), goldenAppleStack, i); addRecipeForTieredDowngrade(new LivingArmourUpgradeBattleHungry(i), fleshStack, i); @@ -251,39 +237,37 @@ public class ModRecipes } } - public static void addRecipeForTieredDowngrade(LivingArmourUpgrade upgrade, ItemStack stack, int tier) - { - switch (tier) - { - case 0: - LivingArmourDowngradeRecipeRegistry.registerRecipe(upgrade, stack, "ingotIron", new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 0)); - break; - case 1: - LivingArmourDowngradeRecipeRegistry.registerRecipe(upgrade, stack, "dustRedstone", "dustRedstone", "ingotIron", new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 0)); - break; - case 2: - LivingArmourDowngradeRecipeRegistry.registerRecipe(upgrade, stack, "ingotGold", "gemLapis", "gemLapis", new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 1)); - break; - case 3: - LivingArmourDowngradeRecipeRegistry.registerRecipe(upgrade, stack, Blocks.VINE, "dyeRed", Items.GOLDEN_CARROT, new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 1)); - break; - case 4: - LivingArmourDowngradeRecipeRegistry.registerRecipe(upgrade, stack, Items.GOLDEN_APPLE, "treeSapling", "treeSapling", new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 2)); - break; - case 5: - LivingArmourDowngradeRecipeRegistry.registerRecipe(upgrade, stack, Blocks.IRON_BLOCK, Blocks.REDSTONE_BLOCK, new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 2)); - break; - case 6: - LivingArmourDowngradeRecipeRegistry.registerRecipe(upgrade, stack, Blocks.IRON_BLOCK, Blocks.GLOWSTONE, "ingotGold", "ingotGold", new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 3)); - break; - case 7: - LivingArmourDowngradeRecipeRegistry.registerRecipe(upgrade, stack, Blocks.GOLD_BLOCK, Blocks.LAPIS_BLOCK, "gemDiamond", new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 3)); - break; - case 8: - LivingArmourDowngradeRecipeRegistry.registerRecipe(upgrade, stack, Items.DRAGON_BREATH, "gemDiamond", new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 4)); - break; - case 9: - LivingArmourDowngradeRecipeRegistry.registerRecipe(upgrade, stack, Items.NETHER_STAR, "gemDiamond", "gemDiamond", new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 4)); + public static void addRecipeForTieredDowngrade(LivingArmourUpgrade upgrade, ItemStack stack, int tier) { + switch (tier) { + case 0: + LivingArmourDowngradeRecipeRegistry.registerRecipe(upgrade, stack, "ingotIron", new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 0)); + break; + case 1: + LivingArmourDowngradeRecipeRegistry.registerRecipe(upgrade, stack, "dustRedstone", "dustRedstone", "ingotIron", new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 0)); + break; + case 2: + LivingArmourDowngradeRecipeRegistry.registerRecipe(upgrade, stack, "ingotGold", "gemLapis", "gemLapis", new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 1)); + break; + case 3: + LivingArmourDowngradeRecipeRegistry.registerRecipe(upgrade, stack, Blocks.VINE, "dyeRed", Items.GOLDEN_CARROT, new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 1)); + break; + case 4: + LivingArmourDowngradeRecipeRegistry.registerRecipe(upgrade, stack, Items.GOLDEN_APPLE, "treeSapling", "treeSapling", new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 2)); + break; + case 5: + LivingArmourDowngradeRecipeRegistry.registerRecipe(upgrade, stack, Blocks.IRON_BLOCK, Blocks.REDSTONE_BLOCK, new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 2)); + break; + case 6: + LivingArmourDowngradeRecipeRegistry.registerRecipe(upgrade, stack, Blocks.IRON_BLOCK, Blocks.GLOWSTONE, "ingotGold", "ingotGold", new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 3)); + break; + case 7: + LivingArmourDowngradeRecipeRegistry.registerRecipe(upgrade, stack, Blocks.GOLD_BLOCK, Blocks.LAPIS_BLOCK, "gemDiamond", new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 3)); + break; + case 8: + LivingArmourDowngradeRecipeRegistry.registerRecipe(upgrade, stack, Items.DRAGON_BREATH, "gemDiamond", new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 4)); + break; + case 9: + LivingArmourDowngradeRecipeRegistry.registerRecipe(upgrade, stack, Items.NETHER_STAR, "gemDiamond", "gemDiamond", new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 4)); } } } diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModRituals.java b/src/main/java/WayofTime/bloodmagic/registry/ModRituals.java index 8b1822e9..57f5d24a 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModRituals.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModRituals.java @@ -9,11 +9,9 @@ import WayofTime.bloodmagic.ritual.harvest.HarvestHandlerStem; import WayofTime.bloodmagic.ritual.harvest.HarvestHandlerTall; import net.minecraft.init.Blocks; -public class ModRituals -{ +public class ModRituals { // TODO Move elsewhere - public static void initHarvestHandlers() - { + public static void initHarvestHandlers() { HarvestRegistry.registerRangeAmplifier(Blocks.DIAMOND_BLOCK.getDefaultState(), 15); HarvestRegistry.registerRangeAmplifier(Blocks.GOLD_BLOCK.getDefaultState(), 10); HarvestRegistry.registerRangeAmplifier(Blocks.IRON_BLOCK.getDefaultState(), 6); @@ -23,8 +21,7 @@ public class ModRituals HarvestRegistry.registerHandler(new HarvestHandlerStem()); } - public static void initCuttingFluids() - { + public static void initCuttingFluids() { CrushingRegistry.registerCuttingFluid(new CrushingHandlerCuttingFluid(ItemCuttingFluid.FluidType.BASIC.getStack(), 250, 0.5)); CrushingRegistry.registerCuttingFluid(new CrushingHandlerCuttingFluid(ItemCuttingFluid.FluidType.EXPLOSIVE.getStack(), 25, 0.05)); } diff --git a/src/main/java/WayofTime/bloodmagic/ritual/crushing/ICrushingHandler.java b/src/main/java/WayofTime/bloodmagic/ritual/crushing/ICrushingHandler.java index fb99faf7..10d586cb 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/crushing/ICrushingHandler.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/crushing/ICrushingHandler.java @@ -9,6 +9,8 @@ import javax.annotation.Nonnull; public interface ICrushingHandler { @Nonnull ItemStack getRecipeOutput(ItemStack input, World world, BlockPos pos); + int getLpDrain(); + double getWillDrain(); } diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualAltarBuilder.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualAltarBuilder.java index 64242e37..9e3592b9 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualAltarBuilder.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualAltarBuilder.java @@ -160,7 +160,7 @@ public class RitualAltarBuilder extends Ritual { } /* - * + * * These methods are utilities for this ritual. They support both the old * forge inventory system, and the new one. */ diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCobblestone.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCobblestone.java index 34321638..f0617d47 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCobblestone.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCobblestone.java @@ -53,11 +53,11 @@ public class RitualCobblestone extends Ritual { alchemyArray.decrStackSize(0, 1); world.setBlockToAir(alchemyArray.getPos()); break; - /* - * case 4: block = Blocks.end_stone; - * alchemyArray.decrStackSize(0, 1); - * world.setBlockToAir(alchemyArray.getPos()); break; - */ + /* + * case 4: block = Blocks.end_stone; + * alchemyArray.decrStackSize(0, 1); + * world.setBlockToAir(alchemyArray.getPos()); break; + */ default: break; } diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCrushing.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCrushing.java index 271ddac4..4b6d7955 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCrushing.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCrushing.java @@ -120,18 +120,18 @@ public class RitualCrushing extends Ritual { ItemStack copyStack = checkStack.copy(); for (ICrushingHandler handler : CrushingRegistry.getCrushingHandlerList()) { - int lpDrain = handler.getLpDrain(); - double willDrain = handler.getWillDrain(); + int lpDrain = handler.getLpDrain(); + double willDrain = handler.getWillDrain(); - if (corrosiveWill < willDrain || currentEssence < lpDrain + getRefreshCost()) { - continue; - } + if (corrosiveWill < willDrain || currentEssence < lpDrain + getRefreshCost()) { + continue; + } - ItemStack result = handler.getRecipeOutput(copyStack, world, pos); + ItemStack result = handler.getRecipeOutput(copyStack, world, pos); - if (result.isEmpty()) { - continue; - } + if (result.isEmpty()) { + continue; + } if (tile != null) { result = Utils.insertStackIntoTile(result, tile, EnumFacing.DOWN); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCrystalSplit.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCrystalSplit.java index d5f666be..70b683f9 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCrystalSplit.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCrystalSplit.java @@ -17,21 +17,17 @@ import WayofTime.bloodmagic.soul.EnumDemonWillType; import WayofTime.bloodmagic.tile.TileDemonCrystal; @RitualRegister("crystal_split") -public class RitualCrystalSplit extends Ritual -{ - public RitualCrystalSplit() - { +public class RitualCrystalSplit extends Ritual { + public RitualCrystalSplit() { super("ritualCrystalSplit", 0, 20000, "ritual." + BloodMagic.MODID + ".crystalSplitRitual"); } @Override - public void performRitual(IMasterRitualStone masterRitualStone) - { + public void performRitual(IMasterRitualStone masterRitualStone) { World world = masterRitualStone.getWorldObj(); int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence(); - if (currentEssence < getRefreshCost()) - { + if (currentEssence < getRefreshCost()) { masterRitualStone.getOwnerNetwork().causeNausea(); return; } @@ -41,16 +37,14 @@ public class RitualCrystalSplit extends Ritual BlockPos rawPos = pos.up(2); TileEntity tile = world.getTileEntity(rawPos); - if (!(tile instanceof TileDemonCrystal) || ((TileDemonCrystal) tile).getType() != EnumDemonWillType.DEFAULT) - { + if (!(tile instanceof TileDemonCrystal) || ((TileDemonCrystal) tile).getType() != EnumDemonWillType.DEFAULT) { return; } IBlockState rawState = world.getBlockState(rawPos); TileDemonCrystal rawTile = (TileDemonCrystal) tile; - if (rawTile.crystalCount >= 5) - { + if (rawTile.crystalCount >= 5) { BlockPos vengefulPos = pos.offset(rotateFacing(EnumFacing.NORTH, direction)).up(); BlockPos corrosivePos = pos.offset(rotateFacing(EnumFacing.EAST, direction)).up(); BlockPos steadfastPos = pos.offset(rotateFacing(EnumFacing.SOUTH, direction)).up(); @@ -62,50 +56,38 @@ public class RitualCrystalSplit extends Ritual int destructiveCrystals = 0; tile = world.getTileEntity(vengefulPos); - if (tile instanceof TileDemonCrystal && ((TileDemonCrystal) tile).getType() == EnumDemonWillType.VENGEFUL && ((TileDemonCrystal) tile).crystalCount < 7) - { + if (tile instanceof TileDemonCrystal && ((TileDemonCrystal) tile).getType() == EnumDemonWillType.VENGEFUL && ((TileDemonCrystal) tile).crystalCount < 7) { vengefulCrystals = ((TileDemonCrystal) tile).crystalCount; - } else if (!(tile instanceof TileDemonCrystal) && world.isAirBlock(vengefulPos)) - { + } else if (!(tile instanceof TileDemonCrystal) && world.isAirBlock(vengefulPos)) { // #donothing, no point setting the crystal to 0 again - } else - { + } else { return; } tile = world.getTileEntity(corrosivePos); - if (tile instanceof TileDemonCrystal && ((TileDemonCrystal) tile).getType() == EnumDemonWillType.CORROSIVE && ((TileDemonCrystal) tile).crystalCount < 7) - { + if (tile instanceof TileDemonCrystal && ((TileDemonCrystal) tile).getType() == EnumDemonWillType.CORROSIVE && ((TileDemonCrystal) tile).crystalCount < 7) { corrosiveCrystals = ((TileDemonCrystal) tile).crystalCount; - } else if (!(tile instanceof TileDemonCrystal) && world.isAirBlock(corrosivePos)) - { + } else if (!(tile instanceof TileDemonCrystal) && world.isAirBlock(corrosivePos)) { - } else - { + } else { return; } tile = world.getTileEntity(steadfastPos); - if (tile instanceof TileDemonCrystal && ((TileDemonCrystal) tile).getType() == EnumDemonWillType.STEADFAST && ((TileDemonCrystal) tile).crystalCount < 7) - { + if (tile instanceof TileDemonCrystal && ((TileDemonCrystal) tile).getType() == EnumDemonWillType.STEADFAST && ((TileDemonCrystal) tile).crystalCount < 7) { steadfastCrystals = ((TileDemonCrystal) tile).crystalCount; - } else if (!(tile instanceof TileDemonCrystal) && world.isAirBlock(steadfastPos)) - { + } else if (!(tile instanceof TileDemonCrystal) && world.isAirBlock(steadfastPos)) { - } else - { + } else { return; } tile = world.getTileEntity(destructivePos); - if (tile instanceof TileDemonCrystal && ((TileDemonCrystal) tile).getType() == EnumDemonWillType.DESTRUCTIVE && ((TileDemonCrystal) tile).crystalCount < 7) - { + if (tile instanceof TileDemonCrystal && ((TileDemonCrystal) tile).getType() == EnumDemonWillType.DESTRUCTIVE && ((TileDemonCrystal) tile).crystalCount < 7) { destructiveCrystals = ((TileDemonCrystal) tile).crystalCount; - } else if (!(tile instanceof TileDemonCrystal) && world.isAirBlock(destructivePos)) - { + } else if (!(tile instanceof TileDemonCrystal) && world.isAirBlock(destructivePos)) { - } else - { + } else { return; } @@ -120,29 +102,24 @@ public class RitualCrystalSplit extends Ritual } } - public EnumFacing rotateFacing(EnumFacing facing, EnumFacing rotation) - { - switch (rotation) - { - case EAST: - return facing.rotateY(); - case SOUTH: - return facing.rotateY().rotateY(); - case WEST: - return facing.rotateYCCW(); - case NORTH: - default: - return facing; + public EnumFacing rotateFacing(EnumFacing facing, EnumFacing rotation) { + switch (rotation) { + case EAST: + return facing.rotateY(); + case SOUTH: + return facing.rotateY().rotateY(); + case WEST: + return facing.rotateYCCW(); + case NORTH: + default: + return facing; } } - public void growCrystal(World world, BlockPos pos, EnumDemonWillType type, int currentCrystalCount) - { - if (currentCrystalCount <= 0) - { + public void growCrystal(World world, BlockPos pos, EnumDemonWillType type, int currentCrystalCount) { + if (currentCrystalCount <= 0) { world.setBlockState(pos, RegistrarBloodMagicBlocks.DEMON_CRYSTAL.getStateFromMeta(type.ordinal()), 3); - } else - { + } else { TileDemonCrystal tile = (TileDemonCrystal) world.getTileEntity(pos); tile.crystalCount++; tile.markDirty(); @@ -152,20 +129,17 @@ public class RitualCrystalSplit extends Ritual } @Override - public int getRefreshTime() - { + public int getRefreshTime() { return 20; } @Override - public int getRefreshCost() - { + public int getRefreshCost() { return 1000; } @Override - public void gatherComponents(Consumer components) - { + public void gatherComponents(Consumer components) { addRune(components, 0, 0, -1, EnumRuneType.FIRE); addRune(components, 1, 0, 0, EnumRuneType.EARTH); addRune(components, 0, 0, 1, EnumRuneType.WATER); @@ -177,14 +151,12 @@ public class RitualCrystalSplit extends Ritual } @Override - public Ritual getNewCopy() - { + public Ritual getNewCopy() { return new RitualCrystalSplit(); } @Override - public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player) - { - return new ITextComponent[] { new TextComponentTranslation(this.getTranslationKey() + ".info") }; + public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player) { + return new ITextComponent[]{new TextComponentTranslation(this.getTranslationKey() + ".info")}; } } diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualEllipsoid.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualEllipsoid.java index ad04ccfd..cece930d 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualEllipsoid.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualEllipsoid.java @@ -17,16 +17,14 @@ import net.minecraftforge.items.IItemHandler; import java.util.function.Consumer; @RitualRegister("ellipsoid") -public class RitualEllipsoid extends Ritual -{ +public class RitualEllipsoid extends Ritual { public static final String SPHEROID_RANGE = "spheroidRange"; public static final String CHEST_RANGE = "chest"; private boolean cached = false; private BlockPos currentPos; //Offset - public RitualEllipsoid() - { + public RitualEllipsoid() { super("ritualEllipsoid", 0, 20000, "ritual." + BloodMagic.MODID + ".ellipseRitual"); addBlockRange(SPHEROID_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-10, -10, -10), new BlockPos(11, 11, 11))); addBlockRange(CHEST_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1)); @@ -36,8 +34,7 @@ public class RitualEllipsoid extends Ritual } @Override - public void performRitual(IMasterRitualStone masterRitualStone) - { + public void performRitual(IMasterRitualStone masterRitualStone) { World world = masterRitualStone.getWorldObj(); int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence(); @@ -45,8 +42,7 @@ public class RitualEllipsoid extends Ritual AreaDescriptor chestRange = masterRitualStone.getBlockRange(CHEST_RANGE); TileEntity tileInventory = world.getTileEntity(chestRange.getContainedPositions(masterPos).get(0)); - if (currentEssence < getRefreshCost()) - { + if (currentEssence < getRefreshCost()) { masterRitualStone.getOwnerNetwork().causeNausea(); return; } @@ -60,20 +56,16 @@ public class RitualEllipsoid extends Ritual int minZ = (int) (masterPos.getZ() - sphereBB.minZ); int maxZ = (int) (sphereBB.maxZ - masterPos.getZ()) - 1; - if (tileInventory != null) - { - if (tileInventory.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN)) - { + if (tileInventory != null) { + if (tileInventory.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN)) { IItemHandler itemHandler = tileInventory.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN); - if (itemHandler.getSlots() <= 0) - { + if (itemHandler.getSlots() <= 0) { return; } int blockSlot = -1; - for (int invSlot = 0; invSlot < itemHandler.getSlots(); invSlot++) - { + for (int invSlot = 0; invSlot < itemHandler.getSlots(); invSlot++) { ItemStack stack = itemHandler.extractItem(invSlot, 1, true); if (stack.isEmpty() || !(stack.getItem() instanceof ItemBlock)) continue; @@ -82,8 +74,7 @@ public class RitualEllipsoid extends Ritual break; } - if (blockSlot == -1) - { + if (blockSlot == -1) { return; } @@ -95,8 +86,7 @@ public class RitualEllipsoid extends Ritual int i = -minY; int k = -minZ; - if (currentPos != null) - { + if (currentPos != null) { j = currentPos.getY(); i = Math.min(xR, Math.max(-minX, currentPos.getX())); k = Math.min(zR, Math.max(-minZ, currentPos.getZ())); @@ -104,25 +94,19 @@ public class RitualEllipsoid extends Ritual int checks = 0; int maxChecks = 100; - while (j <= maxY) - { - while (i <= maxX) - { - while (k <= maxZ) - { + while (j <= maxY) { + while (i <= maxX) { + while (k <= maxZ) { checks++; - if (checks >= maxChecks) - { + if (checks >= maxChecks) { this.currentPos = new BlockPos(i, j, k); return; } - if (checkIfEllipsoidShell(xR, yR, zR, i, j, k)) - { + if (checkIfEllipsoidShell(xR, yR, zR, i, j, k)) { BlockPos newPos = masterPos.add(i, j, k); // - if (!world.getBlockState(newPos).getBlock().isReplaceable(world, newPos)) - { + if (!world.getBlockState(newPos).getBlock().isReplaceable(world, newPos)) { k++; continue; } @@ -156,11 +140,9 @@ public class RitualEllipsoid extends Ritual } } - public boolean checkIfEllipsoidShell(int xR, int yR, int zR, int xOff, int yOff, int zOff) - { + public boolean checkIfEllipsoidShell(int xR, int yR, int zR, int xOff, int yOff, int zOff) { //Checking shell in the x-direction - if (!checkIfEllipsoid(xR, yR, zR, xOff, yOff, zOff)) - { + if (!checkIfEllipsoid(xR, yR, zR, xOff, yOff, zOff)) { return false; } @@ -186,21 +168,18 @@ public class RitualEllipsoid extends Ritual // return false; } - public boolean checkIfEllipsoid(float xR, float yR, float zR, float xOff, float yOff, float zOff) - { + public boolean checkIfEllipsoid(float xR, float yR, float zR, float xOff, float yOff, float zOff) { float possOffset = 0.5f; return xOff * xOff / ((xR + possOffset) * (xR + possOffset)) + yOff * yOff / ((yR + possOffset) * (yR + possOffset)) + zOff * zOff / ((zR + possOffset) * (zR + possOffset)) <= 1; } @Override - public int getRefreshCost() - { + public int getRefreshCost() { return 5; } @Override - public int getRefreshTime() - { + public int getRefreshTime() { return 1; } @@ -212,8 +191,7 @@ public class RitualEllipsoid extends Ritual // } @Override - public void gatherComponents(Consumer components) - { + public void gatherComponents(Consumer components) { addCornerRunes(components, 1, 0, EnumRuneType.DUSK); addRune(components, 4, 0, 0, EnumRuneType.FIRE); @@ -254,8 +232,7 @@ public class RitualEllipsoid extends Ritual } @Override - public Ritual getNewCopy() - { + public Ritual getNewCopy() { return new RitualEllipsoid(); } } diff --git a/src/main/java/WayofTime/bloodmagic/routing/RoutingFluidFilter.java b/src/main/java/WayofTime/bloodmagic/routing/RoutingFluidFilter.java index 6ff9f8d9..9f4b47a7 100644 --- a/src/main/java/WayofTime/bloodmagic/routing/RoutingFluidFilter.java +++ b/src/main/java/WayofTime/bloodmagic/routing/RoutingFluidFilter.java @@ -15,54 +15,42 @@ import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; -public class RoutingFluidFilter implements IFluidFilter -{ +public class RoutingFluidFilter implements IFluidFilter { protected List requestList; protected TileEntity accessedTile; protected IFluidHandler fluidHandler; @Override - public void initializeFilter(List filteredList, TileEntity tile, IFluidHandler fluidHandler, boolean isFilterOutput) - { + public void initializeFilter(List filteredList, TileEntity tile, IFluidHandler fluidHandler, boolean isFilterOutput) { this.accessedTile = tile; this.fluidHandler = fluidHandler; - if (isFilterOutput) - { + if (isFilterOutput) { //The requestList contains a list of how much can be extracted. requestList = new ArrayList<>(); - for (ItemStack filterStack : filteredList) - { + for (ItemStack filterStack : filteredList) { FluidStack fluidFilterStack = getFluidStackFromItemStack(filterStack); - if (fluidFilterStack != null) - { + if (fluidFilterStack != null) { requestList.add(fluidFilterStack); } } IFluidTankProperties[] properties = fluidHandler.getTankProperties(); - for (IFluidTankProperties property : properties) - { + for (IFluidTankProperties property : properties) { FluidStack containedStack = property.getContents(); - if (containedStack != null) - { - for (FluidStack fluidFilterStack : requestList) - { - if (doStacksMatch(fluidFilterStack, containedStack)) - { + if (containedStack != null) { + for (FluidStack fluidFilterStack : requestList) { + if (doStacksMatch(fluidFilterStack, containedStack)) { fluidFilterStack.amount = Math.max(fluidFilterStack.amount - containedStack.amount, 0); } } } } - } else - { + } else { requestList = new ArrayList<>(); - for (ItemStack filterStack : filteredList) - { + for (ItemStack filterStack : filteredList) { FluidStack fluidFilterStack = getFluidStackFromItemStack(filterStack); - if (fluidFilterStack != null) - { + if (fluidFilterStack != null) { fluidFilterStack.amount *= -1; requestList.add(fluidFilterStack); } @@ -70,15 +58,11 @@ public class RoutingFluidFilter implements IFluidFilter IFluidTankProperties[] properties = fluidHandler.getTankProperties(); - for (IFluidTankProperties property : properties) - { + for (IFluidTankProperties property : properties) { FluidStack containedStack = property.getContents(); - if (containedStack != null) - { - for (FluidStack fluidFilterStack : requestList) - { - if (doStacksMatch(fluidFilterStack, containedStack)) - { + if (containedStack != null) { + for (FluidStack fluidFilterStack : requestList) { + if (doStacksMatch(fluidFilterStack, containedStack)) { fluidFilterStack.amount += containedStack.amount; } } @@ -91,20 +75,16 @@ public class RoutingFluidFilter implements IFluidFilter * Gives the remainder~ */ @Override - public FluidStack transferStackThroughOutputFilter(FluidStack fluidStack) - { + public FluidStack transferStackThroughOutputFilter(FluidStack fluidStack) { int allowedAmount = 0; - for (FluidStack filterStack : requestList) - { - if (doStacksMatch(filterStack, fluidStack)) - { + for (FluidStack filterStack : requestList) { + if (doStacksMatch(filterStack, fluidStack)) { allowedAmount = Math.min(filterStack.amount, fluidStack.amount); break; } } - if (allowedAmount <= 0) - { + if (allowedAmount <= 0) { return fluidStack; } @@ -113,14 +93,11 @@ public class RoutingFluidFilter implements IFluidFilter copyStack.amount = fluidStack.amount - filledAmount; Iterator itr = requestList.iterator(); - while (itr.hasNext()) - { + while (itr.hasNext()) { FluidStack filterStack = itr.next(); - if (doStacksMatch(filterStack, copyStack)) - { + if (doStacksMatch(filterStack, copyStack)) { filterStack.amount -= filledAmount; - if (filterStack.amount <= 0) - { + if (filterStack.amount <= 0) { itr.remove(); } } @@ -134,13 +111,10 @@ public class RoutingFluidFilter implements IFluidFilter } @Override - public int transferThroughInputFilter(IFluidFilter outputFilter, int maxTransfer) - { - for (FluidStack filterFluidStack : requestList) - { + public int transferThroughInputFilter(IFluidFilter outputFilter, int maxTransfer) { + for (FluidStack filterFluidStack : requestList) { int allowedAmount = Math.min(filterFluidStack.amount, maxTransfer); - if (allowedAmount <= 0) - { + if (allowedAmount <= 0) { continue; } @@ -152,8 +126,7 @@ public class RoutingFluidFilter implements IFluidFilter FluidStack remainderStack = outputFilter.transferStackThroughOutputFilter(drainStack); int drained = remainderStack == null ? copyStack.amount : (copyStack.amount - remainderStack.amount); - if (drained > 0) - { + if (drained > 0) { drainStack.amount = drained; fluidHandler.drain(drainStack, true); @@ -161,14 +134,11 @@ public class RoutingFluidFilter implements IFluidFilter } Iterator itr = requestList.iterator(); - while (itr.hasNext()) - { + while (itr.hasNext()) { FluidStack filterStack = itr.next(); - if (doStacksMatch(filterStack, copyStack)) - { + if (doStacksMatch(filterStack, copyStack)) { filterStack.amount -= drained; - if (filterStack.amount <= 0) - { + if (filterStack.amount <= 0) { itr.remove(); } } @@ -186,12 +156,9 @@ public class RoutingFluidFilter implements IFluidFilter } @Override - public boolean doesStackMatchFilter(FluidStack testStack) - { - for (FluidStack filterStack : requestList) - { - if (doStacksMatch(filterStack, testStack)) - { + public boolean doesStackMatchFilter(FluidStack testStack) { + for (FluidStack filterStack : requestList) { + if (doStacksMatch(filterStack, testStack)) { return true; } } @@ -200,17 +167,14 @@ public class RoutingFluidFilter implements IFluidFilter } @Override - public boolean doStacksMatch(FluidStack filterStack, FluidStack testStack) - { + public boolean doStacksMatch(FluidStack filterStack, FluidStack testStack) { return testStack != null && filterStack.getFluid() == testStack.getFluid(); } @Nullable - public static FluidStack getFluidStackFromItemStack(ItemStack inputStack) - { + public static FluidStack getFluidStackFromItemStack(ItemStack inputStack) { boolean isEmpty = false; - if (inputStack.getCount() == 0) - { + if (inputStack.getCount() == 0) { isEmpty = true; inputStack.setCount(1); } diff --git a/src/main/java/WayofTime/bloodmagic/soul/ISoulBreathContainer.java b/src/main/java/WayofTime/bloodmagic/soul/ISoulBreathContainer.java index f8b9b137..da0f4d07 100644 --- a/src/main/java/WayofTime/bloodmagic/soul/ISoulBreathContainer.java +++ b/src/main/java/WayofTime/bloodmagic/soul/ISoulBreathContainer.java @@ -2,8 +2,7 @@ package WayofTime.bloodmagic.soul; import net.minecraft.item.ItemStack; -public interface ISoulBreathContainer -{ +public interface ISoulBreathContainer { double getBreath(ItemStack stack); void setBreath(ItemStack stack, double amount); diff --git a/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyArray.java b/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyArray.java index 828f2891..4173ca2c 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyArray.java +++ b/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyArray.java @@ -17,8 +17,7 @@ import net.minecraft.util.math.AxisAlignedBB; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public class TileAlchemyArray extends TileInventory implements ITickable, IAlchemyArray -{ +public class TileAlchemyArray extends TileInventory implements ITickable, IAlchemyArray { public boolean isActive = false; public int activeCounter = 0; public EnumFacing rotation = EnumFacing.HORIZONTALS[0]; @@ -28,22 +27,18 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche public AlchemyArrayEffect arrayEffect; private boolean doDropIngredients = true; - public TileAlchemyArray() - { + public TileAlchemyArray() { super(2, "alchemyArray"); } - public void onEntityCollidedWithBlock(IBlockState state, Entity entity) - { - if (arrayEffect != null) - { + public void onEntityCollidedWithBlock(IBlockState state, Entity entity) { + if (arrayEffect != null) { arrayEffect.onEntityCollidedWithBlock(this, getWorld(), pos, state, entity); } } @Override - public void deserialize(NBTTagCompound tagCompound) - { + public void deserialize(NBTTagCompound tagCompound) { super.deserialize(tagCompound); this.isActive = tagCompound.getBoolean("isActive"); this.activeCounter = tagCompound.getInteger("activeCounter"); @@ -51,23 +46,20 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche if (!tagCompound.hasKey("doDropIngredients")) //Check if the array is old { this.doDropIngredients = true; - } else - { + } else { this.doDropIngredients = tagCompound.getBoolean("doDropIngredients"); } this.rotation = EnumFacing.HORIZONTALS[tagCompound.getInteger(Constants.NBT.DIRECTION)]; NBTTagCompound arrayTag = tagCompound.getCompoundTag("arrayTag"); arrayEffect = AlchemyArrayRecipeRegistry.getAlchemyArrayEffect(key); - if (arrayEffect != null) - { + if (arrayEffect != null) { arrayEffect.readFromNBT(arrayTag); } } @Override - public NBTTagCompound serialize(NBTTagCompound tagCompound) - { + public NBTTagCompound serialize(NBTTagCompound tagCompound) { super.serialize(tagCompound); tagCompound.setBoolean("isActive", isActive); tagCompound.setInteger("activeCounter", activeCounter); @@ -76,8 +68,7 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche tagCompound.setInteger(Constants.NBT.DIRECTION, rotation.getHorizontalIndex()); NBTTagCompound arrayTag = new NBTTagCompound(); - if (arrayEffect != null) - { + if (arrayEffect != null) { arrayEffect.writeToNBT(arrayTag); } tagCompound.setTag("arrayTag", arrayTag); @@ -86,25 +77,20 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche } @Override - public int getInventoryStackLimit() - { + public int getInventoryStackLimit() { return 1; } //Use this to prevent the Array from dropping items - useful for arrays that need to "consume" ingredients well before the effect. - public void setItemDrop(boolean dropItems) - { + public void setItemDrop(boolean dropItems) { this.doDropIngredients = dropItems; } @Override - public void update() - { - if (isActive && attemptCraft()) - { + public void update() { + if (isActive && attemptCraft()) { activeCounter++; - } else - { + } else { isActive = false; doDropIngredients = true; activeCounter = 0; @@ -119,61 +105,48 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche * This occurs when the block is destroyed. */ @Override - public void dropItems() - { - if (arrayEffect == null || doDropIngredients) - { + public void dropItems() { + if (arrayEffect == null || doDropIngredients) { super.dropItems(); } } - public boolean attemptCraft() - { + public boolean attemptCraft() { AlchemyArrayEffect effect = AlchemyArrayRecipeRegistry.getAlchemyArrayEffect(this.getStackInSlot(0), this.getStackInSlot(1)); - if (effect != null) - { - if (arrayEffect == null) - { + if (effect != null) { + if (arrayEffect == null) { arrayEffect = effect; key = effect.getKey(); - } else - { + } else { String effectKey = effect.getKey(); - if (effectKey.equals(key)) - { + if (effectKey.equals(key)) { //Good! Moving on. - } else - { + } else { //Something has changed, therefore we have to move our stuffs. //TODO: Add an AlchemyArrayEffect.onBreak(); ? arrayEffect = effect; key = effect.getKey(); } } - } else - { + } else { RecipeAlchemyArray recipe = BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAlchemyArray(getStackInSlot(0), getStackInSlot(1)); if (recipe == null) return false; AlchemyArrayEffect newEffect = new AlchemyArrayEffectCraftingNew(recipe); - if (arrayEffect == null) - { + if (arrayEffect == null) { arrayEffect = newEffect; key = newEffect.key; - } else if (!newEffect.key.equals(key)) - { + } else if (!newEffect.key.equals(key)) { arrayEffect = newEffect; key = newEffect.key; } } - if (arrayEffect != null) - { + if (arrayEffect != null) { isActive = true; - if (arrayEffect.update(this, this.activeCounter)) - { + if (arrayEffect.update(this, this.activeCounter)) { this.decrStackSize(0, 1); this.decrStackSize(1, 1); this.getWorld().setBlockToAir(getPos()); @@ -186,20 +159,17 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche } @Override - public EnumFacing getRotation() - { + public EnumFacing getRotation() { return rotation; } - public void setRotation(EnumFacing rotation) - { + public void setRotation(EnumFacing rotation) { this.rotation = rotation; } @Override @SideOnly(Side.CLIENT) - public AxisAlignedBB getRenderBoundingBox() - { + public AxisAlignedBB getRenderBoundingBox() { return Block.FULL_BLOCK_AABB.offset(getPos()); } } diff --git a/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyTable.java b/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyTable.java index 57d7d8e1..ac701257 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyTable.java +++ b/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyTable.java @@ -29,8 +29,7 @@ import org.apache.commons.lang3.ArrayUtils; import java.util.ArrayList; import java.util.List; -public class TileAlchemyTable extends TileInventory implements ISidedInventory, ITickable -{ +public class TileAlchemyTable extends TileInventory implements ISidedInventory, ITickable { public static final int orbSlot = 6; public static final int toolSlot = 7; public static final int outputSlot = 8; @@ -41,43 +40,36 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory, public int ticksRequired = 1; public BlockPos connectedPos = BlockPos.ORIGIN; - public boolean[] blockedSlots = new boolean[] { false, false, false, false, false, false }; + public boolean[] blockedSlots = new boolean[]{false, false, false, false, false, false}; - public TileAlchemyTable() - { + public TileAlchemyTable() { super(9, "alchemyTable"); } - public void setInitialTableParameters(EnumFacing direction, boolean isSlave, BlockPos connectedPos) - { + public void setInitialTableParameters(EnumFacing direction, boolean isSlave, BlockPos connectedPos) { this.isSlave = isSlave; this.connectedPos = connectedPos; - if (!isSlave) - { + if (!isSlave) { this.direction = direction; } } - public boolean isInvisible() - { + public boolean isInvisible() { return isSlave(); } - public boolean isInputSlotAccessible(int slot) - { + public boolean isInputSlotAccessible(int slot) { return !(slot < 6 && slot >= 0) || !blockedSlots[slot]; } - public void toggleInputSlotAccessible(int slot) - { + public void toggleInputSlotAccessible(int slot) { if (slot < 6 && slot >= 0) blockedSlots[slot] = !blockedSlots[slot]; } @Override - public void deserialize(NBTTagCompound tag) - { + public void deserialize(NBTTagCompound tag) { super.deserialize(tag); isSlave = tag.getBoolean("isSlave"); @@ -93,8 +85,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory, } @Override - public NBTTagCompound serialize(NBTTagCompound tag) - { + public NBTTagCompound serialize(NBTTagCompound tag) { super.serialize(tag); tag.setBoolean("isSlave", isSlave); @@ -116,19 +107,14 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory, @SuppressWarnings("unchecked") @Override - public T getCapability(Capability capability, EnumFacing facing) - { - if (facing != null && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) - { - if (this.isSlave()) - { + public T getCapability(Capability capability, EnumFacing facing) { + if (facing != null && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { + if (this.isSlave()) { TileEntity tile = getWorld().getTileEntity(connectedPos); - if (tile instanceof TileAlchemyTable && !((TileAlchemyTable) tile).isSlave) - { + if (tile instanceof TileAlchemyTable && !((TileAlchemyTable) tile).isSlave) { return (T) tile.getCapability(capability, facing); } - } else - { + } else { return super.getCapability(capability, facing); } } @@ -137,89 +123,70 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory, } @Override - public int[] getSlotsForFace(EnumFacing side) - { - switch (side) - { - case DOWN: - return new int[] { outputSlot }; - case UP: - return new int[] { orbSlot, toolSlot }; - default: - return new int[] { 0, 1, 2, 3, 4, 5 }; + public int[] getSlotsForFace(EnumFacing side) { + switch (side) { + case DOWN: + return new int[]{outputSlot}; + case UP: + return new int[]{orbSlot, toolSlot}; + default: + return new int[]{0, 1, 2, 3, 4, 5}; } } @Override - public boolean canInsertItem(int index, ItemStack stack, EnumFacing direction) - { - switch (direction) - { - case DOWN: - return index != outputSlot && index != orbSlot && index != toolSlot; - case UP: - if (index == orbSlot && !stack.isEmpty() && stack.getItem() instanceof IBloodOrb) - { - return true; - } else if (index == toolSlot) - { - return false; //TODO: - } else - { - return true; - } - default: - if (this.isSlave) - { - TileEntity tile = getWorld().getTileEntity(connectedPos); - if (tile instanceof TileAlchemyTable && !((TileAlchemyTable) tile).isSlave) - { - return ((TileAlchemyTable) tile).canInsertItem(index, stack, direction); + public boolean canInsertItem(int index, ItemStack stack, EnumFacing direction) { + switch (direction) { + case DOWN: + return index != outputSlot && index != orbSlot && index != toolSlot; + case UP: + if (index == orbSlot && !stack.isEmpty() && stack.getItem() instanceof IBloodOrb) { + return true; + } else if (index == toolSlot) { + return false; //TODO: + } else { + return true; } - } - return getAccessibleInputSlots(direction).contains(index); + default: + if (this.isSlave) { + TileEntity tile = getWorld().getTileEntity(connectedPos); + if (tile instanceof TileAlchemyTable && !((TileAlchemyTable) tile).isSlave) { + return ((TileAlchemyTable) tile).canInsertItem(index, stack, direction); + } + } + return getAccessibleInputSlots(direction).contains(index); } } @Override - public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) - { - switch (direction) - { - case DOWN: - return index == outputSlot; - case UP: - if (index == orbSlot && !stack.isEmpty() && stack.getItem() instanceof IBloodOrb) - { - return true; - } else if (index == toolSlot) - { - return true; //TODO: - } else - { - return true; - } - default: - if (this.isSlave) - { - TileEntity tile = getWorld().getTileEntity(connectedPos); - if (tile instanceof TileAlchemyTable && !((TileAlchemyTable) tile).isSlave) - { - return ((TileAlchemyTable) tile).canExtractItem(index, stack, direction); + public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) { + switch (direction) { + case DOWN: + return index == outputSlot; + case UP: + if (index == orbSlot && !stack.isEmpty() && stack.getItem() instanceof IBloodOrb) { + return true; + } else if (index == toolSlot) { + return true; //TODO: + } else { + return true; } - } - return getAccessibleInputSlots(direction).contains(index); + default: + if (this.isSlave) { + TileEntity tile = getWorld().getTileEntity(connectedPos); + if (tile instanceof TileAlchemyTable && !((TileAlchemyTable) tile).isSlave) { + return ((TileAlchemyTable) tile).canExtractItem(index, stack, direction); + } + } + return getAccessibleInputSlots(direction).contains(index); } } - public List getAccessibleInputSlots(EnumFacing direction) - { + public List getAccessibleInputSlots(EnumFacing direction) { List list = new ArrayList<>(); - for (int i = 0; i < 6; i++) - { - if (isInputSlotAccessible(i)) - { + for (int i = 0; i < 6; i++) { + if (isInputSlotAccessible(i)) { list.add(i); } } @@ -228,19 +195,15 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory, } @Override - public void update() - { - if (isSlave()) - { + public void update() { + if (isSlave()) { return; } List inputList = new ArrayList<>(); - for (int i = 0; i < 6; i++) - { - if (!getStackInSlot(i).isEmpty()) - { + for (int i = 0; i < 6; i++) { + if (!getStackInSlot(i).isEmpty()) { inputList.add(getStackInSlot(i)); } } @@ -249,31 +212,24 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory, // special recipes like dying AlchemyTableRecipe recipe = AlchemyTableRecipeRegistry.getMatchingRecipe(inputList, getWorld(), getPos()); - if (recipe != null && (burnTime > 0 || (!getWorld().isRemote && tier >= recipe.getTierRequired() && this.getContainedLp() >= recipe.getLpDrained()))) - { + if (recipe != null && (burnTime > 0 || (!getWorld().isRemote && tier >= recipe.getTierRequired() && this.getContainedLp() >= recipe.getLpDrained()))) { if (burnTime == 1) notifyUpdate(); - if (canCraft(recipe.getRecipeOutput(inputList))) - { + if (canCraft(recipe.getRecipeOutput(inputList))) { ticksRequired = recipe.getTicksRequired(); burnTime++; - if (burnTime == ticksRequired) - { - if (!getWorld().isRemote) - { + if (burnTime == ticksRequired) { + if (!getWorld().isRemote) { int requiredLp = recipe.getLpDrained(); - if (requiredLp > 0) - { - if (!getWorld().isRemote) - { + if (requiredLp > 0) { + if (!getWorld().isRemote) { consumeLp(requiredLp); } } - if (!getWorld().isRemote) - { + if (!getWorld().isRemote) { craftItem(inputList, recipe); } } @@ -282,34 +238,25 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory, IBlockState state = getWorld().getBlockState(pos); getWorld().notifyBlockUpdate(getPos(), state, state, 3); - } else if (burnTime > ticksRequired + 10) - { + } else if (burnTime > ticksRequired + 10) { burnTime = 0; } - } else - { + } else { burnTime = 0; } - } else - { // Simple recipes + } else { // Simple recipes RecipeAlchemyTable recipeAlchemyTable = BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAlchemyTable(inputList); - if (recipeAlchemyTable != null && (burnTime > 0 || (!getWorld().isRemote && tier >= recipeAlchemyTable.getMinimumTier() && getContainedLp() >= recipeAlchemyTable.getSyphon()))) - { + if (recipeAlchemyTable != null && (burnTime > 0 || (!getWorld().isRemote && tier >= recipeAlchemyTable.getMinimumTier() && getContainedLp() >= recipeAlchemyTable.getSyphon()))) { if (burnTime == 1) notifyUpdate(); - if (canCraft(recipeAlchemyTable.getOutput())) - { + if (canCraft(recipeAlchemyTable.getOutput())) { ticksRequired = recipeAlchemyTable.getTicks(); burnTime++; - if (burnTime >= ticksRequired) - { - if (!getWorld().isRemote) - { - if (recipeAlchemyTable.getSyphon() > 0) - { - if (consumeLp(recipeAlchemyTable.getSyphon()) < recipeAlchemyTable.getSyphon()) - { + if (burnTime >= ticksRequired) { + if (!getWorld().isRemote) { + if (recipeAlchemyTable.getSyphon() > 0) { + if (consumeLp(recipeAlchemyTable.getSyphon()) < recipeAlchemyTable.getSyphon()) { //There was not enough LP to craft or there was no orb burnTime = 0; notifyUpdate(); @@ -330,8 +277,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory, else outputSlotStack.grow(event.getOutput().getCount()); - for (int i = 0; i < 6; i++) - { + for (int i = 0; i < 6; i++) { ItemStack currentStack = getStackInSlot(i); if (currentStack.getItem().hasContainerItem(currentStack)) setInventorySlotContents(i, currentStack.getItem().getContainerItem(currentStack)); @@ -346,20 +292,17 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory, } } } - } else - { + } else { burnTime = 0; } } } - public double getProgressForGui() - { + public double getProgressForGui() { return ((double) burnTime) / ticksRequired; } - private boolean canCraft(ItemStack output) - { + private boolean canCraft(ItemStack output) { ItemStack currentOutputStack = getStackInSlot(outputSlot); if (output.isEmpty()) return false; @@ -371,13 +314,10 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory, return result <= getInventoryStackLimit() && result <= currentOutputStack.getMaxStackSize(); } - public int getTierOfOrb() - { + public int getTierOfOrb() { ItemStack orbStack = getStackInSlot(orbSlot); - if (!orbStack.isEmpty()) - { - if (orbStack.getItem() instanceof IBloodOrb) - { + if (!orbStack.isEmpty()) { + if (orbStack.getItem() instanceof IBloodOrb) { BloodOrb orb = ((IBloodOrb) orbStack.getItem()).getOrb(orbStack); return orb == null ? 0 : orb.getTier(); } @@ -386,16 +326,12 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory, return 0; } - public int getContainedLp() - { + public int getContainedLp() { ItemStack orbStack = getStackInSlot(orbSlot); - if (!orbStack.isEmpty()) - { - if (orbStack.getItem() instanceof IBloodOrb) - { + if (!orbStack.isEmpty()) { + if (orbStack.getItem() instanceof IBloodOrb) { Binding binding = ((IBindable) orbStack.getItem()).getBinding(orbStack); - if (binding == null) - { + if (binding == null) { return 0; } @@ -408,11 +344,9 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory, return 0; } - public void craftItem(List inputList, AlchemyTableRecipe recipe) - { + public void craftItem(List inputList, AlchemyTableRecipe recipe) { ItemStack outputStack = recipe.getRecipeOutput(inputList); - if (this.canCraft(outputStack)) - { + if (this.canCraft(outputStack)) { ItemStack currentOutputStack = getStackInSlot(outputSlot); ItemStack[] inputs = new ItemStack[0]; @@ -423,11 +357,9 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory, MinecraftForge.EVENT_BUS.post(event); outputStack = event.getOutput(); - if (currentOutputStack.isEmpty()) - { + if (currentOutputStack.isEmpty()) { setInventorySlotContents(outputSlot, outputStack); - } else if (ItemHandlerHelper.canItemStacksStack(outputStack, currentOutputStack)) - { + } else if (ItemHandlerHelper.canItemStacksStack(outputStack, currentOutputStack)) { currentOutputStack.grow(outputStack.getCount()); } @@ -435,16 +367,12 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory, } } - public int consumeLp(int requested) - { + public int consumeLp(int requested) { ItemStack orbStack = getStackInSlot(orbSlot); - if (!orbStack.isEmpty()) - { - if (orbStack.getItem() instanceof IBloodOrb) - { - if (NetworkHelper.syphonFromContainer(orbStack, SoulTicket.item(orbStack, world, pos, requested))) - { + if (!orbStack.isEmpty()) { + if (orbStack.getItem() instanceof IBloodOrb) { + if (NetworkHelper.syphonFromContainer(orbStack, SoulTicket.item(orbStack, world, pos, requested))) { return requested; } } @@ -453,64 +381,52 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory, return 0; } - public void consumeInventory(AlchemyTableRecipe recipe) - { + public void consumeInventory(AlchemyTableRecipe recipe) { ItemStack[] input = new ItemStack[6]; - for (int i = 0; i < 6; i++) - { + for (int i = 0; i < 6; i++) { input[i] = getStackInSlot(i); } ItemStack[] result = recipe.getRemainingItems(input); - for (int i = 0; i < 6; i++) - { + for (int i = 0; i < 6; i++) { setInventorySlotContents(i, result[i]); } } - public EnumFacing getDirection() - { + public EnumFacing getDirection() { return direction; } - public boolean isSlave() - { + public boolean isSlave() { return isSlave; } - public int getBurnTime() - { + public int getBurnTime() { return burnTime; } - public int getTicksRequired() - { + public int getTicksRequired() { return ticksRequired; } - public BlockPos getConnectedPos() - { + public BlockPos getConnectedPos() { return connectedPos; } - public boolean[] getBlockedSlots() - { + public boolean[] getBlockedSlots() { return blockedSlots; } - public static int getOrbSlot() - { + public static int getOrbSlot() { return orbSlot; } - public static int getToolSlot() - { + public static int getToolSlot() { return toolSlot; } - public static int getOutputSlot() - { + public static int getOutputSlot() { return outputSlot; } } diff --git a/src/main/java/WayofTime/bloodmagic/tile/TileDemonCrystal.java b/src/main/java/WayofTime/bloodmagic/tile/TileDemonCrystal.java index 827e31b0..9d2e5c4e 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/TileDemonCrystal.java +++ b/src/main/java/WayofTime/bloodmagic/tile/TileDemonCrystal.java @@ -12,8 +12,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.MathHelper; -public class TileDemonCrystal extends TileTicking -{ +public class TileDemonCrystal extends TileTicking { public static final double sameWillConversionRate = 50; public static final double defaultWillConversionRate = 100; public static final double timeDelayForWrongWill = 0.6; @@ -25,45 +24,35 @@ public class TileDemonCrystal extends TileTicking public int crystalCount = 1; public EnumFacing placement = EnumFacing.UP; //Side that this crystal is placed on. - public TileDemonCrystal() - { + public TileDemonCrystal() { this.crystalCount = 1; } @Override - public void onUpdate() - { - if (getWorld().isRemote) - { + public void onUpdate() { + if (getWorld().isRemote) { return; } internalCounter++; - if (internalCounter % 20 == 0 && crystalCount < 7) - { + if (internalCounter % 20 == 0 && crystalCount < 7) { EnumDemonWillType type = getType(); double value = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, type); - if (type != EnumDemonWillType.DEFAULT) - { - if (value >= 0.5) - { + if (type != EnumDemonWillType.DEFAULT) { + if (value >= 0.5) { double nextProgress = getCrystalGrowthPerSecond(value); progressToNextCrystal += WorldDemonWillHandler.drainWill(getWorld(), getPos(), type, nextProgress * sameWillConversionRate, true) / sameWillConversionRate; - } else - { + } else { value = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, EnumDemonWillType.DEFAULT); - if (value > 0.5) - { + if (value > 0.5) { double nextProgress = getCrystalGrowthPerSecond(value) * timeDelayForWrongWill; progressToNextCrystal += WorldDemonWillHandler.drainWill(getWorld(), getPos(), EnumDemonWillType.DEFAULT, nextProgress * defaultWillConversionRate, true) / defaultWillConversionRate; } } - } else - { - if (value > 0.5) - { + } else { + if (value > 0.5) { double nextProgress = getCrystalGrowthPerSecond(value); progressToNextCrystal += WorldDemonWillHandler.drainWill(getWorld(), getPos(), type, nextProgress * sameWillConversionRate, true) / sameWillConversionRate; @@ -84,17 +73,14 @@ public class TileDemonCrystal extends TileTicking * Encourages the crystal to grow by a large percentage by telling it to * drain will from the aura. * - * @param willDrain - * The amount of drain that is needed for the crystal to grow - * successfully for the desired amount. Can be more than the base - * amount. + * @param willDrain The amount of drain that is needed for the crystal to grow + * successfully for the desired amount. Can be more than the base + * amount. * @param progressPercentage * @return percentage actually grown. */ - public double growCrystalWithWillAmount(double willDrain, double progressPercentage) - { - if (crystalCount >= 7) - { + public double growCrystalWithWillAmount(double willDrain, double progressPercentage) { + if (crystalCount >= 7) { return 0; } @@ -104,8 +90,7 @@ public class TileDemonCrystal extends TileTicking double value = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, type); double percentDrain = willDrain <= 0 ? 1 : Math.min(1, value / willDrain); - if (percentDrain <= 0) - { + if (percentDrain <= 0) { return 0; } @@ -118,15 +103,12 @@ public class TileDemonCrystal extends TileTicking return percentDrain * progressPercentage; } - public EnumDemonWillType getType() - { + public EnumDemonWillType getType() { return EnumDemonWillType.values()[this.getBlockMetadata()]; } - public void checkAndGrowCrystal() - { - if (progressToNextCrystal >= 1 && internalCounter % 100 == 0) - { + public void checkAndGrowCrystal() { + if (progressToNextCrystal >= 1 && internalCounter % 100 == 0) { progressToNextCrystal--; crystalCount++; markDirty(); @@ -134,20 +116,16 @@ public class TileDemonCrystal extends TileTicking } } - public double getMaxWillForCrystal() - { + public double getMaxWillForCrystal() { return 50; } - public boolean dropSingleCrystal() - { - if (!getWorld().isRemote && crystalCount > 1) - { + public boolean dropSingleCrystal() { + if (!getWorld().isRemote && crystalCount > 1) { IBlockState state = getWorld().getBlockState(pos); EnumDemonWillType type = state.getValue(BlockDemonCrystal.TYPE); ItemStack stack = BlockDemonCrystal.getItemStackDropped(type, 1); - if (!stack.isEmpty()) - { + if (!stack.isEmpty()) { crystalCount--; InventoryHelper.spawnItemStack(getWorld(), pos.getX(), pos.getY(), pos.getZ(), stack); notifyUpdate(); @@ -158,19 +136,16 @@ public class TileDemonCrystal extends TileTicking return false; } - public double getCrystalGrowthPerSecond(double will) - { + public double getCrystalGrowthPerSecond(double will) { return 1.0 / 200 * Math.sqrt(will / 200); } - public int getCrystalCountForRender() - { + public int getCrystalCountForRender() { return MathHelper.clamp(crystalCount - 1, 0, 6); } @Override - public void deserialize(NBTTagCompound tag) - { + public void deserialize(NBTTagCompound tag) { holder.readFromNBT(tag, "Will"); crystalCount = tag.getInteger("crystalCount"); placement = EnumFacing.byIndex(tag.getInteger("placement")); @@ -178,8 +153,7 @@ public class TileDemonCrystal extends TileTicking } @Override - public NBTTagCompound serialize(NBTTagCompound tag) - { + public NBTTagCompound serialize(NBTTagCompound tag) { holder.writeToNBT(tag, "Will"); tag.setInteger("crystalCount", crystalCount); tag.setInteger("placement", placement.getIndex()); @@ -187,23 +161,19 @@ public class TileDemonCrystal extends TileTicking return tag; } - public int getCrystalCount() - { + public int getCrystalCount() { return crystalCount; } - public void setCrystalCount(int crystalCount) - { + public void setCrystalCount(int crystalCount) { this.crystalCount = crystalCount; } - public EnumFacing getPlacement() - { + public EnumFacing getPlacement() { return placement; } - public void setPlacement(EnumFacing placement) - { + public void setPlacement(EnumFacing placement) { this.placement = placement; } diff --git a/src/main/java/WayofTime/bloodmagic/tile/TileDemonCrystallizer.java b/src/main/java/WayofTime/bloodmagic/tile/TileDemonCrystallizer.java index 0fd56f0c..e462b767 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/TileDemonCrystallizer.java +++ b/src/main/java/WayofTime/bloodmagic/tile/TileDemonCrystallizer.java @@ -11,8 +11,7 @@ import WayofTime.bloodmagic.soul.EnumDemonWillType; import WayofTime.bloodmagic.soul.IDemonWillConduit; import WayofTime.bloodmagic.tile.base.TileTicking; -public class TileDemonCrystallizer extends TileTicking implements IDemonWillConduit -{ +public class TileDemonCrystallizer extends TileTicking implements IDemonWillConduit { public static final int maxWill = 100; public static final double drainRate = 1; public static final double willToFormCrystal = 99; @@ -21,16 +20,13 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond public DemonWillHolder holder = new DemonWillHolder(); public double internalCounter = 0; - public TileDemonCrystallizer() - { + public TileDemonCrystallizer() { } @Override - public void onUpdate() - { - if (getWorld().isRemote) - { + public void onUpdate() { + if (getWorld().isRemote) { return; } @@ -39,15 +35,11 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond { EnumDemonWillType highestType = WorldDemonWillHandler.getHighestDemonWillType(getWorld(), pos); double amount = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, highestType); - if (amount >= willToFormCrystal) - { + if (amount >= willToFormCrystal) { internalCounter += getCrystalFormationRate(amount); - if (internalCounter >= totalFormationTime) - { - if (WorldDemonWillHandler.drainWill(getWorld(), getPos(), highestType, willToFormCrystal, false) >= willToFormCrystal) - { - if (formCrystal(highestType, offsetPos)) - { + if (internalCounter >= totalFormationTime) { + if (WorldDemonWillHandler.drainWill(getWorld(), getPos(), highestType, willToFormCrystal, false) >= willToFormCrystal) { + if (formCrystal(highestType, offsetPos)) { WorldDemonWillHandler.drainWill(getWorld(), getPos(), highestType, willToFormCrystal, true); internalCounter = 0; } @@ -57,12 +49,10 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond } } - public boolean formCrystal(EnumDemonWillType type, BlockPos position) - { + public boolean formCrystal(EnumDemonWillType type, BlockPos position) { getWorld().setBlockState(position, RegistrarBloodMagicBlocks.DEMON_CRYSTAL.getStateFromMeta(type.ordinal())); TileEntity tile = getWorld().getTileEntity(position); - if (tile instanceof TileDemonCrystal) - { + if (tile instanceof TileDemonCrystal) { ((TileDemonCrystal) tile).setPlacement(EnumFacing.UP); return true; } @@ -70,21 +60,18 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond return false; } - public double getCrystalFormationRate(double currentWill) - { + public double getCrystalFormationRate(double currentWill) { return 1; } @Override - public void deserialize(NBTTagCompound tag) - { + public void deserialize(NBTTagCompound tag) { holder.readFromNBT(tag, "Will"); internalCounter = tag.getDouble("internalCounter"); } @Override - public NBTTagCompound serialize(NBTTagCompound tag) - { + public NBTTagCompound serialize(NBTTagCompound tag) { holder.writeToNBT(tag, "Will"); tag.setDouble("internalCounter", internalCounter); return tag; @@ -93,26 +80,21 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond // IDemonWillConduit @Override - public int getWeight() - { + public int getWeight() { return 10; } @Override - public double fillDemonWill(EnumDemonWillType type, double amount, boolean doFill) - { - if (amount <= 0) - { + public double fillDemonWill(EnumDemonWillType type, double amount, boolean doFill) { + if (amount <= 0) { return 0; } - if (!canFill(type)) - { + if (!canFill(type)) { return 0; } - if (!doFill) - { + if (!doFill) { return Math.min(maxWill - holder.getWill(type), amount); } @@ -120,17 +102,14 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond } @Override - public double drainDemonWill(EnumDemonWillType type, double amount, boolean doDrain) - { + public double drainDemonWill(EnumDemonWillType type, double amount, boolean doDrain) { double drained = amount; double current = holder.getWill(type); - if (current < drained) - { + if (current < drained) { drained = current; } - if (doDrain) - { + if (doDrain) { return holder.drainWill(type, amount); } @@ -138,20 +117,17 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond } @Override - public boolean canFill(EnumDemonWillType type) - { + public boolean canFill(EnumDemonWillType type) { return true; } @Override - public boolean canDrain(EnumDemonWillType type) - { + public boolean canDrain(EnumDemonWillType type) { return true; } @Override - public double getCurrentWill(EnumDemonWillType type) - { + public double getCurrentWill(EnumDemonWillType type) { return holder.getWill(type); } } \ No newline at end of file diff --git a/src/main/java/WayofTime/bloodmagic/tile/TileMimic.java b/src/main/java/WayofTime/bloodmagic/tile/TileMimic.java index 11b80f2e..ea0558b6 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/TileMimic.java +++ b/src/main/java/WayofTime/bloodmagic/tile/TileMimic.java @@ -42,7 +42,7 @@ public class TileMimic extends TileInventory implements ITickable { public NBTTagCompound tileTag = new NBTTagCompound(); public TileEntity mimicedTile = null; IBlockState stateOfReplacedBlock = Blocks.AIR.getDefaultState(); - + public int playerCheckRadius = 5; public int potionSpawnRadius = 5; public int potionSpawnInterval = 40; @@ -137,7 +137,7 @@ public class TileMimic extends TileInventory implements ITickable { Utils.insertItemToTile(this, player, 0); ItemStack stack = getStackInSlot(0); - if(stateOfReplacedBlock == Blocks.AIR.getDefaultState()) { + if (stateOfReplacedBlock == Blocks.AIR.getDefaultState()) { if (!stack.isEmpty() && stack.getItem() instanceof ItemBlock) { Block block = ((ItemBlock) stack.getItem()).getBlock(); stateOfReplacedBlock = block.getDefaultState(); @@ -273,7 +273,7 @@ public class TileMimic extends TileInventory implements ITickable { tag.setInteger("playerCheckRadius", playerCheckRadius); tag.setInteger("potionSpawnRadius", potionSpawnRadius); tag.setInteger("potionSpawnInterval", potionSpawnInterval); - tag.setString("stateOfReplacedBlock",stateOfReplacedBlock.toString()); + tag.setString("stateOfReplacedBlock", stateOfReplacedBlock.toString()); return tag; } @@ -296,11 +296,11 @@ public class TileMimic extends TileInventory implements ITickable { public IBlockState getReplacedState() { return stateOfReplacedBlock; } - + public void setReplacedState(IBlockState state) { stateOfReplacedBlock = state; } - + @Override public boolean isItemValidForSlot(int slot, ItemStack itemstack) { return slot == 0 && dropItemsOnBreak; @@ -312,7 +312,7 @@ public class TileMimic extends TileInventory implements ITickable { replaceMimicWithBlockActual(world, pos, mimic.getStackInSlot(0), mimic.tileTag, mimic.stateOfReplacedBlock); } - + public static boolean replaceMimicWithBlockActual(World world, BlockPos pos, ItemStack stack, NBTTagCompound tileTag, IBlockState replacementState) { if (!stack.isEmpty() && stack.getItem() instanceof ItemBlock) { Block block = ((ItemBlock) stack.getItem()).getBlock(); diff --git a/src/main/java/WayofTime/bloodmagic/tile/TilePhantomBlock.java b/src/main/java/WayofTime/bloodmagic/tile/TilePhantomBlock.java index c1d2007f..fc9552ad 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/TilePhantomBlock.java +++ b/src/main/java/WayofTime/bloodmagic/tile/TilePhantomBlock.java @@ -29,7 +29,7 @@ public class TilePhantomBlock extends TileTicking { @Override public void onUpdate() { - if(!world.isRemote) { + if (!world.isRemote) { EntityPlayer player = world.getClosestPlayer(getPos().getX(), getPos().getY(), getPos().getZ(), 10.0D, ItemSigilPhantomBridge.IS_PHANTOM_ACTIVE); if (player != null && !player.isSneaking()) return; diff --git a/src/main/java/WayofTime/bloodmagic/tile/routing/TileMasterRoutingNode.java b/src/main/java/WayofTime/bloodmagic/tile/routing/TileMasterRoutingNode.java index 51318fdc..afbb3410 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/routing/TileMasterRoutingNode.java +++ b/src/main/java/WayofTime/bloodmagic/tile/routing/TileMasterRoutingNode.java @@ -16,8 +16,7 @@ import net.minecraft.world.World; import java.util.*; import java.util.Map.Entry; -public class TileMasterRoutingNode extends TileInventory implements IMasterRoutingNode, ITickable -{ +public class TileMasterRoutingNode extends TileInventory implements IMasterRoutingNode, ITickable { public static final int tickRate = 20; private int currentInput; // A list of connections @@ -26,16 +25,13 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti private List outputNodeList = new LinkedList<>(); private List inputNodeList = new LinkedList<>(); - public TileMasterRoutingNode() - { + public TileMasterRoutingNode() { super(0, "masterRoutingNode"); } @Override - public void update() - { - if (!getWorld().isRemote) - { + public void update() { + if (!getWorld().isRemote) { // currentInput = getWorld().isBlockIndirectlyGettingPowered(pos); currentInput = getWorld().getStrongPower(pos); @@ -50,31 +46,23 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti Map> outputMap = new TreeMap<>(); Map> outputFluidMap = new TreeMap<>(); - for (BlockPos outputPos : outputNodeList) - { + for (BlockPos outputPos : outputNodeList) { TileEntity outputTile = getWorld().getTileEntity(outputPos); - if (this.isConnected(new LinkedList<>(), outputPos)) - { - if (outputTile instanceof IOutputItemRoutingNode) - { + if (this.isConnected(new LinkedList<>(), outputPos)) { + if (outputTile instanceof IOutputItemRoutingNode) { IOutputItemRoutingNode outputNode = (IOutputItemRoutingNode) outputTile; - for (EnumFacing facing : EnumFacing.VALUES) - { - if (!outputNode.isInventoryConnectedToSide(facing) || !outputNode.isOutput(facing)) - { + for (EnumFacing facing : EnumFacing.VALUES) { + if (!outputNode.isInventoryConnectedToSide(facing) || !outputNode.isOutput(facing)) { continue; } IItemFilter filter = outputNode.getOutputFilterForSide(facing); - if (filter != null) - { + if (filter != null) { int priority = outputNode.getPriority(facing); - if (outputMap.containsKey(priority)) - { + if (outputMap.containsKey(priority)) { outputMap.get(priority).add(filter); - } else - { + } else { List filterList = new LinkedList<>(); filterList.add(filter); outputMap.put(priority, filterList); @@ -83,26 +71,20 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti } } - if (outputTile instanceof IOutputFluidRoutingNode) - { + if (outputTile instanceof IOutputFluidRoutingNode) { IOutputFluidRoutingNode outputNode = (IOutputFluidRoutingNode) outputTile; - for (EnumFacing facing : EnumFacing.VALUES) - { - if (!outputNode.isTankConnectedToSide(facing) || !outputNode.isFluidOutput(facing)) - { + for (EnumFacing facing : EnumFacing.VALUES) { + if (!outputNode.isTankConnectedToSide(facing) || !outputNode.isFluidOutput(facing)) { continue; } IFluidFilter filter = outputNode.getOutputFluidFilterForSide(facing); - if (filter != null) - { + if (filter != null) { int priority = outputNode.getPriority(facing); - if (outputFluidMap.containsKey(priority)) - { + if (outputFluidMap.containsKey(priority)) { outputFluidMap.get(priority).add(filter); - } else - { + } else { List filterList = new LinkedList<>(); filterList.add(filter); outputFluidMap.put(priority, filterList); @@ -116,31 +98,23 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti Map> inputMap = new TreeMap<>(); Map> inputFluidMap = new TreeMap<>(); - for (BlockPos inputPos : inputNodeList) - { + for (BlockPos inputPos : inputNodeList) { TileEntity inputTile = getWorld().getTileEntity(inputPos); - if (this.isConnected(new LinkedList<>(), inputPos)) - { - if (inputTile instanceof IInputItemRoutingNode) - { + if (this.isConnected(new LinkedList<>(), inputPos)) { + if (inputTile instanceof IInputItemRoutingNode) { IInputItemRoutingNode inputNode = (IInputItemRoutingNode) inputTile; - for (EnumFacing facing : EnumFacing.VALUES) - { - if (!inputNode.isInventoryConnectedToSide(facing) || !inputNode.isInput(facing)) - { + for (EnumFacing facing : EnumFacing.VALUES) { + if (!inputNode.isInventoryConnectedToSide(facing) || !inputNode.isInput(facing)) { continue; } IItemFilter filter = inputNode.getInputFilterForSide(facing); - if (filter != null) - { + if (filter != null) { int priority = inputNode.getPriority(facing); - if (inputMap.containsKey(priority)) - { + if (inputMap.containsKey(priority)) { inputMap.get(priority).add(filter); - } else - { + } else { List filterList = new LinkedList<>(); filterList.add(filter); inputMap.put(priority, filterList); @@ -149,26 +123,20 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti } } - if (inputTile instanceof IInputFluidRoutingNode) - { + if (inputTile instanceof IInputFluidRoutingNode) { IInputFluidRoutingNode inputNode = (IInputFluidRoutingNode) inputTile; - for (EnumFacing facing : EnumFacing.VALUES) - { - if (!inputNode.isTankConnectedToSide(facing) || !inputNode.isFluidInput(facing)) - { + for (EnumFacing facing : EnumFacing.VALUES) { + if (!inputNode.isTankConnectedToSide(facing) || !inputNode.isFluidInput(facing)) { continue; } IFluidFilter filter = inputNode.getInputFluidFilterForSide(facing); - if (filter != null) - { + if (filter != null) { int priority = inputNode.getPriority(facing); - if (inputFluidMap.containsKey(priority)) - { + if (inputFluidMap.containsKey(priority)) { inputFluidMap.get(priority).add(filter); - } else - { + } else { List filterList = new LinkedList<>(); filterList.add(filter); inputFluidMap.put(priority, filterList); @@ -182,19 +150,14 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti int maxTransfer = this.getMaxTransferForDemonWill(WorldDemonWillHandler.getCurrentWill(getWorld(), pos, EnumDemonWillType.DEFAULT)); int maxFluidTransfer = 1000; - for (Entry> outputEntry : outputMap.entrySet()) - { + for (Entry> outputEntry : outputMap.entrySet()) { List outputList = outputEntry.getValue(); - for (IItemFilter outputFilter : outputList) - { - for (Entry> inputEntry : inputMap.entrySet()) - { + for (IItemFilter outputFilter : outputList) { + for (Entry> inputEntry : inputMap.entrySet()) { List inputList = inputEntry.getValue(); - for (IItemFilter inputFilter : inputList) - { + for (IItemFilter inputFilter : inputList) { maxTransfer -= inputFilter.transferThroughInputFilter(outputFilter, maxTransfer); - if (maxTransfer <= 0) - { + if (maxTransfer <= 0) { return; } } @@ -202,19 +165,14 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti } } - for (Entry> outputEntry : outputFluidMap.entrySet()) - { + for (Entry> outputEntry : outputFluidMap.entrySet()) { List outputList = outputEntry.getValue(); - for (IFluidFilter outputFilter : outputList) - { - for (Entry> inputEntry : inputFluidMap.entrySet()) - { + for (IFluidFilter outputFilter : outputList) { + for (Entry> inputEntry : inputFluidMap.entrySet()) { List inputList = inputEntry.getValue(); - for (IFluidFilter inputFilter : inputList) - { + for (IFluidFilter inputFilter : inputList) { maxFluidTransfer -= inputFilter.transferThroughInputFilter(outputFilter, maxFluidTransfer); - if (maxFluidTransfer <= 0) - { + if (maxFluidTransfer <= 0) { return; } } @@ -223,18 +181,15 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti } } - public int getMaxTransferForDemonWill(double will) - { + public int getMaxTransferForDemonWill(double will) { return 64; } @Override - public NBTTagCompound serialize(NBTTagCompound tag) - { + public NBTTagCompound serialize(NBTTagCompound tag) { super.serialize(tag); NBTTagList tags = new NBTTagList(); - for (BlockPos pos : generalNodeList) - { + for (BlockPos pos : generalNodeList) { NBTTagCompound posTag = new NBTTagCompound(); posTag.setInteger(Constants.NBT.X_COORD, pos.getX()); posTag.setInteger(Constants.NBT.Y_COORD, pos.getY()); @@ -244,8 +199,7 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti tag.setTag(Constants.NBT.ROUTING_MASTER_GENERAL, tags); tags = new NBTTagList(); - for (BlockPos pos : inputNodeList) - { + for (BlockPos pos : inputNodeList) { NBTTagCompound posTag = new NBTTagCompound(); posTag.setInteger(Constants.NBT.X_COORD, pos.getX()); posTag.setInteger(Constants.NBT.Y_COORD, pos.getY()); @@ -255,8 +209,7 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti tag.setTag(Constants.NBT.ROUTING_MASTER_INPUT, tags); tags = new NBTTagList(); - for (BlockPos pos : outputNodeList) - { + for (BlockPos pos : outputNodeList) { NBTTagCompound posTag = new NBTTagCompound(); posTag.setInteger(Constants.NBT.X_COORD, pos.getX()); posTag.setInteger(Constants.NBT.Y_COORD, pos.getY()); @@ -268,29 +221,25 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti } @Override - public void deserialize(NBTTagCompound tag) - { + public void deserialize(NBTTagCompound tag) { super.deserialize(tag); NBTTagList tags = tag.getTagList(Constants.NBT.ROUTING_MASTER_GENERAL, 10); - for (int i = 0; i < tags.tagCount(); i++) - { + for (int i = 0; i < tags.tagCount(); i++) { NBTTagCompound blockTag = tags.getCompoundTagAt(i); BlockPos newPos = new BlockPos(blockTag.getInteger(Constants.NBT.X_COORD), blockTag.getInteger(Constants.NBT.Y_COORD), blockTag.getInteger(Constants.NBT.Z_COORD)); generalNodeList.add(newPos); } tags = tag.getTagList(Constants.NBT.ROUTING_MASTER_INPUT, 10); - for (int i = 0; i < tags.tagCount(); i++) - { + for (int i = 0; i < tags.tagCount(); i++) { NBTTagCompound blockTag = tags.getCompoundTagAt(i); BlockPos newPos = new BlockPos(blockTag.getInteger(Constants.NBT.X_COORD), blockTag.getInteger(Constants.NBT.Y_COORD), blockTag.getInteger(Constants.NBT.Z_COORD)); inputNodeList.add(newPos); } tags = tag.getTagList(Constants.NBT.ROUTING_MASTER_OUTPUT, 10); - for (int i = 0; i < tags.tagCount(); i++) - { + for (int i = 0; i < tags.tagCount(); i++) { NBTTagCompound blockTag = tags.getCompoundTagAt(i); BlockPos newPos = new BlockPos(blockTag.getInteger(Constants.NBT.X_COORD), blockTag.getInteger(Constants.NBT.Y_COORD), blockTag.getInteger(Constants.NBT.Z_COORD)); outputNodeList.add(newPos); @@ -298,16 +247,14 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti } @Override - public boolean isConnected(List path, BlockPos nodePos) - { + public boolean isConnected(List path, BlockPos nodePos) { //TODO: Figure out how to make it so the path is obtained // if (!connectionMap.containsKey(nodePos)) // { // return false; // } TileEntity tile = getWorld().getTileEntity(nodePos); - if (!(tile instanceof IRoutingNode)) - { + if (!(tile instanceof IRoutingNode)) { // connectionMap.remove(nodePos); return false; } @@ -316,22 +263,17 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti List connectionList = node.getConnected(); // List testPath = path.subList(0, path.size()); path.add(nodePos); - for (BlockPos testPos : connectionList) - { - if (path.contains(testPos)) - { + for (BlockPos testPos : connectionList) { + if (path.contains(testPos)) { continue; } - if (testPos.equals(this.getPos()) && node.isConnectionEnabled(testPos)) - { + if (testPos.equals(this.getPos()) && node.isConnectionEnabled(testPos)) { // path.clear(); // path.addAll(testPath); return true; - } else if (NodeHelper.isNodeConnectionEnabled(getWorld(), node, testPos)) - { - if (isConnected(path, testPos)) - { + } else if (NodeHelper.isNodeConnectionEnabled(getWorld(), node, testPos)) { + if (isConnected(path, testPos)) { // path.clear(); // path.addAll(testPath); return true; @@ -343,56 +285,44 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti } @Override - public boolean isConnectionEnabled(BlockPos testPos) - { + public boolean isConnectionEnabled(BlockPos testPos) { return currentInput <= 0; } @Override - public void addNodeToList(IRoutingNode node) - { + public void addNodeToList(IRoutingNode node) { BlockPos newPos = node.getBlockPos(); - if (!generalNodeList.contains(newPos)) - { + if (!generalNodeList.contains(newPos)) { generalNodeList.add(newPos); } - if (node instanceof IInputItemRoutingNode && !inputNodeList.contains(newPos)) - { + if (node instanceof IInputItemRoutingNode && !inputNodeList.contains(newPos)) { inputNodeList.add(newPos); } - if (node instanceof IOutputItemRoutingNode && !outputNodeList.contains(newPos)) - { + if (node instanceof IOutputItemRoutingNode && !outputNodeList.contains(newPos)) { outputNodeList.add(newPos); } } @Override - public void addConnections(BlockPos pos, List connectionList) - { - for (BlockPos testPos : connectionList) - { + public void addConnections(BlockPos pos, List connectionList) { + for (BlockPos testPos : connectionList) { addConnection(pos, testPos); } } @Override - public void addConnection(BlockPos pos1, BlockPos pos2) - { - if (connectionMap.containsKey(pos1) && !connectionMap.get(pos1).contains(pos2)) - { + public void addConnection(BlockPos pos1, BlockPos pos2) { + if (connectionMap.containsKey(pos1) && !connectionMap.get(pos1).contains(pos2)) { connectionMap.get(pos1).add(pos2); - } else - { + } else { List list = new LinkedList<>(); list.add(pos2); connectionMap.put(pos1, list); } - if (connectionMap.containsKey(pos2) && !connectionMap.get(pos2).contains(pos1)) - { + if (connectionMap.containsKey(pos2) && !connectionMap.get(pos2).contains(pos1)) { connectionMap.get(pos2).add(pos1); - } else - { + } else { List list = new LinkedList<>(); list.add(pos1); connectionMap.put(pos2, list); @@ -400,84 +330,69 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti } @Override - public void removeConnection(BlockPos pos1, BlockPos pos2) - { - if (connectionMap.containsKey(pos1)) - { + public void removeConnection(BlockPos pos1, BlockPos pos2) { + if (connectionMap.containsKey(pos1)) { List posList = connectionMap.get(pos1); posList.remove(pos2); - if (posList.isEmpty()) - { + if (posList.isEmpty()) { connectionMap.remove(pos1); } } - if (connectionMap.containsKey(pos2)) - { + if (connectionMap.containsKey(pos2)) { List posList = connectionMap.get(pos2); posList.remove(pos1); - if (posList.isEmpty()) - { + if (posList.isEmpty()) { connectionMap.remove(pos2); } } } @Override - public void connectMasterToRemainingNode(World world, List alreadyChecked, IMasterRoutingNode master) - { + public void connectMasterToRemainingNode(World world, List alreadyChecked, IMasterRoutingNode master) { return; } @Override - public BlockPos getBlockPos() - { + public BlockPos getBlockPos() { return this.getPos(); } @Override - public List getConnected() - { + public List getConnected() { return new LinkedList<>(); } @Override - public BlockPos getMasterPos() - { + public BlockPos getMasterPos() { return this.getPos(); } @Override - public boolean isMaster(IMasterRoutingNode master) - { + public boolean isMaster(IMasterRoutingNode master) { return false; } @Override - public void addConnection(BlockPos pos1) - { + public void addConnection(BlockPos pos1) { // Empty } @Override - public void removeConnection(BlockPos pos1) - { + public void removeConnection(BlockPos pos1) { generalNodeList.remove(pos1); inputNodeList.remove(pos1); outputNodeList.remove(pos1); } @Override - public void removeAllConnections() - { + public void removeAllConnections() { List list = generalNodeList.subList(0, generalNodeList.size()); Iterator itr = list.iterator(); - while (itr.hasNext()) - { + while (itr.hasNext()) { BlockPos testPos = itr.next(); TileEntity tile = getWorld().getTileEntity(testPos); - if (tile instanceof IRoutingNode) - { + if (tile instanceof IRoutingNode) { ((IRoutingNode) tile).removeConnection(pos); getWorld().notifyBlockUpdate(getPos(), getWorld().getBlockState(testPos), getWorld().getBlockState(testPos), 3); } diff --git a/src/main/java/WayofTime/bloodmagic/util/Constants.java b/src/main/java/WayofTime/bloodmagic/util/Constants.java index b368bf9c..7e5eb83f 100644 --- a/src/main/java/WayofTime/bloodmagic/util/Constants.java +++ b/src/main/java/WayofTime/bloodmagic/util/Constants.java @@ -7,10 +7,8 @@ import net.minecraftforge.fml.common.registry.ForgeRegistries; import java.util.Locale; -public class Constants -{ - public static class NBT - { +public class Constants { + public static class NBT { public static final String OWNER_UUID = "ownerUUID"; public static final String OWNER_NAME = "ownerNAME"; public static final String USES = "uses"; @@ -133,13 +131,11 @@ public class Constants public static final String BREATH = "breath"; } - public static class Mod - { + public static class Mod { public static final String DOMAIN = BloodMagic.MODID.toLowerCase(Locale.ENGLISH) + ":"; } - public static final class Gui - { + public static final class Gui { public static final int TELEPOSER_GUI = 0; public static final int SOUL_FORGE_GUI = 1; public static final int ROUTING_NODE_GUI = 2; @@ -148,8 +144,7 @@ public class Constants public static final int SIGIL_HOLDING_GUI = 5; } - public static class Compat - { + public static class Compat { public static final String JEI_CATEGORY_ALTAR = BloodMagic.MODID + ":altar"; public static final String JEI_CATEGORY_BINDING = BloodMagic.MODID + ":binding"; public static final String JEI_CATEGORY_ALCHEMYARRAY = BloodMagic.MODID + ":alchemyArray"; @@ -166,8 +161,7 @@ public class Constants public static final Item THAUMCRAFT_GOGGLES = ForgeRegistries.ITEMS.getValue(new ResourceLocation("Thaumcraft", "goggles")); } - public static class Misc - { + public static class Misc { public static final int POTION_ARRAY_SIZE = 256; public static final float ALTERED_STEP_HEIGHT = 1.00314159f; public static final int NIGHT_VISION_CONSTANT_BEGIN = 30020; diff --git a/src/main/java/WayofTime/bloodmagic/util/ISigilFluidItem.java b/src/main/java/WayofTime/bloodmagic/util/ISigilFluidItem.java index 920b21de..f035728e 100644 --- a/src/main/java/WayofTime/bloodmagic/util/ISigilFluidItem.java +++ b/src/main/java/WayofTime/bloodmagic/util/ISigilFluidItem.java @@ -5,8 +5,10 @@ import net.minecraftforge.fluids.FluidStack; public interface ISigilFluidItem { FluidStack getFluid(ItemStack sigil); + int getCapacity(ItemStack sigil); int fill(ItemStack sigil, FluidStack resource, boolean doFill); + FluidStack drain(ItemStack sigil, int maxDrain, boolean doDrain); } \ No newline at end of file diff --git a/src/main/java/WayofTime/bloodmagic/util/PluginUtil.java b/src/main/java/WayofTime/bloodmagic/util/PluginUtil.java index aeed6037..1297d964 100644 --- a/src/main/java/WayofTime/bloodmagic/util/PluginUtil.java +++ b/src/main/java/WayofTime/bloodmagic/util/PluginUtil.java @@ -45,7 +45,7 @@ public class PluginUtil { // Bring core plugin up to top discoveredAnnotations.sort((o1, o2) -> { if (o1.getLeft().getClass() == BloodMagicCorePlugin.class) - return -1; + return -1; return o1.getClass().getCanonicalName().compareToIgnoreCase(o2.getClass().getCanonicalName()); }); @@ -120,8 +120,7 @@ public class PluginUtil { public enum RegistrationStep { PLUGIN_REGISTER(p -> p.getLeft().register(BloodMagicAPI.INSTANCE)), - RECIPE_REGISTER(p -> p.getLeft().registerRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar())) - ; + RECIPE_REGISTER(p -> p.getLeft().registerRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar())); private final Consumer> consumer; diff --git a/src/main/java/WayofTime/bloodmagic/util/handler/event/GenericHandler.java b/src/main/java/WayofTime/bloodmagic/util/handler/event/GenericHandler.java index fda8d9da..bcd12000 100644 --- a/src/main/java/WayofTime/bloodmagic/util/handler/event/GenericHandler.java +++ b/src/main/java/WayofTime/bloodmagic/util/handler/event/GenericHandler.java @@ -360,7 +360,7 @@ public class GenericHandler { BindableHelper.applyBinding(held, player); // Bind item to the player } - // If the binding exists, we'll check if the player's name has changed since they last used it and update that if so. + // If the binding exists, we'll check if the player's name has changed since they last used it and update that if so. } else if (binding.getOwnerId().equals(player.getGameProfile().getId()) && !binding.getOwnerName().equals(player.getGameProfile().getName())) { binding.setOwnerName(player.getGameProfile().getName()); BindableHelper.applyBinding(held, binding); @@ -419,9 +419,9 @@ public class GenericHandler { } @SubscribeEvent - public static void onRitualDeath(LivingDropsEvent event){ - if(!ConfigHandler.values.wellOfSufferingDrops){ - if(event.getSource().equals(RitualManager.RITUAL_DAMAGE)) { + public static void onRitualDeath(LivingDropsEvent event) { + if (!ConfigHandler.values.wellOfSufferingDrops) { + if (event.getSource().equals(RitualManager.RITUAL_DAMAGE)) { event.getDrops().clear(); } } diff --git a/src/main/java/WayofTime/bloodmagic/util/handler/event/LivingArmourHandler.java b/src/main/java/WayofTime/bloodmagic/util/handler/event/LivingArmourHandler.java index 6a701a0f..447fffa0 100644 --- a/src/main/java/WayofTime/bloodmagic/util/handler/event/LivingArmourHandler.java +++ b/src/main/java/WayofTime/bloodmagic/util/handler/event/LivingArmourHandler.java @@ -45,31 +45,24 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @Mod.EventBusSubscriber(modid = BloodMagic.MODID) -public class LivingArmourHandler -{ +public class LivingArmourHandler { @SubscribeEvent - public static void onEntityHealed(LivingHealEvent event) - { - if (event.getEntityLiving() instanceof EntityPlayer) - { + public static void onEntityHealed(LivingHealEvent event) { + if (event.getEntityLiving() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.getEntity(); - if (LivingArmour.hasFullSet(player)) - { + if (LivingArmour.hasFullSet(player)) { ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack); - if (armour != null) - { + if (armour != null) { double modifier = 1; LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.slowHeal", chestStack); - if (upgrade instanceof LivingArmourUpgradeSlowHeal) - { + if (upgrade instanceof LivingArmourUpgradeSlowHeal) { modifier *= ((LivingArmourUpgradeSlowHeal) upgrade).getHealingModifier(); } - if (modifier != 1) - { + if (modifier != 1) { event.setAmount((float) (event.getAmount() * modifier)); } } @@ -78,23 +71,18 @@ public class LivingArmourHandler } @SubscribeEvent - public static void onMiningSpeedCheck(PlayerEvent.BreakSpeed event) - { + public static void onMiningSpeedCheck(PlayerEvent.BreakSpeed event) { EntityPlayer player = event.getEntityPlayer(); - if (LivingArmour.hasFullSet(player)) - { + if (LivingArmour.hasFullSet(player)) { ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack); - if (armour != null) - { + if (armour != null) { double modifier = 1; - for (LivingArmourUpgrade upgrade : armour.upgradeMap.values()) - { + for (LivingArmourUpgrade upgrade : armour.upgradeMap.values()) { modifier *= upgrade.getMiningSpeedModifier(player); } - if (modifier != 1) - { + if (modifier != 1) { event.setNewSpeed((float) (event.getOriginalSpeed() * modifier)); } } @@ -103,31 +91,24 @@ public class LivingArmourHandler // Applies: Storm Trooper @SubscribeEvent - public static void onEntityJoinedWorld(EntityJoinWorldEvent event) - { + public static void onEntityJoinedWorld(EntityJoinWorldEvent event) { Entity owner = null; - if (event.getEntity() instanceof EntityArrow) - { + if (event.getEntity() instanceof EntityArrow) { owner = ((EntityArrow) event.getEntity()).shootingEntity; - } else if (event.getEntity() instanceof EntityThrowable) - { + } else if (event.getEntity() instanceof EntityThrowable) { owner = ((EntityThrowable) event.getEntity()).getThrower(); } - if (owner instanceof EntityPlayer) - { + if (owner instanceof EntityPlayer) { Entity projectile = event.getEntity(); EntityPlayer player = (EntityPlayer) owner; - if (LivingArmour.hasFullSet(player)) - { + if (LivingArmour.hasFullSet(player)) { ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack); - if (armour != null) - { + if (armour != null) { LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.stormTrooper", chestStack); - if (upgrade instanceof LivingArmourUpgradeStormTrooper) - { + if (upgrade instanceof LivingArmourUpgradeStormTrooper) { float velocityModifier = (float) (((LivingArmourUpgradeStormTrooper) upgrade).getArrowJiggle(player) * Math.sqrt(projectile.motionX * projectile.motionX + projectile.motionY * projectile.motionY + projectile.motionZ * projectile.motionZ)); projectile.motionX += 2 * (event.getWorld().rand.nextDouble() - 0.5) * velocityModifier; @@ -140,37 +121,28 @@ public class LivingArmourHandler } @SubscribeEvent - public static void onPlayerClick(PlayerInteractEvent event) - { - if (event.isCancelable()) - { + public static void onPlayerClick(PlayerInteractEvent event) { + if (event.isCancelable()) { EntityPlayer player = event.getEntityPlayer(); - if (LivingArmour.hasFullSet(player)) - { + if (LivingArmour.hasFullSet(player)) { ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack); - if (armour != null) - { - if (event.getHand() == EnumHand.OFF_HAND) - { + if (armour != null) { + if (event.getHand() == EnumHand.OFF_HAND) { LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.crippledArm", chestStack); - if (upgrade instanceof LivingArmourUpgradeCrippledArm) - { + if (upgrade instanceof LivingArmourUpgradeCrippledArm) { event.setCanceled(true); } } - if (event.getItemStack().getItemUseAction() == EnumAction.DRINK) - { + if (event.getItemStack().getItemUseAction() == EnumAction.DRINK) { ItemStack drinkStack = event.getItemStack(); - if (!(drinkStack.getItem() instanceof ItemSplashPotion)) - { + if (!(drinkStack.getItem() instanceof ItemSplashPotion)) { LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.quenched", chestStack); - if (upgrade instanceof LivingArmourUpgradeQuenched) - { + if (upgrade instanceof LivingArmourUpgradeQuenched) { event.setCanceled(true); } } @@ -182,24 +154,19 @@ public class LivingArmourHandler // Applies: Grim Reaper @SubscribeEvent(priority = EventPriority.HIGHEST) - public static void onEntityDeath(LivingDeathEvent event) - { - if (event.getEntityLiving() instanceof EntityPlayer) - { + public static void onEntityDeath(LivingDeathEvent event) { + if (event.getEntityLiving() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.getEntityLiving(); - if (LivingArmour.hasFullSet(player)) - { + if (LivingArmour.hasFullSet(player)) { ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack); - if (armour != null) - { + if (armour != null) { StatTrackerGrimReaperSprint.incrementCounter(armour); LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.grimReaper", chestStack); - if (upgrade instanceof LivingArmourUpgradeGrimReaperSprint && ((LivingArmourUpgradeGrimReaperSprint) upgrade).canSavePlayer(player)) - { + if (upgrade instanceof LivingArmourUpgradeGrimReaperSprint && ((LivingArmourUpgradeGrimReaperSprint) upgrade).canSavePlayer(player)) { ((LivingArmourUpgradeGrimReaperSprint) upgrade).applyEffectOnRebirth(player); event.setCanceled(true); event.setResult(Event.Result.DENY); @@ -213,26 +180,20 @@ public class LivingArmourHandler // Applies: Jump @SubscribeEvent - public static void onJumpEvent(LivingEvent.LivingJumpEvent event) - { - if (event.getEntityLiving() instanceof EntityPlayer) - { + public static void onJumpEvent(LivingEvent.LivingJumpEvent event) { + if (event.getEntityLiving() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.getEntityLiving(); - if (LivingArmour.hasFullSet(player)) - { + if (LivingArmour.hasFullSet(player)) { ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack); - if (armour != null) - { + if (armour != null) { StatTrackerJump.incrementCounter(armour); - if (!player.isSneaking()) - { + if (!player.isSneaking()) { LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgradeFromNBT(BloodMagic.MODID + ".upgrade.jump", chestStack); - if (upgrade instanceof LivingArmourUpgradeJump) - { + if (upgrade instanceof LivingArmourUpgradeJump) { player.motionY += ((LivingArmourUpgradeJump) upgrade).getJumpModifier(); } } @@ -243,34 +204,25 @@ public class LivingArmourHandler // Applies: Step Assist, Speed Boost @SubscribeEvent(priority = EventPriority.HIGHEST) - public static void onEntityUpdate(LivingEvent.LivingUpdateEvent event) - { - if (event.getEntityLiving() instanceof EntityPlayer) - { + public static void onEntityUpdate(LivingEvent.LivingUpdateEvent event) { + if (event.getEntityLiving() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.getEntityLiving(); boolean hasAssist = false; - if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST)) - { + if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST)) { hasAssist = true; player.stepHeight = Constants.Misc.ALTERED_STEP_HEIGHT; - } else - { - if (LivingArmour.hasFullSet(player)) - { + } else { + if (LivingArmour.hasFullSet(player)) { ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); LivingArmour armour = ItemLivingArmour.getLivingArmourFromStack(chestStack); - if (armour != null) - { + if (armour != null) { LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.stepAssist", chestStack); - if (upgrade instanceof LivingArmourUpgradeStepAssist) - { - if (!player.isSneaking()) - { + if (upgrade instanceof LivingArmourUpgradeStepAssist) { + if (!player.isSneaking()) { player.stepHeight = ((LivingArmourUpgradeStepAssist) upgrade).getStepAssist(); hasAssist = true; - } else - { + } else { player.stepHeight = 0.6F; } } @@ -283,31 +235,26 @@ public class LivingArmourHandler float percentIncrease = 0; - if (LivingArmour.hasFullSet(player)) - { + if (LivingArmour.hasFullSet(player)) { ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); LivingArmour armour = ItemLivingArmour.getLivingArmourFromStack(chestStack); - if (armour != null) - { + if (armour != null) { LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgradeFromNBT(BloodMagic.MODID + ".upgrade.movement", chestStack); - if (upgrade instanceof LivingArmourUpgradeSpeed) - { + if (upgrade instanceof LivingArmourUpgradeSpeed) { percentIncrease += ((LivingArmourUpgradeSpeed) upgrade).getSpeedModifier(); } } } - if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST)) - { + if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST)) { int i = event.getEntityLiving().getActivePotionEffect(RegistrarBloodMagic.BOOST).getAmplifier(); { percentIncrease += (i + 1) * 0.5f; } } - if (percentIncrease > 0 && (player.onGround || player.capabilities.isFlying) && (Math.abs(player.moveForward) > 0 || Math.abs(player.moveStrafing) > 0)) - { + if (percentIncrease > 0 && (player.onGround || player.capabilities.isFlying) && (Math.abs(player.moveForward) > 0 || Math.abs(player.moveStrafing) > 0)) { player.travel(player.moveStrafing * percentIncrease, 0, player.moveForward * percentIncrease); } } @@ -316,8 +263,7 @@ public class LivingArmourHandler // Applies: Arrow Shot // Tracks: Arrow Shot @SubscribeEvent - public static void onArrowFire(ArrowLooseEvent event) - { + public static void onArrowFire(ArrowLooseEvent event) { World world = event.getEntityPlayer().getEntityWorld(); ItemStack stack = event.getBow(); EntityPlayer player = event.getEntityPlayer(); @@ -326,17 +272,14 @@ public class LivingArmourHandler if (world.isRemote) return; - if (LivingArmour.hasFullSet(player)) - { + if (LivingArmour.hasFullSet(player)) { ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack); - if (armour != null) - { + if (armour != null) { StatTrackerArrowShot.incrementCounter(armour); LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.arrowShot", chestStack); - if (upgrade instanceof LivingArmourUpgradeArrowShot) - { + if (upgrade instanceof LivingArmourUpgradeArrowShot) { int charge = event.getCharge(); float velocity = (float) charge / 20.0F; velocity = (velocity * velocity + velocity * 2.0F) / 3.0F; @@ -350,8 +293,7 @@ public class LivingArmourHandler sentientShot = true; } int extraArrows = ((LivingArmourUpgradeArrowShot) upgrade).getExtraArrows(); - for (int n = 0; n < extraArrows; n++) - { + for (int n = 0; n < extraArrows; n++) { ItemStack arrowStack = new ItemStack(Items.ARROW); ItemArrow itemarrow = (ItemArrow) ((stack.getItem() instanceof ItemArrow ? arrowStack.getItem() : Items.ARROW)); EntityArrow entityarrow; @@ -392,21 +334,19 @@ public class LivingArmourHandler } } } - } + } + // Applies: Softfall @SubscribeEvent public static void onPlayerFall(LivingFallEvent event) { - if (event.getEntityLiving() instanceof EntityPlayer) - { + if (event.getEntityLiving() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.getEntityLiving(); - if (LivingArmour.hasFullSet(player)) - { + if (LivingArmour.hasFullSet(player)) { ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack); - if (armour != null) - { + if (armour != null) { StatTrackerFallProtect.incrementCounter(armour, event.getDamageMultiplier() * (event.getDistance() - 3)); LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.fallProtect", chestStack); if (upgrade instanceof LivingArmourUpgradeFallProtect) { @@ -417,17 +357,14 @@ public class LivingArmourHandler } } } - + // Applies: Arrow Shot @SubscribeEvent - public static void onProjectileImpact(ProjectileImpactEvent.Arrow event) - { - if (event.getArrow().removeTag("arrow_shot")) - { + public static void onProjectileImpact(ProjectileImpactEvent.Arrow event) { + if (event.getArrow().removeTag("arrow_shot")) { Entity entity = event.getRayTraceResult().entityHit; - if (entity != null) - { + if (entity != null) { entity.hurtResistantTime = 0; } } diff --git a/src/main/java/WayofTime/bloodmagic/util/helper/IncenseHelper.java b/src/main/java/WayofTime/bloodmagic/util/helper/IncenseHelper.java index 559690ee..5059d631 100644 --- a/src/main/java/WayofTime/bloodmagic/util/helper/IncenseHelper.java +++ b/src/main/java/WayofTime/bloodmagic/util/helper/IncenseHelper.java @@ -21,7 +21,7 @@ public class IncenseHelper { data.setDouble(Constants.NBT.CURRENT_INCENSE, amount); } - public static void setMaxIncense(EntityPlayer player, double amount){ + public static void setMaxIncense(EntityPlayer player, double amount) { NBTTagCompound data = player.getEntityData(); data.setDouble(Constants.NBT.MAX_INCENSE, amount); } @@ -38,6 +38,7 @@ public class IncenseHelper { stack = NBTHelper.checkNBT(stack); stack.getTagCompound().setBoolean(Constants.NBT.HAS_MAX_INCENSE, isMax); } + public static boolean getHasMaxIncense(ItemStack stack) { stack = NBTHelper.checkNBT(stack); return stack.getTagCompound().getBoolean(Constants.NBT.HAS_MAX_INCENSE); diff --git a/src/main/java/WayofTime/bloodmagic/util/helper/NetworkHelper.java b/src/main/java/WayofTime/bloodmagic/util/helper/NetworkHelper.java index bd79a435..c87b8209 100644 --- a/src/main/java/WayofTime/bloodmagic/util/helper/NetworkHelper.java +++ b/src/main/java/WayofTime/bloodmagic/util/helper/NetworkHelper.java @@ -115,12 +115,11 @@ public class NetworkHelper { /** * Syphons a player from within a container. * - * @param stack - ItemStack in the Container. - * @param ticket - SoulTicket to syphon + * @param stack - ItemStack in the Container. + * @param ticket - SoulTicket to syphon * @return - If the syphon was successful. */ - public static boolean syphonFromContainer(ItemStack stack, SoulTicket ticket) - { + public static boolean syphonFromContainer(ItemStack stack, SoulTicket ticket) { if (!(stack.getItem() instanceof IBindable)) return false; @@ -131,7 +130,7 @@ public class NetworkHelper { SoulNetwork network = getSoulNetwork(binding); SoulNetworkEvent.Syphon.Item event = new SoulNetworkEvent.Syphon.Item(network, ticket, stack); - return !MinecraftForge.EVENT_BUS.post(event) && network.syphon(event.getTicket(),true) >= ticket.getAmount(); + return !MinecraftForge.EVENT_BUS.post(event) && network.syphon(event.getTicket(), true) >= ticket.getAmount(); } /** diff --git a/src/main/java/WayofTime/bloodmagic/util/helper/PlayerSacrificeHelper.java b/src/main/java/WayofTime/bloodmagic/util/helper/PlayerSacrificeHelper.java index 1fc54b05..6498132d 100644 --- a/src/main/java/WayofTime/bloodmagic/util/helper/PlayerSacrificeHelper.java +++ b/src/main/java/WayofTime/bloodmagic/util/helper/PlayerSacrificeHelper.java @@ -35,7 +35,7 @@ public class PlayerSacrificeHelper { amount = amount + Math.min(increment, incenseAddition - amount); setPlayerIncense(player, amount); - if(amount == incenseAddition) { + if (amount == incenseAddition) { IncenseHelper.setMaxIncense(player, incenseAddition); } // System.out.println("Amount of incense: " + amount + ", Increment: " +