#Custom block with tag mining level ('forge:needs_netherite_tool')

191 messages · Page 1 of 1 (latest)

fossil wigeon
#

I'm creating several minority from scratch so I have to put the tag so so for some picks to be able to leave the mining

My problem and when I create some minority with the tag only for the netherite pick from the block any pick can break the block (the problem just happens with the picks that I create with kubejs)

I put my 2 files in which they create the picks and the minority

thin axleBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

split coyoteBOT
#

Paste version of blocks.js, tools.js from @fossil wigeon

fossil wigeon
#

Custom block with tag mining level ('forge:needs_netherite_tool')

harsh heath
#
const $TierSortingRegistry = Java.loadClass("net.minecraftforge.common.TierSortingRegistry")
// (int level, int uses, float speed, float attackDamageBonus, int enchantmentValue, TagKey<Block> tag, Supplier<Ingredient> repairIngredient)
const $ForgeTier = Java.loadClass("net.minecraftforge.common.ForgeTier")
const $BlockTags = Java.loadClass("net.minecraft.tags.BlockTags")
const $Tiers = Java.loadClass("net.minecraft.world.item.Tiers")

ItemEvents.toolTierRegistry(event => {
  let COBALT = new $ForgeTier(5, 1550, 9, 3, 22, $BlockTags.create("forge:needs_cobalt_tool"), () => Ingredient.of("#forge:ingot/cobalt"))
  $TierSortingRegistry.registerTier(COBALT, "cobalt", [$Tiers.NETHERITE], [])
  
  /*
  event.add('cobalt', tier => {
    tier.uses = 1550
    tier.speed = 9
    tier.attackDamageBonus = 3
    tier.level = 5
    tier.enchantmentValue = 22
    tier.repairIngredient = '#forge:ingots/cobalt'
  })
  */
})

@fossil wigeon can you try this with cobalt for me? remember to add to some block the tag:
forge:needs_cobalt_tool

fossil wigeon
#

ok

harsh heath
#

oh but now you need to find how to apply the Cobalt Tier...

#

😦

#

to a tool

#

hmm looks like you won't be able to do that without a custom builder

#

hmm looks like tier is not final...

#

or private

#

let me test something

fossil wigeon
#

not work

harsh heath
fossil wigeon
#

ah ok

harsh heath
split coyoteBOT
#

Current implementation of KubeJS tiers on 1.19.2 is missing the tag block and doesn't use the current TierSortingRegistry, probably because Fabric chose another path to solve it? Fabric uses a simple tag of fabric:needs_tool_level_N where N is the level.

Here is the script to create the ordered Tiers on Forge

https://gist.github.com/pietro-lopes/34aadd772edfc80a76c12aa7511ac848

Use your arrays/loops, builder functions, etc to register easier.
Don't forget your models, and your block tags to make them exclusive to that tier.

fossil wigeon
#

and add the same tier with your code

fossil wigeon
#

and the netherite tag is working or i need to add with your code?

harsh heath
#

You don't need to use my script for tiers BELOW netherite, only for tiers above it

#

@fossil wigeon can you record a video with the netherite tag not working? I need to understand why it is not working, should have no problem with that because it is still supported

fossil wigeon
harsh heath
#

you can drag and drop the video here it is short

#

make sure to include the F3 screen of the block so I can see the tags

harsh heath
fossil wigeon
harsh heath
#

you are still using forge:
i said multiple times it is minecraft:
pain

fossil wigeon
#

but not work

#

with minecraft

#

with minecraft: all pickaxes can break the block

harsh heath
#

all pickaxes can break that block?

fossil wigeon
#

yeah

#

on JADE appears wooden pickaxe

harsh heath
#

that is fucked up, I will try here, that doesn't make sense
that tag is vanilla

harsh heath
#

@fossil wigeon

fossil wigeon
#

me

harsh heath
#

you need to register and set a order for every tier, like below
AND reassign the tier for EVERY tool, there is a bug in KubeJS that is making a new instance of the tier without need and it loses the reference 😢
make sure you have those loaded

const $TierSortingRegistry = Java.loadClass("net.minecraftforge.common.TierSortingRegistry")
const $Tiers = Java.loadClass("net.minecraft.world.item.Tiers")
ItemEvents.modification(event => {
  // Register the new tier
  $TierSortingRegistry.registerTier(
    "copper",
    "copper",
    [$Tiers.STONE], [$Tiers.IRON]
  )
  // Reapply the tier to your tools
  event.modify("kubejs:copper_pickaxe", item => {
    item.tier = $TierSortingRegistry.byName("copper")
  })
})

THIS IS FOR TIERS EQUAL AND BELOW NETHERITE
for above you need to use the other script that introduces the ForgeTier

#

@fossil wigeon

fossil wigeon
#

So do I just get this code or also the code from your github?

harsh heath
#

you will need both if you plan on having above netherite tools

fossil wigeon
#

oh ok

#

with your code i create copper

let COPPER = new $ForgeTier(1, 215, 5.0, 1.0, 7, $BlockTags.create("forge:needs_copper_tool"), () => Ingredient.of("#forge:ingots/copper"))
    $TierSortingRegistry.registerTier(COPPER, "copper", [$Tiers.STONE], [$Tiers.IRON])
#

what is STONE and IRON?

#

stone is pickaxe tier now and iron is tier before?

#

see if i do correctly

split coyoteBOT
#

Paste version of tools.js from @fossil wigeon

harsh heath
# fossil wigeon what is STONE and IRON?

In this Minecraft Modding Tutorial, we are making a custom mining level with Forge in Minecraft 1.19.2

== SUPPORT ME ON PATREON ==
▶️ https://www.patreon.com/Kaupenjoe

== ASSETS & DOWNLOAD LINKS ==
GitHub Repo: https://github.com/Tutorials-By-Kaupenjoe/Forge-Tutorial-1.19/tree/30-toolTier
Gist: https://url.kaupenjoe.net/yt429/gist
Assets: htt...

▶ Play video
#

at timestamp

#

he explains the tier stuff

harsh heath
# fossil wigeon

you don't need to add all the pickaxes to the JADE, only the pickaxes that are above netherite

#

also if you will add some in the middle you can add that too to be more precise, just fit it in the array

#

@fossil wigeon did you omit your tiering script right? because you don't need to remove that for <= Netherite

fossil wigeon
#

remove this?

harsh heath
#

yes, don't remove

fossil wigeon
split coyoteBOT
#

Paste version of tools.js from @fossil wigeon

harsh heath
#

@fossil wigeon also I need to know if you will have blocks exactly for that all

#

for example this copper

#

those uppercase will work? tier: 'COPPER'

fossil wigeon
#

i dont know i just copy what u wrote on script

harsh heath
#

you don't need to uppercase there

#

and looks good to me for the copper

#

test those

#

if it works, do the remaining

fossil wigeon
#
ItemEvents.modification(event => {
    // Register the new tier
    $TierSortingRegistry.registerTier(
        "copper",
        "copper",
        [$Tiers.STONE], [$Tiers.IRON]
    )
    // Reapply the tier to your tools
    event.modify("kubejs:copper_pickaxe", item => {
        item.tier = $TierSortingRegistry.byName("copper")
    })
})

this is for what?
i need to create all this for this tooltierregistry>

harsh heath
#

yes, $TierSortingRegistry is to register the ordering of the tiers
for every tier you create you need to register a order

#

AND because KubeJS is bugged with the tiers, you need to reassign the tier for every tool

#

I will try to PR a fix for that

fossil wigeon
#

i need to create iron gold diamond and netherite?

fossil wigeon
split coyoteBOT
#

Paste version of tools.js from @fossil wigeon

fossil wigeon
#

Now if you want to create a tier above netherite I can create it with your code

let COPPER = new $ForgeTier(1, 215, 5.0, 1.0, 7, $BlockTags.create("forge:needs_copper_tool"), () => Ingredient.of("#forge:ingots/copper"))
    $TierSortingRegistry.registerTier(COPPER, "copper", [$Tiers.STONE], [$Tiers.IRON])
#

i use this code to create tier above netherite

harsh heath
#

you removed the normal pickaxes, if it is your intention it is fine, but you should ordeder from lower to higher, I see that copper is at the last on the Jade

#

ops

#

bronze

#

you put bronze at the end

harsh heath
fossil wigeon
#

i need to put like all tier 1 than 2 than 3 than 4
only on JADE

harsh heath
#

you actually only need 1 for reference of each tier

#

just think about which Icon you want

#

so you put there

#

like if you are removing all vanilla pickaxes, you just register your custom pickaxes and it will be fine

#

1 pickaxe of each tier

fossil wigeon
#

some pickaxes have the same tier

#

