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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -27,6 +27,7 @@ import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import ru.bclib.blocks.BaseBlock; import ru.bclib.blocks.BaseBlock;
import ru.bclib.items.tool.BaseShearsItem;
import ru.bclib.util.BlocksHelper; import ru.bclib.util.BlocksHelper;
import ru.bclib.util.MHelper; import ru.bclib.util.MHelper;
import ru.betterend.entity.SilkMothEntity; 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) { public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
if (hand == InteractionHand.MAIN_HAND) { if (hand == InteractionHand.MAIN_HAND) {
ItemStack stack = player.getMainHandItem(); 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)); BlocksHelper.setWithUpdate(world, pos, state.setValue(FULLNESS, 0));
Direction dir = state.getValue(FACING); Direction dir = state.getValue(FACING);
double px = pos.getX() + dir.getStepX() + 0.5; 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.blocks.BaseBlock;
import ru.bclib.client.render.BCLRenderLayer; import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.RenderLayerProvider; import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.items.tool.BaseShearsItem;
import ru.bclib.util.BlocksHelper; import ru.bclib.util.BlocksHelper;
import ru.bclib.util.MHelper; import ru.bclib.util.MHelper;
import ru.betterend.entity.SilkMothEntity; 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) { public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
if (hand == InteractionHand.MAIN_HAND) { if (hand == InteractionHand.MAIN_HAND) {
ItemStack stack = player.getMainHandItem(); 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)); BlocksHelper.setWithUpdate(world, pos, state.setValue(FULLNESS, 0));
Direction dir = state.getValue(FACING); Direction dir = state.getValue(FACING);
double px = pos.getX() + dir.getStepX() + 0.5; 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.blocks.BaseAttachedBlock;
import ru.bclib.client.render.BCLRenderLayer; import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.RenderLayerProvider; import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.items.tool.BaseShearsItem;
import ru.bclib.util.BlocksHelper; import ru.bclib.util.BlocksHelper;
import ru.betterend.interfaces.PottablePlant; import ru.betterend.interfaces.PottablePlant;
import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndFeatures;
@ -57,7 +58,7 @@ public class SmallJellyshroomBlock extends BaseAttachedBlock implements RenderLa
@Override @Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) { public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
ItemStack tool = builder.getParameter(LootContextParams.TOOL); 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, Enchantments.SILK_TOUCH,
tool tool
) > 0) { ) > 0) {

View file

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

View file

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

View file

@ -1,6 +1,7 @@
package ru.betterend.mixin.common; package ru.betterend.mixin.common;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer; 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.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.dimension.DimensionType; 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.LevelStorageSource.LevelStorageAccess;
import net.minecraft.world.level.storage.ServerLevelData; import net.minecraft.world.level.storage.ServerLevelData;
import net.minecraft.world.level.storage.WritableLevelData; import net.minecraft.world.level.storage.WritableLevelData;
@ -36,7 +38,7 @@ import java.util.function.Supplier;
public abstract class ServerLevelMixin extends Level { public abstract class ServerLevelMixin extends Level {
//private static String be_lastWorld = null; //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); super(writableLevelData, resourceKey, dimensionType, supplier, bl, bl2, l);
} }
@ -52,7 +54,7 @@ public abstract class ServerLevelMixin extends Level {
// } // }
@Inject(method = "<init>*", at = @At("TAIL")) @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); ServerLevel level = ServerLevel.class.cast(this);
if (level.dimension() == Level.END) { if (level.dimension() == Level.END) {
TerrainGenerator.initNoise(seed, chunkGenerator.getBiomeSource(), chunkGenerator.climateSampler()); TerrainGenerator.initNoise(seed, chunkGenerator.getBiomeSource(), chunkGenerator.climateSampler());

View file

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