本文整理汇总了Java中net.minecraft.world.storage.MapData.calculateMapCenter方法的典型用法代码示例。如果您正苦于以下问题:Java MapData.calculateMapCenter方法的具体用法?Java MapData.calculateMapCenter怎么用?Java MapData.calculateMapCenter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.storage.MapData
的用法示例。
在下文中一共展示了MapData.calculateMapCenter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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);
}
}
示例3: 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;
}
}
示例4: 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;
}
示例5: 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);
}
示例6: 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);
}
}