提取UpStep属性
This commit is contained in:
parent
a75260754a
commit
8ffada46d8
6 changed files with 23 additions and 14 deletions
|
@ -19,6 +19,9 @@ public class DefaultVehicleData {
|
|||
@SerializedName("MaxEnergy")
|
||||
public int maxEnergy = 100000;
|
||||
|
||||
@SerializedName("UpStep")
|
||||
public float upStep = 0;
|
||||
|
||||
// TODO damage modifier
|
||||
// @SerializedName("DamageModifier")
|
||||
// private List<DamageModify> damageModifier;
|
||||
|
|
|
@ -15,11 +15,9 @@ public class VehicleData {
|
|||
private VehicleData(VehicleEntity entity) {
|
||||
this.id = EntityType.getKey(entity.getType()).toString();
|
||||
this.data = VehicleDataTool.vehicleData.getOrDefault(id, new DefaultVehicleData());
|
||||
|
||||
System.out.println(111);
|
||||
}
|
||||
|
||||
private static final LoadingCache<VehicleEntity, VehicleData> dataCache = CacheBuilder.newBuilder()
|
||||
public static final LoadingCache<VehicleEntity, VehicleData> dataCache = CacheBuilder.newBuilder()
|
||||
.weakKeys()
|
||||
.build(new CacheLoader<>() {
|
||||
public @NotNull VehicleData load(@NotNull VehicleEntity entity) {
|
||||
|
@ -47,4 +45,8 @@ public class VehicleData {
|
|||
return data.maxEnergy;
|
||||
}
|
||||
|
||||
public float upStep() {
|
||||
return data.upStep;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -59,11 +59,6 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
|||
super(type, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float maxUpStep() {
|
||||
return 0.5F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThirdPersonCameraPosition getThirdPersonCameraPosition(int index) {
|
||||
return new ThirdPersonCameraPosition(4, 1, 0);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.atsuishio.superbwarfare.entity.vehicle.base;
|
||||
|
||||
import com.atsuishio.superbwarfare.capability.energy.SyncedEntityEnergyStorage;
|
||||
import com.atsuishio.superbwarfare.data.vehicle.VehicleData;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.IntTag;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
|
@ -76,7 +75,7 @@ public abstract class EnergyVehicleEntity extends VehicleEntity {
|
|||
}
|
||||
|
||||
public int getMaxEnergy() {
|
||||
return VehicleData.from(this).maxEnergy();
|
||||
return data().maxEnergy();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -174,6 +174,15 @@ public abstract class VehicleEntity extends Entity {
|
|||
this.gameEvent(GameEvent.ENTITY_DISMOUNT, pPassenger);
|
||||
}
|
||||
|
||||
public VehicleData data() {
|
||||
return VehicleData.from(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float maxUpStep() {
|
||||
return data().upStep();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Entity getFirstPassenger() {
|
||||
|
@ -501,7 +510,7 @@ public abstract class VehicleEntity extends Entity {
|
|||
}
|
||||
|
||||
public float getMaxHealth() {
|
||||
return VehicleData.from(this).maxHealth();
|
||||
return data().maxHealth();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -546,14 +555,14 @@ public abstract class VehicleEntity extends Entity {
|
|||
* 呼吸回血冷却时长(单位:tick),设为小于0的值以禁用呼吸回血
|
||||
*/
|
||||
public int maxRepairCoolDown() {
|
||||
return VehicleData.from(this).repairCooldown();
|
||||
return data().repairCooldown();
|
||||
}
|
||||
|
||||
/**
|
||||
* 呼吸回血回血量
|
||||
*/
|
||||
public float repairAmount() {
|
||||
return VehicleData.from(this).repairAmount();
|
||||
return data().repairAmount();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"ID": "superbwarfare:tom_6",
|
||||
"MaxHealth": 40,
|
||||
"MaxEnergy": 100000
|
||||
"MaxEnergy": 100000,
|
||||
"UpStep": 0.5
|
||||
}
|
Loading…
Add table
Reference in a new issue