|
2 | 2 |
|
3 | 3 | import com.mojang.datafixers.DSL; |
4 | 4 | import net.minecraft.MethodsReturnNonnullByDefault; |
| 5 | +import net.minecraft.core.particles.ParticleTypes; |
5 | 6 | import net.minecraft.core.registries.BuiltInRegistries; |
6 | 7 | import net.minecraft.core.registries.Registries; |
7 | 8 | import net.minecraft.sounds.SoundEvents; |
8 | 9 | import net.minecraft.world.item.BlockItem; |
| 10 | +import net.minecraft.world.item.BucketItem; |
9 | 11 | import net.minecraft.world.item.DyeColor; |
10 | 12 | import net.minecraft.world.item.Item; |
| 13 | +import net.minecraft.world.item.Items; |
11 | 14 | import net.minecraft.world.item.Rarity; |
12 | 15 | import net.minecraft.world.level.block.Block; |
13 | 16 | import net.minecraft.world.level.block.Blocks; |
| 17 | +import net.minecraft.world.level.block.LiquidBlock; |
| 18 | +import net.minecraft.world.level.block.PointedDripstoneBlock; |
14 | 19 | import net.minecraft.world.level.block.SoundType; |
15 | 20 | import net.minecraft.world.level.block.TrapDoorBlock; |
16 | 21 | import net.minecraft.world.level.block.entity.BlockEntityType; |
17 | 22 | import net.minecraft.world.level.block.state.BlockBehaviour; |
18 | 23 | import net.minecraft.world.level.block.state.properties.BlockSetType; |
| 24 | +import net.minecraft.world.level.material.Fluid; |
19 | 25 | import net.neoforged.bus.api.IEventBus; |
20 | 26 | import net.neoforged.bus.api.SubscribeEvent; |
21 | 27 | import net.neoforged.neoforge.capabilities.Capabilities; |
22 | 28 | import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent; |
| 29 | +import net.neoforged.neoforge.common.SoundActions; |
23 | 30 | import net.neoforged.neoforge.common.util.DeferredSoundType; |
| 31 | +import net.neoforged.neoforge.fluids.FluidType; |
24 | 32 | import net.neoforged.neoforge.registries.DeferredHolder; |
25 | 33 | import net.neoforged.neoforge.registries.DeferredRegister; |
| 34 | +import net.neoforged.neoforge.registries.NeoForgeRegistries; |
26 | 35 | import org.teacon.powertool.PowerTool; |
27 | 36 | import org.teacon.powertool.block.cosmetical.CosmeticBarrel; |
28 | 37 | import org.teacon.powertool.block.cosmetical.CosmeticBeehive; |
|
47 | 56 | import org.teacon.powertool.block.entity.TempleBlockEntity; |
48 | 57 | import org.teacon.powertool.block.entity.TimeObserverBlockEntity; |
49 | 58 | import org.teacon.powertool.block.entity.TrashCanWithContainerBlockEntity; |
| 59 | +import org.teacon.powertool.block.fluid.FakeWater; |
50 | 60 | import org.teacon.powertool.block.holo_sign.HolographicSignBlock; |
51 | 61 | import org.teacon.powertool.block.holo_sign.SignType; |
52 | 62 | import org.teacon.powertool.item.PowerToolDataComponents; |
@@ -82,7 +92,8 @@ public class PowerToolBlocks { |
82 | 92 |
|
83 | 93 | public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(Registries.BLOCK, PowerTool.MODID); |
84 | 94 | public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister.create(Registries.BLOCK_ENTITY_TYPE, PowerTool.MODID); |
85 | | - |
| 95 | + public static final DeferredRegister<Fluid> FLUIDS = DeferredRegister.create(Registries.FLUID, PowerTool.MODID); |
| 96 | + public static final DeferredRegister<FluidType> FLUID_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.FLUID_TYPES, PowerTool.MODID); |
86 | 97 | public static final Map<DyeColor,DeferredHolder<Block,? extends Block>> DH_CHEAT_BLOCKS = new EnumMap<>(DyeColor.class); |
87 | 98 |
|
88 | 99 | public static DeferredHolder<Block,PeriodicCommandBlock> COMMAND_BLOCK; |
@@ -144,10 +155,31 @@ public class PowerToolBlocks { |
144 | 155 | public static DeferredHolder<BlockEntityType<?>,BlockEntityType<TimeObserverBlockEntity>> TIME_OBSERVER_BLOCK_ENTITY; |
145 | 156 | public static DeferredHolder<BlockEntityType<?>,BlockEntityType<RedStoneDelayBlockEntity>> DELAYER_BLOCK_ENTITY; |
146 | 157 | public static DeferredHolder<BlockEntityType<?>,BlockEntityType<BezierCurveBlockEntity>> BEZIER_CURVE_BLOCK_ENTITY; |
147 | | - |
| 158 | + |
| 159 | + public static DeferredHolder<Fluid, FakeWater> FAKE_WATER = FLUIDS.register("fake_water", FakeWater::new); |
| 160 | + public static DeferredHolder<Block, LiquidBlock> FAKE_WATER_BLOCK = BLOCKS.register("fake_water_block", () -> new LiquidBlock( |
| 161 | + FAKE_WATER.get(), |
| 162 | + BlockBehaviour.Properties.ofFullCopy(Blocks.WATER) |
| 163 | + )); |
| 164 | + public static DeferredHolder<Item, BucketItem> FAKE_WATER_BUCKET = ITEMS.register("fake_water_bucket", () -> new BucketItem(FAKE_WATER.get(), new Item.Properties().craftRemainder(Items.BUCKET).stacksTo(1))); |
| 165 | + public static DeferredHolder<FluidType, FluidType> FAKE_WATER_TYPE = FLUID_TYPES.register("fake_water", () -> new FluidType(FluidType.Properties.create() |
| 166 | + .descriptionId("block.powertool.fake_water") |
| 167 | + .fallDistanceModifier(0F) |
| 168 | + .canExtinguish(true) |
| 169 | + .canConvertToSource(true) |
| 170 | + .supportsBoating(true) |
| 171 | + .sound(SoundActions.BUCKET_FILL, SoundEvents.BUCKET_FILL) |
| 172 | + .sound(SoundActions.BUCKET_EMPTY, SoundEvents.BUCKET_EMPTY) |
| 173 | + .sound(SoundActions.FLUID_VAPORIZE, SoundEvents.FIRE_EXTINGUISH) |
| 174 | + .canHydrate(true) |
| 175 | + .addDripstoneDripping(PointedDripstoneBlock.WATER_TRANSFER_PROBABILITY_PER_RANDOM_TICK, ParticleTypes.DRIPPING_DRIPSTONE_WATER, Blocks.WATER_CAULDRON, SoundEvents.POINTED_DRIPSTONE_DRIP_WATER_INTO_CAULDRON) |
| 176 | + )); |
| 177 | + |
148 | 178 | public static void register(IEventBus bus) { |
149 | 179 | BLOCKS.register(bus); |
150 | 180 | BLOCK_ENTITIES.register(bus); |
| 181 | + FLUIDS.register(bus); |
| 182 | + FLUID_TYPES.register(bus); |
151 | 183 | COMMAND_BLOCK = BLOCKS.register("command_block", () -> new PeriodicCommandBlock( |
152 | 184 | BlockBehaviour.Properties.of().mapColor(DyeColor.PURPLE).requiresCorrectToolForDrops().strength(-1.0F, 3600000.0F).noLootTable(), |
153 | 185 | false |
|
0 commit comments