mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Merge branch 'master' into feature/auto-crafters
This commit is contained in:
commit
320ee27b3d
4
.github/workflows/auto-approve.yml
vendored
4
.github/workflows/auto-approve.yml
vendored
@ -11,12 +11,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Approve via actions
|
||||
uses: hmarr/auto-approve-action@v2.0.0
|
||||
uses: hmarr/auto-approve-action@v2.1.0
|
||||
if: github.actor == 'gitlocalize-app[bot]'
|
||||
with:
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
- name: Approve via TheBusyBot
|
||||
uses: hmarr/auto-approve-action@v2.0.0
|
||||
uses: hmarr/auto-approve-action@v2.1.0
|
||||
if: github.actor == 'gitlocalize-app[bot]' || github.actor == 'renovate[bot]'
|
||||
with:
|
||||
github-token: "${{ secrets.ACCESS_TOKEN }}"
|
||||
|
@ -29,9 +29,11 @@
|
||||
* Added Enhanced Auto Crafter
|
||||
|
||||
#### Changes
|
||||
* Changed item order in guide for the Villager Rune and Nether Goo (All runes are now grouped together)
|
||||
|
||||
#### Fixes
|
||||
* Fixed #1161
|
||||
* Fixed #2862
|
||||
|
||||
## Release Candidate 21 (14 Mar 2021)
|
||||
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#21
|
||||
|
@ -93,7 +93,6 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.SoulboundList
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.TalismanListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.VampireBladeListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.VillagerTradingListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.WorldListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.crafting.AnvilListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.crafting.BrewingStandListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.crafting.CartographyTableListener;
|
||||
@ -667,9 +666,6 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
||||
// Handle Slimefun Guide being given on Join
|
||||
new SlimefunGuideListener(this, config.getBoolean("guide.receive-on-first-join"));
|
||||
|
||||
// Load/Unload Worlds in Slimefun
|
||||
new WorldListener(this);
|
||||
|
||||
// Clear the Slimefun Guide History upon Player Leaving
|
||||
new PlayerProfileListener(this);
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.block.Block;
|
||||
@ -12,6 +15,7 @@ import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
|
||||
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.handlers.SimpleBlockBreakHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||
@ -20,6 +24,7 @@ import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock;
|
||||
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker;
|
||||
import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
||||
@ -34,20 +39,27 @@ public class AutoBreeder extends SlimefunItem implements InventoryBlock, EnergyN
|
||||
// We wanna strip the Slimefun Item id here
|
||||
private static final ItemStack organicFood = new ItemStackWrapper(SlimefunItems.ORGANIC_FOOD);
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
public AutoBreeder(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
super(category, item, recipeType, recipe);
|
||||
|
||||
addItemHandler(onBreak());
|
||||
createPreset(this, this::constructMenu);
|
||||
}
|
||||
|
||||
registerBlockHandler(getId(), (p, b, tool, reason) -> {
|
||||
BlockMenu inv = BlockStorage.getInventory(b);
|
||||
@Nonnull
|
||||
private ItemHandler onBreak() {
|
||||
return new SimpleBlockBreakHandler() {
|
||||
|
||||
if (inv != null) {
|
||||
inv.dropItems(b.getLocation(), getInputSlots());
|
||||
@Override
|
||||
public void onBlockBreak(Block b) {
|
||||
BlockMenu inv = BlockStorage.getInventory(b);
|
||||
|
||||
if (inv != null) {
|
||||
inv.dropItems(b.getLocation(), getInputSlots());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
protected void constructMenu(BlockMenuPreset preset) {
|
||||
@ -114,7 +126,7 @@ public class AutoBreeder extends SlimefunItem implements InventoryBlock, EnergyN
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canBreed(Entity n) {
|
||||
private boolean canBreed(@Nonnull Entity n) {
|
||||
if (n.isValid() && n instanceof Animals) {
|
||||
Animals animal = (Animals) n;
|
||||
|
||||
|
@ -1,5 +1,19 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.NotHopperable;
|
||||
@ -12,25 +26,10 @@ import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu;
|
||||
import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link ElectricSmeltery} is an electric version of the standard {@link Smeltery}.
|
||||
@ -102,19 +101,6 @@ public class ElectricSmeltery extends AContainer implements NotHopperable {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
registerBlockHandler(getId(), (p, b, tool, reason) -> {
|
||||
BlockMenu inv = BlockStorage.getInventory(b);
|
||||
|
||||
if (inv != null) {
|
||||
inv.dropItems(b.getLocation(), getInputSlots());
|
||||
inv.dropItems(b.getLocation(), getOutputSlots());
|
||||
}
|
||||
|
||||
progress.remove(b);
|
||||
processing.remove(b);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -18,7 +18,9 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.blocks.Vein;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
|
||||
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockBreakHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.handlers.SimpleBlockBreakHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
@ -59,18 +61,24 @@ public class FluidPump extends SimpleSlimefunItem<BlockTicker> implements Invent
|
||||
public FluidPump(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
super(category, item, recipeType, recipe);
|
||||
|
||||
addItemHandler(onBreak());
|
||||
createPreset(this, this::constructMenu);
|
||||
}
|
||||
|
||||
registerBlockHandler(getId(), (p, b, stack, reason) -> {
|
||||
BlockMenu inv = BlockStorage.getInventory(b);
|
||||
@Nonnull
|
||||
private BlockBreakHandler onBreak() {
|
||||
return new SimpleBlockBreakHandler() {
|
||||
|
||||
if (inv != null) {
|
||||
inv.dropItems(b.getLocation(), getInputSlots());
|
||||
inv.dropItems(b.getLocation(), getOutputSlots());
|
||||
@Override
|
||||
public void onBlockBreak(Block b) {
|
||||
BlockMenu inv = BlockStorage.getInventory(b);
|
||||
|
||||
if (inv != null) {
|
||||
inv.dropItems(b.getLocation(), getInputSlots());
|
||||
inv.dropItems(b.getLocation(), getOutputSlots());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
private void constructMenu(@Nonnull BlockMenuPreset preset) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.accelerators;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import org.bukkit.Material;
|
||||
@ -8,7 +9,9 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
|
||||
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockBreakHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.handlers.SimpleBlockBreakHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
@ -29,17 +32,23 @@ public abstract class AbstractGrowthAccelerator extends SlimefunItem implements
|
||||
public AbstractGrowthAccelerator(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
super(category, item, recipeType, recipe);
|
||||
|
||||
addItemHandler(onBreak());
|
||||
createPreset(this, this::constructMenu);
|
||||
}
|
||||
|
||||
registerBlockHandler(getId(), (p, b, tool, reason) -> {
|
||||
BlockMenu inv = BlockStorage.getInventory(b);
|
||||
@Nonnull
|
||||
private BlockBreakHandler onBreak() {
|
||||
return new SimpleBlockBreakHandler() {
|
||||
|
||||
if (inv != null) {
|
||||
inv.dropItems(b.getLocation(), getInputSlots());
|
||||
@Override
|
||||
public void onBlockBreak(Block b) {
|
||||
BlockMenu inv = BlockStorage.getInventory(b);
|
||||
|
||||
if (inv != null) {
|
||||
inv.dropItems(b.getLocation(), getInputSlots());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
private void constructMenu(BlockMenuPreset preset) {
|
||||
|
@ -2,6 +2,9 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machine
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -14,17 +17,27 @@ import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
|
||||
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockPlaceHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.handlers.SimpleBlockBreakHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.magical.KnowledgeFlask;
|
||||
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.Objects.SlimefunItem.interfaces.InventoryBlock;
|
||||
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker;
|
||||
import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
|
||||
|
||||
/**
|
||||
* The {@link ExpCollector} is a machine which picks up any nearby {@link ExperienceOrb}
|
||||
* and produces a {@link KnowledgeFlask}.
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
*/
|
||||
public class ExpCollector extends SlimefunItem implements InventoryBlock, EnergyNetComponent {
|
||||
|
||||
private final int[] border = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 };
|
||||
@ -32,23 +45,16 @@ public class ExpCollector extends SlimefunItem implements InventoryBlock, Energy
|
||||
private static final int ENERGY_CONSUMPTION = 10;
|
||||
private static final String DATA_KEY = "stored-exp";
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
public ExpCollector(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
super(category, item, recipeType, recipe);
|
||||
|
||||
createPreset(this, this::constructMenu);
|
||||
|
||||
addItemHandler(onPlace());
|
||||
registerBlockHandler(getId(), (p, b, stack, reason) -> {
|
||||
BlockMenu inv = BlockStorage.getInventory(b);
|
||||
|
||||
if (inv != null) {
|
||||
inv.dropItems(b.getLocation(), getOutputSlots());
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
addItemHandler(onPlace(), onBreak());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private BlockPlaceHandler onPlace() {
|
||||
return new BlockPlaceHandler(false) {
|
||||
|
||||
@ -59,6 +65,21 @@ public class ExpCollector extends SlimefunItem implements InventoryBlock, Energy
|
||||
};
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private ItemHandler onBreak() {
|
||||
return new SimpleBlockBreakHandler() {
|
||||
|
||||
@Override
|
||||
public void onBlockBreak(Block b) {
|
||||
BlockMenu inv = BlockStorage.getInventory(b);
|
||||
|
||||
if (inv != null) {
|
||||
inv.dropItems(b.getLocation(), getOutputSlots());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getInputSlots() {
|
||||
return new int[0];
|
||||
|
@ -35,6 +35,13 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
|
||||
|
||||
/**
|
||||
* The {@link GEOMiner} is an electrical machine that allows you to obtain a {@link GEOResource}.
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
* @see GEOResource
|
||||
*/
|
||||
public class GEOMiner extends AContainer implements RecipeDisplayItem, HologramOwner {
|
||||
|
||||
private static final int[] BORDER = { 0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 26, 27, 35, 36, 44, 45, 53 };
|
||||
@ -47,9 +54,6 @@ public class GEOMiner extends AContainer implements RecipeDisplayItem, HologramO
|
||||
super(category, item, recipeType, recipe);
|
||||
|
||||
addItemHandler(onPlace(), onBreak());
|
||||
|
||||
// Unregister the Block handler from AContainer (Fixes #2861)
|
||||
registerBlockHandler(getId(), null);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -2571,14 +2571,14 @@ public final class SlimefunItemSetup {
|
||||
}
|
||||
|
||||
if (minecraftVersion.isAtLeast(MinecraftVersion.MINECRAFT_1_16)) {
|
||||
new StrangeNetherGoo(categories.magicalResources, SlimefunItems.STRANGE_NETHER_GOO, RecipeType.BARTER_DROP,
|
||||
new ItemStack[] {null, null, null, null, new CustomItem(HeadTexture.PIGLIN_HEAD.getAsItemStack(), "&fPiglin"), null, null, null, null})
|
||||
.register(plugin);
|
||||
|
||||
new VillagerRune(categories.magicalResources, SlimefunItems.VILLAGER_RUNE, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {SlimefunItems.MAGIC_LUMP_3, SlimefunItems.MAGICAL_GLASS, new ItemStack(Material.CRYING_OBSIDIAN), SlimefunItems.STRANGE_NETHER_GOO, SlimefunItems.FIRE_RUNE, SlimefunItems.STRANGE_NETHER_GOO, new ItemStack(Material.CRYING_OBSIDIAN), SlimefunItems.MAGICAL_GLASS, SlimefunItems.MAGIC_LUMP_3},
|
||||
new SlimefunItemStack(SlimefunItems.VILLAGER_RUNE, 3))
|
||||
.register(plugin);
|
||||
|
||||
new StrangeNetherGoo(categories.magicalResources, SlimefunItems.STRANGE_NETHER_GOO, RecipeType.BARTER_DROP,
|
||||
new ItemStack[] {null, null, null, null, new CustomItem(HeadTexture.PIGLIN_HEAD.getAsItemStack(), "&fPiglin"), null, null, null, null})
|
||||
.register(plugin);
|
||||
}
|
||||
|
||||
new ElytraCap(categories.magicalArmor, SlimefunItems.ELYTRA_CAP, RecipeType.ARMOR_FORGE,
|
||||
|
@ -4,6 +4,7 @@ import java.util.logging.Level;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.WorldListener;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
||||
@ -56,6 +57,9 @@ public class SlimefunStartupTask implements Runnable {
|
||||
SlimefunPlugin.logger().log(Level.SEVERE, x, () -> "An Error occurred while trying to load World \"" + world.getName() + "\" for Slimefun v" + SlimefunPlugin.getVersion());
|
||||
}
|
||||
}
|
||||
|
||||
// Load/Unload Worlds, only after all plugins have started up. Fixes #2862
|
||||
new WorldListener(this.plugin);
|
||||
|
||||
// Only load this Listener if the corresponding items are enabled
|
||||
if (isEnabled("ELEVATOR_PLATE", "GPS_ACTIVATION_DEVICE_SHARED", "GPS_ACTIVATION_DEVICE_PERSONAL")) {
|
||||
|
Loading…
Reference in New Issue
Block a user