mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-06 00:08:10 +07:00
Fixed segfault during mod loading
This commit is contained in:
@ -112,13 +112,6 @@ public class Mods implements Loadable{
|
||||
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());
|
||||
}
|
||||
|
||||
@ -159,6 +152,15 @@ public class Mods implements Loadable{
|
||||
|
||||
//get textures packed
|
||||
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;
|
||||
|
||||
//flush so generators can use these sprites
|
||||
|
@ -16,6 +16,8 @@ import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.ui.*;
|
||||
|
||||
import static mindustry.Vars.ui;
|
||||
|
||||
public class DatabaseDialog extends FloatingDialog{
|
||||
|
||||
public DatabaseDialog(){
|
||||
@ -69,8 +71,10 @@ public class DatabaseDialog extends FloatingDialog{
|
||||
image.clicked(() -> {
|
||||
if(Core.input.keyDown(KeyCode.SHIFT_LEFT) && Fonts.getUnicode(unlock.name) != 0){
|
||||
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)));
|
||||
}
|
||||
|
@ -204,14 +204,16 @@ public class PlacementFragment extends Fragment{
|
||||
|
||||
ImageButton button = blockTable.addImageButton(new TextureRegionDrawable(block.icon(Cicon.medium)), Styles.selecti, () -> {
|
||||
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){
|
||||
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();
|
||||
button.resizeImage(Cicon.medium.size);
|
||||
|
||||
button.update(() -> { //color unplacable things gray
|
||||
TileEntity core = player.getClosestCore();
|
||||
|
Reference in New Issue
Block a user