Fixed the Haste sigil and "Quick Feet" so that they work with MC's new movement method.

Also added better looking potion effects for a few things
Enabled Shard of Laputa array - no book entry yet.
This commit is contained in:
WayofTime 2018-03-30 18:01:23 -04:00
parent d2a84c0e7c
commit fff793ea7d
4 changed files with 135 additions and 71 deletions

View file

@ -28,7 +28,8 @@ import net.minecraftforge.registries.RegistryBuilder;
@Mod.EventBusSubscriber(modid = BloodMagic.MODID) @Mod.EventBusSubscriber(modid = BloodMagic.MODID)
@GameRegistry.ObjectHolder(BloodMagic.MODID) @GameRegistry.ObjectHolder(BloodMagic.MODID)
public class RegistrarBloodMagic { public class RegistrarBloodMagic
{
private static final BloodOrb ORB_DEF = new BloodOrb("", 0, 0, 0); private static final BloodOrb ORB_DEF = new BloodOrb("", 0, 0, 0);
@GameRegistry.ObjectHolder("weak") @GameRegistry.ObjectHolder("weak")
@ -60,7 +61,8 @@ public class RegistrarBloodMagic {
public static IForgeRegistry<BloodOrb> BLOOD_ORBS = null; public static IForgeRegistry<BloodOrb> BLOOD_ORBS = null;
@SubscribeEvent @SubscribeEvent
public static void registerBloodOrbs(RegistryEvent.Register<BloodOrb> event) { public static void registerBloodOrbs(RegistryEvent.Register<BloodOrb> event)
{
ResourceLocation orb = RegistrarBloodMagicItems.BLOOD_ORB.getRegistryName(); ResourceLocation orb = RegistrarBloodMagicItems.BLOOD_ORB.getRegistryName();
event.getRegistry().registerAll( event.getRegistry().registerAll(
new BloodOrb("weak", 1, 5000, 2).withModel(new ModelResourceLocation(orb, "type=weak")).setRegistryName("weak"), new BloodOrb("weak", 1, 5000, 2).withModel(new ModelResourceLocation(orb, "type=weak")).setRegistryName("weak"),
@ -69,13 +71,14 @@ public class RegistrarBloodMagic {
new BloodOrb("master", 4, 1000000, 25).withModel(new ModelResourceLocation(orb, "type=master")).setRegistryName("master"), new BloodOrb("master", 4, 1000000, 25).withModel(new ModelResourceLocation(orb, "type=master")).setRegistryName("master"),
new BloodOrb("archmage", 5, 10000000, 50).withModel(new ModelResourceLocation(orb, "type=archmage")).setRegistryName("archmage"), new BloodOrb("archmage", 5, 10000000, 50).withModel(new ModelResourceLocation(orb, "type=archmage")).setRegistryName("archmage"),
new BloodOrb("transcendent", 6, 30000000, 50).withModel(new ModelResourceLocation(orb, "type=transcendent")).setRegistryName("transcendent") new BloodOrb("transcendent", 6, 30000000, 50).withModel(new ModelResourceLocation(orb, "type=transcendent")).setRegistryName("transcendent")
); );
} }
@SubscribeEvent @SubscribeEvent
public static void registerPotions(RegistryEvent.Register<Potion> event) { public static void registerPotions(RegistryEvent.Register<Potion> event)
{
event.getRegistry().registerAll( event.getRegistry().registerAll(
new PotionBloodMagic("Boost", false, 0xFFFFFF, 0, 1).setRegistryName("boost"), new PotionBloodMagic("Boost", false, 0xFFFFFF, 0, 0).setRegistryName("boost"),
new PotionBloodMagic("Planar Binding", false, 0, 2, 0).setRegistryName("planar_binding"), new PotionBloodMagic("Planar Binding", false, 0, 2, 0).setRegistryName("planar_binding"),
new PotionBloodMagic("Soul Snare", false, 0xFFFFFF, 3, 0).setRegistryName("soul_snare"), new PotionBloodMagic("Soul Snare", false, 0xFFFFFF, 3, 0).setRegistryName("soul_snare"),
new PotionBloodMagic("Soul Fray", true, 0xFFFFFF, 4, 0).setRegistryName("soul_fray"), new PotionBloodMagic("Soul Fray", true, 0xFFFFFF, 4, 0).setRegistryName("soul_fray"),
@ -86,11 +89,12 @@ public class RegistrarBloodMagic {
new PotionBloodMagic("Bounce", false, 0x000000, 1, 1).setRegistryName("bounce"), new PotionBloodMagic("Bounce", false, 0x000000, 1, 1).setRegistryName("bounce"),
new PotionBloodMagic("Cling", false, 0x000000, 2, 1).setRegistryName("cling"), 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")
); );
} }
@SubscribeEvent @SubscribeEvent
public static void registerEntities(RegistryEvent.Register<EntityEntry> event) { public static void registerEntities(RegistryEvent.Register<EntityEntry> event)
{
int entities = 0; int entities = 0;
event.getRegistry().registerAll( event.getRegistry().registerAll(
@ -104,11 +108,12 @@ public class RegistrarBloodMagic {
EntityEntryBuilder.create().id("corrupted_sheep", ++entities).entity(EntityCorruptedSheep.class).name("corrupted_sheep").tracker(16 * 4, 3, true).build(), EntityEntryBuilder.create().id("corrupted_sheep", ++entities).entity(EntityCorruptedSheep.class).name("corrupted_sheep").tracker(16 * 4, 3, true).build(),
EntityEntryBuilder.create().id("corrupted_chicken", ++entities).entity(EntityCorruptedChicken.class).name("corrupted_chicken").tracker(16 * 4, 3, true).build(), EntityEntryBuilder.create().id("corrupted_chicken", ++entities).entity(EntityCorruptedChicken.class).name("corrupted_chicken").tracker(16 * 4, 3, true).build(),
EntityEntryBuilder.create().id("corrupted_spider", ++entities).entity(EntityCorruptedSpider.class).name("corrupted_spider").tracker(16 * 4, 3, true).build() EntityEntryBuilder.create().id("corrupted_spider", ++entities).entity(EntityCorruptedSpider.class).name("corrupted_spider").tracker(16 * 4, 3, true).build()
); );
} }
@SubscribeEvent @SubscribeEvent
public static void onRegistryCreation(RegistryEvent.NewRegistry event) { public static void onRegistryCreation(RegistryEvent.NewRegistry event)
{
BLOOD_ORBS = new RegistryBuilder<BloodOrb>() BLOOD_ORBS = new RegistryBuilder<BloodOrb>()
.setName(new ResourceLocation(BloodMagic.MODID, "blood_orb")) .setName(new ResourceLocation(BloodMagic.MODID, "blood_orb"))
.setIDRange(0, Short.MAX_VALUE) .setIDRange(0, Short.MAX_VALUE)
@ -119,8 +124,10 @@ public class RegistrarBloodMagic {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@SubscribeEvent @SubscribeEvent
public static void registerModels(ModelRegistryEvent event) { public static void registerModels(ModelRegistryEvent event)
for (BloodOrb orb : BLOOD_ORBS) { {
for (BloodOrb orb : BLOOD_ORBS)
{
ModelResourceLocation modelLocation = orb.getModelLocation(); ModelResourceLocation modelLocation = orb.getModelLocation();
if (modelLocation == null) if (modelLocation == null)
modelLocation = new ModelResourceLocation(orb.getRegistryName(), "inventory"); modelLocation = new ModelResourceLocation(orb.getRegistryName(), "inventory");
@ -128,7 +135,8 @@ public class RegistrarBloodMagic {
ModelLoader.registerItemVariants(RegistrarBloodMagicItems.BLOOD_ORB, modelLocation); ModelLoader.registerItemVariants(RegistrarBloodMagicItems.BLOOD_ORB, modelLocation);
} }
ModelLoader.setCustomMeshDefinition(RegistrarBloodMagicItems.BLOOD_ORB, stack -> { ModelLoader.setCustomMeshDefinition(RegistrarBloodMagicItems.BLOOD_ORB, stack ->
{
if (!stack.hasTagCompound()) if (!stack.hasTagCompound())
return new ModelResourceLocation(ORB_WEAK.getRegistryName(), "inventory"); return new ModelResourceLocation(ORB_WEAK.getRegistryName(), "inventory");

View file

@ -24,6 +24,7 @@ import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectAttractor;
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectBinding; import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectBinding;
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectBounce; import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectBounce;
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectFurnaceFuel; import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectFurnaceFuel;
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectLaputa;
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectMovement; import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectMovement;
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectSigil; import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectSigil;
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectSkeletonTurret; import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectSkeletonTurret;
@ -125,7 +126,7 @@ public class ModRecipes
AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Items.ENDER_PEARL), new ItemStack(Items.REDSTONE), new AlchemyArrayEffectTeleport("teleport"), new StaticAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/teleportation.png"))); AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Items.ENDER_PEARL), new ItemStack(Items.REDSTONE), new AlchemyArrayEffectTeleport("teleport"), new StaticAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/teleportation.png")));
AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Items.BOW), new ItemStack(Items.ARROW), new AlchemyArrayEffectArrowTurret("turret"), new TurretAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SkeletonTurret1.png"))); AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Items.BOW), new ItemStack(Items.ARROW), new AlchemyArrayEffectArrowTurret("turret"), new TurretAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SkeletonTurret1.png")));
// AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Items.APPLE), new ItemStack(Items.REDSTONE), new AlchemyArrayEffectLaputa("laputa"), new AttractorAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/shardoflaputa.png"))); AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Items.REDSTONE), new ItemStack(Blocks.LAPIS_BLOCK), new AlchemyArrayEffectLaputa("laputa"), new AttractorAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/shardoflaputa.png")));
AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Blocks.COBBLESTONE), new ItemStack(Items.IRON_INGOT), new AlchemyArrayEffectSpike("spike"), new LowStaticAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/spikearray.png"))); AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Blocks.COBBLESTONE), new ItemStack(Items.IRON_INGOT), new AlchemyArrayEffectSpike("spike"), new LowStaticAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/spikearray.png")));
AlchemyArrayRecipeRegistry.registerRecipe(ComponentTypes.REAGENT_FAST_MINER.getStack(), new ItemStack(Items.IRON_PICKAXE), new AlchemyArrayEffectSigil("fastMiner", (ISigil) RegistrarBloodMagicItems.SIGIL_FAST_MINER), new SingleAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/FastMinerSigil.png"))); AlchemyArrayRecipeRegistry.registerRecipe(ComponentTypes.REAGENT_FAST_MINER.getStack(), new ItemStack(Items.IRON_PICKAXE), new AlchemyArrayEffectSigil("fastMiner", (ISigil) RegistrarBloodMagicItems.SIGIL_FAST_MINER), new SingleAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/FastMinerSigil.png")));

View file

@ -40,24 +40,31 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@Mod.EventBusSubscriber(modid = BloodMagic.MODID) @Mod.EventBusSubscriber(modid = BloodMagic.MODID)
public class LivingArmourHandler { public class LivingArmourHandler
{
@SubscribeEvent @SubscribeEvent
public static void onEntityHealed(LivingHealEvent event) { public static void onEntityHealed(LivingHealEvent event)
if (event.getEntityLiving() instanceof EntityPlayer) { {
if (event.getEntityLiving() instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) event.getEntity(); EntityPlayer player = (EntityPlayer) event.getEntity();
if (LivingArmour.hasFullSet(player)) { if (LivingArmour.hasFullSet(player))
{
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack); LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour != null) { if (armour != null)
{
double modifier = 1; double modifier = 1;
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.slowHeal", chestStack); LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.slowHeal", chestStack);
if (upgrade instanceof LivingArmourUpgradeSlowHeal) { if (upgrade instanceof LivingArmourUpgradeSlowHeal)
{
modifier *= ((LivingArmourUpgradeSlowHeal) upgrade).getHealingModifier(); modifier *= ((LivingArmourUpgradeSlowHeal) upgrade).getHealingModifier();
} }
if (modifier != 1) { if (modifier != 1)
{
event.setAmount((float) (event.getAmount() * modifier)); event.setAmount((float) (event.getAmount() * modifier));
} }
} }
@ -66,18 +73,23 @@ public class LivingArmourHandler {
} }
@SubscribeEvent @SubscribeEvent
public static void onMiningSpeedCheck(PlayerEvent.BreakSpeed event) { public static void onMiningSpeedCheck(PlayerEvent.BreakSpeed event)
{
EntityPlayer player = event.getEntityPlayer(); EntityPlayer player = event.getEntityPlayer();
if (LivingArmour.hasFullSet(player)) { if (LivingArmour.hasFullSet(player))
{
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack); LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour != null) { if (armour != null)
{
double modifier = 1; double modifier = 1;
for (LivingArmourUpgrade upgrade : armour.upgradeMap.values()) { for (LivingArmourUpgrade upgrade : armour.upgradeMap.values())
{
modifier *= upgrade.getMiningSpeedModifier(player); modifier *= upgrade.getMiningSpeedModifier(player);
} }
if (modifier != 1) { if (modifier != 1)
{
event.setNewSpeed((float) (event.getOriginalSpeed() * modifier)); event.setNewSpeed((float) (event.getOriginalSpeed() * modifier));
} }
} }
@ -86,24 +98,31 @@ public class LivingArmourHandler {
// Applies: Storm Trooper // Applies: Storm Trooper
@SubscribeEvent @SubscribeEvent
public static void onEntityJoinedWorld(EntityJoinWorldEvent event) { public static void onEntityJoinedWorld(EntityJoinWorldEvent event)
{
Entity owner = null; Entity owner = null;
if (event.getEntity() instanceof EntityArrow) { if (event.getEntity() instanceof EntityArrow)
{
owner = ((EntityArrow) event.getEntity()).shootingEntity; owner = ((EntityArrow) event.getEntity()).shootingEntity;
} else if (event.getEntity() instanceof EntityThrowable) { } else if (event.getEntity() instanceof EntityThrowable)
{
owner = ((EntityThrowable) event.getEntity()).getThrower(); owner = ((EntityThrowable) event.getEntity()).getThrower();
} }
if (owner instanceof EntityPlayer) { if (owner instanceof EntityPlayer)
{
Entity projectile = event.getEntity(); Entity projectile = event.getEntity();
EntityPlayer player = (EntityPlayer) owner; EntityPlayer player = (EntityPlayer) owner;
if (LivingArmour.hasFullSet(player)) { if (LivingArmour.hasFullSet(player))
{
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack); LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour != null) { if (armour != null)
{
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.stormTrooper", chestStack); 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)); 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; projectile.motionX += 2 * (event.getWorld().rand.nextDouble() - 0.5) * velocityModifier;
@ -116,29 +135,37 @@ public class LivingArmourHandler {
} }
@SubscribeEvent @SubscribeEvent
public static void onPlayerClick(PlayerInteractEvent event) { public static void onPlayerClick(PlayerInteractEvent event)
if (event.isCancelable()) { {
if (event.isCancelable())
{
EntityPlayer player = event.getEntityPlayer(); EntityPlayer player = event.getEntityPlayer();
if (LivingArmour.hasFullSet(player)) { if (LivingArmour.hasFullSet(player))
{
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack); LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour != null) { if (armour != null)
if (event.getHand() == EnumHand.OFF_HAND) { {
if (event.getHand() == EnumHand.OFF_HAND)
{
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.crippledArm", chestStack); LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.crippledArm", chestStack);
if (upgrade instanceof LivingArmourUpgradeCrippledArm) { if (upgrade instanceof LivingArmourUpgradeCrippledArm)
{
event.setCanceled(true); event.setCanceled(true);
} }
} }
if (event.getItemStack().getItemUseAction() == EnumAction.DRINK) { if (event.getItemStack().getItemUseAction() == EnumAction.DRINK)
{
ItemStack drinkStack = event.getItemStack(); ItemStack drinkStack = event.getItemStack();
//TODO: See if the item is a splash potion? Those should be usable. //TODO: See if the item is a splash potion? Those should be usable.
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.quenched", chestStack); LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.quenched", chestStack);
if (upgrade instanceof LivingArmourUpgradeQuenched) { if (upgrade instanceof LivingArmourUpgradeQuenched)
{
event.setCanceled(true); event.setCanceled(true);
} }
} }
@ -149,19 +176,24 @@ public class LivingArmourHandler {
// Applies: Grim Reaper // Applies: Grim Reaper
@SubscribeEvent(priority = EventPriority.HIGHEST) @SubscribeEvent(priority = EventPriority.HIGHEST)
public static void onEntityDeath(LivingDeathEvent event) { public static void onEntityDeath(LivingDeathEvent event)
if (event.getEntityLiving() instanceof EntityPlayer) { {
if (event.getEntityLiving() instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) event.getEntityLiving(); EntityPlayer player = (EntityPlayer) event.getEntityLiving();
if (LivingArmour.hasFullSet(player)) { if (LivingArmour.hasFullSet(player))
{
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack); LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour != null) { if (armour != null)
{
StatTrackerGrimReaperSprint.incrementCounter(armour); StatTrackerGrimReaperSprint.incrementCounter(armour);
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.grimReaper", chestStack); 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); ((LivingArmourUpgradeGrimReaperSprint) upgrade).applyEffectOnRebirth(player);
event.setCanceled(true); event.setCanceled(true);
event.setResult(Event.Result.DENY); event.setResult(Event.Result.DENY);
@ -175,20 +207,26 @@ public class LivingArmourHandler {
// Applies: Jump // Applies: Jump
@SubscribeEvent @SubscribeEvent
public static void onJumpEvent(LivingEvent.LivingJumpEvent event) { public static void onJumpEvent(LivingEvent.LivingJumpEvent event)
if (event.getEntityLiving() instanceof EntityPlayer) { {
if (event.getEntityLiving() instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) event.getEntityLiving(); EntityPlayer player = (EntityPlayer) event.getEntityLiving();
if (LivingArmour.hasFullSet(player)) { if (LivingArmour.hasFullSet(player))
{
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack); LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour != null) { if (armour != null)
{
StatTrackerJump.incrementCounter(armour); StatTrackerJump.incrementCounter(armour);
if (!player.isSneaking()) { if (!player.isSneaking())
{
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgradeFromNBT(BloodMagic.MODID + ".upgrade.jump", chestStack); LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgradeFromNBT(BloodMagic.MODID + ".upgrade.jump", chestStack);
if (upgrade instanceof LivingArmourUpgradeJump) { if (upgrade instanceof LivingArmourUpgradeJump)
{
player.motionY += ((LivingArmourUpgradeJump) upgrade).getJumpModifier(); player.motionY += ((LivingArmourUpgradeJump) upgrade).getJumpModifier();
} }
} }
@ -199,21 +237,28 @@ public class LivingArmourHandler {
// Applies: Step Assist, Speed Boost // Applies: Step Assist, Speed Boost
@SubscribeEvent(priority = EventPriority.HIGHEST) @SubscribeEvent(priority = EventPriority.HIGHEST)
public static void onEntityUpdate(LivingEvent.LivingUpdateEvent event) { public static void onEntityUpdate(LivingEvent.LivingUpdateEvent event)
if (event.getEntityLiving() instanceof EntityPlayer) { {
if (event.getEntityLiving() instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) event.getEntityLiving(); EntityPlayer player = (EntityPlayer) event.getEntityLiving();
boolean hasAssist = false; boolean hasAssist = false;
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST)) { if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST))
{
hasAssist = true; hasAssist = true;
player.stepHeight = Constants.Misc.ALTERED_STEP_HEIGHT; player.stepHeight = Constants.Misc.ALTERED_STEP_HEIGHT;
} else { } else
if (LivingArmour.hasFullSet(player)) { {
if (LivingArmour.hasFullSet(player))
{
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmourFromStack(chestStack); LivingArmour armour = ItemLivingArmour.getLivingArmourFromStack(chestStack);
if (armour != null) { if (armour != null)
{
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.stepAssist", chestStack); LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.stepAssist", chestStack);
if (upgrade instanceof LivingArmourUpgradeStepAssist) { if (upgrade instanceof LivingArmourUpgradeStepAssist)
{
player.stepHeight = ((LivingArmourUpgradeStepAssist) upgrade).getStepAssist(); player.stepHeight = ((LivingArmourUpgradeStepAssist) upgrade).getStepAssist();
hasAssist = true; hasAssist = true;
} }
@ -226,27 +271,32 @@ public class LivingArmourHandler {
float percentIncrease = 0; float percentIncrease = 0;
if (LivingArmour.hasFullSet(player)) { if (LivingArmour.hasFullSet(player))
{
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmourFromStack(chestStack); LivingArmour armour = ItemLivingArmour.getLivingArmourFromStack(chestStack);
if (armour != null) { if (armour != null)
{
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgradeFromNBT(BloodMagic.MODID + ".upgrade.movement", chestStack); LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgradeFromNBT(BloodMagic.MODID + ".upgrade.movement", chestStack);
if (upgrade instanceof LivingArmourUpgradeSpeed) { if (upgrade instanceof LivingArmourUpgradeSpeed)
percentIncrease += 0.1f * ((LivingArmourUpgradeSpeed) upgrade).getSpeedModifier(); {
percentIncrease += ((LivingArmourUpgradeSpeed) upgrade).getSpeedModifier();
} }
} }
} }
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST)) { if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST))
{
int i = event.getEntityLiving().getActivePotionEffect(RegistrarBloodMagic.BOOST).getAmplifier(); int i = event.getEntityLiving().getActivePotionEffect(RegistrarBloodMagic.BOOST).getAmplifier();
{ {
percentIncrease += (i + 1) * 0.05f; percentIncrease += (i + 1) * 0.5f;
} }
} }
if (percentIncrease > 0 && (player.onGround || player.capabilities.isFlying) && (Math.abs(player.moveForward) > 0 || Math.abs(player.moveStrafing) > 0)) { if (percentIncrease > 0 && (player.onGround || player.capabilities.isFlying) && (Math.abs(player.moveForward) > 0 || Math.abs(player.moveStrafing) > 0))
player.moveRelative(player.moveStrafing, player.moveForward, player.capabilities.isFlying ? (percentIncrease / 2.0f) : percentIncrease, 0.02F); {
player.travel(player.moveStrafing * percentIncrease, 0, player.moveForward * percentIncrease);
} }
} }
} }
@ -254,7 +304,8 @@ public class LivingArmourHandler {
// Applies: Arrow Shot // Applies: Arrow Shot
// Tracks: Arrow Shot // Tracks: Arrow Shot
@SubscribeEvent @SubscribeEvent
public static void onArrowFire(ArrowLooseEvent event) { public static void onArrowFire(ArrowLooseEvent event)
{
World world = event.getEntityPlayer().getEntityWorld(); World world = event.getEntityPlayer().getEntityWorld();
ItemStack stack = event.getBow(); ItemStack stack = event.getBow();
EntityPlayer player = event.getEntityPlayer(); EntityPlayer player = event.getEntityPlayer();
@ -262,14 +313,17 @@ public class LivingArmourHandler {
if (world.isRemote) if (world.isRemote)
return; return;
if (LivingArmour.hasFullSet(player)) { if (LivingArmour.hasFullSet(player))
{
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack); LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour != null) { if (armour != null)
{
StatTrackerArrowShot.incrementCounter(armour); StatTrackerArrowShot.incrementCounter(armour);
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.arrowShot", chestStack); LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.arrowShot", chestStack);
if (upgrade instanceof LivingArmourUpgradeArrowShot) { if (upgrade instanceof LivingArmourUpgradeArrowShot)
{
int charge = event.getCharge(); int charge = event.getCharge();
float velocity = (float) charge / 20.0F; float velocity = (float) charge / 20.0F;
velocity = (velocity * velocity + velocity * 2.0F) / 3.0F; velocity = (velocity * velocity + velocity * 2.0F) / 3.0F;
@ -281,7 +335,8 @@ public class LivingArmourHandler {
velocity = 1.0F; velocity = 1.0F;
int extraArrows = ((LivingArmourUpgradeArrowShot) upgrade).getExtraArrows(); 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); ItemStack arrowStack = new ItemStack(Items.ARROW);
ItemArrow itemarrow = (ItemArrow) ((stack.getItem() instanceof ItemArrow ? arrowStack.getItem() : Items.ARROW)); ItemArrow itemarrow = (ItemArrow) ((stack.getItem() instanceof ItemArrow ? arrowStack.getItem() : Items.ARROW));
EntityArrow entityarrow = itemarrow.createArrow(world, arrowStack, player); EntityArrow entityarrow = itemarrow.createArrow(world, arrowStack, player);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB