• Recently Browsing

    No registered users viewing this page.

  • Posts

    • Ok. That makes sense. It also shows how much of a bot I am. Anyway, Item class:   private SheathCapability sheath = new SheathCapability(); public ItemSheath() { super(new Properties().group(SurvivalEssentials.ESSENTIAL_TAB).maxStackSize(1)); setRegistryName("sheath"); } @Override public ActionResultType onItemUseFirst(ItemStack stack, ItemUseContext context) { PlayerEntity player = context.getPlayer(); if(!context.getWorld().isRemote && player instanceof ServerPlayerEntity) { NetworkHooks.openGui((ServerPlayerEntity) player, new InterfaceSheath()); } return ActionResultType.PASS; } @Override public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { return sheath; }   Cap class:   public class SheathCapability implements ICapabilityProvider, INBTSerializable { private ItemStackHandler inventory = new ItemStackHandler(1); @Override public INBT serializeNBT() { return null; } @Override public void deserializeNBT(INBT nbt) { } @Override public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) { if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) return LazyOptional.of(() -> this.inventory).cast(); return null; } }   I'm not sure what type INBTSerializable should be...
    • A far as i know there is no more customized world type generation in minecraft 1.16, where you can adjust and remove specifical features. There are multiple ways to disable village generation: 1) Set generate structures to off in world creation menu, but i do not think this is what you want 2) Use an existing datapack or create one 3) Make a mod that disables village generation in the world. Its very likely that one already exists Does this answer your question?
    • No, you cannot store the handler in your Item class (there is only one instance of that). You need to create a class that implements ICapabilityProvider and INBTSerializable. This class is what will handle the capabilities of your item and you need to create a new instance of it and return that in initCapabilities.
    • You are relying too much on static-init order. The registry objects in your Blocks class are initialized after the block registry event (because you don't use them until then). But that means they won't initialize properly until after all registry loading is completed.   You should either use DeferredRegister (which returns RegistryObject) or @ObjectHolder.
    • Does this look right (it doesn't feel right): private ItemStackHandler inventory; public ItemSheath() { super(new Properties().group(SurvivalEssentials.ESSENTIAL_TAB).maxStackSize(1)); setRegistryName("sheath"); } @Override public ActionResultType onItemUseFirst(ItemStack stack, ItemUseContext context) { PlayerEntity player = context.getPlayer(); if(!context.getWorld().isRemote && player instanceof ServerPlayerEntity) { NetworkHooks.openGui((ServerPlayerEntity) player, new InterfaceSheath()); } return ActionResultType.PASS; } @Override public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { inventory = new ItemStackHandler(1); return super.initCapabilities(stack, nbt); } If so do I have to figure out how to put in read and write NBT methods, or does the capability handle that?
  • Topics

  • Who's Online (See full list)