Skip to content

Commit

Permalink
Init 1.16.5
Browse files Browse the repository at this point in the history
  • Loading branch information
RedLime committed Nov 16, 2021
1 parent 9cdd668 commit f1213a8
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 32 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ dependencies {
modIncludeImplementation(fabricApi.module("fabric-tool-attribute-api-v1", project.fabric_version))
//modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modImplementation "curse.maven:speedrunigt-538881:3521294"
modImplementation "curse.maven:speedrunigt-538881:3527464"
}

processResources {
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/versions.html
minecraft_version=1.16.1
yarn_mappings=1.16.1+build.21
minecraft_version=1.16.5
yarn_mappings=1.16.5+build.10
loader_version=0.12.2


# Mod Properties
mod_version = 2.1+1.16.1
mod_version = 2.1+1.16.5
maven_group = com.redlimerl
archives_base_name = GhostRunner

# Dependencies
fabric_version=0.18.0+build.387-1.16.1
fabric_version=0.42.0+1.16
4 changes: 2 additions & 2 deletions src/main/java/com/redlimerl/ghostrunner/GhostRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import net.minecraft.SharedConstants;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ScreenTexts;
import net.minecraft.client.gui.screen.options.ControlsOptionsScreen;
import net.minecraft.client.gui.screen.option.ControlsOptionsScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.options.KeyBinding;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import net.minecraft.entity.EntityDimensions;
import net.minecraft.entity.EntityType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public Visibility draw(MatrixStack matrices, ToastManager manager, long currentT
}

MinecraftClient client = manager.getGame();
client.getTextureManager().bindTexture(TOASTS_TEX);
client.getTextureManager().bindTexture(TEXTURE);
RenderSystem.color3f(1.0F, 1.0F, 1.0F);
manager.drawTexture(matrices, 0, 0, 0, 32, 160, 32);
float xpos = this.icon != null ? 30: 10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public APIKeyScreen(BooleanConsumer booleanConsumer) {
@Override
protected void init() {
assert client != null;
client.keyboard.enableRepeatEvents(true);
client.keyboard.setRepeatEvents(true);

this.saveButton = addButton(new ButtonWidget(width / 2 - 100, height / 4 + 32, 98, 20, new TranslatableText("selectWorld.edit.save"),
(button) -> {
Expand Down Expand Up @@ -91,6 +91,6 @@ public void onClose() {

@Override
public void removed() {
if (client != null) client.keyboard.enableRepeatEvents(false);
if (client != null) client.keyboard.setRepeatEvents(false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public GhostEditScreen(GhostListScreen parent, GhostData ghost) {
@Override
protected void init() {
assert client != null;
client.keyboard.enableRepeatEvents(true);
client.keyboard.setRepeatEvents(true);

this.ghostNameTextField = new TextFieldWidget(textRenderer, width / 2 - 100, yPos, 200, 20, new TranslatableText("selectWorld.enterName"));
this.ghostNameTextField.setMaxLength(64);
Expand Down Expand Up @@ -130,6 +130,6 @@ public void close() {

@Override
public void removed() {
if (client != null) client.keyboard.enableRepeatEvents(false);
if (client != null) client.keyboard.setRepeatEvents(false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public GhostListScreen(Screen parent) {
public void init() {

assert this.client != null;
this.client.keyboard.enableRepeatEvents(true);
this.client.keyboard.setRepeatEvents(true);

this.searchBox = new TextFieldWidget(textRenderer, width / 2 - 22, 22, 180, 20, null, new TranslatableText("selectWorld.search"));
this.searchBox.setChangedListener((string) -> this.ghostList.filter(() -> string, filterType, order, false));
Expand Down Expand Up @@ -191,7 +191,7 @@ public void onClose() {

@Override
public void removed() {
if (client != null) client.keyboard.enableRepeatEvents(false);
if (client != null) client.keyboard.setRepeatEvents(false);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public GhostSubmitScreen(Screen parent, GhostData ghostData) {
protected void init() {
assert client != null;

client.keyboard.enableRepeatEvents(true);
client.keyboard.setRepeatEvents(true);
this.submitButton = addButton(new ButtonWidget(width / 2 - 100, height - 65, 200, 20, ScreenTexts.PROCEED,
(button) -> {
client.openScreen(new GhostLoadingScreen(new TranslatableText("ghostrunner.message.submitting_record")));
Expand Down Expand Up @@ -112,6 +112,6 @@ public void onClose() {

@Override
public void removed() {
if (client != null) client.keyboard.enableRepeatEvents(false);
if (client != null) client.keyboard.setRepeatEvents(false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import com.redlimerl.speedrunigt.timer.InGameTimer;
import com.redlimerl.speedrunigt.timer.TimerStatus;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
Expand All @@ -20,12 +22,12 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(ClientPlayerEntity.class)
public abstract class ClientPlayerEntityMixin extends PlayerEntity {
public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity {

@Shadow @Final protected MinecraftClient client;

public ClientPlayerEntityMixin(World world, BlockPos blockPos, GameProfile gameProfile) {
super(world, blockPos, gameProfile);
public ClientPlayerEntityMixin(ClientWorld world, GameProfile profile) {
super(world, profile);
}

@Inject(method = "tick()V", at = @At("TAIL"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.redlimerl.ghostrunner.record.ReplayGhost;
import com.redlimerl.ghostrunner.render.GhostRenderFix;
import net.minecraft.client.MinecraftClient;
import net.minecraft.util.registry.RegistryTracker;
import net.minecraft.util.registry.DynamicRegistryManager;
import net.minecraft.world.Difficulty;
import net.minecraft.world.gen.GeneratorOptions;
import net.minecraft.world.level.LevelInfo;
Expand All @@ -23,8 +23,8 @@ private static void isFabulousGraphicsOrBetter(CallbackInfoReturnable<Boolean> c
if (GhostRenderFix.isRender) cir.setReturnValue(true);
}

@Inject(method = "method_29607(Ljava/lang/String;Lnet/minecraft/world/level/LevelInfo;Lnet/minecraft/util/registry/RegistryTracker$Modifiable;Lnet/minecraft/world/gen/GeneratorOptions;)V", at = @At("TAIL"))
private void createWorld(String worldName, LevelInfo levelInfo, RegistryTracker.Modifiable modifiable, GeneratorOptions generatorOptions, CallbackInfo ci) {
@Inject(method = "createWorld", at = @At("TAIL"))
private void createWorld(String worldName, LevelInfo levelInfo, DynamicRegistryManager.Impl registryTracker, GeneratorOptions generatorOptions, CallbackInfo ci) {
GhostRunner.IS_USE_F3 = false;
GhostRunner.MINIMUM_DIFFICULTY = Difficulty.HARD;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ScreenTexts;
import net.minecraft.client.gui.screen.world.CreateWorldScreen;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.client.gui.widget.PressableWidget;
import net.minecraft.client.gui.widget.TexturedButtonWidget;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.client.util.math.MatrixStack;
Expand All @@ -21,11 +22,12 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(CreateWorldScreen.class)
public abstract class CreateWorldScreenMixin extends Screen {

@Shadow protected abstract <T extends AbstractButtonWidget> T addButton(T button);
public abstract class CreateWorldScreenMixin extends Screen{

@Shadow public boolean hardcore;

@Shadow protected abstract <T extends ClickableWidget> T addButton(T button);

private ButtonWidget fsgButton;
private ButtonWidget ghostButton;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.redlimerl.ghostrunner.GhostRunner;
import net.minecraft.client.gui.screen.world.MoreOptionsDialog;
import net.minecraft.client.gui.widget.TextFieldWidget;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -13,11 +14,11 @@
@Mixin(MoreOptionsDialog.class)
public abstract class MoreOptionsDialogMixin {

@Shadow private String seedText;
@Shadow private TextFieldWidget seedTextField;

@Inject(method = "tick", at = @At("TAIL"))
private void getSeed(CallbackInfo ci) {
GhostRunner.OPTIONAL_LONG = tryParseLong2(seedText);
GhostRunner.OPTIONAL_LONG = tryParseLong2(this.seedTextField.getText());
}

private static OptionalLong tryParseLong2(String string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public PlayerLog(EntityPose pose, Identifier world, Double x, Double y, Double z

public PlayerLog(PlayerEntity player) {
this.pose = player.getPose();
this.world = player.world.getDimensionRegistryKey().getValue();
this.world = player.world.getRegistryKey().getValue();
this.x = player.getX();
this.y = player.getY();
this.z = player.getZ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,12 @@ protected ReplayGhost(GhostInfo ghostInfo) {
this.ghostInfo = ghostInfo;
}

private GhostEntity summon(ClientWorld world, PlayerLog log) {
private void summon(ClientWorld world, PlayerLog log) {
GhostEntity entity = new GhostEntity(GhostRunner.GHOST_ENTITY_TYPE, world);
entity.refreshPositionAndAngles(log.x == null ? 0 : log.x, log.y == null ? 0 : log.y, log.z == null ? 0 : log.z, 0f, 0f);
entity.setTargetSkinUuid(ghostInfo.getGhostData().getGhostUserUuid());
world.addEntity(entity.getEntityId(), entity);
ghost = entity;
return entity;
}

private void remove() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

"depends": {
"fabricloader": ">=0.11.3",
"minecraft": "1.16.1",
"minecraft": "1.16.5",
"speedrunigt": ">=1.8"
}
}

0 comments on commit f1213a8

Please sign in to comment.