diff --git a/src/main/java/com/hbm/entity/projectile/EntityBulletBeamBase.java b/src/main/java/com/hbm/entity/projectile/EntityBulletBeamBase.java index 1d4e2bfe9..aeee12735 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityBulletBeamBase.java +++ b/src/main/java/com/hbm/entity/projectile/EntityBulletBeamBase.java @@ -188,8 +188,12 @@ public class EntityBulletBeamBase extends Entity implements IEntityAdditionalSpa @Override public void writeSpawnData(ByteBuf buf) { buf.writeDouble(beamLength); + buf.writeFloat(rotationYaw); + buf.writeFloat(rotationPitch); } @Override public void readSpawnData(ByteBuf buf) { this.beamLength = buf.readDouble(); + this.rotationYaw = buf.readFloat(); + this.rotationPitch = buf.readFloat(); } } diff --git a/src/main/java/com/hbm/items/weapon/sedna/GunConfig.java b/src/main/java/com/hbm/items/weapon/sedna/GunConfig.java index 8b0e32701..90f21ddf5 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/GunConfig.java +++ b/src/main/java/com/hbm/items/weapon/sedna/GunConfig.java @@ -14,6 +14,7 @@ import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.HbmAnimations.AnimType; import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; /** * Despite how complicated the GunConfig looks, it actually only exists to hold together a bunch of fields. Everything else is infrastructure for getting and setting. @@ -33,6 +34,7 @@ public class GunConfig { public static final String O_CROSSHAIR = "O_CROSSHAIR"; public static final String B_HIDECROSSHAIR = "B_HIDECROSSHAIR"; public static final String B_RELOADANIMATIONSEQUENTIAL = "B_RELOADANIMATIONSEQUENTIAL"; + public static final String O_SCOPETEXTURE = "O_SCOPETEXTURE"; public static final String CON_SMOKE = "CON_SMOKE"; public static final String CON_ORCHESTRA = "CON_ORCHESTRA"; public static final String CON_ONPRESSPRIMARY = "CON_ONPRESSPRIMARY"; @@ -58,6 +60,7 @@ public class GunConfig { protected Crosshair crosshair_DNA; protected boolean hideCrosshair_DNA = true; protected boolean reloadAnimationsSequential_DNA; + protected ResourceLocation scopeTexture_DNA; /** Handles smoke clientside */ protected BiConsumer smokeHandler_DNA; /** This piece only triggers during reloads, playing sounds depending on the reload's progress making reload sounds easier and synced to animations */ @@ -88,6 +91,7 @@ public class GunConfig { public Crosshair getCrosshair(ItemStack stack) { return WeaponUpgradeManager.eval(crosshair_DNA, stack, O_CROSSHAIR, this); } public boolean getHideCrosshair(ItemStack stack) { return WeaponUpgradeManager.eval(hideCrosshair_DNA, stack, B_HIDECROSSHAIR, this); } public boolean getReloadAnimSequential(ItemStack stack) { return WeaponUpgradeManager.eval(reloadAnimationsSequential_DNA, stack, B_RELOADANIMATIONSEQUENTIAL, this); } + public ResourceLocation getScopeTexture(ItemStack stack) { return WeaponUpgradeManager.eval(scopeTexture_DNA, stack, O_SCOPETEXTURE, this); } public BiConsumer getSmokeHandler(ItemStack stack) { return WeaponUpgradeManager.eval(smokeHandler_DNA, stack, CON_SMOKE, this); } public BiConsumer getOrchestra(ItemStack stack) { return WeaponUpgradeManager.eval(this.orchestra_DNA, stack, CON_ORCHESTRA, this); } @@ -108,14 +112,15 @@ public class GunConfig { /* SETTERS */ - public GunConfig rec(Receiver... receivers) { this.receivers_DNA = receivers; return this; } - public GunConfig dura(float dura) { this.durability_DNA = dura; return this; } - public GunConfig draw(int draw) { this.drawDuration_DNA = draw; return this; } - public GunConfig inspect(int inspect) { this.inspectDuration_DNA = inspect; return this; } - public GunConfig inspectCancel(boolean flag) { this.inspectCancel_DNA = flag; return this; } - public GunConfig crosshair(Crosshair crosshair) { this.crosshair_DNA = crosshair; return this; } - public GunConfig hideCrosshair(boolean flag) { this.hideCrosshair_DNA = flag; return this; } - public GunConfig reloadSequential(boolean flag) { this.reloadAnimationsSequential_DNA = flag; return this; } + public GunConfig rec(Receiver... receivers) { this.receivers_DNA = receivers; return this; } + public GunConfig dura(float dura) { this.durability_DNA = dura; return this; } + public GunConfig draw(int draw) { this.drawDuration_DNA = draw; return this; } + public GunConfig inspect(int inspect) { this.inspectDuration_DNA = inspect; return this; } + public GunConfig inspectCancel(boolean flag) { this.inspectCancel_DNA = flag; return this; } + public GunConfig crosshair(Crosshair crosshair) { this.crosshair_DNA = crosshair; return this; } + public GunConfig hideCrosshair(boolean flag) { this.hideCrosshair_DNA = flag; return this; } + public GunConfig reloadSequential(boolean flag) { this.reloadAnimationsSequential_DNA = flag; return this; } + public GunConfig scopeTexture(ResourceLocation tex) { this.scopeTexture_DNA = tex; return this; } public GunConfig smoke(BiConsumer smoke) { this.smokeHandler_DNA = smoke; return this; } public GunConfig orchestra(BiConsumer orchestra) { this.orchestra_DNA = orchestra; return this; } diff --git a/src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java b/src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java index c6a3acab4..a926de13b 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java +++ b/src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java @@ -23,6 +23,7 @@ import com.hbm.util.EnumUtil; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -343,6 +344,8 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei bottomOffset += component.getComponentHeight(player, stack); } } + + Minecraft.getMinecraft().renderEngine.bindTexture(Gui.icons); } public static class SmokeNode { diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactoryClient.java b/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactoryClient.java index ca70b95ca..09f753aa5 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactoryClient.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactoryClient.java @@ -8,6 +8,7 @@ import static com.hbm.items.weapon.sedna.factory.XFactory40mm.*; import static com.hbm.items.weapon.sedna.factory.XFactory44.*; import static com.hbm.items.weapon.sedna.factory.XFactory50.*; import static com.hbm.items.weapon.sedna.factory.XFactory556mm.*; +import static com.hbm.items.weapon.sedna.factory.XFactory75Bolt.*; import static com.hbm.items.weapon.sedna.factory.XFactory762mm.*; import static com.hbm.items.weapon.sedna.factory.XFactory9mm.*; import static com.hbm.items.weapon.sedna.factory.XFactoryAccelerator.*; @@ -120,6 +121,10 @@ public class GunFactoryClient { bmg50_jhp.setRenderer(LegoClient.RENDER_STANDARD_BULLET); bmg50_ap.setRenderer(LegoClient.RENDER_AP_BULLET); bmg50_du.setRenderer(LegoClient.RENDER_DU_BULLET); + + b75.setRenderer(LegoClient.RENDER_AP_BULLET); + b75_inc.setRenderer(LegoClient.RENDER_AP_BULLET); + b75_exp.setRenderer(LegoClient.RENDER_EXPRESS_BULLET); g12_bp.setRenderer(LegoClient.RENDER_STANDARD_BULLET); g12_bp_magnum.setRenderer(LegoClient.RENDER_STANDARD_BULLET); diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/Orchestras.java b/src/main/java/com/hbm/items/weapon/sedna/factory/Orchestras.java index b98d085bb..e029e28b5 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/Orchestras.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/Orchestras.java @@ -897,9 +897,14 @@ public class Orchestras { if(entity.worldObj.isRemote) return; AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); + boolean aiming = ItemGunBaseNT.getIsAiming(stack); if(ClientConfig.GUN_ANIMS_LEGACY.get()) { if(type == AnimType.CYCLE) { + if(timer == 0) { + SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory); + if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, aiming ? 0.125 : 0.125, aiming ? -0.125 : -0.25, aiming ? -0.125 : -0.25D, 0, 0.18, -0.12, 0.01, casing.getName()); + } if(timer == 40) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 0.25F, 1.25F); } if(type == AnimType.CYCLE_DRY) { @@ -922,6 +927,10 @@ public class Orchestras { } } else { if(type == AnimType.CYCLE) { + if(timer == 0) { + SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory); + if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, aiming ? 0.125 : 0.25, aiming ? -0.125 : -0.25, aiming ? -0.125 : -0.25D, 0, 0.18, -0.12, 0.01, casing.getName()); + } if(timer == 40) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 0.25F, 1.25F); } if(type == AnimType.CYCLE_DRY) { @@ -1121,4 +1130,25 @@ public class Orchestras { if(timer == 25) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverCock", 1F, 0.75F); } }; + + public static BiConsumer ORCHESTRA_BOLTER = (stack, ctx) -> { + EntityLivingBase entity = ctx.entity; + if(entity.worldObj.isRemote) return; + AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); + int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); + boolean aiming = ItemGunBaseNT.getIsAiming(stack); + + if(type == AnimType.CYCLE) { + if(timer == 1) { + SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory); + if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.5, aiming ? 0 : -0.125, aiming ? -0.0625 : -0.25D, 0, 0.18, -0.12, 0.01, casing.getName()); + } + } + + if(type == AnimType.RELOAD) { + + if(timer == 5) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magRemove", 1F, 1F); + if(timer == 26) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magInsert", 1F, 1F); + } + }; } diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory44.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory44.java index 32871feb9..48ad36d65 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory44.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory44.java @@ -15,6 +15,7 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineSingleReload; +import com.hbm.lib.RefStrings; import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing.CasingType; import com.hbm.render.anim.BusAnimation; @@ -23,9 +24,12 @@ import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.HbmAnimations.AnimType; import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; public class XFactory44 { + public static final ResourceLocation scope_lilmac = new ResourceLocation(RefStrings.MODID, "textures/misc/scope_44.png"); + public static BulletConfig m44_bp; public static BulletConfig m44_sp; public static BulletConfig m44_fmj; @@ -73,7 +77,7 @@ public class XFactory44 { .anim(LAMBDA_NOPIP_ANIMS).orchestra(Orchestras.ORCHESTRA_NOPIP) ).setUnlocalizedName("gun_heavy_revolver"); ModItems.gun_heavy_revolver_lilmac = new ItemGunBaseNT(WeaponQuality.LEGENDARY, new GunConfig() - .dura(31_000).draw(10).inspect(23).crosshair(Crosshair.L_CLASSIC).smoke(Lego.LAMBDA_STANDARD_SMOKE) + .dura(31_000).draw(10).inspect(23).crosshair(Crosshair.L_CLASSIC).scopeTexture(scope_lilmac).smoke(Lego.LAMBDA_STANDARD_SMOKE) .rec(new Receiver(0) .dmg(10F).delay(14).reload(46).jam(23).sound("hbm:weapon.44Shoot", 1.0F, 1.0F) .mag(new MagazineFullReload(0, 6).addConfigs(m44_equestrian, m44_bp, m44_sp, m44_fmj, m44_jhp, m44_ap, m44_express)) diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory75Bolt.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory75Bolt.java index 1bf7be2bc..5caea7441 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory75Bolt.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory75Bolt.java @@ -45,7 +45,7 @@ public class XFactory75Bolt { .offset(1, -0.0625 * 2.5, -0.25D) .setupStandardFire().recoil(Lego.LAMBDA_STANDARD_RECOIL)) .setupStandardConfiguration() - .anim(LAMBDA_BOLTER_ANIMS).orchestra(Orchestras.ORCHESTRA_GREASEGUN) + .anim(LAMBDA_BOLTER_ANIMS).orchestra(Orchestras.ORCHESTRA_BOLTER) ).setUnlocalizedName("gun_bolter"); } diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryEnergy.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryEnergy.java index 58a345ae7..3b2104f0d 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryEnergy.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryEnergy.java @@ -17,6 +17,7 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; import com.hbm.items.weapon.sedna.mags.MagazineBelt; import com.hbm.items.weapon.sedna.mags.MagazineFullReload; +import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; import com.hbm.packet.PacketDispatcher; import com.hbm.packet.toclient.AuxParticlePacketNT; @@ -32,9 +33,12 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; public class XFactoryEnergy { + + public static final ResourceLocation scope_luna = new ResourceLocation(RefStrings.MODID, "textures/misc/scope_luna.png"); public static BulletConfig energy_tesla; public static BulletConfig energy_tesla_overcharge; @@ -107,7 +111,7 @@ public class XFactoryEnergy { ).setUnlocalizedName("gun_tesla_cannon"); ModItems.gun_lasrifle = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig() - .dura(2_000).draw(10).inspect(26).reloadSequential(true).crosshair(Crosshair.CIRCLE) + .dura(2_000).draw(10).inspect(26).reloadSequential(true).crosshair(Crosshair.CIRCLE).scopeTexture(scope_luna) .rec(new Receiver(0) .dmg(15F).delay(8).reload(44).jam(36).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F) .mag(new MagazineFullReload(0, 24).addConfigs(energy_las, energy_las_overcharge, energy_las_blacklightning)) diff --git a/src/main/java/com/hbm/main/ModEventHandlerClient.java b/src/main/java/com/hbm/main/ModEventHandlerClient.java index f7f641b3c..fbe716233 100644 --- a/src/main/java/com/hbm/main/ModEventHandlerClient.java +++ b/src/main/java/com/hbm/main/ModEventHandlerClient.java @@ -46,6 +46,7 @@ import com.hbm.items.machine.ItemDepletedFuel; import com.hbm.items.machine.ItemFluidDuct; import com.hbm.items.machine.ItemRBMKPellet; import com.hbm.items.weapon.ItemGunBase; +import com.hbm.items.weapon.sedna.GunConfig; import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.lib.Library; import com.hbm.lib.RefStrings; @@ -360,6 +361,15 @@ public class ModEventHandlerClient { } } + if(held != null && held.getItem() instanceof ItemGunBaseNT && ItemGunBaseNT.aimingProgress == ItemGunBaseNT.prevAimingProgress && ItemGunBaseNT.aimingProgress == 1F && event.type == event.type.HOTBAR) { + ItemGunBaseNT gun = (ItemGunBaseNT) held.getItem(); + GunConfig cfg = gun.getConfig(held, 0); + if(cfg.getScopeTexture(held) != null) { + ScaledResolution resolution = event.resolution; + RenderScreenOverlay.renderScope(resolution, cfg.getScopeTexture(held)); + } + } + /// HANDLE FSB HUD /// ItemStack helmet = player.inventory.armorInventory[3]; diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderBolter.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderBolter.java index 4f97ce3c2..ba3af6235 100644 --- a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderBolter.java +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderBolter.java @@ -102,7 +102,7 @@ public class ItemRenderBolter extends ItemRenderWeaponBase { GL11.glScaled(scale, scale, scale); GL11.glRotated(25, 1, 0, 0); GL11.glRotated(45, 0, 1, 0); - GL11.glTranslated(-0.5, -0.5, 0); + GL11.glTranslated(-0.25, -0.5, 0); } @Override diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderG3.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderG3.java index 34185f273..5edb45d39 100644 --- a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderG3.java +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderG3.java @@ -27,7 +27,7 @@ public class ItemRenderG3 extends ItemRenderWeaponBase { float offset = 0.8F; standardAimingTransform(stack, -1.25F * offset, -1F * offset, 2.75F * offset, - 0, -3.625 / 8D, 1.75); + 0, -3.5625 / 8D, 1.75); } @Override diff --git a/src/main/resources/assets/hbm/models/weapons/stg77.obj b/src/main/resources/assets/hbm/models/weapons/stg77.obj index 47582d957..decc89649 100644 --- a/src/main/resources/assets/hbm/models/weapons/stg77.obj +++ b/src/main/resources/assets/hbm/models/weapons/stg77.obj @@ -3411,9 +3411,9 @@ vt 0.170455 0.180723 vt 0.174242 0.144578 vt 0.136364 0.150602 vt 0.174242 0.192771 -vt 0.886904 0.951811 -vt 0.939394 0.807222 -vt 0.991884 0.951811 +vt 0.830355 0.927716 +vt 0.909091 0.710833 +vt 0.987826 0.927716 vt 0.640152 0.662651 vt 0.715909 0.662651 vt 0.753788 0.662651 @@ -3579,15 +3579,15 @@ vt 0.151515 0.536145 vt 0.189394 0.156627 vt 0.178030 0.180723 vt 0.136364 0.186747 -vt 0.969699 0.987093 -vt 0.939394 1.000007 -vt 0.909088 0.987093 -vt 0.878783 0.903614 -vt 0.886904 0.855418 -vt 0.909089 0.820136 -vt 0.969699 0.820136 -vt 0.991884 0.855418 -vt 1.000005 0.903614 +vt 0.954549 0.980639 +vt 0.909091 1.000011 +vt 0.863633 0.980639 +vt 0.818175 0.855421 +vt 0.830355 0.783127 +vt 0.863633 0.730204 +vt 0.954549 0.730204 +vt 0.987826 0.783127 +vt 1.000007 0.855422 vt 0.074559 0.941663 vt 0.075631 0.945782 vt 0.074559 0.949902 diff --git a/src/main/resources/assets/hbm/textures/models/weapons/stg77.png b/src/main/resources/assets/hbm/textures/models/weapons/stg77.png index be34f1633..6bb0d2949 100644 Binary files a/src/main/resources/assets/hbm/textures/models/weapons/stg77.png and b/src/main/resources/assets/hbm/textures/models/weapons/stg77.png differ