• Recently Browsing

    No registered users viewing this page.

  • Posts

    • "If the cap isn't my cap, get the cap:"     "If the cap isn't my cap, get the cap:"         "If the cap isn't my cap, get the cap:"             "If the cap isn't my cap, get the cap:"                 "If the cap isn't my cap, get the cap:"                     ... No?  But. You already wrote the code that does it:  
    • Ok I think this is better: @Override public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) { if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) return lo.cast(); return getCapability(cap, side); } Anyway I don't know if the capability will work, firstly because I have hardly any experience with them and secondly because of the compile error in my container class: public ContainerSheath(final int windowID, PlayerInventory player) { super(EssentialContainers.SHEATH, windowID); for(int y = 0; y < 3; ++y) for(int x = 0; x < 9; ++x) this.addSlot(new Slot(player, 9 + x + y * 9, 8 + x * 18, 84 + y * 18)); for(int x = 0; x < 9; ++x) this.addSlot(new Slot(player, x, 8 + x * 18, 142)); this.addSlot(new SlotItemHandler(iitemhandler, 0, 50, 50)); } @Override public boolean canInteractWith(PlayerEntity playerIn) { return true; } @Override public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) { ItemStack previous = ItemStack.EMPTY; Slot slot = (Slot) this.inventorySlots.get(index); if(slot != null && slot.getHasStack()) { ItemStack current = slot.getStack(); previous = current.copy(); //maybe 9 -> 27, 45 -> 45+18 if(index < 9) { if(!this.mergeItemStack(current, 1, 37, true)) return ItemStack.EMPTY; } else { if(!this.mergeItemStack(current, 0, 1, false)) return ItemStack.EMPTY; } if(current.getCount() == 0) slot.putStack((ItemStack) ItemStack.EMPTY); else slot.onSlotChanged(); if(current.getCount() == previous.getCount()) return ItemStack.EMPTY; slot.onTake(playerIn, current); } return previous; } I don't know how to put IItemHandler in the new SlotItemHandler. Usually I would keep ItemStackHandler in a tileentity class but there I'm not using one... I think it has to do with defining: private LazyOptional<ItemStackHandler> lo; which I'm not sure how to do.
    • Have you tried setting this to something like 50 or 60? Higher numbers mean your feature will have a much higher chance of being generated. Look at other vegetal features in DefaultBiomeFeatures, so you can have an idea of the numbers they use. Also you shouldn't be using Feature#FLOWER i guess, try with Feature#RANDOM_PATCH. See if it works like that
    • getCapability must not return null.
    • You need to give this a value. You probably don't want null here, your cap won't be saved to disk.  
  • Topics

  • Who's Online (See full list)