Jump to content

Draco18s

Members
  • Posts

    16559
  • Joined

  • Last visited

  • Days Won

    156

Everything posted by Draco18s

  1. Looks like z-fighting to me. Check to make sure that you don't have two surfaces in the same place.
  2. To serialize: Store the length of the array. Push all serialized BlockPos values. To deserialize: Read the length of the array. Deserialize that many BlockPos values.
  3. Oy vey. This will always return true. As will this and this. Use orElseThrow here, that's why it exists. You know what Capabilities are and yet, you did this. Your tool is effective on nothing. This is an unchecked cast. Other mods may have items with an inventories too. This code will crash the server if you hold one of their inventory-capable items and use your keybind.
  4. Yeah, that's wrong. https://github.com/Draco18s/ReasonableRealism/tree/1.14.4/src/main/resources/data/harderores
  5. The first build of 1.16.5 is 1.16.5-36.0.0 Official mappings were added in 1.16.5-36.0.48:
  6. Gui Screens are never on the server. As emphasized by the fact that the Screen class is in the client namespace.
  7. Shocker, the server controls game state. Doing things on the client means the server sends an update and overwrites the client's changed values making it look like "it didn't save." Of course it didn't save, you didn't tell the server fuckall.
  8. You almost certainly don't want to pass null.
  9. state1.getBlock() == state2.getBlock()
  10. Variables aren't fucking magic. You want the player's position in a shorthand local variable? Then get the player's position and store it to a shorthand local variable.
  11. Lets say you buy a book on Amazon. And then you order a second copy. When they arrive you place one on your coffee table and one in your bookshelf. Are they the same object? No, of course not, you have TWO books. The one on your coffee table is definitely not the same one on your bookshelf. They are identical but they are not the same object. They are two different instances of that book. The itemstack in the player's inventory is the book on the bookshelf. The itemstack you created in your code is the book on the coffee table. And you just asked you if the two stacks are the same object. Only what you're trying to do is go through your bookshelf and find the other copy of the book that is on your coffee table. So how would you do that? By reading the titles.
  12. (1) Why are i and I not the same variable. Please explain this. (2) Items are not Blocks, ItemStacks are not Items.
  13. So...go look at the available constructors and pass the parameters they want... As for the others, they got renamed. Go look at the available methods and make a best guess.
  14. Did you try it?
  15. *Deadpan* Don't use state.randomTick, that fires the vanilla logic again. You want to make the crop grow if your random returns true, set the event's result to ALLOW. https://github.com/MinecraftForge/MinecraftForge/blob/5f9e6f3b567565a38a46c7ccdf5a09c720b974bc/src/main/java/net/minecraftforge/event/world/BlockEvent.java#L345
  16. You're right, I did. Whoops, not enough morning caffeine.
  17. No. I don't even know why you'd think so. Two separate computers on two separate sides of the country do not share the same JVM. You can't magically entangle the RAM of both machines to send data from one to the other without using the internet.
  18. ItemStackHandler inven = player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).orElseThrow(() => new Exception("WTF How does the player not have an inventory?"); ItemStack doesntFit = inven.insertStack(stack, true); if(!doesntFit.isEmpty() { /*inventory is full */ }
  19. Why do you have both of these lines? Why did you change this line? I told you that method was correct. By returning what's IN the slot you allow item duplication (remember, you're trying to create ghosts! Players can't acquire ghosts!) Why do you have this method? You (1) aren't using it and (2) you aren't using imports and (3) you can just inline it's contents anywhere you would reference it. OrElseThrow() is a thing. So is ifPresent(), which would obliviate the need for this static method anyway. Jesus H Christ why are you comparing strings here. And of course the rest of that if-stack is a bunch of absolutely nonsense. You're checking if the player's held stack is equal to any of the upgrades already applied or if the held stack is Fortune or Silk Touch and that one of the existing upgrades is the other (so either (a) there's an identical upgrade applied or (b) you generate a Fortune/Silk Touch pair) then if the held stack is an upgrade (why was this not checked first?) and the held stack has the same item as the selected inventory slot's item, return true. If any of that is false, prevent insertion. Not only are all of those checks fucking nonsense, and done out of order, but what if the slot is empty? Your method returns false if the slot is empty, preventing the slot from ever being not-empty.
  20. Show your code. Would be best if you posted a link to a git repo.
  21. I did "ghost" items once, and this is the ItemStackHandler subclass: https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/industry/inventory/FilterStackHandler.java Looking at it now, I think line 23 is wrong, should be return stack.copy() (or pass a copy to super and return the original). But I haven't messed with it in a while. The extract method is correct though.
  22. Go look at the function? Also, this code is still client side due to the call to Minecraft.getInstance()
  23. That code only deals with tracking the statistics.
×
×
  • Create New...

Important Information

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