From 3e8000a1661cae75b0bef9b51862c14973fb11b4 Mon Sep 17 00:00:00 2001 From: Boblet Date: Wed, 4 Dec 2024 15:50:59 +0100 Subject: [PATCH] get skullanized, idiot --- .../standard/EntityProcessorCrossSmooth.java | 11 ++++++++++- .../java/com/hbm/handler/EntityEffectHandler.java | 5 +++++ .../com/hbm/items/weapon/sedna/BulletConfig.java | 4 +++- .../items/weapon/sedna/factory/ConfettiUtil.java | 14 ++++++++------ .../items/weapon/sedna/factory/XFactoryFlamer.java | 8 ++++---- src/main/java/com/hbm/particle/ParticleAshes.java | 10 +++++----- .../java/com/hbm/particle/ParticleSkeleton.java | 3 +-- .../com/hbm/particle/helper/SkeletonCreator.java | 14 +++++++++----- 8 files changed, 45 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/hbm/explosion/vanillant/standard/EntityProcessorCrossSmooth.java b/src/main/java/com/hbm/explosion/vanillant/standard/EntityProcessorCrossSmooth.java index 51bdef9e5..38cb3383f 100644 --- a/src/main/java/com/hbm/explosion/vanillant/standard/EntityProcessorCrossSmooth.java +++ b/src/main/java/com/hbm/explosion/vanillant/standard/EntityProcessorCrossSmooth.java @@ -2,10 +2,13 @@ package com.hbm.explosion.vanillant.standard; import com.hbm.explosion.vanillant.ExplosionVNT; import com.hbm.items.weapon.sedna.BulletConfig; +import com.hbm.items.weapon.sedna.factory.ConfettiUtil; +import com.hbm.util.EntityDamageUtil; import com.hbm.util.DamageResistanceHandler.DamageClass; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.DamageSource; public class EntityProcessorCrossSmooth extends EntityProcessorCross { @@ -27,7 +30,13 @@ public class EntityProcessorCrossSmooth extends EntityProcessorCross { @Override public void attackEntity(Entity entity, ExplosionVNT source, float amount) { - entity.attackEntityFrom(BulletConfig.getDamage(null, source.exploder instanceof EntityLivingBase ? (EntityLivingBase) source.exploder : null, clazz), amount); + DamageSource dmg = BulletConfig.getDamage(null, source.exploder instanceof EntityLivingBase ? (EntityLivingBase) source.exploder : null, clazz); + if(!(entity instanceof EntityLivingBase)) { + entity.attackEntityFrom(dmg, amount); + } else { + EntityDamageUtil.attackEntityFromNT((EntityLivingBase) entity, dmg, amount, true, false, 0F, pierceDT, pierceDR); + if(!entity.isEntityAlive()) ConfettiUtil.decideConfetti((EntityLivingBase) entity, dmg); + } } @Override diff --git a/src/main/java/com/hbm/handler/EntityEffectHandler.java b/src/main/java/com/hbm/handler/EntityEffectHandler.java index c6597b3f5..52c80352c 100644 --- a/src/main/java/com/hbm/handler/EntityEffectHandler.java +++ b/src/main/java/com/hbm/handler/EntityEffectHandler.java @@ -18,6 +18,7 @@ import com.hbm.handler.pollution.PollutionHandler.PollutionType; import com.hbm.handler.radiation.ChunkRadiationManager; import com.hbm.interfaces.IArmorModDash; import com.hbm.items.armor.ArmorFSB; +import com.hbm.items.weapon.sedna.factory.ConfettiUtil; import com.hbm.lib.ModDamageSource; import com.hbm.main.MainRegistry; import com.hbm.packet.PacketDispatcher; @@ -572,6 +573,8 @@ public class EntityEffectHandler { HbmLivingProps props = HbmLivingProps.getData(living); Random rand = living.getRNG(); + if(!entity.isEntityAlive()) return; + if(living.isImmuneToFire()) props.fire = 0; double x = living.posX; @@ -594,6 +597,8 @@ public class EntityEffectHandler { if((living.ticksExisted + living.getEntityId()) % 20 == 0) living.attackEntityFrom(DamageSource.onFire, 5F); FlameCreator.composeEffect(entity.worldObj, x - living.width / 2 + living.width * rand.nextDouble(), y + rand.nextDouble() * living.height, z - living.width / 2 + living.width * rand.nextDouble(), FlameCreator.META_BALEFIRE); } + + if(props.fire > 0 || props.balefire > 0) if(!entity.isEntityAlive()) ConfettiUtil.decideConfetti(living, DamageSource.onFire); } private static void handleDashing(Entity entity) { diff --git a/src/main/java/com/hbm/items/weapon/sedna/BulletConfig.java b/src/main/java/com/hbm/items/weapon/sedna/BulletConfig.java index 596a246d2..f9e5c341c 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/BulletConfig.java +++ b/src/main/java/com/hbm/items/weapon/sedna/BulletConfig.java @@ -49,7 +49,7 @@ public class BulletConfig implements Cloneable { public float damageMult = 1.0F; public float armorThresholdNegation = 0.0F; public float armorPiercingPercent = 0.0F; - public float knockbackMult = 0.25F; + public float knockbackMult = 0.1F; public float headshotMult = 1.0F; public DamageClass dmgClass = DamageClass.PHYSICAL; @@ -219,6 +219,8 @@ public class BulletConfig implements Cloneable { bullet.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord); bullet.setDead(); } + + if(!living.isEntityAlive()) ConfettiUtil.decideConfetti(living, source); } }; diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/ConfettiUtil.java b/src/main/java/com/hbm/items/weapon/sedna/factory/ConfettiUtil.java index 7c914ba7e..b5070b6dc 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/ConfettiUtil.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/ConfettiUtil.java @@ -15,20 +15,22 @@ import net.minecraft.util.MathHelper; public class ConfettiUtil { public static void decideConfetti(EntityLivingBase entity, DamageSource source) { + if(entity.isEntityAlive()) return; if(source.damageType.equals(DamageClass.LASER.name())) pulverize(entity); - if(source.damageType.equals(DamageClass.EXPLOSIVE.name())) gib(entity); - skullanize(entity); + if(source.isExplosion()) gib(entity); + if(source.isFireDamage()) cremate(entity); } public static void pulverize(EntityLivingBase entity) { - if(entity.isEntityAlive()) return; int amount = MathHelper.clamp_int((int) (entity.width * entity.height * entity.width * 25), 5, 50); AshesCreator.composeEffect(entity.worldObj, entity, amount, 0.125F); + SkeletonCreator.composeEffect(entity.worldObj, entity, 1F); } - public static void skullanize(EntityLivingBase entity) { - if(entity.isEntityAlive()) return; - SkeletonCreator.composeEffect(entity.worldObj, entity); + public static void cremate(EntityLivingBase entity) { + int amount = MathHelper.clamp_int((int) (entity.width * entity.height * entity.width * 25), 5, 50); + AshesCreator.composeEffect(entity.worldObj, entity, amount, 0.125F); + SkeletonCreator.composeEffect(entity.worldObj, entity, 0.25F); } public static void gib(EntityLivingBase entity) { diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryFlamer.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryFlamer.java index 1ff33433c..57828b6ad 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryFlamer.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryFlamer.java @@ -108,13 +108,13 @@ public class XFactoryFlamer { } public static void init() { - flame_diesel = new BulletConfig().setItem(EnumAmmo.FLAME_DIESEL).setupDamageClass(DamageClass.FIRE).setLife(100).setVel(1F).setGrav(0.02D).setReloadCount(500).setSelfDamageDelay(20) + flame_diesel = new BulletConfig().setItem(EnumAmmo.FLAME_DIESEL).setupDamageClass(DamageClass.FIRE).setLife(100).setVel(1F).setGrav(0.02D).setReloadCount(500).setSelfDamageDelay(20).setKnockback(0F) .setOnUpdate(LAMBDA_FIRE).setOnRicochet(LAMBDA_LINGER_DIESEL); - flame_gas = new BulletConfig().setItem(EnumAmmo.FLAME_GAS).setupDamageClass(DamageClass.FIRE).setLife(10).setSpread(0.05F).setVel(1F).setGrav(0.0D).setReloadCount(500).setSelfDamageDelay(20) + flame_gas = new BulletConfig().setItem(EnumAmmo.FLAME_GAS).setupDamageClass(DamageClass.FIRE).setLife(10).setSpread(0.05F).setVel(1F).setGrav(0.0D).setReloadCount(500).setSelfDamageDelay(20).setKnockback(0F) .setOnUpdate(LAMBDA_FIRE).setOnRicochet(LAMBDA_LINGER_GAS); - flame_napalm = new BulletConfig().setItem(EnumAmmo.FLAME_NAPALM).setupDamageClass(DamageClass.FIRE).setLife(200).setVel(1F).setGrav(0.02D).setReloadCount(500).setSelfDamageDelay(20) + flame_napalm = new BulletConfig().setItem(EnumAmmo.FLAME_NAPALM).setupDamageClass(DamageClass.FIRE).setLife(200).setVel(1F).setGrav(0.02D).setReloadCount(500).setSelfDamageDelay(20).setKnockback(0F) .setOnUpdate(LAMBDA_FIRE).setOnRicochet(LAMBDA_LINGER_NAPALM); - flame_balefire = new BulletConfig().setItem(EnumAmmo.FLAME_BALEFIRE).setupDamageClass(DamageClass.FIRE).setLife(200).setVel(1F).setGrav(0.02D).setReloadCount(500).setSelfDamageDelay(20) + flame_balefire = new BulletConfig().setItem(EnumAmmo.FLAME_BALEFIRE).setupDamageClass(DamageClass.FIRE).setLife(200).setVel(1F).setGrav(0.02D).setReloadCount(500).setSelfDamageDelay(20).setKnockback(0F) .setOnUpdate(LAMBDA_BALEFIRE).setOnRicochet(LAMBDA_LINGER_BALEFIRE); flame_topaz_diesel = flame_diesel .clone().setProjectiles(2).setSpread(0.05F).setLife(60).setGrav(0.0D); diff --git a/src/main/java/com/hbm/particle/ParticleAshes.java b/src/main/java/com/hbm/particle/ParticleAshes.java index 636ca2835..07b50286f 100644 --- a/src/main/java/com/hbm/particle/ParticleAshes.java +++ b/src/main/java/com/hbm/particle/ParticleAshes.java @@ -14,7 +14,7 @@ public class ParticleAshes extends EntityFXRotating { public ParticleAshes(World world, double x, double y, double z, float scale) { super(world, x, y, z); particleIcon = ModEventHandlerClient.particleBase; - this.particleMaxAge = 200 + rand.nextInt(15); + this.particleMaxAge = 1200 + rand.nextInt(20); this.particleScale = scale * 0.9F + rand.nextFloat() * 0.2F; this.particleGravity = 0.01F; @@ -72,14 +72,14 @@ public class ParticleAshes extends EntityFXRotating { float pZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) interp - interpPosZ); Vec3NT vec = new Vec3NT(particleScale, 0, particleScale).rotateAroundYDeg(this.rotationPitch); - - tess.addVertexWithUV(pX + vec.xCoord, pY + 0.05, pZ + vec.zCoord, particleIcon.getMaxU(), particleIcon.getMaxV()); - vec.rotateAroundYDeg(-90); + tess.addVertexWithUV(pX + vec.xCoord, pY + 0.05, pZ + vec.zCoord, particleIcon.getMaxU(), particleIcon.getMinV()); vec.rotateAroundYDeg(-90); - tess.addVertexWithUV(pX + vec.xCoord, pY + 0.05, pZ + vec.zCoord, particleIcon.getMinU(), particleIcon.getMinV()); + tess.addVertexWithUV(pX + vec.xCoord, pY + 0.05, pZ + vec.zCoord, particleIcon.getMaxU(), particleIcon.getMaxV()); vec.rotateAroundYDeg(-90); tess.addVertexWithUV(pX + vec.xCoord, pY + 0.05, pZ + vec.zCoord, particleIcon.getMinU(), particleIcon.getMaxV()); + vec.rotateAroundYDeg(-90); + tess.addVertexWithUV(pX + vec.xCoord, pY + 0.05, pZ + vec.zCoord, particleIcon.getMinU(), particleIcon.getMinV()); } else { renderParticleRotated(tess, interp, sX, sY, sZ, dX, dZ, this.particleScale); } diff --git a/src/main/java/com/hbm/particle/ParticleSkeleton.java b/src/main/java/com/hbm/particle/ParticleSkeleton.java index 314fb7e9a..95e937812 100644 --- a/src/main/java/com/hbm/particle/ParticleSkeleton.java +++ b/src/main/java/com/hbm/particle/ParticleSkeleton.java @@ -1,7 +1,6 @@ package com.hbm.particle; import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; import com.hbm.lib.RefStrings; import com.hbm.particle.helper.SkeletonCreator.EnumSkeletonType; @@ -39,7 +38,7 @@ public class ParticleSkeleton extends EntityFX { this.textureManager = textureManager; this.type = type; - this.particleMaxAge = 200 + rand.nextInt(20); + this.particleMaxAge = 1200 + rand.nextInt(20); this.particleRed = r; this.particleGreen = g; diff --git a/src/main/java/com/hbm/particle/helper/SkeletonCreator.java b/src/main/java/com/hbm/particle/helper/SkeletonCreator.java index 78dfaeafa..ed938a05f 100644 --- a/src/main/java/com/hbm/particle/helper/SkeletonCreator.java +++ b/src/main/java/com/hbm/particle/helper/SkeletonCreator.java @@ -18,6 +18,7 @@ import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityPigZombie; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; @@ -28,11 +29,12 @@ public class SkeletonCreator implements IParticleCreator { public static HashMap> skullanizer = new HashMap(); - public static void composeEffect(World world, Entity toSkeletonize) { + public static void composeEffect(World world, Entity toSkeletonize, float brightness) { NBTTagCompound data = new NBTTagCompound(); data.setString("type", "skeleton"); data.setInteger("entityID", toSkeletonize.getEntityId()); + data.setFloat("brightness", brightness); IParticleCreator.sendPacket(world, toSkeletonize.posX, toSkeletonize.posY, toSkeletonize.posZ, 100, data); } @@ -49,12 +51,14 @@ public class SkeletonCreator implements IParticleCreator { ClientProxy.vanish(entityID); + float brightness = data.getFloat("brightness"); + Function bonealizer = skullanizer.get(entity.getClass()); if(bonealizer != null) { BoneDefinition[] bones = bonealizer.apply(living); for(BoneDefinition bone : bones) { - ParticleSkeleton skeleton = new ParticleSkeleton(Minecraft.getMinecraft().getTextureManager(), world, bone.x, bone.y, bone.z, 1F, 1F, 1F, bone.type); + ParticleSkeleton skeleton = new ParticleSkeleton(Minecraft.getMinecraft().getTextureManager(), world, bone.x, bone.y, bone.z, brightness, brightness, brightness, bone.type); skeleton.prevRotationYaw = skeleton.rotationYaw = bone.yaw; skeleton.prevRotationPitch = skeleton.rotationPitch = bone.pitch; Minecraft.getMinecraft().effectRenderer.addEffect(skeleton); @@ -113,13 +117,12 @@ public class SkeletonCreator implements IParticleCreator { public static Function BONES_DUMMY = (entity) -> { Vec3NT leftarm = new Vec3NT(0.375, 0, 0).rotateAroundYDeg(-entity.renderYawOffset); - Vec3NT forward = new Vec3NT(0, 0, 0.25).rotateAroundYDeg(-entity.renderYawOffset); Vec3NT leftleg = new Vec3NT(0.125, 0, 0).rotateAroundYDeg(-entity.renderYawOffset); return new BoneDefinition[] { new BoneDefinition(EnumSkeletonType.SKULL, -entity.rotationYawHead, entity.rotationPitch, entity.posX, entity.posY + 1.75, entity.posZ), new BoneDefinition(EnumSkeletonType.TORSO, -entity.renderYawOffset, 0, entity.posX, entity.posY + 1.125, entity.posZ), - new BoneDefinition(EnumSkeletonType.LIMB, -entity.renderYawOffset, -90, entity.posX + leftarm.xCoord + forward.xCoord, entity.posY + 1.375, entity.posZ + leftarm.zCoord + forward.zCoord), - new BoneDefinition(EnumSkeletonType.LIMB, -entity.renderYawOffset, -90, entity.posX - leftarm.xCoord + forward.xCoord, entity.posY + 1.375, entity.posZ - leftarm.zCoord + forward.zCoord), + new BoneDefinition(EnumSkeletonType.LIMB, -entity.renderYawOffset, 0, entity.posX + leftarm.xCoord, entity.posY + 1.125, entity.posZ + leftarm.zCoord), + new BoneDefinition(EnumSkeletonType.LIMB, -entity.renderYawOffset, 0, entity.posX - leftarm.xCoord, entity.posY + 1.125, entity.posZ - leftarm.zCoord), new BoneDefinition(EnumSkeletonType.LIMB, -entity.renderYawOffset, 0, entity.posX + leftleg.xCoord, entity.posY + 0.625, entity.posZ + leftleg.zCoord), new BoneDefinition(EnumSkeletonType.LIMB, -entity.renderYawOffset, 0, entity.posX - leftleg.xCoord, entity.posY + 0.625, entity.posZ - leftleg.zCoord), }; @@ -132,6 +135,7 @@ public class SkeletonCreator implements IParticleCreator { skullanizer.put(EntityZombie.class, BONES_ZOMBIE); skullanizer.put(EntitySkeleton.class, BONES_ZOMBIE); + skullanizer.put(EntityPigZombie.class, BONES_ZOMBIE); skullanizer.put(EntityDummy.class, BONES_DUMMY); }