Jump to content

uSkizzik

Members
  • Posts

    222
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by uSkizzik

  1. Vanilla animals already have similar behavior. For example, pigs follow you when you hold a carrot or a carrot on a stick. That's achieved by adding the TemptGoal to the registerGoals method. Here's an example from the vanilla pig class: this.goalSelector.addGoal(4, new TemptGoal(this, 1.2D, Ingredient.of(Items.CARROT_ON_A_STICK), false)); You can also use commas where it says Items.CARROT_ON_A_STICK to add more than one item. P.S.: I'm not sure how you would go about making it follow the player when it's given a specific item, maybe taming?
  2. So, basically I have this model which I want to change based on my entity's stage. I have my logic in my setupAnim() method and most of it works. My issue is that the following piece of code doesn't change the center head's position but successfully changes the other positions & rotations. if (entity.getStage() == 5) { this.centerHead.setPos(1.0F, -21.0F, 0.0F); this.commandBlock.setPos(0.0F, 0.0F, -10.0F); this.rightRibs.setRotation(0.0F, -0.35F, 0.0F); this.leftRibs.setRotation(0.0F, 0.35F, 0.0F); this.bottomRib.setRotation(0.25F, 0.0F, 0.0F); } else { this.centerHead.setPos(1.0F, -16.0F, 0.0F); this.commandBlock.setPos(0.0F, 0.0F, 0.0F); this.rightRibs.setRotation(0.0F, 0.0F, 0.0F); this.leftRibs.setRotation(0.0F, 0.0F, 0.0F); this.bottomRib.setRotation(0.0F, 0.0F, 0.0F); } What's even more interesting is that I have a very similar piece of code for the 6th stage which works just fine if (entity.getStage() == 6) { this.centerHead.setPos(1.0F, -13.0F, 0.0F); this.commandBlock.visible = false; this.rightRibs.visible = false; this.leftRibs.visible = false; this.bottomRib.visible = false; this.backRibs.visible = false; } else { this.centerHead.setPos(1.0F, -16.0F, 0.0F); this.commandBlock.visible = true; this.rightRibs.visible = true; this.leftRibs.visible = true; this.bottomRib.visible = true; this.backRibs.visible = true; } Here's the full model class if anything else is needed.
  3. I actually just made a new method to make the new immutable map with my custom models (via ImmutableMap.builder(), like in vanilla) and it worked.
  4. Alright, I finally solved it! Thanks for all the help @diesieben07!
  5. Turns out it isn't! Any ideas? EDIT: I solved it by calling the method via the project class. Now I have a new error: https://gist.github.com/uSkizzik/e5079c0a6196a6a213f6255343efa7e8
  6. You need to use Java 8 for 1.16.5.
  7. The new name of that class is KeyMapping. You can use forge bot in the official server to convert old class names to new ones via the command !mcp -c moj <Whatever you want to convert>. That command also works for converting mcp methods to official mojang methods.
  8. This is the crash that happens when the game tries to render a zombie with my custom skull on it: Why doesn't it register my custom models? This is the thing I placed before the start of the class: @Mod.EventBusSubscriber(modid = ProjectApple.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) And this is the method I use to register the models: @SubscribeEvent(priority = EventPriority.LOWEST) public void registerSkullPlayerHeadLayers(EntityRenderersEvent.AddLayers event) { Map<EntityType<?>, EntityRenderer<?>> renderers = Minecraft.getInstance().getEntityRenderDispatcher().renderers; for(Map.Entry<EntityType<?>, EntityRenderer<?>> renderer : renderers.entrySet()) { if (renderer.getValue() instanceof LivingEntityRenderer) { List<? extends RenderLayer<?, ?>> layers = ((LivingEntityRenderer<?, ?>) renderer.getValue()).layers; for (RenderLayer<?, ?> layer : layers) { if (layer instanceof CustomHeadLayer) { ((CustomHeadLayer) layer).skullModels.put(PA_TileEntities.CustomSkullTypes.SKIZZIK, new PA_SkullModel(Minecraft.getInstance().getEntityModels().bakeLayer(PA_ModelLayers.SKIZZIK_HEAD_LAYER))); ((CustomHeadLayer) layer).skullModels.put(PA_TileEntities.CustomSkullTypes.SKIZZIK_WITH_GEMS, new PA_SkullModel(Minecraft.getInstance().getEntityModels().bakeLayer(PA_ModelLayers.SKIZZIK_HEAD_WITH_GEMS_LAYER))); } } } } Map<String, EntityRenderer<? extends Player>> skins = Minecraft.getInstance().getEntityRenderDispatcher().getSkinMap(); for(Map.Entry<String, EntityRenderer<? extends Player>> renderer : skins.entrySet()) { if (renderer.getValue() instanceof LivingEntityRenderer) { List<? extends RenderLayer<?, ?>> layers = ((LivingEntityRenderer<?, ?>) renderer.getValue()).layers; for (RenderLayer<?, ?> layer : layers) { if (layer instanceof CustomHeadLayer) { ((CustomHeadLayer) layer).skullModels.put(PA_TileEntities.CustomSkullTypes.SKIZZIK, new PA_SkullModel(Minecraft.getInstance().getEntityModels().bakeLayer(PA_ModelLayers.SKIZZIK_HEAD_LAYER))); ((CustomHeadLayer) layer).skullModels.put(PA_TileEntities.CustomSkullTypes.SKIZZIK_WITH_GEMS, new PA_SkullModel(Minecraft.getInstance().getEntityModels().bakeLayer(PA_ModelLayers.SKIZZIK_HEAD_WITH_GEMS_LAYER))); } } } } } I used ATs instead of reflection which worked for the block renderer.
  9. 1.8 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
  10. 1. I forgot to add the bus subscriber (@Mod.EventBusSubscriber(modid = ProjectApple.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)) 2. What am I supposed to do with the skin map exactly?
  11. There are tutorials online including in the MC wiki on how to setup a vanilla or a forge server.
  12. So, I'm still getting the same crash which means that for some reason this thing is still not using my models. Here's my code: @SubscribeEvent(priority = EventPriority.LOWEST) public void registerSkullPlayerHeadLayers(EntityRenderersEvent.AddLayers event) { Map<EntityType<?>, EntityRenderer<?>> renderers = Minecraft.getInstance().getEntityRenderDispatcher().renderers; for(Map.Entry<EntityType<?>, EntityRenderer<?>> renderer : renderers.entrySet()) { if (renderer.getValue() instanceof LivingEntityRenderer) { List<? extends RenderLayer<?, ?>> layers = ((LivingEntityRenderer<?, ?>) renderer.getValue()).layers; for (RenderLayer<?, ?> layer : layers) { if (layer instanceof CustomHeadLayer) { ((CustomHeadLayer) layer).skullModels.put(PA_TileEntities.CustomSkullTypes.SKIZZIK, new PA_SkullModel(Minecraft.getInstance().getEntityModels().bakeLayer(PA_ModelLayers.SKIZZIK_HEAD_LAYER))); ((CustomHeadLayer) layer).skullModels.put(PA_TileEntities.CustomSkullTypes.SKIZZIK_WITH_GEMS, new PA_SkullModel(Minecraft.getInstance().getEntityModels().bakeLayer(PA_ModelLayers.SKIZZIK_HEAD_WITH_GEMS_LAYER))); } } } } }
  13. Quick question: How do I get an instance of EntityRenderDispatcher?
  14. How do I get all entity renderers though? Also, is FMLClientSetupEvent the correct event or do I need another one?
  15. Alright, so the item works now but the equipping feature crashes the game. It seems that when equipping a skull, the game calls "CustomHeadLayer" which calls SkullBlockRenderer (and I need it to call my custom renderer). How do I fix that?
  16. 1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support. The topic will be closed by a moderator as soon as possible.
  17. Downgrade to Java 8 if you want to continue playing on 1.16.5.
  18. 1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support. The topic will be closed by a moderator as soon as possible.
  19. I haven't dealt with ores yet but I have a suggestion. You can look trough vanilla code and the source code of other mods.
  20. 1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support. The topic will be closed by a moderator as soon as possible.
  21. So can you tell me exactly what I have to do? This is the error I'm getting when opening the creative tab containing the head: It's the same as the one that I got when making the block. What I did there was to change the renderer that I'm using to set the model field to the custom one, so I guess that I have to make a custom renderer for the item too?
  22. Alright, the block works perfectly. Now I just need a custom model since the texture height and width of the vanilla one don't do the job for my textures. I'll see about the item in a minute (I still haven't worked on the "fix" for it.)
  23. So, this? @SubscribeEvent public static void registerTileEntityRenders(FMLClientSetupEvent event) { BlockEntityRenderers.register(PA_SIGN.get(), SignRenderer::new); BlockEntityRenderers.register(PA_SKULL.get(), SkizzikHeadRenderer::new); }
  24. Yup, I knew it was a dumb idea that won't work...
×
×
  • Create New...

Important Information

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