diff --git a/src/main/java/dev/tggamesyt/szar/Szar.java b/src/main/java/dev/tggamesyt/szar/Szar.java index e0c0a46..b29606c 100644 --- a/src/main/java/dev/tggamesyt/szar/Szar.java +++ b/src/main/java/dev/tggamesyt/szar/Szar.java @@ -1,5 +1,6 @@ package dev.tggamesyt.szar; +import com.google.common.collect.ImmutableSet; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; import net.fabricmc.fabric.api.item.v1.FabricItemSettings; @@ -8,6 +9,7 @@ import net.fabricmc.fabric.api.message.v1.ServerMessageDecoratorEvent; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry; import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder; +import net.fabricmc.fabric.api.object.builder.v1.world.poi.PointOfInterestHelper; import net.minecraft.advancement.Advancement; import net.minecraft.block.AbstractBlock; import net.minecraft.block.Block; @@ -20,10 +22,14 @@ import net.minecraft.entity.effect.StatusEffect; import net.minecraft.item.*; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.sound.SoundEvents; import net.minecraft.text.Text; import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; +import net.minecraft.village.VillagerProfession; +import net.minecraft.world.poi.PointOfInterestType; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -46,6 +52,8 @@ public class Szar implements ModInitializer { new FaszBlock(); public static final Identifier TOTEMPACKET = new Identifier(MOD_ID, "nwordpacket"); + public static PointOfInterestType CHEMICAL_WORKBENCH_POI; + public static VillagerProfession DROG_DEALER; public static final ItemGroup SZAR_GROUP = Registry.register( Registries.ITEM_GROUP, new Identifier(MOD_ID, "szar_group"), @@ -96,6 +104,58 @@ public class Szar implements ModInitializer { new Identifier(MOD_ID, "fasz"), FASZ_BLOCK ); + Registry.register( + Registries.BLOCK, + new Identifier(MOD_ID, "chemical_workbench"), + CHEMICAL_WORKBENCH + ); + + Registry.register( + Registries.ITEM, + new Identifier(MOD_ID, "chemical_workbench"), + new BlockItem(CHEMICAL_WORKBENCH, new FabricItemSettings()) + ); + CHEMICAL_WORKBENCH_POI = Registry.register( + Registries.POINT_OF_INTEREST_TYPE, + new Identifier(MOD_ID, "chemical_workbench_poi"), + new PointOfInterestType( + ImmutableSet.copyOf( + 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 + ); ServerMessageDecoratorEvent.EVENT.register((player, message) -> CompletableFuture.completedFuture( filterMessage(player, message) @@ -111,6 +171,8 @@ public class Szar implements ModInitializer { ); 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 PLAYER_JOINT_LEVEL = new HashMap<>(); public static final Map PLAYER_ADDICTION_LEVEL = new HashMap<>(); public static final StatusEffect DROG_EFFECT = Registry.register( diff --git a/src/main/resources/assets/szar/models/block/chemical_workbench.json b/src/main/resources/assets/szar/models/block/chemical_workbench.json new file mode 100644 index 0000000..039a2a0 --- /dev/null +++ b/src/main/resources/assets/szar/models/block/chemical_workbench.json @@ -0,0 +1,28 @@ +{ + "format_version": "1.9.0", + "credit": "Made with Blockbench", + "texture_size": [64, 64], + "textures": { + "0": "szar:block/chemical_1", + "1": "szar:block/chemical_2", + "2": "szar:block/chemical_3", + "3": "szar:block/chemical_4", + "4": "szar:block/chemical_bottom", + "5": "szar:block/chemical_top", + "particle": "szar:block/chemical_1" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [0, 0, 16, 16], "texture": "#3"}, + "east": {"uv": [0, 0, 16, 16], "texture": "#2"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "up": {"uv": [15.73333, 16, 0, 0], "texture": "#5"}, + "down": {"uv": [16, 0, 0, 16], "texture": "#4"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/szar/textures/block/chemical_1.png b/src/main/resources/assets/szar/textures/block/chemical_1.png new file mode 100644 index 0000000..71fe4e0 Binary files /dev/null and b/src/main/resources/assets/szar/textures/block/chemical_1.png differ diff --git a/src/main/resources/assets/szar/textures/block/chemical_2.png b/src/main/resources/assets/szar/textures/block/chemical_2.png new file mode 100644 index 0000000..909aec7 Binary files /dev/null and b/src/main/resources/assets/szar/textures/block/chemical_2.png differ diff --git a/src/main/resources/assets/szar/textures/block/chemical_3.png b/src/main/resources/assets/szar/textures/block/chemical_3.png new file mode 100644 index 0000000..e41ee5b Binary files /dev/null and b/src/main/resources/assets/szar/textures/block/chemical_3.png differ diff --git a/src/main/resources/assets/szar/textures/block/chemical_4.png b/src/main/resources/assets/szar/textures/block/chemical_4.png new file mode 100644 index 0000000..35632e6 Binary files /dev/null and b/src/main/resources/assets/szar/textures/block/chemical_4.png differ diff --git a/src/main/resources/assets/szar/textures/block/chemical_bottom.png b/src/main/resources/assets/szar/textures/block/chemical_bottom.png new file mode 100644 index 0000000..fcc10aa Binary files /dev/null and b/src/main/resources/assets/szar/textures/block/chemical_bottom.png differ diff --git a/src/main/resources/assets/szar/textures/block/chemical_top.png b/src/main/resources/assets/szar/textures/block/chemical_top.png new file mode 100644 index 0000000..00a2ed5 Binary files /dev/null and b/src/main/resources/assets/szar/textures/block/chemical_top.png differ diff --git a/src/main/resources/assets/szar/textures/entity/villager/profession/drog_dealer.png b/src/main/resources/assets/szar/textures/entity/villager/profession/drog_dealer.png new file mode 100644 index 0000000..f9d99f9 Binary files /dev/null and b/src/main/resources/assets/szar/textures/entity/villager/profession/drog_dealer.png differ