this doesn't compile yet, but have something to peek at

This commit is contained in:
Nicholas Ignoffo 2017-08-14 20:53:42 -07:00
parent 973f1019a5
commit 5fcdd978d7
329 changed files with 3247 additions and 2953 deletions

View file

@ -22,8 +22,6 @@ import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTablePotionAugmentRecipe;
import com.google.common.base.Objects;
public class BMPotionUtils
{
public static Random rand = new Random();
@ -50,7 +48,7 @@ public class BMPotionUtils
BlockPos blockPos = entity.getPosition().add(rand.nextInt(horizontalRadius * 2 + 1) - horizontalRadius, rand.nextInt(verticalRadius * 2 + 1) - verticalRadius, rand.nextInt(horizontalRadius * 2 + 1) - horizontalRadius);
Block block = world.getBlockState(blockPos).getBlock();
if (!BloodMagicAPI.getGreenGroveBlacklist().contains(block))
if (!BloodMagicAPI.greenGroveBlacklist.contains(block))
{
if (block instanceof IPlantable || block instanceof IGrowable)
{
@ -79,7 +77,7 @@ public class BMPotionUtils
if (incurredDamage > 0)
{
entity.attackEntityFrom(BloodMagicAPI.getDamageSource(), (float) incurredDamage);
entity.attackEntityFrom(BloodMagicAPI.damageSource, (float) incurredDamage);
}
return incurredDamage;
@ -125,7 +123,7 @@ public class BMPotionUtils
return stack;
} else
{
NBTTagCompound nbttagcompound = (NBTTagCompound) Objects.firstNonNull(stack.getTagCompound(), new NBTTagCompound());
NBTTagCompound nbttagcompound = stack.hasTagCompound() ? stack.getTagCompound() : new NBTTagCompound();
NBTTagList nbttaglist = new NBTTagList();
for (PotionEffect potioneffect : effects)

View file

@ -1,6 +1,6 @@
package WayofTime.bloodmagic.potion;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.BloodMagic;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
@ -11,9 +11,9 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class PotionBloodMagic extends Potion
{
public static ResourceLocation texture = new ResourceLocation(Constants.Mod.MODID, "textures/misc/potions.png");
public static ResourceLocation texture = new ResourceLocation(BloodMagic.MODID, "textures/misc/potions.png");
public PotionBloodMagic(String name, ResourceLocation texture, boolean badEffect, int potionColor, int iconIndexX, int iconIndexY)
public PotionBloodMagic(String name, boolean badEffect, int potionColor, int iconIndexX, int iconIndexY)
{
super(badEffect, potionColor);
this.setPotionName(name);

View file

@ -1,36 +1,33 @@
package WayofTime.bloodmagic.potion;
import WayofTime.bloodmagic.api.event.SacrificeKnifeUsedEvent;
import WayofTime.bloodmagic.registry.ModPotions;
import WayofTime.bloodmagic.registry.RegistrarBloodMagic;
import net.minecraft.entity.Entity;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingEvent;
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;
@Mod.EventBusSubscriber
public class PotionEventHandlers
{
public PotionEventHandlers()
{
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public void onLivingJumpEvent(LivingEvent.LivingJumpEvent event)
public static void onLivingJumpEvent(LivingEvent.LivingJumpEvent event)
{
if (event.getEntityLiving().isPotionActive(ModPotions.boost))
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST))
{
int i = event.getEntityLiving().getActivePotionEffect(ModPotions.boost).getAmplifier();
int i = event.getEntityLiving().getActivePotionEffect(RegistrarBloodMagic.BOOST).getAmplifier();
event.getEntityLiving().motionY += (0.1f) * (2 + i);
}
@ -40,7 +37,7 @@ public class PotionEventHandlers
}
@SubscribeEvent
public void onEntityUpdate(LivingEvent.LivingUpdateEvent event)
public static void onEntityUpdate(LivingEvent.LivingUpdateEvent event)
{
// if (event.getEntityLiving().isPotionActive(ModPotions.boost))
// {
@ -58,7 +55,7 @@ public class PotionEventHandlers
// }
// }
if (event.getEntityLiving().isPotionActive(ModPotions.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);
@ -113,30 +110,30 @@ public class PotionEventHandlers
}
@SubscribeEvent
public void onPlayerRespawn(PlayerEvent.Clone event)
public static void onPlayerRespawn(PlayerEvent.Clone event)
{
if (event.isWasDeath())
event.getEntityPlayer().addPotionEffect(new PotionEffect(ModPotions.soulFray, 400));
event.getEntityPlayer().addPotionEffect(new PotionEffect(RegistrarBloodMagic.SOUL_FRAY, 400));
}
@SubscribeEvent
public void onSacrificeKnifeUsed(SacrificeKnifeUsedEvent event)
public static void onSacrificeKnifeUsed(SacrificeKnifeUsedEvent event)
{
if (event.player.isPotionActive(ModPotions.soulFray))
if (event.player.isPotionActive(RegistrarBloodMagic.SOUL_FRAY))
event.lpAdded = (int) (event.lpAdded * 0.1D);
}
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPlayerDamageEvent(LivingAttackEvent event)
public static void onPlayerDamageEvent(LivingAttackEvent event)
{
if (event.getEntityLiving().isPotionActive(ModPotions.whirlwind) && event.isCancelable() && event.getSource().isProjectile())
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.WHIRLWIND) && event.isCancelable() && event.getSource().isProjectile())
event.setCanceled(true);
}
@SubscribeEvent
public void onEndermanTeleportEvent(EnderTeleportEvent event)
public static void onEndermanTeleportEvent(EnderTeleportEvent event)
{
if (event.getEntityLiving().isPotionActive(ModPotions.planarBinding) && event.isCancelable())
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.PLANAR_BINDING) && event.isCancelable())
{
event.setCanceled(true);
}