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)
@GameRegistry.ObjectHolder(BloodMagic.MODID)
public class RegistrarBloodMagic {
public class RegistrarBloodMagic
{
private static final BloodOrb ORB_DEF = new BloodOrb("", 0, 0, 0);
@GameRegistry.ObjectHolder("weak")
@ -60,7 +61,8 @@ public class RegistrarBloodMagic {
public static IForgeRegistry<BloodOrb> BLOOD_ORBS = null;
@SubscribeEvent
public static void registerBloodOrbs(RegistryEvent.Register<BloodOrb> event) {
public static void registerBloodOrbs(RegistryEvent.Register<BloodOrb> event)
{
ResourceLocation orb = RegistrarBloodMagicItems.BLOOD_ORB.getRegistryName();
event.getRegistry().registerAll(
new BloodOrb("weak", 1, 5000, 2).withModel(new ModelResourceLocation(orb, "type=weak")).setRegistryName("weak"),
@ -69,13 +71,14 @@ public class RegistrarBloodMagic {
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("transcendent", 6, 30000000, 50).withModel(new ModelResourceLocation(orb, "type=transcendent")).setRegistryName("transcendent")
);
);
}
@SubscribeEvent
public static void registerPotions(RegistryEvent.Register<Potion> event) {
public static void registerPotions(RegistryEvent.Register<Potion> event)
{
event.getRegistry().registerAll(
new PotionBloodMagic("Boost", false, 0xFFFFFF, 0, 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("Soul Snare", false, 0xFFFFFF, 3, 0).setRegistryName("soul_snare"),
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("Cling", false, 0x000000, 2, 1).setRegistryName("cling"),
new PotionBloodMagic("S. Lamb", false, 0x000000, 3, 1).setRegistryName("sacrificial_lamb")
);
);
}
@SubscribeEvent
public static void registerEntities(RegistryEvent.Register<EntityEntry> event) {
public static void registerEntities(RegistryEvent.Register<EntityEntry> event)
{
int entities = 0;
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_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()
);
);
}
@SubscribeEvent
public static void onRegistryCreation(RegistryEvent.NewRegistry event) {
public static void onRegistryCreation(RegistryEvent.NewRegistry event)
{
BLOOD_ORBS = new RegistryBuilder<BloodOrb>()
.setName(new ResourceLocation(BloodMagic.MODID, "blood_orb"))
.setIDRange(0, Short.MAX_VALUE)
@ -119,8 +124,10 @@ public class RegistrarBloodMagic {
@SideOnly(Side.CLIENT)
@SubscribeEvent
public static void registerModels(ModelRegistryEvent event) {
for (BloodOrb orb : BLOOD_ORBS) {
public static void registerModels(ModelRegistryEvent event)
{
for (BloodOrb orb : BLOOD_ORBS)
{
ModelResourceLocation modelLocation = orb.getModelLocation();
if (modelLocation == null)
modelLocation = new ModelResourceLocation(orb.getRegistryName(), "inventory");
@ -128,7 +135,8 @@ public class RegistrarBloodMagic {
ModelLoader.registerItemVariants(RegistrarBloodMagicItems.BLOOD_ORB, modelLocation);
}
ModelLoader.setCustomMeshDefinition(RegistrarBloodMagicItems.BLOOD_ORB, stack -> {
ModelLoader.setCustomMeshDefinition(RegistrarBloodMagicItems.BLOOD_ORB, stack ->
{
if (!stack.hasTagCompound())
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.AlchemyArrayEffectBounce;
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectFurnaceFuel;
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectLaputa;
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectMovement;
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectSigil;
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.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(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;
@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));
}
}
@ -66,18 +73,23 @@ 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));
}
}
@ -86,24 +98,31 @@ 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;
@ -116,29 +135,37 @@ 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();
//TODO: See if the item is a splash potion? Those should be usable.
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.quenched", chestStack);
if (upgrade instanceof LivingArmourUpgradeQuenched) {
if (upgrade instanceof LivingArmourUpgradeQuenched)
{
event.setCanceled(true);
}
}
@ -149,19 +176,24 @@ 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);
@ -175,20 +207,26 @@ 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();
}
}
@ -199,21 +237,28 @@ 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 (upgrade instanceof LivingArmourUpgradeStepAssist)
{
player.stepHeight = ((LivingArmourUpgradeStepAssist) upgrade).getStepAssist();
hasAssist = true;
}
@ -226,27 +271,32 @@ 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) {
percentIncrease += 0.1f * ((LivingArmourUpgradeSpeed) upgrade).getSpeedModifier();
if (upgrade instanceof LivingArmourUpgradeSpeed)
{
percentIncrease += ((LivingArmourUpgradeSpeed) upgrade).getSpeedModifier();
}
}
}
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST)) {
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST))
{
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)) {
player.moveRelative(player.moveStrafing, player.moveForward, player.capabilities.isFlying ? (percentIncrease / 2.0f) : percentIncrease, 0.02F);
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);
}
}
}
@ -254,7 +304,8 @@ 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();
@ -262,14 +313,17 @@ 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;
@ -281,7 +335,8 @@ public class LivingArmourHandler {
velocity = 1.0F;
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 = itemarrow.createArrow(world, arrowStack, player);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB