Jump to content

ItsRobinson

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by ItsRobinson

  1. Yeah working now. Thanks to everyone for helping me clean up the code/get it working ? Would anyone know the new way of naming entities? now when the entity kills you it just says slain by entity.*modid*.entity_white_face I know you used to have to used LanguageRegistry and then just add the line to your .lang file but LanguageRegistry seems to be no longer a thing because it doesn't let me import it. EDIT: Nevermind, I had just written my lang file slightly wrong I put this: "entity.fcmobs.entity_white_face.name": "White Face" instead of "entity.fcmobs.entity_white_face": "White Face"
  2. Update, I've just been messing around with what my Entity class is extended with, I changed it from extends EntityZombie to extends EntityMob and it's started to show my model.... Does that mean that you can't extend from base mobs in 1.13.2 forge anymore? EDIT: Textures now don't seem to want to load onto the model ?‍♂️ EDIT 2#: Textures not working was down to my assets files being messed up, fixed that now, all working. Strange how you can't extend from an actual mob but you can from EntityMob, unless it's just /summon that won't allow you to extend from an actual mob, didn't try with an egg.
  3. Still the same result doing it this way
  4. Gonna split it up, code block = class @Mod(Reference.MOD_ID) public class main { public static main instance; public main() { instance = this; FMLJavaModLoadingContext.get().getModEventBus().addListener(this::preinit); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientRegistries); MinecraftForge.EVENT_BUS.register(this); } private void preinit(final FMLCommonSetupEvent event) { Reference.logger.info("Setup Registered"); } private void clientRegistries(final FMLClientSetupEvent event) { RenderingRegistry.registerEntityRenderingHandler(EntityWhiteFace.class, (RenderManager manager) -> new RenderWhiteFace(manager)); Reference.logger.info("Client Registered"); } @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { /*@SubscribeEvent public static void registerEntityTypes(final RegistryEvent.Register<EntityType<?>> event) { EntityInit.addEntityTypes(); EntityInit.ENTITY_TYPES.forEach(entityType -> event.getRegistry().register(entityType)); }*/ @SubscribeEvent public static void registerEntities(final RegistryEvent.Register<EntityType<?>> event) { final EntityType<EntityWhiteFace> WHITE_FACE; WHITE_FACE = EntityInit.createEntityType("entity_white_face", EntityWhiteFace.class, EntityWhiteFace::new, 64, 1, false); event.getRegistry().register(WHITE_FACE); } } } public class EntityInit { public static <T extends Entity> EntityType<T> createEntityType(String id, Class<? extends T> entityClass, Function<? super World, ? extends T> factory, int range, int updateFrequency, boolean sendsVelocityUpdates) { EntityType<T> type = EntityType.Builder.create(entityClass, factory).tracker(range, updateFrequency, sendsVelocityUpdates).build(Reference.MOD_ID + ":" + id); type.setRegistryName(new ResourceLocation(Reference.MOD_ID + ":" + id)); return type; } } public class EntityWhiteFace extends EntityZombie { public EntityWhiteFace(World manager) { super(manager); // TODO Auto-generated constructor stub } } public class RenderWhiteFace extends RenderLiving<EntityWhiteFace> { private static final ResourceLocation WHITE_FACE_TEXTURE = new ResourceLocation(Reference.MOD_ID + ":textures/entity/whiteface.png"); public RenderWhiteFace(RenderManager manager) { super(manager, new ModelWhiteFace(), 0.5F); } @Override protected ResourceLocation getEntityTexture(EntityWhiteFace par1Entity) { return RenderWhiteFace.WHITE_FACE_TEXTURE; } } //The model is just a snowgolem public class ModelWhiteFace extends ModelBase { public ModelRenderer Middle; public ModelRenderer Top; public ModelRenderer Bottom; public ModelWhiteFace() { this.textureWidth = 64; this.textureHeight = 64; this.Middle = new ModelRenderer(this, 0, 16); this.Middle.setRotationPoint(0.0F, 13.0F, 0.0F); this.Middle.addBox(-5.0F, -10.0F, -5.0F, 10, 10, 10, -0.5F); this.Top = new ModelRenderer(this, 0, 0); this.Top.setRotationPoint(0.0F, 4.0F, 0.0F); this.Top.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, -0.5F); this.Bottom = new ModelRenderer(this, 0, 36); this.Bottom.setRotationPoint(0.0F, 24.0F, 0.0F); this.Bottom.addBox(-6.0F, -12.0F, -6.0F, 12, 12, 12, -0.5F); } @Override public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { this.Middle.render(f5); this.Top.render(f5); this.Bottom.render(f5); } /** * This is a helper function from Tabula to set the rotation of model parts */ public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; } } The last thing I can think of is that Tabula's export code is outdated ?‍♂️
  5. Alright, I figured it out ? @Mod(Reference.MOD_ID) public class main { public static main instance; public main() { instance = this; FMLJavaModLoadingContext.get().getModEventBus().addListener(this::preinit); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientRegistries); MinecraftForge.EVENT_BUS.register(this); } private void preinit(final FMLCommonSetupEvent event) { Reference.logger.info("Setup Registered"); } private void clientRegistries(final FMLClientSetupEvent event) { RenderingRegistry.registerEntityRenderingHandler(EntityWhiteFace.class, (RenderManager manager) -> new RenderWhiteFace(manager)); Reference.logger.info("Client Registered"); } @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { /*@SubscribeEvent public static void registerEntityTypes(final RegistryEvent.Register<EntityType<?>> event) { EntityInit.addEntityTypes(); EntityInit.ENTITY_TYPES.forEach(entityType -> event.getRegistry().register(entityType)); }*/ @SubscribeEvent public static void registerEntities(final RegistryEvent.Register<EntityType<?>> event) { final EntityType<EntityWhiteFace> WHITE_FACE; WHITE_FACE = EntityInit.createEntityType("entity_white_face", EntityWhiteFace.class, EntityWhiteFace::new, 64, 1, false); event.getRegistry().register(WHITE_FACE); } } } So my entity is now created with a registry event, however the problem that I had from the very start, the main reason I posted this thread..... The custom model/texture still doesn't load onto the entity, it just stays as a zombie.
  6. Not really any need for snarky comments ? True I forgot to post the crash log And I do know the basics of java, I just don't know what variable to use to store the entitytype other than EntityType<> because I'm not sure what EntityType creation returns.
  7. I noticed after posting my reply about the FMLCommonSetupEvent that the registerEntityRenderingHandler had to be inside the Client one, so I tried that and it didn't work EntityWhiteFace has it's own class it isn't an inner class (just looks like one the way I have quoted my code) I've gone to complete basics and used RegistryEvent.Register to create my entitytype and now it's crashing before it's opening the client. @Mod(Reference.MOD_ID) public class main { public static main instance; public main() { instance = this; FMLJavaModLoadingContext.get().getModEventBus().addListener(this::preinit); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientRegistries); MinecraftForge.EVENT_BUS.register(this); } private void preinit(final FMLCommonSetupEvent event) { Reference.logger.info("Setup Registered"); } private void clientRegistries(final FMLClientSetupEvent event) { //RenderingRegistry.registerEntityRenderingHandler(EntityWhiteFace.class, (RenderManager manager) -> new RenderWhiteFace(manager)); Reference.logger.info("Client Registered"); } @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { /*@SubscribeEvent public static void registerEntityTypes(final RegistryEvent.Register<EntityType<?>> event) { EntityInit.addEntityTypes(); EntityInit.ENTITY_TYPES.forEach(entityType -> event.getRegistry().register(entityType)); }*/ @SubscribeEvent public static void registerEntities(final RegistryEvent.Register<EntityType<?>> event) { event.getRegistry().register(EntityType.Builder.create(EntityWhiteFace.class, EntityWhiteFace::new).tracker(64, 1, false).build(Reference.MOD_ID + ":entity_white_face")); } } } It's the last line of actual code that is making me crash. I think I'm crashing due to the fact that the EntityType hasn't got a registryname set, however I'm not too sure how to do that this way, the old way I did this: EntityType<T> type = EntityType.Builder.create(entityClass, factory).tracker(range, updateFrequency, sendsVelocityUpdates).build(Reference.MOD_ID + ":" + id); type.setRegistryName(new ResourceLocation(Reference.MOD_ID + ":" + id)); But it won't let me do this because it is a void https://prnt.sc/myvth0
  8. Alright I spent the last hour or so trimming down the EntityTypes and I've had a look at how a few other mods register their renders and tried to replicate and it's still not solved the problem. As for your first point of feedback I'm not exactly sure which section you're talking about. Here's my updated code: @Mod(Reference.MOD_ID) public class main { public static main instance; public main() { instance = this; FMLJavaModLoadingContext.get().getModEventBus().addListener(this::preinit); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientRegistries); MinecraftForge.EVENT_BUS.register(this); } private void preinit(final FMLCommonSetupEvent event) { RenderingRegistry.registerEntityRenderingHandler(EntityWhiteFace.class, (RenderManager manager) -> new RenderWhiteFace (manager)); Reference.logger.info("Setup Registered"); } private void clientRegistries(final FMLClientSetupEvent event) { Reference.logger.info("Client Registered"); } @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void registerEntityTypes(final RegistryEvent.Register<EntityType<?>> event) { EntityInit.addEntityTypes(); EntityInit.ENTITY_TYPES.forEach(entityType -> event.getRegistry().register(entityType)); } } } public class EntityInit { private static final EntityType<EntityWhiteFace> WHITE_FACE; static { WHITE_FACE = createEntityType("entity_white_face", EntityWhiteFace.class, EntityWhiteFace::new, 64, 1, false); } private static <T extends Entity> EntityType<T> createEntityType(String id, Class<? extends T> entityClass, Function<? super World, ? extends T> factory, int range, int updateFrequency, boolean sendsVelocityUpdates) { EntityType<T> type = EntityType.Builder.create(entityClass, factory).tracker(range, updateFrequency, sendsVelocityUpdates).build(Reference.MOD_ID + ":" + id); type.setRegistryName(new ResourceLocation(Reference.MOD_ID + ":" + id)); return type; } public static void addEntityTypes() { EntityInit.add(WHITE_FACE); } public static final List<EntityType<?>> ENTITY_TYPES = new LinkedList<>(); public static <T extends Entity> void add(EntityType<T> type) { ENTITY_TYPES.add(type); } public static List<EntityType<?>> getEntityTypes() { return Collections.unmodifiableList(ENTITY_TYPES); } } public class EntityWhiteFace extends EntityZombie { public EntityWhiteFace(World manager) { super(manager); // TODO Auto-generated constructor stub } } public class RenderWhiteFace extends RenderLiving<EntityWhiteFace> { private static final ResourceLocation WHITE_FACE_TEXTURE = new ResourceLocation(Reference.MOD_ID + ":textures/entity/whiteface.png"); public RenderWhiteFace(RenderManager manager) { super(manager, new ModelWhiteFace(), 0.5F); } @Override protected ResourceLocation getEntityTexture(EntityWhiteFace par1Entity) { return RenderWhiteFace.WHITE_FACE_TEXTURE; } } I believe that in 1.13.2 you don't need to mess with the client and common proxy, and that the FMLCommonSetupEvent and the FMLClientSetupEvent is the replacement, which is why I've put the RenderingRegistry.registerEntityRenderingHandler inside of the FMLCommonSetupEvent function, is am I wrong?
  9. I've got an entity that is extended by a Zombie, when I spawn the entity in-game it is supposed to look like my custom model but it doesn't it's just a zombie. It also says that I've summoned a zombie, so my thoughts are that it's either something to do with the entitytype build or it's something to do with the fact that I'm using the same rendering procedure as it was in 1.12.2 ? (btw, yes I stole THIS guys EntityType builder, however I do understand everything that it's doing so I'd say it's not a big deal ?) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public static class EntityTypes { private static final List<EntityType<?>> ENTITY_TYPES = new LinkedList<>(); public static <T extends Entity> void add(EntityType<T> type) { ENTITY_TYPES.add(type); } public static List<EntityType<?>> getEntityTypes() { return Collections.unmodifiableList(ENTITY_TYPES); } @SubscribeEvent public static void registerEntityTypes(final RegistryEvent.Register<EntityType<?>> event) { EntityInit.registerEntityTypes(); ENTITY_TYPES.forEach(entityType -> event.getRegistry().register(entityType)); } } public class EntityInit { public static final EntityType<EntityWhiteFace> WHITE_FACE; static { WHITE_FACE = createEntityType("entity_white_face", EntityWhiteFace.class, EntityWhiteFace::new, 64, 1, false); } private static <T extends Entity> EntityType<T> createEntityType(String id, Class<? extends T> entityClass, Function<? super World, ? extends T> factory, int range, int updateFrequency, boolean sendsVelocityUpdates) { EntityType<T> type = EntityType.Builder.create(entityClass, factory).tracker(range, updateFrequency, sendsVelocityUpdates).build(Reference.MOD_ID + ":" + id); type.setRegistryName(new ResourceLocation(Reference.MOD_ID + ":" + id)); return type; } public static void registerEntityTypes() { main.EntityTypes.add(WHITE_FACE); } } public class EntityWhiteFace extends EntityZombie { public EntityWhiteFace(World worldIn) { super(worldIn); // TODO Auto-generated constructor stub } } The EntityType builder works and allows me to spawn the entityclass that I have made, I have tried overriding some of the AI of the zombie and it works, so it is reading from the EntityWhiteFace class correctly. This is code to render the model: private void preinit(final FMLCommonSetupEvent event) { RenderingRegistry.registerEntityRenderingHandler(EntityWhiteFace.class, new IRenderFactory<EntityWhiteFace>() { @Override public Render<? super EntityWhiteFace> createRenderFor(RenderManager manager) { return new RenderWhiteFace(manager); } }); Reference.logger.info("Setup Registered"); } public class RenderWhiteFace extends RenderLiving<EntityWhiteFace> { public static final ResourceLocation TEXTURES = new ResourceLocation(Reference.MOD_ID + ":textures/entity/whiteface.png"); public RenderWhiteFace(RenderManager manager) { super(manager, new ModelWhiteFace(), 0.5f); } @Override protected ResourceLocation getEntityTexture(EntityWhiteFace entity) { return TEXTURES; } @Override protected void applyRotations(EntityWhiteFace entityLiving, float ageInTicks, float rotationYaw, float partialTicks) { super.applyRotations(entityLiving, ageInTicks, rotationYaw, partialTicks); } } After typing /summon *modid*:entity_white_face this is the result: http://prntscr.com/myt98y It should be spawning with my custom model and textures but it's not Anyone got any ideas, I'm probably doing something drastically wrong in the rendering.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.