Small bit of framework for Soul Breath items, plus testing with the "Scroll of Icarus". Crafting mechanic as well as refilling of its resource not implemented.

This commit is contained in:
WayofTime 2018-04-28 21:56:57 -04:00
parent 560d167765
commit eb6b8a3aa5
7 changed files with 174 additions and 58 deletions

View file

@ -1,14 +1,5 @@
package WayofTime.bloodmagic.core;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.orb.BloodOrb;
import WayofTime.bloodmagic.core.registry.OrbRegistry;
import WayofTime.bloodmagic.entity.mob.*;
import WayofTime.bloodmagic.entity.projectile.EntityBloodLight;
import WayofTime.bloodmagic.entity.projectile.EntityMeteor;
import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow;
import WayofTime.bloodmagic.entity.projectile.EntitySoulSnare;
import WayofTime.bloodmagic.potion.PotionBloodMagic;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.init.MobEffects;
import net.minecraft.potion.Potion;
@ -25,6 +16,20 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.RegistryBuilder;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.core.registry.OrbRegistry;
import WayofTime.bloodmagic.entity.mob.EntityCorruptedChicken;
import WayofTime.bloodmagic.entity.mob.EntityCorruptedSheep;
import WayofTime.bloodmagic.entity.mob.EntityCorruptedSpider;
import WayofTime.bloodmagic.entity.mob.EntityCorruptedZombie;
import WayofTime.bloodmagic.entity.mob.EntityMimic;
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
import WayofTime.bloodmagic.entity.projectile.EntityBloodLight;
import WayofTime.bloodmagic.entity.projectile.EntityMeteor;
import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow;
import WayofTime.bloodmagic.entity.projectile.EntitySoulSnare;
import WayofTime.bloodmagic.orb.BloodOrb;
import WayofTime.bloodmagic.potion.PotionBloodMagic;
@Mod.EventBusSubscriber(modid = BloodMagic.MODID)
@GameRegistry.ObjectHolder(BloodMagic.MODID)
@ -57,6 +62,7 @@ public class RegistrarBloodMagic
public static final Potion BOUNCE = MobEffects.HASTE;
public static final Potion CLING = MobEffects.HASTE;
public static final Potion SACRIFICIAL_LAMB = MobEffects.HASTE;
public static final Potion FLIGHT = MobEffects.HASTE;
public static IForgeRegistry<BloodOrb> BLOOD_ORBS = null;
@ -88,7 +94,8 @@ public class RegistrarBloodMagic
new PotionBloodMagic("Deaf", true, 0x000000, 0, 1).setRegistryName("deafness"),
new PotionBloodMagic("Bounce", false, 0x000000, 1, 1).setRegistryName("bounce"),
new PotionBloodMagic("Cling", false, 0x000000, 2, 1).setRegistryName("cling"),
new PotionBloodMagic("S. Lamb", false, 0x000000, 3, 1).setRegistryName("sacrificial_lamb")
new PotionBloodMagic("S. Lamb", false, 0x000000, 3, 1).setRegistryName("sacrificial_lamb"),
new PotionBloodMagic("Flight", false, 0x000000, 4, 0).setRegistryName("flight")
);
}

View file

