pick 97420a31d The big reformat of 2020

This commit is contained in:
yueh
2020-06-16 21:41:28 +02:00
parent 5304b3febe
commit 5225ea426b
2252 changed files with 95466 additions and 118582 deletions
@@ -18,62 +18,53 @@
package appeng.services.compass;
import com.google.common.base.Preconditions;
import net.minecraft.world.server.ServerWorld;
import java.util.HashMap;
import java.util.Map;
import com.google.common.base.Preconditions;
public final class CompassReader
{
private final Map<Long, CompassRegion> regions = new HashMap<>( 100 );
private final ServerWorld world;
import net.minecraft.world.server.ServerWorld;
public CompassReader( ServerWorld world )
{
this.world = Preconditions.checkNotNull( world );
}
public final class CompassReader {
private final Map<Long, CompassRegion> regions = new HashMap<>(100);
private final ServerWorld world;
public void close()
{
for( final CompassRegion r : this.regions.values() )
{
r.close();
}
public CompassReader(ServerWorld world) {
this.world = Preconditions.checkNotNull(world);
}
this.regions.clear();
}
public void close() {
for (final CompassRegion r : this.regions.values()) {
r.close();
}
public void setHasBeacon( final int cx, final int cz, final int cdy, final boolean hasBeacon )
{
final CompassRegion r = this.getRegion( cx, cz );
this.regions.clear();
}
r.setHasBeacon( cx, cz, cdy, hasBeacon );
}
public void setHasBeacon(final int cx, final int cz, final int cdy, final boolean hasBeacon) {
final CompassRegion r = this.getRegion(cx, cz);
public boolean hasBeacon( final int cx, final int cz )
{
final CompassRegion r = this.getRegion( cx, cz );
r.setHasBeacon(cx, cz, cdy, hasBeacon);
}
return r.hasBeacon( cx, cz );
}
public boolean hasBeacon(final int cx, final int cz) {
final CompassRegion r = this.getRegion(cx, cz);
private CompassRegion getRegion( final int cx, final int cz )
{
long pos = cx >> 10;
pos <<= 32;
pos |= ( cz >> 10 );
return r.hasBeacon(cx, cz);
}
CompassRegion cr = this.regions.get( pos );
private CompassRegion getRegion(final int cx, final int cz) {
long pos = cx >> 10;
pos <<= 32;
pos |= (cz >> 10);
if( cr == null )
{
cr = new CompassRegion( world, cx, cz );
this.regions.put( pos, cr );
}
CompassRegion cr = this.regions.get(pos);
return cr;
}
if (cr == null) {
cr = new CompassRegion(world, cx, cz);
this.regions.put(pos, cr);
}
return cr;
}
}