Clean repo for open source release

Remove build artifacts, dev tool configs, unused dependencies,
and third-party source dumps. Add proper README, update .gitignore,
clean up Makefile.
This commit is contained in:
NotEvil
2026-04-12 00:51:22 +02:00
parent 2e7a1d403b
commit f6466360b6
1947 changed files with 238025 additions and 1 deletions

View File

@@ -0,0 +1,231 @@
package com.tiedup.remake.util.tasks;
import javax.annotation.Nullable;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.registries.ForgeRegistries;
/**
* Represents an item task (for jobs and sales).
*
* Phase 14.3.5: Task system for jobs and sales
*
* An ItemTask defines:
* - What item is needed (by registry name)
* - How many are needed
*
* Used by:
* - Sale system: Price to buy a slave
* - Job system: Items slave must fetch
*
* Based on original ItemTask from 1.12.2
*/
public class ItemTask {
/** The item registry name (e.g., "minecraft:iron_ingot") */
private final String itemId;
/** The amount required */
private final int amount;
/** Cached item reference */
@Nullable
private transient Item cachedItem;
/**
* Create a new item task.
*
* @param itemId The item registry name
* @param amount The amount required
*/
public ItemTask(String itemId, int amount) {
this.itemId = itemId;
this.amount = Math.max(1, amount);
this.cachedItem = null;
}
/**
* Create a new item task from an Item.
*
* @param item The item
* @param amount The amount required
*/
public ItemTask(Item item, int amount) {
ResourceLocation key = ForgeRegistries.ITEMS.getKey(item);
this.itemId = key != null ? key.toString() : "minecraft:air";
this.amount = Math.max(1, amount);
this.cachedItem = item;
}
/**
* Create a new item task from an ItemStack.
*
* @param stack The item stack (amount is used)
*/
public ItemTask(ItemStack stack) {
this(stack.getItem(), stack.getCount());
}
// ========================================
// GETTERS
// ========================================
public String getItemId() {
return itemId;
}
public int getAmount() {
return amount;
}
/**
* Get the Item instance.
*
* @return The Item or null if not found
*/
@Nullable
public Item getItem() {
if (this.cachedItem == null) {
ResourceLocation loc = ResourceLocation.tryParse(this.itemId);
if (loc != null) {
this.cachedItem = ForgeRegistries.ITEMS.getValue(loc);
}
}
return this.cachedItem;
}
/**
* Create an ItemStack of the required amount.
*
* @return ItemStack or empty if item not found
*/
public ItemStack createStack() {
Item item = getItem();
if (item == null) {
return ItemStack.EMPTY;
}
return new ItemStack(item, this.amount);
}
/**
* Get display name for the item.
*
* @return Display name or item ID if not found
*/
public String getDisplayName() {
Item item = getItem();
if (item == null) {
return this.itemId;
}
return new ItemStack(item).getHoverName().getString();
}
// ========================================
// VALIDATION
// ========================================
/**
* Check if an ItemStack matches this task (same item type).
*
* @param stack The stack to check
* @return true if same item type
*/
public boolean matchesItem(ItemStack stack) {
if (stack.isEmpty()) return false;
Item item = getItem();
if (item == null) return false;
return stack.getItem() == item;
}
/**
* Check if an ItemStack completes this task (same item, enough amount).
*
* @param stack The stack to check
* @return true if completes the task
*/
public boolean isCompletedBy(ItemStack stack) {
return matchesItem(stack) && stack.getCount() >= this.amount;
}
/**
* Consume the required items from a stack.
*
* @param stack The stack to consume from
* @return true if consumed successfully
*/
public boolean consumeFrom(ItemStack stack) {
if (!isCompletedBy(stack)) {
return false;
}
stack.shrink(this.amount);
return true;
}
// ========================================
// NBT SERIALIZATION
// ========================================
/**
* Save this task to NBT.
*
* @return CompoundTag with task data
*/
public CompoundTag save() {
CompoundTag tag = new CompoundTag();
tag.putString("item", this.itemId);
tag.putInt("amount", this.amount);
return tag;
}
/**
* Load a task from NBT.
*
* @param tag The CompoundTag to load from
* @return ItemTask or null if invalid
*/
@Nullable
public static ItemTask load(CompoundTag tag) {
if (tag == null || !tag.contains("item")) {
return null;
}
String itemId = tag.getString("item");
int amount = tag.contains("amount") ? tag.getInt("amount") : 1;
return new ItemTask(itemId, amount);
}
// ========================================
// DISPLAY
// ========================================
/**
* Get a display string for this task.
*
* @return String like "20x Iron Ingot"
*/
public String toDisplayString() {
return this.amount + "x " + getDisplayName();
}
@Override
public String toString() {
return "ItemTask{" + this.amount + "x " + this.itemId + "}";
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (!(obj instanceof ItemTask other)) return false;
return this.amount == other.amount && this.itemId.equals(other.itemId);
}
@Override
public int hashCode() {
return 31 * this.itemId.hashCode() + this.amount;
}
}

View File

