Moved block icons to UI atlas

This commit is contained in:
Anuken
2019-07-08 15:49:47 -04:00
parent 1c38e73290
commit d8d04f2ac3
8 changed files with 6849 additions and 5203 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 676 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 KiB

After

Width:  |  Height:  |  Size: 276 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 KiB

After

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 459 KiB

View File

@ -82,6 +82,7 @@ public class MinerDrone extends BaseDrone implements MinerTrait{
public void update(){
if(item.amount == 0 || item.item.type != ItemType.material){
clearItem();
setState(mine);
return;
}
@ -93,11 +94,11 @@ public class MinerDrone extends BaseDrone implements MinerTrait{
TileEntity tile = (TileEntity)target;
if(dst(target) < type.range){
if(tile.tile.block().acceptStack(item.item, item.amount, tile.tile, MinerDrone.this) == item.amount){
if(tile.tile.block().acceptStack(item.item, item.amount, tile.tile, MinerDrone.this) > 0){
Call.transferItemTo(item.item, item.amount, x, y, tile.tile);
item.amount = 0;
}
clearItem();
setState(mine);
}

View File

@ -591,7 +591,8 @@ public class Block extends BlockStorage{
public TextureRegion icon(Icon icon){
if(icons[icon.ordinal()] == null){
icons[icon.ordinal()] = Core.atlas.find(name + "-icon-" + icon.name(), icon == Icon.full ? getGeneratedIcons()[0] : Core.atlas.find(name + "-icon-full", getGeneratedIcons()[0]));
icons[icon.ordinal()] = Core.atlas.find(name + "-icon-" + icon.name(), icon == Icon.full ?
getGeneratedIcons()[0] : Core.atlas.find(name + "-icon-full", getGeneratedIcons()[0]));
}
return icons[icon.ordinal()];
}
@ -701,10 +702,11 @@ public class Block extends BlockStorage{
}
public enum Icon{
//these are stored in the UI atlases
small(8 * 3),
medium(8 * 4),
large(8 * 6),
/** uses whatever the size of the block is */
/** uses whatever the size of the block is. this is always stored in the main game atlas! */
full(0);
public final int size;

View File

@ -143,17 +143,15 @@ public class Generators{
}
}
if(regions.length > 1){
image.save(block.name + "-icon-full");
}
image.save(block.name + "-icon-full");
image.save("../editor/" + block.name + "-icon-editor");
for(Icon icon : Icon.values()){
if(icon.size == 0 || (icon.size == image.width && icon.size == image.height)) continue;
if(icon.size == 0) continue;
Image scaled = new Image(icon.size, icon.size);
scaled.drawScaled(image);
scaled.save(block.name + "-icon-" + icon.name());
scaled.save("../ui/" + block.name + "-icon-" + icon.name());
}
Color average = new Color();