Advertisement
Guest User

DanglingWebItemRightClickedOnBlock

a guest
Dec 18th, 2021
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.06 KB | None | 0 0
  1. package net.mcreator.abyssaldecor.procedures;
  2.  
  3. import net.minecraftforge.registries.ForgeRegistries;
  4.  
  5. import net.minecraft.world.World;
  6. import net.minecraft.world.IWorld;
  7. import net.minecraft.util.math.RayTraceContext;
  8. import net.minecraft.util.math.BlockPos;
  9. import net.minecraft.util.SoundCategory;
  10. import net.minecraft.util.ResourceLocation;
  11. import net.minecraft.util.Hand;
  12. import net.minecraft.util.Direction;
  13. import net.minecraft.item.ItemStack;
  14. import net.minecraft.entity.player.ServerPlayerEntity;
  15. import net.minecraft.entity.player.PlayerEntity;
  16. import net.minecraft.entity.LivingEntity;
  17. import net.minecraft.entity.Entity;
  18. import net.minecraft.block.Blocks;
  19.  
  20. import net.mcreator.abyssaldecor.item.DanglingWebItemItem;
  21. import net.mcreator.abyssaldecor.block.DanglingWebTopBlock;
  22. import net.mcreator.abyssaldecor.block.DanglingWebBottomBlock;
  23. import net.mcreator.abyssaldecor.AbyssalDecorMod;
  24.  
  25. import java.util.Map;
  26.  
  27. public class DanglingWebItemRightClickedOnBlockProcedure {
  28.  
  29. public static void executeProcedure(Map<String, Object> dependencies){
  30. if(dependencies.get("world") == null) {
  31. if(!dependencies.containsKey("world"))
  32. AbyssalDecorMod.LOGGER.warn("Failed to load dependency world for procedure DanglingWebItemRightClickedOnBlock!");
  33. return;
  34. }
  35. if(dependencies.get("x") == null) {
  36. if(!dependencies.containsKey("x"))
  37. AbyssalDecorMod.LOGGER.warn("Failed to load dependency x for procedure DanglingWebItemRightClickedOnBlock!");
  38. return;
  39. }
  40. if(dependencies.get("y") == null) {
  41. if(!dependencies.containsKey("y"))
  42. AbyssalDecorMod.LOGGER.warn("Failed to load dependency y for procedure DanglingWebItemRightClickedOnBlock!");
  43. return;
  44. }
  45. if(dependencies.get("z") == null) {
  46. if(!dependencies.containsKey("z"))
  47. AbyssalDecorMod.LOGGER.warn("Failed to load dependency z for procedure DanglingWebItemRightClickedOnBlock!");
  48. return;
  49. }
  50. if(dependencies.get("entity") == null) {
  51. if(!dependencies.containsKey("entity"))
  52. AbyssalDecorMod.LOGGER.warn("Failed to load dependency entity for procedure DanglingWebItemRightClickedOnBlock!");
  53. return;
  54. }
  55. IWorld world = (IWorld) dependencies.get("world");
  56. double x = dependencies.get("x") instanceof Integer
  57. ? (int) dependencies.get("x") : (double) dependencies.get("x");
  58. double y = dependencies.get("y") instanceof Integer
  59. ? (int) dependencies.get("y") : (double) dependencies.get("y");
  60. double z = dependencies.get("z") instanceof Integer
  61. ? (int) dependencies.get("z") : (double) dependencies.get("z");
  62. Entity entity = (Entity) dependencies.get("entity");
  63. if (((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY).getItem() == DanglingWebItemItem.block) {if ((entity.world.rayTraceBlocks(new RayTraceContext(entity.getEyePosition(1f), entity.getEyePosition(1f)
  64. .add(entity.getLook(1f).x * 5, entity.getLook(1f).y * 5, entity.getLook(1f).z * 5),
  65. 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){
  66. ((LivingEntity)entity).swing(Hand.MAIN_HAND, true);
  67. }if(world instanceof World && !world.isRemote()) {
  68. ((World) world).playSound(null, new BlockPos((int) x, (int) (y-1), (int) z),
  69. (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
  70. SoundCategory.BLOCKS, (float) 0.5, (float) 1);
  71. } else {
  72. ((World) world).playSound(x, (y-1), z,
  73. (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
  74. SoundCategory.BLOCKS, (float) 0.5, (float) 1, false);
  75. }if (!((entity instanceof PlayerEntity)?((PlayerEntity)entity).abilities.isCreativeMode:false)) {if(entity instanceof LivingEntity) {
  76. ItemStack _setstack = ((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY);
  77. _setstack.setCount((int) ((((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY)).getCount()-1));
  78. ((LivingEntity)entity).setHeldItem(Hand.MAIN_HAND, _setstack);
  79. if(entity instanceof ServerPlayerEntity)
  80. ((ServerPlayerEntity)entity).inventory.markDirty();
  81. }}}}}else if ((entity.world.rayTraceBlocks(new RayTraceContext(entity.getEyePosition(1f), entity.getEyePosition(1f)
  82. .add(entity.getLook(1f).x * 5, entity.getLook(1f).y * 5, entity.getLook(1f).z * 5),
  83. 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){
  84. ((LivingEntity)entity).swing(Hand.MAIN_HAND, true);
  85. }if(world instanceof World && !world.isRemote()) {
  86. ((World) world).playSound(null, new BlockPos((int) x, (int) y, (int) (z-1)),
  87. (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
  88. SoundCategory.BLOCKS, (float) 0.5, (float) 1);
  89. } else {
  90. ((World) world).playSound(x, y, (z-1),
  91. (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
  92. SoundCategory.BLOCKS, (float) 0.5, (float) 1, false);
  93. }if (!((entity instanceof PlayerEntity)?((PlayerEntity)entity).abilities.isCreativeMode:false)) {if(entity instanceof LivingEntity) {
  94. ItemStack _setstack = ((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY);
  95. _setstack.setCount((int) ((((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY)).getCount()-1));
  96. ((LivingEntity)entity).setHeldItem(Hand.MAIN_HAND, _setstack);
  97. if(entity instanceof ServerPlayerEntity)
  98. ((ServerPlayerEntity)entity).inventory.markDirty();
  99. }}}}}else if ((entity.world.rayTraceBlocks(new RayTraceContext(entity.getEyePosition(1f), entity.getEyePosition(1f)
  100. .add(entity.getLook(1f).x * 5, entity.getLook(1f).y * 5, entity.getLook(1f).z * 5),
  101. 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){
  102. ((LivingEntity)entity).swing(Hand.MAIN_HAND, true);
  103. }if(world instanceof World && !world.isRemote()) {
  104. ((World) world).playSound(null, new BlockPos((int) x, (int) y, (int) (z+1)),
  105. (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
  106. SoundCategory.BLOCKS, (float) 0.5, (float) 1);
  107. } else {
  108. ((World) world).playSound(x, y, (z+1),
  109. (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
  110. SoundCategory.BLOCKS, (float) 0.5, (float) 1, false);
  111. }if (!((entity instanceof PlayerEntity)?((PlayerEntity)entity).abilities.isCreativeMode:false)) {if(entity instanceof LivingEntity) {
  112. ItemStack _setstack = ((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY);
  113. _setstack.setCount((int) ((((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY)).getCount()-1));
  114. ((LivingEntity)entity).setHeldItem(Hand.MAIN_HAND, _setstack);
  115. if(entity instanceof ServerPlayerEntity)
  116. ((ServerPlayerEntity)entity).inventory.markDirty();
  117. }}}}}else if ((entity.world.rayTraceBlocks(new RayTraceContext(entity.getEyePosition(1f), entity.getEyePosition(1f)
  118. .add(entity.getLook(1f).x * 5, entity.getLook(1f).y * 5, entity.getLook(1f).z * 5),
  119. 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){
  120. ((LivingEntity)entity).swing(Hand.MAIN_HAND, true);
  121. }if(world instanceof World && !world.isRemote()) {
  122. ((World) world).playSound(null, new BlockPos((int) (x-1), (int) y, (int) z),
  123. (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
  124. SoundCategory.BLOCKS, (float) 0.5, (float) 1);
  125. } else {
  126. ((World) world).playSound((x-1), y, z,
  127. (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
  128. SoundCategory.BLOCKS, (float) 0.5, (float) 1, false);
  129. }if (!((entity instanceof PlayerEntity)?((PlayerEntity)entity).abilities.isCreativeMode:false)) {if(entity instanceof LivingEntity) {
  130. ItemStack _setstack = ((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY);
  131. _setstack.setCount((int) ((((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY)).getCount()-1));
  132. ((LivingEntity)entity).setHeldItem(Hand.MAIN_HAND, _setstack);
  133. if(entity instanceof ServerPlayerEntity)
  134. ((ServerPlayerEntity)entity).inventory.markDirty();
  135. }}}}}else if ((entity.world.rayTraceBlocks(new RayTraceContext(entity.getEyePosition(1f), entity.getEyePosition(1f)
  136. .add(entity.getLook(1f).x * 5, entity.getLook(1f).y * 5, entity.getLook(1f).z * 5),
  137. 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){
  138. ((LivingEntity)entity).swing(Hand.MAIN_HAND, true);
  139. }if(world instanceof World && !world.isRemote()) {
  140. ((World) world).playSound(null, new BlockPos((int) (x+1), (int) y, (int) z),
  141. (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
  142. SoundCategory.BLOCKS, (float) 0.5, (float) 1);
  143. } else {
  144. ((World) world).playSound((x+1), y, z,
  145. (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
  146. SoundCategory.BLOCKS, (float) 0.5, (float) 1, false);
  147. }if (!((entity instanceof PlayerEntity)?((PlayerEntity)entity).abilities.isCreativeMode:false)) {if(entity instanceof LivingEntity) {
  148. ItemStack _setstack = ((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY);
  149. _setstack.setCount((int) ((((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemMainhand():ItemStack.EMPTY)).getCount()-1));
  150. ((LivingEntity)entity).setHeldItem(Hand.MAIN_HAND, _setstack);
  151. if(entity instanceof ServerPlayerEntity)
  152. ((ServerPlayerEntity)entity).inventory.markDirty();
  153. }}}}}}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)
  154. .add(entity.getLook(1f).x * 5, entity.getLook(1f).y * 5, entity.getLook(1f).z * 5),
  155. 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){
  156. ((LivingEntity)entity).swing(Hand.OFF_HAND, true);
  157. }if(world instanceof World && !world.isRemote()) {
  158. ((World) world).playSound(null, new BlockPos((int) x, (int) (y-1), (int) z),
  159. (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("ambient.basalt_deltas.additions")),
  160. SoundCategory.BLOCKS, (float) 0.5, (float) 1);
  161. } else {
  162. ((World) world).playSound(x, (y-1), z,
  163. (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("ambient.basalt_deltas.additions")),
  164. SoundCategory.BLOCKS, (float) 0.5, (float) 1, false);
  165. }if (!((entity instanceof PlayerEntity)?((PlayerEntity)entity).abilities.isCreativeMode:false)) {if(entity instanceof LivingEntity) {
  166. ItemStack _setstack = ((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY);
  167. _setstack.setCount((int) ((((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY)).getCount()-1));
  168. ((LivingEntity)entity).setHeldItem(Hand.OFF_HAND, _setstack);
  169. if(entity instanceof ServerPlayerEntity)
  170. ((ServerPlayerEntity)entity).inventory.markDirty();
  171. }}}}}else if ((entity.world.rayTraceBlocks(new RayTraceContext(entity.getEyePosition(1f), entity.getEyePosition(1f)
  172. .add(entity.getLook(1f).x * 5, entity.getLook(1f).y * 5, entity.getLook(1f).z * 5),
  173. 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){
  174. ((LivingEntity)entity).swing(Hand.OFF_HAND, true);
  175. }if(world instanceof World && !world.isRemote()) {
  176. ((World) world).playSound(null, new BlockPos((int) x, (int) y, (int) (z-1)),
  177. (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
  178. SoundCategory.BLOCKS, (float) 0.5, (float) 1);
  179. } else {
  180. ((World) world).playSound(x, y, (z-1),
  181. (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
  182. SoundCategory.BLOCKS, (float) 0.5, (float) 1, false);
  183. }if (!((entity instanceof PlayerEntity)?((PlayerEntity)entity).abilities.isCreativeMode:false)) {if(entity instanceof LivingEntity) {
  184. ItemStack _setstack = ((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY);
  185. _setstack.setCount((int) ((((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY)).getCount()-1));
  186. ((LivingEntity)entity).setHeldItem(Hand.OFF_HAND, _setstack);
  187. if(entity instanceof ServerPlayerEntity)
  188. ((ServerPlayerEntity)entity).inventory.markDirty();
  189. }}}}}else if ((entity.world.rayTraceBlocks(new RayTraceContext(entity.getEyePosition(1f), entity.getEyePosition(1f)
  190. .add(entity.getLook(1f).x * 5, entity.getLook(1f).y * 5, entity.getLook(1f).z * 5),
  191. 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){
  192. ((LivingEntity)entity).swing(Hand.OFF_HAND, true);
  193. }if(world instanceof World && !world.isRemote()) {
  194. ((World) world).playSound(null, new BlockPos((int) x, (int) y, (int) (z+1)),
  195. (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("ambient.basalt_deltas.additions")),
  196. SoundCategory.BLOCKS, (float) 0.5, (float) 1);
  197. } else {
  198. ((World) world).playSound(x, y, (z+1),
  199. (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("ambient.basalt_deltas.additions")),
  200. SoundCategory.BLOCKS, (float) 0.5, (float) 1, false);
  201. }if (!((entity instanceof PlayerEntity)?((PlayerEntity)entity).abilities.isCreativeMode:false)) {if(entity instanceof LivingEntity) {
  202. ItemStack _setstack = ((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY);
  203. _setstack.setCount((int) ((((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY)).getCount()-1));
  204. ((LivingEntity)entity).setHeldItem(Hand.OFF_HAND, _setstack);
  205. if(entity instanceof ServerPlayerEntity)
  206. ((ServerPlayerEntity)entity).inventory.markDirty();
  207. }}}}}else if ((entity.world.rayTraceBlocks(new RayTraceContext(entity.getEyePosition(1f), entity.getEyePosition(1f)
  208. .add(entity.getLook(1f).x * 5, entity.getLook(1f).y * 5, entity.getLook(1f).z * 5),
  209. 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){
  210. ((LivingEntity)entity).swing(Hand.OFF_HAND, true);
  211. }if(world instanceof World && !world.isRemote()) {
  212. ((World) world).playSound(null, new BlockPos((int) (x-1), (int) y, (int) z),
  213. (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
  214. SoundCategory.BLOCKS, (float) 0.5, (float) 1);
  215. } else {
  216. ((World) world).playSound((x-1), y, z,
  217. (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
  218. SoundCategory.BLOCKS, (float) 0.5, (float) 1, false);
  219. }if (!((entity instanceof PlayerEntity)?((PlayerEntity)entity).abilities.isCreativeMode:false)) {if(entity instanceof LivingEntity) {
  220. ItemStack _setstack = ((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY);
  221. _setstack.setCount((int) ((((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY)).getCount()-1));
  222. ((LivingEntity)entity).setHeldItem(Hand.OFF_HAND, _setstack);
  223. if(entity instanceof ServerPlayerEntity)
  224. ((ServerPlayerEntity)entity).inventory.markDirty();
  225. }}}}}else if ((entity.world.rayTraceBlocks(new RayTraceContext(entity.getEyePosition(1f), entity.getEyePosition(1f)
  226. .add(entity.getLook(1f).x * 5, entity.getLook(1f).y * 5, entity.getLook(1f).z * 5),
  227. 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){
  228. ((LivingEntity)entity).swing(Hand.OFF_HAND, true);
  229. }if(world instanceof World && !world.isRemote()) {
  230. ((World) world).playSound(null, new BlockPos((int) (x+1), (int) y, (int) z),
  231. (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
  232. SoundCategory.BLOCKS, (float) 0.5, (float) 1);
  233. } else {
  234. ((World) world).playSound((x+1), y, z,
  235. (net.minecraft.util.SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.grass.place")),
  236. SoundCategory.BLOCKS, (float) 0.5, (float) 1, false);
  237. }if (!((entity instanceof PlayerEntity)?((PlayerEntity)entity).abilities.isCreativeMode:false)) {if(entity instanceof LivingEntity) {
  238. ItemStack _setstack = ((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY);
  239. _setstack.setCount((int) ((((entity instanceof LivingEntity)?((LivingEntity)entity).getHeldItemOffhand():ItemStack.EMPTY)).getCount()-1));
  240. ((LivingEntity)entity).setHeldItem(Hand.OFF_HAND, _setstack);
  241. if(entity instanceof ServerPlayerEntity)
  242. ((ServerPlayerEntity)entity).inventory.markDirty();
  243. }}}}}}
  244. }
  245. }
  246.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement