-
-
Notifications
You must be signed in to change notification settings - Fork 307
/
NMSBridge.java
304 lines (196 loc) · 9.77 KB
/
NMSBridge.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
package net.citizensnpcs.util;
import java.util.Collection;
import java.util.List;
import java.util.UUID;
import java.util.function.Function;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.command.BlockCommandSender;
import org.bukkit.entity.Enderman;
import org.bukkit.entity.Entity;
import org.bukkit.entity.FishHook;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Ocelot;
import org.bukkit.entity.Player;
import org.bukkit.entity.Tameable;
import org.bukkit.entity.Wither;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.scoreboard.Team;
import org.bukkit.util.Vector;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.GameProfileRepository;
import net.citizensnpcs.api.ai.NavigatorParameters;
import net.citizensnpcs.api.command.CommandManager;
import net.citizensnpcs.api.command.exception.CommandException;
import net.citizensnpcs.api.jnbt.CompoundTag;
import net.citizensnpcs.api.npc.BlockBreaker;
import net.citizensnpcs.api.npc.BlockBreaker.BlockBreakerConfiguration;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.util.BoundingBox;
import net.citizensnpcs.api.util.EntityDim;
import net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator;
import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
import net.citizensnpcs.trait.MirrorTrait;
import net.citizensnpcs.trait.versioned.ArmadilloTrait.ArmadilloState;
import net.citizensnpcs.trait.versioned.CamelTrait.CamelPose;
import net.citizensnpcs.trait.versioned.SnifferTrait.SnifferState;
import net.citizensnpcs.util.EntityPacketTracker.PacketAggregator;
import net.citizensnpcs.util.NMS.MinecraftNavigationType;
public interface NMSBridge {
default void activate(Entity entity) {
}
public boolean addEntityToWorld(Entity entity, SpawnReason custom);
public void addOrRemoveFromPlayerList(Entity entity, boolean remove);
public void attack(LivingEntity attacker, LivingEntity target);
public void cancelMoveDestination(Entity entity);
public default Iterable<Object> createBundlePacket(List<Object> packets) {
return packets;
}
public EntityPacketTracker createPacketTracker(Entity entity, PacketAggregator agg);
public GameProfile fillProfileProperties(GameProfile profile, boolean requireSecure) throws Throwable;
public BlockBreaker getBlockBreaker(Entity entity, Block targetBlock, BlockBreakerConfiguration config);
public default Object getBossBar(Entity entity) {
throw new UnsupportedOperationException();
}
public BoundingBox getBoundingBox(Entity handle);
public default double getBoundingBoxHeight(Entity entity) {
return entity.getHeight();
}
public BoundingBox getCollisionBox(Block block);
public Location getDestination(Entity entity);
public GameProfileRepository getGameProfileRepository();
public float getHeadYaw(Entity entity);
public float getHorizontalMovement(Entity entity);
public CompoundTag getNBT(ItemStack item);
public NPC getNPC(Entity entity);
public EntityPacketTracker getPacketTracker(Entity entity);
public List<Entity> getPassengers(Entity entity);
public GameProfile getProfile(Player player);
public GameProfile getProfile(SkullMeta meta);
public default float getRidingHeightOffset(Entity entity, Entity mount) {
return 0;
}
public String getSoundPath(Sound flag) throws CommandException;
public Entity getSource(BlockCommandSender sender);
public float getSpeedFor(NPC npc);
public float getStepHeight(Entity entity);
public TargetNavigator getTargetNavigator(Entity handle, Entity target, NavigatorParameters parameters);
public MCNavigator getTargetNavigator(Entity entity, Iterable<Vector> dest, NavigatorParameters params);
public MCNavigator getTargetNavigator(Entity entity, Location dest, NavigatorParameters params);
public Entity getVehicle(Entity entity);
public float getVerticalMovement(Entity entity);
public default Collection<Player> getViewingPlayers(Entity entity) {
return ((Player) entity).getTrackedBy();
}
public double getWidth(Entity entity);
public float getYaw(Entity entity);
public boolean isOnGround(Entity entity);
public default boolean isSneaking(Entity entity) {
if (entity instanceof Player) {
return ((Player) entity).isSneaking();
}
return false;
}
public boolean isSolid(Block in);
public boolean isValid(Entity entity);
public default void linkTextInteraction(Player player, Entity interaction, Entity mount, double height) {
}
public void load(CommandManager commands);
public void look(Entity from, Entity to);
public void look(Entity entity, float yaw, float pitch);
public void look(Entity entity, Location to, boolean headOnly, boolean immediate);
public void mount(Entity entity, Entity passenger);
public default void onPlayerInfoAdd(Player player, Object source, Function<UUID, MirrorTrait> mirrorTraits) {
}
public InventoryView openAnvilInventory(Player player, Inventory anvil, String title);
public void openHorseInventory(Tameable horse, Player equipper);
public void playAnimation(PlayerAnimation animation, Player player, Iterable<Player> to);
public Runnable playerTicker(NPC npc, Player entity);
public void registerEntityClass(Class<?> clazz);
public void remove(Entity entity);
public void removeFromServerPlayerList(Player player);
public void removeFromWorld(org.bukkit.entity.Entity entity);
public void removeHookIfNecessary(FishHook entity);
public void replaceTrackerEntry(Entity entity);
public void sendPositionUpdate(Entity from, Collection<Player> to, boolean position, Float bodyYaw, Float pitch,
Float headYaw);
public boolean sendTabListAdd(Player recipient, Player listPlayer);
public void sendTabListRemove(Player recipient, Collection<Player> players);
public void sendTeamPacket(Player recipient, Team team, int mode);
default public void setAggressive(Entity entity, boolean aggro) {
}
public default void setAllayDancing(Entity entity, boolean dancing) {
throw new UnsupportedOperationException();
}
public default void setArmadilloState(Entity entity, ArmadilloState state) {
}
public void setBodyYaw(Entity entity, float yaw);
public void setBoundingBox(Entity entity, BoundingBox box);
public default void setCamelPose(Entity entity, CamelPose pose) {
throw new UnsupportedOperationException();
}
public void setCustomName(Entity entity, Object component, String string);
public void setDestination(Entity entity, double x, double y, double z, float speed);
public void setDimensions(Entity entity, EntityDim desired);
public void setEndermanAngry(Enderman enderman, boolean angry);
public void setHeadAndBodyYaw(Entity entity, float yaw);
public void setHeadYaw(Entity entity, float yaw);
public void setKnockbackResistance(LivingEntity entity, double d);
public void setLocationDirectly(Entity entity, Location location);
public default void setLyingDown(Entity cat, boolean lying) {
throw new UnsupportedOperationException();
}
public void setNavigationTarget(Entity handle, Entity target, float speed);
public void setNavigationType(Entity entity, MinecraftNavigationType type);
public void setNoGravity(Entity entity, boolean nogravity);
public default void setPandaSitting(Entity entity, boolean sitting) {
throw new UnsupportedOperationException();
}
public default void setPeekShulker(Entity entity, int peek) {
throw new UnsupportedOperationException();
}
public default void setPiglinDancing(Entity entity, boolean dancing) {
throw new UnsupportedOperationException();
}
public void setPitch(Entity entity, float pitch);
public default void setPolarBearRearing(Entity entity, boolean rearing) {
throw new UnsupportedOperationException();
}
public void setProfile(SkullMeta meta, GameProfile profile);
public void setShouldJump(Entity entity);
public void setSitting(Ocelot ocelot, boolean sitting);
public void setSitting(Tameable tameable, boolean sitting);
public default void setSneaking(Entity entity, boolean sneaking) {
if (entity instanceof Player) {
((Player) entity).setSneaking(sneaking);
}
}
public default void setSnifferState(Entity entity, SnifferState state) {
}
public void setStepHeight(Entity entity, float height);
public default void setTeamNameTagVisible(Team team, boolean visible) {
team.setOption(Team.Option.NAME_TAG_VISIBILITY, visible ? Team.OptionStatus.ALWAYS : Team.OptionStatus.NEVER);
}
public default void setTextDisplayComponent(Entity entity, Object component) {
}
public void setVerticalMovement(Entity bukkitEntity, double d);
public default void setWardenPose(Entity entity, Object pose) {
}
public default void setWitherInvulnerableTicks(Wither wither, int ticks) {
wither.setInvulnerabilityTicks(ticks);
}
public boolean shouldJump(Entity entity);
public void shutdown();
public void sleep(Player entity, boolean sleep);
public void trySwim(Entity entity);
public void trySwim(Entity entity, float power);
public void updateInventoryTitle(Player player, InventoryView view, String newTitle);
public void updateNavigationWorld(Entity entity, World world);
public void updatePathfindingRange(NPC npc, float pathfindingRange);
}