Fix TR villagers.

This commit is contained in:
modmuss50 2022-05-27 15:20:06 +01:00
parent f3942a023e
commit ebaddaca59
3 changed files with 65 additions and 5 deletions

View file

@ -39,6 +39,7 @@ import techreborn.datagen.recipes.machine.industrial_sawmill.IndustrialSawmillRe
import techreborn.datagen.recipes.smelting.SmeltingRecipesProvider import techreborn.datagen.recipes.smelting.SmeltingRecipesProvider
import techreborn.datagen.tags.TRBlockTagProvider import techreborn.datagen.tags.TRBlockTagProvider
import techreborn.datagen.tags.TRItemTagProvider import techreborn.datagen.tags.TRItemTagProvider
import techreborn.datagen.tags.TRPointOfInterestTagProvider
import techreborn.datagen.tags.WaterExplosionTagProvider import techreborn.datagen.tags.WaterExplosionTagProvider
class TechRebornDataGen implements DataGeneratorEntrypoint { class TechRebornDataGen implements DataGeneratorEntrypoint {
@ -47,6 +48,7 @@ class TechRebornDataGen implements DataGeneratorEntrypoint {
void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) { void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
fabricDataGenerator.addProvider(WaterExplosionTagProvider.&new) fabricDataGenerator.addProvider(WaterExplosionTagProvider.&new)
fabricDataGenerator.addProvider(TRItemTagProvider.&new) fabricDataGenerator.addProvider(TRItemTagProvider.&new)
fabricDataGenerator.addProvider(TRPointOfInterestTagProvider.&new)
fabricDataGenerator.addProvider(TRBlockTagProvider.&new) fabricDataGenerator.addProvider(TRBlockTagProvider.&new)
// tags before all else, very important!! // tags before all else, very important!!
fabricDataGenerator.addProvider(SmeltingRecipesProvider.&new) fabricDataGenerator.addProvider(SmeltingRecipesProvider.&new)

View file

@ -0,0 +1,45 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2020 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.datagen.tags
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider
import net.minecraft.tag.PointOfInterestTypeTags
import net.minecraft.util.registry.Registry
import net.minecraft.world.poi.PointOfInterestType
import techreborn.init.TRVillager
class TRPointOfInterestTagProvider extends FabricTagProvider<PointOfInterestType> {
TRPointOfInterestTagProvider(FabricDataGenerator dataGenerator) {
super(dataGenerator, Registry.POINT_OF_INTEREST_TYPE)
}
@Override
protected void generateTags() {
getOrCreateTagBuilder(PointOfInterestTypeTags.ACQUIRABLE_JOB_SITE)
.add(TRVillager.METALLURGIST_POI)
.add(TRVillager.ELECTRICIAN_POI)
}
}

View file

@ -24,14 +24,27 @@ public class TRVillager {
public static final Identifier ELECTRICIAN_ID = new Identifier(TechReborn.MOD_ID, "electrician"); public static final Identifier ELECTRICIAN_ID = new Identifier(TechReborn.MOD_ID, "electrician");
public static final PointOfInterestType METALLURGIST_POI = PointOfInterestHelper.register( public static final PointOfInterestType METALLURGIST_POI = PointOfInterestHelper.register(
METALLURGIST_ID, 1, 1, TRContent.Machine.IRON_ALLOY_FURNACE.block); METALLURGIST_ID, 1, 1, TRContent.Machine.IRON_ALLOY_FURNACE.block
);
public static final PointOfInterestType ELECTRICIAN_POI = PointOfInterestHelper.register( public static final PointOfInterestType ELECTRICIAN_POI = PointOfInterestHelper.register(
ELECTRICIAN_ID, 1, 1, TRContent.Machine.SOLID_FUEL_GENERATOR.block); ELECTRICIAN_ID, 1, 1, TRContent.Machine.SOLID_FUEL_GENERATOR.block
);
public static final VillagerProfession METALLURGIST_PROFESSION = Registry.register(Registry.VILLAGER_PROFESSION, METALLURGIST_ID, public static final VillagerProfession METALLURGIST_PROFESSION = Registry.register(Registry.VILLAGER_PROFESSION, METALLURGIST_ID,
VillagerProfessionBuilder.create().id(METALLURGIST_ID).workstation(RegistryKey.of(Registry.POINT_OF_INTEREST_TYPE_KEY, METALLURGIST_ID)).workSound(SoundEvents.ENTITY_VILLAGER_WORK_TOOLSMITH).build()); VillagerProfessionBuilder.create()
.id(METALLURGIST_ID)
.workstation(RegistryKey.of(Registry.POINT_OF_INTEREST_TYPE_KEY, METALLURGIST_ID))
.workSound(SoundEvents.ENTITY_VILLAGER_WORK_TOOLSMITH)
.build()
);
public static final VillagerProfession ELECTRICIAN_PROFESSION = Registry.register(Registry.VILLAGER_PROFESSION, ELECTRICIAN_ID, public static final VillagerProfession ELECTRICIAN_PROFESSION = Registry.register(Registry.VILLAGER_PROFESSION, ELECTRICIAN_ID,
VillagerProfessionBuilder.create().id(ELECTRICIAN_ID).workstation(RegistryKey.of(Registry.POINT_OF_INTEREST_TYPE_KEY, ELECTRICIAN_ID)).workSound(ModSounds.CABLE_SHOCK).build()); VillagerProfessionBuilder.create()
.id(ELECTRICIAN_ID)
.workstation(RegistryKey.of(Registry.POINT_OF_INTEREST_TYPE_KEY, ELECTRICIAN_ID))
.workSound(ModSounds.CABLE_SHOCK)
.build()
);
private TRVillager() {/* No instantiation. */} private TRVillager() {/* No instantiation. */}