Merge branch 'main' of https://gitlab.com/jeseibel/distant-horizons
This commit is contained in:
+78
-46
@@ -28,16 +28,11 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker
|
||||
import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector;
|
||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.dedicated.DedicatedServer;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
#if MC_VER >= MC_1_19_2
|
||||
import net.minecraft.network.chat.Component;
|
||||
#else // < 1.19.2
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
#endif
|
||||
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.util.HashMap;
|
||||
import java.util.function.BiFunction;
|
||||
@@ -50,17 +45,34 @@ import static com.mojang.brigadier.arguments.IntegerArgumentType.integer;
|
||||
import static net.minecraft.commands.Commands.argument;
|
||||
import static net.minecraft.commands.Commands.literal;
|
||||
|
||||
#if MC_VER >= MC_1_19_2
|
||||
import net.minecraft.network.chat.Component;
|
||||
#else // < 1.19.2
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Base for all mod loader initializers
|
||||
* and handles most setup.
|
||||
*/
|
||||
public abstract class AbstractModInitializer
|
||||
{
|
||||
protected static final Logger LOGGER = DhLoggerBuilder.getLogger(MethodHandles.lookup().lookupClass().getSimpleName());
|
||||
|
||||
private CommandDispatcher<CommandSourceStack> commandDispatcher;
|
||||
|
||||
|
||||
|
||||
//==================//
|
||||
// abstract methods //
|
||||
//==================//
|
||||
|
||||
protected abstract void createInitialBindings();
|
||||
protected abstract IEventProxy createClientProxy();
|
||||
protected abstract IEventProxy createServerProxy(boolean isDedicated);
|
||||
protected abstract void initializeModCompat();
|
||||
|
||||
protected abstract void subscribeRegisterCommandsEvent(Consumer<CommandDispatcher<CommandSourceStack>> eventHandler);
|
||||
private CommandDispatcher<CommandSourceStack> commandDispatcher;
|
||||
|
||||
protected abstract void subscribeClientStartedEvent(Runnable eventHandler);
|
||||
protected abstract void subscribeServerStartingEvent(Consumer<MinecraftServer> eventHandler);
|
||||
@@ -68,41 +80,9 @@ public abstract class AbstractModInitializer
|
||||
|
||||
|
||||
|
||||
private void startup()
|
||||
{
|
||||
DependencySetup.createSharedBindings();
|
||||
SharedApi.init();
|
||||
this.createInitialBindings();
|
||||
}
|
||||
|
||||
private void printModInfo(boolean printGitInfo)
|
||||
{
|
||||
LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION);
|
||||
|
||||
if (printGitInfo)
|
||||
{
|
||||
// Useful for dev builds
|
||||
LOGGER.info("DH Branch: " + ModJarInfo.Git_Branch);
|
||||
LOGGER.info("DH Commit: " + ModJarInfo.Git_Commit);
|
||||
LOGGER.info("DH Jar Build Source: " + ModJarInfo.Build_Source);
|
||||
}
|
||||
}
|
||||
|
||||
protected <T extends IModAccessor> void tryCreateModCompatAccessor(String modId, Class<? super T> accessorClass, Supplier<T> accessorConstructor)
|
||||
{
|
||||
IModChecker modChecker = SingletonInjector.INSTANCE.get(IModChecker.class);
|
||||
if (modChecker.isModLoaded(modId))
|
||||
{
|
||||
//noinspection unchecked
|
||||
ModAccessorInjector.INSTANCE.bind((Class<? extends IModAccessor>) accessorClass, accessorConstructor.get());
|
||||
}
|
||||
}
|
||||
|
||||
private void initConfig()
|
||||
{
|
||||
ConfigBase.INSTANCE = new ConfigBase(ModInfo.ID, ModInfo.NAME, Config.class, 2);
|
||||
Config.completeDelayedSetup();
|
||||
}
|
||||
//===================//
|
||||
// initialize events //
|
||||
//===================//
|
||||
|
||||
public void onInitializeClient()
|
||||
{
|
||||
@@ -148,11 +128,10 @@ public abstract class AbstractModInitializer
|
||||
LOGGER.info(ModInfo.READABLE_NAME + " Initialized");
|
||||
ApiEventInjector.INSTANCE.fireAllEvents(DhApiAfterDhInitEvent.class, null);
|
||||
|
||||
this.subscribeRegisterCommandsEvent(dispatcher -> {
|
||||
this.commandDispatcher = dispatcher;
|
||||
});
|
||||
this.subscribeRegisterCommandsEvent(dispatcher -> { this.commandDispatcher = dispatcher; });
|
||||
|
||||
this.subscribeServerStartingEvent(server -> {
|
||||
this.subscribeServerStartingEvent(server ->
|
||||
{
|
||||
MinecraftDedicatedServerWrapper.INSTANCE.dedicatedServer = (DedicatedServer)server;
|
||||
|
||||
this.initConfig();
|
||||
@@ -163,6 +142,48 @@ public abstract class AbstractModInitializer
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
//===========================//
|
||||
// inner initializer methods //
|
||||
//===========================//
|
||||
|
||||
private void startup()
|
||||
{
|
||||
DependencySetup.createSharedBindings();
|
||||
SharedApi.init();
|
||||
this.createInitialBindings();
|
||||
}
|
||||
|
||||
private void printModInfo(boolean printGitInfo)
|
||||
{
|
||||
LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION);
|
||||
|
||||
if (printGitInfo)
|
||||
{
|
||||
// Useful for dev builds
|
||||
LOGGER.info("DH Branch: " + ModJarInfo.Git_Branch);
|
||||
LOGGER.info("DH Commit: " + ModJarInfo.Git_Commit);
|
||||
LOGGER.info("DH Jar Build Source: " + ModJarInfo.Build_Source);
|
||||
}
|
||||
}
|
||||
|
||||
protected <T extends IModAccessor> void tryCreateModCompatAccessor(String modId, Class<? super T> accessorClass, Supplier<T> accessorConstructor)
|
||||
{
|
||||
IModChecker modChecker = SingletonInjector.INSTANCE.get(IModChecker.class);
|
||||
if (modChecker.isModLoaded(modId))
|
||||
{
|
||||
//noinspection unchecked
|
||||
ModAccessorInjector.INSTANCE.bind((Class<? extends IModAccessor>) accessorClass, accessorConstructor.get());
|
||||
}
|
||||
}
|
||||
|
||||
private void initConfig()
|
||||
{
|
||||
ConfigBase.INSTANCE = new ConfigBase(ModInfo.ID, ModInfo.NAME, Config.class, 2);
|
||||
Config.completeDelayedSetup();
|
||||
}
|
||||
|
||||
private void postInit()
|
||||
{
|
||||
LOGGER.info("Post-Initializing Mod");
|
||||
@@ -258,4 +279,15 @@ public abstract class AbstractModInitializer
|
||||
commandDispatcher.register(builder);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//================//
|
||||
// helper classes //
|
||||
//================//
|
||||
|
||||
public interface IEventProxy
|
||||
{
|
||||
void registerEvents();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-12
@@ -57,18 +57,7 @@ public class TintGetterOverrideFast implements BlockAndTintGetter
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver)
|
||||
{
|
||||
//if (LodCommonMain.forgeMethodCaller != null)
|
||||
//{
|
||||
// return LodCommonMain.forgeMethodCaller.colorResolverGetColor(colorResolver, _getBiome(blockPos),
|
||||
// blockPos.getX(), blockPos.getZ());
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
return colorResolver.getColor(this._getBiome(blockPos), blockPos.getX(), blockPos.getZ());
|
||||
//}
|
||||
}
|
||||
public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver) { return colorResolver.getColor(this._getBiome(blockPos), blockPos.getX(), blockPos.getZ()); }
|
||||
|
||||
@Override
|
||||
public float getShade(Direction direction, boolean bl) { return this.parent.getShade(direction, bl); }
|
||||
|
||||
+29
-119
@@ -73,16 +73,7 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter
|
||||
while (cursor3D.advance())
|
||||
{
|
||||
mutableBlockPos.set(cursor3D.nextX(), cursor3D.nextY(), cursor3D.nextZ());
|
||||
int n;
|
||||
//if (LodCommonMain.forgeMethodCaller != null)
|
||||
//{
|
||||
// n = LodCommonMain.forgeMethodCaller.colorResolverGetColor(colorResolver, _getBiome(mutableBlockPos),
|
||||
// mutableBlockPos.getX(), mutableBlockPos.getZ());
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
n = colorResolver.getColor(this._getBiome(mutableBlockPos), mutableBlockPos.getX(), mutableBlockPos.getZ());
|
||||
//}
|
||||
int n = colorResolver.getColor(this._getBiome(mutableBlockPos), mutableBlockPos.getX(), mutableBlockPos.getZ());
|
||||
|
||||
k += (n & 0xFF0000) >> 16;
|
||||
l += (n & 0xFF00) >> 8;
|
||||
@@ -92,177 +83,96 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver)
|
||||
{
|
||||
return calculateBlockTint(blockPos, colorResolver);
|
||||
}
|
||||
public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver) { return this.calculateBlockTint(blockPos, colorResolver); }
|
||||
|
||||
@Override
|
||||
public float getShade(Direction direction, boolean bl) { return this.parent.getShade(direction, bl); }
|
||||
|
||||
@Override
|
||||
public LevelLightEngine getLightEngine()
|
||||
{
|
||||
return parent.getLightEngine();
|
||||
}
|
||||
public LevelLightEngine getLightEngine() { return this.parent.getLightEngine(); }
|
||||
|
||||
@Override
|
||||
public int getBrightness(LightLayer lightLayer, BlockPos blockPos)
|
||||
{
|
||||
return parent.getBrightness(lightLayer, blockPos);
|
||||
}
|
||||
public int getBrightness(LightLayer lightLayer, BlockPos blockPos) { return this.parent.getBrightness(lightLayer, blockPos); }
|
||||
|
||||
@Override
|
||||
public int getRawBrightness(BlockPos blockPos, int i)
|
||||
{
|
||||
return parent.getRawBrightness(blockPos, i);
|
||||
}
|
||||
public int getRawBrightness(BlockPos blockPos, int i) { return this.parent.getRawBrightness(blockPos, i); }
|
||||
|
||||
@Override
|
||||
public boolean canSeeSky(BlockPos blockPos)
|
||||
{
|
||||
return parent.canSeeSky(blockPos);
|
||||
}
|
||||
public boolean canSeeSky(BlockPos blockPos) { return this.parent.canSeeSky(blockPos); }
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BlockEntity getBlockEntity(BlockPos blockPos)
|
||||
{
|
||||
return parent.getBlockEntity(blockPos);
|
||||
}
|
||||
public BlockEntity getBlockEntity(BlockPos blockPos) { return this.parent.getBlockEntity(blockPos); }
|
||||
|
||||
@Override
|
||||
public BlockState getBlockState(BlockPos blockPos)
|
||||
{
|
||||
return parent.getBlockState(blockPos);
|
||||
}
|
||||
public BlockState getBlockState(BlockPos blockPos) { return this.parent.getBlockState(blockPos); }
|
||||
|
||||
@Override
|
||||
public FluidState getFluidState(BlockPos blockPos)
|
||||
{
|
||||
return parent.getFluidState(blockPos);
|
||||
}
|
||||
public FluidState getFluidState(BlockPos blockPos) { return this.parent.getFluidState(blockPos); }
|
||||
|
||||
@Override
|
||||
public int getLightEmission(BlockPos blockPos)
|
||||
{
|
||||
return parent.getLightEmission(blockPos);
|
||||
}
|
||||
public int getLightEmission(BlockPos blockPos) { return this.parent.getLightEmission(blockPos); }
|
||||
|
||||
@Override
|
||||
public int getMaxLightLevel()
|
||||
{
|
||||
return parent.getMaxLightLevel();
|
||||
}
|
||||
public int getMaxLightLevel() { return this.parent.getMaxLightLevel(); }
|
||||
|
||||
@Override
|
||||
public Stream<BlockState> getBlockStates(AABB aABB)
|
||||
{
|
||||
return parent.getBlockStates(aABB);
|
||||
}
|
||||
public Stream<BlockState> getBlockStates(AABB aABB) { return this.parent.getBlockStates(aABB); }
|
||||
|
||||
@Override
|
||||
public BlockHitResult clip(ClipContext clipContext)
|
||||
{
|
||||
return parent.clip(clipContext);
|
||||
}
|
||||
public BlockHitResult clip(ClipContext clipContext) { return this.parent.clip(clipContext); }
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BlockHitResult clipWithInteractionOverride(Vec3 vec3, Vec3 vec32, BlockPos blockPos, VoxelShape voxelShape, BlockState blockState)
|
||||
{
|
||||
return parent.clipWithInteractionOverride(vec3, vec32, blockPos, voxelShape, blockState);
|
||||
return this.parent.clipWithInteractionOverride(vec3, vec32, blockPos, voxelShape, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBlockFloorHeight(VoxelShape voxelShape, Supplier<VoxelShape> supplier)
|
||||
{
|
||||
return parent.getBlockFloorHeight(voxelShape, supplier);
|
||||
}
|
||||
public double getBlockFloorHeight(VoxelShape voxelShape, Supplier<VoxelShape> supplier) { return this.parent.getBlockFloorHeight(voxelShape, supplier); }
|
||||
|
||||
@Override
|
||||
public double getBlockFloorHeight(BlockPos blockPos)
|
||||
{
|
||||
return parent.getBlockFloorHeight(blockPos);
|
||||
}
|
||||
public double getBlockFloorHeight(BlockPos blockPos) { return this.parent.getBlockFloorHeight(blockPos); }
|
||||
|
||||
@Override
|
||||
public int getMaxBuildHeight()
|
||||
{
|
||||
return parent.getMaxBuildHeight();
|
||||
}
|
||||
public int getMaxBuildHeight() { return this.parent.getMaxBuildHeight(); }
|
||||
|
||||
#if MC_VER >= MC_1_17_1
|
||||
@Override
|
||||
public <T extends BlockEntity> Optional<T> getBlockEntity(BlockPos blockPos, BlockEntityType<T> blockEntityType)
|
||||
{
|
||||
return parent.getBlockEntity(blockPos, blockEntityType);
|
||||
}
|
||||
public <T extends BlockEntity> Optional<T> getBlockEntity(BlockPos blockPos, BlockEntityType<T> blockEntityType) { return this.parent.getBlockEntity(blockPos, blockEntityType); }
|
||||
|
||||
@Override
|
||||
public BlockHitResult isBlockInLine(ClipBlockStateContext clipBlockStateContext)
|
||||
{
|
||||
return parent.isBlockInLine(clipBlockStateContext);
|
||||
}
|
||||
public BlockHitResult isBlockInLine(ClipBlockStateContext clipBlockStateContext) { return this.parent.isBlockInLine(clipBlockStateContext); }
|
||||
|
||||
@Override
|
||||
public int getHeight()
|
||||
{
|
||||
return parent.getHeight();
|
||||
}
|
||||
public int getHeight() { return this.parent.getHeight(); }
|
||||
|
||||
@Override
|
||||
public int getMinBuildHeight()
|
||||
{
|
||||
return parent.getMinBuildHeight();
|
||||
}
|
||||
public int getMinBuildHeight() { return this.parent.getMinBuildHeight(); }
|
||||
|
||||
@Override
|
||||
public int getSectionsCount()
|
||||
{
|
||||
return parent.getSectionsCount();
|
||||
}
|
||||
public int getSectionsCount() { return this.parent.getSectionsCount(); }
|
||||
|
||||
@Override
|
||||
public int getMinSection()
|
||||
{
|
||||
return parent.getMinSection();
|
||||
}
|
||||
public int getMinSection() { return this.parent.getMinSection(); }
|
||||
|
||||
@Override
|
||||
public int getMaxSection()
|
||||
{
|
||||
return parent.getMaxSection();
|
||||
}
|
||||
public int getMaxSection() { return this.parent.getMaxSection(); }
|
||||
|
||||
@Override
|
||||
public boolean isOutsideBuildHeight(BlockPos blockPos)
|
||||
{
|
||||
return parent.isOutsideBuildHeight(blockPos);
|
||||
}
|
||||
public boolean isOutsideBuildHeight(BlockPos blockPos) { return this.parent.isOutsideBuildHeight(blockPos); }
|
||||
|
||||
@Override
|
||||
public boolean isOutsideBuildHeight(int i)
|
||||
{
|
||||
return parent.isOutsideBuildHeight(i);
|
||||
}
|
||||
public boolean isOutsideBuildHeight(int i) { return this.parent.isOutsideBuildHeight(i); }
|
||||
|
||||
@Override
|
||||
public int getSectionIndex(int i)
|
||||
{
|
||||
return parent.getSectionIndex(i);
|
||||
}
|
||||
public int getSectionIndex(int i) { return this.parent.getSectionIndex(i); }
|
||||
|
||||
@Override
|
||||
public int getSectionIndexFromSectionY(int i)
|
||||
{
|
||||
return parent.getSectionIndexFromSectionY(i);
|
||||
}
|
||||
public int getSectionIndexFromSectionY(int i) { return this.parent.getSectionIndexFromSectionY(i); }
|
||||
|
||||
@Override
|
||||
public int getSectionYFromSectionIndex(int i)
|
||||
{
|
||||
return parent.getSectionYFromSectionIndex(i);
|
||||
}
|
||||
public int getSectionYFromSectionIndex(int i) { return this.parent.getSectionYFromSectionIndex(i); }
|
||||
#endif
|
||||
}
|
||||
|
||||
+1
-1
@@ -246,7 +246,7 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
{
|
||||
// convert from an index to a block coordinate
|
||||
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
||||
return this.chunk.getSections()[index].bottomBlockY() * 16;
|
||||
return this.chunk.getSections()[index].bottomBlockY();
|
||||
#else
|
||||
return this.chunk.getSectionYFromSectionIndex(index) * 16;
|
||||
#endif
|
||||
|
||||
+18
-17
@@ -25,35 +25,39 @@ import org.lwjgl.opengl.GL32;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 11-21-2021
|
||||
*/
|
||||
public class LightMapWrapper implements ILightMapWrapper
|
||||
{
|
||||
private int textureId = 0;
|
||||
|
||||
public LightMapWrapper()
|
||||
{
|
||||
}
|
||||
|
||||
//==============//
|
||||
// constructors //
|
||||
//==============//
|
||||
|
||||
public LightMapWrapper() { }
|
||||
|
||||
private void createLightmap(NativeImage image)
|
||||
{
|
||||
textureId = GL32.glGenTextures();
|
||||
GL32.glBindTexture(GL32.GL_TEXTURE_2D, textureId);
|
||||
this.textureId = GL32.glGenTextures();
|
||||
GL32.glBindTexture(GL32.GL_TEXTURE_2D, this.textureId);
|
||||
GL32.glTexImage2D(GL32.GL_TEXTURE_2D, 0, image.format().glFormat(), image.getWidth(), image.getHeight(),
|
||||
0, image.format().glFormat(), GL32.GL_UNSIGNED_BYTE, (ByteBuffer) null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=========//
|
||||
// methods //
|
||||
//=========//
|
||||
|
||||
public void uploadLightmap(NativeImage image)
|
||||
{
|
||||
int currentBind = GL32.glGetInteger(GL32.GL_TEXTURE_BINDING_2D);
|
||||
GL32.glBindTexture(GL32.GL_TEXTURE_2D, textureId);
|
||||
if (textureId == 0)
|
||||
GL32.glBindTexture(GL32.GL_TEXTURE_2D, this.textureId);
|
||||
if (this.textureId == 0)
|
||||
{
|
||||
createLightmap(image);
|
||||
this.createLightmap(image);
|
||||
}
|
||||
// NativeImage::upload(int levelOfDetail, int xOffset, int yOffset, bool shouldCleanup?)
|
||||
image.upload(0, 0, 0, false);
|
||||
GL32.glBindTexture(GL32.GL_TEXTURE_2D, currentBind);
|
||||
}
|
||||
@@ -66,9 +70,6 @@ public class LightMapWrapper implements ILightMapWrapper
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unbind()
|
||||
{
|
||||
GL32.glBindTexture(GL32.GL_TEXTURE_2D, 0);
|
||||
}
|
||||
public void unbind() { GL32.glBindTexture(GL32.GL_TEXTURE_2D, 0); }
|
||||
|
||||
}
|
||||
|
||||
+8
-2
@@ -405,12 +405,18 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
||||
{
|
||||
try
|
||||
{
|
||||
LOAD_LOGGER.info("DistantHorizons: Loading chunk " + chunkPos + " from disk.");
|
||||
LOAD_LOGGER.info("DistantHorizons: Loading chunk [" + chunkPos + "] from disk.");
|
||||
return ChunkLoader.read(level, chunkPos, chunkData);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOAD_LOGGER.error("DistantHorizons: Couldn't load or make chunk " + chunkPos + ". Returning an empty chunk. Error: " + e.getMessage(), e);
|
||||
LOAD_LOGGER.error(
|
||||
"DistantHorizons: couldn't load or make chunk at ["+chunkPos+"]." +
|
||||
"Please try optimizing your world to fix this issue. \n" +
|
||||
"World optimization can be done from the singleplayer world selection screen.\n" +
|
||||
"Error: ["+e.getMessage()+"]."
|
||||
, e);
|
||||
|
||||
return EmptyChunk(level, chunkPos);
|
||||
}
|
||||
}
|
||||
|
||||
+24
-2
@@ -81,6 +81,8 @@ import net.minecraft.world.level.material.Fluid;
|
||||
|
||||
public class ChunkLoader
|
||||
{
|
||||
private static boolean zeroChunkPosErrorLogged = false;
|
||||
|
||||
#if MC_VER >= MC_1_19_2
|
||||
private static final Codec<PalettedContainer<BlockState>> BLOCK_STATE_CODEC = PalettedContainer.codecRW(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState());
|
||||
#elif MC_VER >= MC_1_18_2
|
||||
@@ -232,8 +234,28 @@ public class ChunkLoader
|
||||
ChunkPos actualPos = new ChunkPos(tagLevel.getInt("xPos"), tagLevel.getInt("zPos"));
|
||||
if (!Objects.equals(chunkPos, actualPos))
|
||||
{
|
||||
LOGGER.error("Chunk file at {} is in the wrong location; Ignoring. (Expected {}, got {})", chunkPos, chunkPos, actualPos);
|
||||
return null;
|
||||
if (actualPos.equals(ChunkPos.ZERO))
|
||||
{
|
||||
if (!zeroChunkPosErrorLogged)
|
||||
{
|
||||
zeroChunkPosErrorLogged = true;
|
||||
|
||||
// explicit chunkPos toString is necessary otherwise the JDK 17 compiler breaks
|
||||
LOGGER.warn("Chunk file at ["+chunkPos.toString()+"] doesn't have a chunk pos. \n" +
|
||||
"This might happen if the world was created using an external program. \n" +
|
||||
"DH will attempt to parse the chunk anyway and won't log this message again.\n" +
|
||||
"If issues arise please try optimizing your world to fix this issue. \n" +
|
||||
"World optimization can be done from the singleplayer world selection screen."+
|
||||
"");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// everything is on one line to fix a JDK 17 compiler issue
|
||||
// if the issue is ever resolved, feel free to make this multi-line for readability
|
||||
LOGGER.error("Chunk file at ["+chunkPos.toString()+"] is in the wrong location. \nPlease try optimizing your world to fix this issue. \nWorld optimization can be done from the singleplayer world selection screen. \n(Expected pos: ["+chunkPos.toString()+"], actual ["+actualPos.toString()+"])");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
ChunkStatus.ChunkType chunkType = readChunkType(tagLevel);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.fabric;
|
||||
|
||||
import com.seibel.distanthorizons.common.IEventProxy;
|
||||
import com.seibel.distanthorizons.common.AbstractModInitializer;
|
||||
import com.seibel.distanthorizons.common.rendering.SeamlessOverdraw;
|
||||
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
||||
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
||||
@@ -50,7 +50,6 @@ import net.fabricmc.fabric.api.networking.v1.PacketSender;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.TitleScreen;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.HashSet;
|
||||
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
@@ -62,7 +61,6 @@ import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
|
||||
/**
|
||||
* This handles all events sent to the client,
|
||||
@@ -73,7 +71,7 @@ import org.lwjgl.opengl.GL15;
|
||||
* @version 2023-7-27
|
||||
*/
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class FabricClientProxy implements IEventProxy
|
||||
public class FabricClientProxy implements AbstractModInitializer.IEventProxy
|
||||
{
|
||||
private final ClientApi clientApi = ClientApi.INSTANCE;
|
||||
private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
||||
|
||||
@@ -21,7 +21,6 @@ package com.seibel.distanthorizons.fabric;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.seibel.distanthorizons.common.AbstractModInitializer;
|
||||
import com.seibel.distanthorizons.common.IEventProxy;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.config.ConfigBase;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
|
||||
@@ -29,23 +28,17 @@ import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.*;
|
||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||
import com.seibel.distanthorizons.fabric.wrappers.FabricDependencySetup;
|
||||
import com.seibel.distanthorizons.fabric.wrappers.modAccessor.*;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.api.DedicatedServerModInitializer;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
|
||||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
#if MC_VER >= MC_1_19_2
|
||||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
||||
#else // < 1.19.2
|
||||
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
|
||||
#endif
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@@ -53,10 +46,6 @@ import java.util.function.Consumer;
|
||||
* Initialize and setup the Mod. <br>
|
||||
* If you are looking for the real start of the mod
|
||||
* check out the ClientProxy.
|
||||
*
|
||||
* @author coolGi
|
||||
* @author Ran
|
||||
* @version 9-2-2022
|
||||
*/
|
||||
public class FabricMain extends AbstractModInitializer implements ClientModInitializer, DedicatedServerModInitializer
|
||||
{
|
||||
@@ -65,22 +54,13 @@ public class FabricMain extends AbstractModInitializer implements ClientModIniti
|
||||
|
||||
|
||||
@Override
|
||||
protected void createInitialBindings()
|
||||
{
|
||||
FabricDependencySetup.createInitialBindings();
|
||||
}
|
||||
protected void createInitialBindings() { SingletonInjector.INSTANCE.bind(IModChecker.class, ModChecker.INSTANCE); }
|
||||
|
||||
@Override
|
||||
protected IEventProxy createClientProxy()
|
||||
{
|
||||
return new FabricClientProxy();
|
||||
}
|
||||
protected IEventProxy createClientProxy() { return new FabricClientProxy(); }
|
||||
|
||||
@Override
|
||||
protected IEventProxy createServerProxy(boolean isDedicated)
|
||||
{
|
||||
return new FabricServerProxy(isDedicated);
|
||||
}
|
||||
protected IEventProxy createServerProxy(boolean isDedicated) { return new FabricServerProxy(isDedicated); }
|
||||
|
||||
@Override
|
||||
protected void initializeModCompat()
|
||||
@@ -106,7 +86,6 @@ public class FabricMain extends AbstractModInitializer implements ClientModIniti
|
||||
}
|
||||
|
||||
this.tryCreateModCompatAccessor("starlight", IStarlightAccessor.class, StarlightAccessor::new);
|
||||
//this.tryCreateModCompatAccessor("imm_ptl_core", IImmersivePortalsAccessor.class, ImmersivePortalsAccessor::new);
|
||||
this.tryCreateModCompatAccessor("optifine", IOptifineAccessor.class, OptifineAccessor::new);
|
||||
this.tryCreateModCompatAccessor("bclib", IBCLibAccessor.class, BCLibAccessor::new);
|
||||
#if MC_VER != MC_1_17_1 && MC_VER <= MC_1_20_1
|
||||
@@ -124,10 +103,7 @@ public class FabricMain extends AbstractModInitializer implements ClientModIniti
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void subscribeClientStartedEvent(Runnable eventHandler)
|
||||
{
|
||||
ClientLifecycleEvents.CLIENT_STARTED.register((mc) -> eventHandler.run());
|
||||
}
|
||||
protected void subscribeClientStartedEvent(Runnable eventHandler) { ClientLifecycleEvents.CLIENT_STARTED.register((mc) -> eventHandler.run()); }
|
||||
|
||||
@Override
|
||||
protected void subscribeServerStartingEvent(Consumer<MinecraftServer> eventHandler)
|
||||
@@ -139,10 +115,11 @@ public class FabricMain extends AbstractModInitializer implements ClientModIniti
|
||||
@Override
|
||||
protected void runDelayedSetup()
|
||||
{
|
||||
FabricDependencySetup.runDelayedSetup();
|
||||
SingletonInjector.INSTANCE.runDelayedSetup();
|
||||
|
||||
if (Config.Client.Advanced.Graphics.Fog.disableVanillaFog.get() && SingletonInjector.INSTANCE.get(IModChecker.class).isModLoaded("bclib"))
|
||||
ModAccessorInjector.INSTANCE.get(IBCLibAccessor.class).setRenderCustomFog(false); // Remove BCLib's fog
|
||||
|
||||
#if MC_VER >= MC_1_20_1
|
||||
if (SingletonInjector.INSTANCE.get(IModChecker.class).isModLoaded("sodium"))
|
||||
ModAccessorInjector.INSTANCE.get(ISodiumAccessor.class).setFogOcclusion(false); // FIXME: This is a tmp fix for sodium 0.5.0, and 0.5.1. This is fixed in sodium 0.5.2
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.seibel.distanthorizons.fabric;
|
||||
|
||||
import com.seibel.distanthorizons.common.IEventProxy;
|
||||
import com.seibel.distanthorizons.common.AbstractModInitializer;
|
||||
import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper;
|
||||
import com.seibel.distanthorizons.common.wrappers.misc.ServerPlayerWrapper;
|
||||
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
||||
@@ -33,7 +33,7 @@ import java.util.function.Supplier;
|
||||
* @author Tomlee
|
||||
* @version 5-11-2022
|
||||
*/
|
||||
public class FabricServerProxy implements IEventProxy
|
||||
public class FabricServerProxy implements AbstractModInitializer.IEventProxy
|
||||
{
|
||||
private static final ServerApi SERVER_API = ServerApi.INSTANCE;
|
||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
||||
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020-2023 James Seibel
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.distanthorizons.fabric.wrappers;
|
||||
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker;
|
||||
import com.seibel.distanthorizons.fabric.wrappers.modAccessor.ModChecker;
|
||||
|
||||
/**
|
||||
* Binds all necessary dependencies, so we
|
||||
* can access them in Core. <br>
|
||||
* This needs to be called before any Core classes
|
||||
* are loaded.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @author Ran
|
||||
* @version 3-5-2022
|
||||
*/
|
||||
public class FabricDependencySetup
|
||||
{
|
||||
public static void createInitialBindings()
|
||||
{
|
||||
SingletonInjector.INSTANCE.bind(IModChecker.class, ModChecker.INSTANCE);
|
||||
}
|
||||
|
||||
public static void runDelayedSetup()
|
||||
{
|
||||
SingletonInjector.INSTANCE.runDelayedSetup();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.forge;
|
||||
|
||||
import com.seibel.distanthorizons.common.IEventProxy;
|
||||
import com.seibel.distanthorizons.common.AbstractModInitializer;
|
||||
import com.seibel.distanthorizons.common.util.ProxyUtil;
|
||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
|
||||
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
||||
@@ -88,7 +88,7 @@ import java.util.function.Predicate;
|
||||
* @author James_Seibel
|
||||
* @version 2023-7-27
|
||||
*/
|
||||
public class ForgeClientProxy implements IEventProxy
|
||||
public class ForgeClientProxy implements AbstractModInitializer.IEventProxy
|
||||
{
|
||||
private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
||||
|
||||
@@ -21,12 +21,12 @@ package com.seibel.distanthorizons.forge;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.seibel.distanthorizons.common.AbstractModInitializer;
|
||||
import com.seibel.distanthorizons.common.IEventProxy;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen;
|
||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
|
||||
import com.seibel.distanthorizons.forge.wrappers.ForgeDependencySetup;
|
||||
|
||||
import com.seibel.distanthorizons.forge.wrappers.modAccessor.ModChecker;
|
||||
import com.seibel.distanthorizons.forge.wrappers.modAccessor.OptifineAccessor;
|
||||
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
@@ -68,11 +68,6 @@ import java.util.function.Consumer;
|
||||
* Initialize and setup the Mod. <br>
|
||||
* If you are looking for the real start of the mod
|
||||
* check out the ClientProxy.
|
||||
*
|
||||
* @author coolGi
|
||||
* @author Ran
|
||||
* @author James Seibel
|
||||
* @version 8-15-2022
|
||||
*/
|
||||
@Mod(ModInfo.ID)
|
||||
public class ForgeMain extends AbstractModInitializer
|
||||
@@ -85,22 +80,13 @@ public class ForgeMain extends AbstractModInitializer
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createInitialBindings()
|
||||
{
|
||||
ForgeDependencySetup.createInitialBindings();
|
||||
}
|
||||
protected void createInitialBindings() { SingletonInjector.INSTANCE.bind(IModChecker.class, ModChecker.INSTANCE); }
|
||||
|
||||
@Override
|
||||
protected IEventProxy createClientProxy()
|
||||
{
|
||||
return new ForgeClientProxy();
|
||||
}
|
||||
protected IEventProxy createClientProxy() { return new ForgeClientProxy(); }
|
||||
|
||||
@Override
|
||||
protected IEventProxy createServerProxy(boolean isDedicated)
|
||||
{
|
||||
return new ForgeServerProxy(isDedicated);
|
||||
}
|
||||
protected IEventProxy createServerProxy(boolean isDedicated) { return new ForgeServerProxy(isDedicated); }
|
||||
|
||||
@Override
|
||||
protected void initializeModCompat()
|
||||
@@ -122,16 +108,13 @@ public class ForgeMain extends AbstractModInitializer
|
||||
@Override
|
||||
protected void subscribeRegisterCommandsEvent(Consumer<CommandDispatcher<CommandSourceStack>> eventHandler)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.addListener((RegisterCommandsEvent e) ->
|
||||
{
|
||||
eventHandler.accept(e.getDispatcher());
|
||||
});
|
||||
MinecraftForge.EVENT_BUS.addListener((RegisterCommandsEvent e) -> { eventHandler.accept(e.getDispatcher()); });
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void subscribeClientStartedEvent(Runnable eventHandler)
|
||||
{
|
||||
// FIXME Why it's unused?
|
||||
// FIXME What event is this?
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -144,9 +127,6 @@ public class ForgeMain extends AbstractModInitializer
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runDelayedSetup()
|
||||
{
|
||||
ForgeDependencySetup.runDelayedSetup();
|
||||
}
|
||||
protected void runDelayedSetup() { SingletonInjector.INSTANCE.runDelayedSetup(); }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.seibel.distanthorizons.forge;
|
||||
|
||||
import com.seibel.distanthorizons.common.IEventProxy;
|
||||
import com.seibel.distanthorizons.common.AbstractModInitializer;
|
||||
import com.seibel.distanthorizons.common.util.ProxyUtil;
|
||||
import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper;
|
||||
import com.seibel.distanthorizons.common.wrappers.misc.ServerPlayerWrapper;
|
||||
@@ -50,7 +50,7 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ForgeServerProxy implements IEventProxy
|
||||
public class ForgeServerProxy implements AbstractModInitializer.IEventProxy
|
||||
{
|
||||
#if MC_VER < MC_1_19_2
|
||||
private static LevelAccessor GetEventLevel(WorldEvent e) { return e.getWorld(); }
|
||||
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020-2023 James Seibel
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.distanthorizons.forge.wrappers;
|
||||
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker;
|
||||
import com.seibel.distanthorizons.forge.wrappers.modAccessor.ModChecker;
|
||||
|
||||
/**
|
||||
* Binds all necessary dependencies so we
|
||||
* can access them in Core. <br>
|
||||
* This needs to be called before any Core classes
|
||||
* are loaded.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @author Ran
|
||||
* @version 12-1-2021
|
||||
*/
|
||||
public class ForgeDependencySetup
|
||||
{
|
||||
public static void createInitialBindings()
|
||||
{
|
||||
SingletonInjector.INSTANCE.bind(IModChecker.class, ModChecker.INSTANCE);
|
||||
}
|
||||
|
||||
public static void runDelayedSetup()
|
||||
{
|
||||
SingletonInjector.INSTANCE.runDelayedSetup();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.neoforge;
|
||||
|
||||
import com.seibel.distanthorizons.common.IEventProxy;
|
||||
import com.seibel.distanthorizons.common.AbstractModInitializer;
|
||||
import com.seibel.distanthorizons.common.util.ProxyUtil;
|
||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
|
||||
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
||||
@@ -45,7 +45,6 @@ import net.neoforged.neoforge.event.level.LevelEvent;
|
||||
import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
|
||||
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
//import net.neoforged.network.NetworkRegistry;
|
||||
//import net.neoforged.network.simple.SimpleChannel;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -66,7 +65,7 @@ import org.lwjgl.opengl.GL32;
|
||||
* @author James_Seibel
|
||||
* @version 2023-7-27
|
||||
*/
|
||||
public class NeoforgeClientProxy implements IEventProxy
|
||||
public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy
|
||||
{
|
||||
private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
||||
|
||||
@@ -21,11 +21,12 @@ package com.seibel.distanthorizons.neoforge;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.seibel.distanthorizons.common.AbstractModInitializer;
|
||||
import com.seibel.distanthorizons.common.IEventProxy;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
|
||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||
import com.seibel.distanthorizons.neoforge.wrappers.NeoforgeDependencySetup;
|
||||
import com.seibel.distanthorizons.neoforge.wrappers.modAccessor.ModChecker;
|
||||
import com.seibel.distanthorizons.neoforge.wrappers.modAccessor.OptifineAccessor;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
@@ -45,11 +46,6 @@ import java.util.function.Consumer;
|
||||
* Initialize and setup the Mod. <br>
|
||||
* If you are looking for the real start of the mod
|
||||
* check out the ClientProxy.
|
||||
*
|
||||
* @author coolGi
|
||||
* @author Ran
|
||||
* @author James Seibel
|
||||
* @version 8-15-2022
|
||||
*/
|
||||
@Mod(ModInfo.ID)
|
||||
@SuppressWarnings("unused")
|
||||
@@ -62,22 +58,13 @@ public class NeoforgeMain extends AbstractModInitializer
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createInitialBindings()
|
||||
{
|
||||
NeoforgeDependencySetup.createInitialBindings();
|
||||
}
|
||||
protected IEventProxy createServerProxy(boolean isDedicated) { return new NeoforgeServerProxy(isDedicated); }
|
||||
|
||||
@Override
|
||||
protected IEventProxy createClientProxy()
|
||||
{
|
||||
return new NeoforgeClientProxy();
|
||||
}
|
||||
protected void createInitialBindings() { SingletonInjector.INSTANCE.bind(IModChecker.class, ModChecker.INSTANCE); }
|
||||
|
||||
@Override
|
||||
protected IEventProxy createServerProxy(boolean isDedicated)
|
||||
{
|
||||
return new NeoforgeServerProxy(isDedicated);
|
||||
}
|
||||
protected IEventProxy createClientProxy() { return new NeoforgeClientProxy(); }
|
||||
|
||||
@Override
|
||||
protected void initializeModCompat()
|
||||
@@ -91,29 +78,22 @@ public class NeoforgeMain extends AbstractModInitializer
|
||||
@Override
|
||||
protected void subscribeRegisterCommandsEvent(Consumer<CommandDispatcher<CommandSourceStack>> eventHandler)
|
||||
{
|
||||
NeoForge.EVENT_BUS.addListener((RegisterCommandsEvent e) -> {
|
||||
eventHandler.accept(e.getDispatcher());
|
||||
});
|
||||
NeoForge.EVENT_BUS.addListener((RegisterCommandsEvent e) -> { eventHandler.accept(e.getDispatcher()); });
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void subscribeClientStartedEvent(Runnable eventHandler)
|
||||
{
|
||||
// FIXME Why it's unused?
|
||||
// FIXME What event is this?
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void subscribeServerStartingEvent(Consumer<MinecraftServer> eventHandler)
|
||||
{
|
||||
NeoForge.EVENT_BUS.addListener((ServerStartingEvent e) -> {
|
||||
eventHandler.accept(e.getServer());
|
||||
});
|
||||
NeoForge.EVENT_BUS.addListener((ServerStartingEvent e) -> { eventHandler.accept(e.getServer()); });
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runDelayedSetup()
|
||||
{
|
||||
NeoforgeDependencySetup.runDelayedSetup();
|
||||
}
|
||||
protected void runDelayedSetup() { SingletonInjector.INSTANCE.runDelayedSetup(); }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.seibel.distanthorizons.neoforge;
|
||||
|
||||
import com.seibel.distanthorizons.common.IEventProxy;
|
||||
import com.seibel.distanthorizons.common.AbstractModInitializer;
|
||||
import com.seibel.distanthorizons.common.util.ProxyUtil;
|
||||
import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper;
|
||||
import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper;
|
||||
@@ -25,7 +25,7 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class NeoforgeServerProxy implements IEventProxy
|
||||
public class NeoforgeServerProxy implements AbstractModInitializer.IEventProxy
|
||||
{
|
||||
private static LevelAccessor GetEventLevel(LevelEvent e) { return e.getLevel(); }
|
||||
|
||||
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020-2023 James Seibel
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.distanthorizons.neoforge.wrappers;
|
||||
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker;
|
||||
import com.seibel.distanthorizons.neoforge.wrappers.modAccessor.ModChecker;
|
||||
|
||||
/**
|
||||
* Binds all necessary dependencies so we
|
||||
* can access them in Core. <br>
|
||||
* This needs to be called before any Core classes
|
||||
* are loaded.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @author Ran
|
||||
* @version 12-1-2021
|
||||
*/
|
||||
public class NeoforgeDependencySetup
|
||||
{
|
||||
public static void createInitialBindings()
|
||||
{
|
||||
SingletonInjector.INSTANCE.bind(IModChecker.class, ModChecker.INSTANCE);
|
||||
}
|
||||
|
||||
public static void runDelayedSetup()
|
||||
{
|
||||
SingletonInjector.INSTANCE.runDelayedSetup();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user