Jump to content

Recommended Posts

Posted

im following this case coze removing the material class from the code fucks up mi items that depends on it 
i need to find a replacement for the Material class

 

this is an old item from back 1.8 

 

when turn on hold right click it checks the target block and if its made of wood it changes to cutting animation 

Material pmat = blkstate.getMaterial();

     if (pmat == Material.WOOD){

//then cut it down 

}

this other one checks for dirt or stone its no supposed to work on metal or wood 

 

 

what i could use ? 

 

 

Posted

sorry for the stuborn ness ss

 

test code

Spoiler

				
			if (!warudo.isClientSide && rp != null && can_do_it(helditem)) {
		dblkstate = rp.getBlockState();
		
		String nnn = ForgeRegistries.BLOCKS.getKey(dblkstate.getBlock()).toString();
		System.out.println("\n");
		System.out.println("name " + nnn);
		
		if (dblkstate.canBeReplaced()) {
		System.out.println("blkstate.canBeReplaced()");
		}
		
		if (dblkstate.is(BlockTags.MINEABLE_WITH_AXE)) {
		System.out.println("BlockTags.MINEABLE_WITH_AXE");
		}
		
		if (dblkstate.is(BlockTags.MINEABLE_WITH_PICKAXE)) {
		System.out.println("BlockTags.MINEABLE_WITH_PICKAXE");
		}
		
		if (dblkstate.is(BlockTags.MINEABLE_WITH_SHOVEL)) {
		System.out.println("BlockTags.MINEABLE_WITH_SHOVEL");
		}
		
		if (dblkstate.is(BlockTags.MINEABLE_WITH_HOE)) {
		System.out.println("BlockTags.MINEABLE_WITH_HOE");
		}
		
		
		}				
			


name minecraft:grass_block
BlockTags.MINEABLE_WITH_SHOVEL


name minecraft:dirt
BlockTags.MINEABLE_WITH_SHOVEL

name minecraft:oak_log
BlockTags.LOGS


name minecraft:oak_planks
BlockTags.PLANKS

name minecraft:oak_leaves
BlockTags.MINEABLE_WITH_HOE

name minecraft:cobblestone_slab
BlockTags.MINEABLE_WITH_PICKAXE

name minecraft:stone
BlockTags.MINEABLE_WITH_PICKAXE


name minecraft:coal_block
BlockTags.MINEABLE_WITH_PICKAXE

logs and planks return nothing on minable but i can use the other tags 

name minecraft:oak_log
BlockTags.LOGS

name minecraft:oak_planks
BlockTags.PLANKS

 

it kinda works but its not like like perfect 

 

 

 

 

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.