Merge branch '1.12' into gate-of-the-fold
This commit is contained in:
commit
4248d04263
124 changed files with 2758 additions and 2716 deletions
|
@ -7,10 +7,8 @@ import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
|||
|
||||
import java.util.Locale;
|
||||
|
||||
public class Constants
|
||||
{
|
||||
public static class NBT
|
||||
{
|
||||
public class Constants {
|
||||
public static class NBT {
|
||||
public static final String OWNER_UUID = "ownerUUID";
|
||||
public static final String OWNER_NAME = "ownerNAME";
|
||||
public static final String USES = "uses";
|
||||
|
@ -133,13 +131,11 @@ public class Constants
|
|||
public static final String BREATH = "breath";
|
||||
}
|
||||
|
||||
public static class Mod
|
||||
{
|
||||
public static class Mod {
|
||||
public static final String DOMAIN = BloodMagic.MODID.toLowerCase(Locale.ENGLISH) + ":";
|
||||
}
|
||||
|
||||
public static final class Gui
|
||||
{
|
||||
public static final class Gui {
|
||||
public static final int TELEPOSER_GUI = 0;
|
||||
public static final int SOUL_FORGE_GUI = 1;
|
||||
public static final int ROUTING_NODE_GUI = 2;
|
||||
|
@ -148,8 +144,7 @@ public class Constants
|
|||
public static final int SIGIL_HOLDING_GUI = 5;
|
||||
}
|
||||
|
||||
public static class Compat
|
||||
{
|
||||
public static class Compat {
|
||||
public static final String JEI_CATEGORY_ALTAR = BloodMagic.MODID + ":altar";
|
||||
public static final String JEI_CATEGORY_BINDING = BloodMagic.MODID + ":binding";
|
||||
public static final String JEI_CATEGORY_ALCHEMYARRAY = BloodMagic.MODID + ":alchemyArray";
|
||||
|
@ -166,8 +161,7 @@ public class Constants
|
|||
public static final Item THAUMCRAFT_GOGGLES = ForgeRegistries.ITEMS.getValue(new ResourceLocation("Thaumcraft", "goggles"));
|
||||
}
|
||||
|
||||
public static class Misc
|
||||
{
|
||||
public static class Misc {
|
||||
public static final int POTION_ARRAY_SIZE = 256;
|
||||
public static final float ALTERED_STEP_HEIGHT = 1.00314159f;
|
||||
public static final int NIGHT_VISION_CONSTANT_BEGIN = 30020;
|
||||
|
|
|
@ -5,8 +5,10 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
|
||||
public interface ISigilFluidItem {
|
||||
FluidStack getFluid(ItemStack sigil);
|
||||
|
||||
int getCapacity(ItemStack sigil);
|
||||
|
||||
int fill(ItemStack sigil, FluidStack resource, boolean doFill);
|
||||
|
||||
FluidStack drain(ItemStack sigil, int maxDrain, boolean doDrain);
|
||||
}
|
|
@ -45,7 +45,7 @@ public class PluginUtil {
|
|||
// Bring core plugin up to top
|
||||
discoveredAnnotations.sort((o1, o2) -> {
|
||||
if (o1.getLeft().getClass() == BloodMagicCorePlugin.class)
|
||||
return -1;
|
||||
return -1;
|
||||
|
||||
return o1.getClass().getCanonicalName().compareToIgnoreCase(o2.getClass().getCanonicalName());
|
||||
});
|
||||
|
@ -120,8 +120,7 @@ public class PluginUtil {
|
|||
public enum RegistrationStep {
|
||||
|
||||
PLUGIN_REGISTER(p -> p.getLeft().register(BloodMagicAPI.INSTANCE)),
|
||||
RECIPE_REGISTER(p -> p.getLeft().registerRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar()))
|
||||
;
|
||||
RECIPE_REGISTER(p -> p.getLeft().registerRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar()));
|
||||
|
||||
private final Consumer<Pair<IBloodMagicPlugin, BloodMagicPlugin>> consumer;
|
||||
|
||||
|
|
|
@ -8,30 +8,31 @@ import net.minecraft.init.Blocks;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
|
||||
public class StateUtil
|
||||
{
|
||||
public static IBlockState parseState(String blockInfo)
|
||||
{
|
||||
String[] split = blockInfo.split("\\[");
|
||||
split[1] = split[1].substring(0, split[1].lastIndexOf("]")); // Make sure brackets are removed from state
|
||||
public class StateUtil {
|
||||
public static IBlockState parseState(String state) {
|
||||
if (state.contains("[")) {
|
||||
String[] split = state.split("\\[");
|
||||
split[1] = split[1].substring(0, split[1].lastIndexOf("]")); // Make sure brackets are removed from state
|
||||
|
||||
Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(split[0])); // Find the block
|
||||
if (block == Blocks.AIR)
|
||||
return Blocks.AIR.getDefaultState(); // The block is air, so we're looking at invalid data
|
||||
Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(split[0]));
|
||||
if (block == Blocks.AIR)
|
||||
return block.getDefaultState();
|
||||
|
||||
BlockStateContainer blockState = block.getBlockState();
|
||||
IBlockState returnState = blockState.getBaseState();
|
||||
BlockStateContainer blockState = block.getBlockState();
|
||||
IBlockState returnState = blockState.getBaseState();
|
||||
|
||||
// Force our values into the state
|
||||
String[] stateValues = split[1].split(","); // Splits up each value
|
||||
for (String value : stateValues)
|
||||
{
|
||||
String[] valueSplit = value.split("="); // Separates property and value
|
||||
IProperty property = blockState.getProperty(valueSplit[0]);
|
||||
if (property != null)
|
||||
returnState = returnState.withProperty(property, (Comparable) property.parseValue(valueSplit[1]).get()); // Force the property into the state
|
||||
// Force our values into the state
|
||||
String[] stateValues = split[1].split(","); // Splits up each value
|
||||
for (String value : stateValues) {
|
||||
String[] valueSplit = value.split("=");
|
||||
IProperty property = blockState.getProperty(valueSplit[0]);
|
||||
if (property != null)
|
||||
returnState = returnState.withProperty(property, (Comparable) property.parseValue(valueSplit[1]).get());
|
||||
}
|
||||
|
||||
return returnState;
|
||||
} else {
|
||||
return ForgeRegistries.BLOCKS.getValue(new ResourceLocation(state)).getDefaultState();
|
||||
}
|
||||
|
||||
return returnState;
|
||||
}
|
||||
}
|
|
@ -1,16 +1,15 @@
|
|||
package WayofTime.bloodmagic.util;
|
||||
|
||||
import WayofTime.bloodmagic.altar.ComponentType;
|
||||
import WayofTime.bloodmagic.iface.IDemonWillViewer;
|
||||
import WayofTime.bloodmagic.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
|
||||
import WayofTime.bloodmagic.iface.IDemonWillViewer;
|
||||
import WayofTime.bloodmagic.network.BloodMagicPacketHandler;
|
||||
import WayofTime.bloodmagic.network.PlayerVelocityPacketProcessor;
|
||||
import WayofTime.bloodmagic.tile.TileInventory;
|
||||
import WayofTime.bloodmagic.util.helper.NBTHelper;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Maps;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
import net.minecraft.block.BlockPortal;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
|
@ -42,7 +41,6 @@ import net.minecraftforge.common.ISpecialArmor;
|
|||
import net.minecraftforge.common.ISpecialArmor.ArmorProperties;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
@ -799,9 +797,9 @@ public class Utils {
|
|||
return (state instanceof IFluidBlock || state.getMaterial().isLiquid());
|
||||
}
|
||||
|
||||
public static boolean isFlowingLiquid(World world, BlockPos pos, IBlockState state) {
|
||||
public static boolean isFlowingLiquid(IBlockState state) {
|
||||
Block block = state.getBlock();
|
||||
return ((block instanceof IFluidBlock && Math.abs(((IFluidBlock) block).getFilledPercentage(world, pos)) == 1) || (block instanceof BlockLiquid && block.getMetaFromState(state) != 0));
|
||||
return isBlockLiquid(state) && !(state == block.getDefaultState());
|
||||
}
|
||||
|
||||
public static boolean spawnStackAtBlock(World world, BlockPos pos, @Nullable EnumFacing pushDirection, ItemStack stack) {
|
||||
|
|
|
@ -30,9 +30,12 @@ import WayofTime.bloodmagic.orb.BloodOrb;
|
|||
import WayofTime.bloodmagic.orb.IBloodOrb;
|
||||
import WayofTime.bloodmagic.potion.BMPotionUtils;
|
||||
import WayofTime.bloodmagic.potion.PotionEventHandlers;
|
||||
import WayofTime.bloodmagic.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.ritual.RitualManager;
|
||||
import WayofTime.bloodmagic.ritual.portal.LocationsHandler;
|
||||
import WayofTime.bloodmagic.ritual.types.RitualVeilOfEvil;
|
||||
import WayofTime.bloodmagic.ritual.types.RitualWardOfSacrosanctity;
|
||||
import WayofTime.bloodmagic.soul.DemonWillHolder;
|
||||
import WayofTime.bloodmagic.util.Constants;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
@ -74,12 +77,15 @@ import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
|||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingFallEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent;
|
||||
import net.minecraftforge.event.world.ExplosionEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
|
@ -94,6 +100,8 @@ public class GenericHandler {
|
|||
public static Map<World, Map<EntityPlayer, Integer>> filledHandMapMap = new HashMap<>();
|
||||
private static Map<World, Map<EntityAnimal, EntityAITarget>> targetTaskMapMap = new HashMap<>();
|
||||
private static Map<World, Map<EntityAnimal, EntityAIBase>> attackTaskMapMap = new HashMap<>();
|
||||
public static Map<World, Map<IMasterRitualStone, AreaDescriptor>> preventSpawnMap = new HashMap<>();
|
||||
public static Map<World, Map<IMasterRitualStone, AreaDescriptor>> forceSpawnMap = new HashMap<>();
|
||||
public static Set<IMasterRitualStone> featherRitualSet;
|
||||
|
||||
@SubscribeEvent
|
||||
|
@ -243,9 +251,11 @@ public class GenericHandler {
|
|||
targetTaskMap.remove(animal);
|
||||
attackTaskMap.remove(animal);
|
||||
}
|
||||
} else if (targetTaskMap.containsKey(animal)) {
|
||||
targetTaskMap.remove(animal);
|
||||
attackTaskMap.remove(animal);
|
||||
} else {
|
||||
if (targetTaskMap != null)
|
||||
targetTaskMap.remove(animal);
|
||||
if (attackTaskMap != null)
|
||||
attackTaskMap.remove(animal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -361,7 +371,7 @@ public class GenericHandler {
|
|||
|
||||
BindableHelper.applyBinding(held, player); // Bind item to the player
|
||||
}
|
||||
// If the binding exists, we'll check if the player's name has changed since they last used it and update that if so.
|
||||
// If the binding exists, we'll check if the player's name has changed since they last used it and update that if so.
|
||||
} else if (binding.getOwnerId().equals(player.getGameProfile().getId()) && !binding.getOwnerName().equals(player.getGameProfile().getName())) {
|
||||
binding.setOwnerName(player.getGameProfile().getName());
|
||||
BindableHelper.applyBinding(held, binding);
|
||||
|
@ -420,9 +430,9 @@ public class GenericHandler {
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRitualDeath(LivingDropsEvent event){
|
||||
if(!ConfigHandler.values.wellOfSufferingDrops){
|
||||
if(event.getSource().equals(RitualManager.RITUAL_DAMAGE)) {
|
||||
public static void onRitualDeath(LivingDropsEvent event) {
|
||||
if (!ConfigHandler.values.wellOfSufferingDrops) {
|
||||
if (event.getSource().equals(RitualManager.RITUAL_DAMAGE)) {
|
||||
event.getDrops().clear();
|
||||
}
|
||||
}
|
||||
|
@ -434,10 +444,12 @@ public class GenericHandler {
|
|||
EntityPlayer player = event.getEntityPlayer();
|
||||
ItemStack itemstack = EnchantmentHelper.getEnchantedItem(Enchantments.MENDING, player);
|
||||
|
||||
if (!itemstack.isEmpty() && itemstack.isItemDamaged()) {
|
||||
int i = Math.min(xpToDurability(event.getOrb().xpValue), itemstack.getItemDamage());
|
||||
event.getOrb().xpValue -= durabilityToXp(i);
|
||||
itemstack.setItemDamage(itemstack.getItemDamage() - i);
|
||||
if (!Loader.isModLoaded("unmending")) {
|
||||
if (!itemstack.isEmpty() && itemstack.isItemDamaged()) {
|
||||
int i = Math.min(xpToDurability(event.getOrb().xpValue), itemstack.getItemDamage());
|
||||
event.getOrb().xpValue -= durabilityToXp(i);
|
||||
itemstack.setItemDamage(itemstack.getItemDamage() - i);
|
||||
}
|
||||
}
|
||||
|
||||
if (!player.getEntityWorld().isRemote) {
|
||||
|
@ -459,6 +471,77 @@ public class GenericHandler {
|
|||
return durability / 2;
|
||||
}
|
||||
|
||||
// VeilOfEvil, WardOfSacrosanctity
|
||||
@SubscribeEvent
|
||||
public static void onLivingSpawnEvent(LivingSpawnEvent.CheckSpawn event) {
|
||||
World world = event.getWorld();
|
||||
|
||||
if (!(event.getEntityLiving() instanceof EntityMob)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* WardOfSacrosanctity */
|
||||
|
||||
if (preventSpawnMap.containsKey(world)) {
|
||||
Map<IMasterRitualStone, AreaDescriptor> pMap = preventSpawnMap.get(world);
|
||||
|
||||
if (pMap != null) {
|
||||
for (Map.Entry<IMasterRitualStone, AreaDescriptor> entry : pMap.entrySet()) {
|
||||
IMasterRitualStone masterRitualStone = entry.getKey();
|
||||
AreaDescriptor blockRange = entry.getValue();
|
||||
|
||||
if (masterRitualStone != null && masterRitualStone.isActive() && masterRitualStone.getCurrentRitual() instanceof RitualWardOfSacrosanctity) {
|
||||
if (blockRange.offset(masterRitualStone.getBlockPos()).isWithinArea(new BlockPos(event.getX(), event.getY(), event.getZ()))) {
|
||||
switch (event.getResult()) {
|
||||
case ALLOW:
|
||||
event.setResult(Result.DEFAULT);
|
||||
break;
|
||||
case DEFAULT:
|
||||
event.setResult(Result.DENY);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
pMap.remove(masterRitualStone);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* VeilOfEvil */
|
||||
|
||||
if (forceSpawnMap.containsKey(world)) {
|
||||
Map<IMasterRitualStone, AreaDescriptor> fMap = forceSpawnMap.get(world);
|
||||
|
||||
if (fMap != null) {
|
||||
for (Map.Entry<IMasterRitualStone, AreaDescriptor> entry : fMap.entrySet()) {
|
||||
IMasterRitualStone masterRitualStone = entry.getKey();
|
||||
AreaDescriptor blockRange = entry.getValue();
|
||||
|
||||
if (masterRitualStone != null && masterRitualStone.isActive() && masterRitualStone.getCurrentRitual() instanceof RitualVeilOfEvil) {
|
||||
if (blockRange.offset(masterRitualStone.getBlockPos()).isWithinArea(new BlockPos(event.getX(), event.getY(), event.getZ()))) {
|
||||
switch (event.getResult()) {
|
||||
case DEFAULT:
|
||||
event.setResult(Result.ALLOW);
|
||||
break;
|
||||
case DENY:
|
||||
event.setResult(Result.DEFAULT);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
fMap.remove(masterRitualStone);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onWorldLoad(WorldEvent.Load event) {
|
||||
World world = event.getWorld();
|
||||
|
@ -466,6 +549,8 @@ public class GenericHandler {
|
|||
filledHandMapMap.computeIfAbsent(world, k -> new HashMap<>());
|
||||
attackTaskMapMap.computeIfAbsent(world, k -> new HashMap<>());
|
||||
targetTaskMapMap.computeIfAbsent(world, k -> new HashMap<>());
|
||||
forceSpawnMap.computeIfAbsent(world, k -> new HashMap<>());
|
||||
preventSpawnMap.computeIfAbsent(world, k -> new HashMap<>());
|
||||
PotionEventHandlers.flightListMap.computeIfAbsent(world, k -> new ArrayList<>());
|
||||
PotionEventHandlers.noGravityListMap.computeIfAbsent(world, k -> new ArrayList<>());
|
||||
LocationsHandler.verifyIsInitialized();
|
||||
|
@ -474,12 +559,14 @@ public class GenericHandler {
|
|||
@SubscribeEvent
|
||||
public static void onWorldUnload(WorldEvent.Unload event) {
|
||||
World world = event.getWorld();
|
||||
bounceMapMap.get(world).clear();
|
||||
filledHandMapMap.get(world).clear();
|
||||
attackTaskMapMap.get(world).clear();
|
||||
targetTaskMapMap.get(world).clear();
|
||||
PotionEventHandlers.flightListMap.get(world).clear();
|
||||
PotionEventHandlers.noGravityListMap.get(world).clear();
|
||||
bounceMapMap.remove(world);
|
||||
filledHandMapMap.remove(world);
|
||||
attackTaskMapMap.remove(world);
|
||||
targetTaskMapMap.remove(world);
|
||||
forceSpawnMap.remove(world);
|
||||
preventSpawnMap.remove(world);
|
||||
PotionEventHandlers.flightListMap.remove(world);
|
||||
PotionEventHandlers.noGravityListMap.remove(world);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
package WayofTime.bloodmagic.util.handler.event;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.util.Constants;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
|
||||
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
||||
import WayofTime.bloodmagic.item.soul.ItemSentientBow;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeCrippledArm;
|
||||
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeQuenched;
|
||||
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeSlowHeal;
|
||||
|
@ -16,6 +15,7 @@ import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerFallProtect;
|
|||
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerGrimReaperSprint;
|
||||
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerJump;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.*;
|
||||
import WayofTime.bloodmagic.util.Constants;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -45,31 +45,24 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
|||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = BloodMagic.MODID)
|
||||
public class LivingArmourHandler
|
||||
{
|
||||
public class LivingArmourHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onEntityHealed(LivingHealEvent event)
|
||||
{
|
||||
if (event.getEntityLiving() instanceof EntityPlayer)
|
||||
{
|
||||
public static void onEntityHealed(LivingHealEvent event) {
|
||||
if (event.getEntityLiving() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.getEntity();
|
||||
if (LivingArmour.hasFullSet(player))
|
||||
{
|
||||
if (LivingArmour.hasFullSet(player)) {
|
||||
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
|
||||
if (armour != null)
|
||||
{
|
||||
if (armour != null) {
|
||||
double modifier = 1;
|
||||
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.slowHeal", chestStack);
|
||||
|
||||
if (upgrade instanceof LivingArmourUpgradeSlowHeal)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeSlowHeal) {
|
||||
modifier *= ((LivingArmourUpgradeSlowHeal) upgrade).getHealingModifier();
|
||||
}
|
||||
|
||||
if (modifier != 1)
|
||||
{
|
||||
if (modifier != 1) {
|
||||
event.setAmount((float) (event.getAmount() * modifier));
|
||||
}
|
||||
}
|
||||
|
@ -78,23 +71,18 @@ public class LivingArmourHandler
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onMiningSpeedCheck(PlayerEvent.BreakSpeed event)
|
||||
{
|
||||
public static void onMiningSpeedCheck(PlayerEvent.BreakSpeed event) {
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
if (LivingArmour.hasFullSet(player))
|
||||
{
|
||||
if (LivingArmour.hasFullSet(player)) {
|
||||
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
|
||||
if (armour != null)
|
||||
{
|
||||
if (armour != null) {
|
||||
double modifier = 1;
|
||||
for (LivingArmourUpgrade upgrade : armour.upgradeMap.values())
|
||||
{
|
||||
for (LivingArmourUpgrade upgrade : armour.upgradeMap.values()) {
|
||||
modifier *= upgrade.getMiningSpeedModifier(player);
|
||||
}
|
||||
|
||||
if (modifier != 1)
|
||||
{
|
||||
if (modifier != 1) {
|
||||
event.setNewSpeed((float) (event.getOriginalSpeed() * modifier));
|
||||
}
|
||||
}
|
||||
|
@ -103,31 +91,24 @@ public class LivingArmourHandler
|
|||
|
||||
// Applies: Storm Trooper
|
||||
@SubscribeEvent
|
||||
public static void onEntityJoinedWorld(EntityJoinWorldEvent event)
|
||||
{
|
||||
public static void onEntityJoinedWorld(EntityJoinWorldEvent event) {
|
||||
Entity owner = null;
|
||||
if (event.getEntity() instanceof EntityArrow)
|
||||
{
|
||||
if (event.getEntity() instanceof EntityArrow) {
|
||||
owner = ((EntityArrow) event.getEntity()).shootingEntity;
|
||||
} else if (event.getEntity() instanceof EntityThrowable)
|
||||
{
|
||||
} else if (event.getEntity() instanceof EntityThrowable) {
|
||||
owner = ((EntityThrowable) event.getEntity()).getThrower();
|
||||
}
|
||||
|
||||
if (owner instanceof EntityPlayer)
|
||||
{
|
||||
if (owner instanceof EntityPlayer) {
|
||||
Entity projectile = event.getEntity();
|
||||
EntityPlayer player = (EntityPlayer) owner;
|
||||
if (LivingArmour.hasFullSet(player))
|
||||
{
|
||||
if (LivingArmour.hasFullSet(player)) {
|
||||
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
|
||||
if (armour != null)
|
||||
{
|
||||
if (armour != null) {
|
||||
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.stormTrooper", chestStack);
|
||||
|
||||
if (upgrade instanceof LivingArmourUpgradeStormTrooper)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeStormTrooper) {
|
||||
float velocityModifier = (float) (((LivingArmourUpgradeStormTrooper) upgrade).getArrowJiggle(player) * Math.sqrt(projectile.motionX * projectile.motionX + projectile.motionY * projectile.motionY + projectile.motionZ * projectile.motionZ));
|
||||
|
||||
projectile.motionX += 2 * (event.getWorld().rand.nextDouble() - 0.5) * velocityModifier;
|
||||
|
@ -140,37 +121,28 @@ public class LivingArmourHandler
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onPlayerClick(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.isCancelable())
|
||||
{
|
||||
public static void onPlayerClick(PlayerInteractEvent event) {
|
||||
if (event.isCancelable()) {
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
|
||||
if (LivingArmour.hasFullSet(player))
|
||||
{
|
||||
if (LivingArmour.hasFullSet(player)) {
|
||||
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
|
||||
if (armour != null)
|
||||
{
|
||||
if (event.getHand() == EnumHand.OFF_HAND)
|
||||
{
|
||||
if (armour != null) {
|
||||
if (event.getHand() == EnumHand.OFF_HAND) {
|
||||
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.crippledArm", chestStack);
|
||||
|
||||
if (upgrade instanceof LivingArmourUpgradeCrippledArm)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeCrippledArm) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getItemStack().getItemUseAction() == EnumAction.DRINK)
|
||||
{
|
||||
if (event.getItemStack().getItemUseAction() == EnumAction.DRINK) {
|
||||
ItemStack drinkStack = event.getItemStack();
|
||||
if (!(drinkStack.getItem() instanceof ItemSplashPotion))
|
||||
{
|
||||
if (!(drinkStack.getItem() instanceof ItemSplashPotion)) {
|
||||
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.quenched", chestStack);
|
||||
|
||||
if (upgrade instanceof LivingArmourUpgradeQuenched)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeQuenched) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
@ -182,24 +154,19 @@ public class LivingArmourHandler
|
|||
|
||||
// Applies: Grim Reaper
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
public static void onEntityDeath(LivingDeathEvent event)
|
||||
{
|
||||
if (event.getEntityLiving() instanceof EntityPlayer)
|
||||
{
|
||||
public static void onEntityDeath(LivingDeathEvent event) {
|
||||
if (event.getEntityLiving() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
||||
|
||||
if (LivingArmour.hasFullSet(player))
|
||||
{
|
||||
if (LivingArmour.hasFullSet(player)) {
|
||||
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
|
||||
if (armour != null)
|
||||
{
|
||||
if (armour != null) {
|
||||
StatTrackerGrimReaperSprint.incrementCounter(armour);
|
||||
|
||||
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.grimReaper", chestStack);
|
||||
|
||||
if (upgrade instanceof LivingArmourUpgradeGrimReaperSprint && ((LivingArmourUpgradeGrimReaperSprint) upgrade).canSavePlayer(player))
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeGrimReaperSprint && ((LivingArmourUpgradeGrimReaperSprint) upgrade).canSavePlayer(player)) {
|
||||
((LivingArmourUpgradeGrimReaperSprint) upgrade).applyEffectOnRebirth(player);
|
||||
event.setCanceled(true);
|
||||
event.setResult(Event.Result.DENY);
|
||||
|
@ -213,26 +180,20 @@ public class LivingArmourHandler
|
|||
|
||||
// Applies: Jump
|
||||
@SubscribeEvent
|
||||
public static void onJumpEvent(LivingEvent.LivingJumpEvent event)
|
||||
{
|
||||
if (event.getEntityLiving() instanceof EntityPlayer)
|
||||
{
|
||||
public static void onJumpEvent(LivingEvent.LivingJumpEvent event) {
|
||||
if (event.getEntityLiving() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
||||
|
||||
if (LivingArmour.hasFullSet(player))
|
||||
{
|
||||
if (LivingArmour.hasFullSet(player)) {
|
||||
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
|
||||
if (armour != null)
|
||||
{
|
||||
if (armour != null) {
|
||||
StatTrackerJump.incrementCounter(armour);
|
||||
|
||||
if (!player.isSneaking())
|
||||
{
|
||||
if (!player.isSneaking()) {
|
||||
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgradeFromNBT(BloodMagic.MODID + ".upgrade.jump", chestStack);
|
||||
|
||||
if (upgrade instanceof LivingArmourUpgradeJump)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeJump) {
|
||||
player.motionY += ((LivingArmourUpgradeJump) upgrade).getJumpModifier();
|
||||
}
|
||||
}
|
||||
|
@ -243,34 +204,25 @@ public class LivingArmourHandler
|
|||
|
||||
// Applies: Step Assist, Speed Boost
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
public static void onEntityUpdate(LivingEvent.LivingUpdateEvent event)
|
||||
{
|
||||
if (event.getEntityLiving() instanceof EntityPlayer)
|
||||
{
|
||||
public static void onEntityUpdate(LivingEvent.LivingUpdateEvent event) {
|
||||
if (event.getEntityLiving() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
||||
boolean hasAssist = false;
|
||||
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST))
|
||||
{
|
||||
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST)) {
|
||||
hasAssist = true;
|
||||
player.stepHeight = Constants.Misc.ALTERED_STEP_HEIGHT;
|
||||
} else
|
||||
{
|
||||
if (LivingArmour.hasFullSet(player))
|
||||
{
|
||||
} else {
|
||||
if (LivingArmour.hasFullSet(player)) {
|
||||
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
LivingArmour armour = ItemLivingArmour.getLivingArmourFromStack(chestStack);
|
||||
if (armour != null)
|
||||
{
|
||||
if (armour != null) {
|
||||
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.stepAssist", chestStack);
|
||||
|
||||
if (upgrade instanceof LivingArmourUpgradeStepAssist)
|
||||
{
|
||||
if (!player.isSneaking())
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeStepAssist) {
|
||||
if (!player.isSneaking()) {
|
||||
player.stepHeight = ((LivingArmourUpgradeStepAssist) upgrade).getStepAssist();
|
||||
hasAssist = true;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
player.stepHeight = 0.6F;
|
||||
}
|
||||
}
|
||||
|
@ -283,32 +235,20 @@ public class LivingArmourHandler
|
|||
|
||||
float percentIncrease = 0;
|
||||
|
||||
if (LivingArmour.hasFullSet(player))
|
||||
{
|
||||
if (LivingArmour.hasFullSet(player)) {
|
||||
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
LivingArmour armour = ItemLivingArmour.getLivingArmourFromStack(chestStack);
|
||||
if (armour != null)
|
||||
{
|
||||
if (armour != null) {
|
||||
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgradeFromNBT(BloodMagic.MODID + ".upgrade.movement", chestStack);
|
||||
|
||||
if (upgrade instanceof LivingArmourUpgradeSpeed)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeSpeed) {
|
||||
percentIncrease += ((LivingArmourUpgradeSpeed) upgrade).getSpeedModifier();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST))
|
||||
{
|
||||
int i = event.getEntityLiving().getActivePotionEffect(RegistrarBloodMagic.BOOST).getAmplifier();
|
||||
{
|
||||
percentIncrease += (i + 1) * 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
if (percentIncrease > 0 && (player.onGround || player.capabilities.isFlying) && (Math.abs(player.moveForward) > 0 || Math.abs(player.moveStrafing) > 0))
|
||||
{
|
||||
player.travel(player.moveStrafing * percentIncrease, 0, player.moveForward * percentIncrease);
|
||||
if (percentIncrease != 0 && (player.onGround || player.capabilities.isFlying) && (Math.abs(player.moveForward) > 0 || Math.abs(player.moveStrafing) > 0)) {
|
||||
player.travel(player.moveStrafing * percentIncrease, player.capabilities.isFlying ? player.moveVertical * percentIncrease : 0, player.moveForward * percentIncrease);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -316,8 +256,7 @@ public class LivingArmourHandler
|
|||
// Applies: Arrow Shot
|
||||
// Tracks: Arrow Shot
|
||||
@SubscribeEvent
|
||||
public static void onArrowFire(ArrowLooseEvent event)
|
||||
{
|
||||
public static void onArrowFire(ArrowLooseEvent event) {
|
||||
World world = event.getEntityPlayer().getEntityWorld();
|
||||
ItemStack stack = event.getBow();
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
|
@ -326,17 +265,14 @@ public class LivingArmourHandler
|
|||
if (world.isRemote)
|
||||
return;
|
||||
|
||||
if (LivingArmour.hasFullSet(player))
|
||||
{
|
||||
if (LivingArmour.hasFullSet(player)) {
|
||||
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
|
||||
if (armour != null)
|
||||
{
|
||||
if (armour != null) {
|
||||
StatTrackerArrowShot.incrementCounter(armour);
|
||||
|
||||
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.arrowShot", chestStack);
|
||||
if (upgrade instanceof LivingArmourUpgradeArrowShot)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeArrowShot) {
|
||||
int charge = event.getCharge();
|
||||
float velocity = (float) charge / 20.0F;
|
||||
velocity = (velocity * velocity + velocity * 2.0F) / 3.0F;
|
||||
|
@ -350,8 +286,7 @@ public class LivingArmourHandler
|
|||
sentientShot = true;
|
||||
}
|
||||
int extraArrows = ((LivingArmourUpgradeArrowShot) upgrade).getExtraArrows();
|
||||
for (int n = 0; n < extraArrows; n++)
|
||||
{
|
||||
for (int n = 0; n < extraArrows; n++) {
|
||||
ItemStack arrowStack = new ItemStack(Items.ARROW);
|
||||
ItemArrow itemarrow = (ItemArrow) ((stack.getItem() instanceof ItemArrow ? arrowStack.getItem() : Items.ARROW));
|
||||
EntityArrow entityarrow;
|
||||
|
@ -392,21 +327,19 @@ public class LivingArmourHandler
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Applies: Softfall
|
||||
@SubscribeEvent
|
||||
public static void onPlayerFall(LivingFallEvent event) {
|
||||
if (event.getEntityLiving() instanceof EntityPlayer)
|
||||
{
|
||||
if (event.getEntityLiving() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
||||
|
||||
if (LivingArmour.hasFullSet(player))
|
||||
{
|
||||
if (LivingArmour.hasFullSet(player)) {
|
||||
|
||||
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
|
||||
if (armour != null)
|
||||
{
|
||||
if (armour != null) {
|
||||
StatTrackerFallProtect.incrementCounter(armour, event.getDamageMultiplier() * (event.getDistance() - 3));
|
||||
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.fallProtect", chestStack);
|
||||
if (upgrade instanceof LivingArmourUpgradeFallProtect) {
|
||||
|
@ -417,17 +350,14 @@ public class LivingArmourHandler
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Applies: Arrow Shot
|
||||
@SubscribeEvent
|
||||
public static void onProjectileImpact(ProjectileImpactEvent.Arrow event)
|
||||
{
|
||||
if (event.getArrow().removeTag("arrow_shot"))
|
||||
{
|
||||
public static void onProjectileImpact(ProjectileImpactEvent.Arrow event) {
|
||||
if (event.getArrow().removeTag("arrow_shot")) {
|
||||
Entity entity = event.getRayTraceResult().entityHit;
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
if (entity != null) {
|
||||
entity.hurtResistantTime = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class IncenseHelper {
|
|||
data.setDouble(Constants.NBT.CURRENT_INCENSE, amount);
|
||||
}
|
||||
|
||||
public static void setMaxIncense(EntityPlayer player, double amount){
|
||||
public static void setMaxIncense(EntityPlayer player, double amount) {
|
||||
NBTTagCompound data = player.getEntityData();
|
||||
data.setDouble(Constants.NBT.MAX_INCENSE, amount);
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ public class IncenseHelper {
|
|||
stack = NBTHelper.checkNBT(stack);
|
||||
stack.getTagCompound().setBoolean(Constants.NBT.HAS_MAX_INCENSE, isMax);
|
||||
}
|
||||
|
||||
public static boolean getHasMaxIncense(ItemStack stack) {
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
return stack.getTagCompound().getBoolean(Constants.NBT.HAS_MAX_INCENSE);
|
||||
|
|
|
@ -115,12 +115,11 @@ public class NetworkHelper {
|
|||
/**
|
||||
* Syphons a player from within a container.
|
||||
*
|
||||
* @param stack - ItemStack in the Container.
|
||||
* @param ticket - SoulTicket to syphon
|
||||
* @param stack - ItemStack in the Container.
|
||||
* @param ticket - SoulTicket to syphon
|
||||
* @return - If the syphon was successful.
|
||||
*/
|
||||
public static boolean syphonFromContainer(ItemStack stack, SoulTicket ticket)
|
||||
{
|
||||
public static boolean syphonFromContainer(ItemStack stack, SoulTicket ticket) {
|
||||
if (!(stack.getItem() instanceof IBindable))
|
||||
return false;
|
||||
|
||||
|
@ -131,7 +130,7 @@ public class NetworkHelper {
|
|||
SoulNetwork network = getSoulNetwork(binding);
|
||||
SoulNetworkEvent.Syphon.Item event = new SoulNetworkEvent.Syphon.Item(network, ticket, stack);
|
||||
|
||||
return !MinecraftForge.EVENT_BUS.post(event) && network.syphon(event.getTicket(),true) >= ticket.getAmount();
|
||||
return !MinecraftForge.EVENT_BUS.post(event) && network.syphon(event.getTicket(), true) >= ticket.getAmount();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,7 +35,7 @@ public class PlayerSacrificeHelper {
|
|||
amount = amount + Math.min(increment, incenseAddition - amount);
|
||||
setPlayerIncense(player, amount);
|
||||
|
||||
if(amount == incenseAddition) {
|
||||
if (amount == incenseAddition) {
|
||||
IncenseHelper.setMaxIncense(player, incenseAddition);
|
||||
}
|
||||
// System.out.println("Amount of incense: " + amount + ", Increment: " +
|
||||
|
@ -66,11 +66,15 @@ public class PlayerSacrificeHelper {
|
|||
float sacrificedHealth = health - maxHealth / 10.0f;
|
||||
int lpAdded = (int) (sacrificedHealth * ConfigHandler.values.sacrificialDaggerConversion * getModifier(amount));
|
||||
|
||||
SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(player, true, true, (int) sacrificedHealth, lpAdded);
|
||||
if (MinecraftForge.EVENT_BUS.post(evt))
|
||||
return false;
|
||||
IBloodAltar altar = getAltar(player.getEntityWorld(), player.getPosition());
|
||||
if (altar != null) {
|
||||
SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(player, true, true, (int) sacrificedHealth, lpAdded);
|
||||
if (MinecraftForge.EVENT_BUS.post(evt))
|
||||
return false;
|
||||
|
||||
altar.sacrificialDaggerCall(evt.lpAdded, false);
|
||||
altar.startCycle();
|
||||
|
||||
if (findAndFillAltar(player.getEntityWorld(), player, evt.lpAdded, false)) {
|
||||
player.setHealth(maxHealth / 10.0f);
|
||||
setPlayerIncense(player, 0);
|
||||
player.addPotionEffect(new PotionEffect(RegistrarBloodMagic.SOUL_FRAY, soulFrayDuration));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue