Switch core to 1.14 (generated via ./gradlew :1.14:setCoreVersion)
This commit is contained in:
@@ -11,45 +11,45 @@ import com.replaymod.replay.mixin.FirstPersonRendererAccessor;
|
||||
import com.replaymod.replaystudio.util.Location;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.item.EntityItemFrame;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.entity.mob.MobEntity;
|
||||
import net.minecraft.entity.decoration.ItemFrameEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BoundingBox;
|
||||
|
||||
//#if MC>=11400
|
||||
//$$ import com.replaymod.core.events.KeyBindingEventCallback;
|
||||
//$$ import com.replaymod.core.events.PreRenderCallback;
|
||||
//$$ import com.replaymod.core.events.PreRenderHandCallback;
|
||||
//$$ import com.replaymod.replay.events.RenderSpectatorCrosshairCallback;
|
||||
//$$ import de.johni0702.minecraft.gui.versions.callbacks.PreTickCallback;
|
||||
//$$ import net.fabricmc.fabric.api.util.TriState;
|
||||
//$$ import net.minecraft.client.world.ClientWorld;
|
||||
//$$ import net.minecraft.fluid.Fluid;
|
||||
//$$ import net.minecraft.tag.Tag;
|
||||
//$$ import net.minecraft.util.hit.BlockHitResult;
|
||||
//$$ import net.minecraft.util.hit.HitResult;
|
||||
import com.replaymod.core.events.KeyBindingEventCallback;
|
||||
import com.replaymod.core.events.PreRenderCallback;
|
||||
import com.replaymod.core.events.PreRenderHandCallback;
|
||||
import com.replaymod.replay.events.RenderSpectatorCrosshairCallback;
|
||||
import de.johni0702.minecraft.gui.versions.callbacks.PreTickCallback;
|
||||
import net.fabricmc.fabric.api.util.TriState;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.tag.Tag;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
//#else
|
||||
import com.replaymod.core.versions.MCVer;
|
||||
import com.replaymod.replay.events.ReplayChatMessageEvent;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.EntityViewRenderEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
|
||||
//$$ import com.replaymod.core.versions.MCVer;
|
||||
//$$ import com.replaymod.replay.events.ReplayChatMessageEvent;
|
||||
//$$ import net.minecraft.util.math.RayTraceResult;
|
||||
//$$ import net.minecraft.util.text.ITextComponent;
|
||||
//$$ import net.minecraft.world.World;
|
||||
//$$ import net.minecraftforge.client.event.EntityViewRenderEvent;
|
||||
//$$ import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
//$$ import net.minecraftforge.client.event.RenderHandEvent;
|
||||
//$$ import net.minecraftforge.common.MinecraftForge;
|
||||
//$$ import net.minecraftforge.eventbus.api.EventPriority;
|
||||
//$$ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
//$$ import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
//$$
|
||||
//#if MC>=11300
|
||||
import net.minecraft.util.math.RayTraceFluidMode;
|
||||
//$$ import net.minecraft.util.math.RayTraceFluidMode;
|
||||
//#else
|
||||
//$$ import net.minecraft.block.material.Material;
|
||||
//$$ import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -57,22 +57,22 @@ import net.minecraft.util.math.RayTraceFluidMode;
|
||||
//#endif
|
||||
|
||||
//#if MC>=10904
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
//#if MC>=11200
|
||||
//#if MC>=11300
|
||||
import net.minecraft.client.util.RecipeBookClient;
|
||||
import net.minecraft.client.recipe.book.ClientRecipeBook;
|
||||
//#else
|
||||
//$$ import net.minecraft.stats.RecipeBook;
|
||||
//#endif
|
||||
//#endif
|
||||
import net.minecraft.stats.StatisticsManager;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.stat.StatHandler;
|
||||
import net.minecraft.util.Hand;
|
||||
//#else
|
||||
//$$ import net.minecraft.stats.StatFileWriter;
|
||||
//#endif
|
||||
|
||||
//#if MC>=10800
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
//#else
|
||||
//$$ import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
//$$ import net.minecraft.util.Session;
|
||||
@@ -92,7 +92,7 @@ import static com.replaymod.core.versions.MCVer.*;
|
||||
@SuppressWarnings("EntityConstructor")
|
||||
public class CameraEntity
|
||||
//#if MC>=10800
|
||||
extends EntityPlayerSP
|
||||
extends ClientPlayerEntity
|
||||
//#else
|
||||
//$$ extends EntityClientPlayerMP
|
||||
//#endif
|
||||
@@ -122,9 +122,9 @@ public class CameraEntity
|
||||
|
||||
//#if MC>=11300
|
||||
//#if MC>=11400
|
||||
//$$ public CameraEntity(MinecraftClient mcIn, ClientWorld worldIn, ClientPlayNetworkHandler netHandlerPlayClient, StatHandler statisticsManager, ClientRecipeBook recipeBookClient) {
|
||||
public CameraEntity(MinecraftClient mcIn, ClientWorld worldIn, ClientPlayNetworkHandler netHandlerPlayClient, StatHandler statisticsManager, ClientRecipeBook recipeBookClient) {
|
||||
//#else
|
||||
public CameraEntity(Minecraft mcIn, World worldIn, NetHandlerPlayClient netHandlerPlayClient, StatisticsManager statisticsManager, RecipeBookClient recipeBookClient) {
|
||||
//$$ public CameraEntity(Minecraft mcIn, World worldIn, NetHandlerPlayClient netHandlerPlayClient, StatisticsManager statisticsManager, RecipeBookClient recipeBookClient) {
|
||||
//#endif
|
||||
super(mcIn, worldIn, netHandlerPlayClient, statisticsManager, recipeBookClient);
|
||||
//#else
|
||||
@@ -161,7 +161,7 @@ public class CameraEntity
|
||||
* @param z Delta in Z direction
|
||||
*/
|
||||
public void moveCamera(double x, double y, double z) {
|
||||
setCameraPosition(this.posX + x, this.posY + y, this.posZ + z);
|
||||
setCameraPosition(this.x + x, this.y + y, this.z + z);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -171,9 +171,9 @@ public class CameraEntity
|
||||
* @param z Z coordinate
|
||||
*/
|
||||
public void setCameraPosition(double x, double y, double z) {
|
||||
this.lastTickPosX = this.prevPosX = this.posX = x;
|
||||
this.lastTickPosY = this.prevPosY = this.posY = y;
|
||||
this.lastTickPosZ = this.prevPosZ = this.posZ = z;
|
||||
this.prevRenderX = this.prevX = this.x = x;
|
||||
this.prevRenderY = this.prevY = this.y = y;
|
||||
this.prevRenderZ = this.prevZ = this.z = z;
|
||||
updateBoundingBox();
|
||||
}
|
||||
|
||||
@@ -184,8 +184,8 @@ public class CameraEntity
|
||||
* @param roll Roll in degrees
|
||||
*/
|
||||
public void setCameraRotation(float yaw, float pitch, float roll) {
|
||||
this.prevRotationYaw = this.rotationYaw = yaw;
|
||||
this.prevRotationPitch = this.rotationPitch = pitch;
|
||||
this.prevYaw = this.yaw = yaw;
|
||||
this.prevPitch = this.pitch = pitch;
|
||||
this.roll = roll;
|
||||
}
|
||||
|
||||
@@ -209,38 +209,38 @@ public class CameraEntity
|
||||
//#else
|
||||
//$$ float yOffset = 1.62f; // Magic value (eye height) from EntityRenderer#orientCamera
|
||||
//#endif
|
||||
this.prevPosX = to.prevPosX;
|
||||
this.prevPosY = to.prevPosY + yOffset;
|
||||
this.prevPosZ = to.prevPosZ;
|
||||
this.prevRotationYaw = to.prevRotationYaw;
|
||||
this.prevRotationPitch = to.prevRotationPitch;
|
||||
this.posX = to.posX;
|
||||
this.posY = to.posY + yOffset;
|
||||
this.posZ = to.posZ;
|
||||
this.rotationYaw = to.rotationYaw;
|
||||
this.rotationPitch = to.rotationPitch;
|
||||
this.lastTickPosX = to.lastTickPosX;
|
||||
this.lastTickPosY = to.lastTickPosY + yOffset;
|
||||
this.lastTickPosZ = to.lastTickPosZ;
|
||||
this.prevX = to.prevX;
|
||||
this.prevY = to.prevY + yOffset;
|
||||
this.prevZ = to.prevZ;
|
||||
this.prevYaw = to.prevYaw;
|
||||
this.prevPitch = to.prevPitch;
|
||||
this.x = to.x;
|
||||
this.y = to.y + yOffset;
|
||||
this.z = to.z;
|
||||
this.yaw = to.yaw;
|
||||
this.pitch = to.pitch;
|
||||
this.prevRenderX = to.prevRenderX;
|
||||
this.prevRenderY = to.prevRenderY + yOffset;
|
||||
this.prevRenderZ = to.prevRenderZ;
|
||||
updateBoundingBox();
|
||||
}
|
||||
|
||||
private void updateBoundingBox() {
|
||||
//#if MC>=11400
|
||||
//$$ float width = getWidth();
|
||||
//$$ float height = getHeight();
|
||||
float width = getWidth();
|
||||
float height = getHeight();
|
||||
//#endif
|
||||
//#if MC>=10800
|
||||
//#if MC>=11300
|
||||
setBoundingBox(new AxisAlignedBB(
|
||||
setBoundingBox(new BoundingBox(
|
||||
//#else
|
||||
//$$ setEntityBoundingBox(new AxisAlignedBB(
|
||||
//#endif
|
||||
//#else
|
||||
//$$ this.boundingBox.setBB(AxisAlignedBB.getBoundingBox(
|
||||
//#endif
|
||||
this.posX - width / 2, this.posY, this.posZ - width / 2,
|
||||
this.posX + width / 2, this.posY + height, this.posZ + width / 2));
|
||||
this.x - width / 2, this.y, this.z - width / 2,
|
||||
this.x + width / 2, this.y + height, this.z + width / 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -250,7 +250,7 @@ public class CameraEntity
|
||||
//$$ public void onUpdate() {
|
||||
//#endif
|
||||
//#if MC>=10800
|
||||
Entity view = getRenderViewEntity(this.mc);
|
||||
Entity view = getRenderViewEntity(this.client);
|
||||
//#else
|
||||
//$$ EntityLivingBase view = getRenderViewEntity(this.mc);
|
||||
//#endif
|
||||
@@ -259,19 +259,19 @@ public class CameraEntity
|
||||
// This is important if the spectated player respawns as their
|
||||
// entity is recreated and we have to spectate a new entity
|
||||
UUID spectating = ReplayModReplay.instance.getReplayHandler().getSpectatedUUID();
|
||||
if (spectating != null && (view.getUniqueID() != spectating
|
||||
if (spectating != null && (view.getUuid() != spectating
|
||||
|| view.world != this.world)
|
||||
|| this.world.getEntityByID(view.getEntityId()) != view) {
|
||||
|| this.world.getEntityById(view.getEntityId()) != view) {
|
||||
if (spectating == null) {
|
||||
// Entity (non-player) died, stop spectating
|
||||
ReplayModReplay.instance.getReplayHandler().spectateEntity(this);
|
||||
return;
|
||||
}
|
||||
view = this.world.getPlayerEntityByUUID(spectating);
|
||||
view = this.world.getPlayerByUuid(spectating);
|
||||
if (view != null) {
|
||||
setRenderViewEntity(this.mc, view);
|
||||
setRenderViewEntity(this.client, view);
|
||||
} else {
|
||||
setRenderViewEntity(this.mc, this);
|
||||
setRenderViewEntity(this.client, this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -284,25 +284,25 @@ public class CameraEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preparePlayerToSpawn() {
|
||||
public void method_5823() {
|
||||
// Make sure our world is up-to-date in case of world changes
|
||||
if (this.mc.world != null) {
|
||||
this.world = this.mc.world;
|
||||
if (this.client.world != null) {
|
||||
this.world = this.client.world;
|
||||
}
|
||||
super.preparePlayerToSpawn();
|
||||
super.method_5823();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotation(float yaw, float pitch) {
|
||||
if (getRenderViewEntity(this.mc) == this) {
|
||||
if (getRenderViewEntity(this.client) == this) {
|
||||
// Only update camera rotation when the camera is the view
|
||||
super.setRotation(yaw, pitch);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEntityInsideOpaqueBlock() {
|
||||
return falseUnlessSpectating(Entity::isEntityInsideOpaqueBlock); // Make sure no suffocation overlay is rendered
|
||||
public boolean isInsideWall() {
|
||||
return falseUnlessSpectating(Entity::isInsideWall); // Make sure no suffocation overlay is rendered
|
||||
}
|
||||
|
||||
//#if MC<11300
|
||||
@@ -313,36 +313,36 @@ public class CameraEntity
|
||||
//#endif
|
||||
|
||||
//#if MC>=11400
|
||||
//$$ @Override
|
||||
//$$ public boolean isInFluid(Tag<Fluid> fluid, boolean loadedChunksOnly) {
|
||||
//$$ return falseUnlessSpectating(entity -> entity.isInFluid(fluid, loadedChunksOnly));
|
||||
//$$ }
|
||||
@Override
|
||||
public boolean isInFluid(Tag<Fluid> fluid, boolean loadedChunksOnly) {
|
||||
return falseUnlessSpectating(entity -> entity.isInFluid(fluid, loadedChunksOnly));
|
||||
}
|
||||
//#else
|
||||
//#if MC>=10800
|
||||
@Override
|
||||
public boolean isInLava() {
|
||||
return falseUnlessSpectating(Entity::isInLava); // Make sure no lava overlay is rendered
|
||||
}
|
||||
//$$ @Override
|
||||
//$$ public boolean isInLava() {
|
||||
//$$ return falseUnlessSpectating(Entity::isInLava); // Make sure no lava overlay is rendered
|
||||
//$$ }
|
||||
//#else
|
||||
//$$ @Override
|
||||
//$$ public boolean handleLavaMovement() {
|
||||
//$$ return falseUnlessSpectating(Entity::handleLavaMovement); // Make sure no lava overlay is rendered
|
||||
//$$ }
|
||||
//#endif
|
||||
|
||||
@Override
|
||||
public boolean isInWater() {
|
||||
return falseUnlessSpectating(Entity::isInWater); // Make sure no water overlay is rendered
|
||||
}
|
||||
//$$
|
||||
//$$ @Override
|
||||
//$$ public boolean isInWater() {
|
||||
//$$ return falseUnlessSpectating(Entity::isInWater); // Make sure no water overlay is rendered
|
||||
//$$ }
|
||||
//#endif
|
||||
|
||||
@Override
|
||||
public boolean isBurning() {
|
||||
return falseUnlessSpectating(Entity::isBurning); // Make sure no fire overlay is rendered
|
||||
public boolean isOnFire() {
|
||||
return falseUnlessSpectating(Entity::isOnFire); // Make sure no fire overlay is rendered
|
||||
}
|
||||
|
||||
private boolean falseUnlessSpectating(Function<Entity, Boolean> property) {
|
||||
Entity view = getRenderViewEntity(this.mc);
|
||||
Entity view = getRenderViewEntity(this.client);
|
||||
if (view != null && view != this) {
|
||||
return property.apply(view);
|
||||
}
|
||||
@@ -350,19 +350,19 @@ public class CameraEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBePushed() {
|
||||
public boolean isPushable() {
|
||||
return false; // We are in full control of ourselves
|
||||
}
|
||||
|
||||
//#if MC>=10800
|
||||
@Override
|
||||
protected void createRunningParticles() {
|
||||
protected void spawnSprintingParticles() {
|
||||
// We do not produce any particles, we are a camera
|
||||
}
|
||||
//#endif
|
||||
|
||||
@Override
|
||||
public boolean canBeCollidedWith() {
|
||||
public boolean collides() {
|
||||
return false; // We are a camera, we cannot collide
|
||||
}
|
||||
|
||||
@@ -374,23 +374,23 @@ public class CameraEntity
|
||||
//#endif
|
||||
|
||||
//#if MC>=11400
|
||||
//$$ @Override
|
||||
//$$ public boolean shouldRenderFrom(double double_1, double double_2, double double_3) {
|
||||
//$$ return false; // never render the camera otherwise it'd be visible e.g. in 3rd-person or with shaders
|
||||
//$$ }
|
||||
//#else
|
||||
@Override
|
||||
public boolean shouldRenderInPass(int pass) {
|
||||
// Never render the camera
|
||||
// This is necessary to hide the player head in third person mode and to not
|
||||
// cause any unwanted shadows when rendering with shaders.
|
||||
return false;
|
||||
public boolean shouldRenderFrom(double double_1, double double_2, double double_3) {
|
||||
return false; // never render the camera otherwise it'd be visible e.g. in 3rd-person or with shaders
|
||||
}
|
||||
//#else
|
||||
//$$ @Override
|
||||
//$$ public boolean shouldRenderInPass(int pass) {
|
||||
//$$ // Never render the camera
|
||||
//$$ // This is necessary to hide the player head in third person mode and to not
|
||||
//$$ // cause any unwanted shadows when rendering with shaders.
|
||||
//$$ return false;
|
||||
//$$ }
|
||||
//#endif
|
||||
|
||||
@Override
|
||||
public boolean isInvisible() {
|
||||
Entity view = getRenderViewEntity(this.mc);
|
||||
Entity view = getRenderViewEntity(this.client);
|
||||
if (view != this) {
|
||||
return view.isInvisible();
|
||||
}
|
||||
@@ -398,99 +398,99 @@ public class CameraEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getLocationSkin() {
|
||||
Entity view = getRenderViewEntity(this.mc);
|
||||
if (view != this && view instanceof EntityPlayer) {
|
||||
return Utils.getResourceLocationForPlayerUUID(view.getUniqueID());
|
||||
public Identifier getSkinTexture() {
|
||||
Entity view = getRenderViewEntity(this.client);
|
||||
if (view != this && view instanceof PlayerEntity) {
|
||||
return Utils.getResourceLocationForPlayerUUID(view.getUuid());
|
||||
}
|
||||
return super.getLocationSkin();
|
||||
return super.getSkinTexture();
|
||||
}
|
||||
|
||||
//#if MC>=10800
|
||||
@Override
|
||||
public String getSkinType() {
|
||||
Entity view = this.mc.getRenderViewEntity();
|
||||
if (view != this && view instanceof AbstractClientPlayer) {
|
||||
return ((AbstractClientPlayer) view).getSkinType();
|
||||
public String getModel() {
|
||||
Entity view = this.client.getCameraEntity();
|
||||
if (view != this && view instanceof AbstractClientPlayerEntity) {
|
||||
return ((AbstractClientPlayerEntity) view).getModel();
|
||||
}
|
||||
return super.getSkinType();
|
||||
return super.getModel();
|
||||
}
|
||||
//#endif
|
||||
|
||||
@Override
|
||||
public float getSwingProgress(float renderPartialTicks) {
|
||||
Entity view = getRenderViewEntity(this.mc);
|
||||
if (view != this && view instanceof EntityPlayer) {
|
||||
return ((EntityPlayer) view).getSwingProgress(renderPartialTicks);
|
||||
public float getHandSwingProgress(float renderPartialTicks) {
|
||||
Entity view = getRenderViewEntity(this.client);
|
||||
if (view != this && view instanceof PlayerEntity) {
|
||||
return ((PlayerEntity) view).getHandSwingProgress(renderPartialTicks);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#if MC>=10904
|
||||
@Override
|
||||
public float getCooldownPeriod() {
|
||||
Entity view = this.mc.getRenderViewEntity();
|
||||
if (view != this && view instanceof EntityPlayer) {
|
||||
return ((EntityPlayer) view).getCooldownPeriod();
|
||||
public float method_7279() {
|
||||
Entity view = this.client.getCameraEntity();
|
||||
if (view != this && view instanceof PlayerEntity) {
|
||||
return ((PlayerEntity) view).method_7279();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getCooledAttackStrength(float adjustTicks) {
|
||||
Entity view = this.mc.getRenderViewEntity();
|
||||
if (view != this && view instanceof EntityPlayer) {
|
||||
return ((EntityPlayer) view).getCooledAttackStrength(adjustTicks);
|
||||
public float method_7261(float adjustTicks) {
|
||||
Entity view = this.client.getCameraEntity();
|
||||
if (view != this && view instanceof PlayerEntity) {
|
||||
return ((PlayerEntity) view).method_7261(adjustTicks);
|
||||
}
|
||||
// Default to 1 as to not render the cooldown indicator (renders for < 1)
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumHand getActiveHand() {
|
||||
Entity view = this.mc.getRenderViewEntity();
|
||||
if (view != this && view instanceof EntityPlayer) {
|
||||
return ((EntityPlayer) view).getActiveHand();
|
||||
public Hand getActiveHand() {
|
||||
Entity view = this.client.getCameraEntity();
|
||||
if (view != this && view instanceof PlayerEntity) {
|
||||
return ((PlayerEntity) view).getActiveHand();
|
||||
}
|
||||
return super.getActiveHand();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHandActive() {
|
||||
Entity view = this.mc.getRenderViewEntity();
|
||||
if (view != this && view instanceof EntityPlayer) {
|
||||
return ((EntityPlayer) view).isHandActive();
|
||||
public boolean isUsingItem() {
|
||||
Entity view = this.client.getCameraEntity();
|
||||
if (view != this && view instanceof PlayerEntity) {
|
||||
return ((PlayerEntity) view).isUsingItem();
|
||||
}
|
||||
return super.isHandActive();
|
||||
return super.isUsingItem();
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//$$ @Override
|
||||
//$$ public HitResult rayTrace(double maxDistance, float tickDelta, boolean fluids) {
|
||||
//$$ HitResult result = super.rayTrace(maxDistance, tickDelta, fluids);
|
||||
//$$
|
||||
//$$ // Make sure we can never look at blocks (-> no outline)
|
||||
//$$ if (result instanceof BlockHitResult) {
|
||||
//$$ BlockHitResult blockResult = (BlockHitResult) result;
|
||||
//$$ result = BlockHitResult.createMissed(result.getPos(), blockResult.getSide(), blockResult.getBlockPos());
|
||||
//$$ }
|
||||
//$$
|
||||
//$$ return result;
|
||||
//$$ }
|
||||
//#else
|
||||
//#if MC>=11300
|
||||
@Override
|
||||
public RayTraceResult rayTrace(double blockReachDistance, float partialTicks, RayTraceFluidMode p_174822_4_) {
|
||||
RayTraceResult pos = super.rayTrace(blockReachDistance, partialTicks, p_174822_4_);
|
||||
public HitResult rayTrace(double maxDistance, float tickDelta, boolean fluids) {
|
||||
HitResult result = super.rayTrace(maxDistance, tickDelta, fluids);
|
||||
|
||||
// Make sure we can never look at blocks (-> no outline)
|
||||
if(pos != null && pos.type == RayTraceResult.Type.BLOCK) {
|
||||
pos.type = RayTraceResult.Type.MISS;
|
||||
if (result instanceof BlockHitResult) {
|
||||
BlockHitResult blockResult = (BlockHitResult) result;
|
||||
result = BlockHitResult.createMissed(result.getPos(), blockResult.getSide(), blockResult.getBlockPos());
|
||||
}
|
||||
|
||||
return pos;
|
||||
return result;
|
||||
}
|
||||
//#else
|
||||
//#if MC>=11300
|
||||
//$$ @Override
|
||||
//$$ public RayTraceResult rayTrace(double blockReachDistance, float partialTicks, RayTraceFluidMode p_174822_4_) {
|
||||
//$$ RayTraceResult pos = super.rayTrace(blockReachDistance, partialTicks, p_174822_4_);
|
||||
//$$
|
||||
//$$ // Make sure we can never look at blocks (-> no outline)
|
||||
//$$ if(pos != null && pos.type == RayTraceResult.Type.BLOCK) {
|
||||
//$$ pos.type = RayTraceResult.Type.MISS;
|
||||
//$$ }
|
||||
//$$
|
||||
//$$ return pos;
|
||||
//$$ }
|
||||
//#else
|
||||
//$$ @Override
|
||||
//$$ public RayTraceResult rayTrace(double p_174822_1_, float p_174822_3_) {
|
||||
//$$ RayTraceResult pos = super.rayTrace(p_174822_1_, 1f);
|
||||
@@ -546,40 +546,40 @@ public class CameraEntity
|
||||
handleInputEvents();
|
||||
|
||||
Map<String, KeyBinding> keyBindings = ReplayMod.instance.getKeyBindingRegistry().getKeyBindings();
|
||||
if (keyBindings.get("replaymod.input.rollclockwise").isKeyDown()) {
|
||||
if (keyBindings.get("replaymod.input.rollclockwise").isPressed()) {
|
||||
roll += Utils.isCtrlDown() ? 0.2 : 1;
|
||||
}
|
||||
if (keyBindings.get("replaymod.input.rollcounterclockwise").isKeyDown()) {
|
||||
if (keyBindings.get("replaymod.input.rollcounterclockwise").isPressed()) {
|
||||
roll -= Utils.isCtrlDown() ? 0.2 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
private void handleInputEvents() {
|
||||
if (this.mc.gameSettings.keyBindAttack.isPressed() || this.mc.gameSettings.keyBindUseItem.isPressed()) {
|
||||
if (canSpectate(this.mc.pointedEntity)) {
|
||||
if (this.client.options.keyAttack.wasPressed() || this.client.options.keyUse.wasPressed()) {
|
||||
if (canSpectate(this.client.targetedEntity)) {
|
||||
ReplayModReplay.instance.getReplayHandler().spectateEntity(
|
||||
//#if MC<=10710
|
||||
//$$ (EntityLivingBase)
|
||||
//#endif
|
||||
this.mc.pointedEntity);
|
||||
this.client.targetedEntity);
|
||||
// Make sure we don't exit right away
|
||||
//noinspection StatementWithEmptyBody
|
||||
while (this.mc.gameSettings.keyBindSneak.isPressed());
|
||||
while (this.client.options.keySneak.wasPressed());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateArmYawAndPitch() {
|
||||
this.prevRenderArmYaw = this.renderArmYaw;
|
||||
this.prevRenderArmPitch = this.renderArmPitch;
|
||||
this.renderArmPitch = this.renderArmPitch + (this.rotationPitch - this.renderArmPitch) * 0.5f;
|
||||
this.renderArmYaw = this.renderArmYaw + (this.rotationYaw - this.renderArmYaw) * 0.5f;
|
||||
this.lastRenderYaw = this.renderYaw;
|
||||
this.lastRenderPitch = this.renderPitch;
|
||||
this.renderPitch = this.renderPitch + (this.pitch - this.renderPitch) * 0.5f;
|
||||
this.renderYaw = this.renderYaw + (this.yaw - this.renderYaw) * 0.5f;
|
||||
}
|
||||
|
||||
public boolean canSpectate(Entity e) {
|
||||
return e != null && !e.isInvisible()
|
||||
//#if MC>=10800
|
||||
&& (e instanceof EntityPlayer || e instanceof EntityLiving || e instanceof EntityItemFrame);
|
||||
&& (e instanceof PlayerEntity || e instanceof MobEntity || e instanceof ItemFrameEntity);
|
||||
//#else
|
||||
//$$ && e instanceof EntityPlayer; // cannot be more generic since 1.7.10 has no concept of eye height
|
||||
//#endif
|
||||
@@ -587,11 +587,11 @@ public class CameraEntity
|
||||
|
||||
//#if MC<11400
|
||||
//#if MC>=11102
|
||||
@Override
|
||||
public void sendMessage(ITextComponent message) {
|
||||
if (MinecraftForge.EVENT_BUS.post(new ReplayChatMessageEvent(this))) return;
|
||||
super.sendMessage(message);
|
||||
}
|
||||
//$$ @Override
|
||||
//$$ public void sendMessage(ITextComponent message) {
|
||||
//$$ if (MinecraftForge.EVENT_BUS.post(new ReplayChatMessageEvent(this))) return;
|
||||
//$$ super.sendMessage(message);
|
||||
//$$ }
|
||||
//#else
|
||||
//$$ @Override
|
||||
//$$ public void addChatMessage(ITextComponent message) {
|
||||
@@ -607,53 +607,53 @@ public class CameraEntity
|
||||
//$$ public // All event handlers need to be public in 1.7.10
|
||||
//#endif
|
||||
class EventHandler extends EventRegistrations {
|
||||
private final Minecraft mc = getMinecraft();
|
||||
private final MinecraftClient mc = getMinecraft();
|
||||
|
||||
private EventHandler() {}
|
||||
|
||||
//#if MC>=11400
|
||||
//$$ { on(PreTickCallback.EVENT, this::onPreClientTick); }
|
||||
//$$ private void onPreClientTick() {
|
||||
{ on(PreTickCallback.EVENT, this::onPreClientTick); }
|
||||
private void onPreClientTick() {
|
||||
//#else
|
||||
@SubscribeEvent
|
||||
public void onPreClientTick(TickEvent.ClientTickEvent event) {
|
||||
if (event.phase != TickEvent.Phase.START) return;
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void onPreClientTick(TickEvent.ClientTickEvent event) {
|
||||
//$$ if (event.phase != TickEvent.Phase.START) return;
|
||||
//#endif
|
||||
updateArmYawAndPitch();
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//$$ { on(PreRenderCallback.EVENT, this::onRenderUpdate); }
|
||||
//$$ private void onRenderUpdate() {
|
||||
{ on(PreRenderCallback.EVENT, this::onRenderUpdate); }
|
||||
private void onRenderUpdate() {
|
||||
//#else
|
||||
@SubscribeEvent
|
||||
public void onRenderUpdate(TickEvent.RenderTickEvent event) {
|
||||
if (event.phase != TickEvent.Phase.START) return;
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void onRenderUpdate(TickEvent.RenderTickEvent event) {
|
||||
//$$ if (event.phase != TickEvent.Phase.START) return;
|
||||
//#endif
|
||||
update();
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//$$ { on(KeyBindingEventCallback.EVENT, CameraEntity.this::handleInputEvents); }
|
||||
{ on(KeyBindingEventCallback.EVENT, CameraEntity.this::handleInputEvents); }
|
||||
//#endif
|
||||
|
||||
//#if MC>=11400
|
||||
//$$ { on(RenderSpectatorCrosshairCallback.EVENT, this::shouldRenderSpectatorCrosshair); }
|
||||
//$$ private TriState shouldRenderSpectatorCrosshair() {
|
||||
//$$ return TriState.of(canSpectate(mc.targetedEntity));
|
||||
//$$ }
|
||||
//#else
|
||||
@SubscribeEvent
|
||||
public void preCrosshairRender(RenderGameOverlayEvent.Pre event) {
|
||||
// The crosshair should only render if targeted entity can actually be spectated
|
||||
if (MCVer.getType(event) == RenderGameOverlayEvent.ElementType.CROSSHAIRS) {
|
||||
event.setCanceled(!canSpectate(mc.pointedEntity));
|
||||
}
|
||||
// Hotbar should never be rendered
|
||||
if (MCVer.getType(event) == RenderGameOverlayEvent.ElementType.HOTBAR) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
{ on(RenderSpectatorCrosshairCallback.EVENT, this::shouldRenderSpectatorCrosshair); }
|
||||
private TriState shouldRenderSpectatorCrosshair() {
|
||||
return TriState.of(canSpectate(mc.targetedEntity));
|
||||
}
|
||||
//#else
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void preCrosshairRender(RenderGameOverlayEvent.Pre event) {
|
||||
//$$ // The crosshair should only render if targeted entity can actually be spectated
|
||||
//$$ if (MCVer.getType(event) == RenderGameOverlayEvent.ElementType.CROSSHAIRS) {
|
||||
//$$ event.setCanceled(!canSpectate(mc.pointedEntity));
|
||||
//$$ }
|
||||
//$$ // Hotbar should never be rendered
|
||||
//$$ if (MCVer.getType(event) == RenderGameOverlayEvent.ElementType.HOTBAR) {
|
||||
//$$ event.setCanceled(true);
|
||||
//$$ }
|
||||
//$$ }
|
||||
//#endif
|
||||
|
||||
{ on(SettingsChangedCallback.EVENT, this::onSettingsChanged); }
|
||||
@@ -668,47 +668,47 @@ public class CameraEntity
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//$$ { on(PreRenderHandCallback.EVENT, this::onRenderHand); }
|
||||
//$$ private boolean onRenderHand() {
|
||||
//$$ // Unless we are spectating another player, don't render our hand
|
||||
//$$ if (getRenderViewEntity(mc) == CameraEntity.this || !(getRenderViewEntity(mc) instanceof PlayerEntity)) {
|
||||
//$$ return true; // cancel hand rendering
|
||||
//$$ } else {
|
||||
//$$ onRenderHandMonitor();
|
||||
//$$ return false;
|
||||
//$$ }
|
||||
//$$ }
|
||||
//#else
|
||||
@SubscribeEvent
|
||||
public void onRenderHand(RenderHandEvent event) {
|
||||
{ on(PreRenderHandCallback.EVENT, this::onRenderHand); }
|
||||
private boolean onRenderHand() {
|
||||
// Unless we are spectating another player, don't render our hand
|
||||
if (getRenderViewEntity(mc) == CameraEntity.this || !(getRenderViewEntity(mc) instanceof EntityPlayer)) {
|
||||
event.setCanceled(true);
|
||||
if (getRenderViewEntity(mc) == CameraEntity.this || !(getRenderViewEntity(mc) instanceof PlayerEntity)) {
|
||||
return true; // cancel hand rendering
|
||||
} else {
|
||||
onRenderHandMonitor();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//#else
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void onRenderHand(RenderHandEvent event) {
|
||||
//$$ // Unless we are spectating another player, don't render our hand
|
||||
//$$ if (getRenderViewEntity(mc) == CameraEntity.this || !(getRenderViewEntity(mc) instanceof EntityPlayer)) {
|
||||
//$$ event.setCanceled(true);
|
||||
//$$ }
|
||||
//$$ }
|
||||
//#endif
|
||||
|
||||
//#if MC>=11400
|
||||
//$$ private void onRenderHandMonitor() {
|
||||
private void onRenderHandMonitor() {
|
||||
//#else
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public void onRenderHandMonitor(RenderHandEvent event) {
|
||||
//$$ @SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
//$$ public void onRenderHandMonitor(RenderHandEvent event) {
|
||||
//#endif
|
||||
Entity view = getRenderViewEntity(mc);
|
||||
if (view instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) view;
|
||||
if (view instanceof PlayerEntity) {
|
||||
PlayerEntity player = (PlayerEntity) view;
|
||||
// When the spectated player has changed, force equip their items to prevent the equip animation
|
||||
if (lastHandRendered != player) {
|
||||
lastHandRendered = player;
|
||||
|
||||
FirstPersonRendererAccessor acc = (FirstPersonRendererAccessor) mc.entityRenderer.itemRenderer;
|
||||
FirstPersonRendererAccessor acc = (FirstPersonRendererAccessor) mc.gameRenderer.firstPersonRenderer;
|
||||
//#if MC>=10904
|
||||
acc.setPrevEquippedProgressMainHand(1);
|
||||
acc.setPrevEquippedProgressOffHand(1);
|
||||
acc.setEquippedProgressMainHand(1);
|
||||
acc.setEquippedProgressOffHand(1);
|
||||
acc.setItemStackMainHand(player.getItemStackFromSlot(EntityEquipmentSlot.MAINHAND));
|
||||
acc.setItemStackOffHand(player.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND));
|
||||
acc.setItemStackMainHand(player.getEquippedStack(EquipmentSlot.HAND_MAIN));
|
||||
acc.setItemStackOffHand(player.getEquippedStack(EquipmentSlot.HAND_OFF));
|
||||
//#else
|
||||
//$$ acc.setPrevEquippedProgress(1);
|
||||
//$$ acc.setEquippedProgress(1);
|
||||
@@ -717,75 +717,75 @@ public class CameraEntity
|
||||
//#endif
|
||||
|
||||
|
||||
mc.player.renderArmYaw = mc.player.prevRenderArmYaw = player.rotationYaw;
|
||||
mc.player.renderArmPitch = mc.player.prevRenderArmPitch = player.rotationPitch;
|
||||
mc.player.renderYaw = mc.player.lastRenderYaw = player.yaw;
|
||||
mc.player.renderPitch = mc.player.lastRenderPitch = player.pitch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//$$ // Moved to MixinCamera
|
||||
// Moved to MixinCamera
|
||||
//#else
|
||||
//#if MC>=10800
|
||||
@SubscribeEvent
|
||||
public void onEntityViewRenderEvent(EntityViewRenderEvent.CameraSetup event) {
|
||||
if (mc.getRenderViewEntity() == CameraEntity.this) {
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void onEntityViewRenderEvent(EntityViewRenderEvent.CameraSetup event) {
|
||||
//$$ if (mc.getRenderViewEntity() == CameraEntity.this) {
|
||||
//#if MC>=10904
|
||||
event.setRoll(roll);
|
||||
//$$ event.setRoll(roll);
|
||||
//#else
|
||||
//$$ event.roll = roll;
|
||||
//#endif
|
||||
}
|
||||
}
|
||||
//$$ }
|
||||
//$$ }
|
||||
//#endif
|
||||
//#endif
|
||||
|
||||
private boolean heldItemTooltipsWasTrue;
|
||||
|
||||
//#if MC>=11400
|
||||
//$$ // FIXME fabric
|
||||
// FIXME fabric
|
||||
//#else
|
||||
@SubscribeEvent
|
||||
public void preRenderGameOverlay(RenderGameOverlayEvent.Pre event) {
|
||||
switch (MCVer.getType(event)) {
|
||||
case ALL:
|
||||
heldItemTooltipsWasTrue = mc.gameSettings.heldItemTooltips;
|
||||
mc.gameSettings.heldItemTooltips = false;
|
||||
break;
|
||||
case ARMOR:
|
||||
case HEALTH:
|
||||
case FOOD:
|
||||
case AIR:
|
||||
case HOTBAR:
|
||||
case EXPERIENCE:
|
||||
case HEALTHMOUNT:
|
||||
case JUMPBAR:
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void preRenderGameOverlay(RenderGameOverlayEvent.Pre event) {
|
||||
//$$ switch (MCVer.getType(event)) {
|
||||
//$$ case ALL:
|
||||
//$$ heldItemTooltipsWasTrue = mc.gameSettings.heldItemTooltips;
|
||||
//$$ mc.gameSettings.heldItemTooltips = false;
|
||||
//$$ break;
|
||||
//$$ case ARMOR:
|
||||
//$$ case HEALTH:
|
||||
//$$ case FOOD:
|
||||
//$$ case AIR:
|
||||
//$$ case HOTBAR:
|
||||
//$$ case EXPERIENCE:
|
||||
//$$ case HEALTHMOUNT:
|
||||
//$$ case JUMPBAR:
|
||||
//#if MC>=10904
|
||||
case POTION_ICONS:
|
||||
//$$ case POTION_ICONS:
|
||||
//#endif
|
||||
event.setCanceled(true);
|
||||
break;
|
||||
case HELMET:
|
||||
case PORTAL:
|
||||
case CROSSHAIRS:
|
||||
case BOSSHEALTH:
|
||||
//$$ event.setCanceled(true);
|
||||
//$$ break;
|
||||
//$$ case HELMET:
|
||||
//$$ case PORTAL:
|
||||
//$$ case CROSSHAIRS:
|
||||
//$$ case BOSSHEALTH:
|
||||
//#if MC>=10904
|
||||
case BOSSINFO:
|
||||
case SUBTITLES:
|
||||
//$$ case BOSSINFO:
|
||||
//$$ case SUBTITLES:
|
||||
//#endif
|
||||
case TEXT:
|
||||
case CHAT:
|
||||
case PLAYER_LIST:
|
||||
case DEBUG:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void postRenderGameOverlay(RenderGameOverlayEvent.Post event) {
|
||||
if (MCVer.getType(event) != RenderGameOverlayEvent.ElementType.ALL) return;
|
||||
mc.gameSettings.heldItemTooltips = heldItemTooltipsWasTrue;
|
||||
}
|
||||
//$$ case TEXT:
|
||||
//$$ case CHAT:
|
||||
//$$ case PLAYER_LIST:
|
||||
//$$ case DEBUG:
|
||||
//$$ break;
|
||||
//$$ }
|
||||
//$$ }
|
||||
//$$
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void postRenderGameOverlay(RenderGameOverlayEvent.Post event) {
|
||||
//$$ if (MCVer.getType(event) != RenderGameOverlayEvent.ElementType.ALL) return;
|
||||
//$$ mc.gameSettings.heldItemTooltips = heldItemTooltipsWasTrue;
|
||||
//$$ }
|
||||
//#endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user