the thing, device

This commit is contained in:
Boblet 2025-10-14 16:50:39 +02:00
parent fe38e61ba4
commit 5fd64f5d8f
39 changed files with 355 additions and 180 deletions

View File

@ -1,7 +1,7 @@
package com.hbm.inventory.container; package com.hbm.inventory.container;
import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.util.InventoryUtil; import com.hbm.util.InventoryUtil;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -36,7 +36,7 @@ public class ContainerWeaponTable extends Container {
ContainerWeaponTable.this.index = 0; ContainerWeaponTable.this.index = 0;
if(stack != null) { if(stack != null) {
ItemStack[] mods = WeaponModManager.getUpgradeItems(stack, index); ItemStack[] mods = XWeaponModManager.getUpgradeItems(stack, index);
if(mods != null) for(int i = 0; i < Math.min(mods.length, 7); i++) { if(mods != null) for(int i = 0; i < Math.min(mods.length, 7); i++) {
ContainerWeaponTable.this.mods.setInventorySlotContents(i, mods[i]); ContainerWeaponTable.this.mods.setInventorySlotContents(i, mods[i]);
@ -50,7 +50,7 @@ public class ContainerWeaponTable extends Container {
public void onPickupFromSlot(EntityPlayer player, ItemStack stack) { public void onPickupFromSlot(EntityPlayer player, ItemStack stack) {
super.onPickupFromSlot(player, stack); super.onPickupFromSlot(player, stack);
WeaponModManager.install( XWeaponModManager.install(
stack, index, stack, index,
mods.getStackInSlot(0), mods.getStackInSlot(0),
mods.getStackInSlot(1), mods.getStackInSlot(1),
@ -62,7 +62,7 @@ public class ContainerWeaponTable extends Container {
for(int i = 0; i < 7; i++) { for(int i = 0; i < 7; i++) {
ItemStack mod = ContainerWeaponTable.this.mods.getStackInSlot(i); ItemStack mod = ContainerWeaponTable.this.mods.getStackInSlot(i);
if(WeaponModManager.isApplicable(stack, mod, index, false)) ContainerWeaponTable.this.mods.setInventorySlotContents(i, null); if(XWeaponModManager.isApplicable(stack, mod, index, false)) ContainerWeaponTable.this.mods.setInventorySlotContents(i, null);
} }
ContainerWeaponTable.this.index = 0; ContainerWeaponTable.this.index = 0;
@ -92,7 +92,7 @@ public class ContainerWeaponTable extends Container {
int configs = ((ItemGunBaseNT) stack.getItem()).getConfigCount(); int configs = ((ItemGunBaseNT) stack.getItem()).getConfigCount();
if(configs < button) return null; if(configs < button) return null;
WeaponModManager.install( XWeaponModManager.install(
stack, this.index, stack, this.index,
mods.getStackInSlot(0), mods.getStackInSlot(0),
mods.getStackInSlot(1), mods.getStackInSlot(1),
@ -104,13 +104,13 @@ public class ContainerWeaponTable extends Container {
for(int i = 0; i < 7; i++) { for(int i = 0; i < 7; i++) {
ItemStack mod = ContainerWeaponTable.this.mods.getStackInSlot(i); ItemStack mod = ContainerWeaponTable.this.mods.getStackInSlot(i);
if(WeaponModManager.isApplicable(stack, mod, this.index, false)) ContainerWeaponTable.this.mods.setInventorySlotContents(i, null); if(XWeaponModManager.isApplicable(stack, mod, this.index, false)) ContainerWeaponTable.this.mods.setInventorySlotContents(i, null);
} }
this.index = button; this.index = button;
if(stack != null) { if(stack != null) {
ItemStack[] mods = WeaponModManager.getUpgradeItems(stack, this.index); ItemStack[] mods = XWeaponModManager.getUpgradeItems(stack, this.index);
if(mods != null) for(int i = 0; i < Math.min(mods.length, 7); i++) { if(mods != null) for(int i = 0; i < Math.min(mods.length, 7); i++) {
ContainerWeaponTable.this.mods.setInventorySlotContents(i, mods[i]); ContainerWeaponTable.this.mods.setInventorySlotContents(i, mods[i]);
@ -141,7 +141,7 @@ public class ContainerWeaponTable extends Container {
ItemStack itemstack = this.gun.getStackInSlotOnClosing(0); ItemStack itemstack = this.gun.getStackInSlotOnClosing(0);
if(itemstack != null) { if(itemstack != null) {
WeaponModManager.uninstall(itemstack, index); XWeaponModManager.uninstall(itemstack, index);
player.dropPlayerItemWithRandomChoice(itemstack, false); player.dropPlayerItemWithRandomChoice(itemstack, false);
} }
} }
@ -190,27 +190,27 @@ public class ContainerWeaponTable extends Container {
@Override @Override
public boolean isItemValid(ItemStack stack) { public boolean isItemValid(ItemStack stack) {
return gun.getStackInSlot(0) != null && WeaponModManager.isApplicable(gun.getStackInSlot(0), stack, index, true); return gun.getStackInSlot(0) != null && XWeaponModManager.isApplicable(gun.getStackInSlot(0), stack, index, true);
} }
@Override @Override
public void putStack(ItemStack stack) { public void putStack(ItemStack stack) {
super.putStack(stack); super.putStack(stack);
refreshInstalledMods(); refreshInstalledMods();
WeaponModManager.onInstallStack(gun.getStackInSlot(0), stack, index); XWeaponModManager.onInstallStack(gun.getStackInSlot(0), stack, index);
} }
@Override @Override
public void onPickupFromSlot(EntityPlayer player, ItemStack stack) { public void onPickupFromSlot(EntityPlayer player, ItemStack stack) {
super.onPickupFromSlot(player, stack); super.onPickupFromSlot(player, stack);
refreshInstalledMods(); refreshInstalledMods();
WeaponModManager.onUninstallStack(gun.getStackInSlot(0), stack, index); XWeaponModManager.onUninstallStack(gun.getStackInSlot(0), stack, index);
} }
public void refreshInstalledMods() { public void refreshInstalledMods() {
if(gun.getStackInSlot(0) == null) return; if(gun.getStackInSlot(0) == null) return;
WeaponModManager.uninstall(gun.getStackInSlot(0), index); XWeaponModManager.uninstall(gun.getStackInSlot(0), index);
WeaponModManager.install( XWeaponModManager.install(
gun.getStackInSlot(0), index, gun.getStackInSlot(0), index,
mods.getStackInSlot(0), mods.getStackInSlot(0),
mods.getStackInSlot(1), mods.getStackInSlot(1),

View File

@ -10,7 +10,7 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.SmokeNode;
import com.hbm.items.weapon.sedna.factory.GunStateDecider; import com.hbm.items.weapon.sedna.factory.GunStateDecider;
import com.hbm.items.weapon.sedna.factory.Lego; import com.hbm.items.weapon.sedna.factory.Lego;
import com.hbm.items.weapon.sedna.hud.IHUDComponent; import com.hbm.items.weapon.sedna.hud.IHUDComponent;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.render.anim.AnimationEnums.GunAnimation; import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
@ -89,34 +89,34 @@ public class GunConfig {
/* GETTERS */ /* GETTERS */
public Receiver[] getReceivers(ItemStack stack) { return WeaponModManager.eval(receivers_DNA, stack, O_RECEIVERS, this, this.index); } public Receiver[] getReceivers(ItemStack stack) { return XWeaponModManager.eval(receivers_DNA, stack, O_RECEIVERS, this, this.index); }
public float getDurability(ItemStack stack) { return WeaponModManager.eval(durability_DNA, stack, F_DURABILITY, this, this.index); } public float getDurability(ItemStack stack) { return XWeaponModManager.eval(durability_DNA, stack, F_DURABILITY, this, this.index); }
public int getDrawDuration(ItemStack stack) { return WeaponModManager.eval(drawDuration_DNA, stack, I_DRAWDURATION, this, this.index); } public int getDrawDuration(ItemStack stack) { return XWeaponModManager.eval(drawDuration_DNA, stack, I_DRAWDURATION, this, this.index); }
public int getInspectDuration(ItemStack stack) { return WeaponModManager.eval(inspectDuration_DNA, stack, I_INSPECTDURATION, this, this.index); } public int getInspectDuration(ItemStack stack) { return XWeaponModManager.eval(inspectDuration_DNA, stack, I_INSPECTDURATION, this, this.index); }
public boolean getInspectCancel(ItemStack stack) { return WeaponModManager.eval(inspectCancel_DNA, stack, I_INSPECTCANCEL, this, this.index); } public boolean getInspectCancel(ItemStack stack) { return XWeaponModManager.eval(inspectCancel_DNA, stack, I_INSPECTCANCEL, this, this.index); }
public Crosshair getCrosshair(ItemStack stack) { return WeaponModManager.eval(crosshair_DNA, stack, O_CROSSHAIR, this, this.index); } public Crosshair getCrosshair(ItemStack stack) { return XWeaponModManager.eval(crosshair_DNA, stack, O_CROSSHAIR, this, this.index); }
public boolean getHideCrosshair(ItemStack stack) { return WeaponModManager.eval(hideCrosshair_DNA, stack, B_HIDECROSSHAIR, this, this.index); } public boolean getHideCrosshair(ItemStack stack) { return XWeaponModManager.eval(hideCrosshair_DNA, stack, B_HIDECROSSHAIR, this, this.index); }
public boolean hasThermalSights(ItemStack stack) { return WeaponModManager.eval(thermalSights_DNA, stack, B_THERMALSIGHTS, this, this.index); } public boolean hasThermalSights(ItemStack stack) { return XWeaponModManager.eval(thermalSights_DNA, stack, B_THERMALSIGHTS, this, this.index); }
public boolean getReloadChangesType(ItemStack stack) { return WeaponModManager.eval(reloadRequiresTypeChange_DNA, stack, B_RELOADREQUIRESTYPECHANGE, this, this.index); } public boolean getReloadChangesType(ItemStack stack) { return XWeaponModManager.eval(reloadRequiresTypeChange_DNA, stack, B_RELOADREQUIRESTYPECHANGE, this, this.index); }
public boolean getReloadAnimSequential(ItemStack stack) { return WeaponModManager.eval(reloadAnimationsSequential_DNA, stack, B_RELOADANIMATIONSEQUENTIAL, this, this.index); } public boolean getReloadAnimSequential(ItemStack stack) { return XWeaponModManager.eval(reloadAnimationsSequential_DNA, stack, B_RELOADANIMATIONSEQUENTIAL, this, this.index); }
public ResourceLocation getScopeTexture(ItemStack stack) { return WeaponModManager.eval(scopeTexture_DNA, stack, O_SCOPETEXTURE, this, this.index); } public ResourceLocation getScopeTexture(ItemStack stack) { return XWeaponModManager.eval(scopeTexture_DNA, stack, O_SCOPETEXTURE, this, this.index); }
public BiConsumer<ItemStack, LambdaContext> getSmokeHandler(ItemStack stack) { return WeaponModManager.eval(smokeHandler_DNA, stack, CON_SMOKE, this, this.index); } public BiConsumer<ItemStack, LambdaContext> getSmokeHandler(ItemStack stack) { return XWeaponModManager.eval(smokeHandler_DNA, stack, CON_SMOKE, this, this.index); }
public BiConsumer<ItemStack, LambdaContext> getOrchestra(ItemStack stack) { return WeaponModManager.eval(this.orchestra_DNA, stack, CON_ORCHESTRA, this, this.index); } public BiConsumer<ItemStack, LambdaContext> getOrchestra(ItemStack stack) { return XWeaponModManager.eval(this.orchestra_DNA, stack, CON_ORCHESTRA, this, this.index); }
public BiConsumer<ItemStack, LambdaContext> getPressPrimary(ItemStack stack) { return WeaponModManager.eval(this.onPressPrimary_DNA, stack, CON_ONPRESSPRIMARY, this, this.index); } public BiConsumer<ItemStack, LambdaContext> getPressPrimary(ItemStack stack) { return XWeaponModManager.eval(this.onPressPrimary_DNA, stack, CON_ONPRESSPRIMARY, this, this.index); }
public BiConsumer<ItemStack, LambdaContext> getPressSecondary(ItemStack stack) { return WeaponModManager.eval(this.onPressSecondary_DNA, stack, CON_ONPRESSSECONDARY, this, this.index); } public BiConsumer<ItemStack, LambdaContext> getPressSecondary(ItemStack stack) { return XWeaponModManager.eval(this.onPressSecondary_DNA, stack, CON_ONPRESSSECONDARY, this, this.index); }
public BiConsumer<ItemStack, LambdaContext> getPressTertiary(ItemStack stack) { return WeaponModManager.eval(this.onPressTertiary_DNA, stack, CON_ONPRESSTERTIARY, this, this.index); } public BiConsumer<ItemStack, LambdaContext> getPressTertiary(ItemStack stack) { return XWeaponModManager.eval(this.onPressTertiary_DNA, stack, CON_ONPRESSTERTIARY, this, this.index); }
public BiConsumer<ItemStack, LambdaContext> getPressReload(ItemStack stack) { return WeaponModManager.eval(this.onPressReload_DNA, stack, CON_ONPRESSRELOAD, this, this.index); } public BiConsumer<ItemStack, LambdaContext> getPressReload(ItemStack stack) { return XWeaponModManager.eval(this.onPressReload_DNA, stack, CON_ONPRESSRELOAD, this, this.index); }
public BiConsumer<ItemStack, LambdaContext> getReleasePrimary(ItemStack stack) { return WeaponModManager.eval(this.onReleasePrimary_DNA, stack, CON_ONRELEASEPRIMARY, this, this.index); } public BiConsumer<ItemStack, LambdaContext> getReleasePrimary(ItemStack stack) { return XWeaponModManager.eval(this.onReleasePrimary_DNA, stack, CON_ONRELEASEPRIMARY, this, this.index); }
public BiConsumer<ItemStack, LambdaContext> getReleaseSecondary(ItemStack stack) { return WeaponModManager.eval(this.onReleaseSecondary_DNA, stack, CON_ONRELEASESECONDARY, this, this.index); } public BiConsumer<ItemStack, LambdaContext> getReleaseSecondary(ItemStack stack) { return XWeaponModManager.eval(this.onReleaseSecondary_DNA, stack, CON_ONRELEASESECONDARY, this, this.index); }
public BiConsumer<ItemStack, LambdaContext> getReleaseTertiary(ItemStack stack) { return WeaponModManager.eval(this.onReleaseTertiary_DNA, stack, CON_ONRELEASETERTIARY, this, this.index); } public BiConsumer<ItemStack, LambdaContext> getReleaseTertiary(ItemStack stack) { return XWeaponModManager.eval(this.onReleaseTertiary_DNA, stack, CON_ONRELEASETERTIARY, this, this.index); }
public BiConsumer<ItemStack, LambdaContext> getReleaseReload(ItemStack stack) { return WeaponModManager.eval(this.onReleaseReload_DNA, stack, CON_ONRELEASERELOAD, this, this.index); } public BiConsumer<ItemStack, LambdaContext> getReleaseReload(ItemStack stack) { return XWeaponModManager.eval(this.onReleaseReload_DNA, stack, CON_ONRELEASERELOAD, this, this.index); }
public BiConsumer<ItemStack, LambdaContext> getDecider(ItemStack stack) { return WeaponModManager.eval(this.decider_DNA, stack, CON_DECIDER, this, this.index); } public BiConsumer<ItemStack, LambdaContext> getDecider(ItemStack stack) { return XWeaponModManager.eval(this.decider_DNA, stack, CON_DECIDER, this, this.index); }
public BiFunction<ItemStack, GunAnimation, BusAnimation> getAnims(ItemStack stack) { return WeaponModManager.eval(this.animations_DNA, stack, FUN_ANIMNATIONS, this, this.index); } public BiFunction<ItemStack, GunAnimation, BusAnimation> getAnims(ItemStack stack) { return XWeaponModManager.eval(this.animations_DNA, stack, FUN_ANIMNATIONS, this, this.index); }
public IHUDComponent[] getHUDComponents(ItemStack stack) { return WeaponModManager.eval(this.hudComponents_DNA, stack, O_HUDCOMPONENTS, this, this.index); } public IHUDComponent[] getHUDComponents(ItemStack stack) { return XWeaponModManager.eval(this.hudComponents_DNA, stack, O_HUDCOMPONENTS, this, this.index); }
/* SETTERS */ /* SETTERS */

View File

@ -20,7 +20,7 @@ import com.hbm.items.armor.ArmorTrenchmaster;
import com.hbm.items.weapon.sedna.hud.IHUDComponent; import com.hbm.items.weapon.sedna.hud.IHUDComponent;
import com.hbm.items.weapon.sedna.mags.IMagazine; import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.items.weapon.sedna.mags.MagazineInfinite; import com.hbm.items.weapon.sedna.mags.MagazineInfinite;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.packet.PacketDispatcher; import com.hbm.packet.PacketDispatcher;
@ -115,7 +115,7 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IItemHUD, I
public GunConfig getConfig(ItemStack stack, int index) { public GunConfig getConfig(ItemStack stack, int index) {
GunConfig cfg = configs_DNA[index]; GunConfig cfg = configs_DNA[index];
if(stack == null) return cfg; if(stack == null) return cfg;
return WeaponModManager.eval(cfg, stack, O_GUNCONFIG + index, this, index); return XWeaponModManager.eval(cfg, stack, O_GUNCONFIG + index, this, index);
} }
public int getConfigCount() { public int getConfigCount() {
@ -193,7 +193,7 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IItemHUD, I
list.add(I18nUtil.resolveKey("gui.weapon.condition") + ": " + dura + "%"); list.add(I18nUtil.resolveKey("gui.weapon.condition") + ": " + dura + "%");
} }
for(ItemStack upgrade : WeaponModManager.getUpgradeItems(stack, i)) { for(ItemStack upgrade : XWeaponModManager.getUpgradeItems(stack, i)) {
list.add(EnumChatFormatting.YELLOW + upgrade.getDisplayName()); list.add(EnumChatFormatting.YELLOW + upgrade.getDisplayName());
} }
} }

View File

@ -6,7 +6,7 @@ import java.util.function.BiFunction;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext; import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.factory.Lego; import com.hbm.items.weapon.sedna.factory.Lego;
import com.hbm.items.weapon.sedna.mags.IMagazine; import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
@ -88,37 +88,37 @@ public class Receiver {
protected BiConsumer<ItemStack, LambdaContext> onRecoil_DNA; protected BiConsumer<ItemStack, LambdaContext> onRecoil_DNA;
/* GETTERS */ /* GETTERS */
public float getBaseDamage(ItemStack stack) { return WeaponModManager.eval(this.baseDamage_DNA, stack, F_BASEDAMAGE, this, parent.index); } public float getBaseDamage(ItemStack stack) { return XWeaponModManager.eval(this.baseDamage_DNA, stack, F_BASEDAMAGE, this, parent.index); }
public int getDelayAfterFire(ItemStack stack) { return WeaponModManager.eval(this.delayAfterFire_DNA, stack, I_DELAYAFTERFIRE, this, parent.index); } public int getDelayAfterFire(ItemStack stack) { return XWeaponModManager.eval(this.delayAfterFire_DNA, stack, I_DELAYAFTERFIRE, this, parent.index); }
public int getDelayAfterDryFire(ItemStack stack) { return WeaponModManager.eval(this.delayAfterDryFire_DNA, stack, I_DELAYAFTERDRYFIRE, this, parent.index); } public int getDelayAfterDryFire(ItemStack stack) { return XWeaponModManager.eval(this.delayAfterDryFire_DNA, stack, I_DELAYAFTERDRYFIRE, this, parent.index); }
public int getRoundsPerCycle(ItemStack stack) { return WeaponModManager.eval(this.roundsPerCycle_DNA, stack, I_ROUNDSPERCYCLE, this, parent.index); } public int getRoundsPerCycle(ItemStack stack) { return XWeaponModManager.eval(this.roundsPerCycle_DNA, stack, I_ROUNDSPERCYCLE, this, parent.index); }
public float getSplitProjectiles(ItemStack stack) { return WeaponModManager.eval(this.splitProjectiles_DNA, stack, F_SPLITPROJECTILES, this, parent.index); } public float getSplitProjectiles(ItemStack stack) { return XWeaponModManager.eval(this.splitProjectiles_DNA, stack, F_SPLITPROJECTILES, this, parent.index); }
public float getInnateSpread(ItemStack stack) { return WeaponModManager.eval(this.spreadInnate_DNA, stack, F_SPREADINNATE, this, parent.index); } public float getInnateSpread(ItemStack stack) { return XWeaponModManager.eval(this.spreadInnate_DNA, stack, F_SPREADINNATE, this, parent.index); }
public float getAmmoSpread(ItemStack stack) { return WeaponModManager.eval(this.spreadMultAmmo_DNA, stack, F_SPREADAMMO, this, parent.index); } public float getAmmoSpread(ItemStack stack) { return XWeaponModManager.eval(this.spreadMultAmmo_DNA, stack, F_SPREADAMMO, this, parent.index); }
public float getHipfireSpread(ItemStack stack) { return WeaponModManager.eval(this.spreadPenaltyHipfire_DNA, stack, F_SPREADHIPFIRE, this, parent.index); } public float getHipfireSpread(ItemStack stack) { return XWeaponModManager.eval(this.spreadPenaltyHipfire_DNA, stack, F_SPREADHIPFIRE, this, parent.index); }
public float getDurabilitySpread(ItemStack stack) { return WeaponModManager.eval(this.spreadDurability_DNA, stack, F_SPREADDURABILITY, this, parent.index); } public float getDurabilitySpread(ItemStack stack) { return XWeaponModManager.eval(this.spreadDurability_DNA, stack, F_SPREADDURABILITY, this, parent.index); }
public boolean getRefireOnHold(ItemStack stack) { return WeaponModManager.eval(this.refireOnHold_DNA, stack, B_REFIREONHOLD, this, parent.index); } public boolean getRefireOnHold(ItemStack stack) { return XWeaponModManager.eval(this.refireOnHold_DNA, stack, B_REFIREONHOLD, this, parent.index); }
public boolean getRefireAfterDry(ItemStack stack) { return WeaponModManager.eval(this.refireAfterDry_DNA, stack, B_REFIREAFTERDRY, this, parent.index); } public boolean getRefireAfterDry(ItemStack stack) { return XWeaponModManager.eval(this.refireAfterDry_DNA, stack, B_REFIREAFTERDRY, this, parent.index); }
public boolean getDoesDryFire(ItemStack stack) { return WeaponModManager.eval(this.doesDryFire_DNA, stack, B_DOESDRYFIRE, this, parent.index); } public boolean getDoesDryFire(ItemStack stack) { return XWeaponModManager.eval(this.doesDryFire_DNA, stack, B_DOESDRYFIRE, this, parent.index); }
public boolean getDoesDryFireAfterAuto(ItemStack stack) { return WeaponModManager.eval(this.doesDryFireAfterAuto_DNA, stack, B_DOESDRYFIREAFTERAUTO, this, parent.index); } public boolean getDoesDryFireAfterAuto(ItemStack stack) { return XWeaponModManager.eval(this.doesDryFireAfterAuto_DNA, stack, B_DOESDRYFIREAFTERAUTO, this, parent.index); }
public boolean getEjectOnFire(ItemStack stack) { return WeaponModManager.eval(this.ejectOnFire_DNA, stack, B_EJECTONFIRE, this, parent.index); } public boolean getEjectOnFire(ItemStack stack) { return XWeaponModManager.eval(this.ejectOnFire_DNA, stack, B_EJECTONFIRE, this, parent.index); }
public boolean getReloadOnEmpty(ItemStack stack) { return WeaponModManager.eval(this.reloadOnEmpty_DNA, stack, B_RELOADONEMPTY, this, parent.index); } public boolean getReloadOnEmpty(ItemStack stack) { return XWeaponModManager.eval(this.reloadOnEmpty_DNA, stack, B_RELOADONEMPTY, this, parent.index); }
public int getReloadBeginDuration(ItemStack stack) { return WeaponModManager.eval(this.reloadBeginDuration_DNA, stack, I_RELOADBEGINDURATION, this, parent.index); } public int getReloadBeginDuration(ItemStack stack) { return XWeaponModManager.eval(this.reloadBeginDuration_DNA, stack, I_RELOADBEGINDURATION, this, parent.index); }
public int getReloadCycleDuration(ItemStack stack) { return WeaponModManager.eval(this.reloadCycleDuration_DNA, stack, I_RELOADCYCLEDURATION, this, parent.index); } public int getReloadCycleDuration(ItemStack stack) { return XWeaponModManager.eval(this.reloadCycleDuration_DNA, stack, I_RELOADCYCLEDURATION, this, parent.index); }
public int getReloadEndDuration(ItemStack stack) { return WeaponModManager.eval(this.reloadEndDuration_DNA, stack, I_RELOADENDDURATION, this, parent.index); } public int getReloadEndDuration(ItemStack stack) { return XWeaponModManager.eval(this.reloadEndDuration_DNA, stack, I_RELOADENDDURATION, this, parent.index); }
public int getReloadCockOnEmptyPre(ItemStack stack) { return WeaponModManager.eval(this.reloadCockOnEmptyPre_DNA, stack, I_RELOADCOCKONEMPTYPRE, this, parent.index); } public int getReloadCockOnEmptyPre(ItemStack stack) { return XWeaponModManager.eval(this.reloadCockOnEmptyPre_DNA, stack, I_RELOADCOCKONEMPTYPRE, this, parent.index); }
public int getReloadCockOnEmptyPost(ItemStack stack) { return WeaponModManager.eval(this.reloadCockOnEmptyPost_DNA, stack, I_RELOADCOCKONEMPTYPOST, this, parent.index); } public int getReloadCockOnEmptyPost(ItemStack stack) { return XWeaponModManager.eval(this.reloadCockOnEmptyPost_DNA, stack, I_RELOADCOCKONEMPTYPOST, this, parent.index); }
public int getJamDuration(ItemStack stack) { return WeaponModManager.eval(this.jamDuration_DNA, stack, I_JAMDURATION, this, parent.index); } public int getJamDuration(ItemStack stack) { return XWeaponModManager.eval(this.jamDuration_DNA, stack, I_JAMDURATION, this, parent.index); }
public String getFireSound(ItemStack stack) { return WeaponModManager.eval(this.fireSound_DNA, stack, S_FIRESOUND, this, parent.index); } public String getFireSound(ItemStack stack) { return XWeaponModManager.eval(this.fireSound_DNA, stack, S_FIRESOUND, this, parent.index); }
public float getFireVolume(ItemStack stack) { return WeaponModManager.eval(this.fireVolume_DNA, stack, F_FIREVOLUME, this, parent.index); } public float getFireVolume(ItemStack stack) { return XWeaponModManager.eval(this.fireVolume_DNA, stack, F_FIREVOLUME, this, parent.index); }
public float getFirePitch(ItemStack stack) { return WeaponModManager.eval(this.firePitch_DNA, stack, F_FIREPITCH, this, parent.index); } public float getFirePitch(ItemStack stack) { return XWeaponModManager.eval(this.firePitch_DNA, stack, F_FIREPITCH, this, parent.index); }
public IMagazine getMagazine(ItemStack stack) { return WeaponModManager.eval(this.magazine_DNA, stack, O_MAGAZINE, this, parent.index); } public IMagazine getMagazine(ItemStack stack) { return XWeaponModManager.eval(this.magazine_DNA, stack, O_MAGAZINE, this, parent.index); }
public Vec3 getProjectileOffset(ItemStack stack) { return WeaponModManager.eval(this.projectileOffset_DNA, stack, O_PROJECTILEOFFSET, this, parent.index); } public Vec3 getProjectileOffset(ItemStack stack) { return XWeaponModManager.eval(this.projectileOffset_DNA, stack, O_PROJECTILEOFFSET, this, parent.index); }
public Vec3 getProjectileOffsetScoped(ItemStack stack) { return WeaponModManager.eval(this.projectileOffsetScoped_DNA, stack, O_PROJECTILEOFFSETSCOPED, this, parent.index); } public Vec3 getProjectileOffsetScoped(ItemStack stack) { return XWeaponModManager.eval(this.projectileOffsetScoped_DNA, stack, O_PROJECTILEOFFSETSCOPED, this, parent.index); }
public BiFunction<ItemStack, LambdaContext, Boolean> getCanFire(ItemStack stack) { return WeaponModManager.eval(this.canFire_DNA, stack, FUN_CANFIRE, this, parent.index); } public BiFunction<ItemStack, LambdaContext, Boolean> getCanFire(ItemStack stack) { return XWeaponModManager.eval(this.canFire_DNA, stack, FUN_CANFIRE, this, parent.index); }
public BiConsumer<ItemStack, LambdaContext> getOnFire(ItemStack stack) { return WeaponModManager.eval(this.onFire_DNA, stack, CON_ONFIRE, this, parent.index); } public BiConsumer<ItemStack, LambdaContext> getOnFire(ItemStack stack) { return XWeaponModManager.eval(this.onFire_DNA, stack, CON_ONFIRE, this, parent.index); }
public BiConsumer<ItemStack, LambdaContext> getRecoil(ItemStack stack) { return WeaponModManager.eval(this.onRecoil_DNA, stack, CON_ONRECOIL, this, parent.index); } public BiConsumer<ItemStack, LambdaContext> getRecoil(ItemStack stack) { return XWeaponModManager.eval(this.onRecoil_DNA, stack, CON_ONRECOIL, this, parent.index); }
/* SETTERS */ /* SETTERS */
public Receiver dmg(float dmg) { this.baseDamage_DNA = dmg; return this; } public Receiver dmg(float dmg) { this.baseDamage_DNA = dmg; return this; }

View File

@ -11,7 +11,7 @@ import com.hbm.items.weapon.sedna.impl.ItemGunChargeThrower;
import com.hbm.items.weapon.sedna.impl.ItemGunStinger; import com.hbm.items.weapon.sedna.impl.ItemGunStinger;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext; import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.mags.IMagazine; import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.lib.ModDamageSource; import com.hbm.lib.ModDamageSource;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.packet.toclient.AuxParticlePacketNT;
@ -552,11 +552,11 @@ public class Orchestras {
AudioWrapper audio = MainRegistry.proxy.getLoopedSound("hbm:weapon.fire.flameLoop", (float) entity.posX, (float) entity.posY, (float) entity.posZ, 1F, 15F, 1F, 10); AudioWrapper audio = MainRegistry.proxy.getLoopedSound("hbm:weapon.fire.flameLoop", (float) entity.posX, (float) entity.posY, (float) entity.posZ, 1F, 15F, 1F, 10);
ItemGunBaseNT.loopedSounds.put(entity, audio); ItemGunBaseNT.loopedSounds.put(entity, audio);
audio.startSound(); audio.startSound();
audio.attachTo(entity);
} }
//keepalive //keepalive
if(runningAudio != null && runningAudio.isPlaying()) { if(runningAudio != null && runningAudio.isPlaying()) {
runningAudio.keepAlive(); runningAudio.keepAlive();
runningAudio.updatePosition((float) entity.posX, (float) entity.posY, (float) entity.posZ);
} }
} else { } else {
//stop sound due to timeout //stop sound due to timeout
@ -744,7 +744,7 @@ public class Orchestras {
if(entity.worldObj.isRemote) return; if(entity.worldObj.isRemote) return;
GunAnimation type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); GunAnimation type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean scoped = stack.getItem() == ModItems.gun_g3_zebra || WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SCOPE); boolean scoped = stack.getItem() == ModItems.gun_g3_zebra || XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_SCOPE);
boolean aiming = ItemGunBaseNT.getIsAiming(stack) && !scoped; boolean aiming = ItemGunBaseNT.getIsAiming(stack) && !scoped;
if(type == GunAnimation.CYCLE) { if(type == GunAnimation.CYCLE) {
@ -999,13 +999,13 @@ public class Orchestras {
if(type == GunAnimation.CYCLE) { if(type == GunAnimation.CYCLE) {
if(timer == 0) { if(timer == 0) {
int rounds = WeaponModManager.hasUpgrade(stack, ctx.configIndex, WeaponModManager.ID_MINIGUN_SPEED) ? 3 : 1; int rounds = XWeaponModManager.hasUpgrade(stack, ctx.configIndex, XWeaponModManager.ID_MINIGUN_SPEED) ? 3 : 1;
for(int i = 0; i < rounds; i++) { for(int i = 0; i < rounds; i++) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory); 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.5, aiming ? -0.125 : -0.25, aiming ? -0.25 : -0.5D, 0, 0.18, -0.12, 0.01, (float)entity.getRNG().nextGaussian() * 15F, (float)entity.getRNG().nextGaussian() * 15F, casing.getName()); if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, aiming ? 0.125 : 0.5, aiming ? -0.125 : -0.25, aiming ? -0.25 : -0.5D, 0, 0.18, -0.12, 0.01, (float)entity.getRNG().nextGaussian() * 15F, (float)entity.getRNG().nextGaussian() * 15F, casing.getName());
} }
} }
if(timer == (WeaponModManager.hasUpgrade(stack, 0, 207) ? 3 : 1)) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverSpin", 1F, 0.75F); if(timer == (XWeaponModManager.hasUpgrade(stack, 0, 207) ? 3 : 1)) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverSpin", 1F, 0.75F);
} }
if(type == GunAnimation.CYCLE_DRY) { if(type == GunAnimation.CYCLE_DRY) {
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 1F, 0.75F); if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 1F, 0.75F);
@ -1028,13 +1028,13 @@ public class Orchestras {
if(type == GunAnimation.CYCLE) { if(type == GunAnimation.CYCLE) {
if(timer == 0) { if(timer == 0) {
int index = ctx.configIndex == 0 ? -1 : 1; int index = ctx.configIndex == 0 ? -1 : 1;
int rounds = WeaponModManager.hasUpgrade(stack, ctx.configIndex, WeaponModManager.ID_MINIGUN_SPEED) ? 3 : 1; int rounds = XWeaponModManager.hasUpgrade(stack, ctx.configIndex, XWeaponModManager.ID_MINIGUN_SPEED) ? 3 : 1;
for(int i = 0; i < rounds; i++) { for(int i = 0; i < rounds; i++) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory); SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.25, -0.25, -0.5D * index, 0, 0.18, -0.12 * index, 0.01, (float)entity.getRNG().nextGaussian() * 15F, (float)entity.getRNG().nextGaussian() * 15F, casing.getName()); if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.25, -0.25, -0.5D * index, 0, 0.18, -0.12 * index, 0.01, (float)entity.getRNG().nextGaussian() * 15F, (float)entity.getRNG().nextGaussian() * 15F, casing.getName());
} }
} }
if(timer == (WeaponModManager.hasUpgrade(stack, 0, 207) ? 3 : 1)) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverSpin", 1F, 0.75F); if(timer == (XWeaponModManager.hasUpgrade(stack, 0, 207) ? 3 : 1)) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverSpin", 1F, 0.75F);
} }
if(type == GunAnimation.CYCLE_DRY) { if(type == GunAnimation.CYCLE_DRY) {
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 1F, 0.75F); if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 1F, 0.75F);
@ -1448,7 +1448,7 @@ public class Orchestras {
if(entity.worldObj.isRemote) return; if(entity.worldObj.isRemote) return;
GunAnimation type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); GunAnimation type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack) && !WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SCOPE); boolean aiming = ItemGunBaseNT.getIsAiming(stack) && !XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_SCOPE);
if(type == GunAnimation.EQUIP) { if(type == GunAnimation.EQUIP) {
if(timer == 10) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.openLatch", 1F, 1F); if(timer == 10) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.openLatch", 1F, 1F);

View File

@ -25,7 +25,7 @@ import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmoSecret;
import com.hbm.items.weapon.sedna.mags.MagazineBelt; import com.hbm.items.weapon.sedna.mags.MagazineBelt;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.items.weapon.sedna.mags.MagazineSingleReload; import com.hbm.items.weapon.sedna.mags.MagazineSingleReload;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.packet.PacketDispatcher; import com.hbm.packet.PacketDispatcher;
@ -387,7 +387,7 @@ public class XFactory12ga {
} }
public static Function<ItemStack, String> LAMBDA_NAME_MARESLEG = (stack) -> { public static Function<ItemStack, String> LAMBDA_NAME_MARESLEG = (stack) -> {
if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SAWED_OFF)) return stack.getUnlocalizedName() + "_short"; if(XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_SAWED_OFF)) return stack.getUnlocalizedName() + "_short";
return null; return null;
}; };

View File

@ -16,7 +16,7 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality; import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType; import com.hbm.particle.SpentCasing.CasingType;
@ -59,7 +59,7 @@ public class XFactory22lr {
} }
public static Function<ItemStack, String> LAMBDA_NAME_AM180 = (stack) -> { public static Function<ItemStack, String> LAMBDA_NAME_AM180 = (stack) -> {
if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SILENCER)) return stack.getUnlocalizedName() + "_silenced"; if(XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_SILENCER)) return stack.getUnlocalizedName() + "_silenced";
return null; return null;
}; };

View File

@ -21,7 +21,7 @@ import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmoSecret; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmoSecret;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.items.weapon.sedna.mags.MagazineSingleReload; import com.hbm.items.weapon.sedna.mags.MagazineSingleReload;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType; import com.hbm.particle.SpentCasing.CasingType;
@ -151,7 +151,7 @@ public class XFactory44 {
} }
public static Function<ItemStack, String> LAMBDA_NAME_NOPIP = (stack) -> { public static Function<ItemStack, String> LAMBDA_NAME_NOPIP = (stack) -> {
if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SCOPE)) return stack.getUnlocalizedName() + "_scoped"; if(XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_SCOPE)) return stack.getUnlocalizedName() + "_scoped";
return null; return null;
}; };

View File

@ -19,7 +19,7 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality; import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
@ -107,12 +107,12 @@ public class XFactory556mm {
} }
public static Function<ItemStack, String> LAMBDA_NAME_G3 = (stack) -> { public static Function<ItemStack, String> LAMBDA_NAME_G3 = (stack) -> {
if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SILENCER) && if(XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_SILENCER) &&
WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_NO_STOCK) && XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_NO_STOCK) &&
WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_FURNITURE_BLACK) && XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_FURNITURE_BLACK) &&
WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SCOPE)) return stack.getUnlocalizedName() + "_infiltrator"; XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_SCOPE)) return stack.getUnlocalizedName() + "_infiltrator";
if(!WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_NO_STOCK) && if(!XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_NO_STOCK) &&
WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_FURNITURE_GREEN)) return stack.getUnlocalizedName() + "_a3"; XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_FURNITURE_GREEN)) return stack.getUnlocalizedName() + "_a3";
return null; return null;
}; };
@ -146,7 +146,7 @@ public class XFactory556mm {
.addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL)); .addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL));
case CYCLE: return new BusAnimation() case CYCLE: return new BusAnimation()
.addBus("BOLT", new BusAnimationSequence().addPos(0, 0, 0, 20).addPos(0, 0, -4.5, 40).addPos(0, 0, 0, 40)) .addBus("BOLT", new BusAnimationSequence().addPos(0, 0, 0, 20).addPos(0, 0, -4.5, 40).addPos(0, 0, 0, 40))
.addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, (ItemGunBaseNT.getIsAiming(stack) || !WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_NO_STOCK)) ? -0.25 : -0.75, 25, IType.SIN_DOWN).addPos(0, 0, 0, 75, IType.SIN_FULL)); .addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, (ItemGunBaseNT.getIsAiming(stack) || !XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_NO_STOCK)) ? -0.25 : -0.75, 25, IType.SIN_DOWN).addPos(0, 0, 0, 75, IType.SIN_FULL));
case CYCLE_DRY: return new BusAnimation() case CYCLE_DRY: return new BusAnimation()
.addBus("BOLT", new BusAnimationSequence().addPos(0, 0, 0, 250).addPos(0, 0, -0.3125, 100).hold(25).addPos(0, 0, -2.75, 130).hold(50).addPos(0, 0, -2.4375, 50).addPos(0, 0, 0, 85)) .addBus("BOLT", new BusAnimationSequence().addPos(0, 0, 0, 250).addPos(0, 0, -0.3125, 100).hold(25).addPos(0, 0, -2.75, 130).hold(50).addPos(0, 0, -2.4375, 50).addPos(0, 0, 0, 85))
.addBus("PLUG", new BusAnimationSequence().addPos(0, 0, 0, 250).hold(125).addPos(0, 0, -2.4375, 130).hold(100).addPos(0, 0, 0, 85)) .addBus("PLUG", new BusAnimationSequence().addPos(0, 0, 0, 250).hold(125).addPos(0, 0, -2.4375, 130).hold(100).addPos(0, 0, 0, 85))

