Merge pull request #513 from ugudango/mc1.15/dev

Casted ByteBuffer to Buffer in multiple places
This commit is contained in:
simibubi 2020-11-18 11:16:45 +01:00 committed by GitHub
commit a3501bd5a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,7 @@
package com.simibubi.create.foundation.utility; package com.simibubi.create.foundation.utility;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.Buffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
@ -59,9 +60,9 @@ public class SuperByteBuffer {
template = GLAllocation.createDirectByteBuffer(size); template = GLAllocation.createDirectByteBuffer(size);
template.order(rendered.order()); template.order(rendered.order());
template.limit(rendered.limit()); ((Buffer)template).limit(((Buffer)rendered).limit());
template.put(rendered); template.put(rendered);
template.rewind(); ((Buffer)template).rewind();
transforms = new MatrixStack(); transforms = new MatrixStack();
} }
@ -78,9 +79,9 @@ public class SuperByteBuffer {
public void renderInto(MatrixStack input, IVertexBuilder builder) { public void renderInto(MatrixStack input, IVertexBuilder builder) {
ByteBuffer buffer = template; ByteBuffer buffer = template;
if (buffer.limit() == 0) if (((Buffer)buffer).limit() == 0)
return; return;
buffer.rewind(); ((Buffer)buffer).rewind();
Matrix4f t = input.peek() Matrix4f t = input.peek()
.getModel() .getModel()
@ -207,7 +208,7 @@ public class SuperByteBuffer {
} }
protected int vertexCount(ByteBuffer buffer) { protected int vertexCount(ByteBuffer buffer) {
return buffer.limit() / formatSize; return ((Buffer)buffer).limit() / formatSize;
} }
protected int getBufferPosition(int vertexIndex) { protected int getBufferPosition(int vertexIndex) {
@ -282,7 +283,7 @@ public class SuperByteBuffer {
} }
public boolean isEmpty() { public boolean isEmpty() {
return template.limit() == 0; return ((Buffer)template).limit() == 0;
} }
} }