Everything posted by Choonster
-
Forums Migration/Upgrade
There actually is a "Remove Format" button that I didn't notice before.
-
[1.10.2]How do I know if a player has my mod installed?
I think the OP knows that they can't translate if the mod isn't on the client, they want to know how to detect this. I explained how to detect if the mod is on the server from the client here (sorry about the formatting, the forum migration broke it), it should be mostly the same in reverse. One caveat is that the server needs to store this per-payer rather than in a static field. Two possible options for this are capabilities or a Map<UUID, Boolean>.
-
1.10.2 Modding Tutorial Suggestions
Before you start making a mod, make sure you have a solid understanding of Java and OO programming in general. Once you have that, you can look through some of the tutorials linked here and the Forge Documentation.
-
Forums Migration/Upgrade
I can now edit all of my posts again, even ones made before the migration. Thanks for the fix.
-
Where to learn about power system
If you look at the IBlockState class do you see a method called getPropertyKeys, or is it called getPropertyNames? The method was renamed from getPropertyNames to getPropertyKeys on 2016-11-17. If you see the old name, you should update your MCP mappings to stable_29 (the final mappings version for 1.10.2). If you're using an obfuscated build of EnderIO, it should be automatically deobfuscated to your current MCP mappings. This error suggests that you're using a deobfuscated build or EnderIO/EnderCore are messing with the deobfuscation.
-
Modded Minecraft immediately crashes after startup (Forge?)
Can you post the FML log (logs/fml-client-latest.log in the game directory) rather than the console output? It may have some more useful information.
-
[1.11.2] retrieving possible drops from mob
ReflectionHelper.getPrivateValue gets the value of a field, EntityLiving#getLootTable is a method. Looking up a field/method via reflection is expensive, so you should use ReflectionHelper.findField/findMethod and store the Field/Method object in a static final field and use that to access/modify the field's value or call the method. You're only passing the MCP name of the method to ReflectionHelper, so it won't work outside of the development environment. You need to pass the SRG name as well as the MCP name. You can find the SRG name of a field/method using MCPBot.
-
Forums Migration/Upgrade
There doesn't seem to be any way to toggle off the tt formatting or clear formatting completely. Either this didn't work or there's some other restriction on editing. I edited a post a few time shortly after posting it, but now it's been about 8 minutes since it was posted and I can't seem to edit it any more.
-
The New Forums
Would it be possible to convert the [tt] tags in all the old posts to monospace font instead of code blocks? Having the [tt] tag work in new posts would also be more convenient than having to highlight the text and click a button. Most of my old posts are borderline unreadable because each section of inline code has been replaced with a code block.
-
[1.11.2] retrieving possible drops from mob
If EntityLiving#getLootTable returns a non-null value, you can use LootTableManager#getLootTableFromLocation to get the LootTable from that ResourceLocation. You can then go through the table's pools and entries to build the list. If the entity doesn't use a loot table (e.g. EntityWither), you'll need to hardcode its drop list. Look at JustEnoughResources for an example of how to work with loot tables.
-
[1.11] GUI not updating burn status
ContainerMessage is being sent to the client, so ContainerMessageHandler will be executed on the logical client side. This means that you can't use server classes like EntityPlayerMP and NetHandlerPlayServer, you need to get the client player instead. I do this using a method in my proxy that takes the MessageContext and returns the player. In the client proxy, I override this to return Minecraft#player if MessageContext#side#isClient returns true or MessageContext#getServerHandler#player if it doesn't. In the server proxy, I override it to return MessageContext#getServerHandler#player if MessageContext#side#isServer returns true or throw an exception if it doesn't (because something has gone wrong if you're getting a client-side MessageContext on the dedicated server). To be safe, you should probably send the Container's ID (Container#windowId) in the packet and check that it matches the open Container's ID in your packet handler before you update it with the packet's data. Vanilla packets like SPacketSetSlot do this.
-
[1.11]More problems with custom item
Override it. Forge will call it when required, you don't call it yourself.
-
[1.11]More problems with custom item
You never register CapabilityHandler on the Forge event bus, so CapabiltiyHandler#attachCapability is never called and the capability is never attached to any ItemStack. What diesieben07 said also applies, though.
-
How can i replace basic textures like TNT or Netherblock?
As I said several times in my previous post, the intention was never to completely prevent my replacement from being overridden, just for it not to be overridden by resource packs that replace the vanilla model (e.g. minecraft:foobar). If a resource pack replaces the replacement model (e.g. mymod:foobar_replacement), that's fine.
-
How can i replace basic textures like TNT or Netherblock?
I'm not suggesting that you'd want to stop a texture from being overridden, just that you might want your replacement of a specific model/texture to take priority over other replacements (which isn't possible to do reliably without a lot of hackery). If my mod replaced a vanilla model, the ideal behaviour would be that this replacement takes priority over user-added resource packs replacing the vanilla file; but user-added resource packs could still override my replacement file. Although I've just remembered that you don't have to replace vanilla models using resource packs, you can simply tell Minecraft to use a different model for the Item/Block in code. This way resource packs that replace the vanilla model are ignored, but resource packs can still replace your model.
-
How can i replace basic textures like TNT or Netherblock?
It's what allows resource packs to replace files from mods, so it's useful in that respect; but if you're replacing a vanilla file you may not want that replacement overridden by a resource pack that also replaces the same file. A lot of resource packs only replace vanilla textures (but this definitely isn't always the case), so you could replace the model/blockstates file with one pointing to your own textures/models. A resource pack designed for your mod could still replace these, but a resource pack that replaces the vanilla textures wouldn't have any effect.
-
How can i replace basic textures like TNT or Netherblock?
This is true, but it's worth noting that user-added resource packs will take priority over mod resource packs. This means that if a user-added resource pack and a mod resource pack both replace the same file, the one from the user-added resource pack will be used.
-
[1.11] How to modify a TileEntity via GuiButtons?
The GUI needs to send a packet to the server, which will perform the action in the packet handler (if the player has permission to do it).
-
[1.10.2] Calling method client-Side only
This is what the sided proxy system is for. Create a method in your base proxy class called something like registerModel and then override it in the client proxy to call ModelLoader.setCustomModelResourceLocation. Keep in mind that ModelResourceLocation is also a client-only class, so you can't have it as a parameter of the method. Instead, you'll need to have the name as a parameter and create the ModelResourceLocation in the client proxy's override method. You can read more on sides here.
-
Item with IItemHandler capability
Only use AttachCapabilitiesEvent to attach capabilities to external objects. For your own Items, override Item#initCapabilities to return a new instance of an ICapabilityProvider implementation that provides the capability instance. Your ICapabilityProvider should store the IItemHandler instance, implement ICapabilityProvider#hasCapability to return true if the Capability argument is CapabilityItemHandler.ITEM_HANDLER_CAPABILITY and implement ICapabilityProvider#getCapability to return the IItemHandler instance if the Capability argument is CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.
-
[1.11]More problems with custom item
Either set those values on the ItemStack before you add a recipe for it or create your own recipe class and set them in IRecipe#getCraftingResult.
-
[1.11] GUI not updating burn status
In your Container#detectAndSendChanges override, iterate through Container#listeners and check if each one is an instance of EntityPlayerMP. If it is, send your packet to them. In your packet's handler, you can either call Container#updateProgressBar or your own method to update the client-side data.
-
Check when player was last online
PlayerEvent.PlayerLoggedOutEvent
-
OBJ Models
On closer inspection, overriding Block#shouldSideBeRendered to return false won't affect an OBJ model as OBJModel.OBJBakedModel always returns an empty list from IBakedModel#getQuads when the EnumFacing isn't null. Are you sure ClientProxy#preInit is being called? Set a breakpoint in it to make sure. Set a breakpoint in OBJLoader#loadModel. Is it ever called for your pedestal model?
-
OBJ Models
You override Block#shouldSideBeRendered to return false, so no sides of your block's model are rendered. What does your TESR render? Post your TESR class.
IPS spam blocked by CleanTalk.