update readme

This commit is contained in:
Halbear
2026-05-19 23:22:02 +01:00
parent 5fdf6b2093
commit d4c9dfdb45
4 changed files with 29 additions and 0 deletions
+15
View File
@@ -16,11 +16,26 @@ public class MyVehicleClass extends VehicleBaseEntity {
.SetGasCelCapacity(1000); .SetGasCelCapacity(1000);
public MyVehicleClass(EntityType<?> Type, World WorldIn) { public MyVehicleClass(EntityType<?> Type, World WorldIn) {
//The parameters in this super are the Type, the World, an array of seat positions and the vehicle build info
//specify as many seat positions as you want in this array as it loads all of them as player seats on the entity
super(Type, WorldIn, new Vector3d[]{new Vector3d(0.0D, -1D, 0.0D)}, buildInfo); // The super class handles everything entity related super(Type, WorldIn, new Vector3d[]{new Vector3d(0.0D, -1D, 0.0D)}, buildInfo); // The super class handles everything entity related
//this allows you to completely customise how the camera is structure for the vehicle,
//the first Vector is position offset, the 2nd vector is rotation,
//and then the first float value is 1st person FOV with the 2nd float value being 3rd person FOV
VehicleCameraSettings.AddEntityCameraPreset(this.getType(), VehicleCameraSettings.AddEntityCameraPreset(this.getType(),
new VehicleCameraPreset(new Vector3f(0,4.0f, 16.0f), new VehicleCameraPreset(new Vector3f(0,4.0f, 16.0f),
new Vector3f(0,0,0),70,65f)); new Vector3f(0,0,0),70,65f));
} }
@Override
public void TickUpdateEvent(){
//this is called by the super class every tick update
//and is a safer way to add code without overriding what happens in the parent class
//you can still @Override the normal tick update though
}
} }
``` ```
### The entity renderer: ### The entity renderer:
@@ -124,6 +124,10 @@ public class VehicleBaseEntity extends Entity {
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();
TickUpdateEvent();
}
public void TickUpdateEvent() {
} }
@@ -26,5 +26,10 @@ public class Aeroplane extends VehicleBaseEntity {
new VehicleCameraPreset(new Vector3f(0,0,4.5f), new VehicleCameraPreset(new Vector3f(0,0,4.5f),
new Vector3f(0,0,0),70,60)); new Vector3f(0,0,0),70,60));
} }
@Override
public void TickUpdateEvent(){
}
} }
@@ -27,4 +27,9 @@ public class Airboat extends VehicleBaseEntity {
new VehicleCameraPreset(new Vector3f(0,4.0f, 16.0f), new VehicleCameraPreset(new Vector3f(0,4.0f, 16.0f),
new Vector3f(0,0,0),70,65f)); new Vector3f(0,0,0),70,65f));
} }
@Override
public void TickUpdateEvent(){
}
} }