and the jade mod i dont think i dont use but

split coyoteBOT
#

Paste version of tools.js from @fossil wigeon

harsh heath
#

why bronze is still at the end?

#

you can remove pickaxes that have same tier from the array of the Jade

fossil wigeon
split coyoteBOT
#

Paste version of tools.js from @fossil wigeon

harsh heath
#

did you change anything at all on Jade?

#

bronze is still at the end

#

['kubejs:copper_pickaxe', 'kubejs:lead_pickaxe', 'kubejs:nickel_pickaxe', 'kubejs:tin_pickaxe', 'kubejs:aluminium_pickaxe', 'kubejs:cobalt_pickaxe', 'kubejs:platinum_pickaxe', 'kubejs:silver_pickaxe', 'kubejs:bronze_pickaxe']

Is this sorted and removed tier duplication? if not, fix this

fossil wigeon
#

in JADE i didnt change nothing

#

i just orgazine to tier 1 -> 4

harsh heath
#

sort on jade too and remove duplicated same tier pickaxes from this array

fossil wigeon
#

all minecraft pickaxe vanilla i remove

harsh heath
#

are you removing from the game too?

fossil wigeon
harsh heath
#

do you plan to?

fossil wigeon
#

no

#

i just want to add more pickaxes

#

like the script i send

#

so in blocks (ores) what tag i use to netherite?

#

'forge:needs_netherite_tool'

this tag cant show no one pickaxe in JADE

harsh heath
#

show tags of the block

fossil wigeon
harsh heath
#

looks right, it doesn't have any because you registered all your tiers below netherite

#

and you removed netherite pickaxe from jade

#

it will never show the icon

fossil wigeon
#

i need to registe the netherite tier?

harsh heath
#

what do you want? the icon?

fossil wigeon
#

that aluminuim ore dont show the icon AND with all pickaxes break and dont drop the block

#

sry only netherite pickaxe drop the item

harsh heath
#

I would recommend you to bring back the vanilla pickaxes to the jade if you don't plan on removing them from the game
the jade array is just a representation of what is the minimum pickaxe for it to drop, do you understand this?

#

it gets every pickaxe of the list and test, one by one

fossil wigeon
#
$TierSortingRegistry.registerTier(
        "netherite",
        "netherite",
        [$Tiers.NETHERITE], []
    )
    event.modify("kubejs:netherite_pickaxe", item => {
        item.tier = $TierSortingRegistry.byName("netherite")
    })
harsh heath
#

don't need to register netherite

#

remove this

#

read what I said above

fossil wigeon
#

so this

event.add('netherite', tier => {
        tier.uses = 2031
        tier.speed = 9
        tier.attackDamageBonus = 4
        tier.level = 4
        tier.enchantmentValue = 15
        tier.repairIngredient = '#forge:ingots/netherite'
    })
harsh heath
#

no, forget netherite, this is not the problem

#

are you going to reorder jade array or not?
VOCÊ SÓ PRECISA DE UMA PICARETA REPRESENTANTE DE CADA TIER NO ARRAY DO JADE
nada além disso

fossil wigeon
#

really so i can remove all kubejs pickaxe from array JADE

#

tier mais alto its netherite

harsh heath
#

eu to tentando te falar isso faz horas

fossil wigeon
#

ok now i think is all working well

harsh heath
fossil wigeon
#

e a cena do tier mais alto
voce usou o constantan

let CONSTANTAN = new $ForgeTier(5, 700, 24.0, 8.0, 22, $BlockTags.create("forge:needs_constantan_tool"), () => Ingredient.of("#forge:ingots/constantan"))
    $TierSortingRegistry.registerTier(CONSTANTAN, "constantan", [$Tiers.NETHERITE], [])

o que eu coloco no [] que ta vazio a seguir disto [$Tiers.NETHERITE]

harsh heath
#

vazio significa que não existe nada maior, ou seja vc tá jogando entre o Netherite e a ponta final, que está vazia

#

é a mesma coisa que adicionar depois do netherite

#

igual fiz com constantan

#

se eu não der um tag de needs_constantan_tool, ele fica IGUAL netherite, se eu der o tag, ele fica MAIOR q netherite

#

igual no video que mostrei, q o obsidian só dava pra minerar com a constantan

fossil wigeon
#

ent e se eu quiser outro acima do constantan da para fazer?

harsh heath
#

dá também, mas tem q chamar ele via

