This commit is contained in:
Boblet 2025-05-07 16:49:00 +02:00
parent 58166fda33
commit d8d3263493
8 changed files with 57 additions and 32 deletions

View File

@ -38,7 +38,7 @@ public abstract class ItemInventory implements IInventory {
} }
public NBTTagCompound checkNBT(NBTTagCompound nbt) { public NBTTagCompound checkNBT(NBTTagCompound nbt) {
if(!nbt.hasNoTags()) { if(nbt == null || !nbt.hasNoTags()) {
Random random = new Random(); Random random = new Random();
try { try {

View File

@ -150,9 +150,24 @@ public class ItemBlockStorageCrate extends ItemBlockBase implements IGUIProvider
* solution (?): check equality, then just access the held stack directly. if not, pray the target reference is still accurate and use that. * solution (?): check equality, then just access the held stack directly. if not, pray the target reference is still accurate and use that.
*/ */
if(player.getHeldItem() != null && ItemStack.areItemStacksEqual(player.getHeldItem(), target)) { if(player.getHeldItem() != null && ItemStack.areItemStacksEqual(player.getHeldItem(), target)) {
player.getHeldItem().setTagCompound(checkNBT(nbt)); player.getHeldItem().setTagCompound(nbt);
this.target = player.getHeldItem(); // just fuckin whatever
} else { } else {
target.setTagCompound(checkNBT(nbt)); target.setTagCompound(nbt);
}
}
@Override
public void closeInventory() {
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:block.crateClose", 1.0F, 0.8F);
/*
* realistically, we only need one NBT size check (and we only *want* one because CompressedStreamTools is expensive) so we do that part only when closing
*/
if(player.getHeldItem() != null && ItemStack.areItemStacksEqual(player.getHeldItem(), target)) {
player.getHeldItem().setTagCompound(checkNBT(target.getTagCompound()));
} else {
target.setTagCompound(checkNBT(target.getTagCompound()));
} }
} }
} }

View File

@ -100,6 +100,7 @@ public class GunFactory {
G10, G10_SHRAPNEL, G10_DU, G10_SLUG, G10, G10_SHRAPNEL, G10_DU, G10_SLUG,
R762_HE, BMG50_HE, G10_EXPLOSIVE, R762_HE, BMG50_HE, G10_EXPLOSIVE,
P45_SP, P45_FMJ, P45_JHP, P45_AP, P45_DU, P45_SP, P45_FMJ, P45_JHP, P45_AP, P45_DU,
CT_HOOK,
//ONLY ADD NEW ENTRIES AT THE BOTTOM TO AVOID SHIFTING! //ONLY ADD NEW ENTRIES AT THE BOTTOM TO AVOID SHIFTING!
; ;
@ -126,6 +127,7 @@ public class GunFactory {
TAU_URANIUM, TAU_URANIUM,
COIL_TUNGSTEN, COIL_FERROURANIUM, COIL_TUNGSTEN, COIL_FERROURANIUM,
NUKE_STANDARD, NUKE_DEMO, NUKE_HIGH, NUKE_TOTS, NUKE_HIVE, NUKE_STANDARD, NUKE_DEMO, NUKE_HIGH, NUKE_TOTS, NUKE_HIVE,
CT_HOOK,
}; };
public Enum[] getOrder() { public Enum[] getOrder() {

View File

@ -26,12 +26,12 @@ public class XFactoryTool {
public static void init() { public static void init() {
ct_hook = new BulletConfig().setItem(EnumAmmo.P9_SP); ct_hook = new BulletConfig().setItem(EnumAmmo.CT_HOOK);
ModItems.gun_charge_thrower = new ItemGunBaseNT(WeaponQuality.UTILITY, new GunConfig() ModItems.gun_charge_thrower = new ItemGunBaseNT(WeaponQuality.UTILITY, new GunConfig()
.dura(3_000).draw(20).inspect(31).crosshair(Crosshair.L_CIRCUMFLEX) .dura(3_000).draw(20).inspect(31).reloadChangeType(true).hideCrosshair(false).crosshair(Crosshair.L_CIRCUMFLEX)
.rec(new Receiver(0) .rec(new Receiver(0)
.dmg(5F).delay(4).dry(40).auto(true).spread(0.015F).reload(60).jam(55).sound("hbm:weapon.fire.grenade", 1.0F, 1.0F) .dmg(5F).delay(4).dry(40).auto(true).spread(0F).spreadHipfire(0F).reload(60).jam(55).sound("hbm:weapon.fire.grenade", 1.0F, 1.0F)
.mag(new MagazineFullReload(0, 1).addConfigs(ct_hook)) .mag(new MagazineFullReload(0, 1).addConfigs(ct_hook))
.offset(1, -0.0625 * 2.5, -0.25D) .offset(1, -0.0625 * 2.5, -0.25D)
.setupStandardFire().recoil(LAMBDA_RECOIL_CT)) .setupStandardFire().recoil(LAMBDA_RECOIL_CT))
@ -51,8 +51,6 @@ public class XFactoryTool {
case CYCLE: return new BusAnimation() case CYCLE: return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, 0, 50).addPos(0, 0, -3, 50).addPos(0, 0, 0, 250)) .addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, 0, 50).addPos(0, 0, -3, 50).addPos(0, 0, 0, 250))
.addBus("HAMMER", new BusAnimationSequence().addPos(15, 0, 0, 50).addPos(15, 0, 0, 550).addPos(0, 0, 0, 100)); .addBus("HAMMER", new BusAnimationSequence().addPos(15, 0, 0, 50).addPos(15, 0, 0, 550).addPos(0, 0, 0, 100));
case CYCLE_DRY: return new BusAnimation()
.addBus("HAMMER", new BusAnimationSequence().addPos(15, 0, 0, 50).addPos(15, 0, 0, 550).addPos(0, 0, 0, 100));
case RELOAD: return new BusAnimation() case RELOAD: return new BusAnimation()
.addBus("OPEN", new BusAnimationSequence().addPos(45, 0, 0, 200, IType.SIN_FULL).addPos(45, 0, 0, 750).addPos(0, 0, 0, 200, IType.SIN_UP)) .addBus("OPEN", new BusAnimationSequence().addPos(45, 0, 0, 200, IType.SIN_FULL).addPos(45, 0, 0, 750).addPos(0, 0, 0, 200, IType.SIN_UP))
.addBus("SHELL", new BusAnimationSequence().addPos(4, -8, -4, 0).addPos(4, -8, -4, 200).addPos(0, 0, -5, 500, IType.SIN_DOWN).addPos(0, 0, 0, 200, IType.SIN_UP)) .addBus("SHELL", new BusAnimationSequence().addPos(4, -8, -4, 0).addPos(4, -8, -4, 200).addPos(0, 0, -5, 500, IType.SIN_DOWN).addPos(0, 0, 0, 200, IType.SIN_UP))

View File

@ -3,6 +3,8 @@ package com.hbm.render.item.weapon.sedna;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.factory.XFactoryTool;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.WeaponModManager;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
@ -38,33 +40,35 @@ public class ItemRenderChargeThrower extends ItemRenderWeaponBase {
@Override @Override
public void renderFirstPerson(ItemStack stack) { public void renderFirstPerson(ItemStack stack) {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
if(this.isScoped(stack) && gun.aimingProgress == 1 && gun.prevAimingProgress == 1) { boolean usingScope = this.isScoped(stack) && gun.aimingProgress == 1 && gun.prevAimingProgress == 1;
MagazineFullReload mag = (MagazineFullReload) gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack);
if(usingScope) {
double scale = 3.5D; double scale = 3.5D;
GL11.glScaled(scale, scale, scale); GL11.glScaled(scale, scale, scale);
GL11.glTranslated(-0.5, -1.5, -4); GL11.glTranslated(-0.5, -1.5, -4);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.charge_thrower_tex); } else {
ResourceManager.charge_thrower.renderPart("Gun"); double scale = 0.5D;
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.charge_thrower_mortar_tex); GL11.glScaled(scale, scale, scale);
ResourceManager.charge_thrower.renderPart("Mortar");
ResourceManager.charge_thrower.renderPart("Oomph");
return;
} }
double scale = 0.5D;
GL11.glScaled(scale, scale, scale);
GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glShadeModel(GL11.GL_SMOOTH);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.charge_thrower_tex); Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.charge_thrower_tex);
ResourceManager.charge_thrower.renderPart("Gun"); ResourceManager.charge_thrower.renderPart("Gun");
if(isScoped(stack)) ResourceManager.charge_thrower.renderPart("Scope"); if(isScoped(stack) && !usingScope) ResourceManager.charge_thrower.renderPart("Scope");
//Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.charge_thrower_hook_tex); if(mag.getAmount(stack, null) > 0) {
//ResourceManager.charge_thrower.renderPart("Hook");
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.charge_thrower_mortar_tex); if(mag.getType(stack, null) == XFactoryTool.ct_hook) {
ResourceManager.charge_thrower.renderPart("Mortar"); Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.charge_thrower_hook_tex);
ResourceManager.charge_thrower.renderPart("Oomph"); ResourceManager.charge_thrower.renderPart("Hook");
//Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.charge_thrower_rocket_tex); }
//ResourceManager.charge_thrower.renderPart("Rocket"); //Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.charge_thrower_mortar_tex);
//ResourceManager.charge_thrower.renderPart("Mortar");
//ResourceManager.charge_thrower.renderPart("Oomph");
//Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.charge_thrower_rocket_tex);
//ResourceManager.charge_thrower.renderPart("Rocket");
}
GL11.glShadeModel(GL11.GL_FLAT); GL11.glShadeModel(GL11.GL_FLAT);
} }
@ -103,12 +107,18 @@ public class ItemRenderChargeThrower extends ItemRenderWeaponBase {
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.charge_thrower_tex); Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.charge_thrower_tex);
ResourceManager.charge_thrower.renderPart("Gun"); ResourceManager.charge_thrower.renderPart("Gun");
if(isScoped(stack)) ResourceManager.charge_thrower.renderPart("Scope"); if(isScoped(stack)) ResourceManager.charge_thrower.renderPart("Scope");
//Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.charge_thrower_hook_tex);
//ResourceManager.charge_thrower.renderPart("Hook"); ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.charge_thrower_mortar_tex); MagazineFullReload mag = (MagazineFullReload) gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack);
ResourceManager.charge_thrower.renderPart("Mortar");
//Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.charge_thrower_rocket_tex); if(mag.getAmount(stack, null) > 0) {
//ResourceManager.charge_thrower.renderPart("Rocket");
if(mag.getType(stack, null) == XFactoryTool.ct_hook) {
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.charge_thrower_hook_tex);
ResourceManager.charge_thrower.renderPart("Hook");
}
}
GL11.glShadeModel(GL11.GL_FLAT); GL11.glShadeModel(GL11.GL_FLAT);
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B