Merge remote-tracking branch 'origin/1.12' into 1.12
This commit is contained in:
commit
a5a9224f6d
19 changed files with 643 additions and 248 deletions
|
@ -9,61 +9,68 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|||
|
||||
@Config(modid = BloodMagic.MODID, name = BloodMagic.MODID + "/" + BloodMagic.MODID, category = "")
|
||||
@Mod.EventBusSubscriber(modid = BloodMagic.MODID)
|
||||
public class ConfigHandler {
|
||||
public class ConfigHandler
|
||||
{
|
||||
|
||||
@Config.Comment({"General settings"})
|
||||
@Config.Comment({ "General settings" })
|
||||
public static ConfigGeneral general = new ConfigGeneral();
|
||||
@Config.Comment({"Blacklist options for various features"})
|
||||
@Config.Comment({ "Blacklist options for various features" })
|
||||
public static ConfigBlacklist blacklist = new ConfigBlacklist();
|
||||
@Config.Comment({"Value modifiers for various features"})
|
||||
@Config.Comment({ "Value modifiers for various features" })
|
||||
public static ConfigValues values = new ConfigValues();
|
||||
@Config.Comment({"Toggles for all rituals"})
|
||||
@Config.Comment({ "Toggles for all rituals" })
|
||||
public static ConfigRituals rituals = new ConfigRituals();
|
||||
@Config.Comment({"Settings that only pertain to the client"})
|
||||
@Config.Comment({ "Settings that only pertain to the client" })
|
||||
public static ConfigClient client = new ConfigClient();
|
||||
@Config.Comment({"Compatibility settings"})
|
||||
@Config.Comment({ "Compatibility settings" })
|
||||
public static ConfigCompat compat = new ConfigCompat();
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
|
||||
if (event.getModID().equals(BloodMagic.MODID)) {
|
||||
public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event)
|
||||
{
|
||||
if (event.getModID().equals(BloodMagic.MODID))
|
||||
{
|
||||
ConfigManager.sync(event.getModID(), Config.Type.INSTANCE); // Sync config values
|
||||
MeteorConfigHandler.handleMeteors(false); // Reload meteors
|
||||
}
|
||||
}
|
||||
|
||||
public static class ConfigGeneral {
|
||||
@Config.Comment({"Enables extra information to be printed to the log.", "Warning: May drastically increase log size."})
|
||||
public static class ConfigGeneral
|
||||
{
|
||||
@Config.Comment({ "Enables extra information to be printed to the log.", "Warning: May drastically increase log size." })
|
||||
public boolean enableDebugLogging = false;
|
||||
@Config.Comment({"Enables extra information to be printed to the log."})
|
||||
@Config.Comment({ "Enables extra information to be printed to the log." })
|
||||
public boolean enableAPILogging = false;
|
||||
@Config.Comment({"Enables extra information to be printed to the log.", "Warning: May drastically increase log size."})
|
||||
@Config.Comment({ "Enables extra information to be printed to the log.", "Warning: May drastically increase log size." })
|
||||
public boolean enableVerboseAPILogging = false;
|
||||
}
|
||||
|
||||
public static class ConfigBlacklist {
|
||||
@Config.Comment({"Stops listed blocks and entities from being teleposed.", "Use the registry name of the block or entity. Vanilla objects do not require the modid.", "If a block is specified, you can list the variants to only blacklist a given state."})
|
||||
public String[] teleposer = {"bedrock", "mob_spawner"};
|
||||
@Config.Comment({"Stops listed blocks from being transposed.", "Use the registry name of the block. Vanilla blocks do not require the modid."})
|
||||
public String[] transposer = {"bedrock", "mob_spawner"};
|
||||
@Config.Comment({"Stops the listed entities from being used in the Well of Suffering.", "Use the registry name of the entity. Vanilla entities do not require the modid."})
|
||||
public static class ConfigBlacklist
|
||||
{
|
||||
@Config.Comment({ "Stops listed blocks and entities from being teleposed.", "Use the registry name of the block or entity. Vanilla objects do not require the modid.", "If a block is specified, you can list the variants to only blacklist a given state." })
|
||||
public String[] teleposer = { "bedrock", "mob_spawner" };
|
||||
@Config.Comment({ "Stops listed blocks from being transposed.", "Use the registry name of the block. Vanilla blocks do not require the modid." })
|
||||
public String[] transposer = { "bedrock", "mob_spawner" };
|
||||
@Config.Comment({ "Stops the listed entities from being used in the Well of Suffering.", "Use the registry name of the entity. Vanilla entities do not require the modid." })
|
||||
public String[] wellOfSuffering = {};
|
||||
}
|
||||
|
||||
public static class ConfigValues {
|
||||
@Config.Comment({"Declares the amount of LP gained per HP sacrificed for the given entity.", "Setting the value to 0 will blacklist it.", "Use the registry name of the entity followed by a ';' and then the value you want.", "Vanilla entities do not require the modid."})
|
||||
public String[] sacrificialValues = {"villager;100", "slime;15", "enderman;10", "cow;100", "chicken;100", "horse;100", "sheep;100", "wolf;100", "ocelot;100", "pig;100", "rabbit;100"};
|
||||
@Config.Comment({"Amount of LP the Coat of Arms should provide for each damage dealt."})
|
||||
public static class ConfigValues
|
||||
{
|
||||
@Config.Comment({ "Declares the amount of LP gained per HP sacrificed for the given entity.", "Setting the value to 0 will blacklist it.", "Use the registry name of the entity followed by a ';' and then the value you want.", "Vanilla entities do not require the modid." })
|
||||
public String[] sacrificialValues = { "villager;100", "slime;15", "enderman;10", "cow;100", "chicken;100", "horse;100", "sheep;100", "wolf;100", "ocelot;100", "pig;100", "rabbit;100" };
|
||||
@Config.Comment({ "Amount of LP the Coat of Arms should provide for each damage dealt." })
|
||||
@Config.RangeInt(min = 0, max = 100)
|
||||
public int coatOfArmsConversion = 20;
|
||||
@Config.Comment({"Amount of LP the Sacrificial Dagger should provide for each damage dealt."})
|
||||
@Config.Comment({ "Amount of LP the Sacrificial Dagger should provide for each damage dealt." })
|
||||
@Config.RangeInt(min = 0, max = 10000)
|
||||
public int sacrificialDaggerConversion = 100;
|
||||
@Config.Comment({"Will rewrite any default meteor types with new versions.", "Disable this if you want any of your changes to stay, or do not want default meteor types regenerated."})
|
||||
@Config.Comment({ "Will rewrite any default meteor types with new versions.", "Disable this if you want any of your changes to stay, or do not want default meteor types regenerated." })
|
||||
public boolean shouldResyncMeteors = true;
|
||||
}
|
||||
|
||||
public static class ConfigRituals {
|
||||
public static class ConfigRituals
|
||||
{
|
||||
public boolean ritualAnimalGrowth = true;
|
||||
public boolean ritualContainment = true;
|
||||
public boolean ritualCrushing = true;
|
||||
|
@ -93,33 +100,38 @@ public class ConfigHandler {
|
|||
public boolean ritualPortal = true;
|
||||
public boolean ritualMeteor = true;
|
||||
public boolean ritualDowngrade = true;
|
||||
public boolean ritualEllipsoid = true;
|
||||
public ConfigImperfectRituals imperfect = new ConfigImperfectRituals();
|
||||
}
|
||||
|
||||
public static class ConfigImperfectRituals {
|
||||
public static class ConfigImperfectRituals
|
||||
{
|
||||
public boolean imperfectRitualNight = true;
|
||||
public boolean imperfectRitualRain = true;
|
||||
public boolean imperfectRitualResistance = true;
|
||||
public boolean imperfectRitualZombie = true;
|
||||
}
|
||||
|
||||
public static class ConfigClient {
|
||||
@Config.Comment({"Always render the beams between routing nodes.", "If disabled, the beams will only render while the Node Router is held."})
|
||||
public static class ConfigClient
|
||||
{
|
||||
@Config.Comment({ "Always render the beams between routing nodes.", "If disabled, the beams will only render while the Node Router is held." })
|
||||
public boolean alwaysRenderRoutingLines = false;
|
||||
@Config.Comment({"Completely hide spectral blocks from view.", "If disabled, a transparent block will be displayed."})
|
||||
@Config.Comment({ "Completely hide spectral blocks from view.", "If disabled, a transparent block will be displayed." })
|
||||
public boolean invisibleSpectralBlocks = true;
|
||||
@Config.Comment({"When cycling through slots, the Sigil of Holding will skip over empty slots and move to the next occupied one.", "If disabled, it will behave identically to the default hotbar."})
|
||||
@Config.Comment({ "When cycling through slots, the Sigil of Holding will skip over empty slots and move to the next occupied one.", "If disabled, it will behave identically to the default hotbar." })
|
||||
public boolean sigilHoldingSkipsEmptySlots = false;
|
||||
}
|
||||
|
||||
public static class ConfigCompat {
|
||||
@Config.Comment({"The display mode to use when looking at a Blood Altar.", "ALWAYS - Always display information.", "SIGIL_HELD - Only display information when a Divination or Seers sigil is held in either hand.", "SIGIL_CONTAINED - Only display information when a Divination or Seers sigil is somewhere in the inventory."})
|
||||
public static class ConfigCompat
|
||||
{
|
||||
@Config.Comment({ "The display mode to use when looking at a Blood Altar.", "ALWAYS - Always display information.", "SIGIL_HELD - Only display information when a Divination or Seers sigil is held in either hand.", "SIGIL_CONTAINED - Only display information when a Divination or Seers sigil is somewhere in the inventory." })
|
||||
public AltarDisplayMode wailaAltarDisplayMode = AltarDisplayMode.SIGIL_HELD;
|
||||
|
||||
public enum AltarDisplayMode {
|
||||
public enum AltarDisplayMode
|
||||
{
|
||||
ALWAYS,
|
||||
SIGIL_HELD,
|
||||
SIGIL_CONTAINED,;
|
||||
SIGIL_CONTAINED, ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ public class AlchemyArrayEffectLaputa extends AlchemyArrayEffect
|
|||
|
||||
public int getRandomRadius(Random rand)
|
||||
{
|
||||
return rand.nextInt(4) + 4;
|
||||
return rand.nextInt(5) + 4;
|
||||
}
|
||||
|
||||
public int getRandomHeightOffset(Random rand)
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package WayofTime.bloodmagic.alchemyArray;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.iface.IAlchemyArray;
|
||||
|
||||
public class AlchemyArrayEffectSpike extends AlchemyArrayEffect
|
||||
{
|
||||
public AlchemyArrayEffectSpike(String key)
|
||||
{
|
||||
super(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(TileEntity tile, int ticksActive)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(IAlchemyArray array, World world, BlockPos pos, IBlockState state, Entity entity)
|
||||
{
|
||||
if (entity instanceof EntityLivingBase)
|
||||
{
|
||||
entity.attackEntityFrom(DamageSource.CACTUS, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlchemyArrayEffect getNewCopy()
|
||||
{
|
||||
return new AlchemyArrayEffectSpike(key);
|
||||
}
|
||||
}
|
|
@ -8,7 +8,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
|||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.play.server.SPacketUpdateHealth;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
|
@ -37,15 +36,9 @@ public class AlchemyArrayEffectTeleport extends AlchemyArrayEffect
|
|||
@Override
|
||||
public void onEntityCollidedWithBlock(IAlchemyArray array, World world, BlockPos pos, IBlockState state, Entity entity)
|
||||
{
|
||||
EnumFacing direction = array.getRotation();
|
||||
|
||||
{
|
||||
double motionY = 0.5;
|
||||
double speed = 3;
|
||||
EnumFacing direction = array.getRotation();
|
||||
|
||||
teleportEntityInDirection(world, pos, entity, direction);
|
||||
}
|
||||
|
||||
teleportEntityInDirection(world, pos, entity, direction);
|
||||
}
|
||||
|
||||
public void teleportEntityInDirection(World world, BlockPos currentPos, Entity entity, EnumFacing direction)
|
||||
|
@ -66,7 +59,6 @@ public class AlchemyArrayEffectTeleport extends AlchemyArrayEffect
|
|||
entity.timeUntilPortal = TELEPORT_DELAY;
|
||||
if (!world.isRemote)
|
||||
{
|
||||
Potion d;
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayerMP player = (EntityPlayerMP) entity;
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package WayofTime.bloodmagic.client.render.alchemyArray;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class LowStaticAlchemyCircleRenderer extends LowAlchemyCircleRenderer
|
||||
{
|
||||
public LowStaticAlchemyCircleRenderer()
|
||||
{
|
||||
this(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SkeletonTurret1.png"));
|
||||
}
|
||||
|
||||
public LowStaticAlchemyCircleRenderer(ResourceLocation arrayResource)
|
||||
{
|
||||
super(arrayResource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRotation(float craftTime)
|
||||
{
|
||||
float offset = 2;
|
||||
float duration = 180;
|
||||
if (craftTime >= offset && craftTime < offset + duration)
|
||||
{
|
||||
float modifier = (craftTime - offset) * 2f;
|
||||
return modifier * 1f;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -93,6 +93,36 @@ public class CategoryAlchemy
|
|||
bouncePages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "bounce" + ".info"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "bounce"), new EntryText(bouncePages, TextHelper.localize(keyBase + "bounce"), true));
|
||||
|
||||
List<IPage> teleportPages = new ArrayList<>();
|
||||
|
||||
PageAlchemyArray teleportRecipePage = BookUtils.getAlchemyPage("teleport");
|
||||
if (teleportRecipePage != null)
|
||||
{
|
||||
teleportPages.add(teleportRecipePage);
|
||||
}
|
||||
teleportPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "teleport" + ".info"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "teleport"), new EntryText(teleportPages, TextHelper.localize(keyBase + "teleport"), true));
|
||||
|
||||
List<IPage> standardTurretPages = new ArrayList<>();
|
||||
|
||||
PageAlchemyArray standardTurretRecipePage = BookUtils.getAlchemyPage("turret");
|
||||
if (standardTurretRecipePage != null)
|
||||
{
|
||||
standardTurretPages.add(standardTurretRecipePage);
|
||||
}
|
||||
standardTurretPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "standardTurret" + ".info"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "standardTurret"), new EntryText(standardTurretPages, TextHelper.localize(keyBase + "standardTurret"), true));
|
||||
|
||||
List<IPage> laputaPages = new ArrayList<>();
|
||||
|
||||
PageAlchemyArray laputaRecipePage = BookUtils.getAlchemyPage("laputa");
|
||||
if (laputaRecipePage != null)
|
||||
{
|
||||
laputaPages.add(laputaRecipePage);
|
||||
}
|
||||
laputaPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "laputa" + ".info"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "laputa"), new EntryText(laputaPages, TextHelper.localize(keyBase + "laputa"), true));
|
||||
|
||||
List<IPage> buffPages = new ArrayList<>();
|
||||
|
||||
buffPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "buff" + ".info"), 370));
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -1,41 +1,59 @@
|
|||
package WayofTime.bloodmagic.entity.projectile;
|
||||
|
||||
import WayofTime.bloodmagic.util.Constants;
|
||||
import WayofTime.bloodmagic.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.soul.PlayerDemonWillHandler;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityTippedArrow;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.soul.PlayerDemonWillHandler;
|
||||
import WayofTime.bloodmagic.util.Constants;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class EntitySentientArrow extends EntityTippedArrow {
|
||||
public class EntitySentientArrow extends EntityTippedArrow
|
||||
{
|
||||
public double reimbursedAmountOnHit = 0;
|
||||
public EnumDemonWillType type = EnumDemonWillType.DEFAULT;
|
||||
public int currentLevel = 0;
|
||||
public float[] destructiveExplosionRadius = { 0.5f, 1, 1.5f, 2, 2.5f, 3, 3.5f };
|
||||
public int[] poisonDuration = { 50, 100, 150, 80, 120, 160, 200 };
|
||||
public int[] poisonLevel = { 0, 0, 0, 1, 1, 1, 1 };
|
||||
public int[] levitationDuration = { 20, 40, 60, 80, 100, 120, 160 };
|
||||
public int[] levitationLevel = { 0, 0, 0, 1, 1, 1, 2 };
|
||||
public int[] slownessDuration = { 40, 60, 100, 150, 200, 250, 300 };
|
||||
public int[] slownessLevel = { 0, 0, 0, 1, 1, 1, 2 };
|
||||
|
||||
public EntitySentientArrow(World worldIn) {
|
||||
public EntitySentientArrow(World worldIn)
|
||||
{
|
||||
super(worldIn);
|
||||
}
|
||||
|
||||
public EntitySentientArrow(World worldIn, double x, double y, double z) {
|
||||
public EntitySentientArrow(World worldIn, double x, double y, double z)
|
||||
{
|
||||
super(worldIn, x, y, z);
|
||||
}
|
||||
|
||||
public EntitySentientArrow(World worldIn, EntityLivingBase shooter, EnumDemonWillType type, double reinburseAmount) {
|
||||
public EntitySentientArrow(World worldIn, EntityLivingBase shooter, EnumDemonWillType type, double reinburseAmount, int currentLevel)
|
||||
{
|
||||
super(worldIn, shooter);
|
||||
this.reimbursedAmountOnHit = reinburseAmount;
|
||||
this.type = type;
|
||||
this.currentLevel = currentLevel;
|
||||
}
|
||||
|
||||
public void reimbursePlayer(EntityLivingBase hitEntity, float damage) {
|
||||
if (this.shootingEntity instanceof EntityPlayer) {
|
||||
if (hitEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(hitEntity instanceof IMob)) {
|
||||
public void reimbursePlayer(EntityLivingBase hitEntity, float damage)
|
||||
{
|
||||
if (this.shootingEntity instanceof EntityPlayer)
|
||||
{
|
||||
if (hitEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(hitEntity instanceof IMob))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -44,23 +62,88 @@ public class EntitySentientArrow extends EntityTippedArrow {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound tag) {
|
||||
protected void arrowHit(EntityLivingBase living)
|
||||
{
|
||||
super.arrowHit(living);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case CORROSIVE:
|
||||
living.addPotionEffect(new PotionEffect(MobEffects.POISON, currentLevel >= 0 ? poisonDuration[currentLevel] : 0, currentLevel >= 0 ? poisonLevel[currentLevel] : 0));
|
||||
break;
|
||||
case DEFAULT:
|
||||
break;
|
||||
case DESTRUCTIVE:
|
||||
this.world.createExplosion(this, this.posX, this.posY, this.posZ, currentLevel >= 0 ? destructiveExplosionRadius[currentLevel] : 0, false);
|
||||
break;
|
||||
case STEADFAST:
|
||||
living.addPotionEffect(new PotionEffect(MobEffects.LEVITATION, currentLevel >= 0 ? levitationDuration[currentLevel] : 0, currentLevel >= 0 ? levitationLevel[currentLevel] : 0));
|
||||
break;
|
||||
case VENGEFUL:
|
||||
living.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, currentLevel >= 0 ? slownessDuration[currentLevel] : 0, currentLevel >= 0 ? slownessLevel[currentLevel] : 0));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
|
||||
if (!this.world.isRemote && this.inGround && this.timeInGround > 0)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DESTRUCTIVE:
|
||||
this.world.createExplosion(this, this.posX, this.posY, this.posZ, currentLevel >= 0 ? destructiveExplosionRadius[currentLevel] : 0, false);
|
||||
this.setDead();
|
||||
break;
|
||||
case CORROSIVE:
|
||||
break;
|
||||
case DEFAULT:
|
||||
break;
|
||||
case STEADFAST:
|
||||
break;
|
||||
case VENGEFUL:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
// else if (this.inGround && this.timeInGround != 0 && !this.customPotionEffects.isEmpty() && this.timeInGround >= 600)
|
||||
// {
|
||||
// this.world.setEntityState(this, (byte)0);
|
||||
// this.potion = PotionTypes.EMPTY;
|
||||
// this.customPotionEffects.clear();
|
||||
// this.dataManager.set(COLOR, Integer.valueOf(-1));
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeEntityToNBT(tag);
|
||||
|
||||
tag.setDouble("reimbursement", reimbursedAmountOnHit);
|
||||
tag.setInteger("currentLevel", currentLevel);
|
||||
tag.setString(Constants.NBT.WILL_TYPE, type.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound tag) {
|
||||
public void readEntityFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readEntityFromNBT(tag);
|
||||
|
||||
reimbursedAmountOnHit = tag.getDouble("reimbursement");
|
||||
type = EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH));
|
||||
currentLevel = tag.getInteger("currentLevel");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getArrowStack() {
|
||||
protected ItemStack getArrowStack()
|
||||
{
|
||||
return new ItemStack(Items.ARROW);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,56 +40,68 @@ import java.util.Locale;
|
|||
|
||||
public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentientTool, IVariantProvider//, IMeshProvider
|
||||
{
|
||||
public static int[] soulBracket = new int[]{16, 60, 200, 400, 1000};
|
||||
public static double[] defaultDamageAdded = new double[]{0.25, 0.5, 0.75, 1, 1.25};
|
||||
public static float[] velocityAdded = new float[]{0.25f, 0.5f, 0.75f, 1, 1.25f};
|
||||
public static double[] soulDrainPerSwing = new double[]{0.05, 0.1, 0.2, 0.4, 0.75}; //TODO
|
||||
public static double[] soulDrop = new double[]{2, 4, 7, 10, 13};
|
||||
public static double[] staticDrop = new double[]{1, 1, 2, 3, 3};
|
||||
public static int[] soulBracket = new int[] { 16, 60, 200, 400, 1000, 2000, 4000 };
|
||||
public static double[] defaultDamageAdded = new double[] { 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75 };
|
||||
public static float[] velocityAdded = new float[] { 0.25f, 0.5f, 0.75f, 1, 1.25f, 1.5f, 1.75f };
|
||||
public static double[] soulDrainPerSwing = new double[] { 0.05, 0.1, 0.2, 0.4, 0.75, 1, 1.5 }; //TODO
|
||||
public static double[] soulDrop = new double[] { 2, 4, 7, 10, 13, 16, 24 };
|
||||
public static double[] staticDrop = new double[] { 1, 1, 2, 3, 3, 3, 4 };
|
||||
|
||||
public ItemSentientBow() {
|
||||
public ItemSentientBow()
|
||||
{
|
||||
super();
|
||||
setUnlocalizedName(BloodMagic.MODID + ".sentientBow");
|
||||
setCreativeTab(BloodMagic.TAB_BM);
|
||||
this.addPropertyOverride(new ResourceLocation("pull"), new IItemPropertyGetter() {
|
||||
this.addPropertyOverride(new ResourceLocation("pull"), new IItemPropertyGetter()
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack, World world, EntityLivingBase entityIn) {
|
||||
if (entityIn == null) {
|
||||
public float apply(ItemStack stack, World world, EntityLivingBase entityIn)
|
||||
{
|
||||
if (entityIn == null)
|
||||
{
|
||||
return 0.0F;
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
ItemStack itemstack = entityIn.getActiveItemStack();
|
||||
return !itemstack.isEmpty() && itemstack.getItem() == RegistrarBloodMagicItems.SENTIENT_BOW ? (float) (stack.getMaxItemUseDuration() - entityIn.getItemInUseCount()) / 20.0F : 0.0F;
|
||||
}
|
||||
}
|
||||
});
|
||||
this.addPropertyOverride(new ResourceLocation("pulling"), new IItemPropertyGetter() {
|
||||
this.addPropertyOverride(new ResourceLocation("pulling"), new IItemPropertyGetter()
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack, World world, EntityLivingBase entityIn) {
|
||||
public float apply(ItemStack stack, World world, EntityLivingBase entityIn)
|
||||
{
|
||||
return entityIn != null && entityIn.isHandActive() && entityIn.getActiveItemStack() == stack ? 1.0F : 0.0F;
|
||||
}
|
||||
});
|
||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter()
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack, World world, EntityLivingBase entityIn) {
|
||||
public float apply(ItemStack stack, World world, EntityLivingBase entityIn)
|
||||
{
|
||||
return ((ItemSentientBow) RegistrarBloodMagicItems.SENTIENT_BOW).getCurrentType(stack).ordinal();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
|
||||
{
|
||||
return RegistrarBloodMagicItems.ITEM_DEMON_CRYSTAL == repair.getItem() || super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
|
||||
public void recalculatePowers(ItemStack stack, World world, EntityPlayer player) {
|
||||
public void recalculatePowers(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
EnumDemonWillType type = PlayerDemonWillHandler.getLargestWillType(player);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
recalculatePowers(stack, type, soulsRemaining);
|
||||
}
|
||||
|
||||
public void recalculatePowers(ItemStack stack, EnumDemonWillType type, double will) {
|
||||
public void recalculatePowers(ItemStack stack, EnumDemonWillType type, double will)
|
||||
{
|
||||
this.setCurrentType(stack, will > 0 ? type : EnumDemonWillType.DEFAULT);
|
||||
int level = getLevel(stack, will);
|
||||
int level = getLevel(will);
|
||||
//
|
||||
double drain = level >= 0 ? soulDrainPerSwing[level] : 0;
|
||||
|
||||
|
@ -108,10 +120,13 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
setDamageAdded(stack, level >= 0 ? getDamageModifier(type, level) : 0);
|
||||
}
|
||||
|
||||
private int getLevel(ItemStack stack, double soulsRemaining) {
|
||||
private int getLevel(double soulsRemaining)
|
||||
{
|
||||
int lvl = -1;
|
||||
for (int i = 0; i < soulBracket.length; i++) {
|
||||
if (soulsRemaining >= soulBracket[i]) {
|
||||
for (int i = 0; i < soulBracket.length; i++)
|
||||
{
|
||||
if (soulsRemaining >= soulBracket[i])
|
||||
{
|
||||
lvl = i;
|
||||
}
|
||||
}
|
||||
|
@ -120,42 +135,49 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumDemonWillType getCurrentType(ItemStack stack) {
|
||||
public EnumDemonWillType getCurrentType(ItemStack stack)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (!tag.hasKey(Constants.NBT.WILL_TYPE)) {
|
||||
if (!tag.hasKey(Constants.NBT.WILL_TYPE))
|
||||
{
|
||||
return EnumDemonWillType.DEFAULT;
|
||||
}
|
||||
|
||||
return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public double getDamageModifier(EnumDemonWillType type, int willBracket) {
|
||||
switch (type) {
|
||||
case VENGEFUL:
|
||||
return 0;
|
||||
case DEFAULT:
|
||||
case CORROSIVE:
|
||||
case DESTRUCTIVE:
|
||||
case STEADFAST:
|
||||
return defaultDamageAdded[willBracket];
|
||||
public double getDamageModifier(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case VENGEFUL:
|
||||
return 0;
|
||||
case DEFAULT:
|
||||
case CORROSIVE:
|
||||
case DESTRUCTIVE:
|
||||
case STEADFAST:
|
||||
return defaultDamageAdded[willBracket];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public float getVelocityModifier(EnumDemonWillType type, int willBracket) {
|
||||
switch (type) {
|
||||
case VENGEFUL:
|
||||
return velocityAdded[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
public float getVelocityModifier(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case VENGEFUL:
|
||||
return velocityAdded[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setDamageAdded(ItemStack stack, double damage) {
|
||||
public void setDamageAdded(ItemStack stack, double damage)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -163,7 +185,8 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
tag.setDouble("damage", damage);
|
||||
}
|
||||
|
||||
public double getDamageAdded(ItemStack stack) {
|
||||
public double getDamageAdded(ItemStack stack)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -171,7 +194,8 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
return tag.getDouble("damage");
|
||||
}
|
||||
|
||||
public void setVelocityOfArrow(ItemStack stack, float velocity) {
|
||||
public void setVelocityOfArrow(ItemStack stack, float velocity)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -179,19 +203,22 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
tag.setFloat("velocity", velocity);
|
||||
}
|
||||
|
||||
public float getVelocityOfArrow(ItemStack stack) {
|
||||
public float getVelocityOfArrow(ItemStack stack)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (tag.hasKey("velocity")) {
|
||||
if (tag.hasKey("velocity"))
|
||||
{
|
||||
return tag.getFloat("velocity");
|
||||
}
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
public void setCurrentType(ItemStack stack, EnumDemonWillType type) {
|
||||
public void setCurrentType(ItemStack stack, EnumDemonWillType type)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -199,14 +226,16 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
tag.setString(Constants.NBT.WILL_TYPE, type.toString());
|
||||
}
|
||||
|
||||
public double getDrainOfActivatedBow(ItemStack stack) {
|
||||
public double getDrainOfActivatedBow(ItemStack stack)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_ACTIVE_DRAIN);
|
||||
}
|
||||
|
||||
public void setDrainOfActivatedBow(ItemStack stack, double drain) {
|
||||
public void setDrainOfActivatedBow(ItemStack stack, double drain)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -214,14 +243,16 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_ACTIVE_DRAIN, drain);
|
||||
}
|
||||
|
||||
public double getStaticDropOfActivatedBow(ItemStack stack) {
|
||||
public double getStaticDropOfActivatedBow(ItemStack stack)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_STATIC_DROP);
|
||||
}
|
||||
|
||||
public void setStaticDropOfActivatedBow(ItemStack stack, double drop) {
|
||||
public void setStaticDropOfActivatedBow(ItemStack stack, double drop)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -229,14 +260,16 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_STATIC_DROP, drop);
|
||||
}
|
||||
|
||||
public double getDropOfActivatedBow(ItemStack stack) {
|
||||
public double getDropOfActivatedBow(ItemStack stack)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_DROP);
|
||||
}
|
||||
|
||||
public void setDropOfActivatedBow(ItemStack stack, double drop) {
|
||||
public void setDropOfActivatedBow(ItemStack stack, double drop)
|
||||
{
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -245,24 +278,28 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
this.recalculatePowers(stack, world, player);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
|
||||
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants)
|
||||
{
|
||||
variants.put(0, "inventory");
|
||||
}
|
||||
|
||||
public EntityTippedArrow getArrowEntity(World world, ItemStack stack, EntityLivingBase target, EntityLivingBase user, float velocity) {
|
||||
public EntityTippedArrow getArrowEntity(World world, ItemStack stack, EntityLivingBase target, EntityLivingBase user, float velocity)
|
||||
{
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
|
||||
double amount = user instanceof EntityPlayer ? (this.getDropOfActivatedBow(stack) * world.rand.nextDouble() + this.getStaticDropOfActivatedBow(stack)) : 0;
|
||||
|
||||
float newArrowVelocity = velocity * getVelocityOfArrow(stack);
|
||||
EntitySentientArrow entityArrow = new EntitySentientArrow(world, user, type, amount);
|
||||
double soulsRemaining = user instanceof EntityPlayer ? (PlayerDemonWillHandler.getTotalDemonWill(type, (EntityPlayer) user)) : 0;
|
||||
EntitySentientArrow entityArrow = new EntitySentientArrow(world, user, type, amount, getLevel(soulsRemaining));
|
||||
|
||||
double d0 = target.posX - user.posX;
|
||||
double d1 = target.getEntityBoundingBox().minY + (double) (target.height / 3.0F) - entityArrow.posY;
|
||||
|
@ -270,12 +307,14 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
|
||||
entityArrow.shoot(d0, d1 + d3 * 0.05, d2, newArrowVelocity, 0);
|
||||
|
||||
if (newArrowVelocity == 0) {
|
||||
if (newArrowVelocity == 0)
|
||||
{
|
||||
world.playSound(null, user.getPosition(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.NEUTRAL, 0.4F, 1.0F);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (velocity == 1.0F) {
|
||||
if (velocity == 1.0F)
|
||||
{
|
||||
entityArrow.setIsCritical(true);
|
||||
}
|
||||
|
||||
|
@ -285,11 +324,13 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
|
||||
int k = EnchantmentHelper.getEnchantmentLevel(Enchantments.PUNCH, stack);
|
||||
|
||||
if (k > 0) {
|
||||
if (k > 0)
|
||||
{
|
||||
entityArrow.setKnockbackStrength(k);
|
||||
}
|
||||
|
||||
if (EnchantmentHelper.getEnchantmentLevel(Enchantments.FLAME, stack) > 0) {
|
||||
if (EnchantmentHelper.getEnchantmentLevel(Enchantments.FLAME, stack) > 0)
|
||||
{
|
||||
entityArrow.setFire(100);
|
||||
}
|
||||
|
||||
|
@ -299,8 +340,10 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityLivingBase entityLiving, int timeLeft) {
|
||||
if (entityLiving instanceof EntityPlayer) {
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityLivingBase entityLiving, int timeLeft)
|
||||
{
|
||||
if (entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) entityLiving;
|
||||
boolean flag = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantments.INFINITY, stack) > 0;
|
||||
ItemStack itemstack = this.getFiredArrow(player);
|
||||
|
@ -310,17 +353,21 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
if (i < 0)
|
||||
return;
|
||||
|
||||
if (itemstack != null || flag) {
|
||||
if (itemstack == null) {
|
||||
if (itemstack != null || flag)
|
||||
{
|
||||
if (itemstack == null)
|
||||
{
|
||||
itemstack = new ItemStack(Items.ARROW);
|
||||
}
|
||||
|
||||
float arrowVelocity = getArrowVelocity(i);
|
||||
|
||||
if ((double) arrowVelocity >= 0.1D) {
|
||||
if ((double) arrowVelocity >= 0.1D)
|
||||
{
|
||||
boolean flag1 = flag && itemstack.getItem() == Items.ARROW; //Forge: Fix consuming custom arrows.
|
||||
|
||||
if (!world.isRemote) {
|
||||
if (!world.isRemote)
|
||||
{
|
||||
this.recalculatePowers(stack, world, player);
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
|
||||
|
@ -331,15 +378,18 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
double amount = (this.getDropOfActivatedBow(stack) * world.rand.nextDouble() + this.getStaticDropOfActivatedBow(stack));
|
||||
|
||||
float newArrowVelocity = arrowVelocity * getVelocityOfArrow(stack);
|
||||
EntitySentientArrow entityArrow = new EntitySentientArrow(world, entityLiving, type, amount);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
EntitySentientArrow entityArrow = new EntitySentientArrow(world, entityLiving, type, amount, getLevel(soulsRemaining));
|
||||
entityArrow.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, newArrowVelocity, 1.0F);
|
||||
|
||||
if (newArrowVelocity == 0) {
|
||||
if (newArrowVelocity == 0)
|
||||
{
|
||||
world.playSound(null, player.getPosition(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.NEUTRAL, 0.4F, 1.0F);
|
||||
return;
|
||||
}
|
||||
|
||||
if (arrowVelocity == 1.0F) {
|
||||
if (arrowVelocity == 1.0F)
|
||||
{
|
||||
entityArrow.setIsCritical(true);
|
||||
}
|
||||
|
||||
|
@ -349,17 +399,20 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
|
||||
int k = EnchantmentHelper.getEnchantmentLevel(Enchantments.PUNCH, stack);
|
||||
|
||||
if (k > 0) {
|
||||
if (k > 0)
|
||||
{
|
||||
entityArrow.setKnockbackStrength(k);
|
||||
}
|
||||
|
||||
if (EnchantmentHelper.getEnchantmentLevel(Enchantments.FLAME, stack) > 0) {
|
||||
if (EnchantmentHelper.getEnchantmentLevel(Enchantments.FLAME, stack) > 0)
|
||||
{
|
||||
entityArrow.setFire(100);
|
||||
}
|
||||
|
||||
stack.damageItem(1, player);
|
||||
|
||||
if (flag1) {
|
||||
if (flag1)
|
||||
{
|
||||
entityArrow.pickupStatus = EntityArrow.PickupStatus.CREATIVE_ONLY;
|
||||
}
|
||||
|
||||
|
@ -368,10 +421,12 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
|
||||
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + arrowVelocity * 0.5F);
|
||||
|
||||
if (!flag1) {
|
||||
if (!flag1)
|
||||
{
|
||||
itemstack.shrink(1);
|
||||
|
||||
if (itemstack.isEmpty()) {
|
||||
if (itemstack.isEmpty())
|
||||
{
|
||||
player.inventory.deleteStack(itemstack);
|
||||
}
|
||||
}
|
||||
|
@ -382,16 +437,22 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
}
|
||||
}
|
||||
|
||||
protected ItemStack getFiredArrow(EntityPlayer player) {
|
||||
if (this.isArrow(player.getHeldItem(EnumHand.OFF_HAND))) {
|
||||
protected ItemStack getFiredArrow(EntityPlayer player)
|
||||
{
|
||||
if (this.isArrow(player.getHeldItem(EnumHand.OFF_HAND)))
|
||||
{
|
||||
return player.getHeldItem(EnumHand.OFF_HAND);
|
||||
} else if (this.isArrow(player.getHeldItem(EnumHand.MAIN_HAND))) {
|
||||
} else if (this.isArrow(player.getHeldItem(EnumHand.MAIN_HAND)))
|
||||
{
|
||||
return player.getHeldItem(EnumHand.MAIN_HAND);
|
||||
} else {
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); ++i) {
|
||||
} else
|
||||
{
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); ++i)
|
||||
{
|
||||
ItemStack itemstack = player.inventory.getStackInSlot(i);
|
||||
|
||||
if (this.isArrow(itemstack)) {
|
||||
if (this.isArrow(itemstack))
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
|
@ -401,14 +462,17 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player) {
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player)
|
||||
{
|
||||
World world = player.getEntityWorld();
|
||||
if (!world.isRemote) {
|
||||
if (!world.isRemote)
|
||||
{
|
||||
this.recalculatePowers(droppedStack, world, player);
|
||||
|
||||
EnumDemonWillType type = this.getCurrentType(droppedStack);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
if (soulsRemaining < 1024) {
|
||||
if (soulsRemaining < 1024)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,76 +16,90 @@ import org.apache.commons.codec.binary.StringUtils;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
public class LivingArmourUpgradeSpeed extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{3, 7, 13, 26, 42, 60, 90, 130, 180, 250};
|
||||
public static final double[] speedModifier = new double[]{0.1, 0.2, 0.3, 0.4, 0.5, 0.7, 0.9, 1.1, 1.3, 1.5};
|
||||
public static final int[] sprintSpeedTime = new int[]{0, 0, 0, 0, 0, 20, 60, 60, 100, 200};
|
||||
public static final int[] sprintSpeedLevel = new int[]{0, 0, 0, 0, 0, 0, 0, 1, 1, 2};
|
||||
public static final int[] healthModifier = new int[]{0, 0, 0, 0, 0, 0, 0, 4, 10, 20};
|
||||
public static final int[] sprintRegenTime = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 25};
|
||||
public class LivingArmourUpgradeSpeed extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { 3, 7, 13, 26, 42, 60, 90, 130, 180, 250 };
|
||||
public static final double[] speedModifier = new double[] { 0.1, 0.2, 0.3, 0.4, 0.5, 0.7, 0.9, 1.1, 1.3, 1.5 };
|
||||
public static final int[] sprintSpeedTime = new int[] { 0, 0, 0, 0, 0, 20, 60, 60, 100, 200 };
|
||||
public static final int[] sprintSpeedLevel = new int[] { 0, 0, 0, 0, 0, 0, 0, 1, 1, 2 };
|
||||
public static final int[] healthModifier = new int[] { 0, 0, 0, 0, 0, 0, 0, 4, 10, 20 };
|
||||
public static final int[] sprintRegenTime = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 25 };
|
||||
|
||||
public LivingArmourUpgradeSpeed(int level) {
|
||||
public LivingArmourUpgradeSpeed(int level)
|
||||
{
|
||||
super(level);
|
||||
}
|
||||
|
||||
public double getSpeedModifier() {
|
||||
public double getSpeedModifier()
|
||||
{
|
||||
return speedModifier[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
if (player.isSprinting()) {
|
||||
if (sprintSpeedTime[this.level] > 0) {
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
if (player.isSprinting())
|
||||
{
|
||||
if (sprintSpeedTime[this.level] > 0)
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.SPEED, sprintSpeedTime[this.level], sprintSpeedLevel[this.level], false, false));
|
||||
}
|
||||
|
||||
if (sprintRegenTime[this.level] > 0 && !player.isPotionActive(MobEffects.REGENERATION)) {
|
||||
if (sprintRegenTime[this.level] > 0 && !player.isPotionActive(MobEffects.REGENERATION))
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, sprintRegenTime[this.level], 0, false, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers() {
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers()
|
||||
{
|
||||
Multimap<String, AttributeModifier> modifierMap = HashMultimap.create();
|
||||
|
||||
// modifierMap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(895132, 1), "Speed modifier" + 1, speedModifier[this.level], 1));
|
||||
|
||||
if (healthModifier[this.level] > 0) {
|
||||
String name = getUniqueIdentifier() + "-HealthModifier1";
|
||||
modifierMap.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(UUID.nameUUIDFromBytes(StringUtils.getBytesUtf8(name)), "HealthModifier1", healthModifier[this.level], 0));
|
||||
}
|
||||
// if (healthModifier[this.level] > 0) {
|
||||
// String name = getUniqueIdentifier() + "-HealthModifier1";
|
||||
// modifierMap.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(UUID.nameUUIDFromBytes(StringUtils.getBytesUtf8(name)), "HealthModifier1", healthModifier[this.level], 0));
|
||||
// }
|
||||
|
||||
return modifierMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier() {
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
return BloodMagic.MODID + ".upgrade.movement";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier() {
|
||||
public int getMaxTier()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade() {
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
return tooltipBase + "speed";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import WayofTime.bloodmagic.util.BMLog;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.MobEffects;
|
||||
|
@ -25,15 +24,18 @@ 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;
|
||||
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectSpike;
|
||||
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectTeleport;
|
||||
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectUpdraft;
|
||||
import WayofTime.bloodmagic.client.render.alchemyArray.AttractorAlchemyCircleRenderer;
|
||||
import WayofTime.bloodmagic.client.render.alchemyArray.BindingAlchemyCircleRenderer;
|
||||
import WayofTime.bloodmagic.client.render.alchemyArray.DualAlchemyCircleRenderer;
|
||||
import WayofTime.bloodmagic.client.render.alchemyArray.LowAlchemyCircleRenderer;
|
||||
import WayofTime.bloodmagic.client.render.alchemyArray.LowStaticAlchemyCircleRenderer;
|
||||
import WayofTime.bloodmagic.client.render.alchemyArray.SingleAlchemyCircleRenderer;
|
||||
import WayofTime.bloodmagic.client.render.alchemyArray.StaticAlchemyCircleRenderer;
|
||||
import WayofTime.bloodmagic.client.render.alchemyArray.TurretAlchemyCircleRenderer;
|
||||
|
@ -61,6 +63,7 @@ import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeStormTroop
|
|||
import WayofTime.bloodmagic.potion.BMPotionUtils;
|
||||
import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTableDyeableRecipe;
|
||||
import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTablePotionRecipe;
|
||||
import WayofTime.bloodmagic.util.BMLog;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
import com.google.common.base.Stopwatch;
|
||||
|
@ -122,8 +125,9 @@ public class ModRecipes
|
|||
AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Items.ARROW), new ItemStack(Items.FEATHER), new AlchemyArrayEffectSkeletonTurret("skeletonTurret"), new DualAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SkeletonTurret1.png"), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SkeletonTurret2.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("turretTest"), 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.BOW), new ItemStack(Items.ARROW), new AlchemyArrayEffectArrowTurret("turret"), new TurretAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SkeletonTurret1.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")));
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ public class ModRituals
|
|||
RitualRegistry.registerRitual(downgradeRitual, ConfigHandler.rituals.ritualDowngrade);
|
||||
|
||||
ellipsoidRitual = new RitualEllipsoid();
|
||||
RitualRegistry.registerRitual(ellipsoidRitual, false);
|
||||
RitualRegistry.registerRitual(ellipsoidRitual, ConfigHandler.rituals.ritualEllipsoid);
|
||||
|
||||
RitualCrushing.registerCuttingFluid(ItemCuttingFluid.FluidType.BASIC.getStack(), 250, 0.5);
|
||||
RitualCrushing.registerCuttingFluid(ItemCuttingFluid.FluidType.EXPLOSIVE.getStack(), 25, 0.05);
|
||||
|
|
|
@ -198,7 +198,7 @@ public class RitualEllipsoid extends Ritual
|
|||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
return 0;
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -217,8 +217,43 @@ public class RitualEllipsoid extends Ritual
|
|||
@Override
|
||||
public void gatherComponents(Consumer<RitualComponent> components)
|
||||
{
|
||||
addCornerRunes(components, 1, 0, EnumRuneType.WATER);
|
||||
addCornerRunes(components, 1, 1, EnumRuneType.WATER);
|
||||
addCornerRunes(components, 1, 0, EnumRuneType.DUSK);
|
||||
|
||||
addRune(components, 4, 0, 0, EnumRuneType.FIRE);
|
||||
addRune(components, 5, 0, 0, EnumRuneType.FIRE);
|
||||
addRune(components, 5, 0, -1, EnumRuneType.FIRE);
|
||||
addRune(components, 5, 0, -2, EnumRuneType.FIRE);
|
||||
addRune(components, -4, 0, 0, EnumRuneType.FIRE);
|
||||
addRune(components, -5, 0, 0, EnumRuneType.FIRE);
|
||||
addRune(components, -5, 0, 1, EnumRuneType.FIRE);
|
||||
addRune(components, -5, 0, 2, EnumRuneType.FIRE);
|
||||
|
||||
addRune(components, 0, 0, 4, EnumRuneType.AIR);
|
||||
addRune(components, 0, 0, 5, EnumRuneType.AIR);
|
||||
addRune(components, 1, 0, 5, EnumRuneType.AIR);
|
||||
addRune(components, 2, 0, 5, EnumRuneType.AIR);
|
||||
addRune(components, 0, 0, -4, EnumRuneType.AIR);
|
||||
addRune(components, 0, 0, -5, EnumRuneType.AIR);
|
||||
addRune(components, -1, 0, -5, EnumRuneType.AIR);
|
||||
addRune(components, -2, 0, -5, EnumRuneType.AIR);
|
||||
|
||||
addRune(components, 3, 0, 1, EnumRuneType.EARTH);
|
||||
addRune(components, 3, 0, 2, EnumRuneType.EARTH);
|
||||
addRune(components, 3, 0, 3, EnumRuneType.EARTH);
|
||||
addRune(components, 2, 0, 3, EnumRuneType.EARTH);
|
||||
addRune(components, -3, 0, -1, EnumRuneType.EARTH);
|
||||
addRune(components, -3, 0, -2, EnumRuneType.EARTH);
|
||||
addRune(components, -3, 0, -3, EnumRuneType.EARTH);
|
||||
addRune(components, -2, 0, -3, EnumRuneType.EARTH);
|
||||
|
||||
addRune(components, 1, 0, -3, EnumRuneType.WATER);
|
||||
addRune(components, 2, 0, -3, EnumRuneType.WATER);
|
||||
addRune(components, 3, 0, -3, EnumRuneType.WATER);
|
||||
addRune(components, 3, 0, -2, EnumRuneType.WATER);
|
||||
addRune(components, -1, 0, 3, EnumRuneType.WATER);
|
||||
addRune(components, -2, 0, 3, EnumRuneType.WATER);
|
||||
addRune(components, -3, 0, 3, EnumRuneType.WATER);
|
||||
addRune(components, -3, 0, 2, EnumRuneType.WATER);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue