Compare commits
4 Commits
0.0.3-ALPH
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 818e8b4f63 | |||
| cff32dd304 | |||
| 0d9dc17128 | |||
| 66f327a581 |
10
README.md
10
README.md
@@ -1,3 +1,7 @@
|
||||
Bukkit Plugin
|
||||
|
||||
Download the Plugin here: [CustomCrafting 0.0.2-ALPHA](https://gitlab.com/basman93/CustomCrafting/uploads/b711ed3061aaaadaffe9f9dd954f1237/CustomCrafting-0.0.2-ALPHA.jar)
|
||||
Download the Plugin here:
|
||||
* [Latest](/uploads/859f6a469ab06f6e7645cf7d39fe117c/CustomCrafting-0.0.4-ALPHA.jar)
|
||||
* [Version 0.0.4-Alpha](/uploads/859f6a469ab06f6e7645cf7d39fe117c/CustomCrafting-0.0.4-ALPHA.jar)
|
||||
* [Version 0.0.3-Alpha](/uploads/1cb1378b7ac7ab88ebce876dfa648417/CustomCrafting-0.0.3-ALPHA.jar)
|
||||
* [Version 0.0.2-Alpha](/uploads/b711ed3061aaaadaffe9f9dd954f1237/CustomCrafting-0.0.2-ALPHA.jar)
|
||||
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -3,7 +3,7 @@
|
||||
<groupId>org.forkzone.mc</groupId>
|
||||
<artifactId>CustomCrafting</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.0.3-ALPHA</version>
|
||||
<version>0.0.4-ALPHA</version>
|
||||
<name>CustomCrafting</name>
|
||||
<url></url>
|
||||
<build>
|
||||
|
||||
@@ -127,7 +127,7 @@ public final class CustomCrafting extends JavaPlugin
|
||||
* @param xp (required) the xp the player will get for this
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
private void addNewFurnaceRecipe(String name, String shape, String item, float xp)
|
||||
private void addNewFurnaceRecipe(String name, String shape, String item, float xp, String nbtdata)
|
||||
{
|
||||
String[] item_array = getItemArray(item);
|
||||
if(Material.getMaterial(item_array[0]) == null)
|
||||
@@ -145,7 +145,10 @@ public final class CustomCrafting extends JavaPlugin
|
||||
return;
|
||||
}
|
||||
|
||||
FurnaceRecipe recipe = new FurnaceRecipe(new ItemStack(Material.getMaterial(item_array[0]), toInt(item_array[2]), toShort(item_array[1])), new MaterialData(Material.getMaterial(shape_array[0]), (byte) 0), xp);
|
||||
ItemStack is = new ItemStack(Material.getMaterial(item_array[0]), toInt(item_array[2]), toShort(item_array[1]));
|
||||
if(nbtdata != null && !nbtdata.isEmpty())
|
||||
Bukkit.getUnsafe().modifyItemStack(is, nbtdata);
|
||||
FurnaceRecipe recipe = new FurnaceRecipe(is, new MaterialData(Material.getMaterial(shape_array[0]), (byte) 0), xp);
|
||||
if(!Bukkit.getServer().addRecipe(recipe))
|
||||
getLogger().warning("Something went wrong! Cannot add \"" + name + "\"");
|
||||
else
|
||||
@@ -160,7 +163,7 @@ public final class CustomCrafting extends JavaPlugin
|
||||
* @param shapeless (required) if the recipe is shapeless
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
private void addNewRecipe(NamespacedKey name, String shape, String item, boolean shapeless)
|
||||
private void addNewRecipe(NamespacedKey name, String shape, String item, boolean shapeless, String nbtdata)
|
||||
{
|
||||
String[] item_array = getItemArray(item);
|
||||
if(Material.getMaterial(item_array[0]) == null)
|
||||
@@ -172,7 +175,10 @@ public final class CustomCrafting extends JavaPlugin
|
||||
else if(shapeless)
|
||||
{
|
||||
String[][] shape_array = getShapeArraySL(shape);
|
||||
ShapelessRecipe recipe = new ShapelessRecipe(name, new ItemStack(Material.getMaterial(item_array[0]), toInt(item_array[2]), toShort(item_array[1])));
|
||||
ItemStack is = new ItemStack(Material.getMaterial(item_array[0]), toInt(item_array[2]), toShort(item_array[1]));
|
||||
if(nbtdata != null && !nbtdata.isEmpty())
|
||||
Bukkit.getUnsafe().modifyItemStack(is, nbtdata);
|
||||
ShapelessRecipe recipe = new ShapelessRecipe(name, is);
|
||||
|
||||
for(String[] ingredient_array : shape_array)
|
||||
{
|
||||
@@ -187,7 +193,10 @@ public final class CustomCrafting extends JavaPlugin
|
||||
else
|
||||
{
|
||||
String[][][] shape_array = getShapeArray(shape);
|
||||
ShapedRecipe recipe = new ShapedRecipe(name, new ItemStack(Material.getMaterial(item_array[0]), toInt(item_array[2]), toShort(item_array[1])));
|
||||
ItemStack is = new ItemStack(Material.getMaterial(item_array[0]), toInt(item_array[2]), toShort(item_array[1]));
|
||||
if(nbtdata != null && !nbtdata.isEmpty())
|
||||
Bukkit.getUnsafe().modifyItemStack(is, nbtdata);
|
||||
ShapedRecipe recipe = new ShapedRecipe(name, is);
|
||||
Map<String, Character> map = new HashMap<String, Character>();
|
||||
int counter = 0;
|
||||
String[] recipe_shape = new String[3];
|
||||
@@ -233,12 +242,24 @@ public final class CustomCrafting extends JavaPlugin
|
||||
for(String key : getConfig().getConfigurationSection("recipes").getKeys(false))
|
||||
{
|
||||
NamespacedKey nkey = new NamespacedKey(this, key);
|
||||
addNewRecipe(nkey, getConfig().getString("recipes." + key + ".shape"), getConfig().getString("recipes." + key + ".item"), getConfig().getBoolean("recipes." + key + ".shapeless"));
|
||||
addNewRecipe(
|
||||
nkey,
|
||||
getConfig().getString("recipes." + key + ".shape"),
|
||||
getConfig().getString("recipes." + key + ".item"),
|
||||
getConfig().getBoolean("recipes." + key + ".shapeless"),
|
||||
getConfig().getString("recipes." + key + ".nbt")
|
||||
);
|
||||
}
|
||||
|
||||
for(String key : getConfig().getConfigurationSection("furnace_recipes").getKeys(false))
|
||||
{
|
||||
addNewFurnaceRecipe(key, getConfig().getString("furnace_recipes." + key + ".shape"), getConfig().getString("furnace_recipes." + key + ".item"), (float) getConfig().getDouble("furnace_recipes." + key + ".xp"));
|
||||
addNewFurnaceRecipe(
|
||||
key,
|
||||
getConfig().getString("furnace_recipes." + key + ".shape"),
|
||||
getConfig().getString("furnace_recipes." + key + ".item"),
|
||||
(float) getConfig().getDouble("furnace_recipes." + key + ".xp"),
|
||||
getConfig().getString("furnace_recipes." + key + ".nbt")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user