Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Choonster

Moderators
  • Joined

  • Last visited

Posts posted by Choonster

  1. 31 minutes ago, 7osCraft said:

    Yes, thats what I did but even after looking at the final jar code with some decompiling tool I found out that it is still using the MCP names and not SRG names

     

    That shouldn't be possible. Are you definitely running the build task? Are you looking in the correct output directory (build/libs)?

     

    Run the build task again and post the output, there may be some information as to why it's failing to reobfuscate the JAR.

  2. ·

    Edited by Choonster

    18 minutes ago, Andrew2070 said:

    EntityPlayer#addPrefix or at least ServerChatEvent#setComponent?

     

    EntityPlayer#addPrefix is the preferred way to add prefixes to a player's name.

     

    If you can't do that, use ServerChatEvent#setComponent to replace the chat message instead of cancelling the event and re-sending the message yourself.

     

     

    18 minutes ago, Andrew2070 said:

    Mc Version 1.7.10:

     

    I suspected that may have been the case. As Ugdhar said, 1.7.10 is no longer supported here.

  3. ·

    Edited by Choonster

    7 hours ago, OrangeVillager61 said:

     

    Data parameter IDs are automatically assigned per class hierarchy. You're passing EntityTameable.class as the first argument of EntityDataManager.createKey, so the DataParameter is being assigned the next ID for the EntityTameable class instead of the next ID for the IvVillager class. When you try to register it for the IvVillager instance, there's already a DataParamter registered for that ID so the game crashes with an IllegalArgumentException.

     

    In future, please select the appropriate syntax highlighting when posting code on a site like Gist or Pastebin. To get syntax highlighting on Gist, give each file the appropriate extension (.java for Java code). To get syntax highlighting on Pastebin, select the language from the dropdown at the bottom of the page.

     

    The Adult_Age data parameter is Stringly Typed. I suggest replacing the strings with an enum.

     

     

    7 hours ago, OrangeVillager61 said:

    I still get nullpointerexceptions on the return hire container

     

    I can't see any obvious reason for this. If you haven't already, please create a Git repository for your mod, push it to a site like GitHub and link it here so I can debug it locally.

     

    See my mod and its .gitignore file for an example of the repository structure to use and the files to include.

     

     

    Quote

    (I can't use Blockpos since the game requires it to be x, y and z).

     

     

    You can still create a BlockPos from the individual coordinates.

  4. ·

    Edited by Choonster

    "It crashes" doesn't really tell us anything. Post the latest code and the crash report.

     

    Is there a reason you're intercepting and manually re-sending the chat messages? Why not use EntityPlayer#addPrefix or at least ServerChatEvent#setComponent?

     

    What version of Minecraft are you using?

  5. You should read Forge's documentation page on events, it explains that event handler methods must be annotated with @SubscribeEvent and when to use static or non-static event handler methods.

     

    The FML event bus has been merged with the Forge event bus, so FMLCommonHandler#bus returns the same EventBus that's stored in the MinecraftForge.EVENT_BUS field. It's also deprecated, with a comment containing this information.

  6. 17 minutes ago, Andrew2070 said:

    Could you go into more detail, I haven't done much with Chat other than commands.

     

    EntityPlayer#addPrefix takes an ITextComponent, which will be added to the player's display name as a prefix.

     

    There are multiple implementations of ITextComponent, but the most commonly used ones are TextComponentTranslation (translates its first argument and then formats it by calling String.format with its other arguments) and TextComponentString (a single string).

     

    ITextComponent#getStyle returns the ITextComponent's Style, which can be used to modify the style of the text.

  7. You can use EntityPlayer#addPrefix to add a prefix to a player's display name. You'll probably want to do this when EntityJoinWorldEvent is fired for an EntityPlayer.

  8. 4 hours ago, jayjayrace said:

    java.lang.NoSuchMethodError: com.minecolonies.compatibility.tinkers.TinkersWeaponHelper.isTinkersSword(Lnet/minecraft/item/ItemStack;)Z
     at com.minecolonies.compatibility.Compatibility.isTinkersWeapon(Compatibility.java:98)
     at com.minecolonies.coremod.util.Utils.doesItemServeAsWeapon(Utils.java:151)

     

    Minecolonies is broken. Update to the latest version, this crash has been fixed.

  9. The installer is just for creating the server, you don't need to keep it once you've run it. You need to run forge-1.11.2-13.20.0.2309-universal.jar to run the server.

     

    If it just closes after a few seconds, run it from the command line instead of double-clicking and look for any errors in the output.

     

    If you still don't know what the error is, post the FML log (logs/fml-server-latest.log) using Gist or Pastebin.

  10. ·

    Edited by Choonster

    6 hours ago, OrangeVillager61 said:

    Ah, okay, however, whenever I call the UI, it can't find anything so the list is empty. I think it is my AxisAlignedBB since I'm not sure if I specified the right area.

     

    Where the error occurs:

    
    @Override
    public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
    		AxisAlignedBB vilSearch = new AxisAlignedBB(x, y - 1.0D, z, x, y + 2.0D, z);
    		if (ID == Villager_Hire){
    			return new ContainerIvVillagerHireNitwit((IvVillager)world.getEntitiesWithinAABB(IvVillager.class, vilSearch).get(0), player.inventory);
    		}
    }

    Where it is called:

    
    @Override
    public boolean processInteract(EntityPlayer player, EnumHand hand){
            if (this.getHired() == false && this.getProfession() == 5 && !world.isRemote && !this.isChild())
            {
        		BlockPos blockpos = new BlockPos(this);
            	player.openGui(Iv.instance, GuiHandler.Villager_Hire, world, blockpos.getX(), blockpos.getY(), blockpos.getZ());
            	return true;
            }
    }

     

     

    You're creating an AABB with the x and z coordinates of the BlockPos as both the minimum and maximum coordinates, so the entity will only be found if its bounding box overlaps the northwest corner of the block it's standing on (the area represented by the AABB).

     

    You should instead create the AABB with the x and z coordinates of the BlockPos as the minimum coordinates and the x and z coordinates plus 1 as the maximum coordinates. This way the AABB will cover the entire block instead of just the northwest corner. The  AxisAlignedBB(BlockPos) constructor does this for you, you can then use AxisAlignedBB#expand to expand it by 1 in each direction of the y axis (i.e. up and down).

     

    I created this item to experiment with corner- and edge-based AABBs passed to World#getEntitiesWithinAABB.

     

    Side note: You don't need to cast the result of the List#get call to IvVillager; the result of World#getEntitiesWithinAABB is a List<IvVillager> (because of the first argument), so the List#get call returns an IvVillager.

     

     

    Quote

    Edit:

    As well, when I try to register the data parameter that holds the player id, I get this:

    
    [13:45:40] [Server thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.event.entity.EntityJoinWorldEvent@44fae74c:
    java.lang.IllegalArgumentException: Duplicate id value for 15!
    	at net.minecraft.network.datasync.EntityDataManager.register(EntityDataManager.java:105) ~[EntityDataManager.class:?]
    	at orangeVillager61.ImprovedVillagers.Entities.IvVillager.entityInit(IvVillager.java:210) ~[IvVillager.class:?]

     

    Erroring code:

    
            this.getDataManager().register(OWNER_DEFINED_ID, Optional.<UUID>absent());

     

     

    Are you registering the data parameter more than once? Post the IvVillager class using Gist or Pastebin.

  11. 1 hour ago, bradylox said:

    [13:18:08] [Client thread/FATAL]: Error executing task
    java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space

    ...
    Caused by: java.lang.OutOfMemoryError: Java heap space

     

    Minecraft ran out of memory. You can find instructions on how to give it more using your search engine of choice.

     

    In future, please post the entire FML log using Gist or Pastebin (like you were told to in your previous thread).

  12. If you're using the new @Config annotation-based system, a config GUI will automatically be created for you.

     

    If you're using the Configuration class and specifying the properties yourself, you need to create a class that implements IModGuiFactory and specify it in the guiFactory property of your @Mod annotation. In the IModGuiFactory#createConfigGui implementation, you need to create and return an instance of GuiConfig with the top-level IConfigElements.

     

    You can see an example of the new system here.

  13. ·

    Edited by Choonster

    23 minutes ago, OrangeVillager61 said:

    Alright, when I try to test the GUI I get errors that arrays cannot be cast to IvVillager on the line below.

    
    return new ContainerIvVillagerHauler((IvVillager) world.getEntitiesWithinAABB(IvVillager.class, vilSearch), player.inventory);

    Since I require an IvVillager as an argument, how can I get the IvVillager and select it?

     

    World#getEntitiesWithinAABB returns a List<T>, where T is the class you pass as the first argument or any super class up to Entity. You can't cast a List<T> to T, you need to get an individual element from the list.

     

    This is basic Java knowledge.

  14. ·

    Edited by Choonster

    The issue is that you're still registering an ItemBlock for the door and then registering a model for this instead of the ItemDiamondDoor instance.

     

    I explained this in my first reply:

    On 2017-5-23 at 1:33 PM, Choonster said:

    Because you're using 1.8.9, GameRegistry.registerBlock automatically creates and registers an ItemBlock unless you tell it not to by calling one of the overloads with a Class<? extends ItemBlock> argument and passing null as that argument. The registry system has been overhauled in 1.9+ and ItemBlocks are no longer created automatically.

     

     

    I've fixed these issues and slightly cleaned up the door registration code, you can view and/or merge the changes here.

  15. 7 minutes ago, blahblahbal said:

    I see a lot of reasons to update to 1.9. Regardless, let me merge and download the fix.

     

    I uh... don't see a merge button on the page you linked? I've never done a merge on github before (you can probably tell).

     

    The page I linked lets you create a Pull Request, which you can then merge.

  16. ·

    Edited by Choonster

    I've identified and fixed the problems:

    • BlockDiamondDoor overrides Block#getRenderType to return 7, which isn't a valid return value in 1.8+. The default return value of 3 tells Minecraft to use the baked model system to render the block, which is usually what you want; there's generally no need to override this. This numeric return value was replaced with an enum in 1.9.
    • The diamondDoor.json blockstates file doesn't include the powered property and you haven't told Minecraft to ignore it. You can create an IStateMappper to do this by creating a StateMap.Builder, calling StateMap.Builder#ignore with the properties to ignore and then calling StateMap.Builder#build. Register the IStateMapper by calling ModelLoader.setCustomStateMapper in preInit.

     

    You can view and/or merge the changes here.

     

    It wasn't immediately obvious what the issue with the model was, since you have 101 model errors and Forge only logs the first five. This was made configurable via the forge.verboseMissingModelLoggingCount system property in 1.9.

  17. Just now, Malkierian said:

    Well, thatnks you to talking about the customMeshDefinition, I remembered the place where that was called, and realized that it was registering a new ItemBlock in the code, and was then trying to set the customMeshDefinition to a block model that didn't exist.  Guess that's what I get for blindly following tutorials...  But, I removed the ItemBlock registration and removed the one line trying to set the customMeshDefinition and everything's back to normal.  I never wanted to have a liquid block available in the creative tabs anyway, I have other items for placing these things.  Hopefully now the inventory variants in the blockstates will work (if I decide I even want them).

     

    I'm glad you figured that out.

     

     

    Just now, Malkierian said:

    However, I've still had no answer about the water-like entity interactions for my fluids.

     

    I haven't done this myself, but it may be possible to implement it yourself with Block#onEntityCollidedWithBlock. I can't really help you any further with this, though there may be existing mods that have done this.

  18. ·

    Edited by Choonster

    8 hours ago, Malkierian said:

    As a matter of fact, the blocks/ prefix being there or not had no impact on where the game looked to find the blockstate files, which was merely assets/plasmacraft/blockstates.  If I moved them from there, the textures for the blocks didn't even load.

     

    However, I tried just replacing the model for the inventory variant, I tried removing different portions of the inventory variant, and I tried removing the inventory variant altogether, and it still keeps failing (with that exact same error) and trying to find the item model json file separately (which, of course, I don't have).  I can't find any info on what a fluid blockstate file is SUPPOSED to look like.

     

    EDIT: Just realized how the blockstate files are found, and no, they were in the right place and being loaded.  I just can't figure out how to get it to load the inventory variant properly.

     

    Minecraft will always use assets/<modid>/blockstates/<registry_name>.json for the Block's models (unless you register a custom IStateMapper), but the blockstates file used for the Item models depends on the ModelResourceLocation you pass to ModelLoader.setCustomModelResourceLocation or return from the ItemMeshDefinition you pass to ModelLoader#setCustomMeshDefinition.

     

    To use the inventory variant of the assets/<modid>/blockstates/<path>.json blockstates file for an Item model, use a ModelResourceLocation with <modid> as the domain, <path> as the path and inventory as the variant.

     

    If a MissingVariantException is logged for the inventory variant of this blockstates file, you may be running into this issue where Forge is treating your inventory variant as partially-defined instead of fully-defined.

     

    If you still need help, post the code where you register the Item model, the latest blockstates file (including its path) and the full FML log.

  19. 2 minutes ago, OrangeVillager61 said:

    Okay, thanks, however, when I compare the slot.getStack and the new ItemStack I want with a standard >=, it is undefined and I cannot seem to find an alternative.

     

    Java doesn't allow operator overloading, so you can't use relational operators like >= to compare non-numeric values.

     

    Use the static equality methods in the ItemStack class to check if two ItemStacks are equal or use the getter methods to get each part of the ItemStack (e.g. ItemStack#getItem to get the ItemItemStack#getCount to get the count/stack size).

     

     

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.