View File

@ -17,7 +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.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.IMagazine; import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
@ -107,12 +107,12 @@ public class XFactory9mm {
} }
public static Function<ItemStack, String> LAMBDA_NAME_GREASEGUN = (stack) -> { public static Function<ItemStack, String> LAMBDA_NAME_GREASEGUN = (stack) -> {
if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_GREASEGUN_CLEAN)) return stack.getUnlocalizedName() + "_m3"; if(XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_GREASEGUN_CLEAN)) return stack.getUnlocalizedName() + "_m3";
return null; return null;
}; };
public static Function<ItemStack, String> LAMBDA_NAME_UZI = (stack) -> { public static Function<ItemStack, String> LAMBDA_NAME_UZI = (stack) -> {
if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SILENCER)) return stack.getUnlocalizedName() + "_richter"; if(XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_SILENCER)) return stack.getUnlocalizedName() + "_richter";
return null; return null;
}; };

View File

@ -15,7 +15,7 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
import com.hbm.items.weapon.sedna.impl.ItemGunDrill; import com.hbm.items.weapon.sedna.impl.ItemGunDrill;
import com.hbm.items.weapon.sedna.mags.IMagazine; import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.items.weapon.sedna.mags.MagazineLiquidEngine; import com.hbm.items.weapon.sedna.mags.MagazineLiquidEngine;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -71,7 +71,7 @@ public class XFactoryDrill {
MovingObjectPosition mop = EntityDamageUtil.getMouseOver(ctx.getPlayer(), getModdableReach(stack, 5.0D)); MovingObjectPosition mop = EntityDamageUtil.getMouseOver(ctx.getPlayer(), getModdableReach(stack, 5.0D));
if(mop != null) { if(mop != null) {
if(mop.typeOfHit == mop.typeOfHit.ENTITY) { if(mop.typeOfHit == mop.typeOfHit.ENTITY) {
float damage = 5.0F; float damage = primary.getBaseDamage(stack);
if(mop.entityHit instanceof EntityLivingBase) { if(mop.entityHit instanceof EntityLivingBase) {
EntityDamageUtil.attackEntityFromNT((EntityLivingBase) mop.entityHit, DamageSource.causePlayerDamage(ctx.getPlayer()), damage, true, true, 0.1F, getModdableDTNegation(stack, 2F), getModdablePiercing(stack, 0.15F)); EntityDamageUtil.attackEntityFromNT((EntityLivingBase) mop.entityHit, DamageSource.causePlayerDamage(ctx.getPlayer()), damage, true, true, 0.1F, getModdableDTNegation(stack, 2F), getModdablePiercing(stack, 0.15F));
} else { } else {
@ -87,7 +87,9 @@ public class XFactoryDrill {
} }
} }
mag.useUpAmmo(stack, ctx.inventory, 10); int ammoToUse = 10;
if(XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_ENGINE_ELECTRIC)) ammoToUse = 500; // that's 2,000 operations
mag.useUpAmmo(stack, ctx.inventory, ammoToUse);
if(calcWear) ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index), ctx.config.getDurability(stack))); if(calcWear) ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index), ctx.config.getDurability(stack)));
} }
@ -113,11 +115,11 @@ public class XFactoryDrill {
} }
// this system technically doesn't need to be part of the GunCfg or Receiver or anything, we can just do this and it works the exact same // this system technically doesn't need to be part of the GunCfg or Receiver or anything, we can just do this and it works the exact same
public static double getModdableReach(ItemStack stack, double base) { return WeaponModManager.eval(base, stack, D_REACH, ModItems.gun_drill, 0); } public static double getModdableReach(ItemStack stack, double base) { return XWeaponModManager.eval(base, stack, D_REACH, ModItems.gun_drill, 0); }
public static float getModdableDTNegation(ItemStack stack, float base) { return WeaponModManager.eval(base, stack, F_DTNEG, ModItems.gun_drill, 0); } public static float getModdableDTNegation(ItemStack stack, float base) { return XWeaponModManager.eval(base, stack, F_DTNEG, ModItems.gun_drill, 0); }
public static float getModdablePiercing(ItemStack stack, float base) { return WeaponModManager.eval(base, stack, F_PIERCE, ModItems.gun_drill, 0); } public static float getModdablePiercing(ItemStack stack, float base) { return XWeaponModManager.eval(base, stack, F_PIERCE, ModItems.gun_drill, 0); }
public static int getModdableAoE(ItemStack stack, int base) { return WeaponModManager.eval(base, stack, I_AOE, ModItems.gun_drill, 0); } public static int getModdableAoE(ItemStack stack, int base) { return XWeaponModManager.eval(base, stack, I_AOE, ModItems.gun_drill, 0); }
public static int getModdableHarvestLevel(ItemStack stack, int base) { return WeaponModManager.eval(base, stack, I_HARVEST, ModItems.gun_drill, 0); } public static int getModdableHarvestLevel(ItemStack stack, int base) { return XWeaponModManager.eval(base, stack, I_HARVEST, ModItems.gun_drill, 0); }
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_DRILL_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_DRILL_ANIMS = (stack, type) -> {
switch(type) { switch(type) {

View File

@ -5,7 +5,7 @@ import java.util.List;
import com.hbm.items.ICustomizable; import com.hbm.items.ICustomizable;
import com.hbm.items.weapon.sedna.GunConfig; import com.hbm.items.weapon.sedna.GunConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.util.ChatBuilder; import com.hbm.util.ChatBuilder;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -30,8 +30,8 @@ public class ItemGunNI4NI extends ItemGunBaseNT implements ICustomizable {
if(!world.isRemote) { if(!world.isRemote) {
int maxCoin = 4; int maxCoin = 4;
if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_NI4NI_NICKEL)) maxCoin += 2; if(XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_NI4NI_NICKEL)) maxCoin += 2;
if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_NI4NI_DOUBLOONS)) maxCoin += 2; if(XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_NI4NI_DOUBLOONS)) maxCoin += 2;
if(this.getCoinCount(stack) < maxCoin) { if(this.getCoinCount(stack) < maxCoin) {
this.setCoinCharge(stack, this.getCoinCharge(stack) + 1); this.setCoinCharge(stack, this.getCoinCharge(stack) + 1);

View File

@ -0,0 +1,55 @@
package com.hbm.items.weapon.sedna.mags;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.particle.SpentCasing;
import com.hbm.util.BobMathUtil;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
public class MagazineElectricEngine implements IMagazine {
public static final String KEY_MAG_COUNT = "magcount";
public static final String KEY_MAG_PREV = "magprev";
public static final String KEY_MAG_AFTER = "magafter";
/** A number so the gun tell multiple mags apart */
public int index;
/** How much ammo this mag can hold */
public int capacity;
public MagazineElectricEngine(int index, int capacity) {
this.index = index;
this.capacity = capacity;
}
@Override public Object getType(ItemStack stack, IInventory inventory) { return null; }
@Override public void setType(ItemStack stack, Object type) { }
@Override public int getCapacity(ItemStack stack) { return capacity; }
@Override
public void useUpAmmo(ItemStack stack, IInventory inventory, int amount) {
this.setAmount(stack, Math.max(this.getAmount(stack, inventory) - amount, 0));
}
@Override public int getAmount(ItemStack stack, IInventory inventory) { return getMagCount(stack, index); }
@Override public void setAmount(ItemStack stack, int amount) { setMagCount(stack, index, amount); }
@Override public boolean canReload(ItemStack stack, IInventory inventory) { return false; }
@Override public void initNewType(ItemStack stack, IInventory inventory) { }
@Override public void reloadAction(ItemStack stack, IInventory inventory) { }
@Override public SpentCasing getCasing(ItemStack stack, IInventory inventory) { return null; }
@Override public ItemStack getIconForHUD(ItemStack stack, EntityPlayer player) { return new ItemStack(ModItems.battery_creative); }
@Override public String reportAmmoStateForHUD(ItemStack stack, EntityPlayer player) { return BobMathUtil.getShortNumber(getAmount(stack, player.inventory)) + "/" + BobMathUtil.getShortNumber(this.capacity) + "HE"; }
@Override public void setAmountBeforeReload(ItemStack stack, int amount) { ItemGunBaseNT.setValueInt(stack, KEY_MAG_PREV + index, amount); }
@Override public int getAmountBeforeReload(ItemStack stack) { return ItemGunBaseNT.getValueInt(stack, KEY_MAG_PREV + index); }
@Override public void setAmountAfterReload(ItemStack stack, int amount) { ItemGunBaseNT.setValueInt(stack, KEY_MAG_AFTER + index, amount); }
@Override public int getAmountAfterReload(ItemStack stack) { return ItemGunBaseNT.getValueInt(stack, KEY_MAG_AFTER + index); }
public static int getMagCount(ItemStack stack, int index) { return ItemGunBaseNT.getValueInt(stack, KEY_MAG_COUNT + index); }
public static void setMagCount(ItemStack stack, int index, int value) { ItemGunBaseNT.setValueInt(stack, KEY_MAG_COUNT + index, value); }
}

View File

@ -35,7 +35,7 @@ public class MagazineLiquidEngine implements IMagazine<FluidType> {
@Override @Override
public void useUpAmmo(ItemStack stack, IInventory inventory, int amount) { public void useUpAmmo(ItemStack stack, IInventory inventory, int amount) {
this.setAmount(stack, this.getAmount(stack, inventory) - amount); this.setAmount(stack, Math.max(this.getAmount(stack, inventory) - amount, 0));
} }
@Override public int getAmount(ItemStack stack, IInventory inventory) { return getMagCount(stack, index); } @Override public int getAmount(ItemStack stack, IInventory inventory) { return getMagCount(stack, index); }

View File

@ -10,7 +10,7 @@ public abstract class WeaponModBase implements IWeaponMod {
public String[] slots; public String[] slots;
public int priority = 0; public int priority = 0;
public WeaponModBase(int id, String... slots) { this.slots = slots; WeaponModManager.idToMod.put(id, this); } public WeaponModBase(int id, String... slots) { this.slots = slots; XWeaponModManager.idToMod.put(id, this); }
public WeaponModBase setPriority(int priority) { this.priority = priority; return this; } public WeaponModBase setPriority(int priority) { this.priority = priority; return this; }
@Override public int getModPriority() { return priority; } @Override public int getModPriority() { return priority; }

View File

@ -60,8 +60,8 @@ public class WeaponModCaliber extends WeaponModBase {
} }
/* adding or removing a caliber mod annihilates the loaded rounds */ /* adding or removing a caliber mod annihilates the loaded rounds */
public void onInstall(ItemStack gun, ItemStack mod, int index) { clearMag(gun, index); } @Override public void onInstall(ItemStack gun, ItemStack mod, int index) { clearMag(gun, index); }
public void onUninstall(ItemStack gun, ItemStack mod, int index) { clearMag(gun, index); } @Override public void onUninstall(ItemStack gun, ItemStack mod, int index) { clearMag(gun, index); }
public void clearMag(ItemStack stack, int index) { public void clearMag(ItemStack stack, int index) {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();

View File

@ -0,0 +1,41 @@
package com.hbm.items.weapon.sedna.mods;
import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.factory.XFactoryDrill;
import net.minecraft.item.ItemStack;
public class WeaponModDrill extends WeaponModBase {
protected float damage = 1;
protected double reach = 1;
protected float dt = -1;
protected float pierce = -1;
protected int aoe = -1;
protected int harvest = -1;
public WeaponModDrill(int id) {
super(id, "DRILL");
this.setPriority(PRIORITY_SET);
}
public WeaponModDrill damage(float damage) { this.damage = damage; return this; }
public WeaponModDrill reach(double reach) { this.reach = reach; return this; }
public WeaponModDrill dt(float dt) { this.dt = dt; return this; }
public WeaponModDrill pierce(float pierce) { this.pierce = pierce; return this; }
public WeaponModDrill aoe(int aoe) { this.aoe = aoe; return this; }
public WeaponModDrill harvest(int harvest) { this.harvest = harvest; return this; }
@Override
public <T> T eval(T base, ItemStack gun, String key, Object parent) {
if(key.equals(Receiver.F_BASEDAMAGE)) return cast((Float) base * damage, base);
if(key.equals(XFactoryDrill.D_REACH)) return cast((Double) base * reach, base);
if(key.equals(XFactoryDrill.F_DTNEG) && dt >= 0) return cast((Float) dt, base);
if(key.equals(XFactoryDrill.F_PIERCE) && pierce >= 0) return cast((Float) pierce, base);
if(key.equals(XFactoryDrill.I_AOE) && aoe >= 0) return cast((Integer) aoe, base);
if(key.equals(XFactoryDrill.I_HARVEST) && harvest >= 0) return cast((Integer) harvest, base);
return base;
}
}

View File

@ -0,0 +1,47 @@
package com.hbm.items.weapon.sedna.mods;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.items.weapon.sedna.mags.MagazineElectricEngine;
import com.hbm.items.weapon.sedna.mags.MagazineLiquidEngine;
import net.minecraft.item.ItemStack;
public class WeaponModEngine extends WeaponModBase {
public static final MagazineLiquidEngine ENGINE_DIESEL = new MagazineLiquidEngine(0, 4_000, Fluids.DIESEL, Fluids.DIESEL_CRACK, Fluids.LIGHTOIL);
public static final MagazineLiquidEngine ENGINE_AVIATION = new MagazineLiquidEngine(0, 4_000, Fluids.KEROSENE, Fluids.LPG);
public static final MagazineElectricEngine ENGINE_ELECTRIC = new MagazineElectricEngine(0, 1_000_000);
public static final MagazineLiquidEngine ENGINE_TURBO = new MagazineLiquidEngine(0, 4_000, Fluids.KEROSENE_REFORM, Fluids.REFORMATE);
protected IMagazine mag;
protected int delay;
public WeaponModEngine(int id) {
super(id, "ENGINE");
this.setPriority(PRIORITY_SET);
}
public WeaponModEngine mag(IMagazine mag) { this.mag = mag; return this; }
public WeaponModEngine delay(int delay) { this.delay = delay; return this; }
@Override
public <T> T eval(T base, ItemStack gun, String key, Object parent) {
if(key == Receiver.O_MAGAZINE && mag != null) return cast(mag, base);
if(key == Receiver.I_DELAYAFTERFIRE) return cast((Integer) delay, base);
return base;
}
@Override public void onInstall(ItemStack gun, ItemStack mod, int index) { clearMag(gun, index); }
@Override public void onUninstall(ItemStack gun, ItemStack mod, int index) { clearMag(gun, index); }
public void clearMag(ItemStack stack, int index) {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
IMagazine mag = gun.getConfig(stack, index).getReceivers(stack)[0].getMagazine(stack);
mag.setAmount(stack, 0);
}
}

View File

@ -25,6 +25,7 @@ import com.hbm.items.weapon.sedna.factory.XFactory762mm;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
/** /**
@ -33,7 +34,7 @@ import net.minecraft.nbt.NBTTagCompound;
* *
* @author hbm * @author hbm
*/ */
public class WeaponModManager { public class XWeaponModManager {
public static final String KEY_MOD_LIST = "KEY_MOD_LIST_"; public static final String KEY_MOD_LIST = "KEY_MOD_LIST_";
@ -152,6 +153,15 @@ public class WeaponModManager {
new WeaponModDefinition(EnumModSpecial.NICKEL).addMod(new Item[] {ModItems.gun_n_i_4_n_i}, new WeaponModNickel(ID_NI4NI_NICKEL, "COIN1")); new WeaponModDefinition(EnumModSpecial.NICKEL).addMod(new Item[] {ModItems.gun_n_i_4_n_i}, new WeaponModNickel(ID_NI4NI_NICKEL, "COIN1"));
new WeaponModDefinition(EnumModSpecial.DOUBLOONS).addMod(new Item[] {ModItems.gun_n_i_4_n_i}, new WeaponModNickel(ID_NI4NI_DOUBLOONS, "COIN2")); new WeaponModDefinition(EnumModSpecial.DOUBLOONS).addMod(new Item[] {ModItems.gun_n_i_4_n_i}, new WeaponModNickel(ID_NI4NI_DOUBLOONS, "COIN2"));
new WeaponModDefinition(EnumModSpecial.DRILL_HSS).addMod(new Item[] {ModItems.gun_drill}, new WeaponModDrill(ID_DRILL_HSS).damage(1.25F).dt(3F).pierce(0.15F).harvest(ToolMaterial.EMERALD.ordinal()));
new WeaponModDefinition(EnumModSpecial.DRILL_WEAPONSTEEL).addMod(new Item[] {ModItems.gun_drill}, new WeaponModDrill(ID_DRILL_WSTEEL).damage(1.5F).dt(5F).pierce(0.2F).aoe(2).harvest(ToolMaterial.EMERALD.ordinal()));
new WeaponModDefinition(EnumModSpecial.DRILL_TCALLOY).addMod(new Item[] {ModItems.gun_drill}, new WeaponModDrill(ID_DRILL_TCALLOY).damage(2F).dt(7.5F).pierce(0.2F).reach(1.5).aoe(2).harvest(ToolMaterial.EMERALD.ordinal() + 1));
new WeaponModDefinition(EnumModSpecial.DRILL_SATURNITE).addMod(new Item[] {ModItems.gun_drill}, new WeaponModDrill(ID_DRILL_SATURN).damage(3F).dt(10F).pierce(0.25F).reach(2).aoe(2).harvest(ToolMaterial.EMERALD.ordinal() + 2));
new WeaponModDefinition(EnumModSpecial.ENGINE_DIESEL).addMod(new Item[] {ModItems.gun_drill}, new WeaponModEngine(ID_ENGINE_DIESEL).mag(WeaponModEngine.ENGINE_DIESEL).delay(15));
new WeaponModDefinition(EnumModSpecial.ENGINE_AVIATION).addMod(new Item[] {ModItems.gun_drill}, new WeaponModEngine(ID_ENGINE_AVIATION).mag(WeaponModEngine.ENGINE_AVIATION).delay(10));
new WeaponModDefinition(EnumModSpecial.ENGINE_ELECTRIC).addMod(new Item[] {ModItems.gun_drill}, new WeaponModEngine(ID_ENGINE_ELECTRIC).mag(WeaponModEngine.ENGINE_ELECTRIC).delay(15));
new WeaponModDefinition(EnumModSpecial.ENGINE_TURBO).addMod(new Item[] {ModItems.gun_drill}, new WeaponModEngine(ID_ENGINE_TURBO).mag(WeaponModEngine.ENGINE_TURBO).delay(2));
BulletConfig[] p9 = new BulletConfig[] {XFactory9mm.p9_sp, XFactory9mm.p9_fmj, XFactory9mm.p9_jhp, XFactory9mm.p9_ap}; BulletConfig[] p9 = new BulletConfig[] {XFactory9mm.p9_sp, XFactory9mm.p9_fmj, XFactory9mm.p9_jhp, XFactory9mm.p9_ap};
BulletConfig[] p45 = new BulletConfig[] {XFactory45.p45_sp, XFactory45.p45_fmj, XFactory45.p45_jhp, XFactory45.p45_ap, XFactory45.p45_du}; BulletConfig[] p45 = new BulletConfig[] {XFactory45.p45_sp, XFactory45.p45_fmj, XFactory45.p45_jhp, XFactory45.p45_ap, XFactory45.p45_du};
BulletConfig[] p22 = new BulletConfig[] {XFactory22lr.p22_sp, XFactory22lr.p22_fmj, XFactory22lr.p22_jhp, XFactory22lr.p22_ap}; BulletConfig[] p22 = new BulletConfig[] {XFactory22lr.p22_sp, XFactory22lr.p22_fmj, XFactory22lr.p22_jhp, XFactory22lr.p22_ap};
@ -206,6 +216,14 @@ public class WeaponModManager {
public static final int ID_CARBINE_BAYONET = 219; public static final int ID_CARBINE_BAYONET = 219;
public static final int ID_NI4NI_NICKEL = 220; public static final int ID_NI4NI_NICKEL = 220;
public static final int ID_NI4NI_DOUBLOONS = 221; public static final int ID_NI4NI_DOUBLOONS = 221;
public static final int ID_DRILL_HSS = 222;
public static final int ID_DRILL_WSTEEL = 223;
public static final int ID_DRILL_TCALLOY = 224;
public static final int ID_DRILL_SATURN = 225;
public static final int ID_ENGINE_DIESEL = 226;
public static final int ID_ENGINE_AVIATION = 227;
public static final int ID_ENGINE_ELECTRIC = 228;
public static final int ID_ENGINE_TURBO = 229;
public static ItemStack[] getUpgradeItems(ItemStack stack, int cfg) { public static ItemStack[] getUpgradeItems(ItemStack stack, int cfg) {
if(!stack.hasTagCompound()) return new ItemStack[0]; if(!stack.hasTagCompound()) return new ItemStack[0];

View File

@ -29,7 +29,7 @@ import com.hbm.inventory.recipes.anvil.AnvilRecipes;
import com.hbm.inventory.recipes.loader.SerializableRecipe; import com.hbm.inventory.recipes.loader.SerializableRecipe;
import com.hbm.items.ItemEnums.EnumAchievementType; import com.hbm.items.ItemEnums.EnumAchievementType;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.lib.HbmWorld; import com.hbm.lib.HbmWorld;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.packet.PacketDispatcher; import com.hbm.packet.PacketDispatcher;
@ -281,7 +281,7 @@ public class MainRegistry {
SiegeTier.registerTiers(); SiegeTier.registerTiers();
HazardRegistry.registerItems(); HazardRegistry.registerItems();
HazardRegistry.registerTrafos(); HazardRegistry.registerTrafos();
WeaponModManager.init(); XWeaponModManager.init();
OreDictManager oreMan = new OreDictManager(); OreDictManager oreMan = new OreDictManager();
MinecraftForge.EVENT_BUS.register(oreMan); //OreRegisterEvent MinecraftForge.EVENT_BUS.register(oreMan); //OreRegisterEvent

View File

@ -3,7 +3,7 @@ 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.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -162,6 +162,6 @@ public class ItemRenderAm180 extends ItemRenderWeaponBase {
} }
public boolean hasSilencer(ItemStack stack) { public boolean hasSilencer(ItemStack stack) {
return WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SILENCER); return XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_SILENCER);
} }
} }

View File

@ -4,7 +4,7 @@ import org.lwjgl.opengl.GL11;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -210,6 +210,6 @@ public class ItemRenderAmat extends ItemRenderWeaponBase {
} }
public boolean isSilenced(ItemStack stack) { public boolean isSilenced(ItemStack stack) {
return stack.getItem() == ModItems.gun_amat_penance || WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SILENCER); return stack.getItem() == ModItems.gun_amat_penance || XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_SILENCER);
} }
} }

View File

@ -3,7 +3,7 @@ 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.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -150,6 +150,6 @@ public class ItemRenderCarbine extends ItemRenderWeaponBase {
} }
public boolean hasBayonet(ItemStack stack) { public boolean hasBayonet(ItemStack stack) {
return WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_CARBINE_BAYONET); return XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_CARBINE_BAYONET);
} }
} }

