Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.mcreator.abyssaldecor.procedures;
- import net.minecraftforge.registries.ForgeRegistries;
- import net.minecraft.world.World;
- import net.minecraft.world.IWorld;
- import net.minecraft.util.math.RayTraceContext;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.util.SoundCategory;
- import net.minecraft.util.ResourceLocation;
- import net.minecraft.util.Hand;
- import net.minecraft.util.Direction;
- import net.minecraft.item.ItemStack;
- import net.minecraft.entity.player.ServerPlayerEntity;
- import net.minecraft.entity.player.PlayerEntity;
- import net.minecraft.entity.LivingEntity;
- import net.minecraft.entity.Entity;
- import net.minecraft.block.Blocks;
- import net.mcreator.abyssaldecor.item.DanglingWebItemItem;
- import net.mcreator.abyssaldecor.block.DanglingWebTopBlock;
- import net.mcreator.abyssaldecor.block.DanglingWebBottomBlock;
- import net.mcreator.abyssaldecor.AbyssalDecorMod;
- import java.util.Map;
- public class DanglingWebItemRightClickedOnBlockProcedure {
- public static void executeProcedure(Map<String, Object> dependencies){
- if(dependencies.get("world") == null) {
- if(!dependencies.containsKey("world"))
- AbyssalDecorMod.LOGGER.warn("Failed to load dependency world for procedure DanglingWebItemRightClickedOnBlock!");
- return;
- }
- if(dependencies.get("x") == null) {
- if(!dependencies.containsKey("x"))
- AbyssalDecorMod.LOGGER.warn("Failed to load dependency x for procedure DanglingWebItemRightClickedOnBlock!");
- return;
- }
- if(dependencies.get("y") == null) {
- if(!dependencies.containsKey("y"))
- AbyssalDecorMod.LOGGER.warn("Failed to load dependency y for procedure DanglingWebItemRightClickedOnBlock!");
- return;
- }
- if(dependencies.get("z") == null) {
- if(!dependencies.containsKey("z"))
- AbyssalDecorMod.LOGGER.warn("Failed to load dependency z for procedure DanglingWebItemRightClickedOnBlock!");
- return;
- }
- if(dependencies.get("entity") == null) {
- if(!dependencies.containsKey("entity"))
- AbyssalDecorMod.LOGGER.warn("Failed to load dependency entity for procedure DanglingWebItemRightClickedOnBlock!");
- return;
- }
- IWorld world = (IWorld) dependencies.get("world");
- double x = dependencies.get("x") instanceof Integer
- ? (int) dependencies.get("x") : (double) dependencies.get("x");
- double y = dependencies.get("y") instanceof Integer
- ? (int) dependencies.get("y") : (double) dependencies.get("y");
- double z = dependencies.get("z") instanceof Integer
- ? (int) dependencies.get("z") : (double) dependencies.get("z");
- Entity entity = (Entity) dependencies.get("entity");
- if (((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY).getItem() == DanglingWebItemItem.block) {if ((entity.world.rayTraceBlocks(new RayTraceContext(entity.getEyePosition(1f), entity.getEyePosition(1f)
- .add(entity.getLook(1f).x * 5, entity.getLook(1f).y * 5, entity.getLook(1f).z * 5),
- RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, entity)).getFace()) == Direction.DOWN) {if ((world.getBlockState(new BlockPos((int)x,(int)(y-1),(int)z))).getBlock() == Blocks.AIR||(world.getBlockState(new BlockPos((int)x,(int)(y-1),(int)z))).getBlock() == Blocks.CAVE_AIR) {if ((world.getBlockState(new BlockPos((int)x,(int)(y-2),(int)z))).getBlock() == Blocks.AIR||(world.getBlockState(new BlockPos((int)x,(int)(y-2),(int)z))).getBlock() == Blocks.CAVE_AIR) {world.setBlockState(new BlockPos((int)x,(int)(y-1),(int)z), DanglingWebTopBlock.block.getDefaultState(),3);world.setBlockState(new BlockPos((int)x,(int)(y-2),(int)z), DanglingWebBottomBlock.block.getDefaultState(),3);if(entity instanceof LivingEntity){
- ((LivingEntity)entity).swing(Hand.MAIN_HAND, true);
- }if(world instanceof World && !world.isRemote()) {
- ((World) world).playSound(null, new BlockPos((int) x, (int) (y-1), (int) z),
- (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
- SoundCategory.BLOCKS, (float) 0.5, (float) 1);
- } else {
- ((World) world).playSound(x, (y-1), z,
- (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
- SoundCategory.BLOCKS, (float) 0.5, (float) 1, false);
- }if (!((entity instanceof PlayerEntity)?((PlayerEntity)entity).abilities.isCreativeMode:false)) {if(entity instanceof LivingEntity) {
- ItemStack _setstack = ((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY);
- _setstack.setCount((int) ((((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY)).getCount()-1));
- ((LivingEntity)entity).setHeldItem(Hand.MAIN_HAND, _setstack);
- if(entity instanceof ServerPlayerEntity)
- ((ServerPlayerEntity)entity).inventory.markDirty();
- }}}}}else if ((entity.world.rayTraceBlocks(new RayTraceContext(entity.getEyePosition(1f), entity.getEyePosition(1f)
- .add(entity.getLook(1f).x * 5, entity.getLook(1f).y * 5, entity.getLook(1f).z * 5),
- RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, entity)).getFace()) == Direction.NORTH) {if ((world.getBlockState(new BlockPos((int)x,(int)y,(int)(z-1)))).getBlock() == Blocks.AIR||(world.getBlockState(new BlockPos((int)x,(int)y,(int)(z-1)))).getBlock() == Blocks.CAVE_AIR) {if ((world.getBlockState(new BlockPos((int)x,(int)(y-1),(int)(z-1)))).getBlock() == Blocks.AIR||(world.getBlockState(new BlockPos((int)x,(int)(y-1),(int)(z-1)))).getBlock() == Blocks.CAVE_AIR) {world.setBlockState(new BlockPos((int)x,(int)y,(int)(z-1)), .getDefaultState(),3);world.setBlockState(new BlockPos((int)x,(int)(y-1),(int)(z-1)), .getDefaultState(),3);if(entity instanceof LivingEntity){
- ((LivingEntity)entity).swing(Hand.MAIN_HAND, true);
- }if(world instanceof World && !world.isRemote()) {
- ((World) world).playSound(null, new BlockPos((int) x, (int) y, (int) (z-1)),
- (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
- SoundCategory.BLOCKS, (float) 0.5, (float) 1);
- } else {
- ((World) world).playSound(x, y, (z-1),
- (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
- SoundCategory.BLOCKS, (float) 0.5, (float) 1, false);
- }if (!((entity instanceof PlayerEntity)?((PlayerEntity)entity).abilities.isCreativeMode:false)) {if(entity instanceof LivingEntity) {
- ItemStack _setstack = ((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY);
- _setstack.setCount((int) ((((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY)).getCount()-1));
- ((LivingEntity)entity).setHeldItem(Hand.MAIN_HAND, _setstack);
- if(entity instanceof ServerPlayerEntity)
- ((ServerPlayerEntity)entity).inventory.markDirty();
- }}}}}else if ((entity.world.rayTraceBlocks(new RayTraceContext(entity.getEyePosition(1f), entity.getEyePosition(1f)
- .add(entity.getLook(1f).x * 5, entity.getLook(1f).y * 5, entity.getLook(1f).z * 5),
- RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, entity)).getFace()) == Direction.SOUTH) {if ((world.getBlockState(new BlockPos((int)x,(int)y,(int)(z+1)))).getBlock() == Blocks.AIR||(world.getBlockState(new BlockPos((int)x,(int)y,(int)(z+1)))).getBlock() == Blocks.CAVE_AIR) {if ((world.getBlockState(new BlockPos((int)x,(int)(y-1),(int)(z+1)))).getBlock() == Blocks.AIR||(world.getBlockState(new BlockPos((int)x,(int)(y-1),(int)(z+1)))).getBlock() == Blocks.CAVE_AIR) {world.setBlockState(new BlockPos((int)x,(int)y,(int)(z+1)), .getDefaultState(),3);world.setBlockState(new BlockPos((int)x,(int)(y-1),(int)(z+1)), .getDefaultState(),3);if(entity instanceof LivingEntity){
- ((LivingEntity)entity).swing(Hand.MAIN_HAND, true);
- }if(world instanceof World && !world.isRemote()) {
- ((World) world).playSound(null, new BlockPos((int) x, (int) y, (int) (z+1)),
- (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
- SoundCategory.BLOCKS, (float) 0.5, (float) 1);
- } else {
- ((World) world).playSound(x, y, (z+1),
- (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
- SoundCategory.BLOCKS, (float) 0.5, (float) 1, false);
- }if (!((entity instanceof PlayerEntity)?((PlayerEntity)entity).abilities.isCreativeMode:false)) {if(entity instanceof LivingEntity) {
- ItemStack _setstack = ((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY);
- _setstack.setCount((int) ((((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY)).getCount()-1));
- ((LivingEntity)entity).setHeldItem(Hand.MAIN_HAND, _setstack);
- if(entity instanceof ServerPlayerEntity)
- ((ServerPlayerEntity)entity).inventory.markDirty();
- }}}}}else if ((entity.world.rayTraceBlocks(new RayTraceContext(entity.getEyePosition(1f), entity.getEyePosition(1f)
- .add(entity.getLook(1f).x * 5, entity.getLook(1f).y * 5, entity.getLook(1f).z * 5),
- RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, entity)).getFace()) == Direction.WEST) {if ((world.getBlockState(new BlockPos((int)(x-1),(int)y,(int)z))).getBlock() == Blocks.AIR||(world.getBlockState(new BlockPos((int)(x-1),(int)y,(int)z))).getBlock() == Blocks.CAVE_AIR) {if ((world.getBlockState(new BlockPos((int)(x-1),(int)(y-1),(int)z))).getBlock() == Blocks.AIR||(world.getBlockState(new BlockPos((int)(x-1),(int)(y-1),(int)z))).getBlock() == Blocks.CAVE_AIR) {world.setBlockState(new BlockPos((int)(x-1),(int)y,(int)z), .getDefaultState(),3);world.setBlockState(new BlockPos((int)(x-1),(int)(y-1),(int)z), .getDefaultState(),3);if(entity instanceof LivingEntity){
- ((LivingEntity)entity).swing(Hand.MAIN_HAND, true);
- }if(world instanceof World && !world.isRemote()) {
- ((World) world).playSound(null, new BlockPos((int) (x-1), (int) y, (int) z),
- (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
- SoundCategory.BLOCKS, (float) 0.5, (float) 1);
- } else {
- ((World) world).playSound((x-1), y, z,
- (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
- SoundCategory.BLOCKS, (float) 0.5, (float) 1, false);
- }if (!((entity instanceof PlayerEntity)?((PlayerEntity)entity).abilities.isCreativeMode:false)) {if(entity instanceof LivingEntity) {
- ItemStack _setstack = ((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY);
- _setstack.setCount((int) ((((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY)).getCount()-1));
- ((LivingEntity)entity).setHeldItem(Hand.MAIN_HAND, _setstack);
- if(entity instanceof ServerPlayerEntity)
- ((ServerPlayerEntity)entity).inventory.markDirty();
- }}}}}else if ((entity.world.rayTraceBlocks(new RayTraceContext(entity.getEyePosition(1f), entity.getEyePosition(1f)
- .add(entity.getLook(1f).x * 5, entity.getLook(1f).y * 5, entity.getLook(1f).z * 5),
- RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, entity)).getFace()) == Direction.EAST) {if ((world.getBlockState(new BlockPos((int)(x+1),(int)y,(int)z))).getBlock() == Blocks.AIR||(world.getBlockState(new BlockPos((int)(x+1),(int)y,(int)z))).getBlock() == Blocks.CAVE_AIR) {if ((world.getBlockState(new BlockPos((int)(x+1),(int)(y-1),(int)z))).getBlock() == Blocks.AIR||(world.getBlockState(new BlockPos((int)(x+1),(int)(y-1),(int)z))).getBlock() == Blocks.CAVE_AIR) {world.setBlockState(new BlockPos((int)(x+1),(int)y,(int)z), .getDefaultState(),3);world.setBlockState(new BlockPos((int)(x+1),(int)(y-1),(int)z), .getDefaultState(),3);if(entity instanceof LivingEntity){
- ((LivingEntity)entity).swing(Hand.MAIN_HAND, true);
- }if(world instanceof World && !world.isRemote()) {
- ((World) world).playSound(null, new BlockPos((int) (x+1), (int) y, (int) z),
- (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
- SoundCategory.BLOCKS, (float) 0.5, (float) 1);
- } else {
- ((World) world).playSound((x+1), y, z,
- (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
- SoundCategory.BLOCKS, (float) 0.5, (float) 1, false);
- }if (!((entity instanceof PlayerEntity)?((PlayerEntity)entity).abilities.isCreativeMode:false)) {if(entity instanceof LivingEntity) {
- ItemStack _setstack = ((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY);
- _setstack.setCount((int) ((((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY)).getCount()-1));
- ((LivingEntity)entity).setHeldItem(Hand.MAIN_HAND, _setstack);
- if(entity instanceof ServerPlayerEntity)
- ((ServerPlayerEntity)entity).inventory.markDirty();
- }}}}}}else if (((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY).getItem() == DanglingWebItemItem.block) {if ((entity.world.rayTraceBlocks(new RayTraceContext(entity.getEyePosition(1f), entity.getEyePosition(1f)
- .add(entity.getLook(1f).x * 5, entity.getLook(1f).y * 5, entity.getLook(1f).z * 5),
- RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, entity)).getFace()) == Direction.DOWN) {if ((world.getBlockState(new BlockPos((int)x,(int)(y-1),(int)z))).getBlock() == Blocks.AIR||(world.getBlockState(new BlockPos((int)x,(int)(y-1),(int)z))).getBlock() == Blocks.CAVE_AIR) {if ((world.getBlockState(new BlockPos((int)x,(int)(y-2),(int)z))).getBlock() == Blocks.AIR||(world.getBlockState(new BlockPos((int)x,(int)(y-2),(int)z))).getBlock() == Blocks.CAVE_AIR) {world.setBlockState(new BlockPos((int)x,(int)(y-1),(int)z), DanglingWebTopBlock.block.getDefaultState(),3);world.setBlockState(new BlockPos((int)x,(int)(y-2),(int)z), DanglingWebBottomBlock.block.getDefaultState(),3);if(entity instanceof LivingEntity){
- ((LivingEntity)entity).swing(Hand.OFF_HAND, true);
- }if(world instanceof World && !world.isRemote()) {
- ((World) world).playSound(null, new BlockPos((int) x, (int) (y-1), (int) z),
- (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("ambient.basalt_deltas.additions")),
- SoundCategory.BLOCKS, (float) 0.5, (float) 1);
- } else {
- ((World) world).playSound(x, (y-1), z,
- (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("ambient.basalt_deltas.additions")),
- SoundCategory.BLOCKS, (float) 0.5, (float) 1, false);
- }if (!((entity instanceof PlayerEntity)?((PlayerEntity)entity).abilities.isCreativeMode:false)) {if(entity instanceof LivingEntity) {
- ItemStack _setstack = ((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY);
- _setstack.setCount((int) ((((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY)).getCount()-1));
- ((LivingEntity)entity).setHeldItem(Hand.OFF_HAND, _setstack);
- if(entity instanceof ServerPlayerEntity)
- ((ServerPlayerEntity)entity).inventory.markDirty();
- }}}}}else if ((entity.world.rayTraceBlocks(new RayTraceContext(entity.getEyePosition(1f), entity.getEyePosition(1f)
- .add(entity.getLook(1f).x * 5, entity.getLook(1f).y * 5, entity.getLook(1f).z * 5),
- RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, entity)).getFace()) == Direction.NORTH) {if ((world.getBlockState(new BlockPos((int)x,(int)y,(int)(z-1)))).getBlock() == Blocks.AIR||(world.getBlockState(new BlockPos((int)x,(int)y,(int)(z-1)))).getBlock() == Blocks.CAVE_AIR) {if ((world.getBlockState(new BlockPos((int)x,(int)(y-1),(int)(z-1)))).getBlock() == Blocks.AIR||(world.getBlockState(new BlockPos((int)x,(int)(y-1),(int)(z-1)))).getBlock() == Blocks.CAVE_AIR) {world.setBlockState(new BlockPos((int)x,(int)y,(int)(z-1)), .getDefaultState(),3);world.setBlockState(new BlockPos((int)x,(int)(y-1),(int)(z-1)), .getDefaultState(),3);if(entity instanceof LivingEntity){
- ((LivingEntity)entity).swing(Hand.OFF_HAND, true);
- }if(world instanceof World && !world.isRemote()) {
- ((World) world).playSound(null, new BlockPos((int) x, (int) y, (int) (z-1)),
- (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
- SoundCategory.BLOCKS, (float) 0.5, (float) 1);
- } else {
- ((World) world).playSound(x, y, (z-1),
- (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
- SoundCategory.BLOCKS, (float) 0.5, (float) 1, false);
- }if (!((entity instanceof PlayerEntity)?((PlayerEntity)entity).abilities.isCreativeMode:false)) {if(entity instanceof LivingEntity) {
- ItemStack _setstack = ((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY);
- _setstack.setCount((int) ((((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY)).getCount()-1));
- ((LivingEntity)entity).setHeldItem(Hand.OFF_HAND, _setstack);
- if(entity instanceof ServerPlayerEntity)
- ((ServerPlayerEntity)entity).inventory.markDirty();
- }}}}}else if ((entity.world.rayTraceBlocks(new RayTraceContext(entity.getEyePosition(1f), entity.getEyePosition(1f)
- .add(entity.getLook(1f).x * 5, entity.getLook(1f).y * 5, entity.getLook(1f).z * 5),
- RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, entity)).getFace()) == Direction.SOUTH) {if ((world.getBlockState(new BlockPos((int)x,(int)y,(int)(z+1)))).getBlock() == Blocks.AIR||(world.getBlockState(new BlockPos((int)x,(int)y,(int)(z+1)))).getBlock() == Blocks.CAVE_AIR) {if ((world.getBlockState(new BlockPos((int)x,(int)(y-1),(int)(z+1)))).getBlock() == Blocks.AIR||(world.getBlockState(new BlockPos((int)x,(int)(y-1),(int)(z+1)))).getBlock() == Blocks.CAVE_AIR) {world.setBlockState(new BlockPos((int)x,(int)y,(int)(z+1)), .getDefaultState(),3);world.setBlockState(new BlockPos((int)x,(int)(y-1),(int)(z+1)), .getDefaultState(),3);if(entity instanceof LivingEntity){
- ((LivingEntity)entity).swing(Hand.OFF_HAND, true);
- }if(world instanceof World && !world.isRemote()) {
- ((World) world).playSound(null, new BlockPos((int) x, (int) y, (int) (z+1)),
- (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("ambient.basalt_deltas.additions")),
- SoundCategory.BLOCKS, (float) 0.5, (float) 1);
- } else {
- ((World) world).playSound(x, y, (z+1),
- (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("ambient.basalt_deltas.additions")),
- SoundCategory.BLOCKS, (float) 0.5, (float) 1, false);
- }if (!((entity instanceof PlayerEntity)?((PlayerEntity)entity).abilities.isCreativeMode:false)) {if(entity instanceof LivingEntity) {
- ItemStack _setstack = ((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY);
- _setstack.setCount((int) ((((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY)).getCount()-1));
- ((LivingEntity)entity).setHeldItem(Hand.OFF_HAND, _setstack);
- if(entity instanceof ServerPlayerEntity)
- ((ServerPlayerEntity)entity).inventory.markDirty();
- }}}}}else if ((entity.world.rayTraceBlocks(new RayTraceContext(entity.getEyePosition(1f), entity.getEyePosition(1f)
- .add(entity.getLook(1f).x * 5, entity.getLook(1f).y * 5, entity.getLook(1f).z * 5),
- RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, entity)).getFace()) == Direction.WEST) {if ((world.getBlockState(new BlockPos((int)(x-1),(int)y,(int)z))).getBlock() == Blocks.AIR||(world.getBlockState(new BlockPos((int)(x-1),(int)y,(int)z))).getBlock() == Blocks.CAVE_AIR) {if ((world.getBlockState(new BlockPos((int)(x-1),(int)(y-1),(int)z))).getBlock() == Blocks.AIR||(world.getBlockState(new BlockPos((int)(x-1),(int)(y-1),(int)z))).getBlock() == Blocks.CAVE_AIR) {world.setBlockState(new BlockPos((int)(x-1),(int)y,(int)z), .getDefaultState(),3);world.setBlockState(new BlockPos((int)(x-1),(int)(y-1),(int)z), .getDefaultState(),3);if(entity instanceof LivingEntity){
- ((LivingEntity)entity).swing(Hand.OFF_HAND, true);
- }if(world instanceof World && !world.isRemote()) {
- ((World) world).playSound(null, new BlockPos((int) (x-1), (int) y, (int) z),
- (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
- SoundCategory.BLOCKS, (float) 0.5, (float) 1);
- } else {
- ((World) world).playSound((x-1), y, z,
- (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
- SoundCategory.BLOCKS, (float) 0.5, (float) 1, false);
- }if (!((entity instanceof PlayerEntity)?((PlayerEntity)entity).abilities.isCreativeMode:false)) {if(entity instanceof LivingEntity) {
- ItemStack _setstack = ((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY);
- _setstack.setCount((int) ((((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY)).getCount()-1));
- ((LivingEntity)entity).setHeldItem(Hand.OFF_HAND, _setstack);
- if(entity instanceof ServerPlayerEntity)
- ((ServerPlayerEntity)entity).inventory.markDirty();
- }}}}}else if ((entity.world.rayTraceBlocks(new RayTraceContext(entity.getEyePosition(1f), entity.getEyePosition(1f)
- .add(entity.getLook(1f).x * 5, entity.getLook(1f).y * 5, entity.getLook(1f).z * 5),
- RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, entity)).getFace()) == Direction.EAST) {if ((world.getBlockState(new BlockPos((int)(x+1),(int)y,(int)z))).getBlock() == Blocks.AIR||(world.getBlockState(new BlockPos((int)(x+1),(int)y,(int)z))).getBlock() == Blocks.CAVE_AIR) {if ((world.getBlockState(new BlockPos((int)(x+1),(int)(y-1),(int)z))).getBlock() == Blocks.AIR||(world.getBlockState(new BlockPos((int)(x+1),(int)(y-1),(int)z))).getBlock() == Blocks.CAVE_AIR) {world.setBlockState(new BlockPos((int)(x+1),(int)y,(int)z), .getDefaultState(),3);world.setBlockState(new BlockPos((int)(x+1),(int)(y-1),(int)z), .getDefaultState(),3);if(entity instanceof LivingEntity){
- ((LivingEntity)entity).swing(Hand.OFF_HAND, true);
- }if(world instanceof World && !world.isRemote()) {
- ((World) world).playSound(null, new BlockPos((int) (x+1), (int) y, (int) z),
- (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
- SoundCategory.BLOCKS, (float) 0.5, (float) 1);
- } else {
- ((World) world).playSound((x+1), y, z,
- (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
- SoundCategory.BLOCKS, (float) 0.5, (float) 1, false);
- }if (!((entity instanceof PlayerEntity)?((PlayerEntity)entity).abilities.isCreativeMode:false)) {if(entity instanceof LivingEntity) {
- ItemStack _setstack = ((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY);
- _setstack.setCount((int) ((((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY)).getCount()-1));
- ((LivingEntity)entity).setHeldItem(Hand.OFF_HAND, _setstack);
- if(entity instanceof ServerPlayerEntity)
- ((ServerPlayerEntity)entity).inventory.markDirty();
- }}}}}}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement