Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Cadiboo

Members
  • Posts

    3624
  • Joined

  • Last visited

  • Days Won

    58

Posts posted by Cadiboo

  1. On 1/14/2020 at 1:38 AM, DragonITA said:

    I have a Json Model and I want to animate a certain part of it.

    On 1/14/2020 at 1:38 AM, DragonITA said:

    If yes or no then let me know

    Short answer: No.

    Long answer: Json models are loaded and baked into objects that can easily be uploaded to your GPU for rendering. It is possible to animate these models but it is hard. What exactly are you trying to do, from a player's perspective?

     

    • Like 1
  2. The rendering code has changed massively since 1.7.4 so that snipped of code is no longer usable. However, the intent of the code can still be implemented. I'm not sure how this could be implemented with the current rendering changes (I would wait till 1.15 stabilises before attempting it) but unless the smooth lighting code has changed a lot you would likely be looking at changing AmbientOcclusionFace.

    Pictures from MC-43968:

    Bugged.pngFixed.png

     

    • Like 1
  3. On 1/3/2020 at 3:51 PM, SrAranha said:

    /* Problems: Shift + right click crash minecraft */

    You need to override transferStackInSlot.

    Heres a dynamic version that some Modder made ages ago and that I've updated. Copy pasta code. Just pop it in your container class. Example of it being used.

    /**
     * Generic & dynamic version of {@link Container#transferStackInSlot(EntityPlayer, int)}<br>
     * Handle when the stack in slot {@code index} is shift-clicked. Normally this moves the stack between the player inventory and the other inventory(s).
     *
     * @param player    the player passed in
     * @param index     the index passed in
     * @return the {@link ItemStack}
     */
    @Override
    public ItemStack transferStackInSlot(final EntityPlayer player, final int index) {
        ItemStack itemstack = ItemStack.EMPTY;
        final Slot slot = this.inventorySlots.get(index);
        if ((slot != null) && slot.getHasStack()) {
            final ItemStack itemstack1 = slot.getStack();
            itemstack = itemstack1.copy();
    
            final int containerSlots = this.inventorySlots.size() - player.inventory.mainInventory.size();
            if (index < containerSlots) {
                if (!mergeItemStack(itemstack1, containerSlots, this.inventorySlots.size(), true, this)) {
                    return ItemStack.EMPTY;
                }
            } else if (!mergeItemStack(itemstack1, 0, containerSlots, false, this)) {
                return ItemStack.EMPTY;
            }
            if (itemstack1.getCount() == 0) {
                slot.putStack(ItemStack.EMPTY);
            } else {
                slot.onSlotChanged();
            }
            if (itemstack1.getCount() == itemstack.getCount()) {
                return ItemStack.EMPTY;
            }
            slot.onTake(player, itemstack1);
        }
        return itemstack;
    }

     

  4. On 1/1/2020 at 6:59 AM, imacatlolol said:

    For the config type, the javadocs says that the SERVER type is synced to the client. How would I use this, exactly? If I had to take a guess, the client registers the config like normal but a local file is never made by the client (unless it's a local world); the server simply fills in the object values upon connection, and from that point they should be treated as immutable on the client side. The takeaway being the the client still needs to register the server config during initialization. Is that right?

    Its logical server side (per-world) and syncs to the client on connection. You register it on all distributions.

    On 1/1/2020 at 6:59 AM, imacatlolol said:

    How performant is it to get values from the config? What I mean is, if I need to check a config value every frame for rendering code, is it okay to just grab the value from the config like normal? Or, should I store a "proxy" value that only gets updated when the config changes? I'm assuming it doesn't query the file every single time so it wouldn't be an issue, but I'm not confident.

    Using a "proxy" or "baked" value is much better. You can see and/or profile the performance of the get method yourself. It's (possibly nested) Map#get calls so isn't extremely slow but is a lot slower than direct field access.

    On 1/1/2020 at 6:59 AM, imacatlolol said:

    For client configs, should I place its registration in the client's proxy, or can I leave it in the mod's constructor like other configs? I would assume that client configs would simply be skipped on the server side and wouldn't create a file, but again, I'm not confident.

    Forge registers its client & server configs on all distributions, however they only use simple config values like booleans and numbers. If you're using a class that only exists on a specific distribution (for example an enum) you might want to look into only registering that config on that distribution.

     

    The config types contain some documentation. I've got a tutorial on configs here if you'd like some info. It's not very in-depth though (yet).

    • Thanks 2
  5. The block pos is used for gathering extra data + randomising the model. Passing in BlockPos.ORIGIN (or ZERO, it might have been renamed) is likely to not cause any noticeable bugs. In 1.14.4 there was a method that just took in a BlockState and rendered it, I think it was called renderBlockBrightness and you might want to replicate its logic.

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.