mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 07:13:28 +01:00
Add the Engineer villager back
This commit is contained in:
parent
4cc4b40c4b
commit
2a2f5c6cdc
16 changed files with 205 additions and 58 deletions
|
@ -1,2 +1,2 @@
|
|||
// 1.20.4 2024-03-04T22:51:31.6174299 Sound Definitions
|
||||
5492914eb97f792a830608d663aaf3148987ed3e assets/actuallyadditions/sounds.json
|
||||
// 1.20.4 2024-03-11T20:19:22.9008098 Sound Definitions
|
||||
e7a33758b55803bd59c68b8024cb8484dd4f060f assets/actuallyadditions/sounds.json
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
// 1.20.4 2024-03-11T20:41:48.609238 Tags for minecraft:point_of_interest_type mod id actuallyadditions
|
||||
65352c4eaf105efa72687c568c2d5b5f5fd11996 data/minecraft/tags/point_of_interest_type/acquirable_job_site.json
|
|
@ -18,5 +18,10 @@
|
|||
"sounds": [
|
||||
"actuallyadditions:reconstructor"
|
||||
]
|
||||
},
|
||||
"villager.work_engineer": {
|
||||
"sounds": [
|
||||
"actuallyadditions:coffee_machine"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"values": [
|
||||
"actuallyadditions:engineer"
|
||||
]
|
||||
}
|
|
@ -46,6 +46,7 @@ public class ActuallyAdditionsData {
|
|||
generator.addProvider(true, new ItemRecipeGenerator(packOutput));
|
||||
generator.addProvider(true, generatorBlockTags);
|
||||
generator.addProvider(true, new ItemTagsGenerator(packOutput, lookupProvider, generatorBlockTags, helper));
|
||||
generator.addProvider(true, new PoiTypeTagsGenerator(packOutput, lookupProvider, helper));
|
||||
generator.addProvider(true, new DamageTypeTagsGenerator(packOutput, lookupProvider, helper));
|
||||
|
||||
generator.addProvider(true, new BlockStateGenerator(packOutput, helper));
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package de.ellpeck.actuallyadditions.data;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.gen.village.ActuallyPOITypes;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.data.tags.PoiTypeTagsProvider;
|
||||
import net.minecraft.tags.PoiTypeTags;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class PoiTypeTagsGenerator extends PoiTypeTagsProvider {
|
||||
public PoiTypeTagsGenerator(PackOutput output, CompletableFuture<HolderLookup.Provider> completableFuture, @Nullable ExistingFileHelper fileHelper) {
|
||||
super(output, completableFuture, ActuallyAdditions.MODID, fileHelper);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addTags(HolderLookup.Provider pProvider) {
|
||||
this.tag(PoiTypeTags.ACQUIRABLE_JOB_SITE)
|
||||
.add(
|
||||
ActuallyPOITypes.ENGINEER.getKey()
|
||||
);
|
||||
}
|
||||
}
|
|
@ -19,5 +19,6 @@ public class SoundsGenerator extends SoundDefinitionsProvider {
|
|||
add(AASounds.CRUSHER, definition().with(sound(new ResourceLocation(ActuallyAdditions.MODID, "crusher"))));
|
||||
add(AASounds.COFFEE_MACHINE, definition().with(sound(new ResourceLocation(ActuallyAdditions.MODID, "coffee_machine"))));
|
||||
add(AASounds.DUH_DUH_DUH_DUUUH, definition().with(sound(new ResourceLocation(ActuallyAdditions.MODID, "duh_duh_duh_duuuh"))));
|
||||
add(AASounds.VILLAGER_WORK_ENGINEER, definition().with(sound(new ResourceLocation(ActuallyAdditions.MODID, "coffee_machine"))));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ public class AASounds {
|
|||
public static DeferredHolder<SoundEvent, SoundEvent> CRUSHER = SOUNDS.register("crusher", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ActuallyAdditions.MODID, "crusher")));
|
||||
public static DeferredHolder<SoundEvent, SoundEvent> COFFEE_MACHINE = SOUNDS.register("coffee_machine", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ActuallyAdditions.MODID, "coffee_machine")));
|
||||
public static DeferredHolder<SoundEvent, SoundEvent> DUH_DUH_DUH_DUUUH = SOUNDS.register("duh_duh_duh_duuuh", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ActuallyAdditions.MODID, "duh_duh_duh_duuuh")));
|
||||
public static DeferredHolder<SoundEvent, SoundEvent> VILLAGER_WORK_ENGINEER = SOUNDS.register("villager.work_engineer", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ActuallyAdditions.MODID, "villager.work_engineer")));
|
||||
|
||||
|
||||
public static void init(IEventBus bus) {
|
||||
|
|
|
@ -28,6 +28,9 @@ import de.ellpeck.actuallyadditions.mod.event.CommonEvents;
|
|||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||
import de.ellpeck.actuallyadditions.mod.gen.ActuallyVillages;
|
||||
import de.ellpeck.actuallyadditions.mod.gen.modifier.BoolConfigFeatureBiomeModifier;
|
||||
import de.ellpeck.actuallyadditions.mod.gen.village.ActuallyPOITypes;
|
||||
import de.ellpeck.actuallyadditions.mod.gen.village.ActuallyVillagers;
|
||||
import de.ellpeck.actuallyadditions.mod.gen.village.InitVillager;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
|
||||
|
@ -110,6 +113,8 @@ public class ActuallyAdditions {
|
|||
ActuallyTabs.init(eventBus);
|
||||
ActuallyRecipes.init(eventBus);
|
||||
AASounds.init(eventBus);
|
||||
ActuallyVillagers.init(eventBus);
|
||||
ActuallyPOITypes.init(eventBus);
|
||||
ActuallyAttachments.init(eventBus);
|
||||
ActuallyContainers.CONTAINERS.register(eventBus);
|
||||
ENTITIES.register(eventBus);
|
||||
|
@ -121,6 +126,7 @@ public class ActuallyAdditions {
|
|||
|
||||
NeoForge.EVENT_BUS.addListener(this::serverStarted);
|
||||
NeoForge.EVENT_BUS.addListener(this::serverStopped);
|
||||
NeoForge.EVENT_BUS.addListener(InitVillager::setupTrades);
|
||||
NeoForge.EVENT_BUS.register(new CommonEvents());
|
||||
// NeoForge.EVENT_BUS.register(new DungeonLoot());
|
||||
NeoForge.EVENT_BUS.addListener(ActuallyAdditions::reloadEvent);
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package de.ellpeck.actuallyadditions.mod.gen.village;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.world.entity.ai.village.poi.PoiType;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ActuallyPOITypes {
|
||||
public static final DeferredRegister<PoiType> POI_TYPES = DeferredRegister.create(BuiltInRegistries.POINT_OF_INTEREST_TYPE, ActuallyAdditions.MODID);
|
||||
|
||||
public static DeferredHolder<PoiType, PoiType> ENGINEER = POI_TYPES.register("engineer", () -> new PoiType(ImmutableSet.copyOf(ActuallyBlocks.COFFEE_MACHINE.get().getStateDefinition().getPossibleStates()), 1, 1));
|
||||
|
||||
public static void init(IEventBus bus) {
|
||||
POI_TYPES.register(bus);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package de.ellpeck.actuallyadditions.mod.gen.village;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import de.ellpeck.actuallyadditions.mod.AASounds;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.world.entity.npc.VillagerProfession;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ActuallyVillagers {
|
||||
public static final DeferredRegister<VillagerProfession> VILLAGER_PROFESSIONS = DeferredRegister.create(BuiltInRegistries.VILLAGER_PROFESSION, ActuallyAdditions.MODID);
|
||||
public static final Supplier<VillagerProfession> ENGINEER = VILLAGER_PROFESSIONS.register("engineer", () -> new VillagerProfession("engineer", holder -> holder.value().equals(ActuallyPOITypes.ENGINEER.get()), holder -> holder.value().equals(ActuallyPOITypes.ENGINEER.get()), ImmutableSet.of(), ImmutableSet.of(), AASounds.VILLAGER_WORK_ENGINEER.get()));
|
||||
|
||||
public static void init(IEventBus bus) {
|
||||
VILLAGER_PROFESSIONS.register(bus);
|
||||
}
|
||||
}
|
|
@ -1,53 +1,86 @@
|
|||
///*
|
||||
// * This file ("BasicTradeList.java") is part of the Actually Additions mod for Minecraft.
|
||||
// * It is created and owned by Ellpeck and distributed
|
||||
// * under the Actually Additions License to be found at
|
||||
// * http://ellpeck.de/actaddlicense
|
||||
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
// *
|
||||
// * © 2015-2017 Ellpeck
|
||||
// */
|
||||
//
|
||||
//package de.ellpeck.actuallyadditions.mod.gen.village;
|
||||
//
|
||||
//import java.util.Random;
|
||||
//
|
||||
//import net.minecraft.entity.IMerchant;
|
||||
//import net.minecraft.entity.passive.EntityVillager.ITradeList;
|
||||
//import net.minecraft.entity.passive.EntityVillager.PriceInfo;
|
||||
//import net.minecraft.init.Items;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.village.MerchantRecipe;
|
||||
//import net.minecraft.village.MerchantRecipeList;
|
||||
//
|
||||
//public class BasicTradeList implements ITradeList {
|
||||
//
|
||||
// private final ItemStack input;
|
||||
// private final PriceInfo inputAmount;
|
||||
// private final ItemStack stack;
|
||||
// private final PriceInfo outputAmount;
|
||||
//
|
||||
// public BasicTradeList(ItemStack input, PriceInfo inputAmount, ItemStack stack, PriceInfo outputAmount) {
|
||||
// this.input = input;
|
||||
// this.inputAmount = inputAmount;
|
||||
// this.stack = stack;
|
||||
// this.outputAmount = outputAmount;
|
||||
// }
|
||||
//
|
||||
// public BasicTradeList(PriceInfo emeraldInput, ItemStack stack, PriceInfo outputAmount) {
|
||||
// this(new ItemStack(Items.EMERALD), emeraldInput, stack, outputAmount);
|
||||
// }
|
||||
//
|
||||
// public BasicTradeList(ItemStack input, PriceInfo inputAmount, PriceInfo emeraldOutput) {
|
||||
// this(input, inputAmount, new ItemStack(Items.EMERALD), emeraldOutput);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random) {
|
||||
// ItemStack in = this.input.copy();
|
||||
// in.setCount(this.inputAmount.getPrice(random));
|
||||
// ItemStack out = this.stack.copy();
|
||||
// out.setCount(this.outputAmount.getPrice(random));
|
||||
// recipeList.add(new MerchantRecipe(in, out));
|
||||
// }
|
||||
//}
|
||||
/*
|
||||
* This file ("BasicTradeList.java") is part of the Actually Additions mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015-2017 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.gen.village;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.npc.VillagerTrades;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.trading.MerchantOffer;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class BasicTradeList implements VillagerTrades.ItemListing {
|
||||
|
||||
private final ItemStack input;
|
||||
private final PriceRange inputAmount;
|
||||
private final ItemStack stack;
|
||||
private final PriceRange outputAmount;
|
||||
private int maxUses = 3;
|
||||
private int villagerXp = 15;
|
||||
private float priceMultiplier = 0.05F;
|
||||
|
||||
public BasicTradeList(ItemStack input, PriceRange inputAmount, ItemStack stack, PriceRange outputAmount) {
|
||||
this.input = input;
|
||||
this.inputAmount = inputAmount;
|
||||
this.stack = stack;
|
||||
this.outputAmount = outputAmount;
|
||||
}
|
||||
|
||||
public BasicTradeList(PriceRange emeraldInput, ItemStack stack, PriceRange outputAmount) {
|
||||
this(new ItemStack(Items.EMERALD), emeraldInput, stack, outputAmount);
|
||||
}
|
||||
|
||||
public BasicTradeList(ItemStack input, PriceRange inputAmount, PriceRange emeraldOutput) {
|
||||
this(input, inputAmount, new ItemStack(Items.EMERALD), emeraldOutput);
|
||||
}
|
||||
|
||||
public BasicTradeList withMaxUses(int maxUses) {
|
||||
this.maxUses = maxUses;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BasicTradeList withVillagerXp(int villagerXp) {
|
||||
this.villagerXp = villagerXp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BasicTradeList withPriceMultiplier(float priceMultiplier) {
|
||||
this.priceMultiplier = priceMultiplier;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public MerchantOffer getOffer(Entity trader, RandomSource random) {
|
||||
ItemStack in = this.input.copy();
|
||||
in.setCount(this.inputAmount.getPrice(random));
|
||||
ItemStack out = this.stack.copy();
|
||||
out.setCount(this.outputAmount.getPrice(random));
|
||||
return new MerchantOffer(in, out, this.maxUses, this.villagerXp, this.priceMultiplier);
|
||||
}
|
||||
|
||||
public static class PriceRange extends Tuple<Integer, Integer> {
|
||||
public PriceRange(int min, int max) {
|
||||
super(Integer.valueOf(min), Integer.valueOf(max));
|
||||
|
||||
if (max < min) {
|
||||
ActuallyAdditions.LOGGER.warn("PriceRange({}, {}) invalid, {} smaller than {}", Integer.valueOf(min), Integer.valueOf(max), Integer.valueOf(max), Integer.valueOf(min));
|
||||
}
|
||||
}
|
||||
|
||||
public int getPrice(RandomSource rand) {
|
||||
return this.getA() >= this.getB() ? this.getA() : this.getA() + rand.nextInt(this.getB() - this.getA() + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,9 +10,29 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.gen.village;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import net.minecraft.world.entity.npc.VillagerTrades;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.neoforged.neoforge.event.village.VillagerTradesEvent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// TODO: [port] ADD BACK
|
||||
public final class InitVillager {
|
||||
//
|
||||
public static void setupTrades(VillagerTradesEvent event) {
|
||||
if (event.getType() == ActuallyVillagers.ENGINEER.get()) {
|
||||
Int2ObjectMap<List<VillagerTrades.ItemListing>> trades = event.getTrades();
|
||||
|
||||
trades.put(1, List.of(new BasicTradeList(new BasicTradeList.PriceRange(1, 2), new ItemStack(ActuallyBlocks.BLACK_QUARTZ_ORE.get()), new BasicTradeList.PriceRange(2, 3)), new BasicTradeList(new BasicTradeList.PriceRange(1, 2), new ItemStack(ActuallyItems.BLACK_QUARTZ.get()), new BasicTradeList.PriceRange(6, 8)), new BasicTradeList(new BasicTradeList.PriceRange(1, 3), new ItemStack(ActuallyItems.LASER_WRENCH.get()), new BasicTradeList.PriceRange(1, 1))));
|
||||
trades.put(2, List.of(new BasicTradeList(new ItemStack(ActuallyItems.COFFEE_BEANS.get()), new BasicTradeList.PriceRange(20, 30), new BasicTradeList.PriceRange(1, 2)), new BasicTradeList(new BasicTradeList.PriceRange(3, 5), new ItemStack(ActuallyBlocks.ITEM_INTERFACE.get()), new BasicTradeList.PriceRange(1, 1)), new BasicTradeList(new BasicTradeList.PriceRange(10, 20), new ItemStack(ActuallyBlocks.LASER_RELAY.get()), new BasicTradeList.PriceRange(1, 2))));
|
||||
trades.put(3, List.of(new BasicTradeList(new ItemStack(ActuallyBlocks.TINY_TORCH.get()), new BasicTradeList.PriceRange(30, 40), new BasicTradeList.PriceRange(1, 2)), new BasicTradeList(new BasicTradeList.PriceRange(1, 2), new ItemStack(ActuallyBlocks.WOOD_CASING.get()), new BasicTradeList.PriceRange(1, 2))));
|
||||
trades.put(4, List.of(new BasicTradeList(new BasicTradeList.PriceRange(3, 5), new ItemStack(ActuallyBlocks.IRON_CASING.get()), new BasicTradeList.PriceRange(1, 2)), new BasicTradeList(new ItemStack(ActuallyBlocks.EMPOWERER.get()), new BasicTradeList.PriceRange(1, 1), new BasicTradeList.PriceRange(15, 20)), new BasicTradeList(new BasicTradeList.PriceRange(30, 40), new ItemStack(ActuallyBlocks.LASER_RELAY_EXTREME.get()), new BasicTradeList.PriceRange(1, 1))));
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// public static VillagerProfession jamProfession;
|
||||
// public static VillagerProfession engineerProfession;
|
||||
//
|
||||
|
|
|
@ -5,4 +5,6 @@ public-f net.minecraft.world.level.levelgen.structure.templatesystem.StructurePr
|
|||
public net.minecraft.world.item.crafting.ShapedRecipe pattern
|
||||
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
|
||||
public-f net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool rawTemplates
|
||||
public net.minecraft.world.entity.npc.VillagerTrades$ItemsForEmeralds
|
||||
public net.minecraft.world.entity.npc.VillagerTrades$EmeraldForItems
|
|
@ -26,7 +26,7 @@
|
|||
"_comment": "Entities",
|
||||
"entity.Villager.actuallyadditions.jammer": "Jam Guy",
|
||||
"entity.Villager.actuallyadditions.crystallizer": "Crystallizer",
|
||||
"entity.Villager.actuallyadditions.engineer": "Engineer",
|
||||
"entity.minecraft.villager.actuallyadditions.engineer": "Engineer",
|
||||
"_comment": "Banners",
|
||||
"item.banner.actuallyadditionsBook.black": "Black Actually Additions Manual Pattern",
|
||||
"item.banner.actuallyadditionsBook.red": "Red Actually Additions Manual Pattern",
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
Loading…
Reference in a new issue