-
Posts
44 -
Joined
-
Last visited
-
Days Won
2
Everything posted by TheMikeste1
-
[1.14.4][RESOLVED] OBJ Models: How to Get Started
TheMikeste1 replied to TheMikeste1's topic in Modder Support
Huh, that works. I guess I should have thought of that. So with OBJ models do I need to tell it to load in my texture? I had assumed it would load them in like it does with other blocks. I notice there's a lot of z-fighting though. Also, why is it so dark? -
[1.14.4][RESOLVED] OBJ Models: How to Get Started
TheMikeste1 replied to TheMikeste1's topic in Modder Support
Unfortunately that doesn't work either. I've tried several different paths with and without the .png. I'm probably missing something super obvious that I just can't figure out. -
Yeah, that's for 1.13. Also, I've not seen his stuff myself, but I've seen some moderators say that Harry Talks uses a lot of bad practices. You might want to consider checking some other tutorials. If you haven't gone through them yet, try reading through https://mcforge.readthedocs.io/en/1.13.x/. It's outdated, but the basics are the same. Something that has also helped me a lot were the aforementioned tutorials by McJty, as well as peering through vanilla code and the MC Forge GitHub, particularly the test sections (though I mostly have used Forge code for more "advanced" things).
-
No, I don't believe so. I was following McJty's tutorials for 1.14, and he starts in 1.14.2 with BlockItem. I'm not sure what the tutorial you're using is doing. Just a heads up though, from what I understand a lot of classes have changed names in a similar way.
-
It's called BlockItem now. ?
-
[1.14.4][RESOLVED] OBJ Models: How to Get Started
TheMikeste1 replied to TheMikeste1's topic in Modder Support
Thanks for your suggestion, but unfortunately it didn't help. I'm now trying to use "map_Kd" to get the texture, but that doesn't seem to work, either. It changes to the "no texture found" texture. If I remove map_Kd, it goes back to black. I'm going to keep trying to figure it out. I've been searching through parts of the Forge Github, but there's a lot to go through. In the mean time, if anyone is willing to give me a hand, here's my repository (model_test branch): TestBlock Class Model Registering test_block Blockstate test_block.obj test_block.mtl And an image of what the block currently looks like (with map_Kd): -
[1.14.4][RESOLVED] OBJ Models: How to Get Started
TheMikeste1 replied to TheMikeste1's topic in Modder Support
So I've made some substantial progress! I eventually found an OBJ test on the MC Forge Github (models, code), and my model now renders in-game! Unfortunately, the model is totally black (it's supposed to be bright yellow). If anyone has any insight as to why that may be, I'd appreciate it. Attached are my model files in case those would be useful.. test_block.mtl test_block.obj -
[1.14.4][RESOLVED] OBJ Models: How to Get Started
TheMikeste1 replied to TheMikeste1's topic in Modder Support
After poking around a bit more, I found the ModelRegistryEvent. I assume I'm supposed to register my models here? This is what I have right now: @Mod.EventBusSubscriber(modid = Constants.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public class Models { @SubscribeEvent public static void registerModels(ModelRegistryEvent event) { ModelLoader.addSpecialModel(ResourceLocation.tryCreate("wabbits:models/block/test_block.obj")); OBJModel model; try { model = (OBJModel) OBJLoader.INSTANCE.loadModel(ResourceLocation.tryCreate("wabbits:models/block/test_block.obj")); } catch (Exception e) { e.printStackTrace(); } } } I'm using #addSpecialModel since #setCustomModelResourceLocation is commented out. Looking at them, they don't seem to be do the same thing so I doubt that's the solution. I also noticed that OBJLoader has #loadModel, so I attempted to load in the model. Unfortunately, with the way I'm currently set up, I get a NullPointerException from manager being null on OBJLoader line 85. I don't think I can set manager to anything (it's private), so is there a different time I do this? -
[1.14.4][RESOLVED] OBJ Models: How to Get Started
TheMikeste1 replied to TheMikeste1's topic in Modder Support
Wow, is it really that simple now? That seems a lot easier than previous versions. I seem to still be doing something wrong. I'm getting "[minecraft/ModelBakery]: Unable to load model: 'wabbits:block/test_block.obj' referenced from: wabbits:test_block#: java.io.FileNotFoundException: wabbits:models/block/test_block.obj.json" when launching, and the block is the standard pink and black "no-texture-found" block. It looks like ".json" is being appended to my file name? Perhaps I'm just doing something wrong? Do I need to do anything with ModelBakery? Here's my blockstate test_block.json: { "variants": { "": { "model": "wabbits:test_block.obj" } } } And my ClientProxy: public class ClientProxy implements IProxy { static { OBJLoader.INSTANCE.addDomain(Constants.MOD_ID); //MOD_ID == "wabbits" } @Override public void init() { } @Override public World getClientWorld() { return Minecraft.getInstance().world; } @Override public PlayerEntity getClientPlayer() { return Minecraft.getInstance().player; } } EDIT: I noticed poking through the Forge GitHub that the .obj file paths don't seem to need the folder in front of it, so I've changed my blockstate .json to have "": { "model": "wabbits:test_block.obj" } instead of "": { "model": "wabbits:blocks/test_block.obj" } -
By "first constructor," I assume you mean "new Spear_Entity(null , null)" inside of Builder#create. Instead of giving it an Entity, give it an IFactory, like so: Spear_Entity::new
-
Are you using MC 1.14.4? Take a look at these two posts:
-
I'm trying to learn how to use OBJ models for my mod, but I'm having some difficulty getting started. I've been trying to find some tutorials or documentation on how to do import them and use them, but what I've found is out of date, and some of the functions are removed/renamed. I've looked at a few tutorials, including the 1.13 model section of the Forge Docs website (uses IStateMapper, which no longer exists), as well as this Forge forum tutorial (outdated, and many of the functions used no longer exist). I also peeked at ModelLoader, but the function #setCustomModelResourceLocation (which a lot of what I've found use) commented out, so I'm assuming there's a new way to do it. Would anyone be able to point me towards current tutorials, documentation, or code examples so I can figure out how to use OBJ models? Or possibly outline it for me here? I'm specifically looking for info on how to do it for a Block, but help with Items or Entities would also be useful. Many thanks!
-
I'm assuming you're using MC 1.14.4. Registering Entities is very similar to registering other game Objects, and extremely similar to registering TileEntities in that you actually register Types rather than the Entity itself. Here's an example: //Entities @ObjectHolder("wabbit") public static final EntityType<WabbitEntity> wabbit = null; @SubscribeEvent public static void registerEntities(final RegistryEvent.Register<EntityType<?>> event) { LOGGER.debug("Wabbits: Registering Entities..."); event.getRegistry().registerAll( EntityType.Builder.create(WabbitEntity::new, EntityClassification.CREATURE) .build("wabbit").setRegistryName(Constants.MOD_ID, "wabbit"); ); } //registerEntities() You'll probably want a model for your Entity. Try reading https://mcforge.readthedocs.io/en/1.13.x/models/introduction/ (outdated) to get started. You ought to search through the vanilla files (I'd recommend the Slime or the Rabbit) to see how they make theirs, and you could use a program like Blender to create .obj models if you decide to go that route. You'll likely need to create a special Renderer for you model. Try looking at the vanilla files to see how this works. As for registering your Renderer, try looking at this: https://stackoverflow.com/questions/37126170/irenderfactory-help-in-minecraft-forge (outdated, but the factory still works). Finally, I have some code you can look at if you need more help. Note that it's mostly throw-away code and not very good, so you ought to use it as an example only. EntityType Example Entity and Goal Example Renderer and Model Example
-
I'm not very familiar with Renderers, so it's probably best to get someone else's input. If you dig around in Minecraft's files (as it seems you've done a couple posts prior), you'll notice there's a model/trident.json and a model/trident_in_hand.json. I assume "in_hand" is the one representing the item you hold. You'll notice the parent is builtin/entity, which means it is using a registered Entity as a model. This means you'll need to create and register an Entity to serve as the model of your Item, as well as hold other important information. If you want to see vanilla example of creating Entities, check Minecraft's EntityType (You want to do this. There a a couple things I'm leaving out, such as defining hitboxes). With Forge you register an Entity (or rather, an EntityType) a little differently than vanilla. It's basically the same as other Objects in Forge, and nearly identical to TileEntityTypes. Since I couldn't find any specific documentation on registering them, here's an example: //Entities @ObjectHolder("wabbit") public static final EntityType<WabbitEntity> wabbit = null; @SubscribeEvent public static void registerEntities(final RegistryEvent.Register<EntityType<?>> event) { LOGGER.debug("Wabbits: Registering Entities..."); event.getRegistry().registerAll( EntityType.Builder.create(WabbitEntity::new, EntityClassification.AMBIENT) .build("wabbit").setRegistryName(Constants.MOD_ID, "wabbit"); ); } //registerEntities() There are other files you'll likely want to create, such as a SpearModel (since it looks like you're making a spear). The best thing to do is just search "Trident" in you IDE and look at all the .java and .json files. Piece together what each thing does, and do your best to throw a spear together. You'll learn more as you go along and be able to come back to improve your spear. EDIT: Also, note that when you make your Renderer, you'll also need to register it. you do that like this: RenderingRegistry.registerEntityRenderingHandler(WabbitEntity.class, RenderWabbitFactory.INSTANCE); The second value is a factory. Take a look at this for more info. (https://stackoverflow.com/questions/37126170/irenderfactory-help-in-minecraft-forge)
-
[SOLVED][1.14.4] Entities and SpawnEggs
TheMikeste1 replied to TheMikeste1's topic in Modder Support
Awesome, thank you! -
You'll need to make a special Renderer. Try taking a look at net.minecraft.client.renderer.entity.TridentRenderer to get started.
-
I've been playing around with Entities and decided to make a spawn egg. However, when I used the spawn egg, I got a NullPointerException when I built my EntityType inside of my event subscriber, like so (note the EntityType is built on line 16): 1 //Entities 2 @ObjectHolder("entity_test") 3 public static final EntityType<CreeperEntity> entity_test = null; 4 5 //SpawnEggs 6 @ObjectHolder("spawn_entity_test") 7 public static final Item spawn_entity_test = null; 8 9 @SubscribeEvent 10 public static void registerEntities(final RegistryEvent.Register<EntityType<?>> event) { 11 LOGGER.debug("Wabbits: Registering Entities..."); 12 event.getRegistry().registerAll( 13 EntityType.Builder 14 .create(CreeperEntity::new, EntityClassification.AMBIENT) 15 .size(0.4F, 0.7F) 16 .build("entity_test").setRegistryName(Constants.MOD_ID, "entity_test") 17 ); 18 } //registerEntities() 19 20 @SubscribeEvent 21 public static void registerSpawnEggs(final RegistryEvent.Register<Item> event) { 22 LOGGER.debug("Wabbits: Registering Spawn Eggs..."); 23 event.getRegistry().registerAll( 24 new SpawnEggItem(entity_test, 0, 0, new Item.Properties().group(ItemGroups.MAIN_GROUP_WABBITS)).setRegistryName(Constants.MOD_ID, "spawn_entity_test") 25 ); 26 } //registerSpawnEggs() After exploring with the debugger, I discovered that Items are registered before Entities, which means the spawn egg is being registered before the ObjectHolder for my EntityType is set (resulting in the egg trying to spawn null). I messed around with SubscribeEvent priorities for a while, but Items always registered first. I then tried building the EntityType and assigning it before the register event (lines 3-6): 1 //Entities 2 @ObjectHolder("entity_test") 3 public static final EntityType<CreeperEntity> entity_test = EntityType.Builder 4 .create(CreeperEntity::new, EntityClassification.AMBIENT) 5 .size(0.4F, 0.7F) 6 .build("entity_test"); 7 8 //SpawnEggs 9 @ObjectHolder("spawn_entity_test") 10 public static final Item spawn_entity_test = null; 11 12 13 @SubscribeEvent 14 public static void registerEntities(final RegistryEvent.Register<EntityType<?>> event) { 15 LOGGER.debug("Wabbits: Registering Entities..."); 16 event.getRegistry().registerAll( 17 entity_test.setRegistryName(Constants.MOD_ID, "entity_test") 18 ); 19 } //registerEntities() 20 21 @SubscribeEvent 22 public static void registerSpawnEggs(final RegistryEvent.Register<Item> event) { 23 LOGGER.debug("Wabbits: Registering Spawn Eggs..."); 24 event.getRegistry().registerAll( 25 new SpawnEggItem(entity_test, 0, 0, new Item.Properties().group(ItemGroups.MAIN_GROUP_WABBITS)).setRegistryName(Constants.MOD_ID, "spawn_entity_test") 26 ); 27 } //registerSpawnEggs() This works, but seems odd since every other object (Blocks, Items, ect.) is built or constructed inside of #registerAll. Is there a better way to set up the Entity and SpawnEgg? Thanks in advance!
-
I'd recommend McJty's tutorial here: https://wiki.mcjty.eu/modding/index.php?title=YouTube-1.14 He shows you how to set up configuration files in episode 6.
-
You need to set the max damage when registering the item. E.g. new Spear(new Item.Properties().group(group).maxDamage(250).setRegistryName(name)) Source: net.minecraft.item.Items If you don't, the first if statement in TridentItem#onItemRightClick will trigger and return a FAIL.