villager
This commit is contained in:
@@ -6,7 +6,7 @@ minecraft_version=1.20.1
|
|||||||
yarn_mappings=1.20.1+build.10
|
yarn_mappings=1.20.1+build.10
|
||||||
loader_version=0.18.3
|
loader_version=0.18.3
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.0.6
|
mod_version=1.0.7
|
||||||
maven_group=dev.tggamesyt
|
maven_group=dev.tggamesyt
|
||||||
archives_base_name=szar
|
archives_base_name=szar
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package dev.tggamesyt.szar.client;
|
package dev.tggamesyt.szar.client;
|
||||||
|
|
||||||
|
import dev.tggamesyt.szar.ModPoiTagProvider;
|
||||||
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
|
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
|
||||||
|
|
||||||
@@ -8,5 +9,7 @@ public class SzarDataGenerator implements DataGeneratorEntrypoint {
|
|||||||
@Override
|
@Override
|
||||||
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
|
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
|
||||||
FabricDataGenerator.Pack pack = fabricDataGenerator.createPack();
|
FabricDataGenerator.Pack pack = fabricDataGenerator.createPack();
|
||||||
|
|
||||||
|
pack.addProvider(ModPoiTagProvider::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
// 1.20.1 2026-01-26T11:11:39.1328713 szar/Tags for minecraft:point_of_interest_type
|
||||||
|
eba137b51c50a7143a3668876f41adaa1447b1d1 data\minecraft\tags\point_of_interest_type\acquirable_job_site.json
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"replace": false,
|
||||||
|
"values": [
|
||||||
|
{
|
||||||
|
"id": "szar:chemical_workbench_poi",
|
||||||
|
"required": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
26
src/main/java/dev/tggamesyt/szar/ModPoiTagProvider.java
Normal file
26
src/main/java/dev/tggamesyt/szar/ModPoiTagProvider.java
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package dev.tggamesyt.szar;
|
||||||
|
|
||||||
|
import net.minecraft.data.DataOutput;
|
||||||
|
import net.minecraft.data.server.tag.TagProvider;
|
||||||
|
import net.minecraft.registry.Registry;
|
||||||
|
import net.minecraft.registry.RegistryKey;
|
||||||
|
import net.minecraft.registry.RegistryKeys;
|
||||||
|
import net.minecraft.registry.RegistryWrapper;
|
||||||
|
import net.minecraft.registry.tag.PointOfInterestTypeTags;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.world.poi.PointOfInterestType;
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
public class ModPoiTagProvider extends TagProvider<PointOfInterestType> {
|
||||||
|
public ModPoiTagProvider(DataOutput output,
|
||||||
|
CompletableFuture<RegistryWrapper.WrapperLookup> registryLookupFuture) {
|
||||||
|
super(output, RegistryKeys.POINT_OF_INTEREST_TYPE, registryLookupFuture);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure(RegistryWrapper.WrapperLookup lookup) {
|
||||||
|
this.getOrCreateTagBuilder(PointOfInterestTypeTags.ACQUIRABLE_JOB_SITE)
|
||||||
|
.addOptional(new Identifier(Szar.MOD_ID, "chemical_workbench_poi"));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,6 +24,7 @@ import net.minecraft.item.*;
|
|||||||
import net.minecraft.registry.Registries;
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.registry.RegistryKey;
|
import net.minecraft.registry.RegistryKey;
|
||||||
|
import net.minecraft.registry.RegistryKeys;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.sound.SoundEvents;
|
import net.minecraft.sound.SoundEvents;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
@@ -54,8 +55,24 @@ public class Szar implements ModInitializer {
|
|||||||
new FaszBlock();
|
new FaszBlock();
|
||||||
public static final Identifier TOTEMPACKET =
|
public static final Identifier TOTEMPACKET =
|
||||||
new Identifier(MOD_ID, "nwordpacket");
|
new Identifier(MOD_ID, "nwordpacket");
|
||||||
public static PointOfInterestType CHEMICAL_WORKBENCH_POI;
|
public static final Block CHEMICAL_WORKBENCH =
|
||||||
public static VillagerProfession DROG_DEALER;
|
new Block(AbstractBlock.Settings.copy(Blocks.OAK_PLANKS));
|
||||||
|
public static final RegistryKey<PointOfInterestType> CHEMICAL_WORKBENCH_POI_KEY =
|
||||||
|
RegistryKey.of(RegistryKeys.POINT_OF_INTEREST_TYPE, new Identifier(MOD_ID, "chemical_workbench_poi"));
|
||||||
|
public static PointOfInterestType CHEMICAL_WORKBENCH_POI =
|
||||||
|
PointOfInterestHelper.register(new Identifier(MOD_ID, "chemical_workbench_poi"), 1, 1, CHEMICAL_WORKBENCH);
|
||||||
|
public static VillagerProfession DROG_DEALER = Registry.register(
|
||||||
|
Registries.VILLAGER_PROFESSION,
|
||||||
|
new Identifier(MOD_ID, "drog_dealer"),
|
||||||
|
new VillagerProfession(
|
||||||
|
"drog_dealer",
|
||||||
|
entry -> entry.matchesKey(CHEMICAL_WORKBENCH_POI_KEY),
|
||||||
|
entry -> entry.matchesKey(CHEMICAL_WORKBENCH_POI_KEY),
|
||||||
|
ImmutableSet.of(),
|
||||||
|
ImmutableSet.of(),
|
||||||
|
SoundEvents.ENTITY_VILLAGER_WORK_CLERIC
|
||||||
|
)
|
||||||
|
);
|
||||||
public static final ItemGroup SZAR_GROUP = Registry.register(
|
public static final ItemGroup SZAR_GROUP = Registry.register(
|
||||||
Registries.ITEM_GROUP,
|
Registries.ITEM_GROUP,
|
||||||
new Identifier(MOD_ID, "szar_group"),
|
new Identifier(MOD_ID, "szar_group"),
|
||||||
@@ -82,6 +99,7 @@ public class Szar implements ModInitializer {
|
|||||||
entries.add(Szar.NIGGERITE_LEGGINGS);
|
entries.add(Szar.NIGGERITE_LEGGINGS);
|
||||||
entries.add(Szar.NIGGERITE_BOOTS);
|
entries.add(Szar.NIGGERITE_BOOTS);
|
||||||
entries.add(Szar.NIGGERITE_BLOCK);
|
entries.add(Szar.NIGGERITE_BLOCK);
|
||||||
|
entries.add(Szar.CHEMICAL_WORKBENCH_ITEM);
|
||||||
})
|
})
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
@@ -111,52 +129,20 @@ public class Szar implements ModInitializer {
|
|||||||
new Identifier(MOD_ID, "chemical_workbench"),
|
new Identifier(MOD_ID, "chemical_workbench"),
|
||||||
CHEMICAL_WORKBENCH
|
CHEMICAL_WORKBENCH
|
||||||
);
|
);
|
||||||
|
TradeOfferHelper.registerVillagerOffers(
|
||||||
Registry.register(
|
DROG_DEALER,
|
||||||
Registries.ITEM,
|
1, // villager level
|
||||||
new Identifier(MOD_ID, "chemical_workbench"),
|
factories -> {
|
||||||
new BlockItem(CHEMICAL_WORKBENCH, new FabricItemSettings())
|
factories.add((entity, random) ->
|
||||||
);
|
new TradeOffer(
|
||||||
CHEMICAL_WORKBENCH_POI = Registry.register(
|
new ItemStack(Items.EMERALD, 3),
|
||||||
Registries.POINT_OF_INTEREST_TYPE,
|
new ItemStack(Items.PAPER, 6),
|
||||||
new Identifier(MOD_ID, "chemical_workbench_poi"),
|
12, // max uses
|
||||||
new PointOfInterestType(
|
2, // villager XP
|
||||||
ImmutableSet.copyOf(
|
0.05f // price multiplier
|
||||||
CHEMICAL_WORKBENCH
|
|
||||||
.getStateManager()
|
|
||||||
.getStates()
|
|
||||||
),
|
|
||||||
1, // max tickets
|
|
||||||
1 // search distance
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
DROG_DEALER = Registry.register(
|
}
|
||||||
Registries.VILLAGER_PROFESSION,
|
|
||||||
new Identifier(MOD_ID, "drog_dealer"),
|
|
||||||
new VillagerProfession(
|
|
||||||
"drog_dealer",
|
|
||||||
entry -> entry.matchesKey(
|
|
||||||
RegistryKey.of(
|
|
||||||
Registries.POINT_OF_INTEREST_TYPE.getKey(),
|
|
||||||
new Identifier(MOD_ID, "chemical_workbench_poi")
|
|
||||||
)
|
|
||||||
),
|
|
||||||
entry -> entry.matchesKey(
|
|
||||||
RegistryKey.of(
|
|
||||||
Registries.POINT_OF_INTEREST_TYPE.getKey(),
|
|
||||||
new Identifier(MOD_ID, "chemical_workbench_poi")
|
|
||||||
)
|
|
||||||
),
|
|
||||||
ImmutableSet.of(),
|
|
||||||
ImmutableSet.of(),
|
|
||||||
SoundEvents.ENTITY_VILLAGER_WORK_CLERIC
|
|
||||||
)
|
|
||||||
);
|
|
||||||
PointOfInterestHelper.register(
|
|
||||||
new Identifier(MOD_ID, "chemical_workbench_poi"),
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
CHEMICAL_WORKBENCH
|
|
||||||
);
|
);
|
||||||
TradeOfferHelper.registerVillagerOffers(
|
TradeOfferHelper.registerVillagerOffers(
|
||||||
DROG_DEALER,
|
DROG_DEALER,
|
||||||
@@ -164,8 +150,83 @@ public class Szar implements ModInitializer {
|
|||||||
factories -> {
|
factories -> {
|
||||||
factories.add((entity, random) ->
|
factories.add((entity, random) ->
|
||||||
new TradeOffer(
|
new TradeOffer(
|
||||||
new ItemStack(Items.EMERALD, 2),
|
new ItemStack(Items.SUGAR_CANE, 6),
|
||||||
new ItemStack(Items.GUNPOWDER, 1),
|
new ItemStack(Items.EMERALD, 1),
|
||||||
|
12, // max uses
|
||||||
|
2, // villager XP
|
||||||
|
0.05f // price multiplier
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
TradeOfferHelper.registerVillagerOffers(
|
||||||
|
DROG_DEALER,
|
||||||
|
2, // villager level
|
||||||
|
factories -> {
|
||||||
|
factories.add((entity, random) ->
|
||||||
|
new TradeOffer(
|
||||||
|
new ItemStack(Items.EMERALD, 10),
|
||||||
|
new ItemStack(CANNABIS_ITEM, 1),
|
||||||
|
12, // max uses
|
||||||
|
2, // villager XP
|
||||||
|
0.05f // price multiplier
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
TradeOfferHelper.registerVillagerOffers(
|
||||||
|
DROG_DEALER,
|
||||||
|
3, // villager level
|
||||||
|
factories -> {
|
||||||
|
factories.add((entity, random) ->
|
||||||
|
new TradeOffer(
|
||||||
|
new ItemStack(Items.EMERALD, 15),
|
||||||
|
new ItemStack(WEED_ITEM, 1),
|
||||||
|
12, // max uses
|
||||||
|
2, // villager XP
|
||||||
|
0.05f // price multiplier
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
TradeOfferHelper.registerVillagerOffers(
|
||||||
|
DROG_DEALER,
|
||||||
|
3, // villager level
|
||||||
|
factories -> {
|
||||||
|
factories.add((entity, random) ->
|
||||||
|
new TradeOffer(
|
||||||
|
new ItemStack(Items.EMERALD, 64),
|
||||||
|
new ItemStack(WEED_JOINT_ITEM, 1),
|
||||||
|
12, // max uses
|
||||||
|
2, // villager XP
|
||||||
|
0.05f // price multiplier
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
TradeOfferHelper.registerVillagerOffers(
|
||||||
|
DROG_DEALER,
|
||||||
|
4, // villager level
|
||||||
|
factories -> {
|
||||||
|
factories.add((entity, random) ->
|
||||||
|
new TradeOffer(
|
||||||
|
new ItemStack(Items.EMERALD, 4),
|
||||||
|
new ItemStack(Items.CAMPFIRE, 1),
|
||||||
|
12, // max uses
|
||||||
|
2, // villager XP
|
||||||
|
0.05f // price multiplier
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
TradeOfferHelper.registerVillagerOffers(
|
||||||
|
DROG_DEALER,
|
||||||
|
5, // villager level
|
||||||
|
factories -> {
|
||||||
|
factories.add((entity, random) ->
|
||||||
|
new TradeOffer(
|
||||||
|
new ItemStack(NIGGERITE_INGOT, 10),
|
||||||
|
new ItemStack(WEED_JOINT_ITEM, 1),
|
||||||
12, // max uses
|
12, // max uses
|
||||||
2, // villager XP
|
2, // villager XP
|
||||||
0.05f // price multiplier
|
0.05f // price multiplier
|
||||||
@@ -188,8 +249,6 @@ public class Szar implements ModInitializer {
|
|||||||
);
|
);
|
||||||
ServerTickEvents.END_SERVER_TICK.register(PlayerValueTimer::onServerTick);
|
ServerTickEvents.END_SERVER_TICK.register(PlayerValueTimer::onServerTick);
|
||||||
}
|
}
|
||||||
public static final Block CHEMICAL_WORKBENCH =
|
|
||||||
new Block(AbstractBlock.Settings.copy(Blocks.OAK_PLANKS));
|
|
||||||
public static final Map<UUID, Integer> PLAYER_JOINT_LEVEL = new HashMap<>();
|
public static final Map<UUID, Integer> PLAYER_JOINT_LEVEL = new HashMap<>();
|
||||||
public static final Map<UUID, Boolean> PLAYER_ADDICTION_LEVEL = new HashMap<>();
|
public static final Map<UUID, Boolean> PLAYER_ADDICTION_LEVEL = new HashMap<>();
|
||||||
public static final StatusEffect DROG_EFFECT = Registry.register(
|
public static final StatusEffect DROG_EFFECT = Registry.register(
|
||||||
@@ -197,6 +256,11 @@ public class Szar implements ModInitializer {
|
|||||||
new Identifier(MOD_ID, "drog"),
|
new Identifier(MOD_ID, "drog"),
|
||||||
new DrogEffect()
|
new DrogEffect()
|
||||||
);
|
);
|
||||||
|
public static final Item CHEMICAL_WORKBENCH_ITEM = Registry.register(
|
||||||
|
Registries.ITEM,
|
||||||
|
new Identifier(MOD_ID, "chemical_workbench"),
|
||||||
|
new BlockItem(CHEMICAL_WORKBENCH, new FabricItemSettings())
|
||||||
|
);
|
||||||
public static final Block CANNABIS_BLOCK = Registry.register(
|
public static final Block CANNABIS_BLOCK = Registry.register(
|
||||||
Registries.BLOCK,
|
Registries.BLOCK,
|
||||||
new Identifier(MOD_ID, "cannabis"),
|
new Identifier(MOD_ID, "cannabis"),
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "szar:block/chemical_workbench"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,5 +22,7 @@
|
|||||||
"item.szar.niggerite_boots": "Niggerite Boots",
|
"item.szar.niggerite_boots": "Niggerite Boots",
|
||||||
"item.szar.niggerite_helmet": "Niggerite Helmet",
|
"item.szar.niggerite_helmet": "Niggerite Helmet",
|
||||||
"death.attack.heart_attack": "%1$s got a heart attack",
|
"death.attack.heart_attack": "%1$s got a heart attack",
|
||||||
"death.attack.drog_overdose": "%1$s got a drog overdose"
|
"death.attack.drog_overdose": "%1$s got a drog overdose",
|
||||||
|
"block.szar.chemical_workbench": "Chemical Workbench",
|
||||||
|
"entity.minecraft.villager.drog_dealer": "Drog dealer"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"parent": "szar:block/chemical_workbench"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user