mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 00:34:19 +00:00
Answer the GRAVITY, LOG and LEAVES traits, block tags and attachment to a face from the platform layer, with Bukkit, modded and stub implementations
This commit is contained in:
1 parent
818dbef261
commit
563c2cd276
15 files changed
+344
-35
No files matched your search
@@ -120,7 +120,25 @@ public interface PlatformBlockState {
|
||||
/**
|
||||
* Whether this is part of a tree - tagged as a log or as leaves.
|
||||
*/
|
||||
boolean isTreeBlock();
|
||||
default boolean isTreeBlock() {
|
||||
return isLog() || isLeaves();
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this block is tagged as a log, in the platform's block tags.
|
||||
*/
|
||||
boolean isLog();
|
||||
|
||||
/**
|
||||
* Whether this block is tagged as leaves, in the platform's block tags.
|
||||
*/
|
||||
boolean isLeaves();
|
||||
|
||||
/**
|
||||
* Whether this block falls when nothing holds it up - sand, gravel, concrete powder, anvils and the like, as
|
||||
* the platform's own falling block type decides.
|
||||
*/
|
||||
boolean hasGravity();
|
||||
|
||||
/**
|
||||
* Whether foliage can be planted on top of this block.
|
||||
@@ -164,6 +182,13 @@ public interface PlatformBlockState {
|
||||
*/
|
||||
boolean canPlaceOnto(PlatformBlockState onto);
|
||||
|
||||
/**
|
||||
* Whether this block can attach to the {@code face} of {@code support}, ignoring every other neighbour: the
|
||||
* support's face is sturdy enough to hold a torch, a ladder or a button against it, which is the platform's own
|
||||
* full-face support test. Passing a state from a different adapter fails at runtime.
|
||||
*/
|
||||
boolean canAttach(PlatformBlockState support, PlatformFace face);
|
||||
|
||||
/**
|
||||
* Whether the two states are the same block with the same properties. Prefer this to {@code equals}, which
|
||||
* is identity-based on some adapters.
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.spi;
|
||||
|
||||
/**
|
||||
* One of the six faces of a block, named as the world sees them: up is toward the sky, north toward negative Z,
|
||||
* east toward positive X.
|
||||
* <p>
|
||||
* Internal to Iris; not a published integration surface.
|
||||
*/
|
||||
public enum PlatformFace {
|
||||
UP, DOWN, NORTH, SOUTH, EAST, WEST
|
||||
}
|
||||
@@ -54,6 +54,13 @@ public interface PlatformRegistries {
|
||||
*/
|
||||
PlatformBlockState blockOrNull(String key, boolean warn);
|
||||
|
||||
/**
|
||||
* Whether {@code block} is in the block tag named {@code tag}, a namespaced key such as
|
||||
* {@code minecraft:logs}. A tag the platform does not know has no members, so it answers false. Goes through the
|
||||
* platform's tag lookup on each call: not for the per-block generation path.
|
||||
*/
|
||||
boolean isInTag(PlatformBlockState block, String tag);
|
||||
|
||||
/**
|
||||
* The interned air state. Never null; identity-comparable across calls.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user