Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions kubejs/custom_types/extraprobe.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ declare namespace Helper {

type Items = Internal.ItemStackJS_ | `#${Special.ItemTag}` | `@${Special.Mod}` | "*";
type ItemOrTag = { item: Special.Item } | { tag: Special.ItemTag };
type ItemOrTagWithCount = { item: Special.Item, count?: number } | { tag: Special.ItemTag, count?: number };
type FluidOrTag = { fluid: Special.Fluid } | { tag: Special.FluidTag };
interface Tooltip {
item: Special.Item;
Expand Down
6 changes: 4 additions & 2 deletions kubejs/server_scripts/misc/diamond_ore.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
onEvent("tags.blocks", (event) => {
(function diamondOreTagRemoval() {
onEvent("tags.blocks", (event) => {
event.remove("minecraft:needs_iron_tool", "minecraft:diamond_ore");
event.remove("minecraft:needs_iron_tool", "minecraft:deepslate_diamond_ore");
});
});
})();
95 changes: 95 additions & 0 deletions kubejs/server_scripts/misc/interaction.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
interface ProjectileConfig {
projectile: { item: Special.Item };
particles: ProjectileSettings.Particles;
explosion: ProjectileSettings.Explosion;
createAutoJson?: ProjectileSettings.CreateAutoJSON;
AOE?: ProjectileSettings.AOE;
sound?: ProjectileSettings.Sound;
}

namespace ProjectileSettings {
interface CreateAutoJSON {
fileName: string;
reloadTicks: number;
damage: number;
knockback: number;
drag: number;
velocityMultiplier: number;
gravityMultiplier: number;
sticky: boolean;
soundPitch: number;
}

interface ParticlesEnabledNoColor {
/** Whether the ammo emits particles or not. */
enabled: true;
spread: number;
size: number;
speed: number;
count: number;
type: Special.ParticleType;
/** Specifies whether the particle's color can be changed. */
hasColor: false;
}

interface ParticlesEnabledWithColor extends ParticlesEnabledNoColor {
hasColor: true;
/** The color of the particle. */
color: [red: number, green: number, blue: number];
}

interface ParticlesDisabled {
enabled: false;
}

type Particles = ParticlesEnabledNoColor | ParticlesEnabledWithColor | ParticlesDisabled;

interface ExplosionEnabled {
enabled: true;
strength: number;
damageTerrain: boolean;
causesFire?: boolean;
silent?: boolean;
}

interface ExplosionDisabled {
enabled: false;
}

type Explosion = ExplosionEnabled | ExplosionDisabled;

interface AOE_Enabled {
enabled: true;
effectList: Effect[];
sound: Sound;
}

interface Effect {
potionEffect: Special.MobEffect;
potionTime: number;
potionAmplifier: number;
potionHideParticles: boolean;
range: `${bigint}`; // This should be a `number` but there's some jank happening on Java side
}

interface SoundEnabled {
enabled: true;
soundList: SoundCommand[];
}

type StringSoundSource = Extract<Internal.SoundSource_, string>;

interface SoundCommand {
soundName: Special.SoundEvent;
soundType: StringSoundSource;
soundRange: `${bigint}`; // This should be a `number` but there's some jank happening on Java side
soundVolume: number;
soundPitch: number;
}

interface SoundDisabled {
enabled: false;
}

type Sound = SoundEnabled | SoundDisabled;
}
96 changes: 19 additions & 77 deletions kubejs/server_scripts/misc/interaction.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference types="./interaction.d.ts"/>
/**
* This file originally contained comments marked with "Better Comments" VS Code extension.
* Now it has JSDoc comments instead, which have better editor integration.
Expand Down Expand Up @@ -99,64 +100,6 @@
}
});

/**
* @typedef ProjectileConfig
* @property {Projectile} projectile
* @property {Particles} particles
* @property {Explosion} explosion
*/

/**
* @typedef Projectile
* @property {Special.Item} item Item ID.
*/

/** @typedef {ParticlesEnabledWithNoColor | ParticlesEnabledWithColor | ParticlesDisabled} Particles */

/**
* @typedef ParticlesEnabledWithNoColor
* @property {true} enabled Whether the ammo emits particles or not.
* @property {number} spread
* @property {number} size
* @property {number} speed
* @property {number} count
* @property {string} type
* @property {number} size
* @property {false} hasColor Specifies whether the particle's color can be changed.
*/

/**
* @typedef ParticlesEnabledWithColor
* @property {true} enabled Whether the ammo emits particles or not.
* @property {number} spread
* @property {number} size
* @property {number} speed
* @property {number} count
* @property {string} type
* @property {number} size
* @property {true} hasColor Specifies whether the particle's color can be changed.
* @property {[red: number, green: number, blue: number]} color The color of the particle
*/

/**
* @typedef ParticlesDisabled
* @property {false} enabled Whether the ammo emits particles or not.
*/

/** @typedef {ExplosionEnabled | ExplosionDisabled} Explosion */

/**
* @typedef ExplosionEnabled
* @property {true} enabled
* @property {number} strength
* @property {boolean} damageTerrain
*/

/**
* @typedef ExplosionDisabled
* @property {false} enabled
*/

/** @type {ProjectileConfig[]} */

//? createAutoJson will now also create the required json for create to understand that it can shoot that item.
Expand Down Expand Up @@ -212,7 +155,7 @@
},
sound: {
enabled: false,
soundList: [],
// soundList: [],
},
},
{
Expand Down Expand Up @@ -243,6 +186,7 @@
sticky: ammo.sticky,
sound_pitch: ammo.soundPitch,
};
// @ts-expect-error This works.
JsonIO.write(`kubejs/data/createastral/potato_cannon_projectile_types/${ammo.fileName}.json`, json);
});
});
Expand All @@ -254,14 +198,14 @@
if (entity.fullNBT.Item.id === ammoType.projectile.item) {
server.scheduleInTicks(5, (event) => {
if (entity.removed || entity.deadOrDying || !entity.alive) {
let x = entity.fullNBT.Pos[0];
let y = entity.fullNBT.Pos[1];
let z = entity.fullNBT.Pos[2];
let dim = entity.getLevel().getDimension();
let explosion = entity.block.offset(0, 0, 0).createExplosion();
const x = entity.fullNBT.Pos[0];
const y = entity.fullNBT.Pos[1];
const z = entity.fullNBT.Pos[2];
const dim = entity.getLevel().getDimension();
const explosion = entity.block.offset(0, 0, 0).createExplosion();
if (ammoType.particles.enabled) {
if (ammoType.particles.hasColor) {
let [red, green, blue] = ammoType.particles.color;
const [red, green, blue] = ammoType.particles.color;
server.runCommandSilent(
`execute in ${dim} run particle ${ammoType.particles.type} ${red} ${green} ${blue} ${ammoType.particles.size} ${x} ${y} ${z} ${ammoType.particles.spread} ${ammoType.particles.spread} ${ammoType.particles.spread} ${ammoType.particles.speed} ${ammoType.particles.count}`
);
Expand Down Expand Up @@ -306,48 +250,46 @@
}
});
} else if (entity.type === "minecraft:item") {
let dim = entity.getLevel().getDimension();
let x = entity.x,
y = entity.y,
z = entity.z;
const dim = entity.getLevel().getDimension();
const {x, y, z} = entity;
switch (entity.item) {
case "createastral:fragile_sheet":
entity.item = "createastral:broken_fragile_sheet";
server.runCommandSilent(
`execute in ${dim} run particle minecraft:block minecraft:magenta_concrete_powder ${entity.x} ${entity.y} ${entity.z} 0.0 0.1 0.0 0 5`
`execute in ${dim} run particle minecraft:block minecraft:magenta_concrete_powder ${x} ${y} ${z} 0.0 0.1 0.0 0 5`
);
server.runCommandSilent(
`execute in ${dim} run playsound create:crushing_1 block @a ${entity.x} ${entity.y} ${entity.z}`
`execute in ${dim} run playsound create:crushing_1 block @a ${x} ${y} ${z}`
);
break;

case "createastral:fragile_rocket_fin":
entity.item = "createastral:broken_fragile_rocket_fin";
server.runCommandSilent(
`execute in ${dim} run particle minecraft:block createastral:sturdy_sheet_block ${entity.x} ${entity.y} ${entity.z} 0.0 0.1 0.0 0 5`
`execute in ${dim} run particle minecraft:block createastral:sturdy_sheet_block ${x} ${y} ${z} 0.0 0.1 0.0 0 5`
);
server.runCommandSilent(
`execute in ${dim} run playsound create:crushing_1 block @a ${entity.x} ${entity.y} ${entity.z}`
`execute in ${dim} run playsound create:crushing_1 block @a ${x} ${y} ${z}`
);
break;

case "kubejs:fragile_sheet_block":
entity.item = "kubejs:broken_fragile_sheet_block";
server.runCommandSilent(
`execute in ${dim} run particle minecraft:block kubejs:fragile_sheet_block ${entity.x} ${entity.y} ${entity.z} 0.0 0.1 0.0 0 5`
`execute in ${dim} run particle minecraft:block kubejs:fragile_sheet_block ${x} ${y} ${z} 0.0 0.1 0.0 0 5`
);
server.runCommandSilent(
`execute in ${dim} run playsound create:crushing_1 block @a ${entity.x} ${entity.y} ${entity.z}`
`execute in ${dim} run playsound create:crushing_1 block @a ${x} ${y} ${z}`
);
break;

case "kubejs:fire_resistant_fragile_sheet_block":
entity.item = "kubejs:broken_fire_resistant_fragile_sheet_block";
server.runCommandSilent(
`execute in ${dim} run particle minecraft:block kubejs:broken_fire_resistant_fragile_sheet_block ${entity.x} ${entity.y} ${entity.z} 0.0 0.1 0.0 0 5`
`execute in ${dim} run particle minecraft:block kubejs:broken_fire_resistant_fragile_sheet_block ${x} ${y} ${z} 0.0 0.1 0.0 0 5`
);
server.runCommandSilent(
`execute in ${dim} run playsound create:crushing_1 block @a ${entity.x} ${entity.y} ${entity.z}`
`execute in ${dim} run playsound create:crushing_1 block @a ${x} ${y} ${z}`
);
break;

Expand Down
12 changes: 8 additions & 4 deletions kubejs/server_scripts/misc/tconstruct_fluidsyncfix.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
onEvent("block.right_click", (event) => {
if (event.block.id == "tconstruct:foundry_controller" && event.block.entity.tank != null)
event.block.entity.tank.syncFluids();
});
// @ts-nocheck
// Do not type check this, this is guaranteed to work.
(function hephaestusFluidSyncFix() {
onEvent("block.right_click", (event) => {
if (event.block.id == "tconstruct:foundry_controller" && event.block.entity.tank != null)
event.block.entity.tank.syncFluids();
});
})();
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
(function astralGeneratorsBoilerRecipes() {
const { BUCKET } = global.fluids;

onEvent("recipes", (event) => {
boilerSteamFromFuel(event);
boilerSteamFromLava(event);
Expand All @@ -17,12 +19,12 @@
type: "custommachinery:fluid",
mode: "input",
fluid: "minecraft:water",
amount: 100800,
amount: BUCKET,
},
{
type: "custommachinery:fluid",
fluid: "astralgenerators:steam",
amount: 201600,
amount: 2 * BUCKET,
mode: "output",
},
{
Expand Down Expand Up @@ -51,18 +53,18 @@
type: "custommachinery:fluid",
mode: "input",
fluid: "minecraft:lava",
amount: 100800,
amount: BUCKET,
},
{
type: "custommachinery:fluid",
mode: "input",
fluid: "minecraft:water",
amount: 100800,
amount: BUCKET,
},
{
type: "custommachinery:fluid",
fluid: "astralgenerators:steam",
amount: 201600,
amount: 2 * BUCKET,
mode: "output",
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(function astralGeneratorsFusionReactorRecipes() {
const { BUCKET } = global.fluids;
onEvent("recipes", (event) => {
fusionHelium3(event);
});
Expand All @@ -13,18 +14,18 @@
type: "custommachinery:fluid",
mode: "input",
fluid: "techreborn:deuterium",
amount: 100800,
amount: BUCKET,
},
{
type: "custommachinery:fluid",
mode: "input",
fluid: "techreborn:tritium",
amount: 100800,
amount: BUCKET,
},
{
type: "custommachinery:fluid",
fluid: "techreborn:helium3",
amount: 100800,
amount: BUCKET,
mode: "output",
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(function astralGeneratorsParticleAcceleratorRecipes() {
const {BUCKET} = global.fluids;
onEvent("recipes", (event) => {
acceleratorSingularity(event);
});
Expand All @@ -25,7 +26,7 @@
type: "custommachinery:fluid",
mode: "input",
fluid: "minecraft:water",
amount: 100800,
amount: BUCKET,
},
{
type: "custommachinery:energy",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(function astralGeneratorsSteamTurbineRecipes() {
const { BUCKET } = global.fluids;
onEvent("recipes", (event) => {
turbineSteamToEnergy(event);
});
Expand All @@ -12,7 +13,7 @@
{
type: "custommachinery:fluid",
fluid: "astralgenerators:steam",
amount: 84000,
amount: BUCKET * 5 / 12, // In order to maintain the ratio with the previous weird value. Whyyyyyyy
mode: "input",
},
{
Expand Down
Loading
Loading