mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Oil Pump now shows its "Bucket -> Oil" recipe.
This commit is contained in:
parent
5d5c0cbc8a
commit
9ff093affa
@ -55,6 +55,7 @@ https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#4
|
|||||||
* Removed Nether Drill
|
* Removed Nether Drill
|
||||||
* Tweaked Enhanced Furnace Recipes
|
* Tweaked Enhanced Furnace Recipes
|
||||||
* Changed tooltips for Radiation
|
* Changed tooltips for Radiation
|
||||||
|
* Oil Pump now shows its "Bucket -> Oil" recipe
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
* Fixed Research Titles
|
* Fixed Research Titles
|
||||||
|
@ -6,6 +6,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.TileState;
|
import org.bukkit.block.TileState;
|
||||||
|
|
||||||
import io.github.thebusybiscuit.cscorelib2.collections.OptionalMap;
|
import io.github.thebusybiscuit.cscorelib2.collections.OptionalMap;
|
||||||
@ -41,15 +42,23 @@ public class SlimefunWorld {
|
|||||||
* @return An {@link Optional} of the requested {@link SlimefunBlock}, empty if none was found
|
* @return An {@link Optional} of the requested {@link SlimefunBlock}, empty if none was found
|
||||||
*/
|
*/
|
||||||
public Optional<SlimefunBlock> getBlock(Block b) {
|
public Optional<SlimefunBlock> getBlock(Block b) {
|
||||||
if (b.getState() instanceof TileState) {
|
Optional<SlimefunBlock> optional = blocks.get(new BlockLocation(b));
|
||||||
Optional<String> blockData = SlimefunPlugin.getBlockDataService().getBlockData((TileState) b.getState());
|
|
||||||
|
|
||||||
if (blockData.isPresent()) {
|
|
||||||
return Optional.of(new SlimefunBlock(blockData.get()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return blocks.get(new BlockLocation(b));
|
if (optional.isPresent()) {
|
||||||
|
return optional;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
BlockState state = b.getState();
|
||||||
|
if (state instanceof TileState) {
|
||||||
|
Optional<String> blockData = SlimefunPlugin.getBlockDataService().getBlockData((TileState) state);
|
||||||
|
|
||||||
|
if (blockData.isPresent()) {
|
||||||
|
return Optional.of(new SlimefunBlock(blockData.get()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBlock(Block b, String id) {
|
public boolean isBlock(Block b, String id) {
|
||||||
|
@ -3,6 +3,7 @@ package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.items;
|
|||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.data.Ageable;
|
import org.bukkit.block.data.Ageable;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -23,12 +24,13 @@ public class InfernalBonemeal extends SimpleSlimefunItem<ItemInteractionHandler>
|
|||||||
public ItemInteractionHandler getItemHandler() {
|
public ItemInteractionHandler getItemHandler() {
|
||||||
return (e, p, item) -> {
|
return (e, p, item) -> {
|
||||||
if (isItem(item)) {
|
if (isItem(item)) {
|
||||||
if (e.getClickedBlock() != null && e.getClickedBlock().getType() == Material.NETHER_WART) {
|
Block b = e.getClickedBlock();
|
||||||
Ageable ageable = (Ageable) e.getClickedBlock().getBlockData();
|
if (b != null && b.getType() == Material.NETHER_WART) {
|
||||||
|
Ageable ageable = (Ageable) b.getBlockData();
|
||||||
if (ageable.getAge() < ageable.getMaximumAge()) {
|
if (ageable.getAge() < ageable.getMaximumAge()) {
|
||||||
ageable.setAge(ageable.getMaximumAge());
|
ageable.setAge(ageable.getMaximumAge());
|
||||||
e.getClickedBlock().setBlockData(ageable);
|
b.setBlockData(ageable);
|
||||||
e.getClickedBlock().getWorld().playEffect(e.getClickedBlock().getLocation(), Effect.STEP_SOUND, Material.REDSTONE_BLOCK);
|
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, Material.REDSTONE_BLOCK);
|
||||||
|
|
||||||
if (p.getGameMode() != GameMode.CREATIVE) {
|
if (p.getGameMode() != GameMode.CREATIVE) {
|
||||||
ItemUtils.consumeItem(item, false);
|
ItemUtils.consumeItem(item, false);
|
||||||
|
@ -64,10 +64,11 @@ public class Crucible extends SlimefunGadget {
|
|||||||
addItemHandler((ItemInteractionHandler) (e, p, item) -> {
|
addItemHandler((ItemInteractionHandler) (e, p, item) -> {
|
||||||
if (e.getClickedBlock() != null) {
|
if (e.getClickedBlock() != null) {
|
||||||
String id = BlockStorage.checkID(e.getClickedBlock());
|
String id = BlockStorage.checkID(e.getClickedBlock());
|
||||||
|
|
||||||
if (id != null && id.equals("CRUCIBLE")) {
|
if (id != null && id.equals("CRUCIBLE")) {
|
||||||
if (p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, e.getClickedBlock().getLocation(), ProtectableAction.ACCESS_INVENTORIES)) {
|
if (p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, e.getClickedBlock().getLocation(), ProtectableAction.ACCESS_INVENTORIES)) {
|
||||||
final ItemStack input = p.getInventory().getItemInMainHand();
|
ItemStack input = p.getInventory().getItemInMainHand();
|
||||||
final Block block = e.getClickedBlock().getRelative(BlockFace.UP);
|
Block block = e.getClickedBlock().getRelative(BlockFace.UP);
|
||||||
SlimefunItem machine = SlimefunItem.getByID(id);
|
SlimefunItem machine = SlimefunItem.getByID(id);
|
||||||
|
|
||||||
for (ItemStack convert : RecipeType.getRecipeInputs(machine)) {
|
for (ItemStack convert : RecipeType.getRecipeInputs(machine)) {
|
||||||
@ -79,8 +80,10 @@ public class Crucible extends SlimefunGadget {
|
|||||||
p.getInventory().removeItem(removing);
|
p.getInventory().removeItem(removing);
|
||||||
|
|
||||||
boolean water = Tag.LEAVES.isTagged(input.getType());
|
boolean water = Tag.LEAVES.isTagged(input.getType());
|
||||||
|
|
||||||
if (block.getType() == (water ? Material.WATER : Material.LAVA)) {
|
if (block.getType() == (water ? Material.WATER : Material.LAVA)) {
|
||||||
int level = ((Levelled) block.getBlockData()).getLevel();
|
int level = ((Levelled) block.getBlockData()).getLevel();
|
||||||
|
|
||||||
if (level > 7)
|
if (level > 7)
|
||||||
level -= 8;
|
level -= 8;
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
@ -112,8 +115,11 @@ public class Crucible extends SlimefunGadget {
|
|||||||
block.getWorld().playSound(block.getLocation(), Sound.BLOCK_METAL_BREAK, 1F, 1F);
|
block.getWorld().playSound(block.getLocation(), Sound.BLOCK_METAL_BREAK, 1F, 1F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (BlockStorage.hasBlockInfo(block))
|
|
||||||
|
if (BlockStorage.hasBlockInfo(block)) {
|
||||||
BlockStorage.clearBlockInfo(block);
|
BlockStorage.clearBlockInfo(block);
|
||||||
|
}
|
||||||
|
|
||||||
block.getWorld().playSound(block.getLocation(), Sound.BLOCK_LAVA_EXTINGUISH, 1F, 1F);
|
block.getWorld().playSound(block.getLocation(), Sound.BLOCK_LAVA_EXTINGUISH, 1F, 1F);
|
||||||
}
|
}
|
||||||
block.setType(water ? Material.WATER : Material.LAVA);
|
block.setType(water ? Material.WATER : Material.LAVA);
|
||||||
|
@ -11,6 +11,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
import io.github.thebusybiscuit.cscorelib2.blocks.Vein;
|
import io.github.thebusybiscuit.cscorelib2.blocks.Vein;
|
||||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||||
|
import io.github.thebusybiscuit.slimefun4.core.utils.ChestMenuUtils;
|
||||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
|
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
|
||||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
|
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
|
||||||
@ -43,14 +44,14 @@ public class FluidPump extends SimpleSlimefunItem<BlockTicker> implements Invent
|
|||||||
|
|
||||||
private void constructMenu(BlockMenuPreset preset) {
|
private void constructMenu(BlockMenuPreset preset) {
|
||||||
for (int i : border) {
|
for (int i : border) {
|
||||||
preset.addItem(i, new CustomItem(new ItemStack(Material.GRAY_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false);
|
preset.addItem(i, new CustomItem(new ItemStack(Material.GRAY_STAINED_GLASS_PANE), " "), ChestMenuUtils.getEmptyClickHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i : border_in) {
|
for (int i : border_in) {
|
||||||
preset.addItem(i, new CustomItem(new ItemStack(Material.CYAN_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false);
|
preset.addItem(i, new CustomItem(new ItemStack(Material.CYAN_STAINED_GLASS_PANE), " "), ChestMenuUtils.getEmptyClickHandler());
|
||||||
}
|
}
|
||||||
for (int i : border_out) {
|
for (int i : border_out) {
|
||||||
preset.addItem(i, new CustomItem(new ItemStack(Material.ORANGE_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false);
|
preset.addItem(i, new CustomItem(new ItemStack(Material.ORANGE_STAINED_GLASS_PANE), " "), ChestMenuUtils.getEmptyClickHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i : getOutputSlots()) {
|
for (int i : getOutputSlots()) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.geo;
|
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.geo;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import me.mrCookieSlime.Slimefun.GEO.GEOScanner;
|
import me.mrCookieSlime.Slimefun.GEO.GEOScanner;
|
||||||
@ -24,12 +25,14 @@ public class GEOScannerBlock extends SimpleSlimefunItem<ItemInteractionHandler>
|
|||||||
@Override
|
@Override
|
||||||
public ItemInteractionHandler getItemHandler() {
|
public ItemInteractionHandler getItemHandler() {
|
||||||
return (e, p, stack) -> {
|
return (e, p, stack) -> {
|
||||||
if (e.getClickedBlock() == null) return false;
|
Block b = e.getClickedBlock();
|
||||||
String item = BlockStorage.checkID(e.getClickedBlock());
|
|
||||||
|
if (b == null) return false;
|
||||||
|
String item = BlockStorage.checkID(b);
|
||||||
if (item == null || !item.equals(getID())) return false;
|
if (item == null || !item.equals(getID())) return false;
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
|
||||||
GEOScanner.scanChunk(p, e.getClickedBlock().getChunk());
|
GEOScanner.scanChunk(p, b.getChunk());
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.geo;
|
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.geo;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -16,6 +19,7 @@ import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
|||||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
|
||||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
|
||||||
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
|
||||||
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
|
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
|
||||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||||
@ -25,7 +29,7 @@ import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
|
|||||||
import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
|
import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
|
||||||
import me.mrCookieSlime.Slimefun.utils.MachineHelper;
|
import me.mrCookieSlime.Slimefun.utils.MachineHelper;
|
||||||
|
|
||||||
public abstract class OilPump extends AContainer {
|
public abstract class OilPump extends AContainer implements RecipeDisplayItem {
|
||||||
|
|
||||||
public OilPump(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
public OilPump(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||||
super(category, item, recipeType, recipe);
|
super(category, item, recipeType, recipe);
|
||||||
@ -58,6 +62,11 @@ public abstract class OilPump extends AContainer {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getDisplayRecipes() {
|
||||||
|
return Arrays.asList(new ItemStack(Material.BUCKET), SlimefunItems.BUCKET_OF_OIL);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMachineIdentifier() {
|
public String getMachineIdentifier() {
|
||||||
return "OIL_PUMP";
|
return "OIL_PUMP";
|
||||||
@ -113,7 +122,7 @@ public abstract class OilPump extends AContainer {
|
|||||||
else {
|
else {
|
||||||
ItemStack item = inv.getItemInSlot(slot).clone();
|
ItemStack item = inv.getItemInSlot(slot).clone();
|
||||||
inv.replaceExistingItem(slot, null);
|
inv.replaceExistingItem(slot, null);
|
||||||
pushItems(b, item);
|
inv.pushItem(item, getOutputSlots());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -28,11 +28,9 @@ import io.github.thebusybiscuit.slimefun4.implementation.geo.resources.OilResour
|
|||||||
import io.github.thebusybiscuit.slimefun4.implementation.geo.resources.SaltResource;
|
import io.github.thebusybiscuit.slimefun4.implementation.geo.resources.SaltResource;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.geo.resources.UraniumResource;
|
import io.github.thebusybiscuit.slimefun4.implementation.geo.resources.UraniumResource;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.AndroidKillingListener;
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.AndroidKillingListener;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBootsListener;
|
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.AutonomousToolsListener;
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.AutonomousToolsListener;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BackpackListener;
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BackpackListener;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockListener;
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockListener;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBowListener;
|
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.CoolerListener;
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.CoolerListener;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.DamageListener;
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.DamageListener;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.EnhancedFurnaceListener;
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.EnhancedFurnaceListener;
|
||||||
@ -42,6 +40,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.ItemPickupLis
|
|||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.MultiBlockListener;
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.MultiBlockListener;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.NetworkListener;
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.NetworkListener;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.PlayerProfileListener;
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.PlayerProfileListener;
|
||||||
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBootsListener;
|
||||||
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBowListener;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunGuideListener;
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunGuideListener;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SoulboundListener;
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SoulboundListener;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.TalismanListener;
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.TalismanListener;
|
||||||
@ -335,7 +335,7 @@ public final class SlimefunPlugin extends JavaPlugin {
|
|||||||
getLogger().log(Level.SEVERE, "Could not save Slimefun Blocks for World \"" + world.getName() + "\"");
|
getLogger().log(Level.SEVERE, "Could not save Slimefun Blocks for World \"" + world.getName() + "\"");
|
||||||
}
|
}
|
||||||
} catch (Exception x) {
|
} catch (Exception x) {
|
||||||
getLogger().log(Level.SEVERE, "An Error occured while saving Slimefun-Blocks in World '" + world.getName() + "' for Slimefun " + Slimefun.getVersion());
|
getLogger().log(Level.SEVERE, "An Error occured while saving Slimefun-Blocks in World '" + world.getName() + "' for Slimefun " + Slimefun.getVersion(), x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,19 +270,6 @@ public final class Slimefun {
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Binds this description to the SlimefunItem corresponding to this id.
|
|
||||||
*
|
|
||||||
* @param id the id of the SlimefunItem, not null
|
|
||||||
* @param description the description, not null
|
|
||||||
*
|
|
||||||
* @deprecated As of 4.1.10, renamed to {@link #addHint(String, String...)} for better name convenience.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void addDescription(String id, String... description) {
|
|
||||||
getItemConfig().setDefaultValue(id + ".description", Arrays.asList(description));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binds this hint to the SlimefunItem corresponding to this id.
|
* Binds this hint to the SlimefunItem corresponding to this id.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user