use of net.minecraft.server.level.WorldServer in project SSB-OneBlock by BG-Software-LLC.
the class NMSAdapter_v1_18_R1 method simulateToolBreak.
@Override
public void simulateToolBreak(Player bukkitPlayer, org.bukkit.block.Block bukkitBlock) {
EntityPlayer entityPlayer = ((CraftPlayer) bukkitPlayer).getHandle();
ItemStack itemStack = entityPlayer.er();
WorldServer worldServer = ((CraftWorld) bukkitBlock.getWorld()).getHandle();
BlockPosition blockPosition = new BlockPosition(bukkitBlock.getX(), bukkitBlock.getY(), bukkitBlock.getZ());
IBlockData blockData = worldServer.a_(blockPosition);
itemStack.a(worldServer, blockData, blockPosition, entityPlayer);
}
use of net.minecraft.server.level.WorldServer in project BedWars1058 by andrei1058.
the class Silverfish method spawn.
public static LivingEntity spawn(Location loc, ITeam team, double speed, double health, int despawn, double damage) {
WorldServer mcWorld = ((CraftWorld) loc.getWorld()).getHandle();
Silverfish customEnt = new Silverfish(EntityTypes.aA, mcWorld, team);
customEnt.setLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
customEnt.getAttributeInstance(GenericAttributes.a).setValue(health);
customEnt.getAttributeInstance(GenericAttributes.d).setValue(speed);
customEnt.getAttributeInstance(GenericAttributes.f).setValue(damage);
customEnt.setPersistent();
((CraftLivingEntity) customEnt.getBukkitEntity()).setRemoveWhenFarAway(false);
customEnt.setCustomNameVisible(true);
mcWorld.addEntity(customEnt, CreatureSpawnEvent.SpawnReason.CUSTOM);
customEnt.getBukkitEntity().setCustomName(Language.getDefaultLanguage().m(Messages.SHOP_UTILITY_NPC_IRON_GOLEM_NAME).replace("{despawn}", String.valueOf(despawn).replace("{health}", StringUtils.repeat(Language.getDefaultLanguage().m(Messages.FORMATTING_DESPAWNABLE_UTILITY_NPC_HEALTH) + " ", 10)).replace("{TeamColor}", team.getColor().chat().toString())));
return (LivingEntity) customEnt.getBukkitEntity();
}
use of net.minecraft.server.level.WorldServer in project BedWars1058 by andrei1058.
the class IGolem method spawn.
public static LivingEntity spawn(Location loc, ITeam bedWarsTeam, double speed, double health, int despawn) {
WorldServer mcWorld = ((CraftWorld) Objects.requireNonNull(loc.getWorld())).getHandle();
IGolem customEnt = new IGolem(EntityTypes.P, mcWorld, bedWarsTeam);
customEnt.a(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
((CraftLivingEntity) customEnt.getBukkitEntity()).setRemoveWhenFarAway(false);
Objects.requireNonNull(customEnt.a(GenericAttributes.a)).a(health);
Objects.requireNonNull(customEnt.a(GenericAttributes.d)).a(speed);
if (!CraftEventFactory.doEntityAddEventCalling(mcWorld, customEnt, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
mcWorld.P.a(customEnt);
}
mcWorld.a(customEnt);
customEnt.getBukkitEntity().setPersistent(true);
customEnt.getBukkitEntity().setCustomNameVisible(true);
customEnt.getBukkitEntity().setCustomName(Language.getDefaultLanguage().m(Messages.SHOP_UTILITY_NPC_IRON_GOLEM_NAME).replace("{despawn}", String.valueOf(despawn).replace("{health}", StringUtils.repeat(Language.getDefaultLanguage().m(Messages.FORMATTING_DESPAWNABLE_UTILITY_NPC_HEALTH) + " ", 10)).replace("{TeamColor}", bedWarsTeam.getColor().chat().toString())));
return (LivingEntity) customEnt.getBukkitEntity();
}
use of net.minecraft.server.level.WorldServer in project BedWars1058 by andrei1058.
the class Silverfish method spawn.
public static LivingEntity spawn(Location loc, ITeam team, double speed, double health, int despawn, double damage) {
WorldServer mcWorld = ((CraftWorld) loc.getWorld()).getHandle();
Silverfish customEnt = new Silverfish(EntityTypes.aA, mcWorld, team);
customEnt.a(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
customEnt.a(GenericAttributes.a).a(health);
customEnt.a(GenericAttributes.d).a(speed);
customEnt.a(GenericAttributes.f).a(damage);
if (!CraftEventFactory.doEntityAddEventCalling(mcWorld, customEnt, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
mcWorld.P.a(customEnt);
}
((CraftLivingEntity) customEnt.getBukkitEntity()).setRemoveWhenFarAway(false);
((CraftLivingEntity) customEnt.getBukkitEntity()).setRemoveWhenFarAway(true);
((CraftLivingEntity) customEnt.getBukkitEntity()).setPersistent(true);
customEnt.getBukkitEntity().setCustomName(Language.getDefaultLanguage().m(Messages.SHOP_UTILITY_NPC_IRON_GOLEM_NAME).replace("{despawn}", String.valueOf(despawn).replace("{health}", StringUtils.repeat(Language.getDefaultLanguage().m(Messages.FORMATTING_DESPAWNABLE_UTILITY_NPC_HEALTH) + " ", 10)).replace("{TeamColor}", team.getColor().chat().toString())));
return (LivingEntity) customEnt.getBukkitEntity();
}
use of net.minecraft.server.level.WorldServer in project TheAPI by TheDevTec.
the class v1_17_R1 method packetRespawn.
@Override
public Object packetRespawn(Player player) {
EntityPlayer entityPlayer = (EntityPlayer) getPlayer(player);
WorldServer worldserver = entityPlayer.getWorldServer();
return new PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), BiomeManager.a(worldserver.getSeed()), entityPlayer.d.getGameMode(), entityPlayer.d.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true);
}
Aggregations