-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Basic UI for villager advancement
Done: - Added fisher - Fixed bug in time-based jobs TODO: - Indicate "dining" and "seeking work" in UI - Remove dirt cheat to open advancement UI - 3 tiers of gatherer advancement - Experience and blocks of progress
- Loading branch information
Showing
17 changed files
with
359 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
src/main/java/ca/bradj/questown/jobs/gatherer/GathererUnmappedFullDayAxeWork.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
package ca.bradj.questown.jobs.gatherer; | ||
|
||
import ca.bradj.questown.core.Config; | ||
import ca.bradj.questown.core.init.TagsInit; | ||
import ca.bradj.questown.integration.minecraft.MCHeldItem; | ||
import ca.bradj.questown.jobs.JobID; | ||
import ca.bradj.questown.jobs.SpecialRules; | ||
import ca.bradj.questown.jobs.Work; | ||
import ca.bradj.questown.jobs.production.ProductionStatus; | ||
import ca.bradj.questown.mc.Util; | ||
import com.google.common.collect.ImmutableMap; | ||
import net.minecraft.server.level.ServerLevel; | ||
import net.minecraft.world.item.Items; | ||
import net.minecraft.world.item.crafting.Ingredient; | ||
|
||
import java.util.Collection; | ||
|
||
public class GathererUnmappedFullDayAxeWork extends NewLeaverWork { | ||
|
||
private static final GathererTools.LootTableParameters PARAMS = new GathererTools.LootTableParameters( | ||
GathererTools.AXE_LOOT_TABLE_PREFIX, | ||
GathererTools.AXE_LOOT_TABLE_DEFAULT | ||
); | ||
|
||
static { | ||
allParameters.add(PARAMS); | ||
} | ||
|
||
public static final JobID ID = new JobID("gatherer", "axe_full_day"); | ||
|
||
public static final int BLOCK_STATE_NEED_FOOD = 0; | ||
public static final int BLOCK_STATE_NEED_TOOL = 1; | ||
public static final int BLOCK_STATE_NEED_ROAM = 2; | ||
public static final int BLOCK_STATE_DONE = 3; | ||
|
||
public static final int MAX_STATE = BLOCK_STATE_DONE; | ||
|
||
public static final ImmutableMap<Integer, Ingredient> INGREDIENTS_REQUIRED_AT_STATES = ImmutableMap.of( | ||
BLOCK_STATE_NEED_FOOD, Ingredient.of(TagsInit.Items.VILLAGER_FOOD) | ||
); | ||
public static final ImmutableMap<Integer, Integer> INGREDIENT_QTY_REQUIRED_AT_STATES = ImmutableMap.of( | ||
BLOCK_STATE_NEED_FOOD, 3 | ||
); | ||
public static final ImmutableMap<Integer, Ingredient> TOOLS_REQUIRED_AT_STATES = ImmutableMap.of( | ||
BLOCK_STATE_NEED_TOOL, Ingredient.of(TagsInit.Items.AXES) | ||
); | ||
public static final ImmutableMap<Integer, Integer> WORK_REQUIRED_AT_STATES = ImmutableMap.of( | ||
// No work required | ||
); | ||
public static final ImmutableMap<ProductionStatus, String> SPECIAL_RULES = ImmutableMap.of( | ||
ProductionStatus.fromJobBlockStatus(BLOCK_STATE_NEED_ROAM), SpecialRules.REMOVE_FROM_WORLD, | ||
ProductionStatus.FACTORY.waitingForTimedState(), SpecialRules.REMOVE_FROM_WORLD | ||
); | ||
|
||
public GathererUnmappedFullDayAxeWork() { | ||
super(PARAMS); | ||
} | ||
|
||
public static Work asWork() { | ||
return NewLeaverWork.asWork( | ||
ID, | ||
GathererUnmappedHalfDayAxeWork.ID, // Parent | ||
Items.GOLDEN_AXE.getDefaultInstance(), | ||
GathererTools.AXE_LOOT_TABLE_PREFIX, | ||
Items.OAK_WOOD.getDefaultInstance(), | ||
MAX_STATE, | ||
Util.constant(INGREDIENTS_REQUIRED_AT_STATES), | ||
Util.constant(INGREDIENT_QTY_REQUIRED_AT_STATES), | ||
Util.constant(TOOLS_REQUIRED_AT_STATES), | ||
Util.constant(WORK_REQUIRED_AT_STATES), | ||
ImmutableMap.of( | ||
BLOCK_STATE_NEED_ROAM, () -> Config.GATHERER_TIME_REQUIRED_BASELINE.get() * 3 | ||
), | ||
SPECIAL_RULES, | ||
GathererUnmappedFullDayAxeWork::getFromLootTables | ||
); | ||
} | ||
|
||
// Note: this is still declarative. In a file, we would just specify something like: | ||
// - Strategy: "loot_tables" | ||
// - Prefix: "jobs/axe" | ||
// - Default "jobs/axe/default" | ||
private static Iterable<MCHeldItem> getFromLootTables( | ||
ServerLevel level, | ||
Collection<MCHeldItem> items | ||
) { | ||
return Loots.getFromLootTables( | ||
level, | ||
items, | ||
6, | ||
new GathererTools.LootTableParameters( | ||
GathererTools.AXE_LOOT_TABLE_PREFIX, GathererTools.AXE_LOOT_TABLE_DEFAULT | ||
) | ||
); | ||
} | ||
} |
96 changes: 96 additions & 0 deletions
96
src/main/java/ca/bradj/questown/jobs/gatherer/GathererUnmappedHalfDayAxeWork.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
package ca.bradj.questown.jobs.gatherer; | ||
|
||
import ca.bradj.questown.core.Config; | ||
import ca.bradj.questown.core.init.TagsInit; | ||
import ca.bradj.questown.integration.minecraft.MCHeldItem; | ||
import ca.bradj.questown.jobs.JobID; | ||
import ca.bradj.questown.jobs.SpecialRules; | ||
import ca.bradj.questown.jobs.Work; | ||
import ca.bradj.questown.jobs.production.ProductionStatus; | ||
import ca.bradj.questown.mc.Util; | ||
import com.google.common.collect.ImmutableMap; | ||
import net.minecraft.server.level.ServerLevel; | ||
import net.minecraft.world.item.Items; | ||
import net.minecraft.world.item.crafting.Ingredient; | ||
|
||
import java.util.Collection; | ||
|
||
public class GathererUnmappedHalfDayAxeWork extends NewLeaverWork { | ||
|
||
private static final GathererTools.LootTableParameters PARAMS = new GathererTools.LootTableParameters( | ||
GathererTools.AXE_LOOT_TABLE_PREFIX, | ||
GathererTools.AXE_LOOT_TABLE_DEFAULT | ||
); | ||
|
||
static { | ||
allParameters.add(PARAMS); | ||
} | ||
|
||
public static final JobID ID = new JobID("gatherer", "axe_half_day"); | ||
|
||
public static final int BLOCK_STATE_NEED_FOOD = 0; | ||
public static final int BLOCK_STATE_NEED_TOOL = 1; | ||
public static final int BLOCK_STATE_NEED_ROAM = 2; | ||
public static final int BLOCK_STATE_DONE = 3; | ||
|
||
public static final int MAX_STATE = BLOCK_STATE_DONE; | ||
|
||
public static final ImmutableMap<Integer, Ingredient> INGREDIENTS_REQUIRED_AT_STATES = ImmutableMap.of( | ||
BLOCK_STATE_NEED_FOOD, Ingredient.of(TagsInit.Items.VILLAGER_FOOD) | ||
); | ||
public static final ImmutableMap<Integer, Integer> INGREDIENT_QTY_REQUIRED_AT_STATES = ImmutableMap.of( | ||
BLOCK_STATE_NEED_FOOD, 2 | ||
); | ||
public static final ImmutableMap<Integer, Ingredient> TOOLS_REQUIRED_AT_STATES = ImmutableMap.of( | ||
BLOCK_STATE_NEED_TOOL, Ingredient.of(TagsInit.Items.AXES) | ||
); | ||
public static final ImmutableMap<Integer, Integer> WORK_REQUIRED_AT_STATES = ImmutableMap.of( | ||
// No work required | ||
); | ||
public static final ImmutableMap<ProductionStatus, String> SPECIAL_RULES = ImmutableMap.of( | ||
ProductionStatus.fromJobBlockStatus(BLOCK_STATE_NEED_ROAM), SpecialRules.REMOVE_FROM_WORLD, | ||
ProductionStatus.FACTORY.waitingForTimedState(), SpecialRules.REMOVE_FROM_WORLD | ||
); | ||
|
||
public GathererUnmappedHalfDayAxeWork() { | ||
super(PARAMS); | ||
} | ||
|
||
public static Work asWork() { | ||
return NewLeaverWork.asWork( | ||
ID, | ||
GathererUnmappedAxeWork.ID, // Parent | ||
Items.IRON_AXE.getDefaultInstance(), | ||
GathererTools.AXE_LOOT_TABLE_PREFIX, | ||
Items.OAK_WOOD.getDefaultInstance(), | ||
MAX_STATE, | ||
Util.constant(INGREDIENTS_REQUIRED_AT_STATES), | ||
Util.constant(INGREDIENT_QTY_REQUIRED_AT_STATES), | ||
Util.constant(TOOLS_REQUIRED_AT_STATES), | ||
Util.constant(WORK_REQUIRED_AT_STATES), | ||
ImmutableMap.of( | ||
BLOCK_STATE_NEED_ROAM, () -> Config.GATHERER_TIME_REQUIRED_BASELINE.get() * 2 | ||
), | ||
SPECIAL_RULES, | ||
GathererUnmappedHalfDayAxeWork::getFromLootTables | ||
); | ||
} | ||
|
||
// Note: this is still declarative. In a file, we would just specify something like: | ||
// - Strategy: "loot_tables" | ||
// - Prefix: "jobs/axe" | ||
// - Default "jobs/axe/default" | ||
private static Iterable<MCHeldItem> getFromLootTables( | ||
ServerLevel level, | ||
Collection<MCHeldItem> items | ||
) { | ||
return Loots.getFromLootTables( | ||
level, | ||
items, | ||
3, | ||
new GathererTools.LootTableParameters( | ||
GathererTools.AXE_LOOT_TABLE_PREFIX, GathererTools.AXE_LOOT_TABLE_DEFAULT | ||
) | ||
); | ||
} | ||
} |
Oops, something went wrong.