add first patch
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
console.info("[SOCIETY] fishingRodLeveling.js loaded");
|
||||
|
||||
let maxLureLevel = 4;
|
||||
let maxLuckOfTheSeaLevel = 6;
|
||||
|
||||
ForgeEvents.onEvent(
|
||||
"net.minecraftforge.event.entity.player.ItemFishedEvent",
|
||||
(e) => {
|
||||
let randCap = 40;
|
||||
const player = e.getEntity();
|
||||
const mainHandItem = player.getHeldItem("main_hand");
|
||||
const mainHandItemId = mainHandItem.getId();
|
||||
const enchantmentTags = mainHandItem.enchantmentTags;
|
||||
const validRods = [
|
||||
"aquaculture:iron_fishing_rod",
|
||||
"aquaculture:gold_fishing_rod",
|
||||
"aquaculture:diamond_fishing_rod",
|
||||
"aquaculture:neptunium_fishing_rod",
|
||||
"netherdepthsupgrade:lava_fishing_rod",
|
||||
];
|
||||
if (!validRods.includes(mainHandItemId)) return;
|
||||
|
||||
if (player.level.isRaining()) {
|
||||
randCap = randCap - 10;
|
||||
}
|
||||
switch (mainHandItemId) {
|
||||
case "aquaculture:gold_fishing_rod":
|
||||
randCap -= 5;
|
||||
break;
|
||||
case "aquaculture:diamond_fishing_rod":
|
||||
randCap -= 10;
|
||||
break;
|
||||
case "aquaculture:neptunium_fishing_rod":
|
||||
randCap -= 20;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
const randomNum = Math.floor(Math.random() * randCap);
|
||||
if (randomNum == 0) {
|
||||
const lureLevel = mainHandItem.getEnchantmentLevel("minecraft:lure");
|
||||
const luckOfTheSeaLevel = mainHandItem.getEnchantmentLevel(
|
||||
"minecraft:luck_of_the_sea"
|
||||
);
|
||||
if (lureLevel < maxLureLevel && Math.floor(Math.random() * 2) == 0) {
|
||||
for (let i = 0; i < enchantmentTags.size(); i++) {
|
||||
let enchantment = enchantmentTags.get(i);
|
||||
if (enchantment.get("id") == "minecraft:lure") {
|
||||
enchantmentTags.remove(i);
|
||||
}
|
||||
}
|
||||
mainHandItem.enchantStack("minecraft:lure", lureLevel + 1);
|
||||
player.tell(Text.translatable("society.fishing_rod.level_up.lure").gold());
|
||||
} else if (luckOfTheSeaLevel < maxLuckOfTheSeaLevel) {
|
||||
for (let i = 0; i < enchantmentTags.size(); i++) {
|
||||
let enchantment = enchantmentTags.get(i);
|
||||
if (enchantment.get("id") == "minecraft:luck_of_the_sea") {
|
||||
enchantmentTags.remove(i);
|
||||
}
|
||||
}
|
||||
mainHandItem.enchantStack(
|
||||
"minecraft:luck_of_the_sea",
|
||||
luckOfTheSeaLevel + 1
|
||||
);
|
||||
player.tell(Text.translatable("society.fishing_rod.level_up.lots").gold());
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,42 @@
|
||||
console.info("[SOCIETY] fishingSkills.js loaded");
|
||||
|
||||
global.handleExtraFishing = (e) => {
|
||||
const player = e.getEntity();
|
||||
let increase = 0;
|
||||
if (player.isFake()) player.getHeldItem("main_hand").count--;
|
||||
let hasNet = global.hasBobber(player.getHeldItem("main_hand"), "society:net_bobber")
|
||||
if (player.getLevel().dimension === "minecraft:the_nether") {
|
||||
if (Math.random() < 0.1) player.give(Item.of(`${hasNet ? 3 : 1}x society:nether_jelly`));
|
||||
if (player.stages.has("wooden_pollution") && Math.random() < 0.1)
|
||||
player.give(Item.of(`${hasNet ? 3 : 1}x society:nether_jelly`));
|
||||
if (player.stages.has("fly_fisher")) increase += 1;
|
||||
if (player.stages.has("school_fisher")) increase += 3;
|
||||
if (
|
||||
global.hasBobber(player.getHeldItem("main_hand"), "society:needle_bobber")
|
||||
)
|
||||
increase += 5;
|
||||
if (increase > 0) {
|
||||
e.getDrops().forEach((drop) => {
|
||||
if (drop.hasTag("minecraft:fishes")) {
|
||||
player.give(Item.of(`${increase}x ${drop.id}`, drop.nbt));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
e.getDrops().forEach((drop) => {
|
||||
if (
|
||||
!drop.hasTag("minecraft:fishes") &&
|
||||
hasNet &&
|
||||
drop.maxStackSize > drop.count * 2
|
||||
) {
|
||||
player.give(Item.of(`${drop.count * 2}x ${drop.id}`, drop.nbt));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
ForgeEvents.onEvent(
|
||||
"net.minecraftforge.event.entity.player.ItemFishedEvent",
|
||||
(e) => {
|
||||
global.handleExtraFishing(e);
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,39 @@
|
||||
console.info("[SOCIETY] nerfHero.js loaded");
|
||||
|
||||
const apiEvent = Java.loadClass("net.minecraftforge.eventbus.api.Event");
|
||||
|
||||
global.runFixGrandma = (e) => {
|
||||
if (
|
||||
[
|
||||
"effect.farm_and_charm.grandmas_blessing",
|
||||
"effect.farm_and_charm.farmers_blessing",
|
||||
"effect.brewery.pintcharisma",
|
||||
].includes(e.getEffectInstance().getEffect().getDescriptionId()) &&
|
||||
e.getEntity().getType().toString() == "minecraft:player"
|
||||
) {
|
||||
// e.setResult(apiEvent.Result.DENY);
|
||||
if (e.getEntity().potionEffects.getActive().toString().includes("stunning")) {
|
||||
console.log("removing")
|
||||
e.getEntity().potionEffects.add("oreganized:stunning", 1, 1, true, false);
|
||||
e.setResult(apiEvent.Result.DENY);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ForgeEvents.onEvent("net.minecraftforge.event.entity.living.MobEffectEvent$Applicable", (event) => {
|
||||
global.runFixGrandma(event);
|
||||
|
||||
if (
|
||||
[
|
||||
"effect.minecraft.hero_of_the_village",
|
||||
"effect.vinery.trading",
|
||||
"effect.brewery.pintcharisma",
|
||||
"effect.nethervinery.gravedigger",
|
||||
"effect.nethervinery.improved_gravedigger",
|
||||
].includes(event.getEffectInstance().getEffect().getDescriptionId()) &&
|
||||
event.getEntity().getType().toString() == "minecraft:player"
|
||||
) {
|
||||
event.setResult(apiEvent.Result.DENY);
|
||||
console.log("No cheese in industrial capitalism...");
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
// DEPRECATED
|
||||
@@ -0,0 +1,31 @@
|
||||
console.info("[SOCIETY] skullCavernChunkManager.js loaded");
|
||||
|
||||
global.chunkLoadManager = (e) => {
|
||||
const { chunk, level } = e;
|
||||
|
||||
if (level.dimension === "society:skull_cavern" && !level.isClientSide()) {
|
||||
if (global.susFunctionLogging) console.log("[SOCIETY-SUSFN] skullCavernChunkManager.js");
|
||||
const day = global.getDay(level);
|
||||
|
||||
if (!level.persistentData.chunkParityMap)
|
||||
level.persistentData.chunkParityMap = {};
|
||||
let chunkPos = chunk.pos.toString();
|
||||
let chunkMap = level.persistentData.chunkParityMap;
|
||||
if (chunkMap && chunkMap[chunkPos]) {
|
||||
if (Number(chunkMap[chunkPos].day) !== day) {
|
||||
level.persistentData.chunkParityMap[chunkPos] = {
|
||||
day: day,
|
||||
toggleBit: Number(chunkMap[chunkPos].toggleBit) == 0 ? 1 : 0,
|
||||
};
|
||||
}
|
||||
} else if (chunkMap)
|
||||
level.persistentData.chunkParityMap[chunkPos] = {
|
||||
day: day,
|
||||
toggleBit: 0,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ForgeEvents.onEvent("net.minecraftforge.event.level.ChunkEvent$Load", (e) => {
|
||||
global.chunkLoadManager(e);
|
||||
});
|
||||
Reference in New Issue
Block a user