add first patch

This commit is contained in:
2026-07-31 10:34:32 +09:00
parent 03aac2e45e
commit b1cbc6c78d
6390 changed files with 547430 additions and 0 deletions
@@ -0,0 +1,914 @@
console.info("[SOCIETY] animalBase.js loaded");
const debug = false;
const debugData = (player, level, data, hearts) => {
player.tell(`:heart: ${data.getInt("affection")}-${hearts} hearts`);
player.tell(
`Day: ${Number(
(Math.floor(Number(level.dayTime() / 24000)) + 1).toFixed()
)}`
);
player.tell(`Mood: ${data.getInt("lastMood")}`);
player.tell(`Day Mood last set: ${data.getInt("ageLastSetMood")}`);
player.tell(`Pet: ${data.getInt("ageLastPet")}`);
player.tell(`Fed: ${data.getInt("ageLastFed")}`);
player.tell(`Boosted feed: ${data.getInt("ageLastBoosted")}`);
player.tell(`Dropped Special: ${data.getInt("ageLastDroppedSpecial")}`);
player.tell(`Milked: ${data.getInt("ageLastMilked")}`);
player.tell(`Magic Harvested: ${data.getInt("ageLastMagicHarvested")}`);
};
const initializeFarmAnimal = (day, target, level) => {
const data = target.persistentData;
if (!data.getInt("affection")) {
data.affection = 1;
level.spawnParticles(
"minecraft:heart",
true,
target.x,
target.y + 1.5,
target.z,
0,
0.1,
0,
1,
0.01
);
}
const newBaseDay = day - 1;
if (!data.getInt("ageLastPet")) data.ageLastPet = newBaseDay;
if (!data.getInt("ageLastFed")) data.ageLastFed = newBaseDay;
if (!data.getInt("ageLastDroppedSpecial")) data.ageLastDroppedSpecial = newBaseDay;
if (!data.getInt("ageLastMagicHarvested")) data.ageLastMagicHarvested = newBaseDay;
if (!data.getInt("ageLastMoodSet")) data.ageLastMoodSet = newBaseDay;
if (!data.getInt("ageLastBred")) data.ageLastBred = newBaseDay;
if (!data.getInt("ageLastMilked") && global.checkEntityTag(target, "society:milkable_animal"))
data.ageLastMilked = newBaseDay;
};
// Anti-frustration feature to be forgiving when re-logging
const handleFarmAnimalBackwardsCompat = (target, day) => {
const data = target.persistentData;
if (
day < data.getInt("ageLastPet") ||
data.getInt("ageLastPet") - day > 5000
) {
let newDay = day - 1;
data.ageLastPet = newDay;
data.ageLastMagicHarvested = newDay;
data.ageLastMilked = newDay;
data.ageLastDroppedSpecial = newDay;
data.ageLastBred = newDay;
data.ageLastFed = newDay;
data.ageLastMoodSet = newDay;
}
};
const checkAnimal = (
player,
level,
server,
data,
name,
mood,
hearts,
color
) => {
const nameColor = color || "#55FF55";
const heartsToDisplay = 10;
let icons = [];
if (mood < 64) icons.push("☹");
if (mood > 160) icons.push("☺");
if (data.animalCracker) icons.push("🡅");
if (data.clockwork) icons.push("⚙");
if (data.bff) icons.push("❤");
if (data.bribed) icons.push("💰");
let iconString = "";
icons.forEach((icon, index) => {
iconString += icon;
if (index < icons.length - 1) iconString += " ";
});
global.renderUiText(
player,
server,
{
animalNameIcons: {
type: "text",
x: 0,
y: -88,
text: iconString,
color: nameColor,
alignX: "center",
alignY: "bottom",
},
animalName: {
type: "text",
x: 0,
y: -78,
text: `${name.noColor().toJson()}`,
color: nameColor,
alignX: "center",
alignY: "bottom",
},
animalNameShadow: {
type: "text",
x: 1,
z: -1,
y: -77,
text: `${name.noColor().toJson()}`,
color: "#000000",
alignX: "center",
alignY: "bottom",
},
affection: {
type: "text",
x: 0,
y: -66,
text: `§c${hearts > 0 ? ``.repeat(Math.min(hearts, heartsToDisplay)) : ""
}§0${hearts < heartsToDisplay ? ``.repeat(heartsToDisplay - hearts) : ""
}`,
color: "#FFAA00",
alignX: "center",
alignY: "bottom",
},
affectionShadow: {
type: "text",
x: 1,
z: -1,
y: -65,
text: ``.repeat(heartsToDisplay),
color: "#000000",
alignX: "center",
alignY: "bottom",
},
},
global.mainUiElementIds
);
debug && debugData(player, level, data, hearts);
};
const handlePet = (name, data, mood, day, peckish, hungry, e) => {
const { player, item, target, level, server } = e;
const ageLastPet = data.getInt("ageLastPet");
const affection = data.getInt("affection");
let hearts = Math.floor(affection / 100);
if (hearts > 10) hearts = 10;
else if (hearts < 0) hearts = 0;
let affectionIncreaseMult =
player.stages.has("animal_whisperer") || data.bribed ? 2 : 1;
if (player.stages.has("animal_fancy")) affectionIncreaseMult += 1;
let affectionIncrease = 10 * affectionIncreaseMult;
if (target.isBaby()) {
affectionIncrease =
affectionIncrease * (player.stages.has("fostering") ? 10 : 2);
}
let errorText = "";
if (day > ageLastPet) {
let livableArea = global.getAnimalIsNotCramped(target, 1.1);
if (!player.isFake()) {
debug &&
player.tell(
`Increased Affection by: ${affectionIncrease} from petting`
);
data.affection = affection + affectionIncrease;
}
if (hungry || (!data.clockwork && player.isFake()) || !livableArea) {
data.affection = affection - (hungry ? 15 : 25);
}
data.ageLastPet = day;
level.spawnParticles(
(!data.clockwork && player.isFake()) || hungry
? "minecraft:angry_villager"
: "minecraft:heart",
true,
target.x,
target.y + 1.5,
target.z,
0,
0.1,
0,
1,
0.01
);
global.giveExperience(server, player, "husbandry", Math.max(10, 20 * hearts));
if (!livableArea && !data.clockwork) {
errorText = Text.translatable(
"society.husbandry.crowded",
name
).toJson();
}
if (
!hungry &&
peckish &&
!player.isFake() &&
!item.hasTag("society:animal_feed")
) {
server.runCommandSilent(
global.getEmbersTextAPICommand(
player.username,
`{anchor:"BOTTOM_CENTER",background:1,wrap:220,align:"BOTTOM_CENTER",color:"#FFAA00",offsetY:20}`,
40,
Text.translatable("society.husbandry.peckish", name).toJson()
)
);
}
if (hungry) {
errorText = Text.translatable(
"society.husbandry.starved",
name
).toJson();
}
if (errorText && !player.isFake()) {
server.runCommandSilent(
global.getEmbersTextAPICommand(
player.username,
global.animalMessageSettings,
40,
errorText
)
);
}
} else if (item === "minecraft:air" || item === 'society:mood_scanner') {
let nameColor;
if (peckish) {
nameColor = "#FFAA00";
}
if (hungry) {
nameColor = "#FF5555";
}
checkAnimal(player, level, server, data, name, mood, hearts, nameColor);
}
// Raise Max health
const affectionHealth = hearts * 4;
if (target.maxHealth < affectionHealth) {
target.setMaxHealth(affectionHealth);
target.setHealth(affectionHealth);
}
};
const handleMilk = (name, data, day, hungry, e) => {
const { player, item, target, level, server } = e;
if (player.cooldowns.isOnCooldown(item)) return;
if (player.isFake() && data.getInt("affection") < 100) return;
let errorText;
let milkItem = global.getMilk(level, target, data, player, day, true, undefined, player.stages);
if (milkItem !== -1) {
let milk = level.createEntity("minecraft:item");
milk.x = player.x;
milk.y = player.y;
milk.z = player.z;
milk.item = milkItem;
milk.spawn();
server.runCommandSilent(
`playsound minecraft:entity.cow.milk block @a ${player.x} ${player.y} ${player.z}`
);
global.giveExperience(server, player, "husbandry", 30);
level.spawnParticles(
"minecraft:note",
true,
target.x,
target.y + 1.5,
target.z,
0.1 * rnd(1, 4),
0.1 * rnd(1, 4),
0.1 * rnd(1, 4),
3,
0.01
);
} else if (target.isBaby()) {
errorText = Text.translatable(
"society.husbandry.action.young",
name
).toJson();
} else if (hungry) {
errorText = Text.translatable(
"society.husbandry.action.hungry",
name
).toJson();
} else {
errorText = Text.translatable(
"society.husbandry.action.cooldown_1",
name
).toJson();
}
if (errorText && !player.isFake()) {
server.runCommandSilent(
global.getEmbersTextAPICommand(
player.username,
global.animalMessageSettings,
20,
errorText
)
);
}
};
const handleFeed = (data, day, e) => {
const { player, item, target, level, server } = e;
if (player.cooldowns.isOnCooldown(item)) return;
const ageLastFed = data.getInt("ageLastFed");
const affection = data.getInt("affection");
const affectionIncrease = {
"society:animal_feed": 10,
"society:candied_animal_feed": 100,
"society:mana_feed": 30,
}[item.id];
let affectionIncreaseMult =
player.stages.has("animal_whisperer") || data.bribed ? 2 : 1;
if (player.stages.has("animal_fancy")) affectionIncreaseMult += 0.5;
// Cap affection increase at 100
const totalNewAffection = Math.min(
affectionIncrease * affectionIncreaseMult,
100
);
if (day > ageLastFed) {
server.runCommandSilent(
`playsound minecraft:entity.generic.eat block @a ${player.x} ${player.y} ${player.z}`
);
target.heal(4);
global.giveExperience(server, player, "husbandry", 20);
data.affection = affection + totalNewAffection;
debug &&
player.tell(`Increased Affection by: ${totalNewAffection} from feeding`);
data.ageLastFed = day;
level.spawnParticles(
"legendarycreatures:wisp_particle",
true,
target.x,
target.y + 1.5,
target.z,
0.1 * rnd(1, 4),
0.1 * rnd(1, 4),
0.1 * rnd(1, 4),
5,
0.01
);
item.count--;
global.addItemCooldown(player, item, 10);
}
};
const handleSheepMagicShears = (e) => {
const { target, level, server } = e;
if (target.readyForShearing()) {
target.setSheared(true);
let woolItem = Item.of(target.getColor().getName() + "_wool");
let i = Math.ceil(Math.random() * 4);
for (let j = 0; j < i; j++) {
let wool = level.createEntity("minecraft:item");
wool.x = target.x + rnd(0, 0.5);
wool.y = target.y + 0.5;
wool.z = target.z + rnd(0, 0.5);
wool.item = Item.of(woolItem);
wool.spawn();
wool.setDeltaMovement(
wool
.getDeltaMovement()
.add(
(Math.random() - Math.random()) * 0.1,
Math.random() * 0.05,
(Math.random() - Math.random()) * 0.1
)
);
}
server.runCommandSilent(
`playsound minecraft:entity.sheep.shear block @a ${target.x} ${target.y} ${target.z}`
);
}
};
const handleMagicHarvest = (name, data, e) => {
const { player, level, target, item, server } = e;
if (player.cooldowns.isOnCooldown(item)) return;
if (["minecraft:sheep", "wildernature:minisheep"].includes(target.type)) handleSheepMagicShears(e);
const affection = data.getInt("affection");
let hearts = Math.floor((affection > 1000 ? 1000 : affection) / 100);
let errorText = "";
const droppedLoot = global.getMagicShearsOutput(level, target, player, undefined, player.stages);
if (droppedLoot !== -1) {
server.runCommandSilent(
`playsound minecraft:entity.sheep.shear block @a ${player.x} ${player.y} ${player.z}`
);
global.giveExperience(server, player, "husbandry", 15);
for (let i = 0; i < droppedLoot.length; i++) {
let specialItem = level.createEntity("minecraft:item");
let dropItem = droppedLoot[i];
specialItem.x = player.x;
specialItem.y = player.y;
specialItem.z = player.z;
specialItem.item = dropItem;
specialItem.spawn();
}
global.addItemCooldown(player, item, 1);
} else {
errorText = Text.translatable(
"society.husbandry.action.cooldown_2",
name
).toJson();
if (hearts < 5) {
errorText = Text.translatable(
"society.husbandry.action.need_hearts",
name
).toJson();
}
if (!player.isFake())
server.runCommandSilent(
global.getEmbersTextAPICommand(
player.username,
global.animalMessageSettings,
40,
errorText
)
);
global.addItemCooldown(player, item, 10);
}
};
const handleSpecialItem = (
data,
day,
chance,
hungry,
minHearts,
mult,
item,
hasQuality,
plushieModifiers,
e
) => {
const { player, target, level, server } = e;
let affection;
let mood;
let resolvedItem = item;
let resolvedChance = chance;
let resolvedHasQuality = hasQuality
let dropAmount = mult * (plushieModifiers && plushieModifiers.doubleDrops ? 2 : 1);
if (plushieModifiers) {
affection = 1000;
mood = 256;
resolvedChance = chance + plushieModifiers.probabilityIncrease;
if (plushieModifiers.processItems) {
let processOutput = global.getProcessedItem(item, dropAmount);
resolvedItem = processOutput.item.id;
dropAmount = Math.round(dropAmount / processOutput.divisor) * processOutput.item.count;
resolvedHasQuality = processOutput.preserveQuality
}
} else {
affection = data.getInt("affection") || 0;
mood = global.getOrFetchMood(level, target, day, player);
}
let hearts = Math.floor(affection / 100);
let quality = 0;
if (
(!hungry || plushieModifiers) &&
hearts >= minHearts &&
Math.random() <= resolvedChance
) {
if (item.includes("large")) {
if (Math.random() > (mood + hearts * 10) / 256) {
return;
}
}
if (plushieModifiers) {
data.affection =
affection + (player.stages.has("animal_whisperer") ? 20 : 10);
}
let specialItem = level.createEntity("minecraft:item");
if (resolvedHasQuality && mood >= 160) {
quality = global.getHusbandryQuality(hearts, mood);
}
specialItem.x = player.x;
specialItem.y = player.y;
specialItem.z = player.z;
specialItem.item = Item.of(`${dropAmount}x ${resolvedItem}`,
quality > 0 ? `{quality_food:{effects:[],quality:${quality}}}` : null
);
specialItem.spawn();
server.runCommandSilent(
`playsound stardew_fishing:dwop block @a ${player.x} ${player.y} ${player.z}`
);
global.giveExperience(server, player, "husbandry", 60);
if (target.x) {
level.spawnParticles(
"farmersdelight:star",
true,
target.x,
target.y + 1,
target.z,
0.2 * rnd(1, 4),
0.2 * rnd(1, 4),
0.2 * rnd(1, 4),
3,
0.01
);
}
}
};
const upgradeAnimal = (level, server, item, target, sound, particle) => {
item.count--;
server.runCommandSilent(
`playsound ${sound} block @a ${target.x} ${target.y} ${target.z}`
);
level.spawnParticles(
particle,
true,
target.x,
target.y + 1.5,
target.z,
0.2 * rnd(0, 2),
0.2 * rnd(0, 2),
0.2 * rnd(0, 2),
3,
0.01
);
};
global.handleHusbandryBase = (hand, player, item, target, level, server) => {
const pet = global.checkEntityTag(target, "society:pet_animal");
const eventData = {
player: player,
item: item,
target: target,
level: level,
server: server,
};
if (hand == "OFF_HAND") return;
if (!global.checkEntityTag(target, "society:husbandry_animal") && !pet)
return;
if (item.id === "society:sunlit_crystal") return;
server.scheduleInTicks(1, () => {
if (hand == "MAIN_HAND") {
const day = global.getDay(level);
handleFarmAnimalBackwardsCompat(target, day);
initializeFarmAnimal(day, target, level);
const data = target.persistentData;
let name = target.customName ? target.customName : global.getTranslatedEntityName(String(target.type));
const ageLastFed = data.getInt("ageLastFed");
const peckish = !pet && day - ageLastFed == 1;
const hungry = !pet && day - ageLastFed > 1;
const affection = data.getInt("affection");
const lostProduce = mood < 64 && Math.random() < mood / 64;
let hearts = Math.floor((affection > 1000 ? 1000 : affection) / 100);
player.swing();
const mood = global.getOrFetchMood(level, target, day, player, false, true);
handlePet(name, data, mood, day, peckish, hungry, eventData);
if (pet) return;
if (item.hasTag("society:animal_feed") && !pet)
handleFeed(data, day, eventData);
if (!lostProduce) {
if (
item === "society:milk_pail" &&
global.checkEntityTag(target, "society:milkable_animal")
) {
handleMilk(name, data, day, hungry, eventData);
}
global.handleSpecialHarvest(
level,
target,
player,
server,
undefined,
undefined,
undefined,
handleSpecialItem,
player.stages,
);
}
if (
player.stages.has("biomancer") &&
[
"bakery:bread_knife",
"farmersdelight:iron_knife",
"farmersdelight:diamond_knife",
"farmersdelight:netherite_knife",
"farmersdelight:golden_knife",
"aquaculture:wooden_fillet_knife",
"aquaculture:stone_fillet_knife",
"aquaculture:iron_fillet_knife",
"aquaculture:gold_fillet_knife",
"farmersdelight:flint_knife",
"aquaculture:neptunium_fillet_knife",
"aquaculture:diamond_fillet_knife",
"refurbished_furniture:knife",
].includes(item.id)
) {
if (player.cooldowns.isOnCooldown(item)) return;
if (hearts < 5) {
server.runCommandSilent(
global.getEmbersTextAPICommand(
player.username,
global.animalMessageSettings,
40,
Text.translatable(
"society.husbandry.action.need_hearts",
name
).toJson()
)
);
} else {
let heart = level.createEntity("minecraft:item");
heart.x = player.x;
heart.y = player.y;
heart.z = player.z;
heart.item = Item.of("quark:diamond_heart");
heart.spawn();
server.runCommandSilent(
`playsound minecraft:entity.sheep.shear block @a ${player.x} ${player.y} ${player.z}`
);
server.runCommandSilent(
`playsound legendarycreatures:mojo_hurt block @a ${player.x} ${player.y} ${player.z} 0.1`
);
level.spawnParticles(
"minecraft:angry_villager",
true,
target.x,
target.y + 1.5,
target.z,
0.2 * rnd(1, 4),
0.2 * rnd(1, 4),
0.2 * rnd(1, 4),
5,
0.01
);
data.affection = affection - 100;
global.addItemCooldown(player, item, 5);
}
}
if (
player.stages.has("bribery") &&
item === "numismatics:crown" &&
!data.bribed
) {
if (player.cooldowns.isOnCooldown(item)) return;
data.bribed = true;
data.affection = affection + 100;
item.count--;
server.runCommandSilent(
`playsound stardew_fishing:complete block @a ${player.x} ${player.y} ${player.z}`
);
level.spawnParticles(
"legendarycreatures:desert_mojo_particle",
true,
target.x,
target.y + 1.5,
target.z,
0.2 * rnd(0, 1),
0.2 * rnd(0, 1),
0.2 * rnd(0, 1),
5,
0.01
);
global.addItemCooldown(player, item, 1);
}
if (
player.stages.has("clockwork") &&
item === "create:precision_mechanism" &&
!data.clockwork
) {
data.clockwork = true;
upgradeAnimal(
level,
server,
item,
target,
"trials:vault_activate",
"supplementaries:bomb_explosion"
);
if (data.bff) {
data.bff = false;
server.runCommandSilent(
global.getEmbersTextAPICommand(
player.username,
global.animalMessageSettings,
80,
Text.translatable("society.husbandry.mechanization").toJson()
)
);
}
}
if (
player.stages.has("husbandry_mastery") &&
item === "society:animal_cracker" &&
!data.animalCracker
) {
data.animalCracker = true;
server.runCommandSilent(
`playsound minecraft:entity.generic.eat block @a ${player.x} ${player.y} ${player.z}`
);
upgradeAnimal(
level,
server,
item,
target,
"stardew_fishing:chest_get",
"farmersdelight:star"
);
}
if (
player.stages.has("bff") &&
item === "society:friendship_necklace" &&
!data.bff
) {
data.bff = true;
upgradeAnimal(
level,
server,
item,
target,
"legendarycreatures:wisp_idle",
"buzzier_bees:buttercup_bloom"
);
if (data.clockwork) {
data.clockwork = false;
server.runCommandSilent(
global.getEmbersTextAPICommand(
player.username,
`{anchor:"BOTTOM_CENTER",background:1,wrap:220,align:"BOTTOM_CENTER",color:"#55FF55",offsetY:20}`,
80,
Text.translatable("society.husbandry.emancipation").toJson()
)
);
}
}
if (
player.stages.has("transplanting") &&
item === "quark:diamond_heart" &&
hearts < 10
) {
if (player.cooldowns.isOnCooldown(item)) return;
data.affection = affection + 100;
if (!player.isCreative()) item.count--;
server.runCommandSilent(
`playsound aquaculture:fish_flop block @a ${player.x} ${player.y} ${player.z}`
);
level.spawnParticles(
"minecraft:heart",
true,
target.x,
target.y + 1.5,
target.z,
0.2 * rnd(0, 2),
0.2 * rnd(0, 2),
0.2 * rnd(0, 2),
5,
0.01
);
global.addItemCooldown(player, item, 1);
}
if (!lostProduce && item === "society:magic_shears") {
handleMagicHarvest(name, data, eventData);
}
if (affection > 1075) {
// Cap affection at 1075
data.affection = 1075;
}
if (affection < 0) data.affection = 0;
}
});
};
ItemEvents.entityInteracted((e) => {
const { hand, player, item, target, level, server } = e;
if (item === 'moblassos:diamond_lasso') return;
global.handleHusbandryBase(hand, player, item, target, level, server);
});
BlockEvents.rightClicked(global.plushies, (e) => {
const { level, hand, player, item, server, block } = e;
if (hand == "OFF_HAND") return;
let nbt = block.getEntityData();
if (!nbt) return;
const { animal } = nbt.data;
if (!animal) return;
let animalName = animal.name ? Text.of(animal.name) : global.getTranslatedEntityName(String(animal.type));
if (item === "minecraft:air") {
checkAnimal(
player,
level,
server,
animal,
animalName,
256,
10
);
}
global.executePlushieHusbandry(
level,
server,
player,
item,
block,
handleSpecialItem
);
if (
player.stages.has("clockwork") &&
item === "create:precision_mechanism" &&
!animal.clockwork
) {
nbt.merge({
data: {
animal: {
clockwork: true,
},
},
});
upgradeAnimal(
level,
server,
item,
block,
"trials:vault_activate",
"supplementaries:bomb_explosion"
);
if (animal.bff) {
nbt.merge({
data: {
animal: {
bff: false,
},
},
});
server.runCommandSilent(
global.getEmbersTextAPICommand(
player.username,
global.animalMessageSettings,
80,
Text.translatable("society.husbandry.mechanization").toJson()
)
);
}
}
if (
player.stages.has("husbandry_mastery") &&
item === "society:animal_cracker" &&
!animal.animalCracker
) {
nbt.merge({
data: {
animal: {
animalCracker: true,
},
},
});
server.runCommandSilent(
`playsound minecraft:entity.generic.eat block @a ${player.x} ${player.y} ${player.z}`
);
upgradeAnimal(
level,
server,
item,
block,
"stardew_fishing:chest_get",
"farmersdelight:star"
);
}
if (
player.stages.has("bff") &&
item === "society:friendship_necklace" &&
!animal.bff
) {
nbt.merge({
data: {
animal: {
bff: true,
},
},
});
upgradeAnimal(
level,
server,
item,
block,
"legendarycreatures:wisp_idle",
"buzzier_bees:buttercup_bloom"
);
if (animal.clockwork) {
nbt.merge({
data: {
animal: {
clockwork: false,
},
},
});
server.runCommandSilent(
global.getEmbersTextAPICommand(
player.username,
`{anchor:"BOTTOM_CENTER",background:1,wrap:220,align:"BOTTOM_CENTER",color:"#55FF55",offsetY:20}`,
80,
Text.translatable("society.husbandry.emancipation").toJson()
)
);
}
}
global.setBlockEntityData(block, nbt)
});
@@ -0,0 +1,105 @@
console.info("[SOCIETY] animalBreeding.js loaded");
const breedingItems = [
"minecraft:carrot",
"minecraft:wheat",
"minecraft:beetroot",
"minecraft:potato",
"farmersdelight:cabbage_seeds",
"vintagedelight:ghost_pepper_seeds",
"vintagedelight:cucumber_seeds",
"supplementaries:flax_seeds",
"minecraft:beetroot_seeds",
"minecraft:wheat_seeds",
"minecraft:pumpkin_seeds",
"minecraft:torchflower_seeds",
"farmersdelight:tomato_seeds",
"society:tubabacco_seed",
"society:ancient_fruit_seed",
"society:blueberry_seed",
"minecraft:dandelion",
"minecraft:golden_carrot",
];
ItemEvents.entityInteracted((e) => {
const { hand, player, item, target, level, server } = e;
if (player.cooldowns.isOnCooldown(item)) return;
if (!global.checkEntityTag(target, "society:husbandry_animal") || target.isBaby()) return;
if (breedingItems.includes(item.id)) {
server.runCommandSilent(
global.getEmbersTextAPICommand(
player.username,
global.animalMessageSettings,
160,
Text.translatable("society.husbandry.breeding.need_potion").toJson()
)
);
e.cancel();
}
if (hand == "OFF_HAND") return;
if (hand == "MAIN_HAND" && item === "society:miracle_potion") {
if (global.checkEntityTag(target, "society:infertile")) {
server.runCommandSilent(
global.getEmbersTextAPICommand(
player.username,
global.animalMessageSettings,
120,
Text.translatable("society.husbandry.breeding.infertile").toJson()
)
);
e.cancel();
}
let animalNbt = target.getNbt();
let day = global.getDay(level);
let ageLastBred = target.persistentData.ageLastBred || 0;
if (global.isFresh(day, ageLastBred)) ageLastBred = 0;
if (Number(animalNbt.InLove) === 0 && day > ageLastBred) {
if (
["crittersandcompanions:red_panda", "minecraft:panda"].includes(target.type) &&
Math.random() > 0.2
) {
item.count--;
target.persistentData.ageLastBred = day;
server.runCommandSilent(
global.getEmbersTextAPICommand(
player.username,
global.animalMessageSettings,
160,
Text.translatable("society.husbandry.breeding.fail").toJson()
)
);
} else {
animalNbt.InLove = 2000;
target.setNbt(animalNbt);
item.count--;
level.spawnParticles(
"minecraft:heart",
true,
target.x,
target.y + 1.5,
target.z,
0.2 * rnd(1, 4),
0.2 * rnd(1, 4),
0.2 * rnd(1, 4),
12,
0.01
);
target.persistentData.ageLastBred = day;
global.giveExperience(server, player, "husbandry", 80);
player.swing();
global.addItemCooldown(player, item, 10);
}
} else if (day > ageLastBred) {
global.addItemCooldown(player, "society:miracle_potion", 40);
server.runCommandSilent(
global.getEmbersTextAPICommand(
player.username,
global.animalMessageSettings,
120,
Text.translatable("society.husbandry.breeding.cooldown").toJson()
)
);
}
}
});
@@ -0,0 +1,25 @@
console.info("[SOCIETY] animalMoodScanner.js loaded");
ItemEvents.entityInteracted((e) => {
const { hand, level, target, item, player, server } = e;
if (hand == "OFF_HAND") return;
if (!global.checkEntityTag(target, "society:husbandry_animal")) return;
if (hand == "MAIN_HAND" && item === "society:mood_scanner") {
if (player.cooldowns.isOnCooldown(item)) return;
const day = global.getDay(level);
let name = target.customName ? target.customName : global.getTranslatedEntityName(String(target.type));
const moodMeterHeaderText = Text.empty()
.gray()
.append(Text.of(`==[ `))
.append(
Text.translatable("society.husbandry.mood.meter_header", name).gold(),
)
.append(Text.of(` ]==`));
player.tell(moodMeterHeaderText);
global.getOrFetchMood(level, target, day, player, true);
server.runCommandSilent(
`playsound refurbished_furniture:ui.paddle_ball.retro_win block @a ${target.x} ${target.y} ${target.z}`,
);
global.addItemCooldown(player, item, 10);
}
});
@@ -0,0 +1,30 @@
console.info("[SOCIETY] animalName.js loaded");
// This is done seperately and not in animalBase.js because of scheduling
ItemEvents.entityInteracted((e) => {
const { hand, player, item, target, level, server } = e;
if (hand == "OFF_HAND") return;
if (!global.checkEntityTag(target, "society:husbandry_animal") && !global.checkEntityTag(target, "society:pet_animal")) return;
if (hand == "MAIN_HAND") {
const data = target.persistentData;
if (item === "minecraft:name_tag" && item.nbt?.display && !target.customName) {
data.affection = (data.affection || 0) + (player.stages.has("no_name_for_the_sheep") ? 200 : 100);
server.runCommandSilent(
`playsound minecraft:entity.allay.item_given block @a ${player.x} ${player.y} ${player.z}`
);
level.spawnParticles(
"minecraft:heart",
true,
target.x,
target.y + 1.5,
target.z,
0.2 * rnd(0, 3),
0.2 * rnd(0, 3),
0.2 * rnd(0, 3),
10,
0.01
);
}
}
});
@@ -0,0 +1,51 @@
console.info("[SOCIETY] animalPet.js loaded");
ItemEvents.entityInteracted((e) => {
const { hand, player, level, target, server } = e;
if (hand == "OFF_HAND") return;
if (!global.checkEntityTag(target, "society:pet_animal")) return;
if (hand == "MAIN_HAND") {
let data = target.persistentData;
let possibleGifts;
let gift = level.createEntity("minecraft:item");
if (!data.gifted && data.affection >= 1000) {
let nonIdType = String(target.type).path.replace(/_/g, " ");
let name = target.customName ? target.customName : global.getTranslatedEntityName(String(target.type), global.formatName(nonIdType));
server.runCommandSilent(
global.getEmbersTextAPICommand(
player.username,
// Commented code is original one before 2025.12.22 (84067a9), and I think this is right code. so I attached.
// `{anchor:"BOTTOM_CENTER",background:1,align:"BOTTOM_CENTER",color:"#55FF55",y:-90}`,
// 80,
// Text.translatable("society.husbandry.pet.max_affection", name).toJson(),
`{anchor:"BOTTOM_CENTER",background:1,wrap:220,align:"BOTTOM_CENTER",color:"#FFAA00",offsetY:20}`,
40,
Text.translatable("society.husbandry.pet.max_affection").toJson()
)
);
global.petGifts.forEach((gift) => {
if (gift.animal === target.type) possibleGifts = gift.gifts;
});
data.gifted = true;
gift.x = player.x;
gift.y = player.y;
gift.z = player.z;
gift.item = Item.of(possibleGifts[rnd(0, possibleGifts.length - 1)]);
gift.spawn();
level.spawnParticles(
"minecraft:heart",
true,
target.x,
target.y + 1.5,
target.z,
0.2 * rnd(0, 3),
0.2 * rnd(0, 3),
0.2 * rnd(0, 3),
20,
0.01
);
}
}
});
@@ -0,0 +1 @@
// DEPRECATED
@@ -0,0 +1,85 @@
console.info("[SOCIETY] animalSunlitCrystal.js loaded");
ItemEvents.entityInteracted((e) => {
const { hand, level, target, item, player, server } = e;
if (hand == "OFF_HAND") return;
if (!global.checkEntityTag(target, "society:husbandry_animal")) return;
if (hand == "MAIN_HAND" && item === "society:sunlit_crystal") {
const animalData = target.persistentData;
const animalNbt = target.getNbt();
const plushie = player.getHeldItem("off_hand");
let plushieNbt = plushie.getNbt();
let errorString = "";
if (Number(animalData.getInt("affection") || 0) < 1000) {
errorString =
"society.husbandry.sunlit_crystal.not_enough_animal_affection";
}
if (!plushie.hasTag("society:plushies")) {
errorString = "society.husbandry.sunlit_crystal.not_plushie";
} else if (Number(plushieNbt.get("affection")) < 4) {
errorString =
"society.husbandry.sunlit_crystal.not_enough_plushie_affection";
} else if (plushieNbt.get("animal")) {
errorString = "society.husbandry.sunlit_crystal.has_animal";
}
if (errorString) {
server.runCommandSilent(
global.getEmbersTextAPICommand(
player.username,
global.animalMessageSettings,
80,
Text.translatable(errorString).toJson()
)
);
return;
} else {
if (!player.isCreative()) item.shrink(1);
player.give(
Item.of(
plushie.id,
global.getPlushieItemNbt(
plushieNbt,
target.type,
target.customName,
animalData,
animalNbt
)
)
);
plushie.shrink(1);
server.runCommandSilent(
`playsound relics:table_upgrade block @a ${player.x} ${player.y} ${player.z}`
);
server.runCommandSilent(
`playsound chimes:block.amethyst.shimmer block @a ${player.x} ${player.y} ${player.z}`
);
level.spawnParticles(
"snowyspirit:glow_light",
true,
target.x,
target.y + 1,
target.z,
0.2 * rnd(1, 4),
0.2 * rnd(1, 4),
0.2 * rnd(1, 4),
15,
0.01
);
level.spawnParticles(
"species:wicked_flame",
true,
target.x,
target.y + 1,
target.z,
0.2 * rnd(1, 4),
0.2 * rnd(1, 4),
0.2 * rnd(1, 4),
15,
0.01
);
target.setRemoved("unloaded_to_chunk");
}
}
});
@@ -0,0 +1,29 @@
console.info("[SOCIETY] animalTweaks.js loaded");
ItemEvents.entityInteracted((e) => {
const { item, target } = e;
if (target.type === "minecraft:mooshroom" && item.id === "minecraft:bowl") {
target.attack(2);
}
});
ItemEvents.entityInteracted((e) => {
const { target } = e;
if (target.type === "minecraft:wolf") {
let nbt = target.getNbt();
nbt.IsBewereager = 0;
target.setNbt(nbt)
}
});
EntityEvents.spawned((e) => {
if (e.entity.type == "minecraft:skeleton_horse" && e.entity.getNbt().SkeletonTrap !== 0.0) {
e.cancel();
}
});
EntityEvents.spawned((e) => {
if (e.entity.type == "rottencreatures:immortal" && e.level.dimension !== "society:skull_cavern") {
e.cancel();
}
});
@@ -0,0 +1,12 @@
console.info("[SOCIETY] cancelEntityInteraction.js loaded");
ItemEvents.entityInteracted((e) => {
const { item, player, target } = e;
if (!target.type.includes("item_frame")) {
return;
}
if (item.hasTag('forge:tools/fishing_rods') && item.nbt.toString().includes("bobber")) {
player.tell(Text.translatable("society.item_frame.rod").red());
e.cancel()
}
});
+45
View File
@@ -0,0 +1,45 @@
console.info("[SOCIETY] carKey.js loaded");
BlockEvents.rightClicked((e) => {
const { item, block, player } = e;
if (item.getId() !== "society:car_key") return;
const playerDrunk =
player.potionEffects.isActive("brewery:drunk") ||
player.potionEffects.isActive("brewery:blackout");
if (!playerDrunk && item.nbt && block) {
let car = e.player.level.createEntity("automobility:automobile");
if (item.nbt.car) {
item.nbt.car.Pos[0] = Number(block.getX());
item.nbt.car.Pos[1] = Number(block.getY() + 2);
item.nbt.car.Pos[2] = Number(block.getZ());
car.nbt = item.nbt.car;
} else {
item.nbt.Pos[0] = Number(block.getX());
item.nbt.Pos[1] = Number(block.getY() + 2);
item.nbt.Pos[2] = Number(block.getZ());
car.nbt = item.nbt
}
car.spawn();
item.nbt = null;
} else if (playerDrunk) {
player.tell(
Text.translatable("item.society.car_key.use_on_drunk").gray()
);
}
});
ItemEvents.entityInteracted("society:car_key", (e) => {
const { item, target } = e;
if (target.type !== "automobility:automobile" || item.nbt && item.nbt.car) {
return;
}
if (item.nbt) {
item.nbt.car = target.getNbt();
} else {
item.nbt = {}
item.nbt.car = target.getNbt();
}
target.setRemoved("unloaded_to_chunk");
e.cancel();
});
@@ -0,0 +1,142 @@
console.info("[SOCIETY] checkAnimal.js loaded");
ItemEvents.entityInteracted((e) => {
const { hand, player, level, target, server } = e;
if (hand == "OFF_HAND") return;
if (!global.checkEntityTag(target, "society:longwing")) return;
if (hand == "MAIN_HAND") {
let nearbyLongwings = level
.getEntitiesWithin(target.boundingBox.inflate(8))
.filter((e) => global.checkEntityTag(e, "society:longwing"));
let radius = 4;
let { x, y, z } = target;
let scanBlock;
let scannedBlocks = 0;
let scannedFlowers = [];
let stolenBlock;
for (let pos of BlockPos.betweenClosed(new BlockPos(x - radius, y - radius, z - radius), [
x + radius,
y + radius,
z + radius,
])) {
if (!level.isLoaded(pos)) continue;
scanBlock = level.getBlock(pos);
if (scanBlock.hasTag("minecraft:flowers") && !scannedFlowers.includes(scanBlock.id)) {
scannedFlowers.push(scanBlock.id);
scannedBlocks++;
if (!stolenBlock) stolenBlock = scanBlock;
}
}
let chance = scannedBlocks * 0.15 - nearbyLongwings.length * 0.1;
let eggChance = chance <= 0 ? "0%" : `${Math.min(100, Math.floor((Math.min(1, chance) / 4) * 100))}%`;
chance = chance <= 0 ? "0%" : `${Math.min(100, Math.floor(chance * 100))}%`;
let product = target.type.toString().equals("longwings:butterfly") ? Text.translatable("item.society.butterfly_amber") : Text.translatable("item.society.moth_pollen");
let longWingNameMessage = `${Text.translatable(`item.longwings.${target.getNbt().Variant}`).toJson()}`;
let chanceMessage = `${Text.translatable("society.longwings.produce_chance", chance, product).toJson()}`;
let eggChanceMessage = `${Text.translatable("society.longwings.produce_chance", eggChance, Text.translatable("item.society.caterpillar_eggs")).toJson()}`;
let longwingCountMessage = `${Text.translatable("society.longwings.longwing_count", `${nearbyLongwings.length - 1}`).toJson()}`;
let flowerCountMessage = `${Text.translatable("society.longwings.flower_count", `${scannedBlocks}`).toJson()}`;
global.renderUiText(
player,
server,
{
longwingName: {
type: "text",
x: 0,
y: -90,
text: longWingNameMessage,
color: "#FFFFFF",
alignX: "center",
alignY: "bottom",
},
longwingNameShadow: {
type: "text",
x: 1,
z: -1,
y: -89,
text: longWingNameMessage,
color: "#000000",
alignX: "center",
alignY: "bottom",
},
chanceMessage: {
type: "text",
x: 0,
y: -80,
text: chanceMessage,
color: "#FFAA00",
alignX: "center",
alignY: "bottom",
},
chanceMessageShadow: {
type: "text",
x: 1,
z: -1,
y: -79,
text: chanceMessage,
color: "#000000",
alignX: "center",
alignY: "bottom",
},
eggChanceMessage: {
type: "text",
x: 0,
y: -70,
text: eggChanceMessage,
color: "#FF55FF",
alignX: "center",
alignY: "bottom",
},
eggChanceMessageShadow: {
type: "text",
x: 1,
z: -1,
y: -69,
text: eggChanceMessage,
color: "#000000",
alignX: "center",
alignY: "bottom",
},
longwingCountMessage: {
type: "text",
x: 0,
y: -60,
text: longwingCountMessage,
color: "#FF5555",
alignX: "center",
alignY: "bottom",
},
longwingCountMessageShadow: {
type: "text",
x: 1,
z: -1,
y: -59,
text: longwingCountMessage,
color: "#000000",
alignX: "center",
alignY: "bottom",
},
flowerCountMessage: {
type: "text",
x: 0,
y: -50,
text: flowerCountMessage,
color: "#55FF55",
alignX: "center",
alignY: "bottom",
},
flowerCountMessageShadow: {
type: "text",
x: 1,
z: -1,
y: -49,
text: flowerCountMessage,
color: "#000000",
alignX: "center",
alignY: "bottom",
},
},
global.mainUiElementIds
);
}
});
@@ -0,0 +1,14 @@
console.info("[SOCIETY] disableEggs.js loaded");
const eggs = [
"minecraft:egg",
"autumnity:turkey_egg",
"untitledduckmod:goose_egg",
"untitledduckmod:duck_egg",
"farmlife:galliraptor_egg",
];
EntityEvents.spawned(eggs, (e) => e.cancel());
ItemEvents.rightClicked(eggs, (e) => {
if (!e.player.isCrouching()) e.cancel();
});
@@ -0,0 +1,121 @@
// priority: 0
global.husbandryAnimals = [
"minecraft:cow",
"minecraft:goat",
"minecraft:sheep",
"minecraft:pig",
"snowpig:snow_pig",
"minecraft:rabbit",
"meadow:wooly_cow",
"meadow:wooly_sheep",
"meadow:water_buffalo",
"autumnity:turkey",
"autumnity:snail",
"minecraft:mooshroom",
"buzzier_bees:moobloom",
"minecraft:sniffer",
"etcetera:chapple",
"minecraft:panda",
"species:mammutilation",
"snuffles:snuffle",
"species:goober",
"species:cruncher",
"farmlife:domestic_tribull",
"wildernature:minisheep",
"wildernature:deer",
"wildernature:raccoon",
"wildernature:bison",
"minecraft:chicken",
"untitledduckmod:duck",
"untitledduckmod:goose",
"etcetera:chapple",
"autumnity:turkey",
"species:wraptor",
"wildernature:flamingo",
"wildernature:penguin",
"farmlife:galliraptor",
"minecraft:frog",
"wildernature:squirrel",
"atmospheric:cochineal",
"minecraft:squid",
"minecraft:glow_squid",
"crittersandcompanions:red_panda",
"windswept:frostbiter",
"minecraft:bat",
"crittersandcompanions:shima_enaga",
"minecraft:turtle",
];
global.milkableAnimals = [
"minecraft:cow",
"minecraft:goat",
"minecraft:sheep",
"meadow:wooly_sheep",
"meadow:wooly_cow",
"meadow:water_buffalo",
"minecraft:mooshroom",
"buzzier_bees:moobloom",
"species:mammutilation",
"farmlife:domestic_tribull",
"wildernature:minisheep",
"wildernature:bison",
"minecraft:squid",
"minecraft:glow_squid",
"windswept:frostbiter",
];
global.coopMasterAnimals = [
"minecraft:chicken",
"untitledduckmod:duck",
"untitledduckmod:goose",
"etcetera:chapple",
"autumnity:turkey",
"species:wraptor",
"wildernature:flamingo",
"wildernature:penguin",
"farmlife:galliraptor",
"crittersandcompanions:shima_enaga",
];
global.tierTwoHusbandryAnimals = [
"minecraft:pig",
"meadow:wooly_cow",
"wildernature:bison",
"wildernature:raccoon",
"crittersandcompanions:red_panda",
"wildernature:minisheep",
"minecraft:panda",
"minecraft:mooshroom",
"meadow:water_buffalo",
"untitledduckmod:goose",
"minecraft:rabbit",
"wildernature:squirrel",
"autumnity:turkey",
"minecraft:turtle",
];
global.tierThreeHusbandryAnimals = [
"minecraft:goat",
"buzzier_bees:moobloom",
"species:mammutilation",
"species:goober",
"species:cruncher",
"farmlife:domestic_tribull",
"windswept:frostbiter",
"species:wraptor",
"etcetera:chapple",
"wildernature:flamingo",
"wildernature:penguin",
"farmlife:galliraptor",
"crittersandcompanions:shima_enaga",
];
global.coldMobs = [
"species:mammutilation",
"windswept:frostbiter",
"wildernature:penguin",
"snowpig:snow_pig",
"snuffles:snuffle",
];
global.animalMessageSettings = `{anchor:"BOTTOM_CENTER",background:1,wrap:220,align:"BOTTOM_CENTER",color:"#FF5555",offsetY:-80}`;
@@ -0,0 +1,37 @@
console.info("[SOCIETY] hamsterBite.js loaded");
ItemEvents.entityInteracted((e) => {
const { hand, player, level, target, server, item } = e;
if (hand == "OFF_HAND") return;
if (target.type !== "hamsters:hamster") return;
if (hand == "MAIN_HAND" && item === "society:animal_feed") {
server.runCommandSilent(
`playsound minecraft:entity.generic.eat block @a ${player.x} ${player.y} ${player.z}`
);
level.spawnParticles(
"legendarycreatures:wisp_particle",
true,
target.x,
target.y + 1.5,
target.z,
0.1 * rnd(1, 4),
0.1 * rnd(1, 4),
0.1 * rnd(1, 4),
5,
0.01
);
if (Math.random() < 0.08) {
player.attack(20)
server.runCommandSilent(
global.getEmbersTextAPICommand(
player.username,
`{anchor:"BOTTOM_CENTER",charShakeRandom:0.2,background:1,align:"BOTTOM_CENTER",color:"#FF5555",offsetY:60}`,
100,
Text.translatable("society.hamster.bite").toJson()
)
);
}
item.count--;
global.addItemCooldown(player, item, 10);
}
});
@@ -0,0 +1 @@
// DEPRECATED
@@ -0,0 +1,54 @@
EntityEvents.death((e) => {
const { source, level, server, entity } = e;
if (
source.player &&
source.player.getType() === "minecraft:player" &&
["minecraft:sheep", "wildernature:minisheep", "meadow:wooly_sheep"].includes(entity.type) &&
source.player.stages.has("sacrificial_lamb")
) {
let sacrificeAffection = entity.persistentData.getInt("affection");
if (sacrificeAffection < 200) return;
let witnesses = level
.getEntitiesWithin(source.player.boundingBox.inflate(8))
.filter((entity) => global.checkEntityTag(entity, "society:husbandry_animal"));
server.runCommandSilent(
`playsound legendarycreatures:corpse_eater_death block @a ${source.player.x} ${source.player.y} ${source.player.z}`
);
witnesses.forEach((animal) => {
let data
if (["minecraft:sheep", "wildernature:minisheep", "meadow:wooly_sheep"].includes(animal.type)) {
data = animal.persistentData;
data.affection = data.getInt("affection") - 100;
level.spawnParticles(
"minecraft:angry_villager",
true,
animal.x,
animal.y + 1.5,
animal.z,
0.1 * rnd(1, 4),
0.1 * rnd(1, 4),
0.1 * rnd(1, 4),
5,
0.01
);
} else if (Math.random() < 0.5) {
data = animal.persistentData;
data.affection =
data.getInt("affection") + Math.round(sacrificeAffection / 2);
level.spawnParticles(
"minecraft:sculk_soul",
true,
animal.x,
animal.y + 1.5,
animal.z,
0.1 * rnd(1, 4),
0.1 * rnd(1, 4),
0.1 * rnd(1, 4),
5,
0.01
);
}
});
}
});
@@ -0,0 +1,31 @@
console.info("[SOCIETY] moonStatueDamage.js loaded");
EntityEvents.hurt((e) => {
const { server, level, entity, source } = e;
// Fix windswept bug
if (level.dimension !== "society:skull_cavern") return;
if (
source.player &&
source.player.getType() === "minecraft:player" &&
source.player.stages.has("moon_damage") &&
Math.random() < 0.05
) {
entity.attack(100);
level.spawnParticles(
"species:spectre_pop",
true,
entity.x,
entity.y + 1.5,
entity.z,
0.1 * rnd(1, 4),
0.1 * rnd(1, 4),
0.1 * rnd(1, 4),
5,
0.01
);
server.runCommandSilent(
`playsound create:peculiar_bell_use block @a ${entity.x} ${entity.y} ${entity.z}`
);
}
});
@@ -0,0 +1 @@
// DEPRECATED
@@ -0,0 +1,534 @@
// console.info("[SOCIETY] refreshVillagers.js loaded");
// ItemEvents.entityInteracted((e) => {
// const { hand, player, level, target, server } = e;
// if (hand == "OFF_HAND") return;
// if (target.type !== "minecraft:villager") return;
// let updateThis = false;
// const nbt = target.nbt.toString();
// if (nbt.includes("leatherworker") && !nbt.includes("stylin_purple_hat")) updateThis = true;
// if (nbt.includes("weaponsmith") && !nbt.includes("64k_storage_block")) updateThis = true;
// if (nbt.includes("shepherd") && !nbt.includes("diamond_lasso")) updateThis = true;
// if (nbt.includes("botanist") && !nbt.includes("endless_fortune")) updateThis = true;
// if (nbt.includes("bountiful_fertilizer")) updateThis = true;
// if (nbt.includes("candlelight:cook") && !nbt.includes("sweet_potato_seed")) updateThis = true;
// if (nbt.includes("toolsmith") && nbt.includes("reinforced_core")) updateThis = true;
// if (nbt.includes("cleric") && !nbt.includes("hostile_lasso")) updateThis = true;
// if (nbt.includes("librarian") && !nbt.includes("silk_touch")) updateThis = true;
// if (
// nbt.includes("cartographer") &&
// !nbt.includes("fletcher") &&
// !nbt.includes("shipping_bin_monitor")
// )
// updateThis = true;
// if (nbt.includes("fletcher") && !nbt.includes("enkephalin")) updateThis = true;
// if (nbt.includes("fisher") && !nbt.includes("river_jelly")) updateThis = true;
// if (updateThis) {
// let freshVillager = level.createEntity("minecraft:villager");
// let villagerNbt = freshVillager.getNbt();
// villagerNbt.VillagerData.profession = target.nbt.VillagerData.profession;
// villagerNbt.Brain.memories = target.nbt.Brain.memories;
// freshVillager.customName = target.customName;
// villagerNbt.Pos = [Number(target.x), Number(target.y), Number(target.z)];
// freshVillager.setNbt(villagerNbt);
// freshVillager.spawn();
// target.setRemoved("unloaded_to_chunk");
// server.runCommandSilent(
// `playsound stardew_fishing:complete block @a ${player.x} ${player.y} ${player.z}`
// );
// player.tell(Text.green("Villager updated! Thanks for playing Sunlit Valley!"));
// }
// });
// ItemEvents.entityInteracted((e) => {
// const { hand, level, target } = e;
// if (hand == "OFF_HAND") return;
// if (target.type !== "vinery:wandering_winemaker") return;
// let updateThis = false;
// const nbt = target.nbt.toString();
// if (nbt.includes("minecraft:emerald")) updateThis = true;
// if (updateThis) {
// let freshVillager = level.createEntity("vinery:wandering_winemaker");
// let villagerNbt = freshVillager.getNbt();
// villagerNbt.Brain.memories = target.nbt.Brain.memories;
// freshVillager.customName = target.customName;
// villagerNbt.Pos = [Number(target.x), Number(target.y), Number(target.z)];
// freshVillager.setNbt(villagerNbt);
// villagerNbt.Offers = {
// Recipes: [
// {
// buy: { Count: 18, id: "numismatics:cog" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 12,
// priceMultiplier: 0.2,
// "quark:tier": 6,
// rewardExp: 1,
// sell: {
// Count: 1,
// id: "quark:pathfinders_quill",
// tag: {
// targetBiome: "minecraft:old_growth_pine_taiga",
// targetBiomeColor: 5980703,
// targetBiomeUnderground: 0,
// },
// },
// specialPrice: 0,
// uses: 0,
// xp: 15,
// },
// {
// buy: { Count: 4, id: "numismatics:cog" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 4, id: "vinery:red_grape_seeds" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// {
// buy: { Count: 4, id: "numismatics:cog" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 4, id: "vinery:white_grape_seeds" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// {
// buy: { Count: 1, id: "numismatics:crown" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 4, id: "vinery:taiga_grape_seeds_red" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// {
// buy: { Count: 1, id: "numismatics:crown" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 4, id: "vinery:taiga_grape_seeds_white" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// {
// buy: { Count: 1, id: "numismatics:crown" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 4, id: "vinery:savanna_grape_seeds_red" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// {
// buy: { Count: 1, id: "numismatics:crown" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 4, id: "vinery:savanna_grape_seeds_white" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// {
// buy: { Count: 1, id: "numismatics:crown" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 4, id: "vinery:jungle_grape_seeds_red" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// {
// buy: { Count: 1, id: "numismatics:crown" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 4, id: "vinery:jungle_grape_seeds_white" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// {
// buy: { Count: 4, id: "numismatics:crown" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 4, id: "nethervinery:crimson_grape_seeds" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// {
// buy: { Count: 4, id: "numismatics:crown" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 4, id: "nethervinery:warped_grape_seeds" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// ],
// };
// freshVillager.setNbt(villagerNbt);
// freshVillager.spawn();
// target.setRemoved("unloaded_to_chunk");
// }
// });
// ItemEvents.entityInteracted((e) => {
// const { hand, level, target } = e;
// if (hand == "OFF_HAND") return;
// if (target.type !== "bakery:wandering_baker") return;
// let updateThis = false;
// const nbt = target.nbt.toString();
// if (nbt.includes("minecraft:emerald")) updateThis = true;
// if (updateThis) {
// let freshVillager = level.createEntity("bakery:wandering_baker");
// let villagerNbt = freshVillager.getNbt();
// villagerNbt.Brain.memories = target.nbt.Brain.memories;
// freshVillager.customName = target.customName;
// villagerNbt.Pos = [Number(target.x), Number(target.y), Number(target.z)];
// freshVillager.setNbt(villagerNbt);
// villagerNbt.Offers = {
// Recipes: [
// {
// buy: { Count: 18, id: "numismatics:cog" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 12,
// priceMultiplier: 0.2,
// "quark:tier": 6,
// rewardExp: 1,
// sell: {
// Count: 1,
// id: "quark:pathfinders_quill",
// tag: {
// targetBiome: "minecraft:old_growth_pine_taiga",
// targetBiomeColor: 5980703,
// targetBiomeUnderground: 0,
// },
// },
// specialPrice: 0,
// uses: 0,
// xp: 15,
// },
// {
// buy: { Count: 1, id: "numismatics:crown" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 1, id: "bakery:strawberry_cake" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// {
// buy: { Count: 2, id: "numismatics:crown" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 1, id: "bakery:chocolate_cake" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// {
// buy: { Count: 2, id: "numismatics:cog" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 1, id: "bakery:sweetberry_cake" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// {
// buy: { Count: 2, id: "numismatics:crown" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 1, id: "atmospheric:yucca_gateau" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// {
// buy: { Count: 4, id: "numismatics:cog" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 1, id: "bakery:chocolate_gateau" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// {
// buy: { Count: 1, id: "society:prismatic_shard" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 1, id: "society:prize_ticket" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// {
// buy: { Count: 1, id: "society:prismatic_shard" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 1, id: "splendid_slimes:slime_ticket" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// {
// buy: { Count: 1, id: "society:prismatic_shard" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 4, id: "splendid_slimes:slime_candy" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// {
// buy: { Count: 2, id: "society:prismatic_shard" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 1, id: "pamhc2trees:cinnamon_sapling" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// {
// buy: { Count: 3, id: "society:prismatic_shard" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 1, id: "pamhc2trees:pawpaw_sapling" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// {
// buy: { Count: 3, id: "society:prismatic_shard" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 1, id: "pamhc2trees:hazelnut_sapling" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// {
// buy: { Count: 8, id: "society:prismatic_shard" },
// buyB: { Count: 0, id: "minecraft:air" },
// demand: 0,
// maxUses: 8,
// priceMultiplier: 0.05,
// rewardExp: 1,
// sell: { Count: 1, id: "pamhc2trees:lemon_sapling" },
// specialPrice: 0,
// uses: 0,
// xp: 1,
// },
// ],
// };
// freshVillager.setNbt(villagerNbt);
// freshVillager.spawn();
// target.setRemoved("unloaded_to_chunk");
// }
// });
// ItemEvents.entityInteracted((e) => {
// const { hand, level, target } = e;
// if (hand == "OFF_HAND") return;
// if (target.type !== "ribbits:ribbit") return;
// let updateThis = false;
// const nbt = target.nbt.toString();
// if (nbt.includes("cod") || nbt.includes("salmon")) updateThis = true;
// if (updateThis) {
// let freshVillager = level.createEntity("ribbits:ribbit");
// let villagerNbt = freshVillager.getNbt();
// villagerNbt.Brain.memories = target.nbt.Brain.memories;
// freshVillager.customName = target.customName;
// villagerNbt.Pos = [Number(target.x), Number(target.y), Number(target.z)];
// freshVillager.setNbt(villagerNbt);
// villagerNbt.RibbitData = {
// umbrella: "ribbits:umbrella_3",
// instrument: "ribbits:none",
// profession: "ribbits:fisherman",
// };
// villagerNbt.Offers = {
// Recipes: [
// {
// xp: 0,
// buy: { id: "minecraft:amethyst_shard", Count: 6 },
// sell: { id: "aquaculture:sushi", Count: 1 },
// uses: 0,
// priceMultiplier: 0.05,
// "quark:tier": 6,
// maxUses: 16,
// rewardExp: 1,
// demand: -32,
// specialPrice: 0,
// buyB: { id: "minecraft:air", tag: {}, Count: 0 },
// },
// {
// xp: 0,
// buy: { id: "minecraft:amethyst_shard", Count: 16 },
// sell: { id: "crabbersdelight:pearl", Count: 1 },
// uses: 0,
// priceMultiplier: 0.05,
// "quark:tier": 6,
// maxUses: 16,
// rewardExp: 1,
// demand: -32,
// specialPrice: 0,
// buyB: { id: "minecraft:air", tag: {}, Count: 0 },
// },
// {
// xp: 0,
// buy: { id: "society:amethyst_chunk", Count: 2 },
// sell: { id: "society:ribbit_drum", Count: 1 },
// uses: 0,
// priceMultiplier: 0.05,
// "quark:tier": 6,
// maxUses: 16,
// rewardExp: 1,
// demand: -32,
// specialPrice: 0,
// buyB: { id: "minecraft:air", tag: {}, Count: 0 },
// },
// {
// xp: 0,
// buy: { id: "society:amethyst_chunk", Count: 4 },
// sell: { id: "society:ribbit_gadget", Count: 1 },
// uses: 0,
// priceMultiplier: 0.05,
// "quark:tier": 6,
// maxUses: 16,
// rewardExp: 1,
// demand: -32,
// specialPrice: 0,
// buyB: { id: "minecraft:air", tag: {}, Count: 0 },
// },
// {
// xp: 0,
// buy: { id: "minecraft:amethyst_shard", Count: 32 },
// sell: { id: "furniture:iron_fish_tank", Count: 1 },
// uses: 0,
// priceMultiplier: 0.05,
// "quark:tier": 6,
// maxUses: 16,
// rewardExp: 1,
// demand: -32,
// specialPrice: 0,
// buyB: { id: "minecraft:air", tag: {}, Count: 0 },
// },
// {
// xp: 0,
// buy: { id: "minecraft:amethyst_shard", Count: 32 },
// sell: { id: "furniture:copper_fish_tank", Count: 1 },
// uses: 0,
// priceMultiplier: 0.05,
// "quark:tier": 6,
// maxUses: 16,
// rewardExp: 1,
// demand: -32,
// specialPrice: 0,
// buyB: { id: "minecraft:air", tag: {}, Count: 0 },
// },
// {
// xp: 0,
// buy: { id: "minecraft:amethyst_block", Count: 16 },
// sell: {
// id: "aquaculture:gold_fishing_rod",
// Count: 1,
// },
// uses: 0,
// priceMultiplier: 0.05,
// "quark:tier": 6,
// maxUses: 4,
// rewardExp: 1,
// demand: -8,
// specialPrice: 0,
// buyB: { id: "minecraft:air", tag: {}, Count: 0 },
// },
// {
// xp: 0,
// buy: { id: "society:aged_amethyst_cheese_block", Count: 4 },
// sell: { id: "society:river_jelly", Count: 1 },
// uses: 0,
// priceMultiplier: 0.05,
// "quark:tier": 6,
// maxUses: 16,
// rewardExp: 1,
// demand: -32,
// specialPrice: 0,
// buyB: { id: "minecraft:air", tag: {}, Count: 0 },
// },
// ],
// };
// freshVillager.setNbt(villagerNbt);
// freshVillager.spawn();
// target.setRemoved("unloaded_to_chunk");
// }
// });
@@ -0,0 +1 @@
// DEPRECATED
@@ -0,0 +1,82 @@
console.info("[SOCIETY] slimeTicket.js loaded");
const SlimeFavoriteFoods = {
all_seeing: { item: "minecraft:golden_carrot" },
bitwise: { item: "society:fire_opal" },
blazing: { item: "autumnity:cooked_turkey" },
bony: { item: "society:large_sheep_milk" },
boomcat: { item: "untitledduckmod:cooked_duck", entity: "untitledduckmod:duck" },
dusty: { item: "netherdepthsupgrade:bonefish", entity: "trials:bogged" },
ender: { item: "minecraft:amethyst_shard" },
gold: { item: "society:bell_pepper_preserves" },
juicy: { item: "vinery:jungle_grapes_red" },
luminous: { item: "vintagedelight:pickle" },
mechanic: { item: "oreganized:lead_ingot" },
minty: { item: "society:tubasmoke_stick" },
orby: { item: "society:dried_shimmering_mushrooms" },
phantom: { item: "minecraft:purple_bed" },
prisma: { item: "aquaculture:boulti" },
puddle: { item: "unusualfishmod:raw_sneep_snorp" },
rotting: { item: "minecraft:chicken", entity: "minecraft:chicken" },
shulking: { item: "minecraft:chorus_flower" },
slimy: { item: "farm_and_charm:strawberry" },
sparkcat: { item: "society:smoked_spindlefish" },
sweet: { item: "atmospheric:orange" },
webby: { item: "veggiesdelight:garlic" },
weeping: { item: "pamhc2trees:bananaitem" },
bear: { item: "buzzier_bees:crystallized_honey_block" },
};
ItemEvents.entityInteracted("splendid_slimes:splendid_slime", (e) => {
const { hand, player, level, target, server, item } = e;
if (hand == "OFF_HAND") return;
if (hand == "MAIN_HAND" && item === "splendid_slimes:slime_ticket") {
const slimeType = target.nbt.Breed.toString().path;
const favorites = SlimeFavoriteFoods[slimeType];
server.runCommandSilent(
`playsound chimes:block.iron.chime block @a ${player.x} ${player.y} ${player.z}`
);
level.spawnParticles(
"legendarycreatures:wisp_particle",
true,
target.x,
target.y + 1.5,
target.z,
0.1 * rnd(1, 4),
0.1 * rnd(1, 4),
0.1 * rnd(1, 4),
5,
0.01
);
const translatedSlimeName = global.translatableWithFallback(`slime.splendid_slimes.${slimeType}`, `${global.formatName(slimeType)}`);
const presentSender = global.translatableWithFallback("society.slime_ticket.sender", "Slime Ticket").getString();
if (favorites.item) {
player.give(
Item.of(
"supplementaries:present_pink",
`{BlockEntityTag:{Description:"${
Text.of(NBT.stringTag(`{"translate":"society.slime_ticket.favorite.item", "fallback":"%s Slime's favorite food :pink_heart:", "with":[${translatedSlimeName.toJson()}]}`)).getString()
}",ForgeCaps:{},Items:[{Count:1b,Slot:0b,id:"${
favorites.item
}"}],Recipient:"${player.username}",Sender:"${presentSender}",id:"supplementaries:present"}}`
)
);
}
if (favorites.entity) {
const translatedEntityName = global.getTranslatedEntityName(favorites.entity).toJson();
player.give(
Item.of(
"supplementaries:present_pink",
`{BlockEntityTag:{Description:"${
Text.of(NBT.stringTag(`{"translate":"society.slime_ticket.favorite.entity", "fallback":"%s Slime's favorite mob to eat :pink_heart:", "with":[${translatedSlimeName.toJson()}]}`)).getString()
}",ForgeCaps:{},Items:[{Count:1b,Slot:0b,id:"minecraft:paper",tag:{display:{Name:\'${
translatedEntityName
}\'}}}],Recipient:"${
player.username
}",Sender:"${presentSender}",id:"supplementaries:present"}}`
)
);
}
item.count--;
global.addItemCooldown(player, item, 10);
}
});
@@ -0,0 +1,15 @@
console.info("[SOCIETY] spawnBoomcat.js loaded");
EntityEvents.death((e) => {
const { level, server, entity } = e;
if (Math.random() < 0.2 && entity.type === "minecraft:creeper") {
let cat = level.createEntity("splendid_slimes:splendid_slime");
cat.nbt.Breed = "splendid_slimes:boomcat";
cat.mergeNbt({ Breed: "splendid_slimes:boomcat" });
cat.setPosition(entity.x, entity.y + 2, entity.z);
cat.spawn();
server.runCommandSilent(
`playsound supplementaries:block.present.open block @a ${entity.x} ${entity.y} ${entity.z}`
);
}
});
@@ -0,0 +1,37 @@
console.info("[SOCIETY] steadFastSkill.js loaded");
const steadfastThrottle = ((temp) => (entity, tick, identifier) => {
const { age, uuid } = entity;
const key = `${uuid}${identifier}`;
const now = temp[key];
if (!now || age - now >= tick) {
temp[key] = age;
return false;
}
return true;
})({});
EntityEvents.hurt((e) => {
const { server, level, entity } = e;
// Fix windswept bug
if (entity.isPlayer() && entity.getTicksFrozen() > 140) entity.setTicksFrozen(140);
if (!entity.isPlayer() || steadfastThrottle(entity, 20, "steadfast_throttle")) return;
if (entity.isPlayer() && Math.random() < 0.2 && entity.stages.has("steadfast")) {
entity.heal(2);
level.spawnParticles(
"minecraft:heart",
true,
entity.x,
entity.y + 1.5,
entity.z,
0.1 * rnd(1, 4),
0.1 * rnd(1, 4),
0.1 * rnd(1, 4),
5,
0.01
);
server.runCommandSilent(
`playsound species:item.wicked_treat.apply block @a ${entity.x} ${entity.y} ${entity.z}`
);
}
});