The bug
When you have already a map with id 0 and create a new map, the map with id 0 stops updating. Reloading the world fixes this.
How top reproduce
If a map with id 0 exists already you can use
/give @p filled_map
Otherwise create a new map by right clicking with an empty map
Make sure the player marker moves when you move
Create another map
Look at the map with id 0 again and move around
→ It does not update anymore
The reason
The following is based on a decompiled version of Minecraft 1.10 using MCP 9.30.
The reason for this is that the method net.minecraft.item.ItemEmptyMap.onItemRightClick(ItemStack, World, EntityPlayer, EnumHand)
currently creates server- and client-side a MapData
object and stores it. This should not happen client-side because the client does not store the map id and uses therefor always 0. The problem is that if a map with the id 0 already existed, the net.minecraft.client.gui.MapItemRenderer
registered it already, but because of the new map being generated with the id 0, the old map gets overridden. The MapItemRenderer refers however still to the old MapData which is not updated anymore (intended). The client should probably not create a MapData object in the first place.
Possible fix
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
// The following is the new method content
--itemStackIn.stackSize;
if (worldIn.isRemote) {
return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
}
else {
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.getDimensionType().getId();
mapdata.trackingPosition = true;
mapdata.markDirty();
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);
}
}
}
Linked issues
is duplicated by 5
relates to 3
Comments 43
Is this still an issue in the latest snapshot 16w44a? If so please update the affected versions.
This is an automated comment on any open or reopened issue with out-of-date affected versions.
Your description is very hard to understand. Please provide a better one.