Skip to content
Merged
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 scripts/vanilla-types/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Basically @minecraft/vanilla-data, unlike enums the static properties returns corresponding type classes
9 changes: 9 additions & 0 deletions scripts/vanilla-types/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Script example for ScriptAPI
// Author: Jayly <https://github.com/JaylyDev>
// Project: https://github.com/JaylyDev/ScriptAPI
export * from './mojang-block';
export * from './mojang-dimension';
export * from './mojang-effect';
export * from './mojang-enchantment';
export * from './mojang-entity';
export * from './mojang-item';
9 changes: 9 additions & 0 deletions scripts/vanilla-types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Script example for ScriptAPI
// Author: Jayly <https://github.com/JaylyDev>
// Project: https://github.com/JaylyDev/ScriptAPI
export * from './mojang-block';
export * from './mojang-dimension';
export * from './mojang-effect';
export * from './mojang-enchantment';
export * from './mojang-entity';
export * from './mojang-item';
1,876 changes: 1,876 additions & 0 deletions scripts/vanilla-types/mojang-block.js

Large diffs are not rendered by default.

944 changes: 944 additions & 0 deletions scripts/vanilla-types/mojang-block.ts

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions scripts/vanilla-types/mojang-dimension.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { DimensionTypes, world } from "@minecraft/server";
/**
* All possible MinecraftDimensionTypes
*/
export class MinecraftDimensionTypes {
constructor() {
throw new TypeError("Illegal constructor");
}
;
static get(typeName) {
return world.getDimension(typeName);
}
;
static getAll() {
return DimensionTypes.getAll().map(dimension => world.getDimension(dimension.typeId));
}
;
static get Nether() { return world.getDimension("minecraft:nether"); }
;
static get Overworld() { return world.getDimension("minecraft:overworld"); }
;
static get TheEnd() { return world.getDimension("minecraft:the_end"); }
;
}
19 changes: 19 additions & 0 deletions scripts/vanilla-types/mojang-dimension.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Dimension, DimensionTypes, world } from "@minecraft/server";

