mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-28 16:06:48 +01:00
Merge remote-tracking branch 'origin/mc1.15/dev' into mc1.15/dev
This commit is contained in:
commit
e1644c11e2
16 changed files with 194 additions and 61 deletions
|
@ -39,7 +39,7 @@ minecraft {
|
|||
workingDirectory project.file('run')
|
||||
// property 'mixin.env.disableRefMap', 'true'
|
||||
arg '-mixin.config=create.mixins.json'
|
||||
// jvmArgs '-XX:+UnlockCommercialFeatures'
|
||||
jvmArgs '-XX:+UnlockCommercialFeatures'
|
||||
property 'forge.logging.console.level', 'info'
|
||||
property 'fml.earlyprogresswindow', 'false'
|
||||
mods {
|
||||
|
|
|
@ -81,6 +81,9 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
|||
}
|
||||
|
||||
super.initialize();
|
||||
|
||||
if (world != null && world.isRemote)
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> CreateClient.kineticRenderer.add(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -534,13 +537,6 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
|||
return block.hasIntegratedCogwheel(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
super.onLoad();
|
||||
if (world != null && world.isRemote)
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> CreateClient.kineticRenderer.add(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnloaded() {
|
||||
if (world != null && world.isRemote)
|
||||
|
|
|
@ -901,7 +901,7 @@ public abstract class Contraption {
|
|||
world.getWorld()
|
||||
.removeTileEntity(add);
|
||||
int flags = BlockFlags.IS_MOVING | BlockFlags.NO_NEIGHBOR_DROPS | BlockFlags.UPDATE_NEIGHBORS
|
||||
| BlockFlags.BLOCK_UPDATE;
|
||||
| BlockFlags.BLOCK_UPDATE | BlockFlags.RERENDER_MAIN_THREAD;
|
||||
if (blockIn instanceof IWaterLoggable && oldState.has(BlockStateProperties.WATERLOGGED)
|
||||
&& oldState.get(BlockStateProperties.WATERLOGGED)
|
||||
.booleanValue()) {
|
||||
|
|
|
@ -64,6 +64,12 @@ public class ContraptionRenderDispatcher {
|
|||
}
|
||||
}
|
||||
|
||||
public static void notifyLightPacket(ILightReader world, int chunkX, int chunkZ) {
|
||||
for (RenderedContraption renderer : renderers.values()) {
|
||||
renderer.getLighter().lightVolume.notifyLightPacket(world, chunkX, chunkZ);
|
||||
}
|
||||
}
|
||||
|
||||
public static void renderTick() {
|
||||
firstLayer = true;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package com.simibubi.create.foundation.mixin;
|
||||
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
|
||||
import com.simibubi.create.foundation.render.backend.RenderWork;
|
||||
import com.simibubi.create.foundation.render.backend.light.ILightListener;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.network.play.ClientPlayNetHandler;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.network.play.server.SUpdateLightPacket;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ClientPlayNetHandler.class)
|
||||
public class NetworkLightUpdateMixin {
|
||||
|
||||
@Inject(at = @At("TAIL"), method = "handleUpdateLight")
|
||||
private void onLightPacket(SUpdateLightPacket packet, CallbackInfo ci) {
|
||||
RenderWork.enqueue(() -> {
|
||||
ClientWorld world = Minecraft.getInstance().world;
|
||||
|
||||
if (world == null) return;
|
||||
|
||||
int chunkX = packet.getChunkX();
|
||||
int chunkZ = packet.getChunkZ();
|
||||
|
||||
Chunk chunk = world.getChunkProvider().getChunk(chunkX, chunkZ, false);
|
||||
|
||||
if (chunk != null) {
|
||||
chunk.getTileEntityMap()
|
||||
.values()
|
||||
.stream()
|
||||
.filter(tile -> tile instanceof ILightListener)
|
||||
.map(tile -> (ILightListener) tile)
|
||||
.forEach(ILightListener::onChunkLightUpdate);
|
||||
}
|
||||
|
||||
ContraptionRenderDispatcher.notifyLightPacket(world, chunkX, chunkZ);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,5 +1,11 @@
|
|||
package com.simibubi.create.foundation.mixin;
|
||||
|
||||
import com.simibubi.create.foundation.render.backend.light.ILightListener;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientChunkProvider;
|
||||
import net.minecraft.util.math.SectionPos;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
@ -21,6 +27,8 @@ import net.minecraft.client.world.ClientWorld;
|
|||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Mixin(WorldRenderer.class)
|
||||
public class RenderHooksMixin {
|
||||
|
|
|
@ -3,15 +3,12 @@ package com.simibubi.create.foundation.render.backend;
|
|||
import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.simibubi.create.foundation.render.backend.gl.versioned.GlFunctions;
|
||||
import com.simibubi.create.foundation.render.backend.gl.versioned.GlFeatureCompat;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.lwjgl.opengl.GL;
|
||||
|
@ -23,8 +20,6 @@ import com.simibubi.create.foundation.render.backend.gl.shader.GlProgram;
|
|||
import com.simibubi.create.foundation.render.backend.gl.shader.GlShader;
|
||||
import com.simibubi.create.foundation.render.backend.gl.shader.ProgramSpec;
|
||||
import com.simibubi.create.foundation.render.backend.gl.shader.ShaderType;
|
||||
import com.simibubi.create.foundation.render.backend.gl.versioned.GlVersioned;
|
||||
import com.simibubi.create.foundation.render.backend.gl.versioned.MapBuffer;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureUtil;
|
||||
|
@ -45,7 +40,7 @@ public class Backend {
|
|||
private static boolean enabled;
|
||||
|
||||
public static GLCapabilities capabilities;
|
||||
public static GlFunctions functions;
|
||||
public static GlFeatureCompat compat;
|
||||
|
||||
public Backend() {
|
||||
throw new IllegalStateException();
|
||||
|
@ -74,9 +69,9 @@ public class Backend {
|
|||
|
||||
public static boolean canUseInstancing() {
|
||||
return enabled &&
|
||||
functions.vertexArrayObjectsSupported() &&
|
||||
functions.drawInstancedSupported() &&
|
||||
functions.instancedArraysSupported();
|
||||
compat.vertexArrayObjectsSupported() &&
|
||||
compat.drawInstancedSupported() &&
|
||||
compat.instancedArraysSupported();
|
||||
}
|
||||
|
||||
public static boolean canUseVBOs() {
|
||||
|
@ -107,7 +102,7 @@ public class Backend {
|
|||
private static void onResourceManagerReload(IResourceManager manager, Predicate<IResourceType> predicate) {
|
||||
if (predicate.test(VanillaResourceType.SHADERS)) {
|
||||
capabilities = GL.createCapabilities();
|
||||
functions = new GlFunctions(capabilities);
|
||||
compat = new GlFeatureCompat(capabilities);
|
||||
|
||||
OptifineHandler.refresh();
|
||||
refresh();
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.nio.ByteBuffer;
|
|||
import java.util.function.Consumer;
|
||||
|
||||
import com.simibubi.create.foundation.render.backend.Backend;
|
||||
import com.simibubi.create.foundation.render.backend.gl.versioned.GlFunctions;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
|
||||
public class GlBuffer extends GlObject {
|
||||
|
@ -35,11 +34,11 @@ public class GlBuffer extends GlObject {
|
|||
}
|
||||
|
||||
public void map(int length, Consumer<ByteBuffer> upload) {
|
||||
Backend.functions.mapBuffer(bufferType, 0, length, upload);
|
||||
Backend.compat.mapBuffer(bufferType, 0, length, upload);
|
||||
}
|
||||
|
||||
public void map(int offset, int length, Consumer<ByteBuffer> upload) {
|
||||
Backend.functions.mapBuffer(bufferType, offset, length, upload);
|
||||
Backend.compat.mapBuffer(bufferType, offset, length, upload);
|
||||
}
|
||||
|
||||
protected void deleteInternal(int handle) {
|
||||
|
|
|
@ -3,19 +3,18 @@ package com.simibubi.create.foundation.render.backend.gl;
|
|||
import java.util.function.Consumer;
|
||||
|
||||
import com.simibubi.create.foundation.render.backend.Backend;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
|
||||
public class GlVertexArray extends GlObject {
|
||||
public GlVertexArray() {
|
||||
setHandle(Backend.functions.genVertexArrays());
|
||||
setHandle(Backend.compat.genVertexArrays());
|
||||
}
|
||||
|
||||
public void bind() {
|
||||
Backend.functions.bindVertexArray(handle());
|
||||
Backend.compat.bindVertexArray(handle());
|
||||
}
|
||||
|
||||
public void unbind() {
|
||||
Backend.functions.bindVertexArray(0);
|
||||
Backend.compat.bindVertexArray(0);
|
||||
}
|
||||
|
||||
public void with(Consumer<GlVertexArray> action) {
|
||||
|
@ -25,6 +24,6 @@ public class GlVertexArray extends GlObject {
|
|||
}
|
||||
|
||||
protected void deleteInternal(int handle) {
|
||||
Backend.functions.deleteVertexArrays(handle);
|
||||
Backend.compat.deleteVertexArrays(handle);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,19 +13,23 @@ import java.util.function.Consumer;
|
|||
* Each field stores an enum variant that provides access to the
|
||||
* most appropriate version of a feature for the current system.
|
||||
*/
|
||||
public class GlFunctions {
|
||||
public class GlFeatureCompat {
|
||||
public final MapBuffer mapBuffer;
|
||||
|
||||
public final VertexArrayObject vertexArrayObject;
|
||||
public final InstancedArrays instancedArrays;
|
||||
public final DrawInstanced drawInstanced;
|
||||
|
||||
public GlFunctions(GLCapabilities caps) {
|
||||
public final RGPixelFormat pixelFormat;
|
||||
|
||||
public GlFeatureCompat(GLCapabilities caps) {
|
||||
mapBuffer = getLatest(MapBuffer.class, caps);
|
||||
|
||||
vertexArrayObject = getLatest(VertexArrayObject.class, caps);
|
||||
instancedArrays = getLatest(InstancedArrays.class, caps);
|
||||
drawInstanced = getLatest(DrawInstanced.class, caps);
|
||||
|
||||
pixelFormat = getLatest(RGPixelFormat.class, caps);
|
||||
}
|
||||
|
||||
public void mapBuffer(int target, int offset, int length, Consumer<ByteBuffer> upload) {
|
|
@ -0,0 +1,75 @@
|
|||
package com.simibubi.create.foundation.render.backend.gl.versioned;
|
||||
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
public enum RGPixelFormat implements GlVersioned {
|
||||
GL30_RG {
|
||||
@Override
|
||||
public boolean supported(GLCapabilities caps) {
|
||||
return caps.OpenGL30;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int internalFormat() {
|
||||
return GL30.GL_RG8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int format() {
|
||||
return GL30.GL_RG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int byteCount() {
|
||||
return 2;
|
||||
}
|
||||
},
|
||||
GL11_RGB {
|
||||
@Override
|
||||
public boolean supported(GLCapabilities caps) {
|
||||
return caps.OpenGL11;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int internalFormat() {
|
||||
return GL11.GL_RGB8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int format() {
|
||||
return GL11.GL_RGB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int byteCount() {
|
||||
return 3;
|
||||
}
|
||||
},
|
||||
UNSUPPORTED {
|
||||
@Override
|
||||
public boolean supported(GLCapabilities caps) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int internalFormat() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int format() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int byteCount() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public abstract int internalFormat();
|
||||
public abstract int format();
|
||||
public abstract int byteCount();
|
||||
}
|
|
@ -115,7 +115,7 @@ public abstract class InstancedModel<D extends InstanceData> extends BufferedMod
|
|||
protected void doRender() {
|
||||
vao.with(vao -> {
|
||||
renderSetup();
|
||||
Backend.functions.drawArraysInstanced(GL11.GL_QUADS, 0, vertexCount, glInstanceCount);
|
||||
Backend.compat.drawArraysInstanced(GL11.GL_QUADS, 0, vertexCount, glInstanceCount);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ public abstract class InstancedModel<D extends InstanceData> extends BufferedMod
|
|||
instanceFormat.vertexAttribPointers(staticAttributes);
|
||||
|
||||
for (int i = 0; i < instanceFormat.getShaderAttributeCount(); i++) {
|
||||
Backend.functions.vertexAttribDivisor(i + staticAttributes, 1);
|
||||
Backend.compat.vertexAttribDivisor(i + staticAttributes, 1);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -20,8 +20,6 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public abstract class InstancedTileRenderer<P extends BasicProgram> {
|
||||
public static WorldAttached<ConcurrentHashMap<TileEntity, Integer>> addedLastTick = new WorldAttached<>(ConcurrentHashMap::new);
|
||||
|
||||
protected Map<TileEntity, TileEntityInstance<?>> instances = new HashMap<>();
|
||||
|
||||
protected Map<MaterialType<?>, RenderMaterial<P, ?>> materials = new HashMap<>();
|
||||
|
@ -35,23 +33,8 @@ public abstract class InstancedTileRenderer<P extends BasicProgram> {
|
|||
public abstract void registerMaterials();
|
||||
|
||||
public void tick() {
|
||||
ClientWorld world = Minecraft.getInstance().world;
|
||||
|
||||
int ticks = AnimationTickHolder.getTicks();
|
||||
|
||||
ConcurrentHashMap<TileEntity, Integer> map = addedLastTick.get(world);
|
||||
map
|
||||
.entrySet()
|
||||
.stream()
|
||||
.filter(it -> ticks - it.getValue() > 10)
|
||||
.map(Map.Entry::getKey)
|
||||
.forEach(te -> {
|
||||
map.remove(te);
|
||||
|
||||
onLightUpdate(te);
|
||||
});
|
||||
|
||||
|
||||
// Clean up twice a second. This doesn't have to happen every tick,
|
||||
// but this does need to be run to ensure we don't miss anything.
|
||||
if (ticks % 10 == 0) {
|
||||
|
@ -82,7 +65,6 @@ public abstract class InstancedTileRenderer<P extends BasicProgram> {
|
|||
TileEntityInstance<? super T> renderer = InstancedTileRenderRegistry.instance.create(this, tile);
|
||||
|
||||
if (renderer != null) {
|
||||
addedLastTick.get(tile.getWorld()).put(tile, AnimationTickHolder.getTicks());
|
||||
instances.put(tile, renderer);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,17 @@ public class GridAlignedBB {
|
|||
pos.getWorldEndZ() + 1);
|
||||
}
|
||||
|
||||
public static GridAlignedBB fromChunk(int sectionX, int sectionZ) {
|
||||
int startX = sectionX << 4;
|
||||
int startZ = sectionZ << 4;
|
||||
return new GridAlignedBB(startX,
|
||||
0,
|
||||
startZ,
|
||||
startX + 16,
|
||||
256,
|
||||
startZ + 16);
|
||||
}
|
||||
|
||||
public static AxisAlignedBB toAABB(GridAlignedBB bb) {
|
||||
return new AxisAlignedBB(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ);
|
||||
}
|
||||
|
|
|
@ -2,11 +2,12 @@ package com.simibubi.create.foundation.render.backend.light;
|
|||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import com.simibubi.create.foundation.render.backend.Backend;
|
||||
import com.simibubi.create.foundation.render.backend.gl.versioned.RGPixelFormat;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
import org.lwjgl.opengl.GL13;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import org.lwjgl.opengl.GL40;
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
|
||||
import com.simibubi.create.foundation.render.backend.RenderWork;
|
||||
|
@ -28,11 +29,15 @@ public class LightVolume {
|
|||
|
||||
private final GlTexture glTexture;
|
||||
|
||||
private final RGPixelFormat pixelFormat;
|
||||
|
||||
public LightVolume(GridAlignedBB sampleVolume) {
|
||||
setSampleVolume(sampleVolume);
|
||||
|
||||
pixelFormat = Backend.compat.pixelFormat;
|
||||
|
||||
this.glTexture = new GlTexture(GL20.GL_TEXTURE_3D);
|
||||
this.lightData = MemoryUtil.memAlloc(this.textureVolume.volume() * 2); // TODO: reduce this to span only sampleVolume
|
||||
this.lightData = MemoryUtil.memAlloc(this.textureVolume.volume() * pixelFormat.byteCount());
|
||||
|
||||
// allocate space for the texture
|
||||
GL20.glActiveTexture(GL20.GL_TEXTURE4);
|
||||
|
@ -41,7 +46,7 @@ public class LightVolume {
|
|||
int sizeX = textureVolume.sizeX();
|
||||
int sizeY = textureVolume.sizeY();
|
||||
int sizeZ = textureVolume.sizeZ();
|
||||
GL12.glTexImage3D(GL12.GL_TEXTURE_3D, 0, GL40.GL_RG8, sizeX, sizeY, sizeZ, 0, GL40.GL_RG, GL40.GL_UNSIGNED_BYTE, 0);
|
||||
GL12.glTexImage3D(GL12.GL_TEXTURE_3D, 0, pixelFormat.internalFormat(), sizeX, sizeY, sizeZ, 0, pixelFormat.format(), GL20.GL_UNSIGNED_BYTE, 0);
|
||||
|
||||
glTexture.unbind();
|
||||
GL20.glActiveTexture(GL20.GL_TEXTURE0);
|
||||
|
@ -128,6 +133,15 @@ public class LightVolume {
|
|||
else if (type == LightType.SKY) copySky(world, changedVolume);
|
||||
}
|
||||
|
||||
public void notifyLightPacket(ILightReader world, int chunkX, int chunkZ) {
|
||||
GridAlignedBB changedVolume = GridAlignedBB.fromChunk(chunkX, chunkZ);
|
||||
if (!changedVolume.intersects(sampleVolume))
|
||||
return;
|
||||
changedVolume.intersectAssign(sampleVolume); // compute the region contained by us that has dirty lighting data.
|
||||
|
||||
copyLight(world, changedVolume);
|
||||
}
|
||||
|
||||
/**
|
||||
* Completely (re)populate this volume with block and sky lighting data.
|
||||
* This is expensive and should be avoided.
|
||||
|
@ -222,7 +236,7 @@ public class LightVolume {
|
|||
// just in case something goes wrong or we accidentally call this before this volume is properly disposed of.
|
||||
if (lightData == null || removed) return;
|
||||
|
||||
GL13.glActiveTexture(GL40.GL_TEXTURE4);
|
||||
GL13.glActiveTexture(GL20.GL_TEXTURE4);
|
||||
glTexture.bind();
|
||||
GL11.glTexParameteri(GL13.GL_TEXTURE_3D, GL13.GL_TEXTURE_MIN_FILTER, GL13.GL_LINEAR);
|
||||
GL11.glTexParameteri(GL13.GL_TEXTURE_3D, GL13.GL_TEXTURE_MAG_FILTER, GL13.GL_LINEAR);
|
||||
|
@ -245,7 +259,7 @@ public class LightVolume {
|
|||
int sizeY = textureVolume.sizeY();
|
||||
int sizeZ = textureVolume.sizeZ();
|
||||
|
||||
GL12.glTexSubImage3D(GL12.GL_TEXTURE_3D, 0, 0, 0, 0, sizeX, sizeY, sizeZ, GL40.GL_RG, GL40.GL_UNSIGNED_BYTE, lightData);
|
||||
GL12.glTexSubImage3D(GL12.GL_TEXTURE_3D, 0, 0, 0, 0, sizeX, sizeY, sizeZ, pixelFormat.format(), GL20.GL_UNSIGNED_BYTE, lightData);
|
||||
|
||||
GL20.glPixelStorei(GL20.GL_UNPACK_ALIGNMENT, 4); // 4 is the default
|
||||
bufferDirty = false;
|
||||
|
@ -269,7 +283,7 @@ public class LightVolume {
|
|||
byte b = (byte) ((block & 0xF) << 4);
|
||||
byte s = (byte) ((sky & 0xF) << 4);
|
||||
|
||||
int i = index(x, y, z);
|
||||
int i = posToIndex(x, y, z);
|
||||
lightData.put(i, b);
|
||||
lightData.put(i + 1, s);
|
||||
}
|
||||
|
@ -277,16 +291,16 @@ public class LightVolume {
|
|||
private void writeBlock(int x, int y, int z, int block) {
|
||||
byte b = (byte) ((block & 0xF) << 4);
|
||||
|
||||
lightData.put(index(x, y, z), b);
|
||||
lightData.put(posToIndex(x, y, z), b);
|
||||
}
|
||||
|
||||
private void writeSky(int x, int y, int z, int sky) {
|
||||
byte b = (byte) ((sky & 0xF) << 4);
|
||||
|
||||
lightData.put(index(x, y, z) + 1, b);
|
||||
lightData.put(posToIndex(x, y, z) + 1, b);
|
||||
}
|
||||
|
||||
private int index(int x, int y, int z) {
|
||||
return (x + textureVolume.sizeX() * (y + z * textureVolume.sizeY())) * 2;
|
||||
private int posToIndex(int x, int y, int z) {
|
||||
return (x + textureVolume.sizeX() * (y + z * textureVolume.sizeY())) * pixelFormat.byteCount();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
"CancelTileEntityRenderMixin",
|
||||
"LightUpdateMixin",
|
||||
"RenderHooksMixin",
|
||||
"FogColorTrackerMixin"
|
||||
"FogColorTrackerMixin",
|
||||
"NetworkLightUpdateMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
|
Loading…
Reference in a new issue