This commit is contained in:
Anuken
2020-04-25 12:49:19 -04:00
parent 9e0af97cee
commit 30d8737f67
4 changed files with 30 additions and 23 deletions

View File

@ -321,7 +321,7 @@ public class BlockIndexer{
int quadrantY = tile.y / quadrantSize;
itemSet.clear();
Tile rounded = world.tile(Mathf.clamp(quadrantX * quadrantSize + quadrantSize / 2, 0, world.width() - 1), Mathf.clamp(quadrantY * quadrantSize + quadrantSize / 2, 0, world.height() - 1));
Tile rounded = world.rawTile(Mathf.clamp(quadrantX * quadrantSize + quadrantSize / 2, 0, world.width() - 1), Mathf.clamp(quadrantY * quadrantSize + quadrantSize / 2, 0, world.height() - 1));
//find all items that this quadrant contains
for(int x = Math.max(0, rounded.x - quadrantSize / 2); x < rounded.x + quadrantSize / 2 && x < world.width(); x++){

View File

@ -287,7 +287,7 @@ public class Control implements ApplicationListener, Loadable{
public void playTutorial(){
//TODO implement
ui.showInfo("death");
//ui.showInfo("death");
/*
Zone zone = Zones.groundZero;
ui.loadAnd(() -> {

View File

@ -100,8 +100,12 @@ public class MapIO{
ver.region("preview_map", stream, counter, in -> ver.readMap(in, new WorldContext(){
@Override public void resize(int width, int height){}
@Override public boolean isGenerating(){return false;}
@Override public void begin(){}
@Override public void end(){}
@Override public void begin(){
world.setGenerating(true);
}
@Override public void end(){
world.setGenerating(false);
}
@Override
public Tile tile(int index){

View File

@ -179,6 +179,7 @@ public class Block extends UnlockableContent{
public Block(String name){
super(name);
this.solid = false;
initEntity();
}
//TODO rename to draw() once class refactoring is done.
@ -507,25 +508,7 @@ public class Block extends UnlockableContent{
Arrays.sort(requirements, Structs.comparingInt(i -> i.item.id));
}
@Override
public void displayInfo(Table table){
ContentDisplay.displayBlock(table, this);
}
@Override
public ContentType getContentType(){
return ContentType.block;
}
/** Called after all blocks are created. */
@Override
@CallSuper
public void init(){
//initialize default health based on size
if(health == -1){
health = size * size * 40;
}
protected void initEntity(){
if(entityType == null){
//attempt to find the first declared class and use it as the entity type
@ -563,6 +546,26 @@ public class Block extends UnlockableContent{
entityType = TileEntity::create;
}
}
}
@Override
public void displayInfo(Table table){
ContentDisplay.displayBlock(table, this);
}
@Override
public ContentType getContentType(){
return ContentType.block;
}
/** Called after all blocks are created. */
@Override
@CallSuper
public void init(){
//initialize default health based on size
if(health == -1){
health = size * size * 40;
}
buildCost = 0f;
for(ItemStack stack : requirements){