Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Pick block" to copy items doesn't copy stats #59

Open
Bluexin opened this issue Dec 9, 2018 · 5 comments
Open

"Pick block" to copy items doesn't copy stats #59

Bluexin opened this issue Dec 9, 2018 · 5 comments
Labels
bug Something isn't working

Comments

@Bluexin
Copy link
Owner

Bluexin commented Dec 9, 2018

For unidentified items.

Because cloning items happens on client, and server doesn't send the data about unidentified items for safety reasons.

@Bluexin Bluexin added the bug Something isn't working label Dec 9, 2018
@jredfox
Copy link

jredfox commented Feb 14, 2019

pickblock event is client only and sends the stack directly to server side.

@Bluexin
Copy link
Owner Author

Bluexin commented Feb 14, 2019

Yeah I know, problem is because we don't send unidentified item data to clients (to prevent hax), the data doesn't get cloned either.

@jredfox
Copy link

jredfox commented Feb 14, 2019

I made pickblock event on server side only client can't hack the server's code and converted it to forge events found here and here:
https://github.com/jredfox/evilnotchlib/blob/master/src/main/java/com/evilnotch/lib/asm/transformer/GeneralTransformer.java#L28
https://github.com/jredfox/evilnotchlib/blob/master/src/main/java/com/evilnotch/lib/main/eventhandler/PickBlock.java

However don't do what I did or our mods would remain. Is there a way multple overrides of pickblock event could exist?

I did this so silkspawners could properly fetch spawnpotentials while middle clicking a spawner block

@Bluexin
Copy link
Owner Author

Bluexin commented Feb 14, 2019

Thanks.
The server is already notified of the player using "pick block" in a gui though, so I'd rather hook into that directly, see

object SlotTypeUsable : SlotType() {
override fun handleClick(
slot: SlotBase,
container: ContainerBase,
dragType: Int,
clickType: ClickType?,
player: EntityPlayer
): Pair<Boolean, ItemStack> =
if (!player.world.isRemote && slot.stack.isNotEmpty && !player.isCreative && clickType == ClickType.CLONE) {
val r = (player as EntityPlayerMP).interactionManager.processItemUse(
player,
player.world,
slot.stack,
EnumHand.MAIN_HAND
)
if (r == EnumActionResult.PASS) super.handleClick(slot, container, dragType, clickType, player)
else true to slot.stack
} else super.handleClick(slot, container, dragType, clickType, player)

@Bluexin
Copy link
Owner Author

Bluexin commented Feb 14, 2019

But anyway, this is low priority compared to some other stuff on the roadmap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants