# Hal's Vehicle Framework a simple to use but powerful vehicle library for Minecraft Forge 1.16.5, 1.20.1, and 1.21.1 ## Getting Started after importing the library, to create an entity with the framework you structure it as so ### The entity itself: ``` public class [MyVehicleClass] extends VehicleBaseEntity { private static final VehicleBuildInfo buildInfo = new VehicleBuildInfo(VehicleClassification. [classification] ) .SetEngineCount(2) //example properties .SetEngineType(EngineCategories.Aircraft_Propeller) //this example uses the Zepplin vehicle properties .SetMaxEngineRPM(3000) .SetMaxSpeedMS(70) .SetGasCelCount(8) .SetGasCelCapacity(1000); public Airboat(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), new Vector3f(0,0,0),70,65f)); } } ``` ### The entity renderer: ``` @OnlyIn(Dist.CLIENT) public class [MyVehicleRenderer] extends VehicleBaseRenderer { public AirboatRenderer(EntityRendererManager renderManagerIn) { super(renderManagerIn, new EntityModel[]{new [MyVehicleModel] ()},"textures/entities/ [MyVehicleTexture] .png" ); } } ``` ### Registering the entity you register the entity as if it were any other entity ``` public static DeferredRegister> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITIES, MOD_ID); public static final RegistryObject> 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 this is also the same as if it were any other entity, it is put in the client event handler ``` @Mod.EventBusSubscriber(modid = MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public class ClientEventHandler { @SubscribeEvent public static void init(final FMLClientSetupEvent event) { RenderingRegistry.registerEntityRenderingHandler(ModEntities.MY_VEHICLE.get(), [MyVehicleRenderer] ::new); } } ```