Skip to content

Commit

Permalink
Remove global gamerules and fix the fortress locator
Browse files Browse the repository at this point in the history
  • Loading branch information
cubebotfan committed Aug 25, 2024
1 parent 694db09 commit 0561492
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 127 deletions.
5 changes: 0 additions & 5 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,6 @@
"projectID":252848,
"required":true
},
{
"fileID":4586447,
"projectID":227657,
"required":true
},
{
"fileID":4049657,
"projectID":376737,
Expand Down
1 change: 0 additions & 1 deletion modlist.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
<li><a href="https://www.curseforge.com/projects/404468">FTB Teams (Forge) (by LatvianModder)</a></li>
<li><a href="https://www.curseforge.com/projects/854949">Fusion (Connected Textures) (by SuperMartijn642)</a></li>
<li><a href="https://www.curseforge.com/projects/388172">GeckoLib (by Gecko, Eliot, AzureDoom, Chappie, DerToaster)</a></li>
<li><a href="https://www.curseforge.com/projects/227657">Global GameRules (by GoryMoon, CFGrafanaStats)</a></li>
<li><a href="https://www.curseforge.com/projects/238911">Grappling Hook Mod (by Yyon, Nyfaria, and Mayesnake)</a></li>
<li><a href="https://www.curseforge.com/projects/356646">GunpowderLib (by Jackyy)</a></li>
<li><a href="https://www.curseforge.com/projects/520110">Iceberg [Forge] (by Grend)</a></li>
Expand Down
6 changes: 2 additions & 4 deletions overrides/config/ftbquests/quests/chapters/market.snbt
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,11 @@
rewards: [
{
id: "5CAE42EDC4CE4A1D"
type: "command"
type: "custom"
title: "Fortress Locator"
icon: "create:blaze_burner"
tags: [""]
tags: ["fortress"]
auto: "enabled"
command: "/locate betterfortresses:fortress"
player_command: true
}
{
id: "654464FB386A729A"
Expand Down
102 changes: 0 additions & 102 deletions overrides/config/globalgamerules-common.toml

This file was deleted.

7 changes: 5 additions & 2 deletions overrides/kubejs/server_scripts/_helper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
// priority: 9999

//Java imports
const Registry = java('net.minecraft.core.Registry'); //registries, needed for almost everything involving Java classes
//const BlockPos = java('net.minecraft.core.BlockPos'); //Block position. For some reason we don't need to import this?
const TagKey = java('net.minecraft.tags.TagKey');

// Mod shortcuts
const MOD = (domain, id, x) => (x ? `${x}x ` : "") + (id.startsWith('#') ? '#' : "") + domain + ":" + id.replace('#', '')

Expand Down Expand Up @@ -129,8 +134,6 @@ const addChiselingRecipe = (event, id, items, overwrite) => {
* @param {string} tag Don't include a hashtag in the tag name
*/
// const ItemOutput = java('slimeknights.mantle.recipe.helper.ItemOutput');
// const TagKey = java('net.minecraft.tags.TagKey');
// const Registry = java('net.minecraft.core.Registry');
const getPreferredTag = (tag) => {
/* Tried using mantle for this and it didn't work on first launch unfortunately */
//return Item.of(ItemOutput.fromTag(TagKey.create(Registry.ITEM_REGISTRY, tag), 1).get()).getId();
Expand Down
42 changes: 35 additions & 7 deletions overrides/kubejs/server_scripts/quests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,49 @@ onEvent('ftbquests.custom_reward', function (event) {
let reward = event.getReward()
let id = reward.quest.getCodeString()


let runCommand = (cmd) => {
event.server.scheduleInTicks(10, event.server, function (callback) {
callback.data.runCommandSilent(cmd)
})
}

if (reward.hasTag('reset'))
runCommand('/ftbquests change_progress ' + '@p' + ' reset ' + id)
runCommand(`/ftbquests change_progress ${event.player.name.text} reset ${id}`)

if (reward.hasTag('bad_omen'))
runCommand('/effect clear ' + '@p' + ' minecraft:bad_omen')
runCommand(`/effect clear ${event.player.name.text} minecraft:bad_omen`)

if (reward.hasTag('fortress'))
event.server.scheduleInTicks(10, event.server, function (callback) {
callback.data.runCommand('/execute as ' + '@p' + ' in minecraft:the_nether run locate fortress')
})
if (reward.hasTag('fortress')) {
let message;
let refund = false;

if(event.player.level.dimension==='minecraft:the_nether') {
let structureName = Platform.isLoaded('betterfortresses') ? 'betterfortresses:fortress' : 'fortress';
let playerLevel = event.player.getLevel().getMinecraftLevel();

let structure = TagKey.create(Registry.CONFIGURED_STRUCTURE_FEATURE_REGISTRY, structureName);
let blockPos = new BlockPos(event.player.getX(), event.player.getY(), event.player.getZ());
let radius = 32;

let position = playerLevel.findNearestMapFeature(structure, blockPos, radius, false);

if (blockPos) {
message = `A Fortress was found at ${position.x} ${position.z}.`;

} else {
message = `No fortress could be found. Your gold has been refunded.`;
refund = true;
}
} else {
message = `The Locator cannot be used here. Your gold has been refunded.`;
refund = true;
}

event.server.scheduleInTicks(10, event.server, function (callback) {
if (refund) {
event.player.give(Item.of('thermal:gold_coin', 2))
}
callback.data.runCommand(`/tell ${event.player.name.text} ${message}`)
})
}
})
9 changes: 8 additions & 1 deletion overrides/kubejs/server_scripts/recipes/phantomless.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,11 @@ onEvent('server.datapack.first', event => {
"result": { "name": "tconstruct:double_jump", "level": 1 }
})
})
//slow fall potion is in startup script potions.js
//slow fall potion is in startup script potions.js

onEvent('server.load', event=>{
if (!event.server.persistentData.insomniaDisabled) {
event.server.runCommandSilent("/gamerule doInsomnia false")
event.server.persistentData.insomniaDisabled = true;
}
})
5 changes: 0 additions & 5 deletions server_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@
"projectID":252848,
"required":true
},
{
"fileID":4586447,
"projectID":227657,
"required":true
},
{
"fileID":4049657,
"projectID":376737,
Expand Down

0 comments on commit 0561492

Please sign in to comment.