Util classes.


CustomToolTier 0.6>



With this class, you'll be able to create custom ToolTiers easily and quickly. Here's an example:

                            
        new CustomToolTier(750, 7, 3, 5, 15, item)

        /*
            Parameters:
                - 750 = Tools uses.
                - 7 = Tool speed.
                - 3 = Attack damage bonus.
                - 5 = Level.
                - 15 = Enchantment value.
                - item = Ingredient to repair the tool in the anvil.
        */
                            
                        

CustomArmorMaterial 0.8>



With this class, you'll be able to create custom Armor materials easily and quickly. Here's an example:

                    
public static CustomArmorMaterial armorMat = new CustomArmorMaterial(
        "slime",
        26,
        new int[]{ 5, 7, 5, 4 },
        25,
        SoundEvents.SLIME_SQUISH,
        1f,
        0f,
        () -> Ingredient.of(Items.SLIME_BALL)
    );

/*
    Parameters:
        - "slime" = The id.
        - 26 = Durability multiplier.
        - new int[]{ 5, 7, 5, 4 } = Protection amounts. Helmet, chest plate, leggings and boots.
        - 25 = Enchantment value.
        - SoundEvents.SLIME_SQUISH = Equip sound.
        - 1f = Toughness.
        - 0f = Knockback resistance.
        - () -> Ingredient.of(Items.SLIME_BALL) = Ingredient to repair the armor. (Needs to be a supplier)
*/
                    
                

Boots example:

                    
public static CustomArmorMaterial armorMat = new CustomArmorMaterial(
        "slime",
        26,
        new int[]{ 5, 7, 5, 4 },
        25,
        SoundEvents.SLIME_SQUISH,
        1f,
        0f,
        () -> Ingredient.of(Items.SLIME_BALL)
    );

public static RestItem SLIME_BOOTS = ItemRegistry.CreateCustom(
        MOD_ID,
        "slime_boots",
        () -> new ArmorItem(
                armorMat,
                armorMat.boots(),
                new CustomItemProperties().tab(MY_TAB).build()
        )
);
                    
                
                    
public static CustomArmorMaterial armorMat = new CustomArmorMaterial(
        "slime",
        26,
        new int[]{ 5, 7, 5, 4 },
        25,
        SoundEvents.SLIME_SQUISH,
        1f,
        0f,
        () -> Ingredient.of(Items.SLIME_BALL)
    );

public static Object SLIME_BOOTS = ItemRegistry.CreateCustom(
        MOD_ID,
        "slime_boots",
        () -> new ArmorItem(
                armorMat,
                armorMat.boots(),
                new CustomItemProperties().tab(MY_TAB).build()
        )
);
                    
                

Lazy. 0.6>



If you've ever needed to use .get() (Architectury) and it threw an error or returned null/Air, it's because Architectury didn't have enough time to register that (LINK.item)/(LINK.block)/other. With Lazy, you can make the code wait until Architectury finishes registering it. This can't be used everywhere, and it may not work correctly in all cases. The entire code for this class has been copied from a class that no longer exists in Minecraft. We won't explain how this class works in detail since it's complex. Here's an example of how to use it:

                    
//Example

Lazy.of(SUPPLIER);

//Another example

Lazy.of(
    () -> ITEM
);

//Another example

Lazy.of(
    () -> REGISTRY_SUPPLIER.get()
);

//Another example

private final Lazy<Ingredient> repairIngredient = Lazy.of(
    () -> Ingredient.of(
        repairIngredientItem.get()
    )
);
                    
                

CustomItemProperties. 0.5>



This class operates similarly to Item.Properties, a Minecraft class. To create properties, you'll always need the .build() method, and before this method, you can set all the available ones. Examples:

                    
//Examples

new CustomItemProperties().tab(YOUR_CREATIVE_TAB).build()

new CustomItemProperties().tab(YOUR_CREATIVE_TAB).food(NUTRITION_NUMBER, SATURATION_MOD_NUMBER, EFFECT, EFFECT_CHANCE_NUMBER).stacksTo(MAX_STACK_NUMBER).build()
                    
                

All properties.

Method name Does Types
.tab(CreativeTab) Adds the item to that CreativeTab. RestCreativeTab / DeferredSupplier<?> / ResourceKey<?>
.food(Nutrition, SaturationMod, Effect, EffectChance) Makes the item edible. You can optionally give it an effect with a certain probability (from 0 to 1). int, float, MobEffectInstance, float
.durability(UsesNumber) Tool's durability/uses. int
.defaultDurability(DefaultUsesNumber) Tool's default durability/uses. int
.stacksTo(MaxStackNumber) Maximum items per stack. int
.craftRemainder(Item) ... DeferredSupplier<Item>
.rarity(Rarity) Sets the rarity of the item. Rarity
.fireResistant() Makes it fire-resistant. -
.build() Builds the properties. -

CustomBlockProperties. 0.7>



This class operates similarly to BlockBehaviour.Properties, a Minecraft class. To create properties, you'll always need the .build() method, and before this method, you can set all the available ones. Examples:

                    
//Examples
new CustomBlockProperties().build();

//Another example
new CustomBlockProperties()
    .copy(Blocks.IRON_BLOCK)
    .strength(5, 6)
    .sound(customSounds)
    .strength(1)
    .requiresCorrectToolForDrops()
    .ignitedByLava()
    .build();
                    
                

All properties.

