Compare commits

...

3 commits

Author SHA1 Message Date
Mrbysco
4cc4b40c4b Update Tiny Torch light (Engineers house is quite dark if set to 8) 2024-03-11 19:20:58 +01:00
Mrbysco
523cba5958 Add the Engineers House back 2024-03-11 19:17:59 +01:00
Mrbysco
b3bac386ad Add rotation and mirror code to FullyDirectionalBlock 2024-03-11 19:16:44 +01:00
19 changed files with 562 additions and 11 deletions

View file

@ -1,5 +1,6 @@
// 1.20.4 2024-03-05T16:59:47.0535355 Registries
// 1.20.4 2024-03-11T17:48:44.6414485 Registries
020d2b1f1c21d6c6663ef8126a52e2b9deb0e52e data/actuallyadditions/damage_type/atomicreconstructor.json
4ba41428fdcf03f52855029153722e22e8702823 data/actuallyadditions/neoforge/biome_modifier/add_black_quartz.json
3c9f4fbfed04f0e75ea7b370aa2f8acc531a63bb data/actuallyadditions/worldgen/configured_feature/ore_black_quartz.json
fce2111f746f4c6ddef5444d84a5c2b574efaaa0 data/actuallyadditions/worldgen/placed_feature/ore_black_quartz.json
7cf126882346a296f045db75facf741c77b7d3b1 data/actuallyadditions/worldgen/processor_list/engineer_house.json

View file

@ -1,4 +1,4 @@
// 1.20.4 2024-03-05T17:10:52.5254064 Loot Tables
// 1.20.4 2024-03-11T19:15:36.5038055 Loot Tables
f6655bb234dbcf1041fe8ad95c976ddddda2b02a data/actuallyadditions/loot_tables/blocks/atomic_reconstructor.json
e15c868b26b669c30365bfb93e7d9274e07df16d data/actuallyadditions/loot_tables/blocks/battery_box.json
745d64af3b0203a138f9eca7de21ed4988b35c95 data/actuallyadditions/loot_tables/blocks/bio_reactor.json
@ -120,3 +120,4 @@ d43769e7f20448bf87952664a3ddd12db0804627 data/actuallyadditions/loot_tables/bloc
58ebb57d3470800107617d0cc84250750834b675 data/actuallyadditions/loot_tables/blocks/void_crystal_cluster.json
d3498d690b7d9170fecdc2dd9825519b680cfeec data/actuallyadditions/loot_tables/blocks/wood_casing.json
e1ebdde950a7f730c423a16143ad5598e3b6e3a7 data/actuallyadditions/loot_tables/blocks/xp_solidifier.json
860b2c007cf8a1942e3f2934e1385a3a75d3a940 data/actuallyadditions/loot_tables/engineer_house.json

View file

@ -1,6 +1,7 @@
// 1.20.4 2024-03-09T22:54:38.6848812 Tags for minecraft:item mod id actuallyadditions
// 1.20.4 2024-03-11T17:20:46.9018598 Tags for minecraft:item mod id actuallyadditions
87327118c2f16da245b76de4fdcaab149456d9b8 data/actuallyadditions/tags/items/coffee_beans.json
f3ee78cd8c9563bd1828de2b4b336735f289f9f2 data/actuallyadditions/tags/items/crystals.json
441008b49b4bab00125100fc969cb6582eff7271 data/actuallyadditions/tags/items/crystal_blocks.json
7e6e49c3eb5302af147a2d6ba439e83bd4831cbc data/actuallyadditions/tags/items/drills.json
ae55da193b94fd6375c05d5aa46cafdda9d335cd data/actuallyadditions/tags/items/tiny_coals.json
31cd008db3c44a9c3f643f296e1c7688ca45e2e5 data/forge/tags/items/crops.json

View file

