Fixed save data resetting
This commit is contained in:
@@ -65,6 +65,7 @@ public class VehicleBaseEntity extends Entity {
|
||||
BASE_DOUBLE_PARAMETERS.put("GRAVITY",!vehicleBuildInfo.GetAdheresToGravity() ? 0 : vehicleBuildInfo.GetGravityStrength()/200.0);
|
||||
BASE_BOOL_PARAMETERS.put("ADHERES_TO_GRAVITY",vehicleBuildInfo.GetAdheresToGravity());
|
||||
BASE_BOOL_PARAMETERS.put("ON_GROUND",true);
|
||||
BASE_BOOL_PARAMETERS.put("WHEEL_FRICTION",vehicleBuildInfo.doWheelsDrag());
|
||||
BASE_DOUBLE_PARAMETERS.put("CENTRE_OF_MASS_X",vehicleBuildInfo.GetCentreOfMass().x);
|
||||
BASE_DOUBLE_PARAMETERS.put("CENTRE_OF_MASS_Y",vehicleBuildInfo.GetCentreOfMass().y);
|
||||
BASE_DOUBLE_PARAMETERS.put("CENTRE_OF_MASS_Z",vehicleBuildInfo.GetCentreOfMass().z);
|
||||
@@ -257,14 +258,15 @@ public class VehicleBaseEntity extends Entity {
|
||||
|
||||
@Override
|
||||
protected void readAdditional(CompoundNBT compound) {
|
||||
if (compound.contains("CustomNBTData")) {
|
||||
if (compound.contains("VehicleData")) {
|
||||
this.dataManager.set(VEHICLE_SYNCHED_PARAMETERS, compound.getCompound("VehicleData"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeAdditional(CompoundNBT compound) {
|
||||
compound.put("VehicleData", this.dataManager.get(VEHICLE_SYNCHED_PARAMETERS));
|
||||
CompoundNBT SynchedData = this.dataManager.get(VEHICLE_SYNCHED_PARAMETERS).copy();
|
||||
compound.put("VehicleData", SynchedData);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -278,7 +280,7 @@ public class VehicleBaseEntity extends Entity {
|
||||
this.baseTick();
|
||||
this.LastPositionVector = CurrentPositionVector;
|
||||
CurrentPositionVector = getPositionVec();
|
||||
PhysicsTick();
|
||||
PhysicsTick(!this.world.isRemote());
|
||||
this.setPosition(this.getPosX(), this.getPosY(), this.getPosZ());
|
||||
Controller.PollInputs(GetByteArrayValue("INPUT_DATA"));
|
||||
SubClassTickUpdateEvent();
|
||||
@@ -315,7 +317,8 @@ public class VehicleBaseEntity extends Entity {
|
||||
VehicleVelocity = new Vector3(GetDoubleDataValue("VELOCITY_X"),GetDoubleDataValue("VELOCITY_Y"),GetDoubleDataValue("VELOCITY_Z"));
|
||||
}
|
||||
public boolean TouchingGround(){return GetBooleanDataValue("ON_GROUND");}
|
||||
public void PhysicsTick(){
|
||||
|
||||
public void PhysicsTick(boolean ServerSided){
|
||||
VehicleVelocity = new Vector3(GetDoubleDataValue("VELOCITY_X"),GetDoubleDataValue("VELOCITY_Y"),GetDoubleDataValue("VELOCITY_Z"));
|
||||
Vector3d Velocity = Vector3.Positive(VehicleVelocity).GetDouble();
|
||||
Vector3d NormalisedVelocity = Velocity.normalize();
|
||||
|
||||
@@ -81,8 +81,8 @@ public class VehicleCameraSettings {
|
||||
PointOfView Cam = minecraftInstance.gameSettings.getPointOfView();
|
||||
if (Cam == PointOfView.FIRST_PERSON) {
|
||||
//event.setRoll(event.getRoll() - CurrentPreset.GetCameraTransformations().getZ());
|
||||
//event.setYaw(event.getYaw() + (180F - CurrentPreset.GetCameraTransformations().getX()));
|
||||
//event.setPitch(event.getPitch() - CurrentPreset.GetCameraTransformations().getY());
|
||||
event.setYaw(event.getYaw() + (180F - CurrentPreset.GetCameraTransformations().getX()));
|
||||
event.setPitch(event.getPitch() - CurrentPreset.GetCameraTransformations().getY());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ public class VehicleBuildInfo {
|
||||
private float GasCelCapacity;
|
||||
private double Gravity = 4.9f;
|
||||
private boolean AdheresToGravity = true;
|
||||
private boolean WheelsHaveDragAndFriction = true;
|
||||
private Vector3d PilotSeat;
|
||||
private List<String> BuiltInVehicleInputActions = new ArrayList<>();
|
||||
private List<Vector3d> PassengerSeats = new ArrayList<>();
|
||||
@@ -33,6 +34,12 @@ public class VehicleBuildInfo {
|
||||
private Vector3d OriginOffset = new Vector3d(0,0,0);
|
||||
private PhysicsPreset physicsPreset = PhysicsPreset.AdvancedMinecraft;
|
||||
|
||||
public boolean doWheelsDrag(){return WheelsHaveDragAndFriction;}
|
||||
public VehicleBuildInfo SetWheelDrag(boolean WheelsDrag){
|
||||
this.WheelsHaveDragAndFriction = WheelsDrag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public VehicleBuildInfo SetOrigin(PivotOrigin OriginType, Vector3d OriginOffset){
|
||||
this.OriginType = OriginType;
|
||||
this.OriginOffset = OriginOffset;
|
||||
|
||||
Reference in New Issue
Block a user