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

Been a while

This commit is contained in:
CURVX 2020-11-12 22:20:36 +05:30
parent bd461a6f88
commit 527dfb2b79
9 changed files with 67 additions and 6 deletions

View File

@ -98,6 +98,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.crafting.Cart
import io.github.thebusybiscuit.slimefun4.implementation.listeners.crafting.CauldronListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.crafting.CauldronListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.crafting.CraftingTableListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.crafting.CraftingTableListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.crafting.GrindstoneListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.crafting.GrindstoneListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.crafting.HopperListener;
import io.github.thebusybiscuit.slimefun4.implementation.resources.GEOResourcesSetup; import io.github.thebusybiscuit.slimefun4.implementation.resources.GEOResourcesSetup;
import io.github.thebusybiscuit.slimefun4.implementation.setup.PostSetup; import io.github.thebusybiscuit.slimefun4.implementation.setup.PostSetup;
import io.github.thebusybiscuit.slimefun4.implementation.setup.ResearchSetup; import io.github.thebusybiscuit.slimefun4.implementation.setup.ResearchSetup;
@ -475,6 +476,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
new CauldronListener(this); new CauldronListener(this);
new GrindstoneListener(this); new GrindstoneListener(this);
new CartographyTableListener(this); new CartographyTableListener(this);
new HopperListener(this);
if (minecraftVersion.isAtLeast(MinecraftVersion.MINECRAFT_1_15)) { if (minecraftVersion.isAtLeast(MinecraftVersion.MINECRAFT_1_15)) {
new BeeListener(this); new BeeListener(this);

View File

@ -5,6 +5,7 @@ import java.util.Map;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.VanillaContainer;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.inventory.meta.PotionMeta;
@ -26,7 +27,7 @@ import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
* @author Linox * @author Linox
* *
*/ */
public class AutoBrewer extends AContainer { public class AutoBrewer extends VanillaContainer {
private static final Map<Material, PotionType> potionRecipes = new EnumMap<>(Material.class); private static final Map<Material, PotionType> potionRecipes = new EnumMap<>(Material.class);
private static final Map<PotionType, PotionType> fermentations = new EnumMap<>(PotionType.class); private static final Map<PotionType, PotionType> fermentations = new EnumMap<>(PotionType.class);

View File

@ -3,6 +3,7 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machine
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.VanillaContainer;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Tag; import org.bukkit.Tag;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -22,7 +23,7 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
* @author Linox * @author Linox
* *
*/ */
public class AutoDrier extends AContainer implements RecipeDisplayItem { public class AutoDrier extends VanillaContainer implements RecipeDisplayItem {
private List<ItemStack> recipeList; private List<ItemStack> recipeList;

View File

@ -1,5 +1,6 @@
package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines; package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.VanillaContainer;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.FurnaceRecipe; import org.bukkit.inventory.FurnaceRecipe;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -12,7 +13,7 @@ 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.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
public class ElectricFurnace extends AContainer { public class ElectricFurnace extends VanillaContainer {
public ElectricFurnace(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { public ElectricFurnace(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe); super(category, item, recipeType, recipe);

View File

@ -3,6 +3,7 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machine
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.VanillaContainer;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -23,7 +24,7 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
* @see ElectricIngotFactory * @see ElectricIngotFactory
* *
*/ */
public class ElectricIngotPulverizer extends AContainer implements RecipeDisplayItem { public class ElectricIngotPulverizer extends VanillaContainer implements RecipeDisplayItem {
public ElectricIngotPulverizer(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { public ElectricIngotPulverizer(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe); super(category, item, recipeType, recipe);

View File

@ -1,5 +1,6 @@
package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines; package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.VanillaContainer;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -9,7 +10,7 @@ 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.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
public class ElectricOreGrinder extends AContainer implements RecipeDisplayItem { public class ElectricOreGrinder extends VanillaContainer implements RecipeDisplayItem {
public ElectricOreGrinder(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { public ElectricOreGrinder(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe); super(category, item, recipeType, recipe);

View File

@ -5,6 +5,7 @@ import java.util.Comparator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.VanillaContainer;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -35,7 +36,7 @@ import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
* @author TheBusyBiscuit * @author TheBusyBiscuit
* *
*/ */
public class ElectricSmeltery extends AContainer { public class ElectricSmeltery extends VanillaContainer {
private static final int[] border = { 4, 5, 6, 7, 8, 13, 31, 40, 41, 42, 43, 44 }; private static final int[] border = { 4, 5, 6, 7, 8, 13, 31, 40, 41, 42, 43, 44 };
private static final int[] inputBorder = { 0, 1, 2, 3, 9, 12, 18, 21, 27, 30, 36, 37, 38, 39 }; private static final int[] inputBorder = { 0, 1, 2, 3, 9, 12, 18, 21, 27, 30, 36, 37, 38, 39 };

View File

@ -0,0 +1,36 @@
package io.github.thebusybiscuit.slimefun4.implementation.listeners.crafting;
import javax.annotation.Nonnull;
import org.bukkit.Location;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryMoveItemEvent;
import org.bukkit.event.inventory.InventoryType;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.VanillaContainer;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
/**
* This {@link Listener} prevents item from being transferred to a
* {@link VanillaContainer} using a hopper.
*
*/
public class HopperListener implements SlimefunCraftingListener {
public HopperListener(@Nonnull SlimefunPlugin plugin) {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler
public void fromHopper(InventoryMoveItemEvent e) {
Location loc = e.getDestination().getLocation();
if (e.getSource().getType() == InventoryType.HOPPER && loc != null && BlockStorage.hasBlockInfo(loc)) {
if (BlockStorage.check(loc.getBlock()) instanceof VanillaContainer) {
e.setCancelled(true);
}
}
}
}

View File

@ -0,0 +1,17 @@
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems;
import javax.annotation.ParametersAreNonnullByDefault;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
public abstract class VanillaContainer extends AContainer {
@ParametersAreNonnullByDefault
public VanillaContainer(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
}
}