Reinitailized repository

This commit is contained in:
Malasaur 2026-02-08 21:40:15 +01:00
commit b4fb99fc02
No known key found for this signature in database
2864 changed files with 697863 additions and 0 deletions

View file

@ -0,0 +1,72 @@
// Creates and configures the Creative dimension
/*
const config = global.config;
const hexToRgb = global.hexToRgb;
/////////////////
/// DIMENSION ///
/////////////////
// Defines the Creative dimension
ServerEvents.highPriorityData((event) => {
event.addJson("retards:dimension/creative.json", {
type: "minecraft:overworld",
generator: {
type: "minecraft:flat",
settings: {
biome: "minecraft:plains",
lakes: false,
features: false,
layers: Object.entries(config.creative.layers).map(
([block, count]) => ({
block: block,
height: count,
}),
),
structures: {},
},
},
});
});
//////////////
/// PORTAL ///
//////////////
// Defines the Creative portal
/*
ServerEvents.highPriorityData((event) => {
const portal = config.creative;
const color = hexToRgb(portal.color);
event.addJson("retards:portals/creative.json", {
block: portal.material,
dim: "retards:creative",
r: color.r,
g: color.g,
b: color.b,
ignitionType: "FLUID",
ignitionSource: portal.fluid,
});
});
//////////////
/// DIMINV ///
//////////////
// Applies Dimensional Inventories to the Creative dimension
PlayerEvents.loggedIn((event) => {
const data = event.server.persistentData;
if (!data.creativeInitialized) {
data.creativeInitialized = true;
event.server.runCommandSilent("diminv pool creative create");
event.server.runCommandSilent(
"diminv pool creative dimension retards:creative assign",
);
event.server.runCommandSilent("diminv pool creative gameMode creative");
event.server.runCommandSilent(
"diminv pool creative progressAdvancements false",
);
event.server.runCommandSilent(
"diminv pool creative incrementStatistics false",
);
}
});
*/

View file

@ -0,0 +1,92 @@
// Creates and configures custom dimensions
const raw = JsonIO.readJson("kubejs/config/settings.json");
const config = raw ? JSON.parse(raw.toString()) : {};
function hexToRgb(hex) {
const h = hex.replace("#", "");
return {
r: parseInt(h.substring(0, 2), 16),
g: parseInt(h.substring(2, 4), 16),
b: parseInt(h.substring(4, 6), 16),
};
}
var portalColor;
ServerEvents.highPriorityData((event) => {
if (config.dimensions) {
config.dimensions.forEach((dimension) => {
const [modId, dimId] = dimension.id.split(":");
/////////////////
/// DIMENSION ///
/////////////////
const dimJson = { type: "minecraft:overworld" };
if (dimension.worldgen)
dimJson["generator"] = {
type: "minecraft:flat",
settings: {
biome: "minecraft:plains",
lakes: false,
features: false,
structures: {},
layers: Object.entries(dimension.worldgen).map(
([block, count]) => ({
block: block,
height: count,
}),
),
},
};
event.addJson(`${modId}:dimension/${dimId}.json`, dimJson);
//////////////
/// PORTAL ///
//////////////
const portal = dimension.portal;
if (portal) {
portalColor = hexToRgb(portal.color);
event.addJson(`${modId}:portals/${dimId}.json`, {
block: portal.material,
dim: dimension.id,
r: portalColor.r,
g: portalColor.g,
b: portalColor.b,
ignitionType: "FLUID",
ignitionSource: portal.fluid,
});
}
});
}
});
//////////////
/// DIMINV ///
//////////////
PlayerEvents.loggedIn((event) => {
if (config.dimensions) {
config.dimensions.forEach((dimension) => {
const [modId, dimId] = dimension.id.split(":");
const data = event.server.persistentData;
if (!data.getBoolean(`${dimId}Initialized`)) {
data.putBoolean(`${dimId}Initialized`, true);
event.server.scheduleInTicks(20, () => {
event.server.runCommandSilent(`diminv pool ${dimId} create`);
event.server.runCommandSilent(
`diminv pool ${dimId} dimension ${dimension.id} assign`,
);
event.server.runCommandSilent(
`diminv pool ${dimId} gameMode ${dimension.gamemode}`,
);
event.server.runCommandSilent(
`diminv pool ${dimId} progressAdvancements false`,
);
event.server.runCommandSilent(
`diminv pool ${dimId} incrementStatistics false`,
);
});
}
});
}
});

View file

@ -0,0 +1,23 @@
// Makes Tickets of Eternal Keeping not consumed on death.
const tickets = {};
EntityEvents.death((event) => {
const player = event.player;
if (event.entity.isPlayer()) {
tickets[player.uuid] = null;
player.inventory.allItems.forEach((item) => {
if (item.nbt && item.nbt.EternalKeep) tickets[player.uuid] = item.copy();
});
}
});
PlayerEvents.respawned((event) => {
const player = event.player;
const ticket = tickets[player.uuid];
if (ticket != null) player.give(Item.of(ticket, 1));
tickets[player.uuid] = null;
});