Improve UtilBlock and UtilItem api classes

This commit is contained in:
AlexTheCoder 2017-08-26 02:03:50 -04:00
parent 640902169c
commit 5c3b575c3f
2 changed files with 21 additions and 11 deletions

View File

@ -4,19 +4,10 @@ import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.Blocks;
import net.minecraft.server.v1_8_R3.IBlockData;
import net.minecraft.server.v1_8_R3.Item;
import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.MinecraftKey;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.TileEntityFlowerPot;
import net.minecraft.server.v1_8_R3.WorldServer;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.SkullType;
@ -45,6 +36,16 @@ import com.mojang.authlib.GameProfile;
import mineplex.core.common.Pair;
import mineplex.core.common.block.MultiBlockUpdaterAgent;
import mineplex.core.common.skin.SkinData;
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.Blocks;
import net.minecraft.server.v1_8_R3.IBlockData;
import net.minecraft.server.v1_8_R3.Item;
import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.MinecraftKey;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.TileEntityFlowerPot;
import net.minecraft.server.v1_8_R3.WorldServer;
public class UtilBlock
{
@ -107,6 +108,7 @@ public class UtilBlock
blockAirFoliageSet.add((byte) Material.AIR.getId());
blockAirFoliageSet.add((byte) Material.SAPLING.getId());
blockAirFoliageSet.add((byte) Material.LONG_GRASS.getId());
blockAirFoliageSet.add((byte) Material.DOUBLE_PLANT.getId());
blockAirFoliageSet.add((byte) Material.DEAD_BUSH.getId());
blockAirFoliageSet.add((byte) Material.YELLOW_FLOWER.getId());
blockAirFoliageSet.add((byte) Material.RED_ROSE.getId());
@ -631,6 +633,14 @@ public class UtilBlock
return false;
}
public static List<Block> getInBoundingBox(World world, AxisAlignedBB box)
{
Location l1 = new Location(world, box.a, box.b, box.c);
Location l2 = new Location(world, box.d, box.e, box.f);
return getInBoundingBox(l1, l2);
}
public static ArrayList<Block> getInBoundingBox(Location a, Location b)
{
return getInBoundingBox(a, b, true);

View File

@ -670,7 +670,7 @@ public class UtilItem
public static boolean isBoundless(Material material)
{
return (_materials.get(material).contains(ItemCategory.BOUNDLESS));
return material == null ? false : contains(material, ItemCategory.BOUNDLESS);
}
public static boolean isBoundless(ItemStack stack)