Java Code Examples for net.minecraft.server.MinecraftServer

The following examples show how to use net.minecraft.server.MinecraftServer. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: MyTown2   Source File: ProtectionManager.java    License: The Unlicense 6 votes vote down vote up
public static void checkBlockInteraction(Resident res, BlockPos bp, PlayerInteractEvent.Action action, Event ev) {
    if(!ev.isCancelable()) {
        return;
    }

    World world = MinecraftServer.getServer().worldServerForDimension(bp.getDim());
    Block block = world.getBlock(bp.getX(), bp.getY(), bp.getZ());

    // Bypass for SellSign
    if (block instanceof BlockSign) {
        TileEntity te = world.getTileEntity(bp.getX(), bp.getY(), bp.getZ());
        if(te instanceof TileEntitySign && SellSign.SellSignType.instance.isTileValid((TileEntitySign) te)) {
            return;
        }
    }

    for(SegmentBlock segment : segmentsBlock.get(block.getClass())) {
        if(!segment.shouldInteract(res, bp, action)) {
            ev.setCanceled(true);
        }
    }
}
 
Example 2
Source Project: Thermos   Source File: CauldronCommand.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public List<String> tabComplete(CommandSender sender, String alias, String[] args)
{
    Validate.notNull(sender, "Sender cannot be null");
    Validate.notNull(args, "Arguments cannot be null");
    Validate.notNull(alias, "Alias cannot be null");

    if (args.length == 1)
    {
        return StringUtil.copyPartialMatches(args[0], COMMANDS, new ArrayList<String>(COMMANDS.size()));
    }
    if (((args.length == 2) && "get".equalsIgnoreCase(args[0])) || "set".equalsIgnoreCase(args[0]))
    {
        return StringUtil.copyPartialMatches(args[1], MinecraftServer.getServer().cauldronConfig.getSettings().keySet(), new ArrayList<String>(MinecraftServer.getServer().cauldronConfig.getSettings().size()));
    }
    else if ((args.length == 2) && "chunks".equalsIgnoreCase(args[0]))
    {
        return StringUtil.copyPartialMatches(args[1], CHUNK_COMMANDS, new ArrayList<String>(CHUNK_COMMANDS.size()));
    }

    return ImmutableList.of();
}
 
Example 3
Source Project: Et-Futurum   Source File: ServerEventHandler.java    License: The Unlicense 6 votes vote down vote up
@SubscribeEvent
@SuppressWarnings("unchecked")
public void onWorldTick(TickEvent.ServerTickEvent event) {
	if (event.phase != TickEvent.Phase.END || event.side != Side.SERVER)
		return;

	if (EtFuturum.enablePlayerSkinOverlay)
		if (playerLoggedInCooldown != null)
			if (--playerLoggedInCooldown <= 0) {
				for (World world : MinecraftServer.getServer().worldServers)
					for (EntityPlayer player : (List<EntityPlayer>) world.playerEntities) {
						NBTTagCompound nbt = player.getEntityData();
						if (nbt.hasKey(SetPlayerModelCommand.MODEL_KEY, Constants.NBT.TAG_BYTE)) {
							boolean isAlex = nbt.getBoolean(SetPlayerModelCommand.MODEL_KEY);
							EtFuturum.networkWrapper.sendToAll(new SetPlayerModelMessage(player, isAlex));
						}
					}
				playerLoggedInCooldown = null;
			}
}
 
Example 4
Source Project: Kettle   Source File: SpigotCommand.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
    if (!testPermission(sender)) return true;

    if (args.length != 1) {
        sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
        return false;
    }

    if (args[0].equals("reload")) {
        Command.broadcastCommandMessage(sender, ChatColor.RED + "Please note that this command is not supported and may cause issues.");
        Command.broadcastCommandMessage(sender, ChatColor.RED + "If you encounter any issues please use the /stop command to restart your server.");

        MinecraftServer console = MinecraftServer.getServerCB();
        org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings"));
        for (WorldServer world : console.worlds) {
            world.spigotConfig.init();
        }
        console.server.reloadCount++;

        Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Reload complete.");
    }

    return true;
}
 
