-
Posts
161 -
Joined
-
Last visited
Everything posted by AnZaNaMa
-
Oh, okay. So @Elix_x I don't really understand how you're passing the TileEntity to the getQuads(). I know you're using some sort of workaround with the UnlistedPropertyGeneric, but I don't see what's going on. Is there any chance you could give an example of passing the TileEntity to getQuads() without the Optionals and lambda functions? I'm not well versed in Java 8, so it's extremely confusing to me.
-
Honestly, I was pretty overwhelmed reading through that the first time. However, on closer inspection this doesn't seem all that complicated. I'm just wondering - if getBakedQuads is called every frame, how is it more efficient than a TESR or FastTESR? I mean, obviously it may be because with a TESR, I'd be pushing and popping matrices, and drawing point-by-point and whatnot, but doesn't that eventually have to be done anyway, whether I give Minecraft a BakedModel, or I just render it myself?
-
Oh boy, what have I gotten myself into... I'm already half-way through creating a FastTESR, so I'm going to see how well that does. I'll probably end up coming back to this, though.
-
Well, the model probably will be changing a lot. I'm not sure if I'll be animating yet. I'll look into FastTESR
-
Alright, so I have a block with a TileEntity that is basically a frame that will hold different "parts". I'm trying to determine whether I should use a JSON model (or OBJ) or a TESR. In the end, there will be quite a few unique parts that all will need to render differently and one of my blocks will need to be able to hold multiple different parts. I feel like if I tried to do this using JSON models, it would be way too complex. Also, I have experience using OpenGL apart from Minecraft so I'd probably be able use a TESR pretty well. I don't know if they will cause too much lag, though. Are they a lot more expensive than JSON models? I need the player to be able to use quite a few of these before they lag too badly. Sorry if this question seems unclear. I find it difficult to put what I'm thinking into words. Is there some other option I'm missing or a better way to dynamically render a TileEntity?
-
[1.10.2] Disabling crafting recipe for certain players
AnZaNaMa replied to Bloopers's topic in Modder Support
@jabelar I just want to take a minute to say that your tutorials are amazing. They're super descriptive and give all the information you need and more. I appreciate what you've done. It's a great contribution to the community. -
[1.10.2] Disabling crafting recipe for certain players
AnZaNaMa replied to Bloopers's topic in Modder Support
Oh okay. Is there a reason this couldn't be changed by forge? It seems like forge changes plenty of other things in Minecraft. Maybe it just isn't worth it? -
[1.10.2] Disabling crafting recipe for certain players
AnZaNaMa replied to Bloopers's topic in Modder Support
Not sure if there is a good way to do it currently. Looking back at older posts, it seems that previously you had to do it via reflection. I don't understand why they couldn't just add @Cancelable to the event but maybe it broke something. -
[1.10.2] Disabling crafting recipe for certain players
AnZaNaMa replied to Bloopers's topic in Modder Support
Seems like what you're going to be looking for is the PlayerEvent.ItemCraftedEvent, which apparently is called just before a player crafts an item. Unfortunately, it seems that this event is not @Cancelable, so you'll have to manually stop the crafting from happenning. -
[solved][1.10.2] How to sync entity living from server to client?
AnZaNaMa replied to Dustpuppy's topic in Modder Support
At first, I was going to say that it could just be that you're never calling setCustomNameTag() after the Name is changed, but seeing that you're printing the value of Name to the console and it's not changing, I guess that doesn't really solve the issue here, though you still may want to consider doing so. I believe the real issue here is the way you're handling the GUI. The solution to the problem is not to sync the data from the client to the server. When working with GUIs, you want to use both sides, so your method that opens the GUI should not be @SideOnly(Side.CLIENT) and you should not use Minecraft.getMinecraft().displayGuiScreen(), but instead FMLNetworkHandler.openGui(). I haven't worked with GUIs in a while, but here's a tutorial on using them properly: https://bedrockminer.jimdo.com/modding-tutorials/advanced-modding/gui-screen/ -
I figured it out. Didn't realize I had to give the modid as a parameter to the @Mod.EventBusSubsciber. I've got it working now.
-
This is so strange, though. I don't see why it wouldn't be working. I don't get any errors in the console
-
the override was so that I could call setCreativeTab() in the same line that I create the object, since I store it as an ItemBase, not an Item
-
Okay, I've moved the model registering function, gotten rid of the saved reference to name, and slapped an @SideOnly(Side.CLIENT) on the model registry. I don't know why you're saying to call setUnlocalizedName(getRegistryName()). getRegistryName() returns a ResourceLocation and setUnlocalizedName() requires a String. Also, my item still isn't showing up in the creative menu. I was trying to use my own tab at first, but thought that might be the issue, so I changed it to Tab.MATERIALS and it's still not working correctly. With the @Mod.EventBusSubscriber, I don't need to call MinecraftForge.EVENT_BUS.register() anywhere do I?
-
So, I haven't attempted to create any mods in 1.12 yet. I'm following shadowfacts' tutorial on items and I see now that registering things requires an EventHandler. I have implemented a class for items that just does basic stuff, and I have created EventHandlers. @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll( wrench ); } @SubscribeEvent public static void registerItemModels(ModelRegistryEvent event) { wrench.registerItemModel(); } @SideOnly(Side.CLIENT) public static void registerItemRenderer(Item item, int meta, String id) { ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(Modularity.MODID + ":" + id, "inventory")); } I've followed this tutorial down to the letter (well I guess not literally) and for some reason, my item is not showing up when I load the game. Yes, I have included the @Mod.EventBusSubscriber annotation on my class. Here's a link to my Item Class.
-
[1.11.2] Removing blocks when picked from the world
AnZaNaMa replied to aetherean's topic in Modder Support
Well, as long as both clients are running the mod, I can't see why you would have any issues with it. Maybe @Draco18s has an idea? -
[solved][1.10.2] How to sync entity living from server to client?
AnZaNaMa replied to Dustpuppy's topic in Modder Support
I don't have any experience with this, but here's a tutorial that might be able to help you out... https://wiki.mcjty.eu/modding/index.php/Networking-1.12 -
[1.11.2] Removing blocks when picked from the world
AnZaNaMa replied to aetherean's topic in Modder Support
How are you testing multiplayer? Are you running a dedicated server, or via LAN? Is the server running the mod? -
[1.11.2] Removing blocks when picked from the world
AnZaNaMa replied to aetherean's topic in Modder Support
Well, If that's what you want to do, you'll probably need an EventHandler for whatever event occurs when a player breaks a block and you'll want to cancel the event if it's not one of your blocks. I'm not at my computer right now so I can't say exactly what you'd need. -
[1.11.2] Removing blocks when picked from the world
AnZaNaMa replied to aetherean's topic in Modder Support
oops sorry, try this. public void eventHandler(PlayerEvent.PlayerLoggedInEvent event) { if(!event.player.getEntityWorld().isRemote()) { event.player.capabilities.allowFlying = true; event.player.capabilities.disableDamage = true; event.player.sendPlayerAbilities(); } The if statement just makes sure the code only runs on the server, then the sendPlayerAbilities() forces the server to send updated abilities to the client. -
[1.11.2] Removing blocks when picked from the world
AnZaNaMa replied to aetherean's topic in Modder Support
Just realized you need @SubscribeEvent not @Mod.EventHandler. I'm an idiot and completely forgot that. @Mod.EventHandler is only for FML Lifecycle Events -
[1.11.2] Removing blocks when picked from the world
AnZaNaMa replied to aetherean's topic in Modder Support
During initialization, there won't even be a World, let alone a player. On top of that, you should not use Minecraft.getMinecraft().player for anything other than rendering, as it exists only on the Client side, and won't work properly. If you don't know much about Forge events, I suggest you check them out. They are probably the most important part of the Forge API and modding the game. You can find a quick tutorial I made here. Also, you can always check the forge docs, which are a great source for information. -
[1.11.2] Removing blocks when picked from the world
AnZaNaMa replied to aetherean's topic in Modder Support
One way you could accomplish this for all players is to use an Event Handler that catches player creation: public class EventHandlerClass { //Called when the player is originally created @SubscribeEvent public void onPlayerCreate(EntityJoinWorldEvent event) { if(event.getEntity() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)event.getEntity(); player.capabilities.allowFlying = true; player.capabilities.disableDamage = true; } } //Called when the player respawns or changes dimensions. Will ensure that the player maintains its stats. @SubscribeEvent public void onPlayerClone(PlayerEvent.Clone event) { event.getEntityPlayer().capabilities.allowFlying = true; event.getEntityPlayer().capabilities.disableDamage = true; } } and in whatever method handles FMLInitializationEvent, you need to register the class that has an event handler: public void init(FMLInitializationEvent e) { MinecraftForge.EVENT_BUS.register(new EventHandlerClass()); } I've edited this post a couple times, because I haven't been modding for a while, so I forgot some things. Sorry for any confusion -
[1.11.2] Removing blocks when picked from the world
AnZaNaMa replied to aetherean's topic in Modder Support
It'd be a lot easier to make the player invincible and give them flight than to try and change the mechanics of the game. I'd recommend just keeping it in survival and buffing the player: player.capabilities.allowFlying = true; player.capabilities.disableDamage = true;