~williewillus/violet-moon

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 3

[PATCH botania 1/2] Extract HornItem.canHarvest from HornItem.breakGrass

Details
Message ID
<87h6rx57g6.fsf@vincent-lee.net>
DKIM signature
missing
Download raw message
Patch: +23 -11
No functional change, refactor for next commit

diff --git a/Xplat/src/main/java/vazkii/botania/common/item/HornItem.java b/Xplat/src/main/java/vazkii/botania/common/item/HornItem.java
--- a/Xplat/src/main/java/vazkii/botania/common/item/HornItem.java
+++ b/Xplat/src/main/java/vazkii/botania/common/item/HornItem.java
@@ -19,7 +19,6 @@
import net.minecraft.world.item.ItemUtils;
import net.minecraft.world.item.UseAnim;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.BushBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
@@ -70,6 +69,27 @@
		}
	}

	private static boolean canHarvest(Level level, ItemStack stack, BlockPos pos,
			@Nullable LivingEntity user, EnumHornType type) {
		BlockState state = level.getBlockState(pos);
		BlockEntity be = level.getBlockEntity(pos);

		HornHarvestable harvestable = XplatAbstractions.INSTANCE.findHornHarvestable(level, pos, state, be);
		if (harvestable != null) {
			return harvestable.canHornHarvest(level, pos, stack, type, user);
		} else {
			switch (type) {
				default:
				case WILD:
					return state.getBlock() instanceof BushBlock && !state.is(BotaniaTags.Blocks.SPECIAL_FLOWERS);
				case CANOPY:
					return state.is(BotaniaTags.Blocks.HORN_OF_THE_CANOPY_BREAKABLE);
				case COVERING:
					return state.is(BotaniaTags.Blocks.HORN_OF_THE_COVERING_BREAKABLE);
			}
		}
	}

	public static void breakGrass(Level world, ItemStack stack, BlockPos srcPos, @Nullable LivingEntity user) {
		EnumHornType type = null;
		if (stack.is(BotaniaItems.grassHorn)) {
@@ -86,19 +106,11 @@

		for (BlockPos pos : BlockPos.betweenClosed(srcPos.offset(-range, -rangeY, -range),
				srcPos.offset(range, rangeY, range))) {
			BlockState state = world.getBlockState(pos);
			Block block = state.getBlock();
			BlockEntity be = world.getBlockEntity(pos);
			HornHarvestable harvestable = XplatAbstractions.INSTANCE.findHornHarvestable(world, pos, state, be);

			if (BergamuteBlockEntity.isBergamuteNearby(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5)) {
				continue;
			}
			if (harvestable != null
					? harvestable.canHornHarvest(world, pos, stack, type, user)
					: type == EnumHornType.WILD && block instanceof BushBlock && !state.is(BotaniaTags.Blocks.SPECIAL_FLOWERS)
							|| type == EnumHornType.CANOPY && state.is(BotaniaTags.Blocks.HORN_OF_THE_CANOPY_BREAKABLE)
							|| type == EnumHornType.COVERING && state.is(BotaniaTags.Blocks.HORN_OF_THE_COVERING_BREAKABLE)) {

			if (HornItem.canHarvest(world, stack, pos, user, type)) {
				coords.add(pos.immutable());
			}
		}

[PATCH botania 2/2] Prevent Horn of the Canopy from breaking persistent leaves

Details
Message ID
<87a5xp57eh.fsf@vincent-lee.net>
In-Reply-To
<87h6rx57g6.fsf@vincent-lee.net> (view parent)
DKIM signature
missing
Download raw message
Patch: +8 -1
Likely a regression from the tag migration. Closes #4379

diff --git a/Xplat/src/main/java/vazkii/botania/common/item/HornItem.java b/Xplat/src/main/java/vazkii/botania/common/item/HornItem.java
--- a/Xplat/src/main/java/vazkii/botania/common/item/HornItem.java
+++ b/Xplat/src/main/java/vazkii/botania/common/item/HornItem.java
@@ -20,6 +20,7 @@
import net.minecraft.world.item.UseAnim;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BushBlock;
import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;

@@ -82,8 +83,14 @@
				default:
				case WILD:
					return state.getBlock() instanceof BushBlock && !state.is(BotaniaTags.Blocks.SPECIAL_FLOWERS);
				case CANOPY:
				case CANOPY: {
					if (state.getBlock() instanceof LeavesBlock
							&& state.getValue(LeavesBlock.PERSISTENT)) {
						return false;
					}

					return state.is(BotaniaTags.Blocks.HORN_OF_THE_CANOPY_BREAKABLE);
				}
				case COVERING:
					return state.is(BotaniaTags.Blocks.HORN_OF_THE_COVERING_BREAKABLE);
			}

[botania/patches/linux.yml] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CSXOTHHOW4ED.KCG9JMMBOBHN@cirno2>
In-Reply-To
<87a5xp57eh.fsf@vincent-lee.net> (view parent)
DKIM signature
missing
Download raw message
botania/patches/linux.yml: SUCCESS in 19m44s

[Extract HornItem.canHarvest from HornItem.breakGrass][0] from [Vincent Lee][1]

[0]: https://lists.sr.ht/~williewillus/violet-moon/patches/41445
[1]: vincent@vincent-lee.net

✓ #997094 SUCCESS botania/patches/linux.yml https://builds.sr.ht/~williewillus/job/997094

Re: [PATCH botania 2/2] Prevent Horn of the Canopy from breaking persistent leaves

Details
Message ID
<dwv36an4wv2pkqjqt34a2eknlhnmsqihjkzzgpkiigxcdi7pby@cauc2i3vqwvh>
In-Reply-To
<87a5xp57eh.fsf@vincent-lee.net> (view parent)
DKIM signature
missing
Download raw message
Both commits look good
Reply to thread Export thread (mbox)