Down to less than 100 errors

This commit is contained in:
Anuken
2020-03-06 14:55:06 -05:00
parent 73c0ebb75f
commit 4358658889
16 changed files with 64 additions and 58 deletions

View File

@@ -48,23 +48,23 @@ public class BlockConfigFragment extends Fragment{
table.visible(true);
table.clear();
tile.block().buildConfiguration(tile, table);
tile.buildConfiguration(table);
table.pack();
table.setTransform(true);
table.actions(Actions.scaleTo(0f, 1f), Actions.visible(true),
Actions.scaleTo(1f, 1f, 0.07f, Interpolation.pow3Out));
table.update(() -> {
if(configTile != null && configTile.block().shouldHideConfigure(configTile, player)){
if(configTile != null && configTile.shouldHideConfigure(player)){
hideConfig();
return;
}
table.setOrigin(Align.center);
if(configTile == null || configTile.block() == Blocks.air || configTile.block() != configBlock){
if(configTile == null || configTile.block() == Blocks.air || !configTile.isValid()){
hideConfig();
}else{
configTile.block().updateTableAlign(tile, table);
configTile.updateTableAlign(table);
}
});
}

View File

@@ -41,12 +41,12 @@ public class BlockInventoryFragment extends Fragment{
int fa = amount;
if(net.server() && (!Units.canInteract(player, tile) ||
!netServer.admins.allowAction(player, ActionType.withdrawItem, tile.tile(), action -> {
!netServer.admins.allowAction(player, ActionType.withdrawItem, tile, action -> {
action.item = item;
action.itemAmount = fa;
}))) throw new ValidateException(player, "Player cannot request items.");
int removed = tile.block().removeStack(tile, item, amount);
int removed = tile.removeStack(item, amount);
player.unit().addItem(item, removed);
Events.fire(new WithdrawEvent(tile, player, item, amount));
@@ -96,7 +96,7 @@ public class BlockInventoryFragment extends Fragment{
table.touchable(Touchable.enabled);
table.update(() -> {
if(state.is(State.menu) || tile == null || tile.entity == null || !tile.block().isAccessible() || tile.items().total() == 0){
if(state.is(State.menu) || tile == null || !tile.isValid() || !tile.block().isAccessible() || tile.items().total() == 0){
hide();
}else{
if(holding && lastItem != null){
@@ -144,7 +144,7 @@ public class BlockInventoryFragment extends Fragment{
l.setEnabled(canPick);
Element image = itemImage(item.icon(Cicon.xlarge), () -> {
if(tile == null || tile.entity == null){
if(tile == null || !tile.isValid()){
return "";
}
return round(tile.items().get(item));
@@ -154,7 +154,7 @@ public class BlockInventoryFragment extends Fragment{
image.addListener(new InputListener(){
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, KeyCode button){
if(!canPick.get() || tile == null || tile.entity == null || tile.items() == null || !tile.items().has(item)) return false;
if(!canPick.get() || tile == null || !tile.isValid() || tile.items() == null || !tile.items().has(item)) return false;
int amount = Math.min(1, player.unit().maxAccepted(item));
if(amount > 0){
Call.requestItem(player, tile, item, amount);

View File

@@ -90,7 +90,7 @@ public class PlacementFragment extends Fragment{
scrollPositions.put(currentCategory, blockPane.getScrollY());
if(Core.input.keyDown(Binding.pick) && player.isBuilder()){ //mouse eyedropper select
Tile tile = world.ltileWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
Tilec tile = world.entWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
Block tryRecipe = tile == null ? null : tile.block();
for(BuildRequest req : player.builder().requests()){
@@ -341,7 +341,9 @@ public class PlacementFragment extends Fragment{
topTable.row();
topTable.table(t -> {
t.left().defaults().left();
lastDisplay.display(hoverTile, t);
if(hoverTile.entity != null){
hoverTile.entity.display(t);
}
}).left().growX();
}
}
@@ -451,12 +453,7 @@ public class PlacementFragment extends Fragment{
//setup hovering tile
if(!Core.scene.hasMouse() && topTable.hit(v.x, v.y, false) == null){
Tile tile = world.tileWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
if(tile != null){
hoverTile = tile.link();
}else{
hoverTile = null;
}
hoverTile = world.tileWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
}else{
hoverTile = null;
}