update readme

This commit is contained in:
Halbear
2026-05-19 23:16:12 +01:00
parent 197ccc9b30
commit 5fdf6b2093
+9 -9
View File
@@ -5,9 +5,9 @@ a simple to use but powerful vehicle library for Minecraft Forge 1.16.5, 1.20.1,
after importing the library, to create an entity with the framework you structure it as so after importing the library, to create an entity with the framework you structure it as so
### The entity itself: ### The entity itself:
``` ```
public class [MyVehicleClass] extends VehicleBaseEntity { public class MyVehicleClass extends VehicleBaseEntity {
private static final VehicleBuildInfo buildInfo = new VehicleBuildInfo(VehicleClassification. [classification] ) private static final VehicleBuildInfo buildInfo = new VehicleBuildInfo(VehicleClassification.Zepplin)
.SetEngineCount(2) //example properties .SetEngineCount(2) //example properties
.SetEngineType(EngineCategories.Aircraft_Propeller) //this example uses the Zepplin vehicle properties .SetEngineType(EngineCategories.Aircraft_Propeller) //this example uses the Zepplin vehicle properties
.SetMaxEngineRPM(3000) .SetMaxEngineRPM(3000)
@@ -15,7 +15,7 @@ public class [MyVehicleClass] extends VehicleBaseEntity {
.SetGasCelCount(8) .SetGasCelCount(8)
.SetGasCelCapacity(1000); .SetGasCelCapacity(1000);
public Airboat(EntityType<?> Type, World WorldIn) { public MyVehicleClass(EntityType<?> Type, World WorldIn) {
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
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),
@@ -24,12 +24,12 @@ public class [MyVehicleClass] extends VehicleBaseEntity {
} }
``` ```
### The entity renderer: ### The entity renderer:
this you put an array of models in but for this example its an array of 1 size, this is so you can put multiple models for a single vehicle in, or make it dynamically swappable in game
``` ```
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class [MyVehicleRenderer] extends VehicleBaseRenderer { public class MyVehicleRenderer extends VehicleBaseRenderer {
public AirboatRenderer(EntityRendererManager renderManagerIn) { public AirboatRenderer(EntityRendererManager renderManagerIn) {
super(renderManagerIn, new EntityModel<?>[]{new [MyVehicleModel] ()},"textures/entities/ [MyVehicleTexture] .png" ); super(renderManagerIn, new EntityModel<?>[]{new MyVehicleModel()},"textures/entities/MyVehicleTexture.png");
} }
} }
``` ```
@@ -38,8 +38,8 @@ you register the entity as if it were any other entity
``` ```
public static DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITIES, MOD_ID); public static DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITIES, MOD_ID);
public static final RegistryObject<EntityType< [MyVehicleClass] >> MY_VEHICLE = public static final RegistryObject<EntityType<MyVehicleClass>> MY_VEHICLE =
ENTITY_TYPES.register("my_vehicle", ()-> EntityType.Builder.create( [MyVehicleClass] ::new, ENTITY_TYPES.register("my_vehicle", ()-> EntityType.Builder.create(MyVehicleClass::new,
EntityClassification.MISC ).size(3f,2f).build(new ResourceLocation(MOD_ID, "my_vehicle").toString())); EntityClassification.MISC ).size(3f,2f).build(new ResourceLocation(MOD_ID, "my_vehicle").toString()));
``` ```
### Registering the renderer ### Registering the renderer
@@ -49,7 +49,7 @@ this is also the same as if it were any other entity, it is put in the client ev
public class ClientEventHandler { public class ClientEventHandler {
@SubscribeEvent @SubscribeEvent
public static void init(final FMLClientSetupEvent event) { public static void init(final FMLClientSetupEvent event) {
RenderingRegistry.registerEntityRenderingHandler(ModEntities.MY_VEHICLE.get(), [MyVehicleRenderer] ::new); RenderingRegistry.registerEntityRenderingHandler(ModEntities.MY_VEHICLE.get(), MyVehicleRenderer::new);
} }
} }
``` ```