Skip to content

Commit

Permalink
Removed commands
Browse files Browse the repository at this point in the history
  • Loading branch information
xTracr committed Mar 1, 2024
1 parent 8acc4e3 commit b146c62
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 87 deletions.
10 changes: 5 additions & 5 deletions common/src/main/java/com/xtracr/realcamera/RealCameraCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import java.util.function.BiFunction;

public class RealCameraCore {
private static VertexRecorder recorder = new VertexRecorder();
private static final VertexRecorder recorder = new VertexRecorder();
private static String status = "Successful";
private static boolean renderingPlayer = false;
private static boolean active = false;
Expand Down Expand Up @@ -123,9 +123,9 @@ public static void computeCamera(MinecraftClient client, float tickDelta) {
if (config().isClassic()) return;

// GameRenderer.renderWorld
recorder.clear();
MatrixStack matrixStack = new MatrixStack();
recorder = new VertexRecorder();
virtualRender(client, tickDelta, matrixStack, recorder);
virtualRender(client, tickDelta, matrixStack);
recorder.buildLastRecord();

// ModelPart$Cuboid.renderCuboid
Expand Down Expand Up @@ -168,7 +168,7 @@ private static ModConfig config() {
return ConfigFile.modConfig;
}

private static void virtualRender(MinecraftClient client, float tickDelta, MatrixStack matrixStack, VertexConsumerProvider consumers) {
private static void virtualRender(MinecraftClient client, float tickDelta, MatrixStack matrixStack) {
ClientPlayerEntity player = client.player;
// WorldRenderer.render
if (player.age == 0) {
Expand All @@ -184,7 +184,7 @@ private static void virtualRender(MinecraftClient client, float tickDelta, Matri
EntityRenderDispatcher dispatcher = client.getEntityRenderDispatcher();
dispatcher.configure(client.world, client.gameRenderer.getCamera(), player);
if (config().binding.experimental) dispatcher.render(player, renderOffset.getX(), renderOffset.getY(), renderOffset.getZ(),
MathHelper.lerp(tickDelta, player.prevYaw, player.getYaw()), tickDelta, matrixStack, consumers, dispatcher.getLight(player, tickDelta));
MathHelper.lerp(tickDelta, player.prevYaw, player.getYaw()), tickDelta, matrixStack, recorder, dispatcher.getLight(player, tickDelta));
matrixStack.pop();
// EntityRenderDispatcher.render
if (config().compatPhysicsMod())
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ public class VertexRecorder implements VertexConsumerProvider {
protected BuiltRecord currentRecord;
private VertexRecord lastRecord;

public void clear() {
records.clear();
currentRecord = null;
lastRecord = null;
}

public int quadCount() {
if (currentRecord == null) return 0;
return currentRecord.quadCount;
Expand Down
4 changes: 0 additions & 4 deletions common/src/main/resources/assets/realcamera/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@
"config.tooltip.xtracr_realcamera.autoBind": "Automatically searches through saved lists based on the current player model texture",
"config.tooltip.xtracr_realcamera.depth": "Planes where all vertex-to-screen distances are less than this value will not be rendered",

"message.xtracr_realcamera.command_delete_failure": "Failed to find '%s'",
"message.xtracr_realcamera.command_delete_success": "Successfully deleted '%s'",
"message.xtracr_realcamera.command_listAll": "Found %d results: %s",

"screen.xtracr_realcamera.modelView_title": "Model View",
"screen.widget.xtracr_realcamera.modelView_selectMode": "Selecting",
"screen.widget.xtracr_realcamera.modelView_forwardMode": "Forward Vector",
Expand Down
4 changes: 0 additions & 4 deletions common/src/main/resources/assets/realcamera/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@
"config.tooltip.xtracr_realcamera.autoBind": "根据当前玩家模型纹理,自动在已保存的配置中搜索合适项",
"config.tooltip.xtracr_realcamera.depth": "全部顶点到屏幕距离均小于该值的面不会被渲染",

"message.xtracr_realcamera.command_delete_failure": "未能找到'%s'",
"message.xtracr_realcamera.command_delete_success": "成功删除'%s'",
"message.xtracr_realcamera.command_listAll": "找到了%d个结果: %s",

"screen.xtracr_realcamera.modelView_title": "模型视图",
"screen.widget.xtracr_realcamera.modelView_selectMode": "选择",
"screen.widget.xtracr_realcamera.modelView_forwardMode": "向前矢量",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package com.xtracr.realcamera;

import com.xtracr.realcamera.command.ClientCommand;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
Expand All @@ -19,6 +16,5 @@ public void onInitializeClient() {

ClientTickEvents.END_CLIENT_TICK.register(KeyBindings::handle);
WorldRenderEvents.START.register(EventHandler::onWorldRenderStart);
ClientCommandRegistrationCallback.EVENT.register(new ClientCommand<FabricClientCommandSource>()::register);
}
}
8 changes: 0 additions & 8 deletions forge/src/main/java/com/xtracr/realcamera/EventHandler.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package com.xtracr.realcamera;

import com.xtracr.realcamera.command.ClientCommand;
import com.xtracr.realcamera.config.ConfigFile;
import com.xtracr.realcamera.util.CrosshairUtil;
import net.minecraft.client.MinecraftClient;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraftforge.client.event.InputEvent.Key;
import net.minecraftforge.client.event.RegisterClientCommandsEvent;
import net.minecraftforge.client.event.RenderLevelStageEvent;
import net.minecraftforge.client.event.ViewportEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
Expand All @@ -24,11 +21,6 @@ public static void onCameraUpdate(ViewportEvent.ComputeCameraAngles event) {
}
}

@SubscribeEvent
public static void onClientCommandRegister(RegisterClientCommandsEvent event) {
new ClientCommand<ServerCommandSource>().register(event.getDispatcher(), event.getBuildContext());
}

@SubscribeEvent
public static void onRenderWorldStage(RenderLevelStageEvent event) {
if (RenderLevelStageEvent.Stage.AFTER_SKY.equals(event.getStage())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public void clientSetup(FMLClientSetupEvent event) {

MinecraftForge.EVENT_BUS.addListener(EventHandler::onKeyInput);
MinecraftForge.EVENT_BUS.addListener(EventPriority.LOWEST, EventHandler::onCameraUpdate);
MinecraftForge.EVENT_BUS.addListener(EventHandler::onClientCommandRegister);
MinecraftForge.EVENT_BUS.addListener(EventHandler::onRenderWorldStage);

if (ModList.get().isLoaded("cloth_config")) {
Expand Down

0 comments on commit b146c62

Please sign in to comment.