/**
* All possible MinecraftDimensionTypes
*/
export class MinecraftDimensionTypes {
private constructor() {
throw new TypeError("Illegal constructor");
};
static get(typeName: string): Dimension | undefined {
return world.getDimension(typeName);
};
static getAll(): Dimension[] {
return DimensionTypes.getAll().map(dimension => world.getDimension(dimension.typeId));
};
static get Nether() { return world.getDimension("minecraft:nether"); };
static get Overworld() { return world.getDimension("minecraft:overworld"); };
static get TheEnd() { return world.getDimension("minecraft:the_end"); };
}
80 changes: 80 additions & 0 deletions scripts/vanilla-types/mojang-effect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { EffectTypes } from "@minecraft/server";
/**
* All possible MinecraftEffectTypes
*/
export class MinecraftEffectTypes {
constructor() {
throw new TypeError("Illegal constructor");
}
;
static get(typeName) {
return EffectTypes.get(typeName);
}
;
static getAll() {
return EffectTypes.getAll();
}
;
static get Absorption() { return EffectTypes.get("absorption"); }
;
static get BadOmen() { return EffectTypes.get("bad_omen"); }
;
static get Blindness() { return EffectTypes.get("blindness"); }
;
static get ConduitPower() { return EffectTypes.get("conduit_power"); }
;
static get Darkness() { return EffectTypes.get("darkness"); }
;
static get Empty() { return EffectTypes.get("empty"); }
;
static get FatalPoison() { return EffectTypes.get("fatal_poison"); }
;
static get FireResistance() { return EffectTypes.get("fire_resistance"); }
;
static get Haste() { return EffectTypes.get("haste"); }
;
static get HealthBoost() { return EffectTypes.get("health_boost"); }
;
static get Hunger() { return EffectTypes.get("hunger"); }
;
static get InstantDamage() { return EffectTypes.get("instant_damage"); }
;
static get InstantHealth() { return EffectTypes.get("instant_health"); }
;
static get Invisibility() { return EffectTypes.get("invisibility"); }
;
static get JumpBoost() { return EffectTypes.get("jump_boost"); }
;
static get Levitation() { return EffectTypes.get("levitation"); }
;
static get MiningFatigue() { return EffectTypes.get("mining_fatigue"); }
;
static get Nausea() { return EffectTypes.get("nausea"); }
;
static get NightVision() { return EffectTypes.get("night_vision"); }
;
static get Poison() { return EffectTypes.get("poison"); }
;
static get Regeneration() { return EffectTypes.get("regeneration"); }
;
static get Resistance() { return EffectTypes.get("resistance"); }
;
static get Saturation() { return EffectTypes.get("saturation"); }
;
static get SlowFalling() { return EffectTypes.get("slow_falling"); }
;
static get Slowness() { return EffectTypes.get("slowness"); }
;
static get Speed() { return EffectTypes.get("speed"); }
;
static get Strength() { return EffectTypes.get("strength"); }
;
static get VillageHero() { return EffectTypes.get("village_hero"); }
;
static get WaterBreathing() { return EffectTypes.get("water_breathing"); }
;
static get Weakness() { return EffectTypes.get("weakness"); }
;
static get Wither() { return EffectTypes.get("wither"); }
;
}
46 changes: 46 additions & 0 deletions scripts/vanilla-types/mojang-effect.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { EffectType, EffectTypes } from "@minecraft/server";
/**
* All possible MinecraftEffectTypes
*/
export class MinecraftEffectTypes implements EffectTypes {
private constructor() {
throw new TypeError("Illegal constructor");
};
static get(typeName: string): EffectType | undefined {
return EffectTypes.get(typeName);
};
static getAll(): EffectType[] {
return EffectTypes.getAll();
};
static get Absorption() { return EffectTypes.get("absorption"); };
static get BadOmen() { return EffectTypes.get("bad_omen"); };
static get Blindness() { return EffectTypes.get("blindness"); };
static get ConduitPower() { return EffectTypes.get("conduit_power"); };
static get Darkness() { return EffectTypes.get("darkness"); };
static get Empty() { return EffectTypes.get("empty"); };
static get FatalPoison() { return EffectTypes.get("fatal_poison"); };
static get FireResistance() { return EffectTypes.get("fire_resistance"); };
static get Haste() { return EffectTypes.get("haste"); };
static get HealthBoost() { return EffectTypes.get("health_boost"); };
static get Hunger() { return EffectTypes.get("hunger"); };
static get InstantDamage() { return EffectTypes.get("instant_damage"); };
static get InstantHealth() { return EffectTypes.get("instant_health"); };
static get Invisibility() { return EffectTypes.get("invisibility"); };
static get JumpBoost() { return EffectTypes.get("jump_boost"); };
static get Levitation() { return EffectTypes.get("levitation"); };
static get MiningFatigue() { return EffectTypes.get("mining_fatigue"); };
static get Nausea() { return EffectTypes.get("nausea"); };
static get NightVision() { return EffectTypes.get("night_vision"); };
static get Poison() { return EffectTypes.get("poison"); };
static get Regeneration() { return EffectTypes.get("regeneration"); };
static get Resistance() { return EffectTypes.get("resistance"); };
static get Saturation() { return EffectTypes.get("saturation"); };
static get SlowFalling() { return EffectTypes.get("slow_falling"); };
static get Slowness() { return EffectTypes.get("slowness"); };
static get Speed() { return EffectTypes.get("speed"); };
static get Strength() { return EffectTypes.get("strength"); };
static get VillageHero() { return EffectTypes.get("village_hero"); };
static get WaterBreathing() { return EffectTypes.get("water_breathing"); };
static get Weakness() { return EffectTypes.get("weakness"); };
static get Wither() { return EffectTypes.get("wither"); };
}
102 changes: 102 additions & 0 deletions scripts/vanilla-types/mojang-enchantment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import { EnchantmentType, EnchantmentTypes } from "@minecraft/server";
/**
* All possible MinecraftEnchantmentTypes
*/
export class MinecraftEnchantmentTypes {
constructor() {
throw new TypeError("Illegal constructor");
}
;
static get(typeName) {
return EnchantmentTypes.get(typeName);
}
;
// why don't they have a getAll
static getAll() {
const enchantments = [];
for (const key in this) {
const element = this[key];
if (element instanceof EnchantmentType)
enchantments.push(element);
}
;
return enchantments;
}
;
static get AquaAffinity() { return EnchantmentTypes.get("aqua_affinity"); }
;
static get BaneOfArthropods() { return EnchantmentTypes.get("bane_of_arthropods"); }
;
static get Binding() { return EnchantmentTypes.get("binding"); }
;
static get BlastProtection() { return EnchantmentTypes.get("blast_protection"); }
;
static get Channeling() { return EnchantmentTypes.get("channeling"); }
;
static get DepthStrider() { return EnchantmentTypes.get("depth_strider"); }
;
static get Efficiency() { return EnchantmentTypes.get("efficiency"); }
;
static get FeatherFalling() { return EnchantmentTypes.get("feather_falling"); }
;
static get FireAspect() { return EnchantmentTypes.get("fire_aspect"); }
;
static get FireProtection() { return EnchantmentTypes.get("fire_protection"); }
;
static get Flame() { return EnchantmentTypes.get("flame"); }
;
static get Fortune() { return EnchantmentTypes.get("fortune"); }
;
static get FrostWalker() { return EnchantmentTypes.get("frost_walker"); }
;
static get Impaling() { return EnchantmentTypes.get("impaling"); }
;
static get Infinity() { return EnchantmentTypes.get("infinity"); }
;
static get Knockback() { return EnchantmentTypes.get("knockback"); }
;
static get Looting() { return EnchantmentTypes.get("looting"); }
;
static get Loyalty() { return EnchantmentTypes.get("loyalty"); }
;
static get LuckOfTheSea() { return EnchantmentTypes.get("luck_of_the_sea"); }
;
static get Lure() { return EnchantmentTypes.get("lure"); }
;
static get Mending() { return EnchantmentTypes.get("mending"); }
;
static get Multishot() { return EnchantmentTypes.get("multishot"); }
;
static get Piercing() { return EnchantmentTypes.get("piercing"); }
;
static get Power() { return EnchantmentTypes.get("power"); }
;
static get ProjectileProtection() { return EnchantmentTypes.get("projectile_protection"); }
;
static get Protection() { return EnchantmentTypes.get("protection"); }
;
static get Punch() { return EnchantmentTypes.get("punch"); }
;
static get QuickCharge() { return EnchantmentTypes.get("quick_charge"); }
;
static get Respiration() { return EnchantmentTypes.get("respiration"); }
;
static get Riptide() { return EnchantmentTypes.get("riptide"); }
;
static get Sharpness() { return EnchantmentTypes.get("sharpness"); }
;
static get SilkTouch() { return EnchantmentTypes.get("silk_touch"); }
;
static get Smite() { return EnchantmentTypes.get("smite"); }
;
static get SoulSpeed() { return EnchantmentTypes.get("soul_speed"); }
;
static get SwiftSneak() { return EnchantmentTypes.get("swift_sneak"); }
;
static get Thorns() { return EnchantmentTypes.get("thorns"); }
;
static get Unbreaking() { return EnchantmentTypes.get("unbreaking"); }
;
static get Vanishing() { return EnchantmentTypes.get("vanishing"); }
;
}
60 changes: 60 additions & 0 deletions scripts/vanilla-types/mojang-enchantment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { EnchantmentType, EnchantmentTypes } from "@minecraft/server";

