将枪械ID挪至JSON数据内
This commit is contained in:
parent
6f30687b77
commit
9f4ad5435a
39 changed files with 43 additions and 5 deletions
|
@ -6,6 +6,8 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
public class DefaultGunData {
|
||||
@SerializedName("ID")
|
||||
public String id = "";
|
||||
|
||||
@SerializedName("RecoilX")
|
||||
public double recoilX;
|
||||
|
|
|
@ -55,7 +55,7 @@ public class GunData {
|
|||
this.item = gunItem;
|
||||
this.stack = stack;
|
||||
var id = stack.getDescriptionId();
|
||||
this.id = id.substring(id.lastIndexOf(".") + 1);
|
||||
this.id = id.substring(id.indexOf(".") + 1).replace('.', ':');
|
||||
|
||||
var customData = stack.get(DataComponents.CUSTOM_DATA);
|
||||
this.tag = customData != null ? customData.copyTag() : new CompoundTag();
|
||||
|
|
|
@ -32,16 +32,16 @@ public class GunsTool {
|
|||
gunsData.clear();
|
||||
GunData.dataCache.invalidateAll();
|
||||
|
||||
// TODO 将枪械ID挪至JSON数据内
|
||||
for (var entry : manager.listResources("guns", file -> file.getPath().endsWith(".json")).entrySet()) {
|
||||
var id = entry.getKey();
|
||||
var attribute = entry.getValue();
|
||||
|
||||
try {
|
||||
Gson gson = new Gson();
|
||||
var data = gson.fromJson(new InputStreamReader(attribute.open()), DefaultGunData.class);
|
||||
var path = id.getPath();
|
||||
|
||||
gunsData.put(path.substring(5, path.length() - 5), data);
|
||||
if (!gunsData.containsKey(data.id)) {
|
||||
gunsData.put(data.id, data);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Mod.LOGGER.error(e.getMessage());
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:aa_12",
|
||||
"Spread": 3.5,
|
||||
"RecoilX": 0.006,
|
||||
"RecoilY": 0.018,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:ak_12",
|
||||
"MinZoom": 1.25,
|
||||
"MaxZoom": 6,
|
||||
"Spread": 3.5,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:ak_47",
|
||||
"MinZoom": 1.25,
|
||||
"MaxZoom": 6,
|
||||
"Spread": 4,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:aurelia_sceptre",
|
||||
"Spread": 0.5,
|
||||
"RecoilX": 0,
|
||||
"RecoilY": 0,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:bocek",
|
||||
"Spread": 4,
|
||||
"Headshot": 2.5,
|
||||
"Damage": 48,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:devotion",
|
||||
"DefaultZoom": 2,
|
||||
"Spread": 5,
|
||||
"RecoilX": 0.0018,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:glock_17",
|
||||
"Spread": 2.5,
|
||||
"RecoilX": 0.004,
|
||||
"RecoilY": 0.013,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:glock_18",
|
||||
"Spread": 2.5,
|
||||
"RecoilX": 0.004,
|
||||
"RecoilY": 0.013,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:hk_416",
|
||||
"MinZoom": 1.25,
|
||||
"MaxZoom": 6,
|
||||
"Spread": 3.5,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:homemade_shotgun",
|
||||
"Spread": 4,
|
||||
"RecoilX": 0.005,
|
||||
"RecoilY": 0.026,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:hunting_rifle",
|
||||
"Spread": 7,
|
||||
"RecoilX": 0.004,
|
||||
"RecoilY": 0.04,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:insidious",
|
||||
"Spread": 4,
|
||||
"RecoilX": 0.006,
|
||||
"RecoilY": 0.011,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:javelin",
|
||||
"DefaultZoom": 3,
|
||||
"Spread": 5,
|
||||
"Magazine": 1,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:k_98",
|
||||
"Spread": 5,
|
||||
"RecoilX": 0.002,
|
||||
"RecoilY": 0.063,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:m_1911",
|
||||
"Spread": 2.5,
|
||||
"RecoilX": 0.006,
|
||||
"RecoilY": 0.018,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:m_4",
|
||||
"MinZoom": 4,
|
||||
"MaxZoom": 8,
|
||||
"Spread": 4,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:m_60",
|
||||
"Spread": 5,
|
||||
"RecoilX": 0.004,
|
||||
"RecoilY": 0.014,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:m_79",
|
||||
"Spread": 3.5,
|
||||
"RecoilX": 0.004,
|
||||
"RecoilY": 0.023,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:m_870",
|
||||
"Spread": 3,
|
||||
"RecoilX": 0.009,
|
||||
"RecoilY": 0.04,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:m_98b",
|
||||
"DefaultZoom": 6,
|
||||
"MinZoom": 4,
|
||||
"MaxZoom": 8,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:marlin",
|
||||
"Spread": 2,
|
||||
"RecoilX": 0.004,
|
||||
"RecoilY": 0.031,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:minigun",
|
||||
"Spread": 1.5,
|
||||
"RecoilX": 0.003,
|
||||
"RecoilY": 0.02,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:mk_14",
|
||||
"MinZoom": 1.25,
|
||||
"MaxZoom": 6,
|
||||
"Spread": 5,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:mosin_nagant",
|
||||
"DefaultZoom": 3.5,
|
||||
"Spread": 4.8,
|
||||
"RecoilX": 0.002,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:mp_443",
|
||||
"Spread": 2.5,
|
||||
"RecoilX": 0.004,
|
||||
"RecoilY": 0.013,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:ntw_20",
|
||||
"MinZoom": 1.25,
|
||||
"MaxZoom": 6,
|
||||
"Spread": 8,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:qbz_95",
|
||||
"MinZoom": 4,
|
||||
"MaxZoom": 8,
|
||||
"Spread": 3.7,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:rpg",
|
||||
"Spread": 5,
|
||||
"RecoilX": 0.008,
|
||||
"RecoilY": 0.018,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:rpk",
|
||||
"MinZoom": 1.25,
|
||||
"MaxZoom": 6,
|
||||
"Spread": 5.5,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:secondary_cataclysm",
|
||||
"Spread": 5,
|
||||
"RecoilX": 0.004,
|
||||
"RecoilY": 0.023,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:sentinel",
|
||||
"DefaultZoom": 3,
|
||||
"Spread": 6,
|
||||
"RecoilX": 0.007,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:sks",
|
||||
"Spread": 4.5,
|
||||
"RecoilX": 0.004,
|
||||
"RecoilY": 0.015,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:svd",
|
||||
"MinZoom": 4,
|
||||
"MaxZoom": 8,
|
||||
"Spread": 5.5,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:taser",
|
||||
"Spread": 2,
|
||||
"RecoilX": 0.0001,
|
||||
"RecoilY": 0.002,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:trachelium",
|
||||
"Spread": 3,
|
||||
"RecoilX": 0.005,
|
||||
"RecoilY": 0.032,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:vector",
|
||||
"Spread": 2.3,
|
||||
"RecoilX": 0,
|
||||
"RecoilY": 0.007,
|
||||
|
|
Loading…
Add table
Reference in a new issue