MinecraftScripterAI
Discord ↗
Link Copied to Clipboard
×
"how to create a moving entity"
/* To create a custom moving entity in Minecraft Forge, you'll need to extend the LivingEntity or MobEntity class and register your entity. Here's a basic example: */ // CustomMovingEntity.java public class CustomMovingEntity extends MobEntity { public CustomMovingEntity(EntityType<? extends CustomMovingEntity> type, World worldIn) { super(type, worldIn); } // You can override methods here to customize the behavior of your moving entity } // EntityInit.java public class EntityInit { public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITIES, YourMod.MOD_ID); public static final RegistryObject<EntityType<CustomMovingEntity>> CUSTOM_MOVING_ENTITY = ENTITY_TYPES.register("custom_moving_entity", () -> EntityType.Builder.of(CustomMovingEntity::new, EntityClassification.CREATURE) .sized(0.6F, 1.95F) .build(new ResourceLocation(YourMod.MOD_ID, "custom_moving_entity").toString())); } // In your main mod class, register your entities public class YourMod { public static final String MOD_ID = "yourmodid"; public YourMod() { EntityInit.ENTITY_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); } }