Example 5
Source Project: TFC2   Source File: DebugCommand.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] params)
{
	EntityPlayerMP player;
	try {
		player = getCommandSenderAsPlayer(sender);
	} catch (PlayerNotFoundException e) {
		return;
	}
	WorldServer world = server.worldServerForDimension(player.getEntityWorld().provider.getDimension());

	if(params.length == 1 && params[0].equalsIgnoreCase("report"))
	{
		int xM =player.getPosition().getX() >> 12;
		int zM =player.getPosition().getZ() >> 12;
		String out = "World Seed: [" + world.getSeed() + "] | IslandMap: [" +xM + "," + zM + "] | PlayerPos: [" + player.getPosition().toString() + "]";
		StringSelection selection = new StringSelection(out);
		Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
		if(clipboard != null)
			clipboard.setContents(selection, selection);

	}
}
 
Example 6
Source Project: fabric-carpet   Source File: TickSpeed.java    License: MIT License 6 votes vote down vote up
public static void tick(MinecraftServer server)
{
    process_entities = true;
    if (player_active_timeout > 0)
    {
        player_active_timeout--;
    }
    if (is_paused)
    {
        if (player_active_timeout < PLAYER_GRACE)
        {
            process_entities = false;
        }
    }
    else if (is_superHot)
    {
        if (player_active_timeout <= 0)
        {
            process_entities = false;

        }
    }
}
 
Example 7
Source Project: OpenModsLib   Source File: CommandConfig.java    License: MIT License 6 votes vote down vote up
@Override
public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos blockPos) {
	String command = args[0];
	if (args.length == 1) return filterPrefixes(command, SUBCOMMANDS);

	String modId = args[1];
	if (args.length == 2) return filterPrefixes(modId, ConfigProcessing.getConfigsIds());

	if (COMMAND_SAVE.equals(command)) return Collections.emptyList();

	final ModConfig config = ConfigProcessing.getConfig(modId);
	if (config == null) return Collections.emptyList();

	String category = args[2];
	if (args.length == 3) return filterPrefixes(category, config.getCategories());

	String name = args[3];
	if (args.length == 4) return filterPrefixes(name, config.getValues(category));

	return Collections.emptyList();
}
 
Example 8
public boolean isTargetBlockUnchanged()
{
    MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
    if (server == null)
    {
        return false;
    }

    World world = server.getWorld(this.dimension);
    if (world == null)
    {
        return false;
    }

    IBlockState iBlockState = world.getBlockState(this.pos);
    Block block = iBlockState.getBlock();
    ResourceLocation rl = ForgeRegistries.BLOCKS.getKey(block);
    int meta = block.getMetaFromState(iBlockState);

    // The target block unique name and metadata matches what we have stored
    return this.blockMeta == meta && rl != null && this.blockName.equals(rl.toString());
}
 
Example 9
Source Project: Kettle   Source File: CraftSkull.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean setOwner(String name) {
    if (name == null || name.length() > MAX_OWNER_LENGTH) {
        return false;
    }

    GameProfile profile = MinecraftServer.getServerCB().getPlayerProfileCache().getGameProfileForUsername(name);
    if (profile == null) {
        return false;
    }

    if (skullType != SkullType.PLAYER) {
        skullType = SkullType.PLAYER;
    }

    this.profile = profile;
    return true;
}
 
Example 10
Source Project: Framez   Source File: SoulNetworkHandler.java    License: GNU General Public License v3.0 6 votes vote down vote up
public static boolean canSyphonFromOnlyNetwork(String ownerName, int damageToBeDone)
{
    if (MinecraftServer.getServer() == null)
    {
        return false;
    }

    World world = MinecraftServer.getServer().worldServers[0];
    LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);

    if (data == null)
    {
        data = new LifeEssenceNetwork(ownerName);
        world.setItemData(ownerName, data);
    }

    return data.currentEssence >= damageToBeDone;
}
 
Example 11
public static void setCurrentEssence(String ownerName, int essence)
{
	if (MinecraftServer.getServer() == null)
       {
           return;
       }

       World world = MinecraftServer.getServer().worldServers[0];
       LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);

       if (data == null)
       {
           data = new LifeEssenceNetwork(ownerName);
           world.setItemData(ownerName, data);
       }
       
       data.currentEssence = essence;
       data.markDirty();
}
 
Example 12
Source Project: I18nUpdateMod   Source File: CmdReport.java    License: MIT License 6 votes vote down vote up
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) {
    ItemStack stack = Minecraft.getMinecraft().player.inventory.getCurrentItem();
    if (!stack.isEmpty()) {
        String text = String.format("模组ID:%s\n非本地化名称:%s\n显示名称:%s", stack.getItem().getCreatorModId(stack), stack.getItem().getUnlocalizedName(), stack.getDisplayName());
        String url = I18nConfig.key.reportURL;
        try {
            GuiScreen.setClipboardString(text);
            Desktop.getDesktop().browse(new URI(url));
        } catch (Exception urlException) {
            urlException.printStackTrace();
        }
    } else {
        Minecraft.getMinecraft().player.sendMessage(new TextComponentTranslation("message.i18nmod.cmd_report.empty"));
    }
}
 
Example 13
Source Project: I18nUpdateMod   Source File: CmdGetLangpack.java    License: MIT License 6 votes vote down vote up
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) {
    // 参数为空,警告
    if (args.length == 0) {
        Minecraft.getMinecraft().player.sendMessage(new TextComponentTranslation("message.i18nmod.cmd_get_langpack.empty"));
        return;
    }

    // 参数存在,进行下一步判定
    if (Minecraft.getMinecraft().getResourceManager().getResourceDomains().contains(args[0])) {
        Minecraft.getMinecraft().player.sendMessage(new TextComponentTranslation("message.i18nmod.cmd_get_langpack.right_start", args[0]));

        // 同名资源包存在,直接返回
        if (!cerateTempLangpack(args[0])) {
            Minecraft.getMinecraft().player.sendMessage(new TextComponentTranslation("message.i18nmod.cmd_get_langpack.error_create_folder"));
            return;
        }

        // 主下载功能
        langFileDownloader(args[0]);
    }
    // 参数不存在,警告
    else {
        Minecraft.getMinecraft().player.sendMessage(new TextComponentTranslation("message.i18nmod.cmd_get_langpack.not_found", args[0]));
    }
}
 
Example 14
Source Project: Thermos   Source File: CraftBlock.java    License: GNU General Public License v3.0 6 votes vote down vote up
public static void dumpMaterials() {
    if (MinecraftServer.getServer().cauldronConfig.dumpMaterials.getValue())
    {
        FMLLog.info("Cauldron Dump Materials is ENABLED. Starting dump...");
        for (int i = 0; i < 32000; i++)
        {
            Material material = Material.getMaterial(i);
            if (material != null)
            {
                FMLLog.info("Found material " + material + " with ID " + i);
            }
        }
        FMLLog.info("Cauldron Dump Materials complete.");
        FMLLog.info("To disable these dumps, set cauldron.dump-materials to false in bukkit.yml.");
    }
}
 
Example 15
Source Project: Kettle   Source File: ActivationRange.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Find what entities are in range of the players in the world and set
 * active if in range.
 *
 * @param world
 */
public static void activateEntities(World world) {
    final int miscActivationRange = world.spigotConfig.miscActivationRange;
    final int animalActivationRange = world.spigotConfig.animalActivationRange;
    final int monsterActivationRange = world.spigotConfig.monsterActivationRange;

    int maxRange = Math.max(monsterActivationRange, animalActivationRange);
    maxRange = Math.max(maxRange, miscActivationRange);
    maxRange = Math.min((world.spigotConfig.viewDistance << 4) - 8, maxRange);

    for (EntityPlayer player : world.playerEntities) {

        player.activatedTick = MinecraftServer.currentTick;
        maxBB = player.getEntityBoundingBox().grow(maxRange, 256, maxRange);
        miscBB = player.getEntityBoundingBox().grow(miscActivationRange, 256, miscActivationRange);
        animalBB = player.getEntityBoundingBox().grow(animalActivationRange, 256, animalActivationRange);
        monsterBB = player.getEntityBoundingBox().grow(monsterActivationRange, 256, monsterActivationRange);

        int i = MathHelper.floor(maxBB.minX / 16.0D);
        int j = MathHelper.floor(maxBB.maxX / 16.0D);
        int k = MathHelper.floor(maxBB.minZ / 16.0D);
        int l = MathHelper.floor(maxBB.maxZ / 16.0D);

        for (int i1 = i; i1 <= j; ++i1) {
            for (int j1 = k; j1 <= l; ++j1) {
                if (world.getWorld().isChunkLoaded(i1, j1)) {
                    activateChunkEntities(world.getChunkFromChunkCoords(i1, j1));
                }
            }
        }
    }
}
 
