promotional bannermobile promotional banner

Extended Scripts

An addon for Kamkeel's CustomNpcs+ that gives scripters new capabilities and quality of life shortcuts.

Extended Scripts is an addon for Kamkeel's CustomNpc+. This mod aims to enchance scripting to make it easier and allow scripters to create scripts that would not otherwise be possible. Extended Scripts also adds a few features outside of scripting. 

If you have any questions, would like to request a feature, or just hang out, feel free to join our discord.

Note that it is currently intended to be used with version 1.11.1 of CustomNpc+. It may have issues in other versions.

Be sure to check out CustomNpc+ here as it is required for this mod. 

You can view what scripts are added here: https://loomingveil.github.io/Extended-Scripts/ (A few classes do not show up, but the combined source works properly)

This is the combined Javadoc of Kamkeel's Javadoc and Extended Script's for convenient function look ups: https://loomingveil.github.io/Extended-Scripts-Combined-API/

If you do not want to look at all that, here are some of the more useful functions and classes added:

  • New extAPI (short for Extended API) keyword that you can use to access all the new misc functions. Some useful ones include 

a. createIEntity(String name) for creating entities like fireballs, arrows, and other non-living entities.

b. createCustomParticlePreset(int particleIndex) for an easy way to use CustomNpc+'s custom particle system using some of Minecraft's particle textures.

c. registerAttribute(String key, String displayName, char colorCode, int attributeType, int section) for creating your own (visual only) custom attributes.

d. getStringPixelWidth(): This function returns a number that can be used to center your text.

  • Several Enums, the most useful of which is Key. In a keyPressed event you can now do statements like if (event.key == Key.K_V) /* Do something */ to check if the V key was pressed. You can view a full list of these keys and the other enums in the javadocs.
  • Custom overlay additions. With IPlayer.getScreenResolution() you can now access data about the scaled resolution of a player's screen. This is perfect for scaling your overlays.
  • Custom Projectiles. You can create custom projectiles with custom rendering, custom particle trails, gravity, and more. It is quite similar to how npcs can fire projectiles except now you can fire projectiles as well. Along with these new projectiles are events for on tick and on impact.
  • New ShapeMaker class. This class adds several functions for getting all the points within shapes. It also add a few functions useful for drawing fancy particle shapes.
  • SetHarvestLevel(String toolClass, int level) for turning your scripted items into real tools. Without a harvest level for pickaxes, stone, ores, and the like will not drop upon breaking.
  • hotbarSlotChanged(event) that triggers when you switch your hotbar slot. This can be very useful for a custom item that has an effect that needs to be disabled immediately when you stop holding it.

    The non scripting features are detailed below:

Custom Attributes

Extended Scripts adds its own custom attributes. Some of which include, gravity, swim boost, and flight speed. Additionally, through scripts or the command /veil attribute apply-player, you can give the player attributes that are not dependent on held/equipped items.

If you want to add your own attributes you now can. Although, the logic behind how they work will have to be handled with your own scripts. These attributes are purely visible, but are fully integrated. You can check for them the same way you can with CustomNpc+ custom attributes and they show up alongside your other attributes when pressing the attribute show key. You can add your own one of two ways. The first of which is through scripting using extAPI.registerAttribute(). See the javadocs for more information. The second way is with the command /veil attribute. Using the command ingame will show you how to use it. Using tab to see the available options will also be helpful for several arguments. Currently, attributes are added per world. Keep in mind that if an attribute is deleted, any items with that attribute will lose that attribute.

World Clippers and /inspect

Extended Scripts adds a new item, the World Clippers that can be found in the CustomNpcs Tools tab. With the World Clippers you can left/right click any mob or block to bind the World Clippers to that mob or block. 

While holding the World Clippers and using the command /inspect target, you can see all the nbt data that the target has. This is quite useful for debugging. Additionaly you can use /inspect tp to teleport to the target or /tphere to do the opposite.

For inspecting items you can use /inspect hand to see the data related to what you are holding.

Mobs and scripted items often have a great deal of data attached to them so it can not always be fully displayed in the chat so you can specify the tags you want to see with /inspect <subcommand> <subtag1> <subtag2> ... To find the names of those sub tags you can add -k to the command to only show the subtag names.

Global File Copying

Now in your customnpcs folder, the same place where your global clones are stored, there will be a new folder called global. When creating a new world, any files within the global folder will copied to your new world's local customnpcs folder. So, any quests, dialogs, animations, scripts, ect can be included automatically in your new worlds.

Script Keybind

If you have ever made a scripted item before, you may know the pain of it activating every time you want to edit the script because it has a rightClick(event) then Extended Scripts has a solution for you. Extended scripts adds a new keybind (backslash by default) that simply opens up the scripting interface for a scripted item.

Scripted Armor

Normally scripted items aren't the best when it comes to making armor, but Extended Scripts changes that. Now, if you click, with an item that has a valid armor type, with the item in your hand, like normal armor it will be equipped. The same goes for shift clicking while in the inventory. Extended Scripts also adds a new attribute Armor Value which adds armor points to your armor/held item. Through this your items can provide real protection. Scripted items also now show the player wearing armor by default. You can change the color and the texture if you so wish. For even further customization you can apply an armor overlay texture which does not change with the color to make armor similar to the dyeable leather armor. Finnaly, an event, armorDamaged for when you are attacked and the item is equipped or in your hand.

The Extended Scripts Team

profile avatar
  • 1
    Followers
  • 3
    Projects
  • 1.7K
    Downloads

More from LoomingVeil