use of net.minecraft.world.chunk.EmptyChunk in project Spark-Client by Spark-Client-Development.
the class BackfillProcess method isActive.
@Override
public boolean isActive() {
if (ctx.player() == null || ctx.world() == null) {
return false;
}
if (!Baritone.settings().backfill.getValue()) {
return false;
}
if (Baritone.settings().allowParkour.getValue()) {
logDirect("Backfill cannot be used with allowParkour true");
Baritone.settings().backfill.setValue(false);
return false;
}
amIBreakingABlockHMMMMMMM();
for (BlockPos pos : new ArrayList<>(blocksToReplace.keySet())) {
if (ctx.world().getChunk(pos) instanceof EmptyChunk) {
blocksToReplace.remove(pos);
}
}
baritone.getInputOverrideHandler().clearAllKeys();
return !toFillIn().isEmpty();
}
use of net.minecraft.world.chunk.EmptyChunk in project ImmersivePortalsMod by qouteall.
the class MyCommandClient method isClientChunkLoaded.
private static int isClientChunkLoaded(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
int chunkX = IntegerArgumentType.getInteger(context, "chunkX");
int chunkZ = IntegerArgumentType.getInteger(context, "chunkZ");
Chunk chunk = MinecraftClient.getInstance().world.getChunk(chunkX, chunkZ);
McHelper.serverLog(context.getSource().getPlayer(), chunk != null && !(chunk instanceof EmptyChunk) ? "yes" : "no");
return 0;
}
use of net.minecraft.world.chunk.EmptyChunk in project ImmersivePortalsMod by qouteall.
the class MyCommandClient method register.
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
// for composite command arguments, put into then() 's bracket
// for parallel command arguments, put behind then()
LiteralArgumentBuilder<ServerCommandSource> builder = CommandManager.literal("immersive_portals_debug").requires(commandSource -> true).then(CommandManager.literal("set_max_portal_layer").then(CommandManager.argument("argMaxPortalLayer", IntegerArgumentType.integer()).executes(context -> setMaxPortalLayer(IntegerArgumentType.getInteger(context, "argMaxPortalLayer")))));
builder = builder.then(CommandManager.literal("list_nearby_portals").executes(context -> listNearbyPortals(context)));
builder = builder.then(CommandManager.literal("is_client_chunk_loaded").then(CommandManager.argument("chunkX", IntegerArgumentType.integer()).then(CommandManager.argument("chunkZ", IntegerArgumentType.integer()).executes(MyCommandClient::isClientChunkLoaded))));
builder = builder.then(CommandManager.literal("is_server_chunk_loaded").then(CommandManager.argument("chunkX", IntegerArgumentType.integer()).then(CommandManager.argument("chunkZ", IntegerArgumentType.integer()).executes(context -> {
int chunkX = IntegerArgumentType.getInteger(context, "chunkX");
int chunkZ = IntegerArgumentType.getInteger(context, "chunkZ");
ServerPlayerEntity player = context.getSource().getPlayer();
Chunk chunk = McHelper.getServer().getWorld(player.dimension).getChunk(chunkX, chunkZ, ChunkStatus.FULL, false);
McHelper.serverLog(player, chunk != null && !(chunk instanceof EmptyChunk) ? "yes" : "no");
return 0;
}))));
builder = builder.then(CommandManager.literal("add_portal").executes(context -> addPortal(context)));
builder = builder.then(CommandManager.literal("report_player_status").executes(context -> reportPlayerStatus(context)));
builder = builder.then(CommandManager.literal("client_remote_ticking_enable").executes(context -> {
CGlobal.isClientRemoteTickingEnabled = true;
return 0;
}));
builder = builder.then(CommandManager.literal("client_remote_ticking_disable").executes(context -> {
CGlobal.isClientRemoteTickingEnabled = false;
return 0;
}));
builder = builder.then(CommandManager.literal("advanced_frustum_culling_enable").executes(context -> {
CGlobal.doUseAdvancedFrustumCulling = true;
return 0;
}));
builder = builder.then(CommandManager.literal("advanced_frustum_culling_disable").executes(context -> {
CGlobal.doUseAdvancedFrustumCulling = false;
return 0;
}));
builder = builder.then(CommandManager.literal("multithreaded_chunk_loading_enable").executes(context -> {
SGlobal.isChunkLoadingMultiThreaded = true;
return 0;
}));
builder = builder.then(CommandManager.literal("multithreaded_chunk_loading_disable").executes(context -> {
SGlobal.isChunkLoadingMultiThreaded = false;
return 0;
}));
builder = builder.then(CommandManager.literal("hacked_chunk_render_dispatcher_enable").executes(context -> {
CGlobal.useHackedChunkRenderDispatcher = true;
return 0;
}));
builder = builder.then(CommandManager.literal("hacked_chunk_render_dispatcher_disable").executes(context -> {
CGlobal.useHackedChunkRenderDispatcher = false;
return 0;
}));
builder = builder.then(CommandManager.literal("front_culling_enable").executes(context -> {
CGlobal.useFrontCulling = true;
return 0;
}));
builder = builder.then(CommandManager.literal("front_culling_disable").executes(context -> {
CGlobal.useFrontCulling = false;
return 0;
}));
builder = builder.then(CommandManager.literal("switch_to_normal_renderer").executes(context -> {
MinecraftClient.getInstance().execute(() -> {
CGlobal.useCompatibilityRenderer = false;
});
return 0;
}));
builder = builder.then(CommandManager.literal("switch_to_compatibility_renderer").executes(context -> {
MinecraftClient.getInstance().execute(() -> {
CGlobal.useCompatibilityRenderer = true;
});
return 0;
}));
builder = builder.then(CommandManager.literal("report_server_entities").executes(context -> {
ServerPlayerEntity player = context.getSource().getPlayer();
List<Entity> entities = player.world.getEntities(Entity.class, new Box(player.getBlockPos()).expand(32));
McHelper.serverLog(player, entities.toString());
return 0;
}));
builder = builder.then(CommandManager.literal("report_resource_consumption").executes(MyCommandClient::reportResourceConsumption));
builder = builder.then(CommandManager.literal("report_render_info_num").executes(context -> {
String str = Helper.myToString(CGlobal.renderInfoNumMap.entrySet().stream());
context.getSource().getPlayer().sendMessage(new LiteralText(str));
return 0;
}));
builder = builder.then(CommandManager.literal("rebuild_all").executes(context -> {
MinecraftClient.getInstance().execute(() -> {
((IEChunkRenderDispatcher) ((IEWorldRenderer) MinecraftClient.getInstance().worldRenderer).getChunkRenderDispatcher()).rebuildAll();
});
return 0;
}));
builder = builder.then(CommandManager.literal("shader_debug_enable").executes(context -> {
CGlobal.isRenderDebugMode = true;
return 0;
}));
builder = builder.then(CommandManager.literal("shader_debug_disable").executes(context -> {
CGlobal.isRenderDebugMode = false;
return 0;
}));
builder = builder.then(CommandManager.literal("get_player_colliding_portal_client").executes(context -> {
Portal collidingPortal = ((IEEntity) MinecraftClient.getInstance().player).getCollidingPortal();
McHelper.serverLog(context.getSource().getPlayer(), collidingPortal.toString());
return 0;
}));
builder = builder.then(CommandManager.literal("report_rendering").executes(context -> {
String str = MyRenderHelper.lastPortalRenderInfos.stream().map(list -> list.stream().map(Reference::get).collect(Collectors.toList())).collect(Collectors.toList()).toString();
McHelper.serverLog(context.getSource().getPlayer(), str);
return 0;
}));
builder = builder.then(CommandManager.literal("debug_mirror_mode_enable").executes(context -> {
CGlobal.debugMirrorMode = true;
return 0;
}));
builder = builder.then(CommandManager.literal("debug_mirror_mode_disable").executes(context -> {
CGlobal.debugMirrorMode = false;
return 0;
}));
builder = builder.then(CommandManager.literal("test_riding").executes(context -> {
ServerPlayerEntity player = context.getSource().getPlayer();
MinecartEntity minecart = EntityType.MINECART.create(player.world);
minecart.setPosition(player.x + 1, player.y, player.z);
player.world.spawnEntity(minecart);
player.startRiding(minecart, true);
return 0;
}));
builder = builder.then(CommandManager.literal("report_fog_color").executes(MyCommandClient::reportFogColor));
builder = builder.then(CommandManager.literal("uniform_report_hand").executes(context -> {
OFGlobal.debugFunc = program -> {
String name = program.getName();
if (name.equals("gbuffers_hand") || name.equals("gbuffers_hand_water")) {
try {
ServerPlayerEntity player = context.getSource().getPlayer();
UniformReport.reportUniforms(program.getId(), s -> McHelper.serverLog(player, s));
OFGlobal.debugFunc = p -> {
};
} catch (CommandSyntaxException e) {
e.printStackTrace();
return;
}
}
};
return 0;
}));
builder = builder.then(CommandManager.literal("teleport_on_rendering_enable").executes(context -> {
CGlobal.teleportOnRendering = true;
return 0;
}));
builder = builder.then(CommandManager.literal("teleport_on_rendering_disable").executes(context -> {
CGlobal.teleportOnRendering = false;
return 0;
}));
builder.then(CommandManager.literal("report_chunk_loaders").executes(context -> {
ServerPlayerEntity player = context.getSource().getPlayer();
ChunkVisibilityManager.getChunkLoaders(player).forEach(loader -> McHelper.serverLog(player, loader.toString()));
return 0;
}));
dispatcher.register(builder);
Helper.log("Successfully initialized command /immersive_portals_debug");
}
use of net.minecraft.world.chunk.EmptyChunk in project ImmersivePortalsMod by qouteall.
the class ChunkDataSyncManager method sendWatchPackets.
private void sendWatchPackets(ServerPlayerEntity player, DimensionalChunkPos chunkPos, IEThreadedAnvilChunkStorage ieStorage) {
McHelper.getServer().getProfiler().push("send_chunk_data");
Chunk chunk = McHelper.getServer().getWorld(chunkPos.dimension).getChunk(chunkPos.x, chunkPos.z);
assert chunk != null;
assert !(chunk instanceof EmptyChunk);
player.networkHandler.sendPacket(MyNetwork.createRedirectedMessage(chunkPos.dimension, new ChunkDataS2CPacket(((WorldChunk) chunk), 65535)));
player.networkHandler.sendPacket(MyNetwork.createRedirectedMessage(chunkPos.dimension, new LightUpdateS2CPacket(chunkPos.getChunkPos(), ieStorage.getLightingProvider())));
// update the entity trackers
((ThreadedAnvilChunkStorage) ieStorage).updateCameraPosition(player);
McHelper.getServer().getProfiler().pop();
}
use of net.minecraft.world.chunk.EmptyChunk in project baritone by cabaletta.
the class BackfillProcess method isActive.
@Override
public boolean isActive() {
if (ctx.player() == null || ctx.world() == null) {
return false;
}
if (!Baritone.settings().backfill.value) {
return false;
}
if (Baritone.settings().allowParkour.value) {
logDirect("Backfill cannot be used with allowParkour true");
Baritone.settings().backfill.value = false;
return false;
}
amIBreakingABlockHMMMMMMM();
for (BlockPos pos : new ArrayList<>(blocksToReplace.keySet())) {
if (ctx.world().getChunk(pos) instanceof EmptyChunk) {
blocksToReplace.remove(pos);
}
}
baritone.getInputOverrideHandler().clearAllKeys();
return !toFillIn().isEmpty();
}
Aggregations