Example 16
Source Project: Thermos   Source File: WorldConfig.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void log(String s)
{
    if ( verbose )
    {
        MinecraftServer.getServer().logInfo( s );
    }
}
 
Example 17
Source Project: CommunityMod   Source File: Nyan.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
@SubscribeEvent
public static void onLivingUpdate(LivingEvent.LivingUpdateEvent event) {
	final Entity entity = event.getEntity();
	final World world = entity.getEntityWorld();

	if(world.isRemote) {
		return;
	}

	final MinecraftServer server = world.getMinecraftServer();
	final NBTTagCompound data = entity.getEntityData();

	if(data.hasUniqueId(NYANED_ENTITY_UUID_KEY)) {
		final Entity nyanedEntity =
				server.getEntityFromUuid(data.getUniqueId(NYANED_ENTITY_UUID_KEY));

		if(nyanedEntity == null || nyanedEntity.isDead) {
			world.removeEntity(entity);
			return;
		}
	}

	if(data.getBoolean(HAS_NYAN_ENTITY_KEY)) {
		updateNyanEntity(server, (WorldServer) world, entity, data);
	} else if(!data.hasKey(HAS_NYAN_ENTITY_KEY)) {
		if(entity instanceof EntityPlayer || random.nextInt(10) == 0) {
			data.setBoolean(HAS_NYAN_ENTITY_KEY, true);
			updateNyanEntity(server, (WorldServer) world, entity, data);
		} else {
			data.setBoolean(HAS_NYAN_ENTITY_KEY, false);
		}
	}
}
 
Example 18
Source Project: Thermos   Source File: CraftIpBanEntry.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public void save() {
    IPBanEntry entry = new IPBanEntry(target, this.created, this.source, this.expiration, this.reason);
    this.list.func_152687_a(entry);
    try {
        this.list.func_152678_f();
    } catch (IOException ex) {
        MinecraftServer.getLogger().error("Failed to save banned-ips.json, " + ex.getMessage());
    }
}
 
Example 19
Source Project: NoCubes   Source File: TestRunner.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * @return if the test FAILED
 */
private static boolean runTestWithCatch(final Test test, final MinecraftServer server) {
	try {
		test.action.run();
	} catch (Exception e) {
		log(server, new StringTextComponent("TEST FAILED: " + test.name).applyTextStyle(TextFormatting.RED));
		e.printStackTrace();
		return true;
	}
	return false;
}
 
Example 20
@Redirect(method = "method_14168", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/dimension/Dimension;createChunkGenerator()Lnet/minecraft/world/gen/chunk/ChunkGenerator;"))
private static ChunkGenerator<?> createChunkGenerator(Dimension dimension, WorldSaveHandler saveHandler, Executor executor, MinecraftServer minecraftServer, WorldGenerationProgressListener progressListener, World world, Dimension dimensionArg) {
	LevelGeneratorType generatorType = world.getLevelProperties().getGeneratorType();

	if (generatorType instanceof PatchworkLevelGeneratorType) {
		return ((IForgeWorldType) generatorType).createChunkGenerator(world);
	} else {
		return dimension.createChunkGenerator();
	}
}
 
Example 21
Source Project: Thermos   Source File: CauldronUtils.java    License: GNU General Public License v3.0 5 votes vote down vote up
public static <T> void dumpAndSortClassList(List<Class<? extends T>> classList)
{
    List<String> sortedClassList = new ArrayList<String>();
    for (Class clazz : classList)
    {
        sortedClassList.add(clazz.getName());
    }
    Collections.sort(sortedClassList);
    if (MinecraftServer.tileEntityConfig.enableTECanUpdateWarning.getValue())
    {
        for (String aSortedClassList : sortedClassList) {
            MinecraftServer.getServer().logInfo("Detected TE " + aSortedClassList + " with canUpdate set to true and no updateEntity override!. This is NOT good, please report to mod author as this can hurt performance.");
        }
    }
}
 
Example 22
Source Project: Framez   Source File: FakeWorldServer.java    License: GNU General Public License v3.0 5 votes vote down vote up
private FakeWorldServer(World world) {

        super(MinecraftServer.getServer(), new NonSavingHandler(), world.getWorldInfo().getWorldName(), world.provider.dimensionId,
                new WorldSettings(world.getWorldInfo()), world.theProfiler);
        DimensionManager.setWorld(world.provider.dimensionId, (WorldServer) world);

        chunkProvider = world.getChunkProvider();
    }
 
Example 23
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
	if(sender instanceof EntityPlayer) {
		ItemStack cape = new ItemStack(ModItems.CAPE);
		NBTHelper.setInt(cape, "maxTick", 1000000);
		((EntityPlayer)sender).inventory.addItemStackToInventory(cape);
	} else {
		notifyCommandListener(sender, this, "wizardry.command.notplayer");
	}
}
 
Example 24
@Override
public void handle(ByteBuf data, EntityPlayer player) {
	if (ModConfigs.disabled) return;
	int dim = data.readInt();
	int xPos = data.readInt();
	int yPos = data.readInt();
	int zPos = data.readInt();
	byte renderDistance = data.readByte();

	if (!DimensionManager.isDimensionRegistered(dim)) return;
	WorldServer world = MinecraftServer.getServer().worldServerForDimension(dim);
	if (world == null) return;
	int x;
	int y;
	int z;
	if (yPos < 0) {
		ChunkCoordinates c = world.getSpawnPoint();
		x = c.posX >> 4;
		y = c.posY >> 4;
		z = c.posZ >> 4;
	} else {
		x = xPos;
		y = yPos;
		z = zPos;
	}
	if (renderDistance > ModConfigs.renderDistance) renderDistance = ModConfigs.renderDistance;
	ChunkFinderManager.instance.addFinder(new ChunkFinder(new ChunkCoordinates(x, y, z), dim, world.getChunkProvider(), player, renderDistance));
	//TODO: Add to tracking list.  Send time/data updates at intervals. Keep in mind to catch player disconnects when tracking clients.
	//Register ChunkFinder, and support change of finder location.
	//TODO: This is a repeat of the handling of PacketRequestWorldInfo
	net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new ClientWorldInfoEvent(dim, (EntityPlayerMP) player));
	LookingGlassPacketManager.bus.sendTo(PacketWorldInfo.createPacket(dim), (EntityPlayerMP) player);
}
 
Example 25
public static File getWorldDirectory(MinecraftServer server) {
	if (server.isDedicatedServer()) {
		return server.getFile("world");
	} else {
		File worldsDir = getAnvilFile(server);
		if (worldsDir == null) {
			return null;
		}

		return new File(worldsDir, server.getFolderName());
	}
}
 