View File

@ -5,7 +5,7 @@ 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.factory.XFactoryTool;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -168,6 +168,6 @@ public class ItemRenderChargeThrower extends ItemRenderWeaponBase {
} }
public boolean isScoped(ItemStack stack) { public boolean isScoped(ItemStack stack) {
return WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SCOPE); return XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_SCOPE);
} }
} }

View File

@ -4,7 +4,7 @@ import org.lwjgl.opengl.GL11;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -173,6 +173,6 @@ public class ItemRenderDoubleBarrel extends ItemRenderWeaponBase {
} }
public boolean isSawedOff(ItemStack stack) { public boolean isSawedOff(ItemStack stack) {
return stack.getItem() == ModItems.gun_double_barrel_sacred_dragon || WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SAWED_OFF); return stack.getItem() == ModItems.gun_double_barrel_sacred_dragon || XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_SAWED_OFF);
} }
} }

View File

@ -4,7 +4,7 @@ import org.lwjgl.opengl.GL11;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -212,20 +212,20 @@ public class ItemRenderG3 extends ItemRenderWeaponBase {
} }
public boolean hasStock(ItemStack stack) { public boolean hasStock(ItemStack stack) {
return !WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_NO_STOCK); return !XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_NO_STOCK);
} }
public boolean hasSilencer(ItemStack stack) { public boolean hasSilencer(ItemStack stack) {
return stack.getItem() == ModItems.gun_g3_zebra || WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SILENCER); return stack.getItem() == ModItems.gun_g3_zebra || XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_SILENCER);
} }
public boolean isScoped(ItemStack stack) { public boolean isScoped(ItemStack stack) {
return stack.getItem() == ModItems.gun_g3_zebra || WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SCOPE); return stack.getItem() == ModItems.gun_g3_zebra || XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_SCOPE);
} }
public ResourceLocation getTexture(ItemStack stack) { public ResourceLocation getTexture(ItemStack stack) {
if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_FURNITURE_GREEN)) return ResourceManager.g3_green_tex; if(XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_FURNITURE_GREEN)) return ResourceManager.g3_green_tex;
if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_FURNITURE_BLACK)) return ResourceManager.g3_black_tex; if(XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_FURNITURE_BLACK)) return ResourceManager.g3_black_tex;
return texture; return texture;
} }
} }

