Fixed 1.19 building

This commit is contained in:
coolGi
2023-05-01 14:09:40 +09:30
parent 752eeeb7af
commit 268993e38c
5 changed files with 19 additions and 19 deletions
+1 -1
View File
@@ -120,7 +120,7 @@ https://fabricmc.net/wiki/tutorial:setup
4. Import the project into eclipse
## Switching Versions
This branch support 6 built versions:
This branch support 9 built versions:
- 1.19.4
- 1.19.3
- 1.19.2
@@ -27,7 +27,7 @@ import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
import net.minecraft.client.gui.screens.OptionsScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
#if PRE_MC_1_19_1
#if PRE_MC_1_19
import net.minecraft.network.chat.TranslatableComponent;
#endif
import net.minecraft.resources.ResourceLocation;
@@ -69,7 +69,7 @@ public class MixinOptionsScreen extends Screen {
// For now it goes to the client option by default
(buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(ConfigGui.getScreen(this, "client")),
// Add a title to the screen
#if PRE_MC_1_19_1
#if PRE_MC_1_19
new TranslatableComponent("text.autoconfig." + ModInfo.ID + ".title")));
#else
Component.translatable("text.autoconfig." + ModInfo.ID + ".title")));
@@ -35,7 +35,7 @@ import com.seibel.lod.common.wrappers.world.WorldWrapper;
import net.minecraft.client.Minecraft;
import net.minecraftforge.client.event.InputEvent;
import net.minecraftforge.event.TickEvent;
#if PRE_MC_1_19_1
#if PRE_MC_1_19
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.event.world.ChunkEvent;
import net.minecraftforge.event.world.WorldEvent;
@@ -70,7 +70,7 @@ public class ForgeClientProxy
@SubscribeEvent
public void chunkLoadEvent(ChunkEvent.Load event)
{
#if PRE_MC_1_19_1
#if PRE_MC_1_19
clientApi.clientChunkLoadEvent(new ChunkWrapper(event.getChunk(), event.getWorld()), WorldWrapper.getWorldWrapper(event.getWorld()));
#else
clientApi.clientChunkLoadEvent(new ChunkWrapper(event.getChunk(), event.getLevel()), WorldWrapper.getWorldWrapper(event.getLevel()));
@@ -78,7 +78,7 @@ public class ForgeClientProxy
}
@SubscribeEvent
#if PRE_MC_1_19_1
#if PRE_MC_1_19
public void worldSaveEvent(WorldEvent.Save event)
#else
public void worldSaveEvent(LevelEvent.Save event)
@@ -89,7 +89,7 @@ public class ForgeClientProxy
/** This is also called when a new dimension loads */
@SubscribeEvent
#if PRE_MC_1_19_1
#if PRE_MC_1_19
public void worldLoadEvent(WorldEvent.Load event)
#else
public void worldLoadEvent(LevelEvent.Load event)
@@ -97,7 +97,7 @@ public class ForgeClientProxy
{
if (Minecraft.getInstance().screen instanceof TitleScreen) return;
if (Minecraft.getInstance().getConnection() == null) return; // In 1.19.3, the multiplayer world load is called twice. The first time is before it actually connects to the multiplayer server (so stuff like ip and name arent sent out yet)
#if PRE_MC_1_19_1
#if PRE_MC_1_19
if (event.getWorld() != null) {
eventApi.worldLoadEvent(WorldWrapper.getWorldWrapper(event.getWorld()));
}
@@ -109,7 +109,7 @@ public class ForgeClientProxy
}
@SubscribeEvent
#if PRE_MC_1_19_1
#if PRE_MC_1_19
public void worldUnloadEvent(WorldEvent.Unload event)
{
eventApi.worldUnloadEvent(WorldWrapper.getWorldWrapper(event.getWorld()));
@@ -131,7 +131,7 @@ public class ForgeClientProxy
event.getClass() == BlockEvent.FluidPlaceBlockEvent.class ||
event.getClass() == BlockEvent.PortalSpawnEvent.class)
{
#if PRE_MC_1_19_1
#if PRE_MC_1_19
IChunkWrapper chunk = new ChunkWrapper(event.getWorld().getChunk(event.getPos()), event.getWorld());
DimensionTypeWrapper dimType = DimensionTypeWrapper.getDimensionTypeWrapper(event.getWorld().dimensionType());
#else
@@ -145,7 +145,7 @@ public class ForgeClientProxy
}
@SubscribeEvent
public void onKeyInput(#if PRE_MC_1_19_1 InputEvent.KeyInputEvent event #else InputEvent.Key event #endif)
public void onKeyInput(#if PRE_MC_1_19 InputEvent.KeyInputEvent event #else InputEvent.Key event #endif)
{
if (Minecraft.getInstance().player == null) return;
if (event.getAction() != GLFW.GLFW_PRESS) return;
@@ -49,14 +49,14 @@ import net.minecraftforge.fml.loading.FMLLoader;
import net.minecraftforge.fml.ExtensionPoint;
#elif MC_1_17_1
import net.minecraftforge.fmlclient.ConfigGuiHandler;
#elif POST_MC_1_19_1
#elif POST_MC_1_19
import net.minecraftforge.client.ConfigScreenHandler;
#else // 1.18+ untill 1.19
import net.minecraftforge.client.ConfigGuiHandler;
#endif
// these imports change due to forge refactoring classes in 1.19
#if POST_MC_1_19_1
#if POST_MC_1_19
import net.minecraft.util.RandomSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraftforge.client.model.data.ModelData;
@@ -109,7 +109,7 @@ public class ForgeMain implements LodForgeMethodCaller
#if PRE_MC_1_17_1
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY,
() -> (client, parent) -> ConfigGui.getScreen(parent, ""));
#elif POST_MC_1_19_1
#elif POST_MC_1_19
ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class,
() -> new ConfigScreenHandler.ConfigScreenFactory((client, parent) -> ConfigGui.getScreen(parent, "")));
#else
@@ -120,21 +120,21 @@ public class ForgeMain implements LodForgeMethodCaller
MinecraftForge.EVENT_BUS.register(forgeClientProxy);
}
#if PRE_MC_1_19_1
#if PRE_MC_1_19_
private final ModelDataMap modelData = new ModelDataMap.Builder().build();
#else
private final ModelData modelData = ModelData.EMPTY;
#endif
@Override
#if PRE_MC_1_19_1
#if PRE_MC_1_19
public List<BakedQuad> getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, Random random) {
return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, modelData);
}
#else
public List<BakedQuad> getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, RandomSource random)
{
return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, modelData #if POST_MC_1_19_1, RenderType.solid() #endif);
return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, modelData #if POST_MC_1_19, RenderType.solid() #endif);
}
#endif
@@ -27,7 +27,7 @@ import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
import net.minecraft.client.gui.screens.OptionsScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
#if PRE_MC_1_19_1
#if PRE_MC_1_19
import net.minecraft.network.chat.TranslatableComponent;
#endif
import net.minecraft.resources.ResourceLocation;
@@ -69,7 +69,7 @@ public class MixinOptionsScreen extends Screen {
// For now it goes to the client option by default
(buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(ConfigGui.getScreen(this, "client")),
// Add a title to the screen
#if PRE_MC_1_19_1
#if PRE_MC_1_19
new TranslatableComponent("text.autoconfig." + ModInfo.ID + ".title")));
#else
Component.translatable("text.autoconfig." + ModInfo.ID + ".title")));