Do not load clientside-only classes in serverside ShapeDispatcher code (#1642)
fixed use of client side classes in shape dispatcher
This commit is contained in:
1 parent
2133675ac7
commit
d49be89e23
2 files changed
+12
-14
No files matched your search
@@ -22,8 +22,6 @@ import carpet.script.value.Value;
|
||||
import carpet.script.value.ValueConversions;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat.Mode;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Registry;
|
||||
@@ -763,7 +761,7 @@ public class ShapeDispatcher
|
||||
public long calcKey(final RegistryAccess regs){
|
||||
long hash = super.calcKey(regs);
|
||||
hash ^= 6; hash *= 1099511628211L;
|
||||
hash ^= mode.hashCode(); hash *= 1099511628211L;
|
||||
hash ^= mode; hash *= 1099511628211L;
|
||||
hash ^= relative.hashCode(); hash *= 1099511628211L;
|
||||
for (Vec3 i :vertex_list){
|
||||
hash ^= vec3dhash(i);
|
||||
@@ -784,7 +782,7 @@ public class ShapeDispatcher
|
||||
}
|
||||
alter_point=new ArrayList<>();
|
||||
switch (mode) {
|
||||
case TRIANGLES:
|
||||
case 4:
|
||||
for (int i=0;i<vertex_list.size();i++){
|
||||
Vec3 vecA=vertex_list.get(i);
|
||||
if(relative.get(i)){
|
||||
@@ -803,7 +801,7 @@ public class ShapeDispatcher
|
||||
alter_draw_triangles(vecA, vecB, vecC);
|
||||
}
|
||||
break;
|
||||
case TRIANGLE_FAN:
|
||||
case 6:
|
||||
Vec3 vec0=vertex_list.get(0);
|
||||
if(relative.get(0)){
|
||||
vec0=relativiseRender(p.level, vec0, 0);
|
||||
@@ -821,7 +819,7 @@ public class ShapeDispatcher
|
||||
vec1=vec;
|
||||
}
|
||||
break;
|
||||
case TRIANGLE_STRIP:
|
||||
case 5:
|
||||
Vec3 vecA=vertex_list.get(0);
|
||||
if(relative.get(0)){
|
||||
vecA=relativiseRender(p.level, vecA, 0);
|
||||
@@ -886,7 +884,7 @@ public class ShapeDispatcher
|
||||
@Override
|
||||
protected Set<String> optionalParams() { return Sets.union(super.optionalParams(), optional.keySet()); }
|
||||
ArrayList<Vec3> vertex_list=new ArrayList<>();
|
||||
Mode mode;
|
||||
int mode;
|
||||
ArrayList<Boolean> relative=new ArrayList<>();
|
||||
boolean inneredges;
|
||||
@Override
|
||||
@@ -907,11 +905,11 @@ public class ShapeDispatcher
|
||||
inneredges=false;
|
||||
}
|
||||
if("polygon".equals(_mode)){
|
||||
mode=VertexFormat.Mode.TRIANGLE_FAN;
|
||||
mode=6;
|
||||
}else if("strip".equals(_mode)){
|
||||
mode=VertexFormat.Mode.TRIANGLE_STRIP;
|
||||
mode=5;
|
||||
}else if("triangles".equals(_mode)){
|
||||
mode=VertexFormat.Mode.TRIANGLES;
|
||||
mode=4;
|
||||
if(vertex_list.size()%3!=0){
|
||||
throw new IllegalArgumentException("Unexpected vertex list size: " + vertex_list.size());
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ public class ShapesRenderer
|
||||
else
|
||||
RenderSystem.enableCull();
|
||||
|
||||
bufferBuilder.begin(shape.mode, DefaultVertexFormat.POSITION_COLOR);
|
||||
bufferBuilder.begin(VertexFormat.Mode.values()[shape.mode], DefaultVertexFormat.POSITION_COLOR);
|
||||
for(int i=0;i<shape.vertex_list.size();i++){
|
||||
Vec3 vec=shape.vertex_list.get(i);
|
||||
if(shape.relative.get(i)){
|
||||
@@ -585,7 +585,7 @@ public class ShapesRenderer
|
||||
double cz, float partialTick) {
|
||||
if(shape.a==0){return;}
|
||||
|
||||
if (shape.mode==Mode.TRIANGLE_FAN){
|
||||
if (shape.mode==6){
|
||||
builder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
|
||||
Vec3 vec0=null;
|
||||
for(int i=0;i<shape.vertex_list.size();i++){
|
||||
@@ -613,7 +613,7 @@ public class ShapesRenderer
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (shape.mode==Mode.TRIANGLE_STRIP){
|
||||
if (shape.mode==5){
|
||||
builder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
|
||||
Vec3 vec=shape.vertex_list.get(1);
|
||||
if(shape.relative.get(1)){
|
||||
@@ -648,7 +648,7 @@ public class ShapesRenderer
|
||||
tessellator.end();
|
||||
return;
|
||||
}
|
||||
if (shape.mode==Mode.TRIANGLES){
|
||||
if (shape.mode==4){
|
||||
builder.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR);
|
||||
for (int i=0;i<shape.vertex_list.size();i++){
|
||||
Vec3 vecA=shape.vertex_list.get(i);
|
||||
|
||||
Reference in new issue
Block a user