Merge branch '1.12' into gate-of-the-fold

This commit is contained in:
Tobias 2020-12-30 20:37:59 +01:00 committed by GitHub
commit 4248d04263
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
124 changed files with 2758 additions and 2716 deletions

View file

@ -1,3 +1,101 @@
------------------------------------------------------
Version 2.4.3
------------------------------------------------------
- Fixed Lava Crystals causing crash when used while not yet bound
- Fixed Teleposers sending entities at the destination position the wrong way
- Fixed Speed Runes not working on Tier 2 altars
- Fixed crash when checking tasks for some entities
- Fixed crash when checking some entities for potion effects
- Re-implemented the Boost potion
- The PR still had TODOs in the description when I merged so this may not be complete yet
------------------------------------------------------
Version 2.4.2
------------------------------------------------------
Now with no guarantees for working textures!
Blood Altar:
- A Blood Altar with a Redstone Lamp below it will now emit a redstone signal upon finishing crafting (#1635)
- Fixed Blood Altar being able to obtain negative progress (#1649)
Living Armor:
- Fixed Storm Trooper Level 4 costing 65 instead of -65 upgrade points (#1631)
Rituals:
- Fixed Ritual of the Eternal Soul (Ritual Stone layout & didn't work) (#1633)
- Fixed Ritual Tinkerer (ritual area is now unique per ritual instance), added the ability to reset the ritual ranges to default (#1636)
Misc:
- Lava Crystals can now set things on fire (#1652)
- Fixed parts of the German translation. Other translations still need to be reworked to accomodate changed translation keys (#1640)
- Fixed Guidebook showing wrong recipes (Rune of Self-Sacrifice instead of others) (#1641)
- Wooden Paths now behave like wood instead of stone (sound & efficient tool) (#1638)
Technical Stuff:
- Fixed Veil of Evil and Ward of Sacrosanctity console spam (which could eventually lead to an out of memory exception) (#1639)
- Fixed GLSL shader compilation errors (affected Mesa driver (AMD GPU) on Linux) (#1624)
- Fixed `/bloodmagic network` command permissions (#1613)
- Fixed a rare crash that could occur when summoning mobs (#1618)
------------------------------------------------------
Version 2.4.1
------------------------------------------------------
Nut was too lazy to create a changelog, it's AEon's turn now!
Changes made from Feb 02 - now (Fill end date in later)
Living Armor:
- Fixed "Soft Fall" not preventing damage
- "Nocturnal Prowess" should not flash anymore
- "Trickshot" now ignores HurtResistanceTime
- "Trickshot" now works properly with sentient arrows
- "Step Assist" does not take effect while sneaking
Sentient Bow:
- Fixed Destructive Will arrows exploding continuously
- Fixed Tipped Arrows getting improved even if no Will can be used
Sigils:
- Buffed "Sigil of the Fast Miner" to be in accordance to the "Sanguine Scientium"
- Fixed a bug where "Sigil of the Fast Miner" would also cause the whirlwind effect
- Added "Whirlwind" to the potion registry
- Fixed broken Sigil tooltip formatting
- Fixed Sigil of Holding not updating some Sigil data, allowing for exploits
- Greatly improved "Sigil of Compression" performance
- Fixed "Sigil of Compression" bug that would eat leftover items (usually everything between 55 and 64 items for a 3x3 compression)
Rituals:
- Ported Veil of Evil & Ward of Sacrosanctity
- Fixed "Serenade of the Nether" replacing lava source blocks with lava (fixed underlying function to detect flowing liquids)
- Added configurability to Ritual of the High Jump by modifying a new ritual area with the Ritual Tinkerer
Misc:
- Fixed routing node oredict filter (crashes)
- Fixed mimic vanishing in some cases
- Fixed "Blood Letter's Pack" and "Coat of Arms" always being used in the main hand slot (action bar/hotbar)
- Stop insertions into Demon Crucible if the inventory is not empty
- Fixed abnormal deaths at your own hands through the sacrificial dagger (hopefully) (Gravestone bugginess)
- Fixed "Unmending" mod incompatibility
- Fixed Teleposers crashing the game if someone force-fed it junk
- added Nut being angery at contributors for messing stuff up
- Added some Russian language strings for the guide book
- Added repair recipes for Sentient Tools & Living Armor to JEI
- Many translation keys have changed which makes affected translations fall back to english
Technical Stuff no player cares about:
- Formatted Project code
- Fixed BlockState parsing (mimic vanishing)
- Fixed some and streamlined ritual block ranges
- Mystery drain still mysterious
- Use TextFormatting rather than color codes in block lang names
- Fixed world unload crash (may happen if a world is loaded by world generators or JEI Resource graphing)
- Fixed `/bloodmagic network get` command
- Added translation keys for tickethistory command help strings
------------------------------------------------------
Version 2.4.0
------------------------------------------------------
@ -1107,4 +1205,4 @@ Changed
- A graphical overhaul of everything has been implemented. These textures were provided by CyanideX's Unity texture pack. BBoldt and Yulife (Inap) from the Unity team are our new permanent texture artists.
Bug Fixes
-
-

View file

@ -1,6 +1,6 @@
mod_name=BloodMagic
package_group=com.wayoftime.bloodmagic
mod_version=2.4.0
mod_version=2.4.3
mc_version=1.12.2
forge_version=14.23.5.2808
curse_id=224791

View file

@ -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,
;
}
}
}

View file

@ -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<EntityMob> 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);
}

View file

@ -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<EntityPlayer> 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);
}
}

View file

@ -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);
}
}

View file

@ -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<EntityItem> itemList = world.getEntitiesWithinAABB(EntityItem.class, itemDescriptor.getAABB(pos));
List<ItemStack> inputList = new ArrayList<ItemStack>();
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<EntityLivingBase> 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);
}
}

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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<AltarComponent> altarComponents;

View file