Example 26
Source Project: Thermos   Source File: CauldronHooks.java    License: GNU General Public License v3.0 5 votes vote down vote up
public static boolean checkBoundingBoxSize(Entity entity, AxisAlignedBB aabb)
{
    if (entity instanceof EntityLivingBase && (!(entity instanceof IBossDisplayData) || !(entity instanceof IEntityMultiPart))
            && !(entity instanceof EntityPlayer))
    {
        int logSize = MinecraftServer.cauldronConfig.largeBoundingBoxLogSize.getValue();
        if (logSize <= 0 || !MinecraftServer.cauldronConfig.checkEntityBoundingBoxes.getValue()) return false;
        int x = MathHelper.floor_double(aabb.minX);
        int x1 = MathHelper.floor_double(aabb.maxX + 1.0D);
        int y = MathHelper.floor_double(aabb.minY);
        int y1 = MathHelper.floor_double(aabb.maxY + 1.0D);
        int z = MathHelper.floor_double(aabb.minZ);
        int z1 = MathHelper.floor_double(aabb.maxZ + 1.0D);

        int size = Math.abs(x1 - x) * Math.abs(y1 - y) * Math.abs(z1 - z);
        if (size > MinecraftServer.cauldronConfig.largeBoundingBoxLogSize.getValue())
        {
            logWarning("Entity being removed for bounding box restrictions");
            logWarning("BB Size: {0} > {1} avg edge: {2}", size, logSize, aabb.getAverageEdgeLength());
            logWarning("Motion: ({0}, {1}, {2})", entity.motionX, entity.motionY, entity.motionZ);
            logWarning("Calculated bounding box: {0}", aabb);
            logWarning("Entity bounding box: {0}", entity.getBoundingBox());
            logWarning("Entity: {0}", entity);
            NBTTagCompound tag = new NBTTagCompound();
            entity.writeToNBT(tag);
            logWarning("Entity NBT: {0}", tag);
            logStack();
            entity.setDead();
            return true;
        }
    }

    return false;
}
 
Example 27
Source Project: qcraft-mod   Source File: TileEntityQuantumComputer.java    License: Apache License 2.0 5 votes vote down vote up
public static void teleportPlayerLocal( EntityPlayer player, String portalID )
{
    PortalLocation location = (portalID != null) ?
        PortalRegistry.PortalRegistry.getPortal( portalID ) :
        null;

    if( location != null )
    {
        double xPos = ((double)location.m_x1 + location.m_x2 + 1) / 2;
        double yPos = (double) Math.min(location.m_y1, location.m_y2) + 1;
        double zPos = ((double)location.m_z1 + location.m_z2 + 1) / 2;
        if( location.m_dimensionID == player.dimension )
        {
            player.timeUntilPortal = 40;
            player.setPositionAndUpdate( xPos, yPos, zPos );
        }
        else if( player instanceof EntityPlayerMP )
        {
            player.timeUntilPortal = 40;
            MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension(
                (EntityPlayerMP)player,
                location.m_dimensionID,
                new QuantumTeleporter(
                    MinecraftServer.getServer().worldServerForDimension( location.m_dimensionID ),
                    xPos, yPos, zPos
                )
            );
        }
    }
}
 
Example 28
Source Project: Cyberware   Source File: CommandClearCyberware.java    License: MIT License 5 votes vote down vote up
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
	EntityPlayerMP entityplayermp = args.length == 0 ? getCommandSenderAsPlayer(sender) : getPlayer(server, sender, args[0]);
	NBTTagCompound nbttagcompound = null;

	CyberwareAPI.getCapability(entityplayermp).resetWare(entityplayermp);
	CyberwareAPI.updateData(entityplayermp);
	
	notifyCommandListener(sender, this, "cyberware.commands.clearCyberware.success", new Object[] {entityplayermp.getName()});
}
 
Example 29
@Inject(method = "setupServer",
        at = @At(value = "INVOKE",
                target = "net/minecraft/server/dedicated/MinecraftDedicatedServer.setPlayerManager(Lnet/minecraft/server/PlayerManager;)V",
                shift = At.Shift.AFTER),
        cancellable = true
)
public void setupServer(CallbackInfoReturnable<Boolean> info) throws ScriptException {
    SandboxServer.constructAndSetup((MinecraftServer) (Object) this);
}
 
Example 30
Source Project: Kettle   Source File: CraftMetaSpawnEgg.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
void deserializeInternal(NBTTagCompound tag) {
    super.deserializeInternal(tag);

    if (tag.hasKey(ENTITY_TAG.NBT)) {
        entityTag = tag.getCompoundTag(ENTITY_TAG.NBT);
        MinecraftServer.getServerCB().getDataFixer().process(FixTypes.ENTITY, entityTag); // PAIL: convert TODO: identify DataConverterTypes after implementation

        if (entityTag.hasKey(ENTITY_ID.NBT)) {
            this.spawnedType = EntityType.fromName(new ResourceLocation(entityTag.getString(ENTITY_ID.NBT)).getResourcePath());
        }
    }
}