From 8d07e3458370571a7ce5fc33ba8241b971813f92 Mon Sep 17 00:00:00 2001 From: Bob Date: Sat, 18 Dec 2021 23:14:21 +0100 Subject: [PATCH] patched up MG42 --- .../java/com/hbm/entity/mob/EntityGhost.java | 4 ++- .../com/hbm/handler/BossSpawnHandler.java | 19 ++++++++++++ .../hbm/handler/guncfg/Gun50BMGFactory.java | 28 ++++++++++++++---- src/main/java/com/hbm/main/MainRegistry.java | 1 + .../hbm/render/entity/mob/RenderGhost.java | 13 ++++++++ .../item/weapon/ItemRenderWeaponFFMG42.java | 25 +++++++++++++--- src/main/resources/assets/hbm/lang/de_DE.lang | 2 +- src/main/resources/assets/hbm/lang/en_US.lang | 2 +- .../assets/hbm/textures/entity/ghost.png | Bin 0 -> 1864 bytes 9 files changed, 82 insertions(+), 12 deletions(-) create mode 100644 src/main/resources/assets/hbm/textures/entity/ghost.png diff --git a/src/main/java/com/hbm/entity/mob/EntityGhost.java b/src/main/java/com/hbm/entity/mob/EntityGhost.java index e9040294f..658681df8 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGhost.java +++ b/src/main/java/com/hbm/entity/mob/EntityGhost.java @@ -21,6 +21,8 @@ public class EntityGhost extends EntityCreature { this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIWander(this, 1.0D)); this.tasks.addTask(2, new EntityAILookIdle(this)); + + this.renderDistanceWeight *= 10; } @Override @@ -35,7 +37,7 @@ public class EntityGhost extends EntityCreature { super.onUpdate(); if(!worldObj.isRemote) { - double despawnRange = 100; + double despawnRange = 50; List players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.boundingBox.expand(despawnRange, despawnRange, despawnRange)); if(!players.isEmpty()) this.setDead(); diff --git a/src/main/java/com/hbm/handler/BossSpawnHandler.java b/src/main/java/com/hbm/handler/BossSpawnHandler.java index fed9a282d..bcfe40033 100644 --- a/src/main/java/com/hbm/handler/BossSpawnHandler.java +++ b/src/main/java/com/hbm/handler/BossSpawnHandler.java @@ -6,9 +6,11 @@ import com.hbm.config.GeneralConfig; import com.hbm.config.MobConfig; import com.hbm.config.WorldConfig; import com.hbm.entity.mob.EntityFBI; +import com.hbm.entity.mob.EntityGhost; import com.hbm.entity.mob.EntityMaskMan; import com.hbm.entity.mob.EntityRADBeast; import com.hbm.entity.projectile.EntityMeteor; +import com.hbm.extprop.HbmLivingProps; import com.hbm.items.ModItems; import com.hbm.main.MainRegistry; import com.hbm.util.ContaminationUtil; @@ -118,6 +120,23 @@ public class BossSpawnHandler { if(GeneralConfig.enableMeteorStrikes && !world.isRemote) { meteorUpdate(world); } + + if(world.getTotalWorldTime() % 20 == 0) { + + if(world.rand.nextInt(5) == 0 && !world.playerEntities.isEmpty() && world.provider.isSurfaceWorld()) { + + EntityPlayer player = (EntityPlayer) world.playerEntities.get(world.rand.nextInt(world.playerEntities.size())); + + if(HbmLivingProps.getDigamma(player) > 0) { + Vec3 vec = Vec3.createVectorHelper(75, 0, 0); + vec.rotateAroundY((float)(Math.PI * 2) * world.rand.nextFloat()); + double spawnX = player.posX + vec.xCoord + world.rand.nextGaussian(); + double spawnZ = player.posZ + vec.zCoord + world.rand.nextGaussian(); + double spawnY = world.getHeightValue((int)spawnX, (int)spawnZ); + trySpawn(world, (float)spawnX, (float)spawnY, (float)spawnZ, new EntityGhost(world)); + } + } + } } private static void trySpawn(World world, float x, float y, float z, EntityLiving e) { diff --git a/src/main/java/com/hbm/handler/guncfg/Gun50BMGFactory.java b/src/main/java/com/hbm/handler/guncfg/Gun50BMGFactory.java index e56a4a969..cde95e131 100644 --- a/src/main/java/com/hbm/handler/guncfg/Gun50BMGFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/Gun50BMGFactory.java @@ -12,6 +12,10 @@ import com.hbm.items.ModItems; import com.hbm.packet.AuxParticlePacketNT; import com.hbm.packet.PacketDispatcher; import com.hbm.potion.HbmPotion; +import com.hbm.render.anim.BusAnimation; +import com.hbm.render.anim.BusAnimationKeyframe; +import com.hbm.render.anim.BusAnimationSequence; +import com.hbm.render.anim.HbmAnimations.AnimType; import com.hbm.render.util.RenderScreenOverlay.Crosshair; import com.hbm.util.ContaminationUtil; import com.hbm.util.ContaminationUtil.ContaminationType; @@ -29,7 +33,7 @@ public class Gun50BMGFactory { GunConfiguration config = new GunConfiguration(); - config.rateOfFire = 6; + config.rateOfFire = 1; config.roundsPerCycle = 1; config.gunMode = GunConfiguration.MODE_NORMAL; config.firingMode = GunConfiguration.FIRE_AUTO; @@ -38,14 +42,28 @@ public class Gun50BMGFactory { config.ammoCap = 50; config.reloadType = GunConfiguration.RELOAD_FULL; config.allowsInfinity = true; - config.crosshair = Crosshair.L_BOX; - config.durability = 2000; + config.crosshair = Crosshair.NONE; + config.durability = 15 * 50 * 10; //15 * capacity * default wear config.reloadSound = GunConfiguration.RSOUND_MAG; config.firingSound = "hbm:weapon.calShoot"; config.reloadSoundEnd = false; - config.name = "Maxim gun"; - config.manufacturer = "Hiram Maxim"; + config.animations.put(AnimType.CYCLE, new BusAnimation() + .addBus("RECOIL", new BusAnimationSequence() + .addKeyframe(new BusAnimationKeyframe(1, 0, 0, 25)) + .addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75)) + ) + ); + + config.animations.put(AnimType.RELOAD, new BusAnimation() + .addBus("MAG", new BusAnimationSequence() + .addKeyframe(new BusAnimationKeyframe(0, -1, 0, 500)) + .addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500)) + ) + ); + + config.name = "Universal-Maschinengewehr Modell 42 - .50 Mod"; + config.manufacturer = "Wilhelm-Gustloff-Werke"; config.config = new ArrayList(); config.config.add(BulletConfigSyncingUtil.BMG50_NORMAL); diff --git a/src/main/java/com/hbm/main/MainRegistry.java b/src/main/java/com/hbm/main/MainRegistry.java index f40000485..02929538e 100644 --- a/src/main/java/com/hbm/main/MainRegistry.java +++ b/src/main/java/com/hbm/main/MainRegistry.java @@ -470,6 +470,7 @@ public class MainRegistry { EntityRegistry.registerModEntity(EntityMissileVolcano.class, "entity_missile_volcano", 159, this, 1000, 1, true); EntityRegistry.registerModEntity(EntityMissileShuttle.class, "entity_missile_shuttle", 160, this, 1000, 1, true); EntityRegistry.registerModEntity(EntityZirnoxDebris.class, "entity_zirnox_debris", 161, this, 1000, 1, true); + EntityRegistry.registerModEntity(EntityGhost.class, "entity_ntm_ghost", 162, this, 1000, 1, true); EntityRegistry.registerGlobalEntityID(EntityNuclearCreeper.class, "entity_mob_nuclear_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x204131, 0x75CE00); EntityRegistry.registerGlobalEntityID(EntityTaintedCreeper.class, "entity_mob_tainted_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x813b9b, 0xd71fdd); diff --git a/src/main/java/com/hbm/render/entity/mob/RenderGhost.java b/src/main/java/com/hbm/render/entity/mob/RenderGhost.java index 11dd78995..98c1484a9 100644 --- a/src/main/java/com/hbm/render/entity/mob/RenderGhost.java +++ b/src/main/java/com/hbm/render/entity/mob/RenderGhost.java @@ -1,9 +1,12 @@ package com.hbm.render.entity.mob; +import org.lwjgl.opengl.GL11; + import com.hbm.entity.mob.EntityGhost; import com.hbm.lib.RefStrings; import com.hbm.render.model.ModelSiegeZombie; +import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.entity.RenderBiped; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; @@ -28,4 +31,14 @@ public class RenderGhost extends RenderBiped { protected ResourceLocation getEntityTexture(EntityGhost entity) { return new ResourceLocation(RefStrings.MODID + ":textures/entity/ghost.png"); } + + @Override + public void doRender(EntityLiving p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { + GL11.glEnable(GL11.GL_BLEND); + GL11.glAlphaFunc(GL11.GL_GREATER, 0); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + super.doRender(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + GL11.glDisable(GL11.GL_BLEND); + } } diff --git a/src/main/java/com/hbm/render/item/weapon/ItemRenderWeaponFFMG42.java b/src/main/java/com/hbm/render/item/weapon/ItemRenderWeaponFFMG42.java index 2ab8a5dd6..880faa2b5 100644 --- a/src/main/java/com/hbm/render/item/weapon/ItemRenderWeaponFFMG42.java +++ b/src/main/java/com/hbm/render/item/weapon/ItemRenderWeaponFFMG42.java @@ -3,12 +3,11 @@ package com.hbm.render.item.weapon; import org.lwjgl.opengl.GL11; import com.hbm.main.ResourceManager; +import com.hbm.render.anim.HbmAnimations; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; import net.minecraftforge.client.IItemRenderer; -import net.minecraftforge.client.IItemRenderer.ItemRenderType; -import net.minecraftforge.client.IItemRenderer.ItemRendererHelper; public class ItemRenderWeaponFFMG42 implements IItemRenderer { @@ -38,8 +37,10 @@ public class ItemRenderWeaponFFMG42 implements IItemRenderer { GL11.glPushMatrix(); GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glShadeModel(GL11.GL_SMOOTH); Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.mg42_tex); + boolean renderMag = true; switch(type) { @@ -51,6 +52,21 @@ public class ItemRenderWeaponFFMG42 implements IItemRenderer { GL11.glTranslated(-0.125, 0, 0); GL11.glScaled(s0, s0, s0); + double[] recoil = HbmAnimations.getRelevantTransformation("RECOIL"); + GL11.glTranslated(recoil[0] * 0.25, 0, 0); + + double[] reload = HbmAnimations.getRelevantTransformation("MAG"); + GL11.glRotated(reload[1] * 15, 1, 0, 0); + + GL11.glPushMatrix(); + + GL11.glRotated(reload[1] * -45, 1, 0, 0); + GL11.glTranslated(0, reload[1] * 0.25, -reload[1]); + ResourceManager.mg42.renderPart("Mag"); + GL11.glPopMatrix(); + + renderMag = false; + break; case EQUIPPED: @@ -86,8 +102,9 @@ public class ItemRenderWeaponFFMG42 implements IItemRenderer { default: break; } - GL11.glShadeModel(GL11.GL_SMOOTH); - ResourceManager.mg42.renderAll(); + ResourceManager.mg42.renderPart("Gun"); + if(renderMag) ResourceManager.mg42.renderPart("Mag"); + GL11.glShadeModel(GL11.GL_FLAT); GL11.glPopMatrix(); diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index bb878fce0..ea964c206 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -1354,7 +1354,7 @@ item.gun_bolt_action_green.name=Dream-Repetiergewehr (Grün) item.gun_bolt_action_saturnite.name=Saturnitbüchse item.gun_bolter.name=Boltergewehr item.gun_bolter_digamma.name=Digammagewehr -item.gun_calamity.name=Calamity +item.gun_calamity.name=Knochensäge item.gun_calamity_ammo.name=.50 BMG Patrone (LEGACY) item.gun_calamity_dual.name=Sattelkanone item.gun_cryolator.name=Der Cryolator diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 5efbd8e52..d8c2f23ca 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -1429,7 +1429,7 @@ item.gun_bolt_action_green.name=Dream Bolt-Action Rifle (Green) item.gun_bolt_action_saturnite.name=Saturnite Rifle item.gun_bolter.name=Bolter item.gun_bolter_digamma.name=Digamma Gun -item.gun_calamity.name=Calamity +item.gun_calamity.name=Buzzsaw item.gun_calamity_ammo.name=.50 BMG Round (LEGACY) item.gun_calamity_dual.name=Saddle Gun item.gun_cryolator.name=The Cryolator diff --git a/src/main/resources/assets/hbm/textures/entity/ghost.png b/src/main/resources/assets/hbm/textures/entity/ghost.png new file mode 100644 index 0000000000000000000000000000000000000000..65e248efe2c7c4a0971ae354f0334de19c8fc066 GIT binary patch literal 1864 zcmV-O2ejrtAq8%^aY5=G?kL(@g<1tsXuA0j5~SU=WZ5&%%ro=V` zSALi;JpcHeFA%;h#P8FWns+*etJh*>*Y&%e61DWF)sX~xp{cu6;NHi*XtjfL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