@ -1,29 +1,11 @@
package WayofTime.bloodmagic.core;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.block.IBMBlock;
import WayofTime.bloodmagic.client.IMeshProvider;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.item.*;
import WayofTime.bloodmagic.item.alchemy.ItemCuttingFluid;
import WayofTime.bloodmagic.item.alchemy.ItemLivingArmourPointsUpgrade;
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
import WayofTime.bloodmagic.item.armour.ItemSentientArmour;
import WayofTime.bloodmagic.item.gear.ItemPackSacrifice;
import WayofTime.bloodmagic.item.gear.ItemPackSelfSacrifice;
import WayofTime.bloodmagic.item.routing.ItemFluidRouterFilter;
import WayofTime.bloodmagic.item.routing.ItemNodeRouter;
import WayofTime.bloodmagic.item.routing.ItemRouterFilter;
import WayofTime.bloodmagic.item.sigil.*;
import WayofTime.bloodmagic.item.soul.*;
import WayofTime.bloodmagic.item.types.ComponentTypes;
import WayofTime.bloodmagic.item.types.ShardType;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import java.util.List;
import java.util.Set;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.init.Items;
import net.minecraft.inventory.EntityEquipmentSlot;
@ -38,9 +20,81 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.block.IBMBlock;
import WayofTime.bloodmagic.client.IMeshProvider;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.item.ItemActivationCrystal;
import WayofTime.bloodmagic.item.ItemAlchemicVial;
import WayofTime.bloodmagic.item.ItemAltarMaker;
import WayofTime.bloodmagic.item.ItemArcaneAshes;
import WayofTime.bloodmagic.item.ItemBloodOrb;
import WayofTime.bloodmagic.item.ItemBoundAxe;
import WayofTime.bloodmagic.item.ItemBoundPickaxe;
import WayofTime.bloodmagic.item.ItemBoundShovel;
import WayofTime.bloodmagic.item.ItemBoundSword;
import WayofTime.bloodmagic.item.ItemDaggerOfSacrifice;
import WayofTime.bloodmagic.item.ItemDemonCrystal;
import WayofTime.bloodmagic.item.ItemDemonWillGauge;
import WayofTime.bloodmagic.item.ItemEnum;
import WayofTime.bloodmagic.item.ItemExperienceBook;
import WayofTime.bloodmagic.item.ItemInscriptionTool;
import WayofTime.bloodmagic.item.ItemLavaCrystal;
import WayofTime.bloodmagic.item.ItemPotionFlask;
import WayofTime.bloodmagic.item.ItemRitualDiviner;
import WayofTime.bloodmagic.item.ItemRitualReader;
import WayofTime.bloodmagic.item.ItemSacrificialDagger;
import WayofTime.bloodmagic.item.ItemSanguineBook;
import WayofTime.bloodmagic.item.ItemSlate;
import WayofTime.bloodmagic.item.ItemTelepositionFocus;
import WayofTime.bloodmagic.item.ItemUpgradeTome;
import WayofTime.bloodmagic.item.ItemUpgradeTrainer;
import WayofTime.bloodmagic.item.alchemy.ItemCuttingFluid;
import WayofTime.bloodmagic.item.alchemy.ItemLivingArmourPointsUpgrade;
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
import WayofTime.bloodmagic.item.armour.ItemSentientArmour;
import WayofTime.bloodmagic.item.gear.ItemPackSacrifice;
import WayofTime.bloodmagic.item.gear.ItemPackSelfSacrifice;
import WayofTime.bloodmagic.item.routing.ItemFluidRouterFilter;
import WayofTime.bloodmagic.item.routing.ItemNodeRouter;
import WayofTime.bloodmagic.item.routing.ItemRouterFilter;
import WayofTime.bloodmagic.item.sigil.ItemSigilAir;
import WayofTime.bloodmagic.item.sigil.ItemSigilBloodLight;
import WayofTime.bloodmagic.item.sigil.ItemSigilBounce;
import WayofTime.bloodmagic.item.sigil.ItemSigilClaw;
import WayofTime.bloodmagic.item.sigil.ItemSigilCompression;
import WayofTime.bloodmagic.item.sigil.ItemSigilDivination;
import WayofTime.bloodmagic.item.sigil.ItemSigilElementalAffinity;
import WayofTime.bloodmagic.item.sigil.ItemSigilEnderSeverance;
import WayofTime.bloodmagic.item.sigil.ItemSigilFastMiner;
import WayofTime.bloodmagic.item.sigil.ItemSigilFrost;
import WayofTime.bloodmagic.item.sigil.ItemSigilGreenGrove;
import WayofTime.bloodmagic.item.sigil.ItemSigilHaste;
import WayofTime.bloodmagic.item.sigil.ItemSigilHolding;
import WayofTime.bloodmagic.item.sigil.ItemSigilLava;
import WayofTime.bloodmagic.item.sigil.ItemSigilMagnetism;
import WayofTime.bloodmagic.item.sigil.ItemSigilPhantomBridge;
import WayofTime.bloodmagic.item.sigil.ItemSigilSuppression;
import WayofTime.bloodmagic.item.sigil.ItemSigilTeleposition;
import WayofTime.bloodmagic.item.sigil.ItemSigilTransposition;
import WayofTime.bloodmagic.item.sigil.ItemSigilVoid;
import WayofTime.bloodmagic.item.sigil.ItemSigilWater;
import WayofTime.bloodmagic.item.sigil.ItemSigilWhirlwind;
import WayofTime.bloodmagic.item.soul.ItemMonsterSoul;
import WayofTime.bloodmagic.item.soul.ItemSentientArmourGem;
import WayofTime.bloodmagic.item.soul.ItemSentientAxe;
import WayofTime.bloodmagic.item.soul.ItemSentientBow;
import WayofTime.bloodmagic.item.soul.ItemSentientPickaxe;
import WayofTime.bloodmagic.item.soul.ItemSentientShovel;
import WayofTime.bloodmagic.item.soul.ItemSentientSword;
import WayofTime.bloodmagic.item.soul.ItemSoulGem;
import WayofTime.bloodmagic.item.soul.ItemSoulSnare;
import WayofTime.bloodmagic.item.soulBreath.ItemFlightScroll;
import WayofTime.bloodmagic.item.types.ComponentTypes;
import WayofTime.bloodmagic.item.types.ShardType;
import java.util.List;
import java.util.Set;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
@Mod.EventBusSubscriber(modid = BloodMagic.MODID)
@GameRegistry.ObjectHolder(BloodMagic.MODID)
@ -121,6 +175,7 @@ public class RegistrarBloodMagicItems
public static final Item DEMON_WILL_GAUGE = Items.AIR;
public static final Item POTION_FLASK = Items.AIR;
public static final Item ALCHEMIC_VIAL = Items.AIR;
public static final Item ICARUS_SCROLL = Items.AIR;
public static Item.ToolMaterial BOUND_TOOL_MATERIAL = EnumHelper.addToolMaterial("bound", 4, 1, 10, 8, 50);
public static Item.ToolMaterial SOUL_TOOL_MATERIAL = EnumHelper.addToolMaterial("demonic", 4, 520, 7, 8, 50);
@ -211,7 +266,8 @@ public class RegistrarBloodMagicItems
new ItemLivingArmourPointsUpgrade().setRegistryName("points_upgrade"),
new ItemDemonWillGauge().setRegistryName("demon_will_gauge"),
new ItemPotionFlask().setRegistryName("potion_flask"),
new ItemAlchemicVial().setRegistryName("alchemic_vial")
new ItemAlchemicVial().setRegistryName("alchemic_vial"),
new ItemFlightScroll().setRegistryName("icarus_scroll")
));
event.getRegistry().registerAll(items.toArray(new Item[0]));

