aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky/skyblocker/mixins/MushroomPlantBlockMixin.java
blob: 7e0f5b390b6030bdeffd58662f481f5b09755364 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package de.hysky.skyblocker.mixins;

import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.utils.Utils;
import net.minecraft.block.*;
import net.minecraft.util.shape.VoxelShape;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(MushroomPlantBlock.class)
public abstract class MushroomPlantBlockMixin extends Block {
	@Shadow
	protected static VoxelShape SHAPE;

	@Unique
	private static final VoxelShape OLD_SHAPE = Block.createCuboidShape(4.8, 0.0, 4.8, 11.2, 6.4, 11.2);

	public MushroomPlantBlockMixin(Settings settings) {
		super(settings);
	}

	@ModifyReturnValue(method = "getOutlineShape", at = @At("RETURN"))
	private VoxelShape skyblocker$getOldMushroomOutline(VoxelShape original) {
		return Utils.isOnSkyblock() && SkyblockerConfigManager.get().general.hitbox.oldMushroomHitbox ? OLD_SHAPE : original;
	}

	@Override
	public VoxelShape getCullingShape(BlockState state) {
		return SHAPE;
	}
}