Compat work

- No more net.minecraftforge.common.util usages
 - Replace forge lazy with flywheel lazy
 - Replace forge NonNullSupplier with flywheel NonNullSupplier
 - texture2D -> texture
This commit is contained in:
Jozufozu 2021-10-12 12:52:02 -07:00
parent 59ea700b04
commit d9bfe82a22
7 changed files with 16 additions and 11 deletions

View file

@ -3,8 +3,7 @@ package com.jozufozu.flywheel.backend.struct;
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
import com.jozufozu.flywheel.backend.instancing.InstanceData;
import net.minecraftforge.common.util.NonNullSupplier;
import com.jozufozu.flywheel.util.NonNullSupplier;
public class BasicStructType<S extends InstanceData> implements StructType<S> {

View file

@ -7,8 +7,7 @@ import com.jozufozu.flywheel.backend.gl.GlVertexArray;
import com.jozufozu.flywheel.backend.gl.buffer.GlBuffer;
import com.jozufozu.flywheel.backend.gl.buffer.GlBufferType;
import com.jozufozu.flywheel.backend.gl.buffer.MappedGlBuffer;
import net.minecraftforge.common.util.Lazy;
import com.jozufozu.flywheel.util.Lazy;
public class FullscreenQuad {

View file

@ -6,6 +6,7 @@ import static org.lwjgl.opengl.GL11.GL_QUADS;
import java.util.Collection;
import java.util.Random;
import com.jozufozu.flywheel.util.Lazy;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.world.level.block.RenderShape;
@ -23,7 +24,6 @@ import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.common.util.Lazy;
public class ModelUtil {
private static final Lazy<ModelBlockRenderer> MODEL_RENDERER = Lazy.of(() -> new ModelBlockRenderer(Minecraft.getInstance().getBlockColors()));

View file

@ -4,8 +4,6 @@ import java.util.function.Consumer;
import javax.annotation.Nonnull;
import net.minecraftforge.common.util.NonNullSupplier;
public class Lazy<T> {
private final NonNullSupplier<T> supplier;

View file

@ -0,0 +1,9 @@
package com.jozufozu.flywheel.util;
import javax.annotation.Nonnull;
@FunctionalInterface
public interface NonNullSupplier<T> {
@Nonnull T get();
}

View file

@ -29,8 +29,8 @@ void FLWFinalizeWorldPos(inout vec4 worldPos) {
out vec4 fragColor;
vec4 FLWBlockTexture(vec2 texCoords) {
vec4 cr = texture2D(uCrumbling, texCoords * uTextureScale);
float diffuseAlpha = texture2D(uBlockAtlas, texCoords).a;
vec4 cr = texture(uCrumbling, texCoords * uTextureScale);
float diffuseAlpha = texture(uBlockAtlas, texCoords).a;
cr.a = cr.a * diffuseAlpha;
return cr;
}

View file

@ -37,7 +37,7 @@ void FLWFinalizeWorldPos(inout vec4 worldPos) {
out vec4 fragColor;
vec4 FLWBlockTexture(vec2 texCoords) {
return texture2D(uBlockAtlas, texCoords);
return texture(uBlockAtlas, texCoords);
}
void FLWFinalizeColor(vec4 color) {
@ -59,6 +59,6 @@ void FLWFinalizeColor(vec4 color) {
}
vec4 FLWLight(vec2 lightCoords) {
return texture2D(uLightMap, shiftLight(lightCoords));
return texture(uLightMap, shiftLight(lightCoords));
}
#endif