#Check if a block is full

1 messages · Page 1 of 1 (latest)

valid sentinel
#

How would I check if a block is full? Say dirt, stone, planks, etc?

My idea was to use

Block#getCollisionShape()

Would that work? if so, what do I check against?

#

I am sorry what

#

The title is fucked up???

#

Check if a block is full

#

Better

noble ocean
#

if that is what you mean

valid sentinel
#

Not really, I'd like it to exclude things like fences, flowers, tall grass, etc

#

So my main idea was to first exclude all full blocks

noble ocean
#

then that looks like exactly what you need

valid sentinel
#

Already checked that

#

They went with NMS and I'd prefer not to

gentle plover
#

I mean if that won't work with that you could just use an EnumSet

#

good time complexity

valid sentinel
#

My only issue is wouldn't that make the plugin version dependent? (Well it will work on newer versions, just won't really work on new blocks)

#

If that's the only way then I am fine

#

Just trying to look if there's a way to use collision shapes or similar as to make it easier

gentle plover
#

hacky solution but it is a solution

valid sentinel
gentle plover
valid sentinel
#

I don't get it

gentle plover
#

I'll mock you something quick

valid sentinel
#

ty

gentle plover
#

lol sorry my internet is like fucking dying atm so its taking a while to create this maven project xD

valid sentinel
#

It's fine

#

My internet isn't great either, I understand

gentle plover
#

the 100kbs of pain

valid sentinel
#

Holy

gentle plover
#

thats what happens when companies have Monopolies

valid sentinel
#

Ye

gentle plover
#

I realized part way through

#

you don't even need reflection lol

#

Material#getMaterial or Material#valueOf and check version value

#

you can make something like if version > x add these to the set

#

this is god awful code but

    public static final List<Material> MATERIALS;
    static {
        MATERIALS = new ArrayList<Material>();
        // currently these are the only materials in the game
        MATERIALS.add(Material.WOOD_SLAB);
        MATERIALS.add(Material.GRASS_SLAB);
        MATERIALS.add(Material.STONE_SLAB);

        // oh a new version got added
        // is version > target version?
        MATERIALS.add(Material.valueOf("DIRT_SLAB"));
    }``` kinda displays how'd you sorta go about it
valid sentinel
#

DIRT SLAAAAAAAAAAAAAB

#

anyways yeah

gentle plover
#

this works because the api used is from the server jar

#

so it will have those enums there

valid sentinel
#

Yeah

gentle plover
#

hope I helped somewhat xD

valid sentinel
#

Yeah

gentle plover
#

looks like there are a few relevant ones

valid sentinel
#

actually

#

I can get all blocks by filtering isItem

#

then remove those that have some tags

#

like flower

gentle plover
#

Yep that'd work really well lol

valid sentinel
#

testing to see if it prints the correct items

#

LEGACY_WATER, LEGACY_STATIONARY_WATER, LEGACY_LAVA, LEGACY_STATIONARY_LAVA, LEGACY_BED_BLOCK, LEGACY_PISTON_EXTENSION, LEGACY_PISTON_MOVING_PIECE, LEGACY_DOUBLE_STEP, LEGACY_FIRE, LEGACY_REDSTONE_WIRE, LEGACY_CROPS, LEGACY_BURNING_FURNACE, LEGACY_SIGN_POST, LEGACY_WOODEN_DOOR, LEGACY_WALL_SIGN, LEGACY_IRON_DOOR_BLOCK, LEGACY_GLOWING_REDSTONE_ORE, LEGACY_REDSTONE_TORCH_OFF, LEGACY_SUGAR_CANE_BLOCK, LEGACY_PORTAL, LEGACY_CAKE_BLOCK, LEGACY_DIODE_BLOCK_OFF, LEGACY_DIODE_BLOCK_ON, LEGACY_PUMPKIN_STEM, LEGACY_MELON_STEM, LEGACY_NETHER_WARTS, LEGACY_BREWING_STAND, LEGACY_CAULDRON, LEGACY_ENDER_PORTAL, LEGACY_REDSTONE_LAMP_ON, LEGACY_WOOD_DOUBLE_STEP, LEGACY_COCOA, LEGACY_TRIPWIRE, LEGACY_FLOWER_POT, LEGACY_CARROT, LEGACY_POTATO, LEGACY_SKULL, LEGACY_REDSTONE_COMPARATOR_OFF, LEGACY_REDSTONE_COMPARATOR_ON, LEGACY_STANDING_BANNER, LEGACY_WALL_BANNER, LEGACY_DAYLIGHT_DETECTOR_INVERTED, LEGACY_DOUBLE_STONE_SLAB2, LEGACY_SPRUCE_DOOR, LEGACY_BIRCH_DOOR, LEGACY_JUNGLE_DOOR, LEGACY_ACACIA_DOOR, LEGACY_DARK_OAK_DOOR, LEGACY_PURPUR_DOUBLE_SLAB, LEGACY_BEETROOT_BLOCK, LEGACY_END_GATEWAY, LEGACY_FROSTED_ICE

w a t

gentle plover
#

Make sure ir isn't legacy

#

Weird you only got legacy tho lmao

valid sentinel
#

oh I am dumb

#

I set version to 1.17

#

not api version

gentle plover
#

Lmfao

valid sentinel
#

I was wondering why

#

oh no