More bugfix stuff
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 702 B |
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 795 KiB |
Before Width: | Height: | Size: 274 KiB After Width: | Height: | Size: 127 KiB |
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.0 MiB |
Before Width: | Height: | Size: 144 KiB After Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 174 KiB After Width: | Height: | Size: 89 KiB |
Before Width: | Height: | Size: 240 KiB After Width: | Height: | Size: 144 KiB |
Before Width: | Height: | Size: 404 KiB After Width: | Height: | Size: 305 KiB |
Before Width: | Height: | Size: 306 KiB After Width: | Height: | Size: 122 KiB |
Before Width: | Height: | Size: 685 KiB After Width: | Height: | Size: 598 KiB |
Before Width: | Height: | Size: 373 KiB After Width: | Height: | Size: 344 KiB |
@ -174,6 +174,8 @@ public class World implements ApplicationListener{
|
||||
* A WorldLoadEvent will be fire.
|
||||
*/
|
||||
public void endMapLoad(){
|
||||
prepareTiles(tiles);
|
||||
|
||||
for(int x = 0; x < tiles.length; x++){
|
||||
for(int y = 0; y < tiles[0].length; y++){
|
||||
Tile tile = tiles[x][y];
|
||||
@ -210,7 +212,6 @@ public class World implements ApplicationListener{
|
||||
|
||||
createTiles(generator.width, generator.height);
|
||||
generator.generate(tiles);
|
||||
prepareTiles(tiles);
|
||||
|
||||
endMapLoad();
|
||||
}
|
||||
@ -382,11 +383,6 @@ public class World implements ApplicationListener{
|
||||
}
|
||||
}
|
||||
|
||||
/** Loads raw map tile data into a Tile[][] array, setting up multiblocks, cliffs and ores. */
|
||||
void loadTileData(Tile[][] tiles){
|
||||
prepareTiles(tiles);
|
||||
}
|
||||
|
||||
public void addDarkness(Tile[][] tiles){
|
||||
byte[][] dark = new byte[tiles.length][tiles[0].length];
|
||||
byte[][] writeBuffer = new byte[tiles.length][tiles[0].length];
|
||||
@ -478,15 +474,6 @@ public class World implements ApplicationListener{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//update occlusion data
|
||||
for(int x = 0; x < tiles.length; x++){
|
||||
for(int y = 0; y < tiles[0].length; y++){
|
||||
Tile tile = tiles[x][y];
|
||||
|
||||
tile.updateOcclusion();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface Raycaster{
|
||||
|
@ -260,6 +260,7 @@ public abstract class BlockStorage extends UnlockableContent{
|
||||
/** Try offloading an item to a nearby container in its facing direction. Returns true if success. */
|
||||
public boolean offloadDir(Tile tile, Item item){
|
||||
Tile other = tile.getNearby(tile.rotation());
|
||||
if(other != null) other = other.link();
|
||||
if(other != null && other.getTeam() == tile.getTeam() && other.block().acceptItem(item, other, tile)){
|
||||
other.block().handleItem(item, other, tile);
|
||||
return true;
|
||||
|
@ -238,10 +238,11 @@ public class Tile implements Position, TargetTrait{
|
||||
*/
|
||||
public void getLinkedTiles(Consumer<Tile> cons){
|
||||
if(block.isMultiblock()){
|
||||
int offsetx = -(block.size - 1) / 2;
|
||||
int offsety = -(block.size - 1) / 2;
|
||||
for(int dx = 0; dx < block.size; dx++){
|
||||
for(int dy = 0; dy < block.size; dy++){
|
||||
int size = block.size;
|
||||
int offsetx = -(size - 1) / 2;
|
||||
int offsety = -(size - 1) / 2;
|
||||
for(int dx = 0; dx < size; dx++){
|
||||
for(int dy = 0; dy < size; dy++){
|
||||
Tile other = world.tile(x + dx + offsetx, y + dy + offsety);
|
||||
if(other != null) cons.accept(other);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class BlockPart extends Block{
|
||||
|
||||
@Override
|
||||
public Tile linked(Tile tile){
|
||||
return tile.getNearby(dx, dy);
|
||||
return tile.getNearby(-dx, -dy);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -49,4 +49,10 @@ public class BlockPart extends Block{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return "BlockPart[" + dx + ", " + dy + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -198,6 +198,7 @@ public class Conveyor extends Block{
|
||||
ConveyorEntity entity = tile.entity();
|
||||
entity.minitem = 1f;
|
||||
Tile next = tile.getNearby(tile.rotation());
|
||||
if(next != null) next = next.link();
|
||||
|
||||
float nextMax = next != null && next.block() instanceof Conveyor ? 1f - Math.max(itemSpace - next.<ConveyorEntity>entity().minitem, 0) : 1f;
|
||||
int minremove = Integer.MAX_VALUE;
|
||||
|