From: Irtimaled Date: Mon, 26 Jul 2021 02:38:26 +0000 (-0700) Subject: Get 1.17.1 building X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=ac95f552e83a3f4489dc9911ca218a9d9d611732;p=BoundingBoxOutlineReloaded.git Get 1.17.1 building --- diff --git a/build.gradle b/build.gradle index 095cb59..05c2fea 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { } } dependencies { - classpath "net.fabricmc:fabric-loom:0.2.7-SNAPSHOT" + classpath "net.fabricmc:fabric-loom:0.8-SNAPSHOT" } } @@ -19,13 +19,24 @@ group 'com.irtimaled' version project.buildVersion + '-' + project.mcVersion archivesBaseName = 'BBOutlineReloaded' -sourceCompatibility = 1.8 -targetCompatibility = 1.8 +sourceCompatibility = JavaVersion.VERSION_16 +targetCompatibility = JavaVersion.VERSION_16 + +tasks.withType(JavaCompile).configureEach { + // ensure that the encoding is set to UTF-8, no matter what the system default is + // this fixes some edge cases with special characters not displaying correctly + // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html + // If Javadoc is generated, this must be specified in that task too. + it.options.encoding = "UTF-8" + + // Minecraft 1.17 (21w19a) upwards uses Java 16. + it.options.release = 16 +} dependencies { minecraft 'com.mojang:minecraft:' + project.mcVersion - mappings 'net.fabricmc:yarn:' + project.mcVersion + '+build.27' - modCompile 'net.fabricmc:fabric-loader:0.9.3+build.207' + mappings 'net.fabricmc:yarn:' + project.mcVersion + '+build.1:v2' + modImplementation 'net.fabricmc:fabric-loader:0.11.6' } minecraft { @@ -38,6 +49,13 @@ processResources { } } +java { + toolchain { + languageVersion = JavaLanguageVersion.of(16) + } + withSourcesJar() +} + jar { manifest { attributes([ diff --git a/gradle.properties b/gradle.properties index dc62e0b..341f34c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ name=bbor buildVersion=2.4 # leave a space to reduce merge conflicts on version change -mcVersion=1.16.3 +mcVersion=1.17.1 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f78ba29..c4c1514 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ #Tue May 26 09:16:06 PDT 2020 -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.1-bin.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStorePath=wrapper/dists diff --git a/src/main/java/com/irtimaled/bbor/client/gui/AbstractControl.java b/src/main/java/com/irtimaled/bbor/client/gui/AbstractControl.java index 01db585..df1a538 100644 --- a/src/main/java/com/irtimaled/bbor/client/gui/AbstractControl.java +++ b/src/main/java/com/irtimaled/bbor/client/gui/AbstractControl.java @@ -1,13 +1,14 @@ package com.irtimaled.bbor.client.gui; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.widget.AbstractButtonWidget; +import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder; +import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.LiteralText; import java.awt.*; -abstract class AbstractControl extends AbstractButtonWidget implements IControl { +abstract class AbstractControl extends ClickableWidget implements IControl { private static final int PADDING = 4; protected final MinecraftClient minecraft; @@ -38,7 +39,7 @@ abstract class AbstractControl extends AbstractButtonWidget implements IControl } @Override - protected void renderBg(MatrixStack matrixStack, MinecraftClient minecraft, int mouseX, int mouseY) { + protected void renderBackground(MatrixStack matrixStack, MinecraftClient minecraft, int mouseX, int mouseY) { if (active) renderBackground(matrixStack, mouseX, mouseY); } @@ -65,4 +66,8 @@ abstract class AbstractControl extends AbstractButtonWidget implements IControl public void clearFocus() { this.setFocused(false); } + + @Override + public void appendNarrations(NarrationMessageBuilder builder) { + } } diff --git a/src/main/java/com/irtimaled/bbor/client/gui/AbstractSlider.java b/src/main/java/com/irtimaled/bbor/client/gui/AbstractSlider.java index f527fef..1a3c1f5 100644 --- a/src/main/java/com/irtimaled/bbor/client/gui/AbstractSlider.java +++ b/src/main/java/com/irtimaled/bbor/client/gui/AbstractSlider.java @@ -18,7 +18,7 @@ abstract class AbstractSlider extends AbstractControl { @Override protected void renderBackground(MatrixStack matrixStack, int mouseX, int mouseY) { - this.minecraft.getTextureManager().bindTexture(WIDGETS_LOCATION); + this.minecraft.getTextureManager().bindTexture(WIDGETS_TEXTURE); int hoverState = super.getYImage(this.isHovered()); this.drawTexture(matrixStack, this.x + (int) getProgressPercentage(), this.y, 0, 46 + hoverState * 20, 4, this.height); this.drawTexture(matrixStack, this.x + (int) getProgressPercentage() + 4, this.y, 196, 46 + hoverState * 20, 4, 20); diff --git a/src/main/java/com/irtimaled/bbor/client/gui/ControlList.java b/src/main/java/com/irtimaled/bbor/client/gui/ControlList.java index 80554db..b031531 100644 --- a/src/main/java/com/irtimaled/bbor/client/gui/ControlList.java +++ b/src/main/java/com/irtimaled/bbor/client/gui/ControlList.java @@ -3,7 +3,6 @@ package com.irtimaled.bbor.client.gui; import com.irtimaled.bbor.client.renderers.RenderHelper; import com.irtimaled.bbor.client.renderers.Renderer; import com.irtimaled.bbor.common.MathHelper; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.util.math.MatrixStack; @@ -18,7 +17,6 @@ public class ControlList extends DrawableHelper implements IControlSet { protected final List entries = new ArrayList<>(); private final int scrollBarLeft; private final int listHeight; - private final MinecraftClient minecraft; private final int width; private final int height; private final int top; @@ -32,7 +30,6 @@ public class ControlList extends DrawableHelper implements IControlSet { private boolean isDragging; ControlList(int width, int height, int top, int bottom) { - this.minecraft = MinecraftClient.getInstance(); this.width = width; this.scrollBarLeft = width - 6; this.height = height; @@ -157,7 +154,7 @@ public class ControlList extends DrawableHelper implements IControlSet { this.amountScrolled = MathHelper.clamp(this.amountScrolled, 0.0D, this.getMaxScroll()); RenderHelper.disableLighting(); - RenderHelper.disableFog(); + // RenderHelper.disableFog(); if (!transparentBackground) drawListBackground(); int listTop = this.top + PADDING - (int) this.amountScrolled; @@ -190,7 +187,7 @@ public class ControlList extends DrawableHelper implements IControlSet { } private void drawListBackground() { - this.minecraft.getTextureManager().bindTexture(DrawableHelper.OPTIONS_BACKGROUND_TEXTURE); + RenderHelper.setTexture(DrawableHelper.OPTIONS_BACKGROUND_TEXTURE); Renderer.startTextured() .setColor(32, 32, 32) .setAlpha(255) @@ -222,7 +219,7 @@ public class ControlList extends DrawableHelper implements IControlSet { } private void overlayBackground(int top, int bottom) { - this.minecraft.getTextureManager().bindTexture(DrawableHelper.OPTIONS_BACKGROUND_TEXTURE); + RenderHelper.setTexture(DrawableHelper.OPTIONS_BACKGROUND_TEXTURE); Renderer.startTextured() .setColor(64, 64, 64) .setAlpha(255) diff --git a/src/main/java/com/irtimaled/bbor/client/gui/ListScreen.java b/src/main/java/com/irtimaled/bbor/client/gui/ListScreen.java index 9655563..d97b546 100644 --- a/src/main/java/com/irtimaled/bbor/client/gui/ListScreen.java +++ b/src/main/java/com/irtimaled/bbor/client/gui/ListScreen.java @@ -8,6 +8,8 @@ import net.minecraft.client.resource.language.I18n; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.LiteralText; +import java.util.List; + public abstract class ListScreen extends Screen { private final Screen lastScreen; private static final String version = Versions.build; @@ -40,9 +42,9 @@ public abstract class ListScreen extends Screen { } }; - this.children.add(this.searchField); - this.children.add(this.controlList); - this.children.add(this.doneButton); + this.addDrawableChild(this.searchField); + ((List)this.children()).add(controlList); + this.addDrawableChild(this.doneButton); } protected abstract ControlList buildList(int top, int bottom); @@ -55,7 +57,7 @@ public abstract class ListScreen extends Screen { protected void render(MatrixStack matrixStack, int mouseX, int mouseY) { this.controlList.render(matrixStack, mouseX, mouseY); - this.drawCenteredString(matrixStack, this.textRenderer, this.title.asString(), this.width / 2, 8, 16777215); + this.drawCenteredText(matrixStack, this.textRenderer, this.title.asString(), this.width / 2, 8, 16777215); this.searchField.render(matrixStack, mouseX, mouseY); this.doneButton.render(matrixStack, mouseX, mouseY); diff --git a/src/main/java/com/irtimaled/bbor/client/interop/NBTStructureLoader.java b/src/main/java/com/irtimaled/bbor/client/interop/NBTStructureLoader.java index 7591e51..b0c76ec 100644 --- a/src/main/java/com/irtimaled/bbor/client/interop/NBTStructureLoader.java +++ b/src/main/java/com/irtimaled/bbor/client/interop/NBTStructureLoader.java @@ -5,8 +5,9 @@ import com.irtimaled.bbor.common.ReflectionHelper; import com.irtimaled.bbor.common.events.StructuresLoaded; import com.irtimaled.bbor.common.models.DimensionId; import net.minecraft.client.MinecraftClient; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.nbt.NbtList; +import net.minecraft.server.world.ServerWorld; import net.minecraft.structure.StructureManager; import net.minecraft.structure.StructurePiece; import net.minecraft.structure.StructureStart; @@ -14,10 +15,7 @@ import net.minecraft.util.math.BlockBox; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; import net.minecraft.util.registry.DynamicRegistryManager; -import net.minecraft.world.FeatureUpdater; -import net.minecraft.world.PersistentStateManager; -import net.minecraft.world.StructureWorldAccess; -import net.minecraft.world.World; +import net.minecraft.world.*; import net.minecraft.world.biome.Biome; import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.gen.StructureAccessor; @@ -81,9 +79,9 @@ class NBTStructureLoader { return this.legacyStructureDataUtil; } - private CompoundTag loadStructureStarts(int chunkX, int chunkZ) { + private NbtCompound loadStructureStarts(int chunkX, int chunkZ) { try { - CompoundTag compound = this.chunkLoader.readChunk(chunkX, chunkZ); + NbtCompound compound = this.chunkLoader.readChunk(chunkX, chunkZ); if (compound == null) return null; int dataVersion = compound.contains("DataVersion", 99) ? compound.getInt("DataVersion") : -1; if (dataVersion < 1493) { @@ -102,12 +100,12 @@ class NBTStructureLoader { if (!loadedChunks.add(String.format("%s,%s", chunkX, chunkZ))) return; - CompoundTag structureStarts = loadStructureStarts(chunkX, chunkZ); + NbtCompound structureStarts = loadStructureStarts(chunkX, chunkZ); if (structureStarts == null || structureStarts.getSize() == 0) return; Map> structureStartMap = new HashMap<>(); for (String key : structureStarts.getKeys()) { - CompoundTag compound = structureStarts.getCompound(key); + NbtCompound compound = structureStarts.getCompound(key); if (compound.contains("BB")) { structureStartMap.put(key, new SimpleStructureStart(compound)); } @@ -117,33 +115,31 @@ class NBTStructureLoader { } private static class SimpleStructureStart extends StructureStart { - SimpleStructureStart(CompoundTag compound) { + SimpleStructureStart(NbtCompound compound) { super(null, - 0, - 0, - new BlockBox(compound.getIntArray("BB")), - 0, - 0); + null, + 0, 0); - ListTag children = compound.getList("Children", 10); + NbtList children = compound.getList("Children", 10); for (int index = 0; index < children.size(); ++index) { - CompoundTag child = children.getCompound(index); + NbtCompound child = children.getCompound(index); if (child.contains("BB")) this.children.add(new SimpleStructurePiece(child)); } } @Override - public void init(DynamicRegistryManager dynamicRegistryManager, ChunkGenerator chunkGenerator, StructureManager structureManager, int i, int j, Biome biome, FeatureConfig featureConfig) { + public void init(DynamicRegistryManager registryManager, ChunkGenerator chunkGenerator, StructureManager manager, ChunkPos pos, Biome biome, FeatureConfig config, HeightLimitView world) { + } } private static class SimpleStructurePiece extends StructurePiece { - SimpleStructurePiece(CompoundTag compound) { + SimpleStructurePiece(NbtCompound compound) { super(null, compound); } @Override - protected void toNbt(CompoundTag compoundTag) { + protected void writeNbt(ServerWorld world, NbtCompound nbt) { } @@ -163,7 +159,7 @@ class NBTStructureLoader { this.regionFileCache = creator.apply(file, false); } - public CompoundTag readChunk(int chunkX, int chunkZ) throws IOException { + public NbtCompound readChunk(int chunkX, int chunkZ) throws IOException { if (regionFileCache == null) return null; return regionFileCache.getTagAt(new ChunkPos(chunkX, chunkZ)); } diff --git a/src/main/java/com/irtimaled/bbor/client/interop/TileEntitiesHelper.java b/src/main/java/com/irtimaled/bbor/client/interop/TileEntitiesHelper.java index f778d31..ba54e38 100644 --- a/src/main/java/com/irtimaled/bbor/client/interop/TileEntitiesHelper.java +++ b/src/main/java/com/irtimaled/bbor/client/interop/TileEntitiesHelper.java @@ -12,10 +12,10 @@ import java.util.function.Function; public class TileEntitiesHelper { public static Iterable map(Class clazz, Function map) { - Collection tileEntities = MinecraftClient.getInstance().world.blockEntities; + //Collection tileEntities = MinecraftClient.getInstance().world.blockEntities; Set results = new HashSet<>(); - for (BlockEntity tileEntity : tileEntities) { + /*for (BlockEntity tileEntity : tileEntities) { T typed = TypeHelper.as(tileEntity, clazz); if (typed == null) { continue; @@ -24,7 +24,7 @@ public class TileEntitiesHelper { if (result != null) { results.add(result); } - } + }*/ return results; } } diff --git a/src/main/java/com/irtimaled/bbor/client/keyboard/CustomKeyBinding.java b/src/main/java/com/irtimaled/bbor/client/keyboard/CustomKeyBinding.java index ffdb16f..0f43967 100644 --- a/src/main/java/com/irtimaled/bbor/client/keyboard/CustomKeyBinding.java +++ b/src/main/java/com/irtimaled/bbor/client/keyboard/CustomKeyBinding.java @@ -1,6 +1,6 @@ package com.irtimaled.bbor.client.keyboard; -import net.minecraft.client.options.KeyBinding; +import net.minecraft.client.option.KeyBinding; import net.minecraft.client.util.InputUtil; class CustomKeyBinding extends KeyBinding { diff --git a/src/main/java/com/irtimaled/bbor/client/keyboard/KeyListener.java b/src/main/java/com/irtimaled/bbor/client/keyboard/KeyListener.java index 0039d75..0a7bd41 100644 --- a/src/main/java/com/irtimaled/bbor/client/keyboard/KeyListener.java +++ b/src/main/java/com/irtimaled/bbor/client/keyboard/KeyListener.java @@ -1,7 +1,7 @@ package com.irtimaled.bbor.client.keyboard; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.options.KeyBinding; +import net.minecraft.client.option.KeyBinding; import net.minecraft.client.util.InputUtil; import org.lwjgl.glfw.GLFW; diff --git a/src/main/java/com/irtimaled/bbor/client/providers/BeaconProvider.java b/src/main/java/com/irtimaled/bbor/client/providers/BeaconProvider.java index 8b8cb0e..8c9fb3f 100644 --- a/src/main/java/com/irtimaled/bbor/client/providers/BeaconProvider.java +++ b/src/main/java/com/irtimaled/bbor/client/providers/BeaconProvider.java @@ -18,7 +18,7 @@ public class BeaconProvider implements IBoundingBoxProvider { @Override public Iterable get(DimensionId dimensionId) { return TileEntitiesHelper.map(BeaconBlockEntity.class, beacon -> { - int levels = beacon.getLevel(); + int levels = beacon.getBeamSegments().size(); Coords coords = new Coords(beacon.getPos()); return BoundingBoxBeacon.from(coords, levels); }); diff --git a/src/main/java/com/irtimaled/bbor/client/renderers/RenderHelper.java b/src/main/java/com/irtimaled/bbor/client/renderers/RenderHelper.java index f21183a..ecad189 100644 --- a/src/main/java/com/irtimaled/bbor/client/renderers/RenderHelper.java +++ b/src/main/java/com/irtimaled/bbor/client/renderers/RenderHelper.java @@ -1,8 +1,10 @@ package com.irtimaled.bbor.client.renderers; import com.irtimaled.bbor.client.config.ConfigManager; -import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.render.GameRenderer; +import net.minecraft.util.Identifier; import org.lwjgl.opengl.GL11; public class RenderHelper { @@ -11,36 +13,42 @@ public class RenderHelper { public static final int LINE_LOOP = GL11.GL_LINE_LOOP; public static final int POINTS = GL11.GL_POINTS; + //public static final VertexFormat.DrawMode CUSTOM = ReflectionHelper.getPrivateInstanceBuilder(VertexFormat.DrawMode.class,) public static void beforeRender() { enableBlend(); - GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); lineWidth2(); disableTexture(); - GlStateManager.disableCull(); + RenderSystem.disableCull(); enableDepthTest(); if (ConfigManager.alwaysVisible.get()) { - GlStateManager.clear(GL11.GL_DEPTH_BUFFER_BIT, MinecraftClient.IS_SYSTEM_MAC); + RenderSystem.clear(GL11.GL_DEPTH_BUFFER_BIT, MinecraftClient.IS_SYSTEM_MAC); } } + public static void setTexture(Identifier texture) { + RenderSystem.setShader(GameRenderer::getPositionTexColorShader); + RenderSystem.setShaderTexture(0, texture); + } + public static void afterRender() { polygonModeFill(); - GlStateManager.enableCull(); + RenderSystem.enableCull(); enableTexture(); } public static void beforeRenderFont(OffsetPoint offsetPoint) { - GlStateManager.pushMatrix(); + // RenderSystem.pushMatrix(); polygonModeFill(); - GlStateManager.translated(offsetPoint.getX(), offsetPoint.getY() + 0.002D, offsetPoint.getZ()); - GlStateManager.normal3f(0.0F, 1.0F, 0.0F); - GlStateManager.rotatef(0.0F, 0.0F, 1.0F, 0.0F); - GlStateManager.rotatef(90.0F, 1.0F, 0.0F, 0.0F); - GlStateManager.scalef(-0.0175F, -0.0175F, 0.0175F); + //RenderSystem.translated(offsetPoint.getX(), offsetPoint.getY() + 0.002D, offsetPoint.getZ()); + //RenderSystem.normal3f(0.0F, 1.0F, 0.0F); + //RenderSystem.rotatef(0.0F, 0.0F, 1.0F, 0.0F); + //RenderSystem.rotatef(90.0F, 1.0F, 0.0F, 0.0F); + //RenderSystem.scalef(-0.0175F, -0.0175F, 0.0175F); enableTexture(); enableBlend(); - GlStateManager.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); + RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); depthMaskTrue(); } @@ -48,56 +56,52 @@ public class RenderHelper { public static void afterRenderFont() { disableTexture(); disableBlend(); - GlStateManager.popMatrix(); + //RenderSystem.popMatrix(); enableDepthTest(); } public static void disableLighting() { - GlStateManager.disableLighting(); + //RenderSystem.disableLighting(); } public static void disableDepthTest() { - GlStateManager.disableDepthTest(); + RenderSystem.disableDepthTest(); } public static void enableDepthTest() { - GlStateManager.enableDepthTest(); - } - - public static void disableFog() { - GlStateManager.disableFog(); + RenderSystem.enableDepthTest(); } public static void disableBlend() { - GlStateManager.disableBlend(); + RenderSystem.disableBlend(); } public static void enableBlend() { - GlStateManager.enableBlend(); + RenderSystem.enableBlend(); } public static void disableAlphaTest() { - GlStateManager.disableAlphaTest(); + //RenderSystem.disableAlphaTest(); } public static void enableAlphaTest() { - GlStateManager.enableAlphaTest(); + //RenderSystem.enableAlphaTest(); } public static void disableTexture() { - GlStateManager.disableTexture(); + RenderSystem.disableTexture(); } public static void enableTexture() { - GlStateManager.enableTexture(); + RenderSystem.enableTexture(); } public static void shadeModelSmooth() { - GlStateManager.shadeModel(GL11.GL_SMOOTH); + //RenderSystem.shadeModel(GL11.GL_SMOOTH); } public static void shadeModelFlat() { - GlStateManager.shadeModel(GL11.GL_FLAT); + //RenderSystem.shadeModel(GL11.GL_FLAT); } public static void enablePointSmooth() { @@ -105,27 +109,27 @@ public class RenderHelper { } public static void lineWidth2() { - GlStateManager.lineWidth(2f); + RenderSystem.lineWidth(2f); } public static void polygonModeLine() { - GlStateManager.polygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); + RenderSystem.polygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); } public static void polygonModeFill() { - GlStateManager.polygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); + RenderSystem.polygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); } public static void polygonOffsetMinusOne() { - GlStateManager.polygonOffset(-1.f, -1.f); + RenderSystem.polygonOffset(-1.f, -1.f); } public static void enablePolygonOffsetLine() { - GlStateManager.enableLineOffset(); + //RenderSystem.enableLineOffset(); } public static void depthMaskTrue() { - GlStateManager.depthMask(true); + RenderSystem.depthMask(true); } public static void pointSize5() { @@ -133,14 +137,14 @@ public class RenderHelper { } public static void blendFuncGui() { - GlStateManager.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ZERO, GL11.GL_ONE); + RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ZERO, GL11.GL_ONE); } public static void depthFuncAlways() { - GlStateManager.depthFunc(GL11.GL_ALWAYS); + RenderSystem.depthFunc(GL11.GL_ALWAYS); } public static void depthFuncLessEqual() { - GlStateManager.depthFunc(GL11.GL_LEQUAL); + RenderSystem.depthFunc(GL11.GL_LEQUAL); } } diff --git a/src/main/java/com/irtimaled/bbor/client/renderers/Renderer.java b/src/main/java/com/irtimaled/bbor/client/renderers/Renderer.java index 104eda4..b554000 100644 --- a/src/main/java/com/irtimaled/bbor/client/renderers/Renderer.java +++ b/src/main/java/com/irtimaled/bbor/client/renderers/Renderer.java @@ -12,23 +12,23 @@ public class Renderer { private final int glMode; static Renderer startLines() { - return new Renderer(RenderHelper.LINES, VertexFormats.POSITION_COLOR); + return new Renderer(VertexFormat.DrawMode.LINES, VertexFormats.POSITION_COLOR); } static Renderer startLineLoop() { - return new Renderer(RenderHelper.LINE_LOOP, VertexFormats.POSITION_COLOR); + return new Renderer(VertexFormat.DrawMode.LINES, VertexFormats.POSITION_COLOR); } static Renderer startQuads() { - return new Renderer(RenderHelper.QUADS, VertexFormats.POSITION_COLOR); + return new Renderer(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR); } static Renderer startPoints() { - return new Renderer(RenderHelper.POINTS, VertexFormats.POSITION_COLOR); + return new Renderer(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION_COLOR); } public static Renderer startTextured() { - return new Renderer(RenderHelper.QUADS, VertexFormats.POSITION_TEXTURE_COLOR); + return new Renderer(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR); } private static final Tessellator tessellator = new Tessellator(2097152); @@ -39,9 +39,9 @@ public class Renderer { private int blue; private int alpha; - private Renderer(int glMode, VertexFormat vertexFormat) { + private Renderer(VertexFormat.DrawMode glMode, VertexFormat vertexFormat) { bufferBuilder.begin(glMode, vertexFormat); - this.glMode = glMode; + this.glMode = glMode.mode; } public Renderer setColor(Color color) { @@ -90,7 +90,7 @@ public class Renderer { public void render() { if (glMode == RenderHelper.QUADS) { - bufferBuilder.sortQuads((float) Camera.getX(), (float) Camera.getY(), (float) Camera.getZ()); + bufferBuilder.setCameraPosition((float) Camera.getX(), (float) Camera.getY(), (float) Camera.getZ()); } tessellator.draw(); } diff --git a/src/main/java/com/irtimaled/bbor/common/StructureProcessor.java b/src/main/java/com/irtimaled/bbor/common/StructureProcessor.java index 86c7dba..29ba726 100644 --- a/src/main/java/com/irtimaled/bbor/common/StructureProcessor.java +++ b/src/main/java/com/irtimaled/bbor/common/StructureProcessor.java @@ -27,7 +27,9 @@ class StructureProcessor { private void addStructures(BoundingBoxType type, StructureStart structureStart) { if (structureStart == null) return; - BlockBox bb = structureStart.getBoundingBox(); + if (structureStart.hasNoChildren()) return; + + BlockBox bb = structureStart.setBoundingBoxFromChildren(); if (bb == null) return; AbstractBoundingBox boundingBox = buildStructure(bb, type); @@ -41,8 +43,8 @@ class StructureProcessor { } private AbstractBoundingBox buildStructure(BlockBox bb, BoundingBoxType type) { - Coords min = new Coords(bb.minX, bb.minY, bb.minZ); - Coords max = new Coords(bb.maxX, bb.maxY, bb.maxZ); + Coords min = new Coords(bb.getMinX(), bb.getMinY(), bb.getMinZ()); + Coords max = new Coords(bb.getMaxX(), bb.getMaxY(), bb.getMaxZ()); return BoundingBoxCuboid.from(min, max, type); } diff --git a/src/main/java/com/irtimaled/bbor/common/interop/CommonInterop.java b/src/main/java/com/irtimaled/bbor/common/interop/CommonInterop.java index 21aebc1..1bf7448 100644 --- a/src/main/java/com/irtimaled/bbor/common/interop/CommonInterop.java +++ b/src/main/java/com/irtimaled/bbor/common/interop/CommonInterop.java @@ -48,10 +48,10 @@ public class CommonInterop { } public static void playerLoggedOut(ServerPlayerEntity player) { - EventBus.publish(new PlayerLoggedOut(player.getEntityId())); + EventBus.publish(new PlayerLoggedOut(player.getId())); } public static void playerSubscribed(ServerPlayerEntity player) { - EventBus.publish(new PlayerSubscribed(player.getEntityId(), new ServerPlayer(player))); + EventBus.publish(new PlayerSubscribed(player.getId(), new ServerPlayer(player))); } } diff --git a/src/main/java/com/irtimaled/bbor/mixin/client/MixinGameSettings.java b/src/main/java/com/irtimaled/bbor/mixin/client/MixinGameSettings.java index 96b81d2..fc3691a 100644 --- a/src/main/java/com/irtimaled/bbor/mixin/client/MixinGameSettings.java +++ b/src/main/java/com/irtimaled/bbor/mixin/client/MixinGameSettings.java @@ -2,8 +2,8 @@ package com.irtimaled.bbor.mixin.client; import com.irtimaled.bbor.client.ClientProxy; import com.irtimaled.bbor.client.keyboard.KeyListener; -import net.minecraft.client.options.GameOptions; -import net.minecraft.client.options.KeyBinding; +import net.minecraft.client.option.GameOptions; +import net.minecraft.client.option.KeyBinding; import org.apache.commons.lang3.ArrayUtils; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; diff --git a/src/main/java/com/irtimaled/bbor/mixin/client/gui/screen/MixinOptionsScreen.java b/src/main/java/com/irtimaled/bbor/mixin/client/gui/screen/MixinOptionsScreen.java index bb03b7a..3edd212 100644 --- a/src/main/java/com/irtimaled/bbor/mixin/client/gui/screen/MixinOptionsScreen.java +++ b/src/main/java/com/irtimaled/bbor/mixin/client/gui/screen/MixinOptionsScreen.java @@ -1,31 +1,49 @@ package com.irtimaled.bbor.mixin.client.gui.screen; +import com.google.common.collect.Lists; import com.irtimaled.bbor.client.gui.SettingsScreenButton; +import com.irtimaled.bbor.common.TypeHelper; +import net.minecraft.client.gui.Drawable; +import net.minecraft.client.gui.Element; +import net.minecraft.client.gui.Selectable; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.options.OptionsScreen; -import net.minecraft.client.gui.widget.AbstractButtonWidget; +import net.minecraft.client.gui.screen.option.OptionsScreen; +import net.minecraft.client.gui.widget.ClickableWidget; 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.CallbackInfo; +import java.util.List; + @Mixin(OptionsScreen.class) public class MixinOptionsScreen extends Screen { private MixinOptionsScreen() { super(null); } + private final List buttons = Lists.newArrayList(); + + @Override + protected T addDrawableChild(T drawableElement) { + ClickableWidget widget = TypeHelper.as(drawableElement, ClickableWidget.class); + if(widget != null) { + buttons.add(widget); + } + + return super.addDrawableChild(drawableElement); + } + @Inject(method = "init", at = @At("RETURN")) private void initGui(CallbackInfo ci) { //shuffle middle buttons up by 12 px to make space int top = this.height / 6 + 42; int bottom = this.height / 6 + 168; - for (AbstractButtonWidget button : buttons) { + for (ClickableWidget button : buttons) { if (button.y >= top && button.y < bottom) button.y -= 12; } SettingsScreenButton button = new SettingsScreenButton(this.width / 2 - 155, top + 84, 150, "BBOR", this); - this.buttons.add(this.buttons.size() - 1, button); - this.children.add(this.children.size() - 1, button); + this.addDrawableChild(button); } } diff --git a/src/main/java/com/irtimaled/bbor/mixin/client/settings/MixinKeyBinding.java b/src/main/java/com/irtimaled/bbor/mixin/client/settings/MixinKeyBinding.java index c539332..e0f63d0 100644 --- a/src/main/java/com/irtimaled/bbor/mixin/client/settings/MixinKeyBinding.java +++ b/src/main/java/com/irtimaled/bbor/mixin/client/settings/MixinKeyBinding.java @@ -1,7 +1,7 @@ package com.irtimaled.bbor.mixin.client.settings; import com.irtimaled.bbor.client.keyboard.KeyListener; -import net.minecraft.client.options.KeyBinding; +import net.minecraft.client.option.KeyBinding; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; diff --git a/src/main/java/com/irtimaled/bbor/mixin/resource/MixinResourcePackManager.java b/src/main/java/com/irtimaled/bbor/mixin/resource/MixinResourcePackManager.java index cc99033..78f2dce 100644 --- a/src/main/java/com/irtimaled/bbor/mixin/resource/MixinResourcePackManager.java +++ b/src/main/java/com/irtimaled/bbor/mixin/resource/MixinResourcePackManager.java @@ -1,10 +1,7 @@ package com.irtimaled.bbor.mixin.resource; import com.google.common.collect.ImmutableMap; -import net.minecraft.resource.DefaultResourcePack; -import net.minecraft.resource.ResourcePackManager; -import net.minecraft.resource.ResourcePackProfile; -import net.minecraft.resource.ResourcePackSource; +import net.minecraft.resource.*; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -28,7 +25,7 @@ public class MixinResourcePackManager { private void afterConstructor(CallbackInfo ci) { resourcePackProfile = ResourcePackProfile.of(BBOR, true, - () -> new DefaultResourcePack(BBOR), + () -> new DefaultResourcePack(VanillaDataPackProvider.DEFAULT_PACK_METADATA, BBOR), this.profileFactory, ResourcePackProfile.InsertionPosition.BOTTOM, ResourcePackSource.PACK_SOURCE_BUILTIN); diff --git a/src/main/resources/mixins.bbor.json b/src/main/resources/mixins.bbor.json index 340651a..f093cdc 100644 --- a/src/main/resources/mixins.bbor.json +++ b/src/main/resources/mixins.bbor.json @@ -1,7 +1,7 @@ { "required": true, "minVersion": "0.8", - "compatibilityLevel": "JAVA_8", + "compatibilityLevel": "JAVA_16", "target": "@env(DEFAULT)", "package": "com.irtimaled.bbor.mixin", "refmap": "mixins.bbor.refmap.json",