add config backups
All checks were successful
/ Build BaseBand DSM & Broadway (push) Successful in 2m13s
All checks were successful
/ Build BaseBand DSM & Broadway (push) Successful in 2m13s
This commit is contained in:
parent
a9168696fb
commit
666d4fc03e
4 changed files with 34 additions and 6 deletions
|
@ -14,6 +14,8 @@ import de.com.baseband.client.registry.annotation.Trigger;
|
|||
import de.com.baseband.client.util.interact.Chat;
|
||||
import de.com.baseband.client.util.interact.RotationManager;
|
||||
import de.com.baseband.client.util.interact.ServerDataManager;
|
||||
import de.tudbut.io.StreamReader;
|
||||
import de.tudbut.parsing.JSON;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.SPacketPlayerPosLook;
|
||||
|
@ -22,6 +24,10 @@ import net.minecraftforge.client.event.RenderWorldLastEvent;
|
|||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
@ClientCategory
|
||||
public class Client extends Feature {
|
||||
|
||||
|
@ -60,6 +66,29 @@ public class Client extends Feature {
|
|||
BaseBand.notify("Config saved to disk");
|
||||
}
|
||||
|
||||
@Trigger("Save backup")
|
||||
public void saveBackup() {
|
||||
try(FileOutputStream stream = new FileOutputStream("baseband.db.bak")) {
|
||||
stream.write(JSON.writeReadable(Configuration.asTCN()).getBytes());
|
||||
BaseBand.notify("§aCreated backup of config");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
BaseBand.notify("§cFailed to back up config");
|
||||
}
|
||||
}
|
||||
|
||||
@Trigger("Load backup")
|
||||
public void loadBackup() {
|
||||
try(FileInputStream stream = new FileInputStream("baseband.db.bak")) {
|
||||
String s = new StreamReader(stream).readAllAsString();
|
||||
Configuration.cloneConfigFrom(JSON.read(s));
|
||||
BaseBand.notify("§aLoaded backup of config");
|
||||
} catch (IOException | JSON.JSONFormatException e) {
|
||||
e.printStackTrace();
|
||||
BaseBand.notify("§cFailed to load backup of config");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public GuiTheme.ITheme getTheme() {
|
||||
return theme;
|
||||
|
|
|
@ -57,7 +57,7 @@ public class ElytraFly extends Feature {
|
|||
"With correct settings, this should only require a single normal-height jump at normal speed to take off.\n" +
|
||||
"With okay ping, this can also take off in 1x2 tunnels.")
|
||||
@Marker(1)
|
||||
public boolean autoTakeoff = false;
|
||||
public boolean autoTakeoff = true;
|
||||
|
||||
@Config("Post-Takeoff Motion")
|
||||
@Description("Applies some amount of motion to the player after takeoff is complete, just in case the server resets the elytra again due to bad ping.\n" +
|
||||
|
@ -71,7 +71,7 @@ public class ElytraFly extends Feature {
|
|||
"and higher ones might be more forgiving to bad Gate settings.")
|
||||
@Range("1..40")
|
||||
@Gate(1)
|
||||
public int takeoffTicks = 1;
|
||||
public int takeoffTicks = 5;
|
||||
|
||||
@Config("Takeoff Gate Mode")
|
||||
@Description("Advanced: How the begin of a fall should be detected. Packet is almost always the better option and can't be misconfigured. Only try changing if something doesn't work.")
|
||||
|
|
|
@ -34,8 +34,8 @@ public class NoRender extends Feature {
|
|||
@Config("ItemFrame")
|
||||
public boolean itemFrame;
|
||||
|
||||
@Config("NoPotionIcon")
|
||||
public boolean noPotion;
|
||||
@Config("PotionIcon")
|
||||
public boolean potionIcon;
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
|
@ -48,7 +48,7 @@ public class NoRender extends Feature {
|
|||
|
||||
@SubscribeEvent
|
||||
public void overlayGameRenderEvent(RenderGameOverlayEvent event) {
|
||||
if (noPotion && event.getType() == RenderGameOverlayEvent.ElementType.POTION_ICONS)
|
||||
if (potionIcon && event.getType() == RenderGameOverlayEvent.ElementType.POTION_ICONS)
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ public class BlockUtils {
|
|||
Vec3i size = selection.size();
|
||||
int selSideLength = selection.longestSideH();
|
||||
int sectionSideLength = (selSideLength - 1) / amount + 1; // rounded up
|
||||
System.out.println(sectionSideLength);
|
||||
Selection[] selections = new Selection[(int) ((selSideLength - 1) / sectionSideLength + 1)]; // rounded up
|
||||
int xSideLength = 0;
|
||||
int zSideLength = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue