Adopted new TagAPI

This commit is contained in:
Frank 2022-01-23 22:32:25 +01:00
parent e6ca1220a2
commit a1c87165ae
74 changed files with 300 additions and 281 deletions

View file

@ -4,8 +4,9 @@ import net.minecraft.core.MappedRegistry;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
import ru.bclib.api.TagAPI;
import ru.bclib.api.biomes.BiomeAPI;
import ru.bclib.api.tag.NamedCommonBlockTags;
import ru.bclib.api.tag.TagAPI;
import ru.bclib.integration.modmenu.ModIntegration;
import ru.bclib.world.features.BCLFeature;
@ -42,7 +43,7 @@ public class EnderscapeIntegration extends ModIntegration {
}
});
TagAPI.addTag(TagAPI.BLOCK_GEN_TERRAIN, getBlock("nebulite_ore"));
TagAPI.addTag(TagAPI.BLOCK_GEN_TERRAIN, getBlock("shadow_quartz_ore"));
TagAPI.addBlockTag(NamedCommonBlockTags.GEN_END_STONES, getBlock("nebulite_ore"));
TagAPI.addBlockTag(NamedCommonBlockTags.GEN_END_STONES, getBlock("shadow_quartz_ore"));
}
}

View file

@ -1,8 +1,8 @@
package ru.betterend.integration;
import net.minecraft.tags.Tag;
import net.minecraft.world.item.Item;
import ru.bclib.api.TagAPI;
import ru.bclib.api.tag.TagAPI;
import ru.bclib.api.tag.TagAPI.TagLocation;
import ru.bclib.integration.modmenu.ModIntegration;
import ru.betterend.registry.EndItems;
@ -13,13 +13,13 @@ public class NourishIntegration extends ModIntegration {
@Override
public void init() {
Tag.Named<Item> fats = getItemTag("fats");
Tag.Named<Item> fruit = getItemTag("fruit");
Tag.Named<Item> protein = getItemTag("protein");
Tag.Named<Item> sweets = getItemTag("sweets");
TagLocation<Item> fats = TagLocation.of(getItemTag("fats"));
TagLocation<Item> fruit = TagLocation.of(getItemTag("fruit"));
TagLocation<Item> protein = TagLocation.of(getItemTag("protein"));
TagLocation<Item> sweets = TagLocation.of(getItemTag("sweets"));
TagAPI.addTag(fats, EndItems.END_FISH_RAW, EndItems.END_FISH_COOKED);
TagAPI.addTag(
TagAPI.addItemTag(fats, EndItems.END_FISH_RAW, EndItems.END_FISH_COOKED);
TagAPI.addItemTag(
fruit,
EndItems.SHADOW_BERRY_RAW,
EndItems.SHADOW_BERRY_COOKED,
@ -32,7 +32,7 @@ public class NourishIntegration extends ModIntegration {
EndItems.CHORUS_MUSHROOM_COOKED,
EndItems.BOLUX_MUSHROOM_COOKED
);
TagAPI.addTag(
TagAPI.addItemTag(
protein,
EndItems.END_FISH_RAW,
EndItems.END_FISH_COOKED,
@ -40,7 +40,7 @@ public class NourishIntegration extends ModIntegration {
EndItems.BOLUX_MUSHROOM_COOKED,
EndItems.CAVE_PUMPKIN_PIE
);
TagAPI.addTag(
TagAPI.addItemTag(
sweets,
EndItems.SHADOW_BERRY_JELLY,
EndItems.SWEET_BERRY_JELLY,

View file

@ -12,7 +12,7 @@ public class BYGIntegration extends ModIntegration implements EndBiomeIntegratio
public void init() {
/*Block block = Integrations.BYG.getBlock("ivis_phylium");
if (block != null) {
TagAPI.addTags(block, TagAPI.BLOCK_END_GROUND, TagAPI.BLOCK_GEN_TERRAIN);
TagAPI.addTags(block, CommonBlockTags.END_STONES, CommonBlockTags.GEN_END_STONES);
}
BYGBlocks.register();
BYGFeatures.register();

View file

@ -8,7 +8,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import ru.bclib.api.TagAPI;
import ru.bclib.api.tag.CommonBlockTags;
import ru.bclib.sdf.SDF;
import ru.bclib.util.MHelper;
import ru.bclib.util.SplineHelper;
@ -24,7 +24,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
final Random random = featureConfig.random();
final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level();
if (!world.getBlockState(pos.below()).is(TagAPI.BLOCK_END_GROUND)) return false;
if (!world.getBlockState(pos.below()).is(CommonBlockTags.END_STONES)) return false;
BlockState log = Integrations.BYG.getDefaultState("ether_log");
BlockState wood = Integrations.BYG.getDefaultState("ether_wood");
@ -32,7 +32,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
return log;
};
Function<BlockState, Boolean> replace = (state) -> {
return state.is(TagAPI.BLOCK_END_GROUND) || state.getMaterial().equals(Material.PLANT) || state.getMaterial()
return state.is(CommonBlockTags.END_STONES) || state.getMaterial().equals(Material.PLANT) || state.getMaterial()
.isReplaceable();
};
@ -63,7 +63,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
}
sdf.setReplaceFunction((state) -> {
return state.is(TagAPI.BLOCK_END_GROUND) || state.getMaterial().equals(Material.PLANT) || state.getMaterial()
return state.is(CommonBlockTags.END_STONES) || state.getMaterial().equals(Material.PLANT) || state.getMaterial()
.isReplaceable();
}).addPostProcess((info) -> {
if (info.getState().equals(log) && (!info.getStateUp().equals(log) || !info.getStateDown().equals(log))) {

View file

@ -13,7 +13,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import ru.bclib.api.TagAPI;
import ru.bclib.api.tag.CommonBlockTags;
import ru.bclib.sdf.PosInfo;
import ru.bclib.sdf.SDF;
import ru.bclib.sdf.operator.SDFDisplacement;
@ -38,7 +38,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
final Random random = featureConfig.random();
final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level();
if (!world.getBlockState(pos.below()).is(TagAPI.BLOCK_END_GROUND)) return false;
if (!world.getBlockState(pos.below()).is(CommonBlockTags.END_STONES)) return false;
BlockState log = Integrations.BYG.getDefaultState("nightshade_log");
BlockState wood = Integrations.BYG.getDefaultState("nightshade_wood");
@ -49,7 +49,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
return log;
};
Function<BlockState, Boolean> replace = (state) -> {
return state.is(TagAPI.BLOCK_END_GROUND) || state.getMaterial().equals(Material.PLANT) || state.getMaterial()
return state.is(CommonBlockTags.END_STONES) || state.getMaterial().equals(Material.PLANT) || state.getMaterial()
.isReplaceable();
};
Function<PosInfo, BlockState> post = (info) -> {

View file

@ -11,7 +11,8 @@ import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.AABB;
import ru.bclib.api.TagAPI;
import ru.bclib.api.tag.CommonBlockTags;
import ru.bclib.api.tag.TagAPI;
import ru.bclib.sdf.SDF;
import ru.bclib.sdf.operator.SDFDisplacement;
import ru.bclib.sdf.operator.SDFSubtraction;
@ -39,8 +40,8 @@ public class OldBulbisTreeFeature extends DefaultFeature {
final Random random = featureConfig.random();
final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level();
if (!world.getBlockState(pos.below()).is(TagAPI.BLOCK_END_GROUND)) return false;
if (!world.getBlockState(pos.below(4)).is(TagAPI.BLOCK_GEN_TERRAIN)) return false;
if (!world.getBlockState(pos.below()).is(CommonBlockTags.END_STONES)) return false;
if (!world.getBlockState(pos.below(4)).is(CommonBlockTags.GEN_END_STONES)) return false;
BlockState stem = Integrations.BYG.getDefaultState("bulbis_stem");
BlockState wood = Integrations.BYG.getDefaultState("bulbis_wood");
@ -48,7 +49,7 @@ public class OldBulbisTreeFeature extends DefaultFeature {
BlockState glow = Integrations.BYG.getDefaultState("purple_shroomlight");
Function<BlockState, Boolean> replacement = (state) -> {
if (state.equals(stem) || state.equals(wood) || state.is(TagAPI.BLOCK_END_GROUND) || state.getMaterial()
if (state.equals(stem) || state.equals(wood) || state.is(CommonBlockTags.END_STONES) || state.getMaterial()
.equals(Material.PLANT)) {
return true;
}
@ -155,7 +156,7 @@ public class OldBulbisTreeFeature extends DefaultFeature {
SplineHelper.rotateSpline(branch, angle);
SplineHelper.scale(branch, scale);
Vector3f last = branch.get(branch.size() - 1);
if (world.getBlockState(pos.offset(last.x(), last.y(), last.z())).is(TagAPI.BLOCK_GEN_TERRAIN)) {
if (world.getBlockState(pos.offset(last.x(), last.y(), last.z())).is(CommonBlockTags.GEN_END_STONES)) {
SplineHelper.fillSpline(branch, world, wood, pos, replacement);
}
}