Attempted to add Vacuum Cube.

testdev
sigonasr2 8 years ago
parent 22816a8022
commit e100ccaadc
  1. BIN
      TwosideKeeper.jar
  2. 10
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/RecipeLinker.java
  3. 2
      src/sig/plugin/TwosideKeeper/HelperStructures/CubeType.java
  4. 83
      src/sig/plugin/TwosideKeeper/HelperStructures/CustomItem.java
  5. 4
      src/sig/plugin/TwosideKeeper/HelperStructures/CustomRecipe.java
  6. 4
      src/sig/plugin/TwosideKeeper/HelperStructures/WorldShop.java
  7. 7
      src/sig/plugin/TwosideKeeper/ItemCubeWindow.java
  8. 2
      src/sig/plugin/TwosideKeeper/Recipes.java
  9. 27
      src/sig/plugin/TwosideKeeper/TwosideKeeper.java

Binary file not shown.

@ -361,6 +361,16 @@ public enum RecipeLinker {
Recipes.getArrowFromMeta("PIERCING_ARR"),
new ItemStack(Material.REDSTONE,1),new ItemStack(Material.REDSTONE,1),new ItemStack(Material.REDSTONE,1),
new ItemStack(Material.REDSTONE,1),Recipes.getArrowFromMeta("DOUBLE_DAMAGE_ARR"),
}),
worldshop(RecipeCategory.MISC_ITEMS,ChatColor.BLUE,"World Shop",new ItemStack[]{
CustomItem.WorldShop(),
new ItemStack(Material.CHEST,1),new ItemStack(Material.SIGN,1),null,
CustomItem.DirtSubstitute(),
}),
worldshop2(RecipeCategory.MISC_ITEMS,ChatColor.BLUE,"World Shop [Trapped Chest]",new ItemStack[]{
CustomItem.WorldShop2(),
new ItemStack(Material.TRAPPED_CHEST,1),new ItemStack(Material.SIGN,1),null,
CustomItem.DirtSubstitute(),
});
String name = "";

@ -1,5 +1,5 @@
package sig.plugin.TwosideKeeper.HelperStructures;
public enum CubeType {
NORMAL,LARGE,ENDER
NORMAL,LARGE,ENDER,VACUUM
}

@ -25,6 +25,7 @@ import sig.plugin.TwosideKeeper.Recipes;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.ArrowQuiver;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
public class CustomItem {
ItemStack item;
@ -48,6 +49,7 @@ public class CustomItem {
TwosideKeeper.LARGE_ITEM_CUBE_RECIPE = LargeItemCubeRecipe();
TwosideKeeper.ENDER_ITEM_CUBE_RECIPE = EnderItemCubeRecipe();
TwosideKeeper.DUPLICATE_ENDER_ITEM_CUBE_RECIPE = DuplicateEnderItemCubeRecipe();
TwosideKeeper.VACUUM_CUBE_RECIPE = VacuumCubeRecipe();
TwosideKeeper.ARROW_QUIVER_RECIPE = ArrowQuiverRecipe();
TwosideKeeper.HARDENED_IRON_HELMET_RECIPE = HardenedRecipe(Material.IRON_HELMET,Material.IRON_BLOCK,"aaa","axa","xxx");
TwosideKeeper.HARDENED_IRON_CHESTPLATE_RECIPE = HardenedRecipe(Material.IRON_CHESTPLATE,Material.IRON_BLOCK,"axa","aaa","aaa");
@ -112,19 +114,64 @@ public class CustomItem {
TwosideKeeper.POISON_ARROW_RECIPE = PoisonArrowRecipe();
TwosideKeeper.PIERCING_ARROW_RECIPE = PiercingArrowRecipe();
TwosideKeeper.WORLD_SHOP_RECIPE = WorldShopRecipe();
TwosideKeeper.WORLD_SHOP2_RECIPE = WorldShop2Recipe();
}
private static ItemStack VacuumCube() {
ItemStack item_VacuumCube = new ItemStack(Material.ENDER_CHEST);
List<String> item_VacuumCube_lore = new ArrayList<String>();
item_VacuumCube_lore.add("A storage container that sucks");
item_VacuumCube_lore.add("up blocks. Holds 54 block stacks.");
item_VacuumCube_lore.add(" ");
ItemMeta item_ItemCube_meta=item_VacuumCube.getItemMeta();
item_ItemCube_meta.setLore(item_VacuumCube_lore);
item_ItemCube_meta.setDisplayName(ChatColor.BLUE+""+ChatColor.BOLD+"Vacuum Cube");
item_VacuumCube.setItemMeta(item_ItemCube_meta);
return item_VacuumCube.clone();
}
private static ShapelessRecipe VacuumCubeRecipe() {
ItemStack item_VacuumCube = VacuumCube();
ShapelessRecipe ItemCube = new ShapelessRecipe(item_VacuumCube);
ItemCube.addIngredient(Material.ENDER_CHEST);
ItemCube.addIngredient(Material.ENDER_PEARL);
ItemCube.addIngredient(Material.ENDER_PEARL);
ItemCube.addIngredient(Material.ELYTRA);
ItemCube.addIngredient(4,Material.DIAMOND_BLOCK);
ItemCube.addIngredient(Material.REDSTONE_BLOCK);
return ItemCube;
}
private static ShapelessRecipe WorldShopRecipe() {
ItemStack item_ItemCube = WorldShop();
ItemStack item_worldShop = WorldShop();
ShapedRecipe ItemCube = new ShapedRecipe(item_ItemCube);
ItemCube.shape("ppp","pcp","ppp");
ItemCube.setIngredient('p', Material.WOOD, -1);
ItemCube.setIngredient('c', Material.CHEST);
return ItemCube;
ShapelessRecipe recipe_Worldshop = new ShapelessRecipe(item_worldShop);
recipe_Worldshop.addIngredient(Material.CHEST);
recipe_Worldshop.addIngredient(Material.SIGN);
recipe_Worldshop.addIngredient(Material.DIRT);
return recipe_Worldshop;
}
private static ItemStack WorldShop() {
private static ShapelessRecipe WorldShop2Recipe() {
ItemStack item_worldShop = WorldShop2();
ShapelessRecipe recipe_Worldshop = new ShapelessRecipe(item_worldShop);
recipe_Worldshop.addIngredient(Material.TRAPPED_CHEST);
recipe_Worldshop.addIngredient(Material.SIGN);
recipe_Worldshop.addIngredient(Material.DIRT);
return recipe_Worldshop;
}
public static ItemStack DirtSubstitute() {
ItemStack dirtSub = new ItemStack(Material.DIRT);
ItemUtils.addLore(dirtSub, "You can substitute the dirt block");
ItemUtils.addLore(dirtSub, "with any block to create any type");
ItemUtils.addLore(dirtSub, "of World Shop!");
return dirtSub;
}
public static ItemStack WorldShop() {
ItemStack worldShop = new ItemStack(Material.CHEST);
List<String> worldShopLore = new ArrayList<String>();
worldShopLore.add("You can substitute the dirt block");
@ -132,7 +179,20 @@ public class CustomItem {
worldShopLore.add("of World Shop!");
ItemMeta item_ItemCube_meta=worldShop.getItemMeta();
item_ItemCube_meta.setLore(worldShopLore);
item_ItemCube_meta.setDisplayName("Item Cube");
item_ItemCube_meta.setDisplayName("Placeable World Shop");
worldShop.setItemMeta(item_ItemCube_meta);
return worldShop.clone();
}
public static ItemStack WorldShop2() {
ItemStack worldShop = new ItemStack(Material.TRAPPED_CHEST);
List<String> worldShopLore = new ArrayList<String>();
worldShopLore.add("You can substitute the dirt block");
worldShopLore.add("with any block to create any type");
worldShopLore.add("of World Shop!");
ItemMeta item_ItemCube_meta=worldShop.getItemMeta();
item_ItemCube_meta.setLore(worldShopLore);
item_ItemCube_meta.setDisplayName("Placeable World Shop");
worldShop.setItemMeta(item_ItemCube_meta);
return worldShop.clone();
}
@ -496,4 +556,11 @@ public class CustomItem {
return item_ItemCube.clone();
}
public static boolean isVacuumCube(ItemStack item) {
if (ItemUtils.isValidLoreItem(item) && ItemUtils.LoreContains(item, "A storage container that sucks")) {
return true;
}
return false;
}
}

@ -87,9 +87,9 @@ public enum CustomRecipe {
ItemStack newitem = null;
ItemStack netherstar = null;
for (int i=1;i<10;i++) {
if (ev.getInventory().getItem(i)!=null &&
if ((ev.getInventory().getItem(i)!=null &&
ev.getInventory().getItem(i).getType()!=Material.AIR &&
(ev.getInventory().getItem(i).getType()==Material.ENDER_CHEST)) {
(ev.getInventory().getItem(i).getType()==Material.ENDER_CHEST)) && !CustomItem.isVacuumCube(ev.getInventory().getItem(i))) {
ItemMeta inventory_itemMeta1=ev.getInventory().getItem(i).getItemMeta();
if (inventory_itemMeta1.hasLore() && inventory_itemMeta1.getLore().size()==4) {
String loreitem = inventory_itemMeta1.getLore().get(3);

@ -1213,6 +1213,10 @@ public class WorldShop {
r.setSeed(seed);
Set<String> items = WorldShop.pricelist.keySet();
int rand = r.nextInt(items.size());
if (iter>50) { //A fail-safe so we don't end up in an endless loop.
TwosideKeeper.log("Could not define a specific deal of the day! Please check the ShopPrices.data file for valid prices!", 1);
return new ItemStack(Material.DIRT);
}
for (String s : items) {
if (rand>0) {
rand--;

@ -14,7 +14,7 @@ public class ItemCubeWindow {
public static void addItemCubeWindow(Player p, int id) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.itemcubelist.add(id);
TwosideKeeper.log("Added cube "+id+" to Item Cube List for Player "+p.getName()+". New list: "+pd.itemcubelist.toString(), 3);
TwosideKeeper.log("Added cube "+id+" to Item Cube List for Player "+p.getName()+". New list: "+pd.itemcubelist.toString(),0);
}
public static void popItemCubeWindow(Player p) {
//Opens the next possible item cube inventory from the list of inventories.
@ -22,7 +22,7 @@ public class ItemCubeWindow {
if (pd.itemcubelist.size()>0 && !pd.opened_another_cube) {
int index = pd.itemcubelist.size()-1;
Integer itemcubeid = pd.itemcubelist.get(index);
TwosideKeeper.log("Popping Item Cube ID "+index+" from "+p.getName()+"'s list.", 3);
TwosideKeeper.log("Popping Item Cube ID "+index+" from "+p.getName()+"'s list.", 0);
pd.itemcubelist.remove(index);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
@ -31,6 +31,9 @@ public class ItemCubeWindow {
//pd.itemcubeviews.add(p.getOpenInventory());
CubeType size = TwosideKeeper.itemCube_getCubeType(itemcubeid);
int inv_size = 9;
if (size==CubeType.VACUUM) {
inv_size=54;
} else
if (size!=CubeType.NORMAL) {
inv_size=27;
}

@ -33,6 +33,8 @@ public class Recipes {
//------------------------------
Bukkit.addRecipe(TwosideKeeper.DUPLICATE_ENDER_ITEM_CUBE_RECIPE);
Bukkit.addRecipe(TwosideKeeper.VACUUM_CUBE_RECIPE);
}
public static void Initialize_ArrowQuiver_Recipe() {
Bukkit.addRecipe(TwosideKeeper.ARROW_QUIVER_RECIPE);

@ -252,6 +252,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static CustomItem LARGE_ITEM_CUBE;
public static CustomItem ENDER_ITEM_CUBE;
public static CustomItem DUPLICATE_ENDER_ITEM_CUBE;
public static CustomItem VACUUM_CUBE;
public static CustomItem ARROW_QUIVER;
public static CustomItem HARDENED_IRON_HELMET;
public static CustomItem HARDENED_IRON_CHESTPLATE;
@ -295,6 +296,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static ShapedRecipe LARGE_ITEM_CUBE_RECIPE;
public static ShapedRecipe ENDER_ITEM_CUBE_RECIPE;
public static ShapelessRecipe DUPLICATE_ENDER_ITEM_CUBE_RECIPE;
public static ShapelessRecipe VACUUM_CUBE_RECIPE;
public static ShapedRecipe ARROW_QUIVER_RECIPE;
public static ShapedRecipe HARDENED_IRON_HELMET_RECIPE;
public static ShapedRecipe HARDENED_IRON_CHESTPLATE_RECIPE;
@ -346,6 +348,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static ShapelessRecipe EXPLODING_ARROW_RECIPE;
public static ShapelessRecipe PIERCING_ARROW_RECIPE;
public static ShapelessRecipe WORLD_SHOP_RECIPE;
public static ShapelessRecipe WORLD_SHOP2_RECIPE;
public static CustomPotion STRENGTHENING_VIAL;
public static CustomPotion LIFE_VIAL;
public static CustomPotion HARDENING_VIAL;
@ -2429,6 +2432,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
int size=0;
if (ev.getPlayer().getInventory().getItemInMainHand().getType()==Material.CHEST) {
size=9;
} else
if (CustomItem.isVacuumCube(ev.getPlayer().getInventory().getItemInMainHand())) {
size=54;
} else {
size=27;
}
@ -2463,6 +2469,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
int size=0;
if (ev.getPlayer().getInventory().getItemInMainHand().getType()==Material.CHEST) {
size=9;
} else
if (CustomItem.isVacuumCube(ev.getPlayer().getInventory().getItemInMainHand())) {
size=54;
} else {
size=27;
}
@ -3201,7 +3210,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (ev.getCurrentItem().hasItemMeta()) {
ItemMeta item_meta = ev.getCurrentItem().getItemMeta();
if (item_meta.getDisplayName()!=null &&
item_meta.getDisplayName().contains("Item Cube")) {
(item_meta.getDisplayName().contains("Item Cube") || item_meta.getDisplayName().contains("Vacuum Cube"))) {
if (ev.isShiftClick()) {
ev.setCancelled(true);
} else {
@ -3216,6 +3225,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.getCurrentItem().setAmount(2);
}
CubeType cubetype;
if (ev.getCurrentItem().getItemMeta().getDisplayName().contains("Vacuum Cube")) {
cubetype=CubeType.VACUUM;
} else
if (ev.getCurrentItem().getItemMeta().getDisplayName().contains("Ender Item Cube")) {
cubetype=CubeType.ENDER;
} else if (ev.getCurrentItem().getItemMeta().getDisplayName().contains("Large Item Cube")) {
@ -3927,6 +3939,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (ev.getCurrentItem().getType()==Material.CHEST) {
clicked_size=9;
cubetype=CubeType.NORMAL;
} else {
if (CustomItem.isVacuumCube(ev.getCurrentItem())) {
clicked_size=54;
} else {
clicked_size=27;
if (ev.getCurrentItem().getType()==Material.STORAGE_MINECART) {
@ -3935,6 +3950,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
cubetype=CubeType.ENDER;
}
}
}
//See if we're looking at an Item Cube inventory already.
if (((PlayerStructure)playerdata.get(ev.getWhoClicked().getUniqueId())).isViewingItemCube && ev.getInventory().getTitle().contains("Item Cube")) {
@ -4074,9 +4090,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
int inventory_size;
if (ev.getCurrentItem().getType()==Material.CHEST) {
inventory_size=9;
} else {
if (CustomItem.isVacuumCube(ev.getCurrentItem())) {
inventory_size=54;
} else {
inventory_size=27;
}
}
final PlayerStructure pd2 = pd;
if (!ItemCube.isSomeoneViewingItemCube(idnumb,p)) {
log("Attempting to open",5);
@ -6745,11 +6765,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
config = new File(TwosideKeeper.filesave,"itemcubes/ItemCube"+id+".data");
FileConfiguration workable = YamlConfiguration.loadConfiguration(config);
for (int i=0;i<27;i++) {
for (int i=0;i<54;i++) {
ItemCube_items.add(workable.getItemStack("item"+i, new ItemStack(Material.AIR)));
}
return ItemCube_items;
}
public static CubeType itemCube_getCubeType(int id){
File config;
config = new File(TwosideKeeper.filesave,"itemcubes/ItemCube"+id+".data");
@ -6759,6 +6780,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
case 0:{return CubeType.NORMAL;}
case 1:{return CubeType.LARGE;}
case 2:{return CubeType.ENDER;}
case 3:{return CubeType.VACUUM;}
default:{return CubeType.NORMAL;}
}
}
@ -6792,6 +6814,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
case NORMAL:{workable.set("cubetype", 0);}break;
case LARGE:{workable.set("cubetype", 1);}break;
case ENDER:{workable.set("cubetype", 2);}break;
case VACUUM:{workable.set("cubetype", 3);}break;
}
try {
workable.save(config);

Loading…
Cancel
Save