mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-11 11:17:11 +07:00
Cleanup
This commit is contained in:
parent
93bbd34055
commit
9e9c001422
@ -167,6 +167,10 @@ public class ContentLoader{
|
||||
public <T extends Content> T getByID(ContentType type, int id){
|
||||
|
||||
if(temporaryMapper != null && temporaryMapper[type.ordinal()] != null && temporaryMapper[type.ordinal()].length != 0){
|
||||
//-1 = invalid content
|
||||
if(id < 0){
|
||||
return null;
|
||||
}
|
||||
if(temporaryMapper[type.ordinal()].length <= id || temporaryMapper[type.ordinal()][id] == null){
|
||||
return getByID(type, 0); //default value is always ID 0
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package io.anuke.mindustry.world.blocks.distribution;
|
||||
|
||||
import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.annotations.Annotations.*;
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
@ -70,7 +69,7 @@ public class Sorter extends Block{
|
||||
Item item = entity.buffer.poll(i);
|
||||
if(item != null){
|
||||
Tile other = getTileTarget(item, tile, tile.getNearby(i), true);
|
||||
if(other.block().acceptItem(item, other, tile)){
|
||||
if(other != null && other.block().acceptItem(item, other, tile)){
|
||||
other.block().handleItem(item, other, tile);
|
||||
entity.buffer.remove(i);
|
||||
}
|
||||
@ -93,7 +92,7 @@ public class Sorter extends Block{
|
||||
}
|
||||
}
|
||||
|
||||
Tile getTileTarget(Item item, Tile dest, Tile source, boolean flip){
|
||||
@Nullable Tile getTileTarget(Item item, Tile dest, Tile source, boolean flip){
|
||||
SorterEntity entity = dest.entity();
|
||||
|
||||
int dir = source.relativeTo(dest.x, dest.y);
|
||||
|
@ -2,6 +2,7 @@ package io.anuke.mindustry.world.blocks.sandbox;
|
||||
|
||||
import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.mindustry.entities.type.Player;
|
||||
import io.anuke.mindustry.entities.type.TileEntity;
|
||||
@ -47,6 +48,18 @@ public class ItemSource extends Block{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
|
||||
ItemSourceEntity entity = tile.entity();
|
||||
if(entity.outputItem == null) return;
|
||||
|
||||
Draw.color(entity.outputItem.color);
|
||||
Draw.rect("blank", tile.worldx(), tile.worldy(), 4f, 4f);
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
ItemSourceEntity entity = tile.entity();
|
||||
|
Loading…
Reference in New Issue
Block a user