jsp
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
// priority: 996
|
||||
|
||||
ServerEvents.registry('jukebox_song', event => {
|
||||
event.create("ftbevolution:blockvblock").song('ftbevolution:blockvblock', 240);
|
||||
});
|
||||
@@ -0,0 +1,126 @@
|
||||
// priority: 993
|
||||
|
||||
const debug_mode = false;
|
||||
const tierRequirement = 4;
|
||||
const layers = [
|
||||
"ftbevolution:pyramid_top",
|
||||
"ftbevolution:pyra_mid_upper",
|
||||
"ftbevolution:pyra_mid_lower",
|
||||
"ftbevolution:pyramid_base",
|
||||
];
|
||||
const catalystItem = "minecraft:nether_star";
|
||||
const rewardItem = "ftbevolution:creative_ascension"; // Define the specific reward item here
|
||||
const gamestageRequired = "completed_pyramid";
|
||||
|
||||
|
||||
BlockEvents.rightClicked("minecraft:beacon", function (event) {
|
||||
const { player, hand, item, level, block, server } = event;
|
||||
|
||||
if (hand != "MAIN_HAND") return event.cancel();
|
||||
|
||||
// Check if the player meets requirements
|
||||
if (!player.stages.has(gamestageRequired)) return player.tell(Component.translate("kubejs.pyramid.gamestage"));
|
||||
if (item.id !== catalystItem) return;
|
||||
if (block.getEntityData().Levels < tierRequirement) {
|
||||
return player.tell(Component.translate("kubejs.pyramid.below_tier", [`${tierRequirement.toString()}`, `${block.getEntityData().Levels.toString()}`]));
|
||||
}
|
||||
|
||||
// Validate each layer of the pyramid
|
||||
for (let i = 0; i < layers.length; i++) {
|
||||
let layerSize = 1 + i; // Increase pyramid size by layer
|
||||
let yOffset = -i - 1; // Calculate the vertical offset for each layer
|
||||
|
||||
for (let x = -layerSize; x <= layerSize; x++) {
|
||||
for (let z = -layerSize; z <= layerSize; z++) {
|
||||
let currentBlock = level.getBlock(
|
||||
block.x + x,
|
||||
block.y + yOffset,
|
||||
block.z + z
|
||||
);
|
||||
|
||||
if (currentBlock.id !== layers[i]) {
|
||||
return player.tell(
|
||||
Component.translate('kubejs.pyramid.wrong_layer',
|
||||
[
|
||||
`${(i+1)}`,
|
||||
Text.green(Component.translate(Item.of(layers[i]).getDescriptionId())),
|
||||
Text.red(Component.translate(currentBlock.item.getDescriptionId()))
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
player.sendSystemMessage({ translate: 'kubejs.pyramid.success', color: "green" }, true);
|
||||
let soundCommand = `execute as ${player.name.string} run playsound ars_nouveau:ea_channel ambient ${player.name.string} ~ ~ ~ 0.5 2 0.5`;
|
||||
server.runCommandSilent(soundCommand);
|
||||
|
||||
let iterations = 10;
|
||||
|
||||
// Fireworks for first time completion
|
||||
if (!player.stages.has('received_pyramid_reward')) {
|
||||
iterations = 40;
|
||||
player.stages.add('received_pyramid_reward');
|
||||
server.scheduleInTicks(170, (_) => {
|
||||
server.runCommandSilent(`execute in ${player.level.dimension} positioned ${block.x} ${block.y + 1} ${block.z} run summon firework_rocket ~ ~1 ~ {LifeTime:20,FireworksItem:{id:firework_rocket,components:{fireworks:{flight_duration:1.5,explosions:[{shape:creeper,has_twinkle:1b,has_trail:1b,colors:[I;11546150,8439583]}}}}}`);
|
||||
});
|
||||
server.scheduleInTicks(180, (_) => {
|
||||
server.runCommandSilent(`execute in ${player.level.dimension} positioned ${block.x+3} ${block.y-1} ${block.z+3} run summon firework_rocket ~ ~1 ~ {LifeTime:15,FireworksItem:{id:firework_rocket,components:{fireworks:{flight_duration:1.5,explosions:[{shape:star,has_twinkle:1b,has_trail:1b,colors:[I;11546150,8439583],fade_colors:[I;16351261,16701501]}}}}}`);
|
||||
server.runCommandSilent(`execute in ${player.level.dimension} positioned ${block.x+3} ${block.y-1} ${block.z-3} run summon firework_rocket ~ ~1 ~ {LifeTime:15,FireworksItem:{id:firework_rocket,components:{fireworks:{flight_duration:1.5,explosions:[{shape:star,has_twinkle:1b,has_trail:1b,colors:[I;11546150,8439583],fade_colors:[I;16351261,16701501]}}}}}`);
|
||||
server.runCommandSilent(`execute in ${player.level.dimension} positioned ${block.x-3} ${block.y-1} ${block.z+3} run summon firework_rocket ~ ~1 ~ {LifeTime:15,FireworksItem:{id:firework_rocket,components:{fireworks:{flight_duration:1.5,explosions:[{shape:star,has_twinkle:1b,has_trail:1b,colors:[I;11546150,8439583],fade_colors:[I;16351261,16701501]}}}}}`);
|
||||
server.runCommandSilent(`execute in ${player.level.dimension} positioned ${block.x-3} ${block.y-1} ${block.z-3} run summon firework_rocket ~ ~1 ~ {LifeTime:15,FireworksItem:{id:firework_rocket,components:{fireworks:{flight_duration:1.5,explosions:[{shape:star,has_twinkle:1b,has_trail:1b,colors:[I;11546150,8439583],fade_colors:[I;16351261,16701501]}}}}}`);
|
||||
});
|
||||
}
|
||||
|
||||
// Particle effects for the pyramid
|
||||
for (let i = 0; i < iterations; i++) {
|
||||
let red = Math.random() * 0.5 + 0.5;
|
||||
let green = Math.random() * 0.5 + 0.5;
|
||||
let blue = Math.random() * 0.5 + 0.5;
|
||||
server.scheduleInTicks((i * 5), (_) => server.runCommandSilent(`execute at ${player.username} run particle minecraft:entity_effect{color:[${red},${green},${blue},1.0]} ${block.x + 0.5} ${block.y + 1} ${block.z + 0.5} 0 0 0 0.5 100 force`));
|
||||
}
|
||||
|
||||
// Consume catalyst immediately (before scheduled task) to prevent stale reference issues
|
||||
if (!player.isCreative()) item.count--;
|
||||
|
||||
// Spawn the reward item
|
||||
server.scheduleInTicks(iterations * 5, (_) => {
|
||||
server.runCommandSilent(`execute at ${player.username} run summon item ${block.x} ${block.y + 1} ${block.z} {Item:{id:"${rewardItem}",Count:1b},NoGravity:1b, Glowing:1b, Motion:[0d,0.02d]}`);
|
||||
});
|
||||
|
||||
event.cancel(); // Prevent beacon GUI from opening
|
||||
});
|
||||
|
||||
//Also Adding a System for Players who already compleated the Pyramid
|
||||
// and would like to experience the rework.
|
||||
|
||||
const pyramid_quest_ids = [
|
||||
"3883EC8201EE0E54"
|
||||
];
|
||||
|
||||
PlayerEvents.loggedIn(event => {
|
||||
const {player} = event
|
||||
|
||||
if(!player.stages.has("pyramid_rework")){
|
||||
|
||||
//Bonus. Triggering a Flavor Message.
|
||||
player.tell(Text.translate('ftb.pyramid.initial_message'));
|
||||
player.tell(Text.translate('ftb.pyramid.initial_message.pyramid').green());
|
||||
|
||||
//1. Removing the Existing Pyramid Completion
|
||||
player.stages.remove("completed_pyramid");
|
||||
if (debug_mode) player.tell(`Removed completed_pyramid stage`);
|
||||
|
||||
pyramid_quest_ids.forEach(questID => {
|
||||
player.server.runCommandSilent(`ftbquests change_progress @p reset ${questID}`);
|
||||
});
|
||||
|
||||
//2. Adding a new Gamestage that indicated that the player has started the new pyramid rework.
|
||||
player.stages.add("pyramid_rework");
|
||||
if (debug_mode) player.tell(`Added pyramid_rework stage`);
|
||||
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,70 @@
|
||||
// priority: 995
|
||||
// FTB Ranks ultimine upgrade system
|
||||
|
||||
ServerEvents.loaded((event) => {
|
||||
event.server.scheduleInTicks(100, (_) => {
|
||||
updateRanks();
|
||||
});
|
||||
});
|
||||
|
||||
const ranks = [
|
||||
{
|
||||
name: "ultimine_upgrade0",
|
||||
power: 1,
|
||||
permissions: {
|
||||
"ftbultimine.max_blocks": 16,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ultimine_upgrade1",
|
||||
power: 2,
|
||||
permissions: {
|
||||
"ftbultimine.max_blocks": 32,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ultimine_upgrade2",
|
||||
power: 3,
|
||||
permissions: {
|
||||
"ftbultimine.max_blocks": 48,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ultimine_upgrade3",
|
||||
power: 4,
|
||||
permissions: {
|
||||
"ftbultimine.max_blocks": 64,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ultimine_upgrade4",
|
||||
power: 5,
|
||||
permissions: {
|
||||
"ftbultimine.max_blocks": 96,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ultimine_upgrade5",
|
||||
power: 6,
|
||||
permissions: {
|
||||
"ftbultimine.max_blocks": 128,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
function updateRanks() {
|
||||
for (const rank of ranks) {
|
||||
let FTBRank = $FTBRanksAPI.manager().getRank(rank.name);
|
||||
|
||||
if (!FTBRank.isPresent()) {
|
||||
FTBRank = $FTBRanksAPI.manager().createRank(rank.name, rank.name, rank.power);
|
||||
}
|
||||
else {
|
||||
FTBRank = FTBRank.get();
|
||||
}
|
||||
for (const [permission, value] of Object.entries(rank.permissions)) {
|
||||
FTBRank.setPermission(permission, $NumberPermissionValue.of(value));
|
||||
}
|
||||
}
|
||||
$FTBRanksAPI.manager().markRanksDirty();
|
||||
}
|
||||
Reference in New Issue
Block a user