MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / onCreated

Method onCreated

src/main/java/net/minecraft/item/ItemMap.java:262–281  ·  view source on GitHub ↗

Called when item is crafted/smelted. Used only by maps so far.

(ItemStack stack, World worldIn, EntityPlayer playerIn)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 10

calculateMapCenterMethod · 0.95
hasTagCompoundMethod · 0.80
setItemDamageMethod · 0.80
setItemDataMethod · 0.80
getMetadataMethod · 0.65
markDirtyMethod · 0.65
getBooleanMethod · 0.45
getTagCompoundMethod · 0.45
getMapDataMethod · 0.45
getUniqueDataIdMethod · 0.45

Tested by

no test coverage detected