gun stuff

This commit is contained in:
Boblet 2024-09-03 16:00:41 +02:00
parent 13ffc6a66a
commit a3c56e0a11
7 changed files with 87 additions and 2 deletions

View File

@ -5,6 +5,7 @@
* Removed forgotten bricks
* Updated CMB brick texture
* The ICF machine block now renders with its 3d model in the creative inventory
* "Toggle backpack" keybind is now called "toggle jetpack" to reduce confusion
## Fixed
* Fixed pumpjack gauges not syncing properly

View File

@ -0,0 +1,20 @@
package com.hbm.items.weapon.sedna;
import com.hbm.inventory.RecipesCommon.ComparableStack;
public class BulletConfig {
public ComparableStack ammo;
public int ammoCount = 1;
public float velocity = 5F;
public float spread = 0F;
public float wear = 1F;
public int projectilesMin;
public int projectilesMax;
public float damageMult = 1.0F;
public float headshotMult = 1.0F;
public double gravity = 0;
public int expires = 100;
}

View File

@ -0,0 +1,5 @@
package com.hbm.items.weapon.sedna;
public class GunConfig {
// ???
}

View File

@ -0,0 +1,54 @@
package com.hbm.items.weapon.sedna;
import com.hbm.handler.HbmKeybinds.EnumKeybind;
import com.hbm.items.IKeybindReceiver;
import com.hbm.util.EnumUtil;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class ItemGunBase implements IKeybindReceiver {
public static final String KEY_TIMER = "timer";
public static final String KEY_STATE = "state";
public static final String KEY_MAG_COUNT = "magcount";
public static final String KEY_MAG_TYPE = "magtype";
public static enum GunState {
IDLE, //gun can be fired or reloaded
WINDUP, //fire button is down, added delay before fire
JUST_FIRED, //gun has been fired, cooldown
RELOADING //gun is currently reloading
}
@Override
public void handleKeybind(EntityPlayer player, ItemStack stack, EnumKeybind keybind, boolean state) {
}
//TODO: move into the IMagazine impl
/*// MAG TYPE //
public static int getMagType(ItemStack stack, int index) { return getValueInt(stack, KEY_MAG_TYPE + index); }
public static void setMagType(ItemStack stack, int index, int value) { setValueInt(stack, KEY_MAG_TYPE + index, value); }
// MAG COUNT //
public static int getMagCount(ItemStack stack, int index) { return getValueInt(stack, KEY_MAG_COUNT + index); }
public static void setMagCount(ItemStack stack, int index, int value) { setValueInt(stack, KEY_MAG_COUNT + index, value); }*/
// GUN STATE TIMER //
public static int getTimer(ItemStack stack) { return getValueInt(stack, KEY_TIMER); }
public static void setTimer(ItemStack stack, int value) { setValueInt(stack, KEY_TIMER, value); }
// GUN STATE //
public static GunState getState(ItemStack stack) { return EnumUtil.grabEnumSafely(GunState.class, getValueByte(stack, KEY_STATE)); }
public static void setState(ItemStack stack, GunState value) { setValueByte(stack, KEY_STATE, (byte) value.ordinal()); }
/// UTIL ///
public static int getValueInt(ItemStack stack, String name) { if(stack.hasTagCompound()) stack.getTagCompound().getInteger(name); return 0; }
public static void setValueInt(ItemStack stack, String name, int value) { if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound(); stack.getTagCompound().setInteger(name, value); }
public static byte getValueByte(ItemStack stack, String name) { if(stack.hasTagCompound()) stack.getTagCompound().getByte(name); return 0; }
public static void setValueByte(ItemStack stack, String name, byte value) { if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound(); stack.getTagCompound().setByte(name, value); }
}

View File

@ -0,0 +1,5 @@
package com.hbm.items.weapon.sedna.mags;
public interface IMagazine {
}

View File

@ -654,7 +654,7 @@ hbm.key.craneMoveDown=Kran rückwärts
hbm.key.craneMoveLeft=Kran nach links
hbm.key.craneMoveRight=Kran nach rechts
hbm.key.craneMoveUp=Kran vorwärts
hbm.key.toggleBack=Rucksack umschalten
hbm.key.toggleBack=Jetpack umschalten
hbm.key.toggleHUD=HUD umschalten
hbm.key.reload=Nachladen

View File

@ -1350,7 +1350,7 @@ hbm.key.craneMoveLeft=Move Crane Left
hbm.key.craneMoveRight=Move Crane Right
hbm.key.craneMoveUp=Move Crane Forward
hbm.key.dash=Dash (Unbind from Crouch in config)
hbm.key.toggleBack=Toggle Backpack
hbm.key.toggleBack=Toggle Jetpack
hbm.key.toggleHUD=Toggle HUD
hbm.key.reload=Reload