diff --git a/src/main/java/io/redspace/ironsspellbooks/config/ServerConfigs.java b/src/main/java/io/redspace/ironsspellbooks/config/ServerConfigs.java index 26cfc199c..4b5f85a06 100644 --- a/src/main/java/io/redspace/ironsspellbooks/config/ServerConfigs.java +++ b/src/main/java/io/redspace/ironsspellbooks/config/ServerConfigs.java @@ -134,12 +134,12 @@ public class ServerConfigs { createSpellConfig(SpellType.VOID_TENTACLES_SPELL, true, 3, SpellRarity.LEGENDARY, 30); BUILDER.pop(); //Poison - BUILDER.comment("Poison Spells"); - createSpellConfig(SpellType.POISON_ARROW_SPELL, true, 10, SpellRarity.COMMON, 25); - createSpellConfig(SpellType.POISON_SPLASH_SPELL, true, 10, SpellRarity.UNCOMMON, 20); - createSpellConfig(SpellType.POISON_BREATH_SPELL, true, 10, SpellRarity.COMMON, 25); - createSpellConfig(SpellType.ACID_ORB_SPELL, true, 10, SpellRarity.COMMON, 15); - createSpellConfig(SpellType.SPIDER_ASPECT_SPELL, true, 8, SpellRarity.COMMON, 35); +// BUILDER.comment("Poison Spells"); +// createSpellConfig(SpellType.POISON_ARROW_SPELL, true, 10, SpellRarity.COMMON, 25); +// createSpellConfig(SpellType.POISON_SPLASH_SPELL, true, 10, SpellRarity.UNCOMMON, 20); +// createSpellConfig(SpellType.POISON_BREATH_SPELL, true, 10, SpellRarity.COMMON, 25); +// createSpellConfig(SpellType.ACID_ORB_SPELL, true, 10, SpellRarity.COMMON, 15); +// createSpellConfig(SpellType.SPIDER_ASPECT_SPELL, true, 8, SpellRarity.COMMON, 35); diff --git a/src/main/java/io/redspace/ironsspellbooks/entity/spells/poison_arrow/PoisonArrow.java b/src/main/java/io/redspace/ironsspellbooks/entity/spells/poison_arrow/PoisonArrow.java index 65241e79b..dbb94804c 100644 --- a/src/main/java/io/redspace/ironsspellbooks/entity/spells/poison_arrow/PoisonArrow.java +++ b/src/main/java/io/redspace/ironsspellbooks/entity/spells/poison_arrow/PoisonArrow.java @@ -1,190 +1,190 @@ -package io.redspace.ironsspellbooks.entity.spells.poison_arrow; - -import io.redspace.ironsspellbooks.capabilities.magic.MagicManager; -import io.redspace.ironsspellbooks.damage.DamageSources; -import io.redspace.ironsspellbooks.entity.spells.AbstractMagicProjectile; -import io.redspace.ironsspellbooks.entity.spells.poison_cloud.PoisonCloud; -import io.redspace.ironsspellbooks.registries.EntityRegistry; -import io.redspace.ironsspellbooks.spells.SchoolType; -import io.redspace.ironsspellbooks.spells.SpellType; -import io.redspace.ironsspellbooks.util.ParticleHelper; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.syncher.EntityDataAccessor; -import net.minecraft.network.syncher.EntityDataSerializers; -import net.minecraft.network.syncher.SynchedEntityData; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.projectile.Projectile; -import net.minecraft.world.level.Level; -import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.EntityHitResult; -import net.minecraft.world.phys.Vec3; - -import java.util.Optional; - -public class PoisonArrow extends AbstractMagicProjectile { - private static final EntityDataAccessor IN_GROUND = SynchedEntityData.defineId(PoisonArrow.class, EntityDataSerializers.BOOLEAN); - - public PoisonArrow(EntityType pEntityType, Level pLevel) { - super(pEntityType, pLevel); - } - - public PoisonArrow(Level levelIn, LivingEntity shooter) { - this(EntityRegistry.POISON_ARROW.get(), levelIn); - setOwner(shooter); - } - - public int shakeTime; - protected boolean hasEmittedPoison; - protected boolean inGround; - protected float aoeDamage; - - @Override - public void tick() { - - if (this.shakeTime > 0) { - --this.shakeTime; - } - if (!inGround) { - super.tick(); - //IronsSpellbooks.LOGGER.debug("Poison Arrow Flying!! {}", inGround); - } else { - if (++age > EXPIRE_TIME) { - discard(); - return; - } - if (shouldFall()) { - inGround = false; - //IronsSpellbooks.LOGGER.debug("This side thinks we should fall {}", getDeltaMovement()); - this.setDeltaMovement(getDeltaMovement().normalize().scale(0.05f)); - - } - } - - } - - @Override - protected void defineSynchedData() { - super.defineSynchedData(); - this.getEntityData().define(IN_GROUND, false); - - } - - public void setAoeDamage(float damage) { - this.aoeDamage = damage; - } - - public float getAoeDamage() { - return aoeDamage; - } - - private boolean shouldFall() { - return this.inGround && this.level.noCollision((new AABB(this.position(), this.position())).inflate(0.06D)); - } - - @Override - protected void onHitBlock(BlockHitResult pResult) { - super.onHitBlock(pResult); - Vec3 vec3 = pResult.getLocation().subtract(this.getX(), this.getY(), this.getZ()); - this.setDeltaMovement(vec3); - Vec3 vec31 = vec3.normalize().scale(0.05F); - this.setPosRaw(this.getX() - vec31.x, this.getY() - vec31.y, this.getZ() - vec31.z); - this.playSound(SoundEvents.ARROW_HIT, 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); - this.inGround = true; - this.shakeTime = 7; - if (!level.isClientSide && !hasEmittedPoison){ - createPoisonCloud(pResult.getLocation()); - } - - //IronsSpellbooks.LOGGER.debug("Poison Arrow onHitBlock: {}", inGround); - - } - - @Override - protected void onHitEntity(EntityHitResult entityHitResult) { - if (level.isClientSide) - return; - Entity entity = entityHitResult.getEntity(); - boolean hit = DamageSources.applyDamage(entity, getDamage(), SpellType.POISON_ARROW_SPELL.getDamageSource(this, getOwner()), SchoolType.POISON); - //TODO: add evasion and stuff. Also do this for all other projectiles? - boolean ignore = entity.getType() == EntityType.ENDERMAN; - if (hit) { - if (!ignore) { - if (!level.isClientSide && !hasEmittedPoison) - createPoisonCloud(entity.position()); - if (entity instanceof LivingEntity livingEntity) - livingEntity.setArrowCount(livingEntity.getArrowCount() + 1); - var spawn = entityHitResult.getLocation(); - this.discard(); - } - } else { - this.setDeltaMovement(this.getDeltaMovement().scale(-0.1D)); - this.setYRot(this.getYRot() + 180.0F); - this.yRotO += 180.0F; - } - - - } - - @Override - protected void addAdditionalSaveData(CompoundTag pCompound) { - super.addAdditionalSaveData(pCompound); - pCompound.putBoolean("inGround", this.inGround); - pCompound.putBoolean("hasEmittedPoison", hasEmittedPoison); - pCompound.putFloat("aoeDamage", aoeDamage); - } - - public void createPoisonCloud(Vec3 location) { - if (!level.isClientSide) { - PoisonCloud cloud = new PoisonCloud(level); - cloud.setOwner(getOwner()); - cloud.setDuration(200); - cloud.setDamage(aoeDamage); - cloud.moveTo(location); - level.addFreshEntity(cloud); - hasEmittedPoison = true; - } - } - - @Override - protected void readAdditionalSaveData(CompoundTag pCompound) { - super.readAdditionalSaveData(pCompound); - this.inGround = pCompound.getBoolean("inGround"); - this.hasEmittedPoison = pCompound.getBoolean("hasEmittedPoison"); - this.aoeDamage = pCompound.getFloat("aoeDamage"); - } - - @Override - public void trailParticles() { - Vec3 vec3 = this.position().subtract(getDeltaMovement().scale(2)); - level.addParticle(ParticleHelper.ACID, vec3.x, vec3.y, vec3.z, 0, 0, 0); - } - - @Override - public void impactParticles(double x, double y, double z) { - MagicManager.spawnParticles(level, ParticleHelper.ACID, x, y, z, 15, .03, .03, .03, 0.2, true); - } - - @Override - public float getSpeed() { - return 2.5f; - } - - @Override - public Optional getImpactSound() { - return Optional.empty(); - } - - @Override - public boolean respectsGravity() { - return true; - } - - - - -} +//package io.redspace.ironsspellbooks.entity.spells.poison_arrow; +// +//import io.redspace.ironsspellbooks.capabilities.magic.MagicManager; +//import io.redspace.ironsspellbooks.damage.DamageSources; +//import io.redspace.ironsspellbooks.entity.spells.AbstractMagicProjectile; +//import io.redspace.ironsspellbooks.entity.spells.poison_cloud.PoisonCloud; +//import io.redspace.ironsspellbooks.registries.EntityRegistry; +//import io.redspace.ironsspellbooks.spells.SchoolType; +//import io.redspace.ironsspellbooks.spells.SpellType; +//import io.redspace.ironsspellbooks.util.ParticleHelper; +//import net.minecraft.nbt.CompoundTag; +//import net.minecraft.network.syncher.EntityDataAccessor; +//import net.minecraft.network.syncher.EntityDataSerializers; +//import net.minecraft.network.syncher.SynchedEntityData; +//import net.minecraft.sounds.SoundEvent; +//import net.minecraft.sounds.SoundEvents; +//import net.minecraft.world.entity.Entity; +//import net.minecraft.world.entity.EntityType; +//import net.minecraft.world.entity.LivingEntity; +//import net.minecraft.world.entity.projectile.Projectile; +//import net.minecraft.world.level.Level; +//import net.minecraft.world.phys.AABB; +//import net.minecraft.world.phys.BlockHitResult; +//import net.minecraft.world.phys.EntityHitResult; +//import net.minecraft.world.phys.Vec3; +// +//import java.util.Optional; +// +//public class PoisonArrow extends AbstractMagicProjectile { +// private static final EntityDataAccessor IN_GROUND = SynchedEntityData.defineId(PoisonArrow.class, EntityDataSerializers.BOOLEAN); +// +// public PoisonArrow(EntityType pEntityType, Level pLevel) { +// super(pEntityType, pLevel); +// } +// +// public PoisonArrow(Level levelIn, LivingEntity shooter) { +// this(EntityRegistry.POISON_ARROW.get(), levelIn); +// setOwner(shooter); +// } +// +// public int shakeTime; +// protected boolean hasEmittedPoison; +// protected boolean inGround; +// protected float aoeDamage; +// +// @Override +// public void tick() { +// +// if (this.shakeTime > 0) { +// --this.shakeTime; +// } +// if (!inGround) { +// super.tick(); +// //IronsSpellbooks.LOGGER.debug("Poison Arrow Flying!! {}", inGround); +// } else { +// if (++age > EXPIRE_TIME) { +// discard(); +// return; +// } +// if (shouldFall()) { +// inGround = false; +// //IronsSpellbooks.LOGGER.debug("This side thinks we should fall {}", getDeltaMovement()); +// this.setDeltaMovement(getDeltaMovement().normalize().scale(0.05f)); +// +// } +// } +// +// } +// +// @Override +// protected void defineSynchedData() { +// super.defineSynchedData(); +// this.getEntityData().define(IN_GROUND, false); +// +// } +// +// public void setAoeDamage(float damage) { +// this.aoeDamage = damage; +// } +// +// public float getAoeDamage() { +// return aoeDamage; +// } +// +// private boolean shouldFall() { +// return this.inGround && this.level.noCollision((new AABB(this.position(), this.position())).inflate(0.06D)); +// } +// +// @Override +// protected void onHitBlock(BlockHitResult pResult) { +// super.onHitBlock(pResult); +// Vec3 vec3 = pResult.getLocation().subtract(this.getX(), this.getY(), this.getZ()); +// this.setDeltaMovement(vec3); +// Vec3 vec31 = vec3.normalize().scale(0.05F); +// this.setPosRaw(this.getX() - vec31.x, this.getY() - vec31.y, this.getZ() - vec31.z); +// this.playSound(SoundEvents.ARROW_HIT, 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); +// this.inGround = true; +// this.shakeTime = 7; +// if (!level.isClientSide && !hasEmittedPoison){ +// createPoisonCloud(pResult.getLocation()); +// } +// +// //IronsSpellbooks.LOGGER.debug("Poison Arrow onHitBlock: {}", inGround); +// +// } +// +// @Override +// protected void onHitEntity(EntityHitResult entityHitResult) { +// if (level.isClientSide) +// return; +// Entity entity = entityHitResult.getEntity(); +// boolean hit = DamageSources.applyDamage(entity, getDamage(), SpellType.POISON_ARROW_SPELL.getDamageSource(this, getOwner()), SchoolType.POISON); +// //TODO: add evasion and stuff. Also do this for all other projectiles? +// boolean ignore = entity.getType() == EntityType.ENDERMAN; +// if (hit) { +// if (!ignore) { +// if (!level.isClientSide && !hasEmittedPoison) +// createPoisonCloud(entity.position()); +// if (entity instanceof LivingEntity livingEntity) +// livingEntity.setArrowCount(livingEntity.getArrowCount() + 1); +// var spawn = entityHitResult.getLocation(); +// this.discard(); +// } +// } else { +// this.setDeltaMovement(this.getDeltaMovement().scale(-0.1D)); +// this.setYRot(this.getYRot() + 180.0F); +// this.yRotO += 180.0F; +// } +// +// +// } +// +// @Override +// protected void addAdditionalSaveData(CompoundTag pCompound) { +// super.addAdditionalSaveData(pCompound); +// pCompound.putBoolean("inGround", this.inGround); +// pCompound.putBoolean("hasEmittedPoison", hasEmittedPoison); +// pCompound.putFloat("aoeDamage", aoeDamage); +// } +// +// public void createPoisonCloud(Vec3 location) { +// if (!level.isClientSide) { +// PoisonCloud cloud = new PoisonCloud(level); +// cloud.setOwner(getOwner()); +// cloud.setDuration(200); +// cloud.setDamage(aoeDamage); +// cloud.moveTo(location); +// level.addFreshEntity(cloud); +// hasEmittedPoison = true; +// } +// } +// +// @Override +// protected void readAdditionalSaveData(CompoundTag pCompound) { +// super.readAdditionalSaveData(pCompound); +// this.inGround = pCompound.getBoolean("inGround"); +// this.hasEmittedPoison = pCompound.getBoolean("hasEmittedPoison"); +// this.aoeDamage = pCompound.getFloat("aoeDamage"); +// } +// +// @Override +// public void trailParticles() { +// Vec3 vec3 = this.position().subtract(getDeltaMovement().scale(2)); +// level.addParticle(ParticleHelper.ACID, vec3.x, vec3.y, vec3.z, 0, 0, 0); +// } +// +// @Override +// public void impactParticles(double x, double y, double z) { +// MagicManager.spawnParticles(level, ParticleHelper.ACID, x, y, z, 15, .03, .03, .03, 0.2, true); +// } +// +// @Override +// public float getSpeed() { +// return 2.5f; +// } +// +// @Override +// public Optional getImpactSound() { +// return Optional.empty(); +// } +// +// @Override +// public boolean respectsGravity() { +// return true; +// } +// +// +// +// +//} diff --git a/src/main/java/io/redspace/ironsspellbooks/entity/spells/poison_arrow/PoisonArrowRenderer.java b/src/main/java/io/redspace/ironsspellbooks/entity/spells/poison_arrow/PoisonArrowRenderer.java index 4e9d45443..efb21ff4c 100644 --- a/src/main/java/io/redspace/ironsspellbooks/entity/spells/poison_arrow/PoisonArrowRenderer.java +++ b/src/main/java/io/redspace/ironsspellbooks/entity/spells/poison_arrow/PoisonArrowRenderer.java @@ -1,85 +1,85 @@ -package io.redspace.ironsspellbooks.entity.spells.poison_arrow; - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.PoseStack.Pose; -import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.math.Matrix3f; -import com.mojang.math.Matrix4f; -import com.mojang.math.Vector3f; -import io.redspace.ironsspellbooks.IronsSpellbooks; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.entity.EntityRenderer; -import net.minecraft.client.renderer.entity.EntityRendererProvider.Context; -import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; -import net.minecraft.world.phys.Vec3; - -public class PoisonArrowRenderer extends EntityRenderer { - //private static final ResourceLocation TEXTURE = irons_spellbooks.id("textures/entity/icicle_projectile.png"); - private static final ResourceLocation TEXTURE = IronsSpellbooks.id("textures/entity/arrow.png"); - - public PoisonArrowRenderer(Context context) { - super(context); - } - - @Override - public void render(PoisonArrow entity, float yaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferSource, int light) { - poseStack.pushPose(); - - Vec3 motion = entity.getDeltaMovement(); - float xRot = -((float) (Mth.atan2(motion.horizontalDistance(), motion.y) * (double) (180F / (float) Math.PI)) - 90.0F); - float yRot = -((float) (Mth.atan2(motion.z, motion.x) * (double) (180F / (float) Math.PI)) + 90.0F); - poseStack.mulPose(Vector3f.YP.rotationDegrees(yRot)); - poseStack.mulPose(Vector3f.XP.rotationDegrees(xRot)); - - float f9 = entity.shakeTime - partialTicks; - if (f9 > 0.0F) { - float f10 = -Mth.sin(f9 * 3.0F) * f9; - poseStack.mulPose(Vector3f.XP.rotationDegrees(f10)); - } - - renderModel(poseStack, bufferSource, light); - poseStack.popPose(); - - super.render(entity, yaw, partialTicks, poseStack, bufferSource, light); - } - - public static void renderModel(PoseStack poseStack, MultiBufferSource bufferSource, int light) { - poseStack.scale(0.125f, 0.125f, 0.125f); - - //poseStack.mulPose(entityRenderDispatcher.cameraOrientation()); - //poseStack.mulPose(Vector3f.YP.rotationDegrees(180f)); - - Pose pose = poseStack.last(); - Matrix4f poseMatrix = pose.pose(); - Matrix3f normalMatrix = pose.normal(); - - VertexConsumer consumer = bufferSource.getBuffer(RenderType.entityCutout(getTextureLocation())); - poseStack.mulPose(Vector3f.YP.rotationDegrees(90.0F)); - poseStack.translate(-2, 0, 0); - - for (int j = 0; j < 4; ++j) { - poseStack.mulPose(Vector3f.XP.rotationDegrees(90.0F)); - vertex(poseMatrix, normalMatrix, consumer, -8, -2, 0, 0.0F, 0.0F, 0, 1, 0, light); - vertex(poseMatrix, normalMatrix, consumer, 8, -2, 0, 0.5F, 0.0F, 0, 1, 0, light); - vertex(poseMatrix, normalMatrix, consumer, 8, 2, 0, 0.5F, 0.15625F, 0, 1, 0, light); - vertex(poseMatrix, normalMatrix, consumer, -8, 2, 0, 0.0F, 0.15625F, 0, 1, 0, light); - } - } - - public static void vertex(Matrix4f pMatrix, Matrix3f pNormals, VertexConsumer pVertexBuilder, int pOffsetX, int pOffsetY, int pOffsetZ, float pTextureX, float pTextureY, int pNormalX, int p_113835_, int p_113836_, int pPackedLight) { - pVertexBuilder.vertex(pMatrix, (float) pOffsetX, (float) pOffsetY, (float) pOffsetZ).color(255, 255, 255, 255).uv(pTextureX, pTextureY).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(pPackedLight).normal(pNormals, (float) pNormalX, (float) p_113836_, (float) p_113835_).endVertex(); - } - - @Override - public ResourceLocation getTextureLocation(PoisonArrow entity) { - return getTextureLocation(); - } - - public static ResourceLocation getTextureLocation() { - return TEXTURE; - } - -} \ No newline at end of file +//package io.redspace.ironsspellbooks.entity.spells.poison_arrow; +// +//import com.mojang.blaze3d.vertex.PoseStack; +//import com.mojang.blaze3d.vertex.PoseStack.Pose; +//import com.mojang.blaze3d.vertex.VertexConsumer; +//import com.mojang.math.Matrix3f; +//import com.mojang.math.Matrix4f; +//import com.mojang.math.Vector3f; +//import io.redspace.ironsspellbooks.IronsSpellbooks; +//import net.minecraft.client.renderer.MultiBufferSource; +//import net.minecraft.client.renderer.RenderType; +//import net.minecraft.client.renderer.entity.EntityRenderer; +//import net.minecraft.client.renderer.entity.EntityRendererProvider.Context; +//import net.minecraft.client.renderer.texture.OverlayTexture; +//import net.minecraft.resources.ResourceLocation; +//import net.minecraft.util.Mth; +//import net.minecraft.world.phys.Vec3; +// +//public class PoisonArrowRenderer extends EntityRenderer { +// //private static final ResourceLocation TEXTURE = irons_spellbooks.id("textures/entity/icicle_projectile.png"); +// private static final ResourceLocation TEXTURE = IronsSpellbooks.id("textures/entity/arrow.png"); +// +// public PoisonArrowRenderer(Context context) { +// super(context); +// } +// +// @Override +// public void render(PoisonArrow entity, float yaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferSource, int light) { +// poseStack.pushPose(); +// +// Vec3 motion = entity.getDeltaMovement(); +// float xRot = -((float) (Mth.atan2(motion.horizontalDistance(), motion.y) * (double) (180F / (float) Math.PI)) - 90.0F); +// float yRot = -((float) (Mth.atan2(motion.z, motion.x) * (double) (180F / (float) Math.PI)) + 90.0F); +// poseStack.mulPose(Vector3f.YP.rotationDegrees(yRot)); +// poseStack.mulPose(Vector3f.XP.rotationDegrees(xRot)); +// +// float f9 = entity.shakeTime - partialTicks; +// if (f9 > 0.0F) { +// float f10 = -Mth.sin(f9 * 3.0F) * f9; +// poseStack.mulPose(Vector3f.XP.rotationDegrees(f10)); +// } +// +// renderModel(poseStack, bufferSource, light); +// poseStack.popPose(); +// +// super.render(entity, yaw, partialTicks, poseStack, bufferSource, light); +// } +// +// public static void renderModel(PoseStack poseStack, MultiBufferSource bufferSource, int light) { +// poseStack.scale(0.125f, 0.125f, 0.125f); +// +// //poseStack.mulPose(entityRenderDispatcher.cameraOrientation()); +// //poseStack.mulPose(Vector3f.YP.rotationDegrees(180f)); +// +// Pose pose = poseStack.last(); +// Matrix4f poseMatrix = pose.pose(); +// Matrix3f normalMatrix = pose.normal(); +// +// VertexConsumer consumer = bufferSource.getBuffer(RenderType.entityCutout(getTextureLocation())); +// poseStack.mulPose(Vector3f.YP.rotationDegrees(90.0F)); +// poseStack.translate(-2, 0, 0); +// +// for (int j = 0; j < 4; ++j) { +// poseStack.mulPose(Vector3f.XP.rotationDegrees(90.0F)); +// vertex(poseMatrix, normalMatrix, consumer, -8, -2, 0, 0.0F, 0.0F, 0, 1, 0, light); +// vertex(poseMatrix, normalMatrix, consumer, 8, -2, 0, 0.5F, 0.0F, 0, 1, 0, light); +// vertex(poseMatrix, normalMatrix, consumer, 8, 2, 0, 0.5F, 0.15625F, 0, 1, 0, light); +// vertex(poseMatrix, normalMatrix, consumer, -8, 2, 0, 0.0F, 0.15625F, 0, 1, 0, light); +// } +// } +// +// public static void vertex(Matrix4f pMatrix, Matrix3f pNormals, VertexConsumer pVertexBuilder, int pOffsetX, int pOffsetY, int pOffsetZ, float pTextureX, float pTextureY, int pNormalX, int p_113835_, int p_113836_, int pPackedLight) { +// pVertexBuilder.vertex(pMatrix, (float) pOffsetX, (float) pOffsetY, (float) pOffsetZ).color(255, 255, 255, 255).uv(pTextureX, pTextureY).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(pPackedLight).normal(pNormals, (float) pNormalX, (float) p_113836_, (float) p_113835_).endVertex(); +// } +// +// @Override +// public ResourceLocation getTextureLocation(PoisonArrow entity) { +// return getTextureLocation(); +// } +// +// public static ResourceLocation getTextureLocation() { +// return TEXTURE; +// } +// +//} \ No newline at end of file diff --git a/src/main/java/io/redspace/ironsspellbooks/entity/spells/poison_breath/PoisonBreathProjectile.java b/src/main/java/io/redspace/ironsspellbooks/entity/spells/poison_breath/PoisonBreathProjectile.java index 533da1c0c..a5efc14e8 100644 --- a/src/main/java/io/redspace/ironsspellbooks/entity/spells/poison_breath/PoisonBreathProjectile.java +++ b/src/main/java/io/redspace/ironsspellbooks/entity/spells/poison_breath/PoisonBreathProjectile.java @@ -1,64 +1,64 @@ -package io.redspace.ironsspellbooks.entity.spells.poison_breath; - -import io.redspace.ironsspellbooks.damage.DamageSources; -import io.redspace.ironsspellbooks.entity.spells.AbstractConeProjectile; -import io.redspace.ironsspellbooks.registries.EntityRegistry; -import io.redspace.ironsspellbooks.spells.SchoolType; -import io.redspace.ironsspellbooks.spells.SpellType; -import io.redspace.ironsspellbooks.util.ParticleHelper; -import net.minecraft.world.effect.MobEffectInstance; -import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.level.Level; -import net.minecraft.world.phys.EntityHitResult; -import net.minecraft.world.phys.Vec3; - -public class PoisonBreathProjectile extends AbstractConeProjectile { - public PoisonBreathProjectile(EntityType entityType, Level level) { - super(entityType, level); - } - - public PoisonBreathProjectile(Level level, LivingEntity entity) { - super(EntityRegistry.POISON_BREATH_PROJECTILE.get(), level, entity); - } - - - @Override - public void spawnParticles() { - var owner = getOwner(); - if (!level.isClientSide || owner == null) { - return; - } - Vec3 rotation = owner.getLookAngle().normalize(); - var pos = owner.position().add(rotation.scale(1.6)); - - double x = pos.x; - double y = pos.y + owner.getEyeHeight() * .9f; - double z = pos.z; - - double speed = random.nextDouble() * .4 + .45; - for (int i = 0; i < 20; i++) { - double offset = .25; - double ox = Math.random() * 2 * offset - offset; - double oy = Math.random() * 2 * offset - offset; - double oz = Math.random() * 2 * offset - offset; - - double angularness = .8; - Vec3 randomVec = new Vec3(Math.random() * 2 * angularness - angularness, Math.random() * 2 * angularness - angularness, Math.random() * 2 * angularness - angularness).normalize(); - Vec3 result = (rotation.scale(3).add(randomVec)).normalize().scale(speed); - level.addParticle(random.nextFloat() < .25f ? ParticleHelper.ACID_BUBBLE : ParticleHelper.ACID, x + ox, y + oy, z + oz, result.x, result.y, result.z); - } - - - } - - @Override - protected void onHitEntity(EntityHitResult entityHitResult) { - //irons_spellbooks.LOGGER.debug("ConeOfColdProjectile.onHitEntity: {}", entityHitResult.getEntity().getName().getString()); - var entity = entityHitResult.getEntity(); - if (DamageSources.applyDamage(entity, damage, SpellType.POISON_BREATH_SPELL.getDamageSource(this, getOwner()), SchoolType.POISON) && entity instanceof LivingEntity livingEntity) - livingEntity.addEffect(new MobEffectInstance(MobEffects.POISON, 100, 0)); - } - -} +//package io.redspace.ironsspellbooks.entity.spells.poison_breath; +// +//import io.redspace.ironsspellbooks.damage.DamageSources; +//import io.redspace.ironsspellbooks.entity.spells.AbstractConeProjectile; +//import io.redspace.ironsspellbooks.registries.EntityRegistry; +//import io.redspace.ironsspellbooks.spells.SchoolType; +//import io.redspace.ironsspellbooks.spells.SpellType; +//import io.redspace.ironsspellbooks.util.ParticleHelper; +//import net.minecraft.world.effect.MobEffectInstance; +//import net.minecraft.world.effect.MobEffects; +//import net.minecraft.world.entity.EntityType; +//import net.minecraft.world.entity.LivingEntity; +//import net.minecraft.world.level.Level; +//import net.minecraft.world.phys.EntityHitResult; +//import net.minecraft.world.phys.Vec3; +// +//public class PoisonBreathProjectile extends AbstractConeProjectile { +// public PoisonBreathProjectile(EntityType entityType, Level level) { +// super(entityType, level); +// } +// +// public PoisonBreathProjectile(Level level, LivingEntity entity) { +// super(EntityRegistry.POISON_BREATH_PROJECTILE.get(), level, entity); +// } +// +// +// @Override +// public void spawnParticles() { +// var owner = getOwner(); +// if (!level.isClientSide || owner == null) { +// return; +// } +// Vec3 rotation = owner.getLookAngle().normalize(); +// var pos = owner.position().add(rotation.scale(1.6)); +// +// double x = pos.x; +// double y = pos.y + owner.getEyeHeight() * .9f; +// double z = pos.z; +// +// double speed = random.nextDouble() * .4 + .45; +// for (int i = 0; i < 20; i++) { +// double offset = .25; +// double ox = Math.random() * 2 * offset - offset; +// double oy = Math.random() * 2 * offset - offset; +// double oz = Math.random() * 2 * offset - offset; +// +// double angularness = .8; +// Vec3 randomVec = new Vec3(Math.random() * 2 * angularness - angularness, Math.random() * 2 * angularness - angularness, Math.random() * 2 * angularness - angularness).normalize(); +// Vec3 result = (rotation.scale(3).add(randomVec)).normalize().scale(speed); +// level.addParticle(random.nextFloat() < .25f ? ParticleHelper.ACID_BUBBLE : ParticleHelper.ACID, x + ox, y + oy, z + oz, result.x, result.y, result.z); +// } +// +// +// } +// +// @Override +// protected void onHitEntity(EntityHitResult entityHitResult) { +// //irons_spellbooks.LOGGER.debug("ConeOfColdProjectile.onHitEntity: {}", entityHitResult.getEntity().getName().getString()); +// var entity = entityHitResult.getEntity(); +// if (DamageSources.applyDamage(entity, damage, SpellType.POISON_BREATH_SPELL.getDamageSource(this, getOwner()), SchoolType.POISON) && entity instanceof LivingEntity livingEntity) +// livingEntity.addEffect(new MobEffectInstance(MobEffects.POISON, 100, 0)); +// } +// +//} diff --git a/src/main/java/io/redspace/ironsspellbooks/entity/spells/poison_cloud/PoisonCloud.java b/src/main/java/io/redspace/ironsspellbooks/entity/spells/poison_cloud/PoisonCloud.java index a4ce882e4..662943874 100644 --- a/src/main/java/io/redspace/ironsspellbooks/entity/spells/poison_cloud/PoisonCloud.java +++ b/src/main/java/io/redspace/ironsspellbooks/entity/spells/poison_cloud/PoisonCloud.java @@ -1,45 +1,45 @@ -package io.redspace.ironsspellbooks.entity.spells.poison_cloud; - -import io.redspace.ironsspellbooks.damage.DamageSources; -import io.redspace.ironsspellbooks.entity.spells.AoeEntity; -import io.redspace.ironsspellbooks.registries.EntityRegistry; -import io.redspace.ironsspellbooks.util.ParticleHelper; -import net.minecraft.core.particles.ParticleOptions; -import net.minecraft.world.damagesource.DamageSource; -import net.minecraft.world.effect.MobEffectInstance; -import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.projectile.Projectile; -import net.minecraft.world.level.Level; - -public class PoisonCloud extends AoeEntity { - - public static final DamageSource DAMAGE_SOURCE = new DamageSource("poison_cloud"); - - public PoisonCloud(EntityType pEntityType, Level pLevel) { - super(pEntityType, pLevel); - - } - - public PoisonCloud(Level level) { - this(EntityRegistry.POISON_CLOUD.get(), level); - } - - @Override - public void applyEffect(LivingEntity target) { - var damageSource = DamageSources.indirectDamageSource(DAMAGE_SOURCE, this, getOwner()); - target.hurt(damageSource, getDamage()); - target.addEffect(new MobEffectInstance(MobEffects.POISON, 120, (int) getDamage())); - } - - @Override - public float getParticleCount() { - return .15f; - } - - @Override - public ParticleOptions getParticle() { - return ParticleHelper.POISON_CLOUD; - } -} +//package io.redspace.ironsspellbooks.entity.spells.poison_cloud; +// +//import io.redspace.ironsspellbooks.damage.DamageSources; +//import io.redspace.ironsspellbooks.entity.spells.AoeEntity; +//import io.redspace.ironsspellbooks.registries.EntityRegistry; +//import io.redspace.ironsspellbooks.util.ParticleHelper; +//import net.minecraft.core.particles.ParticleOptions; +//import net.minecraft.world.damagesource.DamageSource; +//import net.minecraft.world.effect.MobEffectInstance; +//import net.minecraft.world.effect.MobEffects; +//import net.minecraft.world.entity.EntityType; +//import net.minecraft.world.entity.LivingEntity; +//import net.minecraft.world.entity.projectile.Projectile; +//import net.minecraft.world.level.Level; +// +//public class PoisonCloud extends AoeEntity { +// +// public static final DamageSource DAMAGE_SOURCE = new DamageSource("poison_cloud"); +// +// public PoisonCloud(EntityType pEntityType, Level pLevel) { +// super(pEntityType, pLevel); +// +// } +// +// public PoisonCloud(Level level) { +// this(EntityRegistry.POISON_CLOUD.get(), level); +// } +// +// @Override +// public void applyEffect(LivingEntity target) { +// var damageSource = DamageSources.indirectDamageSource(DAMAGE_SOURCE, this, getOwner()); +// target.hurt(damageSource, getDamage()); +// target.addEffect(new MobEffectInstance(MobEffects.POISON, 120, (int) getDamage())); +// } +// +// @Override +// public float getParticleCount() { +// return .15f; +// } +// +// @Override +// public ParticleOptions getParticle() { +// return ParticleHelper.POISON_CLOUD; +// } +//} diff --git a/src/main/java/io/redspace/ironsspellbooks/entity/spells/poison_cloud/PoisonSplash.java b/src/main/java/io/redspace/ironsspellbooks/entity/spells/poison_cloud/PoisonSplash.java index c4c2d5155..598ad9845 100644 --- a/src/main/java/io/redspace/ironsspellbooks/entity/spells/poison_cloud/PoisonSplash.java +++ b/src/main/java/io/redspace/ironsspellbooks/entity/spells/poison_cloud/PoisonSplash.java @@ -1,103 +1,103 @@ -package io.redspace.ironsspellbooks.entity.spells.poison_cloud; - -import io.redspace.ironsspellbooks.capabilities.magic.MagicManager; -import io.redspace.ironsspellbooks.damage.DamageSources; -import io.redspace.ironsspellbooks.entity.spells.AoeEntity; -import io.redspace.ironsspellbooks.registries.EntityRegistry; -import io.redspace.ironsspellbooks.spells.SchoolType; -import io.redspace.ironsspellbooks.spells.SpellType; -import io.redspace.ironsspellbooks.util.ParticleHelper; -import io.redspace.ironsspellbooks.util.Utils; -import net.minecraft.core.particles.ParticleOptions; -import net.minecraft.world.effect.MobEffectInstance; -import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.projectile.Projectile; -import net.minecraft.world.level.Level; -import net.minecraft.world.phys.Vec3; - -public class PoisonSplash extends AoeEntity { - - public PoisonSplash(EntityType pEntityType, Level pLevel) { - super(pEntityType, pLevel); - this.setRadius((float) (this.getBoundingBox().getXsize() * .5f)); - } - - public PoisonSplash(Level level) { - this(EntityRegistry.POISON_SPLASH.get(), level); - } - - boolean playedParticles; - - @Override - public void tick() { - if (!playedParticles) { - playedParticles = true; - if (level.isClientSide) { - for (int i = 0; i < 150; i++) { - Vec3 pos = new Vec3(Utils.getRandomScaled(.5f), Utils.getRandomScaled(.2f), this.random.nextFloat() * getRadius()).yRot(this.random.nextFloat() * 360); - Vec3 motion = new Vec3( - Utils.getRandomScaled(.06f), - this.random.nextDouble() * -.8 - .5, - Utils.getRandomScaled(.06f) - ); - - level.addParticle(ParticleHelper.ACID, getX() + pos.x, getY() + pos.y + getBoundingBox().getYsize(), getZ() + pos.z, motion.x, motion.y, motion.z); - } - }else{ - MagicManager.spawnParticles(level, ParticleHelper.POISON_CLOUD, getX(), getY() + getBoundingBox().getYsize(), getZ(), 9, getRadius() * .7f, .2f, getRadius() * .7f, 1, true); - - } - } - - if (tickCount == 4) { - checkHits(); - if (!level.isClientSide) - MagicManager.spawnParticles(level, ParticleHelper.POISON_CLOUD, getX(), getY(), getZ(), 9, getRadius() * .7f, .2f, getRadius() * .7f, 1, true); - createPoisonCloud(); - } - - if (this.tickCount > 6) { - discard(); - } - } - - public void createPoisonCloud() { - if (!level.isClientSide) { - PoisonCloud cloud = new PoisonCloud(level); - cloud.setOwner(getOwner()); - cloud.setDuration(getEffectDuration()); - cloud.setDamage(getDamage() * .1f); - cloud.moveTo(this.position()); - level.addFreshEntity(cloud); - } - } - - @Override - public void applyEffect(LivingEntity target) { - if (DamageSources.applyDamage(target, getDamage(), SpellType.POISON_SPLASH_SPELL.getDamageSource(this, getOwner()), SchoolType.POISON)) - target.addEffect(new MobEffectInstance(MobEffects.POISON, getEffectDuration(), 0)); - } - - - @Override - public float getParticleCount() { - return 0f; - } - - @Override - public void refreshDimensions() { - return; - } - - @Override - public void ambientParticles() { - return; - } - - @Override - public ParticleOptions getParticle() { - return ParticleHelper.ACID_BUBBLE; - } -} +//package io.redspace.ironsspellbooks.entity.spells.poison_cloud; +// +//import io.redspace.ironsspellbooks.capabilities.magic.MagicManager; +//import io.redspace.ironsspellbooks.damage.DamageSources; +//import io.redspace.ironsspellbooks.entity.spells.AoeEntity; +//import io.redspace.ironsspellbooks.registries.EntityRegistry; +//import io.redspace.ironsspellbooks.spells.SchoolType; +//import io.redspace.ironsspellbooks.spells.SpellType; +//import io.redspace.ironsspellbooks.util.ParticleHelper; +//import io.redspace.ironsspellbooks.util.Utils; +//import net.minecraft.core.particles.ParticleOptions; +//import net.minecraft.world.effect.MobEffectInstance; +//import net.minecraft.world.effect.MobEffects; +//import net.minecraft.world.entity.EntityType; +//import net.minecraft.world.entity.LivingEntity; +//import net.minecraft.world.entity.projectile.Projectile; +//import net.minecraft.world.level.Level; +//import net.minecraft.world.phys.Vec3; +// +//public class PoisonSplash extends AoeEntity { +// +// public PoisonSplash(EntityType pEntityType, Level pLevel) { +// super(pEntityType, pLevel); +// this.setRadius((float) (this.getBoundingBox().getXsize() * .5f)); +// } +// +// public PoisonSplash(Level level) { +// this(EntityRegistry.POISON_SPLASH.get(), level); +// } +// +// boolean playedParticles; +// +// @Override +// public void tick() { +// if (!playedParticles) { +// playedParticles = true; +// if (level.isClientSide) { +// for (int i = 0; i < 150; i++) { +// Vec3 pos = new Vec3(Utils.getRandomScaled(.5f), Utils.getRandomScaled(.2f), this.random.nextFloat() * getRadius()).yRot(this.random.nextFloat() * 360); +// Vec3 motion = new Vec3( +// Utils.getRandomScaled(.06f), +// this.random.nextDouble() * -.8 - .5, +// Utils.getRandomScaled(.06f) +// ); +// +// level.addParticle(ParticleHelper.ACID, getX() + pos.x, getY() + pos.y + getBoundingBox().getYsize(), getZ() + pos.z, motion.x, motion.y, motion.z); +// } +// }else{ +// MagicManager.spawnParticles(level, ParticleHelper.POISON_CLOUD, getX(), getY() + getBoundingBox().getYsize(), getZ(), 9, getRadius() * .7f, .2f, getRadius() * .7f, 1, true); +// +// } +// } +// +// if (tickCount == 4) { +// checkHits(); +// if (!level.isClientSide) +// MagicManager.spawnParticles(level, ParticleHelper.POISON_CLOUD, getX(), getY(), getZ(), 9, getRadius() * .7f, .2f, getRadius() * .7f, 1, true); +// createPoisonCloud(); +// } +// +// if (this.tickCount > 6) { +// discard(); +// } +// } +// +// public void createPoisonCloud() { +// if (!level.isClientSide) { +// PoisonCloud cloud = new PoisonCloud(level); +// cloud.setOwner(getOwner()); +// cloud.setDuration(getEffectDuration()); +// cloud.setDamage(getDamage() * .1f); +// cloud.moveTo(this.position()); +// level.addFreshEntity(cloud); +// } +// } +// +// @Override +// public void applyEffect(LivingEntity target) { +// if (DamageSources.applyDamage(target, getDamage(), SpellType.POISON_SPLASH_SPELL.getDamageSource(this, getOwner()), SchoolType.POISON)) +// target.addEffect(new MobEffectInstance(MobEffects.POISON, getEffectDuration(), 0)); +// } +// +// +// @Override +// public float getParticleCount() { +// return 0f; +// } +// +// @Override +// public void refreshDimensions() { +// return; +// } +// +// @Override +// public void ambientParticles() { +// return; +// } +// +// @Override +// public ParticleOptions getParticle() { +// return ParticleHelper.ACID_BUBBLE; +// } +//} diff --git a/src/main/java/io/redspace/ironsspellbooks/registries/EntityRegistry.java b/src/main/java/io/redspace/ironsspellbooks/registries/EntityRegistry.java index d16a4aa2f..9445f55a7 100644 --- a/src/main/java/io/redspace/ironsspellbooks/registries/EntityRegistry.java +++ b/src/main/java/io/redspace/ironsspellbooks/registries/EntityRegistry.java @@ -14,14 +14,10 @@ import io.redspace.ironsspellbooks.entity.mobs.wizards.cryomancer.CryomancerEntity; import io.redspace.ironsspellbooks.entity.mobs.wizards.pyromancer.PyromancerEntity; import io.redspace.ironsspellbooks.entity.spells.acid_orb.AcidOrb; -import io.redspace.ironsspellbooks.entity.spells.poison_arrow.PoisonArrow; -import io.redspace.ironsspellbooks.entity.spells.poison_cloud.PoisonCloud; -import io.redspace.ironsspellbooks.entity.spells.poison_cloud.PoisonSplash; import io.redspace.ironsspellbooks.entity.spells.spectral_hammer.SpectralHammer; import io.redspace.ironsspellbooks.entity.spells.ExtendedLargeFireball; import io.redspace.ironsspellbooks.entity.spells.ExtendedSmallFireball; import io.redspace.ironsspellbooks.entity.spells.ExtendedWitherSkull; -import io.redspace.ironsspellbooks.entity.spells.poison_breath.PoisonBreathProjectile; import io.redspace.ironsspellbooks.entity.spells.blood_slash.BloodSlashProjectile; import io.redspace.ironsspellbooks.entity.spells.cone_of_cold.ConeOfColdProjectile; import io.redspace.ironsspellbooks.entity.spells.creeper_head.CreeperHeadProjectile; @@ -272,36 +268,12 @@ public static void register(IEventBus eventBus) { .clientTrackingRange(64) .build(new ResourceLocation(IronsSpellbooks.MODID, "ice_block_projectile").toString())); - public static final RegistryObject> POISON_CLOUD = - ENTITIES.register("poison_cloud", () -> EntityType.Builder.of(PoisonCloud::new, MobCategory.MISC) - .sized(4f, .8f) - .clientTrackingRange(64) - .build(new ResourceLocation(IronsSpellbooks.MODID, "poison_cloud").toString())); - public static final RegistryObject> DRAGON_BREATH_POOL = ENTITIES.register("dragon_breath_pool", () -> EntityType.Builder.of(DragonBreathPool::new, MobCategory.MISC) .sized(4f, .8f) .clientTrackingRange(64) .build(new ResourceLocation(IronsSpellbooks.MODID, "dragon_breath_pool").toString())); - public static final RegistryObject> POISON_BREATH_PROJECTILE = - ENTITIES.register("poison_breath", () -> EntityType.Builder.of(PoisonBreathProjectile::new, MobCategory.MISC) - .sized(1f, 1f) - .clientTrackingRange(64) - .build(new ResourceLocation(IronsSpellbooks.MODID, "poison_breath").toString())); - - public static final RegistryObject> POISON_ARROW = - ENTITIES.register("poison_arrow", () -> EntityType.Builder.of(PoisonArrow::new, MobCategory.MISC) - .sized(.5f, .5f) - .clientTrackingRange(64) - .build(new ResourceLocation(IronsSpellbooks.MODID, "poison_arrow").toString())); - - public static final RegistryObject> POISON_SPLASH = - ENTITIES.register("poison_splash", () -> EntityType.Builder.of(PoisonSplash::new, MobCategory.MISC) - .sized(3.5f, 4f) - .clientTrackingRange(64) - .build(new ResourceLocation(IronsSpellbooks.MODID, "poison_splash").toString())); - public static final RegistryObject> SUMMONED_FROG = ENTITIES.register("summoned_frog", () -> EntityType.Builder.of(SummonedFrog::new, MobCategory.MISC) .sized(0.5F, 0.5F) diff --git a/src/main/java/io/redspace/ironsspellbooks/render/ChargeSpellLayer.java b/src/main/java/io/redspace/ironsspellbooks/render/ChargeSpellLayer.java index b5150a53b..a83b46db7 100644 --- a/src/main/java/io/redspace/ironsspellbooks/render/ChargeSpellLayer.java +++ b/src/main/java/io/redspace/ironsspellbooks/render/ChargeSpellLayer.java @@ -3,7 +3,6 @@ import io.redspace.ironsspellbooks.entity.mobs.abstract_spell_casting_mob.AbstractSpellCastingMob; import io.redspace.ironsspellbooks.entity.spells.lightning_lance.LightningLanceRenderer; import io.redspace.ironsspellbooks.entity.spells.magic_arrow.MagicArrowRenderer; -import io.redspace.ironsspellbooks.entity.spells.poison_arrow.PoisonArrowRenderer; import io.redspace.ironsspellbooks.player.ClientMagicData; import io.redspace.ironsspellbooks.spells.SpellType; import io.redspace.ironsspellbooks.util.Utils; @@ -51,14 +50,15 @@ public void render(PoseStack poseStack, MultiBufferSource bufferSource, int pPac float castCompletion = Utils.smoothstep(.65f, 1, ClientMagicData.getCastCompletionPercent()); poseStack.scale(castCompletion, castCompletion, castCompletion); MagicArrowRenderer.renderModel(poseStack, bufferSource); - } else if (spell == SpellType.POISON_ARROW_SPELL) { - poseStack.translate(((float) (flag ? -1 : 1) / 32.0F), 1, 0); - poseStack.mulPose(Vector3f.YP.rotationDegrees(180.0F)); - poseStack.mulPose(Vector3f.XP.rotationDegrees(90.0F)); - float castCompletion = Utils.smoothstep(.65f, 1, ClientMagicData.getCastCompletionPercent()); - poseStack.scale(castCompletion, castCompletion, castCompletion); - PoisonArrowRenderer.renderModel(poseStack, bufferSource, pPackedLight); } +// else if (spell == SpellType.POISON_ARROW_SPELL) { +// poseStack.translate(((float) (flag ? -1 : 1) / 32.0F), 1, 0); +// poseStack.mulPose(Vector3f.YP.rotationDegrees(180.0F)); +// poseStack.mulPose(Vector3f.XP.rotationDegrees(90.0F)); +// float castCompletion = Utils.smoothstep(.65f, 1, ClientMagicData.getCastCompletionPercent()); +// poseStack.scale(castCompletion, castCompletion, castCompletion); +// PoisonArrowRenderer.renderModel(poseStack, bufferSource, pPackedLight); +// } poseStack.popPose(); } } @@ -98,16 +98,17 @@ public void render(PoseStack poseStack, MultiBufferSource bufferSource, int pack poseStack.mulPose(Vector3f.YP.rotationDegrees(180.0F)); MagicArrowRenderer.renderModel(poseStack, bufferSource); - } else if (spell == SpellType.POISON_ARROW_SPELL) { - - poseStack.translate(0, -bone.getPivotY() / 16, 0); - poseStack.mulPose(Vector3f.YP.rotationDegrees(180.0F)); - poseStack.mulPose(Vector3f.XP.rotationDegrees(90.0F)); - poseStack.translate(-((flag ? -1 : 1) / 32.0F), .5, -.55); - poseStack.mulPose(Vector3f.YP.rotationDegrees(180.0F)); - PoisonArrowRenderer.renderModel(poseStack, bufferSource, packedLight); - } +// else if (spell == SpellType.POISON_ARROW_SPELL) { +// +// poseStack.translate(0, -bone.getPivotY() / 16, 0); +// poseStack.mulPose(Vector3f.YP.rotationDegrees(180.0F)); +// poseStack.mulPose(Vector3f.XP.rotationDegrees(90.0F)); +// poseStack.translate(-((flag ? -1 : 1) / 32.0F), .5, -.55); +// poseStack.mulPose(Vector3f.YP.rotationDegrees(180.0F)); +// PoisonArrowRenderer.renderModel(poseStack, bufferSource, packedLight); +// +// } poseStack.popPose(); } diff --git a/src/main/java/io/redspace/ironsspellbooks/setup/ClientSetup.java b/src/main/java/io/redspace/ironsspellbooks/setup/ClientSetup.java index e8275092d..6d59cfe90 100644 --- a/src/main/java/io/redspace/ironsspellbooks/setup/ClientSetup.java +++ b/src/main/java/io/redspace/ironsspellbooks/setup/ClientSetup.java @@ -33,7 +33,6 @@ import io.redspace.ironsspellbooks.entity.spells.lightning_lance.LightningLanceRenderer; import io.redspace.ironsspellbooks.entity.spells.magic_arrow.MagicArrowRenderer; import io.redspace.ironsspellbooks.entity.spells.magic_missile.MagicMissileRenderer; -import io.redspace.ironsspellbooks.entity.spells.poison_arrow.PoisonArrowRenderer; import io.redspace.ironsspellbooks.entity.spells.shield.ShieldModel; import io.redspace.ironsspellbooks.entity.spells.shield.ShieldRenderer; import io.redspace.ironsspellbooks.entity.spells.shield.ShieldTrimModel; @@ -168,7 +167,6 @@ public static void rendererRegister(EntityRenderersEvent.RegisterRenderers event event.registerEntityRenderer(EntityRegistry.FIREBOLT_PROJECTILE.get(), FireboltRenderer::new); event.registerEntityRenderer(EntityRegistry.ICICLE_PROJECTILE.get(), IcicleRenderer::new); event.registerEntityRenderer(EntityRegistry.FIRE_BREATH_PROJECTILE.get(), NoopRenderer::new); - event.registerEntityRenderer(EntityRegistry.POISON_BREATH_PROJECTILE.get(), NoopRenderer::new); event.registerEntityRenderer(EntityRegistry.DRAGON_BREATH_PROJECTILE.get(), NoopRenderer::new); event.registerEntityRenderer(EntityRegistry.DEBUG_WIZARD.get(), (renderManager) -> new DebugWizardRenderer(renderManager)); event.registerEntityRenderer(EntityRegistry.PYROMANCER.get(), PyromancerRenderer::new); @@ -196,10 +194,7 @@ public static void rendererRegister(EntityRenderersEvent.RegisterRenderers event event.registerEntityRenderer(EntityRegistry.VOID_TENTACLE.get(), VoidTentacleRenderer::new); event.registerEntityRenderer(EntityRegistry.ICE_BLOCK_PROJECTILE.get(), IceBlockRenderer::new); event.registerEntityRenderer(EntityRegistry.CRYOMANCER.get(), CryomancerRenderer::new); - event.registerEntityRenderer(EntityRegistry.POISON_CLOUD.get(), NoopRenderer::new); event.registerEntityRenderer(EntityRegistry.DRAGON_BREATH_POOL.get(), NoopRenderer::new); - event.registerEntityRenderer(EntityRegistry.POISON_ARROW.get(), PoisonArrowRenderer::new); - event.registerEntityRenderer(EntityRegistry.POISON_SPLASH.get(), NoopRenderer::new); event.registerEntityRenderer(EntityRegistry.SUMMONED_FROG.get(), FrogRenderer::new); event.registerEntityRenderer(EntityRegistry.ACID_ORB.get(), AcidOrbRenderer::new); diff --git a/src/main/java/io/redspace/ironsspellbooks/spells/SpellType.java b/src/main/java/io/redspace/ironsspellbooks/spells/SpellType.java index be1de1782..301c84efc 100644 --- a/src/main/java/io/redspace/ironsspellbooks/spells/SpellType.java +++ b/src/main/java/io/redspace/ironsspellbooks/spells/SpellType.java @@ -11,7 +11,6 @@ import io.redspace.ironsspellbooks.spells.holy.*; import io.redspace.ironsspellbooks.spells.ice.*; import io.redspace.ironsspellbooks.spells.lightning.*; -import io.redspace.ironsspellbooks.spells.poison.*; import io.redspace.ironsspellbooks.spells.void_school.AbyssalShroudSpell; import io.redspace.ironsspellbooks.spells.void_school.VoidTentaclesSpell; import net.minecraft.network.chat.Component; @@ -83,13 +82,13 @@ public enum SpellType { SPECTRAL_HAMMER_SPELL(45, SpectralHammerSpell::new), CHARGE_SPELL(46, ChargeSpell::new), VOID_TENTACLES_SPELL(47, VoidTentaclesSpell::new), - ICE_BLOCK_SPELL(48, IceBlockSpell::new), - POISON_BREATH_SPELL(49, PoisonBreathSpell::new), - POISON_ARROW_SPELL(50, PoisonArrowSpell::new), - POISON_SPLASH_SPELL(51, PoisonSplashSpell::new), - ACID_ORB_SPELL(52, AcidOrbSpell::new), - SPIDER_ASPECT_SPELL(53,SpiderAspectSpell::new), - BLIGHT_SPELL(54,BlightSpell::new) + ICE_BLOCK_SPELL(48, IceBlockSpell::new)//, +// POISON_BREATH_SPELL(49, PoisonBreathSpell::new), +// POISON_ARROW_SPELL(50, PoisonArrowSpell::new), +// POISON_SPLASH_SPELL(51, PoisonSplashSpell::new), +// ACID_ORB_SPELL(52, AcidOrbSpell::new), +// SPIDER_ASPECT_SPELL(53,SpiderAspectSpell::new), +// BLIGHT_SPELL(54,BlightSpell::new) ; private final int value; @@ -135,11 +134,11 @@ public static SpellType getTypeFromValue(int value) { public CastType getCastType() { return switch (this) { - case FIREBALL_SPELL, WISP_SPELL, FANG_STRIKE_SPELL, FANG_WARD_SPELL, SUMMON_VEX_SPELL, RAISE_DEAD_SPELL, GREATER_HEAL_SPELL, CHAIN_CREEPER_SPELL, INVISIBILITY_SPELL, SUMMON_POLAR_BEAR_SPELL, BLESSING_OF_LIFE_SPELL, FORTIFY_SPELL, VOID_TENTACLES_SPELL, SUMMON_HORSE_SPELL, ICE_BLOCK_SPELL, POISON_SPLASH_SPELL, BLIGHT_SPELL -> + case FIREBALL_SPELL, WISP_SPELL, FANG_STRIKE_SPELL, FANG_WARD_SPELL, SUMMON_VEX_SPELL, RAISE_DEAD_SPELL, GREATER_HEAL_SPELL, CHAIN_CREEPER_SPELL, INVISIBILITY_SPELL, SUMMON_POLAR_BEAR_SPELL, BLESSING_OF_LIFE_SPELL, FORTIFY_SPELL, VOID_TENTACLES_SPELL, SUMMON_HORSE_SPELL, ICE_BLOCK_SPELL -> CastType.LONG; - case ELECTROCUTE_SPELL, CONE_OF_COLD_SPELL, FIRE_BREATH_SPELL, WALL_OF_FIRE_SPELL, CLOUD_OF_REGENERATION_SPELL, RAY_OF_SIPHONING_SPELL, BLAZE_STORM_SPELL, DRAGON_BREATH_SPELL, POISON_BREATH_SPELL -> + case ELECTROCUTE_SPELL, CONE_OF_COLD_SPELL, FIRE_BREATH_SPELL, WALL_OF_FIRE_SPELL, CLOUD_OF_REGENERATION_SPELL, RAY_OF_SIPHONING_SPELL, BLAZE_STORM_SPELL, DRAGON_BREATH_SPELL -> CastType.CONTINUOUS; - case LIGHTNING_LANCE_SPELL, MAGIC_ARROW_SPELL, POISON_ARROW_SPELL, ACID_ORB_SPELL -> CastType.CHARGE; + case LIGHTNING_LANCE_SPELL, MAGIC_ARROW_SPELL -> CastType.CHARGE; default -> CastType.INSTANT; }; } @@ -159,7 +158,6 @@ public UseAnim getUseAnim() { private static final SpellType[] BLOOD_SPELLS = {BLOOD_SLASH_SPELL, HEARTSTOP_SPELL, RAISE_DEAD_SPELL, WITHER_SKULL_SPELL, RAY_OF_SIPHONING_SPELL, BLOOD_STEP_SPELL}; private static final SpellType[] EVOCATION_SPELLS = {SUMMON_VEX_SPELL, FIRECRACKER_SPELL, SUMMON_HORSE_SPELL, SHIELD_SPELL, FANG_STRIKE_SPELL, FANG_WARD_SPELL, LOB_CREEPER_SPELL, CHAIN_CREEPER_SPELL, INVISIBILITY_SPELL, SPECTRAL_HAMMER_SPELL}; private static final SpellType[] VOID_SPELLS = {ABYSSAL_SHROUD_SPELL, VOID_TENTACLES_SPELL}; - private static final SpellType[] POISON_SPELLS = {POISON_BREATH_SPELL, POISON_ARROW_SPELL, POISON_SPLASH_SPELL, ACID_ORB_SPELL, SPIDER_ASPECT_SPELL, BLIGHT_SPELL}; public AbstractSpell getSpellForType(int level) { return getSpellForType.get(level); @@ -283,8 +281,6 @@ public SchoolType getSchoolType() { return SchoolType.BLOOD; if (quickSearch(VOID_SPELLS, this)) return SchoolType.VOID; - if (quickSearch(POISON_SPELLS, this)) - return SchoolType.POISON; else return SchoolType.EVOCATION; } @@ -307,8 +303,6 @@ else if (school.equals(SchoolType.EVOCATION)) return EVOCATION_SPELLS; else if (school.equals(SchoolType.VOID)) return VOID_SPELLS; - else if (school.equals(SchoolType.POISON)) - return POISON_SPELLS; else return new SpellType[]{SpellType.NONE_SPELL}; } diff --git a/src/main/java/io/redspace/ironsspellbooks/spells/poison/AcidOrbSpell.java b/src/main/java/io/redspace/ironsspellbooks/spells/poison/AcidOrbSpell.java index 5b2d01e3f..bd0babedb 100644 --- a/src/main/java/io/redspace/ironsspellbooks/spells/poison/AcidOrbSpell.java +++ b/src/main/java/io/redspace/ironsspellbooks/spells/poison/AcidOrbSpell.java @@ -1,96 +1,96 @@ -package io.redspace.ironsspellbooks.spells.poison; - -import com.mojang.datafixers.util.Either; -import io.redspace.ironsspellbooks.IronsSpellbooks; -import io.redspace.ironsspellbooks.capabilities.magic.PlayerMagicData; -import io.redspace.ironsspellbooks.entity.spells.acid_orb.AcidOrb; -import io.redspace.ironsspellbooks.registries.SoundRegistry; -import io.redspace.ironsspellbooks.spells.AbstractSpell; -import io.redspace.ironsspellbooks.spells.SpellType; -import io.redspace.ironsspellbooks.spells.holy.HealSpell; -import io.redspace.ironsspellbooks.util.AnimationHolder; -import io.redspace.ironsspellbooks.util.Utils; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; -import org.checkerframework.checker.units.qual.A; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.builder.ILoopType; - -import java.util.List; -import java.util.Optional; - -public class AcidOrbSpell extends AbstractSpell { - - @Override - public List getUniqueInfo(LivingEntity caster) { - return List.of( - Component.translatable("ui.irons_spellbooks.radius", Utils.stringTruncation(getRadius(caster), 1)), - Component.translatable("ui.irons_spellbooks.rend", Utils.stringTruncation((getRendAmplifier(caster) + 1) * 5, 1)), - Component.translatable("ui.irons_spellbooks.effect_length", Utils.timeFromTicks(getRendDuration(caster), 1))); - } - - public AcidOrbSpell(int level) { - super(SpellType.ACID_ORB_SPELL); - this.level = level; - this.manaCostPerLevel = 3; - this.baseSpellPower = 1; - this.spellPowerPerLevel = 0; - this.castTime = 15; - this.baseManaCost = 30; - - } - - @Override - public Optional getCastStartSound() { - return Optional.of(SoundRegistry.ACID_ORB_CHARGE.get()); - } - - @Override - public Optional getCastFinishSound() { - return Optional.of(SoundRegistry.ACID_ORB_CAST.get()); - } - - @Override - public void onCast(Level level, LivingEntity entity, PlayerMagicData playerMagicData) { - AcidOrb orb = new AcidOrb(level, entity); - orb.setPos(entity.position().add(0, entity.getEyeHeight() - orb.getBoundingBox().getYsize() * .5f, 0).add(entity.getForward())); - orb.shoot(entity.getLookAngle()); - orb.setDeltaMovement(orb.getDeltaMovement().add(0, 0.2, 0)); - orb.setExplosionRadius(getRadius(entity)); - orb.setRendLevel(getRendAmplifier(entity)); - orb.setRendDuration(getRendDuration(entity)); - level.addFreshEntity(orb); - super.onCast(level, entity, playerMagicData); - } - - public float getRadius(LivingEntity caster) { - return getSpellPower(caster) * 3; - } - - public int getRendAmplifier(LivingEntity caster) { - return (int) (getSpellPower(caster) * this.level - 1); - } - - public int getRendDuration(LivingEntity caster) { - return (int) (getSpellPower(caster) * 20 * 15); - } - - public static final AnimationHolder CHARGE_SPIT_ANIMATION = new AnimationHolder("charge_spit", ILoopType.EDefaultLoopTypes.PLAY_ONCE); - public static final AnimationHolder SPIT_FINISH_ANIMATION = new AnimationHolder("charge_spit_finish", ILoopType.EDefaultLoopTypes.PLAY_ONCE); - - @Override - public AnimationHolder getCastStartAnimation() { - return CHARGE_SPIT_ANIMATION; - } - - @Override - public AnimationHolder getCastFinishAnimation() { - return SPIT_FINISH_ANIMATION; - } - -} +//package io.redspace.ironsspellbooks.spells.poison; +// +//import com.mojang.datafixers.util.Either; +//import io.redspace.ironsspellbooks.IronsSpellbooks; +//import io.redspace.ironsspellbooks.capabilities.magic.PlayerMagicData; +//import io.redspace.ironsspellbooks.entity.spells.acid_orb.AcidOrb; +//import io.redspace.ironsspellbooks.registries.SoundRegistry; +//import io.redspace.ironsspellbooks.spells.AbstractSpell; +//import io.redspace.ironsspellbooks.spells.SpellType; +//import io.redspace.ironsspellbooks.spells.holy.HealSpell; +//import io.redspace.ironsspellbooks.util.AnimationHolder; +//import io.redspace.ironsspellbooks.util.Utils; +//import net.minecraft.network.chat.Component; +//import net.minecraft.network.chat.MutableComponent; +//import net.minecraft.resources.ResourceLocation; +//import net.minecraft.sounds.SoundEvent; +//import net.minecraft.world.entity.LivingEntity; +//import net.minecraft.world.entity.player.Player; +//import net.minecraft.world.level.Level; +//import org.checkerframework.checker.units.qual.A; +//import software.bernie.geckolib3.core.builder.AnimationBuilder; +//import software.bernie.geckolib3.core.builder.ILoopType; +// +//import java.util.List; +//import java.util.Optional; +// +//public class AcidOrbSpell extends AbstractSpell { +// +// @Override +// public List getUniqueInfo(LivingEntity caster) { +// return List.of( +// Component.translatable("ui.irons_spellbooks.radius", Utils.stringTruncation(getRadius(caster), 1)), +// Component.translatable("ui.irons_spellbooks.rend", Utils.stringTruncation((getRendAmplifier(caster) + 1) * 5, 1)), +// Component.translatable("ui.irons_spellbooks.effect_length", Utils.timeFromTicks(getRendDuration(caster), 1))); +// } +// +// public AcidOrbSpell(int level) { +// super(SpellType.ACID_ORB_SPELL); +// this.level = level; +// this.manaCostPerLevel = 3; +// this.baseSpellPower = 1; +// this.spellPowerPerLevel = 0; +// this.castTime = 15; +// this.baseManaCost = 30; +// +// } +// +// @Override +// public Optional getCastStartSound() { +// return Optional.of(SoundRegistry.ACID_ORB_CHARGE.get()); +// } +// +// @Override +// public Optional getCastFinishSound() { +// return Optional.of(SoundRegistry.ACID_ORB_CAST.get()); +// } +// +// @Override +// public void onCast(Level level, LivingEntity entity, PlayerMagicData playerMagicData) { +// AcidOrb orb = new AcidOrb(level, entity); +// orb.setPos(entity.position().add(0, entity.getEyeHeight() - orb.getBoundingBox().getYsize() * .5f, 0).add(entity.getForward())); +// orb.shoot(entity.getLookAngle()); +// orb.setDeltaMovement(orb.getDeltaMovement().add(0, 0.2, 0)); +// orb.setExplosionRadius(getRadius(entity)); +// orb.setRendLevel(getRendAmplifier(entity)); +// orb.setRendDuration(getRendDuration(entity)); +// level.addFreshEntity(orb); +// super.onCast(level, entity, playerMagicData); +// } +// +// public float getRadius(LivingEntity caster) { +// return getSpellPower(caster) * 3; +// } +// +// public int getRendAmplifier(LivingEntity caster) { +// return (int) (getSpellPower(caster) * this.level - 1); +// } +// +// public int getRendDuration(LivingEntity caster) { +// return (int) (getSpellPower(caster) * 20 * 15); +// } +// +// public static final AnimationHolder CHARGE_SPIT_ANIMATION = new AnimationHolder("charge_spit", ILoopType.EDefaultLoopTypes.PLAY_ONCE); +// public static final AnimationHolder SPIT_FINISH_ANIMATION = new AnimationHolder("charge_spit_finish", ILoopType.EDefaultLoopTypes.PLAY_ONCE); +// +// @Override +// public AnimationHolder getCastStartAnimation() { +// return CHARGE_SPIT_ANIMATION; +// } +// +// @Override +// public AnimationHolder getCastFinishAnimation() { +// return SPIT_FINISH_ANIMATION; +// } +// +//} diff --git a/src/main/java/io/redspace/ironsspellbooks/spells/poison/BlightSpell.java b/src/main/java/io/redspace/ironsspellbooks/spells/poison/BlightSpell.java index 8cd124107..8d0429c58 100644 --- a/src/main/java/io/redspace/ironsspellbooks/spells/poison/BlightSpell.java +++ b/src/main/java/io/redspace/ironsspellbooks/spells/poison/BlightSpell.java @@ -1,106 +1,106 @@ -package io.redspace.ironsspellbooks.spells.poison; - -import io.redspace.ironsspellbooks.capabilities.magic.CastTargetingData; -import io.redspace.ironsspellbooks.capabilities.magic.PlayerMagicData; -import io.redspace.ironsspellbooks.effect.BlightEffect; -import io.redspace.ironsspellbooks.network.spell.ClientboundSyncTargetingData; -import io.redspace.ironsspellbooks.registries.MobEffectRegistry; -import io.redspace.ironsspellbooks.setup.Messages; -import io.redspace.ironsspellbooks.spells.AbstractSpell; -import io.redspace.ironsspellbooks.spells.SpellType; -import io.redspace.ironsspellbooks.util.Utils; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.world.effect.MobEffectInstance; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.level.Level; -import net.minecraft.world.phys.EntityHitResult; -import org.jetbrains.annotations.Nullable; - -import java.util.List; -import java.util.Optional; - - -public class BlightSpell extends AbstractSpell { - public BlightSpell() { - this(1); - } - - @Override - public List getUniqueInfo(LivingEntity caster) { - return List.of( - Component.translatable("ui.irons_spellbooks.reduced_healing",Utils.stringTruncation((1 + getAmplifier(caster)) * BlightEffect.HEALING_PER_LEVEL * -100, 1)), - Component.translatable("ui.irons_spellbooks.reduced_damage", Utils.stringTruncation((1 + getAmplifier(caster)) * BlightEffect.DAMAGE_PER_LEVEL * -100, 1)), - Component.translatable("ui.irons_spellbooks.effect_length", Utils.timeFromTicks(getDuration(caster), 1)) - ); - } - - public BlightSpell(int level) { - super(SpellType.BLIGHT_SPELL); - this.level = level; - this.manaCostPerLevel = 5; - this.baseSpellPower = 1; - this.spellPowerPerLevel = 0; - this.castTime = 50; - this.baseManaCost = 10; - - } - - @Override - public Optional getCastStartSound() { - return Optional.empty(); - } - - @Override - public Optional getCastFinishSound() { - return Optional.empty(); - } - - - @Override - public boolean checkPreCastConditions(Level level, LivingEntity entity, PlayerMagicData playerMagicData) { - var target = findTarget(entity); - if (target == null) - return false; - else { - playerMagicData.setAdditionalCastData(new CastTargetingData(target)); - if (entity instanceof ServerPlayer serverPlayer) - Messages.sendToPlayer(new ClientboundSyncTargetingData(target, getSpellType()), serverPlayer); - return true; - } - } - - @Override - public void onCast(Level world, LivingEntity entity, PlayerMagicData playerMagicData) { - if (playerMagicData.getAdditionalCastData() instanceof CastTargetingData targetData) { - var targetEntity = targetData.getTarget((ServerLevel) world); - if (targetEntity != null) { - targetEntity.addEffect(new MobEffectInstance(MobEffectRegistry.BLIGHT.get(), getDuration(entity), getAmplifier(entity))); - } - } - - super.onCast(world, entity, playerMagicData); - } - - @Nullable - private LivingEntity findTarget(LivingEntity caster) { - var target = Utils.raycastForEntity(caster.level, caster, 32, true, 0.35f); - if (target instanceof EntityHitResult entityHit && entityHit.getEntity() instanceof LivingEntity livingTarget) { - return livingTarget; - } else { - return null; - } - } - - public int getAmplifier(LivingEntity caster) { - return (int) (getSpellPower(caster) * this.level - 1); - } - - public int getDuration(LivingEntity caster) { - return (int) (getSpellPower(caster) * 20 * 30); - } - -} +//package io.redspace.ironsspellbooks.spells.poison; +// +//import io.redspace.ironsspellbooks.capabilities.magic.CastTargetingData; +//import io.redspace.ironsspellbooks.capabilities.magic.PlayerMagicData; +//import io.redspace.ironsspellbooks.effect.BlightEffect; +//import io.redspace.ironsspellbooks.network.spell.ClientboundSyncTargetingData; +//import io.redspace.ironsspellbooks.registries.MobEffectRegistry; +//import io.redspace.ironsspellbooks.setup.Messages; +//import io.redspace.ironsspellbooks.spells.AbstractSpell; +//import io.redspace.ironsspellbooks.spells.SpellType; +//import io.redspace.ironsspellbooks.util.Utils; +//import net.minecraft.network.chat.Component; +//import net.minecraft.network.chat.MutableComponent; +//import net.minecraft.server.level.ServerLevel; +//import net.minecraft.server.level.ServerPlayer; +//import net.minecraft.sounds.SoundEvent; +//import net.minecraft.world.effect.MobEffectInstance; +//import net.minecraft.world.entity.LivingEntity; +//import net.minecraft.world.level.Level; +//import net.minecraft.world.phys.EntityHitResult; +//import org.jetbrains.annotations.Nullable; +// +//import java.util.List; +//import java.util.Optional; +// +// +//public class BlightSpell extends AbstractSpell { +// public BlightSpell() { +// this(1); +// } +// +// @Override +// public List getUniqueInfo(LivingEntity caster) { +// return List.of( +// Component.translatable("ui.irons_spellbooks.reduced_healing",Utils.stringTruncation((1 + getAmplifier(caster)) * BlightEffect.HEALING_PER_LEVEL * -100, 1)), +// Component.translatable("ui.irons_spellbooks.reduced_damage", Utils.stringTruncation((1 + getAmplifier(caster)) * BlightEffect.DAMAGE_PER_LEVEL * -100, 1)), +// Component.translatable("ui.irons_spellbooks.effect_length", Utils.timeFromTicks(getDuration(caster), 1)) +// ); +// } +// +// public BlightSpell(int level) { +// super(SpellType.BLIGHT_SPELL); +// this.level = level; +// this.manaCostPerLevel = 5; +// this.baseSpellPower = 1; +// this.spellPowerPerLevel = 0; +// this.castTime = 50; +// this.baseManaCost = 10; +// +// } +// +// @Override +// public Optional getCastStartSound() { +// return Optional.empty(); +// } +// +// @Override +// public Optional getCastFinishSound() { +// return Optional.empty(); +// } +// +// +// @Override +// public boolean checkPreCastConditions(Level level, LivingEntity entity, PlayerMagicData playerMagicData) { +// var target = findTarget(entity); +// if (target == null) +// return false; +// else { +// playerMagicData.setAdditionalCastData(new CastTargetingData(target)); +// if (entity instanceof ServerPlayer serverPlayer) +// Messages.sendToPlayer(new ClientboundSyncTargetingData(target, getSpellType()), serverPlayer); +// return true; +// } +// } +// +// @Override +// public void onCast(Level world, LivingEntity entity, PlayerMagicData playerMagicData) { +// if (playerMagicData.getAdditionalCastData() instanceof CastTargetingData targetData) { +// var targetEntity = targetData.getTarget((ServerLevel) world); +// if (targetEntity != null) { +// targetEntity.addEffect(new MobEffectInstance(MobEffectRegistry.BLIGHT.get(), getDuration(entity), getAmplifier(entity))); +// } +// } +// +// super.onCast(world, entity, playerMagicData); +// } +// +// @Nullable +// private LivingEntity findTarget(LivingEntity caster) { +// var target = Utils.raycastForEntity(caster.level, caster, 32, true, 0.35f); +// if (target instanceof EntityHitResult entityHit && entityHit.getEntity() instanceof LivingEntity livingTarget) { +// return livingTarget; +// } else { +// return null; +// } +// } +// +// public int getAmplifier(LivingEntity caster) { +// return (int) (getSpellPower(caster) * this.level - 1); +// } +// +// public int getDuration(LivingEntity caster) { +// return (int) (getSpellPower(caster) * 20 * 30); +// } +// +//} diff --git a/src/main/java/io/redspace/ironsspellbooks/spells/poison/PoisonArrowSpell.java b/src/main/java/io/redspace/ironsspellbooks/spells/poison/PoisonArrowSpell.java index 1e01d913f..c47e6cb5c 100644 --- a/src/main/java/io/redspace/ironsspellbooks/spells/poison/PoisonArrowSpell.java +++ b/src/main/java/io/redspace/ironsspellbooks/spells/poison/PoisonArrowSpell.java @@ -1,81 +1,81 @@ -package io.redspace.ironsspellbooks.spells.poison; - -import com.mojang.datafixers.util.Either; -import io.redspace.ironsspellbooks.IronsSpellbooks; -import io.redspace.ironsspellbooks.capabilities.magic.PlayerMagicData; -import io.redspace.ironsspellbooks.entity.spells.poison_arrow.PoisonArrow; -import io.redspace.ironsspellbooks.registries.SoundRegistry; -import io.redspace.ironsspellbooks.spells.AbstractSpell; -import io.redspace.ironsspellbooks.spells.SpellType; -import io.redspace.ironsspellbooks.spells.ender.MagicArrowSpell; -import io.redspace.ironsspellbooks.spells.holy.HealSpell; -import io.redspace.ironsspellbooks.util.AnimationHolder; -import io.redspace.ironsspellbooks.util.Utils; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.builder.ILoopType; - -import java.util.List; -import java.util.Optional; - -public class PoisonArrowSpell extends AbstractSpell { - - @Override - public List getUniqueInfo(LivingEntity caster) { - return List.of( - Component.translatable("ui.irons_spellbooks.damage", Utils.stringTruncation(getArrowDamage(caster), 1)), - Component.translatable("ui.irons_spellbooks.aoe_damage", Utils.stringTruncation(getAOEDamage(caster), 1))); - } - - public PoisonArrowSpell(int level) { - super(SpellType.POISON_ARROW_SPELL); - this.level = level; - this.manaCostPerLevel = 8; - this.baseSpellPower = 5; - this.spellPowerPerLevel = 1; - this.castTime = 20; - this.baseManaCost = 40; - - } - - @Override - public Optional getCastStartSound() { - return Optional.of(SoundRegistry.MAGIC_ARROW_CHARGE.get()); - } - - @Override - public Optional getCastFinishSound() { - return Optional.of(SoundRegistry.MAGIC_ARROW_RELEASE.get()); - } - - @Override - public void onCast(Level level, LivingEntity entity, PlayerMagicData playerMagicData) { - PoisonArrow magicArrow = new PoisonArrow(level, entity); - magicArrow.setPos(entity.position().add(0, entity.getEyeHeight() - magicArrow.getBoundingBox().getYsize() * .5f, 0).add(entity.getForward())); - magicArrow.shoot(entity.getLookAngle()); - magicArrow.setDamage(getArrowDamage(entity)); - magicArrow.setAoeDamage(getAOEDamage(entity)); - level.addFreshEntity(magicArrow); - super.onCast(level, entity, playerMagicData); - } - - public float getArrowDamage(LivingEntity caster) { - return getSpellPower(caster); - } - - public float getAOEDamage(LivingEntity caster) { - return getSpellPower(caster) * .185f; - } - - @Override - public AnimationHolder getCastStartAnimation() { - return MagicArrowSpell.BOW_CHARGE_ANIMATION; - } - -} +//package io.redspace.ironsspellbooks.spells.poison; +// +//import com.mojang.datafixers.util.Either; +//import io.redspace.ironsspellbooks.IronsSpellbooks; +//import io.redspace.ironsspellbooks.capabilities.magic.PlayerMagicData; +//import io.redspace.ironsspellbooks.entity.spells.poison_arrow.PoisonArrow; +//import io.redspace.ironsspellbooks.registries.SoundRegistry; +//import io.redspace.ironsspellbooks.spells.AbstractSpell; +//import io.redspace.ironsspellbooks.spells.SpellType; +//import io.redspace.ironsspellbooks.spells.ender.MagicArrowSpell; +//import io.redspace.ironsspellbooks.spells.holy.HealSpell; +//import io.redspace.ironsspellbooks.util.AnimationHolder; +//import io.redspace.ironsspellbooks.util.Utils; +//import net.minecraft.network.chat.Component; +//import net.minecraft.network.chat.MutableComponent; +//import net.minecraft.resources.ResourceLocation; +//import net.minecraft.sounds.SoundEvent; +//import net.minecraft.world.entity.LivingEntity; +//import net.minecraft.world.entity.player.Player; +//import net.minecraft.world.level.Level; +//import software.bernie.geckolib3.core.builder.AnimationBuilder; +//import software.bernie.geckolib3.core.builder.ILoopType; +// +//import java.util.List; +//import java.util.Optional; +// +//public class PoisonArrowSpell extends AbstractSpell { +// +// @Override +// public List getUniqueInfo(LivingEntity caster) { +// return List.of( +// Component.translatable("ui.irons_spellbooks.damage", Utils.stringTruncation(getArrowDamage(caster), 1)), +// Component.translatable("ui.irons_spellbooks.aoe_damage", Utils.stringTruncation(getAOEDamage(caster), 1))); +// } +// +// public PoisonArrowSpell(int level) { +// super(SpellType.POISON_ARROW_SPELL); +// this.level = level; +// this.manaCostPerLevel = 8; +// this.baseSpellPower = 5; +// this.spellPowerPerLevel = 1; +// this.castTime = 20; +// this.baseManaCost = 40; +// +// } +// +// @Override +// public Optional getCastStartSound() { +// return Optional.of(SoundRegistry.MAGIC_ARROW_CHARGE.get()); +// } +// +// @Override +// public Optional getCastFinishSound() { +// return Optional.of(SoundRegistry.MAGIC_ARROW_RELEASE.get()); +// } +// +// @Override +// public void onCast(Level level, LivingEntity entity, PlayerMagicData playerMagicData) { +// PoisonArrow magicArrow = new PoisonArrow(level, entity); +// magicArrow.setPos(entity.position().add(0, entity.getEyeHeight() - magicArrow.getBoundingBox().getYsize() * .5f, 0).add(entity.getForward())); +// magicArrow.shoot(entity.getLookAngle()); +// magicArrow.setDamage(getArrowDamage(entity)); +// magicArrow.setAoeDamage(getAOEDamage(entity)); +// level.addFreshEntity(magicArrow); +// super.onCast(level, entity, playerMagicData); +// } +// +// public float getArrowDamage(LivingEntity caster) { +// return getSpellPower(caster); +// } +// +// public float getAOEDamage(LivingEntity caster) { +// return getSpellPower(caster) * .185f; +// } +// +// @Override +// public AnimationHolder getCastStartAnimation() { +// return MagicArrowSpell.BOW_CHARGE_ANIMATION; +// } +// +//} diff --git a/src/main/java/io/redspace/ironsspellbooks/spells/poison/PoisonBreathSpell.java b/src/main/java/io/redspace/ironsspellbooks/spells/poison/PoisonBreathSpell.java index d81b93676..380918414 100644 --- a/src/main/java/io/redspace/ironsspellbooks/spells/poison/PoisonBreathSpell.java +++ b/src/main/java/io/redspace/ironsspellbooks/spells/poison/PoisonBreathSpell.java @@ -1,73 +1,72 @@ -package io.redspace.ironsspellbooks.spells.poison; - - -import io.redspace.ironsspellbooks.capabilities.magic.PlayerMagicData; -import io.redspace.ironsspellbooks.entity.mobs.abstract_spell_casting_mob.AbstractSpellCastingMob; -import io.redspace.ironsspellbooks.entity.spells.AbstractConeProjectile; -import io.redspace.ironsspellbooks.entity.spells.poison_breath.PoisonBreathProjectile; -import io.redspace.ironsspellbooks.spells.AbstractSpell; -import io.redspace.ironsspellbooks.spells.EntityCastData; -import io.redspace.ironsspellbooks.spells.SpellType; -import io.redspace.ironsspellbooks.util.Utils; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.level.Level; - -import java.util.List; -import java.util.Optional; - -public class PoisonBreathSpell extends AbstractSpell { - public PoisonBreathSpell() { - this(1); - } - - @Override - public List getUniqueInfo(LivingEntity caster) { - return List.of(Component.translatable("ui.irons_spellbooks.damage", Utils.stringTruncation(getSpellPower(caster), 1))); - } - - public PoisonBreathSpell(int level) { - super(SpellType.POISON_BREATH_SPELL); - this.level = level; - this.manaCostPerLevel = 1; - this.baseSpellPower = 1; - this.spellPowerPerLevel = 1; - this.castTime = 100; - this.baseManaCost = 5; - - } - - @Override - public Optional getCastStartSound() { - return Optional.empty(); - } - - @Override - public Optional getCastFinishSound() { - return Optional.empty(); - } - - @Override - public void onCast(Level world, LivingEntity entity, PlayerMagicData playerMagicData) { - if (playerMagicData.isCasting() - && playerMagicData.getCastingSpellId() == this.getID() - && playerMagicData.getAdditionalCastData() instanceof EntityCastData entityCastData - && entityCastData.getCastingEntity() instanceof AbstractConeProjectile cone) { - cone.setDealDamageActive(); - } else { - PoisonBreathProjectile breath = new PoisonBreathProjectile(world, entity); - breath.setPos(entity.position().add(0, entity.getEyeHeight() * .7, 0)); - breath.setDamage(getSpellPower(entity)); - world.addFreshEntity(breath); - playerMagicData.setAdditionalCastData(new EntityCastData(breath)); - super.onCast(world, entity, playerMagicData); - } - } - - @Override - public boolean shouldAIStopCasting(AbstractSpellCastingMob mob, LivingEntity target) { - return mob.distanceToSqr(target) > (10 * 10) * 1.2; - } -} +//package io.redspace.ironsspellbooks.spells.poison; +// +// +//import io.redspace.ironsspellbooks.capabilities.magic.PlayerMagicData; +//import io.redspace.ironsspellbooks.entity.mobs.abstract_spell_casting_mob.AbstractSpellCastingMob; +//import io.redspace.ironsspellbooks.entity.spells.AbstractConeProjectile; +//import io.redspace.ironsspellbooks.spells.AbstractSpell; +//import io.redspace.ironsspellbooks.spells.EntityCastData; +//import io.redspace.ironsspellbooks.spells.SpellType; +//import io.redspace.ironsspellbooks.util.Utils; +//import net.minecraft.network.chat.Component; +//import net.minecraft.network.chat.MutableComponent; +//import net.minecraft.sounds.SoundEvent; +//import net.minecraft.world.entity.LivingEntity; +//import net.minecraft.world.level.Level; +// +//import java.util.List; +//import java.util.Optional; +// +//public class PoisonBreathSpell extends AbstractSpell { +// public PoisonBreathSpell() { +// this(1); +// } +// +// @Override +// public List getUniqueInfo(LivingEntity caster) { +// return List.of(Component.translatable("ui.irons_spellbooks.damage", Utils.stringTruncation(getSpellPower(caster), 1))); +// } +// +// public PoisonBreathSpell(int level) { +// super(SpellType.POISON_BREATH_SPELL); +// this.level = level; +// this.manaCostPerLevel = 1; +// this.baseSpellPower = 1; +// this.spellPowerPerLevel = 1; +// this.castTime = 100; +// this.baseManaCost = 5; +// +// } +// +// @Override +// public Optional getCastStartSound() { +// return Optional.empty(); +// } +// +// @Override +// public Optional getCastFinishSound() { +// return Optional.empty(); +// } +// +// @Override +// public void onCast(Level world, LivingEntity entity, PlayerMagicData playerMagicData) { +// if (playerMagicData.isCasting() +// && playerMagicData.getCastingSpellId() == this.getID() +// && playerMagicData.getAdditionalCastData() instanceof EntityCastData entityCastData +// && entityCastData.getCastingEntity() instanceof AbstractConeProjectile cone) { +// cone.setDealDamageActive(); +// } else { +// PoisonBreathProjectile breath = new PoisonBreathProjectile(world, entity); +// breath.setPos(entity.position().add(0, entity.getEyeHeight() * .7, 0)); +// breath.setDamage(getSpellPower(entity)); +// world.addFreshEntity(breath); +// playerMagicData.setAdditionalCastData(new EntityCastData(breath)); +// super.onCast(world, entity, playerMagicData); +// } +// } +// +// @Override +// public boolean shouldAIStopCasting(AbstractSpellCastingMob mob, LivingEntity target) { +// return mob.distanceToSqr(target) > (10 * 10) * 1.2; +// } +//} diff --git a/src/main/java/io/redspace/ironsspellbooks/spells/poison/PoisonSplashSpell.java b/src/main/java/io/redspace/ironsspellbooks/spells/poison/PoisonSplashSpell.java index d1e5c5716..56d22227a 100644 --- a/src/main/java/io/redspace/ironsspellbooks/spells/poison/PoisonSplashSpell.java +++ b/src/main/java/io/redspace/ironsspellbooks/spells/poison/PoisonSplashSpell.java @@ -1,105 +1,105 @@ -package io.redspace.ironsspellbooks.spells.poison; - -import io.redspace.ironsspellbooks.capabilities.magic.CastTargetingData; -import io.redspace.ironsspellbooks.capabilities.magic.PlayerMagicData; -import io.redspace.ironsspellbooks.entity.spells.poison_cloud.PoisonSplash; -import io.redspace.ironsspellbooks.network.spell.ClientboundSyncTargetingData; -import io.redspace.ironsspellbooks.registries.SoundRegistry; -import io.redspace.ironsspellbooks.setup.Messages; -import io.redspace.ironsspellbooks.spells.AbstractSpell; -import io.redspace.ironsspellbooks.spells.SpellType; -import io.redspace.ironsspellbooks.util.Utils; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.level.Level; -import net.minecraft.world.phys.EntityHitResult; -import net.minecraft.world.phys.HitResult; -import net.minecraft.world.phys.Vec3; - -import java.util.List; -import java.util.Optional; - -public class PoisonSplashSpell extends AbstractSpell { - public PoisonSplashSpell() { - this(1); - } - - @Override - public List getUniqueInfo(LivingEntity caster) { - return List.of( - Component.translatable("ui.irons_spellbooks.damage", Utils.stringTruncation(getDamage(caster), 1)), - Component.translatable("ui.irons_spellbooks.effect_length", Utils.timeFromTicks(getDuration(caster), 1)) - ); - } - - public PoisonSplashSpell(int level) { - super(SpellType.POISON_SPLASH_SPELL); - this.level = level; - this.manaCostPerLevel = 10; - this.baseSpellPower = 8; - this.spellPowerPerLevel = 1; - this.castTime = 15; - this.baseManaCost = 40; - } - - @Override - public Optional getCastStartSound() { - return Optional.of(SoundRegistry.ICE_BLOCK_CAST.get()); - } - - @Override - public Optional getCastFinishSound() { - return Optional.empty(); - } - - @Override - public boolean checkPreCastConditions(Level level, LivingEntity entity, PlayerMagicData playerMagicData) { - HitResult raycast = Utils.raycastForEntity(level, entity, 40, true); - - if (raycast.getType() == HitResult.Type.ENTITY && ((EntityHitResult) raycast).getEntity() instanceof LivingEntity target) { - playerMagicData.setAdditionalCastData(new CastTargetingData(target)); - if (entity instanceof ServerPlayer serverPlayer) - Messages.sendToPlayer(new ClientboundSyncTargetingData(target, getSpellType()), serverPlayer); - } - return true; - - } - - @Override - public void onCast(Level level, LivingEntity entity, PlayerMagicData playerMagicData) { - Vec3 spawn = null; - - if (playerMagicData.getAdditionalCastData() instanceof CastTargetingData castTargetingData) { - spawn = castTargetingData.getTargetPosition((ServerLevel) level); - } - if(spawn == null){ - HitResult raycast = Utils.raycastForEntity(level, entity, 32, true); - if (raycast.getType() == HitResult.Type.ENTITY) { - spawn = ((EntityHitResult) raycast).getEntity().position(); - } else { - spawn = Utils.moveToRelativeGroundLevel(level, raycast.getLocation().subtract(entity.getForward().normalize()).add(0, 2, 0), 5); - } - } - - PoisonSplash poisonSplash = new PoisonSplash(level); - poisonSplash.setOwner(entity); - poisonSplash.moveTo(spawn); - poisonSplash.setDamage(getDamage(entity)); - poisonSplash.setEffectDuration(getDuration(entity)); - level.addFreshEntity(poisonSplash); - - super.onCast(level, entity, playerMagicData); - } - - private float getDamage(LivingEntity entity) { - return this.getSpellPower(entity); - } - - private int getDuration(LivingEntity entity) { - return 100 + level * 40; - } -} +//package io.redspace.ironsspellbooks.spells.poison; +// +//import io.redspace.ironsspellbooks.capabilities.magic.CastTargetingData; +//import io.redspace.ironsspellbooks.capabilities.magic.PlayerMagicData; +//import io.redspace.ironsspellbooks.entity.spells.poison_cloud.PoisonSplash; +//import io.redspace.ironsspellbooks.network.spell.ClientboundSyncTargetingData; +//import io.redspace.ironsspellbooks.registries.SoundRegistry; +//import io.redspace.ironsspellbooks.setup.Messages; +//import io.redspace.ironsspellbooks.spells.AbstractSpell; +//import io.redspace.ironsspellbooks.spells.SpellType; +//import io.redspace.ironsspellbooks.util.Utils; +//import net.minecraft.network.chat.Component; +//import net.minecraft.network.chat.MutableComponent; +//import net.minecraft.server.level.ServerLevel; +//import net.minecraft.server.level.ServerPlayer; +//import net.minecraft.sounds.SoundEvent; +//import net.minecraft.world.entity.LivingEntity; +//import net.minecraft.world.level.Level; +//import net.minecraft.world.phys.EntityHitResult; +//import net.minecraft.world.phys.HitResult; +//import net.minecraft.world.phys.Vec3; +// +//import java.util.List; +//import java.util.Optional; +// +//public class PoisonSplashSpell extends AbstractSpell { +// public PoisonSplashSpell() { +// this(1); +// } +// +// @Override +// public List getUniqueInfo(LivingEntity caster) { +// return List.of( +// Component.translatable("ui.irons_spellbooks.damage", Utils.stringTruncation(getDamage(caster), 1)), +// Component.translatable("ui.irons_spellbooks.effect_length", Utils.timeFromTicks(getDuration(caster), 1)) +// ); +// } +// +// public PoisonSplashSpell(int level) { +// super(SpellType.POISON_SPLASH_SPELL); +// this.level = level; +// this.manaCostPerLevel = 10; +// this.baseSpellPower = 8; +// this.spellPowerPerLevel = 1; +// this.castTime = 15; +// this.baseManaCost = 40; +// } +// +// @Override +// public Optional getCastStartSound() { +// return Optional.of(SoundRegistry.ICE_BLOCK_CAST.get()); +// } +// +// @Override +// public Optional getCastFinishSound() { +// return Optional.empty(); +// } +// +// @Override +// public boolean checkPreCastConditions(Level level, LivingEntity entity, PlayerMagicData playerMagicData) { +// HitResult raycast = Utils.raycastForEntity(level, entity, 40, true); +// +// if (raycast.getType() == HitResult.Type.ENTITY && ((EntityHitResult) raycast).getEntity() instanceof LivingEntity target) { +// playerMagicData.setAdditionalCastData(new CastTargetingData(target)); +// if (entity instanceof ServerPlayer serverPlayer) +// Messages.sendToPlayer(new ClientboundSyncTargetingData(target, getSpellType()), serverPlayer); +// } +// return true; +// +// } +// +// @Override +// public void onCast(Level level, LivingEntity entity, PlayerMagicData playerMagicData) { +// Vec3 spawn = null; +// +// if (playerMagicData.getAdditionalCastData() instanceof CastTargetingData castTargetingData) { +// spawn = castTargetingData.getTargetPosition((ServerLevel) level); +// } +// if(spawn == null){ +// HitResult raycast = Utils.raycastForEntity(level, entity, 32, true); +// if (raycast.getType() == HitResult.Type.ENTITY) { +// spawn = ((EntityHitResult) raycast).getEntity().position(); +// } else { +// spawn = Utils.moveToRelativeGroundLevel(level, raycast.getLocation().subtract(entity.getForward().normalize()).add(0, 2, 0), 5); +// } +// } +// +// PoisonSplash poisonSplash = new PoisonSplash(level); +// poisonSplash.setOwner(entity); +// poisonSplash.moveTo(spawn); +// poisonSplash.setDamage(getDamage(entity)); +// poisonSplash.setEffectDuration(getDuration(entity)); +// level.addFreshEntity(poisonSplash); +// +// super.onCast(level, entity, playerMagicData); +// } +// +// private float getDamage(LivingEntity entity) { +// return this.getSpellPower(entity); +// } +// +// private int getDuration(LivingEntity entity) { +// return 100 + level * 40; +// } +//} diff --git a/src/main/java/io/redspace/ironsspellbooks/spells/poison/SpiderAspectSpell.java b/src/main/java/io/redspace/ironsspellbooks/spells/poison/SpiderAspectSpell.java index f29c68b79..01b7495a7 100644 --- a/src/main/java/io/redspace/ironsspellbooks/spells/poison/SpiderAspectSpell.java +++ b/src/main/java/io/redspace/ironsspellbooks/spells/poison/SpiderAspectSpell.java @@ -1,72 +1,72 @@ -package io.redspace.ironsspellbooks.spells.poison; - -import io.redspace.ironsspellbooks.capabilities.magic.PlayerMagicData; -import io.redspace.ironsspellbooks.effect.SpiderAspectEffect; -import io.redspace.ironsspellbooks.registries.MobEffectRegistry; -import io.redspace.ironsspellbooks.spells.AbstractSpell; -import io.redspace.ironsspellbooks.spells.SpellType; -import io.redspace.ironsspellbooks.spells.holy.HealSpell; -import io.redspace.ironsspellbooks.util.AnimationHolder; -import io.redspace.ironsspellbooks.util.Utils; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.world.effect.MobEffectInstance; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.level.Level; - -import java.util.List; -import java.util.Optional; - - -public class SpiderAspectSpell extends AbstractSpell { - public SpiderAspectSpell() { - this(1); - } - - @Override - public List getUniqueInfo(LivingEntity caster) { - return List.of( - Component.translatable("ui.irons_spellbooks.additional_poisoned_damage", Utils.stringTruncation(getPercentDamage(), 0)), - Component.translatable("ui.irons_spellbooks.effect_length", Utils.timeFromTicks(getSpellPower(caster) * 20, 1)) - ); - } - - public SpiderAspectSpell(int level) { - super(SpellType.SPIDER_ASPECT_SPELL); - this.level = level; - this.manaCostPerLevel = 5; - this.baseSpellPower = 20; - this.spellPowerPerLevel = 5; - this.castTime = 0; - this.baseManaCost = 35; - - } - - @Override - public Optional getCastStartSound() { - return Optional.empty(); - } - - @Override - public Optional getCastFinishSound() { - return Optional.empty(); - } - - @Override - public void onCast(Level level, LivingEntity entity, PlayerMagicData playerMagicData) { - - entity.addEffect(new MobEffectInstance(MobEffectRegistry.SPIDER_ASPECT.get(), (int) (getSpellPower(entity) * 20), this.level - 1, false, false, true)); - - super.onCast(level, entity, playerMagicData); - } - - private float getPercentDamage() { - return level * SpiderAspectEffect.DAMAGE_PER_LEVEL * 100; - } - - @Override - public AnimationHolder getCastStartAnimation() { - return HealSpell.SELF_CAST_ANIMATION; - } -} +//package io.redspace.ironsspellbooks.spells.poison; +// +//import io.redspace.ironsspellbooks.capabilities.magic.PlayerMagicData; +//import io.redspace.ironsspellbooks.effect.SpiderAspectEffect; +//import io.redspace.ironsspellbooks.registries.MobEffectRegistry; +//import io.redspace.ironsspellbooks.spells.AbstractSpell; +//import io.redspace.ironsspellbooks.spells.SpellType; +//import io.redspace.ironsspellbooks.spells.holy.HealSpell; +//import io.redspace.ironsspellbooks.util.AnimationHolder; +//import io.redspace.ironsspellbooks.util.Utils; +//import net.minecraft.network.chat.Component; +//import net.minecraft.network.chat.MutableComponent; +//import net.minecraft.sounds.SoundEvent; +//import net.minecraft.world.effect.MobEffectInstance; +//import net.minecraft.world.entity.LivingEntity; +//import net.minecraft.world.level.Level; +// +//import java.util.List; +//import java.util.Optional; +// +// +//public class SpiderAspectSpell extends AbstractSpell { +// public SpiderAspectSpell() { +// this(1); +// } +// +// @Override +// public List getUniqueInfo(LivingEntity caster) { +// return List.of( +// Component.translatable("ui.irons_spellbooks.additional_poisoned_damage", Utils.stringTruncation(getPercentDamage(), 0)), +// Component.translatable("ui.irons_spellbooks.effect_length", Utils.timeFromTicks(getSpellPower(caster) * 20, 1)) +// ); +// } +// +// public SpiderAspectSpell(int level) { +// super(SpellType.SPIDER_ASPECT_SPELL); +// this.level = level; +// this.manaCostPerLevel = 5; +// this.baseSpellPower = 20; +// this.spellPowerPerLevel = 5; +// this.castTime = 0; +// this.baseManaCost = 35; +// +// } +// +// @Override +// public Optional getCastStartSound() { +// return Optional.empty(); +// } +// +// @Override +// public Optional getCastFinishSound() { +// return Optional.empty(); +// } +// +// @Override +// public void onCast(Level level, LivingEntity entity, PlayerMagicData playerMagicData) { +// +// entity.addEffect(new MobEffectInstance(MobEffectRegistry.SPIDER_ASPECT.get(), (int) (getSpellPower(entity) * 20), this.level - 1, false, false, true)); +// +// super.onCast(level, entity, playerMagicData); +// } +// +// private float getPercentDamage() { +// return level * SpiderAspectEffect.DAMAGE_PER_LEVEL * 100; +// } +// +// @Override +// public AnimationHolder getCastStartAnimation() { +// return HealSpell.SELF_CAST_ANIMATION; +// } +//}