Method name Does Types
.copy(Block) Copies the properties of that block. Block
.strength(Hardness, BlastResistance) Changes the block's Hardness and BlastResistance. float, float
.strength(Hardness) Changes the Hardness. float
.sound(SoundType) The SoundType it will use. See (LINK.CreateCustomSoundType) to create custom sounds. SoundType
.requiresCorrectToolForDrops() If the block needs the correct tool to drop its item. See (LINK.CustomToolTier) to create ToolTiers. -
.ignitedByLava() If the block catches fire when near lava. -
.destroyTime(DestroyTime) Time it takes to break the block. float
.dropsLike(Block) Behavior when dropping. Copy the specified block. Block
.dynamicShape() ... -
.explosionResistance(ExplosionResistance) Its resistance to explosions. float
.instabreak() If it's a block that breaks instantly. Example: TNT. -
.forceSolidOn() ... -
.friction(Friction) Friction of the block. float
.jumpFactor(JumpFactor) Jump factor, like the slime block. float
.liquid() ... -
.noCollision() If it has no collisions. -
.noLootTable() Remove lootTable. -
.noOcclusion() ... -
.noParticlesOnBreak() Disable its particles when it breaks. -
.randomTicks() If it randomly ticks. -
.replaceable() If you can replace it, like a flower, grass, etc. -
.speedFactor() Speed when standing on it. float
.pushReaction(PushReaction) Push reaction with pistons. PushReaction
.build() Builds the properties. -

RegisterOreGeneration. 0.8>



With this method you can generate blocks like ores. You need to create the json files. See (LINK.BiomeConditions).

                    
//Examples
OreGenerator.RegisterOreGeneration(
    MOD_ID,
    "new_block",
    new BiomeConditions().isOverworld().isNether()
);

//Another example
OreGenerator.RegisterOreGeneration(
    MOD_ID,
    "another_block",
    new BiomeConditions().isBadlands().hasBuriedTreasure().hasMineshaft()
);
                    
                

BiomeConditions. 0.8>



With this method you can check for biome conditions.

                    
//Examples

new BiomeConditions().isOverworld().isNether()

//Another example

new BiomeConditions().isBadlands().hasBuriedTreasure().hasMineshaft()
                    
                

All BiomeConditions properties.

Method name Does
.isOverworld() Determines if it belongs to the Overworld.
.isNether() Determines if it belongs to the Nether.
.isEnd() Determines if it belongs to the End.
.addCustomBiomeTagKey(TagKey<Biome>) Adds your custom tags.
.isDeepOcean() Determines if it's a deep ocean biome.
.isOcean() Determines if it's an ocean biome.
.isBeach() Determines if it's a beach biome.
.isRiver() Determines if it's a river biome.
.isMountain() Determines if it's a mountain biome.
.isBadlands() Determines if it's a badlands biome.
.isHill() Determines if it's a hill biome.
.isTaiga() Determines if it's a taiga biome.
.isJungle() Determines if it's a jungle biome.
.isForest() Determines if it's a forest biome.
.isSavanna() Determines if it's a savanna biome.
.hasShipwreck() Determines if it contains a shipwreck.
.hasStronghold() Determines if it contains a stronghold.
.hasSwampHut() Determines if it contains a swamp hut.
.hasVillageDesert() Determines if it contains a village in the desert.
.hasVillagePlains() Determines if it contains a village in the plains.
.hasVillageSavanna() Determines if it contains a village in the savanna.
.hasVillageSnowy() Determines if it contains a village in the snowy biome.
.hasVillageTaiga() Determines if it contains a village in the taiga.
.spawnsGoldRabbits() Controls the appearance of golden rabbits.
.spawnsWhiteRabbits() Controls the appearance of white rabbits.
.reducedWaterAmbientSpawns() Reduces the appearance of aquatic creatures.
.allowsTropicalFishSpawnsAtAnyHeight() Allows the appearance of tropical fish at any height.
.polarBearsSpawnOnAlternateBlocks() Controls the appearance of polar bears on alternate blocks.
.moreFrequentDrownedSpawns() Increases the appearance of drowned creatures.
.allowsSurfaceSlimeSpawns() Allows the appearance of Slimes on the surface.
.spawnsSnowFoxes() Controls the appearance of snow foxes.
.playsUnderwaterMusic() Allows underwater music playback.
.hasCloserWaterFog() Activates closer water fog.
.waterOnMapOutlines() Displays water on the map outlines.
.producesCoralsFromBonemeal() Allows the production of corals from bone meal.
.increasedFireBurnout() Increases the duration of fire combustion.
.snowGolemMelts() Determines if snow golems melt.
.withoutZombieSieges() Prevents zombie sieges in the biome.
.withoutPatrolSpawns() Prevents the spawning of patrols in the biome.
.withoutWanderingTraderSpawns() Prevents the appearance of wandering traders.
.spawnsColdVariantFrogs() Controls the appearance of cold variant frogs.
.spawnsWarmVariantFrogs() Controls the appearance of warm variant frogs.

MathHelper 0.10>



With this class, you'll be able to use some cool methods:

                            
/*
With this function, you will obtain a list of positions in a circular form. You should pass two parameters:
 - numPositions = number of positions
 - radius = the radius of the circle
*/
List<BlockPos> positions = MathHelper.generatePositionRing(numPositions, radius);

/*
With this function, you will a random int. You should pass two parameters:
 - min
 - max
*/
int number = MathHelper.getRandomInt(min, max);

/*
With this function, you will a random float. You should pass two parameters:
 - min
 - max
*/
float number = MathHelper.getRandomFloat(min, max);
                            
                        

RestLogger 0.10>



With this class, you'll be able to create a logger easily:

                            
public static final RestLogger logger = new RestLogger(YourModId);

logger.log("¡Hola!");

logger.error("Hello!");

logger.warn("Oops!");