当前位置: 首页>>代码示例>>Java>>正文


Java MapData.markDirty方法代码示例

本文整理汇总了Java中net.minecraft.world.storage.MapData.markDirty方法的典型用法代码示例。如果您正苦于以下问题:Java MapData.markDirty方法的具体用法?Java MapData.markDirty怎么用?Java MapData.markDirty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.world.storage.MapData的用法示例。


在下文中一共展示了MapData.markDirty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreated

import net.minecraft.world.storage.MapData; //导入方法依赖的package包/类
/**
 * Called when item is crafted/smelted. Used only by maps so far.
 */
public void onCreated(ItemStack stack, World worldIn, EntityPlayer playerIn)
{
    if (stack.hasTagCompound() && stack.getTagCompound().getBoolean("map_is_scaling"))
    {
        MapData mapdata = Items.filled_map.getMapData(stack, worldIn);
        stack.setItemDamage(worldIn.getUniqueDataId("map"));
        MapData mapdata1 = new MapData("map_" + stack.getMetadata());
        mapdata1.scale = (byte)(mapdata.scale + 1);

        if (mapdata1.scale > 4)
        {
            mapdata1.scale = 4;
        }

        mapdata1.calculateMapCenter((double)mapdata.xCenter, (double)mapdata.zCenter, mapdata1.scale);
        mapdata1.dimension = mapdata.dimension;
        mapdata1.markDirty();
        worldIn.setItemData("map_" + stack.getMetadata(), mapdata1);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:24,代码来源:ItemMap.java

示例2: scaleMap

import net.minecraft.world.storage.MapData; //导入方法依赖的package包/类
protected static void scaleMap(ItemStack p_185063_0_, World p_185063_1_, int p_185063_2_)
{
    MapData mapdata = Items.FILLED_MAP.getMapData(p_185063_0_, p_185063_1_);
    p_185063_0_.setItemDamage(p_185063_1_.getUniqueDataId("map"));
    MapData mapdata1 = new MapData("map_" + p_185063_0_.getMetadata());

    if (mapdata != null)
    {
        mapdata1.scale = (byte)MathHelper.clamp(mapdata.scale + p_185063_2_, 0, 4);
        mapdata1.trackingPosition = mapdata.trackingPosition;
        mapdata1.calculateMapCenter((double)mapdata.xCenter, (double)mapdata.zCenter, mapdata1.scale);
        mapdata1.dimension = mapdata.dimension;
        mapdata1.markDirty();
        p_185063_1_.setItemData("map_" + p_185063_0_.getMetadata(), mapdata1);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:ItemMap.java

示例3: enableMapTracking

import net.minecraft.world.storage.MapData; //导入方法依赖的package包/类
protected static void enableMapTracking(ItemStack p_185064_0_, World p_185064_1_)
{
    MapData mapdata = Items.FILLED_MAP.getMapData(p_185064_0_, p_185064_1_);
    p_185064_0_.setItemDamage(p_185064_1_.getUniqueDataId("map"));
    MapData mapdata1 = new MapData("map_" + p_185064_0_.getMetadata());
    mapdata1.trackingPosition = true;

    if (mapdata != null)
    {
        mapdata1.xCenter = mapdata.xCenter;
        mapdata1.zCenter = mapdata.zCenter;
        mapdata1.scale = mapdata.scale;
        mapdata1.dimension = mapdata.dimension;
        mapdata1.markDirty();
        p_185064_1_.setItemData("map_" + p_185064_0_.getMetadata(), mapdata1);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:ItemMap.java

示例4: onCreated

import net.minecraft.world.storage.MapData; //导入方法依赖的package包/类
/**
 * Called when item is crafted/smelted. Used only by maps so far.
 */
public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
    if (par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().getBoolean("map_is_scaling"))
    {
        MapData var4 = Items.filled_map.getMapData(par1ItemStack, par2World);
        par1ItemStack.setItemDamage(par2World.getUniqueDataId("map"));
        MapData var5 = new MapData("map_" + par1ItemStack.getItemDamage());
        var5.scale = (byte)(var4.scale + 1);

        if (var5.scale > 4)
        {
            var5.scale = 4;
        }

        var5.xCenter = var4.xCenter;
        var5.zCenter = var4.zCenter;
        var5.dimension = var4.dimension;
        var5.markDirty();
        par2World.setItemData("map_" + par1ItemStack.getItemDamage(), var5);
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:25,代码来源:ItemMap.java

示例5: onCreated

import net.minecraft.world.storage.MapData; //导入方法依赖的package包/类
public void onCreated(ItemStack p_77622_1_, World p_77622_2_, EntityPlayer p_77622_3_)
{
    if (p_77622_1_.hasTagCompound() && p_77622_1_.getTagCompound().getBoolean("map_is_scaling"))
    {
        MapData mapdata = Items.filled_map.getMapData(p_77622_1_, p_77622_2_);
        p_77622_1_.setItemDamage(p_77622_2_.getUniqueDataId("map"));
        MapData mapdata1 = new MapData("map_" + p_77622_1_.getItemDamage());
        mapdata1.scale = (byte)(mapdata.scale + 1);

        if (mapdata1.scale > 4)
        {
            mapdata1.scale = 4;
        }

        mapdata1.xCenter = mapdata.xCenter;
        mapdata1.zCenter = mapdata.zCenter;
        mapdata1.dimension = mapdata.dimension;
        mapdata1.markDirty();
        p_77622_2_.setItemData("map_" + p_77622_1_.getItemDamage(), mapdata1);
        // CraftBukkit start
        MapInitializeEvent event = new MapInitializeEvent(mapdata1.mapView);
        Bukkit.getServer().getPluginManager().callEvent(event);
        // CraftBukkit end
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:26,代码来源:ItemMap.java

示例6: onCreated

import net.minecraft.world.storage.MapData; //导入方法依赖的package包/类
public void onCreated(ItemStack p_77622_1_, World p_77622_2_, EntityPlayer p_77622_3_)
{
    if (p_77622_1_.hasTagCompound() && p_77622_1_.getTagCompound().getBoolean("map_is_scaling"))
    {
        MapData mapdata = Items.filled_map.getMapData(p_77622_1_, p_77622_2_);
        p_77622_1_.setItemDamage(p_77622_2_.getUniqueDataId("map"));
        MapData mapdata1 = new MapData("map_" + p_77622_1_.getItemDamage());
        mapdata1.scale = (byte)(mapdata.scale + 1);

        if (mapdata1.scale > 4)
        {
            mapdata1.scale = 4;
        }

        mapdata1.xCenter = mapdata.xCenter;
        mapdata1.zCenter = mapdata.zCenter;
        mapdata1.dimension = mapdata.dimension;
        mapdata1.markDirty();
        p_77622_2_.setItemData("map_" + p_77622_1_.getItemDamage(), mapdata1);
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:22,代码来源:ItemMap.java

示例7: onCreated

import net.minecraft.world.storage.MapData; //导入方法依赖的package包/类
/**
 * Called when item is crafted/smelted. Used only by maps so far.
 */
public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
    if (par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().getBoolean("map_is_scaling"))
    {
        MapData mapdata = Item.map.getMapData(par1ItemStack, par2World);
        par1ItemStack.setItemDamage(par2World.getUniqueDataId("map"));
        MapData mapdata1 = new MapData("map_" + par1ItemStack.getItemDamage());
        mapdata1.scale = (byte)(mapdata.scale + 1);

        if (mapdata1.scale > 4)
        {
            mapdata1.scale = 4;
        }

        mapdata1.xCenter = mapdata.xCenter;
        mapdata1.zCenter = mapdata.zCenter;
        mapdata1.dimension = mapdata.dimension;
        mapdata1.markDirty();
        par2World.setItemData("map_" + par1ItemStack.getItemDamage(), mapdata1);
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:25,代码来源:ItemMap.java

示例8: onItemRightClick

import net.minecraft.world.storage.MapData; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) {
    ItemStack itemStackIn = playerIn.getHeldItem(hand);
    ItemStack itemstack1 = new ItemStack(ModItems.itemWirelessMap, 1, worldIn.getUniqueDataId("map"));
    String s = "map_" + itemstack1.getItemDamage();
    MapData mapdata = new MapData(s);
    worldIn.setData(s, mapdata);
    mapdata.scale = 0;
    int i = 128 * (1 << mapdata.scale);
    mapdata.xCenter = (int)(Math.round(playerIn.posX / (double)i) * (long)i);
    mapdata.zCenter = (int)(Math.round(playerIn.posZ / (double)i) * (long)i);
    mapdata.dimension = worldIn.provider.getDimension();
    mapdata.markDirty();
    itemStackIn.shrink(1);

    if (itemStackIn.getCount() <= 0)
    {
        return new ActionResult<>(EnumActionResult.SUCCESS, itemstack1);
    }
    else
    {
        if (!playerIn.inventory.addItemStackToInventory(itemstack1.copy()))
        {
            playerIn.dropItem(itemstack1, false);
        }

        return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn);
    }
}
 
开发者ID:TheCBProject,项目名称:WirelessRedstone,代码行数:30,代码来源:ItemEmptyWirelessMap.java

示例9: onItemRightClick

import net.minecraft.world.storage.MapData; //导入方法依赖的package包/类
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
{
    ItemStack itemstack = new ItemStack(Items.filled_map, 1, worldIn.getUniqueDataId("map"));
    String s = "map_" + itemstack.getMetadata();
    MapData mapdata = new MapData(s);
    worldIn.setItemData(s, mapdata);
    mapdata.scale = 0;
    mapdata.calculateMapCenter(playerIn.posX, playerIn.posZ, mapdata.scale);
    mapdata.dimension = (byte)worldIn.provider.getDimensionId();
    mapdata.markDirty();
    --itemStackIn.stackSize;

    if (itemStackIn.stackSize <= 0)
    {
        return itemstack;
    }
    else
    {
        if (!playerIn.inventory.addItemStackToInventory(itemstack.copy()))
        {
            playerIn.dropPlayerItemWithRandomChoice(itemstack, false);
        }

        playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
        return itemStackIn;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:31,代码来源:ItemEmptyMap.java

示例10: func_190906_a

import net.minecraft.world.storage.MapData; //导入方法依赖的package包/类
public static ItemStack func_190906_a(World p_190906_0_, double p_190906_1_, double p_190906_3_, byte p_190906_5_, boolean p_190906_6_, boolean p_190906_7_)
{
    ItemStack itemstack = new ItemStack(Items.FILLED_MAP, 1, p_190906_0_.getUniqueDataId("map"));
    String s = "map_" + itemstack.getMetadata();
    MapData mapdata = new MapData(s);
    p_190906_0_.setItemData(s, mapdata);
    mapdata.scale = p_190906_5_;
    mapdata.calculateMapCenter(p_190906_1_, p_190906_3_, mapdata.scale);
    mapdata.dimension = (byte)p_190906_0_.provider.getDimensionType().getId();
    mapdata.trackingPosition = p_190906_6_;
    mapdata.field_191096_f = p_190906_7_;
    mapdata.markDirty();
    return itemstack;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:15,代码来源:ItemMap.java

示例11: scaleMap

import net.minecraft.world.storage.MapData; //导入方法依赖的package包/类
protected static void scaleMap(ItemStack p_185063_0_, World p_185063_1_, int p_185063_2_)
{
    MapData mapdata = Items.FILLED_MAP.getMapData(p_185063_0_, p_185063_1_);
    p_185063_0_.setItemDamage(p_185063_1_.getUniqueDataId("map"));
    MapData mapdata1 = new MapData("map_" + p_185063_0_.getMetadata());
    mapdata1.scale = (byte)MathHelper.clamp_int(mapdata.scale + p_185063_2_, 0, 4);
    mapdata1.trackingPosition = mapdata.trackingPosition;
    mapdata1.calculateMapCenter((double)mapdata.xCenter, (double)mapdata.zCenter, mapdata1.scale);
    mapdata1.dimension = mapdata.dimension;
    mapdata1.markDirty();
    p_185063_1_.setItemData("map_" + p_185063_0_.getMetadata(), mapdata1);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:13,代码来源:ItemMap.java

示例12: enableMapTracking

import net.minecraft.world.storage.MapData; //导入方法依赖的package包/类
protected static void enableMapTracking(ItemStack p_185064_0_, World p_185064_1_)
{
    MapData mapdata = Items.FILLED_MAP.getMapData(p_185064_0_, p_185064_1_);
    p_185064_0_.setItemDamage(p_185064_1_.getUniqueDataId("map"));
    MapData mapdata1 = new MapData("map_" + p_185064_0_.getMetadata());
    mapdata1.trackingPosition = true;
    mapdata1.xCenter = mapdata.xCenter;
    mapdata1.zCenter = mapdata.zCenter;
    mapdata1.scale = mapdata.scale;
    mapdata1.dimension = mapdata.dimension;
    mapdata1.markDirty();
    p_185064_1_.setItemData("map_" + p_185064_0_.getMetadata(), mapdata1);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:14,代码来源:ItemMap.java

示例13: onItemRightClick

import net.minecraft.world.storage.MapData; //导入方法依赖的package包/类
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
    ItemStack itemstack = new ItemStack(Items.FILLED_MAP, 1, worldIn.getUniqueDataId("map"));
    String s = "map_" + itemstack.getMetadata();
    MapData mapdata = new MapData(s);
    worldIn.setItemData(s, mapdata);
    mapdata.scale = 0;
    mapdata.calculateMapCenter(playerIn.posX, playerIn.posZ, mapdata.scale);
    mapdata.dimension = worldIn.provider.getDimension();
    mapdata.trackingPosition = true;
    mapdata.markDirty();
    --itemStackIn.stackSize;

    if (itemStackIn.stackSize <= 0)
    {
        return new ActionResult(EnumActionResult.SUCCESS, itemstack);
    }
    else
    {
        if (!playerIn.inventory.addItemStackToInventory(itemstack.copy()))
        {
            playerIn.dropItem(itemstack, false);
        }

        playerIn.addStat(StatList.getObjectUseStats(this));
        return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:29,代码来源:ItemEmptyMap.java

示例14: onItemRightClick

import net.minecraft.world.storage.MapData; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
   {
	if (this.isMapReady(stack))
	{
		// Is already a map, so nothing to be done here
	}
	else
	{
		// Initiating it now
		stack.setTagCompound(new NBTTagCompound());
		stack.getTagCompound().setBoolean("initiated", true);

		stack.setItemDamage(world.getUniqueDataId("map"));

		String uniqueName = "map_" + stack.getItemDamage();

		MapData mapdata = new MapData(uniqueName);
        world.setItemData(uniqueName, mapdata);

        mapdata.scale = 2;					// Default scale
        int i = 128 * (1 << mapdata.scale);

        mapdata.xCenter = (int)(Math.round(player.posX / i) * i);
        mapdata.zCenter = (int)(Math.round(player.posZ / i) * i);
        mapdata.dimension = world.provider.getDimension();

        mapdata.markDirty();
	}

       return new ActionResult(EnumActionResult.PASS, stack);
   }
 
开发者ID:Domochevsky,项目名称:minecraft-territorialdealings,代码行数:33,代码来源:TerritoryMap.java

示例15: onItemRightClick

import net.minecraft.world.storage.MapData; //导入方法依赖的package包/类
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
    ItemStack var4 = new ItemStack(Items.filled_map, 1, par2World.getUniqueDataId("map"));
    String var5 = "map_" + var4.getItemDamage();
    MapData var6 = new MapData(var5);
    par2World.setItemData(var5, var6);
    var6.scale = 0;
    int var7 = 128 * (1 << var6.scale);
    var6.xCenter = (int)(Math.round(par3EntityPlayer.posX / (double)var7) * (long)var7);
    var6.zCenter = (int)(Math.round(par3EntityPlayer.posZ / (double)var7) * (long)var7);
    var6.dimension = (byte)par2World.provider.dimensionId;
    var6.markDirty();
    --par1ItemStack.stackSize;

    if (par1ItemStack.stackSize <= 0)
    {
        return var4;
    }
    else
    {
        if (!par3EntityPlayer.inventory.addItemStackToInventory(var4.copy()))
        {
            par3EntityPlayer.dropPlayerItemWithRandomChoice(var4, false);
        }

        return par1ItemStack;
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:32,代码来源:ItemEmptyMap.java


注:本文中的net.minecraft.world.storage.MapData.markDirty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。