Cold Sweat
  • Temperature Basics
  • TempModifiers
  • List of TempModifiers
  • Block Temperature
  • Attributes
  • Tags
    • Item Tags
    • Block Tags
    • Dimension Type Tags
    • Potion Effect Tags
  • Datapacks
    • Datapack Basics
    • Requirements
      • Entity Requirement
      • Item Requirement
      • Block Requirement
      • NBT Requirement
      • Components Requirement
      • Location Requirement
    • Item Configs
    • Block/World Configs
    • Entity Configs
    • Registry Removals
  • KubeJS
    • KubeJS Basics
    • Registries
      • Block Temperature
  • Add-Ons
    • Origin Configs
  • Utility Classes
    • DynamicHolder
    • CapabilityCache
Powered by GitBook
On this page
  • Bindings
  • coldsweat
  1. KubeJS

KubeJS Basics

A short overview of Cold Sweat's KubeJS integration

PreviousRegistry RemovalsNextRegistries

Last updated 5 months ago

Bindings

Cold Sweat has a custom binding that has some utility functions to make manipulating and accessing temperature easier in JavaScript.

coldsweat

Contains miscellaneous utility methods for Cold Sweat.

getConfigSetting()

coldsweat.getConfigSetting(String id)

Returns a containing the value of the specified config setting. The resulting holder has no explicit type, meaning it must be cast.

getRegistryAccess()

coldsweat.getRegistryAccess()

Returns an instance of RegistryAccess, or null if it is not available. See for important information regarding this method.

getTemperature()

coldsweat.getTemperature(Entity entity, String trait)

Returns the value of the specified temperature trait for the given entity. trait is the trait's snake-cased ID.

setTemperature()

coldsweat.setTemperature(Entity entity, String trait, double temperature)

Sets the value of the specified trait for the given entity. It will likely be replaced next tick for any trait other than core.

createModifier()

coldsweat.createModifier(String id)

Creates a new temperature modifier instance from the supplier registered to the given ID.

addModifier()

coldsweat.addModifier(Entity entity, TempModifier modifier, String trait)

Adds the given modifier to the given entity's specified trait. This method provides a basic way of doing this through JavaScript. For more advanced versions, use the Java-based methods instead.

getTrait()

coldsweat.getTrait(String traitId)

Returns the Trait enum constant associated with the given ID. This might be necessary when using Java methods in Cold Sweat.

getColdInsulation()

coldsweat.getColdInsulation(Entity entity)

Returns the sum of all cold insulation from the given entity's armor, curios, etc.

getHeatInsulation()

coldsweat.getHeatInsulation(Entity entity)

Returns the sum of all heat insulation from the given entity's armor, curios, etc.

getBlockTemperature()

coldsweat.getBlockTemperature(BlockContainerJS block)

Returns the raw temperature of the given BlockContainer object (which is what KubeJS refers to as a "block")

getBiomeTemperature()

coldsweat.getBiomeTemperature(Level level, BlockPos pos)

Returns the biome temperature at the given location, taking into account time of day.

getBiomeTemperatureAt()

coldsweat.getBiomeTemperatureAt(Level level, BlockPos pos)

getTemperatureAt()

coldsweat.getTemperatureAt(Level level, BlockPos pos)

Returns the overall ambient temperature at the given position, including nearby blocks, biomes, time of day, depth underground, etc.

Similar to , but also takes altitude into account.

getBiomeTemperature()
DynamicHolder
here