@ -3,17 +3,20 @@ package WayofTime.bloodmagic.altar;
import WayofTime.bloodmagic.api.event.BloodMagicCraftedEvent;
import WayofTime.bloodmagic.api.impl.BloodMagicAPI;
import WayofTime.bloodmagic.api.impl.recipe.RecipeBloodAltar;
import WayofTime.bloodmagic.block.BlockAltar;
import WayofTime.bloodmagic.block.BlockLifeEssence;
import WayofTime.bloodmagic.block.enums.BloodRuneType;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.data.Binding;
import WayofTime.bloodmagic.core.data.SoulTicket;
import WayofTime.bloodmagic.iface.IBindable;
import WayofTime.bloodmagic.util.Constants;
import WayofTime.bloodmagic.orb.BloodOrb;
import WayofTime.bloodmagic.orb.IBloodOrb;
import WayofTime.bloodmagic.util.helper.NetworkHelper;
import WayofTime.bloodmagic.block.BlockLifeEssence;
import WayofTime.bloodmagic.tile.TileAltar;
import WayofTime.bloodmagic.util.Constants;
import WayofTime.bloodmagic.util.helper.NetworkHelper;
import com.google.common.base.Enums;
import net.minecraft.block.BlockRedstoneLight;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -31,8 +34,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 +71,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 +119,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 +162,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 +176,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 +189,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 +199,7 @@ public class BloodAltar implements IFluidHandler
isActive = false;
}
public void update()
{
public void update() {
World world = tileAltar.getWorld();
BlockPos pos = tileAltar.getPos();
@ -220,17 +212,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 +234,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;
@ -254,23 +242,27 @@ public class BloodAltar implements IFluidHandler
tileAltar.getWorld().notifyBlockUpdate(tileAltar.getPos(), tileAltar.getWorld().getBlockState(tileAltar.getPos()), tileAltar.getWorld().getBlockState(tileAltar.getPos()), 3);
}
if (internalCounter % 100 == 0 && (this.isActive || this.cooldownAfterCrafting <= 0))
if (internalCounter % 100 == 0 && (this.isActive || this.cooldownAfterCrafting <= 0)) {
/* Redstone Lamp below altar: Switch Off */
IBlockState state = world.getBlockState(pos);
if (state.getValue(BlockAltar.POWERED)) {
world.setBlockState(pos, state.cycleProperty(BlockAltar.POWERED), 3);
world.notifyNeighborsOfStateChange(pos, RegistrarBloodMagicBlocks.ALTAR, false);
}
startCycle();
}
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 +278,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,9 +290,8 @@ public class BloodAltar implements IFluidHandler
hasOperated = true;
}
if (fluid != null && fluid.amount >= 1)
{
int liquidDrained = Math.min((int) (altarTier.ordinal() >= 2 ? consumptionRate * (1 + consumptionMultiplier) : consumptionRate), fluid.amount);
if (fluid != null && fluid.amount >= 1) {
int liquidDrained = Math.min((int) (consumptionRate * (1 + consumptionMultiplier)), fluid.amount);
if (liquidDrained > (liquidRequired * stackSize - progress))
liquidDrained = liquidRequired * stackSize - progress;
@ -312,27 +301,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)
{
progress -= (int) (efficiencyMultiplier * drainRate);
} else if (!hasOperated && progress > 0) {
progress = Math.max(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,18 +324,23 @@ 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);
}
/* Redstone Lamp below altar: Switch On */
/* Switches on when crafting finishes */
if (world.getBlockState(pos.down()).getBlock() instanceof BlockRedstoneLight) {
world.setBlockState(pos, world.getBlockState(pos).cycleProperty(BlockAltar.POWERED), 3);
world.notifyNeighborsOfStateChange(pos, RegistrarBloodMagicBlocks.ALTAR, false);
}
this.cooldownAfterCrafting = 30;
this.isActive = false;
}
}
} else
{
} else {
ItemStack contained = tileAltar.getStackInSlot(0);
if (contained.isEmpty() || !(contained.getItem() instanceof IBloodOrb) || !(contained.getItem() instanceof IBindable))
@ -363,14 +352,12 @@ public class BloodAltar implements IFluidHandler
if (binding == null || orb == null)
return;
if (fluid != null && fluid.amount >= 1)
{
int liquidDrained = Math.min((int) (altarTier.ordinal() >= 2 ? orb.getFillRate() * (1 + consumptionMultiplier) : orb.getFillRate()), fluid.amount);
if (fluid != null && fluid.amount >= 1) {
int liquidDrained = Math.min((int) (orb.getFillRate() * (1 + consumptionMultiplier)), 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 +367,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 +376,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 +392,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 +422,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 +526,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 +606,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;
}
}

View file

@ -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;

View file

@ -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<RecipeBloodAltar> altarRecipes;
private final Set<RecipeAlchemyTable> alchemyRecipes;
@ -36,8 +35,7 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar
private final Set<RecipeAlchemyArray> alchemyArrayRecipes;
private final Set<RecipeSacrificeCraft> 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<Ingredient> 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<Ingredient> 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<Ingredient> 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<ItemStack> input)
{
public RecipeAlchemyTable getAlchemyTable(@Nonnull List<ItemStack> 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<Ingredient> 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<ItemStack> input)
{
public RecipeTartaricForge getTartaricForge(@Nonnull List<ItemStack> 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<Ingredient> 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<ItemStack> input)
{
public RecipeSacrificeCraft getSacrificeCraft(@Nonnull List<ItemStack> 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<Ingredient> 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<RecipeBloodAltar> getAltarRecipes()
{
public Set<RecipeBloodAltar> getAltarRecipes() {
return ImmutableSet.copyOf(altarRecipes);
}
public Set<RecipeAlchemyTable> getAlchemyRecipes()
{
public Set<RecipeAlchemyTable> getAlchemyRecipes() {
return ImmutableSet.copyOf(alchemyRecipes);
}
public Set<RecipeTartaricForge> getTartaricForgeRecipes()
{
public Set<RecipeTartaricForge> getTartaricForgeRecipes() {
return ImmutableSet.copyOf(tartaricForgeRecipes);
}
public Set<RecipeAlchemyArray> getAlchemyArrayRecipes()
{
public Set<RecipeAlchemyArray> getAlchemyArrayRecipes() {
return ImmutableSet.copyOf(alchemyArrayRecipes);
}
}

View file

@ -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<Ingredient> input;
@Nonnull
@ -17,8 +16,7 @@ public class RecipeSacrificeCraft
@Nonnegative
private final double healthRequired;
public RecipeSacrificeCraft(@Nonnull NonNullList<Ingredient> input, @Nonnull ItemStack output, @Nonnegative double healthRequired)
{
public RecipeSacrificeCraft(@Nonnull NonNullList<Ingredient> 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<Ingredient> getInput()
{
public final NonNullList<Ingredient> 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;
}
}

View file

@ -18,7 +18,10 @@ import WayofTime.bloodmagic.util.Utils;
import WayofTime.bloodmagic.util.helper.NetworkHelper;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
@ -39,10 +42,13 @@ import java.util.ArrayList;
import java.util.List;
public class BlockAltar extends Block implements IVariantProvider, IDocumentedBlock, IBMBlock {
public static final PropertyBool POWERED = PropertyBool.create("powered");
private static final AxisAlignedBB BODY = new AxisAlignedBB(0, 0, 0, 16 / 16F, 12 / 16F, 16 / 16F);
public BlockAltar() {
super(Material.ROCK);
this.setDefaultState(this.blockState.getBaseState().withProperty(POWERED, false));
setTranslationKey(BloodMagic.MODID + ".altar");
setCreativeTab(BloodMagic.TAB_BM);
@ -180,4 +186,39 @@ public class BlockAltar extends Block implements IVariantProvider, IDocumentedBl
public ItemBlock getItem() {
return new ItemBlock(this);
}
/* Redstone code, taken from BlockLever */
public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
return blockState.getValue(POWERED) ? 15 : 0;
}
public int getStrongPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
if (!blockState.getValue(POWERED)) {
return 0;
} else {
return 15;
}
}
public boolean canProvidePower(IBlockState state) {
return true;
}
public IBlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(POWERED, meta > 0);
}
public int getMetaFromState(IBlockState state) {
return state.getValue(POWERED) ? 1 : 0;
}
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, POWERED);
}
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
return this.getDefaultState().withProperty(POWERED, false);
}
}

View file

@ -24,7 +24,7 @@ public class BlockDecorative extends BlockEnum<EnumDecorative> {
@Override
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> 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()));

View file

@ -219,7 +219,7 @@ public class BlockMimic extends BlockEnum<EnumMimic> implements IAltarComponent
}
return null;
}
@Override
public ItemBlock getItem() {
return new ItemBlockMimic(this);

View file

@ -9,10 +9,12 @@ import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import javax.annotation.Nullable;
import java.util.List;
public class BlockPath extends BlockEnum<EnumPath> implements IIncensePath {
@ -26,14 +28,14 @@ public class BlockPath extends BlockEnum<EnumPath> implements IIncensePath {
setResistance(5.0F);
setSoundType(SoundType.STONE);
setHarvestLevel("axe", 0, getStateFromMeta(0));
setHarvestLevel("axe", 0, getStateFromMeta(1));
setHarvestLevel("pickaxe", 0, getStateFromMeta(2));
setHarvestLevel("pickaxe", 0, getStateFromMeta(3));
setHarvestLevel("pickaxe", 0, getStateFromMeta(4));
setHarvestLevel("pickaxe", 0, getStateFromMeta(5));
setHarvestLevel("pickaxe", 3, getStateFromMeta(6));
setHarvestLevel("pickaxe", 3, getStateFromMeta(7));
setHarvestLevel("axe", 0, getDefaultState().withProperty(getProperty(), EnumPath.WOOD));
setHarvestLevel("axe", 0, getDefaultState().withProperty(getProperty(), EnumPath.WOODTILE));
setHarvestLevel("pickaxe", 0, getDefaultState().withProperty(getProperty(), EnumPath.STONE));
setHarvestLevel("pickaxe", 0, getDefaultState().withProperty(getProperty(), EnumPath.STONETILE));
setHarvestLevel("pickaxe", 0, getDefaultState().withProperty(getProperty(), EnumPath.WORNSTONE));
setHarvestLevel("pickaxe", 0, getDefaultState().withProperty(getProperty(), EnumPath.WORNSTONETILE));
setHarvestLevel("pickaxe", 3, getDefaultState().withProperty(getProperty(), EnumPath.OBSIDIAN));
setHarvestLevel("pickaxe", 3, getDefaultState().withProperty(getProperty(), EnumPath.OBSIDIANTILE));
}
@Override
@ -42,6 +44,24 @@ public class BlockPath extends BlockEnum<EnumPath> implements IIncensePath {
super.addInformation(stack, world, tooltip, tooltipFlag);
}
@Override
public Material getMaterial(IBlockState state) {
EnumPath path = state.getValue(getProperty());
if (path.equals(EnumPath.WOOD) || path.equals(EnumPath.WOODTILE))
return Material.WOOD;
else
return Material.ROCK;
}
@Override
public SoundType getSoundType(IBlockState state, World world, BlockPos pos, @Nullable Entity entity) {
EnumPath path = state.getValue(getProperty());
if (path.equals(EnumPath.WOOD) || path.equals(EnumPath.WOODTILE))
return SoundType.WOOD;
else
return super.getSoundType();
}
@Override
public int getLevelOfPath(World world, BlockPos pos, IBlockState state) {
switch (this.getMetaFromState(state)) {

View file

@ -7,7 +7,8 @@ import java.util.Locale;
public enum EnumRitualController implements IStringSerializable {
MASTER,
IMPERFECT,
INVERTED,;
INVERTED,
;
@Override
public String toString() {

View file

@ -98,7 +98,8 @@ public class ElementRegistry {
return;
try (FileReader reader = new FileReader(CONFIG)) {
Map<String, Vector2f> toLoad = GSON.fromJson(reader, new TypeToken<Map<String, Vector2f>>() {}.getType());
Map<String, Vector2f> toLoad = GSON.fromJson(reader, new TypeToken<Map<String, Vector2f>>() {
}.getType());
for (Map.Entry<String, Vector2f> entry : toLoad.entrySet()) {
ElementInfo info = ELEMENT_INFO.get(new ResourceLocation(entry.getKey()));
if (info != null)

View file

@ -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")));

View file

@ -55,7 +55,7 @@ public abstract class ElementDivinedInformation<T extends TileEntity> extends El
if (sigilStack.getItem() instanceof ItemSigilHolding) {
List<ItemStack> 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);
}
}

View file

@ -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;

View file

@ -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;
}
}

View file

@ -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;
}

View file

@ -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;

View file

@ -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;

View file

@ -50,6 +50,11 @@ public class SubCommandNetwork extends CommandTreeBase {
public SoulNetwork network;
public String uuid;
@Override
public int getRequiredPermissionLevel() {
return 2;
}
public Integer commandHelperAmount(MinecraftServer server, ICommandSender sender, String[] args) {
int amount;
if (args.length == 0)
@ -85,11 +90,11 @@ public class SubCommandNetwork extends CommandTreeBase {
@Override
public final void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
if (args.length == 1 && (args[0].equals("?") || args[0].equals("help"))) {
sender.sendMessage(new TextComponentTranslation(getHelp()));
return;
}
if (!getName().equals("get")) {
if (args.length == 1 && (args[0].equals("?") || args[0].equals("help"))) {
sender.sendMessage(new TextComponentTranslation(getHelp()));
return;
}
this.player = args.length < 2 ? getCommandSenderAsPlayer(sender) : getPlayer(server, sender, args[0]);
this.uuid = PlayerHelper.getUUIDFromPlayer(player).toString();
this.network = NetworkHelper.getSoulNetwork(uuid);
@ -164,11 +169,9 @@ public class SubCommandNetwork extends CommandTreeBase {
@Override
public void subExecute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
if (args.length == 1 && (args[0].equals("?") || args[0].equals("help"))) {
sender.sendMessage(new TextComponentTranslation(getHelp()));
return;
}
this.player = args.length < 1 ? getCommandSenderAsPlayer(sender) : getPlayer(server, sender, args[0]);
this.uuid = PlayerHelper.getUUIDFromPlayer(player).toString();
this.network = NetworkHelper.getSoulNetwork(uuid);
sender.sendMessage(new TextComponentString((player != sender ? player.getDisplayName().getFormattedText() + " " : "" + new TextComponentTranslation("tooltip.bloodmagic.sigil.divination.currentEssence", network.getCurrentEssence()).getFormattedText())));
}
}
@ -216,7 +219,7 @@ public class SubCommandNetwork extends CommandTreeBase {
@Override
public void subExecute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
List<SoulTicket> tickethistory = network.getTicketHistory();
if (tickethistory.isEmpty())
if (!tickethistory.isEmpty())
for (SoulTicket i : network.getTicketHistory())
sender.sendMessage(i.getDescription());
sender.sendMessage(new TextComponentTranslation("commands.bloodmagic.success", player.getDisplayName().getFormattedText()));

View file

@ -49,6 +49,7 @@ public class SubCommandRitual extends CommandTreeBase {
class RitualCreate extends CommandTreeBase {
public List<String> ritualList = new ArrayList<>();
public RitualCreate() {
for (Ritual ritual : BloodMagic.RITUAL_MANAGER.getRituals()) {
ritualList.add(BloodMagic.RITUAL_MANAGER.getId(ritual));

View file

@ -1,12 +1,12 @@
package WayofTime.bloodmagic.compat.guideapi.book;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.recipe.TartaricForgeRecipe;
import WayofTime.bloodmagic.compat.guideapi.BookUtils;
import WayofTime.bloodmagic.compat.guideapi.entry.EntryText;
import WayofTime.bloodmagic.compat.guideapi.page.PageAlchemyArray;
import WayofTime.bloodmagic.compat.guideapi.page.PageTartaricForgeRecipe;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.recipe.TartaricForgeRecipe;
import WayofTime.bloodmagic.util.helper.RecipeHelper;
import WayofTime.bloodmagic.util.helper.TextHelper;
import amerifrance.guideapi.api.IPage;
@ -63,6 +63,20 @@ public class CategoryAlchemy
speedPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "speed" + ".info"), 370));
entries.put(new ResourceLocation(keyBase + "speed"), new EntryText(speedPages, TextHelper.localize(keyBase + "speed"), true));
List<IPage> buffPages = new ArrayList<>();
buffPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "buff" + ".info"), 370));
entries.put(new ResourceLocation(keyBase + "buff"), new EntryText(buffPages, TextHelper.localize(keyBase + "buff"), true));
List<IPage> fastMinerPages = new ArrayList<>();
PageAlchemyArray fastMinerRecipePage = BookUtils.getAlchemyPage("fastMiner");
if (fastMinerRecipePage != null) {
fastMinerPages.add(fastMinerRecipePage);
}
fastMinerPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "fastMiner" + ".info"), 370));
entries.put(new ResourceLocation(keyBase + "fastMiner"), new EntryText(fastMinerPages, TextHelper.localize(keyBase + "fastMiner"), true));
List<IPage> updraftPages = new ArrayList<>();
PageAlchemyArray updraftRecipePage = BookUtils.getAlchemyPage("updraft");
@ -123,21 +137,6 @@ public class CategoryAlchemy
laputaPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "laputa" + ".info"), 370));
entries.put(new ResourceLocation(keyBase + "laputa"), new EntryText(laputaPages, TextHelper.localize(keyBase + "laputa"), true));
List<IPage> buffPages = new ArrayList<>();
buffPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "buff" + ".info"), 370));
entries.put(new ResourceLocation(keyBase + "buff"), new EntryText(buffPages, TextHelper.localize(keyBase + "buff"), true));
List<IPage> fastMinerPages = new ArrayList<>();
PageAlchemyArray fastMinerRecipePage = BookUtils.getAlchemyPage("fastMiner");
if (fastMinerRecipePage != null)
{
fastMinerPages.add(fastMinerRecipePage);
}
fastMinerPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "fastMiner" + ".info"), 370));
entries.put(new ResourceLocation(keyBase + "fastMiner"), new EntryText(fastMinerPages, TextHelper.localize(keyBase + "fastMiner"), true));
for (Entry<ResourceLocation, EntryAbstract> entry : entries.entrySet())
{
for (IPage page : entry.getValue().pageList)

View file

@ -1,9 +1,6 @@
package WayofTime.bloodmagic.compat.guideapi.book;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.recipe.TartaricForgeRecipe;
import WayofTime.bloodmagic.core.registry.AltarRecipeRegistry.AltarRecipe;
import WayofTime.bloodmagic.core.registry.OrbRegistry;
import WayofTime.bloodmagic.compat.guideapi.BookUtils;
import WayofTime.bloodmagic.compat.guideapi.entry.EntryText;
import WayofTime.bloodmagic.compat.guideapi.page.PageAlchemyArray;
@ -12,7 +9,10 @@ import WayofTime.bloodmagic.compat.guideapi.page.PageTartaricForgeRecipe;
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.registry.AltarRecipeRegistry.AltarRecipe;
import WayofTime.bloodmagic.core.registry.OrbRegistry;
import WayofTime.bloodmagic.item.types.ComponentTypes;
import WayofTime.bloodmagic.recipe.TartaricForgeRecipe;
import WayofTime.bloodmagic.util.helper.RecipeHelper;
import WayofTime.bloodmagic.util.helper.TextHelper;
import amerifrance.guideapi.api.IPage;
@ -60,6 +60,16 @@ public class CategoryArchitect
altarPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "bloodaltar" + ".info.2"), 370));
entries.put(new ResourceLocation(keyBase + "bloodaltar"), new EntryText(altarPages, TextHelper.localize(keyBase + "bloodaltar"), true));
List<IPage> daggerPages = new ArrayList<>();
AltarRecipe daggerOfSacrificeRecipe = RecipeHelper.getAltarRecipeForOutput(new ItemStack(RegistrarBloodMagicItems.DAGGER_OF_SACRIFICE));
if (daggerOfSacrificeRecipe != null) {
daggerPages.add(new PageAltarRecipe(daggerOfSacrificeRecipe));
}
daggerPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "dagger" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "dagger"), new EntryText(daggerPages, TextHelper.localize(keyBase + "dagger"), true));
List<IPage> ashPages = new ArrayList<>();
TartaricForgeRecipe ashRecipe = RecipeHelper.getForgeRecipeForOutput(new ItemStack(RegistrarBloodMagicItems.ARCANE_ASHES));
@ -206,17 +216,6 @@ public class CategoryArchitect
apprenticeorbPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "apprenticeorb" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "apprenticeorb"), new EntryText(apprenticeorbPages, TextHelper.localize(keyBase + "apprenticeorb"), true));
List<IPage> daggerPages = new ArrayList<>();
AltarRecipe daggerOfSacrificeRecipe = RecipeHelper.getAltarRecipeForOutput(new ItemStack(RegistrarBloodMagicItems.DAGGER_OF_SACRIFICE));
if (daggerOfSacrificeRecipe != null)
{
daggerPages.add(new PageAltarRecipe(daggerOfSacrificeRecipe));
}
daggerPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "dagger" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "dagger"), new EntryText(daggerPages, TextHelper.localize(keyBase + "dagger"), true));
List<IPage> runeSacrificePages = new ArrayList<>();
IRecipe runeSacrificeRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(RegistrarBloodMagicBlocks.BLOOD_RUNE, 1, 3));
@ -359,7 +358,7 @@ public class CategoryArchitect
List<IPage> capacityPages = new ArrayList<>();
IRecipe capacityRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(RegistrarBloodMagicBlocks.BLOOD_RUNE, 1, 4));
IRecipe capacityRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(RegistrarBloodMagicBlocks.BLOOD_RUNE, 1, 6));
if (capacityRecipe != null)
{
capacityPages.add(BookUtils.getPageForRecipe(capacityRecipe));
@ -370,7 +369,7 @@ public class CategoryArchitect
List<IPage> displacementPages = new ArrayList<>();
IRecipe displacementRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(RegistrarBloodMagicBlocks.BLOOD_RUNE, 1, 4));
IRecipe displacementRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(RegistrarBloodMagicBlocks.BLOOD_RUNE, 1, 5));
if (displacementRecipe != null)
{
displacementPages.add(BookUtils.getPageForRecipe(displacementRecipe));
@ -486,6 +485,41 @@ public class CategoryArchitect
downgradePages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "downgrade" + ".info"), 370));
entries.put(new ResourceLocation(keyBase + "downgrade"), new EntryText(downgradePages, TextHelper.localize(keyBase + "downgrade"), true));
List<IPage> boundBladePages = new ArrayList<>();
PageAlchemyArray boundBladePage = BookUtils.getAlchemyPage(new ItemStack(RegistrarBloodMagicItems.BOUND_SWORD));
if (boundBladePage != null) {
boundBladePages.add(boundBladePage);
}
boundBladePages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "boundBlade" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "boundBlade"), new EntryText(boundBladePages, TextHelper.localize(keyBase + "boundBlade"), true));
List<IPage> boundToolPages = new ArrayList<>();
PageAlchemyArray boundToolPage = BookUtils.getAlchemyPage(new ItemStack(RegistrarBloodMagicItems.BOUND_PICKAXE));
if (boundToolPage != null) {
boundToolPages.add(boundToolPage);
}
boundToolPage = BookUtils.getAlchemyPage(new ItemStack(RegistrarBloodMagicItems.BOUND_AXE));
if (boundToolPage != null) {
boundToolPages.add(boundToolPage);
}
boundToolPage = BookUtils.getAlchemyPage(new ItemStack(RegistrarBloodMagicItems.BOUND_SHOVEL));
if (boundToolPage != null) {
boundToolPages.add(boundToolPage);
}
boundToolPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "boundTool" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "boundTool"), new EntryText(boundToolPages, TextHelper.localize(keyBase + "boundTool"), true));
List<IPage> weakShardPages = new ArrayList<>();
weakShardPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "weakShard" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "weakShard"), new EntryText(weakShardPages, TextHelper.localize(keyBase + "weakShard"), true));
List<IPage> teleposerPages = new ArrayList<>();
AltarRecipe teleposerFocusRecipe = RecipeHelper.getAltarRecipeForOutput(new ItemStack(RegistrarBloodMagicItems.TELEPOSITION_FOCUS));
@ -503,45 +537,6 @@ public class CategoryArchitect
teleposerPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "teleposer" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "teleposer"), new EntryText(teleposerPages, TextHelper.localize(keyBase + "teleposer"), true));
List<IPage> boundBladePages = new ArrayList<>();
PageAlchemyArray boundBladePage = BookUtils.getAlchemyPage(new ItemStack(RegistrarBloodMagicItems.BOUND_SWORD));
if (boundBladePage != null)
{
boundBladePages.add(boundBladePage);
}
boundBladePages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "boundBlade" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "boundBlade"), new EntryText(boundBladePages, TextHelper.localize(keyBase + "boundBlade"), true));
List<IPage> boundToolPages = new ArrayList<>();
PageAlchemyArray boundToolPage = BookUtils.getAlchemyPage(new ItemStack(RegistrarBloodMagicItems.BOUND_PICKAXE));
if (boundToolPage != null)
{
boundToolPages.add(boundToolPage);
}
boundToolPage = BookUtils.getAlchemyPage(new ItemStack(RegistrarBloodMagicItems.BOUND_AXE));
if (boundToolPage != null)
{
boundToolPages.add(boundToolPage);
}
boundToolPage = BookUtils.getAlchemyPage(new ItemStack(RegistrarBloodMagicItems.BOUND_SHOVEL));
if (boundToolPage != null)
{
boundToolPages.add(boundToolPage);
}
boundToolPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "boundTool" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "boundTool"), new EntryText(boundToolPages, TextHelper.localize(keyBase + "boundTool"), true));
List<IPage> weakShardPages = new ArrayList<>();
weakShardPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "weakShard" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "weakShard"), new EntryText(weakShardPages, TextHelper.localize(keyBase + "weakShard"), true));
List<IPage> masterOrbPages = new ArrayList<>();
AltarRecipe masterOrbRecipe = RecipeHelper.getAltarRecipeForOutput(OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_MASTER));

