Mods
Resource Packs
Data Packs
Modpacks
Shaders
Plugins
Mods Resource Packs Data Packs Plugins Shaders Modpacks
Get Modrinth App Upgrade to Modrinth+
Sign in
ModsPluginsData PacksShadersResource PacksModpacks
Sign in
Settings
Js Turret

Js Turret

A Turret which can be controlled by Javascript

165
0
Cursed
Equipment
Technology

Compatibility

Minecraft: Java Edition

Platforms

Fabric

Supported environments

Client and server

90% of ad revenue goes to creators

Support creators and Modrinth ad-free with Modrinth+

Links

Report issues

Creators

Herr_Chaos
Herr_Chaos Member

Details

Licensed GPL-3.0-only
Published 2 months ago
Updated 2 months ago
DescriptionGalleryChangelogVersions

Have you ever wanted to have a smart super lethal unbalance infinite ammo sentry? No? Well here it is.

With Js turretâ„¢ you can now terrorise your friends in a way smarter and way more targetable manner. Just place one down write some simple code in java script insert the code into the turret and let her rip.

With one single barrel and a fire rate of sixty shots per minute which all do an untested amount of damage she's a real threat to anyone. All you have to do is to write some basic code to target that one friend and you're good to go (or just copy the code from below).

Code
for (const target of entities) {
    if (target.name === "YourFriend") {
        block.lookAt(target.position.x, target.position.y, target.position.z)
        block.shoot();
    }
}

The crafting recipie is this

the turrets crafting recipie

To insert the written code you can paste it into a book and quill and right click the turret block with it. All pages of the book will be combined and put one after the other.

Available Javascript functions

All of these functions are only available through the block structure.

lookAt(number x, number y, number z)

Makes the barrel look at a given coordinate.

Example:
block.lookAt(0, 1, 0);
shoot()

Shoots in the direction of the current facing.

Example:
block.shoot();
getPosition() -> Vec3dJS

Should return the position of the block with the Vec3dJS struct which contains x, y, z

Example:
const pos = block.getPosition();
rotatePitch(number degrees)

Rotates the turrets pitch by the given degrees.

Example:
block.rotatePitch(1);
rotateYaw(number degrees)

Rotates the turrets yaw by the given degrees.

Example:
block.rotateYaw(1);

In addition to these functions you have access to a list of near by entities with the entities const. The entities const is a list of MinecraftEntity which is a structure with these values:

Vec3dJS position

The position of the entity in the Vec3dJS struct which contains x, y, z

String type

The entity type. Example: entity.minecraft.player

String name

The name of the entity. This is either the player name or the entities name when renamed with a name tag. If neither of those are the case it is just the entity times name. Example: Squid or for items Slimeball or for players just the player name.

Modrinth is open source.

main@16c5a5a

© Rinth, Inc.

Company

TermsPrivacyRulesCareers

Resources

SupportBlogDocsStatus

Interact

Discord X (Twitter) Mastodon Crowdin
Get Modrinth App Settings
NOT AN OFFICIAL MINECRAFT SERVICE. NOT APPROVED BY OR ASSOCIATED WITH MOJANG OR MICROSOFT.