@ -0,0 +1,119 @@
{
"type": "minecraft:chest",
"pools": [
{
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"add": false,
"count": {
"type": "minecraft:uniform",
"max": 10.0,
"min": 3.0
},
"function": "minecraft:set_count"
}
],
"name": "actuallyadditions:wood_casing",
"weight": 60
},
{
"type": "minecraft:item",
"functions": [
{
"add": false,
"count": {
"type": "minecraft:uniform",
"max": 3.0,
"min": 1.0
},
"function": "minecraft:set_count"
}
],
"name": "actuallyadditions:iron_casing",
"weight": 40
},
{
"type": "minecraft:item",
"functions": [
{
"add": false,
"count": {
"type": "minecraft:uniform",
"max": 5.0,
"min": 1.0
},
"function": "minecraft:set_count"
}
],
"name": "actuallyadditions:black_quartz",
"weight": 20
},
{
"type": "minecraft:item",
"functions": [
{
"add": false,
"count": {
"type": "minecraft:uniform",
"max": 2.0,
"min": 1.0
},
"function": "minecraft:set_count"
}
],
"name": "actuallyadditions:bats_wing",
"weight": 5
},
{
"type": "minecraft:item",
"name": "actuallyadditions:drill_core",
"weight": 5
},
{
"type": "minecraft:tag",
"expand": true,
"functions": [
{
"add": false,
"count": {
"type": "minecraft:uniform",
"max": 3.0,
"min": 1.0
},
"function": "minecraft:set_count"
}
],
"name": "actuallyadditions:crystals",
"weight": 20
},
{
"type": "minecraft:tag",
"expand": true,
"functions": [
{
"add": false,
"count": {
"type": "minecraft:uniform",
"max": 3.0,
"min": 1.0
},
"function": "minecraft:set_count"
}
],
"name": "actuallyadditions:crystals",
"weight": 3
}
],
"rolls": {
"type": "minecraft:uniform",
"max": 7.0,
"min": 4.0
}
}
],
"random_sequence": "actuallyadditions:engineer_house"
}

View file

@ -0,0 +1,10 @@
{
"values": [
"actuallyadditions:restonia_crystal_block",
"actuallyadditions:palis_crystal_block",
"actuallyadditions:diamatine_crystal_block",
"actuallyadditions:void_crystal_block",
"actuallyadditions:emeradic_crystal_block",
"actuallyadditions:enori_crystal_block"
]
}

View file

