update readme
This commit is contained in:
@@ -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
|
||||
### 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
|
||||
.SetEngineType(EngineCategories.Aircraft_Propeller) //this example uses the Zepplin vehicle properties
|
||||
.SetMaxEngineRPM(3000)
|
||||
@@ -15,7 +15,7 @@ public class [MyVehicleClass] extends VehicleBaseEntity {
|
||||
.SetGasCelCount(8)
|
||||
.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
|
||||
VehicleCameraSettings.AddEntityCameraPreset(this.getType(),
|
||||
new VehicleCameraPreset(new Vector3f(0,4.0f, 16.0f),
|
||||
@@ -24,12 +24,12 @@ public class [MyVehicleClass] extends VehicleBaseEntity {
|
||||
}
|
||||
```
|
||||
### 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)
|
||||
public class [MyVehicleRenderer] extends VehicleBaseRenderer {
|
||||
|
||||
public class MyVehicleRenderer extends VehicleBaseRenderer {
|
||||
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 final RegistryObject<EntityType< [MyVehicleClass] >> MY_VEHICLE =
|
||||
ENTITY_TYPES.register("my_vehicle", ()-> EntityType.Builder.create( [MyVehicleClass] ::new,
|
||||
public static final RegistryObject<EntityType<MyVehicleClass>> MY_VEHICLE =
|
||||
ENTITY_TYPES.register("my_vehicle", ()-> EntityType.Builder.create(MyVehicleClass::new,
|
||||
EntityClassification.MISC ).size(3f,2f).build(new ResourceLocation(MOD_ID, "my_vehicle").toString()));
|
||||
```
|
||||
### 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 {
|
||||
@SubscribeEvent
|
||||
public static void init(final FMLClientSetupEvent event) {
|
||||
RenderingRegistry.registerEntityRenderingHandler(ModEntities.MY_VEHICLE.get(), [MyVehicleRenderer] ::new);
|
||||
RenderingRegistry.registerEntityRenderingHandler(ModEntities.MY_VEHICLE.get(), MyVehicleRenderer::new);
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user