mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
[CI skip] Formatting
This commit is contained in:
parent
96f93bd808
commit
a80269b7d9
@ -115,14 +115,14 @@ abstract class AbstractItemNetwork extends Network {
|
||||
|
||||
if (menu != null) {
|
||||
switch (request.getDirection()) {
|
||||
case INSERT:
|
||||
distributeInsertionRequest(inventories, request, menu, iterator, destinations);
|
||||
break;
|
||||
case WITHDRAW:
|
||||
collectExtractionRequest(inventories, request, menu, iterator, providers);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case INSERT:
|
||||
distributeInsertionRequest(inventories, request, menu, iterator, destinations);
|
||||
break;
|
||||
case WITHDRAW:
|
||||
collectExtractionRequest(inventories, request, menu, iterator, providers);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -92,19 +92,19 @@ public class CargoNet extends AbstractItemNetwork implements HologramOwner {
|
||||
}
|
||||
|
||||
switch (id) {
|
||||
case "CARGO_MANAGER":
|
||||
return NetworkComponent.REGULATOR;
|
||||
case "CARGO_NODE":
|
||||
return NetworkComponent.CONNECTOR;
|
||||
case "CARGO_NODE_INPUT":
|
||||
case "CARGO_NODE_OUTPUT":
|
||||
case "CARGO_NODE_OUTPUT_ADVANCED":
|
||||
case "CT_IMPORT_BUS":
|
||||
case "CT_EXPORT_BUS":
|
||||
case "CHEST_TERMINAL":
|
||||
return NetworkComponent.TERMINUS;
|
||||
default:
|
||||
return null;
|
||||
case "CARGO_MANAGER":
|
||||
return NetworkComponent.REGULATOR;
|
||||
case "CARGO_NODE":
|
||||
return NetworkComponent.CONNECTOR;
|
||||
case "CARGO_NODE_INPUT":
|
||||
case "CARGO_NODE_OUTPUT":
|
||||
case "CARGO_NODE_OUTPUT_ADVANCED":
|
||||
case "CT_IMPORT_BUS":
|
||||
case "CT_EXPORT_BUS":
|
||||
case "CHEST_TERMINAL":
|
||||
return NetworkComponent.TERMINUS;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,24 +123,24 @@ public class CargoNet extends AbstractItemNetwork implements HologramOwner {
|
||||
if (to == NetworkComponent.TERMINUS) {
|
||||
String id = BlockStorage.checkID(l);
|
||||
switch (id) {
|
||||
case "CARGO_NODE_INPUT":
|
||||
inputNodes.add(l);
|
||||
break;
|
||||
case "CARGO_NODE_OUTPUT":
|
||||
case "CARGO_NODE_OUTPUT_ADVANCED":
|
||||
outputNodes.add(l);
|
||||
break;
|
||||
case "CHEST_TERMINAL":
|
||||
terminals.add(l);
|
||||
break;
|
||||
case "CT_IMPORT_BUS":
|
||||
imports.add(l);
|
||||
break;
|
||||
case "CT_EXPORT_BUS":
|
||||
exports.add(l);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case "CARGO_NODE_INPUT":
|
||||
inputNodes.add(l);
|
||||
break;
|
||||
case "CARGO_NODE_OUTPUT":
|
||||
case "CARGO_NODE_OUTPUT_ADVANCED":
|
||||
outputNodes.add(l);
|
||||
break;
|
||||
case "CHEST_TERMINAL":
|
||||
terminals.add(l);
|
||||
break;
|
||||
case "CT_IMPORT_BUS":
|
||||
imports.add(l);
|
||||
break;
|
||||
case "CT_EXPORT_BUS":
|
||||
exports.add(l);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,19 +68,19 @@ final class CargoUtils {
|
||||
Material type = block.getType();
|
||||
|
||||
switch (type) {
|
||||
case CHEST:
|
||||
case TRAPPED_CHEST:
|
||||
case FURNACE:
|
||||
case DISPENSER:
|
||||
case DROPPER:
|
||||
case HOPPER:
|
||||
case BREWING_STAND:
|
||||
case BARREL:
|
||||
case BLAST_FURNACE:
|
||||
case SMOKER:
|
||||
return true;
|
||||
default:
|
||||
return SlimefunTag.SHULKER_BOXES.isTagged(type);
|
||||
case CHEST:
|
||||
case TRAPPED_CHEST:
|
||||
case FURNACE:
|
||||
case DISPENSER:
|
||||
case DROPPER:
|
||||
case HOPPER:
|
||||
case BREWING_STAND:
|
||||
case BARREL:
|
||||
case BLAST_FURNACE:
|
||||
case SMOKER:
|
||||
return true;
|
||||
default:
|
||||
return SlimefunTag.SHULKER_BOXES.isTagged(type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,14 +75,14 @@ public class EnergyNet extends Network implements HologramOwner {
|
||||
return null;
|
||||
} else {
|
||||
switch (component.getEnergyComponentType()) {
|
||||
case CONNECTOR:
|
||||
case CAPACITOR:
|
||||
return NetworkComponent.CONNECTOR;
|
||||
case CONSUMER:
|
||||
case GENERATOR:
|
||||
return NetworkComponent.TERMINUS;
|
||||
default:
|
||||
return null;
|
||||
case CONNECTOR:
|
||||
case CAPACITOR:
|
||||
return NetworkComponent.CONNECTOR;
|
||||
case CONSUMER:
|
||||
case GENERATOR:
|
||||
return NetworkComponent.TERMINUS;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -98,21 +98,21 @@ public class EnergyNet extends Network implements HologramOwner {
|
||||
|
||||
if (component != null) {
|
||||
switch (component.getEnergyComponentType()) {
|
||||
case CAPACITOR:
|
||||
capacitors.put(l, component);
|
||||
break;
|
||||
case CONSUMER:
|
||||
consumers.put(l, component);
|
||||
break;
|
||||
case GENERATOR:
|
||||
if (component instanceof EnergyNetProvider) {
|
||||
generators.put(l, (EnergyNetProvider) component);
|
||||
} else if (component instanceof SlimefunItem) {
|
||||
((SlimefunItem) component).warn("This Item is marked as a GENERATOR but does not implement the interface EnergyNetProvider!");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case CAPACITOR:
|
||||
capacitors.put(l, component);
|
||||
break;
|
||||
case CONSUMER:
|
||||
consumers.put(l, component);
|
||||
break;
|
||||
case GENERATOR:
|
||||
if (component instanceof EnergyNetProvider) {
|
||||
generators.put(l, (EnergyNetProvider) component);
|
||||
} else if (component instanceof SlimefunItem) {
|
||||
((SlimefunItem) component).warn("This Item is marked as a GENERATOR but does not implement the interface EnergyNetProvider!");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -138,29 +138,29 @@ public class BlockDataService implements Keyed {
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case PLAYER_HEAD:
|
||||
case PLAYER_WALL_HEAD:
|
||||
case CHEST:
|
||||
case DISPENSER:
|
||||
case BREWING_STAND:
|
||||
case DROPPER:
|
||||
case FURNACE:
|
||||
case BLAST_FURNACE:
|
||||
case HOPPER:
|
||||
case LECTERN:
|
||||
case JUKEBOX:
|
||||
case ENDER_CHEST:
|
||||
case ENCHANTING_TABLE:
|
||||
case DAYLIGHT_DETECTOR:
|
||||
case SMOKER:
|
||||
case BARREL:
|
||||
case SPAWNER:
|
||||
case BEACON:
|
||||
// All of the above Materials are Tile Entities
|
||||
return true;
|
||||
default:
|
||||
// Otherwise we assume they're not Tile Entities
|
||||
return false;
|
||||
case PLAYER_HEAD:
|
||||
case PLAYER_WALL_HEAD:
|
||||
case CHEST:
|
||||
case DISPENSER:
|
||||
case BREWING_STAND:
|
||||
case DROPPER:
|
||||
case FURNACE:
|
||||
case BLAST_FURNACE:
|
||||
case HOPPER:
|
||||
case LECTERN:
|
||||
case JUKEBOX:
|
||||
case ENDER_CHEST:
|
||||
case ENCHANTING_TABLE:
|
||||
case DAYLIGHT_DETECTOR:
|
||||
case SMOKER:
|
||||
case BARREL:
|
||||
case SPAWNER:
|
||||
case BEACON:
|
||||
// All of the above Materials are Tile Entities
|
||||
return true;
|
||||
default:
|
||||
// Otherwise we assume they're not Tile Entities
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,20 +38,20 @@ public class ButcherAndroid extends ProgrammableAndroid {
|
||||
boolean attack = false;
|
||||
|
||||
switch (face) {
|
||||
case NORTH:
|
||||
attack = n.getLocation().getZ() < b.getZ();
|
||||
break;
|
||||
case EAST:
|
||||
attack = n.getLocation().getX() > b.getX();
|
||||
break;
|
||||
case SOUTH:
|
||||
attack = n.getLocation().getZ() > b.getZ();
|
||||
break;
|
||||
case WEST:
|
||||
attack = n.getLocation().getX() < b.getX();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case NORTH:
|
||||
attack = n.getLocation().getZ() < b.getZ();
|
||||
break;
|
||||
case EAST:
|
||||
attack = n.getLocation().getX() > b.getX();
|
||||
break;
|
||||
case SOUTH:
|
||||
attack = n.getLocation().getZ() > b.getZ();
|
||||
break;
|
||||
case WEST:
|
||||
attack = n.getLocation().getX() < b.getX();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (attack) {
|
||||
|
@ -64,22 +64,22 @@ public class FarmerAndroid extends ProgrammableAndroid {
|
||||
Random random = ThreadLocalRandom.current();
|
||||
|
||||
switch (crop) {
|
||||
case WHEAT:
|
||||
return new ItemStack(Material.WHEAT, random.nextInt(2) + 1);
|
||||
case POTATOES:
|
||||
return new ItemStack(Material.POTATO, random.nextInt(3) + 1);
|
||||
case CARROTS:
|
||||
return new ItemStack(Material.CARROT, random.nextInt(3) + 1);
|
||||
case BEETROOTS:
|
||||
return new ItemStack(Material.BEETROOT, random.nextInt(3) + 1);
|
||||
case COCOA:
|
||||
return new ItemStack(Material.COCOA_BEANS, random.nextInt(3) + 1);
|
||||
case NETHER_WART:
|
||||
return new ItemStack(Material.NETHER_WART, random.nextInt(3) + 1);
|
||||
case SWEET_BERRY_BUSH:
|
||||
return new ItemStack(Material.SWEET_BERRIES, random.nextInt(3) + 1);
|
||||
default:
|
||||
return null;
|
||||
case WHEAT:
|
||||
return new ItemStack(Material.WHEAT, random.nextInt(2) + 1);
|
||||
case POTATOES:
|
||||
return new ItemStack(Material.POTATO, random.nextInt(3) + 1);
|
||||
case CARROTS:
|
||||
return new ItemStack(Material.CARROT, random.nextInt(3) + 1);
|
||||
case BEETROOTS:
|
||||
return new ItemStack(Material.BEETROOT, random.nextInt(3) + 1);
|
||||
case COCOA:
|
||||
return new ItemStack(Material.COCOA_BEANS, random.nextInt(3) + 1);
|
||||
case NETHER_WART:
|
||||
return new ItemStack(Material.NETHER_WART, random.nextInt(3) + 1);
|
||||
case SWEET_BERRY_BUSH:
|
||||
return new ItemStack(Material.SWEET_BERRIES, random.nextInt(3) + 1);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,14 +194,14 @@ public class ProgrammableAndroid extends SlimefunItem implements InventoryBlock,
|
||||
*/
|
||||
public AndroidFuelSource getFuelSource() {
|
||||
switch (getTier()) {
|
||||
case 1:
|
||||
return AndroidFuelSource.SOLID;
|
||||
case 2:
|
||||
return AndroidFuelSource.LIQUID;
|
||||
case 3:
|
||||
return AndroidFuelSource.NUCLEAR;
|
||||
default:
|
||||
throw new IllegalStateException("Cannot convert the following Android tier to a fuel type: " + getTier());
|
||||
case 1:
|
||||
return AndroidFuelSource.SOLID;
|
||||
case 2:
|
||||
return AndroidFuelSource.LIQUID;
|
||||
case 3:
|
||||
return AndroidFuelSource.NUCLEAR;
|
||||
default:
|
||||
throw new IllegalStateException("Cannot convert the following Android tier to a fuel type: " + getTier());
|
||||
}
|
||||
}
|
||||
|
||||
@ -564,38 +564,38 @@ public class ProgrammableAndroid extends SlimefunItem implements InventoryBlock,
|
||||
|
||||
private void registerDefaultFuelTypes() {
|
||||
switch (getFuelSource()) {
|
||||
case SOLID:
|
||||
registerFuelType(new MachineFuel(80, new ItemStack(Material.COAL_BLOCK)));
|
||||
registerFuelType(new MachineFuel(45, new ItemStack(Material.BLAZE_ROD)));
|
||||
registerFuelType(new MachineFuel(70, new ItemStack(Material.DRIED_KELP_BLOCK)));
|
||||
case SOLID:
|
||||
registerFuelType(new MachineFuel(80, new ItemStack(Material.COAL_BLOCK)));
|
||||
registerFuelType(new MachineFuel(45, new ItemStack(Material.BLAZE_ROD)));
|
||||
registerFuelType(new MachineFuel(70, new ItemStack(Material.DRIED_KELP_BLOCK)));
|
||||
|
||||
// Coal & Charcoal
|
||||
registerFuelType(new MachineFuel(8, new ItemStack(Material.COAL)));
|
||||
registerFuelType(new MachineFuel(8, new ItemStack(Material.CHARCOAL)));
|
||||
// Coal & Charcoal
|
||||
registerFuelType(new MachineFuel(8, new ItemStack(Material.COAL)));
|
||||
registerFuelType(new MachineFuel(8, new ItemStack(Material.CHARCOAL)));
|
||||
|
||||
// Logs
|
||||
for (Material mat : Tag.LOGS.getValues()) {
|
||||
registerFuelType(new MachineFuel(2, new ItemStack(mat)));
|
||||
}
|
||||
// Logs
|
||||
for (Material mat : Tag.LOGS.getValues()) {
|
||||
registerFuelType(new MachineFuel(2, new ItemStack(mat)));
|
||||
}
|
||||
|
||||
// Wooden Planks
|
||||
for (Material mat : Tag.PLANKS.getValues()) {
|
||||
registerFuelType(new MachineFuel(1, new ItemStack(mat)));
|
||||
}
|
||||
// Wooden Planks
|
||||
for (Material mat : Tag.PLANKS.getValues()) {
|
||||
registerFuelType(new MachineFuel(1, new ItemStack(mat)));
|
||||
}
|
||||
|
||||
break;
|
||||
case LIQUID:
|
||||
registerFuelType(new MachineFuel(100, new ItemStack(Material.LAVA_BUCKET)));
|
||||
registerFuelType(new MachineFuel(200, SlimefunItems.OIL_BUCKET));
|
||||
registerFuelType(new MachineFuel(500, SlimefunItems.FUEL_BUCKET));
|
||||
break;
|
||||
case NUCLEAR:
|
||||
registerFuelType(new MachineFuel(2500, SlimefunItems.URANIUM));
|
||||
registerFuelType(new MachineFuel(1200, SlimefunItems.NEPTUNIUM));
|
||||
registerFuelType(new MachineFuel(3000, SlimefunItems.BOOSTED_URANIUM));
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unhandled Fuel Source: " + getFuelSource());
|
||||
break;
|
||||
case LIQUID:
|
||||
registerFuelType(new MachineFuel(100, new ItemStack(Material.LAVA_BUCKET)));
|
||||
registerFuelType(new MachineFuel(200, SlimefunItems.OIL_BUCKET));
|
||||
registerFuelType(new MachineFuel(500, SlimefunItems.FUEL_BUCKET));
|
||||
break;
|
||||
case NUCLEAR:
|
||||
registerFuelType(new MachineFuel(2500, SlimefunItems.URANIUM));
|
||||
registerFuelType(new MachineFuel(1200, SlimefunItems.NEPTUNIUM));
|
||||
registerFuelType(new MachineFuel(3000, SlimefunItems.BOOSTED_URANIUM));
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unhandled Fuel Source: " + getFuelSource());
|
||||
}
|
||||
}
|
||||
|
||||
@ -685,26 +685,26 @@ public class ProgrammableAndroid extends SlimefunItem implements InventoryBlock,
|
||||
BlockFace face = rotationData == null ? BlockFace.NORTH : BlockFace.valueOf(rotationData);
|
||||
|
||||
switch (instruction) {
|
||||
case START:
|
||||
case WAIT:
|
||||
// We are "waiting" here, so we only move a step forward
|
||||
BlockStorage.addBlockInfo(b, "index", String.valueOf(index));
|
||||
break;
|
||||
case REPEAT:
|
||||
// "repeat" just means, we reset our index
|
||||
BlockStorage.addBlockInfo(b, "index", String.valueOf(0));
|
||||
break;
|
||||
case CHOP_TREE:
|
||||
// We only move to the next step if we finished chopping wood
|
||||
if (chopTree(b, inv, face)) {
|
||||
case START:
|
||||
case WAIT:
|
||||
// We are "waiting" here, so we only move a step forward
|
||||
BlockStorage.addBlockInfo(b, "index", String.valueOf(index));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// We set the index here in advance to fix moving android issues
|
||||
BlockStorage.addBlockInfo(b, "index", String.valueOf(index));
|
||||
instruction.execute(this, b, inv, face);
|
||||
break;
|
||||
break;
|
||||
case REPEAT:
|
||||
// "repeat" just means, we reset our index
|
||||
BlockStorage.addBlockInfo(b, "index", String.valueOf(0));
|
||||
break;
|
||||
case CHOP_TREE:
|
||||
// We only move to the next step if we finished chopping wood
|
||||
if (chopTree(b, inv, face)) {
|
||||
BlockStorage.addBlockInfo(b, "index", String.valueOf(index));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// We set the index here in advance to fix moving android issues
|
||||
BlockStorage.addBlockInfo(b, "index", String.valueOf(index));
|
||||
instruction.execute(this, b, inv, face);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -110,14 +110,14 @@ public class MultiTool extends SlimefunItem implements Rechargeable {
|
||||
return (e, item, offhand) -> {
|
||||
// Fixes #2217 - Prevent them from being used to shear entities
|
||||
switch (e.getRightClicked().getType()) {
|
||||
case MUSHROOM_COW:
|
||||
case SHEEP:
|
||||
case SNOWMAN:
|
||||
SlimefunPlugin.getLocalization().sendMessage(e.getPlayer(), "messages.multi-tool.not-shears");
|
||||
e.setCancelled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case MUSHROOM_COW:
|
||||
case SHEEP:
|
||||
case SNOWMAN:
|
||||
SlimefunPlugin.getLocalization().sendMessage(e.getPlayer(), "messages.multi-tool.not-shears");
|
||||
e.setCancelled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -128,24 +128,24 @@ public abstract class Reactor extends AbstractEnergyProvider implements Hologram
|
||||
ReactorMode mode = getReactorMode(b.getLocation());
|
||||
|
||||
switch (mode) {
|
||||
case GENERATOR:
|
||||
menu.replaceExistingItem(4, new CustomItem(SlimefunItems.NUCLEAR_REACTOR, "&7Focus: &eElectricity", "", "&6Your Reactor will focus on Power Generation", "&6If your Energy Network doesn't need Power", "&6it will not produce any either", "", "&7\u21E8 Click to change the Focus to &eProduction"));
|
||||
menu.addMenuClickHandler(4, (p, slot, item, action) -> {
|
||||
BlockStorage.addBlockInfo(b, MODE, ReactorMode.PRODUCTION.toString());
|
||||
updateInventory(menu, b);
|
||||
return false;
|
||||
});
|
||||
break;
|
||||
case PRODUCTION:
|
||||
menu.replaceExistingItem(4, new CustomItem(SlimefunItems.PLUTONIUM, "&7Focus: &eProduction", "", "&6Your Reactor will focus on producing goods", "&6If your Energy Network doesn't need Power", "&6it will continue to run and simply will", "&6not generate any Power in the mean time", "", "&7\u21E8 Click to change the Focus to &ePower Generation"));
|
||||
menu.addMenuClickHandler(4, (p, slot, item, action) -> {
|
||||
BlockStorage.addBlockInfo(b, MODE, ReactorMode.GENERATOR.toString());
|
||||
updateInventory(menu, b);
|
||||
return false;
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case GENERATOR:
|
||||
menu.replaceExistingItem(4, new CustomItem(SlimefunItems.NUCLEAR_REACTOR, "&7Focus: &eElectricity", "", "&6Your Reactor will focus on Power Generation", "&6If your Energy Network doesn't need Power", "&6it will not produce any either", "", "&7\u21E8 Click to change the Focus to &eProduction"));
|
||||
menu.addMenuClickHandler(4, (p, slot, item, action) -> {
|
||||
BlockStorage.addBlockInfo(b, MODE, ReactorMode.PRODUCTION.toString());
|
||||
updateInventory(menu, b);
|
||||
return false;
|
||||
});
|
||||
break;
|
||||
case PRODUCTION:
|
||||
menu.replaceExistingItem(4, new CustomItem(SlimefunItems.PLUTONIUM, "&7Focus: &eProduction", "", "&6Your Reactor will focus on producing goods", "&6If your Energy Network doesn't need Power", "&6it will continue to run and simply will", "&6not generate any Power in the mean time", "", "&7\u21E8 Click to change the Focus to &ePower Generation"));
|
||||
menu.addMenuClickHandler(4, (p, slot, item, action) -> {
|
||||
BlockStorage.addBlockInfo(b, MODE, ReactorMode.GENERATOR.toString());
|
||||
updateInventory(menu, b);
|
||||
return false;
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
BlockMenu port = getAccessPort(b.getLocation());
|
||||
|
@ -120,21 +120,21 @@ public class IndustrialMiner extends MultiBlockMachine {
|
||||
Random random = ThreadLocalRandom.current();
|
||||
|
||||
switch (ore) {
|
||||
case COAL_ORE:
|
||||
return new ItemStack(Material.COAL);
|
||||
case DIAMOND_ORE:
|
||||
return new ItemStack(Material.DIAMOND);
|
||||
case EMERALD_ORE:
|
||||
return new ItemStack(Material.EMERALD);
|
||||
case NETHER_QUARTZ_ORE:
|
||||
return new ItemStack(Material.QUARTZ);
|
||||
case REDSTONE_ORE:
|
||||
return new ItemStack(Material.REDSTONE, 4 + random.nextInt(2));
|
||||
case LAPIS_ORE:
|
||||
return new ItemStack(Material.LAPIS_LAZULI, 4 + random.nextInt(4));
|
||||
default:
|
||||
// This includes Iron and Gold ore (and Ancient Debris)
|
||||
return new ItemStack(ore);
|
||||
case COAL_ORE:
|
||||
return new ItemStack(Material.COAL);
|
||||
case DIAMOND_ORE:
|
||||
return new ItemStack(Material.DIAMOND);
|
||||
case EMERALD_ORE:
|
||||
return new ItemStack(Material.EMERALD);
|
||||
case NETHER_QUARTZ_ORE:
|
||||
return new ItemStack(Material.QUARTZ);
|
||||
case REDSTONE_ORE:
|
||||
return new ItemStack(Material.REDSTONE, 4 + random.nextInt(2));
|
||||
case LAPIS_ORE:
|
||||
return new ItemStack(Material.LAPIS_LAZULI, 4 + random.nextInt(4));
|
||||
default:
|
||||
// This includes Iron and Gold ore (and Ancient Debris)
|
||||
return new ItemStack(ore);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,39 +56,39 @@ public class SwordOfBeheading extends SimpleSlimefunItem<EntityKillHandler> {
|
||||
Random random = ThreadLocalRandom.current();
|
||||
|
||||
switch (e.getEntityType()) {
|
||||
case ZOMBIE:
|
||||
if (random.nextInt(100) < chanceZombie.getValue()) {
|
||||
e.getDrops().add(new ItemStack(Material.ZOMBIE_HEAD));
|
||||
}
|
||||
break;
|
||||
case SKELETON:
|
||||
if (random.nextInt(100) < chanceSkeleton.getValue()) {
|
||||
e.getDrops().add(new ItemStack(Material.SKELETON_SKULL));
|
||||
}
|
||||
break;
|
||||
case CREEPER:
|
||||
if (random.nextInt(100) < chanceCreeper.getValue()) {
|
||||
e.getDrops().add(new ItemStack(Material.CREEPER_HEAD));
|
||||
}
|
||||
break;
|
||||
case WITHER_SKELETON:
|
||||
if (random.nextInt(100) < chanceWitherSkeleton.getValue()) {
|
||||
e.getDrops().add(new ItemStack(Material.WITHER_SKELETON_SKULL));
|
||||
}
|
||||
break;
|
||||
case PLAYER:
|
||||
if (random.nextInt(100) < chancePlayer.getValue()) {
|
||||
ItemStack skull = new ItemStack(Material.PLAYER_HEAD);
|
||||
case ZOMBIE:
|
||||
if (random.nextInt(100) < chanceZombie.getValue()) {
|
||||
e.getDrops().add(new ItemStack(Material.ZOMBIE_HEAD));
|
||||
}
|
||||
break;
|
||||
case SKELETON:
|
||||
if (random.nextInt(100) < chanceSkeleton.getValue()) {
|
||||
e.getDrops().add(new ItemStack(Material.SKELETON_SKULL));
|
||||
}
|
||||
break;
|
||||
case CREEPER:
|
||||
if (random.nextInt(100) < chanceCreeper.getValue()) {
|
||||
e.getDrops().add(new ItemStack(Material.CREEPER_HEAD));
|
||||
}
|
||||
break;
|
||||
case WITHER_SKELETON:
|
||||
if (random.nextInt(100) < chanceWitherSkeleton.getValue()) {
|
||||
e.getDrops().add(new ItemStack(Material.WITHER_SKELETON_SKULL));
|
||||
}
|
||||
break;
|
||||
case PLAYER:
|
||||
if (random.nextInt(100) < chancePlayer.getValue()) {
|
||||
ItemStack skull = new ItemStack(Material.PLAYER_HEAD);
|
||||
|
||||
ItemMeta meta = skull.getItemMeta();
|
||||
((SkullMeta) meta).setOwningPlayer((Player) e.getEntity());
|
||||
skull.setItemMeta(meta);
|
||||
ItemMeta meta = skull.getItemMeta();
|
||||
((SkullMeta) meta).setOwningPlayer((Player) e.getEntity());
|
||||
skull.setItemMeta(meta);
|
||||
|
||||
e.getDrops().add(skull);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
e.getDrops().add(skull);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -32,56 +32,56 @@ class OilResource extends SlimefunResource {
|
||||
}
|
||||
|
||||
switch (biome) {
|
||||
case SNOWY_BEACH:
|
||||
case STONE_SHORE:
|
||||
case BEACH:
|
||||
return 6;
|
||||
case SNOWY_BEACH:
|
||||
case STONE_SHORE:
|
||||
case BEACH:
|
||||
return 6;
|
||||
|
||||
case DESERT:
|
||||
case DESERT_HILLS:
|
||||
case DESERT_LAKES:
|
||||
return 45;
|
||||
case DESERT:
|
||||
case DESERT_HILLS:
|
||||
case DESERT_LAKES:
|
||||
return 45;
|
||||
|
||||
case MOUNTAINS:
|
||||
case GRAVELLY_MOUNTAINS:
|
||||
case MOUNTAIN_EDGE:
|
||||
case RIVER:
|
||||
return 17;
|
||||
case MOUNTAINS:
|
||||
case GRAVELLY_MOUNTAINS:
|
||||
case MOUNTAIN_EDGE:
|
||||
case RIVER:
|
||||
return 17;
|
||||
|
||||
case SNOWY_MOUNTAINS:
|
||||
case SNOWY_TUNDRA:
|
||||
case ICE_SPIKES:
|
||||
case FROZEN_OCEAN:
|
||||
case FROZEN_RIVER:
|
||||
return 14;
|
||||
case SNOWY_MOUNTAINS:
|
||||
case SNOWY_TUNDRA:
|
||||
case ICE_SPIKES:
|
||||
case FROZEN_OCEAN:
|
||||
case FROZEN_RIVER:
|
||||
return 14;
|
||||
|
||||
case BADLANDS:
|
||||
case BADLANDS_PLATEAU:
|
||||
case WOODED_BADLANDS_PLATEAU:
|
||||
case ERODED_BADLANDS:
|
||||
case MODIFIED_BADLANDS_PLATEAU:
|
||||
case MODIFIED_WOODED_BADLANDS_PLATEAU:
|
||||
case MUSHROOM_FIELDS:
|
||||
case MUSHROOM_FIELD_SHORE:
|
||||
return 24;
|
||||
case BADLANDS:
|
||||
case BADLANDS_PLATEAU:
|
||||
case WOODED_BADLANDS_PLATEAU:
|
||||
case ERODED_BADLANDS:
|
||||
case MODIFIED_BADLANDS_PLATEAU:
|
||||
case MODIFIED_WOODED_BADLANDS_PLATEAU:
|
||||
case MUSHROOM_FIELDS:
|
||||
case MUSHROOM_FIELD_SHORE:
|
||||
return 24;
|
||||
|
||||
case DEEP_OCEAN:
|
||||
case OCEAN:
|
||||
case COLD_OCEAN:
|
||||
case DEEP_COLD_OCEAN:
|
||||
case DEEP_FROZEN_OCEAN:
|
||||
case DEEP_LUKEWARM_OCEAN:
|
||||
case DEEP_WARM_OCEAN:
|
||||
case LUKEWARM_OCEAN:
|
||||
case WARM_OCEAN:
|
||||
return 62;
|
||||
case DEEP_OCEAN:
|
||||
case OCEAN:
|
||||
case COLD_OCEAN:
|
||||
case DEEP_COLD_OCEAN:
|
||||
case DEEP_FROZEN_OCEAN:
|
||||
case DEEP_LUKEWARM_OCEAN:
|
||||
case DEEP_WARM_OCEAN:
|
||||
case LUKEWARM_OCEAN:
|
||||
case WARM_OCEAN:
|
||||
return 62;
|
||||
|
||||
case SWAMP:
|
||||
case SWAMP_HILLS:
|
||||
return 20;
|
||||
case SWAMP:
|
||||
case SWAMP_HILLS:
|
||||
return 20;
|
||||
|
||||
default:
|
||||
return 10;
|
||||
default:
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,33 +26,33 @@ class SaltResource extends SlimefunResource {
|
||||
}
|
||||
|
||||
switch (biome) {
|
||||
case SNOWY_BEACH:
|
||||
case STONE_SHORE:
|
||||
case BEACH:
|
||||
case DESERT_LAKES:
|
||||
case RIVER:
|
||||
case ICE_SPIKES:
|
||||
case FROZEN_RIVER:
|
||||
return 40;
|
||||
case SNOWY_BEACH:
|
||||
case STONE_SHORE:
|
||||
case BEACH:
|
||||
case DESERT_LAKES:
|
||||
case RIVER:
|
||||
case ICE_SPIKES:
|
||||
case FROZEN_RIVER:
|
||||
return 40;
|
||||
|
||||
case DEEP_OCEAN:
|
||||
case OCEAN:
|
||||
case COLD_OCEAN:
|
||||
case DEEP_COLD_OCEAN:
|
||||
case DEEP_FROZEN_OCEAN:
|
||||
case DEEP_LUKEWARM_OCEAN:
|
||||
case DEEP_WARM_OCEAN:
|
||||
case FROZEN_OCEAN:
|
||||
case LUKEWARM_OCEAN:
|
||||
case WARM_OCEAN:
|
||||
return 60;
|
||||
case DEEP_OCEAN:
|
||||
case OCEAN:
|
||||
case COLD_OCEAN:
|
||||
case DEEP_COLD_OCEAN:
|
||||
case DEEP_FROZEN_OCEAN:
|
||||
case DEEP_LUKEWARM_OCEAN:
|
||||
case DEEP_WARM_OCEAN:
|
||||
case FROZEN_OCEAN:
|
||||
case LUKEWARM_OCEAN:
|
||||
case WARM_OCEAN:
|
||||
return 60;
|
||||
|
||||
case SWAMP:
|
||||
case SWAMP_HILLS:
|
||||
return 20;
|
||||
case SWAMP:
|
||||
case SWAMP_HILLS:
|
||||
return 20;
|
||||
|
||||
default:
|
||||
return 6;
|
||||
default:
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,49 +59,49 @@ public class CustomItemSerializer {
|
||||
builder.append(flag.toString() + "=");
|
||||
|
||||
switch (flag) {
|
||||
case AMOUNT: {
|
||||
builder.append(item.getAmount());
|
||||
break;
|
||||
}
|
||||
case DATA: {
|
||||
builder.append((int) item.getData().getData());
|
||||
break;
|
||||
}
|
||||
case DURABILITY: {
|
||||
builder.append((int) item.getDurability());
|
||||
break;
|
||||
}
|
||||
case ENCHANTMENTS:
|
||||
for (Enchantment enchantment : Enchantment.values()) {
|
||||
if (item.getEnchantments().containsKey(enchantment)) {
|
||||
builder.append(enchantment.getName() + ":" + item.getEnchantmentLevel(enchantment));
|
||||
} else {
|
||||
builder.append(enchantment.getName() + ":0");
|
||||
case AMOUNT: {
|
||||
builder.append(item.getAmount());
|
||||
break;
|
||||
}
|
||||
case DATA: {
|
||||
builder.append((int) item.getData().getData());
|
||||
break;
|
||||
}
|
||||
case DURABILITY: {
|
||||
builder.append((int) item.getDurability());
|
||||
break;
|
||||
}
|
||||
case ENCHANTMENTS:
|
||||
for (Enchantment enchantment : Enchantment.values()) {
|
||||
if (item.getEnchantments().containsKey(enchantment)) {
|
||||
builder.append(enchantment.getName() + ":" + item.getEnchantmentLevel(enchantment));
|
||||
} else {
|
||||
builder.append(enchantment.getName() + ":0");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ITEMMETA_DISPLAY_NAME: {
|
||||
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()) {
|
||||
builder.append(item.getItemMeta().getDisplayName().replaceAll("\\u00a7", "&"));
|
||||
} else {
|
||||
builder.append("NONE");
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ITEMMETA_DISPLAY_NAME: {
|
||||
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()) {
|
||||
builder.append(item.getItemMeta().getDisplayName().replaceAll("\\u00a7", "&"));
|
||||
} else {
|
||||
builder.append("NONE");
|
||||
case ITEMMETA_LORE: {
|
||||
if (item.hasItemMeta() && item.getItemMeta().hasLore()) {
|
||||
builder.append(item.getItemMeta().getLore().toString().replaceAll("\\u00a7", "&"));
|
||||
} else {
|
||||
builder.append("NONE");
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ITEMMETA_LORE: {
|
||||
if (item.hasItemMeta() && item.getItemMeta().hasLore()) {
|
||||
builder.append(item.getItemMeta().getLore().toString().replaceAll("\\u00a7", "&"));
|
||||
} else {
|
||||
builder.append("NONE");
|
||||
case MATERIAL: {
|
||||
builder.append(item.getType().toString());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MATERIAL: {
|
||||
builder.append(item.getType().toString());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
i++;
|
||||
|
@ -378,7 +378,8 @@ public class BlockStorage {
|
||||
* This will return an {@link ImmutableMap} of the underline {@code Map<String, Config>} of
|
||||
* this worlds {@link BlockStorage}. If there is no registered world then this will return null.
|
||||
*
|
||||
* @param world The world of which to fetch the data from.
|
||||
* @param world
|
||||
* The world of which to fetch the data from.
|
||||
* @return An {@link ImmutableMap} of the raw data or null if the world isn't registered.
|
||||
*/
|
||||
@Nullable
|
||||
|
@ -1,12 +1,7 @@
|
||||
package io.github.thebusybiscuit.slimefun4.testing.tests.utils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import be.seeseemelk.mockbukkit.MockBukkit;
|
||||
import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChargeUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -17,6 +12,11 @@ import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import be.seeseemelk.mockbukkit.MockBukkit;
|
||||
import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChargeUtils;
|
||||
|
||||
class TestChargeUtils {
|
||||
|
||||
@BeforeAll
|
||||
|
Loading…
Reference in New Issue
Block a user