1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Updated with requested changes

This commit is contained in:
dNiym 2019-08-18 14:47:25 -04:00
parent 8a56939931
commit aeacac0b01
2 changed files with 39 additions and 40 deletions

View File

@ -46,14 +46,14 @@ public abstract class AReactor extends SlimefunItem {
private static final BlockFace[] cooling =
{
BlockFace.NORTH,
BlockFace.NORTH_EAST,
BlockFace.EAST,
BlockFace.SOUTH_EAST,
BlockFace.SOUTH,
BlockFace.SOUTH_WEST,
BlockFace.WEST,
BlockFace.NORTH_WEST
BlockFace.NORTH,
BlockFace.NORTH_EAST,
BlockFace.EAST,
BlockFace.SOUTH_EAST,
BlockFace.SOUTH,
BlockFace.SOUTH_WEST,
BlockFace.WEST,
BlockFace.NORTH_WEST
};
private Set<MachineFuel> recipes = new HashSet<MachineFuel>();
@ -101,9 +101,9 @@ public abstract class AReactor extends SlimefunItem {
if(ap != null) {
menu.replaceExistingItem(infoSlot, new CustomItem(new ItemStack(Material.GREEN_WOOL), "&7Access Port", "", "&6Detected", "", "&7> Click to view Access Port"));
menu.addMenuClickHandler(infoSlot, (p, slot, item, action) -> {
ap.open(p);
newInstance(menu, b);
ap.open(p);
newInstance(menu, b);
return false;
});
} else {
@ -114,12 +114,12 @@ public abstract class AReactor extends SlimefunItem {
return false;
});
}
} catch(Exception x) {
}
}
@Override
public boolean canOpen(Block b, Player p) {
return p.hasPermission("slimefun.inventory.bypass") || CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true);
@ -173,34 +173,34 @@ public abstract class AReactor extends SlimefunItem {
private void constructMenu(BlockMenuPreset preset) {
for (int i : border) {
preset.addItem(i, new CustomItem(new ItemStack(Material.GRAY_STAINED_GLASS_PANE), " "),
(p, slot, item, action) -> false
);
(p, slot, item, action) -> false
);
}
for (int i : border_1) {
preset.addItem(i, new CustomItem(new ItemStack(Material.LIME_STAINED_GLASS_PANE), " "),
(p, slot, item, action) -> false
);
(p, slot, item, action) -> false
);
}
for (int i : border_3) {
preset.addItem(i, new CustomItem(new ItemStack(Material.GREEN_STAINED_GLASS_PANE), " "),
(p, slot, item, action) -> false
);
(p, slot, item, action) -> false
);
}
preset.addItem(22, new CustomItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE), " "),
(p, slot, item, action) -> false
);
(p, slot, item, action) -> false
);
preset.addItem(1, new CustomItem(SlimefunItems.URANIUM, "&7Fuel Slot", "", "&rThis Slot accepts radioactive Fuel such as:", "&2Uranium &ror &aNeptunium"),
(p, slot, item, action) -> false
);
(p, slot, item, action) -> false
);
for (int i : border_2) {
preset.addItem(i, new CustomItem(new ItemStack(Material.CYAN_STAINED_GLASS_PANE), " "),
(p, slot, item, action) -> false
);
(p, slot, item, action) -> false
);
}
if (needsCooling()) {
@ -211,8 +211,8 @@ public abstract class AReactor extends SlimefunItem {
for (int i : border_4) {
preset.addItem(i, new CustomItem(new ItemStack(Material.BARRIER), "&cNo Coolant Required"),
(p, slot, item, action) -> false
);
(p, slot, item, action) -> false
);
}
}
}
@ -369,15 +369,15 @@ public abstract class AReactor extends SlimefunItem {
}
outer:
for (MachineFuel recipe: recipes) {
for (int slot: getFuelSlots()) {
if (SlimefunManager.isItemSimiliar(BlockStorage.getInventory(l).getItemInSlot(slot), recipe.getInput(), true)) {
found.put(slot, recipe.getInput().getAmount());
r = recipe;
break outer;
for (MachineFuel recipe: recipes) {
for (int slot: getFuelSlots()) {
if (SlimefunManager.isItemSimiliar(BlockStorage.getInventory(l).getItemInSlot(slot), recipe.getInput(), true)) {
found.put(slot, recipe.getInput().getAmount());
r = recipe;
break outer;
}
}
}
}
if (r != null) {
for (Map.Entry<Integer, Integer> entry: found.entrySet()) {
@ -395,11 +395,11 @@ public abstract class AReactor extends SlimefunItem {
final boolean explosion = explode.contains(l);
if (explosion) {
BlockStorage.getInventory(l).close();
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, () -> {
ReactorHologram.remove(l);
}, 0);
explode.remove(l);
processing.remove(l);
progress.remove(l);
@ -467,7 +467,7 @@ public abstract class AReactor extends SlimefunItem {
public BlockMenu getAccessPort(Location l) {
Location portL = new Location(l.getWorld(), l.getX(), l.getY() + 3, l.getZ());
if (BlockStorage.check(portL, "REACTOR_ACCESS_PORT")) return BlockStorage.getInventory(portL);
return null;
}

View File

@ -193,6 +193,7 @@ public class ReactorAccessPort extends SlimefunItem {
public AReactor getReactor(Location l) {
Location reactorL = new Location(l.getWorld(), l.getX(), l.getY() - 3, l.getZ());
SlimefunItem item = BlockStorage.check(reactorL.getBlock());
if(item instanceof AReactor)
return (AReactor) item;
@ -203,9 +204,7 @@ public class ReactorAccessPort extends SlimefunItem {
public BlockMenu getReactorMenu(Location l) {
Location reactorL = new Location(l.getWorld(), l.getX(), l.getY() - 3, l.getZ());
SlimefunItem item = BlockStorage.check(reactorL);
if(item != null && (item.getID().equals("NUCLEAR_REACTOR") || item.getID().equals("NETHERSTAR_REACTOR")))
if(BlockStorage.checkID(reactorL).equals("NUCLEAR_REACTOR") || BlockStorage.checkID(reactorL).equals("NETHERSTAR_REACTOR"))
return BlockStorage.getInventory(reactorL);
return null;