(final FMLCommonSetupEvent event)
| 90 | } |
| 91 | |
| 92 | private void commonSetup(final FMLCommonSetupEvent event) { |
| 93 | event.enqueueWork(() -> { |
| 94 | CompooperBlock.bootStrap(); |
| 95 | DispenserBlock.registerProjectileBehavior(PItems.POOP_BALL); |
| 96 | DispenserBlock.registerProjectileBehavior(PItems.SEA_POOP_BALL); |
| 97 | DispenserBlock.registerProjectileBehavior(PItems.WITHER_POOP_BALL); |
| 98 | DispenserBlock.registerBehavior(PItems.POOP.get(), new OptionalDispenseItemBehavior() { |
| 99 | @Override |
| 100 | protected ItemStack execute(BlockSource blockSource, ItemStack item) { |
| 101 | this.setSuccess(true); |
| 102 | Level level = blockSource.level(); |
| 103 | BlockPos blockpos = blockSource.pos().relative(blockSource.state().getValue(DispenserBlock.FACING)); |
| 104 | |
| 105 | if (!BoneMealItem.applyBonemeal(item, level, blockpos, null) && !BoneMealItem.growWaterPlant(item, level, blockpos, null)) { |
| 106 | this.setSuccess(false); |
| 107 | } else if (!level.isClientSide) { |
| 108 | level.levelEvent(1505, blockpos, 15); |
| 109 | } |
| 110 | return item; |
| 111 | } |
| 112 | }); |
| 113 | DispenserBlock.registerBehavior(PBlocks.POOP_TNT.asItem(), new DefaultDispenseItemBehavior() { |
| 114 | @Override |
| 115 | protected ItemStack execute(BlockSource blockSource, ItemStack item) { |
| 116 | Level level = blockSource.level(); |
| 117 | Direction facing = blockSource.state().getValue(DispenserBlock.FACING); |
| 118 | BlockPos pos = blockSource.pos().relative(facing); |
| 119 | |
| 120 | PoopTntEntity tnt = new PoopTntEntity(level, pos.getX() + 0.5, pos.getY() + 0.125, pos.getZ() + 0.5, null); |
| 121 | level.addFreshEntity(tnt); |
| 122 | level.playSound(null, tnt.getX(), tnt.getY(), tnt.getZ(), SoundEvents.TNT_PRIMED, SoundSource.BLOCKS, 1.0F, 1.0F); |
| 123 | level.gameEvent(null, GameEvent.ENTITY_PLACE, pos); |
| 124 | item.shrink(1); |
| 125 | return item; |
| 126 | } |
| 127 | }); |
| 128 | |
| 129 | FluidInteractionRegistry.addInteraction(NeoForgeMod.WATER_TYPE.value(), new FluidInteractionRegistry.InteractionInformation( |
| 130 | PFluidTypes.URINE_FLUID_TYPE.get(), (fluidState) -> fluidState.isSource() ? PBlocks.POOLIME_BLOCK.get().defaultBlockState() : Blocks.CLAY.defaultBlockState())); |
| 131 | FluidInteractionRegistry.addInteraction(PFluidTypes.URINE_FLUID_TYPE.get(), new FluidInteractionRegistry.InteractionInformation( |
| 132 | NeoForgeMod.WATER_TYPE.value(), (fluidState) -> fluidState.isSource() ? Blocks.COARSE_DIRT.defaultBlockState() : Blocks.CLAY.defaultBlockState())); |
| 133 | |
| 134 | FluidInteractionRegistry.addInteraction(PFluidTypes.URINE_FLUID_TYPE.get(), new FluidInteractionRegistry.InteractionInformation( |
| 135 | NeoForgeMod.LAVA_TYPE.value(), (fluidState) -> fluidState.isSource() ? Blocks.MAGMA_BLOCK.defaultBlockState() : Blocks.NETHERRACK.defaultBlockState())); |
| 136 | FluidInteractionRegistry.addInteraction(NeoForgeMod.LAVA_TYPE.value(), new FluidInteractionRegistry.InteractionInformation( |
| 137 | PFluidTypes.URINE_FLUID_TYPE.get(), (fluidState) -> fluidState.isSource() ? Blocks.OBSIDIAN.defaultBlockState() : Blocks.MAGMA_BLOCK.defaultBlockState())); |
| 138 | |
| 139 | FluidInteractionRegistry.addInteraction(NeoForgeMod.LAVA_TYPE.value(), new FluidInteractionRegistry.InteractionInformation( |
| 140 | (level, currentPos, relativePos, currentState) -> level.getBlockState(currentPos.below()).is(PBlocks.POOP_BLOCK.get()) && level.getBlockState(relativePos).is(Blocks.BLUE_ICE), |
| 141 | Blocks.DEEPSLATE.defaultBlockState())); |
| 142 | }); |
| 143 | PStats.init(); |
| 144 | } |
| 145 | |
| 146 | public static ResourceLocation loc(String path) { |
| 147 | return ResourceLocation.fromNamespaceAndPath(PoopSky.MOD_ID, path); |
nothing calls this directly
no test coverage detected