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

Method breakBlock

src/main/java/net/minecraft/block/BlockSkull.java:162–189  ·  view source on GitHub ↗
(World worldIn, BlockPos pos, IBlockState state)

Source from the content-addressed store, hash-verified

160 }
161
162 public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
163 {
164 if (!worldIn.isRemote)
165 {
166 if (!state.getValue(NODROP))
167 {
168 TileEntity tileentity = worldIn.getTileEntity(pos);
169
170 if (tileentity instanceof TileEntitySkull)
171 {
172 TileEntitySkull tileentityskull = (TileEntitySkull)tileentity;
173 ItemStack itemstack = new ItemStack(Items.skull, 1, this.getDamageValue(worldIn, pos));
174
175 if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null)
176 {
177 itemstack.setTagCompound(new NBTTagCompound());
178 NBTTagCompound nbttagcompound = new NBTTagCompound();
179 NBTUtil.writeGameProfile(nbttagcompound, tileentityskull.getPlayerProfile());
180 itemstack.getTagCompound().setTag("SkullOwner", nbttagcompound);
181 }
182
183 spawnAsEntity(worldIn, pos, itemstack);
184 }
185 }
186
187 super.breakBlock(worldIn, pos, state);
188 }
189 }
190
191 /**
192 * Get the Item that this Block should drop when harvested.

Callers

nothing calls this directly

Calls 10

getDamageValueMethod · 0.95
getSkullTypeMethod · 0.95
getPlayerProfileMethod · 0.95
setTagCompoundMethod · 0.95
writeGameProfileMethod · 0.95
getTagCompoundMethod · 0.95
setTagMethod · 0.80
spawnAsEntityMethod · 0.80
getValueMethod · 0.65
getTileEntityMethod · 0.65

Tested by

no test coverage detected