Merge branch '1.19' into breedable-moths

This commit is contained in:
Frank 2022-11-18 19:55:10 +01:00 committed by GitHub
commit ad609a21af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 622 additions and 140 deletions

View file

@ -49,7 +49,7 @@ loom {
accessWidenerPath = file("src/main/resources/betterend.accesswidener") accessWidenerPath = file("src/main/resources/betterend.accesswidener")
interfaceInjection { interfaceInjection {
// When enabled injected interfaces from dependecies will be applied. // When enabled injected interfaces from dependecies will be applied.
enableDependencyInterfaceInjection = false enableDependencyInterfaceInjection = true
} }
} }

View file

@ -0,0 +1,66 @@
package org.betterx.betterend.blocks;
import org.betterx.bclib.interfaces.tools.AddMineablePickaxe;
import org.betterx.bclib.util.BlocksHelper;
import org.betterx.betterend.blocks.basis.LitPillarBlock;
import org.betterx.betterend.registry.EndBlocks;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.level.storage.loot.LootContext;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import java.util.Collections;
import java.util.List;
public class BuddingSmaragdantCrystalBlock extends LitPillarBlock implements AddMineablePickaxe {
public BuddingSmaragdantCrystalBlock() {
super(FabricBlockSettings.of(Material.GLASS)
.luminance(15)
.hardness(1F)
.resistance(1F)
.noOcclusion()
.sound(SoundType.AMETHYST)
.randomTicks());
}
@Override
public PushReaction getPistonPushReaction(BlockState blockState) {
return PushReaction.DESTROY;
}
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
return Collections.emptyList();
}
@SuppressWarnings("deprecation")
@Override
public void randomTick(BlockState blockState, ServerLevel world, BlockPos pos, RandomSource random) {
Direction dir = BlocksHelper.randomDirection(random);
BlockPos side = pos.relative(dir);
BlockState sideState = world.getBlockState(side);
if (random.nextInt(20) == 0) {
if (canShardGrowAtState(sideState)) {
BlockState shard = EndBlocks.SMARAGDANT_CRYSTAL_SHARD.defaultBlockState()
.setValue(SmaragdantCrystalShardBlock.WATERLOGGED, sideState.getFluidState().getType() == Fluids.WATER)
.setValue(SmaragdantCrystalShardBlock.FACING, dir);
world.setBlockAndUpdate(side, shard);
}
}
}
public static boolean canShardGrowAtState(BlockState blockState) {
return blockState.isAir() || blockState.is(Blocks.WATER) && blockState.getFluidState().getAmount() == 8;
}
}

View file