View file

@ -131,6 +131,8 @@ public class CategoryRitual
addRitualPagesToEntries("condor", entries);
addRitualPagesToEntries("featheredEarth", entries);
addRitualPagesToEntries("grounding", entries);
addRitualPagesToEntries("veilOfEvil", entries);
addRitualPagesToEntries("wardOfSacrosanctity", entries);
for (Entry<ResourceLocation, EntryAbstract> entry : entries.entrySet())
{

View file

@ -34,9 +34,15 @@ import WayofTime.bloodmagic.util.Constants;
import WayofTime.bloodmagic.util.helper.ItemHelper.LivingUpgrades;
import mezz.jei.api.*;
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.IVanillaRecipeFactory;
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@JEIPlugin
@ -58,6 +64,8 @@ public class BloodMagicJEIPlugin implements IModPlugin {
registry.addRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAlchemyRecipes(), Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE);
registry.addRecipes(AlchemyTableRecipeRegistry.getRecipeList(), Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE);
registry.addRecipes(getAnvilRecipes(), VanillaRecipeCategoryUid.ANVIL);
registry.handleRecipes(RecipeBloodAltar.class, AltarRecipeJEI::new, Constants.Compat.JEI_CATEGORY_ALTAR);
registry.handleRecipes(RecipeTartaricForge.class, TartaricForgeRecipeJEI::new, Constants.Compat.JEI_CATEGORY_SOULFORGE);
registry.handleRecipes(RecipeAlchemyArray.class, AlchemyArrayCraftingRecipeJEI::new, Constants.Compat.JEI_CATEGORY_ALCHEMYARRAY);
@ -127,4 +135,98 @@ public class BloodMagicJEIPlugin implements IModPlugin {
new ArmourDowngradeRecipeCategory()
);
}
public Collection<IRecipeWrapper> getAnvilRecipes() {
IVanillaRecipeFactory vanillaRecipeFactory = jeiHelper.getVanillaRecipeFactory();
/* Sentient Tool repair recipes */
List<ItemStack> outputSwords = new LinkedList<>();
List<ItemStack> outputPickaxes = new LinkedList<>();
List<ItemStack> outputAxes = new LinkedList<>();
List<ItemStack> outputBows = new LinkedList<>();
List<ItemStack> outputShovels = new LinkedList<>();
List<ItemStack> inputRightSentient = new LinkedList<>();
List<List<ItemStack>> sentientOutputs = new LinkedList<>();
List<ItemStack> sentientTools = new LinkedList<>();
sentientTools.add(new ItemStack(RegistrarBloodMagicItems.SENTIENT_AXE));
sentientTools.add(new ItemStack(RegistrarBloodMagicItems.SENTIENT_PICKAXE));
sentientTools.add(new ItemStack(RegistrarBloodMagicItems.SENTIENT_BOW));
sentientTools.add(new ItemStack(RegistrarBloodMagicItems.SENTIENT_SHOVEL));
sentientTools.add(new ItemStack(RegistrarBloodMagicItems.SENTIENT_SWORD));
for (int i = 4; i > 0; i--) {
for (ItemStack j : sentientTools) {
int maxDmg = j.getMaxDamage();
j.setItemDamage(maxDmg - (maxDmg / 4) * i);
}
outputAxes.add(sentientTools.get(0).copy());
outputPickaxes.add(sentientTools.get(1).copy());
outputBows.add(sentientTools.get(2).copy());
outputShovels.add(sentientTools.get(3).copy());
outputSwords.add(sentientTools.get(4).copy());
inputRightSentient.add(new ItemStack(RegistrarBloodMagicItems.ITEM_DEMON_CRYSTAL, i));
}
sentientOutputs.add(outputAxes);
sentientOutputs.add(outputPickaxes);
sentientOutputs.add(outputBows);
sentientOutputs.add(outputShovels);
sentientOutputs.add(outputSwords);
Collection<IRecipeWrapper> collection = new LinkedList<>();
for (int i = 0; i < 5; i++) {
ItemStack inputLeft = sentientTools.get(i);
inputLeft.setItemDamage(inputLeft.getMaxDamage());
collection.add(vanillaRecipeFactory.createAnvilRecipe(inputLeft, inputRightSentient, sentientOutputs.get(i)));
}
/* Living Armor repair recipes */
List<ItemStack> outputHelmets = new LinkedList<>();
List<ItemStack> outputChestplates = new LinkedList<>();
List<ItemStack> outputLeggings = new LinkedList<>();
List<ItemStack> outputBoots = new LinkedList<>();
List<ItemStack> inputRightLiving = new LinkedList<>();
List<List<ItemStack>> livingOutputs = new LinkedList<>();
List<ItemStack> livingTools = new LinkedList<>();
livingTools.add(new ItemStack(RegistrarBloodMagicItems.LIVING_ARMOUR_HELMET));
livingTools.add(new ItemStack(RegistrarBloodMagicItems.LIVING_ARMOUR_CHEST));
livingTools.add(new ItemStack(RegistrarBloodMagicItems.LIVING_ARMOUR_LEGGINGS));
livingTools.add(new ItemStack(RegistrarBloodMagicItems.LIVING_ARMOUR_BOOTS));
for (int i = 4; i > 0; i--) {
for (ItemStack j : livingTools) {
int maxDmg = j.getMaxDamage();
j.setItemDamage(maxDmg - (maxDmg / 4) * i);
}
outputHelmets.add(livingTools.get(0).copy());
outputChestplates.add(livingTools.get(1).copy());
outputLeggings.add(livingTools.get(2).copy());
outputBoots.add(livingTools.get(3).copy());
inputRightLiving.add(new ItemStack(RegistrarBloodMagicItems.COMPONENT, i, 8));
}
livingOutputs.add(outputHelmets);
livingOutputs.add(outputChestplates);
livingOutputs.add(outputLeggings);
livingOutputs.add(outputBoots);
for (int i = 0; i < 4; i++) {
ItemStack inputLeft = livingTools.get(i);
inputLeft.setItemDamage(inputLeft.getMaxDamage());
collection.add(vanillaRecipeFactory.createAnvilRecipe(inputLeft, inputRightLiving, livingOutputs.get(i)));
}
return collection;
}
}

View file

@ -13,6 +13,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
@ -25,7 +26,7 @@ public class DataProviderAlchemyArray implements IWailaDataProvider {
@Nonnull
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return new ItemStack(RegistrarBloodMagicItems.ARCANE_ASHES).setStackDisplayName(TextHelper.getFormattedText(RegistrarBloodMagicBlocks.ALCHEMY_ARRAY.getLocalizedName()));
return new ItemStack(RegistrarBloodMagicItems.ARCANE_ASHES).setStackDisplayName(TextFormatting.WHITE + RegistrarBloodMagicBlocks.ALCHEMY_ARRAY.getLocalizedName());
}
@Nonnull

View file

