Added new potion effects for bouncing as well as clinging to walls - the sigils will come later (Hai, Yulife~)
This commit is contained in:
parent
2e192ff29c
commit
5ad3c0eda1
|
@ -221,8 +221,6 @@ public class LivingArmour implements ILivingArmour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean allowOnlyDowngrades = player.isPotionActive(ModPotions.immuneSuppress);
|
|
||||||
|
|
||||||
for (Entry<String, StatTracker> entry : trackerMap.entrySet())
|
for (Entry<String, StatTracker> entry : trackerMap.entrySet())
|
||||||
{
|
{
|
||||||
StatTracker tracker = entry.getValue();
|
StatTracker tracker = entry.getValue();
|
||||||
|
|
|
@ -21,7 +21,8 @@ public class ModPotions
|
||||||
public static Potion plantLeech;
|
public static Potion plantLeech;
|
||||||
public static Potion deafness;
|
public static Potion deafness;
|
||||||
|
|
||||||
public static Potion immuneSuppress;
|
public static Potion bounce;
|
||||||
|
public static Potion cling;
|
||||||
|
|
||||||
public static void init()
|
public static void init()
|
||||||
{
|
{
|
||||||
|
@ -49,7 +50,8 @@ public class ModPotions
|
||||||
constrict = registerPotion("Constriction", new ResourceLocation("constrict"), true, 0x000000, 6, 0);
|
constrict = registerPotion("Constriction", new ResourceLocation("constrict"), true, 0x000000, 6, 0);
|
||||||
plantLeech = registerPotion("Plant Leech", new ResourceLocation("plantLeech"), true, 0x000000, 7, 0);
|
plantLeech = registerPotion("Plant Leech", new ResourceLocation("plantLeech"), true, 0x000000, 7, 0);
|
||||||
deafness = registerPotion("Deaf", new ResourceLocation("deafness"), true, 0x000000, 0, 1);
|
deafness = registerPotion("Deaf", new ResourceLocation("deafness"), true, 0x000000, 0, 1);
|
||||||
immuneSuppress = registerPotion("(-) Immunity", new ResourceLocation("immuneSuppress"), true, 0x000000, 1, 1);
|
bounce = registerPotion("Bounce", new ResourceLocation("bounce"), false, 0x000000, 1, 1);
|
||||||
|
cling = registerPotion("Cling", new ResourceLocation("cling"), false, 0x000000, 2, 1);
|
||||||
// heavyHeart = new PotionBloodMagic("Heavy Heart", new
|
// heavyHeart = new PotionBloodMagic("Heavy Heart", new
|
||||||
// ResourceLocation(resourceLocation +
|
// ResourceLocation(resourceLocation +
|
||||||
// heavyHeart.getName().toLowerCase()), true, 0, 0, 0);
|
// heavyHeart.getName().toLowerCase()), true, 0, 0, 0);
|
||||||
|
|
|
@ -455,10 +455,13 @@ public class ModRecipes
|
||||||
addPotionRecipe(1000, 1, new ItemStack(Items.GLASS_BOTTLE), new PotionEffect(MobEffects.INVISIBILITY, 2 * 60 * 20));
|
addPotionRecipe(1000, 1, new ItemStack(Items.GLASS_BOTTLE), new PotionEffect(MobEffects.INVISIBILITY, 2 * 60 * 20));
|
||||||
addPotionRecipe(1000, 1, new ItemStack(Items.POISONOUS_POTATO), new PotionEffect(MobEffects.SATURATION, 1));
|
addPotionRecipe(1000, 1, new ItemStack(Items.POISONOUS_POTATO), new PotionEffect(MobEffects.SATURATION, 1));
|
||||||
addPotionRecipe(1000, 1, new ItemStack(ModItems.BLOOD_SHARD, 1, 0), new PotionEffect(MobEffects.HEALTH_BOOST, 2 * 60 * 20));
|
addPotionRecipe(1000, 1, new ItemStack(ModItems.BLOOD_SHARD, 1, 0), new PotionEffect(MobEffects.HEALTH_BOOST, 2 * 60 * 20));
|
||||||
|
addPotionRecipe(100, 1, new ItemStack(Blocks.SLIME_BLOCK), new PotionEffect(ModPotions.bounce, 2 * 60 * 20));
|
||||||
|
addPotionRecipe(100, 1, new ItemStack(Items.STRING), new PotionEffect(ModPotions.cling, 2 * 60 * 20));
|
||||||
|
|
||||||
addPotionRecipe(1000, 1, new ItemStack(Items.BEETROOT), new PotionEffect(ModPotions.deafness, 450));
|
addPotionRecipe(1000, 1, new ItemStack(Items.BEETROOT), new PotionEffect(ModPotions.deafness, 450));
|
||||||
|
|
||||||
AlchemyTableRecipeRegistry.registerRecipe(new AlchemyTablePotionRecipe(5000, 100, 4, ItemLivingArmourPointsUpgrade.getStack(ItemLivingArmourPointsUpgrade.DRAFT_ANGELUS), new PotionEffect(ModPotions.immuneSuppress, 15 * 60 * 20)));
|
// AlchemyTableRecipeRegistry.registerRecipe(new AlchemyTablePotionRecipe(5000, 100, 4, new ItemStack(Blocks.SLIME_BLOCK), new PotionEffect(ModPotions.bounce, 15 * 60 * 20)));
|
||||||
|
// AlchemyTableRecipeRegistry.registerRecipe(new AlchemyTablePotionRecipe(5000, 100, 4, new ItemStack(Items.STRING), new PotionEffect(ModPotions.bounce, 15 * 60 * 20)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ItemStack mundaneLengtheningStack = ItemComponent.getStack(ItemComponent.CATALYST_LENGTH_1);
|
static ItemStack mundaneLengtheningStack = ItemComponent.getStack(ItemComponent.CATALYST_LENGTH_1);
|
||||||
|
|
|
@ -93,6 +93,29 @@ public class Utils
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isPlayerBesideSolidBlockFace(EntityPlayer player)
|
||||||
|
{
|
||||||
|
World world = player.worldObj;
|
||||||
|
double minimumDistanceFromAxis = 0.7;
|
||||||
|
BlockPos centralPos = player.getPosition();
|
||||||
|
for (EnumFacing facing : EnumFacing.HORIZONTALS)
|
||||||
|
{
|
||||||
|
BlockPos offsetPos = centralPos.offset(facing);
|
||||||
|
double distance = Math.min(offsetPos.getX() + 0.5 - player.posX, offsetPos.getZ() + 0.5 - player.posZ);
|
||||||
|
if (distance > minimumDistanceFromAxis)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
IBlockState state = world.getBlockState(offsetPos);
|
||||||
|
if (state.isSideSolid(world, offsetPos, facing.getOpposite()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean canPlayerSeeDemonWill(EntityPlayer player)
|
public static boolean canPlayerSeeDemonWill(EntityPlayer player)
|
||||||
{
|
{
|
||||||
ItemStack[] mainInventory = player.inventory.mainInventory;
|
ItemStack[] mainInventory = player.inventory.mainInventory;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package WayofTime.bloodmagic.util.handler.event;
|
package WayofTime.bloodmagic.util.handler.event;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
@ -28,6 +30,7 @@ import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.entity.item.ItemTossEvent;
|
import net.minecraftforge.event.entity.item.ItemTossEvent;
|
||||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
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.LivingHurtEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
|
@ -36,6 +39,7 @@ import net.minecraftforge.event.world.ExplosionEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||||
import WayofTime.bloodmagic.ConfigHandler;
|
import WayofTime.bloodmagic.ConfigHandler;
|
||||||
import WayofTime.bloodmagic.annot.Handler;
|
import WayofTime.bloodmagic.annot.Handler;
|
||||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||||
|
@ -71,6 +75,7 @@ import WayofTime.bloodmagic.potion.BMPotionUtils;
|
||||||
import WayofTime.bloodmagic.registry.ModItems;
|
import WayofTime.bloodmagic.registry.ModItems;
|
||||||
import WayofTime.bloodmagic.registry.ModPotions;
|
import WayofTime.bloodmagic.registry.ModPotions;
|
||||||
import WayofTime.bloodmagic.util.ChatUtil;
|
import WayofTime.bloodmagic.util.ChatUtil;
|
||||||
|
import WayofTime.bloodmagic.util.Utils;
|
||||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
|
@ -78,6 +83,42 @@ import com.google.common.base.Strings;
|
||||||
@Handler
|
@Handler
|
||||||
public class GenericHandler
|
public class GenericHandler
|
||||||
{
|
{
|
||||||
|
public Map<EntityPlayer, Double> bounceMap = new HashMap<EntityPlayer, Double>();
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onEntityFall(LivingFallEvent event)
|
||||||
|
{
|
||||||
|
if (event.getEntityLiving() instanceof EntityPlayer)
|
||||||
|
{
|
||||||
|
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
||||||
|
if (player.isPotionActive(ModPotions.bounce) && !player.isSneaking() && event.getDistance() > 2)
|
||||||
|
{
|
||||||
|
event.setDamageMultiplier(0);
|
||||||
|
|
||||||
|
if (player.worldObj.isRemote)
|
||||||
|
{
|
||||||
|
player.motionY *= -0.9;
|
||||||
|
player.isAirBorne = true;
|
||||||
|
player.onGround = false;
|
||||||
|
bounceMap.put(player, player.motionY);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
player.fallDistance = 0;
|
||||||
|
event.setCanceled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void playerTickPost(TickEvent.PlayerTickEvent event)
|
||||||
|
{
|
||||||
|
if (event.phase == TickEvent.Phase.END && bounceMap.containsKey(event.player))
|
||||||
|
{
|
||||||
|
event.player.motionY = bounceMap.remove(event.player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onPlayerClick(PlayerInteractEvent event)
|
public void onPlayerClick(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
|
@ -187,6 +228,17 @@ public class GenericHandler
|
||||||
|
|
||||||
EntityLivingBase entity = event.getEntityLiving();
|
EntityLivingBase entity = event.getEntityLiving();
|
||||||
|
|
||||||
|
if (entity instanceof EntityPlayer)
|
||||||
|
{
|
||||||
|
EntityPlayer player = (EntityPlayer) entity;
|
||||||
|
if (player.worldObj.isRemote && player.isSneaking() && player.isPotionActive(ModPotions.cling) && Utils.isPlayerBesideSolidBlockFace(player) && !player.onGround)
|
||||||
|
{
|
||||||
|
player.motionY = 0;
|
||||||
|
player.motionX *= 0.8;
|
||||||
|
player.motionZ *= 0.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (entity.isPotionActive(MobEffects.NIGHT_VISION))
|
if (entity.isPotionActive(MobEffects.NIGHT_VISION))
|
||||||
{
|
{
|
||||||
int duration = entity.getActivePotionEffect(MobEffects.NIGHT_VISION).getDuration();
|
int duration = entity.getActivePotionEffect(MobEffects.NIGHT_VISION).getDuration();
|
||||||
|
|
Loading…
Reference in a new issue