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

[Split Shulkers] Washing a shulker box in a chauldron should remove both colors #10

Open
fabien-gigante opened this issue Jul 28, 2024 · 0 comments

Comments

@fabien-gigante
Copy link

fabien-gigante commented Jul 28, 2024

Issue Summary

Washing a shulker box in a chauldron should remove both colors

Detailed information

Steps to reproduce:

  • Place a chauldron, fill it with with water
  • Have in hand a shulker box with two colors applied
  • Right click on the chauldron

Observed behavior:

  • Only the primary (vanilla) color is removed

Expected behavior:

  • The secondary (moded) color should be removed as well

Suggested fix

Some time back, I start developing a similar mod. However I don't maintain it, and yours is globally better anyway. 😀 However, I used the following method to solve this issue, which you mind find usefull.

		// Override cauldron behavior to also clean the secondary color of shulker boxes
		CauldronBehavior CLEAN_SHULKER_BOX = ((state, world, pos, player, hand, stack) -> {
			ActionResult ret = CauldronBehavior.CLEAN_SHULKER_BOX.interact(state, world, pos, player, hand, stack);
			if (ret != ActionResult.PASS && !world.isClient) {
				ItemStack itemStack = player.getStackInHand(hand);
				NbtCompound nbt = BlockItem.getBlockEntityNbt(itemStack);
				if (nbt != null) ShulkerBoxBlockEntityExt.putNbtSecondaryColor(nbt, null);
			}
			return ret;
		});
		// Replace vanilla behavior by overriden behavior
		Map<Item, CauldronBehavior> map = CauldronBehavior.WATER_CAULDRON_BEHAVIOR.map();
		map.replaceAll((item, behavior) -> behavior == CauldronBehavior.CLEAN_SHULKER_BOX ? CLEAN_SHULKER_BOX : behavior);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant