本文整理汇总了Java中net.minecraft.world.storage.MapData类的典型用法代码示例。如果您正苦于以下问题:Java MapData类的具体用法?Java MapData怎么用?Java MapData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MapData类属于net.minecraft.world.storage包,在下文中一共展示了MapData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: render
import net.minecraft.world.storage.MapData; //导入依赖的package包/类
@Override
public void render(MapView map, MapCanvas canvas, Player player) {
// Map
for (int x = 0; x < 128; ++x) {
for (int y = 0; y < 128; ++y) {
canvas.setPixel(x, y, worldMap.colors[y * 128 + x]);
}
}
// Cursors
MapCursorCollection cursors = canvas.getCursors();
while (cursors.size() > 0) {
cursors.removeCursor(cursors.getCursor(0));
}
for (Map.Entry<UUID, MapData.MapCoord> key : worldMap.playersVisibleOnMap.entrySet()) {
// If this cursor is for a player check visibility with vanish system
Player other = Bukkit.getPlayer(key.getKey());
if (other != null && !player.canSee(other)) {
continue;
}
MapData.MapCoord decoration = key.getValue();
cursors.addCursor(decoration.centerX, decoration.centerZ, (byte) (decoration.iconRotation & 15), decoration.iconSize);
}
}
开发者ID:djoveryde,项目名称:KCauldron,代码行数:27,代码来源:CraftMapRenderer.java
示例17: 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 par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (!par2World.isClient)
{
MapData var6 = this.getMapData(par1ItemStack, par2World);
if (par3Entity instanceof EntityPlayer)
{
EntityPlayer var7 = (EntityPlayer)par3Entity;
var6.updateVisiblePlayers(var7, par1ItemStack);
}
if (par5)
{
this.updateMapData(par2World, par3Entity, var6);
}
}
}
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:23,代码来源:ItemMap.java
示例18: 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
示例19: addInformation
import net.minecraft.world.storage.MapData; //导入依赖的package包/类
/**
* allows items to add custom lines of information to the mouseover description
*/
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
MapData var5 = this.getMapData(par1ItemStack, par2EntityPlayer.worldObj);
if (par4)
{
if (var5 == null)
{
par3List.add("Unknown map");
}
else
{
par3List.add("Scaling at 1:" + (1 << var5.scale));
par3List.add("(Level " + var5.scale + "/" + 4 + ")");
}
}
}
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:21,代码来源:ItemMap.java
示例20: onUpdate
import net.minecraft.world.storage.MapData; //导入依赖的package包/类
public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_)
{
if (!p_77663_2_.isRemote)
{
MapData mapdata = this.getMapData(p_77663_1_, p_77663_2_);
if (p_77663_3_ instanceof EntityPlayer)
{
EntityPlayer entityplayer = (EntityPlayer)p_77663_3_;
mapdata.updateVisiblePlayers(entityplayer, p_77663_1_);
}
if (p_77663_5_)
{
this.updateMapData(p_77663_2_, p_77663_3_, mapdata);
}
}
}
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:19,代码来源:ItemMap.java
注:本文中的net.minecraft.world.storage.MapData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论