@@ -0,0 +1,148 @@
package com.tiedup.remake.util.tasks;
import com.tiedup.remake.core.TiedUpMod;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* Loads and manages job tasks for slave work system.
*
* Phase 14.3.5: Job system
*
* A job is an ItemTask that a slave must complete
* (fetch X items) within a time limit or face punishment.
*
* Based on original JobLoader from 1.12.2
*/
public class JobLoader {
private static final Random RANDOM = new Random();
/** List of available jobs */
private static final List<ItemTask> JOBS = new ArrayList<>();
/** Whether jobs have been initialized */
private static boolean initialized = false;
/**
* Initialize default jobs.
* Called on mod initialization.
*/
public static void init() {
if (initialized) return;
// Default jobs - common gathering tasks
// Easy jobs
JOBS.add(new ItemTask("minecraft:cobblestone", 16));
JOBS.add(new ItemTask("minecraft:dirt", 16));
JOBS.add(new ItemTask("minecraft:oak_log", 8));
JOBS.add(new ItemTask("minecraft:wheat", 10));
JOBS.add(new ItemTask("minecraft:potato", 10));
JOBS.add(new ItemTask("minecraft:carrot", 10));
JOBS.add(new ItemTask("minecraft:apple", 5));
// Medium jobs
JOBS.add(new ItemTask("minecraft:iron_ore", 5));
JOBS.add(new ItemTask("minecraft:coal", 10));
JOBS.add(new ItemTask("minecraft:raw_iron", 5));
JOBS.add(new ItemTask("minecraft:raw_copper", 10));
JOBS.add(new ItemTask("minecraft:leather", 5));
JOBS.add(new ItemTask("minecraft:string", 8));
JOBS.add(new ItemTask("minecraft:paper", 10));
JOBS.add(new ItemTask("minecraft:book", 3));
// Hard jobs
JOBS.add(new ItemTask("minecraft:raw_gold", 3));
JOBS.add(new ItemTask("minecraft:diamond", 1));
JOBS.add(new ItemTask("minecraft:emerald", 1));
JOBS.add(new ItemTask("minecraft:blaze_rod", 2));
JOBS.add(new ItemTask("minecraft:ender_pearl", 2));
JOBS.add(new ItemTask("minecraft:obsidian", 4));
initialized = true;
TiedUpMod.LOGGER.info(
"[JobLoader] Loaded {} default jobs",
JOBS.size()
);
}
/**
* Get a random job task.
*
* @return Random ItemTask for a job
*/
public static ItemTask getRandomJob() {
if (JOBS.isEmpty()) {
// Fallback if not initialized
return new ItemTask("minecraft:cobblestone", 16);
}
return JOBS.get(RANDOM.nextInt(JOBS.size()));
}
/**
* Get a random job from a difficulty tier.
*
* @param difficulty 0 = easy, 1 = medium, 2 = hard
* @return Random ItemTask from that tier
*/
public static ItemTask getRandomJob(int difficulty) {
if (JOBS.isEmpty()) {
return new ItemTask("minecraft:cobblestone", 16);
}
// Simple tier system based on list indices
int tierSize = JOBS.size() / 3;
int startIndex = difficulty * tierSize;
int endIndex = Math.min(startIndex + tierSize, JOBS.size());
if (startIndex >= JOBS.size()) {
startIndex = 0;
endIndex = tierSize;
}
int range = endIndex - startIndex;
if (range <= 0) range = 1;
return JOBS.get(startIndex + RANDOM.nextInt(range));
}
/**
* Get all available jobs.
*
* @return List of all jobs
*/
public static List<ItemTask> getAllJobs() {
return new ArrayList<>(JOBS);
}
/**
* Check if jobs are available.
*
* @return true if at least one job is configured
*/
public static boolean hasJobs() {
return !JOBS.isEmpty();
}
/**
* Add a custom job.
*
* @param job The job to add
*/
public static void addJob(ItemTask job) {
if (job != null) {
JOBS.add(job);
}
}
/**
* Clear all jobs (for reloading).
*/
public static void clear() {
JOBS.clear();
initialized = false;
}
}

View File

@@ -0,0 +1,103 @@
package com.tiedup.remake.util.tasks;
import com.tiedup.remake.core.TiedUpMod;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* Loads and manages sale prices for slave trading.
*
* Phase 14.3.5: Sale system
*
* Provides default sale prices and can be extended
* to load from config files in the future.
*
* Based on original SaleLoader from 1.12.2
*/
public class SaleLoader {
private static final Random RANDOM = new Random();
/** List of available sale prices */
private static final List<ItemTask> SALES = new ArrayList<>();
/** Whether sales have been initialized */
private static boolean initialized = false;
/**
* Initialize default sales.
* Called on mod initialization.
*/
public static void init() {
if (initialized) return;
// Default sale prices
SALES.add(new ItemTask("minecraft:iron_ingot", 10));
SALES.add(new ItemTask("minecraft:iron_ingot", 20));
SALES.add(new ItemTask("minecraft:gold_ingot", 10));
SALES.add(new ItemTask("minecraft:gold_ingot", 15));
SALES.add(new ItemTask("minecraft:diamond", 3));
SALES.add(new ItemTask("minecraft:diamond", 5));
SALES.add(new ItemTask("minecraft:emerald", 5));
SALES.add(new ItemTask("minecraft:emerald", 10));
initialized = true;
TiedUpMod.LOGGER.info(
"[SaleLoader] Loaded {} default sales",
SALES.size()
);
}
/**
* Get a random sale price.
*
* @return Random ItemTask for sale price
*/
public static ItemTask getRandomSale() {
if (SALES.isEmpty()) {
// Fallback if not initialized
return new ItemTask("minecraft:iron_ingot", 10);
}
return SALES.get(RANDOM.nextInt(SALES.size()));
}
/**
* Get all available sale prices.
*
* @return List of all sales
*/
public static List<ItemTask> getAllSales() {
return new ArrayList<>(SALES);
}
/**
* Check if sales are available.
*
* @return true if at least one sale is configured
*/
public static boolean hasSales() {
return !SALES.isEmpty();
}
/**
* Add a custom sale price.
*
* @param sale The sale to add
*/
public static void addSale(ItemTask sale) {
if (sale != null) {
SALES.add(sale);
}
}
/**
* Clear all sales (for reloading).
*/
public static void clear() {
SALES.clear();
initialized = false;
}
}