Updated Tag API and tag constants

This commit is contained in:
paulevsGitch 2022-01-21 14:56:37 +03:00
parent 7ab5377a03
commit db082ef1be
35 changed files with 308 additions and 385 deletions

View file

@ -23,7 +23,7 @@ public abstract class CraftingMenuMixin {
private void bclib_stillValid(Player player, CallbackInfoReturnable<Boolean> info) {
if (access.evaluate((world, pos) -> {
BlockState state = world.getBlockState(pos);
return state.getBlock() instanceof CraftingTableBlock || state.is(TagAPI.BLOCK_WORKBENCHES);
return state.getBlock() instanceof CraftingTableBlock || state.is(TagAPI.COMMON_BLOCK_WORKBENCHES);
}, true)) {
info.setReturnValue(true);
}

View file

@ -22,6 +22,6 @@ public abstract class EnchantmentMenuMixin extends AbstractContainerMenu {
target = "Lnet/minecraft/world/level/block/state/BlockState;is(Lnet/minecraft/world/level/block/Block;)Z")//,
)
private boolean bclib_isBookshelf(BlockState state, Block block) {
return block == Blocks.BOOKSHELF ? state.is(TagAPI.BLOCK_BOOKSHELVES) : state.is(block);
return block == Blocks.BOOKSHELF ? state.is(TagAPI.COMMON_BLOCK_BOOKSHELVES) : state.is(block);
}
}

View file

@ -21,7 +21,6 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import ru.bclib.BCLib;
import ru.bclib.api.biomes.BiomeAPI;
import ru.bclib.api.dataexchange.DataExchangeAPI;
import ru.bclib.recipes.BCLRecipeManager;

View file

@ -15,7 +15,7 @@ import ru.bclib.api.TagAPI;
public class PistonBaseBlockMixin {
@Inject(method="isPushable", at=@At("HEAD"), cancellable = true)
private static void bclib_isPushable(BlockState blockState, Level level, BlockPos blockPos, Direction direction, boolean bl, Direction direction2, CallbackInfoReturnable<Boolean> cir){
if (blockState.is(TagAPI.BLOCK_IMMOBILE)){
if (blockState.is(TagAPI.COMMON_BLOCK_IMMOBILE)){
cir.setReturnValue(false);
cir.cancel();
}

View file

@ -28,6 +28,6 @@ public class PortalShapeMixin {
}
private static boolean be_FRAME(StatePredicate FRAME, BlockState state, BlockGetter getter, BlockPos pos){
return state.is(TagAPI.BLOCK_NETHER_PORTAL_FRAME) || FRAME.test(state, getter, pos);
return state.is(TagAPI.COMMON_BLOCK_NETHER_PORTAL_FRAME) || FRAME.test(state, getter, pos);
}
}

View file

@ -1,12 +1,10 @@
package ru.bclib.mixin.common.shears;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.advancements.critereon.ItemPredicate;
import net.minecraft.advancements.critereon.ItemPredicate.Builder;
import net.minecraft.tags.Tag;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.ItemLike;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
@ -26,7 +24,7 @@ public abstract class ItemPredicateBuilderMixin {
@Inject(method = "matches", at = @At("HEAD"), cancellable = true)
void bclib_of(ItemStack itemStack, CallbackInfoReturnable<Boolean> cir) {
if (this.items != null && this.items.size() == 1 && this.items.contains(Items.SHEARS)) {
if (itemStack.is(TagAPI.ITEM_COMMON_SHEARS) || itemStack.is(TagAPI.ITEM_SHEARS)){
if (itemStack.is(TagAPI.COMMON_ITEM_SHEARS) || itemStack.is(FabricToolTags.SHEARS)){
cir.setReturnValue(true);
}
}