下面列出了org.bukkit.Material#BLAZE_POWDER 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public int spaceForItem(TPDirection insertDirection, ItemStack insertion) {
if (isInvLocked(cachedBrewingStand)) {
return 0;
}
if (insertion.getType() == Material.POTION || insertion.getType() == Material.SPLASH_POTION || insertion.getType() == Material.LINGERING_POTION) {
if (cachedInv.getItem(0) != null && cachedInv.getItem(1) != null && cachedInv.getItem(2) != null) {
return 0;
} else {
return 1;
}
} else if (insertDirection.isSide() && insertion.getType() == Material.BLAZE_POWDER) {
return spaceForItem(cachedInv.getFuel(), insertion);
} else if (isBrewingIngredient(insertion.getType())) {
return spaceForItem(cachedInv.getIngredient(), insertion);
} else {
return 0;
}
}
private void registerMagicalPlant(String name, ItemStack item, String texture, ItemStack[] recipe) {
String upperCase = name.toUpperCase(Locale.ROOT);
String enumStyle = upperCase.replace(' ', '_');
SlimefunItemStack essence = new SlimefunItemStack(enumStyle + "_ESSENCE", Material.BLAZE_POWDER, "&rMagical Essence", "", "&7" + name);
Berry berry = new Berry(essence, upperCase + "_ESSENCE", PlantType.ORE_PLANT, texture);
berries.add(berry);
new SlimefunItem(magicalCategory, new SlimefunItemStack(enumStyle + "_PLANT", Material.OAK_SAPLING, "&r" + name + " Plant"), RecipeType.ENHANCED_CRAFTING_TABLE,
recipe)
.register(this);
MagicalEssence magicalEssence = new MagicalEssence(magicalCategory, essence);
magicalEssence.setRecipeOutput(item.clone());
magicalEssence.register(this);
}
public GrindStone(Category category, SlimefunItemStack item) {
super(category, item,
new ItemStack[] {null, null, null, null, new ItemStack(Material.OAK_FENCE), null, null, new CustomItem(Material.DISPENSER, "Dispenser (Facing up)"), null},
new ItemStack[] {
new ItemStack(Material.BLAZE_ROD), new ItemStack(Material.BLAZE_POWDER, 4),
new ItemStack(Material.BONE), new ItemStack(Material.BONE_MEAL, 4),
new ItemStack(Material.GRAVEL), new ItemStack(Material.FLINT),
new ItemStack(Material.ENDER_EYE), new CustomItem(SlimefunItems.ENDER_LUMP_1, 2),
new ItemStack(Material.COBBLESTONE), new ItemStack(Material.GRAVEL),
new ItemStack(Material.ANDESITE), new ItemStack(Material.GRAVEL),
new ItemStack(Material.DIORITE), new ItemStack(Material.GRAVEL),
new ItemStack(Material.GRANITE), new ItemStack(Material.GRAVEL),
new ItemStack(Material.DIRT), SlimefunItems.STONE_CHUNK,
new ItemStack(Material.SANDSTONE), new ItemStack(Material.SAND, 4),
new ItemStack(Material.RED_SANDSTONE), new ItemStack(Material.RED_SAND, 4),
new ItemStack(Material.PRISMARINE_BRICKS), new ItemStack(Material.PRISMARINE, 2),
new ItemStack(Material.PRISMARINE), new ItemStack(Material.PRISMARINE_SHARD, 4)
},
BlockFace.SELF
);
}
@Override
public ItemStack insertItem(TPDirection insertDirection, ItemStack insertion) {
if (!isInLoadedChunk()) {
return insertion;
}
if (isInvLocked(cachedBrewingStand)) {
return insertion;
}
if (insertion.getType() == Material.POTION || insertion.getType() == Material.SPLASH_POTION || insertion.getType() == Material.LINGERING_POTION) {
if (cachedInv.getItem(0) == null) {
cachedInv.setItem(0, insertion);
return null;
} else if (cachedInv.getItem(1) == null) {
cachedInv.setItem(1, insertion);
return null;
} else if (cachedInv.getItem(2) == null) {
cachedInv.setItem(2, insertion);
return null;
}
} else if (insertDirection.isSide() && insertion.getType() == Material.BLAZE_POWDER) {
ItemStack oldFuel = cachedInv.getFuel();
cachedInv.setFuel(accumulateItems(oldFuel, insertion));
if (insertion == null || insertion.getAmount() == 0) {
insertion = null;
}
} else if (isBrewingIngredient(insertion.getType())) {
ItemStack oldIngredient = cachedInv.getIngredient();
cachedInv.setIngredient(accumulateItems(oldIngredient, insertion));
if (insertion == null || insertion.getAmount() == 0) {
insertion = null;
}
}
return insertion;
}
public static void addGunPowder()
{
ItemStack s = new ItemStack(Material.BLAZE_POWDER);
brewing.setItem(24, new ShopMenuItem(s,s,15));
}
private Material getIconMaterialForSpecificStatistic(Query query, PlayerStat stat) {
if (stat == PlayerStat.BLOCKS_BROKEN || stat == PlayerStat.BLOCKS_PLACED) {
Material material = Material.getMaterial(query.getValue("block").toString());
if (material != null && material.isItem()) {
return material;
}
}
if (stat == PlayerStat.VILLAGER_TRADES) {
return Material.getMaterial(query.getValue("trade").toString());
}
if (stat == PlayerStat.KILLS_MOBS) {
return Material.getMaterial(query.getValue("weapon").toString());
}
if (stat == PlayerStat.ITEMS_PICKED_UP || stat == PlayerStat.ITEMS_DROPPED || stat == PlayerStat.ITEMS_CRAFTED || stat == PlayerStat.TOOLS_BROKEN) {
return Material.getMaterial(query.getValue("item").toString());
}
if (stat == PlayerStat.ITEMS_CAUGHT) {
return Material.getMaterial(query.getValue("caught").toString());
}
if (stat == PlayerStat.FOOD_EATEN) {
return Material.getMaterial(query.getValue("foodEaten").toString());
}
if (stat == PlayerStat.DISTANCE_TRAVELLED) {
String movementType = query.getValue("moveType").toString();
switch (movementType) {
case "SWIM":
return Material.TROPICAL_FISH;
case "FLY":
return Material.BLAZE_POWDER;
case "BOAT":
return Material.OAK_BOAT;
case "MINECART":
case "HORSE IN MINECART":
return Material.MINECART;
case "PIG IN MINECART":
case "PIG":
return Material.COOKED_PORKCHOP;
case "HORSE":
return Material.DIAMOND_HORSE_ARMOR;
case "FLY WITH ELYTRA":
return Material.ELYTRA;
case "WALK":
return Material.GOLDEN_BOOTS;
}
}
return plugin.getStatisticDescriptionConfig().getIconMaterial(stat);
}
static ItemStack insertIntoVanillaInventory(ItemStack stack, Inventory inv) {
ItemStack[] contents = inv.getContents();
int minSlot = 0;
int maxSlot = contents.length;
// Check if it is a normal furnace
if (inv instanceof FurnaceInventory) {
// Check if it is fuel or not
if (stack.getType().isFuel()) {
maxSlot = 2;
// Any non-smeltable items should not land in the upper slot
if (!isSmeltable(stack, true)) {
minSlot = 1;
}
}
else {
maxSlot = 1;
}
}
else if (inv instanceof BrewerInventory) {
if (stack.getType() == Material.POTION || stack.getType() == Material.LINGERING_POTION || stack.getType() == Material.SPLASH_POTION) {
// Potions slot
maxSlot = 3;
}
else if (stack.getType() == Material.BLAZE_POWDER) {
// Blaze Powder slot
minSlot = 4;
maxSlot = 5;
}
else {
// Input slot
minSlot = 3;
maxSlot = 4;
}
}
ItemStackWrapper wrapper = new ItemStackWrapper(stack);
for (int slot = minSlot; slot < maxSlot; slot++) {
// Changes to this ItemStack are synchronized with the Item in the Inventory
ItemStack itemInSlot = contents[slot];
if (itemInSlot == null) {
inv.setItem(slot, stack);
return null;
}
else {
int maxStackSize = itemInSlot.getType().getMaxStackSize();
if (SlimefunUtils.isItemSimilar(itemInSlot, wrapper, true, false) && itemInSlot.getAmount() < maxStackSize) {
int amount = itemInSlot.getAmount() + stack.getAmount();
if (amount > maxStackSize) {
stack.setAmount(amount - maxStackSize);
}
else {
stack = null;
}
itemInSlot.setAmount(Math.min(amount, maxStackSize));
// Setting item in inventory will clone the ItemStack
inv.setItem(slot, itemInSlot);
return stack;
}
}
}
return stack;
}