make distribution block fields/funcs public/protected

This commit is contained in:
DeltaNedas
2020-08-08 18:23:54 +01:00
parent 3fbeb33390
commit 5e5aadc4ac
10 changed files with 44 additions and 45 deletions

View File

@@ -93,24 +93,24 @@ public class Conveyor extends Block implements Autotiler{
public class ConveyorEntity extends Building{ public class ConveyorEntity extends Building{
//parallel array data //parallel array data
Item[] ids = new Item[capacity]; public Item[] ids = new Item[capacity];
float[] xs = new float[capacity]; public float[] xs = new float[capacity];
float[] ys = new float[capacity]; public float[] ys = new float[capacity];
//amount of items, always < capacity //amount of items, always < capacity
int len = 0; public int len = 0;
//next entity //next entity
@Nullable Building next; public @Nullable Building next;
@Nullable ConveyorEntity nextc; public @Nullable ConveyorEntity nextc;
//whether the next conveyor's rotation == tile rotation //whether the next conveyor's rotation == tile rotation
boolean aligned; public boolean aligned;
int lastInserted, mid; public int lastInserted, mid;
float minitem = 1; public float minitem = 1;
int blendbits, blending; public int blendbits, blending;
int blendsclx, blendscly; public int blendsclx, blendscly;
float clogHeat = 0f; public float clogHeat = 0f;
@Override @Override
public void draw(){ public void draw(){
@@ -348,7 +348,7 @@ public class Conveyor extends Block implements Autotiler{
} }
final void add(int o){ public final void add(int o){
for(int i = Math.max(o + 1, len); i > o; i--){ for(int i = Math.max(o + 1, len); i > o; i--){
ids[i] = ids[i - 1]; ids[i] = ids[i - 1];
xs[i] = xs[i - 1]; xs[i] = xs[i - 1];
@@ -358,7 +358,7 @@ public class Conveyor extends Block implements Autotiler{
len++; len++;
} }
final void remove(int o){ public final void remove(int o){
for(int i = o; i < len - 1; i++){ for(int i = o; i < len - 1; i++){
ids[i] = ids[i + 1]; ids[i] = ids[i + 1];
xs[i] = xs[i + 1]; xs[i] = xs[i + 1];

View File

@@ -15,7 +15,7 @@ public class ExtendingItemBridge extends ItemBridge{
super(name); super(name);
hasItems = true; hasItems = true;
} }
public class ExtendingItemBridgeEntity extends ItemBridgeEntity{ public class ExtendingItemBridgeEntity extends ItemBridgeEntity{
@Override @Override
public void draw(){ public void draw(){

View File

@@ -357,7 +357,7 @@ public class ItemBridge extends Block{
return liquids.get(liquid) + amount < liquidCapacity && (liquids.current() == liquid || liquids.get(liquids.current()) < 0.2f); return liquids.get(liquid) + amount < liquidCapacity && (liquids.current() == liquid || liquids.get(liquids.current()) < 0.2f);
} }
private boolean linked(Building source){ protected boolean linked(Building source){
return source instanceof ItemBridgeEntity && linkValid(source.tile(), tile) && ((ItemBridgeEntity)source).link == pos(); return source instanceof ItemBridgeEntity && linkValid(source.tile(), tile) && ((ItemBridgeEntity)source).link == pos();
} }

View File

@@ -27,7 +27,7 @@ public class Junction extends Block{
} }
public class JunctionEntity extends Building{ public class JunctionEntity extends Building{
DirectionalItemBuffer buffer = new DirectionalItemBuffer(capacity); public DirectionalItemBuffer buffer = new DirectionalItemBuffer(capacity);
@Override @Override
public int acceptStack(Item item, int amount, Teamc source){ public int acceptStack(Item item, int amount, Teamc source){

View File

@@ -86,13 +86,13 @@ public class MassDriver extends Block{
} }
public class MassDriverEntity extends Building{ public class MassDriverEntity extends Building{
int link = -1; public int link = -1;
float rotation = 90; public float rotation = 90;
float reload = 0f; public float reload = 0f;
DriverState state = DriverState.idle; public DriverState state = DriverState.idle;
OrderedSet<Tile> waitingShooters = new OrderedSet<>(); public OrderedSet<Tile> waitingShooters = new OrderedSet<>();
Tile currentShooter(){ public Tile currentShooter(){
return waitingShooters.isEmpty() ? null : waitingShooters.first(); return waitingShooters.isEmpty() ? null : waitingShooters.first();
} }
@@ -322,7 +322,7 @@ public class MassDriver extends Block{
} }
} }
enum DriverState{ public enum DriverState{
idle, //nothing is shooting at this mass driver and it does not have any target idle, //nothing is shooting at this mass driver and it does not have any target
accepting, //currently getting shot at, unload items accepting, //currently getting shot at, unload items
shooting, shooting,

View File

@@ -31,9 +31,9 @@ public class OverflowGate extends Block{
} }
public class OverflowGateEntity extends Building{ public class OverflowGateEntity extends Building{
Item lastItem; public Item lastItem;
Tile lastInput; public Tile lastInput;
float time; public float time;
@Override @Override
public int acceptStack(Item item, int amount, Teamc source){ public int acceptStack(Item item, int amount, Teamc source){

View File

@@ -136,7 +136,7 @@ public class PayloadConveyor extends Block{
super.draw(); super.draw();
} }
@Override @Override
public void draw(){ public void draw(){
super.draw(); super.draw();
@@ -241,15 +241,14 @@ public class PayloadConveyor extends Block{
} }
} }
boolean blends(int direction){ protected boolean blends(int direction){
if(direction == rotation){ if(direction == rotation){
return !blocked || next != null; return !blocked || next != null;
}else{
return PayloadAcceptor.blends(this, direction);
} }
return PayloadAcceptor.blends(this, direction);
} }
TextureRegion clipRegion(Rect bounds, Rect sprite, TextureRegion region){ protected TextureRegion clipRegion(Rect bounds, Rect sprite, TextureRegion region){
Rect over = Tmp.r3; Rect over = Tmp.r3;
boolean overlaps = Intersector.intersectRectangles(bounds, sprite, over); boolean overlaps = Intersector.intersectRectangles(bounds, sprite, over);
@@ -273,11 +272,11 @@ public class PayloadConveyor extends Block{
return out; return out;
} }
int curStep(){ public int curStep(){
return (int)((Time.time()) / moveTime); return (int)((Time.time()) / moveTime);
} }
float fract(){ public float fract(){
return interp.apply(progress / moveTime); return interp.apply(progress / moveTime);
} }
} }

View File

@@ -20,9 +20,9 @@ public class Router extends Block{
} }
public class RouterEntity extends Building{ public class RouterEntity extends Building{
Item lastItem; public Item lastItem;
Tile lastInput; public Tile lastInput;
float time; public float time;
@Override @Override
public void updateTile(){ public void updateTile(){
@@ -70,7 +70,7 @@ public class Router extends Block{
return result; return result;
} }
Building getTileTarget(Item item, Tile from, boolean set){ public Building getTileTarget(Item item, Tile from, boolean set){
int counter = rotation; int counter = rotation;
for(int i = 0; i < proximity.size; i++){ for(int i = 0; i < proximity.size; i++){
Building other = proximity.get((i + counter) % proximity.size); Building other = proximity.get((i + counter) % proximity.size);

View File

@@ -48,7 +48,7 @@ public class Sorter extends Block{
} }
public class SorterEntity extends Building{ public class SorterEntity extends Building{
@Nullable Item sortItem; public @Nullable Item sortItem;
@Override @Override
public void configured(Player player, Object value){ public void configured(Player player, Object value){
@@ -86,12 +86,12 @@ public class Sorter extends Block{
to.handleItem(this, item); to.handleItem(this, item);
} }
boolean isSame(Building other){ public boolean isSame(Building other){
//uncomment code below to prevent sorter/gate chaining // comment code below to allow sorter/gate chaining
return other != null && (other.block() instanceof Sorter || other.block() instanceof OverflowGate); return other != null && (other.block() instanceof Sorter || other.block() instanceof OverflowGate);
} }
Building getTileTarget(Item item, Building source, boolean flip){ public Building getTileTarget(Item item, Building source, boolean flip){
int dir = source.relativeTo(tile.x, tile.y); int dir = source.relativeTo(tile.x, tile.y);
if(dir == -1) return null; if(dir == -1) return null;
Building to; Building to;

View File

@@ -147,7 +147,7 @@ public class StackConveyor extends Block implements Autotiler{
int[] bits = buildBlending(tile, rotation, null, true); int[] bits = buildBlending(tile, rotation, null, true);
if(bits[0] == 0 && blends(tile, rotation, 0) && !blends(tile, rotation, 2)) state = stateLoad; // a 0 that faces into a conveyor with none behind it if(bits[0] == 0 && blends(tile, rotation, 0) && !blends(tile, rotation, 2)) state = stateLoad; // a 0 that faces into a conveyor with none behind it
if(bits[0] == 0 && !blends(tile, rotation, 0) && blends(tile, rotation, 2)) state = stateUnload; // a 0 that faces into none with a conveyor behind it if(bits[0] == 0 && !blends(tile, rotation, 0) && blends(tile, rotation, 2)) state = stateUnload; // a 0 that faces into none with a conveyor behind it
blendprox = 0; blendprox = 0;
for(int i = 0; i < 4; i++){ for(int i = 0; i < 4; i++){
@@ -219,12 +219,12 @@ public class StackConveyor extends Block implements Autotiler{
return false; // has no moving parts; return false; // has no moving parts;
} }
private void poofIn(){ protected void poofIn(){
link = tile.pos(); link = tile.pos();
Fx.plasticburn.at(this); Fx.plasticburn.at(this);
} }
private void poofOut(){ protected void poofOut(){
Fx.plasticburn.at(this); Fx.plasticburn.at(this);
link = -1; link = -1;
} }