diff --git a/build.gradle b/build.gradle index 8d073fa..21044e6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,6 @@ plugins { - id 'babric-loom' version '1.4.2' + id 'fabric-loom' version '1.8.12' + id 'babric-loom-extension' version '1.8.9' id 'maven-publish' } @@ -11,7 +12,6 @@ version = project.mod_version group = project.maven_group loom { - gluedMinecraftJar() customMinecraftManifest.set("https://babric.github.io/manifest-polyfill/${minecraft_version}.json") intermediaryUrl.set("https://maven.glass-launcher.net/babric/babric/intermediary/%1\$s/intermediary-%1\$s-v2.jar") } @@ -48,6 +48,7 @@ repositories { name = 'Jitpack' url = 'https://jitpack.io' } + // Used for another StationAPI dependency exclusiveContent { forRepository { maven { @@ -70,19 +71,26 @@ dependencies { implementation "org.slf4j:slf4j-api:1.8.0-beta4" implementation 'org.apache.logging.log4j:log4j-slf4j18-impl:2.17.2' + implementation(include("me.carleslc:Simple-Yaml:1.8.4") as Dependency) modImplementation "net.modificationstation:StationAPI:${project.stapi_version}" // Optional, but convenient mods for mod creators and users alike. - modImplementation("com.github.calmilamsy:ModMenu:${project.modmenu_version}") { + modImplementation("net.glasslauncher.mods:ModMenu:${project.modmenu_version}") { + transitive false + } + + modImplementation("net.glasslauncher.mods:glass-networking:${project.glass_networking_version}") { + transitive false + } + + modImplementation("net.glasslauncher.mods:GlassConfigAPI:${project.gcapi_version}") { + transitive false + } + + modImplementation("net.glasslauncher.mods:AlwaysMoreItems:${project.alwaysmoreitems_version}") { transitive false } -// modImplementation("net.glasslauncher.mods:GlassConfigAPI:${project.gcapi_version}") { -// transitive false -// } -// modImplementation("net.glasslauncher:HowManyItems-Fabric-Unofficial:${project.howmanyitems_version}") { -// transitive false -// } } processResources { @@ -127,4 +135,4 @@ publishing { // The repositories here will be used for publishing your artifact, not for // retrieving dependencies. } -} \ No newline at end of file +} diff --git a/gradle.properties b/gradle.properties index c99ee18..44915cb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,18 +5,19 @@ org.gradle.daemon=false # Fabric Properties # check these on https://fabricmc.net/develop minecraft_version=b1.7.3 -yarn_mappings=b1.7.3+a00e3b0 -loader_version=0.14.24-babric.1 +yarn_mappings=b1.7.3+c6a9668 +loader_version=0.15.6-babric.1 # Mod Properties -mod_version=1.1.5 +mod_version=1.1.6 maven_group=net.mine_diver archives_base_name=SmoothBeta # Dependencies -stapi_version=2.0-alpha.1 +stapi_version=2.0.0-alpha.3 # Extra Dependencies -gcapi_version=1.1.6 -howmanyitems_version=5.0.13 -modmenu_version=v1.8.5-beta.3 \ No newline at end of file +glass_networking_version=1.0.3 +gcapi_version=3.0.2 +alwaysmoreitems_version=1.4.0 +modmenu_version=1.8.5-beta.9 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e411586..e1adfb4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/net/mine_diver/smoothbeta/client/render/RenderRegion.java b/src/main/java/net/mine_diver/smoothbeta/client/render/RenderRegion.java index f71807b..3bdf604 100644 --- a/src/main/java/net/mine_diver/smoothbeta/client/render/RenderRegion.java +++ b/src/main/java/net/mine_diver/smoothbeta/client/render/RenderRegion.java @@ -3,33 +3,33 @@ import net.mine_diver.smoothbeta.client.render.gl.GlUniform; import net.mine_diver.smoothbeta.client.render.gl.VertexBuffer; import net.mine_diver.smoothbeta.mixin.client.multidraw.RenderListAccessor; -import net.minecraft.class_472; import net.minecraft.client.render.WorldRenderer; +import net.minecraft.client.render.world.ChunkRenderer; import net.modificationstation.stationapi.api.util.math.Vec3f; import java.nio.IntBuffer; import java.util.ArrayList; import java.util.List; -public class RenderRegion extends class_472 { +public class RenderRegion extends ChunkRenderer { private final RenderListAccessor _super = (RenderListAccessor) this; private final SmoothWorldRenderer stationWorldRenderer; private final List buffers = new ArrayList<>(); public RenderRegion(WorldRenderer worldRenderer) { - _super.smoothbeta_setField_2486(IntBuffer.allocate(0)); + _super.smoothbeta_setGlListBuffer(IntBuffer.allocate(0)); stationWorldRenderer = ((SmoothWorldRenderer) worldRenderer); } @Override - public void method_1912(int i, int j, int k, double d, double e, double f) { - super.method_1912(i, j, k, d, e, f); + public void init(int i, int j, int k, double d, double e, double f) { + super.init(i, j, k, d, e, f); buffers.clear(); } @Override - public void method_1910(int i) { + public void addGlList(int i) { throw new UnsupportedOperationException("Call lists can't be added to VBO regions!"); } @@ -37,11 +37,11 @@ public void addBuffer(VertexBuffer buffer) { buffers.add(buffer); } - public void method_1909() { - if (!_super.smoothbeta_getField_2487() || buffers.isEmpty()) return; + public void render() { + if (!_super.smoothbeta_getInitialized() || buffers.isEmpty()) return; Shader shader = Shaders.getTerrainShader(); GlUniform chunkOffset = shader.chunkOffset; - chunkOffset.set(_super.smoothbeta_getField_2480() - _super.smoothbeta_getField_2483(), _super.smoothbeta_getField_2481() - _super.smoothbeta_getField_2484(), _super.smoothbeta_getField_2482() - _super.smoothbeta_getField_2485()); + chunkOffset.set(_super.smoothbeta_getX() - _super.smoothbeta_getOffsetX(), _super.smoothbeta_getY() - _super.smoothbeta_getOffsetY(), _super.smoothbeta_getZ() - _super.smoothbeta_getOffsetZ()); chunkOffset.upload(); for (VertexBuffer vertexBuffer : buffers) vertexBuffer.uploadToPool(); stationWorldRenderer.smoothbeta_getTerrainVboPool().drawAll(); diff --git a/src/main/java/net/mine_diver/smoothbeta/client/render/VboPool.java b/src/main/java/net/mine_diver/smoothbeta/client/render/VboPool.java index 1c254e9..31fe24e 100644 --- a/src/main/java/net/mine_diver/smoothbeta/client/render/VboPool.java +++ b/src/main/java/net/mine_diver/smoothbeta/client/render/VboPool.java @@ -10,6 +10,7 @@ import java.nio.ByteBuffer; import java.nio.IntBuffer; +@SuppressWarnings("removal") public class VboPool implements AutoCloseable { @SuppressWarnings("deprecation") private static final MinecraftAccessor mc = ((MinecraftAccessor) FabricLoader.getInstance().getGameInstance()); diff --git a/src/main/java/net/mine_diver/smoothbeta/mixin/MixinServerChunkCache.java b/src/main/java/net/mine_diver/smoothbeta/mixin/MixinServerChunkCache.java index 3d278db..f29e167 100644 --- a/src/main/java/net/mine_diver/smoothbeta/mixin/MixinServerChunkCache.java +++ b/src/main/java/net/mine_diver/smoothbeta/mixin/MixinServerChunkCache.java @@ -2,12 +2,12 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import net.minecraft.class_243; -import net.minecraft.class_326; -import net.minecraft.class_43; -import net.minecraft.class_51; import net.minecraft.util.math.ChunkPos; import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.ChunkCache; +import net.minecraft.world.chunk.ChunkSource; +import net.minecraft.world.chunk.storage.ChunkStorage; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Overwrite; import org.spongepowered.asm.mixin.Shadow; @@ -18,23 +18,23 @@ import java.util.Map; -@Mixin(class_326.class) +@Mixin(ChunkCache.class) abstract class MixinServerChunkCache { - @Shadow private Map field_1229; + @Shadow private Map chunkByPos; - @Shadow public abstract class_43 method_1807(int chunkX, int chunkZ); + @Shadow public abstract Chunk loadChunk(int chunkX, int chunkZ); @Unique - private Int2ObjectMap smoothbeta$serverChunkCache; + private Int2ObjectMap smoothbeta$serverChunkCache; @Inject( method = "", at = @At("RETURN") ) - private void getMap(World level, class_243 arg1, class_51 arg2, CallbackInfo ci) { + private void getMap(World level, ChunkStorage arg1, ChunkSource arg2, CallbackInfo ci) { smoothbeta$serverChunkCache = new Int2ObjectOpenHashMap<>(); - field_1229 = smoothbeta$serverChunkCache; + chunkByPos = smoothbeta$serverChunkCache; } // TODO: replace with ASM @@ -43,7 +43,7 @@ private void getMap(World level, class_243 arg1, class_51 arg2, CallbackInfo ci) * @author mine_diver */ @Overwrite - public boolean method_1802(int chunkX, int chunkZ) { + public boolean isChunkLoaded(int chunkX, int chunkZ) { return smoothbeta$serverChunkCache.containsKey(ChunkPos.hashCode(chunkX, chunkZ)); } @@ -53,8 +53,8 @@ public boolean method_1802(int chunkX, int chunkZ) { * @author mine_diver */ @Overwrite - public class_43 method_1806(int chunkX, int chunkZ) { - class_43 var3 = smoothbeta$serverChunkCache.get(ChunkPos.hashCode(chunkX, chunkZ)); - return var3 == null ? method_1807(chunkX, chunkZ) : var3; + public Chunk getChunk(int chunkX, int chunkZ) { + Chunk var3 = smoothbeta$serverChunkCache.get(ChunkPos.hashCode(chunkX, chunkZ)); + return var3 == null ? loadChunk(chunkX, chunkZ) : var3; } } diff --git a/src/main/java/net/mine_diver/smoothbeta/mixin/client/MixinTileEntityRenderDispatcher.java b/src/main/java/net/mine_diver/smoothbeta/mixin/client/MixinTileEntityRenderDispatcher.java index 9e4c3ac..91941be 100644 --- a/src/main/java/net/mine_diver/smoothbeta/mixin/client/MixinTileEntityRenderDispatcher.java +++ b/src/main/java/net/mine_diver/smoothbeta/mixin/client/MixinTileEntityRenderDispatcher.java @@ -15,17 +15,17 @@ @Mixin(BlockEntityRenderDispatcher.class) class MixinTileEntityRenderDispatcher { - @Shadow private Map, BlockEntityRenderer> field_1564; + @Shadow private Map, BlockEntityRenderer> renderers; @Redirect( method = "()V", at = @At( value = "FIELD", - target = "Lnet/minecraft/client/render/block/entity/BlockEntityRenderDispatcher;field_1564:Ljava/util/Map;", + target = "Lnet/minecraft/client/render/block/entity/BlockEntityRenderDispatcher;renderers:Ljava/util/Map;", opcode = Opcodes.PUTFIELD ) ) private void overrideMap(BlockEntityRenderDispatcher instance, Map, BlockEntityRenderer> value) { - field_1564 = new IdentityHashMap<>(); + renderers = new IdentityHashMap<>(); } } diff --git a/src/main/java/net/mine_diver/smoothbeta/mixin/client/multidraw/ChunkRendererMixin.java b/src/main/java/net/mine_diver/smoothbeta/mixin/client/multidraw/ChunkRendererMixin.java index c9ae9bc..6e9aa65 100644 --- a/src/main/java/net/mine_diver/smoothbeta/mixin/client/multidraw/ChunkRendererMixin.java +++ b/src/main/java/net/mine_diver/smoothbeta/mixin/client/multidraw/ChunkRendererMixin.java @@ -7,11 +7,11 @@ import net.mine_diver.smoothbeta.client.render.VboPool; import net.mine_diver.smoothbeta.client.render.gl.VertexBuffer; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.class_42; import net.minecraft.client.Minecraft; import net.minecraft.client.render.Tessellator; import net.minecraft.client.render.block.BlockRenderManager; import net.minecraft.client.render.chunk.ChunkBuilder; +import net.minecraft.world.WorldRegion; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; @@ -69,7 +69,7 @@ private void smoothbeta_init(CallbackInfo ci) { ) private void smoothbeta_startRenderingTerrain( CallbackInfo ci, - int var1, int var2, int var3, int var4, int var5, int var6, HashSet var7, int var8, class_42 var9, BlockRenderManager var10, int var11 + int var1, int var2, int var3, int var4, int var5, int var6, HashSet var7, int var8, WorldRegion var9, BlockRenderManager var10, int var11 ) { smoothbeta_currentBufferIndex = var11; ((SmoothTessellator) tessellator).smoothbeta_startRenderingTerrain(this); diff --git a/src/main/java/net/mine_diver/smoothbeta/mixin/client/multidraw/RenderListAccessor.java b/src/main/java/net/mine_diver/smoothbeta/mixin/client/multidraw/RenderListAccessor.java index 05d1376..141078b 100644 --- a/src/main/java/net/mine_diver/smoothbeta/mixin/client/multidraw/RenderListAccessor.java +++ b/src/main/java/net/mine_diver/smoothbeta/mixin/client/multidraw/RenderListAccessor.java @@ -1,34 +1,34 @@ package net.mine_diver.smoothbeta.mixin.client.multidraw; -import net.minecraft.class_472; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; import java.nio.IntBuffer; +import net.minecraft.client.render.world.ChunkRenderer; -@Mixin(class_472.class) +@Mixin(ChunkRenderer.class) public interface RenderListAccessor { - @Accessor("field_2486") - void smoothbeta_setField_2486(IntBuffer buffer); + @Accessor("glListBuffer") + void smoothbeta_setGlListBuffer(IntBuffer buffer); - @Accessor("field_2487") - boolean smoothbeta_getField_2487(); + @Accessor("initialized") + boolean smoothbeta_getInitialized(); - @Accessor("field_2480") - int smoothbeta_getField_2480(); + @Accessor("x") + int smoothbeta_getX(); - @Accessor("field_2481") - int smoothbeta_getField_2481(); + @Accessor("y") + int smoothbeta_getY(); - @Accessor("field_2482") - int smoothbeta_getField_2482(); + @Accessor("z") + int smoothbeta_getZ(); - @Accessor("field_2483") - float smoothbeta_getField_2483(); + @Accessor("offsetX") + float smoothbeta_getOffsetX(); - @Accessor("field_2484") - float smoothbeta_getField_2484(); + @Accessor("offsetY") + float smoothbeta_getOffsetY(); - @Accessor("field_2485") - float smoothbeta_getField_2485(); + @Accessor("offsetZ") + float smoothbeta_getOffsetZ(); } diff --git a/src/main/java/net/mine_diver/smoothbeta/mixin/client/multidraw/WorldRendererMixin.java b/src/main/java/net/mine_diver/smoothbeta/mixin/client/multidraw/WorldRendererMixin.java index a1a11ac..3dc6e10 100644 --- a/src/main/java/net/mine_diver/smoothbeta/mixin/client/multidraw/WorldRendererMixin.java +++ b/src/main/java/net/mine_diver/smoothbeta/mixin/client/multidraw/WorldRendererMixin.java @@ -1,9 +1,9 @@ package net.mine_diver.smoothbeta.mixin.client.multidraw; import net.mine_diver.smoothbeta.client.render.*; -import net.minecraft.class_472; import net.minecraft.client.render.WorldRenderer; import net.minecraft.client.render.chunk.ChunkBuilder; +import net.minecraft.client.render.world.ChunkRenderer; import net.minecraft.client.util.GlAllocationUtils; import net.minecraft.entity.LivingEntity; import org.lwjgl.opengl.GL11; @@ -24,7 +24,7 @@ @Mixin(WorldRenderer.class) abstract class WorldRendererMixin implements SmoothWorldRenderer { - @Shadow private class_472[] field_1794; + @Shadow private ChunkRenderer[] field_1794; @Unique private VboPool smoothbeta_vboPool; @@ -36,7 +36,7 @@ public VboPool smoothbeta_getTerrainVboPool() { } @Inject( - method = "method_1537()V", + method = "reload()V", at = @At("HEAD") ) private void smoothbeta_resetVboPool(CallbackInfo ci) { @@ -49,18 +49,18 @@ private void smoothbeta_resetVboPool(CallbackInfo ci) { method = "", at = @At( value = "NEW", - target = "()Lnet/minecraft/class_472;" + target = "()Lnet/minecraft/client/render/world/ChunkRenderer;" ) ) - private class_472 smoothbeta_injectRenderRegion() { + private ChunkRenderer smoothbeta_injectRenderRegion() { return new RenderRegion((WorldRenderer) (Object) this); } @Inject( - method = "method_1542(IIID)I", + method = "renderChunks(IIID)I", at = @At( value = "INVOKE", - target = "Lnet/minecraft/class_472;method_1910(I)V", + target = "Lnet/minecraft/client/render/world/ChunkRenderer;addGlList(I)V", shift = At.Shift.BEFORE ), locals = LocalCapture.CAPTURE_FAILHARD @@ -70,13 +70,13 @@ private void smoothbeta_addBufferToRegion(int j, int k, int d, double par4, Call } @Redirect( - method = "method_1542(IIID)I", + method = "renderChunks(IIID)I", at = @At( value = "INVOKE", - target = "Lnet/minecraft/class_472;method_1910(I)V" + target = "Lnet/minecraft/client/render/world/ChunkRenderer;addGlList(I)V" ) ) - private void smoothbeta_stopCallingRenderList(class_472 instance, int i) {} + private void smoothbeta_stopCallingRenderList(ChunkRenderer instance, int i) {} @Unique private final FloatBuffer @@ -84,7 +84,7 @@ private void smoothbeta_stopCallingRenderList(class_472 instance, int i) {} smoothbeta_projectionMatrix = GlAllocationUtils.allocateFloatBuffer(16); @Inject( - method = "method_1540(ID)V", + method = "renderLastChunks(ID)V", at = @At("HEAD") ) public void smoothbeta_beforeRenderRegion(int d, double par2, CallbackInfo ci) { @@ -109,7 +109,7 @@ public void smoothbeta_beforeRenderRegion(int d, double par2, CallbackInfo ci) { } @Inject( - method = "method_1540(ID)V", + method = "renderLastChunks(ID)V", at = @At("RETURN") ) public void smoothbeta_afterRenderRegion(int d, double par2, CallbackInfo ci) { diff --git a/src/main/java/net/mine_diver/smoothbeta/mixin/entity/compat/stationentities/EntityRegisterEventMixin.java b/src/main/java/net/mine_diver/smoothbeta/mixin/entity/compat/stationentities/EntityRegisterEventMixin.java index 2a65e18..f17a37d 100644 --- a/src/main/java/net/mine_diver/smoothbeta/mixin/entity/compat/stationentities/EntityRegisterEventMixin.java +++ b/src/main/java/net/mine_diver/smoothbeta/mixin/entity/compat/stationentities/EntityRegisterEventMixin.java @@ -1,14 +1,11 @@ package net.mine_diver.smoothbeta.mixin.entity.compat.stationentities; import net.mine_diver.smoothbeta.entity.SmoothEntityRegistry; -import net.minecraft.entity.Entity; import net.modificationstation.stationapi.api.event.entity.EntityRegister; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyVariable; -import java.util.function.BiConsumer; - @Mixin(EntityRegister.EntityRegisterBuilder.class) public class EntityRegisterEventMixin { @ModifyVariable( @@ -18,7 +15,7 @@ public class EntityRegisterEventMixin { argsOnly = true, remap = false ) - private BiConsumer, String> smoothbeta_registerNoID(BiConsumer, String> registerNoID) { - return registerNoID.andThen(SmoothEntityRegistry::registerNoID); + private EntityRegister.RegisterFunctionNoId smoothbeta_registerNoID(EntityRegister.RegisterFunctionNoId value) { + return SmoothEntityRegistry::registerNoID; } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index d8c0b01..52f411e 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,6 +33,6 @@ "depends": { "minecraft": "1.0.0-beta.7.3", - "stationapi": ">=2.0-alpha.1" + "stationapi": ">=2.0.0-alpha.3" } }