Java Code Examples for

The following examples show how to use . 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 check out the related API usage on the sidebar.
Example 1
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
    ItemStack heldStack = player.getHeldItem(hand);

    if (!player.capabilities.isCreativeMode) heldStack.shrink(1);

    world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_SKELETON_DEATH, SoundCategory.PLAYERS, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

    if (!world.isRemote) {
        WorldInfo worldinfo = world.getWorldInfo();
    } else player.sendMessage(new TextComponentString("Dark clouds start forming in the sky"));

    return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, heldStack);
Example 2
Source Project: malmo   File:    License: MIT License 6 votes vote down vote up
public boolean shouldCreateWorld(MissionInit missionInit, World world)
	if (this.fwparams != null && this.fwparams.isForceReset())
	    return true;
    if (Minecraft.getMinecraft().world == null || world == null)
        return true;    // Definitely need to create a world if there isn't one in existence!

    WorldInfo worldInfo =  world.getWorldInfo();
    if (worldInfo == null)
        return true;

    String genOptions = worldInfo.getGeneratorOptions();
    if (genOptions == null)
        return true;

    if (!genOptions.equals(this.fwparams.getGeneratorString()))
        return true;    // Generation doesn't match, so recreate.
    return false;
Example 3
public ShipStorage(BlockPos bp, World hostWorld) {
	super(hostWorld.getSaveHandler(), hostWorld.getWorldInfo(), hostWorld.provider, hostWorld.profiler,
	blockMap = new HashMap<BlockPos, BlockStorage>();
	offset = bp;
	tesrs = new ArrayList<TileEntity>();
	host = hostWorld;
Example 4
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 5
public VoidWorldBiomeProvider(World world)
    super(world.getWorldInfo()); = world;