Skip to content

Commit

Permalink
Manually migrate mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
2No2Name committed Aug 11, 2024
1 parent 3333bb6 commit fc7ad4a
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
Expand All @@ -38,8 +37,6 @@ public abstract class FlowableFluidMixin {
@Shadow
public abstract Fluid getFlowing();

@Shadow
protected abstract int getFlowSpeed(WorldView world);

/*
* getSpread:
Expand Down Expand Up @@ -68,9 +65,8 @@ public abstract class FlowableFluidMixin {
@Shadow
protected abstract boolean receivesFlow(Direction face, BlockView world, BlockPos pos, BlockState state, BlockPos fromPos, BlockState fromState);


@Shadow
protected abstract void flow(WorldAccess world, BlockPos pos, BlockState state, Direction direction, FluidState fluidState);
protected abstract int getMaxFlowDistance(WorldView world);

@Unique
private static int getNumIndicesFromRadius(int radius) {
Expand Down Expand Up @@ -99,7 +95,7 @@ public void getSpread(World world, BlockPos pos, BlockState state, CallbackInfoR
// otherwise just handle the single possible direction

Map<Direction, FluidState> flowResultByDirection = Maps.newEnumMap(Direction.class);
int searchRadius = this.getFlowSpeed(world) + 1;
int searchRadius = this.getMaxFlowDistance(world) + 1;
int numIndicesFromRadius = getNumIndicesFromRadius(searchRadius);
if (numIndicesFromRadius > 256) {
//We use bytes to represent the indices, which works with vanilla search radius of up to 5
Expand Down Expand Up @@ -177,7 +173,7 @@ private void calculateComplexFluidFlowDirections(World world, BlockPos startPos,
Byte2ByteOpenHashMap currentPositions = new Byte2ByteOpenHashMap();
Byte2BooleanOpenHashMap holeCache = new Byte2BooleanOpenHashMap();
byte holeAccess = 0;
int searchRadius = this.getFlowSpeed(world) + 1;
int searchRadius = this.getMaxFlowDistance(world) + 1;

//Like vanilla, the first iteration is separate, because getUpdatedState is called to check whether a
// renewable fluid source block is created in the flow direction.
Expand All @@ -203,7 +199,7 @@ private void calculateComplexFluidFlowDirections(World world, BlockPos startPos,

//Iterate over the positions and find the shortest path to the center
//If a hole is found, stop the iteration
for (int i = 0; i < this.getFlowSpeed(world) && holeAccess == 0; i++) {
for (int i = 0; i < this.getMaxFlowDistance(world) && holeAccess == 0; i++) {
Fluid targetFluid = this.getFlowing();
for (ObjectIterator<Byte2ByteMap.Entry> iterator = prevPositions.byte2ByteEntrySet().fastIterator(); iterator.hasNext(); ) {
Byte2ByteMap.Entry entry = iterator.next();
Expand Down

0 comments on commit fc7ad4a

Please sign in to comment.