Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Listener
- public void onServer(GameStartedServerEvent _e) {
- World world = Sponge.getServer().getWorld("world").get();
- Location<World> location = new Location<World>(world, -68, 69, 720);
- Entity banker = world.createEntity(EntityTypes.VILLAGER, location.getPosition());
- banker.offer(Keys.AI_ENABLED, false);
- banker.offer(Keys.INVULNERABLE, true);
- banker.offer(Keys.CAREER, Careers.CLERIC);
- banker.offer(Keys.CUSTOM_NAME_VISIBLE, true);
- banker.offer(Sponge.getDataManager().getManipulatorBuilder(TradeOfferData.class).get().create());
- banker.offer(Keys.DISPLAY_NAME, Text.of(TextColors.GOLD, "Banker"));
- try (CauseStackManager.StackFrame frame = Sponge.getCauseStackManager().pushCauseFrame()) {
- frame.addContext(EventContextKeys.SPAWN_TYPE, SpawnTypes.PLUGIN);
- world.spawnEntity(banker);
- }
- }
Add Comment
Please, Sign In to add comment