Fixed segfault during mod loading
This commit is contained in:
@@ -112,13 +112,6 @@ public class Mods implements Loadable{
|
|||||||
totalSprites += sprites.size + overrides.size;
|
totalSprites += sprites.size + overrides.size;
|
||||||
});
|
});
|
||||||
|
|
||||||
for(AtlasRegion region : Core.atlas.getRegions()){
|
|
||||||
PageType type = getPage(region);
|
|
||||||
if(!packer.has(type, region.name)){
|
|
||||||
packer.add(type, region.name, Core.atlas.getPixmap(region));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.debug("Time to pack textures: {0}", Time.elapsed());
|
Log.debug("Time to pack textures: {0}", Time.elapsed());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,6 +152,15 @@ public class Mods implements Loadable{
|
|||||||
|
|
||||||
//get textures packed
|
//get textures packed
|
||||||
if(totalSprites > 0){
|
if(totalSprites > 0){
|
||||||
|
Core.atlas = new TextureAtlas(Core.files.internal("sprites/sprites.atlas"));
|
||||||
|
|
||||||
|
for(AtlasRegion region : Core.atlas.getRegions()){
|
||||||
|
PageType type = getPage(region);
|
||||||
|
if(!packer.has(type, region.name)){
|
||||||
|
packer.add(type, region.name, Core.atlas.getPixmap(region));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TextureFilter filter = Core.settings.getBool("linear") ? TextureFilter.Linear : TextureFilter.Nearest;
|
TextureFilter filter = Core.settings.getBool("linear") ? TextureFilter.Linear : TextureFilter.Nearest;
|
||||||
|
|
||||||
//flush so generators can use these sprites
|
//flush so generators can use these sprites
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ import mindustry.gen.*;
|
|||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
|
|
||||||
|
import static mindustry.Vars.ui;
|
||||||
|
|
||||||
public class DatabaseDialog extends FloatingDialog{
|
public class DatabaseDialog extends FloatingDialog{
|
||||||
|
|
||||||
public DatabaseDialog(){
|
public DatabaseDialog(){
|
||||||
@@ -69,8 +71,10 @@ public class DatabaseDialog extends FloatingDialog{
|
|||||||
image.clicked(() -> {
|
image.clicked(() -> {
|
||||||
if(Core.input.keyDown(KeyCode.SHIFT_LEFT) && Fonts.getUnicode(unlock.name) != 0){
|
if(Core.input.keyDown(KeyCode.SHIFT_LEFT) && Fonts.getUnicode(unlock.name) != 0){
|
||||||
Core.app.setClipboardText((char)Fonts.getUnicode(unlock.name) + "");
|
Core.app.setClipboardText((char)Fonts.getUnicode(unlock.name) + "");
|
||||||
|
ui.showInfoFade("$copied");
|
||||||
|
}else{
|
||||||
|
Vars.ui.content.show(unlock);
|
||||||
}
|
}
|
||||||
Vars.ui.content.show(unlock);
|
|
||||||
});
|
});
|
||||||
image.addListener(new Tooltip(t -> t.background(Tex.button).add(unlock.localizedName)));
|
image.addListener(new Tooltip(t -> t.background(Tex.button).add(unlock.localizedName)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -204,14 +204,16 @@ public class PlacementFragment extends Fragment{
|
|||||||
|
|
||||||
ImageButton button = blockTable.addImageButton(new TextureRegionDrawable(block.icon(Cicon.medium)), Styles.selecti, () -> {
|
ImageButton button = blockTable.addImageButton(new TextureRegionDrawable(block.icon(Cicon.medium)), Styles.selecti, () -> {
|
||||||
if(unlocked(block)){
|
if(unlocked(block)){
|
||||||
control.input.block = control.input.block == block ? null : block;
|
|
||||||
selectedBlocks.put(currentCategory, control.input.block);
|
|
||||||
|
|
||||||
if(Core.input.keyDown(KeyCode.SHIFT_LEFT) && Fonts.getUnicode(block.name) != 0){
|
if(Core.input.keyDown(KeyCode.SHIFT_LEFT) && Fonts.getUnicode(block.name) != 0){
|
||||||
Core.app.setClipboardText((char)Fonts.getUnicode(block.name) + "");
|
Core.app.setClipboardText((char)Fonts.getUnicode(block.name) + "");
|
||||||
|
ui.showInfoFade("$copied");
|
||||||
|
}else{
|
||||||
|
control.input.block = control.input.block == block ? null : block;
|
||||||
|
selectedBlocks.put(currentCategory, control.input.block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).size(46f).group(group).name("block-" + block.name).get();
|
}).size(46f).group(group).name("block-" + block.name).get();
|
||||||
|
button.resizeImage(Cicon.medium.size);
|
||||||
|
|
||||||
button.update(() -> { //color unplacable things gray
|
button.update(() -> { //color unplacable things gray
|
||||||
TileEntity core = player.getClosestCore();
|
TileEntity core = player.getClosestCore();
|
||||||
|
|||||||
Reference in New Issue
Block a user