mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Fixes #2269 (+ refactoring)
This commit is contained in:
parent
a1e5be2568
commit
68b9a0aed8
@ -92,6 +92,7 @@
|
||||
* Fixed #2257
|
||||
* Fixed #2260
|
||||
* Fixed #2263
|
||||
* Fixed #2269
|
||||
|
||||
## Release Candidate 15 (01 Aug 2020)
|
||||
|
||||
|
@ -116,6 +116,7 @@ public class EnergyNet extends Network {
|
||||
|
||||
if (!regulator.equals(b.getLocation())) {
|
||||
SimpleHologram.update(b, "&4Multiple Energy Regulators connected");
|
||||
SlimefunPlugin.getProfiler().closeEntry(b.getLocation(), SlimefunItems.ENERGY_REGULATOR.getItem(), timestamp.get());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -23,9 +23,9 @@ import net.md_5.bungee.api.chat.hover.content.Text;
|
||||
class PerformanceSummary {
|
||||
|
||||
// The threshold at which a Block or Chunk is significant enough to appear in /sf timings
|
||||
private static final int VISIBILITY_THRESHOLD = 300_000;
|
||||
private static final int MIN_ITEMS = 4;
|
||||
private static final int MAX_ITEMS = 12;
|
||||
private static final int VISIBILITY_THRESHOLD = 260_000;
|
||||
private static final int MIN_ITEMS = 6;
|
||||
private static final int MAX_ITEMS = 20;
|
||||
|
||||
private final SlimefunProfiler profiler;
|
||||
private final PerformanceRating rating;
|
||||
|
@ -77,27 +77,26 @@ abstract class AbstractCargoNode extends SlimefunItem {
|
||||
|
||||
protected void addChannelSelector(Block b, BlockMenu menu, int slotPrev, int slotCurrent, int slotNext) {
|
||||
boolean isChestTerminalInstalled = SlimefunPlugin.getThirdPartySupportService().isChestTerminalInstalled();
|
||||
int channel = ((!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), FREQUENCY) == null) ? 0 : (Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), FREQUENCY))));
|
||||
|
||||
menu.replaceExistingItem(slotPrev, new CustomItem(SlimefunUtils.getCustomHead(HeadTexture.CARGO_ARROW_LEFT.getTexture()), "&bPrevious Channel", "", "&e> Click to decrease the Channel ID by 1"));
|
||||
menu.addMenuClickHandler(slotPrev, (p, slot, item, action) -> {
|
||||
int channel = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), FREQUENCY)) - 1;
|
||||
int newChannel = channel + 1;
|
||||
|
||||
if (channel < 0) {
|
||||
if (isChestTerminalInstalled) {
|
||||
channel = 16;
|
||||
newChannel = 16;
|
||||
}
|
||||
else {
|
||||
channel = 15;
|
||||
newChannel = 15;
|
||||
}
|
||||
}
|
||||
|
||||
BlockStorage.addBlockInfo(b, FREQUENCY, String.valueOf(channel));
|
||||
BlockStorage.addBlockInfo(b, FREQUENCY, String.valueOf(newChannel));
|
||||
updateBlockMenu(menu, b);
|
||||
return false;
|
||||
});
|
||||
|
||||
int channel = ((!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), FREQUENCY) == null) ? 0 : (Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), FREQUENCY))));
|
||||
|
||||
if (channel == 16) {
|
||||
menu.replaceExistingItem(slotCurrent, new CustomItem(SlimefunUtils.getCustomHead(HeadTexture.CHEST_TERMINAL.getTexture()), "&bChannel ID: &3" + (channel + 1)));
|
||||
menu.addMenuClickHandler(slotCurrent, ChestMenuUtils.getEmptyClickHandler());
|
||||
@ -109,18 +108,18 @@ abstract class AbstractCargoNode extends SlimefunItem {
|
||||
|
||||
menu.replaceExistingItem(slotNext, new CustomItem(SlimefunUtils.getCustomHead(HeadTexture.CARGO_ARROW_RIGHT.getTexture()), "&bNext Channel", "", "&e> Click to increase the Channel ID by 1"));
|
||||
menu.addMenuClickHandler(slotNext, (p, slot, item, action) -> {
|
||||
int channeln = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), FREQUENCY)) + 1;
|
||||
int newChannel = channel + 1;
|
||||
|
||||
if (isChestTerminalInstalled) {
|
||||
if (channeln > 16) {
|
||||
channeln = 0;
|
||||
if (newChannel > 16) {
|
||||
newChannel = 0;
|
||||
}
|
||||
}
|
||||
else if (channeln > 15) {
|
||||
channeln = 0;
|
||||
else if (newChannel > 15) {
|
||||
newChannel = 0;
|
||||
}
|
||||
|
||||
BlockStorage.addBlockInfo(b, FREQUENCY, String.valueOf(channeln));
|
||||
BlockStorage.addBlockInfo(b, FREQUENCY, String.valueOf(newChannel));
|
||||
updateBlockMenu(menu, b);
|
||||
return false;
|
||||
});
|
||||
|
@ -8,13 +8,26 @@ import org.bukkit.inventory.ItemStack;
|
||||
import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetProvider;
|
||||
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockUseHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
|
||||
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNet;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
/**
|
||||
* The {@link SolarGenerator} is a simple {@link EnergyNetProvider} which generates energy if
|
||||
* it has direct contact with sunlight.
|
||||
*
|
||||
* Some versions of the {@link SolarGenerator} will even generate energy at night, this is determined by
|
||||
* {@link #getNightEnergy()}.
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
* @see EnergyNet
|
||||
* @see EnergyNetProvider
|
||||
*
|
||||
*/
|
||||
public class SolarGenerator extends SlimefunItem implements EnergyNetProvider {
|
||||
|
||||
private final int dayEnergy;
|
||||
@ -47,11 +60,6 @@ public class SolarGenerator extends SlimefunItem implements EnergyNetProvider {
|
||||
return nightEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnergyNetComponentType getEnergyComponentType() {
|
||||
return EnergyNetComponentType.GENERATOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
return 0;
|
||||
@ -64,23 +72,20 @@ public class SolarGenerator extends SlimefunItem implements EnergyNetProvider {
|
||||
if (world.getEnvironment() != Environment.NORMAL) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
boolean isDaytime = isDaytime(world);
|
||||
|
||||
boolean isDaytime = isDaytime(world);
|
||||
|
||||
// Performance optimization for daytime-only solar generators
|
||||
if (!isDaytime && getNightEnergy() < 0.1) {
|
||||
return 0;
|
||||
// Performance optimization for daytime-only solar generators
|
||||
if (!isDaytime && getNightEnergy() < 1) {
|
||||
return 0;
|
||||
}
|
||||
else if (!world.isChunkLoaded(l.getBlockX() >> 4, l.getBlockZ() >> 4) || l.getBlock().getLightFromSky() < 15) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return isDaytime ? getDayEnergy() : getNightEnergy();
|
||||
}
|
||||
}
|
||||
|
||||
if (!world.isChunkLoaded(l.getBlockX() >> 4, l.getBlockZ() >> 4) || l.getBlock().getLightFromSky() != 15) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (isDaytime) {
|
||||
return getDayEnergy();
|
||||
}
|
||||
|
||||
return getNightEnergy();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -93,7 +98,8 @@ public class SolarGenerator extends SlimefunItem implements EnergyNetProvider {
|
||||
* @return Whether the given {@link World} has daytime and no active thunderstorm
|
||||
*/
|
||||
private boolean isDaytime(World world) {
|
||||
return !world.hasStorm() && !world.isThundering() && (world.getTime() < 12300 || world.getTime() > 23850);
|
||||
long time = world.getTime();
|
||||
return !world.hasStorm() && !world.isThundering() && (time < 12300 || time > 23850);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,32 +1,34 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
||||
|
||||
/**
|
||||
* The {@link AutoAnvil} is an electric machine which can repair any {@link ItemStack} using
|
||||
* Duct tape.
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
*/
|
||||
public abstract class AutoAnvil extends AContainer {
|
||||
|
||||
public AutoAnvil(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
super(category, item, recipeType, recipe);
|
||||
}
|
||||
private final int repairFactor;
|
||||
|
||||
@Override
|
||||
public String getInventoryTitle() {
|
||||
return "Auto-Anvil";
|
||||
public AutoAnvil(Category category, int repairFactor, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
super(category, item, recipeType, recipe);
|
||||
|
||||
this.repairFactor = repairFactor;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -44,61 +46,32 @@ public abstract class AutoAnvil extends AContainer {
|
||||
return "AUTO_ANVIL";
|
||||
}
|
||||
|
||||
public abstract int getRepairFactor();
|
||||
|
||||
@Override
|
||||
protected void tick(Block b) {
|
||||
BlockMenu menu = BlockStorage.getInventory(b);
|
||||
protected MachineRecipe findNextRecipe(BlockMenu menu) {
|
||||
for (int slot : getInputSlots()) {
|
||||
ItemStack ductTape = menu.getItemInSlot(slot == getInputSlots()[0] ? getInputSlots()[1] : getInputSlots()[0]);
|
||||
ItemStack item = menu.getItemInSlot(slot);
|
||||
|
||||
if (isProcessing(b)) {
|
||||
int timeleft = progress.get(b);
|
||||
if (item != null && item.getType().getMaxDurability() > 0 && ((Damageable) item.getItemMeta()).getDamage() > 0) {
|
||||
if (SlimefunUtils.isItemSimilar(ductTape, SlimefunItems.DUCT_TAPE, true, false)) {
|
||||
ItemStack repairedItem = repair(item);
|
||||
|
||||
if (timeleft > 0) {
|
||||
ChestMenuUtils.updateProgressbar(menu, 22, timeleft, processing.get(b).getTicks(), getProgressBar());
|
||||
|
||||
if (getCharge(b.getLocation()) < getEnergyConsumption()) {
|
||||
return;
|
||||
}
|
||||
|
||||
removeCharge(b.getLocation(), getEnergyConsumption());
|
||||
progress.put(b, timeleft - 1);
|
||||
}
|
||||
else {
|
||||
menu.replaceExistingItem(22, new CustomItem(Material.BLACK_STAINED_GLASS_PANE, " "));
|
||||
menu.pushItem(processing.get(b).getOutput()[0].clone(), getOutputSlots());
|
||||
|
||||
progress.remove(b);
|
||||
processing.remove(b);
|
||||
}
|
||||
}
|
||||
else {
|
||||
MachineRecipe recipe = null;
|
||||
|
||||
for (int slot : getInputSlots()) {
|
||||
ItemStack target = menu.getItemInSlot(slot == getInputSlots()[0] ? getInputSlots()[1] : getInputSlots()[0]);
|
||||
ItemStack item = menu.getItemInSlot(slot);
|
||||
|
||||
if (item != null && item.getType().getMaxDurability() > 0 && ((Damageable) item.getItemMeta()).getDamage() > 0) {
|
||||
if (SlimefunUtils.isItemSimilar(target, SlimefunItems.DUCT_TAPE, true)) {
|
||||
ItemStack repaired = repair(item);
|
||||
recipe = new MachineRecipe(30, new ItemStack[] { target, item }, new ItemStack[] { repaired });
|
||||
if (!menu.fits(repairedItem, getOutputSlots())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int inputSlot : getInputSlots()) {
|
||||
menu.consumeItem(inputSlot);
|
||||
}
|
||||
|
||||
if (recipe != null) {
|
||||
if (!menu.fits(recipe.getOutput()[0], getOutputSlots())) return;
|
||||
|
||||
for (int slot : getInputSlots()) {
|
||||
menu.consumeItem(slot);
|
||||
return new MachineRecipe(30, new ItemStack[] { ductTape, item }, new ItemStack[] { repairedItem });
|
||||
}
|
||||
|
||||
processing.put(b, recipe);
|
||||
progress.put(b, recipe.getTicks());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private ItemStack repair(ItemStack item) {
|
||||
@ -106,7 +79,8 @@ public abstract class AutoAnvil extends AContainer {
|
||||
ItemMeta meta = repaired.getItemMeta();
|
||||
|
||||
short maxDurability = item.getType().getMaxDurability();
|
||||
short durability = (short) (((Damageable) meta).getDamage() - (maxDurability / getRepairFactor()));
|
||||
int repairPercentage = 100 / repairFactor;
|
||||
short durability = (short) (((Damageable) meta).getDamage() - (maxDurability / repairPercentage));
|
||||
|
||||
if (durability < 0) {
|
||||
durability = 0;
|
||||
|
@ -21,8 +21,11 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
public abstract class GPSTransmitter extends SimpleSlimefunItem<BlockTicker> implements EnergyNetComponent {
|
||||
|
||||
public GPSTransmitter(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
private final int capacity;
|
||||
|
||||
public GPSTransmitter(Category category, int tier, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
super(category, item, recipeType, recipe);
|
||||
this.capacity = 4 << (2 * tier);
|
||||
|
||||
addItemHandler(onPlace());
|
||||
registerBlockHandler(getID(), (p, b, stack, reason) -> {
|
||||
@ -32,6 +35,11 @@ public abstract class GPSTransmitter extends SimpleSlimefunItem<BlockTicker> imp
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
return capacity;
|
||||
}
|
||||
|
||||
private BlockPlaceHandler onPlace() {
|
||||
return new BlockPlaceHandler(false) {
|
||||
|
||||
|
@ -1,46 +1,19 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.resources;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.geo.GEOResource;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class NetherIceResource implements GEOResource {
|
||||
class NetherIceResource extends SlimefunResource {
|
||||
|
||||
private final NamespacedKey key = new NamespacedKey(SlimefunPlugin.instance(), "nether_ice");
|
||||
NetherIceResource() {
|
||||
super("nether_ice", "Nether Ice", SlimefunItems.NETHER_ICE, 6, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDefaultSupply(Environment environment, Biome biome) {
|
||||
return environment == Environment.NETHER ? 32 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamespacedKey getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxDeviation() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Nether Ice";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem() {
|
||||
return SlimefunItems.NETHER_ICE.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isObtainableFromGEOMiner() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,17 +1,15 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.resources;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.geo.GEOResource;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class OilResource implements GEOResource {
|
||||
class OilResource extends SlimefunResource {
|
||||
|
||||
private final NamespacedKey key = new NamespacedKey(SlimefunPlugin.instance(), "oil");
|
||||
OilResource() {
|
||||
super("oil", "Oil", SlimefunItems.OIL_BUCKET, 8, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDefaultSupply(Environment environment, Biome biome) {
|
||||
@ -74,29 +72,4 @@ class OilResource implements GEOResource {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamespacedKey getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxDeviation() {
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Oil";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem() {
|
||||
return SlimefunItems.OIL_BUCKET.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isObtainableFromGEOMiner() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,17 +1,15 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.resources;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.geo.GEOResource;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class SaltResource implements GEOResource {
|
||||
class SaltResource extends SlimefunResource {
|
||||
|
||||
private final NamespacedKey key = new NamespacedKey(SlimefunPlugin.instance(), "salt");
|
||||
SaltResource() {
|
||||
super("salt", "Salt", SlimefunItems.SALT, 18, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDefaultSupply(Environment environment, Biome biome) {
|
||||
@ -51,29 +49,4 @@ class SaltResource implements GEOResource {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxDeviation() {
|
||||
return 18;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamespacedKey getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Salt";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem() {
|
||||
return SlimefunItems.SALT.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isObtainableFromGEOMiner() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.resources;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.geo.GEOResource;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
abstract class SlimefunResource implements GEOResource {
|
||||
|
||||
private final NamespacedKey key;
|
||||
private final String defaultName;
|
||||
private final ItemStack item;
|
||||
private final int maxDeviation;
|
||||
private final boolean geoMiner;
|
||||
|
||||
SlimefunResource(String key, String defaultName, ItemStack item, int maxDeviation, boolean geoMiner) {
|
||||
Validate.notNull(key, "NamespacedKey cannot be null!");
|
||||
Validate.notNull(defaultName, "The default name cannot be null!");
|
||||
Validate.notNull(item, "item cannot be null!");
|
||||
|
||||
this.key = new NamespacedKey(SlimefunPlugin.instance(), key);
|
||||
this.defaultName = defaultName;
|
||||
this.item = item;
|
||||
this.maxDeviation = maxDeviation;
|
||||
this.geoMiner = geoMiner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamespacedKey getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return defaultName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem() {
|
||||
return item.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxDeviation() {
|
||||
return maxDeviation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isObtainableFromGEOMiner() {
|
||||
return geoMiner;
|
||||
}
|
||||
|
||||
}
|
@ -1,17 +1,15 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.resources;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.geo.GEOResource;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class UraniumResource implements GEOResource {
|
||||
class UraniumResource extends SlimefunResource {
|
||||
|
||||
private final NamespacedKey key = new NamespacedKey(SlimefunPlugin.instance(), "uranium");
|
||||
UraniumResource() {
|
||||
super("uranium", "Small Chunks of Uranium", SlimefunItems.SMALL_URANIUM, 2, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDefaultSupply(Environment envionment, Biome biome) {
|
||||
@ -22,29 +20,4 @@ class UraniumResource implements GEOResource {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamespacedKey getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxDeviation() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Small Chunks of Uranium";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem() {
|
||||
return SlimefunItems.SMALL_URANIUM.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isObtainableFromGEOMiner() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2047,14 +2047,9 @@ public final class SlimefunItemSetup {
|
||||
new ItemStack[] {new ItemStack(Material.REDSTONE), new ItemStack(Material.ANVIL), new ItemStack(Material.REDSTONE), SlimefunItems.CARBONADO, SlimefunItems.AUTO_ENCHANTER, SlimefunItems.CARBONADO, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.WITHER_PROOF_OBSIDIAN})
|
||||
.register(plugin);
|
||||
|
||||
new AutoAnvil(categories.electricity, SlimefunItems.AUTO_ANVIL, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new AutoAnvil(categories.electricity, 10, SlimefunItems.AUTO_ANVIL, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new ItemStack[] {null, new ItemStack(Material.ANVIL), null, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.REINFORCED_ALLOY_INGOT, new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.IRON_BLOCK)}) {
|
||||
|
||||
@Override
|
||||
public int getRepairFactor() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
return 128;
|
||||
@ -2067,14 +2062,9 @@ public final class SlimefunItemSetup {
|
||||
|
||||
}.register(plugin);
|
||||
|
||||
new AutoAnvil(categories.electricity, SlimefunItems.AUTO_ANVIL_2, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new AutoAnvil(categories.electricity, 25, SlimefunItems.AUTO_ANVIL_2, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new ItemStack[] {null, SlimefunItems.AUTO_ANVIL, null, SlimefunItems.STEEL_PLATE, SlimefunItems.HEATING_COIL, SlimefunItems.STEEL_PLATE, new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.IRON_BLOCK)}) {
|
||||
|
||||
@Override
|
||||
public int getRepairFactor() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
return 256;
|
||||
@ -2100,7 +2090,7 @@ public final class SlimefunItemSetup {
|
||||
new ItemStack[] {SlimefunItems.BRASS_INGOT, new ItemStack(Material.ORANGE_STAINED_GLASS), SlimefunItems.BRASS_INGOT, SlimefunItems.POWER_CRYSTAL, SlimefunItems.TIN_DUST, SlimefunItems.POWER_CRYSTAL, SlimefunItems.BRASS_INGOT, new ItemStack(Material.ORANGE_STAINED_GLASS), SlimefunItems.BRASS_INGOT})
|
||||
.register(plugin);
|
||||
|
||||
new GPSTransmitter(categories.gps, SlimefunItems.GPS_TRANSMITTER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new GPSTransmitter(categories.gps, 1, SlimefunItems.GPS_TRANSMITTER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new ItemStack[] {null, null, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.STEEL_INGOT, SlimefunItems.ADVANCED_CIRCUIT_BOARD, SlimefunItems.STEEL_INGOT, SlimefunItems.STEEL_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.STEEL_INGOT}) {
|
||||
|
||||
@Override
|
||||
@ -2108,11 +2098,6 @@ public final class SlimefunItemSetup {
|
||||
return y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
return 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyConsumption() {
|
||||
return 1;
|
||||
@ -2120,7 +2105,7 @@ public final class SlimefunItemSetup {
|
||||
|
||||
}.register(plugin);
|
||||
|
||||
new GPSTransmitter(categories.gps, SlimefunItems.GPS_TRANSMITTER_2, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new GPSTransmitter(categories.gps, 2, SlimefunItems.GPS_TRANSMITTER_2, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new ItemStack[] {SlimefunItems.GPS_TRANSMITTER, SlimefunItems.BRONZE_INGOT, SlimefunItems.GPS_TRANSMITTER, SlimefunItems.BRONZE_INGOT, SlimefunItems.CARBON, SlimefunItems.BRONZE_INGOT, SlimefunItems.GPS_TRANSMITTER, SlimefunItems.BRONZE_INGOT, SlimefunItems.GPS_TRANSMITTER}) {
|
||||
|
||||
@Override
|
||||
@ -2128,11 +2113,6 @@ public final class SlimefunItemSetup {
|
||||
return y * 4 + 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyConsumption() {
|
||||
return 3;
|
||||
@ -2140,7 +2120,7 @@ public final class SlimefunItemSetup {
|
||||
|
||||
}.register(plugin);
|
||||
|
||||
new GPSTransmitter(categories.gps, SlimefunItems.GPS_TRANSMITTER_3, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new GPSTransmitter(categories.gps, 3, SlimefunItems.GPS_TRANSMITTER_3, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new ItemStack[] {SlimefunItems.GPS_TRANSMITTER_2, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.GPS_TRANSMITTER_2, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.CARBONADO, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.GPS_TRANSMITTER_2, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.GPS_TRANSMITTER_2}) {
|
||||
|
||||
@Override
|
||||
@ -2148,11 +2128,6 @@ public final class SlimefunItemSetup {
|
||||
return y * 16 + 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
return 256;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyConsumption() {
|
||||
return 11;
|
||||
@ -2160,7 +2135,7 @@ public final class SlimefunItemSetup {
|
||||
|
||||
}.register(plugin);
|
||||
|
||||
new GPSTransmitter(categories.gps, SlimefunItems.GPS_TRANSMITTER_4, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new GPSTransmitter(categories.gps, 4, SlimefunItems.GPS_TRANSMITTER_4, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new ItemStack[] {SlimefunItems.GPS_TRANSMITTER_3, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.GPS_TRANSMITTER_3, SlimefunItems.NICKEL_INGOT, SlimefunItems.CARBONADO, SlimefunItems.NICKEL_INGOT, SlimefunItems.GPS_TRANSMITTER_3, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.GPS_TRANSMITTER_3}) {
|
||||
|
||||
@Override
|
||||
@ -2168,11 +2143,6 @@ public final class SlimefunItemSetup {
|
||||
return y * 64 + 600;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
return 1024;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyConsumption() {
|
||||
return 46;
|
||||
|
Loading…
Reference in New Issue
Block a user