[$TierSortingRegistry.byName("constantan")], []

por exemplo

fossil wigeon
#

ah ok

#

ent eu em vez de fazer o constantan fiz o cobalt = constantan

harsh heath
#

usa a mesma coisa, só não dá um tag pra ele na hora de construir

fossil wigeon
#
let COBALT = new $ForgeTier(5, 1550, 14.0, 4.0, 21, $BlockTags.create("forge:needs_cobalt_tool"), () => Ingredient.of("#forge:ingots/cobalt"))
    $TierSortingRegistry.registerTier(COBALT, "cobalt", [$Tiers.NETHERITE], [])

e no item modification

$TierSortingRegistry.registerTier(
        "cobalt",
        "cobalt",
        [$Tiers.NETHERITE], []
    )
    event.modify("kubejs:cobalt_pickaxe", item => {
        item.tier = $TierSortingRegistry.byName("cobalt")
    })
harsh heath
#

deixa null

#

no tag

#

não, infelizmente ora acima de netherite tem q usar o método do ForgeTier

#

do meu script

fossil wigeon
#

calma deixa so ver se entendi
esse 2 codigos q pus tao certos

harsh heath
#

ah vc fez certo, só duplicou o registro, não precisa registrar de novo no modification

fossil wigeon
#

pois exato percebi isso agora

#
let CONSTANTAN = new $ForgeTier(6, 3300, 14.0, 4.0, 21, $BlockTags.create("forge:needs_constantan_tool"), () => Ingredient.of("#forge:ingots/constantan"))
    $TierSortingRegistry.registerTier(CONSTANTAN, "constantan", [$TierSortingRegistry.byName("cobalt")], [])

vamos imaginar que quero adicionar o constantan que seja maior que o cobalt fica assim

harsh heath
#

perfeito

fossil wigeon
#

ja tou a perceber

#

isto aqui e so para tiers QUE EU NAO CRIEI TIPO COBALT

harsh heath
#

mas sempre lembre de usar o modification pra readicionar o tier

fossil wigeon
#

isto aqui do proprio kubejs serve para q entao?

harsh heath
#

os tiers que vc deu TAG não precisam do registerTier no modification só do event.modify

#

esse aí serve pra vc cadastrar normal, quando vc usa o registerTier ele pega do registro q preencheu daí, mas só serve pra abaixo do netherite

fossil wigeon
harsh heath
#

acima de netherite usa o
ForgeTier + registerTier lá no toolTierRegistry
e no modification só o event.modify

fossil wigeon
#

q e isto aqui

let COBALT = new $ForgeTier(5, 3300, 14.0, 4.0, 21, $BlockTags.create("forge:needs_cobalt_tool"), () => Ingredient.of("#forge:ingots/cobalt"))
    $TierSortingRegistry.registerTier(COBALT, "cobalt", [$Tiers.NETHERITE], [])
harsh heath
#

isso

#

o jeito que fizeram esses tiers ficou mt confuso e o KubeJS também não ajuda...

fossil wigeon
#

agora aconteceu outra coisa

harsh heath
fossil wigeon
#

a picareta de cobalt q tem o tier 5 maior que netherite nao consegue quebrar um bloco de tier diamante

harsh heath
#

mostra os registros e os modification do cobalt

fossil wigeon
#

so tenho isto

let COBALT = new $ForgeTier(5, 3300, 14.0, 4.0, 21, $BlockTags.create("forge:needs_cobalt_tool"), () => Ingredient.of("#forge:ingots/cobalt"))
    $TierSortingRegistry.registerTier(COBALT, "cobalt", [$Tiers.NETHERITE], [])
harsh heath
#

falta o modification

fossil wigeon
#

ent aquilo so cria

#

o modification aplica na picareta

harsh heath
#

exato

fossil wigeon
#

aparece isto

harsh heath
#

vc copiou o registro do modification

#

n precisa

fossil wigeon
#
$TierSortingRegistry.registerTier(
        "cobalt",
        "cobalt",
        [$Tiers.NETHERITE], []
    )
    event.modify("kubejs:cobalt_pickaxe", item => {
        item.tier = $TierSortingRegistry.byName("cobalt")
    })
#

coloquei isso

harsh heath
#

é, a primeira n precisa

#

só o event.modify

fossil wigeon
#

ah ok

#

a parte inicial e como se fosse o ForgeTier

#

agora ja ta
bem acho q ta tudo ja

#

obg tu es o REI