diff --git a/src/generated/resources/assets/sullysmod/lang/en_us.json b/src/generated/resources/assets/sullysmod/lang/en_us.json index 93aea281..bd6b919d 100644 --- a/src/generated/resources/assets/sullysmod/lang/en_us.json +++ b/src/generated/resources/assets/sullysmod/lang/en_us.json @@ -109,6 +109,8 @@ "item.sullysmod.tortoise_shell": "Tortoise Shell", "item.sullysmod.tortoise_spawn_egg": "Tortoise Spawn Egg", "item.sullysmod.venom_vial": "Vial of Jungle Venom", + "painting.sullysmod.amber.author": "Graus", + "painting.sullysmod.amber.title": "Amber", "painting.sullysmod.unnerving_night.author": "RealSpidey", "painting.sullysmod.unnerving_night.title": "Unnerving Night", "subtitles.block.flinger_totem.add_honey": "Honey applied", diff --git a/src/generated/resources/data/minecraft/tags/painting_variant/placeable.json b/src/generated/resources/data/minecraft/tags/painting_variant/placeable.json new file mode 100644 index 00000000..e26162ce --- /dev/null +++ b/src/generated/resources/data/minecraft/tags/painting_variant/placeable.json @@ -0,0 +1,6 @@ +{ + "values": [ + "sullysmod:unnerving_night", + "sullysmod:amber" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/sullysmod/loot_tables/archaeology/petrified_sapling_tree.json b/src/generated/resources/data/sullysmod/loot_tables/archaeology/petrified_sapling_tree.json new file mode 100644 index 00000000..a0512774 --- /dev/null +++ b/src/generated/resources/data/sullysmod/loot_tables/archaeology/petrified_sapling_tree.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:archaeology", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "sullysmod:amber" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "sullysmod:archaeology/petrified_sapling_tree" +} \ No newline at end of file diff --git a/src/generated/resources/data/sullysmod/worldgen/configured_feature/petrified_tree.json b/src/generated/resources/data/sullysmod/worldgen/configured_feature/petrified_tree.json index 6fc8a7f9..e85b3981 100644 --- a/src/generated/resources/data/sullysmod/worldgen/configured_feature/petrified_tree.json +++ b/src/generated/resources/data/sullysmod/worldgen/configured_feature/petrified_tree.json @@ -3,27 +3,7 @@ "config": { "decorators": [ { - "type": "minecraft:alter_ground", - "provider": { - "type": "minecraft:weighted_state_provider", - "entries": [ - { - "data": { - "Name": "minecraft:gravel" - }, - "weight": 5 - }, - { - "data": { - "Name": "minecraft:suspicious_gravel", - "Properties": { - "dusted": "0" - } - }, - "weight": 3 - } - ] - } + "type": "sullysmod:petrified_gravel_decorator" } ], "dirt_provider": { diff --git a/src/main/java/com/uraneptus/sullysmod/SullysMod.java b/src/main/java/com/uraneptus/sullysmod/SullysMod.java index fd9e766b..02081280 100644 --- a/src/main/java/com/uraneptus/sullysmod/SullysMod.java +++ b/src/main/java/com/uraneptus/sullysmod/SullysMod.java @@ -13,10 +13,7 @@ import com.uraneptus.sullysmod.core.data.server.loot.SMLootTableProvider; import com.uraneptus.sullysmod.core.data.server.modifiers.SMAdvancementModifiersProvider; import com.uraneptus.sullysmod.core.data.server.modifiers.SMLootModifierProvider; -import com.uraneptus.sullysmod.core.data.server.tags.SMBiomeTagsProvider; -import com.uraneptus.sullysmod.core.data.server.tags.SMBlockTagsProvider; -import com.uraneptus.sullysmod.core.data.server.tags.SMEntityTagsProvider; -import com.uraneptus.sullysmod.core.data.server.tags.SMItemTagsProvider; +import com.uraneptus.sullysmod.core.data.server.tags.*; import com.uraneptus.sullysmod.core.other.SMTextDefinitions; import com.uraneptus.sullysmod.core.registry.*; import net.minecraft.core.HolderLookup; @@ -63,6 +60,7 @@ public SullysMod() { SMRecipeTypes.RECIPE_TYPES.register(bus); SMRecipeSerializer.SERIALIZERS.register(bus); SMPaintingVariants.PAINTINGS.register(bus); + SMTreeDecoratorTypes.TREE_DECORATORS.register(bus); DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> SMItems::buildCreativeTabContents); @@ -113,6 +111,7 @@ public void gatherData(GatherDataEvent event) { generator.addProvider(includeServer, blockTagProvider); generator.addProvider(includeServer, new SMItemTagsProvider(packOutput, lookupProvider, blockTagProvider.contentsGetter(), fileHelper)); generator.addProvider(includeServer, new SMBiomeTagsProvider(packOutput, lookupProvider, fileHelper)); + generator.addProvider(includeServer, new SMPaintingVariantTagsProvider(packOutput, lookupProvider, fileHelper)); generator.addProvider(includeServer, new SMAdvancementModifiersProvider(packOutput, lookupProvider)); generator.addProvider(includeServer, new SMLootTableProvider(packOutput)); generator.addProvider(includeServer, new SMAdvancementProvider(packOutput, lookupProvider, fileHelper)); diff --git a/src/main/java/com/uraneptus/sullysmod/common/levelgen/PetrifiedTreeGravelDecorator.java b/src/main/java/com/uraneptus/sullysmod/common/levelgen/PetrifiedTreeGravelDecorator.java index 1895b465..7dd3b81b 100644 --- a/src/main/java/com/uraneptus/sullysmod/common/levelgen/PetrifiedTreeGravelDecorator.java +++ b/src/main/java/com/uraneptus/sullysmod/common/levelgen/PetrifiedTreeGravelDecorator.java @@ -1,6 +1,9 @@ package com.uraneptus.sullysmod.common.levelgen; import com.google.common.collect.Lists; +import com.mojang.serialization.Codec; +import com.uraneptus.sullysmod.SullysMod; +import com.uraneptus.sullysmod.core.registry.SMTreeDecoratorTypes; import net.minecraft.core.BlockPos; import net.minecraft.util.random.SimpleWeightedRandomList; import net.minecraft.world.level.block.Blocks; @@ -13,18 +16,27 @@ import net.minecraft.world.level.levelgen.feature.stateproviders.WeightedStateProvider; import net.minecraft.world.level.levelgen.feature.treedecorators.AlterGroundDecorator; import net.minecraft.world.level.levelgen.feature.treedecorators.TreeDecorator; +import net.minecraft.world.level.levelgen.feature.treedecorators.TreeDecoratorType; +import net.minecraft.world.level.levelgen.feature.treedecorators.TrunkVineDecorator; import net.minecraft.world.level.storage.loot.BuiltInLootTables; import net.minecraftforge.event.ForgeEventFactory; import java.util.List; -public class PetrifiedTreeGravelDecorator extends AlterGroundDecorator { +public class PetrifiedTreeGravelDecorator extends TreeDecorator { + public static final Codec CODEC = Codec.unit(() -> PetrifiedTreeGravelDecorator.INSTANCE); + public static final PetrifiedTreeGravelDecorator INSTANCE = new PetrifiedTreeGravelDecorator(); + public final BlockStateProvider provider; public PetrifiedTreeGravelDecorator() { - super(new WeightedStateProvider(SimpleWeightedRandomList.builder() - .add(Blocks.GRAVEL.defaultBlockState(), 5) - .add(Blocks.SUSPICIOUS_GRAVEL.defaultBlockState(), 3)) - ); + this.provider = new WeightedStateProvider(SimpleWeightedRandomList.builder() + .add(Blocks.GRAVEL.defaultBlockState(), 75) + .add(Blocks.SUSPICIOUS_GRAVEL.defaultBlockState(), 25)); + } + + @Override + protected TreeDecoratorType type() { + return SMTreeDecoratorTypes.GRAVEL_DECORATOR.get(); } @Override @@ -45,11 +57,11 @@ public void place(TreeDecorator.Context pContext) { int i = list.get(0).getY(); list.stream().filter((p_69310_) -> p_69310_.getY() == i).forEach((p_225978_) -> { this.placeCircle(pContext, p_225978_.west().north()); - this.placeCircle(pContext, p_225978_.east(2).north()); - this.placeCircle(pContext, p_225978_.west().south(2)); - this.placeCircle(pContext, p_225978_.east(2).south(2)); + this.placeCircle(pContext, p_225978_.east(1).north()); + this.placeCircle(pContext, p_225978_.west().south(1)); + this.placeCircle(pContext, p_225978_.east(1).south(1)); - for(int j = 0; j < 5; ++j) { + for(int j = 0; j < 1; ++j) { int k = pContext.random().nextInt(64); int l = k % 8; int i1 = k / 8; @@ -57,7 +69,6 @@ public void place(TreeDecorator.Context pContext) { this.placeCircle(pContext, p_225978_.offset(-3 + l, 0, -3 + i1)); } } - }); } } @@ -79,13 +90,11 @@ private void placeBlockAt(TreeDecorator.Context pContext, BlockPos pPos) { if (Feature.isGrassOrDirt(pContext.level(), blockpos)) { BlockState state = this.provider.getState(pContext.random(), pPos); pContext.level().getBlockEntity(pPos, BlockEntityType.BRUSHABLE_BLOCK).ifPresent(brushableBlockEntity -> { - brushableBlockEntity.setLootTable(BuiltInLootTables.END_CITY_TREASURE, pPos.asLong()); + brushableBlockEntity.setLootTable(SullysMod.modPrefix("archaeology/petrified_sapling_tree"), pPos.asLong()); }); pContext.setBlock(blockpos, ForgeEventFactory.alterGround(pContext.level(), pContext.random(), blockpos, state)); - break; } - if (!pContext.isAir(blockpos) && i < 0) { break; } diff --git a/src/main/java/com/uraneptus/sullysmod/core/data/server/SMRecipeProvider.java b/src/main/java/com/uraneptus/sullysmod/core/data/server/SMRecipeProvider.java index dadd5aaa..f99ad412 100644 --- a/src/main/java/com/uraneptus/sullysmod/core/data/server/SMRecipeProvider.java +++ b/src/main/java/com/uraneptus/sullysmod/core/data/server/SMRecipeProvider.java @@ -17,6 +17,7 @@ import static com.uraneptus.sullysmod.core.data.SMDatagenUtil.*; +//TODO add wood recipes @SuppressWarnings("SameParameterValue") public class SMRecipeProvider extends RecipeProvider { diff --git a/src/main/java/com/uraneptus/sullysmod/core/data/server/loot/SMArchaeologyLoot.java b/src/main/java/com/uraneptus/sullysmod/core/data/server/loot/SMArchaeologyLoot.java new file mode 100644 index 00000000..ade0b34d --- /dev/null +++ b/src/main/java/com/uraneptus/sullysmod/core/data/server/loot/SMArchaeologyLoot.java @@ -0,0 +1,22 @@ +package com.uraneptus.sullysmod.core.data.server.loot; + +import com.uraneptus.sullysmod.SullysMod; +import com.uraneptus.sullysmod.core.registry.SMBlocks; +import net.minecraft.data.loot.LootTableSubProvider; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.storage.loot.LootPool; +import net.minecraft.world.level.storage.loot.LootTable; +import net.minecraft.world.level.storage.loot.entries.LootItem; +import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; + +import java.util.function.BiConsumer; + +public class SMArchaeologyLoot implements LootTableSubProvider { + + @Override + public void generate(BiConsumer pOutput) { + //TODO wait for sully to decide on loot + pOutput.accept(SullysMod.modPrefix("archaeology/petrified_sapling_tree"), LootTable.lootTable().withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).add(LootItem.lootTableItem(SMBlocks.AMBER.get())))); + } +} diff --git a/src/main/java/com/uraneptus/sullysmod/core/data/server/loot/SMLootTableProvider.java b/src/main/java/com/uraneptus/sullysmod/core/data/server/loot/SMLootTableProvider.java index 50e2aee7..6dda6d10 100644 --- a/src/main/java/com/uraneptus/sullysmod/core/data/server/loot/SMLootTableProvider.java +++ b/src/main/java/com/uraneptus/sullysmod/core/data/server/loot/SMLootTableProvider.java @@ -12,7 +12,8 @@ public class SMLootTableProvider extends LootTableProvider { public SMLootTableProvider(PackOutput packOutput) { super(packOutput, Collections.emptySet(), List.of( new LootTableProvider.SubProviderEntry(SMBlockLoot::new, LootContextParamSets.BLOCK), - new LootTableProvider.SubProviderEntry(SMEntityLoot::new, LootContextParamSets.ENTITY) + new LootTableProvider.SubProviderEntry(SMEntityLoot::new, LootContextParamSets.ENTITY), + new LootTableProvider.SubProviderEntry(SMArchaeologyLoot::new, LootContextParamSets.ARCHAEOLOGY) )); } diff --git a/src/main/java/com/uraneptus/sullysmod/core/data/server/tags/SMPaintingVariantTagsProvider.java b/src/main/java/com/uraneptus/sullysmod/core/data/server/tags/SMPaintingVariantTagsProvider.java new file mode 100644 index 00000000..94d6bbe7 --- /dev/null +++ b/src/main/java/com/uraneptus/sullysmod/core/data/server/tags/SMPaintingVariantTagsProvider.java @@ -0,0 +1,23 @@ +package com.uraneptus.sullysmod.core.data.server.tags; + +import com.uraneptus.sullysmod.SullysMod; +import com.uraneptus.sullysmod.core.registry.SMPaintingVariants; +import net.minecraft.core.HolderLookup; +import net.minecraft.data.PackOutput; +import net.minecraft.data.tags.PaintingVariantTagsProvider; +import net.minecraft.tags.PaintingVariantTags; +import net.minecraftforge.common.data.ExistingFileHelper; +import org.jetbrains.annotations.Nullable; + +import java.util.concurrent.CompletableFuture; + +public class SMPaintingVariantTagsProvider extends PaintingVariantTagsProvider { + + public SMPaintingVariantTagsProvider(PackOutput pOutput, CompletableFuture pProvider, @Nullable ExistingFileHelper existingFileHelper) { + super(pOutput, pProvider, SullysMod.MOD_ID, existingFileHelper); + } + + protected void addTags(HolderLookup.Provider pProvider) { + SMPaintingVariants.PAINTINGS.getEntries().forEach(painting -> tag(PaintingVariantTags.PLACEABLE).add(painting.getKey())); + } +} diff --git a/src/main/java/com/uraneptus/sullysmod/core/registry/SMPaintingVariants.java b/src/main/java/com/uraneptus/sullysmod/core/registry/SMPaintingVariants.java index 08dc48ef..6bcd27dc 100644 --- a/src/main/java/com/uraneptus/sullysmod/core/registry/SMPaintingVariants.java +++ b/src/main/java/com/uraneptus/sullysmod/core/registry/SMPaintingVariants.java @@ -14,6 +14,7 @@ public class SMPaintingVariants { public static Map PAINTING_TRANSLATIONS = new HashMap<>(); public static final RegistryObject UNNERVING_NIGHT = registerPainting("unnerving_night", "RealSpidey", 16, 32); + public static final RegistryObject AMBER = registerPainting("amber", "Graus", 16, 32); public static RegistryObject registerPainting(String name, String author, int width, int height) { PAINTING_TRANSLATIONS.put(name, author); diff --git a/src/main/java/com/uraneptus/sullysmod/core/registry/SMTreeDecoratorTypes.java b/src/main/java/com/uraneptus/sullysmod/core/registry/SMTreeDecoratorTypes.java new file mode 100644 index 00000000..bace1386 --- /dev/null +++ b/src/main/java/com/uraneptus/sullysmod/core/registry/SMTreeDecoratorTypes.java @@ -0,0 +1,14 @@ +package com.uraneptus.sullysmod.core.registry; + +import com.uraneptus.sullysmod.SullysMod; +import com.uraneptus.sullysmod.common.levelgen.PetrifiedTreeGravelDecorator; +import net.minecraft.world.level.levelgen.feature.treedecorators.TreeDecoratorType; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; + +public class SMTreeDecoratorTypes { + public static final DeferredRegister> TREE_DECORATORS = DeferredRegister.create(ForgeRegistries.TREE_DECORATOR_TYPES, SullysMod.MOD_ID); + + public static final RegistryObject> GRAVEL_DECORATOR = TREE_DECORATORS.register("petrified_gravel_decorator", () -> new TreeDecoratorType<>(PetrifiedTreeGravelDecorator.CODEC)); +} diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 65fadc21..2600bcfd 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -2,5 +2,4 @@ public net.minecraft.world.level.block.ButtonBlock m_51115_()I # getPressDuratio public net.minecraft.world.damagesource.DamageSources m_269079_(Lnet/minecraft/resources/ResourceKey;)Lnet/minecraft/world/damagesource/DamageSource; # source # SOURCE FOR DAMAGESOURCE public net.minecraft.world.damagesource.DamageSources m_268998_(Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/entity/Entity;)Lnet/minecraft/world/damagesource/DamageSource; # source public net.minecraft.world.entity.projectile.AbstractArrow f_36703_ # inGround -public net.minecraft.world.entity.projectile.AbstractArrow f_36696_ # lastState -public net.minecraft.world.level.levelgen.feature.treedecorators.AlterGroundDecorator f_69303_ # provider +public net.minecraft.world.entity.projectile.AbstractArrow f_36696_ # lastState \ No newline at end of file diff --git a/src/main/resources/assets/sullysmod/textures/painting/amber.png b/src/main/resources/assets/sullysmod/textures/painting/amber.png new file mode 100644 index 00000000..8aed36ac Binary files /dev/null and b/src/main/resources/assets/sullysmod/textures/painting/amber.png differ diff --git a/src/main/resources/data/minecraft/tags/painting_variant/placeable.json b/src/main/resources/data/minecraft/tags/painting_variant/placeable.json deleted file mode 100644 index 830a9f60..00000000 --- a/src/main/resources/data/minecraft/tags/painting_variant/placeable.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "replace": false, - "values": [ - "sullysmod:unnerving_night" - ] -} \ No newline at end of file