mirror of
https://github.com/darksaid98/Flashback.git
synced 2026-12-02 14:38:50 +00:00
Backport 0.17.0 to 1.21
This commit is contained in:
1 parent
2d43b9d54c
commit
89201e682c
3 files changed
+6
-15
No files matched your search
@@ -47,7 +47,7 @@ public class FilePlayerSkin {
|
|||||||
NativeImage nativeImage = NativeImage.read(inputStream);
|
NativeImage nativeImage = NativeImage.read(inputStream);
|
||||||
|
|
||||||
// We determine the type using the alpha of the pixel at 54, 20
|
// We determine the type using the alpha of the pixel at 54, 20
|
||||||
int argb = nativeImage.getPixel(54, 20);
|
int argb = nativeImage.getPixelRGBA(54, 20);
|
||||||
PlayerSkin.Model model = PlayerSkin.Model.WIDE;
|
PlayerSkin.Model model = PlayerSkin.Model.WIDE;
|
||||||
if (((argb >> 24) & 0xFF) < 20) {
|
if (((argb >> 24) & 0xFF) < 20) {
|
||||||
model = PlayerSkin.Model.SLIM;
|
model = PlayerSkin.Model.SLIM;
|
||||||
@@ -63,7 +63,7 @@ public class FilePlayerSkin {
|
|||||||
this.playerSkin = new PlayerSkin(resourceLocation, null, null, null, model, false);
|
this.playerSkin = new PlayerSkin(resourceLocation, null, null, null, model, false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Flashback.LOGGER.error("Unable to load skin from file", e);
|
Flashback.LOGGER.error("Unable to load skin from file", e);
|
||||||
this.playerSkin = DefaultPlayerSkin.getDefaultSkin();
|
this.playerSkin = DefaultPlayerSkin.get(UUID.randomUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.playerSkin;
|
return this.playerSkin;
|
||||||
|
|||||||
@@ -3,15 +3,15 @@ package com.moulberry.flashback.mixin.millis;
|
|||||||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||||
import com.moulberry.flashback.Flashback;
|
import com.moulberry.flashback.Flashback;
|
||||||
import net.minecraft.client.renderer.WorldBorderRenderer;
|
import net.minecraft.client.renderer.LevelRenderer;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
@Mixin(WorldBorderRenderer.class)
|
@Mixin(LevelRenderer.class)
|
||||||
public class MixinWorldBorderRenderer {
|
public class MixinWorldBorderRenderer {
|
||||||
|
|
||||||
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/Util;getMillis()J"), require = 0)
|
@WrapOperation(method = "renderWorldBorder", at = @At(value = "INVOKE", target = "Lnet/minecraft/Util;getMillis()J"), require = 0)
|
||||||
public long render(Operation<Long> original) {
|
public long renderWorldBorder(Operation<Long> original) {
|
||||||
if (Flashback.isInReplay()) {
|
if (Flashback.isInReplay()) {
|
||||||
return Flashback.getVisualMillis();
|
return Flashback.getVisualMillis();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,15 +33,6 @@ public abstract class MixinEntity {
|
|||||||
@Shadow
|
@Shadow
|
||||||
public abstract UUID getUUID();
|
public abstract UUID getUUID();
|
||||||
|
|
||||||
// Force entities to be able to ride players on servers
|
|
||||||
@WrapOperation(method = "startRiding(Lnet/minecraft/world/entity/Entity;Z)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;isClientSide()Z"))
|
|
||||||
public boolean startRiding_isClientSide(Level instance, Operation<Boolean> original) {
|
|
||||||
if (Flashback.isInReplay()) {
|
|
||||||
return true; // Always pretend we're clientside so mounting players is allowed
|
|
||||||
}
|
|
||||||
return original.call(instance);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "isInvisibleTo", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "isInvisibleTo", at = @At("HEAD"), cancellable = true)
|
||||||
public void isInvisibleTo(Player player, CallbackInfoReturnable<Boolean> cir) {
|
public void isInvisibleTo(Player player, CallbackInfoReturnable<Boolean> cir) {
|
||||||
ReplayServer replayServer = Flashback.getReplayServer();
|
ReplayServer replayServer = Flashback.getReplayServer();
|
||||||
|
|||||||
Reference in new issue
Block a user