-
Posts
16559 -
Joined
-
Last visited
-
Days Won
156
Everything posted by Draco18s
-
New versions don't make the need for packets to magically go away.
-
Capabilities store "arbitrary data." If your magic system isn't "arbitrary data" then something is very wrong indeed.
-
Use data packs. Your mod is also a data pack.
-
Capabilities.
-
[1.15.2] How to make an item that doesn't burn
Draco18s replied to someRandomKid's topic in Modder Support
By "doesn't burn" do you mean that it does not provide fuel for a furnace? Because that's automatic. Or do you mean that when dropped into the world it isn't destroyed by fire or lava? Or do you mean something else? -
You see this? https://github.com/LukasSchikirianski/JungleAddonsMod/blob/master/Jungle Addons - 1.16.1/src/main/java/com/lukas/jungle_addons/JungleAddons.java#L30 You see how it says bus=Bus.MOD? That's the wrong bus for those events.
-
That's called Reaching Across Sides and won't work. If the client and sever are running on different machines, how do you think the server knows about the gui change? (a) use the loot system and get the block's drops (b) pickBlock()
-
Do not use this, this uses the vanilla IInventory system. You should use ItemStackHandler for inventory instead. Why the fuck do you have THREE local variables storing the same block state? blockstate, newBlockstate, and blockRemoved are literally all the same thing and can never be anything else at this point in the code. If you are interested in doing something with these variables, but not with this value, don't assign a value here. Yeah. Like that...why didn't you just assign newBlockstate to AIR to begin with? And for that matter why do you even need this variable anyway? What. Why are you passing a public static field to a private non-static method? What. This is not how you get an ItemStack from a block. This won't work for a whole host of blocks, from piston heads, to cake, to redstone wire, to crops. Mmm yep. This is why ItemStackHandler exists. *Suspicion*
-
I don't know. Where are you calling destroyBlock from? What's that code look like?
-
ReflectionObfuscationHelper if I remember the class's name correctly. You call getPrivateValue and pass in the SRG name of the field you want.
-
Let me pop my IDE open here and... Well, the POWERED value and the dataManager are both private, so.... Reflection.
-
Don't serialize/deserialize entities to change their field values. That's disgusting.
-
Report the crash to the mod author.
-
They're bit flags. You bit-wise OR the values together. 1 | 2 (aka "3") 4 | 8 (aka "12") 1 | 2 | 8 (aka "11") This will create weird effects that you almost certainly do not want.
-
Item has methods for onRightClick and onEntityInteract (you'll have to poke around for exact method names). Just override them and put your functionality there.
-
No. Also:
-
Don't compare strings. Use instanceof. You already use a cast later down. Why are you performing this particular check twice? Use an early return here like you did with a null player. "Refuel." And finally: Why are you bothering with R keypresses? Why not use the systems Minecraft already has in place (right clicking with a stack)? Then you don't need this key press handler at all and can put this logic inside your item (where it belongs) and don't need to deal with custom packets.
-
Read the javadoc.
-
Well you have a world.isRemote check there, but I can't tell if you're checking for true or false. And you have another line above it that looks suspicious. But you posted your code as an image rather than text showing a tooltip that is patently useless for solving the problem and hiding code I might actually be interested in. Also, there's nothing wrong with world.setBlockState, provided you pay attention to the FLAG parameter. world.destroyBlock should also work (it will drop the block's loot). world.removeBlock should just be a wrapper around world.setBlockState(Blocks.AIR)
-
Asyncing Item Cooldown Among Itemstacks
Draco18s replied to Babelincoln1809's topic in Modder Support
Ah yes, you are correct. Normally this sort of issue is caused by people putting data in the Item class. Anyway, in order to make the cooldown stack based not player based, the answer is still Capabilities. -
I only had to spell things out for you. Twice.
-
Is the concept of blocks being registered per-world feasible?
Draco18s replied to miir's topic in Modder Support
Not really, no. -
Asyncing Item Cooldown Among Itemstacks
Draco18s replied to Babelincoln1809's topic in Modder Support
You can't do this. Use Capabilities. -
None of those. The tile entity already has a world field. You even found it. Fucking use it.