@ -1,86 +1,12 @@
package WayofTime.bloodmagic.compress;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.Tuple;
import net.minecraft.world.World;
public class AdvancedCompressionHandler extends CompressionHandler {
private static InventoryCrafting[] inventoryCrafting = {
new InventoryCrafting(new Container() {
public boolean canInteractWith(EntityPlayer player) {
return false;
}
},
3, 3),
new InventoryCrafting(new Container() {
public boolean canInteractWith(EntityPlayer player) {
return false;
}
},
2, 2),
new InventoryCrafting(new Container() {
public boolean canInteractWith(EntityPlayer player) {
return false;
}
},
1, 1)
};
private static ItemStack reversibleCheck;
public static boolean isResultStackReversible(ItemStack stack, World world) {
if (stack.isEmpty()) {
return false;
}
inventoryCrafting[2].setInventorySlotContents(0, stack);
ItemStack returnStack = getNNRecipeOutput(inventoryCrafting[2], world);
return !returnStack.isEmpty() && CompressionRegistry.areItemStacksEqual(reversibleCheck, returnStack);
}
public static ItemStack getRecipe(ItemStack stack, World world, int gridSize) {
StorageBlockCraftingManager craftingManagerSB = StorageBlockCraftingManager.getInstance();
InventoryCrafting inventory = inventoryCrafting[3 - gridSize];
for (int i = 0; i < inventory.getSizeInventory(); i++) {
inventory.setInventorySlotContents(i, stack);
}
ItemStack notEmptyRecipe = craftingManagerSB.findMatchingRecipe(inventory, world);
if (!notEmptyRecipe.isEmpty()) {
return notEmptyRecipe;
}
ItemStack result = getNNRecipeOutput(inventory, world);
if (isResultStackReversible(result, world)) {
craftingManagerSB.addRecipe(CraftingManager.findMatchingRecipe(inventory, world));
return result;
}
return ItemStack.EMPTY;
}
public static ItemStack getNNRecipeOutput(InventoryCrafting inventory, World world) {
IRecipe checkForNull = CraftingManager.findMatchingRecipe(inventory, world);
if (checkForNull != null) {
return checkForNull.getRecipeOutput();
}
return ItemStack.EMPTY;
}
public static ItemStack get22Recipe(ItemStack stack, World world) {
return getRecipe(stack, world, 2);
}
public static ItemStack get33Recipe(ItemStack stack, World world) {
return getRecipe(stack, world, 3);
}
public ItemStack compressInventory(ItemStack[] inv, World world) {
for (ItemStack invStack : inv) {
if (invStack.isEmpty()) {
@ -88,12 +14,26 @@ public class AdvancedCompressionHandler extends CompressionHandler {
}
for (int i = 3; i >= 2; i--) {
reversibleCheck = invStack;
ItemStack stack = getRecipe(invStack, world, i);
ItemStack invStackCopy = invStack.copy();
invStackCopy.setCount(1);
Tuple<ItemStack, Integer> stackTuple = CompressionRegistry.compressionMap.get(invStackCopy);
ItemStack stack;
if (stackTuple == null) {
StorageBlockCraftingManager.reversibleCheck = invStack;
stack = StorageBlockCraftingManager.getRecipe(invStack, world, i);
if (stack.isEmpty())
continue;
CompressionRegistry.compressionMap.put(invStackCopy, new Tuple<>(stack, i * i));
} else {
stack = stackTuple.getFirst();
if (stackTuple.getSecond() != i * i)
return ItemStack.EMPTY;
}
if (!stack.isEmpty()) {
int needed = (i == 2 ? 4 : 9);
int remaining = iterateThroughInventory(invStack, invStack.getMaxStackSize() - needed, inv, needed, true); // if more than needed gets consumed at any point, the simulate test was needed after all
int remaining = iterateThroughInventory(invStack, CompressionRegistry.getItemThreshold(invStack, needed), inv, needed, true);
if (remaining <= 0)
return stack;
}

View file

@ -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() {

View file

@ -3,6 +3,9 @@ package WayofTime.bloodmagic.compress;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import java.util.HashSet;
import java.util.Set;
public abstract class CompressionHandler {
/**
* Called to look at the inventory and syphons the required stack. Returns
@ -14,7 +17,9 @@ public abstract class CompressionHandler {
public abstract ItemStack compressInventory(ItemStack[] inv, World world);
public int iterateThroughInventory(ItemStack required, int kept, ItemStack[] inv, int needed, boolean doDrain) {
int oldNeeded = needed;
int i = -1;
Set<Integer> consumeSet = new HashSet<>();
for (ItemStack invStack : inv) {
i++;
@ -31,26 +36,32 @@ public abstract class CompressionHandler {
used += stackSize - remainingFromStack;
}
kept -= used; // 0
kept -= used;
if (kept <= 0 && needed > 0) {
int remainingFromStack = Math.max(stackSize - used - needed, 0);
if (doDrain) {
needed -= (stackSize - used - remainingFromStack);
if (needed != 0 && needed < oldNeeded) {
consumeSet.add(i);
}
if (doDrain && (!(needed < oldNeeded) || needed == 0)) {
invStack.setCount(remainingFromStack + used);
for (Integer j : consumeSet) {
inv[j].setCount(0);
inv[j] = ItemStack.EMPTY;
}
consumeSet.clear();
if (invStack.isEmpty()) {
inv[i] = ItemStack.EMPTY;
}
}
needed -= (stackSize - used - remainingFromStack);
}
if (needed <= 0) {
return 0;
}
}
}
return needed;

View file

@ -3,6 +3,7 @@ package WayofTime.bloodmagic.compress;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Tuple;
import net.minecraft.world.World;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
@ -18,8 +19,9 @@ import java.util.Map;
* form.
*/
public class CompressionRegistry {
public static List<CompressionHandler> compressionRegistry = new ArrayList<>();
private static List<CompressionHandler> compressionRegistry = new ArrayList<>();
public static Map<ItemStack, Integer> thresholdMap = new HashMap<>();
static Map<ItemStack, Tuple<ItemStack, Integer>> compressionMap = new HashMap<>();
public static void registerHandler(CompressionHandler handler) {
compressionRegistry.add(handler);
@ -77,10 +79,24 @@ public class CompressionRegistry {
return Pair.of(ItemStack.EMPTY, false);
}
public static int getItemThreshold(ItemStack stack) {
return stack.getItem().getItemStackLimit(stack); //this should work according to the guide, leaving behind a full stack of the source item (unless otherwise specified with a BaseCompressionHandler recipe)
public static int getItemThreshold(ItemStack stack, int needed) {
Integer threshold = thresholdMap.get(stack);
if (threshold != null)
return threshold;
else
return stack.getMaxStackSize() - needed;
}
public static int getItemThreshold(ItemStack stack) {
Integer threshold = thresholdMap.get(stack);
if (threshold != null)
return threshold;
else
return stack.getMaxStackSize();
}
public static boolean areItemStacksEqual(ItemStack stack, ItemStack compressedStack) {
return stack.isItemEqual(compressedStack) && (stack.getTagCompound() == null ? !compressedStack.hasTagCompound() : stack.getTagCompound().equals(compressedStack.getTagCompound()));
}

View file

@ -6,17 +6,91 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
import java.util.LinkedList;
import java.util.List;
import java.util.HashSet;
import java.util.Set;
public class StorageBlockCraftingManager {
private static final StorageBlockCraftingManager instance = new StorageBlockCraftingManager();
private List<IRecipe> recipes = new LinkedList<>();
private static InventoryCrafting[] inventoryCrafting = {
new InventoryCrafting(new Container() {
public boolean canInteractWith(EntityPlayer player) {
return false;
}
},
3, 3),
new InventoryCrafting(new Container() {
public boolean canInteractWith(EntityPlayer player) {
return false;
}
},
2, 2),
new InventoryCrafting(new Container() {
public boolean canInteractWith(EntityPlayer player) {
return false;
}
},
1, 1)
public void addRecipe(IRecipe recipe){
};
static ItemStack reversibleCheck;
private HashSet<IRecipe> recipes = new HashSet<>(); // TODO: Clear when recipes are reloaded in 1.14
private Set<ItemStack> blacklist = new HashSet<>();
public static boolean isResultStackReversible(ItemStack stack, World world) {
if (stack.isEmpty()) {
return false;
}
inventoryCrafting[2].setInventorySlotContents(0, stack);
ItemStack returnStack = getNNRecipeOutput(inventoryCrafting[2], world);
return !returnStack.isEmpty() && CompressionRegistry.areItemStacksEqual(reversibleCheck, returnStack);
}
public static ItemStack getRecipe(ItemStack stack, World world, int gridSize) {
StorageBlockCraftingManager craftingManagerSB = getInstance();
if (craftingManagerSB.blacklist.contains(stack)) {
return ItemStack.EMPTY;
}
InventoryCrafting inventory = inventoryCrafting[3 - gridSize];
for (int i = 0; i < inventory.getSizeInventory(); i++) {
inventory.setInventorySlotContents(i, stack);
}
ItemStack notEmptyRecipe = craftingManagerSB.findMatchingRecipe(inventory, world);
if (!notEmptyRecipe.isEmpty()) {
return notEmptyRecipe;
}
ItemStack result = getNNRecipeOutput(inventory, world);
if (isResultStackReversible(result, world)) {
craftingManagerSB.addRecipe(CraftingManager.findMatchingRecipe(inventory, world));
return result;
}
craftingManagerSB.blacklist.add(stack);
return ItemStack.EMPTY;
}
public static ItemStack getNNRecipeOutput(InventoryCrafting inventory, World world) {
IRecipe checkForNull = CraftingManager.findMatchingRecipe(inventory, world);
if (checkForNull != null) {
return checkForNull.getRecipeOutput();
}
return ItemStack.EMPTY;
}
public static ItemStack get22Recipe(ItemStack stack, World world) {
return getRecipe(stack, world, 2);
}
public static ItemStack get33Recipe(ItemStack stack, World world) {
return getRecipe(stack, world, 3);
}
public void addRecipe(IRecipe recipe) {
this.recipes.add(recipe);
}
@ -32,7 +106,7 @@ public class StorageBlockCraftingManager {
return this.findMatchingRecipe(craftingInventory, world, this.recipes);
}
private ItemStack findMatchingRecipe(InventoryCrafting craftingInventory, World world, List<IRecipe> list) {
private ItemStack findMatchingRecipe(InventoryCrafting craftingInventory, World world, HashSet<IRecipe> list) {
int i = 0;
ItemStack itemstack = ItemStack.EMPTY;
ItemStack itemstack1 = ItemStack.EMPTY;
@ -67,11 +141,10 @@ public class StorageBlockCraftingManager {
return new ItemStack(itemstack.getItem(), 1, i1);
} else {
for (j = 0; j < list.size(); ++j) {
IRecipe irecipe = list.get(j);
for (IRecipe iRecipe : list) {
if (irecipe.matches(craftingInventory, world)) {
return irecipe.getCraftingResult(craftingInventory);
if (iRecipe.matches(craftingInventory, world)) {
return iRecipe.getCraftingResult(craftingInventory);
}
}
@ -83,62 +156,5 @@ public class StorageBlockCraftingManager {
return instance;
}
private static boolean isResultStackReversible(ItemStack stack, int gridSize, World world, List<IRecipe> list) {
if (stack.isEmpty()) {
return false;
}
InventoryCrafting inventory = new InventoryCrafting(new Container() {
public boolean canInteractWith(EntityPlayer player) {
return false;
}
}, 2, 2);
inventory.setInventorySlotContents(0, stack);
ItemStack returnStack = StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world, list);
if (returnStack.isEmpty()) {
return false;
}
ItemStack compressedStack = ItemStack.EMPTY;
switch (gridSize) {
case 2:
compressedStack = get22Recipe(returnStack, world, list);
break;
case 3:
compressedStack = get33Recipe(returnStack, world, list);
break;
}
return !compressedStack.isEmpty() && CompressionRegistry.areItemStacksEqual(stack, compressedStack);
}
private static ItemStack getRecipe(ItemStack stack, World world, int gridSize, List<IRecipe> list) {
InventoryCrafting inventory = new InventoryCrafting(new Container() {
public boolean canInteractWith(EntityPlayer player) {
return false;
}
}, gridSize, gridSize);
for (int i = 0; i < inventory.getSizeInventory(); i++) {
inventory.setInventorySlotContents(i, stack);
}
return StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world, list);
}
private static boolean has22Recipe(ItemStack stack, World world, List<IRecipe> list) {
return !get22Recipe(stack, world, list).isEmpty();
}
private static ItemStack get22Recipe(ItemStack stack, World world, List<IRecipe> list) {
return getRecipe(stack, world, 2, list);
}
private static boolean has33Recipe(ItemStack stack, World world, List<IRecipe> list) {
return !get33Recipe(stack, world, list).isEmpty();
}
private static ItemStack get33Recipe(ItemStack stack, World world, List<IRecipe> list) {
return getRecipe(stack, world, 3, list);
}
}

View file

@ -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<BloodOrb> BLOOD_ORBS = null;
@SubscribeEvent
public static void registerBloodOrbs(RegistryEvent.Register<BloodOrb> event)
{
public static void registerBloodOrbs(RegistryEvent.Register<BloodOrb> 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<Potion> event)
{
public static void registerPotions(RegistryEvent.Register<Potion> 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<EntityEntry> event)
{
public static void registerEntities(RegistryEvent.Register<EntityEntry> 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<BloodOrb>()
.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");

View file

@ -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<Item> items;
@SubscribeEvent
public static void registerItems(RegistryEvent.Register<Item> event)
{
public static void registerItems(RegistryEvent.Register<Item> 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<String> variants = new Int2ObjectOpenHashMap<>();

View file

@ -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<IRecipe> event)
{
for (int i = 0; i < ItemSoulGem.names.length; i++)
{
for (EnumDemonWillType willType : EnumDemonWillType.values())
{
public static void registerRecipes(RegistryEvent.Register<IRecipe> 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<String> 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<ItemStack> discoveredOres = OreDictionary.getOres(ore);
List<ItemStack> 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);
}
}

View file

@ -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

View file

@ -47,7 +47,8 @@ public class ItemActivationCrystal extends ItemEnum.Variant<ItemActivationCrysta
public enum CrystalType implements ISubItem {
WEAK,
AWAKENED,
CREATIVE,;
CREATIVE,
;
@Nonnull
@Override

View file

@ -3,16 +3,13 @@ package WayofTime.bloodmagic.item;
import WayofTime.bloodmagic.item.types.AlchemicVialType;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
public class ItemAlchemicVial extends ItemEnum.Variant<AlchemicVialType>
{
public ItemAlchemicVial()
{
public class ItemAlchemicVial extends ItemEnum.Variant<AlchemicVialType> {
public ItemAlchemicVial() {
super(AlchemicVialType.class, "alchemic_vial");
}
@Override
public void gatherVariants(Int2ObjectMap<String> variants)
{
public void gatherVariants(Int2ObjectMap<String> variants) {
for (AlchemicVialType type : types)
variants.put(type.ordinal(), "type=normal");
}

View file

@ -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);
}

View file

@ -7,13 +7,23 @@ import WayofTime.bloodmagic.core.data.SoulTicket;
import WayofTime.bloodmagic.util.helper.NetworkHelper;
import WayofTime.bloodmagic.util.helper.PlayerHelper;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.init.MobEffects;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ -70,7 +80,32 @@ 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
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
pos = pos.offset(facing);
ItemStack itemstack = player.getHeldItem(hand);
Binding binding = getBinding(player.getHeldItem(hand));
if (binding == null)
return EnumActionResult.FAIL;
if (!player.canPlayerEdit(pos, facing, itemstack))
return EnumActionResult.FAIL;
if (worldIn.isAirBlock(pos) && NetworkHelper.getSoulNetwork(binding).syphonAndDamage(player, SoulTicket.item(player.getHeldItem(hand), 100)).isSuccess()) {
worldIn.playSound(player, pos, SoundEvents.ITEM_FIRECHARGE_USE, SoundCategory.BLOCKS, 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
worldIn.setBlockState(pos, Blocks.FIRE.getDefaultState(), 11);
} else
return EnumActionResult.FAIL;
if (player instanceof EntityPlayerMP)
CriteriaTriggers.PLACED_BLOCK.trigger((EntityPlayerMP) player, pos, itemstack);
return EnumActionResult.SUCCESS;
}
@Override

View file

@ -2,6 +2,7 @@ package WayofTime.bloodmagic.item;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.ritual.AreaDescriptor;
import WayofTime.bloodmagic.ritual.EnumRitualReaderState;
import WayofTime.bloodmagic.ritual.IMasterRitualStone;
import WayofTime.bloodmagic.ritual.Ritual;
@ -21,7 +22,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
@ -100,11 +100,21 @@ public class ItemRitualReader extends Item implements IVariantProvider {
switch (state) {
case INFORMATION:
master.provideInformationOfRitualToPlayer(player);
break;
case SET_AREA:
if (player.isSneaking() && player.getHeldItem(EnumHand.OFF_HAND).getItem() instanceof ItemBloodOrb) {
Ritual ritual = master.getCurrentRitual();
for (String range : ritual.getListOfRanges()) {
AreaDescriptor aabb = ritual.getBlockRange(range);
master.setBlockRange(range, aabb);
}
break;
}
String range = this.getCurrentBlockRange(stack);
if (range == null || player.isSneaking()) {
if (range == null || range.isEmpty() || player.isSneaking()) {
String newRange = master.getNextBlockRange(range);
range = newRange;
this.setCurrentBlockRange(stack, newRange);
@ -144,17 +154,21 @@ public class ItemRitualReader extends Item implements IVariantProvider {
BlockPos pos1 = pos.subtract(masterPos);
this.setBlockPos(stack, pos1);
player.sendStatusMessage(new TextComponentTranslation("ritual.bloodmagic.blockRange.firstBlock"), true);
player.sendMessage(new TextComponentString(pos1.toString()));
} else {
tile = world.getTileEntity(masterPos);
if (tile instanceof IMasterRitualStone) {
IMasterRitualStone master = (IMasterRitualStone) tile;
BlockPos pos2 = pos.subtract(masterPos);
String range = this.getCurrentBlockRange(stack);
if (range == null || range.isEmpty()) {
String newRange = master.getNextBlockRange(range);
range = newRange;
this.setCurrentBlockRange(stack, newRange);
}
Ritual ritual = master.getCurrentRitual();
//TODO: Fix AreaDescriptor area handling to be inclusive, then remove the "-1" for range calculation below.
int maxHorizontalRange = ritual.getMaxHorizontalRadiusForRange(range, null, null) - 1;
int maxVerticalRange = ritual.getMaxVerticalRadiusForRange(range, null, null) - 1;
int maxHorizontalRange = ritual.getMaxHorizontalRadiusForRange(range, null, null);
int maxVerticalRange = ritual.getMaxVerticalRadiusForRange(range, null, null);
int maxVolume = ritual.getMaxVolumeForRange(range, null, null);
switch (master.setBlockRangeByBounds(player, range, containedPos, pos2)) {

View file

@ -53,7 +53,7 @@ public class ItemSacrificialDagger extends ItemEnum<ItemSacrificialDagger.Dagger
@Override
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBase entityLiving, int timeLeft) {
if (entityLiving instanceof EntityPlayer && !entityLiving.getEntityWorld().isRemote)
if(PlayerSacrificeHelper.sacrificePlayerHealth((EntityPlayer) entityLiving))
if (PlayerSacrificeHelper.sacrificePlayerHealth((EntityPlayer) entityLiving))
IncenseHelper.setHasMaxIncense(stack, (EntityPlayer) entityLiving, false);
}
@ -94,14 +94,16 @@ public class ItemSacrificialDagger extends ItemEnum<ItemSacrificialDagger.Dagger
return super.onItemRightClick(world, player, hand);
if (evt.shouldDrainHealth) {
DamageSourceBloodMagic damageSrc = DamageSourceBloodMagic.INSTANCE;
player.hurtResistantTime = 0;
player.attackEntityFrom(DamageSourceBloodMagic.INSTANCE, 0.001F);
player.setHealth(Math.max(player.getHealth() - 2, 0.0001f));
if (player.getHealth() <= 0.001f) {
player.onDeath(DamageSourceBloodMagic.INSTANCE);
player.setHealth(0);
float playerHealth = player.getHealth();
if (Math.ceil(player.getHealth() - 2) <= 0) {
player.attackEntityFrom(damageSrc, Float.MAX_VALUE);
} else {
float damageAmount = net.minecraftforge.common.ForgeHooks.onLivingDamage(player, damageSrc, 2.0F);
player.getCombatTracker().trackDamage(damageSrc, playerHealth, damageAmount);
player.setHealth(Math.max(player.getHealth() - 2, 0.001f));
}
// player.attackEntityFrom(BloodMagicAPI.getDamageSource(), 2.0F);
}
if (!evt.shouldFillAltar)
@ -132,9 +134,9 @@ public class ItemSacrificialDagger extends ItemEnum<ItemSacrificialDagger.Dagger
if (!world.isRemote && entity instanceof EntityPlayer) {
boolean prepared = this.isPlayerPreparedForSacrifice(world, (EntityPlayer) entity);
this.setUseForSacrifice(stack, prepared);
if(IncenseHelper.getHasMaxIncense(stack) && !prepared)
if (IncenseHelper.getHasMaxIncense(stack) && !prepared)
IncenseHelper.setHasMaxIncense(stack, (EntityPlayer) entity, false);
if(prepared) {
if (prepared) {
boolean isMax = IncenseHelper.getMaxIncense((EntityPlayer) entity) == IncenseHelper.getCurrentIncense((EntityPlayer) entity);
IncenseHelper.setHasMaxIncense(stack, (EntityPlayer) entity, isMax);
}
@ -178,15 +180,15 @@ public class ItemSacrificialDagger extends ItemEnum<ItemSacrificialDagger.Dagger
}
@Override
public boolean hasEffect(ItemStack stack)
{
public boolean hasEffect(ItemStack stack) {
return IncenseHelper.getHasMaxIncense(stack) || super.hasEffect(stack);
}
public enum DaggerType implements ISubItem {
NORMAL,
CREATIVE,;
CREATIVE,
;
@Nonnull
@Override

View file

@ -32,7 +32,8 @@ public class ItemSlate extends ItemEnum.Variant<ItemSlate.SlateType> {
REINFORCED,
IMBUED,
DEMONIC,
ETHEREAL,;
ETHEREAL,
;
@Nonnull
@Override

View file

@ -93,7 +93,8 @@ public class ItemTelepositionFocus extends ItemEnum.Variant<ItemTelepositionFocu
WEAK,
ENHANCED,
REINFORCED,
DEMONIC,;
DEMONIC,
;
@Nonnull
@Override

View file

@ -22,98 +22,86 @@ import WayofTime.bloodmagic.item.block.base.ItemBlockEnum;
import WayofTime.bloodmagic.util.ChatUtil;
public class ItemBlockMimic extends ItemBlockEnum
{
public ItemBlockMimic(BlockEnum block)
{
public class ItemBlockMimic extends ItemBlockEnum {
public ItemBlockMimic(BlockEnum block) {
super(block);
setHasSubtypes(true);
}
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
ItemStack stack = player.getHeldItem(hand);
//If not sneaking, do normal item use
if (!player.isSneaking())
{
if (!player.isSneaking()) {
return super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
}
//IF sneaking and player has permission, replace the targeted block
if (player.canPlayerEdit(pos, facing, stack))
{
if (player.canPlayerEdit(pos, facing, stack)) {
//Store information about the block being replaced and its appropriate itemstack
IBlockState replacedBlockstate = world.getBlockState(pos);
Block replacedBlock = replacedBlockstate.getBlock();
ItemStack replacedStack = replacedBlock.getItem(world, pos, replacedBlockstate);
//Get the state for the mimic
IBlockState mimicBlockstate = this.getBlock().getStateFromMeta(stack.getMetadata());
//Check if the block can be replaced
if (!canReplaceBlock(world, pos, replacedBlockstate))
{
if (!canReplaceBlock(world, pos, replacedBlockstate)) {
return super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
}
//Check if the tile entity, if any, can be replaced
TileEntity tileReplaced = world.getTileEntity(pos);
if (!canReplaceTile(tileReplaced))
{
if (!canReplaceTile(tileReplaced)) {
return EnumActionResult.FAIL;
}
//If tile can be replaced, store info about the tile
NBTTagCompound tileTag = getTagFromTileEntity(tileReplaced);
if (tileReplaced != null)
{
if (tileReplaced != null) {
NBTTagCompound voidTag = new NBTTagCompound();
voidTag.setInteger("x", pos.getX());
voidTag.setInteger("y", pos.getY());
voidTag.setInteger("z", pos.getZ());
tileReplaced.readFromNBT(voidTag);
}
//Remove one item from stack
stack.shrink(1);
//Replace the block
world.setBlockState(pos, mimicBlockstate, 3);
//Make placing sound
SoundType soundtype = this.block.getSoundType();
world.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
world.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
//Replace the tile entity
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileMimic)
{
if (tile instanceof TileMimic) {
TileMimic mimic = (TileMimic) tile;
mimic.tileTag = tileTag;
mimic.setReplacedState(replacedBlockstate);
mimic.setInventorySlotContents(0, replacedStack);
mimic.refreshTileEntity();
if (player.capabilities.isCreativeMode)
{
if (player.capabilities.isCreativeMode) {
mimic.dropItemsOnBreak = false;
}
}
return EnumActionResult.SUCCESS;
}
}
return EnumActionResult.FAIL;
}
public boolean canReplaceTile(TileEntity tile)
{
if (tile instanceof TileEntityChest)
{
public boolean canReplaceTile(TileEntity tile) {
if (tile instanceof TileEntityChest) {
return true;
}
@ -124,12 +112,10 @@ public class ItemBlockMimic extends ItemBlockEnum
return state.getBlockHardness(world, pos) != -1.0F;
}
public NBTTagCompound getTagFromTileEntity(TileEntity tile)
{
public NBTTagCompound getTagFromTileEntity(TileEntity tile) {
NBTTagCompound tag = new NBTTagCompound();
if (tile != null)
{
if (tile != null) {
return tile.writeToNBT(tag);
}
@ -137,8 +123,7 @@ public class ItemBlockMimic extends ItemBlockEnum
}
@Override
public int getMetadata(int meta)
{
public int getMetadata(int meta) {
return meta;
}
}

View file

@ -44,13 +44,13 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator, I
RayTraceResult rayTrace = this.rayTrace(world, player, false);
if (rayTrace == null) {
return super.onItemRightClick(world, player, EnumHand.MAIN_HAND);
return super.onItemRightClick(world, player, hand);
} else {
if (rayTrace.typeOfHit == RayTraceResult.Type.BLOCK) {
TileEntity tile = world.getTileEntity(rayTrace.getBlockPos());
if (!(tile instanceof IBloodAltar))
return super.onItemRightClick(world, player, EnumHand.MAIN_HAND);
return super.onItemRightClick(world, player, hand);
LPContainer.tryAndFillAltar((IBloodAltar) tile, stack, world, rayTrace.getBlockPos());
}

View file

@ -60,13 +60,13 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato
RayTraceResult position = this.rayTrace(world, player, false);
if (position == null) {
return super.onItemRightClick(world, player, EnumHand.MAIN_HAND);
return super.onItemRightClick(world, player, hand);
} else {
if (position.typeOfHit == RayTraceResult.Type.BLOCK) {
TileEntity tile = world.getTileEntity(position.getBlockPos());
if (!(tile instanceof IBloodAltar))
return super.onItemRightClick(world, player, EnumHand.MAIN_HAND);
return super.onItemRightClick(world, player, hand);
LPContainer.tryAndFillAltar((IBloodAltar) tile, stack, world, position.getBlockPos());
}

View file

@ -23,12 +23,10 @@ import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
public class ItemFluidRouterFilter extends Item implements IFluidFilterProvider, IVariantProvider
{
public static String[] names = { "exact" };
public class ItemFluidRouterFilter extends Item implements IFluidFilterProvider, IVariantProvider {
public static String[] names = {"exact"};
public ItemFluidRouterFilter()
{
public ItemFluidRouterFilter() {
super();
setTranslationKey(BloodMagic.MODID + ".fluidFilter.");
@ -37,15 +35,13 @@ public class ItemFluidRouterFilter extends Item implements IFluidFilterProvider,
}
@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<ItemStack> list)
{
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> 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<String> tooltip, ITooltipFlag flag)
{
public void addInformation(ItemStack stack, World world, List<String> 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<ItemStack> 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<ItemStack> 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<String> variants)
{
public void gatherVariants(@Nonnull Int2ObjectMap<String> 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);

View file

@ -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<ItemStack> list)
{
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> 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<String> tooltip, ITooltipFlag flag)
{
public void addInformation(ItemStack stack, World world, List<String> 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<ItemStack> 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<ItemStack> 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<String> variants)
{
public void gatherVariants(@Nonnull Int2ObjectMap<String> 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);

View file

@ -6,7 +6,6 @@ import WayofTime.bloodmagic.util.helper.TextHelper;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -38,7 +37,7 @@ public class ItemSigilBase extends ItemSigil implements IVariantProvider {
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
if (TextHelper.canTranslate(tooltipBase + "desc"))
tooltip.addAll(Arrays.asList(WordUtils.wrap(new TextComponentTranslation(tooltipBase + "desc").getFormattedText(), 30, "/cut", false).split("/cut")));
tooltip.addAll(Arrays.asList(WordUtils.wrap(TextHelper.localizeEffect(tooltipBase + "desc"), 30, "/cut", false).split("/cut")));
super.addInformation(stack, world, tooltip, flag);
}

View file

@ -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<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
{
public ActionResult<ItemStack> 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);
}
}

View file

@ -131,10 +131,10 @@ public class ItemSigilHolding extends ItemSigilBase implements IKeybindable, IAl
public void saveInventory(ItemStack itemStack, List<ItemStack> inventory) {
NBTTagCompound itemTag = itemStack.getTagCompound();
if (itemTag == null) {
itemStack.setTagCompound(new NBTTagCompound());
}
if (itemTag == null)
itemStack.setTagCompound(itemTag = new NBTTagCompound());
NBTTagCompound inventoryTag = new NBTTagCompound();
NBTTagList itemList = new NBTTagList();
for (int i = 0; i < inventorySize; i++) {
@ -146,7 +146,8 @@ public class ItemSigilHolding extends ItemSigilBase implements IKeybindable, IAl
}
}
itemTag.setTag(Constants.NBT.ITEMS, itemList);
inventoryTag.setTag(Constants.NBT.ITEMS, itemList);
itemTag.setTag(Constants.NBT.ITEM_INVENTORY, inventoryTag);
}
@Override
@ -246,7 +247,8 @@ public class ItemSigilHolding extends ItemSigilBase implements IKeybindable, IAl
return NonNullList.withSize(inventorySize, ItemStack.EMPTY);
}
NBTTagList tagList = tagCompound.getTagList(Constants.NBT.ITEMS, 10);
NBTTagCompound inventoryTag = tagCompound.getCompoundTag(Constants.NBT.ITEM_INVENTORY);
NBTTagList tagList = inventoryTag.getTagList(Constants.NBT.ITEMS, 10);
if (tagList.isEmpty()) {
return NonNullList.withSize(inventorySize, ItemStack.EMPTY);

View file

@ -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);
}

View file

@ -104,7 +104,8 @@ public class ItemMonsterSoul extends ItemEnum.Variant<ItemMonsterSoul.WillType>
CORROSIVE,
DESTRUCTIVE,
VENGEFUL,
STEADFAST,;
STEADFAST,
;
@Nonnull
@Override

View file

@ -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);
}

View file

@ -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<EntityPlayer, Map<EntityLivingBase, Vector3d>> floatMap = new HashMap<EntityPlayer, Map<EntityLivingBase, Vector3d>>();
public static Map<EntityPlayer, EntityLivingBase> heldEntityMap = new HashMap<EntityPlayer, EntityLivingBase>();
public static Map<EntityPlayer, Double> heldEntityOffsetMap = new HashMap<EntityPlayer, Double>();
//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<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
{
public ActionResult<ItemStack> 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<EntityLivingBase, Vector3d> entityMap = floatMap.get(player);
if (entityMap == null)
{
if (entityMap == null) {
return;
}
List<EntityLivingBase> removalList = new ArrayList<EntityLivingBase>();
for (Entry<EntityLivingBase, Vector3d> entry : entityMap.entrySet())
{
for (Entry<EntityLivingBase, Vector3d> 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<EntityLivingBase, Vector3d> entityMap = floatMap.get(player);
entityMap.put(living, updatedOffset);
return true;
} else
{
} else {
Map<EntityLivingBase, Vector3d> entityMap = new HashMap<EntityLivingBase, Vector3d>();
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<EntityLivingBase, Vector3d> 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<String> variants)
{
public void gatherVariants(Consumer<String> variants) {
variants.accept("active=false");
variants.accept("active=true");
}

View file

@ -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);

View file

@ -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;
}

View file

@ -40,7 +40,8 @@ public enum ComponentTypes implements ISubItem {
CATALYST_POWER_1,
REAGENT_CLAW,
REAGENT_BOUNCE,
REAGENT_FROST,;
REAGENT_FROST,
;
@Nonnull
@Override

View file

@ -9,7 +9,8 @@ import java.util.Locale;
public enum ShardType implements ISubItem {
WEAK,
DEMONIC,;
DEMONIC,
;
@Nonnull
@Override

View file

@ -8,7 +8,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
public class LivingArmourUpgradeStormTrooper extends LivingArmourUpgrade {
public static final int[] costs = new int[]{-10, -25, -40, 65, -90};
public static final int[] costs = new int[]{-10, -25, -40, -65, -90};
public static final float[] inaccuracy = new float[]{0.04f, 0.08f, 0.12f, 0.16f, 0.2f};
public LivingArmourUpgradeStormTrooper(int level) {

View file

@ -14,7 +14,7 @@ public class LivingArmourUpgradeFallProtect extends LivingArmourUpgrade {
super(level);
}
public float getDamageMultiplier() {
return 1 - protectionLevel[this.level];
}

View file

@ -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<String, AttributeModifier> getAttributeModifiers()
{
public Multimap<String, AttributeModifier> getAttributeModifiers() {
Multimap<String, AttributeModifier> 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";
}
}

View file

@ -3,6 +3,7 @@ package WayofTime.bloodmagic.potion;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
import WayofTime.bloodmagic.event.SacrificeKnifeUsedEvent;
import com.google.common.collect.Lists;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile;
@ -55,7 +56,7 @@ public class PotionEventHandlers {
@SubscribeEvent
public static void onEntityUpdate(LivingEvent.LivingUpdateEvent event) {
EntityLivingBase eventEntityLiving = event.getEntityLiving();
List<EntityPlayer> flightList = flightListMap.get(eventEntityLiving.getEntityWorld());
List<EntityPlayer> flightList = flightListMap.getOrDefault(eventEntityLiving.getEntityWorld(), Lists.newArrayList());
if (eventEntityLiving instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) eventEntityLiving;
@ -76,35 +77,44 @@ public class PotionEventHandlers {
}
}
}
// if (eventEntityLiving.isPotionActive(ModPotions.boost))
// {
// int i = eventEntityLiving.getActivePotionEffect(ModPotions.boost).getAmplifier();
// {
// float percentIncrease = (i + 1) * 0.05f;
//
// if (eventEntityLiving instanceof EntityPlayer)
// {
// EntityPlayer entityPlayer = (EntityPlayer) eventEntityLiving;
//
// if ((entityPlayer.onGround || entityPlayer.capabilities.isFlying) && entityPlayer.moveForward > 0F)
// entityPlayer.moveFlying(0F, 1F, entityPlayer.capabilities.isFlying ? (percentIncrease / 2.0f) : percentIncrease);
// }
// }
// }
List<EntityLivingBase> noGravityList = noGravityListMap.get(event.getEntityLiving().getEntityWorld());
if ((!(eventEntityLiving instanceof EntityPlayer) || !((EntityPlayer) eventEntityLiving).isSpectator()) && eventEntityLiving.isPotionActive(RegistrarBloodMagic.SUSPENDED)) {
eventEntityLiving.setNoGravity(true);
noGravityList.add(eventEntityLiving);
} else {
eventEntityLiving.setNoGravity(false);
noGravityList.remove(eventEntityLiving);
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST)) {
int amplifier = event.getEntityLiving().getActivePotionEffect(RegistrarBloodMagic.BOOST).getAmplifier();
float percentIncrease = (amplifier + 1) * 0.5F;
boolean isPlayerAndFlying = eventEntityLiving instanceof EntityPlayer && ((EntityPlayer) eventEntityLiving).capabilities.isFlying;
if (percentIncrease != 0 && (eventEntityLiving.onGround || isPlayerAndFlying) &&
(eventEntityLiving.moveForward != 0 || eventEntityLiving.moveStrafing != 0 || eventEntityLiving.motionY != 0)) {
eventEntityLiving.travel(eventEntityLiving.moveStrafing * percentIncrease,
isPlayerAndFlying ? eventEntityLiving.moveVertical * percentIncrease : 0, // TODO: Vertical movement doesn't seem to be impacted even with excessive values
eventEntityLiving.moveForward * percentIncrease);
if (isPlayerAndFlying && eventEntityLiving.motionY != 0) // TODO: remove when entity.travel() works with vertical movement or a better solution exists.
eventEntityLiving.motionY *= (1 + Math.min(percentIncrease, 0.75F)); // if this goes too high, it escalates
}
}
if (eventEntityLiving.isPotionActive(RegistrarBloodMagic.GROUNDED))
if (eventEntityLiving instanceof EntityPlayer && ((EntityPlayer) eventEntityLiving).capabilities.isFlying)
eventEntityLiving.motionY -= (0.05D * (double) (eventEntityLiving.getActivePotionEffect(RegistrarBloodMagic.GROUNDED).getAmplifier() + 1) - eventEntityLiving.motionY) * 0.2D;
else
eventEntityLiving.motionY -= (0.1D * (double) (eventEntityLiving.getActivePotionEffect(RegistrarBloodMagic.GROUNDED).getAmplifier() + 1) - eventEntityLiving.motionY) * 0.2D;
List<EntityLivingBase> noGravityList = noGravityListMap.getOrDefault(event.getEntityLiving().getEntityWorld(), Lists.newArrayList());
if (noGravityList != null) {
if (eventEntityLiving.isPotionActive(RegistrarBloodMagic.SUSPENDED) && !eventEntityLiving.hasNoGravity()) {
eventEntityLiving.setNoGravity(true);
noGravityList.add(eventEntityLiving);
} else if (noGravityList.contains(eventEntityLiving)) {
eventEntityLiving.setNoGravity(false);
noGravityList.remove(eventEntityLiving);
}
}
if (eventEntityLiving.isPotionActive(RegistrarBloodMagic.GROUNDED)) {
PotionEffect activeEffect = eventEntityLiving.getActivePotionEffect(RegistrarBloodMagic.GROUNDED);
if (activeEffect != null) {
if (eventEntityLiving instanceof EntityPlayer && ((EntityPlayer) eventEntityLiving).capabilities.isFlying)
eventEntityLiving.motionY -= (0.05D * (double) activeEffect.getAmplifier() + 1 - eventEntityLiving.motionY) * 0.2D;
else
eventEntityLiving.motionY -= (0.1D * (double) activeEffect.getAmplifier() + 1 - eventEntityLiving.motionY) * 0.2D;
}
}
if (eventEntityLiving.isPotionActive(RegistrarBloodMagic.WHIRLWIND)) {
int d0 = 3;

View file

@ -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<TileInversionPillar>()
{
ClientRegistry.bindTileEntitySpecialRenderer(TileInversionPillar.class, new AnimationTESR<TileInversionPillar>() {
@Override
public void handleEvents(TileInversionPillar chest, float time, Iterable<Event> pastEvents)
{
public void handleEvents(TileInversionPillar chest, float time, Iterable<Event> 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<String, RenderPlayer> 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<String, ITimeValue> parameters)
{
public IAnimationStateMachine load(ResourceLocation location, ImmutableMap<String, ITimeValue> parameters) {
return ModelLoaderRegistry.loadASM(location, parameters);
}
}

View file

@ -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<ItemStack> 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<ItemStack, Pair<String, int[]>> 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<ItemStack, Pair<String, int[]>> entry : dialogueMap.entrySet())
{
for (Entry<ItemStack, Pair<String, int[]>> entry : dialogueMap.entrySet()) {
ItemStack keyStack = entry.getKey();
String str = entry.getValue().getKey();
Map<Integer, List<ITextComponent>> textMap = new HashMap<>();
for (int tick : entry.getValue().getValue())
{
for (int tick : entry.getValue().getValue()) {
List<ITextComponent> 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));
}
}
}

View file

@ -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));
}

View file

@ -35,12 +35,16 @@ public abstract class AreaDescriptor implements Iterator<BlockPos> {
}
public abstract AreaDescriptor copy();
public abstract int getVolumeForOffsets(BlockPos offset1, BlockPos offset2);
public abstract boolean isWithinRange(BlockPos offset1, BlockPos offset2, int verticalLimit, int horizontalLimit);
public abstract int getVolume();
public abstract int getHeight();
public abstract boolean isWithinRange(int verticalLimit, int horizontalLimit);
/**
@ -89,6 +93,14 @@ public abstract class AreaDescriptor implements Iterator<BlockPos> {
this(minimumOffset, size, size, size);
}
public Rectangle(AreaDescriptor.Rectangle rectangle) {
this(rectangle.minimumOffset, rectangle.maximumOffset);
}
public AreaDescriptor.Rectangle copy() {
return new AreaDescriptor.Rectangle(this);
}
@Override
public List<BlockPos> getContainedPositions(BlockPos pos) {
if (!cache || !pos.equals(cachedPosition) || blockPosCache.isEmpty()) {
@ -115,6 +127,19 @@ public abstract class AreaDescriptor implements Iterator<BlockPos> {
return tempAABB.offset(pos.getX(), pos.getY(), pos.getZ());
}
@Override
public int getHeight() {
return this.maximumOffset.getY() - this.minimumOffset.getY();
}
public BlockPos getMinimumOffset() {
return minimumOffset;
}
public BlockPos getMaximumOffset() {
return maximumOffset;
}
/**
* Sets the offsets of the AreaDescriptor in a safe way that will make
* minimumOffset the lowest corner
@ -264,12 +289,27 @@ public abstract class AreaDescriptor implements Iterator<BlockPos> {
setRadius(minimumOffset, radius);
}
public HemiSphere(AreaDescriptor.HemiSphere hemiSphere) {
this(hemiSphere.minimumOffset, hemiSphere.radius);
}
public AreaDescriptor.HemiSphere copy() {
return new AreaDescriptor.HemiSphere(this);
}
public void setRadius(BlockPos minimumOffset, int radius) {
this.minimumOffset = new BlockPos(Math.min(minimumOffset.getX(), minimumOffset.getX()), Math.min(minimumOffset.getY(), minimumOffset.getY()), Math.min(minimumOffset.getZ(), minimumOffset.getZ()));
this.radius = radius;
blockPosCache = new ArrayList<>();
}
@Override
public int getHeight() {
return this.radius * 2;
}
@Override
public List<BlockPos> getContainedPositions(BlockPos pos) {
if (!cache || !pos.equals(cachedPosition) || blockPosCache.isEmpty()) {
@ -403,6 +443,20 @@ public abstract class AreaDescriptor implements Iterator<BlockPos> {
this.blockPosCache = new ArrayList<>();
}
public Cross(AreaDescriptor.Cross cross) {
this(cross.centerPos, cross.size);
}
public AreaDescriptor.Cross copy() {
return new AreaDescriptor.Cross(this);
}
@Override
public int getHeight() {
return this.size * 2 + 1;
}
@Override
public List<BlockPos> getContainedPositions(BlockPos pos) {
if (!cache || !pos.equals(cachedPosition) || blockPosCache.isEmpty()) {

View file

@ -33,6 +33,8 @@ public interface IMasterRitualStone {
void setCooldown(int cooldown);
boolean isActive();
void setActive(boolean active);
EnumFacing getDirection();
@ -69,5 +71,9 @@ public interface IMasterRitualStone {
void addBlockRange(String range, AreaDescriptor defaultRange);
void setBlockRanges(Map<String, AreaDescriptor> blockRanges);
void setBlockRange(String range, AreaDescriptor defaultRange);
Ritual getCurrentRitual();
}

View file

@ -9,6 +9,8 @@ import javax.annotation.Nonnull;
public interface ICrushingHandler {
@Nonnull
ItemStack getRecipeOutput(ItemStack input, World world, BlockPos pos);
int getLpDrain();
double getWillDrain();
}

View file

@ -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.
*/

View file

@ -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;
}

View file

@ -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);

View file

@ -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<RitualComponent> components)
{
public void gatherComponents(Consumer<RitualComponent> 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")};
}
}

View file

@ -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<RitualComponent> components)
{
public void gatherComponents(Consumer<RitualComponent> 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();
}
}

View file

@ -1,17 +1,21 @@
package WayofTime.bloodmagic.ritual.types;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.altar.IBloodAltar;
import WayofTime.bloodmagic.altar.BloodAltar;
import WayofTime.bloodmagic.block.BlockLifeEssence;
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
import WayofTime.bloodmagic.ritual.*;
import WayofTime.bloodmagic.tile.TileAltar;
import WayofTime.bloodmagic.util.helper.NetworkHelper;
import WayofTime.bloodmagic.util.helper.PlayerHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import java.util.List;
import java.util.UUID;
@ -19,12 +23,15 @@ import java.util.function.Consumer;
@RitualRegister("eternal_soul")
public class RitualEternalSoul extends Ritual {
public static final String ALTAR_RANGE = "altar";
private IBloodAltar altar = null;
private BlockPos altarOffsetPos = new BlockPos(0, 0, 0);
public RitualEternalSoul() {
super("ritualEternalSoul", 2, 2000000, "ritual." + BloodMagic.MODID + ".eternalSoulRitual");
addBlockRange(ALTAR_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-5, -10, -5), 11, 21, 11));
setMaximumVolumeAndDistanceOfRange(ALTAR_RANGE, 0, 10, 15);
}
@Override
@ -33,20 +40,29 @@ public class RitualEternalSoul extends Ritual {
int currentEssence = NetworkHelper.getSoulNetwork(owner).getCurrentEssence();
World world = masterRitualStone.getWorldObj();
BlockPos pos = masterRitualStone.getBlockPos();
BlockPos altarPos = pos.add(altarOffsetPos);
if (this.altar == null) {
for (int i = -5; i <= 5; i++) {
for (int j = -5; j <= 5; j++) {
for (int k = -10; k <= 10; k++) {
if (world.getTileEntity(new BlockPos(pos.getX() + i, pos.getY() + j, pos.getZ() + k)) instanceof IBloodAltar) {
this.altar = (IBloodAltar) world.getTileEntity(new BlockPos(pos.getX() + i, pos.getY() + j, pos.getZ() + k));
}
}
TileEntity tile = world.getTileEntity(altarPos);
AreaDescriptor altarRange = masterRitualStone.getBlockRange(ALTAR_RANGE);
if (!altarRange.isWithinArea(altarOffsetPos) || !(tile instanceof TileAltar)) {
for (BlockPos newPos : altarRange.getContainedPositions(pos)) {
TileEntity nextTile = world.getTileEntity(newPos);
if (nextTile instanceof TileAltar) {
tile = nextTile;
altarOffsetPos = newPos.subtract(pos);
altarRange.resetCache();
break;
}
}
}
if (!(this.altar instanceof IFluidHandler))
if (!(tile instanceof TileAltar)) {
return;
}
BloodAltar altar = (BloodAltar) tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null);
int horizontalRange = 15;
int verticalRange = 20;
@ -54,21 +70,20 @@ public class RitualEternalSoul extends Ritual {
List<EntityPlayer> list = world.getEntitiesWithinAABB(EntityPlayer.class,
new AxisAlignedBB(pos.getX() - 0.5f, pos.getY() - 0.5f, pos.getZ() - 0.5f,
pos.getX() + 0.5f, pos.getY() + 0.5f, pos.getZ() + 0.5f)
.expand(horizontalRange, verticalRange, horizontalRange));
.expand(horizontalRange, verticalRange, horizontalRange).expand(0, -verticalRange, 0));
EntityPlayer entityOwner = null;
for (EntityPlayer player : list) {
if (PlayerHelper.getUUIDFromPlayer(player) == owner)
entityOwner = player;
}
EntityPlayer entityOwner = PlayerHelper.getPlayerFromUUID(owner);
int fillAmount = Math.min(currentEssence / 2, ((IFluidHandler) this.altar).fill(new FluidStack(BlockLifeEssence.getLifeEssence(), 10000), false));
int fillAmount = Math.min(currentEssence / 2, altar.fill(new FluidStack(BlockLifeEssence.getLifeEssence(), 10000), false));
((IFluidHandler) this.altar).fill(new FluidStack(BlockLifeEssence.getLifeEssence(), fillAmount), true);
altar.fill(new FluidStack(BlockLifeEssence.getLifeEssence(), fillAmount), true);
if (entityOwner != null && entityOwner.getHealth() > 2.0f && fillAmount != 0)
if (entityOwner != null && list.contains(entityOwner) && entityOwner.getHealth() > 2.0f && fillAmount != 0)
entityOwner.setHealth(2.0f);
for (EntityPlayer player : list)
player.addPotionEffect(new PotionEffect(RegistrarBloodMagic.SOUL_FRAY, 100));
masterRitualStone.getOwnerNetwork().syphon(masterRitualStone.ticket(fillAmount * 2));
}
@ -86,7 +101,7 @@ public class RitualEternalSoul extends Ritual {
@Override
public void gatherComponents(Consumer<RitualComponent> components) {
addCornerRunes(components, 0, 1, EnumRuneType.FIRE);
addCornerRunes(components, 1, 0, EnumRuneType.FIRE);
for (int i = 0; i < 4; i++) {
addCornerRunes(components, 2, i, EnumRuneType.AIR);

View file

@ -64,7 +64,7 @@ public class RitualGrounding extends Ritual {
double vengefulDrained = 0;
/* Actual ritual stuff begins here */
AreaDescriptor groundingRange = getBlockRange(GROUNDING_RANGE);
AreaDescriptor groundingRange = masterRitualStone.getBlockRange(GROUNDING_RANGE);
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, groundingRange.getAABB(pos));
for (EntityLivingBase entity : entities) {
if (totalEffects >= maxEffects) {

View file

@ -14,11 +14,14 @@ import java.util.function.Consumer;
@RitualRegister("jumping")
public class RitualJumping extends Ritual {
public static final String JUMP_RANGE = "jumpRange";
public static final String JUMP_POWER = "jumpPower";
public RitualJumping() {
super("ritualJump", 0, 5000, "ritual." + BloodMagic.MODID + ".jumpRitual");
addBlockRange(JUMP_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-1, 1, -1), 3, 1, 3));
setMaximumVolumeAndDistanceOfRange(JUMP_RANGE, 0, 5, 5);
addBlockRange(JUMP_POWER, new AreaDescriptor.Rectangle(new BlockPos(0, 0, 0), 0, 5, 0));
setMaximumVolumeAndDistanceOfRange(JUMP_POWER, 0, 0, 100);
}
@Override
@ -41,7 +44,7 @@ public class RitualJumping extends Ritual {
break;
}
double motionY = 1.5;
double motionY = masterRitualStone.getBlockRange(JUMP_POWER).getHeight() * 0.3;
entity.fallDistance = 0;
if (entity.isSneaking()) {
@ -66,7 +69,7 @@ public class RitualJumping extends Ritual {
@Override
public int getRefreshCost() {
return 5;
return getBlockRange(JUMP_POWER).getHeight();
}
@Override

View file

@ -1,12 +1,12 @@
package WayofTime.bloodmagic.ritual.types;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.ritual.*;
import WayofTime.bloodmagic.util.DamageSourceBloodMagic;
import WayofTime.bloodmagic.soul.DemonWillHolder;
import WayofTime.bloodmagic.soul.EnumDemonWillType;
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
import WayofTime.bloodmagic.ritual.*;
import WayofTime.bloodmagic.soul.DemonWillHolder;
import WayofTime.bloodmagic.soul.EnumDemonWillType;
import WayofTime.bloodmagic.util.DamageSourceBloodMagic;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
@ -85,7 +85,7 @@ public class RitualLava extends Ritual {
for (BlockPos newPos : lavaRange.getContainedPositions(pos)) {
IBlockState state = world.getBlockState(newPos);
if (world.isAirBlock(newPos) || Utils.isFlowingLiquid(world, newPos, state)) {
if (world.isAirBlock(newPos) || Utils.isFlowingLiquid(state)) {
int lpCost = getLPCostForRawWill(rawWill);
if (currentEssence < lpCost) {
break;

View file

@ -0,0 +1,102 @@
package WayofTime.bloodmagic.ritual.types;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
import WayofTime.bloodmagic.ritual.*;
import WayofTime.bloodmagic.soul.DemonWillHolder;
import WayofTime.bloodmagic.soul.EnumDemonWillType;
import WayofTime.bloodmagic.util.handler.event.GenericHandler;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
@RitualRegister("veil_of_evil")
public class RitualVeilOfEvil extends Ritual {
public static final String VEIL_RANGE = "veilRange";
public RitualVeilOfEvil() {
super("ritualVeilOfEvil", 0, 40000, "ritual." + BloodMagic.MODID + ".veilOfEvilRitual");
addBlockRange(VEIL_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-16, 0, -16), 33));
setMaximumVolumeAndDistanceOfRange(VEIL_RANGE, 0, 256, 256);
}
@Override
public void performRitual(IMasterRitualStone masterRitualStone) {
/* Default Ritual Stuff */
World world = masterRitualStone.getWorldObj();
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
BlockPos pos = masterRitualStone.getBlockPos();
if (currentEssence < getRefreshCost()) {
masterRitualStone.getOwnerNetwork().causeNausea();
return;
}
// int maxEffects = currentEssence / getRefreshCost();
// int totalEffects = 0;
/* Default will augment stuff */
List<EnumDemonWillType> willConfig = masterRitualStone.getActiveWillConfig();
DemonWillHolder holder = WorldDemonWillHandler.getWillHolder(world, pos);
double rawWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.DEFAULT, willConfig);
double corrosiveWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.CORROSIVE, willConfig);
double destructiveWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.DESTRUCTIVE, willConfig);
double steadfastWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.STEADFAST, willConfig);
double vengefulWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.VENGEFUL, willConfig);
double rawDrained = 0;
double corrosiveDrained = 0;
double destructiveDrained = 0;
double steadfastDrained = 0;
double vengefulDrained = 0;
/* Actual ritual stuff begins here */
if (GenericHandler.forceSpawnMap.containsKey(world)) {
Map<IMasterRitualStone, AreaDescriptor> forceSpawnMap = GenericHandler.forceSpawnMap.get(world);
if (forceSpawnMap != null) {
forceSpawnMap.put(masterRitualStone, masterRitualStone.getBlockRange(VEIL_RANGE));
} else {
forceSpawnMap = new HashMap<>();
forceSpawnMap.put(masterRitualStone, masterRitualStone.getBlockRange(VEIL_RANGE));
GenericHandler.forceSpawnMap.put(world, forceSpawnMap);
}
} else {
HashMap<IMasterRitualStone, AreaDescriptor> forceSpawnMap = new HashMap<>();
forceSpawnMap.put(masterRitualStone, masterRitualStone.getBlockRange(VEIL_RANGE));
GenericHandler.forceSpawnMap.put(world, forceSpawnMap);
}
masterRitualStone.getOwnerNetwork().syphon(masterRitualStone.ticket(getRefreshCost()));
}
@Override
public int getRefreshCost() {
return 0;
}
@Override
public void gatherComponents(Consumer<RitualComponent> components) {
addOffsetRunes(components, 1, 0, 2, EnumRuneType.DUSK);
addCornerRunes(components, 3, 0, EnumRuneType.FIRE);
for (int i = 0; i <= 1; i++) {
addParallelRunes(components, (4 + i), i, EnumRuneType.DUSK);
addOffsetRunes(components, (4 + i), i, -1, EnumRuneType.BLANK);
addOffsetRunes(components, 4, 5, i, EnumRuneType.EARTH);
}
addCornerRunes(components, 5, 1, EnumRuneType.BLANK);
}
@Override
public Ritual getNewCopy() {
return new RitualVeilOfEvil();
}
}

View file

@ -0,0 +1,105 @@
package WayofTime.bloodmagic.ritual.types;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
import WayofTime.bloodmagic.ritual.*;
import WayofTime.bloodmagic.soul.DemonWillHolder;
import WayofTime.bloodmagic.soul.EnumDemonWillType;
import WayofTime.bloodmagic.util.handler.event.GenericHandler;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
@RitualRegister("ward_of_sacrosanctity")
public class RitualWardOfSacrosanctity extends Ritual {
public static final String SPAWN_WARD = "spawnWard";
public RitualWardOfSacrosanctity() {
super("ritualWardOfSacrosanctity", 0, 40000, "ritual." + BloodMagic.MODID + ".wardOfSacrosanctityRitual");
addBlockRange(SPAWN_WARD, new AreaDescriptor.Rectangle(new BlockPos(-16, -10, -16), 33));
setMaximumVolumeAndDistanceOfRange(SPAWN_WARD, 0, 256, 256);
}
@Override
public void performRitual(IMasterRitualStone masterRitualStone) {
/* Default Ritual Stuff */
World world = masterRitualStone.getWorldObj();
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
BlockPos pos = masterRitualStone.getBlockPos();
if (currentEssence < getRefreshCost()) {
masterRitualStone.getOwnerNetwork().causeNausea();
return;
}
// int maxEffects = currentEssence / getRefreshCost();
// int totalEffects = 0;
/* Default will augment stuff */
List<EnumDemonWillType> willConfig = masterRitualStone.getActiveWillConfig();
DemonWillHolder holder = WorldDemonWillHandler.getWillHolder(world, pos);
double rawWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.DEFAULT, willConfig);
double corrosiveWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.CORROSIVE, willConfig);
double destructiveWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.DESTRUCTIVE, willConfig);
double steadfastWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.STEADFAST, willConfig);
double vengefulWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.VENGEFUL, willConfig);
double rawDrained = 0;
double corrosiveDrained = 0;
double destructiveDrained = 0;
double steadfastDrained = 0;
double vengefulDrained = 0;
/* Actual ritual stuff begins here */
if (GenericHandler.preventSpawnMap.containsKey(world)) {
Map<IMasterRitualStone, AreaDescriptor> preventSpawnMap = GenericHandler.preventSpawnMap.get(world);
if (preventSpawnMap != null) {
preventSpawnMap.put(masterRitualStone, masterRitualStone.getBlockRange(SPAWN_WARD));
} else {
preventSpawnMap = new HashMap<>();
preventSpawnMap.put(masterRitualStone, masterRitualStone.getBlockRange(SPAWN_WARD));
GenericHandler.preventSpawnMap.put(world, preventSpawnMap);
}
} else {
HashMap<IMasterRitualStone, AreaDescriptor> preventSpawnMap = new HashMap<>();
preventSpawnMap.put(masterRitualStone, masterRitualStone.getBlockRange(SPAWN_WARD));
GenericHandler.preventSpawnMap.put(world, preventSpawnMap);
}
masterRitualStone.getOwnerNetwork().syphon(masterRitualStone.ticket(getRefreshCost()));
}
@Override
public int getRefreshTime() {
return 25;
}
@Override
public int getRefreshCost() {
return 2;
}
@Override
public void gatherComponents(Consumer<RitualComponent> components) {
for (int i = 2; i < 5; i++) {
if (i < 4) {
addParallelRunes(components, 1, 0, EnumRuneType.AIR);
}
addCornerRunes(components, i, 0, EnumRuneType.FIRE);
}
addParallelRunes(components, 5, 0, EnumRuneType.DUSK);
addOffsetRunes(components, 5, 6, 0, EnumRuneType.WATER);
}
@Override
public Ritual getNewCopy() {
return new RitualWardOfSacrosanctity();
}
}

View file

@ -71,7 +71,7 @@ public class RitualWellOfSuffering extends Ritual {
if (tile instanceof TileAltar) {
TileAltar tileAltar = (TileAltar) tile;
AreaDescriptor damageRange = getBlockRange(DAMAGE_RANGE);
AreaDescriptor damageRange = masterRitualStone.getBlockRange(DAMAGE_RANGE);
AxisAlignedBB range = damageRange.getAABB(pos);
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, range);

View file

@ -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<FluidStack> requestList;
protected TileEntity accessedTile;
protected IFluidHandler fluidHandler;
@Override
public void initializeFilter(List<ItemStack> filteredList, TileEntity tile, IFluidHandler fluidHandler, boolean isFilterOutput)
{
public void initializeFilter(List<ItemStack> 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<FluidStack> 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<FluidStack> 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);
}

View file

@ -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);

View file

@ -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());
}
}

View file

@ -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> T getCapability(Capability<T> capability, EnumFacing facing)
{
if (facing != null && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
{
if (this.isSlave())
{
public <T> T getCapability(Capability<T> 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<Integer> getAccessibleInputSlots(EnumFacing direction)
{
public List<Integer> getAccessibleInputSlots(EnumFacing direction) {
List<Integer> 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<ItemStack> 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<ItemStack> inputList, AlchemyTableRecipe recipe)
{
public void craftItem(List<ItemStack> 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;
}
}

View file

@ -204,7 +204,7 @@ public class TileDemonCrucible extends TileInventory implements ITickable, IDemo
@Override
public boolean canInsertItem(int index, ItemStack stack, EnumFacing direction) {
return !stack.isEmpty() && (stack.getItem() instanceof IDemonWillGem || stack.getItem() instanceof IDiscreteDemonWill);
return !stack.isEmpty() && inventory.get(0).isEmpty() && (stack.getItem() instanceof IDemonWillGem || stack.getItem() instanceof IDiscreteDemonWill);
}
@Override

View file

@ -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;
}

View file

@ -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);
}
}

View file

@ -32,6 +32,7 @@ import javax.annotation.Nullable;
import java.util.*;
public class TileMasterRitualStone extends TileTicking implements IMasterRitualStone {
protected final Map<String, AreaDescriptor> modableRangeMap = new HashMap<>();
private UUID owner;
private SoulNetwork cachedNetwork;
private boolean active;
@ -42,7 +43,6 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
private EnumFacing direction = EnumFacing.NORTH;
private boolean inverted;
private List<EnumDemonWillType> currentActiveWillConfig = new ArrayList<>();
protected final Map<String, AreaDescriptor> modableRangeMap = new HashMap<>();
@Override
public void onUpdate() {
@ -425,13 +425,27 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
return null;
}
@Override
public void addBlockRange(String range, AreaDescriptor defaultRange) {
modableRangeMap.put(range, defaultRange);
modableRangeMap.putIfAbsent(range, defaultRange.copy());
}
@Override
public void addBlockRanges(Map<String, AreaDescriptor> blockRanges) {
for (Map.Entry<String, AreaDescriptor> entry : blockRanges.entrySet()) {
modableRangeMap.put(entry.getKey(), entry.getValue());
modableRangeMap.putIfAbsent(entry.getKey(), entry.getValue().copy());
}
}
@Override
public void setBlockRange(String range, AreaDescriptor defaultRange) {
modableRangeMap.put(range, defaultRange.copy());
}
@Override
public void setBlockRanges(Map<String, AreaDescriptor> blockRanges) {
for (Map.Entry<String, AreaDescriptor> entry : blockRanges.entrySet()) {
modableRangeMap.put(entry.getKey(), entry.getValue().copy());
}
}

View file

@ -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();

View file

@ -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;

View file

@ -49,7 +49,7 @@ public class TileTeleposer extends TileInventory implements ITickable {
@Override
public void update() {
if (!getWorld().isRemote) {
if (!getWorld().isRemote && canInitiateTeleport()) {
int currentInput = getWorld().getStrongPower(pos);
if (previousInput == 0 && currentInput != 0) {
@ -120,7 +120,7 @@ public class TileTeleposer extends TileInventory implements ITickable {
if (!focusWorldEntities.isEmpty()) {
for (Entity entity : focusWorldEntities) {
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(new BlockPos(entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ()), entity, bindingOwnerID, true));
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(new BlockPos(entity.posX - focusPos.getX() + pos.getX(), entity.posY - focusPos.getY() + pos.getY(), entity.posZ - focusPos.getZ() + pos.getZ()), entity, bindingOwnerID, true));
}
}
@ -133,7 +133,7 @@ public class TileTeleposer extends TileInventory implements ITickable {
if (!focusWorldEntities.isEmpty()) {
for (Entity entity : focusWorldEntities) {
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(new BlockPos(entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ()), entity, bindingOwnerID, focusWorld, getWorld().provider.getDimension(), true));
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(new BlockPos(entity.posX - focusPos.getX() + pos.getX(), entity.posY - focusPos.getY() + pos.getY(), entity.posZ - focusPos.getZ() + pos.getZ()), entity, bindingOwnerID, focusWorld, getWorld().provider.getDimension(), true));
}
}
}

Some files were not shown because too many files have changed in this diff Show more