本文整理汇总了Java中org.bukkit.craftbukkit.inventory.CraftShapedRecipe类的典型用法代码示例。如果您正苦于以下问题:Java CraftShapedRecipe类的具体用法?Java CraftShapedRecipe怎么用?Java CraftShapedRecipe使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CraftShapedRecipe类属于org.bukkit.craftbukkit.inventory包,在下文中一共展示了CraftShapedRecipe类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toBukkitRecipe
import org.bukkit.craftbukkit.inventory.CraftShapedRecipe; //导入依赖的package包/类
public org.bukkit.inventory.ShapedRecipe toBukkitRecipe() {
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
switch (this.height) {
case 1:
switch (this.width) {
case 1:
recipe.shape("a");
break;
case 2:
recipe.shape("ab");
break;
case 3:
recipe.shape("abc");
break;
}
break;
case 2:
switch (this.width) {
case 1:
recipe.shape("a","b");
break;
case 2:
recipe.shape("ab","cd");
break;
case 3:
recipe.shape("abc","def");
break;
}
break;
case 3:
switch (this.width) {
case 1:
recipe.shape("a","b","c");
break;
case 2:
recipe.shape("ab","cd","ef");
break;
case 3:
recipe.shape("abc","def","ghi");
break;
}
break;
}
char c = 'a';
for (ItemStack stack : this.items) {
if (stack != null) {
recipe.setIngredient(c, org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), stack.getData());
}
c++;
}
return recipe;
}
示例2: toBukkitRecipe
import org.bukkit.craftbukkit.inventory.CraftShapedRecipe; //导入依赖的package包/类
public org.bukkit.inventory.ShapedRecipe toBukkitRecipe() {
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
switch (this.height) {
case 1:
switch (this.width) {
case 1:
recipe.shape("a");
break;
case 2:
recipe.shape("ab");
break;
case 3:
recipe.shape("abc");
break;
}
break;
case 2:
switch (this.width) {
case 1:
recipe.shape("a","b");
break;
case 2:
recipe.shape("ab","cd");
break;
case 3:
recipe.shape("abc","def");
break;
}
break;
case 3:
switch (this.width) {
case 1:
recipe.shape("a","b","c");
break;
case 2:
recipe.shape("ab","cd","ef");
break;
case 3:
recipe.shape("abc","def","ghi");
break;
}
break;
}
char c = 'a';
for (ItemStack stack : this.items) {
if (stack != null) {
recipe.setIngredient(c, org.bukkit.Material.getMaterial(stack.id), stack.getData());
}
c++;
}
return recipe;
}
示例3: toBukkitRecipe
import org.bukkit.craftbukkit.inventory.CraftShapedRecipe; //导入依赖的package包/类
public org.bukkit.inventory.ShapedRecipe toBukkitRecipe()
{
CraftItemStack result = CraftItemStack.asCraftMirror(this.recipeOutput);
CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
switch (this.recipeHeight)
{
case 1:
switch (this.recipeWidth)
{
case 1:
recipe.shape("a");
break;
case 2:
recipe.shape("ab");
break;
case 3:
recipe.shape("abc");
break;
}
break;
case 2:
switch (this.recipeWidth)
{
case 1:
recipe.shape("a", "b");
break;
case 2:
recipe.shape("ab", "cd");
break;
case 3:
recipe.shape("abc", "def");
break;
}
break;
case 3:
switch (this.recipeWidth)
{
case 1:
recipe.shape("a", "b", "c");
break;
case 2:
recipe.shape("ab", "cd", "ef");
break;
case 3:
recipe.shape("abc", "def", "ghi");
break;
}
break;
}
char c = 'a';
for (ItemStack stack : this.recipeItems)
{
if (stack != null)
{
recipe.setIngredient(c, org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), stack.getItemDamage());
}
c++;
}
return recipe;
}