Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/30/20 in all areas

  1. Sorry lol here are the screenshots of the xms thing. Im allowing it to use around 14gb of ram.
    1 point
  2. You should do both. The custom slot (smoothly) prevents the player from inserting into the slot in the container, while the custom item handler capability prevents other tile entities from inserting item into the slot.
    1 point
  3. Howdy You could get some clues from the Botania mod, it uses ItemStackHandlers and Capabilities instead of IInventory eg ItemFlowerBag. https://github.com/Vazkii/Botania/blob/master/src/main/java/vazkii/botania/common/item/ItemFlowerBag.java The only potential problem with SlotItemHandler and ItemStackhandler instead of IInventory is that IInventory is also used by vanilla to tell the source container (typically TileEntity) that the GUI has modified the slot contents (marked it as "dirty"). But SlotItemHandler and ItemStackhandler don't do that. There are some knowledgeable folks on this forum who think that it doesn't matter because the source container is marked as dirty in other ways; they might be right although I'm not convinced yet. I haven't tested it empirically yet (on my to-do list). Up until now I've played it safe and wrapped the ItemStackHandler in an IInventory. If you decide to test it yourself, please let me know... -TGG
    1 point
  4. howdy There's a working tutorial example of custom container here (furnace) https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe31_inventory_furnace It uses a similar method to what David M said, i.e. a custom OutputSlot for the GUI, which stops the player adding but not your code. -TGG
    1 point
  5. Ah, yeah you're right. Vanilla does have a few of these dirty "quick fixes" hidden away in the guts of the code. @Deprecated public static RenderType getChunkRenderType(BlockState blockStateIn) { Block block = blockStateIn.getBlock(); if (block instanceof LeavesBlock) { return fancyGraphics ? RenderType.getCutoutMipped() : RenderType.getSolid(); } else { RenderType rendertype = TYPES_BY_BLOCK.get(block); return rendertype != null ? rendertype : RenderType.getSolid(); } } and public static boolean canRenderInLayer(BlockState state, RenderType type) { Block block = state.getBlock(); if (block instanceof LeavesBlock) { return fancyGraphics ? type == RenderType.getCutoutMipped() : type == RenderType.getSolid(); } else { java.util.function.Predicate<RenderType> rendertype; synchronized (RenderTypeLookup.class) { rendertype = blockRenderChecks.get(block.delegate); } return rendertype != null ? rendertype.test(type) : type == RenderType.getSolid(); } }
    1 point
  6. 1. Use a custom slot in your container and override Slot#isItemValid to return false. 2. Create another item handler for the output and override the methods to not allow inserting item into it.
    1 point
  7. You need two item stack handlers, one that's private that the machine can insert to, and one that you expose via getCapability that can only be extracted from (and which wraps around the former). https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/harderores/entity/SifterTileEntity.java#L51-L52
    1 point
  8. This is typical software engineering jargon for "I wouldn't do it that way." In this case, if the code works, it works. If you're going into professional programming, then maybe you should take the time to learn how to efficiently write code, but for someone who's learning how to mod Minecraft, it really doesn't matter. As time goes on, you'll eventually learn what practices to use over others. The important thing is that most of this forum will not help you out well unless you come already with code. The people here, and in many other places, do not like to just "hand out code" and will be more likely to help. So start out by working with what you know. You're not expected to have perfect code when you first start. And trust me, if you come here with one error, they're going to point out all of the other ones, too. That's my advice. Chances are one of the "higher ups" here will trump me, because that's what they do. Welcome to Forge.
    1 point
×
×
  • Create New...

Important Information

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