]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/commitdiff
Downgrade to 1.12.2
authorirtimaled <irtimaled@gmail.com>
Tue, 25 Jun 2019 06:52:46 +0000 (23:52 -0700)
committerIrtimaled <irtimaled@gmail.com>
Sun, 11 Aug 2019 06:39:03 +0000 (23:39 -0700)
35 files changed:
build.gradle
gradle.properties
src/main/java/com/irtimaled/bbor/Main.java
src/main/java/com/irtimaled/bbor/client/ClientProxy.java
src/main/java/com/irtimaled/bbor/client/ClientRenderer.java
src/main/java/com/irtimaled/bbor/client/gui/AbstractButton.java
src/main/java/com/irtimaled/bbor/client/gui/AbstractSlider.java
src/main/java/com/irtimaled/bbor/client/gui/SettingsScreen.java
src/main/java/com/irtimaled/bbor/client/gui/SettingsScreenButton.java
src/main/java/com/irtimaled/bbor/client/keyboard/Key.java
src/main/java/com/irtimaled/bbor/client/keyboard/KeyListener.java
src/main/java/com/irtimaled/bbor/common/chunkProcessors/AbstractChunkProcessor.java
src/main/java/com/irtimaled/bbor/common/chunkProcessors/EndChunkProcessor.java
src/main/java/com/irtimaled/bbor/common/chunkProcessors/NetherChunkProcessor.java
src/main/java/com/irtimaled/bbor/common/chunkProcessors/OverworldChunkProcessor.java
src/main/java/com/irtimaled/bbor/common/chunkProcessors/ReflectionHelper.java [new file with mode: 0644]
src/main/java/com/irtimaled/bbor/common/events/ChunkLoaded.java
src/main/java/com/irtimaled/bbor/common/events/ServerWorldTick.java
src/main/java/com/irtimaled/bbor/common/events/WorldLoaded.java
src/main/java/com/irtimaled/bbor/common/interop/CommonInterop.java
src/main/java/com/irtimaled/bbor/common/messages/AddBoundingBox.java
src/main/java/com/irtimaled/bbor/common/messages/InitializeClient.java
src/main/java/com/irtimaled/bbor/common/messages/PayloadBuilder.java
src/main/java/com/irtimaled/bbor/common/messages/RemoveBoundingBox.java
src/main/java/com/irtimaled/bbor/common/messages/SubscribeToServer.java
src/main/java/com/irtimaled/bbor/mixin/client/MixinMinecraft.java
src/main/java/com/irtimaled/bbor/mixin/client/gui/MixinGuiOptions.java
src/main/java/com/irtimaled/bbor/mixin/client/renderer/MixinEntityRenderer.java
src/main/java/com/irtimaled/bbor/mixin/client/settings/MixinGameSettings.java
src/main/java/com/irtimaled/bbor/mixin/network/play/client/MixinCPacketCustomPayload.java
src/main/java/com/irtimaled/bbor/mixin/network/play/server/MixinSPacketCustomPayload.java
src/main/java/com/irtimaled/bbor/mixin/server/dedicated/MixinDedicatedServer.java [deleted file]
src/main/java/com/irtimaled/bbor/server/ServerRunner.java [deleted file]
src/main/java/com/irtimaled/bbor/server/ThrowableConsumer.java [deleted file]
src/main/resources/mixins.bbor.json

index c84131daffade1a0ccd88e2a40e21ea3c5aa48ea..17578867c21782b5e0721df2955445fdaaf2fbaa 100644 (file)
@@ -6,7 +6,7 @@ buildscript {
         maven { url 'https://files.minecraftforge.net/maven' }
     }
     dependencies {
-        classpath 'com.github.Irtimaled:ForgeGradle:' + project.mcVersion + '-SNAPSHOT'
+        classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
         classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
     }
 }
@@ -38,7 +38,7 @@ dependencies {
 
 minecraft {
     version = project.mcVersion
-    mappings = 'snapshot_20180908'
+    mappings = 'snapshot_20171003'
     runDir = 'run'
     tweakClass = 'com.irtimaled.bbor.launch.ClientTweaker'
     makeObfSourceJar = false
index 91964517832191da1b96aeb7299c8072712cfc21..39848527ca983d879e69cb0bc28e392b7d1afe8a 100644 (file)
@@ -1,4 +1,4 @@
 name=bbor
 buildVersion=1.0.13
 # leave a space to reduce merge conflicts on version change
-mcVersion=1.13
+mcVersion=1.12.2
index 0449b17ae7f08e9f862d69072469fda68685c1ff..1f34b1dfb7e84be38c296939b13ae741dd148d87 100644 (file)
@@ -1,18 +1,9 @@
 package com.irtimaled.bbor;
 
 import com.irtimaled.bbor.install.Installer;
-import com.irtimaled.bbor.server.ServerRunner;
-
-import java.io.IOException;
-import java.util.Arrays;
 
 public class Main {
-    public static void main(String... args) throws IOException {
-        if (args.length > 0 && args[0].equals("--server")) {
-            ServerRunner.run("@MC_VERSION@", Arrays.asList(args).subList(1, args.length));
-        } else {
-            Installer.install("@VERSION@", "@MC_VERSION@");
-
-        }
+    public static void main(String... args) {
+        Installer.install("@VERSION@", "@MC_VERSION@");
     }
 }
index b446afca112900a73b7175dc42e8cb3d7175daed..6b80f8c5a22fbf6bcf4314ac967da0fdb9d6a4fe 100644 (file)
@@ -15,10 +15,10 @@ public class ClientProxy extends CommonProxy {
     public static boolean active;
 
     static {
-        KeyListener.register("Toggle Active", 0x42, Name)
+        KeyListener.register("Toggle Active", 0x30, Name)
                 .onKeyPressHandler(ClientProxy::toggleActive)
                 .onLongKeyPressHandler(60, SettingsScreen::show);
-        KeyListener.register("Toggle Outer Box Only", 0x4f, Name)
+        KeyListener.register("Toggle Outer Box Only", 0x18, Name)
                 .onKeyPressHandler(ClientProxy::toggleOuterBoxesOnly);
     }
 
@@ -49,7 +49,6 @@ public class ClientProxy extends CommonProxy {
         EventBus.subscribe(SeedCommandTyped.class, this::onSeedCommandTyped);
 
         renderer = new ClientRenderer(this::getCache);
-        KeyListener.init();
     }
 
     private void render(Render event) {
index 40d4386f64fd93cb4d6061db8e399b4788aae9b2..106bdcc34f6c6c0912b6c1ade187ae5e72ecd4e7 100644 (file)
@@ -121,7 +121,7 @@ public class ClientRenderer {
     }
 
     private int getRenderDistanceChunks() {
-        return Minecraft.getInstance().gameSettings.renderDistanceChunks;
+        return Minecraft.getMinecraft().gameSettings.renderDistanceChunks;
     }
 
     private boolean isSlimeChunk(int chunkX, int chunkZ) {
index 234199171bedc1b92b84b02e411821ae01b3c807..cf7265f72f9a46b7ac68800c62f8c2eaaebe9936 100644 (file)
@@ -15,11 +15,11 @@ abstract class AbstractButton extends GuiButton implements IRenderableControl {
 
     @Override
     public void render(int mouseX, int mouseY) {
-        super.render(mouseX, mouseY, 0f);
+        super.drawButton(Minecraft.getMinecraft(), mouseX, mouseY, 0f);
     }
 
     @Override
-    protected void renderBg(Minecraft p_renderBg_1_, int p_renderBg_2_, int p_renderBg_3_) {
+    protected void mouseDragged(Minecraft mc, int mouseX, int mouseY) {
         renderBackground();
     }
 
@@ -36,9 +36,12 @@ abstract class AbstractButton extends GuiButton implements IRenderableControl {
     }
 
     @Override
-    public void onClick(double mouseX, double mouseY) {
-        super.onClick(mouseX, mouseY);
-        onPressed();
+    public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
+        if (super.mousePressed(mc, mouseX, mouseY)) {
+            onPressed();
+            return true;
+        }
+        return false;
     }
 
     protected abstract void onPressed();
index 059ce943e642c636bad7d35804bca769f320ceaa..9813cd2f1c3d4e18591e54681c2c01f1a9ae167c 100644 (file)
@@ -7,6 +7,7 @@ import org.lwjgl.opengl.GL11;
 
 abstract class AbstractSlider extends GuiButton implements IRenderableControl {
     double progress;
+    private boolean dragging = false;
 
     AbstractSlider(int id, int x, int y, int width) {
         super(id, x, y, width, 20, "");
@@ -14,11 +15,14 @@ abstract class AbstractSlider extends GuiButton implements IRenderableControl {
 
     @Override
     public void render(int mouseX, int mouseY) {
-        super.render(mouseX, mouseY, 0f);
+        super.drawButton(Minecraft.getMinecraft(), mouseX, mouseY, 0f);
     }
 
     @Override
-    protected void renderBg(Minecraft minecraft, int mouseX, int mouseY) {
+    protected void mouseDragged(Minecraft minecraft, int mouseX, int mouseY) {
+        if (dragging) {
+            changeProgress(mouseX);
+        }
         minecraft.getTextureManager().bindTexture(BUTTON_TEXTURES);
         GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
         this.drawTexturedModalRect(this.x + (int) (this.progress * (double) (this.width - 8)), this.y, 0, 66, 4, 20);
@@ -46,16 +50,20 @@ abstract class AbstractSlider extends GuiButton implements IRenderableControl {
         return 0;
     }
 
+
     @Override
-    protected void onDrag(double mouseX, double mouseY, double deltaX, double deltaY) {
-        changeProgress(mouseX);
-        super.onDrag(mouseX, mouseY, deltaX, deltaY);
+    public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
+        if (super.mousePressed(mc, mouseX, mouseY)) {
+            changeProgress(mouseX);
+            dragging = true;
+            return true;
+        }
+        return false;
     }
 
     @Override
-    public void onClick(double mouseX, double mouseY) {
-        changeProgress(mouseX);
-        super.onClick(mouseX, mouseY);
+    public void mouseReleased(int mouseX, int mouseY) {
+        dragging = false;
     }
 
     protected abstract void updateText();
index 8a556fa38843d56145308721c138b51656574996..23c4cc0a1b000ca214f6d0ee0ca760bc22952f0e 100644 (file)
@@ -7,8 +7,8 @@ import com.irtimaled.bbor.common.TypeHelper;
 import com.irtimaled.bbor.config.ConfigManager;
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.GuiButton;
 import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.gui.IGuiEventListener;
 import net.minecraft.client.renderer.OpenGlHelper;
 import org.lwjgl.opengl.GL11;
 
@@ -30,7 +30,7 @@ public class SettingsScreen extends GuiScreen {
     }
 
     public static void show() {
-        Minecraft.getInstance().displayGuiScreen(new SettingsScreen(null, 0));
+        Minecraft.getMinecraft().displayGuiScreen(new SettingsScreen(null, 0));
     }
 
     private int getY(double row) {
@@ -39,7 +39,7 @@ public class SettingsScreen extends GuiScreen {
 
     private void addControl(IRenderableControl control) {
         this.controls.add(control);
-        TypeHelper.doIfType(control, IGuiEventListener.class, this.eventListeners::add);
+        TypeHelper.doIfType(control, GuiButton.class, this.buttonList::add);
     }
 
     private void addTabs(String... labels) {
@@ -52,7 +52,7 @@ public class SettingsScreen extends GuiScreen {
                     (id, x, y1, width) -> new AbstractButton(id, x, y, width, label, index != tabIndex) {
                         @Override
                         public void onPressed() {
-                            Minecraft.getInstance().displayGuiScreen(new SettingsScreen(lastScreen, index));
+                            Minecraft.getMinecraft().displayGuiScreen(new SettingsScreen(lastScreen, index));
                         }
                     });
             column++;
@@ -109,7 +109,7 @@ public class SettingsScreen extends GuiScreen {
     }
 
     @Override
-    protected void initGui() {
+    public void initGui() {
         this.title = ClientProxy.Name;
 
         this.controls = new HashSet<>();
@@ -152,9 +152,9 @@ public class SettingsScreen extends GuiScreen {
                 (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Monuments", BoundingBoxType.OceanMonument),
                 (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Igloos", BoundingBoxType.Igloo),
 
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Ocean Ruins", BoundingBoxType.OceanRuin),
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Buried Treasure", BoundingBoxType.BuriedTreasure),
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Shipwrecks", BoundingBoxType.Shipwreck),
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Ocean Ruins", BoundingBoxType.OceanRuin, false),
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Buried Treasure", BoundingBoxType.BuriedTreasure, false),
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Shipwrecks", BoundingBoxType.Shipwreck, false),
 
                 (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Pillager Outposts", BoundingBoxType.PillagerOutpost, false),
                 (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Strongholds", BoundingBoxType.Stronghold),
@@ -194,8 +194,7 @@ public class SettingsScreen extends GuiScreen {
                 .render();
 
         GL11.glDisable(GL11.GL_DEPTH_TEST);
-        GL11.glEnable(GL11.GL_BLEND);
-        OpenGlHelper.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ZERO, GL11.GL_ONE);
+        OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ZERO, GL11.GL_ONE);
 
         GL11.glDisable(GL11.GL_ALPHA_TEST);
         GL11.glShadeModel(7425);
@@ -222,12 +221,12 @@ public class SettingsScreen extends GuiScreen {
         GL11.glEnable(GL11.GL_TEXTURE_2D);
         GL11.glShadeModel(7424);
         GL11.glEnable(GL11.GL_ALPHA_TEST);
-        OpenGlHelper.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
+        OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
         GL11.glDisable(GL11.GL_BLEND);
     }
 
     @Override
-    public void render(int mouseX, int mouseY, float unknown) {
+    public void drawScreen(int mouseX, int mouseY, float partialTicks) {
         if (this.mc.world == null) {
             this.drawDefaultBackground();
             this.drawScreen(getY(-1), getY(5.5) - 4);
index d9dd00323d80dd643b85dd322b4460b7a1a8b35c..ec3ee98c8b80fd9a9f41bb8b75765543b5c7d768 100644 (file)
@@ -13,6 +13,6 @@ public class SettingsScreenButton extends AbstractButton {
 
     @Override
     public void onPressed() {
-        Minecraft.getInstance().displayGuiScreen(screen);
+        Minecraft.getMinecraft().displayGuiScreen(screen);
     }
 }
index 06179e1f012ce3641201a828e07098d197d55e8f..d7d64540dc0dffd4b13df95a4565f1c168da9729 100644 (file)
@@ -1,10 +1,8 @@
 package com.irtimaled.bbor.client.keyboard;
 
 import net.minecraft.client.settings.KeyBinding;
-import net.minecraft.client.util.InputMappings;
 
 public class Key extends KeyBinding {
-    private InputMappings.Input input;
     private KeyHandler onKeyPress;
     private KeyHandler onLongKeyPress;
     private int longPressDuration;
@@ -24,23 +22,11 @@ public class Key extends KeyBinding {
         return this;
     }
 
-    InputMappings.Input getInput() {
-        if (input == null)
-            return getDefault();
-        return input;
-    }
-
-    @Override
-    public void bind(InputMappings.Input input) {
-        this.input = input;
-        super.bind(input);
-    }
-
     private int pressDuration = 0;
 
     @Override
     public boolean isPressed() {
-        return pressDuration == 1;
+        return pressDuration >= 1;
     }
 
     void release() {
@@ -60,6 +46,7 @@ public class Key extends KeyBinding {
 
         if (pressDuration == longPressDuration) {
             onLongKeyPress.handle();
+            pressDuration = 0;
         }
     }
 
index a680d7c74736a87c4fbd00e8e0455463a115bcb9..3d52bbb8fd2ab727145a7f1dd1c1ffc62e1789d1 100644 (file)
@@ -1,55 +1,36 @@
 package com.irtimaled.bbor.client.keyboard;
 
-import net.minecraft.client.Minecraft;
 import net.minecraft.client.settings.KeyBinding;
-import net.minecraft.client.util.InputMappings;
-import org.lwjgl.glfw.GLFW;
 
 import java.util.HashSet;
 import java.util.Set;
 
 public class KeyListener {
-    private static final Minecraft minecraft = Minecraft.getInstance();
-    private static long mainWindowHandle;
     private static Set<Key> keys = new HashSet<>();
 
-    public static void init() {
-        mainWindowHandle = minecraft.mainWindow.getHandle();
-        GLFW.glfwSetKeyCallback(mainWindowHandle, KeyListener::onKeyEvent);
-    }
-
     public static Key register(String description, int keyCode, String category) {
         Key key = new Key(description, keyCode, category);
         keys.add(key);
         return key;
     }
 
-    private static void onKeyEvent(long windowHandle, int keyCode, int scanCode, int action, int modifiers) {
-        if (windowHandle == mainWindowHandle && minecraft.currentScreen == null && keyCode != -1 && !InputMappings.isKeyDown(292)) {
-            InputMappings.Input input = InputMappings.getInputByCode(keyCode, scanCode);
-            for (Key key : keys) {
-                if (key.getInput() == input) {
-                    switch (action) {
-                        case GLFW.GLFW_PRESS:
-                            key.press();
-                            break;
-                        case GLFW.GLFW_REPEAT:
-                            key.repeat();
-                            break;
-                        case GLFW.GLFW_RELEASE:
-                            key.release();
-                            return;
-                    }
-                    if (minecraft.currentScreen != null)
-                        key.release();
-                    return;
+    public static KeyBinding[] keyBindings() {
+        return keys.toArray(new KeyBinding[0]);
+    }
+
+    public static boolean setKeyBindState(int keyCode, boolean pressed) {
+        for (Key key : keys) {
+            if (key.getKeyCode() == keyCode) {
+                if (!pressed) {
+                    key.release();
+                } else if (key.isPressed()) {
+                    key.repeat();
+                } else {
+                    key.press();
                 }
+                return true;
             }
         }
-        minecraft.keyboardListener.onKeyEvent(windowHandle, keyCode, scanCode, action, modifiers);
-    }
-
-    public static KeyBinding[] keyBindings() {
-        return keys.stream().toArray(KeyBinding[]::new);
+        return false;
     }
 }
index efb75941bb6c002b787bf0be21749f07e4909f89..8bd43bd5340af2df0daa10acd19f0258f84d1c62 100644 (file)
@@ -9,18 +9,21 @@ import com.irtimaled.bbor.common.models.BoundingBoxStructure;
 import com.irtimaled.bbor.common.models.Coords;
 import net.minecraft.tileentity.TileEntity;
 import net.minecraft.tileentity.TileEntityMobSpawner;
-import net.minecraft.util.math.MutableBoundingBox;
+import net.minecraft.util.math.ChunkPos;
 import net.minecraft.world.chunk.Chunk;
-import net.minecraft.world.gen.feature.structure.StructurePiece;
-import net.minecraft.world.gen.feature.structure.StructureStart;
+import net.minecraft.world.chunk.IChunkProvider;
+import net.minecraft.world.gen.ChunkProviderServer;
+import net.minecraft.world.gen.IChunkGenerator;
+import net.minecraft.world.gen.structure.MapGenStructure;
+import net.minecraft.world.gen.structure.StructureBoundingBox;
+import net.minecraft.world.gen.structure.StructureComponent;
+import net.minecraft.world.gen.structure.StructureStart;
 
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
+import java.util.function.Function;
 
 public abstract class AbstractChunkProcessor {
-    Set<BoundingBoxType> supportedStructures = new HashSet<>();
+    Map<BoundingBoxType, Function<IChunkGenerator, Collection<StructureStart>>> supportedStructures = new HashMap<>();
 
     AbstractChunkProcessor(BoundingBoxCache boundingBoxCache) {
         this.boundingBoxCache = boundingBoxCache;
@@ -28,31 +31,49 @@ public abstract class AbstractChunkProcessor {
 
     private final BoundingBoxCache boundingBoxCache;
 
-    private void addStructures(BoundingBoxType type, Map<String, StructureStart> structureMap) {
-        StructureStart structureStart = structureMap.get(type.getName());
-        if (structureStart == null) return;
+    static <T extends IChunkGenerator, R extends MapGenStructure> Collection<StructureStart> getStructures(T chunkGenerator, Class<R> generatorClass) {
+        Class<T> chunkGeneratorClass = (Class<T>) chunkGenerator.getClass();
+        R structureGenerator = ReflectionHelper.getPrivateValue(chunkGeneratorClass, chunkGenerator, generatorClass);
+        if (structureGenerator != null) {
+            Map<ChunkPos, StructureStart> structureMap = ReflectionHelper.getPrivateValue(MapGenStructure.class, structureGenerator, Map.class);
+            return structureMap.values();
+        }
+        return Collections.emptyList();
+    }
+
+    Collection<StructureStart> getStructuresWithComponent(Collection<StructureStart> structures, Class structureComponent) {
+        Collection<StructureStart> validStructures = new HashSet<>();
+        for (StructureStart structure : structures) {
+            if (structure.getComponents().get(0).getClass().equals(structureComponent)) {
+                validStructures.add(structure);
+            }
+        }
+        return validStructures;
+    }
 
-        MutableBoundingBox bb = structureStart.getBoundingBox();
+
+    private void addStructures(BoundingBoxType type, StructureStart structureStart) {
+        StructureBoundingBox bb = structureStart.getBoundingBox();
         if (bb == null) return;
 
         AbstractBoundingBox boundingBox = buildStructure(bb, type);
         if (boundingBoxCache.isCached(boundingBox)) return;
 
         Set<AbstractBoundingBox> structureBoundingBoxes = new HashSet<>();
-        for (StructurePiece structureComponent : structureStart.getComponents()) {
+        for (StructureComponent structureComponent : structureStart.getComponents()) {
             structureBoundingBoxes.add(buildStructure(structureComponent.getBoundingBox(), type));
         }
         boundingBoxCache.addBoundingBoxes(boundingBox, structureBoundingBoxes);
     }
 
-    private AbstractBoundingBox buildStructure(MutableBoundingBox bb, BoundingBoxType type) {
+    private AbstractBoundingBox buildStructure(StructureBoundingBox bb, BoundingBoxType type) {
         Coords min = new Coords(bb.minX, bb.minY, bb.minZ);
         Coords max = new Coords(bb.maxX, bb.maxY, bb.maxZ);
         return BoundingBoxStructure.from(min, max, type);
     }
 
     private void addMobSpawners(Chunk chunk) {
-        Collection<TileEntity> tileEntities = chunk.getTileEntityMap().values();
+        Collection<TileEntity> tileEntities = chunk.getWorld().loadedTileEntityList;
         for (TileEntity tileEntity : tileEntities) {
             TileEntityMobSpawner spawner = TypeHelper.as(tileEntity, TileEntityMobSpawner.class);
             if (spawner != null) {
@@ -63,10 +84,14 @@ public abstract class AbstractChunkProcessor {
     }
 
     public void process(Chunk chunk) {
-        Map<String, StructureStart> structureMap = chunk.getStructureStarts();
-        if (structureMap.size() > 0) {
-            supportedStructures.forEach(type -> addStructures(type, structureMap));
-        }
+        IChunkProvider chunkProvider = chunk.getWorld().getChunkProvider();
+        IChunkGenerator chunkGenerator = ReflectionHelper.getPrivateValue(ChunkProviderServer.class, (ChunkProviderServer) chunkProvider, IChunkGenerator.class);
+        supportedStructures.forEach((type, supplier) ->
+                {
+                    Collection<StructureStart> structureStarts = supplier.apply(chunkGenerator);
+                    structureStarts.forEach(structureStart -> addStructures(type, structureStart));
+                }
+        );
         addMobSpawners(chunk);
     }
 }
index b46824ff1d8b150b211abcc62f39218b4692c1af..cf6775b329c4fb80ca9b78056162d7d84afd4771 100644 (file)
@@ -2,10 +2,11 @@ package com.irtimaled.bbor.common.chunkProcessors;
 
 import com.irtimaled.bbor.common.BoundingBoxCache;
 import com.irtimaled.bbor.common.BoundingBoxType;
+import net.minecraft.world.gen.structure.MapGenEndCity;
 
 public class EndChunkProcessor extends AbstractChunkProcessor {
     public EndChunkProcessor(BoundingBoxCache boundingBoxCache) {
         super(boundingBoxCache);
-        supportedStructures.add(BoundingBoxType.EndCity);
+        supportedStructures.put(BoundingBoxType.EndCity, (chunkGenerator) -> getStructures(chunkGenerator, MapGenEndCity.class));
     }
 }
index 79e960713a6d1ec790193aaf295722f21b3f29f9..022fc5b3ca76876d17d18e61f2c64ea261a47eb3 100644 (file)
@@ -2,10 +2,11 @@ package com.irtimaled.bbor.common.chunkProcessors;
 
 import com.irtimaled.bbor.common.BoundingBoxCache;
 import com.irtimaled.bbor.common.BoundingBoxType;
+import net.minecraft.world.gen.structure.MapGenNetherBridge;
 
 public class NetherChunkProcessor extends AbstractChunkProcessor {
     public NetherChunkProcessor(BoundingBoxCache boundingBoxCache) {
         super(boundingBoxCache);
-        supportedStructures.add(BoundingBoxType.NetherFortress);
+        supportedStructures.put(BoundingBoxType.NetherFortress, (chunkGenerator) -> getStructures(chunkGenerator, MapGenNetherBridge.class));
     }
 }
index ab561ba7031121035c168f78267d37d37aee7d43..463c70a9d7da24e8caf85c98d8d2ed965b4548a9 100644 (file)
@@ -2,21 +2,18 @@ package com.irtimaled.bbor.common.chunkProcessors;
 
 import com.irtimaled.bbor.common.BoundingBoxCache;
 import com.irtimaled.bbor.common.BoundingBoxType;
+import net.minecraft.world.gen.structure.*;
 
 public class OverworldChunkProcessor extends AbstractChunkProcessor {
     public OverworldChunkProcessor(BoundingBoxCache boundingBoxCache) {
         super(boundingBoxCache);
-        supportedStructures.add(BoundingBoxType.DesertTemple);
-        supportedStructures.add(BoundingBoxType.JungleTemple);
-        supportedStructures.add(BoundingBoxType.WitchHut);
-        supportedStructures.add(BoundingBoxType.OceanMonument);
-        supportedStructures.add(BoundingBoxType.Stronghold);
-        supportedStructures.add(BoundingBoxType.Mansion);
-        supportedStructures.add(BoundingBoxType.MineShaft);
-        supportedStructures.add(BoundingBoxType.Shipwreck);
-        supportedStructures.add(BoundingBoxType.OceanRuin);
-        supportedStructures.add(BoundingBoxType.BuriedTreasure);
-        supportedStructures.add(BoundingBoxType.Igloo);
-        supportedStructures.add(BoundingBoxType.PillagerOutpost);
+        supportedStructures.put(BoundingBoxType.DesertTemple, (chunkGenerator) -> getStructuresWithComponent(getStructures(chunkGenerator, MapGenScatteredFeature.class), ComponentScatteredFeaturePieces.DesertPyramid.class));
+        supportedStructures.put(BoundingBoxType.JungleTemple, (chunkGenerator) -> getStructuresWithComponent(getStructures(chunkGenerator, MapGenScatteredFeature.class), ComponentScatteredFeaturePieces.JunglePyramid.class));
+        supportedStructures.put(BoundingBoxType.WitchHut, (chunkGenerator) -> getStructuresWithComponent(getStructures(chunkGenerator, MapGenScatteredFeature.class), ComponentScatteredFeaturePieces.SwampHut.class));
+        supportedStructures.put(BoundingBoxType.OceanMonument, (chunkGenerator) -> getStructures(chunkGenerator, StructureOceanMonument.class));
+        supportedStructures.put(BoundingBoxType.Stronghold, (chunkGenerator) -> getStructures(chunkGenerator, MapGenStronghold.class));
+        supportedStructures.put(BoundingBoxType.Mansion, (chunkGenerator) -> getStructures(chunkGenerator, WoodlandMansion.class));
+        supportedStructures.put(BoundingBoxType.MineShaft, (chunkGenerator) -> getStructures(chunkGenerator, MapGenMineshaft.class));
+        supportedStructures.put(BoundingBoxType.Igloo, (chunkGenerator) -> getStructuresWithComponent(getStructures(chunkGenerator, MapGenScatteredFeature.class), ComponentScatteredFeaturePieces.Igloo.class));
     }
 }
diff --git a/src/main/java/com/irtimaled/bbor/common/chunkProcessors/ReflectionHelper.java b/src/main/java/com/irtimaled/bbor/common/chunkProcessors/ReflectionHelper.java
new file mode 100644 (file)
index 0000000..67a3e56
--- /dev/null
@@ -0,0 +1,46 @@
+package com.irtimaled.bbor.common.chunkProcessors;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ReflectionHelper {
+    public static <T, R> R getPrivateValue(Class<T> sourceClass, T instance, Class<R> resultClass) {
+        try {
+            Field f = getField(sourceClass, resultClass);
+            if (f != null) {
+                return (R) f.get(instance);
+            }
+        } catch (Exception ignored) {
+        }
+        return null;
+    }
+
+    private static Map<Class, Map<Class, Field>> fieldMap = new HashMap<>();
+
+    private static <T, R> Field getField(Class<T> sourceClass, Class<R> resultClass) {
+        Map<Class, Field> map = fieldMap.computeIfAbsent(sourceClass, k -> new HashMap<>());
+        Field field = map.get(resultClass);
+        if (field == null) {
+            field = getFieldUsingReflection(sourceClass, resultClass);
+            if (field != null) {
+                field.setAccessible(true);
+                map.put(resultClass, field);
+            }
+        }
+        return field;
+    }
+
+    private static <T, R> Field getFieldUsingReflection(Class<T> sourceClass, Class<R> resultClass) {
+        Field[] fields = sourceClass.getDeclaredFields();
+        for (Field field : fields) {
+            if (field.getType().equals(resultClass))
+                return field;
+        }
+        for (Field field : fields) {
+            if (resultClass.isAssignableFrom(field.getType()))
+                return field;
+        }
+        return null;
+    }
+}
\ No newline at end of file
index fa3d677f2c3525a0ddf00c56534afde7a0203428..45b41bed3bedd56c83c0dffc60ba20456b124ded 100644 (file)
@@ -8,7 +8,7 @@ public class ChunkLoaded {
 
     public ChunkLoaded(Chunk chunk) {
         this.chunk = chunk;
-        this.dimensionId = chunk.getWorld().getDimension().getType().getId();
+        this.dimensionId = chunk.getWorld().provider.getDimensionType().getId();
     }
 
     public Chunk getChunk() {
index 8b20b87e9d349ea4aefe7fe6fad69c0947eb3784..f4e7a8be2be8cb7ed56800849367a18dd60ee1d9 100644 (file)
@@ -8,7 +8,7 @@ public class ServerWorldTick {
 
     public ServerWorldTick(WorldServer world) {
         this.world = world;
-        this.dimensionId = world.getDimension().getType().getId();
+        this.dimensionId = world.provider.getDimensionType().getId();
     }
 
     public WorldServer getWorld() {
index 12596b341a94d0a169eefd2c3dd83fd050bce7f7..ce2ca5f447faf509471e378b759ac124fa31b667 100644 (file)
@@ -11,7 +11,7 @@ public class WorldLoaded {
 
     public WorldLoaded(WorldServer world) {
         WorldInfo info = world.getWorldInfo();
-        this.dimensionId = world.getDimension().getType().getId();
+        this.dimensionId = world.provider.getDimensionType().getId();
         this.seed = info.getSeed();
         this.spawnX = info.getSpawnX();
         this.spawnZ = info.getSpawnZ();
index ed16c7c5dfcd8f165f5d5e1d1312d415b5c7302b..e3aaa8c2964cc91668972ab2cd4fafe351b362ff 100644 (file)
@@ -64,7 +64,7 @@ public class CommonInterop {
 
     public static void tryHarvestBlock(Block block, BlockPos pos, World world) {
         if (block instanceof BlockMobSpawner) {
-            EventBus.publish(new MobSpawnerBroken(world.dimension.getType().getId(), new Coords(pos)));
+            EventBus.publish(new MobSpawnerBroken(world.provider.getDimensionType().getId(), new Coords(pos)));
         }
     }
 }
index 3a12945565057955ae2971d51b80c38fff92d472..a39a6e23e5786d4064fcd59fe80c4e842ce319b1 100644 (file)
@@ -7,7 +7,7 @@ import java.util.HashSet;
 import java.util.Set;
 
 public class AddBoundingBox {
-    public static final String NAME = "bbor:add_bounding_box";
+    public static final String NAME = "bbor:addbb";
 
     public static PayloadBuilder getPayload(int dimensionId, AbstractBoundingBox key, Set<AbstractBoundingBox> boundingBoxes) {
         if (!BoundingBoxSerializer.canSerialize(key)) return null;
index ae10a98af02bd3eeca76ba72d8c4c0e66eebda56..f4a5d17089ba572a6827bb475a681e4f158f7dfd 100644 (file)
@@ -3,7 +3,7 @@ package com.irtimaled.bbor.common.messages;
 import com.irtimaled.bbor.client.events.InitializeClientReceived;
 
 public class InitializeClient {
-    public static final String NAME = "bbor:initialize";
+    public static final String NAME = "bbor:init";
 
     public static PayloadBuilder getPayload(long seed, int spawnX, int spawnZ) {
         return PayloadBuilder.clientBound(NAME)
index ec2579a3a576a4e1a48b2b80c3a06188111a5c2a..1ea7977ad44dc7308d75973c0dd603f7bd42cd78 100644 (file)
@@ -6,28 +6,23 @@ import net.minecraft.network.Packet;
 import net.minecraft.network.PacketBuffer;
 import net.minecraft.network.play.client.CPacketCustomPayload;
 import net.minecraft.network.play.server.SPacketCustomPayload;
-import net.minecraft.util.ResourceLocation;
 
-import java.util.HashMap;
-import java.util.Map;
 import java.util.function.BiFunction;
 
 public class PayloadBuilder {
-    private static Map<String, ResourceLocation> packetNames = new HashMap<>();
-
     static PayloadBuilder clientBound(String name) {
-        return new PayloadBuilder(packetNames.computeIfAbsent(name, ResourceLocation::new), SPacketCustomPayload::new);
+        return new PayloadBuilder(name, SPacketCustomPayload::new);
     }
 
     static PayloadBuilder serverBound(String name) {
-        return new PayloadBuilder(packetNames.computeIfAbsent(name, ResourceLocation::new), CPacketCustomPayload::new);
+        return new PayloadBuilder(name, CPacketCustomPayload::new);
     }
 
-    private final ResourceLocation name;
-    private final BiFunction<ResourceLocation, PacketBuffer, Packet<?>> packetBuilder;
+    private final String name;
+    private final BiFunction<String, PacketBuffer, Packet<?>> packetBuilder;
     private final PacketBuffer buffer;
 
-    private PayloadBuilder(ResourceLocation name, BiFunction<ResourceLocation, PacketBuffer, Packet<?>> packetBuilder) {
+    private PayloadBuilder(String name, BiFunction<String, PacketBuffer, Packet<?>> packetBuilder) {
         this.name = name;
         this.buffer = new PacketBuffer(Unpooled.buffer());
         this.packetBuilder = packetBuilder;
index 2baf62e2b5a4d6a37442580165c8c57813865c65..3f508bfc17b6c5f73003329684398cc66ecf9bb5 100644 (file)
@@ -4,7 +4,7 @@ import com.irtimaled.bbor.client.events.RemoveBoundingBoxReceived;
 import com.irtimaled.bbor.common.models.AbstractBoundingBox;
 
 public class RemoveBoundingBox {
-    public static final String NAME = "bbor:remove_bounding_box";
+    public static final String NAME = "bbor:removebb";
 
     public static PayloadBuilder getPayload(int dimensionId, AbstractBoundingBox key) {
         if (!BoundingBoxSerializer.canSerialize(key)) return null;
index 5ddf390682d13bcb5012f8bbc6facee1541158df..939623671361fb39aa083ce6361d858904f5dc18 100644 (file)
@@ -1,7 +1,7 @@
 package com.irtimaled.bbor.common.messages;
 
 public class SubscribeToServer {
-    public static final String NAME = "bbor:subscribe";
+    public static final String NAME = "bbor:sub";
 
     public static PayloadBuilder getPayload() {
         return PayloadBuilder.serverBound(NAME);
index 3bde9db961e68b065e12616b61b22d9a43c8ed3b..852e408f5b26883d5fbdf00b33e1500554cd67e6 100644 (file)
@@ -1,12 +1,15 @@
 package com.irtimaled.bbor.mixin.client;
 
 import com.irtimaled.bbor.client.ClientProxy;
+import com.irtimaled.bbor.client.keyboard.KeyListener;
 import com.irtimaled.bbor.common.interop.CommonInterop;
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.main.GameConfiguration;
+import net.minecraft.client.settings.KeyBinding;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.Redirect;
 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 
 @Mixin(Minecraft.class)
@@ -23,4 +26,11 @@ public class MixinMinecraft {
     private void init(CallbackInfo ci) {
         clientProxy.init();
     }
+
+    @Redirect(method = "runTickKeyboard", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/settings/KeyBinding;setKeyBindState(IZ)V"))
+    private void setKeyBindState(int keyCode, boolean pressed) {
+        if (!KeyListener.setKeyBindState(keyCode, pressed)) {
+            KeyBinding.setKeyBindState(keyCode, pressed);
+        }
+    }
 }
index cba5640805793e985adeb12ad300236f977e1f3a..e420af68f7bf1d8901be99bc2f041a745ac7d8cc 100644 (file)
@@ -16,7 +16,7 @@ public class MixinGuiOptions extends GuiScreen {
         //shuffle middle buttons up by 12 px to make space
         int top = this.height / 6 + 42;
         int bottom = this.height / 6 + 168;
-        for (GuiButton button : buttons) {
+        for (GuiButton button : buttonList) {
             if (button.y >= top && button.y < bottom)
                 button.y -= 12;
         }
index 44f66c1197d2b36a745b1f46e991e8e502f85758..1b66b33f64b2238ff893c53b76d54e08592cb379 100644 (file)
@@ -16,8 +16,10 @@ public class MixinEntityRenderer {
     @Final
     private Minecraft mc;
 
-    @Inject(method = "updateCameraAndRender(FJ)V", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/profiler/Profiler;endStartSection(Ljava/lang/String;)V", args = "ldc=hand", shift = At.Shift.BEFORE))
-    private void render(float partialTicks, long ignored, CallbackInfo ci) {
-        ClientInterop.render(partialTicks, this.mc.player);
+    @Inject(method = "renderWorldPass", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/profiler/Profiler;endStartSection(Ljava/lang/String;)V", args = "ldc=hand", shift = At.Shift.BEFORE))
+    private void render(int pass, float partialTicks, long finishTimeNano, CallbackInfo ci) {
+        if (pass % 2 == 0) {
+            ClientInterop.render(partialTicks, this.mc.player);
+        }
     }
 }
index 71d3b7efa6cfce4f7416b2598066fdd22824a310..322af8155c2100c44a300fed0336e4c5b751c72f 100644 (file)
@@ -1,8 +1,8 @@
 package com.irtimaled.bbor.mixin.client.settings;
 
 import com.irtimaled.bbor.client.keyboard.KeyListener;
-import net.minecraft.client.GameSettings;
 import net.minecraft.client.Minecraft;
+import net.minecraft.client.settings.GameSettings;
 import net.minecraft.client.settings.KeyBinding;
 import org.apache.commons.lang3.ArrayUtils;
 import org.spongepowered.asm.mixin.Mixin;
index a53d2db102849d5bdb527b3ad110bb2bccff8a6a..25d0232f75dec86bbd1cd381b077732384191d55 100644 (file)
@@ -5,7 +5,6 @@ import com.irtimaled.bbor.common.messages.SubscribeToServer;
 import net.minecraft.network.NetHandlerPlayServer;
 import net.minecraft.network.play.INetHandlerPlayServer;
 import net.minecraft.network.play.client.CPacketCustomPayload;
-import net.minecraft.util.ResourceLocation;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Shadow;
 import org.spongepowered.asm.mixin.injection.At;
@@ -14,11 +13,11 @@ import org.spongepowered.asm.mixin.injection.Redirect;
 @Mixin(CPacketCustomPayload.class)
 public class MixinCPacketCustomPayload {
     @Shadow
-    private ResourceLocation channel;
+    private String channel;
 
     @Redirect(method = "processPacket", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/play/INetHandlerPlayServer;processCustomPayload(Lnet/minecraft/network/play/client/CPacketCustomPayload;)V"))
     private void processPacket(INetHandlerPlayServer netHandlerPlayServer, CPacketCustomPayload packet) {
-        if (this.channel.toString().equals(SubscribeToServer.NAME)) {
+        if (this.channel.equals(SubscribeToServer.NAME)) {
             CommonInterop.playerSubscribed(((NetHandlerPlayServer) netHandlerPlayServer).player);
         } else {
             netHandlerPlayServer.processCustomPayload(packet);
index a0ab1d64f72fd388222a030d9a4465a75a2b5982..ef75b5d165e786a6b7fcc71fb6bf7abb2fb71a66 100644 (file)
@@ -6,7 +6,6 @@ import net.minecraft.client.network.NetHandlerPlayClient;
 import net.minecraft.network.PacketBuffer;
 import net.minecraft.network.play.INetHandlerPlayClient;
 import net.minecraft.network.play.server.SPacketCustomPayload;
-import net.minecraft.util.ResourceLocation;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Shadow;
 import org.spongepowered.asm.mixin.injection.At;
@@ -15,17 +14,16 @@ import org.spongepowered.asm.mixin.injection.Redirect;
 @Mixin(SPacketCustomPayload.class)
 public abstract class MixinSPacketCustomPayload {
     @Shadow
-    private ResourceLocation channel;
+    private String channel;
 
     @Redirect(method = "processPacket", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/play/INetHandlerPlayClient;handleCustomPayload(Lnet/minecraft/network/play/server/SPacketCustomPayload;)V"))
     private void processPacket(INetHandlerPlayClient netHandlerPlayClient, SPacketCustomPayload packet) {
-        String channelName = channel.toString();
-        if (channelName.startsWith("bbor:")) {
+        if (this.channel.startsWith("bbor:")) {
             PacketBuffer data = null;
             try {
                 data = packet.getBufferData();
                 PayloadReader reader = new PayloadReader(data);
-                switch (channelName) {
+                switch (this.channel) {
                     case InitializeClient.NAME: {
                         EventBus.publish(InitializeClient.getEvent(reader));
                         ((NetHandlerPlayClient) netHandlerPlayClient).sendPacket(SubscribeToServer.getPayload().build());
diff --git a/src/main/java/com/irtimaled/bbor/mixin/server/dedicated/MixinDedicatedServer.java b/src/main/java/com/irtimaled/bbor/mixin/server/dedicated/MixinDedicatedServer.java
deleted file mode 100644 (file)
index 983def3..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.irtimaled.bbor.mixin.server.dedicated;
-
-import com.irtimaled.bbor.common.CommonProxy;
-import com.irtimaled.bbor.common.interop.CommonInterop;
-import net.minecraft.server.dedicated.DedicatedServer;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-
-@Mixin(DedicatedServer.class)
-public class MixinDedicatedServer {
-    @Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/dedicated/DedicatedServer;loadAllWorlds(Ljava/lang/String;Ljava/lang/String;JLnet/minecraft/world/WorldType;Lcom/google/gson/JsonElement;)V"))
-    private void init(CallbackInfoReturnable<Boolean> cir) {
-        CommonInterop.init();
-        new CommonProxy().init();
-    }
-}
diff --git a/src/main/java/com/irtimaled/bbor/server/ServerRunner.java b/src/main/java/com/irtimaled/bbor/server/ServerRunner.java
deleted file mode 100644 (file)
index d92819a..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.irtimaled.bbor.server;
-
-import net.minecraft.launchwrapper.Launch;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.nio.channels.Channels;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class ServerRunner {
-    private static final Map<String, String> VANILLA_SERVER_JARS = new HashMap<>();
-
-    private static final String[] LIBRARIES = {
-            "https://github.com/irtimaled/Mixin/releases/download/org/spongepowered/mixin/0.7.11-SNAPSHOT/mixin-0.7.11-SNAPSHOT.jar",
-            "https://repo1.maven.org/maven2/org/ow2/asm/asm/6.2/asm-6.2.jar",
-            "https://repo1.maven.org/maven2/org/ow2/asm/asm-commons/6.2/asm-commons-6.2.jar",
-            "https://repo1.maven.org/maven2/org/ow2/asm/asm-tree/6.2/asm-tree-6.2.jar",
-            "https://libraries.minecraft.net/net/minecraft/launchwrapper/1.12/launchwrapper-1.12.jar"
-    };
-
-    private static final ThrowableConsumer<URL> addURL;
-
-    static {
-        VANILLA_SERVER_JARS.put("1.13", "https://launcher.mojang.com/v1/objects/d0caafb8438ebd206f99930cfaecfa6c9a13dca0/server.jar");
-
-        try {
-            Method method = URLClassLoader.class
-                    .getDeclaredMethod("addURL", URL.class);
-            method.setAccessible(true);
-            addURL = url -> method.invoke(ClassLoader.getSystemClassLoader(), url);
-        } catch (ReflectiveOperationException e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    private static void addURLToClasspath(File file) throws MalformedURLException {
-        addURL.accept(file.toURI().toURL());
-    }
-
-    public static void run(String version, List<String> args) throws IOException {
-        String serverJarUrl = VANILLA_SERVER_JARS.get(version);
-
-        addURLToClasspath(getOrDownload(new File("."), serverJarUrl));
-        for (String url : LIBRARIES) {
-            addURLToClasspath(getOrDownload(new File("libs"), url));
-        }
-
-        args = new ArrayList<>(args);
-        args.add("--tweakClass");
-        args.add("com.irtimaled.bbor.launch.ServerTweaker");
-
-        System.out.println("Launching server...");
-        Launch.main(args.toArray(new String[0]));
-    }
-
-    private static File getOrDownload(File directory, String url) throws IOException {
-        String fileName = url.substring(url.lastIndexOf('/') + 1);
-        File target = new File(directory, fileName);
-        if (target.isFile()) {
-            return target;
-        }
-        target.getParentFile().mkdirs();
-
-        System.out.println("Downloading library: " + url);
-        new FileOutputStream(target).getChannel()
-                .transferFrom(Channels.newChannel(new URL(url).openStream()), 0, Long.MAX_VALUE);
-
-        return target;
-    }
-}
diff --git a/src/main/java/com/irtimaled/bbor/server/ThrowableConsumer.java b/src/main/java/com/irtimaled/bbor/server/ThrowableConsumer.java
deleted file mode 100644 (file)
index 77c0324..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.irtimaled.bbor.server;
-
-import com.irtimaled.bbor.common.TypeHelper;
-
-import java.util.function.Consumer;
-
-public interface ThrowableConsumer<T> extends Consumer<T> {
-    @Override
-    default void accept(final T elem) {
-        try {
-            acceptThrows(elem);
-        } catch (final Throwable t) {
-            throw TypeHelper.as(t, RuntimeException.class, () -> new RuntimeException(t));
-        }
-    }
-
-    void acceptThrows(T elem) throws Throwable;
-}
index 4632988fc5b8b536162397afec38754d1f781a53..4b6b316bbb79e87333154659739da358c61ce721 100644 (file)
@@ -25,8 +25,5 @@
     "client.settings.MixinKeyBinding",
     "network.play.server.MixinSPacketCustomPayload",
     "network.play.server.MixinSPacketSpawnPosition"
-  ],
-  "server": [
-    "server.dedicated.MixinDedicatedServer"
   ]
 }