mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-25 03:55:30 +01:00
Add NMS#getCollisionBox(BlockData)
This commit is contained in:
parent
2247a81150
commit
deb438bd75
@ -356,7 +356,6 @@ public class EventListen implements Listener {
|
||||
if (npc.isProtected()) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
if (event instanceof EntityDamageByEntityEvent) {
|
||||
NPCDamageByEntityEvent damageEvent = new NPCDamageByEntityEvent(npc, (EntityDamageByEntityEvent) event);
|
||||
Bukkit.getPluginManager().callEvent(damageEvent);
|
||||
|
@ -808,7 +808,7 @@ public class NPCCommands {
|
||||
|
||||
@Command(
|
||||
aliases = { "npc" },
|
||||
usage = "create [name] ((-b(aby),u(nspawned),s(ilent),t(emporary),c(enter),p(acket)) --at [x,y,z,world] --type [type] --item (item) --trait ['trait1, trait2...'] --model [model name] --nameplate [true|false|hover] --temporaryticks [ticks] --registry [registry name]",
|
||||
usage = "create [name] ((-b(aby),u(nspawned),s(ilent),t(emporary),c(enter),p(acket)) --at [x,y,z,world] --type [type] --item (item) --trait ['trait1, trait2...'] --model [model name] --nameplate [true|false|hover] --temporaryduration [duration] --registry [registry name]",
|
||||
desc = "",
|
||||
flags = "bustpc",
|
||||
modifiers = { "create" },
|
||||
@ -818,7 +818,7 @@ public class NPCCommands {
|
||||
public void create(CommandContext args, CommandSender sender, NPC npc, @Flag("at") Location at,
|
||||
@Flag(value = "type", defValue = "PLAYER") EntityType type, @Flag("trait") String traits,
|
||||
@Flag(value = "nameplate", completions = { "true", "false", "hover" }) String nameplate,
|
||||
@Flag("temporaryticks") Integer temporaryTicks, @Flag("item") String item,
|
||||
@Flag("temporaryduration") Duration temporaryDuration, @Flag("item") String item,
|
||||
@Flag("template") String templateName, @Flag("registry") String registryName) throws CommandException {
|
||||
String name = args.getJoinedStrings(1).trim();
|
||||
if (args.hasValueFlag("type")) {
|
||||
@ -851,7 +851,7 @@ public class NPCCommands {
|
||||
Messaging.send(sender, "An in-memory registry has been created named [[" + registryName + "]].");
|
||||
}
|
||||
}
|
||||
if (args.hasFlag('t') || temporaryTicks != null) {
|
||||
if (args.hasFlag('t') || temporaryDuration != null) {
|
||||
registry = temporaryRegistry;
|
||||
}
|
||||
if (item != null) {
|
||||
@ -876,13 +876,13 @@ public class NPCCommands {
|
||||
if (!Setting.SERVER_OWNS_NPCS.asBoolean()) {
|
||||
npc.getOrAddTrait(Owner.class).setOwner(sender);
|
||||
}
|
||||
if (temporaryTicks != null) {
|
||||
if (temporaryDuration != null) {
|
||||
NPC temp = npc;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), () -> {
|
||||
if (temporaryRegistry.getByUniqueId(temp.getUniqueId()) == temp) {
|
||||
temp.destroy();
|
||||
}
|
||||
}, temporaryTicks);
|
||||
}, Util.toTicks(temporaryDuration));
|
||||
}
|
||||
npc.getOrAddTrait(MobType.class).setType(type);
|
||||
|
||||
@ -1286,7 +1286,7 @@ public class NPCCommands {
|
||||
if (height != null) {
|
||||
npc.getOrAddTrait(BoundingBoxTrait.class).setHeight(height);
|
||||
}
|
||||
EntityDim dim = npc.getOrAddTrait(BoundingBoxTrait.class).getAdjustedBoundingBox();
|
||||
EntityDim dim = npc.getOrAddTrait(BoundingBoxTrait.class).getAdjustedDimensions();
|
||||
Messaging.sendTr(sender, Messages.BOUNDING_BOX_SET, "width " + dim.width + " height " + dim.height);
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.BlockDisplay;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Interaction;
|
||||
|
||||
@ -36,17 +37,22 @@ public class BoundingBoxTrait extends Trait implements Supplier<BoundingBox> {
|
||||
public BoundingBox get() {
|
||||
Location location = npc.getEntity().getLocation();
|
||||
if (function != null) {
|
||||
BoundingBox bb = function.apply(getAdjustedBoundingBox());
|
||||
BoundingBox bb = function.apply(getAdjustedDimensions());
|
||||
NMS.setDimensions(npc.getEntity(), bb.toDimensions());
|
||||
return bb.add(location);
|
||||
}
|
||||
EntityDim dim = getAdjustedBoundingBox();
|
||||
EntityDim dim = getAdjustedDimensions();
|
||||
NMS.setDimensions(npc.getEntity(), dim);
|
||||
if (interaction != null) {
|
||||
Interaction ie = (Interaction) interaction.getEntity();
|
||||
ie.setInteractionWidth(dim.width);
|
||||
ie.setInteractionHeight(dim.height);
|
||||
}
|
||||
return new BoundingBox(location.getX() - dim.width / 2, location.getY(), location.getZ() - dim.width / 2,
|
||||
location.getX() + dim.width / 2, location.getY() + dim.height, location.getZ() + dim.width / 2);
|
||||
}
|
||||
|
||||
public EntityDim getAdjustedBoundingBox() {
|
||||
public EntityDim getAdjustedDimensions() {
|
||||
EntityDim desired = base;
|
||||
if (scale != -1) {
|
||||
desired = desired.mul(scale);
|
||||
@ -69,6 +75,10 @@ public class BoundingBoxTrait extends Trait implements Supplier<BoundingBox> {
|
||||
|
||||
@Override
|
||||
public void onSpawn() {
|
||||
if (npc.getEntity().getType().toString().contains("BLOCK_DISPLAY")) {
|
||||
BoundingBox bb = NMS.getCollisionBox(((BlockDisplay) npc.getEntity()).getBlock());
|
||||
base = EntityDim.from(bb);
|
||||
}
|
||||
base = EntityDim.from(npc.getEntity());
|
||||
npc.data().set(NPC.Metadata.BOUNDING_BOX_FUNCTION, this);
|
||||
if (!SUPPORTS_INTERACTION)
|
||||
@ -86,7 +96,7 @@ public class BoundingBoxTrait extends Trait implements Supplier<BoundingBox> {
|
||||
public void run() {
|
||||
if (interaction == null)
|
||||
return;
|
||||
EntityDim dim = getAdjustedBoundingBox();
|
||||
EntityDim dim = getAdjustedDimensions();
|
||||
Interaction box = ((Interaction) interaction.getEntity());
|
||||
box.setInteractionWidth(dim.width);
|
||||
box.setInteractionHeight(dim.height);
|
||||
@ -113,9 +123,9 @@ public class BoundingBoxTrait extends Trait implements Supplier<BoundingBox> {
|
||||
|
||||
static {
|
||||
try {
|
||||
Class.forName("org.bukkit.entity.Interaction");
|
||||
Class<?> clazz = Class.forName("org.bukkit.entity.Interaction");
|
||||
try {
|
||||
Interaction.class.getMethod("isResponsive");
|
||||
clazz.getMethod("isResponsive");
|
||||
} catch (NoSuchMethodException | SecurityException e) {
|
||||
SUPPORTS_RESPONSIVE = false;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import org.bukkit.attribute.Attributable;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeInstance;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.command.BlockCommandSender;
|
||||
import org.bukkit.entity.Enderman;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -242,6 +243,10 @@ public class NMS {
|
||||
return BRIDGE.getCollisionBox(block).add(block.getX(), block.getY(), block.getZ());
|
||||
}
|
||||
|
||||
public static BoundingBox getCollisionBox(BlockData blockdata) {
|
||||
return BRIDGE.getCollisionBox(blockdata);
|
||||
}
|
||||
|
||||
public static Map<String, Object> getComponentMap(ItemStack item) {
|
||||
return BRIDGE.getComponentMap(item);
|
||||
}
|
||||
@ -897,6 +902,10 @@ public class NMS {
|
||||
BRIDGE.setNoGravity(entity, nogravity);
|
||||
}
|
||||
|
||||
public static void setOpWithoutSaving(Player player, boolean op) {
|
||||
BRIDGE.setOpWithoutSaving(player, op);
|
||||
}
|
||||
|
||||
public static void setPandaSitting(Entity entity, boolean sitting) {
|
||||
BRIDGE.setPandaSitting(entity, sitting);
|
||||
}
|
||||
@ -972,10 +981,6 @@ public class NMS {
|
||||
BRIDGE.setWitherInvulnerableTicks(wither, ticks);
|
||||
}
|
||||
|
||||
public static void setOpWithoutSaving(Player player, boolean op) {
|
||||
BRIDGE.setOpWithoutSaving(player, op);
|
||||
}
|
||||
|
||||
public static boolean shouldBroadcastToPlayer(NPC npc, Supplier<Boolean> defaultResponse) {
|
||||
return npc != null && npc.data().has(NPC.Metadata.NPC_SPAWNING_IN_PROGRESS) ? false : defaultResponse.get();
|
||||
}
|
||||
|
@ -85,6 +85,10 @@ public interface NMSBridge {
|
||||
|
||||
public BoundingBox getCollisionBox(Block block);
|
||||
|
||||
public default BoundingBox getCollisionBox(Object blockdata) {
|
||||
return BoundingBox.ONE;
|
||||
}
|
||||
|
||||
public default Map<String, Object> getComponentMap(ItemStack item) {
|
||||
return item.getItemMeta().serialize();
|
||||
}
|
||||
@ -240,6 +244,8 @@ public interface NMSBridge {
|
||||
|
||||
public void setNoGravity(Entity entity, boolean nogravity);
|
||||
|
||||
public void setOpWithoutSaving(Player player, boolean op);
|
||||
|
||||
public default void setPandaSitting(Entity entity, boolean sitting) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@ -298,8 +304,6 @@ public interface NMSBridge {
|
||||
wither.setInvulnerabilityTicks(ticks);
|
||||
}
|
||||
|
||||
public void setOpWithoutSaving(Player player, boolean op);
|
||||
|
||||
public boolean shouldJump(Entity entity);
|
||||
|
||||
public void shutdown();
|
||||
|
@ -32,6 +32,7 @@ import org.bukkit.craftbukkit.v1_13_R2.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.CraftSound;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.boss.CraftBossBar;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.command.CraftBlockCommandSender;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity;
|
||||
@ -494,6 +495,12 @@ public class NMSImpl implements NMSBridge {
|
||||
return NMSBoundingBox.wrap(NMSImpl.getHandle(handle).getBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getCollisionBox(Object data) {
|
||||
return NMSBoundingBox
|
||||
.wrap(((CraftBlockData) data).getState().getCollisionShape(null, BlockPosition.ZERO).getBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
|
||||
WorldServer world = ((CraftWorld) block.getWorld()).getHandle();
|
||||
|
@ -30,6 +30,7 @@ import org.bukkit.craftbukkit.v1_14_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.CraftSound;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.boss.CraftBossBar;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.command.CraftBlockCommandSender;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity;
|
||||
@ -221,6 +222,7 @@ import net.minecraft.server.v1_14_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_14_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_14_R1.BehaviorController;
|
||||
import net.minecraft.server.v1_14_R1.Block;
|
||||
import net.minecraft.server.v1_14_R1.BlockAccessAir;
|
||||
import net.minecraft.server.v1_14_R1.BlockPosition;
|
||||
import net.minecraft.server.v1_14_R1.BossBattleServer;
|
||||
import net.minecraft.server.v1_14_R1.ChatComponentText;
|
||||
@ -302,6 +304,7 @@ import net.minecraft.server.v1_14_R1.ScoreboardTeam;
|
||||
import net.minecraft.server.v1_14_R1.SoundEffect;
|
||||
import net.minecraft.server.v1_14_R1.Vec3D;
|
||||
import net.minecraft.server.v1_14_R1.VoxelShape;
|
||||
import net.minecraft.server.v1_14_R1.VoxelShapeCollision;
|
||||
import net.minecraft.server.v1_14_R1.WorldServer;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -534,6 +537,12 @@ public class NMSImpl implements NMSBridge {
|
||||
return NMSBoundingBox.wrap(NMSImpl.getHandle(handle).getBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getCollisionBox(Object data) {
|
||||
return NMSBoundingBox.wrap(((CraftBlockData) data).getState()
|
||||
.a(BlockAccessAir.INSTANCE, BlockPosition.ZERO, VoxelShapeCollision.a()).getBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
|
||||
WorldServer world = ((CraftWorld) block.getWorld()).getHandle();
|
||||
|
@ -30,6 +30,7 @@ import org.bukkit.craftbukkit.v1_15_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.CraftSound;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.boss.CraftBossBar;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.command.CraftBlockCommandSender;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
|
||||
@ -223,6 +224,7 @@ import net.minecraft.server.v1_15_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_15_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_15_R1.BehaviorController;
|
||||
import net.minecraft.server.v1_15_R1.Block;
|
||||
import net.minecraft.server.v1_15_R1.BlockAccessAir;
|
||||
import net.minecraft.server.v1_15_R1.BlockPosition;
|
||||
import net.minecraft.server.v1_15_R1.BossBattleServer;
|
||||
import net.minecraft.server.v1_15_R1.ChatComponentText;
|
||||
@ -307,6 +309,7 @@ import net.minecraft.server.v1_15_R1.ScoreboardTeam;
|
||||
import net.minecraft.server.v1_15_R1.SoundEffect;
|
||||
import net.minecraft.server.v1_15_R1.Vec3D;
|
||||
import net.minecraft.server.v1_15_R1.VoxelShape;
|
||||
import net.minecraft.server.v1_15_R1.VoxelShapeCollision;
|
||||
import net.minecraft.server.v1_15_R1.WorldServer;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -549,6 +552,12 @@ public class NMSImpl implements NMSBridge {
|
||||
return NMSBoundingBox.wrap(NMSImpl.getHandle(handle).getBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getCollisionBox(Object data) {
|
||||
return NMSBoundingBox.wrap(((CraftBlockData) data).getState()
|
||||
.a(BlockAccessAir.INSTANCE, BlockPosition.ZERO, VoxelShapeCollision.a()).getBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
|
||||
WorldServer world = ((CraftWorld) block.getWorld()).getHandle();
|
||||
|
@ -30,6 +30,7 @@ import org.bukkit.craftbukkit.v1_16_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_16_R3.CraftSound;
|
||||
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_16_R3.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.v1_16_R3.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.v1_16_R3.boss.CraftBossBar;
|
||||
import org.bukkit.craftbukkit.v1_16_R3.command.CraftBlockCommandSender;
|
||||
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity;
|
||||
@ -233,6 +234,7 @@ import net.minecraft.server.v1_16_R3.AttributeProvider;
|
||||
import net.minecraft.server.v1_16_R3.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_16_R3.BehaviorController;
|
||||
import net.minecraft.server.v1_16_R3.Block;
|
||||
import net.minecraft.server.v1_16_R3.BlockAccessAir;
|
||||
import net.minecraft.server.v1_16_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_16_R3.BossBattleServer;
|
||||
import net.minecraft.server.v1_16_R3.ChatComponentText;
|
||||
@ -320,6 +322,7 @@ import net.minecraft.server.v1_16_R3.SoundEffect;
|
||||
import net.minecraft.server.v1_16_R3.TagsFluid;
|
||||
import net.minecraft.server.v1_16_R3.Vec3D;
|
||||
import net.minecraft.server.v1_16_R3.VoxelShape;
|
||||
import net.minecraft.server.v1_16_R3.VoxelShapeCollision;
|
||||
import net.minecraft.server.v1_16_R3.WorldServer;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -564,6 +567,12 @@ public class NMSImpl implements NMSBridge {
|
||||
return NMSBoundingBox.wrap(NMSImpl.getHandle(handle).getBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getCollisionBox(Object data) {
|
||||
return NMSBoundingBox.wrap(((CraftBlockData) data).getState()
|
||||
.c(BlockAccessAir.INSTANCE, BlockPosition.ZERO, VoxelShapeCollision.a()).getBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
|
||||
WorldServer world = ((CraftWorld) block.getWorld()).getHandle();
|
||||
|
@ -29,6 +29,7 @@ import org.bukkit.craftbukkit.v1_17_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.CraftSound;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.boss.CraftBossBar;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.command.CraftBlockCommandSender;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftEntity;
|
||||
@ -307,6 +308,7 @@ import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.world.level.EmptyBlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.dimension.end.EndDragonFight;
|
||||
@ -316,6 +318,7 @@ import net.minecraft.world.level.pathfinder.Node;
|
||||
import net.minecraft.world.level.pathfinder.Path;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.scores.PlayerTeam;
|
||||
|
||||
@ -574,6 +577,12 @@ public class NMSImpl implements NMSBridge {
|
||||
return NMSBoundingBox.wrap(NMSImpl.getHandle(handle).getBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getCollisionBox(Object data) {
|
||||
return NMSBoundingBox.wrap(((CraftBlockData) data).getState()
|
||||
.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CollisionContext.empty()).bounds());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
|
||||
ServerLevel world = ((CraftWorld) block.getWorld()).getHandle();
|
||||
|
@ -28,6 +28,7 @@ import org.bukkit.craftbukkit.v1_18_R2.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.CraftSound;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.boss.CraftBossBar;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.command.CraftBlockCommandSender;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftEntity;
|
||||
@ -309,6 +310,7 @@ import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.world.level.EmptyBlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.dimension.end.EndDragonFight;
|
||||
@ -320,6 +322,7 @@ import net.minecraft.world.level.pathfinder.PathFinder;
|
||||
import net.minecraft.world.level.portal.PortalInfo;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.scores.PlayerTeam;
|
||||
|
||||
@ -580,6 +583,12 @@ public class NMSImpl implements NMSBridge {
|
||||
return NMSBoundingBox.wrap(NMSImpl.getHandle(handle).getBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getCollisionBox(Object data) {
|
||||
return NMSBoundingBox.wrap(((CraftBlockData) data).getState()
|
||||
.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CollisionContext.empty()).bounds());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
|
||||
ServerLevel world = ((CraftWorld) block.getWorld()).getHandle();
|
||||
|
@ -33,6 +33,7 @@ import org.bukkit.craftbukkit.v1_19_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_19_R3.CraftSound;
|
||||
import org.bukkit.craftbukkit.v1_19_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_19_R3.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.v1_19_R3.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.v1_19_R3.boss.CraftBossBar;
|
||||
import org.bukkit.craftbukkit.v1_19_R3.command.CraftBlockCommandSender;
|
||||
import org.bukkit.craftbukkit.v1_19_R3.entity.CraftEntity;
|
||||
@ -349,6 +350,7 @@ import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.world.level.EmptyBlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.dimension.end.EndDragonFight;
|
||||
@ -360,6 +362,7 @@ import net.minecraft.world.level.pathfinder.PathFinder;
|
||||
import net.minecraft.world.level.portal.PortalInfo;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.scores.PlayerTeam;
|
||||
|
||||
@ -624,6 +627,12 @@ public class NMSImpl implements NMSBridge {
|
||||
return NMSBoundingBox.wrap(getHandle(handle).getBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getCollisionBox(Object data) {
|
||||
return NMSBoundingBox.wrap(((CraftBlockData) data).getState()
|
||||
.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CollisionContext.empty()).bounds());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
|
||||
ServerLevel world = ((CraftWorld) block.getWorld()).getHandle();
|
||||
|
@ -31,6 +31,7 @@ import org.bukkit.craftbukkit.v1_20_R4.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_20_R4.CraftSound;
|
||||
import org.bukkit.craftbukkit.v1_20_R4.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_20_R4.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.v1_20_R4.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.v1_20_R4.boss.CraftBossBar;
|
||||
import org.bukkit.craftbukkit.v1_20_R4.command.CraftBlockCommandSender;
|
||||
import org.bukkit.craftbukkit.v1_20_R4.entity.CraftEntity;
|
||||
@ -362,6 +363,7 @@ import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.world.level.EmptyBlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.dimension.end.EndDragonFight;
|
||||
@ -373,6 +375,7 @@ import net.minecraft.world.level.pathfinder.PathType;
|
||||
import net.minecraft.world.level.portal.PortalInfo;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.scores.PlayerTeam;
|
||||
|
||||
@ -629,6 +632,12 @@ public class NMSImpl implements NMSBridge {
|
||||
return NMSBoundingBox.wrap(getHandle(handle).getBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getCollisionBox(Object data) {
|
||||
return NMSBoundingBox.wrap(((CraftBlockData) data).getState()
|
||||
.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CollisionContext.empty()).bounds());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
|
||||
ServerLevel world = ((CraftWorld) block.getWorld()).getHandle();
|
||||
|
@ -31,6 +31,7 @@ import org.bukkit.craftbukkit.v1_21_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_21_R1.CraftSound;
|
||||
import org.bukkit.craftbukkit.v1_21_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_21_R1.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.v1_21_R1.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.v1_21_R1.boss.CraftBossBar;
|
||||
import org.bukkit.craftbukkit.v1_21_R1.command.CraftBlockCommandSender;
|
||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity;
|
||||
@ -362,6 +363,7 @@ import net.minecraft.world.inventory.ContainerLevelAccess;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.world.level.EmptyBlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.dimension.end.EndDragonFight;
|
||||
@ -373,6 +375,7 @@ import net.minecraft.world.level.pathfinder.PathType;
|
||||
import net.minecraft.world.level.portal.DimensionTransition;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.scores.PlayerTeam;
|
||||
|
||||
@ -616,6 +619,12 @@ public class NMSImpl implements NMSBridge {
|
||||
return shape.isEmpty() ? BoundingBox.EMPTY : NMSBoundingBox.wrap(shape.bounds());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getCollisionBox(Object data) {
|
||||
return NMSBoundingBox.wrap(((CraftBlockData) data).getState()
|
||||
.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CollisionContext.empty()).bounds());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getComponentMap(org.bukkit.inventory.ItemStack item) {
|
||||
if (META_COMPOUND_TAG == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user