View file

@ -1,10 +1,13 @@
package WayofTime.bloodmagic.potion;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.event.SacrificeKnifeUsedEvent;
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.potion.PotionEffect;
@ -16,15 +19,20 @@ import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.util.List;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
import WayofTime.bloodmagic.event.SacrificeKnifeUsedEvent;
@Mod.EventBusSubscriber(modid = BloodMagic.MODID)
public class PotionEventHandlers {
public class PotionEventHandlers
{
public static List<EntityPlayer> flightList = new ArrayList<EntityPlayer>();
@SubscribeEvent
public static void onLivingJumpEvent(LivingEvent.LivingJumpEvent event) {
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST)) {
public static void onLivingJumpEvent(LivingEvent.LivingJumpEvent event)
{
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST))
{
int i = event.getEntityLiving().getActivePotionEffect(RegistrarBloodMagic.BOOST).getAmplifier();
event.getEntityLiving().motionY += (0.1f) * (2 + i);
}
@ -35,7 +43,33 @@ public class PotionEventHandlers {
}
@SubscribeEvent
public static void onEntityUpdate(LivingEvent.LivingUpdateEvent event) {
public static void onEntityUpdate(LivingEvent.LivingUpdateEvent event)
{
if (event.getEntityLiving() instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
if (!player.world.isRemote)
{
if (player.isPotionActive(RegistrarBloodMagic.FLIGHT))
{
if (!player.isSpectator() && !player.capabilities.allowFlying)
{
player.capabilities.allowFlying = true;
player.sendPlayerAbilities();
flightList.add(player);
}
} else
{
if (flightList.contains(player))
{
player.capabilities.allowFlying = false;
player.capabilities.isFlying = false;
player.sendPlayerAbilities();
flightList.remove(player);
}
}
}
}
// if (event.getEntityLiving().isPotionActive(ModPotions.boost))
// {
// int i = event.getEntityLiving().getActivePotionEffect(ModPotions.boost).getAmplifier();
@ -52,12 +86,14 @@ public class PotionEventHandlers {
// }
// }
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.WHIRLWIND)) {
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.WHIRLWIND))
{
int d0 = 3;
AxisAlignedBB axisAlignedBB = new AxisAlignedBB(event.getEntityLiving().posX - 0.5, event.getEntityLiving().posY - 0.5, event.getEntityLiving().posZ - 0.5, event.getEntityLiving().posX + 0.5, event.getEntityLiving().posY + 0.5, event.getEntityLiving().posZ + 0.5).expand(d0, d0, d0);
List<Entity> entityList = event.getEntityLiving().getEntityWorld().getEntitiesWithinAABB(Entity.class, axisAlignedBB);
for (Entity projectile : entityList) {
for (Entity projectile : entityList)
{
if (projectile == null)
continue;
if (!(projectile instanceof IProjectile))
@ -84,7 +120,8 @@ public class PotionEventHandlers {
if (angle < 3 * (Math.PI / 4))
continue; // angle is < 135 degrees
if (throwingEntity != null) {
if (throwingEntity != null)
{
delX = -projectile.posX + throwingEntity.posX;
delY = -projectile.posY + (throwingEntity.posY + throwingEntity.getEyeHeight());
delZ = -projectile.posZ + throwingEntity.posZ;
@ -104,26 +141,31 @@ public class PotionEventHandlers {
}
@SubscribeEvent
public static void onPlayerRespawn(PlayerEvent.Clone event) {
public static void onPlayerRespawn(PlayerEvent.Clone event)
{
if (event.isWasDeath())
event.getEntityPlayer().addPotionEffect(new PotionEffect(RegistrarBloodMagic.SOUL_FRAY, 400));
}
@SubscribeEvent
public static void onSacrificeKnifeUsed(SacrificeKnifeUsedEvent event) {
public static void onSacrificeKnifeUsed(SacrificeKnifeUsedEvent event)
{
if (event.player.isPotionActive(RegistrarBloodMagic.SOUL_FRAY))
event.lpAdded = (int) (event.lpAdded * 0.1D);
}
@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void onPlayerDamageEvent(LivingAttackEvent event) {
public static void onPlayerDamageEvent(LivingAttackEvent event)
{
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.WHIRLWIND) && event.isCancelable() && event.getSource().isProjectile())
event.setCanceled(true);
}
@SubscribeEvent
public static void onEndermanTeleportEvent(EnderTeleportEvent event) {
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.PLANAR_BINDING) && event.isCancelable()) {
public static void onEndermanTeleportEvent(EnderTeleportEvent event)
{
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.PLANAR_BINDING) && event.isCancelable())
{
event.setCanceled(true);
}
}

View file

@ -172,6 +172,7 @@ public class ModRecipes
addPotionRecipe(1000, 1, new ItemStack(RegistrarBloodMagicItems.BLOOD_SHARD, 1, 0), new PotionEffect(MobEffects.HEALTH_BOOST, 2 * 60 * 20));
addPotionRecipe(1000, 1, new ItemStack(Blocks.SLIME_BLOCK), new PotionEffect(RegistrarBloodMagic.BOUNCE, 2 * 60 * 20));
addPotionRecipe(1000, 1, new ItemStack(Items.STRING), new PotionEffect(RegistrarBloodMagic.CLING, 2 * 60 * 20));
addPotionRecipe(1000, 1, new ItemStack(Items.CAKE), new PotionEffect(RegistrarBloodMagic.FLIGHT, 2 * 60 * 20));
addPotionRecipe(1000, 1, new ItemStack(Items.BEETROOT), new PotionEffect(RegistrarBloodMagic.DEAFNESS, 450));
}

View file

@ -7,8 +7,10 @@ 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";
@ -125,13 +127,17 @@ public class Constants {
public static final String POTION_IMPURITY = "impurity";
public static final String TANK = "tank";
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;
@ -140,7 +146,8 @@ 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";
@ -157,7 +164,8 @@ 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 = 30002;

View file

@ -190,6 +190,8 @@ item.bloodmagic.living_point_upgrade.draft_angelus.name=Draft of Angelus
item.bloodmagic.willGauge.name=Demon Will Aura Gauge
item.bloodmagic.potionFlask.name=Potion Flask
item.bloodmagic.icarusScroll.name=Scroll of Icarus
# Blocks
tile.bloodmagic.fluid.lifeEssence.name=Life Essence

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB