Skip to content

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

Description

@fabien-gigante

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);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions