mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-17 05:03:55 -07:00
Imported from mc-dev:
- ShapedRecipes - ShapelessRecipes - CraftingRecipe - FurnaceRecipes
This commit is contained in:
committed by
EvilSeph
parent
39048be430
commit
84ecdb5439
59
src/main/java/net/minecraft/server/ShapelessRecipes.java
Normal file
59
src/main/java/net/minecraft/server/ShapelessRecipes.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class ShapelessRecipes implements CraftingRecipe {
|
||||
|
||||
private final ItemStack a;
|
||||
private final List b;
|
||||
|
||||
public ShapelessRecipes(ItemStack itemstack, List list) {
|
||||
this.a = itemstack;
|
||||
this.b = list;
|
||||
}
|
||||
|
||||
public ItemStack b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public boolean a(InventoryCrafting inventorycrafting) {
|
||||
ArrayList arraylist = new ArrayList(this.b);
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
ItemStack itemstack = inventorycrafting.b(j, i);
|
||||
|
||||
if (itemstack != null) {
|
||||
boolean flag = false;
|
||||
Iterator iterator = arraylist.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
ItemStack itemstack1 = (ItemStack) iterator.next();
|
||||
|
||||
if (itemstack.id == itemstack1.id && (itemstack1.getData() == -1 || itemstack.getData() == itemstack1.getData())) {
|
||||
flag = true;
|
||||
arraylist.remove(itemstack1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return arraylist.isEmpty();
|
||||
}
|
||||
|
||||
public ItemStack b(InventoryCrafting inventorycrafting) {
|
||||
return this.a.cloneItemStack();
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return this.b.size();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user