diff --git a/changelog b/changelog index 5dc4a445d..938e01585 100644 --- a/changelog +++ b/changelog @@ -4,6 +4,9 @@ * All dual wielded guns now render more accurately when dropped instead of only showing one gun * Added support for left handed guns (currently unused)* * Removed the presentations for the old particle accelerator and schottky diode +* Gibbing NPCs now also spawns bones, if supported by the skeletonizer + * Gibbed bones only have a 50% chance of spawning and come with a unique red texture + * Gibbed bones have a way shorter lifetime and higher gravity to match the gib particles ## Fixed * Fixed wood burner only being able to create one ash pile per item burned, even when that item yields more, creating a backlog in the internal ash value diff --git a/src/main/java/com/hbm/entity/EntityMappings.java b/src/main/java/com/hbm/entity/EntityMappings.java index 9c5d5358d..764b06463 100644 --- a/src/main/java/com/hbm/entity/EntityMappings.java +++ b/src/main/java/com/hbm/entity/EntityMappings.java @@ -25,7 +25,6 @@ import com.hbm.entity.train.*; import com.hbm.main.MainRegistry; import com.hbm.util.Tuple.Quartet; -import cpw.mods.fml.common.registry.EntityRegistry; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EnumCreatureType; diff --git a/src/main/java/com/hbm/handler/GunConfiguration.java b/src/main/java/com/hbm/handler/GunConfiguration.java deleted file mode 100644 index f703d47e4..000000000 --- a/src/main/java/com/hbm/handler/GunConfiguration.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.hbm.handler; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.function.Consumer; - -import com.hbm.items.weapon.sedna.Crosshair; -import com.hbm.lib.HbmCollection.EnumGunManufacturer; -import com.hbm.render.anim.AnimationEnums.GunAnimation; -import com.hbm.render.anim.BusAnimation; - -import net.minecraft.util.ResourceLocation; - -@Deprecated -public class GunConfiguration implements Cloneable { - - /** - * alt function restrictions: - * alt can not be reloaded (reload type of 0, ammo cap of 0) - * alt cooldown and main cooldown are shared (alt cooldown will almoast always be greater or equal) - * alt is always the lower priority, mouse2 will be canceled then mouse1 is activated at the same time - * restrictions must be applied in gun's logic, mechanism may be dysfunctional if these rules are ignored - */ - - //amount of ticks between each bullet - public int rateOfFire; - //amount of bullets fired per delay passed - public int roundsPerCycle; - /** Amount of rounds per burst, irrelevant if not a burst fire weapon**/ - public int roundsPerBurst; - //0 = normal, 1 = release, 2 = both - public int gunMode; - //0 = manual, 1 = automatic - public int firingMode; - //weapon won't fire after weapon breaks (main only) - public int durability; - - //animations! - public HashMap animations = new HashMap(); - //lazy-ish loading for animations, required for loading animations from ResourceManager, since that occurs after we've initialised the guns - public Consumer loadAnimations; - public boolean animationsLoaded = false; - //when sneaking, disables crosshair and centers the bullet spawn point - public boolean hasSights; - //does this weapon behave like fully sick old-school boomer shooters - public boolean isCentered; - //texture overlay when sneaking - public ResourceLocation scopeTexture; - - //duration of every animation cycle, used also for how quickly a burst fire rifle can fire - public int firingDuration; - //sound path to the shooting sound - public String firingSound = ""; - public String firingSoundEmpty = null; - public float firingVolume = 1.0F; - public float firingPitch = 1.0F; - //how long the reload animation will play - //MUST BE GREATER THAN ZERO ! ! ! - public int reloadDuration; - public int emptyReloadAdditionalDuration; - //sound path to the reload sound - public String reloadSound = ""; - public String reloadSoundEmpty = null; - //whether the reload sound should be played at the beginning or at the end of the reload - public boolean reloadSoundEnd = true; - public String equipSound = ""; - - //how much ammo the clip can hold, 0 if drawn from inventory - public int ammoCap; - //0 does not allow direct reload, 1 is full clip, 2 is single bullet - public int reloadType; - // If the animations are designed to be sequential, the last frame will be held until the next anmiation starts - public boolean reloadAnimationsSequential = false; - //whether or not the infinity enchantment should work - public boolean allowsInfinity; - //whether the ammo count should be displayed - public boolean showAmmo = true; - - //for electrically powered weapons: - //the Maximum capacity of the gun - public long maxCharge; - //the rate at which the gun is charged - public long chargeRate; - //how much energy is discharged per shot - public long dischargePerShot; - - public String name = ""; - public EnumGunManufacturer manufacturer = EnumGunManufacturer.NONE; - public List comment = new ArrayList(); - - //bullet configs for main and alt fire - public List config = new ArrayList(); - - //crosshair - public Crosshair crosshair; - - //casing eject behavior - public CasingEjector ejector = null; - - public static final int MODE_NORMAL = 0; - public static final int MODE_RELEASE = 1; - public static final int MODE_BOTH = 1; - - public static final int FIRE_MANUAL = 0; - public static final int FIRE_AUTO = 1; - public static final int FIRE_BURST = 2; - - public static final int RELOAD_NONE = 0; - public static final int RELOAD_FULL = 1; - public static final int RELOAD_SINGLE = 2; - - public static final String RSOUND_REVOLVER = "hbm:weapon.revolverReload"; - public static final String RSOUND_RIFLE = ""; - public static final String RSOUND_MAG = "hbm:weapon.magReload"; - public static final String RSOUND_MAG_BOLT = "hbm:weapon.magReloadBolt"; - public static final String RSOUND_SHOTGUN = "hbm:weapon.shotgunReload"; - public static final String RSOUND_LAUNCHER = "hbm:weapon.rpgReload"; - public static final String RSOUND_GRENADE = "hbm:weapon.hkReload"; - public static final String RSOUND_GRENADE_NEW = "hbm:weapon.glReload"; - public static final String RSOUND_FATMAN = "hbm:weapon.fatmanReload"; - -} diff --git a/src/main/java/com/hbm/items/weapon/ItemCrucible.java b/src/main/java/com/hbm/items/weapon/ItemCrucible.java index 3945e52cc..09c1e5453 100644 --- a/src/main/java/com/hbm/items/weapon/ItemCrucible.java +++ b/src/main/java/com/hbm/items/weapon/ItemCrucible.java @@ -1,7 +1,6 @@ package com.hbm.items.weapon; import java.util.List; -import java.util.Random; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; 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 10745b90d..661b4185a 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 @@ -48,6 +48,8 @@ public class ConfettiUtil { if(entity instanceof EntitySkeleton) return; if(entity instanceof EntitySlime) return; + SkeletonCreator.composeEffectGib(entity.worldObj, entity, 0.25F); + NBTTagCompound vdat = new NBTTagCompound(); vdat.setString("type", "giblets"); vdat.setInteger("ent", entity.getEntityId()); diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index 2d51ccd49..a1c226305 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -41,7 +41,6 @@ import com.hbm.handler.HbmKeybinds; import com.hbm.handler.HbmKeybinds.EnumKeybind; import com.hbm.handler.ImpactWorldHandler; import com.hbm.handler.imc.IMCHandlerNHNEI; -import com.hbm.items.IAnimatedItem; import com.hbm.items.ModItems; import com.hbm.items.weapon.sedna.factory.GunFactoryClient; import com.hbm.lib.RefStrings; @@ -49,10 +48,6 @@ import com.hbm.particle.*; import com.hbm.particle.helper.ParticleCreators; import com.hbm.particle.psys.engine.EventHandlerParticleEngine; import com.hbm.qmaw.QMAWLoader; -import com.hbm.render.anim.BusAnimation; -import com.hbm.render.anim.BusAnimationSequence; -import com.hbm.render.anim.HbmAnimations; -import com.hbm.render.anim.HbmAnimations.Animation; import com.hbm.render.block.*; import com.hbm.render.entity.RenderEmpty; import com.hbm.render.entity.effect.*; diff --git a/src/main/java/com/hbm/particle/ParticleSkeleton.java b/src/main/java/com/hbm/particle/ParticleSkeleton.java index a3eb3f4c9..37f8f5cf1 100644 --- a/src/main/java/com/hbm/particle/ParticleSkeleton.java +++ b/src/main/java/com/hbm/particle/ParticleSkeleton.java @@ -26,8 +26,13 @@ public class ParticleSkeleton extends EntityFX { public static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/particle/skeleton.png"); public static final ResourceLocation texture_ext = new ResourceLocation(RefStrings.MODID + ":textures/particle/skoilet.png"); + public static final ResourceLocation texture_blood = new ResourceLocation(RefStrings.MODID + ":textures/particle/skeleton_blood.png"); + public static final ResourceLocation texture_blood_ext = new ResourceLocation(RefStrings.MODID + ":textures/particle/skoilet_blood.png"); public static final IModelCustom skeleton = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/effect/skeleton.obj"), false).asVBO(); protected EnumSkeletonType type; + + public ResourceLocation useTexture; + public ResourceLocation useTextureExt; private float momentumYaw; private float momentumPitch; @@ -50,6 +55,18 @@ public class ParticleSkeleton extends EntityFX { this.momentumPitch = rand.nextFloat() * 5 * (rand.nextBoolean() ? 1 : -1); this.momentumYaw = rand.nextFloat() * 5 * (rand.nextBoolean() ? 1 : -1); + + this.useTexture = texture; + this.useTextureExt = texture_ext; + } + + public ParticleSkeleton makeGib() { + this.initialDelay = -2; // skip post delay motion randomization + this.useTexture = texture_blood; + this.useTextureExt = texture_blood_ext; + this.particleGravity = 0.04F; + this.particleMaxAge = 600 + rand.nextInt(20); + return this; } @Override @@ -139,16 +156,16 @@ public class ParticleSkeleton extends EntityFX { switch(type) { case SKULL: - this.textureManager.bindTexture(texture); + this.textureManager.bindTexture(useTexture); skeleton.renderPart("Skull"); break; case TORSO: - this.textureManager.bindTexture(texture); + this.textureManager.bindTexture(useTexture); skeleton.renderPart("Torso"); break; case LIMB: - this.textureManager.bindTexture(texture); + this.textureManager.bindTexture(useTexture); skeleton.renderPart("Limb"); break; case SKULL_VILLAGER: - this.textureManager.bindTexture(texture_ext); + this.textureManager.bindTexture(useTextureExt); skeleton.renderPart("SkullVillager"); break; } diff --git a/src/main/java/com/hbm/particle/helper/SkeletonCreator.java b/src/main/java/com/hbm/particle/helper/SkeletonCreator.java index 98018bd17..059ae65a8 100644 --- a/src/main/java/com/hbm/particle/helper/SkeletonCreator.java +++ b/src/main/java/com/hbm/particle/helper/SkeletonCreator.java @@ -33,20 +33,31 @@ public class SkeletonCreator implements IParticleCreator { public static HashMap> skullanizer = new HashMap(); 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); } + + public static void composeEffectGib(World world, Entity toSkeletonize, float force) { + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "skeleton"); + data.setInteger("entityID", toSkeletonize.getEntityId()); + data.setFloat("brightness", 1F); + data.setFloat("force", force); + data.setBoolean("gib", true); + IParticleCreator.sendPacket(world, toSkeletonize.posX, toSkeletonize.posY, toSkeletonize.posZ, 100, data); + } @Override @SideOnly(Side.CLIENT) public void makeParticle(World world, EntityPlayer player, TextureManager texman, Random rand, double x, double y, double z, NBTTagCompound data) { if(skullanizer.isEmpty()) init(); - + + boolean gib = data.getBoolean("gib"); + float force = data.getFloat("force"); int entityID = data.getInteger("entityID"); Entity entity = world.getEntityByID(entityID); if(!(entity instanceof EntityLivingBase)) return; @@ -61,9 +72,16 @@ public class SkeletonCreator implements IParticleCreator { if(bonealizer != null) { BoneDefinition[] bones = bonealizer.apply(living); for(BoneDefinition bone : bones) { + if(gib && rand.nextBoolean()) continue; 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; + if(gib) { + skeleton.makeGib(); + skeleton.motionX = rand.nextGaussian() * force; + skeleton.motionY = (rand.nextGaussian() + 1) * force; + skeleton.motionZ = rand.nextGaussian() * force; + } Minecraft.getMinecraft().effectRenderer.addEffect(skeleton); } } @@ -161,7 +179,7 @@ public class SkeletonCreator implements IParticleCreator { skullanizer.put(EntityDummy.class.getSimpleName(), BONES_DUMMY); //techguns compat, for some reason - //not alwayss accurate because of variable arm position, but better than nothing + //not always accurate because of variable arm position, but better than nothing skullanizer.put("ArmySoldier", BONES_ZOMBIE); skullanizer.put("PsychoSteve", BONES_ZOMBIE); skullanizer.put("SkeletonSoldier", BONES_ZOMBIE); diff --git a/src/main/resources/assets/hbm/textures/particle/skeleton_blood.png b/src/main/resources/assets/hbm/textures/particle/skeleton_blood.png new file mode 100644 index 000000000..1ecde389e Binary files /dev/null and b/src/main/resources/assets/hbm/textures/particle/skeleton_blood.png differ diff --git a/src/main/resources/assets/hbm/textures/particle/skoilet_blood.png b/src/main/resources/assets/hbm/textures/particle/skoilet_blood.png new file mode 100644 index 000000000..bd714fb71 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/particle/skoilet_blood.png differ