View File

@ -3,7 +3,7 @@ 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.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -153,6 +153,6 @@ public class ItemRenderGreasegun extends ItemRenderWeaponBase {
} }
public boolean isRefurbished(ItemStack stack) { public boolean isRefurbished(ItemStack stack) {
return WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_GREASEGUN_CLEAN); return XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_GREASEGUN_CLEAN);
} }
} }

View File

@ -4,7 +4,7 @@ import org.lwjgl.opengl.GL11;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -176,6 +176,6 @@ public class ItemRenderHeavyRevolver extends ItemRenderWeaponBase {
} }
public boolean isScoped(ItemStack stack) { public boolean isScoped(ItemStack stack) {
return stack.getItem() == ModItems.gun_heavy_revolver_lilmac || WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SCOPE); return stack.getItem() == ModItems.gun_heavy_revolver_lilmac || XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_SCOPE);
} }
} }

View File

@ -3,7 +3,7 @@ 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.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -138,14 +138,14 @@ public class ItemRenderLasrifle extends ItemRenderWeaponBase {
} }
public boolean hasScope(ItemStack stack) { public boolean hasScope(ItemStack stack) {
return !WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_LAS_AUTO); return !XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_LAS_AUTO);
} }
public boolean hasShotgun(ItemStack stack) { public boolean hasShotgun(ItemStack stack) {
return WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_LAS_SHOTGUN); return XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_LAS_SHOTGUN);
} }
public boolean hasCapacitor(ItemStack stack) { public boolean hasCapacitor(ItemStack stack) {
return WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_LAS_CAPACITOR); return XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_LAS_CAPACITOR);
} }
} }

View File

@ -5,7 +5,7 @@ import java.nio.DoubleBuffer;
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.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -193,10 +193,10 @@ public class ItemRenderMAS36 extends ItemRenderWeaponBase {
} }
public boolean isScoped(ItemStack stack) { public boolean isScoped(ItemStack stack) {
return WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SCOPE); return XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_SCOPE);
} }
public boolean hasBayonet(ItemStack stack) { public boolean hasBayonet(ItemStack stack) {
return WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_MAS_BAYONET); return XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_MAS_BAYONET);
} }
} }

View File

@ -4,7 +4,7 @@ import org.lwjgl.opengl.GL11;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -171,6 +171,6 @@ public class ItemRenderMaresleg extends ItemRenderWeaponBase {
} }
public boolean getShort(ItemStack stack) { public boolean getShort(ItemStack stack) {
return stack.getItem() == ModItems.gun_maresleg_broken || WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SAWED_OFF); return stack.getItem() == ModItems.gun_maresleg_broken || XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_SAWED_OFF);
} }
} }

View File

@ -3,7 +3,7 @@ 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.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -183,10 +183,10 @@ public class ItemRenderMinigunDual extends ItemRenderWeaponBase {
} }
public boolean hasSilencer(ItemStack stack, int cfg) { public boolean hasSilencer(ItemStack stack, int cfg) {
return WeaponModManager.hasUpgrade(stack, cfg, WeaponModManager.ID_SILENCER); return XWeaponModManager.hasUpgrade(stack, cfg, XWeaponModManager.ID_SILENCER);
} }
public boolean isSaturnite(ItemStack stack, int cfg) { public boolean isSaturnite(ItemStack stack, int cfg) {
return WeaponModManager.hasUpgrade(stack, cfg, WeaponModManager.ID_UZI_SATURN); return XWeaponModManager.hasUpgrade(stack, cfg, XWeaponModManager.ID_UZI_SATURN);
} }
} }

View File

@ -3,7 +3,7 @@ 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.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -110,6 +110,6 @@ public class ItemRenderPanzerschreck extends ItemRenderWeaponBase {
} }
public boolean hasShield(ItemStack stack) { public boolean hasShield(ItemStack stack) {
return !WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_NO_SHIELD); return !XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_NO_SHIELD);
} }
} }

View File

@ -3,7 +3,7 @@ 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.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -177,10 +177,10 @@ public class ItemRenderUzi extends ItemRenderWeaponBase {
} }
public boolean hasSilencer(ItemStack stack, int cfg) { public boolean hasSilencer(ItemStack stack, int cfg) {
return WeaponModManager.hasUpgrade(stack, cfg, WeaponModManager.ID_SILENCER); return XWeaponModManager.hasUpgrade(stack, cfg, XWeaponModManager.ID_SILENCER);
} }
public boolean isSaturnite(ItemStack stack) { public boolean isSaturnite(ItemStack stack) {
return WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_UZI_SATURN); return XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_UZI_SATURN);
} }
} }

View File

@ -3,7 +3,7 @@ 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.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.XWeaponModManager;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -289,10 +289,10 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase {
} }
public boolean hasSilencer(ItemStack stack, int cfg) { public boolean hasSilencer(ItemStack stack, int cfg) {
return WeaponModManager.hasUpgrade(stack, cfg, WeaponModManager.ID_SILENCER); return XWeaponModManager.hasUpgrade(stack, cfg, XWeaponModManager.ID_SILENCER);
} }
public boolean isSaturnite(ItemStack stack, int cfg) { public boolean isSaturnite(ItemStack stack, int cfg) {
return WeaponModManager.hasUpgrade(stack, cfg, WeaponModManager.ID_UZI_SATURN); return XWeaponModManager.hasUpgrade(stack, cfg, XWeaponModManager.ID_UZI_SATURN);
} }
} }

View File

@ -6,6 +6,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.ISound; import net.minecraft.client.audio.ISound;
import net.minecraft.client.audio.MovingSound; import net.minecraft.client.audio.MovingSound;
import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@ -14,8 +15,11 @@ public class AudioDynamic extends MovingSound {
public float maxVolume = 1; public float maxVolume = 1;
public float range; public float range;
public int keepAlive; public int keepAlive;
public int timeSinceKA;; public int timeSinceKA;
public boolean shouldExpire = false;; public boolean shouldExpire = false;
// shitty addition that should make looped sounds on tools and guns work right
// position updates happen automatically and if the parent is the client player, volume is always on max
public Entity parentEntity = null;
protected AudioDynamic(ResourceLocation loc) { protected AudioDynamic(ResourceLocation loc) {
super(loc); super(loc);
@ -30,13 +34,22 @@ public class AudioDynamic extends MovingSound {
this.zPosF = z; this.zPosF = z;
} }
public void attachTo(Entity e) {
this.parentEntity = e;
}
@Override @Override
public void update() { public void update() {
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer; EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
float f = 0; float f = 0;
if(player != null) { if(parentEntity != null) {
this.setPosition((float) parentEntity.posX, (float) parentEntity.posY, (float) parentEntity.posZ);
}
// only adjust volume over distance if the sound isn't attached to this entity
if(player != null && player != parentEntity) {
f = (float)Math.sqrt(Math.pow(xPosF - player.posX, 2) + Math.pow(yPosF - player.posY, 2) + Math.pow(zPosF - player.posZ, 2)); f = (float)Math.sqrt(Math.pow(xPosF - player.posX, 2) + Math.pow(yPosF - player.posY, 2) + Math.pow(zPosF - player.posZ, 2));
volume = func(f); volume = func(f);
} else { } else {

View File

@ -1,11 +1,14 @@
package com.hbm.sound; package com.hbm.sound;
import net.minecraft.entity.Entity;
public class AudioWrapper { public class AudioWrapper {
public void setKeepAlive(int keepAlive) { } public void setKeepAlive(int keepAlive) { }
public void keepAlive() { } public void keepAlive() { }
public void updatePosition(float x, float y, float z) { } public void updatePosition(float x, float y, float z) { }
public void attachTo(Entity e) { }
public void updateVolume(float volume) { } public void updateVolume(float volume) { }
public void updateRange(float range) { } public void updateRange(float range) { }

View File

@ -2,6 +2,7 @@ package com.hbm.sound;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@ -10,64 +11,59 @@ public class AudioWrapperClient extends AudioWrapper {
AudioDynamic sound; AudioDynamic sound;
public AudioWrapperClient(ResourceLocation source) { public AudioWrapperClient(ResourceLocation source) {
if(source != null) if(source != null) sound = new AudioDynamic(source);
sound = new AudioDynamic(source);
} }
@Override @Override
public void setKeepAlive(int keepAlive) { public void setKeepAlive(int keepAlive) {
if(sound != null) if(sound != null) sound.setKeepAlive(keepAlive);
sound.setKeepAlive(keepAlive);
} }
@Override @Override
public void keepAlive() { public void keepAlive() {
if(sound != null) if(sound != null) sound.keepAlive();
sound.keepAlive();
} }
@Override @Override
public void updatePosition(float x, float y, float z) { public void updatePosition(float x, float y, float z) {
if(sound != null) if(sound != null) sound.setPosition(x, y, z);
sound.setPosition(x, y, z); }
@Override
public void attachTo(Entity e) {
if(sound != null) sound.attachTo(e);
} }
@Override @Override
public void updateVolume(float volume) { public void updateVolume(float volume) {
if(sound != null) if(sound != null) sound.setVolume(volume);
sound.setVolume(volume);
} }
@Override @Override
public void updateRange(float range) { public void updateRange(float range) {
if(sound != null) if(sound != null) sound.setRange(range);
sound.setRange(range);
} }
@Override @Override
public void updatePitch(float pitch) { public void updatePitch(float pitch) {
if(sound != null) if(sound != null) sound.setPitch(pitch);
sound.setPitch(pitch);
} }
@Override @Override
public float getVolume() { public float getVolume() {
if(sound != null) if(sound != null) return sound.getVolume();
return sound.getVolume();
return 1; return 1;
} }
@Override @Override
public float getPitch() { public float getPitch() {
if(sound != null) if(sound != null) return sound.getPitch();
return sound.getPitch();
return 1; return 1;
} }
@Override @Override
public void startSound() { public void startSound() {
if(sound != null) if(sound != null) sound.start();
sound.start();
} }
@Override @Override
@ -80,6 +76,6 @@ public class AudioWrapperClient extends AudioWrapper {
@Override @Override
public boolean isPlaying() { public boolean isPlaying() {
return sound.isPlaying(); return sound != null ? sound.isPlaying() : false;
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 280 B

After

Width:  |  Height:  |  Size: 285 B