@ -0,0 +1,249 @@
{
"processors": [
{
"processor_type": "minecraft:rule",
"rules": [
{
"input_predicate": {
"block": "actuallyadditions:lamp_white",
"predicate_type": "minecraft:random_block_match",
"probability": 0.0625
},
"location_predicate": {
"predicate_type": "minecraft:always_true"
},
"output_state": {
"Name": "actuallyadditions:lamp_orange",
"Properties": {
"lit": "true"
}
}
},
{
"input_predicate": {
"block": "actuallyadditions:lamp_white",
"predicate_type": "minecraft:random_block_match",
"probability": 0.0625
},
"location_predicate": {
"predicate_type": "minecraft:always_true"
},
"output_state": {
"Name": "actuallyadditions:lamp_magenta",
"Properties": {
"lit": "true"
}
}
},
{
"input_predicate": {
"block": "actuallyadditions:lamp_white",
"predicate_type": "minecraft:random_block_match",
"probability": 0.0625
},
"location_predicate": {
"predicate_type": "minecraft:always_true"
},
"output_state": {
"Name": "actuallyadditions:lamp_light_blue",
"Properties": {
"lit": "true"
}
}
},
{
"input_predicate": {
"block": "actuallyadditions:lamp_white",
"predicate_type": "minecraft:random_block_match",
"probability": 0.0625
},
"location_predicate": {
"predicate_type": "minecraft:always_true"
},
"output_state": {
"Name": "actuallyadditions:lamp_yellow",
"Properties": {
"lit": "true"
}
}
},
{
"input_predicate": {
"block": "actuallyadditions:lamp_white",
"predicate_type": "minecraft:random_block_match",
"probability": 0.0625
},
"location_predicate": {
"predicate_type": "minecraft:always_true"
},
"output_state": {
"Name": "actuallyadditions:lamp_lime",
"Properties": {
"lit": "true"
}
}
},
{
"input_predicate": {
"block": "actuallyadditions:lamp_white",
"predicate_type": "minecraft:random_block_match",
"probability": 0.0625
},
"location_predicate": {
"predicate_type": "minecraft:always_true"
},
"output_state": {
"Name": "actuallyadditions:lamp_pink",
"Properties": {
"lit": "true"
}
}
},
{
"input_predicate": {
"block": "actuallyadditions:lamp_white",
"predicate_type": "minecraft:random_block_match",
"probability": 0.0625
},
"location_predicate": {
"predicate_type": "minecraft:always_true"
},
"output_state": {
"Name": "actuallyadditions:lamp_gray",
"Properties": {
"lit": "true"
}
}
},
{
"input_predicate": {
"block": "actuallyadditions:lamp_white",
"predicate_type": "minecraft:random_block_match",
"probability": 0.0625
},
"location_predicate": {
"predicate_type": "minecraft:always_true"
},
"output_state": {
"Name": "actuallyadditions:lamp_light_gray",
"Properties": {
"lit": "true"
}
}
},
{
"input_predicate": {
"block": "actuallyadditions:lamp_white",
"predicate_type": "minecraft:random_block_match",
"probability": 0.0625
},
"location_predicate": {
"predicate_type": "minecraft:always_true"
},
"output_state": {
"Name": "actuallyadditions:lamp_cyan",
"Properties": {
"lit": "true"
}
}
},
{
"input_predicate": {
"block": "actuallyadditions:lamp_white",
"predicate_type": "minecraft:random_block_match",
"probability": 0.0625
},
"location_predicate": {
"predicate_type": "minecraft:always_true"
},
"output_state": {
"Name": "actuallyadditions:lamp_purple",
"Properties": {
"lit": "true"
}
}
},
{
"input_predicate": {
"block": "actuallyadditions:lamp_white",
"predicate_type": "minecraft:random_block_match",
"probability": 0.0625
},
"location_predicate": {
"predicate_type": "minecraft:always_true"
},
"output_state": {
"Name": "actuallyadditions:lamp_blue",
"Properties": {
"lit": "true"
}
}
},
{
"input_predicate": {
"block": "actuallyadditions:lamp_white",
"predicate_type": "minecraft:random_block_match",
"probability": 0.0625
},
"location_predicate": {
"predicate_type": "minecraft:always_true"
},
"output_state": {
"Name": "actuallyadditions:lamp_brown",
"Properties": {
"lit": "true"
}
}
},
{
"input_predicate": {
"block": "actuallyadditions:lamp_white",
"predicate_type": "minecraft:random_block_match",
"probability": 0.0625
},
"location_predicate": {
"predicate_type": "minecraft:always_true"
},
"output_state": {
"Name": "actuallyadditions:lamp_green",
"Properties": {
"lit": "true"
}
}
},
{
"input_predicate": {
"block": "actuallyadditions:lamp_white",
"predicate_type": "minecraft:random_block_match",
"probability": 0.0625
},
"location_predicate": {
"predicate_type": "minecraft:always_true"
},
"output_state": {
"Name": "actuallyadditions:lamp_red",
"Properties": {
"lit": "true"
}
}
},
{
"input_predicate": {
"block": "actuallyadditions:lamp_white",
"predicate_type": "minecraft:random_block_match",
"probability": 0.0625
},
"location_predicate": {
"predicate_type": "minecraft:always_true"
},
"output_state": {
"Name": "actuallyadditions:lamp_black",
"Properties": {
"lit": "true"
}
}
}
]
}
]
}

View file

