mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 11:53:29 +01:00
update to 1.18.2 yooo
This commit is contained in:
parent
f6496454be
commit
73b4d285f1
19 changed files with 75 additions and 68 deletions
16
build.gradle
16
build.gradle
|
@ -24,7 +24,7 @@ if (System.getenv('BUILD_NUMBER') != null) {
|
||||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
mappings channel: 'official', version: '1.18.1'
|
mappings channel: 'official', version: '1.18.2'
|
||||||
|
|
||||||
runs {
|
runs {
|
||||||
client {
|
client {
|
||||||
|
@ -102,16 +102,16 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft 'net.minecraftforge:forge:1.18.1-39.0.5'
|
minecraft 'net.minecraftforge:forge:1.18.2-40.0.3'
|
||||||
|
|
||||||
compileOnly fg.deobf("mezz.jei:jei-1.18.1:9.1.0.47:api")
|
compileOnly fg.deobf("mezz.jei:jei-1.18.2:9.4.1.117:api")
|
||||||
runtimeOnly fg.deobf("mezz.jei:jei-1.18.1:9.1.0.47")
|
runtimeOnly fg.deobf("mezz.jei:jei-1.18.2:9.4.1.117")
|
||||||
|
|
||||||
compileOnly fg.deobf("vazkii.patchouli:Patchouli:1.18.1-63:api")
|
compileOnly fg.deobf("vazkii.patchouli:Patchouli:1.18.2-66-SNAPSHOT:api")
|
||||||
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:1.18.1-63")
|
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:1.18.2-66-SNAPSHOT")
|
||||||
|
|
||||||
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.18.1-5.0.3.0")
|
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.18.2-5.0.6.3")
|
||||||
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.18.1-5.0.3.0:api")
|
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.18.2-5.0.6.3:api")
|
||||||
|
|
||||||
// TODO Enchantability
|
// TODO Enchantability
|
||||||
/* compile fg.deobf("quarris.enchantability:Enchantability:11.0.48")*/
|
/* compile fg.deobf("quarris.enchantability:Enchantability:11.0.48")*/
|
||||||
|
|
|
@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.api.multiblock;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.tags.Tag;
|
import net.minecraft.tags.Tag;
|
||||||
|
import net.minecraft.tags.TagKey;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
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;
|
||||||
|
@ -13,8 +14,8 @@ public record Matcher(BlockState defaultState, ICheck check) {
|
||||||
return new Matcher(Blocks.AIR.defaultBlockState(), null);
|
return new Matcher(Blocks.AIR.defaultBlockState(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Matcher tag(Block defaultBlock, Tag.Named<?> tag) {
|
public static Matcher tag(Block defaultBlock, TagKey<Block> tag) {
|
||||||
return new Matcher(defaultBlock.defaultBlockState(), (level, start, offset, pos, state, c) -> state.getBlock().getTags().contains(tag.getName()));
|
return new Matcher(defaultBlock.defaultBlockState(), (level, start, offset, pos, state, c) -> state.is(tag));
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ICheck {
|
public interface ICheck {
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class BlockAncientSapling extends BushBlock implements BonemealableBlock,
|
||||||
if (state.getValue(SaplingBlock.STAGE) == 0) {
|
if (state.getValue(SaplingBlock.STAGE) == 0) {
|
||||||
level.setBlock(pos, state.cycle(SaplingBlock.STAGE), 4);
|
level.setBlock(pos, state.cycle(SaplingBlock.STAGE), 4);
|
||||||
} else if (ForgeEventFactory.saplingGrowTree(level, rand, pos)) {
|
} else if (ForgeEventFactory.saplingGrowTree(level, rand, pos)) {
|
||||||
ModFeatures.Configured.ANCIENT_TREE.place(level, level.getChunkSource().getGenerator(), rand, pos);
|
ModFeatures.Configured.ANCIENT_TREE.value().place(level, level.getChunkSource().getGenerator(), rand, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ public final class Multiblocks {
|
||||||
new String[][]{
|
new String[][]{
|
||||||
{" RRRRR ", " R R ", "R RRR R", "R R R R", "R R 0 R R", "R R R R", "R RRR R", " R R ", " RRRRR "}},
|
{" RRRRR ", " R R ", "R RRR R", "R R R R", "R R 0 R R", "R R R R", "R RRR R", " R R ", " RRRRR "}},
|
||||||
'R', new Matcher(Blocks.POPPY.defaultBlockState(),
|
'R', new Matcher(Blocks.POPPY.defaultBlockState(),
|
||||||
(level, start, offset, pos, state, c) -> BlockTags.SMALL_FLOWERS.contains(state.getBlock())),
|
(level, start, offset, pos, state, c) -> state.is(BlockTags.SMALL_FLOWERS)),
|
||||||
'0', ModBlocks.OFFERING_TABLE,
|
'0', ModBlocks.OFFERING_TABLE,
|
||||||
' ', Matcher.wildcard());
|
' ', Matcher.wildcard());
|
||||||
public static final IMultiblock ANIMAL_SPAWNER = NaturesAuraAPI.instance().createMultiblock(
|
public static final IMultiblock ANIMAL_SPAWNER = NaturesAuraAPI.instance().createMultiblock(
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class BlockEntityBlastFurnaceBooster extends BlockEntityImpl implements I
|
||||||
private boolean isApplicable(List<Ingredient> ingredients) {
|
private boolean isApplicable(List<Ingredient> ingredients) {
|
||||||
for (var ing : ingredients) {
|
for (var ing : ingredients) {
|
||||||
for (var stack : ing.getItems()) {
|
for (var stack : ing.getItems()) {
|
||||||
if (stack.getItem().getTags().stream().anyMatch(t -> t.getPath().startsWith("ores/")))
|
if (stack.getTags().anyMatch(t -> t.location().getPath().startsWith("ores/")))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class BlockEntityFlowerGenerator extends BlockEntityImpl implements ITick
|
||||||
for (var z = -range; z <= range; z++) {
|
for (var z = -range; z <= range; z++) {
|
||||||
var offset = this.worldPosition.offset(x, y, z);
|
var offset = this.worldPosition.offset(x, y, z);
|
||||||
var state = this.level.getBlockState(offset);
|
var state = this.level.getBlockState(offset);
|
||||||
if (BlockTags.SMALL_FLOWERS.contains(state.getBlock()))
|
if (state.is(BlockTags.SMALL_FLOWERS))
|
||||||
possible.add(offset);
|
possible.add(offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class BlockEntityOakGenerator extends BlockEntityImpl implements ITickabl
|
||||||
if (!this.level.isClientSide)
|
if (!this.level.isClientSide)
|
||||||
while (!this.scheduledBigTrees.isEmpty()) {
|
while (!this.scheduledBigTrees.isEmpty()) {
|
||||||
var pos = this.scheduledBigTrees.remove();
|
var pos = this.scheduledBigTrees.remove();
|
||||||
if (this.level.getBlockState(pos).getBlock().getTags().contains(BlockTags.LOGS.getName())) {
|
if (this.level.getBlockState(pos).is(BlockTags.LOGS)) {
|
||||||
var toAdd = 100000;
|
var toAdd = 100000;
|
||||||
var canGen = this.canGenerateRightNow(toAdd);
|
var canGen = this.canGenerateRightNow(toAdd);
|
||||||
if (canGen)
|
if (canGen)
|
||||||
|
|
|
@ -133,7 +133,7 @@ public class BlockEntityWoodStand extends BlockEntityImpl implements ITickableBl
|
||||||
for (var z = -1; z <= 1; z++) {
|
for (var z = -1; z <= 1; z++) {
|
||||||
var offset = pos.offset(x, y, z);
|
var offset = pos.offset(x, y, z);
|
||||||
var state = level.getBlockState(offset);
|
var state = level.getBlockState(offset);
|
||||||
if (state.getBlock().getTags().contains(BlockTags.LOGS.getName()) || includeLeaves && state.getBlock() instanceof LeavesBlock) {
|
if (state.is(BlockTags.LOGS) || includeLeaves && state.getBlock() instanceof LeavesBlock) {
|
||||||
if (drop) {
|
if (drop) {
|
||||||
level.destroyBlock(offset, true);
|
level.destroyBlock(offset, true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -154,7 +154,7 @@ public class BlockEntityWoodStand extends BlockEntityImpl implements ITickableBl
|
||||||
}
|
}
|
||||||
for (var i = 0; i < 2; i++) {
|
for (var i = 0; i < 2; i++) {
|
||||||
var state = this.level.getBlockState(this.ritualPos.above(i));
|
var state = this.level.getBlockState(this.ritualPos.above(i));
|
||||||
if (!(state.getBlock().getTags().contains(BlockTags.LOGS.getName())))
|
if (!(state.is(BlockTags.LOGS)))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.timer < this.recipe.time / 2) {
|
if (this.timer < this.recipe.time / 2) {
|
||||||
|
|
|
@ -80,8 +80,7 @@ public class NetherGrassEffect implements IDrainSpotEffect {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var state = level.getBlockState(goalPos);
|
var state = level.getBlockState(goalPos);
|
||||||
var block = state.getBlock();
|
if (state.is(Tags.Blocks.NETHERRACK)) {
|
||||||
if (Tags.Blocks.NETHERRACK.contains(block)) {
|
|
||||||
level.setBlockAndUpdate(goalPos, ModBlocks.NETHER_GRASS.defaultBlockState());
|
level.setBlockAndUpdate(goalPos, ModBlocks.NETHER_GRASS.defaultBlockState());
|
||||||
|
|
||||||
var closestSpot = IAuraChunk.getHighestSpot(level, goalPos, 25, pos);
|
var closestSpot = IAuraChunk.getHighestSpot(level, goalPos, 25, pos);
|
||||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.core.Registry;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.tags.Tag;
|
import net.minecraft.tags.Tag;
|
||||||
|
import net.minecraft.tags.TagKey;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.util.Tuple;
|
import net.minecraft.util.Tuple;
|
||||||
import net.minecraft.util.random.WeightedRandom;
|
import net.minecraft.util.random.WeightedRandom;
|
||||||
|
@ -105,7 +106,7 @@ public class OreSpawnEffect implements IDrainSpotEffect {
|
||||||
var y = Mth.floor(powderPos.y + level.random.nextGaussian() * range);
|
var y = Mth.floor(powderPos.y + level.random.nextGaussian() * range);
|
||||||
var z = Mth.floor(powderPos.z + level.random.nextGaussian() * range);
|
var z = Mth.floor(powderPos.z + level.random.nextGaussian() * range);
|
||||||
var orePos = new BlockPos(x, y, z);
|
var orePos = new BlockPos(x, y, z);
|
||||||
if (orePos.distSqr(powderPos.x, powderPos.y, powderPos.z, true) <= range * range
|
if (orePos.distToCenterSqr(powderPos.x, powderPos.y, powderPos.z) <= range * range
|
||||||
&& orePos.distSqr(pos) <= this.dist * this.dist && level.isLoaded(orePos)) {
|
&& orePos.distSqr(pos) <= this.dist * this.dist && level.isLoaded(orePos)) {
|
||||||
var state = level.getBlockState(orePos);
|
var state = level.getBlockState(orePos);
|
||||||
if (state.getBlock() != requiredBlock)
|
if (state.getBlock() != requiredBlock)
|
||||||
|
@ -116,10 +117,11 @@ public class OreSpawnEffect implements IDrainSpotEffect {
|
||||||
var ore = WeightedRandom.getRandomItem(level.random, ores, totalWeight).orElse(null);
|
var ore = WeightedRandom.getRandomItem(level.random, ores, totalWeight).orElse(null);
|
||||||
if (ore == null)
|
if (ore == null)
|
||||||
continue;
|
continue;
|
||||||
var tag = level.getTagManager().getOrEmpty(Registry.BLOCK_REGISTRY).getTag(ore.tag);
|
var tag = TagKey.create(Registry.BLOCK_REGISTRY, ore.tag);
|
||||||
if (tag == null)
|
if (tag == null)
|
||||||
continue;
|
continue;
|
||||||
for (var toPlace : tag.getValues()) {
|
for (var holder : Registry.BLOCK.getTagOrEmpty(tag)) {
|
||||||
|
var toPlace = holder.value();
|
||||||
if (toPlace == null || toPlace == Blocks.AIR)
|
if (toPlace == null || toPlace == Blocks.AIR)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class CuriosCompat implements ICompat {
|
||||||
@Override
|
@Override
|
||||||
public void addItemTags(ItemTagProvider provider) {
|
public void addItemTags(ItemTagProvider provider) {
|
||||||
for (var entry : TYPES.entrySet()) {
|
for (var entry : TYPES.entrySet()) {
|
||||||
var tag = ItemTags.createOptional(new ResourceLocation("curios", entry.getValue()));
|
var tag = ItemTags.create(new ResourceLocation("curios", entry.getValue()));
|
||||||
provider.tag(tag).add(entry.getKey());
|
provider.tag(tag).add(entry.getKey());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraft.data.DataGenerator;
|
||||||
import net.minecraft.data.tags.BlockTagsProvider;
|
import net.minecraft.data.tags.BlockTagsProvider;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.tags.BlockTags;
|
import net.minecraft.tags.BlockTags;
|
||||||
|
import net.minecraft.tags.TagKey;
|
||||||
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;
|
||||||
import net.minecraftforge.common.Tags;
|
import net.minecraftforge.common.Tags;
|
||||||
|
@ -14,7 +15,7 @@ import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class BlockTagProvider extends BlockTagsProvider {
|
public class BlockTagProvider extends BlockTagsProvider {
|
||||||
|
|
||||||
public static final Tags.IOptionalNamedTag<Block> NETHER_ALTAR_WOOD = BlockTags.createOptional(new ResourceLocation(NaturesAura.MOD_ID, "nether_altar_wood"));
|
public static final TagKey<Block> NETHER_ALTAR_WOOD = BlockTags.create(new ResourceLocation(NaturesAura.MOD_ID, "nether_altar_wood"));
|
||||||
|
|
||||||
public BlockTagProvider(DataGenerator gen, @Nullable ExistingFileHelper existingFileHelper) {
|
public BlockTagProvider(DataGenerator gen, @Nullable ExistingFileHelper existingFileHelper) {
|
||||||
super(gen, NaturesAura.MOD_ID, existingFileHelper);
|
super(gen, NaturesAura.MOD_ID, existingFileHelper);
|
||||||
|
@ -28,7 +29,7 @@ public class BlockTagProvider extends BlockTagsProvider {
|
||||||
this.tag(BlockTags.LEAVES).add(ModBlocks.GOLDEN_LEAVES, ModBlocks.ANCIENT_LEAVES, ModBlocks.DECAYED_LEAVES);
|
this.tag(BlockTags.LEAVES).add(ModBlocks.GOLDEN_LEAVES, ModBlocks.ANCIENT_LEAVES, ModBlocks.DECAYED_LEAVES);
|
||||||
this.tag(BlockTags.RAILS).add(ModBlocks.DIMENSION_RAIL_END, ModBlocks.DIMENSION_RAIL_NETHER, ModBlocks.DIMENSION_RAIL_OVERWORLD);
|
this.tag(BlockTags.RAILS).add(ModBlocks.DIMENSION_RAIL_END, ModBlocks.DIMENSION_RAIL_NETHER, ModBlocks.DIMENSION_RAIL_OVERWORLD);
|
||||||
this.tag(BlockTags.SLABS).add(ModBlocks.ANCIENT_SLAB, ModBlocks.INFUSED_SLAB, ModBlocks.INFUSED_BRICK_SLAB);
|
this.tag(BlockTags.SLABS).add(ModBlocks.ANCIENT_SLAB, ModBlocks.INFUSED_SLAB, ModBlocks.INFUSED_BRICK_SLAB);
|
||||||
this.tag(Tags.Blocks.DIRT).add(ModBlocks.NETHER_GRASS);
|
this.tag(BlockTags.DIRT).add(ModBlocks.NETHER_GRASS);
|
||||||
this.tag(BlockTags.SMALL_FLOWERS).add(ModBlocks.END_FLOWER, ModBlocks.AURA_BLOOM);
|
this.tag(BlockTags.SMALL_FLOWERS).add(ModBlocks.END_FLOWER, ModBlocks.AURA_BLOOM);
|
||||||
this.tag(NETHER_ALTAR_WOOD).add(Blocks.CRIMSON_PLANKS, Blocks.WARPED_PLANKS);
|
this.tag(NETHER_ALTAR_WOOD).add(Blocks.CRIMSON_PLANKS, Blocks.WARPED_PLANKS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.data.tags.ItemTagsProvider;
|
||||||
import net.minecraft.tags.BlockTags;
|
import net.minecraft.tags.BlockTags;
|
||||||
import net.minecraft.tags.ItemTags;
|
import net.minecraft.tags.ItemTags;
|
||||||
import net.minecraft.tags.Tag;
|
import net.minecraft.tags.Tag;
|
||||||
|
import net.minecraft.tags.TagKey;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraftforge.common.Tags;
|
import net.minecraftforge.common.Tags;
|
||||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||||
|
@ -37,7 +38,7 @@ public class ItemTagProvider extends ItemTagsProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TagAppender<Item> tag(Tag.Named<Item> p_126549_) {
|
public TagAppender<Item> tag(TagKey<Item> p_126549_) {
|
||||||
// super is protected, but CuriosCompat needs this
|
// super is protected, but CuriosCompat needs this
|
||||||
return super.tag(p_126549_);
|
return super.tag(p_126549_);
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ public class EntityMoverMinecart extends AbstractMinecart {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getCartItem() {
|
public ItemStack getPickResult() {
|
||||||
return new ItemStack(ModItems.MOVER_CART);
|
return new ItemStack(ModItems.MOVER_CART);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package de.ellpeck.naturesaura.gen;
|
package de.ellpeck.naturesaura.gen;
|
||||||
|
|
||||||
|
import net.minecraft.core.Holder;
|
||||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||||
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
|
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
|
||||||
|
@ -20,22 +21,23 @@ public final class ModFeatures {
|
||||||
|
|
||||||
public static final class Configured {
|
public static final class Configured {
|
||||||
|
|
||||||
public static final ConfiguredFeature<TreeConfiguration, ?> ANCIENT_TREE = ModFeatures.ANCIENT_TREE.configured(new TreeConfiguration.TreeConfigurationBuilder(null, null, null, null, null).build());
|
public static Holder<ConfiguredFeature<TreeConfiguration, ?>> ANCIENT_TREE;
|
||||||
public static final ConfiguredFeature<NoneFeatureConfiguration, ?> AURA_BLOOM = ModFeatures.AURA_BLOOM.configured(FeatureConfiguration.NONE);
|
public static Holder<ConfiguredFeature<NoneFeatureConfiguration, ?>> NETHER_WART_MUSHROOM;
|
||||||
public static final ConfiguredFeature<NoneFeatureConfiguration, ?> AURA_CACTUS = ModFeatures.AURA_CACTUS.configured(FeatureConfiguration.NONE);
|
public static Holder<ConfiguredFeature<NoneFeatureConfiguration, ?>> AURA_BLOOM;
|
||||||
public static final ConfiguredFeature<NoneFeatureConfiguration, ?> WARPED_AURA_MUSHROOM = ModFeatures.WARPED_AURA_MUSHROOM.configured(FeatureConfiguration.NONE);
|
public static Holder<ConfiguredFeature<NoneFeatureConfiguration, ?>> AURA_CACTUS;
|
||||||
public static final ConfiguredFeature<NoneFeatureConfiguration, ?> CRIMSON_AURA_MUSHROOM = ModFeatures.CRIMSON_AURA_MUSHROOM.configured(FeatureConfiguration.NONE);
|
public static Holder<ConfiguredFeature<NoneFeatureConfiguration, ?>> WARPED_AURA_MUSHROOM;
|
||||||
public static final ConfiguredFeature<NoneFeatureConfiguration, ?> AURA_MUSHROOM = ModFeatures.AURA_MUSHROOM.configured(FeatureConfiguration.NONE);
|
public static Holder<ConfiguredFeature<NoneFeatureConfiguration, ?>> CRIMSON_AURA_MUSHROOM;
|
||||||
|
public static Holder<ConfiguredFeature<NoneFeatureConfiguration, ?>> AURA_MUSHROOM;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class Placed {
|
public static final class Placed {
|
||||||
|
|
||||||
public static final PlacedFeature AURA_BLOOM = ModFeatures.Configured.AURA_BLOOM.placed();
|
public static Holder<PlacedFeature> AURA_BLOOM;
|
||||||
public static final PlacedFeature AURA_CACTUS = ModFeatures.Configured.AURA_CACTUS.placed();
|
public static Holder<PlacedFeature> AURA_CACTUS;
|
||||||
public static final PlacedFeature WARPED_AURA_MUSHROOM = ModFeatures.Configured.WARPED_AURA_MUSHROOM.placed();
|
public static Holder<PlacedFeature> WARPED_AURA_MUSHROOM;
|
||||||
public static final PlacedFeature CRIMSON_AURA_MUSHROOM = ModFeatures.Configured.CRIMSON_AURA_MUSHROOM.placed();
|
public static Holder<PlacedFeature> CRIMSON_AURA_MUSHROOM;
|
||||||
public static final PlacedFeature AURA_MUSHROOM = ModFeatures.Configured.AURA_MUSHROOM.placed();
|
public static Holder<PlacedFeature> AURA_MUSHROOM;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class ItemCrimsonMeal extends ItemImpl {
|
||||||
if (level.random.nextInt(5) == 0) {
|
if (level.random.nextInt(5) == 0) {
|
||||||
int age = state.getValue(NetherWartBlock.AGE);
|
int age = state.getValue(NetherWartBlock.AGE);
|
||||||
if (age >= 3) {
|
if (age >= 3) {
|
||||||
ModFeatures.Configured.CRIMSON_AURA_MUSHROOM.place((ServerLevel) level, ((ServerLevel) level).getChunkSource().getGenerator(), level.random, pos);
|
ModFeatures.Configured.CRIMSON_AURA_MUSHROOM.value().place((ServerLevel) level, ((ServerLevel) level).getChunkSource().getGenerator(), level.random, pos);
|
||||||
} else {
|
} else {
|
||||||
level.setBlockAndUpdate(pos, state.setValue(NetherWartBlock.AGE, age + 1));
|
level.setBlockAndUpdate(pos, state.setValue(NetherWartBlock.AGE, age + 1));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,8 @@ package de.ellpeck.naturesaura.items;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.entities.EntityStructureFinder;
|
import de.ellpeck.naturesaura.entities.EntityStructureFinder;
|
||||||
import de.ellpeck.naturesaura.entities.ModEntities;
|
import de.ellpeck.naturesaura.entities.ModEntities;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.Holder;
|
||||||
|
import net.minecraft.core.HolderSet;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
|
@ -10,15 +11,15 @@ import net.minecraft.world.InteractionResultHolder;
|
||||||
import net.minecraft.world.entity.player.Player;
|
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.levelgen.feature.StructureFeature;
|
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||||
|
|
||||||
public class ItemStructureFinder extends ItemImpl {
|
public class ItemStructureFinder extends ItemImpl {
|
||||||
|
|
||||||
private final StructureFeature<?> structureName;
|
private final Holder<ConfiguredStructureFeature<?, ?>> structureName;
|
||||||
private final int color;
|
private final int color;
|
||||||
private final int radius;
|
private final int radius;
|
||||||
|
|
||||||
public ItemStructureFinder(String baseName, StructureFeature<?> structureName, int color, int radius) {
|
public ItemStructureFinder(String baseName, Holder<ConfiguredStructureFeature<?, ?>> structureName, int color, int radius) {
|
||||||
super(baseName);
|
super(baseName);
|
||||||
this.structureName = structureName;
|
this.structureName = structureName;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
|
@ -29,13 +30,14 @@ public class ItemStructureFinder extends ItemImpl {
|
||||||
public InteractionResultHolder<ItemStack> use(Level levelIn, Player playerIn, InteractionHand handIn) {
|
public InteractionResultHolder<ItemStack> use(Level levelIn, Player playerIn, InteractionHand handIn) {
|
||||||
var stack = playerIn.getItemInHand(handIn);
|
var stack = playerIn.getItemInHand(handIn);
|
||||||
if (!levelIn.isClientSide && ((ServerLevel) levelIn).structureFeatureManager().shouldGenerateFeatures()) {
|
if (!levelIn.isClientSide && ((ServerLevel) levelIn).structureFeatureManager().shouldGenerateFeatures()) {
|
||||||
var pos = ((ServerLevel) levelIn).getChunkSource().getGenerator().findNearestMapFeature((ServerLevel) levelIn, this.structureName, playerIn.blockPosition(), this.radius, false);
|
var holderSet = HolderSet.direct(this.structureName);
|
||||||
|
var pos = ((ServerLevel) levelIn).getChunkSource().getGenerator().findNearestMapFeature((ServerLevel) levelIn, holderSet, playerIn.blockPosition(), this.radius, false);
|
||||||
if (pos != null) {
|
if (pos != null) {
|
||||||
var entity = new EntityStructureFinder(ModEntities.STRUCTURE_FINDER, levelIn);
|
var entity = new EntityStructureFinder(ModEntities.STRUCTURE_FINDER, levelIn);
|
||||||
entity.setPos(playerIn.getX(), playerIn.getY(0.5D), playerIn.getZ());
|
entity.setPos(playerIn.getX(), playerIn.getY(0.5D), playerIn.getZ());
|
||||||
entity.setItem(stack);
|
entity.setItem(stack);
|
||||||
entity.getEntityData().set(EntityStructureFinder.COLOR, this.color);
|
entity.getEntityData().set(EntityStructureFinder.COLOR, this.color);
|
||||||
entity.signalTo(pos.above(64));
|
entity.signalTo(pos.getFirst().above(64));
|
||||||
levelIn.addFreshEntity(entity);
|
levelIn.addFreshEntity(entity);
|
||||||
|
|
||||||
stack.shrink(1);
|
stack.shrink(1);
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class ItemAxe extends AxeItem implements IModItem, ICustomItemModel {
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, Player player) {
|
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, Player player) {
|
||||||
if (itemstack.getItem() == ModItems.SKY_AXE) {
|
if (itemstack.getItem() == ModItems.SKY_AXE) {
|
||||||
if (player.level.getBlockState(pos).getBlock().getTags().contains(BlockTags.LOGS.getName())) {
|
if (player.level.getBlockState(pos).is(BlockTags.LOGS)) {
|
||||||
BlockEntityWoodStand.recurseTreeDestruction(player.level, pos, pos, false, true);
|
BlockEntityWoodStand.recurseTreeDestruction(player.level, pos, pos, false, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,9 @@ import de.ellpeck.naturesaura.recipes.EnabledCondition;
|
||||||
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.data.BuiltinRegistries;
|
import net.minecraft.data.BuiltinRegistries;
|
||||||
|
import net.minecraft.data.worldgen.StructureFeatures;
|
||||||
|
import net.minecraft.data.worldgen.features.FeatureUtils;
|
||||||
|
import net.minecraft.data.worldgen.placement.PlacementUtils;
|
||||||
import net.minecraft.world.effect.MobEffect;
|
import net.minecraft.world.effect.MobEffect;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.EquipmentSlot;
|
import net.minecraft.world.entity.EquipmentSlot;
|
||||||
|
@ -42,6 +45,8 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||||
|
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
|
import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration;
|
||||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||||
|
@ -214,9 +219,9 @@ public final class ModRegistry {
|
||||||
new ItemArmor("sky_chest", ModArmorMaterial.SKY, EquipmentSlot.CHEST),
|
new ItemArmor("sky_chest", ModArmorMaterial.SKY, EquipmentSlot.CHEST),
|
||||||
new ItemArmor("sky_pants", ModArmorMaterial.SKY, EquipmentSlot.LEGS),
|
new ItemArmor("sky_pants", ModArmorMaterial.SKY, EquipmentSlot.LEGS),
|
||||||
new ItemArmor("sky_shoes", ModArmorMaterial.SKY, EquipmentSlot.FEET),
|
new ItemArmor("sky_shoes", ModArmorMaterial.SKY, EquipmentSlot.FEET),
|
||||||
new ItemStructureFinder("fortress_finder", StructureFeature.NETHER_BRIDGE, 0xba2800, 1024),
|
new ItemStructureFinder("fortress_finder", StructureFeatures.FORTRESS, 0xba2800, 1024),
|
||||||
new ItemStructureFinder("end_city_finder", StructureFeature.END_CITY, 0xca5cd6, 1024),
|
new ItemStructureFinder("end_city_finder", StructureFeatures.END_CITY, 0xca5cd6, 1024),
|
||||||
new ItemStructureFinder("outpost_finder", StructureFeature.PILLAGER_OUTPOST, 0xab9f98, 2048),
|
new ItemStructureFinder("outpost_finder", StructureFeatures.PILLAGER_OUTPOST, 0xab9f98, 2048),
|
||||||
new ItemBreakPrevention(),
|
new ItemBreakPrevention(),
|
||||||
new ItemPetReviver(),
|
new ItemPetReviver(),
|
||||||
new ItemNetheriteFinder()
|
new ItemNetheriteFinder()
|
||||||
|
@ -313,25 +318,19 @@ public final class ModRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
// register features 27 more times for some reason
|
ModFeatures.Configured.AURA_BLOOM = FeatureUtils.register(ModFeatures.AURA_BLOOM.getRegistryName().toString(), ModFeatures.AURA_BLOOM, NoneFeatureConfiguration.INSTANCE);
|
||||||
for (var entry : ModFeatures.Configured.class.getFields()) {
|
ModFeatures.Configured.AURA_CACTUS = FeatureUtils.register(ModFeatures.AURA_CACTUS.getRegistryName().toString(), ModFeatures.AURA_CACTUS, NoneFeatureConfiguration.INSTANCE);
|
||||||
try {
|
ModFeatures.Configured.WARPED_AURA_MUSHROOM = FeatureUtils.register(ModFeatures.WARPED_AURA_MUSHROOM.getRegistryName().toString(), ModFeatures.WARPED_AURA_MUSHROOM, NoneFeatureConfiguration.INSTANCE);
|
||||||
var feature = (ConfiguredFeature<?, ?>) entry.get(null);
|
ModFeatures.Configured.CRIMSON_AURA_MUSHROOM = FeatureUtils.register(ModFeatures.CRIMSON_AURA_MUSHROOM.getRegistryName().toString(), ModFeatures.CRIMSON_AURA_MUSHROOM, NoneFeatureConfiguration.INSTANCE);
|
||||||
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, feature.feature.getRegistryName(), feature);
|
ModFeatures.Configured.AURA_MUSHROOM = FeatureUtils.register(ModFeatures.AURA_MUSHROOM.getRegistryName().toString(), ModFeatures.AURA_MUSHROOM, NoneFeatureConfiguration.INSTANCE);
|
||||||
} catch (IllegalAccessException e) {
|
ModFeatures.Configured.ANCIENT_TREE = FeatureUtils.register(ModFeatures.ANCIENT_TREE.getRegistryName().toString(), ModFeatures.ANCIENT_TREE, new TreeConfiguration.TreeConfigurationBuilder(null, null, null, null, null).build());
|
||||||
NaturesAura.LOGGER.error(e);
|
ModFeatures.Configured.NETHER_WART_MUSHROOM = FeatureUtils.register(ModFeatures.NETHER_WART_MUSHROOM.getRegistryName().toString(), ModFeatures.NETHER_WART_MUSHROOM, NoneFeatureConfiguration.INSTANCE);
|
||||||
}
|
|
||||||
}
|
ModFeatures.Placed.AURA_BLOOM = PlacementUtils.register(ModFeatures.AURA_BLOOM.getRegistryName().toString(), ModFeatures.Configured.AURA_BLOOM);
|
||||||
for (var entry : ModFeatures.Placed.class.getFields()) {
|
ModFeatures.Placed.AURA_CACTUS = PlacementUtils.register(ModFeatures.AURA_CACTUS.getRegistryName().toString(), ModFeatures.Configured.AURA_CACTUS);
|
||||||
try {
|
ModFeatures.Placed.WARPED_AURA_MUSHROOM = PlacementUtils.register(ModFeatures.WARPED_AURA_MUSHROOM.getRegistryName().toString(), ModFeatures.Configured.WARPED_AURA_MUSHROOM);
|
||||||
var placed = (PlacedFeature) entry.get(null);
|
ModFeatures.Placed.CRIMSON_AURA_MUSHROOM = PlacementUtils.register(ModFeatures.CRIMSON_AURA_MUSHROOM.getRegistryName().toString(), ModFeatures.Configured.CRIMSON_AURA_MUSHROOM);
|
||||||
// why are you making this so difficult for me
|
ModFeatures.Placed.AURA_MUSHROOM = PlacementUtils.register(ModFeatures.AURA_MUSHROOM.getRegistryName().toString(), ModFeatures.Configured.AURA_MUSHROOM);
|
||||||
Supplier<ConfiguredFeature<?, ?>> feature = ObfuscationReflectionHelper.getPrivateValue(PlacedFeature.class, placed, "f_191775_");
|
|
||||||
Registry.register(BuiltinRegistries.PLACED_FEATURE, feature.get().feature.getRegistryName(), placed);
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
NaturesAura.LOGGER.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Block createFlowerPot(Block block) {
|
public static Block createFlowerPot(Block block) {
|
||||||
|
|
Loading…
Reference in a new issue