Update to 20w22a (minimal mode only)

This commit is contained in:
Jonas Herzig
2020-06-04 11:54:33 +02:00
parent 6210cb09aa
commit 88be6b3935
26 changed files with 293 additions and 83 deletions

View File

@@ -9,6 +9,7 @@ import de.johni0702.minecraft.gui.utils.EventRegistrations;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.client.util.math.MatrixStack;
//#if FABRIC>=1
import de.johni0702.minecraft.gui.versions.callbacks.RenderHudCallback;
@@ -41,21 +42,26 @@ public class GuiRecordingOverlay extends EventRegistrations {
* Render the recording icon and text in the top left corner of the screen.
*/
//#if FABRIC>=1
{ on(RenderHudCallback.EVENT, partialTicks -> renderRecordingIndicator()); }
private void renderRecordingIndicator() {
{ on(RenderHudCallback.EVENT, (stack, partialTicks) -> renderRecordingIndicator(stack)); }
private void renderRecordingIndicator(MatrixStack stack) {
//#else
//$$ @SubscribeEvent
//$$ public void renderRecordingIndicator(RenderGameOverlayEvent.Post event) {
//$$ if (getType(event) != RenderGameOverlayEvent.ElementType.ALL) return;
//$$ MatrixStack stack = new MatrixStack();
//#endif
if (guiControls.isStopped()) return;
if (settingsRegistry.get(Setting.INDICATOR)) {
TextRenderer fontRenderer = mc.textRenderer;
String text = guiControls.isPaused() ? I18n.translate("replaymod.gui.paused") : I18n.translate("replaymod.gui.recording");
fontRenderer.draw(text.toUpperCase(), 30, 18 - (fontRenderer.fontHeight / 2), 0xffffffff);
fontRenderer.draw(
//#if MC>=11600
//$$ stack,
//#endif
text.toUpperCase(), 30, 18 - (fontRenderer.fontHeight / 2), 0xffffffff);
bindTexture(TEXTURE);
enableAlphaTest();
GuiRenderer renderer = new MinecraftGuiRenderer(MCVer.newScaledResolution(mc));
GuiRenderer renderer = new MinecraftGuiRenderer(stack, MCVer.newScaledResolution(mc));
renderer.drawTexturedRect(10, 10, 58, 20, 16, 16, 16, 16, TEXTURE_SIZE, TEXTURE_SIZE);
}
}

View File

@@ -18,6 +18,9 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.network.ClientConnection;
import org.apache.logging.log4j.Logger;
//#if MC>=11600
//$$ import net.minecraft.world.World;
//#else
//#if MC>=11400
import net.minecraft.world.dimension.DimensionType;
//#endif
@@ -25,6 +28,7 @@ import net.minecraft.world.dimension.DimensionType;
//#if MC>=10800
import net.minecraft.world.level.LevelGeneratorType;
//#endif
//#endif
import java.io.File;
import java.text.SimpleDateFormat;
@@ -60,10 +64,14 @@ public class ConnectionEventHandler {
boolean local = networkManager.isLocal();
if (local) {
//#if MC>=10800
//#if MC>=11600
//$$ if (mc.getServer().getWorld(World.field_25179).isDebugWorld()) {
//#else
//#if MC>=11400
if (mc.getServer().getWorld(DimensionType.OVERWORLD).getGeneratorType() == LevelGeneratorType.DEBUG_ALL_BLOCK_STATES) {
//#else
//$$ if (mc.getIntegratedServer().getEntityWorld().getWorldType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
//#endif
//#endif
logger.info("Debug World recording is not supported.");
return;
@@ -82,7 +90,11 @@ public class ConnectionEventHandler {
String worldName;
if (local) {
//#if MC>=11600
//$$ worldName = mc.getServer().method_27728().getLevelName();
//#else
worldName = mc.getServer().getLevelName();
//#endif
} else if (mc.getCurrentServerEntry() != null) {
worldName = mc.getCurrentServerEntry().address;
//#if MC>=11100

View File

@@ -207,9 +207,13 @@ public class RecordingEventHandler extends EventRegistrations {
//$$ (byte) Math.round(dx * 32), (byte) Math.round(dy * 32), (byte) Math.round(dz * 32),
//#endif
newYaw, newPitch
//#if MC>=11600
//$$ , player.isOnGround()
//#else
//#if MC>=10800
, player.onGround
//#endif
//#endif
);
}

View File

@@ -10,16 +10,25 @@ import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.level.LevelProperties;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
//#if MC>=11600
//$$ import net.minecraft.util.registry.RegistryKey;
//$$ import net.minecraft.world.MutableWorldProperties;
//$$ import java.util.function.Supplier;
//#else
import net.minecraft.world.level.LevelProperties;
//#endif
//#if MC>=11400
import net.minecraft.world.chunk.ChunkManager;
//#if MC<11600
import net.minecraft.world.dimension.Dimension;
//#endif
import net.minecraft.world.dimension.DimensionType;
import java.util.function.BiFunction;
//#else
@@ -38,6 +47,11 @@ public abstract class MixinWorldClient extends World implements RecordingEventHa
@Shadow
private MinecraftClient client;
//#if MC>=11600
//$$ protected MixinWorldClient(MutableWorldProperties mutableWorldProperties, RegistryKey<World> registryKey, RegistryKey<DimensionType> registryKey2, DimensionType dimensionType, Supplier<Profiler> profiler, boolean bl, boolean bl2, long l) {
//$$ super(mutableWorldProperties, registryKey, registryKey2, dimensionType, profiler, bl, bl2, l);
//$$ }
//#else
//#if MC>=11400
protected MixinWorldClient(LevelProperties levelProperties_1, DimensionType dimensionType_1, BiFunction<World, Dimension, ChunkManager> biFunction_1, Profiler profiler_1, boolean boolean_1) {
super(levelProperties_1, dimensionType_1, biFunction_1, profiler_1, boolean_1);
@@ -61,6 +75,7 @@ public abstract class MixinWorldClient extends World implements RecordingEventHa
//$$ info, providerIn, profilerIn, client);
//$$ }
//#endif
//#endif
private RecordingEventHandler replayModRecording_getRecordingEventHandler() {
return ((RecordingEventHandler.RecordingEventSender) this.client.worldRenderer).getRecordingEventHandler();