1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00
This commit is contained in:
Jeffrey Kosse 2022-10-16 14:03:43 +02:00
parent 475b27b48c
commit c40bf0d1d3
8 changed files with 79 additions and 53 deletions

View File

@ -69,21 +69,7 @@ final class CargoUtils {
} }
Material type = block.getType(); Material type = block.getType();
return SlimefunTag.INVENTORY_BLOCKS.isTagged(type);
// TODO: Add designated SlimefunTag
return switch (type) {
case CHEST,
TRAPPED_CHEST,
FURNACE,
DISPENSER,
DROPPER,
HOPPER,
BREWING_STAND,
BARREL,
BLAST_FURNACE,
SMOKER -> true;
default -> SlimefunTag.SHULKER_BOXES.isTagged(type);
};
} }
@Nonnull @Nonnull

View File

@ -6,6 +6,7 @@ import java.util.logging.Level;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Keyed; import org.bukkit.Keyed;
@ -137,32 +138,7 @@ public class BlockDataService implements Keyed {
return false; return false;
} }
// TODO: Add designated SlimefunTag return SlimefunTag.TILE_ENTITIES.isTagged(type);
return switch (type) {
case PLAYER_HEAD,
PLAYER_WALL_HEAD,
CHEST,
DISPENSER,
BREWING_STAND,
DROPPER,
FURNACE,
BLAST_FURNACE,
HOPPER,
LECTERN,
JUKEBOX,
ENDER_CHEST,
ENCHANTING_TABLE,
DAYLIGHT_DETECTOR,
SMOKER,
BARREL,
SPAWNER,
BEACON ->
// All of the above Materials are Tile Entities
true;
default ->
// Otherwise we assume they're not Tile Entities
false;
};
} }
} }

View File

@ -202,13 +202,7 @@ public abstract class AbstractAutoCrafter extends SlimefunItem implements Energy
protected boolean isValidInventory(@Nonnull Block block) { protected boolean isValidInventory(@Nonnull Block block) {
Material type = block.getType(); Material type = block.getType();
// TODO: Add designated SlimefunTag return SlimefunTag.STORAGE_BLOCKS.isTagged(type);
return switch (type) {
case CHEST,
TRAPPED_CHEST,
BARREL -> true;
default -> SlimefunTag.SHULKER_BOXES.isTagged(type);
};
} }
/** /**

View File

@ -199,7 +199,7 @@ public class Crucible extends SimpleSlimefunItem<BlockUseHandler> implements Rec
} }
private void placeLiquid(@Nonnull Block block, boolean water) { private void placeLiquid(@Nonnull Block block, boolean water) {
if (block.getType() == Material.AIR || block.getType() == Material.CAVE_AIR || block.getType() == Material.VOID_AIR) { if (block.getType().isAir()) {
// Fixes #2903 - Cancel physics update to resolve weird overlapping // Fixes #2903 - Cancel physics update to resolve weird overlapping
block.setType(water ? Material.WATER : Material.LAVA, false); block.setType(water ? Material.WATER : Material.LAVA, false);
} else { } else {
@ -220,14 +220,13 @@ public class Crucible extends SimpleSlimefunItem<BlockUseHandler> implements Rec
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
private void runPostTask(Block block, Sound sound, int times) { private void runPostTask(Block block, Sound sound, int times) {
if (!(block.getBlockData() instanceof Levelled)) { if (!(block.getBlockData() instanceof Levelled le)) {
block.getWorld().playSound(block.getLocation(), Sound.BLOCK_METAL_BREAK, 1F, 1F); block.getWorld().playSound(block.getLocation(), Sound.BLOCK_METAL_BREAK, 1F, 1F);
return; return;
} }
block.getWorld().playSound(block.getLocation(), sound, 1F, 1F); block.getWorld().playSound(block.getLocation(), sound, 1F, 1F);
int level = 8 - times; int level = 8 - times;
Levelled le = (Levelled) block.getBlockData();
le.setLevel(level); le.setLevel(level);
block.setBlockData(le, false); block.setBlockData(le, false);

View File

@ -260,9 +260,24 @@ public enum SlimefunTag implements Tag<Material> {
GRAVITY_AFFECTED_BLOCKS, GRAVITY_AFFECTED_BLOCKS,
/** /**
* All wool carpets * All wool carpets.
*/ */
WOOL_CARPETS; WOOL_CARPETS,
/**
* All storage blocks.
*/
STORAGE_BLOCKS,
/**
* All blocks with an inventory.
*/
INVENTORY_BLOCKS,
/**
* All tile entities.
*/
TILE_ENTITIES;
/** /**
* Lookup table for tag names. * Lookup table for tag names.

View File

@ -0,0 +1,13 @@
{
"values" : [
"#slimefun:storage_blocks",
"minecraft:furnace",
"minecraft:dispenser",
"minecraft:dropper",
"minecraft:hopper",
"minecraft:brewing_stand",
"minecraft:blast_furnace",
"minecraft:smoker",
"minecraft:campfire"
]
}

View File

@ -0,0 +1,8 @@
{
"values" : [
"#slimefun:shulker_boxes",
"minecraft:chest",
"minecraft:trapped_chest",
"minecraft:barrel"
]
}

View File

@ -0,0 +1,35 @@
{
"values" : [
"#minecraft:signs",
"#minecraft:banners",
"#minecraft:beds",
"minecraft:hopper",
"minecraft:brewing_stand",
"minecraft:blast_furnace",
"minecraft:smoker",
"minecraft:beacon",
"minecraft:spawner",
"minecraft:note_block",
"minecraft:jukebox",
"minecraft:enchanting_table",
"minecraft:end_portal",
"minecraft:ender_chest",
"minecraft:command_block",
"minecraft:structure_block",
"minecraft:end_gateway",
"minecraft:comparator",
"minecraft:conduit",
"minecraft:bell",
"minecraft:daylight_detector",
"minecraft:player_head",
"minecraft:player_wall_head",
{
"id" : "minecraft:soul_campfire",
"required" : false
},
{
"id" : "minecraft:lectern",
"required" : false
}
]
}