Update to 1.18

This commit is contained in:
Jozufozu 2021-12-06 21:29:21 -08:00
parent d179a68769
commit 46cbd76fb6
14 changed files with 26 additions and 29 deletions

View File

@ -31,11 +31,11 @@ version = "${mc_update_version}-${mod_version}" + (dev ? ".${buildnumber}" : '')
group = 'com.jozufozu.flywheel' group = 'com.jozufozu.flywheel'
archivesBaseName = 'flywheel-forge' archivesBaseName = 'flywheel-forge'
java.toolchain.languageVersion = JavaLanguageVersion.of(16) java.toolchain.languageVersion = JavaLanguageVersion.of(17)
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
minecraft { minecraft {
mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}" mappings channel: 'official', version: "${minecraft_version}" // TODO: waiting for parchment 1.18
runs { runs {
client { client {

View File

@ -3,9 +3,9 @@ org.gradle.daemon = false
# mod version info # mod version info
mod_version = 0.3.0 mod_version = 0.3.0
mc_update_version = 1.17 mc_update_version = 1.18
minecraft_version = 1.17.1 minecraft_version = 1.18
forge_version = 37.1.0 forge_version = 38.0.15
# build dependency versions # build dependency versions
forgegradle_version = 5.1.+ forgegradle_version = 5.1.+

View File

@ -4,7 +4,7 @@ import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.client.event.RenderLevelLastEvent;
import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
@ -15,7 +15,7 @@ public class RenderWork {
@SubscribeEvent(priority = EventPriority.LOWEST) @SubscribeEvent(priority = EventPriority.LOWEST)
public static void onRenderWorldLast(RenderWorldLastEvent event) { public static void onRenderWorldLast(RenderLevelLastEvent event) {
while (!runs.isEmpty()) { while (!runs.isEmpty()) {
runs.remove() runs.remove()
.run(); .run();

View File

@ -6,7 +6,7 @@ import com.mojang.brigadier.builder.ArgumentBuilder;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraftforge.fmllegacy.network.PacketDistributor; import net.minecraftforge.network.PacketDistributor;
public class BooleanConfigCommand { public class BooleanConfigCommand {

View File

@ -4,12 +4,12 @@ import com.mojang.brigadier.CommandDispatcher;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;
import net.minecraftforge.event.server.ServerStartingEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fmlserverevents.FMLServerStartingEvent;
public class FlwCommands { public class FlwCommands {
@SubscribeEvent @SubscribeEvent
public static void onServerStarting(FMLServerStartingEvent event) { public static void onServerStarting(ServerStartingEvent event) {
CommandDispatcher<CommandSourceStack> dispatcher = event.getServer() CommandDispatcher<CommandSourceStack> dispatcher = event.getServer()
.getCommands() .getCommands()
.getDispatcher(); .getDispatcher();

View File

@ -3,9 +3,9 @@ package com.jozufozu.flywheel.config;
import com.jozufozu.flywheel.Flywheel; import com.jozufozu.flywheel.Flywheel;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.fmllegacy.network.NetworkDirection; import net.minecraftforge.network.NetworkDirection;
import net.minecraftforge.fmllegacy.network.NetworkRegistry; import net.minecraftforge.network.NetworkRegistry;
import net.minecraftforge.fmllegacy.network.simple.SimpleChannel; import net.minecraftforge.network.simple.SimpleChannel;
public class FlwPackets { public class FlwPackets {
public static final ResourceLocation CHANNEL_NAME = new ResourceLocation(Flywheel.ID, "network"); public static final ResourceLocation CHANNEL_NAME = new ResourceLocation(Flywheel.ID, "network");

View File

@ -4,7 +4,7 @@ package com.jozufozu.flywheel.config;
import java.util.function.Supplier; import java.util.function.Supplier;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraftforge.fmllegacy.network.NetworkEvent; import net.minecraftforge.network.NetworkEvent;
/** /**
* Thanks, @zelophed * Thanks, @zelophed

View File

@ -8,7 +8,7 @@ import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.ForgeModelBakery;
/** /**
* A helper class for loading and accessing json models. * A helper class for loading and accessing json models.
@ -38,7 +38,7 @@ public class PartialModel {
public static void onModelRegistry(ModelRegistryEvent event) { public static void onModelRegistry(ModelRegistryEvent event) {
for (PartialModel partial : ALL) for (PartialModel partial : ALL)
ModelLoader.addSpecialModel(partial.getLocation()); ForgeModelBakery.addSpecialModel(partial.getLocation());
tooLate = true; tooLate = true;
} }

View File

@ -29,7 +29,7 @@ public class StitchedSprite {
} }
public static void onTextureStitchPre(TextureStitchEvent.Pre event) { public static void onTextureStitchPre(TextureStitchEvent.Pre event) {
ResourceLocation atlasLocation = event.getMap().location(); ResourceLocation atlasLocation = event.getAtlas().location();
List<StitchedSprite> sprites = ALL.get(atlasLocation); List<StitchedSprite> sprites = ALL.get(atlasLocation);
if (sprites != null) { if (sprites != null) {
for (StitchedSprite sprite : sprites) { for (StitchedSprite sprite : sprites) {
@ -39,7 +39,7 @@ public class StitchedSprite {
} }
public static void onTextureStitchPost(TextureStitchEvent.Post event) { public static void onTextureStitchPost(TextureStitchEvent.Post event) {
TextureAtlas atlas = event.getMap(); TextureAtlas atlas = event.getAtlas();
ResourceLocation atlasLocation = atlas.location(); ResourceLocation atlasLocation = atlas.location();
List<StitchedSprite> sprites = ALL.get(atlasLocation); List<StitchedSprite> sprites = ALL.get(atlasLocation);
if (sprites != null) { if (sprites != null) {

View File

@ -34,7 +34,7 @@ public class ModelUtil {
BufferBuilder builder = new BufferBuilder(DefaultVertexFormat.BLOCK.getIntegerSize()); BufferBuilder builder = new BufferBuilder(DefaultVertexFormat.BLOCK.getIntegerSize());
builder.begin(QUADS, DefaultVertexFormat.BLOCK); builder.begin(QUADS, DefaultVertexFormat.BLOCK);
ForgeHooksClient.setRenderLayer(layer); ForgeHooksClient.setRenderType(layer);
ModelBlockRenderer.enableCaching(); ModelBlockRenderer.enableCaching();
for (StructureTemplate.StructureBlockInfo info : blocks) { for (StructureTemplate.StructureBlockInfo info : blocks) {
BlockState state = info.state; BlockState state = info.state;
@ -53,7 +53,7 @@ public class ModelUtil {
ms.popPose(); ms.popPose();
} }
ModelBlockRenderer.clearCache(); ModelBlockRenderer.clearCache();
ForgeHooksClient.setRenderLayer(null); ForgeHooksClient.setRenderType(null);
builder.end(); builder.end();
return builder; return builder;

View File

@ -46,8 +46,8 @@ public class RenderHooksMixin {
private RenderBuffers renderBuffers; private RenderBuffers renderBuffers;
@Inject(at = @At("HEAD"), method = "setupRender") @Inject(at = @At("HEAD"), method = "setupRender")
private void setupRender(Camera info, Frustum clippingHelper, boolean p_228437_3_, int frameCount, boolean isSpectator, CallbackInfo ci) { private void setupRender(Camera camera, Frustum frustum, boolean queue, boolean isSpectator, CallbackInfo ci) {
MinecraftForge.EVENT_BUS.post(new BeginFrameEvent(level, info, clippingHelper)); MinecraftForge.EVENT_BUS.post(new BeginFrameEvent(level, camera, frustum));
} }
/** /**

View File

@ -16,7 +16,7 @@ import net.minecraft.network.protocol.game.ClientboundLightUpdatePacket;
@Mixin(ClientPacketListener.class) @Mixin(ClientPacketListener.class)
public class NetworkLightUpdateMixin { public class NetworkLightUpdateMixin {
@Inject(at = @At("TAIL"), method = "handleLightUpdatePacked") @Inject(at = @At("TAIL"), method = "handleLightUpdatePacket")
private void onLightPacket(ClientboundLightUpdatePacket packet, CallbackInfo ci) { private void onLightPacket(ClientboundLightUpdatePacket packet, CallbackInfo ci) {
RenderWork.enqueue(() -> { RenderWork.enqueue(() -> {
ClientLevel world = Minecraft.getInstance().level; ClientLevel world = Minecraft.getInstance().level;

View File

@ -11,11 +11,8 @@ import java.nio.channels.ReadableByteChannel;
import org.lwjgl.system.MemoryUtil; import org.lwjgl.system.MemoryUtil;
import com.mojang.blaze3d.systems.RenderSystem;
public class StreamUtil { public class StreamUtil {
public static String readToString(InputStream is) { public static String readToString(InputStream is) {
RenderSystem.assertThread(RenderSystem::isOnRenderThread);
ByteBuffer bytebuffer = null; ByteBuffer bytebuffer = null;
try { try {

View File

@ -1,5 +1,5 @@
modLoader = "javafml" modLoader = "javafml"
loaderVersion = "[37,)" loaderVersion = "[38,)"
issueTrackerURL = "https://github.com/Jozufozu/Flywheel/issues" issueTrackerURL = "https://github.com/Jozufozu/Flywheel/issues"
license = "MIT" license = "MIT"
@ -17,13 +17,13 @@ A modern engine for modded minecraft.
[[dependencies.flywheel]] [[dependencies.flywheel]]
modId = "forge" modId = "forge"
mandatory = true mandatory = true
versionRange = "[37,)" versionRange = "[38,)"
ordering = "NONE" ordering = "NONE"
side = "BOTH" side = "BOTH"
[[dependencies.flywheel]] [[dependencies.flywheel]]
modId = "minecraft" modId = "minecraft"
mandatory = true mandatory = true
versionRange = "[1.17,1.18)" versionRange = "[1.18,1.19)"
ordering = "NONE" ordering = "NONE"
side = "BOTH" side = "BOTH"