Jump to content

Alpvax

Members
  • Posts

    297
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by Alpvax

  1. It is also possible to use NBT tags to create swords which have custom attributemodifiers and models in order to have more than the usual sword types.

    It can be done with any item, but you cannot add new functionality and behind the scenes they are still the vanilla sword item.

    See https://minecraft.gamepedia.com/Model#Item_predicates for more info on custom models (uses an NBT tag to select which model override to use).

  2. Even closer now.

    I do not want to update neighbours, as the property is changed from Block#neighborChanged, and I do not want to cause an infinite loop.

    //Called after updating property
    BlockState blockState = getBlockState();
    //Do not update neighbours
    getWorld().notifyBlockUpdate(getPos(), blockState, blockState, Constants.BlockFlags.BLOCK_UPDATE | Constants.BlockFlags.RERENDER_MAIN_THREAD); 
    requestModelDataUpdate();

    I also call requestModelDataUpdate at the end of handleUpdateTag.

    The data is now correct on the client (displayed when right clicked), but the render is always 1 step behind (Only updates once another block is placed).

  3. Almost fully working.

    Only thing I'm now struggling with is forcing my TileEntity to sync.

    I'm calling markDirty and requestModelDataUpdate after changing the property, but the client side data doesn't refresh until I close and reopen the world.

    Do I need to send a custom packet, or is there an easier way of forcing a resync?

  4. I am in the process of converting my existing blockstate based model to a tileentity due to excessive use of blockstates (4-value EnumProperty for each direction = 4096 + waterlogged = 8192 permutations!)

    I have an existing (generated) multipart blockstate json, is there any way to easily convert it to the same model, just using the data from the tileentity instead of the blockstate?

     

    I'm assuming I need to create a custom BakedModel, but I would ideally like to keep the current data-driven approach (one model for each of the 4 enum values).

     

    It's the first time I've started looking into custom models, and I think a TileEntityRenderer is overkill for static models. Please correct me if I'm wrong.

  5. 6 hours ago, frakier said:

    "resources\data\minecraft\tags\items\carnivore.json"

     

    6 hours ago, frakier said:

    "resources\data\mymod\tags\items\carnivore.json"

    These are 2 different tags ("minecraft:carnivore" and "mymod:carnivore" respectively).

    You should make 1 tag "mymod:carnivore" and add all the defaults to it (as in all the vanilla items, and your custom items if applicable), then if you want to add items in another mod, you also define the "mymod:carnivore" tag (not the "mysecondmod:carnivore", again that would be a different tag).

     

    As an extension on what draco said, the only time you should put tags in the minecraft domain is if you are overriding/adding to an existing vanilla tag.

  6. 17 hours ago, BlockyPenguin said:

    [ "one": {

    That is not valid json. Currently you have an array with keys.

    Either it should be an array of objects "[ { ..." or it should be an object with keys of "one, two,...".

    I would suggest going for the first option (especially as that is what you support in your code):

    17 hours ago, BlockyPenguin said:

    JsonArray jsonSteps = jsonMethod.getAsJsonArray("steps");

     

    • Like 1
  7. Worked around the issue by double unchecked casting the type:

    
    public abstract class IOType<T> extends ForgeRegistryEntry<IOType<?>> {
        @SuppressWarnings("unchecked")
        public static final Class<IOType<?>> CLASS_GENERIC = (Class<IOType<?>>)((Class<?>)IOType.class);
    }
    
    //Can then be used as follows
    public static final DeferredRegister<IOType<?>> IO_TYPES = DeferredRegister.create(IOType.CLASS_GENERIC, MODID);

    By putting the constant in the API class, it can be used by others who are consuming the API.

    • Like 1
  8. DeferredRegister has been updated recently to make it work with custom registries, but it still doesn't work with custom generic RegistryObjects (similar to TileEntityType<T>).

     

    When trying to create the DeferredRegister, it errors with: 

    Quote

    Required type: DeferredRegister<IOType<?>>
    Provided: DeferredRegister<IOType>
    Incompatible equality constraint: IOType<?> and IOType

    //Registry
      public static final DeferredRegister<IOType<?>> IO_TYPES = DeferredRegister.create(IOType.class, MODID);
    
    //IOType.java (currently just a stub)
    public abstract class IOType<T> extends ForgeRegistryEntry<IOType<?>> {
    }

     

    Is there a workaround for this issue, or can I just not use DeferredRegister? This will be available in an API, so I would ideally be able to support the more popular DeferredRegister approach.

     

    Removing the parametised type (DeferredRegister<IOType> IO_TYPES = ...) then throws the error of IOType not implementing IForgeRegistryEntry<IOType>, so that isn't a fix.

    I am wondering if the only workaround is to make the registry in a static initialiser (and overriding it in the NewRegistryEvent), but that seems like a step backwards.

     

    Does anyone have any suggestions?

  9. 2 hours ago, KollyPop said:

    I'm new to modding.

     

    1.16.1

    If you are new to modding, I would suggest starting with 1.15, not 1.16. 1.16 has only just been released, so there are still bugs and issues being worked out.

     

    You need to subscribe to one of the render events, and render your text inside the event listener, in the same way you would in any other GUI.

  10. 16 hours ago, TheGreyGhost said:

    1 block = 1 bucket (think lava or water being filled into a bucket and back again).

    I don't agree with that logic.

    Yes, 1 bucket of a fluid is 1 block of the fluid (although it actually doesn't quite reach the top, so you could argue that is not true), but there is nothing saying 1 solid block is equivalent to 1 bucket of that material melted down.

    Liquid doesn't have ingots or nuggets, so those solid conversions do not need to apply to them.

    If we keep it as 1 block of a solid becomes a bucket-and-a-bit, all it means is that you don't fit an even number of blocks into your tanks. But I don't see why that is an issue, because once you have converted it to a fluid, whatever you're using it for (machines?) probably doesn't care about the solid amount.

    If you want to transfer exact amounts, use the blocks. They are probably easier to transport anyway (there is a vanilla mechanic for it, and you can usually carry 64 per inventory slot as opposed to the 1 in a bucket).

    • Like 1
  11. 13 hours ago, TheGreyGhost said:

    THe round trip is the problem.  In real life, you get conservation of mass i.e. if you melt the compound then freeze it, you get the same mass as before.

    if your ingot is 144/1000 of a bucket, then converting ingots to buckets and back again gains you several extra ingots.

    I don't see how that is true at all. Why does 1 block have to fit in 1 bucket? If we just accept that 1 block is 1296mb, everything works.

    I don't see why we have to add the restriction that 1 bucket is 1 (solid) block. We can just accept that melting it makes it less dense, therefore bigger.

    • Like 1
  12. Bear in mind that more players use metric systems than imperial (according to minecraft server statistics, and the fact that there are few countries which still use the imperial system).

    It is far easier for users to understand that half a bucket is 500mb, than it is for them to see 648 "atoms" (If that is the approach, I would prefer to use something like "voxellites" which has no real-world bearing than "atoms" which could cause huge confusion for users of chemical mods).

    And to the next argument that you would just display it as "3 1/2 buckets" or 3 1/1296 buckets", that is hugely unnatural for me (and presumably many others).

     

    I'm not sure what the issue with 144mb/ingot is. Why does a melted compound have to fit in the same space as a solid one? It doesn't in real life.

    And as far as cauldrons, I think it's fair enough to just lose 1mb in a cauldron. Who cares about 1/1000 of a bucket of an infinite resource? And for those mods which have finite supplies of water, they usually add their own mechanisms for collecting/storing it, so the cauldron issue is moot.

    • Like 1
    • Thanks 1
  13. On 6/21/2020 at 1:47 PM, _vertig0 said:

    Villagers spawned with other means

    Do you just mean with spawn eggs? Or do commands not work either?

    Vanilla spawn eggs (I believe) have the entity set when they are created, so if you override the entity, I think you also need to override the spawn egg to make it work.

    Disclaimer: I've not actually done it myself, but I believe that is the case.

×
×
  • Create New...

Important Information

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