terrestria compatibility
This commit is contained in:
		| @@ -9,7 +9,7 @@ | ||||
| 	loader_version=0.14.11 | ||||
|  | ||||
| # Mod Properties | ||||
| 	mod_version = 1.19.3.0 | ||||
| 	mod_version = 1.19.3.1 | ||||
| 	maven_group = de.jottyfan.minecraft | ||||
| 	archives_base_name = quickiefabric | ||||
|  | ||||
|   | ||||
| @@ -0,0 +1,27 @@ | ||||
| package de.jottyfan.minecraft.quickiefabric.help; | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author jotty | ||||
|  * | ||||
|  */ | ||||
| public class ClassHelper { | ||||
|  | ||||
| 	/** | ||||
| 	 * check if c is instance of name | ||||
| 	 * | ||||
| 	 * @param c    the class | ||||
| 	 * @param name the name | ||||
| 	 * @return true or false | ||||
| 	 */ | ||||
| 	public static final Boolean isInstanceOf(Class<?> c, String name) { | ||||
| 		Class<?>[] a = c.getInterfaces(); | ||||
| 		for (Class<?> cl : a) { | ||||
| 			String simpleName = cl.getSimpleName(); | ||||
| 			if (simpleName.equals(name)) { | ||||
| 				return true; | ||||
| 			} | ||||
| 		} | ||||
| 		return false; | ||||
| 	} | ||||
| } | ||||
| @@ -4,9 +4,9 @@ import java.util.List; | ||||
|  | ||||
| import com.google.common.collect.Lists; | ||||
|  | ||||
| import de.jottyfan.minecraft.quickiefabric.help.ClassHelper; | ||||
| import net.minecraft.block.Block; | ||||
| import net.minecraft.block.BlockState; | ||||
| import net.minecraft.block.LeavesBlock; | ||||
| import net.minecraft.item.AxeItem; | ||||
| import net.minecraft.item.ItemStack; | ||||
| import net.minecraft.item.ToolMaterial; | ||||
| @@ -35,7 +35,9 @@ public class ToolRangeableAxe extends AxeItem implements ToolRangeable { | ||||
|  | ||||
| 	@Override | ||||
| 	public boolean canBreakNeighbors(BlockState blockIn) { | ||||
| 		return super.isSuitableFor(blockIn) || blockIn.getBlock() instanceof LeavesBlock; | ||||
| 		Class<?> c = blockIn.getBlock().getClass(); | ||||
| 		return super.isSuitableFor(blockIn) || ClassHelper.isInstanceOf(c, "LeavesBlock") | ||||
| 				|| ClassHelper.isInstanceOf(c, "ExtendedLeavesBlock"); // from terrestria | ||||
| 	} | ||||
|  | ||||
| 	@Override | ||||
|   | ||||
| @@ -0,0 +1,18 @@ | ||||
| package de.jottyfan.minecraft.quickiefabric.help; | ||||
|  | ||||
| import org.junit.Test; | ||||
|  | ||||
| import de.jottyfan.minecraft.quickiefabric.blocks.BlockCottonplant; | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author jotty | ||||
|  * | ||||
|  */ | ||||
| public class TestClassHelper { | ||||
|  | ||||
| 	@Test | ||||
| 	public void testIsInstanceOf() { | ||||
| 		ClassHelper.isInstanceOf(BlockCottonplant.class, "Fertilizable"); | ||||
| 	} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user