@ -24,6 +24,7 @@ public final class ActuallyTags {
public static final TagKey<Item> TINY_COALS = tag("tiny_coals");
public static final TagKey<Item> HOLDS_ITEMS = ItemTags.create(new ResourceLocation("forge", "holds_items"));
public static final TagKey<Item> CRYSTALS = tag("crystals");
public static final TagKey<Item> CRYSTAL_BLOCKS = tag("crystal_blocks");
public static final TagKey<Item> SEEDS_RICE = ItemTags.create(new ResourceLocation("forge", "seeds/rice"));
public static final TagKey<Item> SEEDS_COFFEE = ItemTags.create(new ResourceLocation("forge", "seeds/coffee"));
public static final TagKey<Item> SEEDS_CANOLA = ItemTags.create(new ResourceLocation("forge", "seeds/canola"));

View file

@ -5,6 +5,7 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.gen.ActuallyBiomeModifiers;
import de.ellpeck.actuallyadditions.mod.gen.ActuallyConfiguredFeatures;
import de.ellpeck.actuallyadditions.mod.gen.ActuallyPlacedFeatures;
import de.ellpeck.actuallyadditions.mod.gen.ActuallyProcessorLists;
import de.ellpeck.actuallyadditions.mod.misc.ActuallyDamageTypes;
import net.minecraft.core.Cloner;
import net.minecraft.core.HolderLookup;
@ -75,6 +76,7 @@ public class ActuallyAdditionsData {
});
registryBuilder.add(Registries.CONFIGURED_FEATURE, ActuallyConfiguredFeatures::bootstrap);
registryBuilder.add(Registries.PLACED_FEATURE, ActuallyPlacedFeatures::bootstrap);
registryBuilder.add(Registries.PROCESSOR_LIST, ActuallyProcessorLists::bootstrap);
registryBuilder.add(NeoForgeRegistries.Keys.BIOME_MODIFIERS, ActuallyBiomeModifiers::bootstrap);
// We need the BIOME registry to be present, so we can use a biome tag, doesn't matter that it's empty
registryBuilder.add(Registries.BIOME, $ -> {

View file

@ -39,6 +39,10 @@ public class ItemTagsGenerator extends ItemTagsProvider {
.add(ActuallyItems.RESTONIA_CRYSTAL.get(), ActuallyItems.PALIS_CRYSTAL.get(),
ActuallyItems.DIAMATINE_CRYSTAL.get(), ActuallyItems.VOID_CRYSTAL.get(),
ActuallyItems.EMERADIC_CRYSTAL.get(), ActuallyItems.ENORI_CRYSTAL.get());
this.tag(ActuallyTags.Items.CRYSTAL_BLOCKS)
.add(ActuallyBlocks.RESTONIA_CRYSTAL.getItem(), ActuallyBlocks.PALIS_CRYSTAL.getItem(),
ActuallyBlocks.DIAMATINE_CRYSTAL.getItem(), ActuallyBlocks.VOID_CRYSTAL.getItem(),
ActuallyBlocks.EMERADIC_CRYSTAL.getItem(), ActuallyBlocks.ENORI_CRYSTAL.getItem());
tag(Tags.Items.SLIMEBALLS)
.add(ActuallyItems.RICE_SLIMEBALL.get());

View file

@ -2,13 +2,16 @@ package de.ellpeck.actuallyadditions.data;
import com.google.common.collect.ImmutableSet;
import de.ellpeck.actuallyadditions.api.ActuallyTags;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.misc.DungeonLoot;
import net.minecraft.advancements.critereon.StatePropertiesPredicate;
import net.minecraft.data.PackOutput;
import net.minecraft.data.loot.BlockLootSubProvider;
import net.minecraft.data.loot.LootTableProvider;
import net.minecraft.data.loot.LootTableSubProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.flag.FeatureFlags;
import net.minecraft.world.item.Item;
@ -19,17 +22,21 @@ import net.minecraft.world.level.storage.loot.LootPool;
import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.ValidationContext;
import net.minecraft.world.level.storage.loot.entries.LootItem;
import net.minecraft.world.level.storage.loot.entries.TagEntry;
import net.minecraft.world.level.storage.loot.functions.CopyNbtFunction;
import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition;
import net.minecraft.world.level.storage.loot.providers.nbt.ContextNbtProvider;
import net.minecraft.world.level.storage.loot.providers.number.ConstantValue;
import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator;
import net.neoforged.neoforge.registries.DeferredHolder;
import javax.annotation.Nonnull;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.stream.Collectors;
@ -37,7 +44,8 @@ import java.util.stream.Collectors;
public class LootTableGenerator extends LootTableProvider {
public LootTableGenerator(PackOutput packOutput) {
super(packOutput, Set.of(), List.of(
new SubProviderEntry(Blocks::new, LootContextParamSets.BLOCK)
new SubProviderEntry(Blocks::new, LootContextParamSets.BLOCK),
new SubProviderEntry(Dungeon::new, LootContextParamSets.CHEST)
));
}
@ -240,4 +248,27 @@ public class LootTableGenerator extends LootTableProvider {
return ActuallyBlocks.BLOCKS.getEntries().stream().map(DeferredHolder::get).filter(e -> !ignoreForNow.contains(e)).collect(Collectors.toList());
}
}
public static class Dungeon implements LootTableSubProvider {
@Override
public void generate(BiConsumer<ResourceLocation, LootTable.Builder> pOutput) {
// addCrystals = true;
pOutput.accept(
DungeonLoot.ENGINEER_HOUSE,
LootTable.lootTable()
.withPool(
LootPool.lootPool()
.setRolls(UniformGenerator.between(4.0F, 7.0F))
.add(LootItem.lootTableItem(ActuallyBlocks.WOOD_CASING.getItem()).setWeight(60).apply(SetItemCountFunction.setCount(UniformGenerator.between(3.0F, 10.0F))))
.add(LootItem.lootTableItem(ActuallyBlocks.IRON_CASING.getItem()).setWeight(40).apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 3.0F))))
.add(LootItem.lootTableItem(ActuallyItems.BLACK_QUARTZ.get()).setWeight(20).apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 5.0F))))
.add(LootItem.lootTableItem(ActuallyItems.BATS_WING.get()).setWeight(5).apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 2.0F))))
.add(LootItem.lootTableItem(ActuallyItems.DRILL_CORE.get()).setWeight(5))
.add(TagEntry.expandTag(ActuallyTags.Items.CRYSTALS).setWeight(20).apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 3.0F))))
.add(TagEntry.expandTag(ActuallyTags.Items.CRYSTALS).setWeight(3).apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 3.0F))))
)
);
}
}
}

View file

@ -26,7 +26,7 @@ import de.ellpeck.actuallyadditions.mod.entity.EntityWorm;
import de.ellpeck.actuallyadditions.mod.entity.InitEntities;
import de.ellpeck.actuallyadditions.mod.event.CommonEvents;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.gen.ActuallyVillageCrops;
import de.ellpeck.actuallyadditions.mod.gen.ActuallyVillages;
import de.ellpeck.actuallyadditions.mod.gen.modifier.BoolConfigFeatureBiomeModifier;
import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
@ -125,7 +125,7 @@ public class ActuallyAdditions {
// NeoForge.EVENT_BUS.register(new DungeonLoot());
NeoForge.EVENT_BUS.addListener(ActuallyAdditions::reloadEvent);
NeoForge.EVENT_BUS.addListener(Worm::onHoe);
NeoForge.EVENT_BUS.addListener(ActuallyVillageCrops::addNewVillageCrop);
NeoForge.EVENT_BUS.addListener(ActuallyVillages::modifyVillageStructures);
InitFluids.init(eventBus);
eventBus.addListener(PacketHandler::register);

View file

@ -43,7 +43,7 @@ public class BlockTinyTorch extends BlockBase {
@Override
public int getLightEmission(BlockState state, BlockGetter level, BlockPos pos) {
return 8;
return 12;
}
@Override

View file

@ -3,6 +3,8 @@ package de.ellpeck.actuallyadditions.mod.blocks.base;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
@ -29,6 +31,16 @@ public abstract class FullyDirectionalBlock extends BlockBase {
return this.stateDefinition.getOwner().defaultBlockState().setValue(FACING, Direction.NORTH);
}
@Override
public BlockState rotate(BlockState pState, Rotation pRotation) {
return pState.setValue(FACING, pRotation.rotate(pState.getValue(FACING)));
}
@Override
public BlockState mirror(BlockState pState, Mirror pMirror) {
return pState.rotate(pMirror.getRotation(pState.getValue(FACING)));
}
@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(FACING);

View file

@ -0,0 +1,49 @@
package de.ellpeck.actuallyadditions.mod.gen;
import com.google.common.collect.ImmutableList;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.BootstapContext;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.levelgen.structure.templatesystem.AlwaysTrueTest;
import net.minecraft.world.level.levelgen.structure.templatesystem.ProcessorRule;
import net.minecraft.world.level.levelgen.structure.templatesystem.RandomBlockMatchTest;
import net.minecraft.world.level.levelgen.structure.templatesystem.RuleProcessor;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessor;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorList;
import java.util.List;
public class ActuallyProcessorLists {
public static final ResourceKey<StructureProcessorList> ENGINEER_HOUSE_PROCESSOR_LIST_KEY = ResourceKey.create(
Registries.PROCESSOR_LIST, new ResourceLocation(ActuallyAdditions.MODID, "engineer_house"));
public static void bootstrap(BootstapContext<StructureProcessorList> context) {
register(context, ENGINEER_HOUSE_PROCESSOR_LIST_KEY, ImmutableList.of(new RuleProcessor(ImmutableList.of(
new ProcessorRule(new RandomBlockMatchTest(ActuallyBlocks.LAMP_WHITE.get(), 0.0625F), AlwaysTrueTest.INSTANCE, ActuallyBlocks.LAMP_ORANGE.get().defaultBlockState().setValue(BlockStateProperties.LIT, true)),
new ProcessorRule(new RandomBlockMatchTest(ActuallyBlocks.LAMP_WHITE.get(), 0.0625F), AlwaysTrueTest.INSTANCE, ActuallyBlocks.LAMP_MAGENTA.get().defaultBlockState().setValue(BlockStateProperties.LIT, true)),
new ProcessorRule(new RandomBlockMatchTest(ActuallyBlocks.LAMP_WHITE.get(), 0.0625F), AlwaysTrueTest.INSTANCE, ActuallyBlocks.LAMP_LIGHT_BLUE.get().defaultBlockState().setValue(BlockStateProperties.LIT, true)),
new ProcessorRule(new RandomBlockMatchTest(ActuallyBlocks.LAMP_WHITE.get(), 0.0625F), AlwaysTrueTest.INSTANCE, ActuallyBlocks.LAMP_YELLOW.get().defaultBlockState().setValue(BlockStateProperties.LIT, true)),
new ProcessorRule(new RandomBlockMatchTest(ActuallyBlocks.LAMP_WHITE.get(), 0.0625F), AlwaysTrueTest.INSTANCE, ActuallyBlocks.LAMP_LIME.get().defaultBlockState().setValue(BlockStateProperties.LIT, true)),
new ProcessorRule(new RandomBlockMatchTest(ActuallyBlocks.LAMP_WHITE.get(), 0.0625F), AlwaysTrueTest.INSTANCE, ActuallyBlocks.LAMP_PINK.get().defaultBlockState().setValue(BlockStateProperties.LIT, true)),
new ProcessorRule(new RandomBlockMatchTest(ActuallyBlocks.LAMP_WHITE.get(), 0.0625F), AlwaysTrueTest.INSTANCE, ActuallyBlocks.LAMP_GRAY.get().defaultBlockState().setValue(BlockStateProperties.LIT, true)),
new ProcessorRule(new RandomBlockMatchTest(ActuallyBlocks.LAMP_WHITE.get(), 0.0625F), AlwaysTrueTest.INSTANCE, ActuallyBlocks.LAMP_LIGHT_GRAY.get().defaultBlockState().setValue(BlockStateProperties.LIT, true)),
new ProcessorRule(new RandomBlockMatchTest(ActuallyBlocks.LAMP_WHITE.get(), 0.0625F), AlwaysTrueTest.INSTANCE, ActuallyBlocks.LAMP_CYAN.get().defaultBlockState().setValue(BlockStateProperties.LIT, true)),
new ProcessorRule(new RandomBlockMatchTest(ActuallyBlocks.LAMP_WHITE.get(), 0.0625F), AlwaysTrueTest.INSTANCE, ActuallyBlocks.LAMP_PURPLE.get().defaultBlockState().setValue(BlockStateProperties.LIT, true)),
new ProcessorRule(new RandomBlockMatchTest(ActuallyBlocks.LAMP_WHITE.get(), 0.0625F), AlwaysTrueTest.INSTANCE, ActuallyBlocks.LAMP_BLUE.get().defaultBlockState().setValue(BlockStateProperties.LIT, true)),
new ProcessorRule(new RandomBlockMatchTest(ActuallyBlocks.LAMP_WHITE.get(), 0.0625F), AlwaysTrueTest.INSTANCE, ActuallyBlocks.LAMP_BROWN.get().defaultBlockState().setValue(BlockStateProperties.LIT, true)),
new ProcessorRule(new RandomBlockMatchTest(ActuallyBlocks.LAMP_WHITE.get(), 0.0625F), AlwaysTrueTest.INSTANCE, ActuallyBlocks.LAMP_GREEN.get().defaultBlockState().setValue(BlockStateProperties.LIT, true)),
new ProcessorRule(new RandomBlockMatchTest(ActuallyBlocks.LAMP_WHITE.get(), 0.0625F), AlwaysTrueTest.INSTANCE, ActuallyBlocks.LAMP_RED.get().defaultBlockState().setValue(BlockStateProperties.LIT, true)),
new ProcessorRule(new RandomBlockMatchTest(ActuallyBlocks.LAMP_WHITE.get(), 0.0625F), AlwaysTrueTest.INSTANCE, ActuallyBlocks.LAMP_BLACK.get().defaultBlockState().setValue(BlockStateProperties.LIT, true))
))));
}
private static void register(BootstapContext<StructureProcessorList> bootstapContext,
ResourceKey<StructureProcessorList> processorListResourceKey,
List<StructureProcessor> structureProcessorList) {
bootstapContext.register(processorListResourceKey, new StructureProcessorList(structureProcessorList));
}
}

View file

@ -1,10 +1,16 @@
package de.ellpeck.actuallyadditions.mod.gen;
import com.mojang.datafixers.util.Pair;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.levelgen.structure.pools.SinglePoolElement;
import net.minecraft.world.level.levelgen.structure.pools.StructurePoolElement;
import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool;
import net.minecraft.world.level.levelgen.structure.templatesystem.AlwaysTrueTest;
import net.minecraft.world.level.levelgen.structure.templatesystem.ProcessorRule;
import net.minecraft.world.level.levelgen.structure.templatesystem.RandomBlockMatchTest;
@ -16,11 +22,71 @@ import net.neoforged.neoforge.event.server.ServerAboutToStartEvent;
import java.util.ArrayList;
import java.util.List;
public class ActuallyVillageCrops {
public class ActuallyVillages {
public static void addNewVillageCrop(final ServerAboutToStartEvent event) {
private static void addBuildingToPool(Registry<StructureTemplatePool> templatePoolRegistry,
Registry<StructureProcessorList> processorListRegistry,
ResourceLocation poolRL,
String nbtPieceRL,
int weight) {
// Grabs the processor list we want to use along with our piece.
// This is a requirement as using the ProcessorLists.EMPTY field will cause the game to throw errors.
// The reason why is the empty processor list in the world's registry is not the same instance as in that field once the world is started up.
Holder<StructureProcessorList> emptyProcessorList = processorListRegistry.getHolderOrThrow(ActuallyProcessorLists.ENGINEER_HOUSE_PROCESSOR_LIST_KEY);
// Grab the pool we want to add to
StructureTemplatePool pool = templatePoolRegistry.get(poolRL);
if (pool == null) return;
// Grabs the nbt piece and creates a SinglePoolElement of it that we can add to a structure's pool.
// Use .legacy( for villages/outposts and .single( for everything else
SinglePoolElement piece = SinglePoolElement.legacy(nbtPieceRL, emptyProcessorList).apply(StructureTemplatePool.Projection.RIGID);
// Use AccessTransformer or Accessor Mixin to make StructureTemplatePool's templates field public for us to see.
// Weight is handled by how many times the entry appears in this list.
// We do not need to worry about immutability as this field is created using Lists.newArrayList(); which makes a mutable list.
for (int i = 0; i < weight; i++) {
pool.templates.add(piece);
}
// Use AccessTransformer or Accessor Mixin to make StructureTemplatePool's rawTemplates field public for us to see.
// This list of pairs of pieces and weights is not used by vanilla by default but another mod may need it for efficiency.
// So lets add to this list for completeness. We need to make a copy of the array as it can be an immutable list.
// NOTE: This is a com.mojang.datafixers.util.Pair. It is NOT a fastUtil pair class. Use the mojang class.
List<Pair<StructurePoolElement, Integer>> listOfPieceEntries = new ArrayList<>(pool.rawTemplates);
listOfPieceEntries.add(new Pair<>(piece, weight));
pool.rawTemplates = listOfPieceEntries;
}
public static void modifyVillageStructures(final ServerAboutToStartEvent event) {
Registry<StructureTemplatePool> templatePoolRegistry = event.getServer().registryAccess().registry(Registries.TEMPLATE_POOL).orElseThrow();
Registry<StructureProcessorList> processorListRegistry = event.getServer().registryAccess().registry(Registries.PROCESSOR_LIST).orElseThrow();
//Add Engineer house to villages
addBuildingToPool(templatePoolRegistry, processorListRegistry,
new ResourceLocation("minecraft:village/plains/houses"),
ActuallyAdditions.MODID + ":andrew_period_house", 10);
addBuildingToPool(templatePoolRegistry, processorListRegistry,
new ResourceLocation("minecraft:village/snowy/houses"),
ActuallyAdditions.MODID + ":andrew_period_house", 10);
addBuildingToPool(templatePoolRegistry, processorListRegistry,
new ResourceLocation("minecraft:village/savanna/houses"),
ActuallyAdditions.MODID + ":andrew_period_house", 10);
addBuildingToPool(templatePoolRegistry, processorListRegistry,
new ResourceLocation("minecraft:village/taiga/houses"),
ActuallyAdditions.MODID + ":andrew_period_house", 10);
addBuildingToPool(templatePoolRegistry, processorListRegistry,
new ResourceLocation("minecraft:village/desert/houses"),
ActuallyAdditions.MODID + ":andrew_period_house", 50);
//Add Actually Additions crops to village farms
StructureProcessor cropProcessor = new RuleProcessor(List.of(
new ProcessorRule(new RandomBlockMatchTest(Blocks.WHEAT, 0.30F), AlwaysTrueTest.INSTANCE, ActuallyBlocks.RICE.get().defaultBlockState()),
new ProcessorRule(new RandomBlockMatchTest(Blocks.WHEAT, 0.25F), AlwaysTrueTest.INSTANCE, ActuallyBlocks.COFFEE.get().defaultBlockState()),

View file

@ -10,13 +10,16 @@
package de.ellpeck.actuallyadditions.mod.misc;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import net.minecraft.resources.ResourceLocation;
// TODO: [port] MOVE OVER TO DATA GENS
@Deprecated
public class DungeonLoot {
//
// public static final ResourceLocation JAM_HOUSE = new ResourceLocation(ActuallyAdditions.MODID, "jam_house");
// public static final ResourceLocation LUSH_CAVES = new ResourceLocation(ActuallyAdditions.MODID, "lush_caves");
// public static final ResourceLocation ENGINEER_HOUSE = new ResourceLocation(ActuallyAdditions.MODID, "engineer_house");
public static final ResourceLocation ENGINEER_HOUSE = new ResourceLocation(ActuallyAdditions.MODID, "engineer_house");
//
// public DungeonLoot() {
// LootTableList.register(JAM_HOUSE);

View file

@ -3,4 +3,6 @@ public net.minecraft.world.damagesource.DamageSources damageTypes
public-f net.minecraft.data.recipes.RecipeProvider getName()Ljava/lang/String;
public-f net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorList list
public net.minecraft.world.item.crafting.ShapedRecipe pattern
public net.minecraft.world.inventory.InventoryMenu TEXTURE_EMPTY_SLOTS
public net.minecraft.world.inventory.InventoryMenu TEXTURE_EMPTY_SLOTS
public net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool templates
public-f net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool rawTemplates