Jump to content

Alpvax

Members
  • Posts

    304
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by Alpvax

  1. 15 hours ago, ChAoS_UnItY said:

    Is getCollisionShape a good way to do that? (also , can this method return a array with more than one VoxelShape stuff?)

    Look at VoxelShapes.or for multiple shapes at once.

    There is a getShape for if you want to override the selection shape as well as the collision shape.

  2. 18 hours ago, Zorochase said:
    
    @SubscribeEvent
    public static void onAttachCapabilities(AttachCapabilitiesEvent<ItemStack> event) {
        Item item = event.getObject().getItem();
        if (item instanceof DreamsteelSwordItem) {
            event.addCapability(new ResourceLocation(Oneirocraft.MOD_ID, "juiceditem"), new JuicedItemProvider());
        }
    }

     

    This is not how you should add capabilities to your own items, you should override IForgeItem#initCapabilities: 

    @Nullable
    @Override
    public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) {
        return new IMultitool.Provider();
    }

    I can't really tell from the snippets you have posted, do you have a git repository?

    Use your IDE to set breakpoints to try and find what is actually null when that function is called.

  3. 1 hour ago, DaemonUmbra said:

    Or you could join the Discord and let the bot do the lookup for you

    Yes, that's what I'm going to continue to do. I misunderstood the following:

     

    On 2/18/2020 at 3:53 PM, diesieben07 said:

    Well, I would hope that whatever text editor you are using has a search feature.

    to mean that the currently used mappings were available by default somewhere in my IDE.

  4. class Provider implements ICapabilityProvider {
        private Supplier<IMultitool> multitoolSup;
    
        Provider() {
          this(() -> Capabilities.MULTITOOL_CAPABILITY.getDefaultInstance());
        }
        Provider(Supplier<IMultitool> sup) {
          multitoolSup = sup;
        }
    
        private LazyOptional<IMultitool> capability = LazyOptional.of(() -> multitoolSup.get());
    
        @Nonnull
        @Override
        public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) {
          return cap == Capabilities.MULTITOOL_CAPABILITY ? capability.cast() : LazyOptional.empty();
        }
      }

    I had the advantage that my capability currently just acts as a flag, so I don't care about storing it for later use (i.e. I can just create a new instance every time with no issues).

    You will probably want to save the value of `supplier.get()` if you interact with it outside of the LazyOptional.

  5. I discovered with my mod that due to the order of class loading (item registration depending on the ItemGroup from my main class) my initCapabilities method was being called before my capability instance was set, so it was attempting to call null.getDefaultInstance and throwing the error.

    I resolved the issue by wrapping it in an additional supplier, so the capability was definitely set by the time it was used.

    • Like 1
  6. 14 hours ago, outflows said:

    This isn't a bump but just a friendly push

    No, it's a bump.

     

    You need to render your custom interface in the RenderGameOverlayEvent.Post (So it is displayed in front of anything else on the screen).

    You also need to make sure you only listen to one of the events (see RenderGameOverlayEvent.ElementType) to prevent rendering it multiple times per frame.

    • Like 1
  7. The look vector is a vector (with a length/magnitude of 1) pointing in the direction the entity is looking.

    So the direction/velocity of your fireball should be a multiple of that vector, and the start position should be the player eye position, plus part of the look vector (to spawn just in front of the player, instead of inside it's face)

    • Like 1
  8. 14 hours ago, diesieben07 said:

    There is extensive Javadocs, including copy-paste-ready examples, on the DeferredRegister class.

    True, but there is absolutely no mention of it in the documentation. Most modders wouldn't know to look at the javadoc of a class which they haven't heard of.

     

    Either way, this is now off-topic.

  9. I have seen references to the DeferredRegister in the test mods, but it is only today that I actually started looking into how it works.

    The documentation makes absolutely no mention of it at all (admittedly most of the documentation is not up to date).

    Would be nice if someone who understood it more could update the docs and preferably give an example (I didn't know that it sort of replaced ObjectHolder fields).

  10. Server output and log files: https://gist.github.com/Alpvax/1a9f43056150afd81e3223c802d8974c

    Java: 1.8.0_222 (Oracle)

    Forge: 28.0.14, for MC 1.14.4

    Error: "Can not hotload overworld. This must be loaded at all times by main Server."

    No mods installed, fresh install (accepted eula, but otherwise as-installed).

     

    Does anyone have any suggestions?

     

    EDIT: After a reboot, everything started to work. Presumably it was the result of java not closing properly on a previous run

×
×
  • Create New...

Important Information

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