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


Java MapData类代码示例

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


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

示例1: downloadMap

import net.minecraft.world.storage.MapData; //导入依赖的package包/类
public void downloadMap(@Nullable String fileName, @Nullable Integer scaledRes) {
    if (MC.player == null || !(MC.player.getHeldItemMainhand().getItem() instanceof ItemMap)) return;

    ItemMap map = (ItemMap) MC.player.getHeldItemMainhand().getItem();
    MapData heldMapData = map.getMapData(MC.player.getHeldItemMainhand(), MC.world);

    if (fileName == null) fileName = heldMapData.mapName;

    ResourceLocation location = findResourceLocation(heldMapData.mapName);
    if (location == null) {
        Helper.printMessage("Failed to find ResourceLocation");
        return;
    }

    DynamicTexture texture = (DynamicTexture)MC.getTextureManager().getTexture(location);
    BufferedImage image = dynamicToImage(texture);
    if (scaledRes != null) image = createResizedCopy(image, scaledRes, scaledRes, true);

    saveImage(fileName, image);
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:21,代码来源:MapDownloader.java

示例2: onUpdate

import net.minecraft.world.storage.MapData; //导入依赖的package包/类
/**
 * Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and
 * update it's contents.
 */
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected)
{
    if (!worldIn.isRemote)
    {
        MapData mapdata = this.getMapData(stack, worldIn);

        if (entityIn instanceof EntityPlayer)
        {
            EntityPlayer entityplayer = (EntityPlayer)entityIn;
            mapdata.updateVisiblePlayers(entityplayer, stack);
        }

        if (isSelected)
        {
            this.updateMapData(worldIn, entityIn, mapdata);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:23,代码来源:ItemMap.java

示例3: 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

示例4: setMapdataTo

import net.minecraft.world.storage.MapData; //导入依赖的package包/类
/**
 * Sets new MapData from the packet to given MapData param
 */
public void setMapdataTo(MapData mapdataIn)
{
    mapdataIn.scale = this.mapScale;
    mapdataIn.mapDecorations.clear();

    for (int i = 0; i < this.mapVisiblePlayersVec4b.length; ++i)
    {
        Vec4b vec4b = this.mapVisiblePlayersVec4b[i];
        mapdataIn.mapDecorations.put("icon-" + i, vec4b);
    }

    for (int j = 0; j < this.mapMaxX; ++j)
    {
        for (int k = 0; k < this.mapMaxY; ++k)
        {
            mapdataIn.colors[this.mapMinX + j + (this.mapMinY + k) * 128] = this.mapDataBytes[j + k * this.mapMaxX];
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:23,代码来源:S34PacketMaps.java

示例5: addInformation

import net.minecraft.world.storage.MapData; //导入依赖的package包/类
/**
 * allows items to add custom lines of information to the mouseover description
 */
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{
    MapData mapdata = this.getMapData(stack, playerIn.worldObj);

    if (advanced)
    {
        if (mapdata == null)
        {
            tooltip.add("Unknown map");
        }
        else
        {
            tooltip.add("Scaling at 1:" + (1 << mapdata.scale));
            tooltip.add("(Level " + mapdata.scale + "/" + 4 + ")");
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:21,代码来源:ItemMap.java

示例6: setMapdataTo

import net.minecraft.world.storage.MapData; //导入依赖的package包/类
/**
 * Sets new MapData from the packet to given MapData param
 */
public void setMapdataTo(MapData mapdataIn)
{
    mapdataIn.scale = this.mapScale;
    mapdataIn.trackingPosition = this.trackingPosition;
    mapdataIn.mapDecorations.clear();

    for (int i = 0; i < this.icons.length; ++i)
    {
        MapDecoration mapdecoration = this.icons[i];
        mapdataIn.mapDecorations.put("icon-" + i, mapdecoration);
    }

    for (int j = 0; j < this.columns; ++j)
    {
        for (int k = 0; k < this.rows; ++k)
        {
            mapdataIn.colors[this.minX + j + (this.minZ + k) * 128] = this.mapDataBytes[j + k * this.columns];
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:24,代码来源:SPacketMaps.java

示例7: onUpdate

import net.minecraft.world.storage.MapData; //导入依赖的package包/类
/**
 * Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and
 * update it's contents.
 */
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected)
{
    if (!worldIn.isRemote)
    {
        MapData mapdata = this.getMapData(stack, worldIn);

        if (entityIn instanceof EntityPlayer)
        {
            EntityPlayer entityplayer = (EntityPlayer)entityIn;
            mapdata.updateVisiblePlayers(entityplayer, stack);
        }

        if (isSelected || entityIn instanceof EntityPlayer && ((EntityPlayer)entityIn).getHeldItemOffhand() == stack)
        {
            this.updateMapData(worldIn, entityIn, mapdata);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:23,代码来源:ItemMap.java

示例8: 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

示例9: 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

示例10: addInformation

import net.minecraft.world.storage.MapData; //导入依赖的package包/类
/**
 * allows items to add custom lines of information to the mouseover description
 */
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{
    MapData mapdata = this.getMapData(stack, playerIn.world);

    if (advanced)
    {
        if (mapdata == null)
        {
            tooltip.add("Unknown map");
        }
        else
        {
            tooltip.add("Scaling at 1:" + (1 << mapdata.scale));
            tooltip.add("(Level " + mapdata.scale + "/" + 4 + ")");
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:ItemMap.java

示例11: renderMapFirstPerson

import net.minecraft.world.storage.MapData; //导入依赖的package包/类
private void renderMapFirstPerson(ItemStack stack)
{
    GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
    GlStateManager.scale(0.38F, 0.38F, 0.38F);
    GlStateManager.disableLighting();
    this.mc.getTextureManager().bindTexture(RES_MAP_BACKGROUND);
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    GlStateManager.translate(-0.5F, -0.5F, 0.0F);
    GlStateManager.scale(0.0078125F, 0.0078125F, 0.0078125F);
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
    vertexbuffer.pos(-7.0D, 135.0D, 0.0D).tex(0.0D, 1.0D).endVertex();
    vertexbuffer.pos(135.0D, 135.0D, 0.0D).tex(1.0D, 1.0D).endVertex();
    vertexbuffer.pos(135.0D, -7.0D, 0.0D).tex(1.0D, 0.0D).endVertex();
    vertexbuffer.pos(-7.0D, -7.0D, 0.0D).tex(0.0D, 0.0D).endVertex();
    tessellator.draw();
    MapData mapdata = Items.FILLED_MAP.getMapData(stack, this.mc.world);

    if (mapdata != null)
    {
        this.mc.entityRenderer.getMapItemRenderer().renderMap(mapdata, false);
    }

    GlStateManager.enableLighting();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:27,代码来源:ItemRenderer.java

示例12: setMapdataTo

import net.minecraft.world.storage.MapData; //导入依赖的package包/类
/**
 * Sets new MapData from the packet to given MapData param
 */
@SideOnly(Side.CLIENT)
public void setMapdataTo(MapData mapdataIn)
{
    mapdataIn.scale = this.mapScale;
    mapdataIn.trackingPosition = this.trackingPosition;
    mapdataIn.mapDecorations.clear();

    for (int i = 0; i < this.icons.length; ++i)
    {
        Vec4b vec4b = this.icons[i];
        mapdataIn.mapDecorations.put("icon-" + i, vec4b);
    }

    for (int j = 0; j < this.columns; ++j)
    {
        for (int k = 0; k < this.rows; ++k)
        {
            mapdataIn.colors[this.minX + j + (this.minZ + k) * 128] = this.mapDataBytes[j + k * this.columns];
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:SPacketMaps.java

示例13: addInformation

import net.minecraft.world.storage.MapData; //导入依赖的package包/类
/**
 * allows items to add custom lines of information to the mouseover description
 */
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{
    MapData mapdata = this.getMapData(stack, playerIn.worldObj);

    if (advanced)
    {
        if (mapdata == null)
        {
            tooltip.add("Unknown map");
        }
        else
        {
            tooltip.add("Scaling at 1:" + (1 << mapdata.scale));
            tooltip.add("(Level " + mapdata.scale + "/" + 4 + ")");
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:22,代码来源:ItemMap.java

示例14: renderMapFirstPerson

import net.minecraft.world.storage.MapData; //导入依赖的package包/类
private void renderMapFirstPerson(ItemStack stack)
{
    GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
    GlStateManager.scale(0.38F, 0.38F, 0.38F);
    GlStateManager.disableLighting();
    this.mc.getTextureManager().bindTexture(RES_MAP_BACKGROUND);
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    GlStateManager.translate(-0.5F, -0.5F, 0.0F);
    GlStateManager.scale(0.0078125F, 0.0078125F, 0.0078125F);
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
    vertexbuffer.pos(-7.0D, 135.0D, 0.0D).tex(0.0D, 1.0D).endVertex();
    vertexbuffer.pos(135.0D, 135.0D, 0.0D).tex(1.0D, 1.0D).endVertex();
    vertexbuffer.pos(135.0D, -7.0D, 0.0D).tex(1.0D, 0.0D).endVertex();
    vertexbuffer.pos(-7.0D, -7.0D, 0.0D).tex(0.0D, 0.0D).endVertex();
    tessellator.draw();
    MapData mapdata = Items.FILLED_MAP.getMapData(stack, this.mc.theWorld);

    if (mapdata != null)
    {
        this.mc.entityRenderer.getMapItemRenderer().renderMap(mapdata, false);
    }

    GlStateManager.enableLighting();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:27,代码来源:ItemRenderer.java

示例15: addInformation

import net.minecraft.world.storage.MapData; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List info, boolean showAdvancedInfo)
{


    if (!this.isMapReady(stack))
    {
    	info.add("It's currently blank. Use the");
    	info.add("map to start inscribing it.");
    }
    else
    {
    	MapData mapData = this.getMapData(stack, player.worldObj);

    	info.add("A map of the land.");
    	//info.add("Center: x" + mapData.xCenter + " z" + mapData.zCenter);
    	info.add("Dimension: " + mapData.dimension);

    	if (showAdvancedInfo)
    	{
    		info.add("Scaling at 1:" + (1 << mapData.scale));
            info.add("(Level " + mapData.scale + "/" + 4 + ")");
    	}
    }
}
 
开发者ID:Domochevsky,项目名称:minecraft-territorialdealings,代码行数:27,代码来源:TerritoryMap.java


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