User Tools

Site Tools


tutorial:fluids

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:fluids [2020/02/11 12:07] – Registry#add() -> Registry.register() upcraftlptutorial:fluids [2020/10/09 23:14] – Update names, fix compile issues comp500
Line 5: Line 5:
  
 ===== Making an abstract fluid ===== ===== Making an abstract fluid =====
-Vanilla fluids extend ''net.minecraft.fluid.BaseFluid'', and so shall we.+Vanilla fluids extend ''net.minecraft.fluid.FlowableFluid'', and so shall we.
 <code java [enable_line_numbers="true"]> <code java [enable_line_numbers="true"]>
-public abstract class TutorialFluid extends BaseFluid+public abstract class TutorialFluid extends FlowableFluid
 { {
  /**  /**
Line 32: Line 32:
  */  */
  @Override  @Override
- protected void beforeBreakingBlock(IWorld world, BlockPos pos, BlockState state)+ protected void beforeBreakingBlock(WorldAccess world, BlockPos pos, BlockState state)
  {  {
  final BlockEntity blockEntity = state.getBlock().hasBlockEntity() ? world.getBlockEntity(pos) : null;  final BlockEntity blockEntity = state.getBlock().hasBlockEntity() ? world.getBlockEntity(pos) : null;
- Block.dropStacks(state, world.getWorld(), pos, blockEntity);+ Block.dropStacks(state, world, pos, blockEntity);
  }  }
   
Line 45: Line 45:
  */  */
  @Override  @Override
- protected boolean method_15777(FluidState fluidState, BlockView blockView, BlockPos blockPos, Fluid fluid, Direction direction)+ protected boolean canBeReplacedWith(FluidState fluidState, BlockView blockView, BlockPos blockPos, Fluid fluid, Direction direction)
  {  {
  return false;  return false;
Line 55: Line 55:
  */  */
  @Override  @Override
- protected int method_15733(WorldView worldView)+ protected int getFlowSpeed(WorldView worldView)
  {  {
  return 4;  return 4;
Line 61: Line 61:
   
  /**  /**
- * Water returns 1. Lava returns in the Overworld and in the Nether.+ * Water returns 1. Lava returns in the Overworld and in the Nether.
  */  */
  @Override  @Override
Line 293: Line 293:
  final Identifier listenerId = new Identifier(fluidId.getNamespace(), fluidId.getPath() + "_reload_listener");  final Identifier listenerId = new Identifier(fluidId.getNamespace(), fluidId.getPath() + "_reload_listener");
   
- final Sprite[] fluidSprites = new Sprite[] { null, null };+ final Sprite[] fluidSprites = { null, null };
   
  ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(new SimpleSynchronousResourceReloadListener()  ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(new SimpleSynchronousResourceReloadListener()
tutorial/fluids.txt · Last modified: 2023/05/04 11:31 by solidblock