24w21a - broken shapes
This commit is contained in:
1 parent
7a1e152229
commit
9e578e6cc9
18 files changed
+274
-235
No files matched your search
+1
-1
@@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check https://fabricmc.net/develop/
|
# check https://fabricmc.net/develop/
|
||||||
minecraft_version=24w20a
|
minecraft_version=24w21a
|
||||||
loader_version=0.15.11
|
loader_version=0.15.11
|
||||||
jsr305_version=3.0.2
|
jsr305_version=3.0.2
|
||||||
fabric_version=0.97.8+1.20.6
|
fabric_version=0.97.8+1.20.6
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package carpet.fakes;
|
||||||
|
|
||||||
|
public interface PortalProcessorInterface
|
||||||
|
{
|
||||||
|
void setPortalTime(int time);
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package carpet.mixins;
|
|||||||
|
|
||||||
import carpet.network.CarpetClient;
|
import carpet.network.CarpetClient;
|
||||||
import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl;
|
import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl;
|
||||||
|
import net.minecraft.network.DisconnectionDetails;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket;
|
import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -13,7 +14,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
public class ClientCommonPacketListenerImpl_customPacketMixin
|
public class ClientCommonPacketListenerImpl_customPacketMixin
|
||||||
{
|
{
|
||||||
@Inject(method = "onDisconnect", at = @At("HEAD"))
|
@Inject(method = "onDisconnect", at = @At("HEAD"))
|
||||||
private void onCMDisconnected(Component reason, CallbackInfo ci)
|
private void onCMDisconnected(DisconnectionDetails reason, CallbackInfo ci)
|
||||||
{
|
{
|
||||||
CarpetClient.disconnect();
|
CarpetClient.disconnect();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package carpet.mixins;
|
package carpet.mixins;
|
||||||
|
|
||||||
import carpet.fakes.EntityInterface;
|
import carpet.fakes.EntityInterface;
|
||||||
|
import carpet.fakes.PortalProcessorInterface;
|
||||||
import carpet.script.EntityEventsGroup;
|
import carpet.script.EntityEventsGroup;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.PortalProcessor;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@@ -15,13 +18,13 @@ public abstract class Entity_scarpetEventsMixin implements EntityInterface
|
|||||||
{
|
{
|
||||||
//@Shadow public boolean removed;
|
//@Shadow public boolean removed;
|
||||||
|
|
||||||
@Shadow protected int portalTime;
|
|
||||||
@Shadow private int portalCooldown;
|
@Shadow private int portalCooldown;
|
||||||
|
|
||||||
@Shadow public abstract boolean isRemoved();
|
@Shadow public abstract boolean isRemoved();
|
||||||
|
|
||||||
@Shadow private Vec3 position, deltaMovement;
|
@Shadow private Vec3 position, deltaMovement;
|
||||||
|
|
||||||
|
@Shadow @Nullable public PortalProcessor portalProcess;
|
||||||
private boolean permanentVehicle;
|
private boolean permanentVehicle;
|
||||||
|
|
||||||
private final EntityEventsGroup events = new EntityEventsGroup((Entity) (Object)this);
|
private final EntityEventsGroup events = new EntityEventsGroup((Entity) (Object)this);
|
||||||
@@ -61,13 +64,13 @@ public abstract class Entity_scarpetEventsMixin implements EntityInterface
|
|||||||
@Override
|
@Override
|
||||||
public int getPortalTimer()
|
public int getPortalTimer()
|
||||||
{
|
{
|
||||||
return portalTime;
|
return portalProcess.getPortalTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPortalTimer(int amount)
|
public void setPortalTimer(int amount)
|
||||||
{
|
{
|
||||||
portalTime = amount;
|
((PortalProcessorInterface)portalProcess).setPortalTime(amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "tick", at = @At("HEAD"))
|
@Inject(method = "tick", at = @At("HEAD"))
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package carpet.mixins;
|
package carpet.mixins;
|
||||||
|
|
||||||
import carpet.CarpetSettings;
|
import carpet.CarpetSettings;
|
||||||
|
import carpet.patches.EntityPlayerMPFake;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
@@ -47,4 +48,12 @@ public abstract class LivingEntity_creativeFlyMixin extends Entity
|
|||||||
cir.setReturnValue( getFlyingSpeed() * (float)CarpetSettings.creativeFlySpeed);
|
cir.setReturnValue( getFlyingSpeed() * (float)CarpetSettings.creativeFlySpeed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "canChangeDimensions", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void canChangeDimensions(CallbackInfoReturnable<Boolean> cir)
|
||||||
|
{
|
||||||
|
if (CarpetSettings.isCreativeFlying(this)) {
|
||||||
|
cir.setReturnValue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.fakes.PortalProcessorInterface;
|
||||||
|
import net.minecraft.world.entity.PortalProcessor;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
|
@Mixin(PortalProcessor.class)
|
||||||
|
public class PortalProcessor_scarpetMixin implements PortalProcessorInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
@Shadow private int portalTime;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPortalTime(int time)
|
||||||
|
{
|
||||||
|
portalTime = time;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package carpet.mixins;
|
|||||||
import carpet.CarpetServer;
|
import carpet.CarpetServer;
|
||||||
import carpet.fakes.ServerGamePacketListenerImplInterface;
|
import carpet.fakes.ServerGamePacketListenerImplInterface;
|
||||||
import net.minecraft.network.Connection;
|
import net.minecraft.network.Connection;
|
||||||
|
import net.minecraft.network.DisconnectionDetails;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
@@ -26,8 +27,8 @@ public abstract class ServerGamePacketListenerImpl_coreMixin extends ServerCommo
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "onDisconnect", at = @At("HEAD"))
|
@Inject(method = "onDisconnect", at = @At("HEAD"))
|
||||||
private void onPlayerDisconnect(Component reason, CallbackInfo ci) {
|
private void onPlayerDisconnect(DisconnectionDetails reason, CallbackInfo ci) {
|
||||||
CarpetServer.onPlayerLoggedOut(this.player, reason);
|
CarpetServer.onPlayerLoggedOut(this.player, reason.reason());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -97,20 +97,20 @@ public abstract class ServerPlayer_scarpetEventMixin extends Player implements S
|
|||||||
private ResourceKey<Level> previousDimension;
|
private ResourceKey<Level> previousDimension;
|
||||||
|
|
||||||
@Inject(method = "changeDimension", at = @At("HEAD"))
|
@Inject(method = "changeDimension", at = @At("HEAD"))
|
||||||
private void logPreviousCoordinates(DimensionTransitionSupplier serverWorld, CallbackInfoReturnable<Entity> cir)
|
private void logPreviousCoordinates(DimensionTransition serverWorld, CallbackInfoReturnable<Entity> cir)
|
||||||
{
|
{
|
||||||
previousLocation = position();
|
previousLocation = position();
|
||||||
previousDimension = level().dimension(); //dimension type
|
previousDimension = level().dimension(); //dimension type
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "changeDimension", at = @At("RETURN"))
|
@Inject(method = "changeDimension", at = @At("RETURN"))
|
||||||
private void atChangeDimension(DimensionTransitionSupplier destinationP, CallbackInfoReturnable<Entity> cir)
|
private void atChangeDimension(DimensionTransition destinationP, CallbackInfoReturnable<Entity> cir)
|
||||||
{
|
{
|
||||||
if (PLAYER_CHANGES_DIMENSION.isNeeded())
|
if (PLAYER_CHANGES_DIMENSION.isNeeded())
|
||||||
{
|
{
|
||||||
ServerPlayer player = (ServerPlayer) (Object)this;
|
ServerPlayer player = (ServerPlayer) (Object)this;
|
||||||
DimensionTransition destinationTransition = destinationP.get();
|
DimensionTransition destinationTransition = destinationP;
|
||||||
ServerLevel destination = destinationTransition.newDimension();
|
ServerLevel destination = destinationTransition.newLevel();
|
||||||
Vec3 to = null;
|
Vec3 to = null;
|
||||||
if (!wonGame || previousDimension != Level.END || destination.dimension() != Level.OVERWORLD)
|
if (!wonGame || previousDimension != Level.END || destination.dimension() != Level.OVERWORLD)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,9 +11,5 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||||||
@Mixin(TheEndGatewayBlockEntity.class)
|
@Mixin(TheEndGatewayBlockEntity.class)
|
||||||
public class TheEndGatewayBlockEntity_creativeNoClipMixin
|
public class TheEndGatewayBlockEntity_creativeNoClipMixin
|
||||||
{
|
{
|
||||||
@Inject(method = "canEntityTeleport", cancellable = true, at = @At("HEAD"))
|
// removeme
|
||||||
private static void checkFlyingCreative(Entity entity, CallbackInfoReturnable<Boolean> cir)
|
|
||||||
{
|
|
||||||
if (CarpetSettings.isCreativeFlying(entity)) cir.setReturnValue(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ public class CarpetClient
|
|||||||
private static LocalPlayer clientPlayer = null;
|
private static LocalPlayer clientPlayer = null;
|
||||||
private static boolean isServerCarpet = false;
|
private static boolean isServerCarpet = false;
|
||||||
public static String serverCarpetVersion;
|
public static String serverCarpetVersion;
|
||||||
public static final ResourceLocation CARPET_CHANNEL = new ResourceLocation("carpet", "hello");
|
public static final ResourceLocation CARPET_CHANNEL = ResourceLocation.fromNamespaceAndPath("carpet", "hello");
|
||||||
|
|
||||||
public static void gameJoined(LocalPlayer player)
|
public static void gameJoined(LocalPlayer player)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import carpet.CarpetSettings;
|
|||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.UUIDUtil;
|
import net.minecraft.core.UUIDUtil;
|
||||||
|
import net.minecraft.network.DisconnectionDetails;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.contents.TranslatableContents;
|
import net.minecraft.network.chat.contents.TranslatableContents;
|
||||||
import net.minecraft.network.protocol.PacketFlow;
|
import net.minecraft.network.protocol.PacketFlow;
|
||||||
@@ -30,6 +31,7 @@ import net.minecraft.world.level.GameType;
|
|||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.entity.SkullBlockEntity;
|
import net.minecraft.world.level.block.entity.SkullBlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraft.world.level.portal.DimensionTransition;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import carpet.fakes.ServerPlayerInterface;
|
import carpet.fakes.ServerPlayerInterface;
|
||||||
import carpet.utils.Messenger;
|
import carpet.utils.Messenger;
|
||||||
@@ -147,10 +149,10 @@ public class EntityPlayerMPFake extends ServerPlayer
|
|||||||
shakeOff();
|
shakeOff();
|
||||||
|
|
||||||
if (reason.getContents() instanceof TranslatableContents text && text.getKey().equals("multiplayer.disconnect.duplicate_login")) {
|
if (reason.getContents() instanceof TranslatableContents text && text.getKey().equals("multiplayer.disconnect.duplicate_login")) {
|
||||||
this.connection.onDisconnect(reason);
|
this.connection.onDisconnect(new DisconnectionDetails(reason));
|
||||||
} else {
|
} else {
|
||||||
this.server.tell(new TickTask(this.server.getTickCount(), () -> {
|
this.server.tell(new TickTask(this.server.getTickCount(), () -> {
|
||||||
this.connection.onDisconnect(reason);
|
this.connection.onDisconnect(new DisconnectionDetails(reason));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -213,7 +215,7 @@ public class EntityPlayerMPFake extends ServerPlayer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Entity changeDimension(DimensionTransitionSupplier serverLevel)
|
public Entity changeDimension(DimensionTransition serverLevel)
|
||||||
{
|
{
|
||||||
super.changeDimension(serverLevel);
|
super.changeDimension(serverLevel);
|
||||||
if (wonGame) {
|
if (wonGame) {
|
||||||
|
|||||||
@@ -890,7 +890,7 @@ public abstract class CommandArgument
|
|||||||
{
|
{
|
||||||
throw error("Custom sting type requires options passed as a list" + " for custom type " + suffix);
|
throw error("Custom sting type requires options passed as a list" + " for custom type " + suffix);
|
||||||
}
|
}
|
||||||
validOptions = ((ListValue) optionsValue).getItems().stream().map(v -> new ResourceLocation(v.getString())).collect(Collectors.toSet());
|
validOptions = ((ListValue) optionsValue).getItems().stream().map(v -> ResourceLocation.parse(v.getString())).collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class FeatureGenerator
|
|||||||
{
|
{
|
||||||
return custom.apply(world).plop(world, pos);
|
return custom.apply(world).plop(world, pos);
|
||||||
}
|
}
|
||||||
ResourceLocation id = new ResourceLocation(featureName);
|
ResourceLocation id = ResourceLocation.parse(featureName);
|
||||||
Structure structure = world.registryAccess().registryOrThrow(Registries.STRUCTURE).get(id);
|
Structure structure = world.registryAccess().registryOrThrow(Registries.STRUCTURE).get(id);
|
||||||
if (structure != null)
|
if (structure != null)
|
||||||
{
|
{
|
||||||
@@ -129,7 +129,7 @@ public class FeatureGenerator
|
|||||||
@Nullable
|
@Nullable
|
||||||
public static Structure resolveConfiguredStructure(String name, ServerLevel world, BlockPos pos)
|
public static Structure resolveConfiguredStructure(String name, ServerLevel world, BlockPos pos)
|
||||||
{
|
{
|
||||||
ResourceLocation id = new ResourceLocation(name);
|
ResourceLocation id = ResourceLocation.parse(name);
|
||||||
Structure configuredStructureFeature = world.registryAccess().registryOrThrow(Registries.STRUCTURE).get(id);
|
Structure configuredStructureFeature = world.registryAccess().registryOrThrow(Registries.STRUCTURE).get(id);
|
||||||
if (configuredStructureFeature != null)
|
if (configuredStructureFeature != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class InputValidator
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return new ResourceLocation(string);
|
return ResourceLocation.parse(string);
|
||||||
}
|
}
|
||||||
catch (ResourceLocationException iie)
|
catch (ResourceLocationException iie)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ public class ShapeDispatcher
|
|||||||
|
|
||||||
key = 0;
|
key = 0;
|
||||||
followEntity = -1;
|
followEntity = -1;
|
||||||
shapeDimension = ResourceKey.create(Registries.DIMENSION, new ResourceLocation(options.get("dim").getString()));
|
shapeDimension = ResourceKey.create(Registries.DIMENSION, ResourceLocation.parse(options.get("dim").getString()));
|
||||||
if (options.containsKey("follow"))
|
if (options.containsKey("follow"))
|
||||||
{
|
{
|
||||||
followEntity = NumericValue.asNumber(options.getOrDefault("follow", optional.get("follow"))).getInt();
|
followEntity = NumericValue.asNumber(options.getOrDefault("follow", optional.get("follow"))).getInt();
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import carpet.script.utils.shapes.ShapeDirection;
|
|||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.BufferBuilder;
|
import com.mojang.blaze3d.vertex.BufferBuilder;
|
||||||
|
import com.mojang.blaze3d.vertex.BufferUploader;
|
||||||
|
import com.mojang.blaze3d.vertex.ByteBufferBuilder;
|
||||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.Tesselator;
|
import com.mojang.blaze3d.vertex.Tesselator;
|
||||||
@@ -142,8 +144,7 @@ public class ShapesRenderer
|
|||||||
//RenderSystem.polygonOffset(-3f, -3f);
|
//RenderSystem.polygonOffset(-3f, -3f);
|
||||||
//RenderSystem.enablePolygonOffset();
|
//RenderSystem.enablePolygonOffset();
|
||||||
|
|
||||||
Tesselator tessellator = Tesselator.getInstance();
|
Tesselator tesselator = Tesselator.getInstance();
|
||||||
BufferBuilder bufferBuilder = tessellator.getBuilder();
|
|
||||||
|
|
||||||
// render
|
// render
|
||||||
double cameraX = camera.getPosition().x;
|
double cameraX = camera.getPosition().x;
|
||||||
@@ -166,7 +167,7 @@ public class ShapesRenderer
|
|||||||
shapes.get(dimensionType).values().forEach(s -> {
|
shapes.get(dimensionType).values().forEach(s -> {
|
||||||
if ((!s.shape.debug || entityBoxes) && s.shouldRender(dimensionType))
|
if ((!s.shape.debug || entityBoxes) && s.shouldRender(dimensionType))
|
||||||
{
|
{
|
||||||
s.renderLines(matrices, tessellator, bufferBuilder, cameraX, cameraY, cameraZ, partialTick);
|
s.renderLines(matrices, tesselator, cameraX, cameraY, cameraZ, partialTick);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// faces
|
// faces
|
||||||
@@ -174,7 +175,7 @@ public class ShapesRenderer
|
|||||||
shapes.get(dimensionType).values().forEach(s -> {
|
shapes.get(dimensionType).values().forEach(s -> {
|
||||||
if ((!s.shape.debug || entityBoxes) && s.shouldRender(dimensionType))
|
if ((!s.shape.debug || entityBoxes) && s.shouldRender(dimensionType))
|
||||||
{
|
{
|
||||||
s.renderFaces(tessellator, bufferBuilder, cameraX, cameraY, cameraZ, partialTick);
|
s.renderFaces(tesselator, cameraX, cameraY, cameraZ, partialTick);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
RenderSystem.lineWidth(1.0F);
|
RenderSystem.lineWidth(1.0F);
|
||||||
@@ -190,7 +191,7 @@ public class ShapesRenderer
|
|||||||
labels.get(dimensionType).values().forEach(s -> {
|
labels.get(dimensionType).values().forEach(s -> {
|
||||||
if ((!s.shape.debug || entityBoxes) && s.shouldRender(dimensionType))
|
if ((!s.shape.debug || entityBoxes) && s.shouldRender(dimensionType))
|
||||||
{
|
{
|
||||||
s.renderLines(matrices, tessellator, bufferBuilder, cameraX, cameraY, cameraZ, partialTick);
|
s.renderLines(matrices, tesselator, cameraX, cameraY, cameraZ, partialTick);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -266,9 +267,9 @@ public class ShapesRenderer
|
|||||||
long expiryTick;
|
long expiryTick;
|
||||||
double renderEpsilon;
|
double renderEpsilon;
|
||||||
|
|
||||||
public abstract void renderLines(PoseStack matrices, Tesselator tessellator, BufferBuilder builder, double cx, double cy, double cz, float partialTick);
|
public abstract void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick);
|
||||||
|
|
||||||
public void renderFaces(Tesselator tessellator, BufferBuilder builder, double cx, double cy, double cz, float partialTick)
|
public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,7 +340,7 @@ public class ShapesRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderLines(PoseStack matrices, Tesselator tessellator, BufferBuilder builder, double cx, double cy,
|
public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy,
|
||||||
double cz, float partialTick)
|
double cz, float partialTick)
|
||||||
{
|
{
|
||||||
if (shape.a == 0.0)
|
if (shape.a == 0.0)
|
||||||
@@ -514,7 +515,7 @@ public class ShapesRenderer
|
|||||||
modelPart.setPos(0.0F, 24.0F - shulkerBoxBlockEntity.getProgress(f) * 0.5F * 16.0F, 0.0F);
|
modelPart.setPos(0.0F, 24.0F - shulkerBoxBlockEntity.getProgress(f) * 0.5F * 16.0F, 0.0F);
|
||||||
modelPart.yRot = 270.0F * shulkerBoxBlockEntity.getProgress(f) * (float) (Math.PI / 180.0);
|
modelPart.yRot = 270.0F * shulkerBoxBlockEntity.getProgress(f) * (float) (Math.PI / 180.0);
|
||||||
VertexConsumer vertexConsumer = material.buffer(multiBufferSource, RenderType::entityCutoutNoCull);
|
VertexConsumer vertexConsumer = material.buffer(multiBufferSource, RenderType::entityCutoutNoCull);
|
||||||
model.renderToBuffer(poseStack, vertexConsumer, i, j, 1.0F, 1.0F, 1.0F, 1.0F);
|
model.renderToBuffer(poseStack, vertexConsumer, i, j, 0xffffffff);
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -529,7 +530,7 @@ public class ShapesRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderLines(PoseStack matrices, Tesselator tessellator, BufferBuilder builder, double cx, double cy, double cz, float partialTick)
|
public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick)
|
||||||
{
|
{
|
||||||
if (shape.a == 0.0)
|
if (shape.a == 0.0)
|
||||||
{
|
{
|
||||||
@@ -579,7 +580,7 @@ public class ShapesRenderer
|
|||||||
{
|
{
|
||||||
text_x = (float) (-textRenderer.width(shape.value.getString()));
|
text_x = (float) (-textRenderer.width(shape.value.getString()));
|
||||||
}
|
}
|
||||||
MultiBufferSource.BufferSource immediate = MultiBufferSource.immediate(builder);
|
MultiBufferSource.BufferSource immediate = MultiBufferSource.immediate(new ByteBufferBuilder(RenderType.TRANSIENT_BUFFER_SIZE));
|
||||||
textRenderer.drawInBatch(shape.value, text_x, 0.0F, shape.textcolor, false, matrices.last().pose(), immediate, Font.DisplayMode.NORMAL, shape.textbck, 15728880);
|
textRenderer.drawInBatch(shape.value, text_x, 0.0F, shape.textcolor, false, matrices.last().pose(), immediate, Font.DisplayMode.NORMAL, shape.textbck, 15728880);
|
||||||
immediate.endBatch();
|
immediate.endBatch();
|
||||||
matrices.popPose();
|
matrices.popPose();
|
||||||
@@ -616,7 +617,7 @@ public class ShapesRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderLines(PoseStack matrices, Tesselator tessellator, BufferBuilder bufferBuilder, double cx, double cy, double cz, float partialTick)
|
public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick)
|
||||||
{
|
{
|
||||||
if (shape.a == 0.0)
|
if (shape.a == 0.0)
|
||||||
{
|
{
|
||||||
@@ -624,7 +625,7 @@ public class ShapesRenderer
|
|||||||
}
|
}
|
||||||
Vec3 v1 = shape.relativiseRender(client.level, shape.from, partialTick);
|
Vec3 v1 = shape.relativiseRender(client.level, shape.from, partialTick);
|
||||||
Vec3 v2 = shape.relativiseRender(client.level, shape.to, partialTick);
|
Vec3 v2 = shape.relativiseRender(client.level, shape.to, partialTick);
|
||||||
drawBoxWireGLLines(tessellator, bufferBuilder,
|
drawBoxWireGLLines(tesselator,
|
||||||
(float) (v1.x - cx - renderEpsilon), (float) (v1.y - cy - renderEpsilon), (float) (v1.z - cz - renderEpsilon),
|
(float) (v1.x - cx - renderEpsilon), (float) (v1.y - cy - renderEpsilon), (float) (v1.z - cz - renderEpsilon),
|
||||||
(float) (v2.x - cx + renderEpsilon), (float) (v2.y - cy + renderEpsilon), (float) (v2.z - cz + renderEpsilon),
|
(float) (v2.x - cx + renderEpsilon), (float) (v2.y - cy + renderEpsilon), (float) (v2.z - cz + renderEpsilon),
|
||||||
v1.x != v2.x, v1.y != v2.y, v1.z != v2.z,
|
v1.x != v2.x, v1.y != v2.y, v1.z != v2.z,
|
||||||
@@ -633,7 +634,7 @@ public class ShapesRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderFaces(Tesselator tessellator, BufferBuilder bufferBuilder, double cx, double cy, double cz, float partialTick)
|
public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick)
|
||||||
{
|
{
|
||||||
if (shape.fa == 0.0)
|
if (shape.fa == 0.0)
|
||||||
{
|
{
|
||||||
@@ -643,7 +644,7 @@ public class ShapesRenderer
|
|||||||
Vec3 v2 = shape.relativiseRender(client.level, shape.to, partialTick);
|
Vec3 v2 = shape.relativiseRender(client.level, shape.to, partialTick);
|
||||||
// consider using built-ins
|
// consider using built-ins
|
||||||
//DebugRenderer.drawBox(new Box(v1.x, v1.y, v1.z, v2.x, v2.y, v2.z), 0.5f, 0.5f, 0.5f, 0.5f);//shape.r, shape.g, shape.b, shape.a);
|
//DebugRenderer.drawBox(new Box(v1.x, v1.y, v1.z, v2.x, v2.y, v2.z), 0.5f, 0.5f, 0.5f, 0.5f);//shape.r, shape.g, shape.b, shape.a);
|
||||||
drawBoxFaces(tessellator, bufferBuilder,
|
drawBoxFaces(tesselator,
|
||||||
(float) (v1.x - cx - renderEpsilon), (float) (v1.y - cy - renderEpsilon), (float) (v1.z - cz - renderEpsilon),
|
(float) (v1.x - cx - renderEpsilon), (float) (v1.y - cy - renderEpsilon), (float) (v1.z - cz - renderEpsilon),
|
||||||
(float) (v2.x - cx + renderEpsilon), (float) (v2.y - cy + renderEpsilon), (float) (v2.z - cz + renderEpsilon),
|
(float) (v2.x - cx + renderEpsilon), (float) (v2.y - cy + renderEpsilon), (float) (v2.z - cz + renderEpsilon),
|
||||||
v1.x != v2.x, v1.y != v2.y, v1.z != v2.z,
|
v1.x != v2.x, v1.y != v2.y, v1.z != v2.z,
|
||||||
@@ -660,11 +661,11 @@ public class ShapesRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderLines(PoseStack matrices, Tesselator tessellator, BufferBuilder bufferBuilder, double cx, double cy, double cz, float partialTick)
|
public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick)
|
||||||
{
|
{
|
||||||
Vec3 v1 = shape.relativiseRender(client.level, shape.from, partialTick);
|
Vec3 v1 = shape.relativiseRender(client.level, shape.from, partialTick);
|
||||||
Vec3 v2 = shape.relativiseRender(client.level, shape.to, partialTick);
|
Vec3 v2 = shape.relativiseRender(client.level, shape.to, partialTick);
|
||||||
drawLine(tessellator, bufferBuilder,
|
drawLine(tesselator,
|
||||||
(float) (v1.x - cx - renderEpsilon), (float) (v1.y - cy - renderEpsilon), (float) (v1.z - cz - renderEpsilon),
|
(float) (v1.x - cx - renderEpsilon), (float) (v1.y - cy - renderEpsilon), (float) (v1.z - cz - renderEpsilon),
|
||||||
(float) (v2.x - cx + renderEpsilon), (float) (v2.y - cy + renderEpsilon), (float) (v2.z - cz + renderEpsilon),
|
(float) (v2.x - cx + renderEpsilon), (float) (v2.y - cy + renderEpsilon), (float) (v2.z - cz + renderEpsilon),
|
||||||
shape.r, shape.g, shape.b, shape.a
|
shape.r, shape.g, shape.b, shape.a
|
||||||
@@ -683,7 +684,7 @@ public class ShapesRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderFaces(Tesselator tessellator, BufferBuilder bufferBuilder, double cx, double cy, double cz, float partialTick)
|
public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick)
|
||||||
{
|
{
|
||||||
if (shape.fa == 0)
|
if (shape.fa == 0)
|
||||||
{
|
{
|
||||||
@@ -699,7 +700,7 @@ public class ShapesRenderer
|
|||||||
RenderSystem.enableCull();
|
RenderSystem.enableCull();
|
||||||
}
|
}
|
||||||
|
|
||||||
bufferBuilder.begin(faceIndices[shape.mode], DefaultVertexFormat.POSITION_COLOR);
|
BufferBuilder builder = tesselator.begin(faceIndices[shape.mode], DefaultVertexFormat.POSITION_COLOR);
|
||||||
for (int i = 0; i < shape.vertexList.size(); i++)
|
for (int i = 0; i < shape.vertexList.size(); i++)
|
||||||
{
|
{
|
||||||
Vec3 vec = shape.vertexList.get(i);
|
Vec3 vec = shape.vertexList.get(i);
|
||||||
@@ -707,9 +708,9 @@ public class ShapesRenderer
|
|||||||
{
|
{
|
||||||
vec = shape.relativiseRender(client.level, vec, partialTick);
|
vec = shape.relativiseRender(client.level, vec, partialTick);
|
||||||
}
|
}
|
||||||
bufferBuilder.vertex(vec.x() - cx, vec.y() - cy, vec.z() - cz).color(shape.fr, shape.fg, shape.fb, shape.fa).endVertex();
|
builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.fr, shape.fg, shape.fb, shape.fa);
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
|
|
||||||
RenderSystem.disableCull();
|
RenderSystem.disableCull();
|
||||||
RenderSystem.depthMask(false);
|
RenderSystem.depthMask(false);
|
||||||
@@ -719,7 +720,7 @@ public class ShapesRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderLines(PoseStack matrices, Tesselator tessellator, BufferBuilder builder, double cx, double cy,
|
public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy,
|
||||||
double cz, float partialTick)
|
double cz, float partialTick)
|
||||||
{
|
{
|
||||||
if (shape.a == 0)
|
if (shape.a == 0)
|
||||||
@@ -729,7 +730,7 @@ public class ShapesRenderer
|
|||||||
|
|
||||||
if (shape.mode == 6)
|
if (shape.mode == 6)
|
||||||
{
|
{
|
||||||
builder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
|
||||||
Vec3 vec0 = null;
|
Vec3 vec0 = null;
|
||||||
for (int i = 0; i < shape.vertexList.size(); i++)
|
for (int i = 0; i < shape.vertexList.size(); i++)
|
||||||
{
|
{
|
||||||
@@ -742,13 +743,13 @@ public class ShapesRenderer
|
|||||||
{
|
{
|
||||||
vec0 = vec;
|
vec0 = vec;
|
||||||
}
|
}
|
||||||
builder.vertex(vec.x() - cx, vec.y() - cy, vec.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex();
|
builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
|
||||||
}
|
}
|
||||||
builder.vertex(vec0.x() - cx, vec0.y() - cy, vec0.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex();
|
builder.addVertex((float) (vec0.x() - cx), (float) (vec0.y() - cy), (float) (vec0.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
if (shape.inneredges)
|
if (shape.inneredges)
|
||||||
{
|
{
|
||||||
builder.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR);
|
BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR);
|
||||||
for (int i = 1; i < shape.vertexList.size() - 1; i++)
|
for (int i = 1; i < shape.vertexList.size() - 1; i++)
|
||||||
{
|
{
|
||||||
Vec3 vec = shape.vertexList.get(i);
|
Vec3 vec = shape.vertexList.get(i);
|
||||||
@@ -757,22 +758,22 @@ public class ShapesRenderer
|
|||||||
vec = shape.relativiseRender(client.level, vec, partialTick);
|
vec = shape.relativiseRender(client.level, vec, partialTick);
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.vertex(vec.x() - cx, vec.y() - cy, vec.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex();
|
builderr.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
|
||||||
builder.vertex(vec0.x() - cx, vec0.y() - cy, vec0.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex();
|
builderr.addVertex((float) (vec0.x() - cx), (float) (vec0.y() - cy), (float) (vec0.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builderr.buildOrThrow());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (shape.mode == 5)
|
if (shape.mode == 5)
|
||||||
{
|
{
|
||||||
builder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
|
||||||
Vec3 vec = shape.vertexList.get(1);
|
Vec3 vec = shape.vertexList.get(1);
|
||||||
if (shape.relative.get(1))
|
if (shape.relative.get(1))
|
||||||
{
|
{
|
||||||
vec = shape.relativiseRender(client.level, vec, partialTick);
|
vec = shape.relativiseRender(client.level, vec, partialTick);
|
||||||
}
|
}
|
||||||
builder.vertex(vec.x() - cx, vec.y() - cy, vec.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex();
|
builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < shape.vertexList.size(); i += 2)
|
for (i = 0; i < shape.vertexList.size(); i += 2)
|
||||||
{
|
{
|
||||||
@@ -781,7 +782,7 @@ public class ShapesRenderer
|
|||||||
{
|
{
|
||||||
vec = shape.relativiseRender(client.level, vec, partialTick);
|
vec = shape.relativiseRender(client.level, vec, partialTick);
|
||||||
}
|
}
|
||||||
builder.vertex(vec.x() - cx, vec.y() - cy, vec.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex();
|
builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
|
||||||
}
|
}
|
||||||
i = shape.vertexList.size() - 1;
|
i = shape.vertexList.size() - 1;
|
||||||
for (i -= 1 - i % 2; i > 0; i -= 2)
|
for (i -= 1 - i % 2; i > 0; i -= 2)
|
||||||
@@ -791,7 +792,7 @@ public class ShapesRenderer
|
|||||||
{
|
{
|
||||||
vec = shape.relativiseRender(client.level, vec, partialTick);
|
vec = shape.relativiseRender(client.level, vec, partialTick);
|
||||||
}
|
}
|
||||||
builder.vertex(vec.x() - cx, vec.y() - cy, vec.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex();
|
builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
|
||||||
}
|
}
|
||||||
if (shape.inneredges)
|
if (shape.inneredges)
|
||||||
{
|
{
|
||||||
@@ -802,15 +803,15 @@ public class ShapesRenderer
|
|||||||
{
|
{
|
||||||
vec = shape.relativiseRender(client.level, vec, partialTick);
|
vec = shape.relativiseRender(client.level, vec, partialTick);
|
||||||
}
|
}
|
||||||
builder.vertex(vec.x() - cx, vec.y() - cy, vec.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex();
|
builder.addVertex((float) (vec.x() - cx), (float) (vec.y() - cy), (float) (vec.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (shape.mode == 4)
|
if (shape.mode == 4)
|
||||||
{
|
{
|
||||||
builder.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR);
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR);
|
||||||
for (int i = 0; i < shape.vertexList.size(); i++)
|
for (int i = 0; i < shape.vertexList.size(); i++)
|
||||||
{
|
{
|
||||||
Vec3 vecA = shape.vertexList.get(i);
|
Vec3 vecA = shape.vertexList.get(i);
|
||||||
@@ -830,16 +831,16 @@ public class ShapesRenderer
|
|||||||
{
|
{
|
||||||
vecC = shape.relativiseRender(client.level, vecC, partialTick);
|
vecC = shape.relativiseRender(client.level, vecC, partialTick);
|
||||||
}
|
}
|
||||||
builder.vertex(vecA.x() - cx, vecA.y() - cy, vecA.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex();
|
builder.addVertex((float) (vecA.x() - cx), (float) (vecA.y() - cy), (float) (vecA.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
|
||||||
builder.vertex(vecB.x() - cx, vecB.y() - cy, vecB.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex();
|
builder.addVertex((float) (vecB.x() - cx), (float) (vecB.y() - cy), (float) (vecB.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
|
||||||
|
|
||||||
builder.vertex(vecB.x() - cx, vecB.y() - cy, vecB.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex();
|
builder.addVertex((float) (vecB.x() - cx), (float) (vecB.y() - cy), (float) (vecB.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
|
||||||
builder.vertex(vecC.x() - cx, vecC.y() - cy, vecC.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex();
|
builder.addVertex((float) (vecC.x() - cx), (float) (vecC.y() - cy), (float) (vecC.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
|
||||||
|
|
||||||
builder.vertex(vecC.x() - cx, vecC.y() - cy, vecC.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex();
|
builder.addVertex((float) (vecC.x() - cx), (float) (vecC.y() - cy), (float) (vecC.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
|
||||||
builder.vertex(vecA.x() - cx, vecA.y() - cy, vecA.z() - cz).color(shape.r, shape.g, shape.b, shape.a).endVertex();
|
builder.addVertex((float) (vecA.x() - cx), (float) (vecA.y() - cy), (float) (vecA.z() - cz)).setColor(shape.r, shape.g, shape.b, shape.a);
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -852,28 +853,28 @@ public class ShapesRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderLines(PoseStack matrices, Tesselator tessellator, BufferBuilder bufferBuilder, double cx, double cy, double cz, float partialTick)
|
public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick)
|
||||||
{
|
{
|
||||||
if (shape.a == 0.0)
|
if (shape.a == 0.0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Vec3 vc = shape.relativiseRender(client.level, shape.center, partialTick);
|
Vec3 vc = shape.relativiseRender(client.level, shape.center, partialTick);
|
||||||
drawSphereWireframe(tessellator, bufferBuilder,
|
drawSphereWireframe(tesselator,
|
||||||
(float) (vc.x - cx), (float) (vc.y - cy), (float) (vc.z - cz),
|
(float) (vc.x - cx), (float) (vc.y - cy), (float) (vc.z - cz),
|
||||||
(float) (shape.radius + renderEpsilon), shape.subdivisions,
|
(float) (shape.radius + renderEpsilon), shape.subdivisions,
|
||||||
shape.r, shape.g, shape.b, shape.a);
|
shape.r, shape.g, shape.b, shape.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderFaces(Tesselator tessellator, BufferBuilder bufferBuilder, double cx, double cy, double cz, float partialTick)
|
public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick)
|
||||||
{
|
{
|
||||||
if (shape.fa == 0.0)
|
if (shape.fa == 0.0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Vec3 vc = shape.relativiseRender(client.level, shape.center, partialTick);
|
Vec3 vc = shape.relativiseRender(client.level, shape.center, partialTick);
|
||||||
drawSphereFaces(tessellator, bufferBuilder,
|
drawSphereFaces(tesselator,
|
||||||
(float) (vc.x - cx), (float) (vc.y - cy), (float) (vc.z - cz),
|
(float) (vc.x - cx), (float) (vc.y - cy), (float) (vc.z - cz),
|
||||||
(float) (shape.radius + renderEpsilon), shape.subdivisions,
|
(float) (shape.radius + renderEpsilon), shape.subdivisions,
|
||||||
shape.fr, shape.fg, shape.fb, shape.fa);
|
shape.fr, shape.fg, shape.fb, shape.fa);
|
||||||
@@ -888,7 +889,7 @@ public class ShapesRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderLines(PoseStack matrices, Tesselator tessellator, BufferBuilder bufferBuilder, double cx, double cy, double cz, float partialTick)
|
public void renderLines(PoseStack matrices, Tesselator tesselator, double cx, double cy, double cz, float partialTick)
|
||||||
{
|
{
|
||||||
if (shape.a == 0.0)
|
if (shape.a == 0.0)
|
||||||
{
|
{
|
||||||
@@ -896,7 +897,7 @@ public class ShapesRenderer
|
|||||||
}
|
}
|
||||||
Vec3 vc = shape.relativiseRender(client.level, shape.center, partialTick);
|
Vec3 vc = shape.relativiseRender(client.level, shape.center, partialTick);
|
||||||
double dir = Mth.sign(shape.height);
|
double dir = Mth.sign(shape.height);
|
||||||
drawCylinderWireframe(tessellator, bufferBuilder,
|
drawCylinderWireframe(tesselator,
|
||||||
(float) (vc.x - cx - dir * renderEpsilon), (float) (vc.y - cy - dir * renderEpsilon), (float) (vc.z - cz - dir * renderEpsilon),
|
(float) (vc.x - cx - dir * renderEpsilon), (float) (vc.y - cy - dir * renderEpsilon), (float) (vc.z - cz - dir * renderEpsilon),
|
||||||
(float) (shape.radius + renderEpsilon), (float) (shape.height + 2 * dir * renderEpsilon), shape.axis,
|
(float) (shape.radius + renderEpsilon), (float) (shape.height + 2 * dir * renderEpsilon), shape.axis,
|
||||||
shape.subdivisions, shape.radius == 0,
|
shape.subdivisions, shape.radius == 0,
|
||||||
@@ -905,7 +906,7 @@ public class ShapesRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderFaces(Tesselator tessellator, BufferBuilder bufferBuilder, double cx, double cy, double cz, float partialTick)
|
public void renderFaces(Tesselator tesselator, double cx, double cy, double cz, float partialTick)
|
||||||
{
|
{
|
||||||
if (shape.fa == 0.0)
|
if (shape.fa == 0.0)
|
||||||
{
|
{
|
||||||
@@ -913,7 +914,7 @@ public class ShapesRenderer
|
|||||||
}
|
}
|
||||||
Vec3 vc = shape.relativiseRender(client.level, shape.center, partialTick);
|
Vec3 vc = shape.relativiseRender(client.level, shape.center, partialTick);
|
||||||
double dir = Mth.sign(shape.height);
|
double dir = Mth.sign(shape.height);
|
||||||
drawCylinderFaces(tessellator, bufferBuilder,
|
drawCylinderFaces(tesselator,
|
||||||
(float) (vc.x - cx - dir * renderEpsilon), (float) (vc.y - cy - dir * renderEpsilon), (float) (vc.z - cz - dir * renderEpsilon),
|
(float) (vc.x - cx - dir * renderEpsilon), (float) (vc.y - cy - dir * renderEpsilon), (float) (vc.z - cz - dir * renderEpsilon),
|
||||||
(float) (shape.radius + renderEpsilon), (float) (shape.height + 2 * dir * renderEpsilon), shape.axis,
|
(float) (shape.radius + renderEpsilon), (float) (shape.height + 2 * dir * renderEpsilon), shape.axis,
|
||||||
shape.subdivisions, shape.radius == 0,
|
shape.subdivisions, shape.radius == 0,
|
||||||
@@ -923,129 +924,129 @@ public class ShapesRenderer
|
|||||||
|
|
||||||
// some raw shit
|
// some raw shit
|
||||||
|
|
||||||
public static void drawLine(Tesselator tessellator, BufferBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2, float red1, float grn1, float blu1, float alpha)
|
public static void drawLine(Tesselator tesselator, float x1, float y1, float z1, float x2, float y2, float z2, float red1, float grn1, float blu1, float alpha)
|
||||||
{
|
{
|
||||||
builder.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR);
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR);
|
||||||
builder.vertex(x1, y1, z1).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x1, y1, z1).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawBoxWireGLLines(
|
public static void drawBoxWireGLLines(
|
||||||
Tesselator tessellator, BufferBuilder builder,
|
Tesselator tesselator,
|
||||||
float x1, float y1, float z1,
|
float x1, float y1, float z1,
|
||||||
float x2, float y2, float z2,
|
float x2, float y2, float z2,
|
||||||
boolean xthick, boolean ythick, boolean zthick,
|
boolean xthick, boolean ythick, boolean zthick,
|
||||||
float red1, float grn1, float blu1, float alpha, float red2, float grn2, float blu2)
|
float red1, float grn1, float blu1, float alpha, float red2, float grn2, float blu2)
|
||||||
{
|
{
|
||||||
builder.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR);
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR);
|
||||||
if (xthick)
|
if (xthick)
|
||||||
{
|
{
|
||||||
builder.vertex(x1, y1, z1).color(red1, grn2, blu2, alpha).endVertex();
|
builder.addVertex(x1, y1, z1).setColor(red1, grn2, blu2, alpha);
|
||||||
builder.vertex(x2, y1, z1).color(red1, grn2, blu2, alpha).endVertex();
|
builder.addVertex(x2, y1, z1).setColor(red1, grn2, blu2, alpha);
|
||||||
|
|
||||||
builder.vertex(x2, y2, z1).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x1, y2, z1).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x1, y2, z1).setColor(red1, grn1, blu1, alpha);
|
||||||
|
|
||||||
builder.vertex(x1, y1, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x1, y1, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x2, y1, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
|
|
||||||
builder.vertex(x1, y2, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
}
|
}
|
||||||
if (ythick)
|
if (ythick)
|
||||||
{
|
{
|
||||||
builder.vertex(x1, y1, z1).color(red2, grn1, blu2, alpha).endVertex();
|
builder.addVertex(x1, y1, z1).setColor(red2, grn1, blu2, alpha);
|
||||||
builder.vertex(x1, y2, z1).color(red2, grn1, blu2, alpha).endVertex();
|
builder.addVertex(x1, y2, z1).setColor(red2, grn1, blu2, alpha);
|
||||||
|
|
||||||
builder.vertex(x2, y1, z1).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y1, z1).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x2, y2, z1).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha);
|
||||||
|
|
||||||
builder.vertex(x1, y2, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x1, y1, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x1, y1, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
|
|
||||||
builder.vertex(x2, y1, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
}
|
}
|
||||||
if (zthick)
|
if (zthick)
|
||||||
{
|
{
|
||||||
builder.vertex(x1, y1, z1).color(red2, grn2, blu1, alpha).endVertex();
|
builder.addVertex(x1, y1, z1).setColor(red2, grn2, blu1, alpha);
|
||||||
builder.vertex(x1, y1, z2).color(red2, grn2, blu1, alpha).endVertex();
|
builder.addVertex(x1, y1, z2).setColor(red2, grn2, blu1, alpha);
|
||||||
|
|
||||||
builder.vertex(x1, y2, z1).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x1, y2, z1).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x1, y2, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
|
|
||||||
builder.vertex(x2, y1, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x2, y1, z1).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y1, z1).setColor(red1, grn1, blu1, alpha);
|
||||||
|
|
||||||
builder.vertex(x2, y2, z1).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawBoxFaces(
|
public static void drawBoxFaces(
|
||||||
Tesselator tessellator, BufferBuilder builder,
|
Tesselator tesselator,
|
||||||
float x1, float y1, float z1,
|
float x1, float y1, float z1,
|
||||||
float x2, float y2, float z2,
|
float x2, float y2, float z2,
|
||||||
boolean xthick, boolean ythick, boolean zthick,
|
boolean xthick, boolean ythick, boolean zthick,
|
||||||
float red1, float grn1, float blu1, float alpha)
|
float red1, float grn1, float blu1, float alpha)
|
||||||
{
|
{
|
||||||
builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);
|
||||||
|
|
||||||
if (xthick && ythick)
|
if (xthick && ythick)
|
||||||
{
|
{
|
||||||
builder.vertex(x1, y1, z1).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x1, y1, z1).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x2, y1, z1).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y1, z1).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x2, y2, z1).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x1, y2, z1).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x1, y2, z1).setColor(red1, grn1, blu1, alpha);
|
||||||
if (zthick)
|
if (zthick)
|
||||||
{
|
{
|
||||||
builder.vertex(x1, y1, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x1, y1, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x1, y2, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x2, y1, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (zthick && ythick)
|
if (zthick && ythick)
|
||||||
{
|
{
|
||||||
builder.vertex(x1, y1, z1).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x1, y1, z1).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x1, y2, z1).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x1, y2, z1).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x1, y2, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x1, y1, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x1, y1, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
|
|
||||||
if (xthick)
|
if (xthick)
|
||||||
{
|
{
|
||||||
builder.vertex(x2, y1, z1).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y1, z1).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x2, y1, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x2, y2, z1).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// now at least drawing one
|
// now at least drawing one
|
||||||
if (zthick && xthick)
|
if (zthick && xthick)
|
||||||
{
|
{
|
||||||
builder.vertex(x1, y1, z1).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x1, y1, z1).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x2, y1, z1).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y1, z1).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x2, y1, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y1, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x1, y1, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x1, y1, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
|
|
||||||
|
|
||||||
if (ythick)
|
if (ythick)
|
||||||
{
|
{
|
||||||
builder.vertex(x1, y2, z1).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x1, y2, z1).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x2, y2, z1).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y2, z1).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x2, y2, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
builder.vertex(x1, y2, z2).color(red1, grn1, blu1, alpha).endVertex();
|
builder.addVertex(x1, y2, z2).setColor(red1, grn1, blu1, alpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawCylinderWireframe(Tesselator tessellator, BufferBuilder builder,
|
public static void drawCylinderWireframe(Tesselator tesselator,
|
||||||
float cx, float cy, float cz,
|
float cx, float cy, float cz,
|
||||||
float r, float h, Direction.Axis axis, int subd, boolean isFlat,
|
float r, float h, Direction.Axis axis, int subd, boolean isFlat,
|
||||||
float red, float grn, float blu, float alpha)
|
float red, float grn, float blu, float alpha)
|
||||||
@@ -1066,48 +1067,48 @@ public class ShapesRenderer
|
|||||||
for (int dh = 0; dh < hsteps; dh++)
|
for (int dh = 0; dh < hsteps; dh++)
|
||||||
{
|
{
|
||||||
float hh = dh * hstep;
|
float hh = dh * hstep;
|
||||||
builder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip
|
||||||
for (int i = 0; i <= num_steps360 + 1; i++)
|
for (int i = 0; i <= num_steps360 + 1; i++)
|
||||||
{
|
{
|
||||||
float theta = step * i;
|
float theta = step * i;
|
||||||
float x = r * Mth.cos(theta);
|
float x = r * Mth.cos(theta);
|
||||||
float y = hh;
|
float y = hh;
|
||||||
float z = r * Mth.sin(theta);
|
float z = r * Mth.sin(theta);
|
||||||
builder.vertex(x + cx, y + cy, z + cz).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha);
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isFlat)
|
if (!isFlat)
|
||||||
{
|
{
|
||||||
for (int i = 0; i <= num_steps180; i++)
|
for (int i = 0; i <= num_steps180; i++)
|
||||||
{
|
{
|
||||||
builder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip
|
||||||
float theta = step * i;
|
float theta = step * i;
|
||||||
float x = r * Mth.cos(theta);
|
float x = r * Mth.cos(theta);
|
||||||
|
|
||||||
float z = r * Mth.sin(theta);
|
float z = r * Mth.sin(theta);
|
||||||
|
|
||||||
builder.vertex(cx - x, cy + 0, cz + z).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx - x, cy + 0, cz + z).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx + x, cy + 0, cz - z).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx + x, cy + 0, cz - z).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx + x, cy + h, cz - z).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx + x, cy + h, cz - z).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx - x, cy + h, cz + z).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx - x, cy + h, cz + z).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx - x, cy + 0, cz + z).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx - x, cy + 0, cz + z).setColor(red, grn, blu, alpha);
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
builder.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR);
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR);
|
||||||
for (int i = 0; i <= num_steps180; i++)
|
for (int i = 0; i <= num_steps180; i++)
|
||||||
{
|
{
|
||||||
float theta = step * i;
|
float theta = step * i;
|
||||||
float x = r * Mth.cos(theta);
|
float x = r * Mth.cos(theta);
|
||||||
float z = r * Mth.sin(theta);
|
float z = r * Mth.sin(theta);
|
||||||
builder.vertex(cx - x, cy, cz + z).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx - x, cy, cz + z).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx + x, cy, cz - z).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx + x, cy, cz - z).setColor(red, grn, blu, alpha);
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1116,47 +1117,47 @@ public class ShapesRenderer
|
|||||||
for (int dh = 0; dh < hsteps; dh++)
|
for (int dh = 0; dh < hsteps; dh++)
|
||||||
{
|
{
|
||||||
float hh = dh * hstep;
|
float hh = dh * hstep;
|
||||||
builder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip
|
||||||
for (int i = 0; i <= num_steps360; i++)
|
for (int i = 0; i <= num_steps360; i++)
|
||||||
{
|
{
|
||||||
float theta = step * i;
|
float theta = step * i;
|
||||||
float z = r * Mth.cos(theta);
|
float z = r * Mth.cos(theta);
|
||||||
float x = hh;
|
float x = hh;
|
||||||
float y = r * Mth.sin(theta);
|
float y = r * Mth.sin(theta);
|
||||||
builder.vertex(x + cx, y + cy, z + cz).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha);
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isFlat)
|
if (!isFlat)
|
||||||
{
|
{
|
||||||
for (int i = 0; i <= num_steps180; i++)
|
for (int i = 0; i <= num_steps180; i++)
|
||||||
{
|
{
|
||||||
builder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip
|
||||||
float theta = step * i;
|
float theta = step * i;
|
||||||
float y = r * Mth.cos(theta);
|
float y = r * Mth.cos(theta);
|
||||||
|
|
||||||
float z = r * Mth.sin(theta);
|
float z = r * Mth.sin(theta);
|
||||||
|
|
||||||
builder.vertex(cx + 0, cy - y, cz + z).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx + 0, cy - y, cz + z).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx + 0, cy + y, cz - z).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx + 0, cy + y, cz - z).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx + h, cy + y, cz - z).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx + h, cy + y, cz - z).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx + h, cy - y, cz + z).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx + h, cy - y, cz + z).setColor(red, grn, blu, alpha);
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
builder.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR);
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR);
|
||||||
for (int i = 0; i <= num_steps180; i++)
|
for (int i = 0; i <= num_steps180; i++)
|
||||||
{
|
{
|
||||||
float theta = step * i;
|
float theta = step * i;
|
||||||
float y = r * Mth.cos(theta);
|
float y = r * Mth.cos(theta);
|
||||||
float z = r * Mth.sin(theta);
|
float z = r * Mth.sin(theta);
|
||||||
builder.vertex(cx, cy - y, cz + z).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx, cy - y, cz + z).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx, cy + y, cz - z).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx, cy + y, cz - z).setColor(red, grn, blu, alpha);
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (axis == Direction.Axis.Z)
|
else if (axis == Direction.Axis.Z)
|
||||||
@@ -1164,52 +1165,52 @@ public class ShapesRenderer
|
|||||||
for (int dh = 0; dh < hsteps; dh++)
|
for (int dh = 0; dh < hsteps; dh++)
|
||||||
{
|
{
|
||||||
float hh = dh * hstep;
|
float hh = dh * hstep;
|
||||||
builder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip
|
||||||
for (int i = 0; i <= num_steps360; i++)
|
for (int i = 0; i <= num_steps360; i++)
|
||||||
{
|
{
|
||||||
float theta = step * i;
|
float theta = step * i;
|
||||||
float y = r * Mth.cos(theta);
|
float y = r * Mth.cos(theta);
|
||||||
float z = hh;
|
float z = hh;
|
||||||
float x = r * Mth.sin(theta);
|
float x = r * Mth.sin(theta);
|
||||||
builder.vertex(x + cx, y + cy, z + cz).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha);
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
}
|
}
|
||||||
if (!isFlat)
|
if (!isFlat)
|
||||||
{
|
{
|
||||||
for (int i = 0; i <= num_steps180; i++)
|
for (int i = 0; i <= num_steps180; i++)
|
||||||
{
|
{
|
||||||
builder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip
|
||||||
float theta = step * i;
|
float theta = step * i;
|
||||||
float x = r * Mth.cos(theta);
|
float x = r * Mth.cos(theta);
|
||||||
|
|
||||||
float y = r * Mth.sin(theta);
|
float y = r * Mth.sin(theta);
|
||||||
|
|
||||||
builder.vertex(cx + x, cy - y, cz + 0).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx + x, cy - y, cz + 0).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx - x, cy + y, cz + 0).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx - x, cy + y, cz + 0).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx - x, cy + y, cz + h).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx - x, cy + y, cz + h).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx + x, cy - y, cz + h).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx + x, cy - y, cz + h).setColor(red, grn, blu, alpha);
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
builder.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR);
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR);
|
||||||
for (int i = 0; i <= num_steps180; i++)
|
for (int i = 0; i <= num_steps180; i++)
|
||||||
{
|
{
|
||||||
float theta = step * i;
|
float theta = step * i;
|
||||||
float x = r * Mth.cos(theta);
|
float x = r * Mth.cos(theta);
|
||||||
float y = r * Mth.sin(theta);
|
float y = r * Mth.sin(theta);
|
||||||
builder.vertex(cx + x, cy - y, cz).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx + x, cy - y, cz).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx - x, cy + y, cz).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx - x, cy + y, cz).setColor(red, grn, blu, alpha);
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawCylinderFaces(Tesselator tessellator, BufferBuilder builder,
|
public static void drawCylinderFaces(Tesselator tesselator,
|
||||||
float cx, float cy, float cz,
|
float cx, float cy, float cz,
|
||||||
float r, float h, Direction.Axis axis, int subd, boolean isFlat,
|
float r, float h, Direction.Axis axis, int subd, boolean isFlat,
|
||||||
float red, float grn, float blu, float alpha)
|
float red, float grn, float blu, float alpha)
|
||||||
@@ -1221,30 +1222,30 @@ public class ShapesRenderer
|
|||||||
if (axis == Direction.Axis.Y)
|
if (axis == Direction.Axis.Y)
|
||||||
{
|
{
|
||||||
|
|
||||||
builder.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR);
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR);
|
||||||
builder.vertex(cx, cy, cz).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx, cy, cz).setColor(red, grn, blu, alpha);
|
||||||
for (int i = 0; i <= num_steps360; i++)
|
for (int i = 0; i <= num_steps360; i++)
|
||||||
{
|
{
|
||||||
float theta = step * i;
|
float theta = step * i;
|
||||||
float x = r * Mth.cos(theta);
|
float x = r * Mth.cos(theta);
|
||||||
float z = r * Mth.sin(theta);
|
float z = r * Mth.sin(theta);
|
||||||
builder.vertex(x + cx, cy, z + cz).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(x + cx, cy, z + cz).setColor(red, grn, blu, alpha);
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
if (!isFlat)
|
if (!isFlat)
|
||||||
{
|
{
|
||||||
builder.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR);
|
BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR);
|
||||||
builder.vertex(cx, cy + h, cz).color(red, grn, blu, alpha).endVertex();
|
builderr.addVertex(cx, cy + h, cz).setColor(red, grn, blu, alpha);
|
||||||
for (int i = 0; i <= num_steps360; i++)
|
for (int i = 0; i <= num_steps360; i++)
|
||||||
{
|
{
|
||||||
float theta = step * i;
|
float theta = step * i;
|
||||||
float x = r * Mth.cos(theta);
|
float x = r * Mth.cos(theta);
|
||||||
float z = r * Mth.sin(theta);
|
float z = r * Mth.sin(theta);
|
||||||
builder.vertex(x + cx, cy + h, z + cz).color(red, grn, blu, alpha).endVertex();
|
builderr.addVertex(x + cx, cy + h, z + cz).setColor(red, grn, blu, alpha);
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builderr.buildOrThrow());
|
||||||
|
|
||||||
builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads
|
BufferBuilder builderrr = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads
|
||||||
float xp = r * 1;
|
float xp = r * 1;
|
||||||
float zp = r * 0;
|
float zp = r * 0;
|
||||||
for (int i = 1; i <= num_steps360; i++)
|
for (int i = 1; i <= num_steps360; i++)
|
||||||
@@ -1252,43 +1253,43 @@ public class ShapesRenderer
|
|||||||
float theta = step * i;
|
float theta = step * i;
|
||||||
float x = r * Mth.cos(theta);
|
float x = r * Mth.cos(theta);
|
||||||
float z = r * Mth.sin(theta);
|
float z = r * Mth.sin(theta);
|
||||||
builder.vertex(cx + xp, cy + 0, cz + zp).color(red, grn, blu, alpha).endVertex();
|
builderrr.addVertex(cx + xp, cy + 0, cz + zp).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx + xp, cy + h, cz + zp).color(red, grn, blu, alpha).endVertex();
|
builderrr.addVertex(cx + xp, cy + h, cz + zp).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx + x, cy + h, cz + z).color(red, grn, blu, alpha).endVertex();
|
builderrr.addVertex(cx + x, cy + h, cz + z).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx + x, cy + 0, cz + z).color(red, grn, blu, alpha).endVertex();
|
builderrr.addVertex(cx + x, cy + 0, cz + z).setColor(red, grn, blu, alpha);
|
||||||
xp = x;
|
xp = x;
|
||||||
zp = z;
|
zp = z;
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builderrr.buildOrThrow());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (axis == Direction.Axis.X)
|
else if (axis == Direction.Axis.X)
|
||||||
{
|
{
|
||||||
builder.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR);
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR);
|
||||||
builder.vertex(cx, cy, cz).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx, cy, cz).setColor(red, grn, blu, alpha);
|
||||||
for (int i = 0; i <= num_steps360; i++)
|
for (int i = 0; i <= num_steps360; i++)
|
||||||
{
|
{
|
||||||
float theta = step * i;
|
float theta = step * i;
|
||||||
float y = r * Mth.cos(theta);
|
float y = r * Mth.cos(theta);
|
||||||
float z = r * Mth.sin(theta);
|
float z = r * Mth.sin(theta);
|
||||||
builder.vertex(cx, cy + y, z + cz).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx, cy + y, z + cz).setColor(red, grn, blu, alpha);
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
if (!isFlat)
|
if (!isFlat)
|
||||||
{
|
{
|
||||||
builder.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR);
|
BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR);
|
||||||
builder.vertex(cx + h, cy, cz).color(red, grn, blu, alpha).endVertex();
|
builderr.addVertex(cx + h, cy, cz).setColor(red, grn, blu, alpha);
|
||||||
for (int i = 0; i <= num_steps360; i++)
|
for (int i = 0; i <= num_steps360; i++)
|
||||||
{
|
{
|
||||||
float theta = step * i;
|
float theta = step * i;
|
||||||
float y = r * Mth.cos(theta);
|
float y = r * Mth.cos(theta);
|
||||||
float z = r * Mth.sin(theta);
|
float z = r * Mth.sin(theta);
|
||||||
builder.vertex(cx + h, cy + y, cz + z).color(red, grn, blu, alpha).endVertex();
|
builderr.addVertex(cx + h, cy + y, cz + z).setColor(red, grn, blu, alpha);
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builderr.buildOrThrow());
|
||||||
|
|
||||||
builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads
|
BufferBuilder builderrr = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads
|
||||||
float yp = r * 1;
|
float yp = r * 1;
|
||||||
float zp = r * 0;
|
float zp = r * 0;
|
||||||
for (int i = 1; i <= num_steps360; i++)
|
for (int i = 1; i <= num_steps360; i++)
|
||||||
@@ -1296,42 +1297,42 @@ public class ShapesRenderer
|
|||||||
float theta = step * i;
|
float theta = step * i;
|
||||||
float y = r * Mth.cos(theta);
|
float y = r * Mth.cos(theta);
|
||||||
float z = r * Mth.sin(theta);
|
float z = r * Mth.sin(theta);
|
||||||
builder.vertex(cx + 0, cy + yp, cz + zp).color(red, grn, blu, alpha).endVertex();
|
builderrr.addVertex(cx + 0, cy + yp, cz + zp).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx + h, cy + yp, cz + zp).color(red, grn, blu, alpha).endVertex();
|
builderrr.addVertex(cx + h, cy + yp, cz + zp).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx + h, cy + y, cz + z).color(red, grn, blu, alpha).endVertex();
|
builderrr.addVertex(cx + h, cy + y, cz + z).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx + 0, cy + y, cz + z).color(red, grn, blu, alpha).endVertex();
|
builderrr.addVertex(cx + 0, cy + y, cz + z).setColor(red, grn, blu, alpha);
|
||||||
yp = y;
|
yp = y;
|
||||||
zp = z;
|
zp = z;
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builderrr.buildOrThrow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (axis == Direction.Axis.Z)
|
else if (axis == Direction.Axis.Z)
|
||||||
{
|
{
|
||||||
builder.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR);
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR);
|
||||||
builder.vertex(cx, cy, cz).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(cx, cy, cz).setColor(red, grn, blu, alpha);
|
||||||
for (int i = 0; i <= num_steps360; i++)
|
for (int i = 0; i <= num_steps360; i++)
|
||||||
{
|
{
|
||||||
float theta = step * i;
|
float theta = step * i;
|
||||||
float x = r * Mth.cos(theta);
|
float x = r * Mth.cos(theta);
|
||||||
float y = r * Mth.sin(theta);
|
float y = r * Mth.sin(theta);
|
||||||
builder.vertex(x + cx, cy + y, cz).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(x + cx, cy + y, cz).setColor(red, grn, blu, alpha);
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
if (!isFlat)
|
if (!isFlat)
|
||||||
{
|
{
|
||||||
builder.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR);
|
BufferBuilder builderr = tesselator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR);
|
||||||
builder.vertex(cx, cy, cz + h).color(red, grn, blu, alpha).endVertex();
|
builderr.addVertex(cx, cy, cz + h).setColor(red, grn, blu, alpha);
|
||||||
for (int i = 0; i <= num_steps360; i++)
|
for (int i = 0; i <= num_steps360; i++)
|
||||||
{
|
{
|
||||||
float theta = step * i;
|
float theta = step * i;
|
||||||
float x = r * Mth.cos(theta);
|
float x = r * Mth.cos(theta);
|
||||||
float y = r * Mth.sin(theta);
|
float y = r * Mth.sin(theta);
|
||||||
builder.vertex(x + cx, cy + y, cz + h).color(red, grn, blu, alpha).endVertex();
|
builderr.addVertex(x + cx, cy + y, cz + h).setColor(red, grn, blu, alpha);
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builderr.buildOrThrow());
|
||||||
|
|
||||||
builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads
|
BufferBuilder builderrr = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads
|
||||||
float xp = r;
|
float xp = r;
|
||||||
float yp = 0;
|
float yp = 0;
|
||||||
for (int i = 1; i <= num_steps360; i++)
|
for (int i = 1; i <= num_steps360; i++)
|
||||||
@@ -1339,19 +1340,19 @@ public class ShapesRenderer
|
|||||||
float theta = step * i;
|
float theta = step * i;
|
||||||
float x = r * Mth.cos(theta);
|
float x = r * Mth.cos(theta);
|
||||||
float y = r * Mth.sin(theta);
|
float y = r * Mth.sin(theta);
|
||||||
builder.vertex(cx + xp, cy + yp, cz + 0).color(red, grn, blu, alpha).endVertex();
|
builderrr.addVertex(cx + xp, cy + yp, cz + 0).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx + xp, cy + yp, cz + h).color(red, grn, blu, alpha).endVertex();
|
builderrr.addVertex(cx + xp, cy + yp, cz + h).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx + x, cy + y, cz + h).color(red, grn, blu, alpha).endVertex();
|
builderrr.addVertex(cx + x, cy + y, cz + h).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(cx + x, cy + y, cz + 0).color(red, grn, blu, alpha).endVertex();
|
builderrr.addVertex(cx + x, cy + y, cz + 0).setColor(red, grn, blu, alpha);
|
||||||
xp = x;
|
xp = x;
|
||||||
yp = y;
|
yp = y;
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builderrr.buildOrThrow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawSphereWireframe(Tesselator tessellator, BufferBuilder builder,
|
public static void drawSphereWireframe(Tesselator tesselator,
|
||||||
float cx, float cy, float cz,
|
float cx, float cy, float cz,
|
||||||
float r, int subd,
|
float r, int subd,
|
||||||
float red, float grn, float blu, float alpha)
|
float red, float grn, float blu, float alpha)
|
||||||
@@ -1361,7 +1362,7 @@ public class ShapesRenderer
|
|||||||
int num_steps360 = (int) (2 * Math.PI / step) + 1;
|
int num_steps360 = (int) (2 * Math.PI / step) + 1;
|
||||||
for (int i = 0; i <= num_steps360; i++)
|
for (int i = 0; i <= num_steps360; i++)
|
||||||
{
|
{
|
||||||
builder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
|
||||||
float theta = step * i;
|
float theta = step * i;
|
||||||
for (int j = 0; j <= num_steps180; j++)
|
for (int j = 0; j <= num_steps180; j++)
|
||||||
{
|
{
|
||||||
@@ -1369,13 +1370,13 @@ public class ShapesRenderer
|
|||||||
float x = r * Mth.sin(phi) * Mth.cos(theta);
|
float x = r * Mth.sin(phi) * Mth.cos(theta);
|
||||||
float z = r * Mth.sin(phi) * Mth.sin(theta);
|
float z = r * Mth.sin(phi) * Mth.sin(theta);
|
||||||
float y = r * Mth.cos(phi);
|
float y = r * Mth.cos(phi);
|
||||||
builder.vertex(x + cx, y + cy, z + cz).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha);
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
}
|
}
|
||||||
for (int j = 0; j <= num_steps180; j++)
|
for (int j = 0; j <= num_steps180; j++)
|
||||||
{
|
{
|
||||||
builder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR); // line loop to line strip
|
||||||
float phi = step * j;
|
float phi = step * j;
|
||||||
|
|
||||||
for (int i = 0; i <= num_steps360; i++)
|
for (int i = 0; i <= num_steps360; i++)
|
||||||
@@ -1384,14 +1385,14 @@ public class ShapesRenderer
|
|||||||
float x = r * Mth.sin(phi) * Mth.cos(theta);
|
float x = r * Mth.sin(phi) * Mth.cos(theta);
|
||||||
float z = r * Mth.sin(phi) * Mth.sin(theta);
|
float z = r * Mth.sin(phi) * Mth.sin(theta);
|
||||||
float y = r * Mth.cos(phi);
|
float y = r * Mth.cos(phi);
|
||||||
builder.vertex(x + cx, y + cy, z + cz).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha);
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawSphereFaces(Tesselator tessellator, BufferBuilder builder,
|
public static void drawSphereFaces(Tesselator tesselator,
|
||||||
float cx, float cy, float cz,
|
float cx, float cy, float cz,
|
||||||
float r, int subd,
|
float r, int subd,
|
||||||
float red, float grn, float blu, float alpha)
|
float red, float grn, float blu, float alpha)
|
||||||
@@ -1404,7 +1405,7 @@ public class ShapesRenderer
|
|||||||
{
|
{
|
||||||
float theta = i * step;
|
float theta = i * step;
|
||||||
float thetaprime = theta + step;
|
float thetaprime = theta + step;
|
||||||
builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads
|
BufferBuilder builder = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); // quad strip to quads
|
||||||
float xb = 0;
|
float xb = 0;
|
||||||
float zb = 0;
|
float zb = 0;
|
||||||
float xbp = 0;
|
float xbp = 0;
|
||||||
@@ -1418,17 +1419,17 @@ public class ShapesRenderer
|
|||||||
float y = r * Mth.cos(phi);
|
float y = r * Mth.cos(phi);
|
||||||
float xp = r * Mth.sin(phi) * Mth.cos(thetaprime);
|
float xp = r * Mth.sin(phi) * Mth.cos(thetaprime);
|
||||||
float zp = r * Mth.sin(phi) * Mth.sin(thetaprime);
|
float zp = r * Mth.sin(phi) * Mth.sin(thetaprime);
|
||||||
builder.vertex(xb + cx, yp + cy, zb + cz).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(xb + cx, yp + cy, zb + cz).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(xbp + cx, yp + cy, zbp + cz).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(xbp + cx, yp + cy, zbp + cz).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(xp + cx, y + cy, zp + cz).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(xp + cx, y + cy, zp + cz).setColor(red, grn, blu, alpha);
|
||||||
builder.vertex(x + cx, y + cy, z + cz).color(red, grn, blu, alpha).endVertex();
|
builder.addVertex(x + cx, y + cy, z + cz).setColor(red, grn, blu, alpha);
|
||||||
xb = x;
|
xb = x;
|
||||||
zb = z;
|
zb = z;
|
||||||
xbp = xp;
|
xbp = xp;
|
||||||
zbp = zp;
|
zbp = zp;
|
||||||
yp = y;
|
yp = y;
|
||||||
}
|
}
|
||||||
tessellator.end();
|
BufferUploader.draw(builder.buildOrThrow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ public class ValueConversions
|
|||||||
case "overworld", "over_world" -> server.getLevel(Level.OVERWORLD);
|
case "overworld", "over_world" -> server.getLevel(Level.OVERWORLD);
|
||||||
default -> {
|
default -> {
|
||||||
ResourceKey<Level> dim = null;
|
ResourceKey<Level> dim = null;
|
||||||
ResourceLocation id = new ResourceLocation(dimString);
|
ResourceLocation id = ResourceLocation.parse(dimString);
|
||||||
// not using RegistryKey.of since that one creates on check
|
// not using RegistryKey.of since that one creates on check
|
||||||
for (ResourceKey<Level> world : (server.levelKeys()))
|
for (ResourceKey<Level> world : (server.levelKeys()))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -157,6 +157,7 @@
|
|||||||
"HorseBaseEntity_scarpetMixin",
|
"HorseBaseEntity_scarpetMixin",
|
||||||
"RandomState_ScarpetMixin",
|
"RandomState_ScarpetMixin",
|
||||||
"Biome_scarpetMixin",
|
"Biome_scarpetMixin",
|
||||||
|
"PortalProcessor_scarpetMixin",
|
||||||
|
|
||||||
"BlockEntity_movableBEMixin",
|
"BlockEntity_movableBEMixin",
|
||||||
"PistonBaseBlock_movableBEMixin",
|
"PistonBaseBlock_movableBEMixin",
|
||||||
|
|||||||
Reference in new issue
Block a user