• Recently Browsing

    No registered users viewing this page.

  • Posts

    • I made a sonar-like entity radar that works fine, but it only faces north. That wouldn't be a problem if I was making a minimap, but for a radar telling the player which direction they're facing isn't good enough to let the player where exactly these entities are. I assume rotating it has something to do with comparing the player's look vector against the entity position, but that's an area I've just never been able to understand the math for.   The best way I know how would be to check for each of the player's EnumFacing values and subtract or add my i and j variables accordingly, but that still only gives me 4 possible rotations which isn't what I'm trying to do...   Can I get any help with this?   private void renderRadar() { mc.getTextureManager().bindTexture(res); int x = screenwidth - 74; int y = 10; drawTexturedModalRect(x, y, 192, 188, 64, 68); float posx = x + 31.5f; float posy = y + 35.5f; drawTexturedModalRect(posx, posy, 234, 156, 1, 1); int k; for (Entity e : entitylist) { float i = (float) (e.posX - mc.player.posX); float j = (float) (e.posZ - mc.player.posZ); k = e instanceof EntityMob ? 231 : e instanceof EntityPlayer ? 234 : e instanceof EntityLiving ? 232 : e instanceof EntityItem ? 233 : 0; if (k > 0) { drawTexturedModalRect(posx + i, posy + j, k, 156, 1, 1); } } }  
    • I have like 9 mods and that it but when I run forge it crashes on startup
    • You cannot. It resets when you click, before the actual attack happens.
    • If you need to interact with the IItemHandler directly I would recommend also storing the IItemHandler in a field directly. The interaction through getCapability is only really necessary for interactions with other mods / automation. For accessing your own mods inventories you can use something simpler / more direct.   IItemHandler#getStackInSlot.   Since you are using ItemStackHandler you have access to the IItemHandlerModifiable interface and you can use IItemHandlerModifiable#setStackInSlot. For a plain IItemHandler you'd first have to clear the slot using IItemHandler#extractItem and then use IItemHandler#insertItem.   You can override ItemStackHandler#getSlotLimit.
    • I have this line of code in my block's tile entity: private LazyOptional<IItemHandler> handler = LazyOptional.of(this::createHandler); And this code in my block's container: this.tile_entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).ifPresent(h -> { this.addSlot(new SlotItemHandler(h, 0, 26, 21)); this.addSlot(new SlotItemHandler(h, 1, 26, 48)); this.addSlot(new SlotItemHandler(h, 2, 80, 35)); }); And this code also in my block's tile entity: private IItemHandler createHandler() { return new ItemStackHandler(3) { @Override protected void onContentsChanged(int slot) { markDirty(); } @Override public boolean isItemValid(int slot, @Nonnull ItemStack stack) { if(slot != 2) { return true; } else { return false; } } @Nonnull @Override public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { return super.insertItem(slot, stack, simulate); } }; }   It seems to me that this has something to do with the block's inventory.   I have a few questions because this is very new and I don't know much about it: How do you check the item in one of the slots? How do you set what that item is? How do you change the size of that slot?   I have been trying time and time again to figure out the answer to these questions with no luck. Thanks for any help.
  • Topics

  • Who's Online (See full list)