Skip to content

Commit

Permalink
добавил background и тени
Browse files Browse the repository at this point in the history
  • Loading branch information
xzxADIxzx committed Nov 6, 2022
1 parent fbbc6b4 commit 6a9e2ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 3 additions & 4 deletions src/main/java/tk/darkdustry/bot/Main.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package tk.darkdustry.bot;

import arc.util.Log;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.internal.entities.WebhookImpl;
import tk.darkdustry.bot.components.ConfigUtils;
import tk.darkdustry.bot.components.ResourceUtils;

import static arc.util.Log.err;
import static java.util.Objects.requireNonNull;
import static net.dv8tion.jda.api.entities.WebhookType.INCOMING;
import static net.dv8tion.jda.api.requests.GatewayIntent.*;
import static net.dv8tion.jda.internal.requests.RestActionImpl.setDefaultFailure;
Expand Down Expand Up @@ -37,8 +36,8 @@ public static void main(String[] args) {
mapsWebhook = new WebhookImpl(jda.getTextChannelById(config.mapsChannelId), config.mapsWebhookId, INCOMING).setToken(config.mapsWebhookToken);
schematicsWebhook = new WebhookImpl(jda.getTextChannelById(config.schematicsChannelId), config.schematicsWebhookId, INCOMING).setToken(config.schematicsWebhookToken);
} catch (Exception e) {
err("Failed to launch Community Bot. Make sure the provided token and guild/channel IDs in the configuration are correct.");
err(e);
Log.err("Failed to launch Community Bot. Make sure the provided token and guild/channel IDs in the configuration are correct.");
Log.err(e);
}

Listener.loadCommands(config.prefix);
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/tk/darkdustry/bot/components/ContentHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import mindustry.entities.units.BuildPlan;
import mindustry.game.Schematic;
import mindustry.game.Schematics;
import mindustry.graphics.Drawf;
import mindustry.io.MapIO;
import mindustry.maps.Map;

Expand All @@ -34,14 +35,20 @@ public static Schematic parseSchematic(File file) throws IOException {
}

public static byte[] parseSchematicImage(Schematic schematic) {
var image = new BufferedImage(schematic.width * 32, schematic.height * 32, TYPE_INT_ARGB);
var plans = schematic.tiles.map(stile -> new BuildPlan(stile.x, stile.y, stile.rotation, stile.block, stile.config));
var image = new BufferedImage(schematic.width * 32 + 64, schematic.height * 32 + 64, TYPE_INT_ARGB);
var plans = schematic.tiles.map(stile -> new BuildPlan(stile.x + 1, stile.y + 1, stile.rotation, stile.block, stile.config));

currentImage = image;
currentGraphics = image.createGraphics();

Draw.reset();

for (int x = 0; x < schematic.width + 2; x++)
for (int y = 0; y < schematic.height + 2; y++)
Draw.rect("metal-floor", x * 8f, y * 8f);

plans.each(plan -> Drawf.squareShadow(plan.drawx(), plan.drawy(), plan.block.size * 16f, 1f));

plans.each(plan -> {
plan.animScale = 1f;
plan.worldContext = false;
Expand Down

0 comments on commit 6a9e2ed

Please sign in to comment.