Called when item is crafted/smelted. Used only by maps so far.
(ItemStack stack, World worldIn, EntityPlayer playerIn)
| 260 | * Called when item is crafted/smelted. Used only by maps so far. |
| 261 | */ |
| 262 | public void onCreated(ItemStack stack, World worldIn, EntityPlayer playerIn) |
| 263 | { |
| 264 | if (stack.hasTagCompound() && stack.getTagCompound().getBoolean("map_is_scaling")) |
| 265 | { |
| 266 | MapData mapdata = Items.filled_map.getMapData(stack, worldIn); |
| 267 | stack.setItemDamage(worldIn.getUniqueDataId("map")); |
| 268 | MapData mapdata1 = new MapData("map_" + stack.getMetadata()); |
| 269 | mapdata1.scale = (byte)(mapdata.scale + 1); |
| 270 | |
| 271 | if (mapdata1.scale > 4) |
| 272 | { |
| 273 | mapdata1.scale = 4; |
| 274 | } |
| 275 | |
| 276 | mapdata1.calculateMapCenter(mapdata.xCenter, mapdata.zCenter, mapdata1.scale); |
| 277 | mapdata1.dimension = mapdata.dimension; |
| 278 | mapdata1.markDirty(); |
| 279 | worldIn.setItemData("map_" + stack.getMetadata(), mapdata1); |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | /** |
| 284 | * allows items to add custom lines of information to the mouseover description |
nothing calls this directly
no test coverage detected