mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-16 06:03:44 +01:00
Cart Assembler sounds (placing and rail replace)
This commit is contained in:
parent
197834c36c
commit
444dc4c903
2 changed files with 8 additions and 2 deletions
|
@ -41,6 +41,8 @@ import net.minecraft.util.ActionResultType;
|
|||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
@ -177,7 +179,7 @@ public class CartAssemblerBlock extends AbstractRailBlock
|
|||
newType = type;
|
||||
if (newType == null)
|
||||
return ActionResultType.PASS;
|
||||
|
||||
world.playSound(null, pos, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 1, 1);
|
||||
world.setBlockState(pos, state.with(RAIL_TYPE, newType));
|
||||
|
||||
if (!player.isCreative()) {
|
||||
|
|
|
@ -13,6 +13,8 @@ import net.minecraft.item.BlockItem;
|
|||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.state.properties.RailShape;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -25,8 +27,10 @@ public class CartAssemblerBlockItem extends BlockItem {
|
|||
@Override
|
||||
@Nonnull
|
||||
public ActionResultType onItemUse(ItemUseContext context) {
|
||||
if (tryPlaceAssembler(context))
|
||||
if (tryPlaceAssembler(context)) {
|
||||
context.getWorld().playSound(null, context.getPos(), SoundEvents.BLOCK_STONE_PLACE, SoundCategory.BLOCKS, 1, 1);
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
return super.onItemUse(context);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue