mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-28 16:06:28 +01:00
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:
parent
59ea700b04
commit
d9bfe82a22
7 changed files with 16 additions and 11 deletions
|
@ -3,8 +3,7 @@ package com.jozufozu.flywheel.backend.struct;
|
||||||
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
|
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
|
||||||
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
||||||
import com.jozufozu.flywheel.backend.instancing.InstanceData;
|
import com.jozufozu.flywheel.backend.instancing.InstanceData;
|
||||||
|
import com.jozufozu.flywheel.util.NonNullSupplier;
|
||||||
import net.minecraftforge.common.util.NonNullSupplier;
|
|
||||||
|
|
||||||
public class BasicStructType<S extends InstanceData> implements StructType<S> {
|
public class BasicStructType<S extends InstanceData> implements StructType<S> {
|
||||||
|
|
||||||
|
|
|
@ -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.GlBuffer;
|
||||||
import com.jozufozu.flywheel.backend.gl.buffer.GlBufferType;
|
import com.jozufozu.flywheel.backend.gl.buffer.GlBufferType;
|
||||||
import com.jozufozu.flywheel.backend.gl.buffer.MappedGlBuffer;
|
import com.jozufozu.flywheel.backend.gl.buffer.MappedGlBuffer;
|
||||||
|
import com.jozufozu.flywheel.util.Lazy;
|
||||||
import net.minecraftforge.common.util.Lazy;
|
|
||||||
|
|
||||||
public class FullscreenQuad {
|
public class FullscreenQuad {
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import static org.lwjgl.opengl.GL11.GL_QUADS;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import com.jozufozu.flywheel.util.Lazy;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
|
||||||
import net.minecraft.world.level.block.RenderShape;
|
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.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||||
import net.minecraftforge.client.ForgeHooksClient;
|
import net.minecraftforge.client.ForgeHooksClient;
|
||||||
import net.minecraftforge.client.model.data.EmptyModelData;
|
import net.minecraftforge.client.model.data.EmptyModelData;
|
||||||
import net.minecraftforge.common.util.Lazy;
|
|
||||||
|
|
||||||
public class ModelUtil {
|
public class ModelUtil {
|
||||||
private static final Lazy<ModelBlockRenderer> MODEL_RENDERER = Lazy.of(() -> new ModelBlockRenderer(Minecraft.getInstance().getBlockColors()));
|
private static final Lazy<ModelBlockRenderer> MODEL_RENDERER = Lazy.of(() -> new ModelBlockRenderer(Minecraft.getInstance().getBlockColors()));
|
||||||
|
|
|
@ -4,8 +4,6 @@ import java.util.function.Consumer;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import net.minecraftforge.common.util.NonNullSupplier;
|
|
||||||
|
|
||||||
public class Lazy<T> {
|
public class Lazy<T> {
|
||||||
|
|
||||||
private final NonNullSupplier<T> supplier;
|
private final NonNullSupplier<T> supplier;
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.jozufozu.flywheel.util;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface NonNullSupplier<T> {
|
||||||
|
|
||||||
|
@Nonnull T get();
|
||||||
|
}
|
|
@ -29,8 +29,8 @@ void FLWFinalizeWorldPos(inout vec4 worldPos) {
|
||||||
out vec4 fragColor;
|
out vec4 fragColor;
|
||||||
|
|
||||||
vec4 FLWBlockTexture(vec2 texCoords) {
|
vec4 FLWBlockTexture(vec2 texCoords) {
|
||||||
vec4 cr = texture2D(uCrumbling, texCoords * uTextureScale);
|
vec4 cr = texture(uCrumbling, texCoords * uTextureScale);
|
||||||
float diffuseAlpha = texture2D(uBlockAtlas, texCoords).a;
|
float diffuseAlpha = texture(uBlockAtlas, texCoords).a;
|
||||||
cr.a = cr.a * diffuseAlpha;
|
cr.a = cr.a * diffuseAlpha;
|
||||||
return cr;
|
return cr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ void FLWFinalizeWorldPos(inout vec4 worldPos) {
|
||||||
out vec4 fragColor;
|
out vec4 fragColor;
|
||||||
|
|
||||||
vec4 FLWBlockTexture(vec2 texCoords) {
|
vec4 FLWBlockTexture(vec2 texCoords) {
|
||||||
return texture2D(uBlockAtlas, texCoords);
|
return texture(uBlockAtlas, texCoords);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FLWFinalizeColor(vec4 color) {
|
void FLWFinalizeColor(vec4 color) {
|
||||||
|
@ -59,6 +59,6 @@ void FLWFinalizeColor(vec4 color) {
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 FLWLight(vec2 lightCoords) {
|
vec4 FLWLight(vec2 lightCoords) {
|
||||||
return texture2D(uLightMap, shiftLight(lightCoords));
|
return texture(uLightMap, shiftLight(lightCoords));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue