Skip to content

Commit

Permalink
Start re-implementing the Spatial Tinkerer villager
Browse files Browse the repository at this point in the history
  • Loading branch information
robotgryphon committed Mar 12, 2024
1 parent 5c6ad6b commit 3419a69
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import dev.compactmods.machines.datagen.lang.RussianLangGenerator;
import dev.compactmods.machines.datagen.tags.BlockTagGenerator;
import dev.compactmods.machines.datagen.tags.ItemTagGenerator;
import dev.compactmods.machines.datagen.tags.PointOfInterestTagGenerator;
import net.minecraft.data.DataProvider;
import net.minecraft.data.loot.LootTableProvider;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
Expand Down Expand Up @@ -46,7 +47,7 @@ public static void gatherData(GatherDataEvent event) {
generator.addProvider(server, new CurioSlotGenerator(packOut, holderLookup, fileHelper));
generator.addProvider(server, new CurioEntityGenerator(packOut, holderLookup, fileHelper));

// generator.addProvider(server, new PointOfInterestTagGenerator(packOut, holderLookup, helper));
generator.addProvider(server, new PointOfInterestTagGenerator(packOut, holderLookup, fileHelper));
// generator.addProvider(event.includeServer(), new PackMetaGenerator(packOut));

// Client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dev.compactmods.machines.datagen.tags;

import dev.compactmods.machines.api.Constants;
import dev.compactmods.machines.neoforge.villager.Villagers;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.data.tags.PoiTypeTagsProvider;
Expand All @@ -19,6 +20,6 @@ public PointOfInterestTagGenerator(PackOutput packOut, CompletableFuture<HolderL
@Override
protected void addTags(HolderLookup.@NotNull Provider provider) {
TagAppender<PoiType> builder = tag(PoiTypeTags.ACQUIRABLE_JOB_SITE);
// builder.add(Villagers.TINKERER_WORKBENCH_KEY);
builder.add(Villagers.TINKERER_WORKBENCH_KEY);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.entity.ai.village.poi.PoiType;
import net.minecraft.world.entity.npc.VillagerProfession;
import net.minecraft.world.flag.FeatureFlag;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.MapColor;
import net.neoforged.neoforge.registries.DeferredBlock;
import net.neoforged.neoforge.registries.DeferredItem;

import java.util.function.Supplier;

Expand All @@ -18,6 +26,11 @@ public class Villagers {
public static final ResourceKey<PoiType> TINKERER_WORKBENCH_KEY = ResourceKey
.create(BuiltInRegistries.POINT_OF_INTEREST_TYPE.key(), TINKERER_ID);

public static final DeferredBlock<Block> SPATIAL_WORKBENCH = Registries.BLOCKS.registerSimpleBlock("spatial_workbench", BlockBehaviour.Properties.of()
.mapColor(MapColor.NONE));

public static final DeferredItem<BlockItem> SPATIAL_WORKBENCH_ITEM = Registries.ITEMS.registerSimpleBlockItem(SPATIAL_WORKBENCH);

public static final Supplier<VillagerProfession> TINKERER = Registries.VILLAGERS.register("tinkerer",
() -> new VillagerProfession(
TINKERER_ID.toString(),
Expand All @@ -40,9 +53,9 @@ public class Villagers {
// () -> new BasicItemListing(1, new ItemStack(Machines.MACHINE_BLOCK_ITEM_TINY.get()), 5, 100));

static {
// Registries.POINTS_OF_INTEREST.register("tinkerer", () -> new PoiType(
// ImmutableSet.of(MachineRoomUpgrades.WORKBENCH_BLOCK.get().defaultBlockState()), 1, 1)
// );
Registries.POINTS_OF_INTEREST.register("tinkerer", () -> new PoiType(
ImmutableSet.of(SPATIAL_WORKBENCH.get().defaultBlockState()), 1, 1)
);
}

public static void prepare() {
Expand Down

0 comments on commit 3419a69

Please sign in to comment.