Jump to content

Fubar

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by Fubar

  1. Okay, I guess I'll go with the two-block solution then. Could you tell me, if the following approach would be correct? Source block (A) will be at the bottom, Child block (B) on top. Both blocks can not be moved by pistons. 1. Block A: Use Block.isValidPosition to check if the block above is free (air). Cancel/Allow placement depending on the outcome. 2. Block A: Use Block.onBlockPlacedBy to spawn block B on top 3. Block A & B: Use Block.onReplaced to destroy the connected block A/B. Anything else I need to consider?
  2. I thought about splitting it in two blocks, but I hoped there's an easier 1-block-solution. It worked before 1.15 and I had no problems with it. I would even go so far as to say that there are less problems with a single block since you don't have to care about other blocks that belong to the model.
  3. I have some lighting issues since 1.15 I'm using a block that is 1m wide and 2m high. The problem I have are shadows on the upper part of the model that seem to be affected by the bottom part. Any idea how I can get rid of them? I'm registering the block render layer on FMLClientSetupEvent as RenderType.Cutout since the upper part will not be a full block. I'm not setting the block's lighting property, only the material (earth) and hardness/resistance. Example (White texture for testing purposes):
  4. Any more ideas are appreciated. Thank you.
  5. It could fill both, but it should only do if the player has enough items. If the player had one of each it wouldn't work. Currently I'm: - Creating a copy of the inventory - Create an InventoryMatrix (3x3 slots) - Fill the matrix with valid input items from the copied inventory - Reduce the stack size from pulled ItemStacks by one or set them to null if they reach zero - Use the "findMatchingRecipe" function from the CraftingManager class to check if the matrix would output an item - If yes: Do changes to original inventory and give the output ItemStack to the player
  6. The result + problem would be the same. If it finds an item which can go into slot1 + slot2 and afterwards an item which can only go into slot1 it doesn't work, since the first item was already sent to slot1 and occupies it. That's why I was thinking about some kind of priority system so the second item goes into slot1 first (it has less possibilities) and then the first item goes into the second slot, since it can go into either of them.
  7. Hello there. I'm currently trying to check if a player would be able to craft an item based on the items the player has in their inventory. This should be done without using a crafting table or gui. The check is triggered automatically after a specific event (for example right-clicking with an item). I'm using a 3x3 "InventoryCrafting" matrix to craft items. It's pretty simple if every slot of a crafting recipe has only 1 valid input. I loop through all slots of the recipe and through the player's inventory to check if all items are available. The problem occurs if a recipe uses the ore dictionary and has multiple valid inputs for a single slot. Let's say there is a recipe which requires "anyFoodItem" in Slot 1 and an "apple" in the 2nd slot. The player has a bread and an apple in it's inventory. Now I loop through the recipe slots + inventory. It looks for any food item, finds the bread and puts it into the first slot. Afterwards it finds the apple and puts it into the second slot => The recipe works. But there's a problem. It will not work if both items in the player's inventory are swapped. So instead of "bread, apple" => "apple, bread" It looks for any food item, finds the apple and puts it into the first slot. Now it finds the bread, but is unable to put it into the second slot since apples are the only valid item for that slot. This results into a non-working recipe even if the player would be able to craft the item. To fix this problem I would need to arrange the items in a smart way. My idea was to check every slot in the crafting matrix and fill the ones which have the least possible items first. But I'm not sure if that works well or if there's a better method.
  8. Hello there. I'm currently trying to render a block invisible unless the player holds a specified item - for example an apple. As long as the player is holding said item the block will be visible for that player. It's a simple block and has no entity. It could also be used as a building block which means you could have many of them at once in the same chunk. I tried overriding render methods in the block class like shouldSideBeRendered and returned true/false depending on the held item, but since those methods get only called after a block update/placement they are not suitable for my situation. So my guess is I need to register my own render type and return it in the getRenderType method ? I'm a bit lost here and would like someone to point me in the right direction on how to implement that. Thank you for your time.
×
×
  • Create New...

Important Information

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