#clay with inventory
1 messages · Page 1 of 1 (latest)
You cant assign a TileState to a random Block. It has to be a TileState as well.
hm
to override the block
that's a very bad idea
my goal is to add inventory to any block
allowing them to receive items from hopper
oh yeah well
1.12
This has to be handled externally. There is no way to implement that natively.
oh shit 1.12 I'm out lol, sorry
:c
my knowledge about pre 1.13 is very limited
Oh then the idea i just cooked up in my head wont work too...
say it
PDC of Chunks
well you cannot simply register new block / tileentity classes and expect them to work
that's not what the API was designed for
You need to completely emulate all the properties of a BlockInventoryHolder TileState
only exists on 1.16.3+
jep
yeah but they are using 1.12.2^^
sooo
let me rephrase
you want hoppers be able to put stuff into your custom block's inventories
right?
yes
if so: there's NO OTHER WAY than checking inventory/hopper events and moving those items manually
Events arent fired
^
well of course events are fired
no
events for items ENTERING the hopper are
yes
He has to get all TileStates when a chunk loads, filter the hopper states out and manually tick them depending on their orientation.
and then you have to the rest manually
I mean what do you expect? of course spigot won't call an event when a hopper doesnt actually attempt to move stuff from a hopper to your custom dirt block^^
you will have to check when items ENTER your hopper and then do the rest on your own
there DEFINITELY is no other way, sorry
:C
i was using some breakpoints
and i saw that the event was fired in my custom block
I made a hopper filtering plugin a few weeks ago ( https://www.spigotmc.org/resources/filtered-hoppers.96037/ ) so I know how hoppers are working in 1.17, aaaaaand: in 1.12.2, the API will definitely not have more methods, soooo I can garantuee: no way! There are no events for hoppers checking blockstates that don't extend/implement container :/
my block is a container :D
you just CANNOT create new blocks
override
yes but hear me out
of course you can create a new class that extends/implements container
but never ever will there exist any REAL block in your world that actually has your custom block as its blockstate
the API isn't designed to do that
that's why MATERIAL is an enum
believe me or not, you will not get it to work in this way
the only problem here is that the hopper is not transfering items
You are currently changing the bahavior of all clay type Blocks. Not just certain ones.
Is the block next to me a hopper? If yes, transfer it. If no, don't. And your block is NOT a hopper, it's just something else
I'm doing spigot development for more than 3 years now and have sold quite a lot of premium plugins until today. In my opinion, what you are looking for is simply not possible. Of course you can recreate the behaviour you're looking for, but you cannot just do it the way you're currently trying to use. Sure, I might be wrong, but tbh I am very very sure that I aint.
Sooo to rephrase:
you have to rewrite all the hopper mechanics
you cannot simply trick the game into thinking your custom block is a container
it just will never work
Its possible but he will have to use a LOT of workarounds.
The hardest problem will be serialization.
noo nooo
well
I never looked at the source code that actually saves the world data
anyway, let's just agree on the fact that listening to the event that tells you when items ENTER the hopper and then doing the remaining stuff manually is the only viable solution^^
ooooor
you could fork spigot, create a PR that adds the new events you need, and ask md_5 to merge it. But he probably will never do because hoppers already are one of the largest lag machines that exist in spigot