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

Method tryPlace

src/main/java/net/minecraft/item/ItemSlab.java:111–134  ·  view source on GitHub ↗
(ItemStack stack, World worldIn, BlockPos pos, Object variantInStack)

Source from the content-addressed store, hash-verified

109 }
110
111 private boolean tryPlace(ItemStack stack, World worldIn, BlockPos pos, Object variantInStack)
112 {
113 IBlockState iblockstate = worldIn.getBlockState(pos);
114
115 if (iblockstate.getBlock() == this.singleSlab)
116 {
117 Comparable comparable = iblockstate.getValue(this.singleSlab.getVariantProperty());
118
119 if (comparable == variantInStack)
120 {
121 IBlockState iblockstate1 = this.doubleSlab.getDefaultState().withProperty((IProperty)this.singleSlab.getVariantProperty(), comparable);
122
123 if (worldIn.checkNoEntityCollision(this.doubleSlab.getCollisionBoundingBox(worldIn, pos, iblockstate1)) && worldIn.setBlockState(pos, iblockstate1, 3))
124 {
125 worldIn.playSoundEffect((float)pos.getX() + 0.5F, (float)pos.getY() + 0.5F, (float)pos.getZ() + 0.5F, this.doubleSlab.stepSound.getPlaceSound(), (this.doubleSlab.stepSound.getVolume() + 1.0F) / 2.0F, this.doubleSlab.stepSound.getFrequency() * 0.8F);
126 --stack.stackSize;
127 }
128
129 return true;
130 }
131 }
132
133 return false;
134 }
135}

Callers 1

onItemUseMethod · 0.95

Calls 15

getBlockMethod · 0.95
getValueMethod · 0.95
getDefaultStateMethod · 0.80
playSoundEffectMethod · 0.80
getFrequencyMethod · 0.80
getBlockStateMethod · 0.65
withPropertyMethod · 0.65
getXMethod · 0.65
getYMethod · 0.65
getZMethod · 0.65
getVolumeMethod · 0.65

Tested by

no test coverage detected