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
+65
View File
@@ -0,0 +1,65 @@
JEIEvents.addItems((e) => {
e.add("displaydelight:food_plate")
e.add("displaydelight:small_food_plate")
e.add("minecraft:bundle");
e.add("snowyspirit:ginger_crate");
const trophies = [
Item.of(
"trofers:large_pillar",
'{BlockEntityTag:{Trophy:"trofers:pantry"}}'
),
Item.of(
"trofers:large_pillar",
'{BlockEntityTag:{Trophy:"trofers:vault"}}'
),
Item.of(
"trofers:large_pillar",
'{BlockEntityTag:{Trophy:"trofers:boiler_room"}}'
),
Item.of(
"trofers:large_pillar",
'{BlockEntityTag:{Trophy:"trofers:crafts_room"}}'
),
Item.of(
"trofers:large_pillar",
'{BlockEntityTag:{Trophy:"trofers:fish_tank"}}'
),
Item.of(
"trofers:large_pillar",
'{BlockEntityTag:{Trophy:"trofers:artifacts"}}'
),
Item.of(
"trofers:large_pillar",
'{BlockEntityTag:{Trophy:"trofers:minerals"}}'
),
Item.of(
"trofers:large_pillar",
'{BlockEntityTag:{Trophy:"trofers:crops"}}'
),
Item.of("trofers:large_pillar", '{BlockEntityTag:{Trophy:"trofers:fish"}}'),
Item.of(
"trofers:large_pillar",
'{BlockEntityTag:{Trophy:"trofers:brews"}}'
),
Item.of("trofers:large_pillar", '{BlockEntityTag:{Trophy:"trofers:gems"}}'),
Item.of(
"trofers:large_pillar",
'{BlockEntityTag:{Trophy:"trofers:relics"}}'
),
Item.of(
"trofers:large_pillar",
'{BlockEntityTag:{Trophy:"trofers:cooking"}}'
),
Item.of(
"trofers:large_pillar",
'{BlockEntityTag:{Trophy:"trofers:wheels"}}'
),
Item.of(
"trofers:large_pillar",
'{BlockEntityTag:{Trophy:"trofers:perfection"}}'
),
];
trophies.forEach((item) => {
e.add(item);
});
});
+563
View File
@@ -0,0 +1,563 @@
const registerBECategory = (
event,
categoryID,
block,
title,
inputCount,
days
) => {
event.custom(`society:${categoryID}`, (category) => {
const {
jeiHelpers: { guiHelper },
} = category;
category
.title(title)
.background(
guiHelper.createDrawable(
"society:textures/gui/block_entity.png",
1,
1,
142,
42
)
)
.icon(guiHelper.createDrawableItemStack(Item.of(`society:${block}`)))
.isRecipeHandled((recipe) => {
return !!(
recipe?.data?.input !== undefined &&
recipe?.data?.output !== undefined
);
})
.setDrawHandler((recipe, recipeSlotsView, guiGraphics) => {
let dayCount = recipe.getRecipeData().time || days;
guiGraphics.drawWordWrap(
Client.font,
dayCount < 1
? Text.translatable("jei.society.working_block_entity.short")
: dayCount > 1
? Text.translatable("jei.society.working_block_entity.days", `${dayCount}`)
: Text.translatable("jei.society.working_block_entity.day", `${dayCount}`),
72,
29,
177,
0
);
})
.handleLookup((builder, recipe) => {
const { input, output, fluidOutput } = recipe.data;
const slotSize = 21;
if (input.includes("#")) {
builder
.addSlot("INPUT", 2, 2)
.addIngredients([Ingredient.of(input, 2)])
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
} else {
builder
.addSlot("INPUT", 2, 2)
.addItemStack(
`${output[0].includes("steamed_milk") ? 1 : inputCount}x ${input}`
)
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
}
builder.addSlot("CATALYST", 52, 2).addItemStack(`society:${block}`);
if (fluidOutput && categoryID !== "tapping") {
builder
.addSlot("OUTPUT", 104, 2)
.addFluidStack(`${fluidOutput}`)
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
} else {
output.forEach((item, index) => {
builder
.addSlot("OUTPUT", 104 + index * slotSize, 2)
.addItemStack(Item.of(`${item}`))
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
});
}
});
});
};
const registerMushroomLogCategory = (
event,
categoryID,
title
) => {
event.custom(`society:${categoryID}`, (category) => {
const {
jeiHelpers: { guiHelper },
} = category;
category
.title(title)
.background(
guiHelper.createDrawable(
"society:textures/gui/block_entity.png",
1,
1,
142,
42
)
)
.icon(guiHelper.createDrawableItemStack(Item.of(`society:mushroom_log`)))
.isRecipeHandled((recipe) => {
return !!(
recipe?.data?.input !== undefined &&
recipe?.data?.output !== undefined
);
})
.setDrawHandler((recipe, recipeSlotsView, guiGraphics) => {
guiGraphics.drawWordWrap(
Client.font,
Text.translatable("jei.society.working_block_entity.days", 4),
72,
29,
177,
0
);
})
.handleLookup((builder, recipe) => {
const { input, output } = recipe.data;
const slotSize = 21;
const isStrong = global.dominantMushroomLogBlocks.get(input) !== undefined
if (isStrong) {
builder
.addSlot("INPUT", 2, 2)
.addItemStack(
`1x ${input}`
)
.addTooltipCallback((slotView, tooltip) => {
tooltip.add(1,
Text.translatable(`jei.society.mushroom_growing.strong`).darkGreen()
);
})
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
} else {
builder
.addSlot("INPUT", 2, 2)
.addItemStack(
`1x ${input}`
)
.addTooltipCallback((slotView, tooltip) => {
tooltip.add(1,
Text.translatable(`jei.society.mushroom_growing.weak`).aqua()
);
})
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
}
builder.addSlot("CATALYST", 52, 2).addItemStack(`society:mushroom_log`);
output.forEach((item, index) => {
builder
.addSlot("OUTPUT", 104 + index * slotSize, 2)
.addItemStack(Item.of(`${item}`))
.addTooltipCallback((slotView, tooltip) => {
tooltip.add(1,
Text.translatable("jei.society.mushroom_growing.mult").green()
);
})
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
});
});
});
};
const registerFishPondCategory = (event, categoryID, block, title) => {
event.custom(`society:${categoryID}`, (category) => {
const {
jeiHelpers: { guiHelper },
} = category;
category
.title(title)
.background(guiHelper.createBlankDrawable(177, 61))
.icon(guiHelper.createDrawableItemStack(Item.of(`society:${block}`)))
.isRecipeHandled((recipe) => {
return !!(recipe?.data?.item !== undefined);
})
.setDrawHandler(
(recipe, recipeSlotsView, guiGraphics, mouseX, mouseY) => {
global["textDrawHandler"](
category.jeiHelpers,
recipe,
recipeSlotsView,
guiGraphics,
mouseX,
mouseY
);
}
)
.handleLookup((builder, recipe) => {
const { item, additionalRewards } = recipe.data;
let fishId = item.path;
if (fishId.includes("raw_")) {
if (fishId === "raw_snowflake") fishId = "frosty_fin";
else fishId = fishId.substring(4, fishId.length);
}
const outputs = [
{
item: `society:${fishId}_roe`,
count: 1,
},
].concat(additionalRewards || []);
const slotSize = 21;
builder
.addSlot("CATALYST", 2, 28)
.addItemStack(`society:fish_pond`)
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
builder
.addSlot("INPUT", 2, 2)
.addItemStack(`${item}`)
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
global["textDrawHandler"] = (
jeiHelpers,
recipe,
recipeSlotsView,
guiGraphics
) => {
guiGraphics.drawWordWrap(
Client.font,
Text.translatable("jei.society.working_block_entity.item"),
2,
49,
177,
0
);
};
outputs.forEach((reward, index) => {
const line = index > 6 ? 28 : 2;
builder
.addSlot(
"OUTPUT",
26 + (index > 6 ? index - 7 : index) * slotSize,
line
)
.addItemStack(Item.of(`${reward.count}x ${reward.item}`))
.addTooltipCallback((slotView, tooltip) => {
if (reward.minPopulation) {
tooltip.add(1,
Text.translatable("jei.society.fish_farming.population", `${reward.minPopulation}`).aqua()
);
}
if (reward.chance) {
tooltip.add(2,
Text.translatable("jei.society.husbandry.chance", `${Math.round(reward.chance * 100)}`).gold()
);
}
})
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
});
});
});
};
JEIAddedEvents.registerCategories((e) => {
registerBECategory(e, "seed_making", "seed_maker", Text.translatable("jei.society.category.seed_making"), 3, 1);
registerBECategory(e, "preserving", "preserves_jar", Text.translatable("jei.society.category.preserving"), 5, 3);
registerBECategory(e, "wine_making", "wine_keg", Text.translatable("jei.society.category.wine_making"), 3, 6);
registerBECategory(e,
"bait_upgrading",
"deluxe_worm_farm",
Text.translatable("jei.society.category.bait_upgrading"),
4,
0.5
);
registerBECategory(e, "cask_aging", "aging_cask", Text.translatable("jei.society.category.cask_aging"), 1, 10);
registerBECategory(
e,
"artisanal_cheese_pressing",
"cheese_press",
Text.translatable("jei.society.category.artisanal_cheese_pressing"),
1,
2
);
registerBECategory(e,
"ancient_aging",
"ancient_cask",
Text.translatable("jei.society.category.ancient_aging"),
1,
20
);
registerMushroomLogCategory(e, "mushroom_growing", Text.translatable("jei.society.category.mushroom_growing"));
registerBECategory(e, "dehydrating", "dehydrator", Text.translatable("jei.society.category.dehydrating"), 8, 1);
registerBECategory(e, "fish_smoking", "fish_smoker", Text.translatable("jei.society.category.fish_smoking"), 1, 2);
registerBECategory(e, "bait_making", "bait_maker", Text.translatable("jei.society.category.bait_making"), 1, 1);
registerBECategory(e,
"mayonnaise_making",
"mayonnaise_machine",
Text.translatable("jei.society.category.mayonnaise_making"),
1,
1
);
registerBECategory(e, "loom_weaving", "loom", Text.translatable("jei.society.category.loom_weaving"), 5, 1);
registerBECategory(e,
"crystal_growing",
"crystalarium",
Text.translatable("jei.society.category.crystal_growing"),
1,
5
);
registerFishPondCategory(e, "fish_farming", "fish_pond", Text.translatable("jei.society.category.fish_farming"));
registerBECategory(e, "charging", "charging_rod", Text.translatable("jei.society.category.charging"), 1, 5);
registerBECategory(e,
"espresso_brewing",
"espresso_machine",
Text.translatable("jei.society.category.espresso_brewing"),
4,
0.5
);
registerBECategory(e,
"goddess_offering",
"ancient_goddess_statue",
Text.translatable("jei.society.category.goddess_offering"),
64,
0
);
registerBECategory(e, "recycling", "recycling_machine", Text.translatable("jei.society.category.recycling"), 1, 1);
registerBECategory(e, "oil_making", "oil_maker", Text.translatable("jei.society.category.oil_making"), 1, 1);
registerBECategory(e, "tapping", "tapper", Text.translatable("jei.society.category.tapping"), 1, 7);
registerBECategory(e, "auto_tapping", "auto_tapper", Text.translatable("jei.society.category.auto_tapping"), 1, 0.5);
registerBECategory(e, "pickling", "pickling_can", Text.translatable("jei.society.category.pickling"), 1, 0.5);
});
// JEI Catalysts broken on JEI version
// JEI Catalyst code broken on latest JEI version
// JEIAddedEvents.registerRecipeCatalysts((e) => {
// let helper = e.data.getJeiHelpers();
// e.data.addRecipeCatalyst(
// Item.of("society:seed_maker"),
// helper.getRecipeType("society:seed_making").get()
// );
// e.data.addRecipeCatalyst(
// Item.of("society:preserves_jar"),
// helper.getRecipeType("society:preserving").get()
// );
// e.data.addRecipeCatalyst(
// Item.of("society:deluxe_worm_farm"),
// helper.getRecipeType("society:bait_upgrading").get()
// );
// e.data.addRecipeCatalyst(
// Item.of("society:aging_cask"),
// helper.getRecipeType("society:cask_aging").get()
// );
// e.data.addRecipeCatalyst(
// Item.of("society:fish_smoker"),
// helper.getRecipeType("society:fish_smoking").get()
// );
// e.data.addRecipeCatalyst(
// Item.of("society:mayonnaise_machine"),
// helper.getRecipeType("society:mayonnaise_making").get()
// );
// e.data.addRecipeCatalyst(
// Item.of("society:loom"),
// helper.getRecipeType("society:loom_weaving").get()
// );
// e.data.addRecipeCatalyst(
// Item.of("society:crystalarium"),
// helper.getRecipeType("society:crystal_growing").get()
// );
// e.data.addRecipeCatalyst(
// Item.of("society:fish_pond"),
// helper.getRecipeType("society:fish_farming").get()
// );
// });
JEIAddedEvents.registerRecipes((e) => {
let recipe;
Array.from(global.seedMakerRecipes.keys()).forEach((element) => {
recipe = global.seedMakerRecipes.get(element);
e.custom("society:seed_making").add({
input: element,
output: recipe.output,
time: recipe.time,
fluidOutput: recipe.fluidOutput,
});
});
Array.from(global.preservesJarRecipes.keys()).forEach((element) => {
recipe = global.preservesJarRecipes.get(element);
e.custom("society:preserving").add({
input: element,
output: recipe.output,
time: recipe.time,
fluidOutput: recipe.fluidOutput,
});
});
Array.from(global.wineKegRecipes.keys()).forEach((element) => {
recipe = global.wineKegRecipes.get(element);
e.custom("society:wine_making").add({
input: element,
output: recipe.output,
time: recipe.time,
fluidOutput: recipe.fluidOutput,
});
});
Array.from(global.deluxeWormFarmRecipes.keys()).forEach((element) => {
recipe = global.deluxeWormFarmRecipes.get(element);
e.custom("society:bait_upgrading").add({
input: element,
output: recipe.output,
time: recipe.time,
fluidOutput: recipe.fluidOutput,
});
});
Array.from(global.cheesePressRecipes.keys()).forEach((element) => {
recipe = global.cheesePressRecipes.get(element);
e.custom("society:artisanal_cheese_pressing").add({
input: element,
output: recipe.output,
time: recipe.time,
fluidOutput: recipe.fluidOutput,
});
});
Array.from(global.agingCaskRecipes.keys()).forEach((element) => {
recipe = global.agingCaskRecipes.get(element);
e.custom("society:cask_aging").add({
input: element,
output: recipe.output,
time: recipe.time,
fluidOutput: recipe.fluidOutput,
});
});
Array.from(global.ancientCaskRecipes.keys()).forEach((element) => {
recipe = global.ancientCaskRecipes.get(element);
e.custom("society:ancient_aging").add({
input: element,
output: recipe.output,
time: recipe.time,
fluidOutput: recipe.fluidOutput,
});
});
Array.from(global.dehydratorRecipes.keys()).forEach((element) => {
recipe = global.dehydratorRecipes.get(element);
e.custom("society:dehydrating").add({
input: element,
output: recipe.output,
time: recipe.time,
fluidOutput: recipe.fluidOutput,
});
});
Array.from(global.fishSmokerRecipes.keys()).forEach((element) => {
recipe = global.fishSmokerRecipes.get(element);
e.custom("society:fish_smoking").add({
input: element,
output: recipe.output,
time: recipe.time,
fluidOutput: recipe.fluidOutput,
});
});
Array.from(global.baitMakerRecipes.keys()).forEach((element) => {
recipe = global.baitMakerRecipes.get(element);
e.custom("society:bait_making").add({
input: element,
output: recipe.output,
time: recipe.time,
fluidOutput: recipe.fluidOutput,
});
});
Array.from(global.mayonnaiseMachineRecipes.keys()).forEach((element) => {
recipe = global.mayonnaiseMachineRecipes.get(element);
e.custom("society:mayonnaise_making").add({
input: element,
output: recipe.output,
time: recipe.time,
fluidOutput: recipe.fluidOutput,
});
});
Array.from(global.loomRecipes.keys()).forEach((element) => {
recipe = global.loomRecipes.get(element);
e.custom("society:loom_weaving").add({
input: element,
output: recipe.output,
time: recipe.time,
fluidOutput: recipe.fluidOutput,
});
});
Array.from(global.crystalariumCrystals.keys()).forEach((element) => {
recipe = global.crystalariumCrystals.get(element);
e.custom("society:crystal_growing").add({
input: element,
output: recipe.output,
time: recipe.time,
fluidOutput: recipe.fluidOutput,
});
});
Array.from(global.mushroomLogRecipes.keys()).forEach((element) => {
recipe = global.mushroomLogRecipes.get(element);
e.custom("society:mushroom_growing").add({
input: element,
output: recipe.output,
});
});
Array.from(global.fishPondDefinitions.keys()).forEach((element) => {
recipe = global.fishPondDefinitions.get(element);
e.custom("society:fish_farming").add({
item: element,
additionalRewards: recipe.additionalRewards,
});
});
e.custom("society:charging").add({ input: "", output: ["society:battery"] });
Array.from(global.espressoMachineRecipes.keys()).forEach((element) => {
recipe = global.espressoMachineRecipes.get(element);
e.custom("society:espresso_brewing").add({
input: element,
output: recipe.output,
time: recipe.time,
fluidOutput: recipe.fluidOutput,
});
});
[
{ input: "society:ancient_fruit", output: ["society:prismatic_shard"] },
{
input: "vintagedelight:ghost_pepper",
output: ["64x society:sparkstone"],
},
{
input: "farm_and_charm:corn",
output: ["4x society:pristine_star_shards"],
},
{ input: "snowyspirit:ginger", output: ["4x minecraft:netherite_scrap"] },
].forEach((element) => {
e.custom("society:goddess_offering").add(element);
});
Array.from(global.recyclingMachineRecipes.keys()).forEach((element) => {
recipe = global.recyclingMachineRecipes.get(element);
e.custom("society:recycling").add({
input: element,
output: recipe.output,
time: recipe.time,
fluidOutput: recipe.fluidOutput,
});
});
Array.from(global.oilMakerRecipes.keys()).forEach((element) => {
recipe = global.oilMakerRecipes.get(element);
e.custom("society:oil_making").add({
input: element,
output: recipe.output,
time: recipe.time,
fluidOutput: recipe.fluidOutput,
});
});
Array.from(global.tapperRecipes.keys()).forEach((element) => {
recipe = global.tapperRecipes.get(element);
e.custom("society:tapping").add({
input: element,
output: recipe.output,
time: recipe.time,
fluidOutput: recipe.fluidOutput,
});
});
Array.from(global.tapperRecipes.keys()).forEach((element) => {
recipe = global.tapperRecipes.get(element);
e.custom("society:auto_tapping").add({
input: element,
output: recipe.output,
time: recipe.time,
fluidOutput: recipe.fluidOutput,
});
});
Array.from(global.picklingRecipes.keys()).forEach((element) => {
recipe = global.picklingRecipes.get(element);
e.custom("society:pickling").add({
input: element,
output: [recipe.pickle],
time: recipe.time,
fluidOutput: recipe.fluidOutput,
});
});
});
+56
View File
@@ -0,0 +1,56 @@
const registerExtractingCategory = (event, title) => {
event.custom("society:extracting", (category) => {
const {
jeiHelpers: { guiHelper },
} = category;
category
.title(title)
.background(guiHelper.createBlankDrawable(144, 144))
.icon(guiHelper.createDrawableItemStack(Item.of("extractinator:extractinator")))
.isRecipeHandled((recipe) => {
return !!(recipe?.data?.input !== undefined && recipe?.data?.outputs !== undefined);
})
.handleLookup((builder, recipe) => {
const { input, outputs } = recipe.data;
const slotSize = 18;
builder
.addSlot("CATALYST", 55, 2)
.addItemStack(Item.of("extractinator:extractinator"))
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
builder
.addSlot("INPUT", 73, 2)
.addItemStack(input)
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
for (let i = 0; i < 8; i++) {
for (let j = 0; j < 7; j++) {
let index = 8 * j + i;
if (outputs.length > index) {
builder
.addSlot("OUTPUT", i * slotSize + 1, j * slotSize + 21)
.addItemStack(Item.of(`1x ${outputs[index]}`))
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
}
}
}
});
});
};
JEIAddedEvents.registerCategories((e) => {
registerExtractingCategory(e, Text.translatable("jei.society.category.extracting"));
});
JEIAddedEvents.registerRecipes((e) => {
global.extractinatorRecipes.forEach((element) => {
const outputMap = element.output.map((item) => item.drop);
let drops = [];
outputMap.forEach((drop) => {
Ingredient.of(drop).itemIds.forEach((element) => {
drops.push(element);
});
});
e.custom("society:extracting").add({
input: element.input,
outputs: drops,
});
});
});
+4
View File
@@ -0,0 +1,4 @@
JEIEvents.hideItems((e) => {
e.hide(global.removedItems);
e.hide(global.hiddenItems);
});
+222
View File
@@ -0,0 +1,222 @@
const registerMilkingCategory = (event, equipment, title) => {
event.custom("society:milking", (category) => {
const {
jeiHelpers: { guiHelper },
} = category;
category
.title(title)
.background(guiHelper.createDrawable("society:textures/gui/milking.png", 1, 1, 148, 40))
.icon(guiHelper.createDrawableItemStack(Item.of(equipment)))
.isRecipeHandled((recipe) => {
return !!(recipe?.data?.animal !== undefined);
})
.setDrawHandler((recipe, recipeSlotsView, guiGraphics) => {
guiGraphics.drawWordWrap(
Client.font,
Text.translatable(
"jei.society.husbandry.cooldown",
Text.translatable(
`jei.society.working_block_entity.day${recipe.getRecipeData().cooldown > 1 ? "s" : ""}`,
`${recipe.getRecipeData().cooldown}`
)
),
2,
26,
177,
0
);
})
.handleLookup((builder, recipe) => {
const { animal, milk } = recipe.data;
const outputs = [
{
item: milk.sm,
count: 1,
},
{
item: milk.lg,
count: 1,
},
];
const slotSize = 21;
builder
.addSlot("CATALYST", 48, 2)
.addItemStack(equipment)
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
builder
.addSlot("INPUT", 2, 2)
.addItemStack(`${animal}_spawn_egg`)
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
outputs.forEach((reward, index) => {
builder
.addSlot("OUTPUT", 104 + index * slotSize, 2)
.addItemStack(Item.of(`${reward.count}x ${reward.item}`))
.addTooltipCallback((slotView, tooltip) => {
if (index == 0) {
tooltip.add(1, Text.translatable("jei.society.husbandry.affection.range", `1-5`).lightPurple());
} else {
tooltip.add(1, Text.translatable("jei.society.husbandry.affection.over", `6`).lightPurple());
}
})
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
});
});
});
};
const registerForagingCategory = (event, title) => {
event.custom("society:foraging", (category) => {
const {
jeiHelpers: { guiHelper },
} = category;
category
.title(title)
.background(guiHelper.createDrawable("society:textures/gui/foraging.png", 1, 1, 174, 40))
.icon(guiHelper.createDrawableItemStack(Item.of("society:truffle")))
.isRecipeHandled((recipe) => {
return !!(recipe?.data?.animal !== undefined);
})
.setDrawHandler((recipe, recipeSlotsView, guiGraphics, mouseX, mouseY) => {
global["textDrawHandler"](
category.jeiHelpers,
recipe,
recipeSlotsView,
guiGraphics,
mouseX,
mouseY
);
})
.handleLookup((builder, recipe) => {
const { animal, forages } = recipe.data;
const slotSize = 21;
builder
.addSlot("INPUT", 2, 2)
.addItemStack(`${animal}_spawn_egg`)
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
global["textDrawHandler"] = (jeiHelpers, recipe, recipeSlotsView, guiGraphics) => {
guiGraphics.drawWordWrap(
Client.font,
Text.translatable("jei.society.working_block_entity.item"),
2,
28,
177,
0
);
};
forages.forEach((forage, index) => {
if (forage.itemPool) {
forage.itemPool.forEach((poolItem, poolIndex) => {
// Keep itemPool forages at end of pool to ensure calculation correct
builder
.addSlot("OUTPUT", 50 + (index + poolIndex) * slotSize, 2)
.addItemStack(Item.of(`${forage.countMult}x ${poolItem}`))
.addTooltipCallback((slotView, tooltip) => {
tooltip.add(1, Text.translatable("jei.society.husbandry.affection.over", `${forage.minHearts}`).lightPurple());
tooltip.add(2, Text.translatable("jei.society.husbandry.pool").gold());
tooltip.add(
3,
Text.translatable("jei.society.husbandry.pool.roll", `${Math.round(forage.chance * 100)}`).gold()
);
tooltip.add(
4,
Text.translatable(
"jei.society.husbandry.pool.select", `${Math.round((1 / forage.itemPool.length) * 100)}`
).gold()
);
if (forage.hasQuality) {
tooltip.add(5, Text.translatable("jei.society.husbandry.affection.quality").green());
}
})
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
});
} else {
builder
.addSlot("OUTPUT", 50 + index * slotSize, 2)
.addItemStack(Item.of(`${forage.countMult}x ${forage.item}`))
.addTooltipCallback((slotView, tooltip) => {
tooltip.add(1, Text.translatable("jei.society.husbandry.affection.over", `${forage.minHearts}`).lightPurple());
tooltip.add(2, Text.translatable("jei.society.husbandry.chance", `${Math.round(forage.chance * 100)}`).gold());
if (forage.hasQuality) {
tooltip.add(3, Text.translatable("jei.society.husbandry.affection.quality").green());
}
})
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
}
});
});
});
};
const registerGiftCategory = (event, title) => {
event.custom("society:pet_gifts", (category) => {
const {
jeiHelpers: { guiHelper },
} = category;
category
.title(title)
.background(guiHelper.createDrawable("society:textures/gui/gifting.png", 1, 1, 174, 40))
.icon(guiHelper.createDrawableItemStack(Item.of("supplementaries:present_magenta")))
.isRecipeHandled((recipe) => {
return !!(recipe?.data?.animal !== undefined);
})
.setDrawHandler((recipe, recipeSlotsView, guiGraphics, mouseX, mouseY) => {
global["textDrawHandler"](
category.jeiHelpers,
recipe,
recipeSlotsView,
guiGraphics,
mouseX,
mouseY
);
})
.handleLookup((builder, recipe) => {
const { animal, gifts } = recipe.data;
const slotSize = 21;
builder
.addSlot("INPUT", 2, 2)
.addItemStack(`${animal}_spawn_egg`)
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
global["textDrawHandler"] = (jeiHelpers, recipe, recipeSlotsView, guiGraphics) => {
guiGraphics.drawWordWrap(
Client.font,
Text.translatable("jei.society.working_block_entity.item"),
2,
28,
177,
0
);
};
gifts.forEach((item, index) => {
builder
.addSlot("OUTPUT", 50 + index * slotSize, 2)
.addItemStack(Item.of(`1x ${item}`))
.addTooltipCallback((slotView, tooltip) => {
tooltip.add(1, Text.translatable("jei.society.husbandry.affection.at", `10`).lightPurple());
tooltip.add(
2,
Text.translatable("jei.society.husbandry.pool.select", `${Math.round((1 / gifts.length) * 100)}`).gold()
);
})
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
});
});
});
};
JEIAddedEvents.registerCategories((e) => {
registerMilkingCategory(e, "society:milk_pail", Text.translatable("jei.society.category.milking"));
registerForagingCategory(e, Text.translatable("jei.society.category.foraging"));
registerGiftCategory(e, Text.translatable("jei.society.category.pet_gifts"));
});
JEIAddedEvents.registerRecipes((e) => {
global.husbandryMilkingDefinitions.forEach((element) => {
e.custom("society:milking").add(element);
});
global.husbandryForagingDefinitions.forEach((element) => {
e.custom("society:foraging").add(element);
});
global.petGifts.forEach((element) => {
e.custom("society:pet_gifts").add(element);
});
});
+327
View File
@@ -0,0 +1,327 @@
const $Block = Java.loadClass("net.minecraft.world.level.block.Block");
const $IntegerProperty = Java.loadClass(
"net.minecraft.world.level.block.state.properties.IntegerProperty"
);
const $BooleanProperty = Java.loadClass(
"net.minecraft.world.level.block.state.properties.BooleanProperty"
);
const $CropBlock = Java.loadClass(
"net.minecraft.world.level.block.CropBlock"
);
const $SereneFertility = Java.loadClass("sereneseasons.init.ModFertility");
const $JadeCropInfo = Java.loadClass("snownee.jade.addon.vanilla.CropProgressProvider");
const $DewdropConfig = Java.loadClass("cool.bot.dewdropfarmland.Config");
const Vec2 = Java.loadClass("net.minecraft.world.phys.Vec2");
global["JadePlushieClientCallback"] = (tooltip, accessor, pluginConfig) => {
if (!global.plushies.includes(accessor.getBlock().id)) return;
const nbt = accessor.getServerData();
if (nbt.type.equals("")) return;
const type = nbt.type;
let typeData = global.plushieTraits[type];
const affection = Number(nbt.affection);
const quality = Number(nbt.quality);
let blockName = accessor.getBlock().getDescriptionId();
tooltip.clear();
tooltip.add(Component.translatable(blockName));
tooltip.add(`§6${"★".repeat(quality + 1)}§8${"☆".repeat(3 - quality)}`);
tooltip.add(`§${typeData.color}${global.formatName(typeData.trait)}`);
if (nbt.animal) {
tooltip.add(global.getTranslatedEntityName(String(nbt.animal)));
} else {
tooltip.add(
`§c${affection > 0 ? ``.repeat(affection) : ""}§8${
affection < 4 ? ``.repeat(4 - affection) : ""
}`
);
}
};
global["JadeShippingBinClientCallback"] = (tooltip, accessor, pluginConfig) => {
const blockId = accessor.getBlock().id;
if (blockId !== "shippingbin:basic_shipping_bin" && blockId !== "shippingbin:smart_shipping_bin") return;
const nbt = accessor.getServerData();
let customName = global.getShippingBinName(nbt, false);
if (customName) tooltip.add(customName);
};
global["JadeFishPondClientCallback"] = (tooltip, accessor, pluginConfig) => {
if (accessor.getBlock().id !== "society:fish_pond") return;
const properties = accessor.getBlockState();
const nbt = accessor.getServerData();
if (nbt.type.equals("")) return;
let fish = nbt.type;
const upgraded = properties.getValue($BooleanProperty.create("upgraded"));
let fishIcons = "";
for (let index = 0; index < nbt.max_population; index++) {
if (index < nbt.population) fishIcons += "§3⏳§r";
else fishIcons += "§7⏳§r";
}
let blockName = accessor.getBlock().getDescriptionId();
tooltip.clear();
const helper = tooltip.getElementHelper();
const fishIcon = helper
.item(Item.of(fish), 0.5)
.message(null)
.translate(Vec2(-2, -1));
tooltip.add(Component.translatable(blockName));
tooltip["add(snownee.jade.api.ui.IElement)"](fishIcon);
tooltip.append(Component.translatable(Item.of(fish).getDescriptionId()));
if (upgraded) {
tooltip["add(snownee.jade.api.ui.IElement)"](
helper
.item(Item.of("society:sea_biscut"), 0.5)
.message(null)
.translate(Vec2(-2, -1))
);
tooltip.append(fishIcons);
} else {
tooltip.add(fishIcons);
}
};
global["JadeArtisanMachineClientCallback"] = (
tooltip,
accessor,
pluginConfig
) => {
if (!global.artisanMachineIds.includes(accessor.getBlock().id)) return;
const properties = accessor.getBlockState();
const nbt = accessor.getServerData();
if (!nbt) return;
const machine = global.artisanMachineDefinitions.filter((obj) => {
return obj.id === accessor.getBlock().id;
})[0];
if (!machine) return;
const isChargingRod = accessor.getBlock().id === "society:charging_rod";
const working = properties.getValue($BooleanProperty.create("working"));
if (!working || (nbt.recipe.equals("") && !isChargingRod)) return;
const recipe = isChargingRod
? {
output: ["society:battery"],
}
: machine.recipes.get(nbt.recipe);
const stage = nbt.stage;
const upgraded = properties.getValue($BooleanProperty.create("upgraded"));
let duration = recipe.time || machine.stageCount;
if (accessor.getBlock().id == "society:aging_cask" && upgraded) {
duration = Math.round(duration / 2);
}
let progressIcons = "";
for (let index = 0; index < duration; index++) {
if (index < stage) progressIcons += "⬛";
else progressIcons += "⬜";
}
const progress = Text.translatable(
"jade.society.working_block_entity.progress",
`${Number(stage)}`,
`${duration}`
);
let blockName = accessor.getBlock().getDescriptionId();
tooltip.clear();
const helper = tooltip.getElementHelper();
const recipeIcon = helper
.item(Item.of(recipe.output[0]), 0.5)
.message(null)
.translate(Vec2(-2, -1));
tooltip.add(Component.translatable(blockName));
tooltip["add(snownee.jade.api.ui.IElement)"](recipeIcon);
tooltip.append(
Component.translatable(Item.of(recipe.output[0]).getDescriptionId())
);
if (upgraded) {
tooltip["add(snownee.jade.api.ui.IElement)"](
helper
.item(Item.of(machine.upgrade), 0.5)
.message(null)
.translate(Vec2(-2, -1))
);
tooltip.append(progress);
} else {
tooltip.add(progress);
}
tooltip["append(snownee.jade.api.ui.IElement)"](
helper
.item(Item.of("minecraft:clock"), 0.5)
.message(null)
.translate(Vec2(-2, -1))
);
};
global["JadeSocietyCropClientCallback"] = (
tooltip,
accessor,
pluginConfig
) => {
const block = accessor.getBlock();
const position = accessor.getPosition();
const level = accessor.getLevel();
const blockContainer = level.getBlock(position);
const state = accessor.getBlockState();
const name = block.getIdLocation().toString();
const strictGreenhouse = $DewdropConfig.strictGreenhouses;
const soil = (() => {
let scannedBlock;
for (let i = -2; i < 0 ; i++) {
scannedBlock = level.getBlock(position.above(i));
if (scannedBlock.getId().includes("farmland") || scannedBlock.getId().includes("garden_pot")) {
return scannedBlock;
}
}
return null;
})();
const needsFarmland = ([
"minecraft:sweet_berry_bush",
"windswept:wild_berry_bush",
"vintagedelight:gearo_berry_bush",
"farmersdelight:rice",
"farmersdelight:rice_panicles"
].includes(name));
const fertilizerNotApplies = [
"farmersdelight:rice_panicles"
];
const grapeMap = {
red: "vinery:red_grape_seeds",
white: "vinery:white_grape_seeds",
savanna_red: "vinery:savanna_grape_seeds_red",
savanna_white: "vinery:savanna_grape_seeds_white",
taiga_red: "vinery:taiga_grape_seeds_red",
taiga_white: "vinery:taiga_grape_seeds_white",
jungle_red: "vinery:jungle_grape_seeds_red",
jungle_white: "vinery:jungle_grape_seeds_white",
crimson: "nethervinery:crimson_grape_seeds",
warped: "nethervinery:warped_grape_seeds"
};
const hasGreenhouseGlass = () => {
let scannedBlock;
for (let i = 0; i < 16; i++) {
scannedBlock = level.getBlock(position.above(i + 1));
if (strictGreenhouse && scannedBlock.hasTag("dewdrop:waterable")) return false;
if (scannedBlock.hasTag("sereneseasons:greenhouse_glass")) {
return true;
}
}
return false;
};
const hasAvailableGardenPot = () => {
const pot = soil;
if (!pot || !pot.getId().includes("dew_drop_farmland_growth:garden_pot")) return false;
if (!level.canSeeSky(position.above())) return true;
return false;
};
const getGrowthDay = (age, maxAge) => {
const farmland = soil;
if (!farmland || fertilizerNotApplies.includes(name)) return {age: age, maxAge: maxAge, boosted: false};
let delta = 0;
if (farmland.hasTag("dew_drop_farmland_growth:weak_fertilized_farmland")) {
delta = 1;
}
if (farmland.hasTag("dew_drop_farmland_growth:strong_fertilized_farmland")) {
delta = 2;
}
if (farmland.hasTag("dew_drop_farmland_growth:hyper_fertilized_farmland")) {
delta = 3;
}
if (delta == 0) return {age: age, maxAge: maxAge, boosted: false};
return {age: age == 0 ? 0 : age - delta, maxAge: Math.max(1, maxAge - delta), boosted: true};
};
const isCropFertile = (cropId) => {
if (needsFarmland && !soil) return false;
return $SereneFertility.isCropFertile(cropId, level, position)
|| hasGreenhouseGlass()
|| hasAvailableGardenPot();
};
const addGrowthLevelTooltip = (current, max, isFertile) => {
const { age, maxAge, boosted } = getGrowthDay(current, max);
let ageText = Component.of(Number(age).toFixed());
let maxAgeText = Component.of(Number(maxAge).toFixed());
if(boosted) {ageText = ageText.darkGreen(); maxAgeText = maxAgeText.darkGreen()}
if (current >= max) {
tooltip.add(Component.translatable("jade.society.crop_growth.mature").darkGreen());
} else {
tooltip.add(Component.translatable("jade.society.crop_growth", ageText, maxAgeText));
}
if (!isFertile) {
tooltip.add(Component.translatable("jade.society.crop_growth.stop").red());
}
};
if ($SereneFertility.isCrop(state) && blockContainer.hasTag("dew_drop_farmland_growth:cancel_random_tick")) {
try {
if (block instanceof $CropBlock) {
addGrowthLevelTooltip(block.getAge(state), block.getMaxAge(), isCropFertile(name));
} else if (state.hasProperty(BlockProperties.AGE_7)) {
addGrowthLevelTooltip(state.getValue(BlockProperties.AGE_7), 7, isCropFertile(name));
} else if (state.hasProperty(BlockProperties.AGE_5)) {
addGrowthLevelTooltip(state.getValue(BlockProperties.AGE_5), 5, isCropFertile(name));
} else if (state.hasProperty(BlockProperties.AGE_4)) {
addGrowthLevelTooltip(state.getValue(BlockProperties.AGE_4), 4, isCropFertile(name));
} else if (state.hasProperty(BlockProperties.AGE_3)) {
addGrowthLevelTooltip(state.getValue(BlockProperties.AGE_3), 3, isCropFertile(name));
}
} catch (e) {}
} else if (name.includes("grape_bush")) {
const age = state.getValue(BlockProperties.AGE_3);
addGrowthLevelTooltip(age, 3, isCropFertile(grapeMap[name.replace("_grape_bush", "")]));
tooltip.add(Component.translatable("jade.society.crop_growth.stop").red());
if (name.includes("jungle")) tooltip.add(Component.translatable("jade.society.crop_growth.need_lattice").red());
else tooltip.add(Component.translatable("jade.society.crop_growth.need_stem").red());
} else if (name.includes("grapevine_stem") || name.match(/vinery:.+_lattice/i)) {
const age = state.getValue(BlockProperties.AGE_4);
if (age == 0) return;
addGrowthLevelTooltip(
age,
4,
isCropFertile(grapeMap[state.getValue(block.getStateDefinition().getProperty("grape")).getSerializedName()])
);
} else {
$JadeCropInfo.INSTANCE.appendTooltip(tooltip.getTooltip(), accessor, pluginConfig);
if (!blockContainer.hasTag("dew_drop_farmland_growth:cancel_random_tick") && $SereneFertility.isCrop(state) && !isCropFertile(name)) {
tooltip.add(Component.translatable("jade.society.crop_growth.stop").red());
}
}
if (needsFarmland && !soil) {
if (name.includes("rice")) tooltip.add(Component.translatable("jade.society.crop_growth.need_watered_farmland").red());
else tooltip.add(Component.translatable("jade.society.crop_growth.need_farmland").red());
}
};
JadeEvents.onClientRegistration((e) => {
e.block("society:plushie_jade", $Block).tooltip(
(tooltip, accessor, pluginConfig) => {
global["JadePlushieClientCallback"](tooltip, accessor, pluginConfig);
}
);
e.block("society:fish_pond_jade", $Block).tooltip(
(tooltip, accessor, pluginConfig) => {
global["JadeFishPondClientCallback"](tooltip, accessor, pluginConfig);
}
);
e.block("society:artisan_machine_jade", $Block).tooltip(
(tooltip, accessor, pluginConfig) => {
global["JadeArtisanMachineClientCallback"](
tooltip,
accessor,
pluginConfig
);
}
);
e.block("society:crop_growth_jade", $Block).tooltip(
(tooltip, accessor, pluginConfig) => {
global["JadeSocietyCropClientCallback"](tooltip, accessor, pluginConfig);
}
);
e.block("kubejs:shipping_bin_jade", $Block).tooltip(
(tooltip, accessor, pluginConfig) => {
global["JadeShippingBinClientCallback"](tooltip, accessor, pluginConfig);
}
);
});
+211
View File
@@ -0,0 +1,211 @@
JEIAddedEvents.registerCategories((e) => {
const guiHelper = e.data.jeiHelpers.guiHelper;
e.custom("vinery:manual_juicing", (category) => {
category
.title(Text.translatable("jei.society.category.manual_juicing"))
.background(guiHelper.createBlankDrawable(177, 60))
.icon(guiHelper.createDrawableItemStack("vinery:grapevine_pot"))
.isRecipeHandled(() => true)
.handleLookup((builder, recipe) => {
const { grape, juice } = recipe.data;
builder
.addSlot("input", 27, 38)
.addItemStack(Item.of(grape))
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
builder.addSlot("input", 90, 38).addItemStack("vinery:grapevine_pot");
builder
.addSlot("input", 90, 24)
.addItemStack("vinery:wine_bottle")
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
builder
.addSlot("output", 132, 38)
.addItemStack(Item.of(juice))
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
});
});
e.custom("society:enriched_bone_mealing", (category) => {
category
.title(Text.translatable("jei.society.category.enriched_bone_mealing"))
.background(guiHelper.createBlankDrawable(177, 20))
.icon(guiHelper.createDrawableItemStack("society:enriched_bone_meal"))
.isRecipeHandled(() => true)
.handleLookup((builder, recipe) => {
const { crop, bonemealTarget } = recipe.data;
builder
.addSlot("input", 27, 2)
.addItemStack(Item.of(bonemealTarget))
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
builder
.addSlot("input", 63, 2)
.addItemStack(Item.of("society:enriched_bone_meal"))
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
builder
.addSlot("output", 132, 2)
.addItemStack(Item.of(crop))
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
});
});
e.custom("society:furniture_catalog", (category) => {
category
.title(Text.translatable("jei.society.category.block_purchasing"))
.background(guiHelper.createBlankDrawable(177, 20))
.icon(guiHelper.createDrawableItemStack("whimsy_deco:gatcha_machine"))
.isRecipeHandled(() => true)
.handleLookup((builder, recipe) => {
const { catalog, cost, output } = recipe.data;
builder
.addSlot("input", 27, 2)
.addItemStack(Item.of(catalog))
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
builder
.addSlot("input", 63, 2)
.addItemStack(Item.of(cost))
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
builder
.addSlot("output", 132, 2)
.addItemStack(Item.of(output))
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
});
});
e.custom("herbalbrews:tea_drying", (category) => {
category
.title(Text.translatable("jei.society.category.tea_drying"))
.background(guiHelper.createDrawable("society:textures/gui/drying.png", 1, 1, 122, 48))
.icon(guiHelper.createDrawableItemStack("herbalbrews:green_tea_leaf"))
.isRecipeHandled(() => true)
.setDrawHandler((recipe, recipeSlotsView, guiGraphics) => {
guiGraphics.drawWordWrap(
Client.font,
Text.translatable("jei.society.tea_drying"),
2,
36,
177,
0
);
})
.handleLookup((builder, recipe) => {
const { input, output } = recipe.data;
builder
.addSlot("input", 20, 14)
.addItemStack(Item.of(input))
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
builder
.addSlot("output", 84, 14)
.addItemStack(Item.of(output))
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
});
});
});
JEIAddedEvents.registerRecipes((e) => {
const nether = ["crimson", "warped"];
const juiceJEIRecipe = (juice, grape) => {
e.custom("vinery:manual_juicing").add({
grape: `6x ${nether.includes(juice) ? "nethervinery" : "vinery"}:${grape}`,
juice: `2x ${nether.includes(juice) ? "nethervinery" : "vinery"}:${juice}_grapejuice`,
});
};
const grapeJuices = [
"red",
"red_savanna",
"red_jungle",
"red_taiga",
"white",
"white_savanna",
"white_jungle",
"white_taiga",
"crimson",
"warped",
];
const grapes = [
"red_grape",
"savanna_grapes_red",
"jungle_grapes_red",
"taiga_grapes_red",
"white_grape",
"savanna_grapes_white",
"jungle_grapes_white",
"taiga_grapes_white",
"crimson_grape",
"warped_grape",
];
grapeJuices.forEach((juice, index) => {
if (juice.includes("red")) {
juiceJEIRecipe("red", grapes[index]);
} else if (juice.includes("white")) {
juiceJEIRecipe("white", grapes[index]);
} else {
juiceJEIRecipe(juice, grapes[index]);
}
});
const cropDupes = [
{ crop: "minecraft:glow_berries" },
{ crop: "herbalbrews:lavender" },
{ crop: "herbalbrews:hibiscus" },
{ crop: "farm_and_charm:wild_ribwort" },
{ crop: "farm_and_charm:wild_nettle" },
{ crop: "vinery:cherry", bonemealTarget: "vinery:dark_cherry_leaves" },
{ crop: "minecraft:apple", bonemealTarget: "vinery:apple_leaves" },
].forEach((item) => {
const { crop, bonemealTarget } = item;
e.custom("society:enriched_bone_mealing").add({
crop: crop,
bonemealTarget: bonemealTarget || crop,
});
});
[
{
catalog: "whimsy_deco:gatcha_machine",
cost: "1x numismatics:sun",
output: "society:plushie_capsule",
},
].forEach((item) => {
e.custom("society:furniture_catalog").add(item);
});
[
{
input: "herbalbrews:green_tea_leaf_block",
output: "herbalbrews:dried_out_green_tea_leaf_block",
},
{
input: "herbalbrews:dried_green_tea_leaf_block",
output: "herbalbrews:black_tea_leaf_block",
},
{
input: "herbalbrews:mixed_tea_leaf_block",
output: "herbalbrews:oolong_tea_leaf_block",
},
].forEach((item) => {
e.custom("herbalbrews:tea_drying").add(item);
});
});
// // JEI Catalysts broken on JEI version
// JEIAddedEvents.registerRecipeCatalysts((e) => {
// let helper = e.data.getJeiHelpers();
// let recipeType = helper.getRecipeType("vinery:manual_juicing");
// e.data.addRecipeCatalyst(Item.of("vinery:grapevine_pot"), recipeType.get());
// e.data.addRecipeCatalyst(
// "nethervinery:crimson_grapevine_pot",
// recipeType.get()
// );
// e.data.addRecipeCatalyst(
// "nethervinery:warped_grapevine_pot",
// recipeType.get()
// );
// e.data.addRecipeCatalyst(
// "society:enriched_bone_meal",
// "society:enriched_bone_mealing"
// );
// });
JEIEvents.removeCategories((e) => {
e.remove("waystones:warp_plate");
e.remove("farm_and_charm:cooking_pot");
e.remove("meadow:woodcutting");
e.remove("trading_floor:potential_villager_trade");
});
+64
View File
@@ -0,0 +1,64 @@
const registerLootCategory = (event, title) => {
event.custom("society:loot_box", (category) => {
const {
jeiHelpers: { guiHelper },
} = category;
category
.title(title)
.background(guiHelper.createBlankDrawable(144, 148))
.icon(guiHelper.createDrawableItemStack(Item.of("society:furniture_box")))
.isRecipeHandled((recipe) => {
return !!(recipe?.data?.input !== undefined && recipe?.data?.outputs !== undefined);
})
.handleLookup((builder, recipe) => {
const { input, outputs } = recipe.data;
const slotSize = 18;
builder
.addSlot("INPUT", 73, 2)
.addItemStack(input)
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
for (let i = 0; i < 8; i++) {
for (let j = 0; j < 7; j++) {
let index = 8 * j + i;
if (outputs.length > index) {
builder
.addSlot("OUTPUT", i * slotSize + 1, j * slotSize + 21)
.addItemStack(Item.of(`1x ${outputs[index]}`))
.setBackground(guiHelper.getSlotDrawable(), -1, -1);
}
}
}
});
});
};
JEIAddedEvents.registerCategories((e) => {
registerLootCategory(e, Text.translatable("jei.society.category.loot_box"));
});
const addLootBoxRecipes = (e, input, outptTag) => {
let output = [];
let fullOutputList = Ingredient.of(outptTag).itemIds;
for (let i = 0; i < fullOutputList.length; i++) {
if (i > 0 && i % 56 === 0) {
e.custom("society:loot_box").add({
input: input,
outputs: output,
});
output = [];
}
output.push(fullOutputList[i]);
}
e.custom("society:loot_box").add({
input: input,
outputs: output,
});
};
JEIAddedEvents.registerRecipes((e) => {
addLootBoxRecipes(e, "society:furniture_box", "#society:loot_furniture");
const fantasyBoxes = ["nordic", "dunmer", "venthyr", "bone", "royal", "necrolord"];
fantasyBoxes.forEach((theme) => {
addLootBoxRecipes(e, `society:fantasy_box_${theme}`, `#society:${theme}_fantasy_furniture`);
});
addLootBoxRecipes(e, "society:plushie_capsule", "#society:plushies");
addLootBoxRecipes(e, "society:bouquet_bag", "#society:bouquet_bag_flowers");
});
@@ -0,0 +1,160 @@
Ponder.registry((e) => {
e.create('bakery:baker_station').scene("baker_station_scene_one", "Caking Baked Goods", (scene, util) => {
scene.showStructure();
scene.world.setBlocks([2, 1, 2], "bakery:baker_station");
scene.idle(10);
scene.text(80, "The Caking Station is the work table for preparing cakes, cookies, and cupcakes.")
scene.idle(100);
scene.addLazyKeyframe();
scene.text(80, "To start, place cake dough on top of the station", [2, 2, 2])
scene.idle(30);
scene.showControls(35, [2, 3, 2], "down").rightClick().withItem('bakery:cake_dough')
scene.idle(40);
scene.world.setBlocks([2, 2, 2], "bakery:blank_cake", true);
scene.idle(50);
scene.addLazyKeyframe();
scene.text(80, "To make cupcakes, any kind of knife can be used to cut the cake.", [2, 3, 2])
scene.idle(30);
scene.showControls(35, [2, 3, 2], "down").rightClick().withItem('bakery:bread_knife')
scene.idle(40);
scene.world.modifyBlock([2, 2, 2], () => Block.id("bakery:blank_cake").with("cake", false).with("cupcake", true), true);
scene.idle(40);
scene.addLazyKeyframe();
scene.text(80, "For cookies, roll down the cupcake dough using a rolling pin.", [2, 3, 2])
scene.idle(30);
scene.showControls(35, [2, 3, 2], "down").rightClick().withItem('bakery:rolling_pin')
scene.idle(40);
scene.world.modifyBlock([2, 2, 2], () => Block.id("bakery:blank_cake").with("cake", false).with("cupcake", false).with("cookie", true), true);
scene.idle(40);
scene.world.hideSection([2, 1, 2], Facing.UP);
scene.world.hideSection([2, 2, 2], Facing.UP);
scene.world.hideSection([0, 1, 2], Facing.UP);
scene.world.hideSection([4, 1, 2], Facing.UP);
scene.world.hideSection([0, 2, 2], Facing.UP);
scene.world.hideSection([0, 2, 2], Facing.UP);
scene.idle(20);
scene.addLazyKeyframe();
scene.world.setBlocks([0, 1, 2], "bakery:baker_station");
scene.world.showSection([0, 1, 2], Facing.DOWN);
scene.world.setBlocks([4, 1, 2], "bakery:baker_station");
scene.world.showSection([4, 1, 2], Facing.DOWN);
scene.world.setBlocks([0, 2, 2], "bakery:blank_cake");
scene.world.showSection([0, 2, 2], Facing.DOWN);
scene.world.setBlocks([4, 2, 2], "bakery:blank_cake");
scene.world.showSection([4, 2, 2], Facing.DOWN);
scene.world.modifyBlock([0, 2, 2], () => Block.id("bakery:blank_cake").with("cake", false).with("cupcake", false).with("cookie", true), false);
scene.world.modifyBlock([2, 2, 2], () => Block.id("bakery:blank_cake").with("cake", false).with("cupcake", true), false);
scene.world.showSection([2, 1, 2], Facing.DOWN);
scene.world.showSection([2, 2, 2], Facing.DOWN);
scene.text(80, "Frosting can be added at any stage of the caking process.")
scene.idle(50);
scene.showControls(35, [2, 3, 2], "down").rightClick().withItem('bakery:strawberry_jam')
scene.idle(40);
scene.world.setBlocks([0, 2, 2], "bakery:strawberry_cookie_block", true);
scene.world.setBlocks([2, 2, 2], "bakery:strawberry_cupcake_block", true);
scene.world.setBlocks([4, 2, 2], "bakery:strawberry_cake", true);
scene.idle(40);
scene.addLazyKeyframe()
scene.text(80, "The cakes can then be harvested with an empty hand.", [2, 3, 2])
scene.idle(30);
scene.showControls(35, [2, 3, 2], "down").rightClick()
scene.idle(40);
scene.world.replaceBlocks([4, 2, 2], "air", true);
scene.world.replaceBlocks([2, 2, 2], "air", true);
scene.world.replaceBlocks([0, 2, 2], "air", true);
const leftBlockPos = util.grid.at(4, 2, 2);
const centerBlockPos = util.grid.at(2, 2, 2);
const rightBlockPos = util.grid.at(0, 2, 2);
const leftTop = util.vector.topOf(leftBlockPos);
const centerTop = util.vector.topOf(centerBlockPos);
const rightTop = util.vector.topOf(rightBlockPos);
const cakeEntity = scene.world.createItemEntity(leftTop.add(0, 0.2, 0), util.vector.of(0.01, 0, 0), "bakery:strawberry_cake");
const cupcakecakeEntity =scene.world.createItemEntity(centerTop.add(0, 0.2, 0), util.vector.of(0.01, 0, 0), "4x bakery:strawberry_cupcake");
const cookieEntity = scene.world.createItemEntity(rightTop.add(0, 0.2, 0), util.vector.of(0.01, 0, 0), "4x bakery:strawberry_glazed_cookie");
scene.idle(60);
scene.world.modifyEntity(cakeEntity, (e) => {
e.discard();
});
scene.world.modifyEntity(cupcakecakeEntity, (e) => {
e.discard();
});
scene.world.modifyEntity(cookieEntity, (e) => {
e.discard();
});
scene.world.hideSection([2, 1, 2], Facing.UP);
scene.world.hideSection([2, 2, 2], Facing.UP);
scene.world.hideSection([0, 1, 2], Facing.UP);
scene.world.hideSection([4, 1, 2], Facing.UP);
scene.world.hideSection([0, 2, 2], Facing.UP);
scene.world.hideSection([0, 2, 2], Facing.UP);
scene.idle(20);
scene.addLazyKeyframe()
scene.world.replaceBlocks([0, 1, 2], "air", false);
scene.world.replaceBlocks([4, 1, 2], "air", false);
scene.world.replaceBlocks([2, 1, 2], "bakery:iron_table", false);
scene.world.setBlocks([2, 2, 2], "bakery:strawberry_cake", true);
scene.world.showSection([2, 1, 2], Facing.DOWN);
scene.world.showSection([2, 2, 2], Facing.DOWN);
scene.text(80, "Cakes must be sliced before being eaten.", [2, 3, 2])
scene.idle(30);
scene.showControls(35, [2, 3, 2], "down").rightClick().withItem('bakery:bread_knife')
scene.idle(40);
scene.world.modifyBlock([2, 2, 2], () => Block.id("bakery:strawberry_cake").with("cuts", "1"), false);
scene.world.createItemEntity(centerTop.add(0, 0.2, 0), util.vector.of(0.01, 0, 0), "bakery:strawberry_cake_slice");
scene.idle(70);
});
});
@@ -0,0 +1,222 @@
Ponder.registry((e) => {
e.create(["brewery:wooden_brewingstation", "brewery:copper_brewingstation", "brewery:netherite_brewingstation"]).scene('brewingstation_scene_one', "Starting the Brewing Process", (scene) => {
scene.showBasePlate();
scene.world.setBlocks([1, 1, 2], "brewery:wooden_brewingstation");
scene.world.setBlocks([1, 1, 1], "brewery:brew_timer");
scene.world.setBlocks([2, 1, 1], "brewery:brew_oven");
scene.world.setBlocks([2, 1, 2], "brewery:brew_whistle");
scene.world.setBlocks([2, 2, 2], "brewery:brew_whistle");
scene.world.modifyBlock([1, 1, 2], () => Block.id("brewery:wooden_brewingstation").with("facing", "south"), false);
scene.world.modifyBlock([1, 1, 1], () => Block.id("brewery:brew_timer").with("facing", "south"), false);
scene.world.modifyBlock([2, 1, 1], () => Block.id("brewery:brew_oven").with("facing", "south"), false);
scene.world.modifyBlock([2, 1, 2], () => Block.id("brewery:brew_whistle").with("facing", "south"), false);
scene.world.modifyBlock([2, 2, 2], () => Block.id("brewery:brew_whistle").with("half", "upper").with("facing", "south"), false);
global.showPonderLayer(scene, 0, 1);
scene.idle(10);
scene.text(80, "The Brewingstation is a multiblock machine for brewing beers and spirits.")
scene.idle(100);
scene.addLazyKeyframe();
scene.text(80, "To start, place your ingredients into the basin and fill with water.", [1, 2, 2])
scene.idle(30);
scene.showControls(35, [1, 2, 3], "down").rightClick().withItem('brewery:hops')
scene.idle(40);
scene.showControls(35, [1, 2, 3], "down").rightClick().withItem('minecraft:water_bucket')
scene.world.modifyBlock([1, 1, 2], () => Block.id("brewery:wooden_brewingstation").with("facing", "south").with("liquid", "filled"), false);
scene.idle(50);
scene.addLazyKeyframe();
scene.text(80, "Place your fuel in the oven block to begin brewing.", [2, 2, 1])
scene.idle(30);
scene.showControls(35, [2, 2, 1], "down").rightClick().withItem('minecraft:coal')
scene.world.modifyBlock([2, 1, 1], () => Block.id("brewery:brew_oven").with("facing", "south").with("heat", "lit"), false);
scene.idle(40);
});
e.create(["brewery:wooden_brewingstation", "brewery:copper_brewingstation", "brewery:netherite_brewingstation"]).scene('brewingstation_scene_two', "The Brewing Minigame", (scene, util) => {
scene.showBasePlate();
scene.world.setBlocks([1, 1, 2], "brewery:wooden_brewingstation");
scene.world.setBlocks([1, 1, 1], "brewery:brew_timer");
scene.world.setBlocks([2, 1, 1], "brewery:brew_oven");
scene.world.setBlocks([2, 1, 2], "brewery:brew_whistle");
scene.world.setBlocks([2, 2, 2], "brewery:brew_whistle");
scene.world.modifyBlock([1, 1, 2], () => Block.id("brewery:wooden_brewingstation").with("facing", "south").with("liquid", "filled"), false);
scene.world.modifyBlock([1, 1, 1], () => Block.id("brewery:brew_timer").with("facing", "south"), false);
scene.world.modifyBlock([2, 1, 1], () => Block.id("brewery:brew_oven").with("facing", "south").with("heat", "lit"), false);
scene.world.modifyBlock([2, 1, 2], () => Block.id("brewery:brew_whistle").with("facing", "south"), false);
scene.world.modifyBlock([2, 2, 2], () => Block.id("brewery:brew_whistle").with("half", "upper").with("facing", "south"), false);
global.showPonderLayer(scene, 0, 1);
scene.idle(10);
scene.text(80, "The brewing process is an active one, and the faster you fix issues in the brewing, the higher output you'll get.")
scene.idle(90);
scene.addLazyKeyframe();
scene.text(80, "The basin needs a constant supply of water, and sometimes drains", [1, 2, 2])
let basin = util.select.fromTo(1, 1, 2, 1, 1, 2)
scene.overlay.showOutline(PonderPalette.GREEN, "block", basin, 30)
scene.idle(10);
scene.world.modifyBlock([1, 1, 2], () => Block.id("brewery:wooden_brewingstation").with("facing", "south").with("liquid", "drained"), false);
scene.idle(60);
scene.showControls(35, [1, 2, 3], "down").rightClick().withItem('minecraft:water_bucket')
scene.world.modifyBlock([1, 1, 2], () => Block.id("brewery:wooden_brewingstation").with("facing", "south").with("liquid", "filled"), false);
scene.idle(60);
scene.addLazyKeyframe();
scene.text(80, "The basin may also overflow, requiring you to take out some water", [1, 2, 2])
scene.idle(10);
scene.world.modifyBlock([1, 1, 2], () => Block.id("brewery:wooden_brewingstation").with("facing", "south").with("liquid", "overflowing"), false);
scene.idle(60);
scene.showControls(35, [1, 2, 3], "down").rightClick().withItem('minecraft:bucket')
scene.world.modifyBlock([1, 1, 2], () => Block.id("brewery:wooden_brewingstation").with("facing", "south").with("liquid", "filled"), false);
scene.idle(60);
scene.addLazyKeyframe();
let oven = util.select.fromTo(2, 1, 1, 2, 1, 1)
scene.overlay.showOutline(PonderPalette.GREEN, "block", oven, 30)
scene.text(80, "Like the basin, the oven portion may run out of fuel", [2, 2, 1])
scene.idle(10);
scene.world.modifyBlock([2, 1, 1], () => Block.id("brewery:brew_oven").with("facing", "south").with("heat", "weak"), false);
scene.idle(60);
scene.showControls(35, [2, 2, 1], "down").rightClick().withItem('minecraft:coal')
scene.world.modifyBlock([2, 1, 1], () => Block.id("brewery:brew_oven").with("facing", "south").with("heat", "lit"), false);
scene.idle(60);
scene.addLazyKeyframe();
let timer = util.select.fromTo(1, 1, 1, 1, 1, 1)
scene.overlay.showOutline(PonderPalette.GREEN, "block", timer, 30)
scene.text(80, "Finally, the timer portion of the brewingstation may need to be reset with a right click", [2, 2, 2])
scene.idle(10);
scene.world.modifyBlock([1, 1, 1], () => Block.id("brewery:brew_timer").with("facing", "south").with("time", true), false);
scene.world.modifyBlock([1, 1, 1], () => Block.id("brewery:brew_timer").with("facing", "south").with("activated", true), false);
scene.idle(60);
scene.showControls(35, [1, 2, 1], "down").rightClick()
scene.world.modifyBlock([1, 1, 1], () => Block.id("brewery:brew_timer").with("facing", "south"), false);
scene.idle(60);
scene.addLazyKeyframe();
scene.overlay.showOutline(PonderPalette.GREEN, "block", basin, 30)
scene.world.modifyBlock([1, 1, 2], () => Block.id("brewery:wooden_brewingstation").with("facing", "south").with("liquid", "beer"), false);
scene.text(80, "Once finished, you can take your beer out with a Beer Mugs!", [1, 2, 2])
scene.idle(70);
scene.showControls(35, [1, 2, 3], "down").rightClick().withItem('brewery:beer_mug')
scene.world.modifyBlock([1, 1, 2], () => Block.id("brewery:wooden_brewingstation").with("facing", "south").with("liquid", "empty"), false);
scene.idle(60);
});
e.create(["brewery:wooden_brewingstation", "brewery:copper_brewingstation", "brewery:netherite_brewingstation"]).scene('brewingstation_scene_three', "Brewingstation Tiers", (scene) => {
scene.showBasePlate();
scene.world.setBlocks([1, 1, 2], "brewery:wooden_brewingstation");
scene.world.setBlocks([1, 1, 1], "brewery:brew_timer");
scene.world.setBlocks([2, 1, 1], "brewery:brew_oven");
scene.world.setBlocks([2, 1, 2], "brewery:brew_whistle");
scene.world.setBlocks([2, 2, 2], "brewery:brew_whistle");
scene.world.modifyBlock([1, 1, 2], () => Block.id("brewery:wooden_brewingstation").with("facing", "south"), false);
scene.world.modifyBlock([1, 1, 1], () => Block.id("brewery:brew_timer").with("facing", "south"), false);
scene.world.modifyBlock([2, 1, 1], () => Block.id("brewery:brew_oven").with("facing", "south"), false);
scene.world.modifyBlock([2, 1, 2], () => Block.id("brewery:brew_whistle").with("facing", "south"), false);
scene.world.modifyBlock([2, 2, 2], () => Block.id("brewery:brew_whistle").with("half", "upper").with("facing", "south"), false);
global.showPonderLayer(scene, 0, 1);
scene.idle(10);
scene.text(60, "There are three tiers of Brewingstation:")
scene.idle(70);
scene.text(70, "Wooden is the starter tier, and can only brew beers.")
scene.idle(90);
scene.addLazyKeyframe();
scene.world.setBlocks([1, 1, 2], "brewery:copper_brewingstation");
scene.world.modifyBlock([1, 1, 2], () => Block.id("brewery:copper_brewingstation").with("facing", "south").with("material", "copper"), true);
scene.world.modifyBlock([1, 1, 1], () => Block.id("brewery:brew_timer").with("facing", "south").with("material", "copper"), true);
scene.world.modifyBlock([2, 1, 1], () => Block.id("brewery:brew_oven").with("facing", "south").with("material", "copper"), true);
scene.world.modifyBlock([2, 1, 2], () => Block.id("brewery:brew_whistle").with("facing", "south").with("material", "copper"), true);
scene.world.modifyBlock([2, 2, 2], () => Block.id("brewery:brew_whistle").with("half", "upper").with("material", "copper").with("facing", "south"), true);
scene.text(60, "Copper is the second tier, capable of brewing spirits and beers. It also never spawns Elementals.")
scene.idle(90);
scene.addLazyKeyframe();
scene.world.setBlocks([1, 1, 2], "brewery:netherite_brewingstation");
scene.world.modifyBlock([1, 1, 2], () => Block.id("brewery:netherite_brewingstation").with("facing", "south").with("material", "netherite"), true);
scene.world.modifyBlock([1, 1, 1], () => Block.id("brewery:brew_timer").with("facing", "south").with("material", "netherite"), true);
scene.world.modifyBlock([2, 1, 1], () => Block.id("brewery:brew_oven").with("facing", "south").with("material", "netherite"), true);
scene.world.modifyBlock([2, 1, 2], () => Block.id("brewery:brew_whistle").with("facing", "south").with("material", "netherite"), true);
scene.world.modifyBlock([2, 2, 2], () => Block.id("brewery:brew_whistle").with("half", "upper").with("material", "netherite").with("facing", "south"), true);
scene.idle(10);
scene.text(80, "Reinforced is the final tier. It can brew every drink, and provides a minimum quality of 3.")
scene.idle(80);
});
});
@@ -0,0 +1,73 @@
Ponder.registry((e) => {
e.create("vinery:grapevine_pot").scene("grapevine_pot_scene", "Juicing grapes", (scene, util) => {
scene.showBasePlate();
scene.world.setBlocks([2, 1, 2], "vinery:grapevine_pot");
scene.world.showSection([2, 1, 2], Facing.DOWN);
scene.idle(10);
scene.text(80, "The Grapevine Pot can be filled with a max of 6 grapes of the same type", [2, 2, 2])
scene.showControls(60, [2, 2, 2], "down").rightClick().withItem('vinery:red_grape')
scene.idle(70);
scene.world.modifyBlock([2, 1, 2], () => Block.id("vinery:grapevine_pot").with("type", "red").with("storage", "1").with("stage", "1"), false);
scene.idle(5);
scene.world.modifyBlock([2, 1, 2], () => Block.id("vinery:grapevine_pot").with("type", "red").with("storage", "3").with("stage", "2"), false);
scene.idle(5);
scene.world.modifyBlock([2, 1, 2], () => Block.id("vinery:grapevine_pot").with("type", "red").with("storage", "6").with("stage", "3"), false);
scene.idle(70);
scene.addLazyKeyframe();
const armorStand = scene.world.createEntity("armor_stand", [2.5, 1, 2.5]);
scene.text(80, "Once filled, jump on the grapes to turn them into juice", [2, 3, 2])
scene.idle(20);
for (let height = 1; height < 3; height = height + 0.07) {
let h = height;
scene.world.modifyEntity(armorStand, (e) => {
e.setY(h);
});
scene.idle(1);
}
for (let height = 3; height > 1; height = height - 0.07) {
let h = height;
scene.world.modifyEntity(armorStand, (e) => {
e.setY(h);
});
scene.idle(1);
}
scene.idle(20);
scene.world.removeEntity(armorStand)
scene.idle(20);
scene.world.modifyBlock([2, 1, 2], () => Block.id("vinery:grapevine_pot").with("type", "red").with("storage", "6").with("stage", "4"), false);
scene.idle(5);
scene.world.modifyBlock([2, 1, 2], () => Block.id("vinery:grapevine_pot").with("type", "red").with("storage", "6").with("stage", "5"), false);
scene.idle(5);
scene.world.modifyBlock([2, 1, 2], () => Block.id("vinery:grapevine_pot").with("type", "red").with("storage", "6").with("stage", "6"), false);
scene.idle(50);
scene.addLazyKeyframe();
scene.text(80, "You can then bottle the juice using empty wine bottles", [2, 2, 2])
let selection = util.select.fromTo(2, 1, 2, 2, 1, 2)
scene.overlay.showOutline(PonderPalette.GREEN, "fiveby", selection, 30)
scene.showControls(60, [2, 2, 2], "down").rightClick().withItem('vinery:wine_bottle')
scene.idle(70);
scene.world.modifyBlock([2, 1, 2], () => Block.id("vinery:grapevine_pot").with("type", "red").with("storage", "3").with("stage", "1"), false);
scene.idle(5);
scene.world.modifyBlock([2, 1, 2], () => Block.id("vinery:grapevine_pot").with("type", "red").with("storage", "0").with("stage", "2"), false);
});
});
@@ -0,0 +1,16 @@
Ponder.tags((e) => {
const cookingBrewing = [
"vinery:grapevine_pot",
"brewery:wooden_brewingstation",
"brewery:copper_brewingstation",
"brewery:netherite_brewingstation",
"bakery:baker_station",
];
e.createTag(
"society:cooking_brewing",
"brewery:wooden_brewingstation",
"Cooking and Brewing",
"Tutorials for complex cooking & brewing machines",
cookingBrewing
);
});
+9
View File
@@ -0,0 +1,9 @@
const ModConfig = Java.loadClass("sereneseasons.init.ModConfig")
NetworkEvents.dataReceived('society.synchronize_season_duration', (event) => {
if(!event.getData()) return;
const subSeasonDuration = event.getData().subSeasonDuration;
if(subSeasonDuration !== ModConfig.seasons.subSeasonDuration) {
ModConfig.seasons.subSeasonDuration = subSeasonDuration;
}
});
@@ -0,0 +1,331 @@
ItemEvents.tooltip((tooltip) => {
global.plushies.forEach((plush) => {
tooltip.addAdvanced(plush, (item, advanced, text) => {
if (item.nbt) {
let type = global.plushieTraits[Number(item.nbt.getInt("type"))];
if (tooltip.shift) {
text.add(1, [
Text.translatable("tooltip.society.plushies.trait"),
global.getTranslatedTextWithColorCode(
type.color,
`society.item.plushie.${type.trait}`
),
]);
text.add(2, [
Text.translate(`society.item.plushie.trait.description`).darkGray(),
]);
let description = Text.translate(
`society.item.plushie.${type.trait}.description`
)
.getString()
.split("\n");
text.add(3, [Text.gray(description[0])]);
text.add(4, [description[1]]);
} else {
if (item.nbt.getCompound("quality_food"))
text.add(1, [
Text.translatable("tooltip.society.plushies.rarity"),
Text.gold(
"★".repeat(
item.nbt.getCompound("quality_food").getInt("quality") + 1
)
),
Text.gray(
"☆".repeat(
3 - item.nbt.getCompound("quality_food").getInt("quality")
)
),
]);
else text.add(1, [Text.gray("☆".repeat(4))]);
let affection = item.nbt.getInt("affection");
text.add(2, [
Text.translatable("tooltip.society.plushies.affection"),
`§c${affection > 0 ? ``.repeat(affection) : ""}§7${affection < 4 ? ``.repeat(4 - affection) : ""
}`,
]);
text.add(3, [
Text.translatable("tooltip.society.plushies.trait"),
global.getTranslatedTextWithColorCode(
type.color,
`society.item.plushie.${type.trait}`
),
Text.of(" "),
Text.translatable(
"tooltip.society.hold_key",
global.getTranslatedTextWithColorCode(
type.color,
"key.keyboard.shift"
)
).gray(),
]);
if (item.nbt.animal) {
let animal = item.nbt.getCompound("animal");
text.add(4, [
Text.translatable("tooltip.society.plushies.animal_type"),
global.getTranslatedEntityName(String(animal.type)).gold(),
]);
if (animal.name) {
text.add(5, [
Text.translatable("tooltip.society.plushies.animal_name"),
`§6${String(animal.name)}`,
]);
}
} else {
text.add(4, [Text.translatable("tooltip.society.plushies")]);
}
}
} else {
text.add(1, [Text.translatable("tooltip.society.plushies")]);
}
});
});
tooltip.addAdvanced("society:villager_invitation", (item, advanced, text) => {
if (item.nbt) {
text.add(
1,
Text.translatable(
"block.society.fish_pond.fish.type",
`${item.nbt.get("type")}`
).aqua()
);
text.add(
2,
Text.translatable("block.society.fish_pond.description").gray()
);
} else {
text.add(
1,
Text.translatable("block.society.fish_pond.description").gray()
);
}
});
tooltip.addAdvanced("society:villager_home", (item, advanced, text) => {
if (item.nbt) {
text.add(
1,
Text.translatable(
"block.society.villager_home.type",
`${item.nbt.getString("type")}`
).green()
);
text.add(
2,
Text.translatable("block.society.villager_home.description").gray()
);
} else {
text.add(
1,
Text.translatable("block.society.villager_home.description").gray()
);
}
});
tooltip.addAdvanced("society:fish_pond", (item, advanced, text) => {
if (item.nbt) {
text.add(
1,
Text.translatable(
"block.society.fish_pond.fish.type",
`${Item.of(item.nbt.get("type")).id}`
).aqua()
);
text.add(
2,
Text.translatable(
"block.society.fish_pond.fish.population",
`${item.nbt.get("population")}`,
`${item.nbt.get("max_population")}`
).aqua()
);
} else {
text.add(
1,
Text.translatable("block.society.fish_pond.description").gray()
);
text.add(
2,
Text.translatable(
"block.society.fish_pond.description.place"
).darkAqua()
);
}
});
tooltip.addAdvanced("society:caterpillar_eggs", (item, advanced, text) => {
if (item.nbt) {
text.add(
1,
Text.translatable("item.society.caterpillar_eggs.description").darkGray()
);
text.add(
2,
Text.translatable(
"item.society.caterpillar_eggs.longwing.type",
Text.translatable(`item.longwings.${item.nbt.getString("child")}`).gray()
).green()
);
text.add(
3,
Text.translatable(
"item.society.caterpillar_eggs.longwing.parents",
Text.translatable(`item.longwings.${item.nbt.getString("parent")}`).gray(),
Text.translatable(`item.longwings.${item.nbt.getString("coparent")}`).gray()
).lightPurple()
);
text.add(
4,
Text.translatable(
"item.society.caterpillar_eggs.longwing.size",
`${item.nbt.getDouble("size")}`
).darkGray()
);
} else {
text.add(
1,
Text.translatable("item.society.caterpillar_eggs.description").gray()
);
}
});
// Sometimes season just breaks for the tooltip and I have no idea why
tooltip.addAdvanced("farmersdelight:tomato_seeds", (item, advanced, text) => {
if (tooltip.shift) {
text.add(1, [
Text.white("")
.append(Text.translatable("desc.sereneseasons.fertile_seasons"))
.append(":"),
Text.of(" "),
Text.translatable("desc.sereneseasons.spring").green().append(","),
Text.of(" "),
Text.translatable("desc.sereneseasons.summer").yellow().append(","),
Text.of(" "),
Text.translatable("desc.sereneseasons.autumn").gold(),
]);
} else {
text.add(1, [
Text.translatable(
"tooltip.society.hold_key",
Text.translatable("key.keyboard.shift").gray()
).darkGray(),
]);
}
});
tooltip.addAdvanced(
"farm_and_charm:strawberry_seed",
(item, advanced, text) => {
if (tooltip.shift) {
text.add(1, [
Text.white("")
.append(Text.translatable("desc.sereneseasons.fertile_seasons"))
.append(":"),
Text.of(" "),
Text.translatable("desc.sereneseasons.spring").green(),
]);
} else {
text.add(1, [
Text.translatable(
"tooltip.society.hold_key",
Text.translatable("key.keyboard.shift").gray()
).darkGray(),
]);
}
}
);
const magnifyingBlocks = [
Text.translatable("block.society.auto_grabber"),
Text.translatable("block.society.artisan_hopper"),
Text.translatable("block.farmingforblockheads.chicken_nest"),
Text.translatable("block.society.feeding_trough"),
Text.translatable("block.splendid_slimes.slime_feeder"),
Text.translatable("block.society.snow_melter"),
Text.translatable("block.society.fish_pond_basket"),
Text.translatable("block.society.fish_pond_hatchery"),
Text.translatable("block.society.golden_clock"),
Text.translatable("block.society.mana_clock"),
Text.translatable("block.society.mana_milker"),
Text.translatable("item.society.magnifying_glass.description.view_block.sprinklers"),
Text.translatable("block.society.growth_obelisk"),
Text.translatable("block.society.ribbit_hut"),
Text.translatable("block.society.fish_pond_manager"),
];
tooltip.addAdvanced("society:magnifying_glass", (item, advanced, text) => {
if (tooltip.shift) {
magnifyingBlocks.forEach((block, index) => {
text.add(index + 1, Text.gold(block));
});
} else {
text.add(
1,
Text.translatable("item.society.magnifying_glass.description").green()
);
text.add(2, [
Text.translatable(
"item.society.magnifying_glass.description.view_block",
Text.translatable("key.keyboard.shift").gray()
).darkGray(),
]);
}
});
tooltip.addAdvanced("society:car_key", (item, advanced, text) => {
text.add(1, [Text.translatable("item.society.car_key.description").gray()]);
if (item.nbt) {
text.add(2, [
Text.translatable("item.society.car_key.description.parked").green(),
]);
} else {
text.add(2, [
Text.translatable("item.society.car_key.description.empty").red(),
]);
}
});
const getPigColoredName = (pig) => {
switch (pig) {
case "Red":
return Text.translatable("society.pig_race.red_pig").red();
case "Blue":
return Text.translatable("society.pig_race.blue_pig").blue();
case "Yellow":
return Text.translatable("society.pig_race.yellow_pig").yellow();
case "Green":
return Text.translatable("society.pig_race.green_pig").green();
default:
console.log(`Invalid pig color`);
}
return Text.of(`${pig}`);
};
tooltip.addAdvanced(
["society:pig_race_ticket", "society:multiplayer_pig_race_ticket"],
(item, advanced, text) => {
text.add(1, [
Text.translatable("item.society.pig_race_ticket.description").gray(),
]);
if (item.nbt) {
text.add(2, [
Text.translatable(
"item.society.pig_race_ticket.description.bet",
getPigColoredName(item.nbt.bet)
).gray(),
]);
} else {
text.add(2, [
Text.translatable(
"item.society.pig_race_ticket.description.no_pig"
).gray(),
]);
}
}
);
global.ageableProductInputs.forEach((product) => {
const splitProduct = product.item.split(":");
tooltip.addAdvanced(`society:aged_${splitProduct[1]}`, (item, advance, text) => {
if (product.item === "brewery:whiskey_maggoallan" || product.item === "brewery:whiskey_smokey_reverie")
text.set(0, text.get(0).copy().gold())
else
text.set(0, text.get(0).copy().aqua());
});
tooltip.addAdvanced(`society:double_aged_${splitProduct[1]}`, (item, advance, text) => {
if (product.item === "brewery:whiskey_maggoallan" || product.item === "brewery:whiskey_smokey_reverie")
text.set(0, text.get(0).copy().gold())
else
text.set(0, text.get(0).copy().darkAqua());
});
});
});
@@ -0,0 +1,54 @@
ItemEvents.tooltip((tooltip) => {
const yearRound = ['aquaculture:minnow', 'aquaculture:carp', 'aquaculture:bluegill', 'society:neptuna']
let springFish = [];
let summerFish = [];
let autumnFish = [];
let winterFish = [];
tooltip.add(yearRound, [Text.of(" ").append(Text.translatable("desc.sereneseasons.year_round").lightPurple())]);
const addSeasonTooltip = (item, seasonText, seasonArray) => {
if (!yearRound.includes(item) && !seasonArray.includes(item)) {
seasonArray.push(item);
tooltip.add(item, [Text.of(" ").append(seasonText)]);
}
};
global.springOcean.forEach((entry) =>
addSeasonTooltip(entry.fish, Text.translatable("desc.sereneseasons.spring").green(), springFish)
);
global.springRiver.forEach((entry) =>
addSeasonTooltip(entry.fish, Text.translatable("desc.sereneseasons.spring").green(), springFish)
);
global.springFresh.forEach((entry) =>
addSeasonTooltip(entry.fish, Text.translatable("desc.sereneseasons.spring").green(), springFish)
);
global.summerOcean.forEach((entry) =>
addSeasonTooltip(entry.fish, Text.translatable("desc.sereneseasons.summer").yellow(), summerFish)
);
global.summerRiver.forEach((entry) =>
addSeasonTooltip(entry.fish, Text.translatable("desc.sereneseasons.summer").yellow(), summerFish)
);
global.summerFresh.forEach((entry) =>
addSeasonTooltip(entry.fish, Text.translatable("desc.sereneseasons.summer").yellow(), summerFish)
);
global.autumnOcean.forEach((entry) =>
addSeasonTooltip(entry.fish, Text.translatable("desc.sereneseasons.autumn").gold(), autumnFish)
);
global.autumnRiver.forEach((entry) =>
addSeasonTooltip(entry.fish, Text.translatable("desc.sereneseasons.autumn").gold(), autumnFish)
);
global.autumnFresh.forEach((entry) =>
addSeasonTooltip(entry.fish, Text.translatable("desc.sereneseasons.autumn").gold(), autumnFish)
);
global.winterOcean.forEach((entry) =>
addSeasonTooltip(entry.fish, Text.translatable("desc.sereneseasons.winter").aqua(), winterFish)
);
global.winterRiver.forEach((entry) =>
addSeasonTooltip(entry.fish, Text.translatable("desc.sereneseasons.winter").aqua(), winterFish)
);
global.winterFresh.forEach((entry) =>
addSeasonTooltip(entry.fish, Text.translatable("desc.sereneseasons.winter").aqua(), winterFish)
);
});
@@ -0,0 +1,442 @@
const formatNumber = (number, quality, doubled) => {
let value;
if (quality) {
if (quality == 1.0) value = Math.round(number * (doubled ? 1.5 : 1.25));
if (quality == 2.0) value = Math.round(number * (doubled ? 2 : 1.5));
if (quality == 3.0) value = Math.round(number * (doubled ? 3 : 2));
} else {
value = number;
}
return global.formatPrice(value);
};
const getStackBonusValueTooltips = (text, number, item, attribute, quality) => {
let value = number;
let clientStages = Client.player.stages;
let bonusTooltips = [];
let qualityDoubled = false;
let attributeMult = global.getAttributeMultiplier(
Client.player.nbt.Attributes,
`shippingbin:${attribute}_sell_multiplier`
);
let hasMultipliers = attributeMult > 1;
if (
clientStages.has("bluegill_meridian") &&
item.id == "aquaculture:bluegill"
) {
hasMultipliers = true;
value = 666;
bonusTooltips.push(
Text.translatable("item.society.bluegill_meridian.price_modifier").aqua()
);
}
if (
clientStages.has("phenomenology_of_treasure") &&
(item.hasTag("society:artifacts") || item.hasTag("society:relics"))
) {
hasMultipliers = true;
value *= 3;
bonusTooltips.push(
Text.translatable(
"item.society.phenomenology_of_treasure.price_modifier"
).aqua()
);
}
if (
clientStages.has("brine_and_punishment") &&
item.hasTag("society:brine_and_punishment")
) {
hasMultipliers = true;
value *= 2;
bonusTooltips.push(
Text.translatable(
"item.society.brine_and_punishment.price_modifier"
).aqua()
);
}
if (
clientStages.has("the_metamorphosize") &&
["longwings:moth", "longwings:butterfly"].includes(item.id)
) {
hasMultipliers = true;
let size = 1.0;
if (item.nbt) {
if (item.nbt.size && typeof item.nbt.size !== "function") {
size = item.nbt.size;
}
}
let increase = Number(Math.round((size / 0.01) * 4) * 2);
value += increase;
bonusTooltips.push(
Text.translatable(
"item.society.the_metamorphosize.price_modifier", String(increase)
).aqua()
);
}
if (
quality > 0 &&
clientStages.has("the_quality_of_the_earth") &&
attribute.equals("crop") &&
!item.hasTag("minecraft:fishes")
) {
hasMultipliers = true;
qualityDoubled = true
bonusTooltips.push(
Text.translatable(
"item.society.the_quality_of_the_earth.price_modifier"
).aqua()
);
}
value = Math.round(value * item.count * attributeMult);
text.add(1, [
Text.translatable(
"tooltip.society.coins",
`${formatNumber(value, quality, qualityDoubled)}`
).white(),
Text.of(" "),
Text.translatable("tooltip.society.stack_value")
.gray()
.append(
hasMultipliers
? Text.translatable("tooltip.society.multipliers")
: Text.empty()
),
]);
bonusTooltips.forEach((bonus, index) => {
text.add(2 + index, [bonus]);
});
if (attributeMult > 1) {
text.add(bonusTooltips.length + 2, [
getAttributeText(attribute),
Text.green(` +${Math.round((attributeMult - 1) * 100)}%`),
]);
} else {
text.add(bonusTooltips.length + 2, [getAttributeText(attribute)]);
}
};
const getAttributeText = (attribute) => {
switch (attribute) {
case "crop":
return Text.translatable("tooltip.society.farmer_product").gold();
case "wood":
return Text.translatable("tooltip.society.artisan_product").gold();
case "gem":
return Text.translatable("tooltip.society.geologist_product").gold();
case "meat":
return Text.translatable("tooltip.society.adventurer_product").gold();
default:
console.log(`Invalid attribute`);
}
};
global.addPriceTooltip = (tooltip, sellable, attribute) => {
let value = global.getConfiguredValue(sellable.value, attribute);
tooltip.addAdvanced(sellable.item, (item, advanced, text) => {
let quality;
if (item.nbt && item.nbt.quality_food) {
quality = item.nbt.quality_food.quality;
}
if (tooltip.shift) {
getStackBonusValueTooltips(text, value, item, attribute, quality);
} else {
text.add(1, [
Text.translatable(
"tooltip.society.coins",
`${formatNumber(value, quality)}`
).white(),
Text.of(" "),
Text.translatable(
"tooltip.society.hold_key",
Text.translatable("key.keyboard.shift").gray()
).darkGray(),
]);
}
});
};
ItemEvents.tooltip((tooltip) => {
const calculateCost = (coin, count, stackSize) => {
let value = 0;
switch (coin) {
case "spur":
value = 1;
break;
case "bevel":
value = 8;
break;
case "sprocket":
value = 16;
break;
case "cog":
value = 64;
break;
case "crown":
value = 512;
break;
case "sun":
value = 4096;
break;
case "neptunium_coin":
value = 32768;
break;
case "ancient_coin":
value = 262144;
break;
case "prismatic_coin":
value = 16777216;
break;
default:
console.log(`Invalid coin`);
}
return formatNumber(value * count * (stackSize || 1));
};
const coinTooltips = [
"numismatics:spur",
"numismatics:bevel",
"numismatics:sprocket",
"numismatics:cog",
"numismatics:crown",
"numismatics:sun",
"numismatics:neptunium_coin",
"numismatics:ancient_coin",
"numismatics:prismatic_coin",
];
coinTooltips.forEach((coin) => {
tooltip.addAdvanced(coin, (item, advanced, text) => {
if (!coin.includes("_coin")) {
text.remove(1);
}
if (tooltip.shift) {
text.add(1, [
Text.translatable(
"tooltip.society.coins",
`${calculateCost(coin.path, 1, item.count)}`
).white(),
Text.of(" "),
Text.translatable("tooltip.society.stack_value").gray(),
]);
} else {
text.add(1, [
Text.translatable(
"tooltip.society.coins",
`${calculateCost(coin.path, 1, 1)}`
).white(),
Text.of(" "),
Text.translatable(
"tooltip.society.hold_key",
Text.translatable("key.keyboard.shift").gray()
).darkGray(),
]);
}
});
});
tooltip.addAdvanced("splendid_slimes:plort", (item, advanced, text) => {
let plortType;
let price;
if (item.nbt && item.nbt.plort) {
plortType = item.nbt.plort.id;
}
global.plorts.forEach((plort) => {
if (plort.type == plortType) price = plort.value;
});
if (tooltip.shift) {
getStackBonusValueTooltips(text, price, item, "crop", 0);
} else {
text.add(1, [
Text.translatable(
"tooltip.society.coins",
`${formatNumber(price, 0)}`
).white(),
Text.of(" "),
Text.translatable(
"tooltip.society.hold_key",
Text.translatable("key.keyboard.shift").gray()
).darkGray(),
]);
}
});
tooltip.addAdvanced("splendid_slimes:slime_heart", (item, advanced, text) => {
let heartType;
let price;
if (item.nbt && item.nbt.slime) {
heartType = item.nbt.slime.id;
}
global.slimeHearts.forEach((heart) => {
if (heart.type == heartType) price = heart.value;
});
if (tooltip.shift) {
getStackBonusValueTooltips(text, price, item, "crop", 0);
} else {
text.add(1, [
Text.translatable(
"tooltip.society.coins",
`${formatNumber(price, 0)}`
).white(),
Text.of(" "),
Text.translatable(
"tooltip.society.hold_key",
Text.translatable("key.keyboard.shift").gray()
).darkGray(),
]);
}
});
const getLongwingTooltips = (item, text) => {
let variant;
let size = 1.0;
let price = 1;
if (item.nbt) {
if (item.nbt.variant) {
variant = item.nbt.variant;
}
if (item.nbt.size && typeof item.nbt.size !== "function") {
size = item.nbt.size;
}
}
global.longwings.forEach((wing) => {
if (wing.variant == variant) price = (16 - wing.rarity) * 78;
});
price += Math.round((size / 0.01) * 4)
if (tooltip.shift) {
getStackBonusValueTooltips(text, price, item, "meat", 0);
} else {
text.add(1, [
Text.translatable(
"tooltip.society.coins",
`${formatNumber(price, 0)}`
).white(),
Text.of(" "),
Text.translatable(
"tooltip.society.hold_key",
Text.translatable("key.keyboard.shift").gray()
).darkGray(),
]);
}
}
// Item.of('longwings:moth', '{size:1.0f,variant:"small_emerald"}')
tooltip.addAdvanced("longwings:butterfly", (item, advanced, text) => {
getLongwingTooltips(item, text)
});
tooltip.addAdvanced("longwings:moth", (item, advanced, text) => {
getLongwingTooltips(item, text)
});
// Ore
global.ore.forEach((item) => {
global.addPriceTooltip(tooltip, item, "gem");
});
// Pristine
global.pristine.forEach((item) => {
global.addPriceTooltip(tooltip, item, "gem");
});
// Geodes
global.geodeList.forEach((geodeItem) => {
global.addPriceTooltip(tooltip, geodeItem, "gem");
tooltip.add(
geodeItem.item,
Text.translatable("tooltip.society.item_type.mineral").gray()
);
});
global.frozenGeodeList.forEach((geodeItem) => {
global.addPriceTooltip(tooltip, geodeItem, "gem");
tooltip.add(
geodeItem.item,
Text.translatable("tooltip.society.item_type.mineral").gray()
);
});
global.magmaGeodeList.forEach((geodeItem) => {
global.addPriceTooltip(tooltip, geodeItem, "gem");
tooltip.add(
geodeItem.item,
Text.translatable("tooltip.society.item_type.mineral").gray()
);
});
// Gem
global.gems.forEach((gem) => {
global.addPriceTooltip(tooltip, gem, "gem");
tooltip.add(
gem.item,
Text.translatable("tooltip.society.item_type.gem").gray()
);
});
[
"society:sparkstone",
"minecraft:emerald",
"minecraft:diamond",
"minecraft:amethyst_shard",
"minecraft:quartz",
"society:prismatic_shard",
"minecraft:prismarine_crystals",
].forEach((gem) => {
tooltip.add(gem, Text.translatable("tooltip.society.item_type.gem").gray());
});
global.miscGeologist.forEach((gem) => {
global.addPriceTooltip(tooltip, gem, "gem");
});
// Artifact
global.artifacts.forEach((artifact) => {
global.addPriceTooltip(tooltip, artifact, "meat");
});
global.relics.forEach((artifact) => {
global.addPriceTooltip(tooltip, artifact, "meat");
});
// Crops
global.crops.forEach((crop) => {
global.addPriceTooltip(tooltip, crop, "crop");
});
// Meat
global.animalProducts.forEach((meat) => {
global.addPriceTooltip(tooltip, meat, "crop");
});
// Wines
global.wines.forEach((wine) => {
global.addPriceTooltip(tooltip, wine, "wood");
});
// Brews
global.brews.forEach((brew) => {
global.addPriceTooltip(tooltip, brew, "wood");
});
// Preserves
global.preserves.forEach((jar) => {
global.addPriceTooltip(tooltip, jar, "wood");
});
// Dehydrated
global.dehydrated.forEach((jar) => {
global.addPriceTooltip(tooltip, jar, "wood");
});
// Artisan goods
global.artisanGoods.forEach((good) => {
global.addPriceTooltip(tooltip, good, "wood");
});
// Fish
global.fish.forEach((fish) => {
global.addPriceTooltip(tooltip, fish, "crop");
});
global.smokedFish.forEach((fish) => {
global.addPriceTooltip(tooltip, fish, "wood");
});
global.agedRoe.forEach((fish) => {
global.addPriceTooltip(tooltip, fish, "wood");
});
// Cocktails
global.cocktails.forEach((cocktail) => {
global.addPriceTooltip(tooltip, cocktail, "crop");
});
// herbalbrews
global.herbalBrews.forEach((brew) => {
global.addPriceTooltip(tooltip, brew, "crop");
});
// Logs
global.logs.forEach((log) => {
global.addPriceTooltip(tooltip, log, "crop");
});
// Cooking
global.cooking.forEach((dish) => {
global.addPriceTooltip(tooltip, dish, "crop");
});
// Misc
global.miscAdventurer.forEach((miscItem) => {
global.addPriceTooltip(tooltip, miscItem, "meat");
});
});
File diff suppressed because it is too large Load Diff
+1
View File
@@ -0,0 +1 @@
// DEPRECATED