Jump to content

Featured Replies

Posted
comment_13268

Hello Lads, 
I ran into an issue with the Vencillio base where gem's and some other items could be cut or crafted without the necessary tool, today I have a small snippet of code which could be considered kinda "hacky" but takes care of this issue.

First Open your Crafting.java
rs2.content.skill.craftingnew.Crafting.java

search for

public boolean itemOnItem(Player player, Item use, Item with) {

next search for this

	final Craftable craftable = getCraftable(use.getId(), with.getId());

		if (craftable == null) {
			return false;
		}

and underneath that we can add this snippet of code I have written.

if(craftable.getUse().getId() != use.getId() && craftable.getUse().getId() != with.getId()) {
			player.send(new SendMessage("You need a " + craftable.getUse().getDefinition().getName() + " to craft this"));
			return false;
}

Let's explain a bit what this code does so you guys can understand how we are solving this issue

craftable.getUse.getId()

returns the ID of the required Chisel(or required tool)
we are comparing this against both of our used items to make sure a chisel is in fact being used.

If the correct tool is not being used we are using

craftable.getUse().getDefinition.getName()

 

to return the name of the proper tool to the user.


Hopefully this helped someone out.

  • 2 years later...

Create an account or sign in to comment