Everything posted by Draco18s
-
[1.16.5]Determine the block that the player is looking at.
Find existing usages of RayTraceResult.
-
Totem of Undying Code
Search the vanilla code for other references to it.
-
[1.16.5] Replaced vanilla block missing from default creative tab [RESOLVED]
Don't. Because it happens during chunk load, the chunk hasn't loaded yet, so it pauses the load to fetch the chunk you're referencing, which is the chunk that contains the cauldron which is currently paused waiting for it to finish loading. Do that check in an update tick.
-
Way to swap two crafting recipes?
That was posted in May of 2017, so MC 1.10 most likely. Recipes were much more...run-time accessible at the time. How that particular mod did things I can't say (I can't even find the mod description, just a link to the twitter of the guy that made it).
-
[1.16] Converting a legacy block after update
You can get an idea of how I handle it here: https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/harderores/HarderOres.java#L134 (I needed to support Silk Touch on a property that made no sense to be separate blocks) Magic registry stuff (old event-style rather than new DeferredRegister style): https://github.com/Draco18s/ReasonableRealism/blob/033da26f8ba4bcd25b0911aa9775764f12d7dbbe/src/main/java/com/draco18s/hardlib/EasyRegistry.java#L57 getPickBlock (reg names were dynamic, so this is a bit ugly): https://github.com/Draco18s/ReasonableRealism/blob/033da26f8ba4bcd25b0911aa9775764f12d7dbbe/src/main/java/com/draco18s/harderores/block/ore/HardOreBlock.java#L80 getStateForPlacement: https://github.com/Draco18s/ReasonableRealism/blob/033da26f8ba4bcd25b0911aa9775764f12d7dbbe/src/main/java/com/draco18s/harderores/block/ore/HardOreBlock.java#L90 I had to do some custom shenanigans for the loot table as well. But if your three items are sensibly named I don't think you need to do much that vanilla doesn't already support. It was just easier for me to write a loot condition that got the blockstate's numerical value and did a lookup on the item than it was to specify a 1:1 relationship in the loot table.
-
Trying to look for a hashset list in player.inventory.getCurrentItem()
Why do you have this? Your class isn't the one being called by the JVM.
-
[1.16] Converting a legacy block after update
Yes, but you need a custom BlockItem that knows what state needs to be set.
-
Trying to look for a hashset list in player.inventory.getCurrentItem()
Do you ever call getList()?
-
[1.16.5] save/transfer of capability
if cap IS the enderchest, then it CAN'T be null and vice versa.
-
[1.16] Converting a legacy block after update
Honestly this is a perfectly valid blockstate block. All three "versions" are a tea_kettle, but with some stateful information (full, empty, hot).
-
OnBlockActivated fires twice
Your IDE should tell you to simplify this to Hand.MAIN_HAND
-
[1.16] Item subtypes
It doesn't. Welcome to The Flattening.
-
OnBlockActivated fires twice
There are two hands.
-
[1.16.5] save/transfer of capability
First, second, third, and fourth.
-
[1.16.5] save/transfer of capability
-
[1.16.5] save/transfer of capability
Hooray! You did the same thing again! Only this time with lambdas! Lets put it this way, you have a chest on one side of your house with raw beef in it and have just built a new kitchen and you want to move all that beef into a new chest in the kitchen next to a furnace. Which makes more sense? A) Use pistons to move the old chest to the new chest's location. B) Take the beef out of the chest and place it in the new chest.
-
Dropping an item only when clicked on certain block
The fact that the code is inside "the separator" (or in my case, the millstone) I don't need to check if the block is the block I care about because the only time this will get called is if the player clicks on that type of block. They right click on a door? The door class gets the call, not the separator.
-
[1.16.5] save/transfer of capability
Take the items out of one capability and put them into the other.
-
Dropping an item only when clicked on certain block
https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/harderores/block/MillstoneBlock.java#L57
-
[1.16.5] save/transfer of capability
"Assign this local variable to the reference stored in this other local variable. Now, recycle these local variables." You haven't actually done anything except create two pointers to the same capability data (which you then feed to the garbage collector).
-
[1.16.5] save/transfer of capability
Your capability contains item stacks, right? Why not move the item stacks from one capability to the other?
-
[1.16.5] save/transfer of capability
This doesn't actually give the new player entity the capability data. Because orElseGet returns a value (in this case, your local variable, backpackHandler) in the event that the original getCap call returns null. No reference is made between the player object and this handler and as soon as your method returns, the inventory is lost. You need to copy the inventory from one capability to the other.
- Item in inventory?
-
How to make a lootbag?
I wonder how entities and blocks do it and maybe it is applicable.
-
How to make a lootbag?
Loot is done with loot tables now, which handles the "random selection" process for you.
IPS spam blocked by CleanTalk.