/**
* All possible MinecraftEnchantmentTypes
*/
export class MinecraftEnchantmentTypes implements EnchantmentTypes {
private constructor() {
throw new TypeError("Illegal constructor");
};
static get(typeName: string): EnchantmentType | undefined {
return EnchantmentTypes.get(typeName);
};
// why don't they have a getAll
static getAll(): EnchantmentType[] {
const enchantments: EnchantmentType[] = [];
for (const key in this) {
const element = this[key];
if (element instanceof EnchantmentType) enchantments.push(element);
};
return enchantments;
};
static get AquaAffinity() { return EnchantmentTypes.get("aqua_affinity"); };
static get BaneOfArthropods() { return EnchantmentTypes.get("bane_of_arthropods"); };
static get Binding() { return EnchantmentTypes.get("binding"); };
static get BlastProtection() { return EnchantmentTypes.get("blast_protection"); };
static get Channeling() { return EnchantmentTypes.get("channeling"); };
static get DepthStrider() { return EnchantmentTypes.get("depth_strider"); };
static get Efficiency() { return EnchantmentTypes.get("efficiency"); };
static get FeatherFalling() { return EnchantmentTypes.get("feather_falling"); };
static get FireAspect() { return EnchantmentTypes.get("fire_aspect"); };
static get FireProtection() { return EnchantmentTypes.get("fire_protection"); };
static get Flame() { return EnchantmentTypes.get("flame"); };
static get Fortune() { return EnchantmentTypes.get("fortune"); };
static get FrostWalker() { return EnchantmentTypes.get("frost_walker"); };
static get Impaling() { return EnchantmentTypes.get("impaling"); };
static get Infinity() { return EnchantmentTypes.get("infinity"); };
static get Knockback() { return EnchantmentTypes.get("knockback"); };
static get Looting() { return EnchantmentTypes.get("looting"); };
static get Loyalty() { return EnchantmentTypes.get("loyalty"); };
static get LuckOfTheSea() { return EnchantmentTypes.get("luck_of_the_sea"); };
static get Lure() { return EnchantmentTypes.get("lure"); };
static get Mending() { return EnchantmentTypes.get("mending"); };
static get Multishot() { return EnchantmentTypes.get("multishot"); };
static get Piercing() { return EnchantmentTypes.get("piercing"); };
static get Power() { return EnchantmentTypes.get("power"); };
static get ProjectileProtection() { return EnchantmentTypes.get("projectile_protection"); };
static get Protection() { return EnchantmentTypes.get("protection"); };
static get Punch() { return EnchantmentTypes.get("punch"); };
static get QuickCharge() { return EnchantmentTypes.get("quick_charge"); };
static get Respiration() { return EnchantmentTypes.get("respiration"); };
static get Riptide() { return EnchantmentTypes.get("riptide"); };
static get Sharpness() { return EnchantmentTypes.get("sharpness"); };
static get SilkTouch() { return EnchantmentTypes.get("silk_touch"); };
static get Smite() { return EnchantmentTypes.get("smite"); };
static get SoulSpeed() { return EnchantmentTypes.get("soul_speed"); };
static get SwiftSneak() { return EnchantmentTypes.get("swift_sneak"); };
static get Thorns() { return EnchantmentTypes.get("thorns"); };
static get Unbreaking() { return EnchantmentTypes.get("unbreaking"); };
static get Vanishing() { return EnchantmentTypes.get("vanishing"); };
}
Loading