Run migration mappings
Everything is still broken, but at least we reduced the amount of errors by hundreds, if not thousands.
This commit is contained in:
parent
1caae69992
commit
4035d91151
484 changed files with 4924 additions and 4962 deletions
|
@ -7,13 +7,13 @@ import WayofTime.bloodmagic.util.helper.NBTHelper;
|
|||
import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTablePotionAugmentRecipe;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.potion.Effect;
|
||||
import net.minecraft.potion.EffectInstance;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -25,7 +25,7 @@ import java.util.Random;
|
|||
public class BMPotionUtils {
|
||||
public static Random rand = new Random();
|
||||
|
||||
public static double damageMobAndGrowSurroundingPlants(EntityLivingBase entity, int horizontalRadius, int verticalRadius, double damageRatio, int maxPlantsGrown) {
|
||||
public static double damageMobAndGrowSurroundingPlants(LivingEntity entity, int horizontalRadius, int verticalRadius, double damageRatio, int maxPlantsGrown) {
|
||||
World world = entity.getEntityWorld();
|
||||
if (world.isRemote) {
|
||||
return 0;
|
||||
|
@ -41,7 +41,7 @@ public class BMPotionUtils {
|
|||
|
||||
for (int i = 0; i < maxPlantsGrown; i++) {
|
||||
BlockPos blockPos = entity.getPosition().add(rand.nextInt(horizontalRadius * 2 + 1) - horizontalRadius, rand.nextInt(verticalRadius * 2 + 1) - verticalRadius, rand.nextInt(horizontalRadius * 2 + 1) - horizontalRadius);
|
||||
IBlockState state = world.getBlockState(blockPos);
|
||||
BlockState state = world.getBlockState(blockPos);
|
||||
|
||||
if (!BloodMagicAPI.INSTANCE.getBlacklist().getGreenGrove().contains(state)) {
|
||||
if (state.getBlock() instanceof IGrowable) {
|
||||
|
@ -54,11 +54,11 @@ public class BMPotionUtils {
|
|||
Block block = world.getBlockState(blockPos).getBlock();
|
||||
// if (world.rand.nextInt(50) == 0)
|
||||
{
|
||||
IBlockState preBlockState = world.getBlockState(blockPos);
|
||||
BlockState preBlockState = world.getBlockState(blockPos);
|
||||
for (int n = 0; n < 10; n++)
|
||||
block.updateTick(world, blockPos, world.getBlockState(blockPos), world.rand);
|
||||
|
||||
IBlockState newState = world.getBlockState(blockPos);
|
||||
BlockState newState = world.getBlockState(blockPos);
|
||||
if (!newState.equals(preBlockState)) {
|
||||
world.playEvent(2001, blockPos, Block.getIdFromBlock(newState.getBlock()) + (newState.getBlock().getMetaFromState(newState) << 12));
|
||||
incurredDamage += damageRatio;
|
||||
|
@ -73,20 +73,20 @@ public class BMPotionUtils {
|
|||
return incurredDamage;
|
||||
}
|
||||
|
||||
public static double getLengthAugment(ItemStack flaskStack, Potion potion) {
|
||||
public static double getLengthAugment(ItemStack flaskStack, Effect potion) {
|
||||
NBTHelper.checkNBT(flaskStack);
|
||||
NBTTagCompound tag = flaskStack.getTagCompound();
|
||||
CompoundNBT tag = flaskStack.getTagCompound();
|
||||
|
||||
return tag.getDouble(Constants.NBT.POTION_AUGMENT_LENGHT + potion.getName());
|
||||
}
|
||||
|
||||
public static void setLengthAugment(ItemStack flaskStack, Potion potion, double value) {
|
||||
public static void setLengthAugment(ItemStack flaskStack, Effect potion, double value) {
|
||||
if (value < 0) {
|
||||
value = 0;
|
||||
}
|
||||
|
||||
NBTHelper.checkNBT(flaskStack);
|
||||
NBTTagCompound tag = flaskStack.getTagCompound();
|
||||
CompoundNBT tag = flaskStack.getTagCompound();
|
||||
|
||||
tag.setDouble(Constants.NBT.POTION_AUGMENT_LENGHT + potion.getName(), value);
|
||||
}
|
||||
|
@ -102,15 +102,15 @@ public class BMPotionUtils {
|
|||
* @param effects
|
||||
* @return
|
||||
*/
|
||||
public static ItemStack setEffects(ItemStack stack, Collection<PotionEffect> effects) {
|
||||
public static ItemStack setEffects(ItemStack stack, Collection<EffectInstance> effects) {
|
||||
if (effects.isEmpty()) {
|
||||
return stack;
|
||||
} else {
|
||||
NBTTagCompound nbttagcompound = stack.hasTagCompound() ? stack.getTagCompound() : new NBTTagCompound();
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
CompoundNBT nbttagcompound = stack.hasTagCompound() ? stack.getTagCompound() : new CompoundNBT();
|
||||
ListNBT nbttaglist = new ListNBT();
|
||||
|
||||
for (PotionEffect potioneffect : effects) {
|
||||
nbttaglist.appendTag(potioneffect.writeCustomPotionEffectToNBT(new NBTTagCompound()));
|
||||
for (EffectInstance potioneffect : effects) {
|
||||
nbttaglist.appendTag(potioneffect.writeCustomPotionEffectToNBT(new CompoundNBT()));
|
||||
}
|
||||
|
||||
nbttagcompound.setTag("CustomPotionEffects", nbttaglist);
|
||||
|
@ -119,19 +119,19 @@ public class BMPotionUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static AlchemyTablePotionAugmentRecipe getLengthAugmentRecipe(int lpDrained, int ticksRequired, int tierRequired, List<ItemStack> inputItems, PotionEffect baseEffect, double lengthAugment) {
|
||||
public static AlchemyTablePotionAugmentRecipe getLengthAugmentRecipe(int lpDrained, int ticksRequired, int tierRequired, List<ItemStack> inputItems, EffectInstance baseEffect, double lengthAugment) {
|
||||
return new AlchemyTablePotionAugmentRecipe(lpDrained, ticksRequired, tierRequired, inputItems, baseEffect, lengthAugment, 0);
|
||||
}
|
||||
|
||||
public static AlchemyTablePotionAugmentRecipe getPowerAugmentRecipe(int lpDrained, int ticksRequired, int tierRequired, List<ItemStack> inputItems, PotionEffect baseEffect, int powerAugment) {
|
||||
public static AlchemyTablePotionAugmentRecipe getPowerAugmentRecipe(int lpDrained, int ticksRequired, int tierRequired, List<ItemStack> inputItems, EffectInstance baseEffect, int powerAugment) {
|
||||
return new AlchemyTablePotionAugmentRecipe(lpDrained, ticksRequired, tierRequired, inputItems, baseEffect, 0, powerAugment);
|
||||
}
|
||||
|
||||
public static AlchemyTablePotionAugmentRecipe getLengthAugmentRecipe(int lpDrained, int ticksRequired, int tierRequired, ItemStack inputItem, PotionEffect baseEffect, double lengthAugment) {
|
||||
public static AlchemyTablePotionAugmentRecipe getLengthAugmentRecipe(int lpDrained, int ticksRequired, int tierRequired, ItemStack inputItem, EffectInstance baseEffect, double lengthAugment) {
|
||||
return new AlchemyTablePotionAugmentRecipe(lpDrained, ticksRequired, tierRequired, inputItem, baseEffect, lengthAugment, 0);
|
||||
}
|
||||
|
||||
public static AlchemyTablePotionAugmentRecipe getPowerAugmentRecipe(int lpDrained, int ticksRequired, int tierRequired, ItemStack inputItem, PotionEffect baseEffect, int powerAugment) {
|
||||
public static AlchemyTablePotionAugmentRecipe getPowerAugmentRecipe(int lpDrained, int ticksRequired, int tierRequired, ItemStack inputItem, EffectInstance baseEffect, int powerAugment) {
|
||||
return new AlchemyTablePotionAugmentRecipe(lpDrained, ticksRequired, tierRequired, inputItem, baseEffect, 0, powerAugment);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,14 +2,14 @@ package WayofTime.bloodmagic.potion;
|
|||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.potion.Effect;
|
||||
import net.minecraft.potion.EffectInstance;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class PotionBloodMagic extends Potion {
|
||||
public class PotionBloodMagic extends Effect {
|
||||
public static ResourceLocation texture = new ResourceLocation(BloodMagic.MODID, "textures/misc/potions.png");
|
||||
|
||||
public PotionBloodMagic(String name, boolean badEffect, int potionColor, int iconIndexX, int iconIndexY) {
|
||||
|
@ -19,22 +19,22 @@ public class PotionBloodMagic extends Potion {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRenderInvText(PotionEffect effect) {
|
||||
public boolean shouldRenderInvText(EffectInstance effect) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public PotionEffect apply(EntityLivingBase entity, int duration) {
|
||||
public EffectInstance apply(LivingEntity entity, int duration) {
|
||||
return apply(entity, duration, 0);
|
||||
}
|
||||
|
||||
public PotionEffect apply(EntityLivingBase entity, int duration, int level) {
|
||||
PotionEffect effect = new PotionEffect(this, duration, level, false, false);
|
||||
public EffectInstance apply(LivingEntity entity, int duration, int level) {
|
||||
EffectInstance effect = new EffectInstance(this, duration, level, false, false);
|
||||
entity.addPotionEffect(effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
public int getLevel(EntityLivingBase entity) {
|
||||
PotionEffect effect = entity.getActivePotionEffect(this);
|
||||
public int getLevel(LivingEntity entity) {
|
||||
EffectInstance effect = entity.getActivePotionEffect(this);
|
||||
if (effect != null) {
|
||||
return effect.getAmplifier();
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class PotionBloodMagic extends Potion {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender(PotionEffect effect) {
|
||||
public boolean shouldRender(EffectInstance effect) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@ import WayofTime.bloodmagic.core.RegistrarBloodMagic;
|
|||
import WayofTime.bloodmagic.event.SacrificeKnifeUsedEvent;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.IProjectile;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.projectile.AbstractArrowEntity;
|
||||
import net.minecraft.entity.projectile.ThrowableEntity;
|
||||
import net.minecraft.potion.EffectInstance;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -26,12 +26,12 @@ import java.util.Map;
|
|||
|
||||
@Mod.EventBusSubscriber(modid = BloodMagic.MODID)
|
||||
public class PotionEventHandlers {
|
||||
public static Map<World, List<EntityPlayer>> flightListMap = new HashMap<>();
|
||||
public static Map<World, List<EntityLivingBase>> noGravityListMap = new HashMap<>();
|
||||
public static Map<World, List<PlayerEntity>> flightListMap = new HashMap<>();
|
||||
public static Map<World, List<LivingEntity>> noGravityListMap = new HashMap<>();
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onLivingJumpEvent(LivingEvent.LivingJumpEvent event) {
|
||||
EntityLivingBase eventEntityLiving = event.getEntityLiving();
|
||||
LivingEntity eventEntityLiving = event.getEntityLiving();
|
||||
|
||||
if (eventEntityLiving.isPotionActive(RegistrarBloodMagic.BOOST)) {
|
||||
int i = eventEntityLiving.getActivePotionEffect(RegistrarBloodMagic.BOOST).getAmplifier();
|
||||
|
@ -44,7 +44,7 @@ public class PotionEventHandlers {
|
|||
|
||||
@SubscribeEvent
|
||||
public static void onLivingFall(LivingFallEvent event) {
|
||||
EntityLivingBase eventEntityLiving = event.getEntityLiving();
|
||||
LivingEntity eventEntityLiving = event.getEntityLiving();
|
||||
|
||||
if (eventEntityLiving.isPotionActive(RegistrarBloodMagic.HEAVY_HEART)) {
|
||||
int i = eventEntityLiving.getActivePotionEffect(RegistrarBloodMagic.HEAVY_HEART).getAmplifier() + 1;
|
||||
|
@ -55,11 +55,11 @@ public class PotionEventHandlers {
|
|||
|
||||
@SubscribeEvent
|
||||
public static void onEntityUpdate(LivingEvent.LivingUpdateEvent event) {
|
||||
EntityLivingBase eventEntityLiving = event.getEntityLiving();
|
||||
List<EntityPlayer> flightList = flightListMap.getOrDefault(eventEntityLiving.getEntityWorld(), Lists.newArrayList());
|
||||
LivingEntity eventEntityLiving = event.getEntityLiving();
|
||||
List<PlayerEntity> flightList = flightListMap.getOrDefault(eventEntityLiving.getEntityWorld(), Lists.newArrayList());
|
||||
|
||||
if (eventEntityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) eventEntityLiving;
|
||||
if (eventEntityLiving instanceof PlayerEntity) {
|
||||
PlayerEntity player = (PlayerEntity) eventEntityLiving;
|
||||
if (!player.world.isRemote) {
|
||||
if (player.isPotionActive(RegistrarBloodMagic.FLIGHT)) {
|
||||
if (!player.isSpectator() && !player.capabilities.allowFlying) {
|
||||
|
@ -92,7 +92,7 @@ public class PotionEventHandlers {
|
|||
// }
|
||||
// }
|
||||
// }
|
||||
List<EntityLivingBase> noGravityList = noGravityListMap.getOrDefault(event.getEntityLiving().getEntityWorld(), Lists.newArrayList());
|
||||
List<LivingEntity> noGravityList = noGravityListMap.getOrDefault(event.getEntityLiving().getEntityWorld(), Lists.newArrayList());
|
||||
if (eventEntityLiving.isPotionActive(RegistrarBloodMagic.SUSPENDED) && !eventEntityLiving.hasNoGravity()) {
|
||||
eventEntityLiving.setNoGravity(true);
|
||||
noGravityList.add(eventEntityLiving);
|
||||
|
@ -102,7 +102,7 @@ public class PotionEventHandlers {
|
|||
}
|
||||
|
||||
if (eventEntityLiving.isPotionActive(RegistrarBloodMagic.GROUNDED))
|
||||
if (eventEntityLiving instanceof EntityPlayer && ((EntityPlayer) eventEntityLiving).capabilities.isFlying)
|
||||
if (eventEntityLiving instanceof PlayerEntity && ((PlayerEntity) eventEntityLiving).capabilities.isFlying)
|
||||
eventEntityLiving.motionY -= (0.05D * (double) (eventEntityLiving.getActivePotionEffect(RegistrarBloodMagic.GROUNDED).getAmplifier() + 1) - eventEntityLiving.motionY) * 0.2D;
|
||||
else
|
||||
eventEntityLiving.motionY -= (0.1D * (double) (eventEntityLiving.getActivePotionEffect(RegistrarBloodMagic.GROUNDED).getAmplifier() + 1) - eventEntityLiving.motionY) * 0.2D;
|
||||
|
@ -120,10 +120,10 @@ public class PotionEventHandlers {
|
|||
|
||||
Entity throwingEntity = null;
|
||||
|
||||
if (projectile instanceof EntityArrow)
|
||||
throwingEntity = ((EntityArrow) projectile).shootingEntity;
|
||||
else if (projectile instanceof EntityThrowable)
|
||||
throwingEntity = ((EntityThrowable) projectile).getThrower();
|
||||
if (projectile instanceof AbstractArrowEntity)
|
||||
throwingEntity = ((AbstractArrowEntity) projectile).shootingEntity;
|
||||
else if (projectile instanceof ThrowableEntity)
|
||||
throwingEntity = ((ThrowableEntity) projectile).getThrower();
|
||||
|
||||
if (throwingEntity != null && throwingEntity.equals(eventEntityLiving))
|
||||
continue;
|
||||
|
@ -161,7 +161,7 @@ public class PotionEventHandlers {
|
|||
@SubscribeEvent
|
||||
public static void onPlayerRespawn(PlayerEvent.Clone event) {
|
||||
if (event.isWasDeath())
|
||||
event.getEntityPlayer().addPotionEffect(new PotionEffect(RegistrarBloodMagic.SOUL_FRAY, 400));
|
||||
event.getEntityPlayer().addPotionEffect(new EffectInstance(RegistrarBloodMagic.SOUL_FRAY, 400));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue