aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/ambientaddons/mixin/MixinCarpet.java
blob: 20de47cbd2ae553728be195bd627fe59e3ae34f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package com.ambientaddons.mixin;

import com.ambientaddons.features.dungeon.IgnoreCarpet;
import net.minecraft.block.BlockCarpet;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

// credit Floppa Client
@Mixin(BlockCarpet.class)
public abstract class MixinCarpet extends MixinBlock {
    @Inject(method = "setBlockBoundsFromMeta", at = @At("HEAD"), cancellable = true)
    protected void setBlockBoundsFromMeta(int meta, CallbackInfo ci) {
        if (IgnoreCarpet.INSTANCE.shouldIgnoreCarpet()) {
            setBlockBounds(0F, 0F, 0F, 1F, 0F, 1F);
            ci.cancel();
        }
    }
}