~williewillus/botania

b5eebb969e287d5b0425b052f0707a7eef655da9 — Vincent Lee 6 months ago 7401219 1.19.2
Fix Rosa arcana not taking into account stacked xp orbs

Closes #4406
M Xplat/src/main/java/vazkii/botania/common/block/flower/generating/RosaArcanaBlockEntity.java => Xplat/src/main/java/vazkii/botania/common/block/flower/generating/RosaArcanaBlockEntity.java +7 -2
@@ 27,6 27,7 @@ import vazkii.botania.api.block_entity.RadiusDescriptor;
import vazkii.botania.common.block.BotaniaFlowerBlocks;
import vazkii.botania.common.handler.BotaniaSounds;
import vazkii.botania.common.helper.EntityHelper;
import vazkii.botania.mixin.ExperienceOrbAccessor;

import java.util.List;
import java.util.Map;


@@ 68,9 69,13 @@ public class RosaArcanaBlockEntity extends GeneratingFlowerBlockEntity {

		List<ExperienceOrb> orbs = getLevel().getEntitiesOfClass(ExperienceOrb.class, effectBounds);
		for (ExperienceOrb orb : orbs) {
			if (orb.isAlive()) {
			int count = ((ExperienceOrbAccessor) orb).botania_getCount();
			if (orb.isAlive() && count > 0) {
				addMana(orb.getValue() * MANA_PER_XP);
				orb.discard();
				((ExperienceOrbAccessor) orb).botania_setCount(count - 1);
				if (count == 1) {
					orb.discard();
				}
				float pitch = (level.random.nextFloat() - level.random.nextFloat()) * 0.35F + 0.9F;
				//Usage of vanilla sound event: Subtitle is "Experience gained", and this is about gaining experience anyways.
				level.playSound(null, getEffectivePos(), SoundEvents.EXPERIENCE_ORB_PICKUP, SoundSource.BLOCKS, 0.07F, pitch);

A Xplat/src/main/java/vazkii/botania/mixin/ExperienceOrbAccessor.java => Xplat/src/main/java/vazkii/botania/mixin/ExperienceOrbAccessor.java +14 -0
@@ 0,0 1,14 @@
package vazkii.botania.mixin;

import net.minecraft.world.entity.ExperienceOrb;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

@Mixin(ExperienceOrb.class)
public interface ExperienceOrbAccessor {
    @Accessor("count")
    int botania_getCount();

    @Accessor("count")
    void botania_setCount(int c);
}

M Xplat/src/main/resources/botania_xplat.mixins.json => Xplat/src/main/resources/botania_xplat.mixins.json +1 -0
@@ 21,6 21,7 @@
    "DispenserBlockAccessor",
    "EntityAccessor",
    "EntityMixin",
    "ExperienceOrbAccessor",
    "FarmBlockMixin",
    "FireBlockAccessor",
    "GoalSelectorAccessor",