mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
trenchie: the return
This commit is contained in:
parent
c6966aa7dc
commit
eeefb0e4eb
@ -3,7 +3,10 @@ package com.hbm.items.armor;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.extprop.HbmPlayerProps;
|
||||
import com.hbm.handler.ArmorModHandler;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.render.model.ModelArmorTrenchmaster;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -11,6 +14,7 @@ import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
|
||||
@ -43,7 +47,7 @@ public class ArmorTrenchmaster extends ArmorFSB {
|
||||
super.addInformation(stack, player, list, ext);
|
||||
|
||||
//list.add(EnumChatFormatting.RED + " " + I18nUtil.resolveKey("armor.fasterReload"));
|
||||
//list.add(EnumChatFormatting.RED + " " + I18nUtil.resolveKey("armor.moreAmmo"));
|
||||
list.add(EnumChatFormatting.RED + " " + I18nUtil.resolveKey("armor.moreAmmo"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -83,4 +87,17 @@ public class ArmorTrenchmaster extends ArmorFSB {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isTrenchMaster(EntityPlayer player) {
|
||||
return player.inventory.armorInventory[2] != null && player.inventory.armorInventory[2].getItem() == ModItems.trenchmaster_plate && ArmorFSB.hasFSBArmor(player);
|
||||
}
|
||||
|
||||
public static boolean hasAoS(EntityPlayer player) {
|
||||
if(player.inventory.armorInventory[3] != null) {
|
||||
ItemStack[] mods = ArmorModHandler.pryMods(player.inventory.armorInventory[3]);
|
||||
ItemStack helmet = mods[ArmorModHandler.helmet_only];
|
||||
return helmet != null && helmet.getItem() == ModItems.card_aos;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@ import org.lwjgl.input.Mouse;
|
||||
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.entity.projectile.EntityBulletBaseNT;
|
||||
import com.hbm.handler.ArmorModHandler;
|
||||
import com.hbm.handler.BulletConfigSyncingUtil;
|
||||
import com.hbm.handler.BulletConfiguration;
|
||||
import com.hbm.handler.CasingEjector;
|
||||
@ -17,8 +16,7 @@ import com.hbm.interfaces.IHoldableWeapon;
|
||||
import com.hbm.interfaces.IItemHUD;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.items.IEquipReceiver;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.armor.ArmorFSB;
|
||||
import com.hbm.items.armor.ArmorTrenchmaster;
|
||||
import com.hbm.items.weapon.sedna.Crosshair;
|
||||
import com.hbm.lib.HbmCollection;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
@ -50,6 +48,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
|
||||
@Deprecated
|
||||
public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEquipReceiver {
|
||||
|
||||
public GunConfiguration mainConfig;
|
||||
@ -590,8 +589,8 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
config = altConfig;
|
||||
|
||||
if(hasInfinity(stack, config)) return;
|
||||
if(isTrenchMaster(player) && player.getRNG().nextInt(3) == 0) return;
|
||||
if(hasAoS(player) && player.getRNG().nextInt(3) == 0) return;
|
||||
if(ArmorTrenchmaster.isTrenchMaster(player) && player.getRNG().nextInt(3) == 0) return;
|
||||
if(ArmorTrenchmaster.hasAoS(player) && player.getRNG().nextInt(3) == 0) return;
|
||||
|
||||
if(config.reloadType != GunConfiguration.RELOAD_NONE) {
|
||||
setMag(stack, getMag(stack) - 1);
|
||||
@ -842,20 +841,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
GunConfiguration config = ((ItemGunBase) stack.getItem()).mainConfig;
|
||||
int cycle = config.reloadDuration;
|
||||
if (getMag(stack) == 0) cycle += config.emptyReloadAdditionalDuration;
|
||||
if(isTrenchMaster(player)) return Math.max(1, cycle / 2);
|
||||
if(ArmorTrenchmaster.isTrenchMaster(player)) return Math.max(1, cycle / 2);
|
||||
return cycle;
|
||||
}
|
||||
|
||||
public static boolean isTrenchMaster(EntityPlayer player) {
|
||||
return player.inventory.armorInventory[2] != null && player.inventory.armorInventory[2].getItem() == ModItems.trenchmaster_plate && ArmorFSB.hasFSBArmor(player);
|
||||
}
|
||||
|
||||
public static boolean hasAoS(EntityPlayer player) {
|
||||
if(player.inventory.armorInventory[3] != null) {
|
||||
ItemStack[] mods = ArmorModHandler.pryMods(player.inventory.armorInventory[3]);
|
||||
ItemStack helmet = mods[ArmorModHandler.helmet_only];
|
||||
return helmet != null && helmet.getItem() == ModItems.card_aos;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.inventory.gui.GUIWeaponTable;
|
||||
import com.hbm.items.IEquipReceiver;
|
||||
import com.hbm.items.IKeybindReceiver;
|
||||
import com.hbm.items.armor.ArmorTrenchmaster;
|
||||
import com.hbm.items.weapon.sedna.hud.IHUDComponent;
|
||||
import com.hbm.items.weapon.sedna.mags.IMagazine;
|
||||
import com.hbm.items.weapon.sedna.mods.WeaponModManager;
|
||||
@ -320,7 +321,7 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IItemHUD, I
|
||||
return;
|
||||
}
|
||||
|
||||
for(int i = 0; i < confNo; i++) {
|
||||
for(int i = 0; i < confNo; i++) for(int k = 0; k == 0 || (k < 2 && ArmorTrenchmaster.isTrenchMaster(player) && this.getState(stack, i) == GunState.RELOADING); k++) {
|
||||
BiConsumer<ItemStack, LambdaContext> orchestra = configs[i].getOrchestra(stack);
|
||||
if(orchestra != null) orchestra.accept(stack, ctx[i]);
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.hbm.items.weapon.sedna.mags;
|
||||
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.armor.ArmorTrenchmaster;
|
||||
import com.hbm.items.tool.ItemCasingBag;
|
||||
import com.hbm.items.weapon.sedna.BulletConfig;
|
||||
import com.hbm.particle.SpentCasing;
|
||||
@ -58,4 +59,14 @@ public interface IMagazine<T> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean shouldUseUpTrenchie(IInventory inv) {
|
||||
if(inv instanceof InventoryPlayer) {
|
||||
InventoryPlayer invPlayer = (InventoryPlayer) inv;
|
||||
boolean trenchie = ArmorTrenchmaster.isTrenchMaster(invPlayer.player);
|
||||
boolean aos = ArmorTrenchmaster.hasAoS(invPlayer.player);
|
||||
if(trenchie || aos) return invPlayer.player.getRNG().nextInt(3) < 2;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,6 +29,7 @@ public class MagazineBelt implements IMagazine<BulletConfig> {
|
||||
@Override
|
||||
public void useUpAmmo(ItemStack stack, IInventory inventory, int amount) {
|
||||
if(inventory == null) return;
|
||||
if(!IMagazine.shouldUseUpTrenchie(inventory)) return;
|
||||
|
||||
BulletConfig first = this.getFirstConfig(stack, inventory);
|
||||
|
||||
|
||||
@ -69,6 +69,7 @@ public abstract class MagazineSingleTypeBase implements IMagazine<BulletConfig>
|
||||
|
||||
@Override
|
||||
public void useUpAmmo(ItemStack stack, IInventory inventory, int amount) {
|
||||
if(!IMagazine.shouldUseUpTrenchie(inventory) && getCapacity(stack) != 1) return;
|
||||
this.setAmount(stack, this.getAmount(stack, inventory) - amount);
|
||||
IMagazine.handleAmmoBag(inventory, this.getType(stack, inventory), amount);
|
||||
}
|
||||
|
||||
@ -45,7 +45,6 @@ import com.hbm.tileentity.bomb.TileEntityNukeCustom;
|
||||
import com.hbm.tileentity.machine.rbmk.RBMKDials;
|
||||
import com.hbm.util.*;
|
||||
import com.hbm.world.biome.BiomeGenCraterBase;
|
||||
import com.hbm.world.biome.BiomeGenNoMansLand;
|
||||
import com.hbm.world.feature.BedrockOre;
|
||||
import com.hbm.world.feature.OreCave;
|
||||
import com.hbm.world.feature.OreLayer3D;
|
||||
@ -300,7 +299,7 @@ public class MainRegistry {
|
||||
OreDictManager.registerOres();
|
||||
|
||||
if(WorldConfig.enableCraterBiomes) BiomeGenCraterBase.initDictionary();
|
||||
BiomeGenNoMansLand.initDictionary();
|
||||
//BiomeGenNoMansLand.initDictionary();
|
||||
|
||||
aMatSchrab.customCraftingMaterial = ModItems.ingot_schrabidium;
|
||||
aMatHaz.customCraftingMaterial = ModItems.hazmat_cloth;
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.packet.toclient;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import com.hbm.items.armor.ArmorTrenchmaster;
|
||||
import com.hbm.items.weapon.ItemGunBase;
|
||||
import com.hbm.items.weapon.sedna.GunConfig;
|
||||
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
|
||||
@ -105,6 +106,7 @@ public class GunAnimationPacket implements IMessage {
|
||||
|
||||
if(animation != null) {
|
||||
boolean isReloadAnimation = type == AnimType.RELOAD || type == AnimType.RELOAD_CYCLE || type == AnimType.RELOAD_EMPTY;
|
||||
if(isReloadAnimation && ArmorTrenchmaster.isTrenchMaster(player)) animation.setTimeMult(0.5D);
|
||||
HbmAnimations.hotbar[slot][0] = new Animation(stack.getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, type, isReloadAnimation && base.mainConfig.reloadAnimationsSequential);
|
||||
}
|
||||
|
||||
@ -143,6 +145,7 @@ public class GunAnimationPacket implements IMessage {
|
||||
Minecraft.getMinecraft().entityRenderer.itemRenderer.resetEquippedProgress();
|
||||
Minecraft.getMinecraft().entityRenderer.itemRenderer.itemToRender = stack;
|
||||
boolean isReloadAnimation = type == AnimType.RELOAD || type == AnimType.RELOAD_CYCLE || type == AnimType.RELOAD_EMPTY;
|
||||
if(isReloadAnimation && ArmorTrenchmaster.isTrenchMaster(player)) animation.setTimeMult(0.5D);
|
||||
HbmAnimations.hotbar[slot][gunIndex] = new Animation(stack.getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, type, isReloadAnimation && config.getReloadAnimSequential(stack));
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,6 +64,16 @@ public class BusAnimation {
|
||||
return animationBuses.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Multiplies all keyframe durations by the supplied double. Numbers below 1 make the animation play faster.
|
||||
* @param mult
|
||||
*/
|
||||
public void setTimeMult(double mult) {
|
||||
for(Entry<String, BusAnimationSequence> sequence : animationBuses.entrySet()) {
|
||||
sequence.getValue().multiplyTime(mult);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of a bus at a specified time
|
||||
* @param name the name of the bus in question
|
||||
@ -78,15 +88,6 @@ public class BusAnimation {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* reads all buses and checks if inbetween the last invocation and this one, a sound was scheduled
|
||||
* @param lastMillis the last time the bus was checked
|
||||
* @param millis the current time
|
||||
*/
|
||||
public void playPendingSounds(int lastMillis, int millis) {
|
||||
//TODO: pending
|
||||
}
|
||||
|
||||
public int getDuration() {
|
||||
return totalTime;
|
||||
}
|
||||
|
||||
@ -86,11 +86,25 @@ public class BusAnimationSequence {
|
||||
return hold(duration);
|
||||
}
|
||||
|
||||
public BusAnimationSequence multiplyTime(double mult) {
|
||||
|
||||
for(Dimension dim : Dimension.values()) {
|
||||
List<BusAnimationKeyframe> keyframes = transformKeyframes.get(dim.ordinal());
|
||||
for(BusAnimationKeyframe keyframe : keyframes) keyframe.duration *= mult;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Grabs the numerical value for the most recent keyframe on the given dimension */
|
||||
private double getLast(Dimension dim) {
|
||||
BusAnimationKeyframe frame = getLastFrame(dim);
|
||||
return frame != null ? frame.value : 0D;
|
||||
}
|
||||
|
||||
private BusAnimationKeyframe getLastFrame(Dimension dim) {
|
||||
List<BusAnimationKeyframe> keyframes = transformKeyframes.get(dim.ordinal());
|
||||
if(keyframes.isEmpty()) return 0D;
|
||||
return keyframes.get(keyframes.size() - 1).value;
|
||||
if(keyframes.isEmpty()) return null;
|
||||
return keyframes.get(keyframes.size() - 1);
|
||||
}
|
||||
|
||||
//all transformation data is absolute, additive transformations have not yet been implemented
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user