More Tag Related Changes

This commit is contained in:
Frank 2022-04-03 22:51:04 +02:00
parent 5ba0488c9b
commit b59eb42d35
16 changed files with 19 additions and 20 deletions

View file

@ -23,6 +23,7 @@ import ru.bclib.api.tag.CommonItemTags;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.CustomColorProvider;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.interfaces.tools.AddMineableHammer;
import ru.bclib.interfaces.tools.AddMineablePickaxe;
import ru.bclib.util.ColorUtil;
import ru.bclib.util.MHelper;
@ -30,7 +31,7 @@ import ru.betterend.registry.EndItems;
import java.util.List;
public class AuroraCrystalBlock extends AbstractGlassBlock implements RenderLayerProvider, CustomColorProvider, AddMineablePickaxe {
public class AuroraCrystalBlock extends AbstractGlassBlock implements RenderLayerProvider, CustomColorProvider, AddMineablePickaxe, AddMineableHammer {
public static final Vec3i[] COLORS;
private static final int MIN_DROP = 1;
private static final int MAX_DROP = 4;
@ -38,7 +39,6 @@ public class AuroraCrystalBlock extends AbstractGlassBlock implements RenderLaye
public AuroraCrystalBlock() {
super(FabricBlockSettings
.of(Material.GLASS)
.breakByTool(CommonItemTags.HAMMERS)
.hardness(1F)
.resistance(1F)
.luminance(15)

View file

@ -25,7 +25,6 @@ public class BubbleCoralBlock extends EndUnderwaterPlantBlock implements AddMine
public BubbleCoralBlock() {
super(FabricBlockSettings.of(Material.WATER_PLANT)
.breakByHand(true)
.sound(SoundType.CORAL_BLOCK)
.noCollission());
}

View file

@ -43,7 +43,6 @@ public class EndLilyBlock extends EndUnderwaterPlantBlock implements AddMineable
public EndLilyBlock() {
super(FabricBlockSettings.of(Material.WATER_PLANT)
.breakByHand(true)
.sound(SoundType.WET_GRASS)
.lightLevel((state) -> state.getValue(SHAPE) == TripleShape.TOP ? 13 : 0)
.noCollission());

View file

@ -29,7 +29,6 @@ public class FlamaeaBlock extends EndPlantBlock implements CustomItemProvider, A
public FlamaeaBlock() {
super(FabricBlockSettings.of(Material.PLANT)
.breakByHand(true)
.sound(SoundType.WET_GRASS));
}

View file

@ -24,7 +24,6 @@ public class GlowingPillarSeedBlock extends EndPlantWithAgeBlock implements AddM
public GlowingPillarSeedBlock() {
super(FabricBlockSettings.of(Material.PLANT)
.breakByHand(true)
.sound(SoundType.GRASS)
.lightLevel(state -> state.getValue(AGE) * 3 + 3)
.randomTicks()

View file

@ -34,7 +34,6 @@ public class HydraluxBlock extends UnderwaterPlantBlock implements AddMineableS
public HydraluxBlock() {
super(FabricBlockSettings.of(Material.WATER_PLANT)
.breakByHand(true)
.sound(SoundType.WET_GRASS)
.lightLevel((state) -> state.getValue(SHAPE).hasGlow() ? 15 : 0)
.noCollission());

View file

@ -16,7 +16,6 @@ public class HydraluxPetalBlock extends BaseBlock implements AddMineableAxe {
this(
FabricBlockSettings
.of(Material.PLANT)
.breakByHand(true)
.hardness(1)
.resistance(1)
.mapColor(MaterialColor.PODZOL)

View file

@ -29,7 +29,7 @@ public class LargeAmaranitaBlock extends EndPlantBlock implements AddMineableShe
public LargeAmaranitaBlock() {
super(FabricBlockSettings.of(Material.PLANT)
.breakByHand(true)
.sound(SoundType.GRASS)
.lightLevel((state) -> (state.getValue(SHAPE) == TripleShape.TOP) ? 15 : 0));
}

View file

@ -24,7 +24,7 @@ public class PondAnemoneBlock extends EndUnderwaterPlantBlock implements AddMine
public PondAnemoneBlock() {
super(FabricBlockSettings.of(Material.WATER_PLANT)
.breakByHand(true)
.luminance(13)
.sound(SoundType.CORAL_BLOCK)
.noCollission());

View file

@ -27,6 +27,7 @@ import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3;
import ru.bclib.blocks.BaseBlock;
import ru.bclib.items.tool.BaseShearsItem;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.MHelper;
import ru.betterend.entity.SilkMothEntity;
@ -99,7 +100,7 @@ public class SilkMothHiveBlock extends BaseBlock {
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
if (hand == InteractionHand.MAIN_HAND) {
ItemStack stack = player.getMainHandItem();
if (stack.is(FabricToolTags.SHEARS) && state.getValue(FULLNESS) == 3) {
if (BaseShearsItem.isShear(stack) && state.getValue(FULLNESS) == 3) {
BlocksHelper.setWithUpdate(world, pos, state.setValue(FULLNESS, 0));
Direction dir = state.getValue(FACING);
double px = pos.getX() + dir.getStepX() + 0.5;

View file

@ -37,6 +37,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
import ru.bclib.blocks.BaseBlock;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.items.tool.BaseShearsItem;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.MHelper;
import ru.betterend.entity.SilkMothEntity;
@ -163,7 +164,7 @@ public class SilkMothNestBlock extends BaseBlock implements RenderLayerProvider
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
if (hand == InteractionHand.MAIN_HAND) {
ItemStack stack = player.getMainHandItem();
if (stack.is(FabricToolTags.SHEARS) && state.getValue(ACTIVE) && state.getValue(FULLNESS) == 3) {
if (BaseShearsItem.isShear(stack) && state.getValue(ACTIVE) && state.getValue(FULLNESS) == 3) {
BlocksHelper.setWithUpdate(world, pos, state.setValue(FULLNESS, 0));
Direction dir = state.getValue(FACING);
double px = pos.getX() + dir.getStepX() + 0.5;

View file

@ -32,6 +32,7 @@ import ru.bclib.api.tag.CommonBlockTags;
import ru.bclib.blocks.BaseAttachedBlock;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.items.tool.BaseShearsItem;
import ru.bclib.util.BlocksHelper;
import ru.betterend.interfaces.PottablePlant;
import ru.betterend.registry.EndFeatures;
@ -57,7 +58,7 @@ public class SmallJellyshroomBlock extends BaseAttachedBlock implements RenderLa
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
if (tool != null && tool.is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(
if (tool != null && BaseShearsItem.isShear(tool) || EnchantmentHelper.getItemEnchantmentLevel(
Enchantments.SILK_TOUCH,
tool
) > 0) {

View file

@ -24,6 +24,7 @@ import ru.bclib.blocks.BaseAttachedBlock;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.interfaces.tools.AddMineableShears;
import ru.bclib.items.tool.BaseShearsItem;
import ru.bclib.util.MHelper;
import java.util.EnumMap;
@ -46,8 +47,7 @@ public class FurBlock extends BaseAttachedBlock implements RenderLayerProvider,
public FurBlock(ItemLike drop, int dropChance) {
super(FabricBlockSettings.of(Material.REPLACEABLE_PLANT)
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.sound(SoundType.GRASS)
.noCollission());
this.drop = drop;
@ -64,7 +64,7 @@ public class FurBlock extends BaseAttachedBlock implements RenderLayerProvider,
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
if (tool != null && tool.is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(
if (tool != null && BaseShearsItem.isShear(tool) || EnchantmentHelper.getItemEnchantmentLevel(
Enchantments.SILK_TOUCH,
tool
) > 0) {

View file

@ -154,7 +154,7 @@ public class MetalMaterial {
ore = hasOre ? EndBlocks.registerBlock(name + "_ore", new BaseOreBlock(()->rawOre, 1, 3, 1)) : null;
alloyingOre = hasOre ? TagAPI.makeItemTag(BetterEnd.MOD_ID, name + "_alloying") : null;
if (hasOre) {
TagAPI.addItemTag(alloyingOre.getName(), ore, rawOre);
TagAPI.addItemTag(alloyingOre, ore, rawOre);
}
block = EndBlocks.registerBlock(name + "_block", new BaseBlock(settings));

View file

@ -1,6 +1,7 @@
package ru.betterend.mixin.common;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
@ -13,6 +14,7 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.dimension.DimensionType;
import net.minecraft.world.level.storage.LevelStorageSource;
import net.minecraft.world.level.storage.LevelStorageSource.LevelStorageAccess;
import net.minecraft.world.level.storage.ServerLevelData;
import net.minecraft.world.level.storage.WritableLevelData;
@ -36,7 +38,7 @@ import java.util.function.Supplier;
public abstract class ServerLevelMixin extends Level {
//private static String be_lastWorld = null;
protected ServerLevelMixin(WritableLevelData writableLevelData, ResourceKey<Level> resourceKey, DimensionType dimensionType, Supplier<ProfilerFiller> supplier, boolean bl, boolean bl2, long l) {
protected ServerLevelMixin(WritableLevelData writableLevelData, ResourceKey<Level> resourceKey, Holder<DimensionType> dimensionType, Supplier<ProfilerFiller> supplier, boolean bl, boolean bl2, long l) {
super(writableLevelData, resourceKey, dimensionType, supplier, bl, bl2, l);
}
@ -52,7 +54,7 @@ public abstract class ServerLevelMixin extends Level {
// }
@Inject(method = "<init>*", at = @At("TAIL"))
private void be_onServerWorldInit(MinecraftServer minecraftServer, Executor executor, LevelStorageAccess levelStorageAccess, ServerLevelData serverLevelData, ResourceKey<Level> resourceKey, DimensionType dimensionType, ChunkProgressListener chunkProgressListener, ChunkGenerator chunkGenerator, boolean bl, long seed, List<CustomSpawner> list, boolean bl2, CallbackInfo ci) {
private void be_onServerWorldInit(MinecraftServer minecraftServer, Executor executor, LevelStorageAccess levelStorageAccess, ServerLevelData serverLevelData, ResourceKey resourceKey, Holder holder, ChunkProgressListener chunkProgressListener, ChunkGenerator chunkGenerator, boolean bl, long seed, List list, boolean bl2, CallbackInfo ci) {
ServerLevel level = ServerLevel.class.cast(this);
if (level.dimension() == Level.END) {
TerrainGenerator.initNoise(seed, chunkGenerator.getBiomeSource(), chunkGenerator.climateSampler());

View file

@ -81,7 +81,7 @@ public class EndTags {
TagAPI.addBlockTag(NamedBlockTags.CLIMBABLE, block);
}
else if (block instanceof PedestalBlock) {
TagAPI.addBlockTag(PEDESTALS.getName(), block);
TagAPI.addBlockTag(PEDESTALS, block);
}
Material mat = block.defaultBlockState().getMaterial();