@ -84,7 +84,7 @@ public class InfusionPedestal extends PedestalBlock {
BlockState blockState, BlockState blockState,
BlockEntityType<T> blockEntityType BlockEntityType<T> blockEntityType
) { ) {
return InfusionPedestalEntity::tickEnity; return InfusionPedestalEntity::tickEntity;
} }
static { static {

View file

@ -82,13 +82,13 @@ public class SilkMothHiveBlock extends BaseBlock {
if (!world.getBlockState(spawn).isAir()) { if (!world.getBlockState(spawn).isAir()) {
return; return;
} }
int count = world.getEntities(EndEntities.SILK_MOTH, new AABB(pos).inflate(16), (entity) -> { int count = world.getEntities(EndEntities.SILK_MOTH.type(), new AABB(pos).inflate(16), (entity) -> {
return true; return true;
}).size(); }).size();
if (count > 6) { if (count > 6) {
return; return;
} }
SilkMothEntity moth = new SilkMothEntity(EndEntities.SILK_MOTH, world); SilkMothEntity moth = new SilkMothEntity(EndEntities.SILK_MOTH.type(), world);
moth.moveTo(spawn.getX() + 0.5, spawn.getY() + 0.5, spawn.getZ() + 0.5, dir.toYRot(), 0); moth.moveTo(spawn.getX() + 0.5, spawn.getY() + 0.5, spawn.getZ() + 0.5, dir.toYRot(), 0);
moth.setDeltaMovement(new Vec3(dir.getStepX() * 0.4, 0, dir.getStepZ() * 0.4)); moth.setDeltaMovement(new Vec3(dir.getStepX() * 0.4, 0, dir.getStepZ() * 0.4));
moth.setHive(world, pos); moth.setHive(world, pos);

View file

@ -149,13 +149,13 @@ public class SilkMothNestBlock extends BaseBlock implements RenderLayerProvider
if (!world.getBlockState(spawn).isAir()) { if (!world.getBlockState(spawn).isAir()) {
return; return;
} }
int count = world.getEntities(EndEntities.SILK_MOTH, new AABB(pos).inflate(16), (entity) -> { int count = world.getEntities(EndEntities.SILK_MOTH.type(), new AABB(pos).inflate(16), (entity) -> {
return true; return true;
}).size(); }).size();
if (count > 6) { if (count > 6) {
return; return;
} }
SilkMothEntity moth = new SilkMothEntity(EndEntities.SILK_MOTH, world); SilkMothEntity moth = new SilkMothEntity(EndEntities.SILK_MOTH.type(), world);
moth.moveTo(spawn.getX() + 0.5, spawn.getY() + 0.5, spawn.getZ() + 0.5, dir.toYRot(), 0); moth.moveTo(spawn.getX() + 0.5, spawn.getY() + 0.5, spawn.getZ() + 0.5, dir.toYRot(), 0);
moth.setDeltaMovement(new Vec3(dir.getStepX() * 0.4, 0, dir.getStepZ() * 0.4)); moth.setDeltaMovement(new Vec3(dir.getStepX() * 0.4, 0, dir.getStepZ() * 0.4));
moth.setHive(world, pos); moth.setHive(world, pos);

View file

@ -52,13 +52,15 @@ public class InfusionPedestalEntity extends PedestalBlockEntity {
protected void fromTag(CompoundTag tag) { protected void fromTag(CompoundTag tag) {
super.fromTag(tag); super.fromTag(tag);
if (tag.contains("ritual")) { if (tag.contains("ritual")) {
if (!hasRitual()) {
linkedRitual = new InfusionRitual(this, level, worldPosition); linkedRitual = new InfusionRitual(this, level, worldPosition);
}
linkedRitual.fromTag(tag.getCompound("ritual")); linkedRitual.fromTag(tag.getCompound("ritual"));
linkedRitual.configure(); linkedRitual.configure();
} }
} }
public static <T extends BlockEntity> void tickEnity( public static <T extends BlockEntity> void tickEntity(
Level level, Level level,
BlockPos blockPos, BlockPos blockPos,
BlockState blockState, BlockState blockState,

View file

@ -209,6 +209,6 @@ public class DragonflyEntity extends DespawnableAnimal implements FlyingAnimal {
@Override @Override
public AgeableMob getBreedOffspring(ServerLevel world, AgeableMob entity) { public AgeableMob getBreedOffspring(ServerLevel world, AgeableMob entity) {
return EndEntities.DRAGONFLY.create(world); return EndEntities.DRAGONFLY.type().create(world);
} }
} }

View file

@ -162,7 +162,7 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
@Override @Override
public AgeableMob getBreedOffspring(ServerLevel world, AgeableMob entity) { public AgeableMob getBreedOffspring(ServerLevel world, AgeableMob entity) {
return SILK_MOTH.create(world); return EndEntities.SILK_MOTH.type().create(world);
} }
@Override @Override

View file

@ -489,6 +489,12 @@ public class CraftingRecipes {
.setOutputCount(4) .setOutputCount(4)
.addMaterial('#', EndBlocks.DRAGON_BONE_BLOCK) .addMaterial('#', EndBlocks.DRAGON_BONE_BLOCK)
.build(); .build();
BCLRecipeBuilder.crafting(BetterEnd.makeID("smaragdant_crystal"), EndBlocks.SMARAGDANT_CRYSTAL)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("##", "##")
.addMaterial('#', EndBlocks.SMARAGDANT_CRYSTAL_SHARD)
.build();
} }
private static void registerLantern(String name, Block lantern, Block slab) { private static void registerLantern(String name, Block lantern, Block slab) {

View file

@ -1,5 +1,6 @@
package org.betterx.betterend.registry; package org.betterx.betterend.registry;
import org.betterx.bclib.api.v3.tag.BCLBlockTags;
import org.betterx.bclib.blocks.*; import org.betterx.bclib.blocks.*;
import org.betterx.bclib.registry.BlockRegistry; import org.betterx.bclib.registry.BlockRegistry;
import org.betterx.betterend.BetterEnd; import org.betterx.betterend.BetterEnd;
@ -10,8 +11,11 @@ import org.betterx.betterend.config.Configs;
import org.betterx.betterend.item.material.EndArmorMaterial; import org.betterx.betterend.item.material.EndArmorMaterial;
import org.betterx.betterend.item.material.EndToolMaterial; import org.betterx.betterend.item.material.EndToolMaterial;
import org.betterx.betterend.tab.CreativeTabs; import org.betterx.betterend.tab.CreativeTabs;
import org.betterx.worlds.together.tag.v3.TagManager;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
@ -30,41 +34,89 @@ public class EndBlocks {
"end_mycelium", "end_mycelium",
new EndTerrainBlock(MaterialColor.COLOR_LIGHT_BLUE) new EndTerrainBlock(MaterialColor.COLOR_LIGHT_BLUE)
); );
public static final Block END_MOSS = registerBlock("end_moss", new EndTerrainBlock(MaterialColor.COLOR_CYAN)); public static final Block END_MOSS = registerBlock(
"end_moss",
new EndTerrainBlock(MaterialColor.COLOR_CYAN),
BCLBlockTags.BONEMEAL_SOURCE_END_STONE,
BlockTags.NYLIUM
);
public static final Block CHORUS_NYLIUM = registerBlock( public static final Block CHORUS_NYLIUM = registerBlock(
"chorus_nylium", "chorus_nylium",
new EndTerrainBlock(MaterialColor.COLOR_MAGENTA) new EndTerrainBlock(MaterialColor.COLOR_MAGENTA),
BCLBlockTags.BONEMEAL_SOURCE_END_STONE,
BlockTags.NYLIUM
);
public static final Block CAVE_MOSS = registerBlock(
"cave_moss",
new EndTripleTerrain(MaterialColor.COLOR_PURPLE),
BCLBlockTags.BONEMEAL_SOURCE_END_STONE,
BlockTags.NYLIUM
); );
public static final Block CAVE_MOSS = registerBlock("cave_moss", new EndTripleTerrain(MaterialColor.COLOR_PURPLE));
public static final Block CRYSTAL_MOSS = registerBlock( public static final Block CRYSTAL_MOSS = registerBlock(
"crystal_moss", "crystal_moss",
new EndTerrainBlock(MaterialColor.COLOR_PINK) new EndTerrainBlock(MaterialColor.COLOR_PINK),
BCLBlockTags.BONEMEAL_SOURCE_END_STONE,
BlockTags.NYLIUM
); );
public static final Block CRYSTAL_MOSS_COVER = registerBlock( public static final Block SHADOW_GRASS = registerBlock(
"crystal_moss_cover", "shadow_grass",
new CrystalMossCoverBlock(MaterialColor.COLOR_PINK) new ShadowGrassBlock(),
BCLBlockTags.BONEMEAL_SOURCE_END_STONE,
BlockTags.NYLIUM
);
public static final Block PINK_MOSS = registerBlock(
"pink_moss",
new EndTerrainBlock(MaterialColor.COLOR_PINK),
BCLBlockTags.BONEMEAL_SOURCE_END_STONE,
BlockTags.NYLIUM
);
public static final Block AMBER_MOSS = registerBlock(
"amber_moss",
new EndTerrainBlock(MaterialColor.COLOR_ORANGE),
BCLBlockTags.BONEMEAL_SOURCE_END_STONE,
BlockTags.NYLIUM
); );
public static final Block SHADOW_GRASS = registerBlock("shadow_grass", new ShadowGrassBlock());
public static final Block PINK_MOSS = registerBlock("pink_moss", new EndTerrainBlock(MaterialColor.COLOR_PINK));
public static final Block AMBER_MOSS = registerBlock("amber_moss", new EndTerrainBlock(MaterialColor.COLOR_ORANGE));
public static final Block JUNGLE_MOSS = registerBlock( public static final Block JUNGLE_MOSS = registerBlock(
"jungle_moss", "jungle_moss",
new EndTerrainBlock(MaterialColor.COLOR_GREEN) new EndTerrainBlock(MaterialColor.COLOR_GREEN),
BCLBlockTags.BONEMEAL_SOURCE_END_STONE,
BlockTags.NYLIUM
);
public static final Block SANGNUM = registerBlock(
"sangnum",
new EndTerrainBlock(MaterialColor.COLOR_RED),
BCLBlockTags.BONEMEAL_SOURCE_END_STONE,
BlockTags.NYLIUM
);
public static final Block RUTISCUS = registerBlock(
"rutiscus",
new EndTerrainBlock(MaterialColor.COLOR_ORANGE),
BCLBlockTags.BONEMEAL_SOURCE_END_STONE,
BlockTags.NYLIUM
);
public static final Block PALLIDIUM_FULL = registerBlock(
"pallidium_full",
new PallidiumBlock("full", null),
BCLBlockTags.BONEMEAL_SOURCE_END_STONE,
BlockTags.NYLIUM
); );
public static final Block SANGNUM = registerBlock("sangnum", new EndTerrainBlock(MaterialColor.COLOR_RED));
public static final Block RUTISCUS = registerBlock("rutiscus", new EndTerrainBlock(MaterialColor.COLOR_ORANGE));
public static final Block PALLIDIUM_FULL = registerBlock("pallidium_full", new PallidiumBlock("full", null));
public static final Block PALLIDIUM_HEAVY = registerBlock( public static final Block PALLIDIUM_HEAVY = registerBlock(
"pallidium_heavy", "pallidium_heavy",
new PallidiumBlock("heavy", PALLIDIUM_FULL) new PallidiumBlock("heavy", PALLIDIUM_FULL),
BCLBlockTags.BONEMEAL_SOURCE_END_STONE,
BlockTags.NYLIUM
); );
public static final Block PALLIDIUM_THIN = registerBlock( public static final Block PALLIDIUM_THIN = registerBlock(
"pallidium_thin", "pallidium_thin",
new PallidiumBlock("thin", PALLIDIUM_HEAVY) new PallidiumBlock("thin", PALLIDIUM_HEAVY),
BCLBlockTags.BONEMEAL_SOURCE_END_STONE,
BlockTags.NYLIUM
); );
public static final Block PALLIDIUM_TINY = registerBlock( public static final Block PALLIDIUM_TINY = registerBlock(
"pallidium_tiny", "pallidium_tiny",
new PallidiumBlock("tiny", PALLIDIUM_THIN) new PallidiumBlock("tiny", PALLIDIUM_THIN),
BCLBlockTags.BONEMEAL_SOURCE_END_STONE,
BlockTags.NYLIUM
); );
// Roads // // Roads //
@ -83,10 +135,15 @@ public class EndBlocks {
public static final Block SANGNUM_PATH = registerBlock("sangnum_path", new BasePathBlock(SANGNUM)); public static final Block SANGNUM_PATH = registerBlock("sangnum_path", new BasePathBlock(SANGNUM));
public static final Block RUTISCUS_PATH = registerBlock("rutiscus_path", new BasePathBlock(RUTISCUS)); public static final Block RUTISCUS_PATH = registerBlock("rutiscus_path", new BasePathBlock(RUTISCUS));
public static final Block MOSSY_OBSIDIAN = registerBlock("mossy_obsidian", new MossyObsidian()); public static final Block MOSSY_OBSIDIAN = registerBlock(
"mossy_obsidian",
new MossyObsidian(),
BCLBlockTags.BONEMEAL_SOURCE_OBSIDIAN
);
public static final Block DRAGON_BONE_BLOCK = registerBlock( public static final Block DRAGON_BONE_BLOCK = registerBlock(
"dragon_bone_block", "dragon_bone_block",
new BaseRotatedPillarBlock(Blocks.BONE_BLOCK) new BaseRotatedPillarBlock(Blocks.BONE_BLOCK),
EndTags.BONEMEAL_TARGET_DRAGON_BONE
); );
public static final Block DRAGON_BONE_STAIRS = registerBlock( public static final Block DRAGON_BONE_STAIRS = registerBlock(
"dragon_bone_stairs", "dragon_bone_stairs",
@ -96,7 +153,11 @@ public class EndBlocks {
"dragon_bone_slab", "dragon_bone_slab",
new BaseSlabBlock(DRAGON_BONE_BLOCK) new BaseSlabBlock(DRAGON_BONE_BLOCK)
); );
public static final Block MOSSY_DRAGON_BONE = registerBlock("mossy_dragon_bone", new MossyDragonBoneBlock()); public static final Block MOSSY_DRAGON_BONE = registerBlock(
"mossy_dragon_bone",
new MossyDragonBoneBlock(),
EndTags.BONEMEAL_SOURCE_DRAGON_BONE
);
// Rocks // // Rocks //
public static final StoneMaterial FLAVOLITE = new StoneMaterial("flavolite", MaterialColor.SAND); public static final StoneMaterial FLAVOLITE = new StoneMaterial("flavolite", MaterialColor.SAND);
@ -382,6 +443,12 @@ public class EndBlocks {
); );
public static final Block FLAMMALIX = registerBlock("flammalix", new FlammalixBlock()); public static final Block FLAMMALIX = registerBlock("flammalix", new FlammalixBlock());
public static final Block CRYSTAL_MOSS_COVER = registerBlock(
"crystal_moss_cover",
new CrystalMossCoverBlock(MaterialColor.COLOR_PINK)
);
public static final Block BLUE_VINE_SEED = registerBlock("blue_vine_seed", new BlueVineSeedBlock()); public static final Block BLUE_VINE_SEED = registerBlock("blue_vine_seed", new BlueVineSeedBlock());
public static final Block BLUE_VINE = registerEndBlockOnly("blue_vine", new BlueVineBlock()); public static final Block BLUE_VINE = registerEndBlockOnly("blue_vine", new BlueVineBlock());
public static final Block BLUE_VINE_LANTERN = registerBlock("blue_vine_lantern", new BlueVineLanternBlock()); public static final Block BLUE_VINE_LANTERN = registerBlock("blue_vine_lantern", new BlueVineLanternBlock());
@ -571,6 +638,7 @@ public class EndBlocks {
"smaragdant_crystal", "smaragdant_crystal",
SMARAGDANT_CRYSTAL SMARAGDANT_CRYSTAL
); );
public static final Block BUDDING_SMARAGDANT_CRYSTAL = registerBlock("budding_smaragdant_crystal", new BuddingSmaragdantCrystalBlock());
public static final Block RESPAWN_OBELISK = registerBlock("respawn_obelisk", new RespawnObeliskBlock()); public static final Block RESPAWN_OBELISK = registerBlock("respawn_obelisk", new RespawnObeliskBlock());
@ -635,16 +703,17 @@ public class EndBlocks {
return BlockRegistry.getModBlockItems(BetterEnd.MOD_ID); return BlockRegistry.getModBlockItems(BetterEnd.MOD_ID);
} }
public static Block registerBlock(ResourceLocation id, Block block) { public static Block registerBlock(ResourceLocation id, Block block, TagKey<Block>... tags) {
if (!Configs.BLOCK_CONFIG.getBooleanRoot(id.getPath(), true)) { if (!Configs.BLOCK_CONFIG.getBooleanRoot(id.getPath(), true)) {
return block; return block;
} }
getBlockRegistry().register(id, block); getBlockRegistry().register(id, block);
TagManager.BLOCKS.add(block, tags);
return block; return block;
} }
public static Block registerBlock(String name, Block block) { public static Block registerBlock(String name, Block block, TagKey<Block>... tags) {
return registerBlock(BetterEnd.makeID(name), block); return registerBlock(BetterEnd.makeID(name), block, tags);
} }
public static Block registerEndBlockOnly(String name, Block block) { public static Block registerEndBlockOnly(String name, Block block) {

View file

@ -1,6 +1,7 @@
package org.betterx.betterend.registry; package org.betterx.betterend.registry;
import org.betterx.bclib.api.v2.spawning.SpawnRuleBuilder; import org.betterx.bclib.api.v2.spawning.SpawnRuleBuilder;
import org.betterx.bclib.entity.BCLEntityWrapper;
import org.betterx.betterend.BetterEnd; import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.config.Configs; import org.betterx.betterend.config.Configs;
import org.betterx.betterend.entity.*; import org.betterx.betterend.entity.*;
@ -17,7 +18,7 @@ import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRe
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder; import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder;
public class EndEntities { public class EndEntities {
public static final EntityType<DragonflyEntity> DRAGONFLY = register( public static final BCLEntityWrapper<DragonflyEntity> DRAGONFLY = register(
"dragonfly", "dragonfly",
MobCategory.AMBIENT, MobCategory.AMBIENT,
0.6F, 0.6F,
@ -28,7 +29,7 @@ public class EndEntities {
ColorUtil.color(32, 42, 176), ColorUtil.color(32, 42, 176),
ColorUtil.color(115, 225, 249) ColorUtil.color(115, 225, 249)
); );
public static final EntityType<EndSlimeEntity> END_SLIME = register( public static final BCLEntityWrapper<EndSlimeEntity> END_SLIME = register(
"end_slime", "end_slime",
MobCategory.MONSTER, MobCategory.MONSTER,
2F, 2F,
@ -39,7 +40,7 @@ public class EndEntities {
ColorUtil.color(28, 28, 28), ColorUtil.color(28, 28, 28),
ColorUtil.color(99, 11, 99) ColorUtil.color(99, 11, 99)
); );
public static final EntityType<EndFishEntity> END_FISH = register( public static final BCLEntityWrapper<EndFishEntity> END_FISH = register(
"end_fish", "end_fish",
MobCategory.WATER_AMBIENT, MobCategory.WATER_AMBIENT,
0.5F, 0.5F,
@ -50,7 +51,7 @@ public class EndEntities {
ColorUtil.color(3, 50, 76), ColorUtil.color(3, 50, 76),
ColorUtil.color(120, 206, 255) ColorUtil.color(120, 206, 255)
); );
public static final EntityType<ShadowWalkerEntity> SHADOW_WALKER = register( public static final BCLEntityWrapper<ShadowWalkerEntity> SHADOW_WALKER = register(
"shadow_walker", "shadow_walker",
MobCategory.MONSTER, MobCategory.MONSTER,
0.6F, 0.6F,
@ -61,7 +62,7 @@ public class EndEntities {
ColorUtil.color(30, 30, 30), ColorUtil.color(30, 30, 30),
ColorUtil.color(5, 5, 5) ColorUtil.color(5, 5, 5)
); );
public static final EntityType<CubozoaEntity> CUBOZOA = register( public static final BCLEntityWrapper<CubozoaEntity> CUBOZOA = register(
"cubozoa", "cubozoa",
MobCategory.WATER_AMBIENT, MobCategory.WATER_AMBIENT,
0.6F, 0.6F,
@ -72,7 +73,7 @@ public class EndEntities {
ColorUtil.color(151, 77, 181), ColorUtil.color(151, 77, 181),
ColorUtil.color(93, 176, 238) ColorUtil.color(93, 176, 238)
); );
public static final EntityType<SilkMothEntity> SILK_MOTH = register( public static final BCLEntityWrapper<SilkMothEntity> SILK_MOTH = register(
"silk_moth", "silk_moth",
MobCategory.AMBIENT, MobCategory.AMBIENT,
0.6F, 0.6F,
@ -127,7 +128,7 @@ public class EndEntities {
return type; return type;
} }
private static <T extends Mob> EntityType<T> register( private static <T extends Mob> BCLEntityWrapper<T> register(
String name, String name,
MobCategory group, MobCategory group,
float width, float width,
@ -145,11 +146,10 @@ public class EndEntities {
? EntityDimensions.fixed(width, height) ? EntityDimensions.fixed(width, height)
: EntityDimensions.scalable(width, height)) : EntityDimensions.scalable(width, height))
.build(); .build();
if (Configs.ENTITY_CONFIG.getBooleanRoot(id.getPath(), true)) {
FabricDefaultAttributeRegistry.register(type, attributes); FabricDefaultAttributeRegistry.register(type, attributes);
EndItems.registerEndEgg("spawn_egg_" + name, type, eggColor, dotsColor); EndItems.registerEndEgg("spawn_egg_" + name, type, eggColor, dotsColor);
return Registry.register(Registry.ENTITY_TYPE, BetterEnd.makeID(name), type); Registry.register(Registry.ENTITY_TYPE, BetterEnd.makeID(name), type);
}
return type; return new BCLEntityWrapper<>(type, Configs.ENTITY_CONFIG.getBooleanRoot(id.getPath(), true));
} }
} }

View file

@ -32,12 +32,12 @@ public class EndEntitiesRenders {
public static final ModelLayerLocation CRYSTALITE_BOOTS = registerMain("crystalite_boots"); public static final ModelLayerLocation CRYSTALITE_BOOTS = registerMain("crystalite_boots");
public static void register() { public static void register() {
register(EndEntities.DRAGONFLY, RendererEntityDragonfly::new); register(EndEntities.DRAGONFLY.type(), RendererEntityDragonfly::new);
register(EndEntities.END_SLIME, RendererEntityEndSlime::new); register(EndEntities.END_SLIME.type(), RendererEntityEndSlime::new);
register(EndEntities.END_FISH, RendererEntityEndFish::new); register(EndEntities.END_FISH.type(), RendererEntityEndFish::new);
register(EndEntities.SHADOW_WALKER, RendererEntityShadowWalker::new); register(EndEntities.SHADOW_WALKER.type(), RendererEntityShadowWalker::new);
register(EndEntities.CUBOZOA, RendererEntityCubozoa::new); register(EndEntities.CUBOZOA.type(), RendererEntityCubozoa::new);
register(EndEntities.SILK_MOTH, SilkMothEntityRenderer::new); register(EndEntities.SILK_MOTH.type(), SilkMothEntityRenderer::new);
EntityModelLayerRegistry.registerModelLayer(DRAGONFLY_MODEL, DragonflyEntityModel::getTexturedModelData); EntityModelLayerRegistry.registerModelLayer(DRAGONFLY_MODEL, DragonflyEntityModel::getTexturedModelData);
EntityModelLayerRegistry.registerModelLayer( EntityModelLayerRegistry.registerModelLayer(

View file

@ -7,6 +7,8 @@ import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI;
import org.betterx.bclib.api.v3.levelgen.features.BCLConfigureFeature; import org.betterx.bclib.api.v3.levelgen.features.BCLConfigureFeature;
import org.betterx.bclib.api.v3.levelgen.features.BCLFeature; import org.betterx.bclib.api.v3.levelgen.features.BCLFeature;
import org.betterx.bclib.api.v3.levelgen.features.BCLFeatureBuilder; import org.betterx.bclib.api.v3.levelgen.features.BCLFeatureBuilder;
import org.betterx.bclib.api.v3.levelgen.features.config.ConditionFeatureConfig;
import org.betterx.bclib.api.v3.levelgen.features.placement.InBiome;
import org.betterx.bclib.util.JsonFactory; import org.betterx.bclib.util.JsonFactory;
import org.betterx.betterend.BetterEnd; import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.complexmaterials.StoneMaterial; import org.betterx.betterend.complexmaterials.StoneMaterial;
@ -32,11 +34,10 @@ import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.GenerationStep.Decoration; import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.OreFeature; import net.minecraft.world.level.levelgen.feature.OreFeature;
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration; import net.minecraft.world.level.levelgen.feature.RandomPatchFeature;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.*;
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration;
import net.minecraft.world.level.levelgen.feature.configurations.SimpleBlockConfiguration;
import net.minecraft.world.level.levelgen.feature.stateproviders.SimpleStateProvider; import net.minecraft.world.level.levelgen.feature.stateproviders.SimpleStateProvider;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
@ -1047,6 +1048,129 @@ public class EndFeatures {
.buildAndRegister(); .buildAndRegister();
private static final Holder<PlacedFeature> BONEMEAL_END_MOSS_NOT_GLOWING_GRASSLANDS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_end_moss_not_glowing_grasslands"))
.add(EndBlocks.CREEPING_MOSS, 10)
.add(EndBlocks.UMBRELLA_MOSS, 10)
.inlinePlace().build();
private static final Holder<PlacedFeature> BONEMEAL_END_MOSS_GLOWING_GRASSLANDS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_end_moss_glowing_grasslands"))
.add(EndBlocks.CREEPING_MOSS, 10)
.add(EndBlocks.UMBRELLA_MOSS, 10)
.add(EndBlocks.BLOOMING_COOKSONIA, 100)
.add(EndBlocks.VAIOLUSH_FERN, 100)
.add(EndBlocks.FRACTURN, 100)
.add(EndBlocks.SALTEAGO, 100)
.add(EndBlocks.TWISTED_UMBRELLA_MOSS, 10)
.inlinePlace().build();
public static final BCLConfigureFeature<Feature<ConditionFeatureConfig>, ConditionFeatureConfig> BONEMEAL_END_MOSS = BCLFeatureBuilder
.start(
BetterEnd.makeID("bonemeal_end_moss"),
BCLFeature.CONDITION
)
.configuration(new ConditionFeatureConfig(
InBiome.matchingID(EndBiomes.GLOWING_GRASSLANDS.getID()),
BONEMEAL_END_MOSS_GLOWING_GRASSLANDS,
BONEMEAL_END_MOSS_NOT_GLOWING_GRASSLANDS
))
.buildAndRegister();
private static final Holder<PlacedFeature> BONEMEAL_RUTISCUS_NOT_LANTERN_WOODS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_rutiscus_not_lantern_woods"))
.add(EndBlocks.ORANGO, 100)
.add(EndBlocks.AERIDIUM, 20)
.add(EndBlocks.LUTEBUS, 20)
.add(EndBlocks.LAMELLARIUM, 100)
.inlinePlace()
.build();
private static final Holder<PlacedFeature> BONEMEAL_RUTISCUS_LANTERN_WOODS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_rutiscus_lantern_woods"))
.add(EndBlocks.AERIDIUM, 20)
.add(EndBlocks.BOLUX_MUSHROOM, 5)
.add(EndBlocks.LAMELLARIUM, 100)
.inlinePlace()
.build();
public static final BCLConfigureFeature<Feature<ConditionFeatureConfig>, ConditionFeatureConfig> BONEMEAL_RUTISCUS = BCLFeatureBuilder
.start(
BetterEnd.makeID("bonemeal_rutiscus"),
BCLFeature.CONDITION
)
.configuration(new ConditionFeatureConfig(
InBiome.matchingID(EndBiomes.LANTERN_WOODS.getID()),
BONEMEAL_RUTISCUS_LANTERN_WOODS,
BONEMEAL_RUTISCUS_NOT_LANTERN_WOODS
))
.buildAndRegister();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_END_MYCELIUM = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_end_mycelium"))
.add(EndBlocks.CREEPING_MOSS, 100)
.add(EndBlocks.UMBRELLA_MOSS, 100)
.buildAndRegister();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_JUNGLE_MOSS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_jungle_moss"))
.add(EndBlocks.JUNGLE_GRASS, 100)
.add(EndBlocks.TWISTED_UMBRELLA_MOSS, 100)
.add(EndBlocks.SMALL_JELLYSHROOM, 10)
.buildAndRegister();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_SANGNUM = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_sangnum"))
.add(EndBlocks.CLAWFERN, 100)
.add(EndBlocks.GLOBULAGUS, 100)
.add(EndBlocks.SMALL_AMARANITA_MUSHROOM, 10)
.buildAndRegister();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_MOSSY_DRAGON_BONE = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_mossy_dragon_bone"))
.add(EndBlocks.CLAWFERN, 100)
.add(EndBlocks.GLOBULAGUS, 100)
.add(EndBlocks.SMALL_AMARANITA_MUSHROOM, 10)
.buildAndRegister();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_MOSSY_OBSIDIAN = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_mossy_obsidian"))
.add(EndBlocks.CLAWFERN, 100)
.add(EndBlocks.GLOBULAGUS, 100)
.add(EndBlocks.SMALL_AMARANITA_MUSHROOM, 10)
.buildAndRegister();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_CAVE_MOSS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_cave_moss"))
.add(EndBlocks.CAVE_GRASS, 100)
.buildAndRegister();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_CHORUS_NYLIUM = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_chorus_nylium"))
.add(EndBlocks.CHORUS_GRASS, 100)
.buildAndRegister();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_CRYSTAL_MOSS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_crystal_moss"))
.add(EndBlocks.CRYSTAL_GRASS, 100)
.buildAndRegister();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_SHADOW_GRASS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_shadow_grass"))
.add(EndBlocks.SHADOW_PLANT, 100)
.buildAndRegister();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_PINK_MOSS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_pink_moss"))
.add(EndBlocks.BUSHY_GRASS, 100)
.buildAndRegister();
public static final BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> BONEMEAL_AMBER_MOSS = BCLFeatureBuilder
.startBonemealPatch(BetterEnd.makeID("bonemeal_amber_moss"))
.add(EndBlocks.AMBER_GRASS, 100)
.buildAndRegister();
public static <F extends Feature<FC>, FC extends FeatureConfiguration> F inlineBuild(String name, F feature) { public static <F extends Feature<FC>, FC extends FeatureConfiguration> F inlineBuild(String name, F feature) {
ResourceLocation l = BetterEnd.makeID(name); ResourceLocation l = BetterEnd.makeID(name);
if (Registry.FEATURE.containsKey(l)) { if (Registry.FEATURE.containsKey(l)) {

View file

@ -277,9 +277,9 @@ public class EndItems {
public final static Item END_FISH_COOKED = registerEndFood("end_fish_cooked", Foods.COOKED_SALMON); public final static Item END_FISH_COOKED = registerEndFood("end_fish_cooked", Foods.COOKED_SALMON);
public final static Item BUCKET_END_FISH = registerEndItem( public final static Item BUCKET_END_FISH = registerEndItem(
"bucket_end_fish", "bucket_end_fish",
new EndBucketItem(EndEntities.END_FISH) new EndBucketItem(EndEntities.END_FISH.type())
); );
public final static Item BUCKET_CUBOZOA = registerEndItem("bucket_cubozoa", new EndBucketItem(EndEntities.CUBOZOA)); public final static Item BUCKET_CUBOZOA = registerEndItem("bucket_cubozoa", new EndBucketItem(EndEntities.CUBOZOA.type()));
public final static Item SWEET_BERRY_JELLY = registerEndFood("sweet_berry_jelly", 8, 0.7F); public final static Item SWEET_BERRY_JELLY = registerEndFood("sweet_berry_jelly", 8, 0.7F);
public final static Item SHADOW_BERRY_JELLY = registerEndFood( public final static Item SHADOW_BERRY_JELLY = registerEndFood(
"shadow_berry_jelly", "shadow_berry_jelly",

View file

@ -1,6 +1,5 @@
package org.betterx.betterend.registry; package org.betterx.betterend.registry;
import org.betterx.bclib.api.v2.BonemealAPI;
import org.betterx.bclib.api.v2.ComposterAPI; import org.betterx.bclib.api.v2.ComposterAPI;
import org.betterx.bclib.blocks.BaseVineBlock; import org.betterx.bclib.blocks.BaseVineBlock;
import org.betterx.bclib.blocks.SimpleLeavesBlock; import org.betterx.bclib.blocks.SimpleLeavesBlock;
@ -21,7 +20,6 @@ import net.minecraft.world.food.FoodProperties;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.LeavesBlock; import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.block.state.BlockBehaviour.Properties; import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
@ -45,6 +43,13 @@ public class EndTags {
public static final TagKey<Item> ALLOYING_GOLD = TagManager.ITEMS.makeTag(BetterEnd.MOD_ID, "alloying_gold"); public static final TagKey<Item> ALLOYING_GOLD = TagManager.ITEMS.makeTag(BetterEnd.MOD_ID, "alloying_gold");
public static final TagKey<Item> ALLOYING_COPPER = TagManager.ITEMS.makeTag(BetterEnd.MOD_ID, "alloying_copper"); public static final TagKey<Item> ALLOYING_COPPER = TagManager.ITEMS.makeTag(BetterEnd.MOD_ID, "alloying_copper");
public static final TagKey<Block> BONEMEAL_SOURCE_DRAGON_BONE = TagManager.BLOCKS.makeTogetherTag(
"bonemeal/source/dragon_bone"
);
public static final TagKey<Block> BONEMEAL_TARGET_DRAGON_BONE = TagManager.BLOCKS.makeTogetherTag(
"bonemeal/target/dragon_bone"
);
public static void register() { public static void register() {
addEndGround(EndBlocks.THALLASIUM.ore); addEndGround(EndBlocks.THALLASIUM.ore);
addEndGround(EndBlocks.ENDSTONE_DUST); addEndGround(EndBlocks.ENDSTONE_DUST);
@ -68,8 +73,6 @@ public class EndTags {
if (block instanceof EndTerrainBlock) { if (block instanceof EndTerrainBlock) {
addEndGround(block); addEndGround(block);
TagManager.BLOCKS.add(BlockTags.NYLIUM, block);
BonemealAPI.addSpreadableBlock(block, Blocks.END_STONE);
} else if (block instanceof LeavesBlock || block instanceof SimpleLeavesBlock) { } else if (block instanceof LeavesBlock || block instanceof SimpleLeavesBlock) {
TagManager.BLOCKS.add(BlockTags.LEAVES, block); TagManager.BLOCKS.add(BlockTags.LEAVES, block);
ComposterAPI.allowCompost(0.3f, item); ComposterAPI.allowCompost(0.3f, item);
@ -85,10 +88,6 @@ public class EndTags {
} }
}); });
addEndGround(EndBlocks.CAVE_MOSS); addEndGround(EndBlocks.CAVE_MOSS);
TagManager.BLOCKS.add(BlockTags.NYLIUM, EndBlocks.CAVE_MOSS);
BonemealAPI.addSpreadableBlock(EndBlocks.CAVE_MOSS, Blocks.END_STONE);
BonemealAPI.addSpreadableBlock(EndBlocks.MOSSY_OBSIDIAN, Blocks.OBSIDIAN);
BonemealAPI.addSpreadableBlock(EndBlocks.MOSSY_DRAGON_BONE, EndBlocks.DRAGON_BONE_BLOCK);
List<Item> ITEM_HAMMERS = Lists.newArrayList(); List<Item> ITEM_HAMMERS = Lists.newArrayList();
EndItems.getModItems().forEach(item -> { EndItems.getModItems().forEach(item -> {
@ -125,6 +124,8 @@ public class EndTags {
TagManager.ITEMS.add(ALLOYING_IRON, Items.IRON_ORE, Items.DEEPSLATE_IRON_ORE, Items.RAW_IRON); TagManager.ITEMS.add(ALLOYING_IRON, Items.IRON_ORE, Items.DEEPSLATE_IRON_ORE, Items.RAW_IRON);
TagManager.ITEMS.add(ALLOYING_GOLD, Items.GOLD_ORE, Items.DEEPSLATE_GOLD_ORE, Items.RAW_GOLD); TagManager.ITEMS.add(ALLOYING_GOLD, Items.GOLD_ORE, Items.DEEPSLATE_GOLD_ORE, Items.RAW_GOLD);
TagManager.ITEMS.add(ALLOYING_COPPER, Items.COPPER_ORE, Items.DEEPSLATE_COPPER_ORE, Items.RAW_COPPER); TagManager.ITEMS.add(ALLOYING_COPPER, Items.COPPER_ORE, Items.DEEPSLATE_COPPER_ORE, Items.RAW_COPPER);
TagManager.ITEMS.add(ItemTags.FISHES, EndItems.END_FISH_RAW, EndItems.END_FISH_COOKED);
} }
public static void addEndGround(Block bl) { public static void addEndGround(Block bl) {

View file

@ -16,6 +16,7 @@ import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.chunk.LevelChunk.EntityCreationType;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import java.awt.*; import java.awt.*;
@ -56,7 +57,9 @@ public class InfusionRitual implements Container {
for (int i = 0; i < catalysts.length; i++) { for (int i = 0; i < catalysts.length; i++) {
Point point = PEDESTALS_MAP[i]; Point point = PEDESTALS_MAP[i];
MutableBlockPos checkPos = worldPos.mutable().move(Direction.EAST, point.x).move(Direction.NORTH, point.y); MutableBlockPos checkPos = worldPos.mutable().move(Direction.EAST, point.x).move(Direction.NORTH, point.y);
BlockEntity catalystEntity = world.getBlockEntity(checkPos); BlockEntity catalystEntity = world.isClientSide
? world.getChunkAt(checkPos).getBlockEntity(checkPos, EntityCreationType.CHECK)
: world.getBlockEntity(checkPos);
if (catalystEntity instanceof PedestalBlockEntity) { if (catalystEntity instanceof PedestalBlockEntity) {
catalysts[i] = (PedestalBlockEntity) catalystEntity; catalysts[i] = (PedestalBlockEntity) catalystEntity;
} else { } else {

View file

@ -2,8 +2,8 @@ package org.betterx.betterend.util;
import org.betterx.bclib.api.v2.BonemealAPI; import org.betterx.bclib.api.v2.BonemealAPI;
import org.betterx.betterend.blocks.basis.EndTerrainBlock; import org.betterx.betterend.blocks.basis.EndTerrainBlock;
import org.betterx.betterend.registry.EndBiomes;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import org.betterx.betterend.registry.EndFeatures;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
@ -14,82 +14,155 @@ import java.util.List;
public class BonemealPlants { public class BonemealPlants {
public static void init() { public static void init() {
BonemealAPI.addLandGrass(EndBlocks.CREEPING_MOSS, EndBlocks.END_MOSS); org.betterx.bclib.api.v3.bonemeal.BonemealAPI.INSTANCE.addSpreadableFeatures(
BonemealAPI.addLandGrass(EndBlocks.UMBRELLA_MOSS, EndBlocks.END_MOSS);
BonemealAPI.addLandGrass(EndBlocks.CREEPING_MOSS, EndBlocks.END_MYCELIUM);
BonemealAPI.addLandGrass(EndBlocks.UMBRELLA_MOSS, EndBlocks.END_MYCELIUM);
BonemealAPI.addLandGrass(EndBlocks.CAVE_GRASS, EndBlocks.CAVE_MOSS);
BonemealAPI.addLandGrass(EndBlocks.CHORUS_GRASS, EndBlocks.CHORUS_NYLIUM);
BonemealAPI.addLandGrass(EndBlocks.CRYSTAL_GRASS, EndBlocks.CRYSTAL_MOSS);
BonemealAPI.addLandGrass(EndBlocks.SHADOW_PLANT, EndBlocks.SHADOW_GRASS);
BonemealAPI.addLandGrass(EndBlocks.BUSHY_GRASS, EndBlocks.PINK_MOSS);
BonemealAPI.addLandGrass(EndBlocks.AMBER_GRASS, EndBlocks.AMBER_MOSS);
BonemealAPI.addLandGrass(EndBlocks.JUNGLE_GRASS, EndBlocks.JUNGLE_MOSS);
BonemealAPI.addLandGrass(EndBlocks.TWISTED_UMBRELLA_MOSS, EndBlocks.JUNGLE_MOSS);
BonemealAPI.addLandGrass(EndBlocks.SMALL_JELLYSHROOM, EndBlocks.JUNGLE_MOSS, 0.1F);
BonemealAPI.addLandGrass(
EndBiomes.GLOWING_GRASSLANDS.getID(),
EndBlocks.BLOOMING_COOKSONIA,
EndBlocks.END_MOSS
);
BonemealAPI.addLandGrass(EndBiomes.GLOWING_GRASSLANDS.getID(), EndBlocks.VAIOLUSH_FERN, EndBlocks.END_MOSS);
BonemealAPI.addLandGrass(EndBiomes.GLOWING_GRASSLANDS.getID(), EndBlocks.FRACTURN, EndBlocks.END_MOSS);
BonemealAPI.addLandGrass(EndBiomes.GLOWING_GRASSLANDS.getID(), EndBlocks.SALTEAGO, EndBlocks.END_MOSS);
BonemealAPI.addLandGrass(
EndBiomes.GLOWING_GRASSLANDS.getID(),
EndBlocks.CREEPING_MOSS,
EndBlocks.END_MOSS, EndBlocks.END_MOSS,
0.1F EndFeatures.BONEMEAL_END_MOSS
);
BonemealAPI.addLandGrass(
EndBiomes.GLOWING_GRASSLANDS.getID(),
EndBlocks.UMBRELLA_MOSS,
EndBlocks.END_MOSS,
0.1F
);
BonemealAPI.addLandGrass(
EndBiomes.GLOWING_GRASSLANDS.getID(),
EndBlocks.TWISTED_UMBRELLA_MOSS,
EndBlocks.END_MOSS,
0.1F
); );
BonemealAPI.addLandGrass(EndBlocks.ORANGO, EndBlocks.RUTISCUS); org.betterx.bclib.api.v3.bonemeal.BonemealAPI.INSTANCE.addSpreadableFeatures(
BonemealAPI.addLandGrass(EndBlocks.AERIDIUM, EndBlocks.RUTISCUS, 0.2F); EndBlocks.RUTISCUS,
BonemealAPI.addLandGrass(EndBlocks.LUTEBUS, EndBlocks.RUTISCUS, 0.2F); EndFeatures.BONEMEAL_RUTISCUS
BonemealAPI.addLandGrass(EndBlocks.LAMELLARIUM, EndBlocks.RUTISCUS); );
BonemealAPI.addLandGrass(EndBiomes.LANTERN_WOODS.getID(), EndBlocks.AERIDIUM, EndBlocks.RUTISCUS, 0.2F); org.betterx.bclib.api.v3.bonemeal.BonemealAPI.INSTANCE.addSpreadableFeatures(
BonemealAPI.addLandGrass(EndBiomes.LANTERN_WOODS.getID(), EndBlocks.LAMELLARIUM, EndBlocks.RUTISCUS); EndBlocks.END_MYCELIUM,
BonemealAPI.addLandGrass(EndBiomes.LANTERN_WOODS.getID(), EndBlocks.BOLUX_MUSHROOM, EndBlocks.RUTISCUS, 0.05F); EndFeatures.BONEMEAL_END_MYCELIUM
);
BonemealAPI.addLandGrass( org.betterx.bclib.api.v3.bonemeal.BonemealAPI.INSTANCE.addSpreadableFeatures(
EndBlocks.GLOBULAGUS, EndBlocks.JUNGLE_MOSS,
EndFeatures.BONEMEAL_JUNGLE_MOSS
);
org.betterx.bclib.api.v3.bonemeal.BonemealAPI.INSTANCE.addSpreadableFeatures(
EndBlocks.SANGNUM, EndBlocks.SANGNUM,
EndBlocks.MOSSY_OBSIDIAN, EndFeatures.BONEMEAL_SANGNUM
EndBlocks.MOSSY_DRAGON_BONE
); );
BonemealAPI.addLandGrass(
EndBlocks.CLAWFERN, org.betterx.bclib.api.v3.bonemeal.BonemealAPI.INSTANCE.addSpreadableFeatures(
EndBlocks.SANGNUM,
EndBlocks.MOSSY_OBSIDIAN, EndBlocks.MOSSY_OBSIDIAN,
EndBlocks.MOSSY_DRAGON_BONE EndFeatures.BONEMEAL_MOSSY_OBSIDIAN
); );
BonemealAPI.addLandGrass(EndBlocks.SANGNUM, EndBlocks.SMALL_AMARANITA_MUSHROOM, 0.1F);
BonemealAPI.addLandGrass(EndBlocks.SMALL_AMARANITA_MUSHROOM, EndBlocks.MOSSY_OBSIDIAN, 0.1F);
BonemealAPI.addLandGrass(EndBlocks.SMALL_AMARANITA_MUSHROOM, EndBlocks.MOSSY_DRAGON_BONE, 0.1F);
BonemealAPI.addLandGrass(EndBlocks.GLOBULAGUS, EndBlocks.MOSSY_DRAGON_BONE); org.betterx.bclib.api.v3.bonemeal.BonemealAPI.INSTANCE.addSpreadableFeatures(
BonemealAPI.addLandGrass(EndBlocks.CLAWFERN, EndBlocks.MOSSY_DRAGON_BONE); EndBlocks.MOSSY_DRAGON_BONE,
BonemealAPI.addLandGrass(EndBlocks.SMALL_AMARANITA_MUSHROOM, EndBlocks.MOSSY_DRAGON_BONE, 0.1F); EndFeatures.BONEMEAL_MOSSY_DRAGON_BONE
);
BonemealAPI.addLandGrass(EndBlocks.GLOBULAGUS, EndBlocks.MOSSY_OBSIDIAN); org.betterx.bclib.api.v3.bonemeal.BonemealAPI.INSTANCE.addSpreadableFeatures(
BonemealAPI.addLandGrass(EndBlocks.CLAWFERN, EndBlocks.MOSSY_OBSIDIAN); EndBlocks.CAVE_MOSS,
BonemealAPI.addLandGrass(EndBlocks.SMALL_AMARANITA_MUSHROOM, EndBlocks.MOSSY_OBSIDIAN, 0.1F); EndFeatures.BONEMEAL_CAVE_MOSS
);
org.betterx.bclib.api.v3.bonemeal.BonemealAPI.INSTANCE.addSpreadableFeatures(
EndBlocks.CHORUS_NYLIUM,
EndFeatures.BONEMEAL_CHORUS_NYLIUM
);
org.betterx.bclib.api.v3.bonemeal.BonemealAPI.INSTANCE.addSpreadableFeatures(
EndBlocks.CRYSTAL_MOSS,
EndFeatures.BONEMEAL_CRYSTAL_MOSS
);
org.betterx.bclib.api.v3.bonemeal.BonemealAPI.INSTANCE.addSpreadableFeatures(
EndBlocks.SHADOW_GRASS,
EndFeatures.BONEMEAL_SHADOW_GRASS
);
org.betterx.bclib.api.v3.bonemeal.BonemealAPI.INSTANCE.addSpreadableFeatures(
EndBlocks.PINK_MOSS,
EndFeatures.BONEMEAL_PINK_MOSS
);
org.betterx.bclib.api.v3.bonemeal.BonemealAPI.INSTANCE.addSpreadableFeatures(
EndBlocks.AMBER_MOSS,
EndFeatures.BONEMEAL_AMBER_MOSS
);
// BonemealAPI.addLandGrass(EndBlocks.CAVE_GRASS, EndBlocks.CAVE_MOSS);
//
// BonemealAPI.addLandGrass(EndBlocks.CHORUS_GRASS, EndBlocks.CHORUS_NYLIUM);
//
// BonemealAPI.addLandGrass(EndBlocks.CRYSTAL_GRASS, EndBlocks.CRYSTAL_MOSS);
//
// BonemealAPI.addLandGrass(EndBlocks.SHADOW_PLANT, EndBlocks.SHADOW_GRASS);
//
// BonemealAPI.addLandGrass(EndBlocks.BUSHY_GRASS, EndBlocks.PINK_MOSS);
//
// BonemealAPI.addLandGrass(EndBlocks.AMBER_GRASS, EndBlocks.AMBER_MOSS);
// BonemealAPI.addLandGrass(EndBlocks.CREEPING_MOSS, EndBlocks.END_MOSS);
// BonemealAPI.addLandGrass(EndBlocks.UMBRELLA_MOSS, EndBlocks.END_MOSS);
//
// BonemealAPI.addLandGrass(
// EndBiomes.GLOWING_GRASSLANDS.getID(),
// EndBlocks.BLOOMING_COOKSONIA,
// EndBlocks.END_MOSS
// );
// BonemealAPI.addLandGrass(EndBiomes.GLOWING_GRASSLANDS.getID(), EndBlocks.VAIOLUSH_FERN, EndBlocks.END_MOSS);
// BonemealAPI.addLandGrass(EndBiomes.GLOWING_GRASSLANDS.getID(), EndBlocks.FRACTURN, EndBlocks.END_MOSS);
// BonemealAPI.addLandGrass(EndBiomes.GLOWING_GRASSLANDS.getID(), EndBlocks.SALTEAGO, EndBlocks.END_MOSS);
// BonemealAPI.addLandGrass(
// EndBiomes.GLOWING_GRASSLANDS.getID(),
// EndBlocks.CREEPING_MOSS,
// EndBlocks.END_MOSS,
// 0.1F
// );
// BonemealAPI.addLandGrass(
// EndBiomes.GLOWING_GRASSLANDS.getID(),
// EndBlocks.UMBRELLA_MOSS,
// EndBlocks.END_MOSS,
// 0.1F
// );
// BonemealAPI.addLandGrass(
// EndBiomes.GLOWING_GRASSLANDS.getID(),
// EndBlocks.TWISTED_UMBRELLA_MOSS,
// EndBlocks.END_MOSS,
// 0.1F
// );
// BonemealAPI.addLandGrass(EndBlocks.CREEPING_MOSS, EndBlocks.END_MYCELIUM);
// BonemealAPI.addLandGrass(EndBlocks.UMBRELLA_MOSS, EndBlocks.END_MYCELIUM);
// BonemealAPI.addLandGrass(EndBlocks.JUNGLE_GRASS, EndBlocks.JUNGLE_MOSS);
// BonemealAPI.addLandGrass(EndBlocks.TWISTED_UMBRELLA_MOSS, EndBlocks.JUNGLE_MOSS);
// BonemealAPI.addLandGrass(EndBlocks.SMALL_JELLYSHROOM, EndBlocks.JUNGLE_MOSS, 0.1F);
// BonemealAPI.addLandGrass(EndBlocks.ORANGO, EndBlocks.RUTISCUS);
// BonemealAPI.addLandGrass(EndBlocks.AERIDIUM, EndBlocks.RUTISCUS, 0.2F);
// BonemealAPI.addLandGrass(EndBlocks.LUTEBUS, EndBlocks.RUTISCUS, 0.2F);
// BonemealAPI.addLandGrass(EndBlocks.LAMELLARIUM, EndBlocks.RUTISCUS);
//
// BonemealAPI.addLandGrass(EndBiomes.LANTERN_WOODS.getID(), EndBlocks.AERIDIUM, EndBlocks.RUTISCUS, 0.2F);
// BonemealAPI.addLandGrass(EndBiomes.LANTERN_WOODS.getID(), EndBlocks.LAMELLARIUM, EndBlocks.RUTISCUS);
// BonemealAPI.addLandGrass(EndBiomes.LANTERN_WOODS.getID(), EndBlocks.BOLUX_MUSHROOM, EndBlocks.RUTISCUS, 0.05F);
// BonemealAPI.addLandGrass(
// EndBlocks.GLOBULAGUS,
// EndBlocks.SANGNUM,
// EndBlocks.MOSSY_OBSIDIAN,
// EndBlocks.MOSSY_DRAGON_BONE
// );
// BonemealAPI.addLandGrass(
// EndBlocks.CLAWFERN,
// EndBlocks.SANGNUM,
// EndBlocks.MOSSY_OBSIDIAN,
// EndBlocks.MOSSY_DRAGON_BONE
// );
// BonemealAPI.addLandGrass(EndBlocks.SMALL_AMARANITA_MUSHROOM, EndBlocks.SANGNUM, 0.1F);
// BonemealAPI.addLandGrass(EndBlocks.SMALL_AMARANITA_MUSHROOM, EndBlocks.MOSSY_DRAGON_BONE, 0.1F);
// BonemealAPI.addLandGrass(EndBlocks.GLOBULAGUS, EndBlocks.MOSSY_DRAGON_BONE);
// BonemealAPI.addLandGrass(EndBlocks.CLAWFERN, EndBlocks.MOSSY_DRAGON_BONE);
// BonemealAPI.addLandGrass(EndBlocks.SMALL_AMARANITA_MUSHROOM, EndBlocks.MOSSY_DRAGON_BONE, 0.1F);
// BonemealAPI.addLandGrass(EndBlocks.SMALL_AMARANITA_MUSHROOM, EndBlocks.MOSSY_OBSIDIAN, 0.1F);
// BonemealAPI.addLandGrass(EndBlocks.GLOBULAGUS, EndBlocks.MOSSY_OBSIDIAN);
// BonemealAPI.addLandGrass(EndBlocks.CLAWFERN, EndBlocks.MOSSY_OBSIDIAN);
// BonemealAPI.addLandGrass(EndBlocks.SMALL_AMARANITA_MUSHROOM, EndBlocks.MOSSY_OBSIDIAN, 0.1F);
Block[] charnias = new Block[]{ Block[] charnias = new Block[]{
EndBlocks.CHARNIA_CYAN, EndBlocks.CHARNIA_CYAN,

View file

@ -8,32 +8,67 @@ import org.betterx.betterend.registry.EndBiomes;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import org.betterx.betterend.registry.EndItems; import org.betterx.betterend.registry.EndItems;
import net.minecraft.advancements.critereon.LocationPredicate;
import net.minecraft.core.Holder; import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.LootPool;
import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.entries.LootItem;
import net.minecraft.world.level.storage.loot.predicates.LootItemRandomChanceCondition; import net.minecraft.world.level.storage.loot.predicates.LootItemRandomChanceCondition;
import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; import net.minecraft.world.level.storage.loot.providers.number.ConstantValue;
import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator; import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator;
import net.minecraft.world.level.storage.loot.BuiltInLootTables;
import net.minecraft.world.level.storage.loot.entries.LootItem;
import net.minecraft.world.level.storage.loot.entries.LootTableReference;
import net.minecraft.world.level.storage.loot.functions.EnchantWithLevelsFunction;
import net.minecraft.world.level.storage.loot.functions.SetItemDamageFunction;
import net.minecraft.world.level.storage.loot.predicates.LocationCheck;
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
import net.fabricmc.fabric.api.loot.v2.LootTableEvents; import net.fabricmc.fabric.api.loot.v2.LootTableEvents;
public class LootTableUtil { public class LootTableUtil {
private static final ResourceLocation END_CITY_TREASURE_ID = new ResourceLocation("chests/end_city_treasure");
private static final ResourceLocation COMMON = BetterEnd.makeID("chests/common"); private static final ResourceLocation COMMON = BetterEnd.makeID("chests/common");
private static final ResourceLocation FOGGY_MUSHROOMLAND = BetterEnd.makeID("chests/foggy_mushroomland"); private static final ResourceLocation FOGGY_MUSHROOMLAND = BetterEnd.makeID("chests/foggy_mushroomland");
private static final ResourceLocation CHORUS_FOREST = BetterEnd.makeID("chests/chorus_forest"); private static final ResourceLocation CHORUS_FOREST = BetterEnd.makeID("chests/chorus_forest");
private static final ResourceLocation SHADOW_FOREST = BetterEnd.makeID("chests/shadow_forest"); private static final ResourceLocation SHADOW_FOREST = BetterEnd.makeID("chests/shadow_forest");
private static final ResourceLocation LANTERN_WOODS = BetterEnd.makeID("chests/lantern_woods"); private static final ResourceLocation LANTERN_WOODS = BetterEnd.makeID("chests/lantern_woods");
private static final ResourceLocation UMBRELLA_JUNGLE = BetterEnd.makeID("chests/umbrella_jungle"); private static final ResourceLocation UMBRELLA_JUNGLE = BetterEnd.makeID("chests/umbrella_jungle");
private static final ResourceLocation FISHING_FISH = BetterEnd.makeID("gameplay/fishing/fish");
private static final ResourceLocation FISHING_TREASURE = BetterEnd.makeID("gameplay/fishing/treasure");
private static final ResourceLocation FISHING_JUNK = BetterEnd.makeID("gameplay/fishing/junk");
private static final LootItemCondition.Builder IN_END
= LocationCheck.checkLocation(LocationPredicate.Builder.location().setDimension(Level.END));
private static final LootItemCondition.Builder IN_FOGGY_MUSHROOMLAND
= LocationCheck.checkLocation(LocationPredicate.Builder.location().setBiome(EndBiomes.FOGGY_MUSHROOMLAND.getBiomeKey()));
private static final LootItemCondition.Builder IN_CHORUS_FOREST
= LocationCheck.checkLocation(LocationPredicate.Builder.location().setBiome(EndBiomes.CHORUS_FOREST.getBiomeKey()));
private static final LootItemCondition.Builder IN_AMBER_LAND
= LocationCheck.checkLocation(LocationPredicate.Builder.location().setBiome(EndBiomes.AMBER_LAND.getBiomeKey()));
private static final LootItemCondition.Builder IN_GLOWING_GRASSLANDS
= LocationCheck.checkLocation(LocationPredicate.Builder.location().setBiome(EndBiomes.GLOWING_GRASSLANDS.getBiomeKey()));
private static final LootItemCondition.Builder IN_LANTERN_WOODS
= LocationCheck.checkLocation(LocationPredicate.Builder.location().setBiome(EndBiomes.LANTERN_WOODS.getBiomeKey()));
private static final LootItemCondition.Builder IN_MEGALAKE
= LocationCheck.checkLocation(LocationPredicate.Builder.location().setBiome(EndBiomes.MEGALAKE.getBiomeKey()));
private static final LootItemCondition.Builder IN_MEGALAKE_GROVE
= LocationCheck.checkLocation(LocationPredicate.Builder.location().setBiome(EndBiomes.MEGALAKE_GROVE.getBiomeKey()));
private static final LootItemCondition.Builder IN_NEON_OASIS
= LocationCheck.checkLocation(LocationPredicate.Builder.location().setBiome(EndBiomes.NEON_OASIS.getBiomeKey()));
private static final LootItemCondition.Builder IN_SHADOW_FOREST
= LocationCheck.checkLocation(LocationPredicate.Builder.location().setBiome(EndBiomes.SHADOW_FOREST.getBiomeKey()));
private static final LootItemCondition.Builder IN_SULPHUR_SPRINGS
= LocationCheck.checkLocation(LocationPredicate.Builder.location().setBiome(EndBiomes.SULPHUR_SPRINGS.getBiomeKey()));
private static final LootItemCondition.Builder IN_UMBRELLA_JUNGLE
= LocationCheck.checkLocation(LocationPredicate.Builder.location().setBiome(EndBiomes.UMBRELLA_JUNGLE.getBiomeKey()));
public static void init() { public static void init() {
LootTableEvents.MODIFY.register((resourceManager, lootManager, id, table, setter) -> { LootTableEvents.MODIFY.register((resourceManager, lootManager, id, table, setter) -> {
if (END_CITY_TREASURE_ID.equals(id)) { if (BuiltInLootTables.END_CITY_TREASURE.equals(id)) {
LootPool.Builder builder = LootPool.lootPool(); LootPool.Builder builder = LootPool.lootPool();
builder.setRolls(ConstantValue.exactly(1)); builder.setRolls(ConstantValue.exactly(1));
builder.when(LootItemRandomChanceCondition.randomChance(0.2f)); builder.when(LootItemRandomChanceCondition.randomChance(0.2f));
@ -47,7 +82,45 @@ public class LootTableUtil {
builder.add(LootItem.lootTableItem(EndItems.MUSIC_DISC_ENDSEEKER)); builder.add(LootItem.lootTableItem(EndItems.MUSIC_DISC_ENDSEEKER));
builder.add(LootItem.lootTableItem(EndItems.MUSIC_DISC_EO_DRACONA)); builder.add(LootItem.lootTableItem(EndItems.MUSIC_DISC_EO_DRACONA));
table.withPool(builder); table.withPool(builder);
} else if (BuiltInLootTables.FISHING.equals(id)) {
table.modifyPools((modifier) -> modifier.when(IN_END.invert()));
table.withPool(LootPool.lootPool().when(IN_END).setRolls(ConstantValue.exactly(1.0F))
.add(LootTableReference.lootTableReference(FISHING_FISH).setWeight(85).setQuality(-1))
.add(LootTableReference.lootTableReference(FISHING_TREASURE).setWeight(5).setQuality(2))
.add(LootTableReference.lootTableReference(FISHING_JUNK).setWeight(10).setQuality(-2)));
} else if (id.getNamespace().equals(BetterEnd.MOD_ID)) { } else if (id.getNamespace().equals(BetterEnd.MOD_ID)) {
if (FISHING_FISH.equals(id)) {
LootPool.Builder builder = LootPool.lootPool()
.add(LootItem.lootTableItem(EndItems.END_FISH_RAW));
table.withPool(builder);
return;
} else if (FISHING_JUNK.equals(id)) {
LootPool.Builder builder = LootPool.lootPool()
.add(LootItem.lootTableItem(EndItems.END_LILY_LEAF))
.add(LootItem.lootTableItem(Items.ENDER_PEARL))
.add(LootItem.lootTableItem(Items.CHORUS_FRUIT))
.add(LootItem.lootTableItem(EndItems.GELATINE))
.add(LootItem.lootTableItem(EndItems.CRYSTAL_SHARDS))
.add(LootItem.lootTableItem(EndItems.HYDRALUX_PETAL).when(IN_SULPHUR_SPRINGS));
addCharnia(builder);
table.withPool(builder);
return;
} else if (FISHING_TREASURE.equals(id)) {
LootPool.Builder builder = LootPool.lootPool()
.add(LootItem.lootTableItem(EndBlocks.TERMINITE.swordBlade))
.add(LootItem.lootTableItem(EndBlocks.TERMINITE.forgedPlate))
.add(LootItem.lootTableItem(EndBlocks.MENGER_SPONGE))
.add(LootItem.lootTableItem(Items.BOW)
.apply(SetItemDamageFunction.setDamage(UniformGenerator.between(0.0F, 0.25F)))
.apply(EnchantWithLevelsFunction.enchantWithLevels(ConstantValue.exactly(30.0F)).allowTreasure()))
.add(LootItem.lootTableItem(Items.FISHING_ROD)
.apply(SetItemDamageFunction.setDamage(UniformGenerator.between(0.0F, 0.25F)))
.apply(EnchantWithLevelsFunction.enchantWithLevels(ConstantValue.exactly(30.0F)).allowTreasure()))
.add(LootItem.lootTableItem(Items.BOOK)
.apply(EnchantWithLevelsFunction.enchantWithLevels(ConstantValue.exactly(30.0F)).allowTreasure()));
table.withPool(builder);
return;
}
addCommonItems(table); addCommonItems(table);
if (FOGGY_MUSHROOMLAND.equals(id)) { if (FOGGY_MUSHROOMLAND.equals(id)) {
LootPool.Builder builder = LootPool.lootPool(); LootPool.Builder builder = LootPool.lootPool();
@ -106,6 +179,21 @@ public class LootTableUtil {
return COMMON; return COMMON;
} }
private static void addCharnia(LootPool.Builder pool) {
pool.add(LootItem.lootTableItem(EndBlocks.CHARNIA_CYAN)
.when(IN_GLOWING_GRASSLANDS.or(IN_MEGALAKE).or(IN_MEGALAKE_GROVE).or(IN_NEON_OASIS)));
pool.add(LootItem.lootTableItem(EndBlocks.CHARNIA_LIGHT_BLUE)
.when(IN_FOGGY_MUSHROOMLAND.or(IN_GLOWING_GRASSLANDS).or(IN_MEGALAKE).or(IN_MEGALAKE_GROVE).or(IN_UMBRELLA_JUNGLE)));
pool.add(LootItem.lootTableItem(EndBlocks.CHARNIA_GREEN)
.when(IN_GLOWING_GRASSLANDS.or(IN_NEON_OASIS).or(IN_SULPHUR_SPRINGS).or(IN_UMBRELLA_JUNGLE)));
pool.add(LootItem.lootTableItem(EndBlocks.CHARNIA_RED)
.when(IN_AMBER_LAND.or(IN_LANTERN_WOODS).or(IN_NEON_OASIS)));
pool.add(LootItem.lootTableItem(EndBlocks.CHARNIA_ORANGE)
.when(IN_AMBER_LAND.or(IN_LANTERN_WOODS).or(IN_SULPHUR_SPRINGS)));
pool.add(LootItem.lootTableItem(EndBlocks.CHARNIA_PURPLE)
.when(IN_CHORUS_FOREST.or(IN_SHADOW_FOREST)));
}
private static void addCommonItems(LootTable.Builder table) { private static void addCommonItems(LootTable.Builder table) {
LootPool.Builder builder = LootPool.lootPool(); LootPool.Builder builder = LootPool.lootPool();
builder.setRolls(UniformGenerator.between(0, 2)); builder.setRolls(UniformGenerator.between(0, 2));

View file

@ -3,6 +3,8 @@ package org.betterx.betterend.world.features.terrain;
import org.betterx.bclib.api.v2.levelgen.features.features.DefaultFeature; import org.betterx.bclib.api.v2.levelgen.features.features.DefaultFeature;
import org.betterx.bclib.util.BlocksHelper; import org.betterx.bclib.util.BlocksHelper;
import org.betterx.bclib.util.MHelper; import org.betterx.bclib.util.MHelper;
import org.betterx.betterend.blocks.BuddingSmaragdantCrystalBlock;
import org.betterx.betterend.blocks.SmaragdantCrystalShardBlock;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import org.betterx.worlds.together.tag.v3.CommonBlockTags; import org.betterx.worlds.together.tag.v3.CommonBlockTags;
@ -14,6 +16,8 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.core.Direction;
import net.minecraft.world.level.material.Fluids;
public class SmaragdantCrystalFeature extends DefaultFeature { public class SmaragdantCrystalFeature extends DefaultFeature {
@Override @Override
@ -29,6 +33,7 @@ public class SmaragdantCrystalFeature extends DefaultFeature {
int count = MHelper.randRange(15, 30, random); int count = MHelper.randRange(15, 30, random);
BlockState crystal = EndBlocks.SMARAGDANT_CRYSTAL.defaultBlockState(); BlockState crystal = EndBlocks.SMARAGDANT_CRYSTAL.defaultBlockState();
BlockState shard = EndBlocks.SMARAGDANT_CRYSTAL_SHARD.defaultBlockState(); BlockState shard = EndBlocks.SMARAGDANT_CRYSTAL_SHARD.defaultBlockState();
BlockState buddingCrystal = EndBlocks.BUDDING_SMARAGDANT_CRYSTAL.defaultBlockState();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
mut.set(pos) mut.set(pos)
.move(MHelper.floor(random.nextGaussian() * 2 + 0.5), 5, MHelper.floor(random.nextGaussian() * 2 + 0.5)); .move(MHelper.floor(random.nextGaussian() * 2 + 0.5), 5, MHelper.floor(random.nextGaussian() * 2 + 0.5));
@ -42,10 +47,26 @@ public class SmaragdantCrystalFeature extends DefaultFeature {
mut.setY(mut.getY() - 1); mut.setY(mut.getY() - 1);
state = world.getBlockState(mut); state = world.getBlockState(mut);
} }
if (state.is(CommonBlockTags.GEN_END_STONES) && !world.getBlockState(mut.above()) if (state.is(CommonBlockTags.GEN_END_STONES) && world.getBlockState(mut.above()).isAir()) {
.is(crystal.getBlock())) {
for (int j = 0; j <= dist; j++) { for (int j = 0; j <= dist; j++) {
if (random.nextInt(8) == 0) {
BlocksHelper.setWithoutUpdate(world, mut, buddingCrystal);
for (Direction k : BlocksHelper.HORIZONTAL) {
BlockPos sidePos = mut.relative(k);
BlockState sideState = world.getBlockState(sidePos);
if (BuddingSmaragdantCrystalBlock.canShardGrowAtState(sideState)) {
if (random.nextBoolean()) {
BlockState attachedShard = EndBlocks.SMARAGDANT_CRYSTAL_SHARD.defaultBlockState()
.setValue(SmaragdantCrystalShardBlock.WATERLOGGED,
sideState.getFluidState().getType() == Fluids.WATER)
.setValue(SmaragdantCrystalShardBlock.FACING, k);
BlocksHelper.setWithoutUpdate(world, sidePos, attachedShard);
}
}
}
} else {
BlocksHelper.setWithoutUpdate(world, mut, crystal); BlocksHelper.setWithoutUpdate(world, mut, crystal);
}
mut.setY(mut.getY() + 1); mut.setY(mut.getY() + 1);
} }
boolean waterlogged = !world.getFluidState(mut).isEmpty(); boolean waterlogged = !world.getFluidState(mut).isEmpty();

View file

@ -670,6 +670,7 @@
"block.betterend.sandy_jadestone_tiles": "Sandy Jadestone Tiles", "block.betterend.sandy_jadestone_tiles": "Sandy Jadestone Tiles",
"block.betterend.sandy_jadestone_wall": "Sandy Jadestone Wall", "block.betterend.sandy_jadestone_wall": "Sandy Jadestone Wall",
"block.betterend.smaragdant_crystal": "Smaragdant Crystal", "block.betterend.smaragdant_crystal": "Smaragdant Crystal",
"block.betterend.budding_smaragdant_crystal": "Budding Smaragdant Crystal",
"block.betterend.smaragdant_crystal_shard": "Smaragdant Crystal Shard", "block.betterend.smaragdant_crystal_shard": "Smaragdant Crystal Shard",
"block.betterend.virid_jadestone": "Virid Jadestone", "block.betterend.virid_jadestone": "Virid Jadestone",
"block.betterend.virid_jadestone_bricks": "Virid Jadestone Bricks", "block.betterend.virid_jadestone_bricks": "Virid Jadestone Bricks",

View file

@ -0,0 +1,12 @@
{
"parent": "block/cube",
"textures": {
"down": "betterend:block/budding_smaragdant_crystal_top",
"east": "betterend:block/budding_smaragdant_crystal_side",
"north": "betterend:block/budding_smaragdant_crystal_side",
"particle": "betterend:block/budding_smaragdant_crystal_side",
"south": "betterend:block/budding_smaragdant_crystal_side",
"up": "betterend:block/budding_smaragdant_crystal_top",
"west": "betterend:block/budding_smaragdant_crystal_side"
}
}

View file

@ -0,0 +1,3 @@
{
"parent": "betterend:block/budding_smaragdant_crystal"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

View file

@ -349,6 +349,7 @@
"betterend:aeternium_ingot", "betterend:aeternium_ingot",
"betterend:sulphuric_rock_flower_pot", "betterend:sulphuric_rock_flower_pot",
"betterend:umbrella_tree_gate", "betterend:umbrella_tree_gate",
"betterend:jellyshroom_composter" "betterend:jellyshroom_composter",
"betterend:smaragdant_crystal"
] ]
} }

View file

@ -0,0 +1,4 @@
{
"type": "minecraft:fishing",
"pools": []
}

View file

@ -0,0 +1,4 @@
{
"type": "minecraft:fishing",
"pools": []
}

View file

@ -0,0 +1,4 @@
{
"type": "minecraft:fishing",
"pools": []
}