mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 11:45:51 +00:00
Reduced technical debt
This commit is contained in:
parent
dc1cff31f5
commit
e0316453d9
@ -13,8 +13,8 @@ public class MultiBlock {
|
|||||||
|
|
||||||
public static List<MultiBlock> list = new ArrayList<>();
|
public static List<MultiBlock> list = new ArrayList<>();
|
||||||
|
|
||||||
Material[] blocks;
|
private Material[] blocks;
|
||||||
Material trigger;
|
private Material trigger;
|
||||||
|
|
||||||
public MultiBlock(Material[] build, Material trigger) {
|
public MultiBlock(Material[] build, Material trigger) {
|
||||||
this.blocks = build;
|
this.blocks = build;
|
||||||
|
@ -7,7 +7,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class DamagableChargableItem extends SlimefunItem {
|
public class DamagableChargableItem extends SlimefunItem {
|
||||||
|
|
||||||
String chargeType;
|
private String chargeType;
|
||||||
|
|
||||||
public DamagableChargableItem(Category category, ItemStack item, String id, RecipeType recipeType, ItemStack[] recipe, String chargeType) {
|
public DamagableChargableItem(Category category, ItemStack item, String id, RecipeType recipeType, ItemStack[] recipe, String chargeType) {
|
||||||
super(category, item, id, recipeType, recipe);
|
super(category, item, id, recipeType, recipe);
|
||||||
@ -19,6 +19,8 @@ public class DamagableChargableItem extends SlimefunItem {
|
|||||||
this.chargeType = chargeType;
|
this.chargeType = chargeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getChargeType() { return this.chargeType; }
|
public String getChargeType() {
|
||||||
|
return this.chargeType;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,21 @@
|
|||||||
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem;
|
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem;
|
||||||
|
|
||||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
import java.util.Random;
|
||||||
import me.mrCookieSlime.Slimefun.SlimefunStartup;
|
|
||||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
|
||||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
|
||||||
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker;
|
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Furnace;
|
import org.bukkit.block.Furnace;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||||
|
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||||
|
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||||
|
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker;
|
||||||
|
|
||||||
public class EnhancedFurnace extends SlimefunItem {
|
public class EnhancedFurnace extends SlimefunItem {
|
||||||
|
|
||||||
int speed, efficiency, fortune;
|
private int speed;
|
||||||
|
private int efficiency;
|
||||||
|
private int fortune;
|
||||||
|
|
||||||
public EnhancedFurnace(int speed, int efficiency, int fortune, ItemStack item, String id, ItemStack[] recipe) {
|
public EnhancedFurnace(int speed, int efficiency, int fortune, ItemStack item, String id, ItemStack[] recipe) {
|
||||||
super(Categories.MACHINES_1, item, id, RecipeType.ENHANCED_CRAFTING_TABLE, recipe);
|
super(Categories.MACHINES_1, item, id, RecipeType.ENHANCED_CRAFTING_TABLE, recipe);
|
||||||
@ -59,7 +62,7 @@ public class EnhancedFurnace extends SlimefunItem {
|
|||||||
|
|
||||||
public int getOutput() {
|
public int getOutput() {
|
||||||
int fortune = this.fortune;
|
int fortune = this.fortune;
|
||||||
fortune = SlimefunStartup.randomize(fortune + 2) - 1;
|
fortune = new Random().nextInt(fortune + 2) - 1;
|
||||||
if (fortune <= 0) fortune = 0;
|
if (fortune <= 0) fortune = 0;
|
||||||
fortune++;
|
fortune++;
|
||||||
return fortune;
|
return fortune;
|
||||||
|
@ -7,7 +7,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class JetBoots extends DamagableChargableItem {
|
public class JetBoots extends DamagableChargableItem {
|
||||||
|
|
||||||
double speed;
|
private double speed;
|
||||||
|
|
||||||
public JetBoots(ItemStack item, String id, ItemStack[] recipe, double speed) {
|
public JetBoots(ItemStack item, String id, ItemStack[] recipe, double speed) {
|
||||||
super(Categories.TECH, item, id, RecipeType.ENHANCED_CRAFTING_TABLE, recipe, "Jet Boots");
|
super(Categories.TECH, item, id, RecipeType.ENHANCED_CRAFTING_TABLE, recipe, "Jet Boots");
|
||||||
|
@ -7,7 +7,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class Jetpack extends DamagableChargableItem {
|
public class Jetpack extends DamagableChargableItem {
|
||||||
|
|
||||||
double thrust;
|
private double thrust;
|
||||||
|
|
||||||
public Jetpack(ItemStack item, String id, ItemStack[] recipe, double thrust) {
|
public Jetpack(ItemStack item, String id, ItemStack[] recipe, double thrust) {
|
||||||
super(Categories.TECH, item, id, RecipeType.ENHANCED_CRAFTING_TABLE, recipe, "Jetpack");
|
super(Categories.TECH, item, id, RecipeType.ENHANCED_CRAFTING_TABLE, recipe, "Jetpack");
|
||||||
|
@ -11,7 +11,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class MultiTool extends DamagableChargableItem {
|
public class MultiTool extends DamagableChargableItem {
|
||||||
|
|
||||||
List<Integer> modes;
|
private List<Integer> modes;
|
||||||
|
|
||||||
public MultiTool(ItemStack item, String id, RecipeType recipeType, ItemStack[] recipe, String[] keys, Object[] values) {
|
public MultiTool(ItemStack item, String id, RecipeType recipeType, ItemStack[] recipe, String[] keys, Object[] values) {
|
||||||
super(Categories.TECH, item, id, recipeType, recipe, "Multi Tool", keys, values);
|
super(Categories.TECH, item, id, recipeType, recipe, "Multi Tool", keys, values);
|
||||||
@ -19,7 +19,7 @@ public class MultiTool extends DamagableChargableItem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
List<Integer> list = new ArrayList<Integer>();
|
List<Integer> list = new ArrayList<>();
|
||||||
for (int i = 0; i < 50; i++) {
|
for (int i = 0; i < 50; i++) {
|
||||||
if (Slimefun.getItemValue(this.getID(), "mode." + i + ".enabled") != null) {
|
if (Slimefun.getItemValue(this.getID(), "mode." + i + ".enabled") != null) {
|
||||||
if ((Boolean) Slimefun.getItemValue(this.getID(), "mode." + i + ".enabled")) list.add(i);
|
if ((Boolean) Slimefun.getItemValue(this.getID(), "mode." + i + ".enabled")) list.add(i);
|
||||||
|
@ -8,7 +8,7 @@ import org.bukkit.potion.PotionEffect;
|
|||||||
|
|
||||||
public class SlimefunArmorPiece extends SlimefunItem {
|
public class SlimefunArmorPiece extends SlimefunItem {
|
||||||
|
|
||||||
PotionEffect[] effects;
|
private PotionEffect[] effects;
|
||||||
|
|
||||||
public SlimefunArmorPiece(Category category, ItemStack item, String id, RecipeType recipeType, ItemStack[] recipe, PotionEffect[] effects) {
|
public SlimefunArmorPiece(Category category, ItemStack item, String id, RecipeType recipeType, ItemStack[] recipe, PotionEffect[] effects) {
|
||||||
super(category, item, id, recipeType, recipe);
|
super(category, item, id, recipeType, recipe);
|
||||||
@ -20,6 +20,8 @@ public class SlimefunArmorPiece extends SlimefunItem {
|
|||||||
this.effects = effects;
|
this.effects = effects;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PotionEffect[] getEffects() { return this.effects; }
|
public PotionEffect[] getEffects() {
|
||||||
|
return this.effects;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,13 +10,15 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class SlimefunGadget extends SlimefunItem {
|
public class SlimefunGadget extends SlimefunItem {
|
||||||
|
|
||||||
List<ItemStack[]> recipes;
|
private List<ItemStack[]> recipes;
|
||||||
List<ItemStack> display_recipes;
|
private List<ItemStack> display_recipes;
|
||||||
|
|
||||||
public SlimefunGadget(Category category, ItemStack item, String id, RecipeType recipeType, ItemStack[] recipe, ItemStack[] machineRecipes) {
|
public SlimefunGadget(Category category, ItemStack item, String id, RecipeType recipeType, ItemStack[] recipe, ItemStack[] machineRecipes) {
|
||||||
super(category, item, id, recipeType, recipe);
|
super(category, item, id, recipeType, recipe);
|
||||||
this.recipes = new ArrayList<ItemStack[]>();
|
|
||||||
this.display_recipes = new ArrayList<ItemStack>();
|
this.recipes = new ArrayList<>();
|
||||||
|
this.display_recipes = new ArrayList<>();
|
||||||
|
|
||||||
for (ItemStack i: machineRecipes) {
|
for (ItemStack i: machineRecipes) {
|
||||||
this.recipes.add(new ItemStack[] {i});
|
this.recipes.add(new ItemStack[] {i});
|
||||||
this.display_recipes.add(i);
|
this.display_recipes.add(i);
|
||||||
@ -25,8 +27,9 @@ public class SlimefunGadget extends SlimefunItem {
|
|||||||
|
|
||||||
public SlimefunGadget(Category category, ItemStack item, String id, RecipeType recipeType, ItemStack[] recipe, ItemStack[] machineRecipes, String[] keys, Object[] values) {
|
public SlimefunGadget(Category category, ItemStack item, String id, RecipeType recipeType, ItemStack[] recipe, ItemStack[] machineRecipes, String[] keys, Object[] values) {
|
||||||
super(category, item, id, recipeType, recipe, keys, values);
|
super(category, item, id, recipeType, recipe, keys, values);
|
||||||
this.recipes = new ArrayList<ItemStack[]>();
|
this.recipes = new ArrayList<>();
|
||||||
this.display_recipes = new ArrayList<ItemStack>();
|
this.display_recipes = new ArrayList<>();
|
||||||
|
|
||||||
for (ItemStack i: machineRecipes) {
|
for (ItemStack i: machineRecipes) {
|
||||||
this.recipes.add(new ItemStack[] {i});
|
this.recipes.add(new ItemStack[] {i});
|
||||||
this.display_recipes.add(i);
|
this.display_recipes.add(i);
|
||||||
|
@ -349,7 +349,7 @@ public class SlimefunItem {
|
|||||||
if (recipeType.toItem().isSimilar(RecipeType.MOB_DROP.toItem())) {
|
if (recipeType.toItem().isSimilar(RecipeType.MOB_DROP.toItem())) {
|
||||||
try {
|
try {
|
||||||
EntityType entity = EntityType.valueOf(ChatColor.stripColor(recipe[4].getItemMeta().getDisplayName()).toUpperCase().replace(" ", "_"));
|
EntityType entity = EntityType.valueOf(ChatColor.stripColor(recipe[4].getItemMeta().getDisplayName()).toUpperCase().replace(" ", "_"));
|
||||||
List<ItemStack> dropping = new ArrayList<ItemStack>();
|
List<ItemStack> dropping = new ArrayList<>();
|
||||||
if (SlimefunManager.drops.containsKey(entity)) dropping = SlimefunManager.drops.get(entity);
|
if (SlimefunManager.drops.containsKey(entity)) dropping = SlimefunManager.drops.get(entity);
|
||||||
dropping.add(output);
|
dropping.add(output);
|
||||||
SlimefunManager.drops.put(entity, dropping);
|
SlimefunManager.drops.put(entity, dropping);
|
||||||
|
@ -255,8 +255,8 @@ public abstract class AContainer extends SlimefunItem {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MachineRecipe r = null;
|
MachineRecipe r = null;
|
||||||
Map<Integer, Integer> found = new HashMap<Integer, Integer>();
|
Map<Integer, Integer> found = new HashMap<>();
|
||||||
outer:
|
|
||||||
for (MachineRecipe recipe: recipes) {
|
for (MachineRecipe recipe: recipes) {
|
||||||
for (ItemStack input: recipe.getInput()) {
|
for (ItemStack input: recipe.getInput()) {
|
||||||
slots:
|
slots:
|
||||||
@ -269,7 +269,7 @@ public abstract class AContainer extends SlimefunItem {
|
|||||||
}
|
}
|
||||||
if (found.size() == recipe.getInput().length) {
|
if (found.size() == recipe.getInput().length) {
|
||||||
r = recipe;
|
r = recipe;
|
||||||
break outer;
|
break;
|
||||||
}
|
}
|
||||||
else found.clear();
|
else found.clear();
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ public abstract class ADrill extends AContainer {
|
|||||||
ItemMeta im = item.getItemMeta();
|
ItemMeta im = item.getItemMeta();
|
||||||
((Damageable) im).setDamage(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
|
((Damageable) im).setDamage(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
|
||||||
im.setDisplayName(" ");
|
im.setDisplayName(" ");
|
||||||
List<String> lore = new ArrayList<String>();
|
List<String> lore = new ArrayList<>();
|
||||||
lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
|
lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
|
||||||
lore.add("");
|
lore.add("");
|
||||||
lore.add(MachineHelper.getTimeLeft(timeleft / 2));
|
lore.add(MachineHelper.getTimeLeft(timeleft / 2));
|
||||||
|
@ -6,6 +6,7 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -264,7 +265,7 @@ public abstract class AReactor extends SlimefunItem {
|
|||||||
public void register(boolean slimefun) {
|
public void register(boolean slimefun) {
|
||||||
addItemHandler(new EnergyTicker() {
|
addItemHandler(new EnergyTicker() {
|
||||||
|
|
||||||
Set<Location> explode = new HashSet<Location>();
|
private Set<Location> explode = new HashSet<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double generateEnergy(final Location l, SlimefunItem sf, Config data) {
|
public double generateEnergy(final Location l, SlimefunItem sf, Config data) {
|
||||||
@ -284,13 +285,13 @@ public abstract class AReactor extends SlimefunItem {
|
|||||||
progress.put(l, timeleft - 1);
|
progress.put(l, timeleft - 1);
|
||||||
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, () -> {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, () -> {
|
||||||
if (!l.getBlock().getRelative(cooling[CSCoreLib.randomizer().nextInt(cooling.length)]).isLiquid()) explode.add(l);
|
if (!l.getBlock().getRelative(cooling[new Random().nextInt(cooling.length)]).isLiquid()) explode.add(l);
|
||||||
});
|
});
|
||||||
|
|
||||||
ItemStack item = getProgressBar().clone();
|
ItemStack item = getProgressBar().clone();
|
||||||
ItemMeta im = item.getItemMeta();
|
ItemMeta im = item.getItemMeta();
|
||||||
im.setDisplayName(" ");
|
im.setDisplayName(" ");
|
||||||
List<String> lore = new ArrayList<String>();
|
List<String> lore = new ArrayList<>();
|
||||||
lore.add(MachineHelper.getProgress(timeleft, processing.get(l).getTicks()));
|
lore.add(MachineHelper.getProgress(timeleft, processing.get(l).getTicks()));
|
||||||
lore.add(MachineHelper.getCoolant(timeleft, processing.get(l).getTicks()));
|
lore.add(MachineHelper.getCoolant(timeleft, processing.get(l).getTicks()));
|
||||||
lore.add("");
|
lore.add("");
|
||||||
@ -353,7 +354,7 @@ public abstract class AReactor extends SlimefunItem {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MachineFuel r = null;
|
MachineFuel r = null;
|
||||||
Map<Integer, Integer> found = new HashMap<Integer, Integer>();
|
Map<Integer, Integer> found = new HashMap<>();
|
||||||
|
|
||||||
if (port != null) {
|
if (port != null) {
|
||||||
refill:
|
refill:
|
||||||
@ -384,6 +385,7 @@ public abstract class AReactor extends SlimefunItem {
|
|||||||
for (Map.Entry<Integer, Integer> entry: found.entrySet()) {
|
for (Map.Entry<Integer, Integer> entry: found.entrySet()) {
|
||||||
BlockStorage.getInventory(l).replaceExistingItem(entry.getKey(), InvUtils.decreaseItem(BlockStorage.getInventory(l).getItemInSlot(entry.getKey()), entry.getValue()));
|
BlockStorage.getInventory(l).replaceExistingItem(entry.getKey(), InvUtils.decreaseItem(BlockStorage.getInventory(l).getItemInSlot(entry.getKey()), entry.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
processing.put(l, r);
|
processing.put(l, r);
|
||||||
progress.put(l, r.getTicks());
|
progress.put(l, r.getTicks());
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,9 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class MachineRecipe {
|
public class MachineRecipe {
|
||||||
|
|
||||||
int ticks;
|
private int ticks;
|
||||||
ItemStack[] input;
|
private ItemStack[] input;
|
||||||
ItemStack[] output;
|
private ItemStack[] output;
|
||||||
|
|
||||||
public MachineRecipe(int seconds, ItemStack[] input, ItemStack[] output) {
|
public MachineRecipe(int seconds, ItemStack[] input, ItemStack[] output) {
|
||||||
this.ticks = seconds * 2;
|
this.ticks = seconds * 2;
|
||||||
|
@ -61,7 +61,7 @@ public abstract class AutoAnvil extends AContainer {
|
|||||||
ItemMeta im = item.getItemMeta();
|
ItemMeta im = item.getItemMeta();
|
||||||
((Damageable) im).setDamage(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
|
((Damageable) im).setDamage(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
|
||||||
im.setDisplayName(" ");
|
im.setDisplayName(" ");
|
||||||
List<String> lore = new ArrayList<String>();
|
List<String> lore = new ArrayList<>();
|
||||||
lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
|
lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
|
||||||
lore.add("");
|
lore.add("");
|
||||||
lore.add(MachineHelper.getTimeLeft(timeleft / 2));
|
lore.add(MachineHelper.getTimeLeft(timeleft / 2));
|
||||||
|
@ -62,7 +62,7 @@ public class AutoDisenchanter extends AContainer {
|
|||||||
ItemMeta im = item.getItemMeta();
|
ItemMeta im = item.getItemMeta();
|
||||||
((Damageable) im).setDamage(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
|
((Damageable) im).setDamage(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
|
||||||
im.setDisplayName(" ");
|
im.setDisplayName(" ");
|
||||||
List<String> lore = new ArrayList<String>();
|
List<String> lore = new ArrayList<>();
|
||||||
lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
|
lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
|
||||||
lore.add("");
|
lore.add("");
|
||||||
lore.add(MachineHelper.getTimeLeft(timeleft / 2));
|
lore.add(MachineHelper.getTimeLeft(timeleft / 2));
|
||||||
@ -88,8 +88,8 @@ public class AutoDisenchanter extends AContainer {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MachineRecipe r = null;
|
MachineRecipe r = null;
|
||||||
Map<Enchantment, Integer> enchantments = new HashMap<Enchantment, Integer>();
|
Map<Enchantment, Integer> enchantments = new HashMap<>();
|
||||||
Set<ItemEnchantment> enchantments2 = new HashSet<ItemEnchantment>();
|
Set<ItemEnchantment> enchantments2 = new HashSet<>();
|
||||||
slots:
|
slots:
|
||||||
for (int slot: getInputSlots()) {
|
for (int slot: getInputSlots()) {
|
||||||
ItemStack target = BlockStorage.getInventory(b).getItemInSlot(slot == getInputSlots()[0] ? getInputSlots()[1]: getInputSlots()[0]);
|
ItemStack target = BlockStorage.getInventory(b).getItemInSlot(slot == getInputSlots()[0] ? getInputSlots()[1]: getInputSlots()[0]);
|
||||||
|
@ -64,7 +64,7 @@ public class AutoEnchanter extends AContainer {
|
|||||||
ItemMeta im = item.getItemMeta();
|
ItemMeta im = item.getItemMeta();
|
||||||
((Damageable) im).setDamage(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
|
((Damageable) im).setDamage(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
|
||||||
im.setDisplayName(" ");
|
im.setDisplayName(" ");
|
||||||
List<String> lore = new ArrayList<String>();
|
List<String> lore = new ArrayList<>();
|
||||||
lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
|
lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
|
||||||
lore.add("");
|
lore.add("");
|
||||||
lore.add(MachineHelper.getTimeLeft(timeleft / 2));
|
lore.add(MachineHelper.getTimeLeft(timeleft / 2));
|
||||||
@ -101,8 +101,8 @@ public class AutoEnchanter extends AContainer {
|
|||||||
|
|
||||||
// Enchant
|
// Enchant
|
||||||
if (item != null && item.getType() == Material.ENCHANTED_BOOK && target != null) {
|
if (item != null && item.getType() == Material.ENCHANTED_BOOK && target != null) {
|
||||||
Map<Enchantment, Integer> enchantments = new HashMap<Enchantment, Integer>();
|
Map<Enchantment, Integer> enchantments = new HashMap<>();
|
||||||
Set<ItemEnchantment> enchantments2 = new HashSet<ItemEnchantment>();
|
Set<ItemEnchantment> enchantments2 = new HashSet<>();
|
||||||
int amount = 0;
|
int amount = 0;
|
||||||
int special_amount = 0;
|
int special_amount = 0;
|
||||||
EnchantmentStorageMeta meta = (EnchantmentStorageMeta) item.getItemMeta();
|
EnchantmentStorageMeta meta = (EnchantmentStorageMeta) item.getItemMeta();
|
||||||
|
@ -41,7 +41,7 @@ public abstract class AutomatedCraftingChamber extends SlimefunItem {
|
|||||||
private static final int[] border_in = {9, 10, 11, 12, 13, 18, 22, 27, 31, 36, 40, 45, 46, 47, 48, 49};
|
private static final int[] border_in = {9, 10, 11, 12, 13, 18, 22, 27, 31, 36, 40, 45, 46, 47, 48, 49};
|
||||||
private static final int[] border_out = {23, 24, 25, 26, 32, 35, 41, 42, 43, 44};
|
private static final int[] border_out = {23, 24, 25, 26, 32, 35, 41, 42, 43, 44};
|
||||||
|
|
||||||
public static Map<String, ItemStack> recipes = new HashMap<String, ItemStack>();
|
public static Map<String, ItemStack> recipes = new HashMap<>();
|
||||||
|
|
||||||
public AutomatedCraftingChamber(Category category, ItemStack item, String name, RecipeType recipeType, ItemStack[] recipe) {
|
public AutomatedCraftingChamber(Category category, ItemStack item, String name, RecipeType recipeType, ItemStack[] recipe) {
|
||||||
super(category, item, name, recipeType, recipe);
|
super(category, item, name, recipeType, recipe);
|
||||||
|
@ -32,7 +32,7 @@ public abstract class CropGrowthAccelerator extends SlimefunItem {
|
|||||||
|
|
||||||
private static final int[] border = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26};
|
private static final int[] border = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26};
|
||||||
|
|
||||||
public static final Map<Material, Integer> crops = new HashMap<Material, Integer>();
|
public static final Map<Material, Integer> crops = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
crops.put(Material.WHEAT, 7);
|
crops.put(Material.WHEAT, 7);
|
||||||
|
@ -51,7 +51,7 @@ public abstract class ElectricGoldPan extends AContainer {
|
|||||||
ItemMeta im = item.getItemMeta();
|
ItemMeta im = item.getItemMeta();
|
||||||
((Damageable) im).setDamage(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
|
((Damageable) im).setDamage(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
|
||||||
im.setDisplayName(" ");
|
im.setDisplayName(" ");
|
||||||
List<String> lore = new ArrayList<String>();
|
List<String> lore = new ArrayList<>();
|
||||||
lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
|
lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
|
||||||
lore.add("");
|
lore.add("");
|
||||||
lore.add(MachineHelper.getTimeLeft(timeleft / 2));
|
lore.add(MachineHelper.getTimeLeft(timeleft / 2));
|
||||||
|
@ -36,8 +36,8 @@ import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
|
|||||||
|
|
||||||
public class FluidPump extends SlimefunItem{
|
public class FluidPump extends SlimefunItem{
|
||||||
|
|
||||||
public static Map<Block, MachineRecipe> processing = new HashMap<Block, MachineRecipe>();
|
public static Map<Block, MachineRecipe> processing = new HashMap<>();
|
||||||
public static Map<Block, Integer> progress = new HashMap<Block, Integer>();
|
public static Map<Block, Integer> progress = new HashMap<>();
|
||||||
|
|
||||||
private static final int[] border = {0, 1, 2, 3, 4, 5, 6, 7, 8, 13, 31, 36, 37, 38, 39, 40, 41, 42, 43, 44, 22};
|
private static final int[] border = {0, 1, 2, 3, 4, 5, 6, 7, 8, 13, 31, 36, 37, 38, 39, 40, 41, 42, 43, 44, 22};
|
||||||
private static final int[] border_in = {9, 10, 11, 12, 18, 21, 27, 28, 29, 30};
|
private static final int[] border_in = {9, 10, 11, 12, 18, 21, 27, 28, 29, 30};
|
||||||
@ -124,13 +124,13 @@ public class FluidPump extends SlimefunItem{
|
|||||||
|
|
||||||
ItemStack output = new ItemStack(Material.LAVA_BUCKET);
|
ItemStack output = new ItemStack(Material.LAVA_BUCKET);
|
||||||
|
|
||||||
if (!fits(b, new ItemStack[] {output})) return;
|
if (!fits(b, output)) return;
|
||||||
|
|
||||||
ChargableBlock.addCharge(b, -getEnergyConsumption());
|
ChargableBlock.addCharge(b, -getEnergyConsumption());
|
||||||
BlockStorage.getInventory(b).replaceExistingItem(slot, InvUtils.decreaseItem(BlockStorage.getInventory(b).getItemInSlot(slot), 1));
|
BlockStorage.getInventory(b).replaceExistingItem(slot, InvUtils.decreaseItem(BlockStorage.getInventory(b).getItemInSlot(slot), 1));
|
||||||
pushItems(b, new ItemStack[] {output});
|
pushItems(b, output);
|
||||||
|
|
||||||
List<Location> list = new ArrayList<Location>();
|
List<Location> list = new ArrayList<>();
|
||||||
list.add(fluid.getLocation());
|
list.add(fluid.getLocation());
|
||||||
Vein.calculate(fluid.getLocation(), fluid.getLocation(), list, 64);
|
Vein.calculate(fluid.getLocation(), fluid.getLocation(), list, 64);
|
||||||
list.get(list.size() - 1).getBlock().setType(Material.AIR);
|
list.get(list.size() - 1).getBlock().setType(Material.AIR);
|
||||||
@ -146,11 +146,11 @@ public class FluidPump extends SlimefunItem{
|
|||||||
|
|
||||||
ItemStack output = new ItemStack(Material.WATER_BUCKET);
|
ItemStack output = new ItemStack(Material.WATER_BUCKET);
|
||||||
|
|
||||||
if (!fits(b, new ItemStack[] {output})) return;
|
if (!fits(b, output)) return;
|
||||||
|
|
||||||
ChargableBlock.addCharge(b, -getEnergyConsumption());
|
ChargableBlock.addCharge(b, -getEnergyConsumption());
|
||||||
BlockStorage.getInventory(b).replaceExistingItem(slot, InvUtils.decreaseItem(BlockStorage.getInventory(b).getItemInSlot(slot), 1));
|
BlockStorage.getInventory(b).replaceExistingItem(slot, InvUtils.decreaseItem(BlockStorage.getInventory(b).getItemInSlot(slot), 1));
|
||||||
pushItems(b, new ItemStack[] {output});
|
pushItems(b, output);
|
||||||
|
|
||||||
fluid.setType(Material.AIR);
|
fluid.setType(Material.AIR);
|
||||||
|
|
||||||
@ -198,11 +198,11 @@ public class FluidPump extends SlimefunItem{
|
|||||||
return inv;
|
return inv;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean fits(Block b, ItemStack[] items) {
|
protected boolean fits(Block b, ItemStack... items) {
|
||||||
return inject(b).addItem(items).isEmpty();
|
return inject(b).addItem(items).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void pushItems(Block b, ItemStack[] items) {
|
protected void pushItems(Block b, ItemStack... items) {
|
||||||
Inventory inv = inject(b);
|
Inventory inv = inject(b);
|
||||||
inv.addItem(items);
|
inv.addItem(items);
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ public abstract class HeatedPressureChamber extends AContainer {
|
|||||||
public int[] getSlotsAccessedByItemTransport(BlockMenu menu, ItemTransportFlow flow, ItemStack item) {
|
public int[] getSlotsAccessedByItemTransport(BlockMenu menu, ItemTransportFlow flow, ItemStack item) {
|
||||||
if (flow.equals(ItemTransportFlow.WITHDRAW)) return getOutputSlots();
|
if (flow.equals(ItemTransportFlow.WITHDRAW)) return getOutputSlots();
|
||||||
|
|
||||||
List<Integer> slots = new ArrayList<Integer>();
|
List<Integer> slots = new ArrayList<>();
|
||||||
|
|
||||||
for (int slot: getInputSlots()) {
|
for (int slot: getInputSlots()) {
|
||||||
if (SlimefunManager.isItemSimiliar(menu.getItemInSlot(slot), item, true)) {
|
if (SlimefunManager.isItemSimiliar(menu.getItemInSlot(slot), item, true)) {
|
||||||
@ -98,8 +98,8 @@ public abstract class HeatedPressureChamber extends AContainer {
|
|||||||
registerRecipe(30, new ItemStack[] {SlimefunItems.BLISTERING_INGOT, SlimefunItems.CARBONADO}, new ItemStack[] {SlimefunItems.BLISTERING_INGOT_2});
|
registerRecipe(30, new ItemStack[] {SlimefunItems.BLISTERING_INGOT, SlimefunItems.CARBONADO}, new ItemStack[] {SlimefunItems.BLISTERING_INGOT_2});
|
||||||
registerRecipe(60, new ItemStack[] {SlimefunItems.BLISTERING_INGOT_2, new ItemStack(Material.NETHER_STAR)}, new ItemStack[] {SlimefunItems.BLISTERING_INGOT_3});
|
registerRecipe(60, new ItemStack[] {SlimefunItems.BLISTERING_INGOT_2, new ItemStack(Material.NETHER_STAR)}, new ItemStack[] {SlimefunItems.BLISTERING_INGOT_3});
|
||||||
registerRecipe(90, new ItemStack[] {SlimefunItems.PLUTONIUM, SlimefunItems.URANIUM}, new ItemStack[] {SlimefunItems.BOOSTED_URANIUM});
|
registerRecipe(90, new ItemStack[] {SlimefunItems.PLUTONIUM, SlimefunItems.URANIUM}, new ItemStack[] {SlimefunItems.BOOSTED_URANIUM});
|
||||||
registerRecipe(60, new ItemStack[]{SlimefunItems.NETHER_ICE, SlimefunItems.PLUTONIUM}, new ItemStack[]{new CustomItem(SlimefunItems.ENRICHED_NETHER_ICE, 4)});
|
registerRecipe(60, new ItemStack[] {SlimefunItems.NETHER_ICE, SlimefunItems.PLUTONIUM}, new ItemStack[]{new CustomItem(SlimefunItems.ENRICHED_NETHER_ICE, 4)});
|
||||||
registerRecipe(45, new ItemStack[]{SlimefunItems.ENRICHED_NETHER_ICE}, new ItemStack[]{new CustomItem(SlimefunItems.NETHER_ICE_COOLANT_CELL, 8)});
|
registerRecipe(45, new ItemStack[] {SlimefunItems.ENRICHED_NETHER_ICE}, new ItemStack[]{new CustomItem(SlimefunItems.NETHER_ICE_COOLANT_CELL, 8)});
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInventoryTitle() {
|
public String getInventoryTitle() {
|
||||||
@ -148,7 +148,7 @@ public abstract class HeatedPressureChamber extends AContainer {
|
|||||||
ItemMeta im = item.getItemMeta();
|
ItemMeta im = item.getItemMeta();
|
||||||
im.setDisplayName(" ");
|
im.setDisplayName(" ");
|
||||||
((Damageable) im).setDamage(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
|
((Damageable) im).setDamage(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
|
||||||
List<String> lore = new ArrayList<String>();
|
List<String> lore = new ArrayList<>();
|
||||||
lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
|
lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
|
||||||
lore.add("");
|
lore.add("");
|
||||||
lore.add(MachineHelper.getTimeLeft(timeleft / 2));
|
lore.add(MachineHelper.getTimeLeft(timeleft / 2));
|
||||||
@ -174,8 +174,8 @@ public abstract class HeatedPressureChamber extends AContainer {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MachineRecipe r = null;
|
MachineRecipe r = null;
|
||||||
Map<Integer, Integer> found = new HashMap<Integer, Integer>();
|
Map<Integer, Integer> found = new HashMap<>();
|
||||||
outer:
|
|
||||||
for (MachineRecipe recipe: recipes) {
|
for (MachineRecipe recipe: recipes) {
|
||||||
for (ItemStack input: recipe.getInput()) {
|
for (ItemStack input: recipe.getInput()) {
|
||||||
slots:
|
slots:
|
||||||
@ -188,7 +188,7 @@ public abstract class HeatedPressureChamber extends AContainer {
|
|||||||
}
|
}
|
||||||
if (found.size() == recipe.getInput().length) {
|
if (found.size() == recipe.getInput().length) {
|
||||||
r = recipe;
|
r = recipe;
|
||||||
break outer;
|
break;
|
||||||
}
|
}
|
||||||
else found.clear();
|
else found.clear();
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ public abstract class OilPump extends AContainer {
|
|||||||
ItemMeta im = item.getItemMeta();
|
ItemMeta im = item.getItemMeta();
|
||||||
((Damageable) im).setDamage(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
|
((Damageable) im).setDamage(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
|
||||||
im.setDisplayName(" ");
|
im.setDisplayName(" ");
|
||||||
List<String> lore = new ArrayList<String>();
|
List<String> lore = new ArrayList<>();
|
||||||
lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
|
lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
|
||||||
lore.add("");
|
lore.add("");
|
||||||
lore.add(MachineHelper.getTimeLeft(timeleft / 2));
|
lore.add(MachineHelper.getTimeLeft(timeleft / 2));
|
||||||
|
@ -53,7 +53,7 @@ public abstract class Refinery extends AContainer {
|
|||||||
ItemMeta im = item.getItemMeta();
|
ItemMeta im = item.getItemMeta();
|
||||||
((Damageable) im).setDamage(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
|
((Damageable) im).setDamage(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
|
||||||
im.setDisplayName(" ");
|
im.setDisplayName(" ");
|
||||||
List<String> lore = new ArrayList<String>();
|
List<String> lore = new ArrayList<>();
|
||||||
lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
|
lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
|
||||||
lore.add("");
|
lore.add("");
|
||||||
lore.add(MachineHelper.getTimeLeft(timeleft / 2));
|
lore.add(MachineHelper.getTimeLeft(timeleft / 2));
|
||||||
|
@ -34,19 +34,20 @@ public final class Files {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void delete(File folder) {
|
public static boolean delete(File folder) {
|
||||||
File[] files = folder.listFiles();
|
File[] files = folder.listFiles();
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
for (File current: files) {
|
for (File current: files) {
|
||||||
if (current.isDirectory()) {
|
if (current.isDirectory()) {
|
||||||
delete(current);
|
if (!delete(current)) return false;;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
current.delete();
|
if (!current.delete()) return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
folder.delete();
|
|
||||||
|
return folder.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1196,7 +1196,7 @@ public final class SlimefunSetup {
|
|||||||
public boolean onBlockBreak(BlockBreakEvent e, ItemStack item, int fortune, List<ItemStack> drops) {
|
public boolean onBlockBreak(BlockBreakEvent e, ItemStack item, int fortune, List<ItemStack> drops) {
|
||||||
if (SlimefunManager.isItemSimiliar(e.getPlayer().getInventory().getItemInMainHand(), SlimefunItems.LUMBER_AXE, true)) {
|
if (SlimefunManager.isItemSimiliar(e.getPlayer().getInventory().getItemInMainHand(), SlimefunItems.LUMBER_AXE, true)) {
|
||||||
if (MaterialHelper.isLog( e.getBlock().getType())) {
|
if (MaterialHelper.isLog( e.getBlock().getType())) {
|
||||||
List<Location> logs = new ArrayList<Location>();
|
List<Location> logs = new ArrayList<>();
|
||||||
TreeCalculator.getTree(e.getBlock().getLocation(), e.getBlock().getLocation(), logs);
|
TreeCalculator.getTree(e.getBlock().getLocation(), e.getBlock().getLocation(), logs);
|
||||||
|
|
||||||
if (logs.contains(e.getBlock().getLocation())) logs.remove(e.getBlock().getLocation());
|
if (logs.contains(e.getBlock().getLocation())) logs.remove(e.getBlock().getLocation());
|
||||||
@ -1541,9 +1541,10 @@ public final class SlimefunSetup {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Chest chest = (Chest) chestBlock.getState();
|
Chest chest = (Chest) chestBlock.getState();
|
||||||
final Inventory inv = chest.getInventory();
|
final Inventory inv = chest.getInventory();
|
||||||
List<Location> ores = new ArrayList<Location>();
|
List<Location> ores = new ArrayList<>();
|
||||||
|
|
||||||
for (int x = b.getX() - 4; x <= b.getX() + 4; x++) {
|
for (int x = b.getX() - 4; x <= b.getX() + 4; x++) {
|
||||||
for (int z = b.getZ() - 4; z <= b.getZ() + 4; z++) {
|
for (int z = b.getZ() - 4; z <= b.getZ() + 4; z++) {
|
||||||
for (int y = b.getY(); y > 0; y--) {
|
for (int y = b.getY(); y > 0; y--) {
|
||||||
@ -1599,9 +1600,10 @@ public final class SlimefunSetup {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Chest chest = (Chest) chestBlock.getState();
|
Chest chest = (Chest) chestBlock.getState();
|
||||||
final Inventory inv = chest.getInventory();
|
final Inventory inv = chest.getInventory();
|
||||||
List<Location> ores = new ArrayList<Location>();
|
List<Location> ores = new ArrayList<>();
|
||||||
|
|
||||||
for (int x = b.getX() - 6; x <= b.getX() + 6; x++) {
|
for (int x = b.getX() - 6; x <= b.getX() + 6; x++) {
|
||||||
for (int z = b.getZ() - 6; z <= b.getZ() + 6; z++) {
|
for (int z = b.getZ() - 6; z <= b.getZ() + 6; z++) {
|
||||||
for (int y = b.getY(); y > 0; y--) {
|
for (int y = b.getY(); y > 0; y--) {
|
||||||
@ -1789,15 +1791,19 @@ public final class SlimefunSetup {
|
|||||||
new ItemStack[] {new ItemStack(Material.GRAVEL), new ItemStack(Material.FLINT), new ItemStack(Material.GRAVEL), new ItemStack(Material.CLAY_BALL), new ItemStack(Material.GRAVEL), SlimefunItems.SIFTED_ORE}, Material.OAK_TRAPDOOR)
|
new ItemStack[] {new ItemStack(Material.GRAVEL), new ItemStack(Material.FLINT), new ItemStack(Material.GRAVEL), new ItemStack(Material.CLAY_BALL), new ItemStack(Material.GRAVEL), SlimefunItems.SIFTED_ORE}, Material.OAK_TRAPDOOR)
|
||||||
.register(true, new MultiBlockInteractionHandler() {
|
.register(true, new MultiBlockInteractionHandler() {
|
||||||
|
|
||||||
|
private Random random = new Random();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onInteract(final Player p, MultiBlock mb, final Block b) {
|
public boolean onInteract(final Player p, MultiBlock mb, final Block b) {
|
||||||
if (mb.isMultiBlock(SlimefunItem.getByID("AUTOMATED_PANNING_MACHINE"))) {
|
if (mb.isMultiBlock(SlimefunItem.getByID("AUTOMATED_PANNING_MACHINE"))) {
|
||||||
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
||||||
final ItemStack input = p.getInventory().getItemInMainHand();
|
final ItemStack input = p.getInventory().getItemInMainHand();
|
||||||
ItemStack output = null;
|
ItemStack output = null;
|
||||||
if (SlimefunStartup.chance(100, (Integer) Slimefun.getItemValue("GOLD_PAN", "chance.SIFTED_ORE"))) output = SlimefunItems.SIFTED_ORE;
|
|
||||||
else if (SlimefunStartup.chance(100, (Integer) Slimefun.getItemValue("GOLD_PAN", "chance.CLAY"))) output = new ItemStack(Material.CLAY_BALL);
|
if (random.nextInt(100) < (Integer) Slimefun.getItemValue("GOLD_PAN", "chance.SIFTED_ORE")) output = SlimefunItems.SIFTED_ORE;
|
||||||
else if (SlimefunStartup.chance(100, (Integer) Slimefun.getItemValue("GOLD_PAN", "chance.FLINT"))) output = new ItemStack(Material.FLINT);
|
else if (random.nextInt(100) < (Integer) Slimefun.getItemValue("GOLD_PAN", "chance.CLAY")) output = new ItemStack(Material.CLAY_BALL);
|
||||||
|
else if (random.nextInt(100) < (Integer) Slimefun.getItemValue("GOLD_PAN", "chance.FLINT")) output = new ItemStack(Material.FLINT);
|
||||||
|
|
||||||
final ItemStack drop = output;
|
final ItemStack drop = output;
|
||||||
if (input != null) {
|
if (input != null) {
|
||||||
if (input.getType() == Material.GRAVEL) {
|
if (input.getType() == Material.GRAVEL) {
|
||||||
@ -1815,6 +1821,7 @@ public final class SlimefunSetup {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Messages.local.sendTranslation(p, "machines.wrong-item", true);
|
Messages.local.sendTranslation(p, "machines.wrong-item", true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1864,7 +1871,7 @@ public final class SlimefunSetup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (e.getPlayer().getInventory().getItemInMainHand().getEnchantments().containsKey(Enchantment.DURABILITY)) {
|
if (e.getPlayer().getInventory().getItemInMainHand().getEnchantments().containsKey(Enchantment.DURABILITY)) {
|
||||||
if (SlimefunStartup.randomize(100) <= (60 + 40 / (e.getPlayer().getInventory().getItemInMainHand().getEnchantmentLevel(Enchantment.DURABILITY) + 1))) PlayerInventory.damageItemInHand(e.getPlayer());
|
if (new Random().nextInt(100) <= (60 + 40 / (e.getPlayer().getInventory().getItemInMainHand().getEnchantmentLevel(Enchantment.DURABILITY) + 1))) PlayerInventory.damageItemInHand(e.getPlayer());
|
||||||
}
|
}
|
||||||
else PlayerInventory.damageItemInHand(e.getPlayer());
|
else PlayerInventory.damageItemInHand(e.getPlayer());
|
||||||
|
|
||||||
@ -2108,7 +2115,7 @@ public final class SlimefunSetup {
|
|||||||
public boolean onBlockBreak(BlockBreakEvent e, ItemStack item, int fortune, List<ItemStack> drops) {
|
public boolean onBlockBreak(BlockBreakEvent e, ItemStack item, int fortune, List<ItemStack> drops) {
|
||||||
if (SlimefunManager.isItemSimiliar(e.getPlayer().getInventory().getItemInMainHand(), SlimefunItems.PICKAXE_OF_VEIN_MINING, true)) {
|
if (SlimefunManager.isItemSimiliar(e.getPlayer().getInventory().getItemInMainHand(), SlimefunItems.PICKAXE_OF_VEIN_MINING, true)) {
|
||||||
if (e.getBlock().getType().toString().endsWith("_ORE")) {
|
if (e.getBlock().getType().toString().endsWith("_ORE")) {
|
||||||
List<Location> blocks = new ArrayList<Location>();
|
List<Location> blocks = new ArrayList<>();
|
||||||
Vein.calculate(e.getBlock().getLocation(), e.getBlock().getLocation(), blocks, 16);
|
Vein.calculate(e.getBlock().getLocation(), e.getBlock().getLocation(), blocks, 16);
|
||||||
for (Location block: blocks) {
|
for (Location block: blocks) {
|
||||||
Block b = block.getBlock();
|
Block b = block.getBlock();
|
||||||
@ -2555,7 +2562,8 @@ public final class SlimefunSetup {
|
|||||||
PlayerInventory.consumeItemInHand(e.getPlayer());
|
PlayerInventory.consumeItemInHand(e.getPlayer());
|
||||||
FireworkShow.launchRandom(e.getPlayer(), 2);
|
FireworkShow.launchRandom(e.getPlayer(), 2);
|
||||||
|
|
||||||
List<ItemStack> gifts = new ArrayList<ItemStack>();
|
List<ItemStack> gifts = new ArrayList<>();
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
gifts.add(new CustomItem(SlimefunItems.EASTER_CARROT_PIE, 4));
|
gifts.add(new CustomItem(SlimefunItems.EASTER_CARROT_PIE, 4));
|
||||||
gifts.add(new CustomItem(SlimefunItems.CHRISTMAS_APPLE_PIE, 4));
|
gifts.add(new CustomItem(SlimefunItems.CHRISTMAS_APPLE_PIE, 4));
|
||||||
|
@ -289,10 +289,10 @@ public final class SlimefunGuide {
|
|||||||
clearHistory(p.getUniqueId());
|
clearHistory(p.getUniqueId());
|
||||||
|
|
||||||
if (book) {
|
if (book) {
|
||||||
List<TellRawMessage> pages = new ArrayList<TellRawMessage>();
|
List<TellRawMessage> pages = new ArrayList<>();
|
||||||
List<String> texts = new ArrayList<String>();
|
List<String> texts = new ArrayList<>();
|
||||||
List<String> tooltips = new ArrayList<String>();
|
List<String> tooltips = new ArrayList<>();
|
||||||
List<PlayerRunnable> actions = new ArrayList<PlayerRunnable>();
|
List<PlayerRunnable> actions = new ArrayList<>();
|
||||||
|
|
||||||
int tier = 0;
|
int tier = 0;
|
||||||
|
|
||||||
@ -501,7 +501,7 @@ public final class SlimefunGuide {
|
|||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
List<String> parents = new ArrayList<String>();
|
List<String> parents = new ArrayList<>();
|
||||||
parents.add("");
|
parents.add("");
|
||||||
parents.add(ChatColor.translateAlternateColorCodes('&', "&rYou need to unlock all Items"));
|
parents.add(ChatColor.translateAlternateColorCodes('&', "&rYou need to unlock all Items"));
|
||||||
parents.add(ChatColor.translateAlternateColorCodes('&', "&rfrom the following Categories first:"));
|
parents.add(ChatColor.translateAlternateColorCodes('&', "&rfrom the following Categories first:"));
|
||||||
@ -549,10 +549,10 @@ public final class SlimefunGuide {
|
|||||||
if (category == null) return;
|
if (category == null) return;
|
||||||
|
|
||||||
if (book && category.getItems().size() < 250) {
|
if (book && category.getItems().size() < 250) {
|
||||||
List<TellRawMessage> pages = new ArrayList<TellRawMessage>();
|
List<TellRawMessage> pages = new ArrayList<>();
|
||||||
List<String> texts = new ArrayList<String>();
|
List<String> texts = new ArrayList<>();
|
||||||
List<String> tooltips = new ArrayList<String>();
|
List<String> tooltips = new ArrayList<>();
|
||||||
List<PlayerRunnable> actions = new ArrayList<PlayerRunnable>();
|
List<PlayerRunnable> actions = new ArrayList<>();
|
||||||
|
|
||||||
for (final SlimefunItem item: category.getItems()) {
|
for (final SlimefunItem item: category.getItems()) {
|
||||||
if (Slimefun.hasPermission(p, item, false)) {
|
if (Slimefun.hasPermission(p, item, false)) {
|
||||||
|
@ -100,7 +100,7 @@ public class SlimefunStartup extends JavaPlugin {
|
|||||||
private boolean coreProtect = false;
|
private boolean coreProtect = false;
|
||||||
|
|
||||||
// Supported Versions of Minecraft
|
// Supported Versions of Minecraft
|
||||||
final String[] supported = {"v1_14_"};
|
private final String[] supported = {"v1_14_"};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
@ -4,8 +4,8 @@ import org.bukkit.block.Block;
|
|||||||
|
|
||||||
public class AndroidObject {
|
public class AndroidObject {
|
||||||
|
|
||||||
ProgrammableAndroid android;
|
private ProgrammableAndroid android;
|
||||||
Block b;
|
private Block b;
|
||||||
|
|
||||||
public AndroidObject(ProgrammableAndroid android, Block b) {
|
public AndroidObject(ProgrammableAndroid android, Block b) {
|
||||||
this.android = android;
|
this.android = android;
|
||||||
|
@ -273,80 +273,67 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
|
|||||||
ScriptPart part = ScriptPart.valueOf(script[index]);
|
ScriptPart part = ScriptPart.valueOf(script[index]);
|
||||||
|
|
||||||
if (getAndroidType().isType(part.getRequiredType())) {
|
if (getAndroidType().isType(part.getRequiredType())) {
|
||||||
|
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
|
||||||
|
double damage = getTier() < 2 ? 20D : 4D * getTier();
|
||||||
|
|
||||||
switch (part) {
|
switch (part) {
|
||||||
case GO_DOWN: {
|
case GO_DOWN:
|
||||||
try {
|
try {
|
||||||
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
|
|
||||||
Block block = b.getRelative(BlockFace.DOWN);
|
Block block = b.getRelative(BlockFace.DOWN);
|
||||||
move(b, face, block);
|
move(b, face, block);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
case GO_FORWARD:
|
||||||
case GO_FORWARD: {
|
|
||||||
try {
|
try {
|
||||||
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
|
|
||||||
Block block = b.getRelative(face);
|
Block block = b.getRelative(face);
|
||||||
move(b, face, block);
|
move(b, face, block);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
case GO_UP:
|
||||||
case GO_UP: {
|
|
||||||
try {
|
try {
|
||||||
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
|
|
||||||
Block block = b.getRelative(BlockFace.UP);
|
Block block = b.getRelative(BlockFace.UP);
|
||||||
move(b, face, block);
|
move(b, face, block);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
case REPEAT:
|
||||||
case REPEAT: {
|
|
||||||
BlockStorage.addBlockInfo(b, "index", String.valueOf(0));
|
BlockStorage.addBlockInfo(b, "index", String.valueOf(0));
|
||||||
break;
|
break;
|
||||||
}
|
case TURN_LEFT:
|
||||||
case TURN_LEFT: {
|
int indexLeft = directions.indexOf(BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"))) - 1;
|
||||||
int rotIndex = directions.indexOf(BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"))) - 1;
|
if (indexLeft < 0) indexLeft = directions.size() - 1;
|
||||||
if (rotIndex < 0) rotIndex = directions.size() - 1;
|
Rotatable rotatableLeft = (Rotatable) b.getBlockData();
|
||||||
BlockFace dir = directions.get(rotIndex);
|
rotatableLeft.setRotation(directions.get(indexLeft));
|
||||||
Rotatable blockData = (Rotatable) b.getBlockData();
|
b.setBlockData(rotatableLeft);
|
||||||
blockData.setRotation(dir);
|
BlockStorage.addBlockInfo(b, "rotation", directions.get(indexLeft).toString());
|
||||||
b.setBlockData(blockData);
|
|
||||||
BlockStorage.addBlockInfo(b, "rotation", dir.toString());
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case TURN_RIGHT: {
|
case TURN_RIGHT: {
|
||||||
int rotIndex = directions.indexOf(BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"))) + 1;
|
int indexRight = directions.indexOf(BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"))) + 1;
|
||||||
if (rotIndex == directions.size()) rotIndex = 0;
|
if (indexRight == directions.size()) indexRight = 0;
|
||||||
BlockFace dir = directions.get(rotIndex);
|
Rotatable rotatableRight = (Rotatable) b.getBlockData();
|
||||||
Rotatable blockData = (Rotatable) b.getBlockData();
|
rotatableRight.setRotation(directions.get(indexRight));
|
||||||
blockData.setRotation(dir);
|
b.setBlockData(rotatableRight);
|
||||||
b.setBlockData(blockData);
|
BlockStorage.addBlockInfo(b, "rotation", directions.get(indexRight).toString());
|
||||||
BlockStorage.addBlockInfo(b, "rotation", dir.toString());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DIG_FORWARD: {
|
case DIG_FORWARD:
|
||||||
Block block = b.getRelative(BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation")));
|
mine(b, b.getRelative(face));
|
||||||
mine(b, block);
|
|
||||||
break;
|
break;
|
||||||
}
|
case DIG_UP:
|
||||||
case DIG_UP: {
|
mine(b, b.getRelative(BlockFace.UP));
|
||||||
Block block = b.getRelative(BlockFace.UP);
|
|
||||||
mine(b, block);
|
|
||||||
break;
|
break;
|
||||||
}
|
case DIG_DOWN:
|
||||||
case DIG_DOWN: {
|
mine(b, b.getRelative(BlockFace.DOWN));
|
||||||
Block block = b.getRelative(BlockFace.DOWN);
|
|
||||||
mine(b, block);
|
|
||||||
break;
|
break;
|
||||||
}
|
case CATCH_FISH:
|
||||||
case CATCH_FISH: {
|
Block water = b.getRelative(BlockFace.DOWN);
|
||||||
Block block = b.getRelative(BlockFace.DOWN);
|
if (water.getType().equals(Material.WATER)) {
|
||||||
if (block.getType().equals(Material.WATER)) {
|
water.getWorld().playSound(water.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1F, 1F);
|
||||||
block.getWorld().playSound(block.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1F, 1F);
|
|
||||||
if (CSCoreLib.randomizer().nextInt(100) < 10 * getTier()) {
|
if (CSCoreLib.randomizer().nextInt(100) < 10 * getTier()) {
|
||||||
ItemStack drop = fish[CSCoreLib.randomizer().nextInt(fish.length)];
|
ItemStack drop = fish[CSCoreLib.randomizer().nextInt(fish.length)];
|
||||||
if (fits(b, drop)) pushItems(b, drop);
|
if (fits(b, drop)) pushItems(b, drop);
|
||||||
@ -354,30 +341,19 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
|
|||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
case MOVE_AND_DIG_FORWARD:
|
||||||
case MOVE_AND_DIG_FORWARD: {
|
movedig(b, face, b.getRelative(face));
|
||||||
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
|
|
||||||
Block block = b.getRelative(face);
|
|
||||||
movedig(b, face, block);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case MOVE_AND_DIG_UP: {
|
case MOVE_AND_DIG_UP: {
|
||||||
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
|
movedig(b, face, b.getRelative(BlockFace.UP));
|
||||||
Block block = b.getRelative(BlockFace.UP);
|
|
||||||
movedig(b, face, block);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MOVE_AND_DIG_DOWN: {
|
case MOVE_AND_DIG_DOWN:
|
||||||
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
|
movedig(b, face, b.getRelative(BlockFace.DOWN));
|
||||||
Block block = b.getRelative(BlockFace.DOWN);
|
|
||||||
movedig(b, face, block);
|
|
||||||
break;
|
break;
|
||||||
}
|
case INTERFACE_ITEMS:
|
||||||
case INTERFACE_ITEMS: {
|
if (BlockStorage.check(b.getRelative(face), "ANDROID_INTERFACE_ITEMS") && b.getRelative(face).getState() instanceof Dispenser) {
|
||||||
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
|
Dispenser d = (Dispenser) b.getRelative(face).getState();
|
||||||
Block block = b.getRelative(face);
|
|
||||||
if (BlockStorage.check(block, "ANDROID_INTERFACE_ITEMS") && block.getState() instanceof Dispenser) {
|
|
||||||
Dispenser d = (Dispenser) block.getState();
|
|
||||||
for (int slot: getOutputSlots()) {
|
for (int slot: getOutputSlots()) {
|
||||||
ItemStack stack = BlockStorage.getInventory(b).getItemInSlot(slot);
|
ItemStack stack = BlockStorage.getInventory(b).getItemInSlot(slot);
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
@ -393,12 +369,9 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
case INTERFACE_FUEL:
|
||||||
case INTERFACE_FUEL: {
|
if (BlockStorage.check(b.getRelative(face), "ANDROID_INTERFACE_FUEL") && b.getRelative(face).getState() instanceof Dispenser) {
|
||||||
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
|
Dispenser d = (Dispenser) b.getRelative(face).getState();
|
||||||
Block block = b.getRelative(face);
|
|
||||||
if (BlockStorage.check(block, "ANDROID_INTERFACE_FUEL") && block.getState() instanceof Dispenser) {
|
|
||||||
Dispenser d = (Dispenser) block.getState();
|
|
||||||
for (int slot = 0; slot < 9; slot++) {
|
for (int slot = 0; slot < 9; slot++) {
|
||||||
ItemStack item = d.getInventory().getItem(slot);
|
ItemStack item = d.getInventory().getItem(slot);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
@ -420,36 +393,23 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
case FARM_FORWARD:
|
||||||
case FARM_FORWARD: {
|
farm(b, b.getRelative(face));
|
||||||
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
|
|
||||||
Block block = b.getRelative(face);
|
|
||||||
farm(b, block);
|
|
||||||
break;
|
break;
|
||||||
}
|
case FARM_DOWN:
|
||||||
case FARM_DOWN: {
|
farm(b, b.getRelative(BlockFace.DOWN));
|
||||||
Block block = b.getRelative(BlockFace.DOWN);
|
|
||||||
farm(b, block);
|
|
||||||
break;
|
break;
|
||||||
}
|
case FARM_EXOTIC_FORWARD:
|
||||||
case FARM_EXOTIC_FORWARD: {
|
exoticFarm(b, b.getRelative(face));
|
||||||
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
|
|
||||||
Block block = b.getRelative(face);
|
|
||||||
exoticFarm(b, block);
|
|
||||||
break;
|
break;
|
||||||
}
|
case FARM_EXOTIC_DOWN:
|
||||||
case FARM_EXOTIC_DOWN: {
|
exoticFarm(b, b.getRelative(BlockFace.DOWN));
|
||||||
Block block = b.getRelative(BlockFace.DOWN);
|
|
||||||
exoticFarm(b, block);
|
|
||||||
break;
|
break;
|
||||||
}
|
case CHOP_TREE:
|
||||||
case CHOP_TREE: {
|
if (MaterialHelper.isLog(b.getRelative(face).getType())) {
|
||||||
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
|
List<Location> list = new ArrayList<>();
|
||||||
Block block = b.getRelative(face);
|
list.add(b.getRelative(face).getLocation());
|
||||||
if (MaterialHelper.isLog( block.getType())) {
|
TreeCalculator.getTree(b.getRelative(face).getLocation(), b.getRelative(face).getLocation(), list);
|
||||||
List<Location> list = new ArrayList<Location>();
|
|
||||||
list.add(block.getLocation());
|
|
||||||
TreeCalculator.getTree(block.getLocation(), block.getLocation(), list);
|
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
refresh = false;
|
refresh = false;
|
||||||
Block log = list.get(list.size() - 1).getBlock();
|
Block log = list.get(list.size() - 1).getBlock();
|
||||||
@ -460,7 +420,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
|
|||||||
if (fits(b, items)) {
|
if (fits(b, items)) {
|
||||||
pushItems(b, items);
|
pushItems(b, items);
|
||||||
log.getWorld().playEffect(log.getLocation(), Effect.STEP_SOUND, log.getType());
|
log.getWorld().playEffect(log.getLocation(), Effect.STEP_SOUND, log.getType());
|
||||||
if (log.getY() == block.getY()) {
|
if (log.getY() == b.getRelative(face).getY()) {
|
||||||
log.setType(MaterialHelper.getSaplingFromLog(log.getType()));
|
log.setType(MaterialHelper.getSaplingFromLog(log.getType()));
|
||||||
}
|
}
|
||||||
else log.setType(Material.AIR);
|
else log.setType(Material.AIR);
|
||||||
@ -470,10 +430,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
case ATTACK_MOBS_ANIMALS:
|
||||||
case ATTACK_MOBS_ANIMALS: {
|
|
||||||
double damage = getTier() < 2 ? 20D : 4D * getTier();
|
|
||||||
|
|
||||||
entities:
|
entities:
|
||||||
for (Entity n: AndroidStatusHologram.getNearbyEntities(b, 4D + getTier())) {
|
for (Entity n: AndroidStatusHologram.getNearbyEntities(b, 4D + getTier())) {
|
||||||
switch (BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"))) {
|
switch (BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"))) {
|
||||||
@ -522,10 +479,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
case ATTACK_MOBS:
|
||||||
case ATTACK_MOBS: {
|
|
||||||
double damage = getTier() < 2 ? 20D : 4D * getTier();
|
|
||||||
|
|
||||||
entities:
|
entities:
|
||||||
for (Entity n: AndroidStatusHologram.getNearbyEntities(b, 4D + getTier())) {
|
for (Entity n: AndroidStatusHologram.getNearbyEntities(b, 4D + getTier())) {
|
||||||
if (n instanceof Animals) continue;
|
if (n instanceof Animals) continue;
|
||||||
@ -575,11 +529,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
case ATTACK_ANIMALS:
|
||||||
|
|
||||||
case ATTACK_ANIMALS: {
|
|
||||||
double damage = getTier() < 2 ? 20D : 4D * getTier();
|
|
||||||
|
|
||||||
entities:
|
entities:
|
||||||
for (Entity n: AndroidStatusHologram.getNearbyEntities(b, 4D + getTier())) {
|
for (Entity n: AndroidStatusHologram.getNearbyEntities(b, 4D + getTier())) {
|
||||||
if (n instanceof Monster) continue;
|
if (n instanceof Monster) continue;
|
||||||
@ -629,11 +579,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
case ATTACK_ANIMALS_ADULT:
|
||||||
|
|
||||||
case ATTACK_ANIMALS_ADULT: {
|
|
||||||
double damage = getTier() < 2 ? 20D : 4D * getTier();
|
|
||||||
|
|
||||||
entities:
|
entities:
|
||||||
for (Entity n: AndroidStatusHologram.getNearbyEntities(b, 4D + getTier())) {
|
for (Entity n: AndroidStatusHologram.getNearbyEntities(b, 4D + getTier())) {
|
||||||
if (n instanceof Monster) continue;
|
if (n instanceof Monster) continue;
|
||||||
@ -684,7 +630,6 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ public class Slimefun {
|
|||||||
* @return the list of all the IDs of the enabled items.
|
* @return the list of all the IDs of the enabled items.
|
||||||
*/
|
*/
|
||||||
public static List<String> listIDs() {
|
public static List<String> listIDs() {
|
||||||
List<String> ids = new ArrayList<String>();
|
List<String> ids = new ArrayList<>();
|
||||||
for (SlimefunItem item: SlimefunItem.list()) {
|
for (SlimefunItem item: SlimefunItem.list()) {
|
||||||
ids.add(item.getID());
|
ids.add(item.getID());
|
||||||
}
|
}
|
||||||
@ -273,7 +273,7 @@ public class Slimefun {
|
|||||||
* @see #current_categories
|
* @see #current_categories
|
||||||
*/
|
*/
|
||||||
public static List<ItemStack> listCategories() {
|
public static List<ItemStack> listCategories() {
|
||||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
List<ItemStack> items = new ArrayList<>();
|
||||||
for (Category c: Category.list()) {
|
for (Category c: Category.list()) {
|
||||||
items.add(c.getItem());
|
items.add(c.getItem());
|
||||||
}
|
}
|
||||||
@ -348,6 +348,6 @@ public class Slimefun {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<GuideHandler> getGuideHandlers(int tier) {
|
public static List<GuideHandler> getGuideHandlers(int tier) {
|
||||||
return guide_handlers.containsKey(tier) ? guide_handlers.get(tier): new ArrayList<GuideHandler>();
|
return guide_handlers.containsKey(tier) ? guide_handlers.get(tier): new ArrayList<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -26,9 +26,9 @@ public class EnergyNet extends Network {
|
|||||||
|
|
||||||
private static final int RANGE = 6;
|
private static final int RANGE = 6;
|
||||||
|
|
||||||
public static Set<String> machines_input = new HashSet<String>();
|
public static Set<String> machines_input = new HashSet<>();
|
||||||
public static Set<String> machines_storage = new HashSet<String>();
|
public static Set<String> machines_storage = new HashSet<>();
|
||||||
public static Set<String> machines_output = new HashSet<String>();
|
public static Set<String> machines_output = new HashSet<>();
|
||||||
|
|
||||||
public static NetworkComponent getComponent(Block b) {
|
public static NetworkComponent getComponent(Block b) {
|
||||||
return getComponent(b.getLocation());
|
return getComponent(b.getLocation());
|
||||||
@ -79,9 +79,9 @@ public class EnergyNet extends Network {
|
|||||||
return energy_network;
|
return energy_network;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<Location> input = new HashSet<Location>();
|
private Set<Location> input = new HashSet<>();
|
||||||
private Set<Location> storage = new HashSet<Location>();
|
private Set<Location> storage = new HashSet<>();
|
||||||
private Set<Location> output = new HashSet<Location>();
|
private Set<Location> output = new HashSet<>();
|
||||||
|
|
||||||
protected EnergyNet(Location l) {
|
protected EnergyNet(Location l) {
|
||||||
super(l);
|
super(l);
|
||||||
|
@ -12,8 +12,8 @@ import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
|||||||
|
|
||||||
public class UniversalBlockMenu extends DirtyChestMenu {
|
public class UniversalBlockMenu extends DirtyChestMenu {
|
||||||
|
|
||||||
BlockMenuPreset preset;
|
private BlockMenuPreset preset;
|
||||||
ItemManipulationEvent event;
|
private ItemManipulationEvent event;
|
||||||
|
|
||||||
public UniversalBlockMenu(BlockMenuPreset preset) {
|
public UniversalBlockMenu(BlockMenuPreset preset) {
|
||||||
super(preset.getTitle());
|
super(preset.getTitle());
|
||||||
|
@ -202,7 +202,7 @@ public class CargoManager {
|
|||||||
boolean data = blockInfo.getString("filter-durability").equals("true");
|
boolean data = blockInfo.getString("filter-durability").equals("true");
|
||||||
|
|
||||||
if (blockInfo.getString("filter-type").equals("whitelist")) {
|
if (blockInfo.getString("filter-type").equals("whitelist")) {
|
||||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
List<ItemStack> items = new ArrayList<>();
|
||||||
for (int slot: slots) {
|
for (int slot: slots) {
|
||||||
ItemStack template = menu.getItemInSlot(slot);
|
ItemStack template = menu.getItemInSlot(slot);
|
||||||
if (template != null) items.add(new CustomItem(template, 1));
|
if (template != null) items.add(new CustomItem(template, 1));
|
||||||
|
@ -33,6 +33,7 @@ import me.mrCookieSlime.Slimefun.api.network.Network;
|
|||||||
import me.mrCookieSlime.Slimefun.holograms.CargoHologram;
|
import me.mrCookieSlime.Slimefun.holograms.CargoHologram;
|
||||||
|
|
||||||
public class CargoNet extends Network {
|
public class CargoNet extends Network {
|
||||||
|
|
||||||
public static boolean EXTRA_CHANNELS = false;
|
public static boolean EXTRA_CHANNELS = false;
|
||||||
|
|
||||||
private static final int RANGE = 5;
|
private static final int RANGE = 5;
|
||||||
@ -67,15 +68,15 @@ public class CargoNet extends Network {
|
|||||||
return getNetworkFromLocation(b.getLocation()) != null;
|
return getNetworkFromLocation(b.getLocation()) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<Location> inputNodes = new HashSet<Location>();
|
private Set<Location> inputNodes = new HashSet<>();
|
||||||
private Set<Location> outputNodes = new HashSet<Location>();
|
private Set<Location> outputNodes = new HashSet<>();
|
||||||
private Set<Location> advancedOutputNodes = new HashSet<Location>();
|
private Set<Location> advancedOutputNodes = new HashSet<>();
|
||||||
|
|
||||||
|
|
||||||
//Chest Terminal Stuff
|
//Chest Terminal Stuff
|
||||||
final Set<Location> terminals = new HashSet<Location>();
|
private final Set<Location> terminals = new HashSet<>();
|
||||||
final Set<Location> imports = new HashSet<Location>();
|
private final Set<Location> imports = new HashSet<>();
|
||||||
final Set<Location> exports = new HashSet<Location>();
|
private final Set<Location> exports = new HashSet<>();
|
||||||
|
|
||||||
protected CargoNet(Location l) {
|
protected CargoNet(Location l) {
|
||||||
super(l);
|
super(l);
|
||||||
|
@ -5,10 +5,10 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class ItemRequest {
|
public class ItemRequest {
|
||||||
|
|
||||||
ItemStack item;
|
private ItemStack item;
|
||||||
ItemTransportFlow flow;
|
private ItemTransportFlow flow;
|
||||||
Location terminal;
|
private Location terminal;
|
||||||
int slot;
|
private int slot;
|
||||||
|
|
||||||
public ItemRequest(Location terminal, int slot, ItemStack item, ItemTransportFlow flow) {
|
public ItemRequest(Location terminal, int slot, ItemStack item, ItemTransportFlow flow) {
|
||||||
this.terminal = terminal;
|
this.terminal = terminal;
|
||||||
|
@ -22,7 +22,7 @@ public class SlimefunTabCompleter implements TabCompleter {
|
|||||||
return createReturnList(Slimefun.listIDs(), args[2]);
|
return createReturnList(Slimefun.listIDs(), args[2]);
|
||||||
}
|
}
|
||||||
else if (args[0].equalsIgnoreCase("research")) {
|
else if (args[0].equalsIgnoreCase("research")) {
|
||||||
List<String> researches = new ArrayList<String>();
|
List<String> researches = new ArrayList<>();
|
||||||
for (Research res : Research.list()) {
|
for (Research res : Research.list()) {
|
||||||
researches.add(res.getName().toUpperCase().replace(" ", "_"));
|
researches.add(res.getName().toUpperCase().replace(" ", "_"));
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ public class DamageListener implements Listener {
|
|||||||
|
|
||||||
if (!e.getEntity().getCanPickupItems() && Talisman.checkFor(e, SlimefunItem.getByID("HUNTER_TALISMAN")) && !(e.getEntity() instanceof Player)) {
|
if (!e.getEntity().getCanPickupItems() && Talisman.checkFor(e, SlimefunItem.getByID("HUNTER_TALISMAN")) && !(e.getEntity() instanceof Player)) {
|
||||||
|
|
||||||
List<ItemStack> newDrops = new ArrayList<ItemStack>();
|
List<ItemStack> newDrops = new ArrayList<>();
|
||||||
for (ItemStack drop : e.getDrops()) {
|
for (ItemStack drop : e.getDrops()) {
|
||||||
newDrops.add(drop);
|
newDrops.add(drop);
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
|||||||
|
|
||||||
public class TeleporterListener implements Listener {
|
public class TeleporterListener implements Listener {
|
||||||
|
|
||||||
BlockFace[] faces = {BlockFace.NORTH, BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST, BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST};
|
private final BlockFace[] faces = {BlockFace.NORTH, BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST, BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST};
|
||||||
|
|
||||||
public TeleporterListener(SlimefunStartup plugin) {
|
public TeleporterListener(SlimefunStartup plugin) {
|
||||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||||
|
Loading…
Reference in New Issue
Block a user