Fix it so forge in 1.17 works
This commit is contained in:
@@ -3,6 +3,8 @@ package com.seibel.lod.common.forge;
|
||||
import com.seibel.lod.common.wrappers.minecraft.MinecraftClientWrapper;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.ColorResolver;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
@@ -16,4 +18,6 @@ import java.util.Random;
|
||||
*/
|
||||
public interface LodForgeMethodCaller {
|
||||
List<BakedQuad> getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, Random random);
|
||||
|
||||
int colorResolverGetColor(ColorResolver resolver, Biome biome, double x, double z);
|
||||
}
|
||||
|
||||
+7
-2
@@ -1,5 +1,6 @@
|
||||
package com.seibel.lod.common.wrappers.block;
|
||||
|
||||
import com.seibel.lod.common.LodCommonMain;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.client.color.block.BlockTintCache;
|
||||
@@ -42,8 +43,12 @@ public class TintGetterOverrideFast implements BlockAndTintGetter {
|
||||
|
||||
@Override
|
||||
public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver) {
|
||||
Biome b = _getBiome(blockPos);
|
||||
return colorResolver.getColor(b, blockPos.getX(), blockPos.getZ());
|
||||
if (LodCommonMain.forgeMethodCaller != null) {
|
||||
return LodCommonMain.forgeMethodCaller.colorResolverGetColor(colorResolver, _getBiome(blockPos),
|
||||
blockPos.getX(), blockPos.getZ());
|
||||
} else {
|
||||
return colorResolver.getColor(_getBiome(blockPos), blockPos.getX(), blockPos.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+9
-1
@@ -1,5 +1,6 @@
|
||||
package com.seibel.lod.common.wrappers.block;
|
||||
|
||||
import com.seibel.lod.common.LodCommonMain;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.client.color.block.BlockTintCache;
|
||||
@@ -55,7 +56,14 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter {
|
||||
while (cursor3D.advance())
|
||||
{
|
||||
mutableBlockPos.set(cursor3D.nextX(), cursor3D.nextY(), cursor3D.nextZ());
|
||||
int n = colorResolver.getColor(_getBiome(mutableBlockPos), mutableBlockPos.getX(), mutableBlockPos.getZ());
|
||||
int n;
|
||||
if (LodCommonMain.forgeMethodCaller != null) {
|
||||
n = LodCommonMain.forgeMethodCaller.colorResolverGetColor(colorResolver, _getBiome(mutableBlockPos),
|
||||
mutableBlockPos.getX(), mutableBlockPos.getZ());
|
||||
} else {
|
||||
n = colorResolver.getColor(_getBiome(mutableBlockPos), mutableBlockPos.getX(), mutableBlockPos.getZ());
|
||||
}
|
||||
|
||||
k += (n & 0xFF0000) >> 16;
|
||||
l += (n & 0xFF00) >> 8;
|
||||
m += n & 0xFF;
|
||||
|
||||
@@ -35,10 +35,11 @@ import com.seibel.lod.forge.wrappers.modAccessor.OptifineAccessor;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.ColorResolver;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.ConfigGuiHandler;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
@@ -46,6 +47,8 @@ import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.fmlclient.ConfigGuiHandler;
|
||||
//import net.minecraftforge.client.ConfigGuiHandler;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@@ -102,4 +105,9 @@ public class ForgeMain implements LodForgeMethodCaller
|
||||
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, dataMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int colorResolverGetColor(ColorResolver resolver, Biome biome, double x, double z) {
|
||||
return resolver.m_130045_(biome, x, z);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.seibel.lod.forge.fabric.api.networking.v1;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -88,8 +89,11 @@ public final class PlayerLookup {
|
||||
public static Collection<ServerPlayer> tracking(ServerLevel world, ChunkPos pos) {
|
||||
Objects.requireNonNull(world, "The world cannot be null");
|
||||
Objects.requireNonNull(pos, "The chunk pos cannot be null");
|
||||
|
||||
#if MC_VERSION_1_18_1 | MC_VERSION_1_18_2
|
||||
return world.getChunkSource().chunkMap.getPlayers(pos, false);
|
||||
#else
|
||||
return world.getChunkSource().chunkMap.getPlayers(pos, false).toList();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.seibel.lod.forge.mixins.unsafe;
|
||||
|
||||
import net.minecraft.util.ThreadingDetector;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
#if MC_VERSION_1_18_1 | MC_VERSION_1_18_2
|
||||
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -24,3 +27,7 @@ public class MixinThreadingDectector {
|
||||
this.lock = new Semaphore(2);
|
||||
}
|
||||
}
|
||||
#else
|
||||
@Mixin(ThreadingDetector.class)
|
||||
public class MixinThreadingDectector {} //FIXME: Is there some way to make this file just not be added?
|
||||
#endif
|
||||
Reference in New Issue
Block a user