Remove some more preprocessor statements in favor of remap

This commit is contained in:
Jonas Herzig
2019-05-28 11:25:46 +02:00
parent f3acf8cde7
commit d89655e69a
18 changed files with 137 additions and 254 deletions

View File

@@ -103,8 +103,10 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
AdvancementUpdateS2CPacket.class,
SelectAdvancementTabS2CPacket.class,
//#endif
//#if MC>=10904
// TODO Update possibly more?
//#if MC>=10800
SetCameraEntityS2CPacket.class,
TitleS2CPacket.class,
//#endif
HealthUpdateS2CPacket.class,
GuiOpenS2CPacket.class,
GuiCloseS2CPacket.class,
@@ -113,24 +115,7 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
SignEditorOpenS2CPacket.class,
StatisticsS2CPacket.class,
ExperienceBarUpdateS2CPacket.class,
SetCameraEntityS2CPacket.class,
PlayerAbilitiesS2CPacket.class,
TitleS2CPacket.class
//#else
//#if MC>=10800
//$$ S43PacketCamera.class,
//$$ S45PacketTitle.class,
//#endif
//$$ S06PacketUpdateHealth.class,
//$$ S2DPacketOpenWindow.class,
//$$ S2EPacketCloseWindow.class,
//$$ S2FPacketSetSlot.class,
//$$ S30PacketWindowItems.class,
//$$ S36PacketSignEditorOpen.class,
//$$ S37PacketStatistics.class,
//$$ S1FPacketSetExperience.class,
//$$ S39PacketPlayerAbilities.class
//#endif
PlayerAbilitiesS2CPacket.class
);
private static int TP_DISTANCE_LIMIT = 128;
@@ -342,11 +327,7 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
if (mc.world != null) {
for (PlayerEntity playerEntity : playerEntities(mc.world)) {
if (!playerEntity.field_6016 && playerEntity instanceof OtherClientPlayerEntity) {
//#if MC>=11300
playerEntity.tickMovement();
//#else
//$$ playerEntity.onLivingUpdate();
//#endif
playerEntity.tickMovement();
}
}
}
@@ -644,13 +625,8 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
//#endif
if(cent != null) {
//#if MC>=10809
if(!allowMovement && !((Math.abs(cent.x - ppl.getX()) > TP_DISTANCE_LIMIT) ||
(Math.abs(cent.z - ppl.getZ()) > TP_DISTANCE_LIMIT))) {
//#else
//$$ if(!allowMovement && !((Math.abs(cent.posX - ppl.func_148932_c()) > TP_DISTANCE_LIMIT) ||
//$$ (Math.abs(cent.posZ - ppl.func_148933_e()) > TP_DISTANCE_LIMIT))) {
//#endif
return null;
} else {
allowMovement = false;
@@ -667,11 +643,7 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
}
CameraEntity cent = replayHandler.getCameraEntity();
//#if MC>=10809
cent.setCameraPosition(ppl.getX(), ppl.getY(), ppl.getZ());
//#else
//$$ cent.setCameraPosition(ppl.func_148932_c(), ppl.func_148928_d(), ppl.func_148933_e());
//#endif
}
}.run();
}
@@ -1025,17 +997,10 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
int x = packet.getX();
int z = packet.getZ();
//#else
//#if MC>=10809
//$$ if (p instanceof S21PacketChunkData && ((S21PacketChunkData) p).getExtractedSize() == 0) {
//$$ S21PacketChunkData packet = (S21PacketChunkData) p;
//$$ int x = packet.getChunkX();
//$$ int z = packet.getChunkZ();
//#else
//$$ if (p instanceof S21PacketChunkData && ((S21PacketChunkData) p).func_149276_g() == 0) {
//$$ S21PacketChunkData packet = (S21PacketChunkData) p;
//$$ int x = packet.func_149273_e();
//$$ int z = packet.func_149271_f();
//#endif
//#endif
// If the chunk is getting unloaded, we will have to forcefully update the position of all entities
// within. Otherwise, if there wasn't a game tick recently, there may be entities that have moved

View File

@@ -19,6 +19,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.decoration.ItemFrameEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.stat.StatHandler;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BoundingBox;
@@ -28,7 +29,6 @@ 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;
@@ -65,10 +65,7 @@ import net.minecraft.client.recipe.book.ClientRecipeBook;
//$$ import net.minecraft.stats.RecipeBook;
//#endif
//#endif
import net.minecraft.stat.StatHandler;
import net.minecraft.util.Hand;
//#else
//$$ import net.minecraft.stats.StatFileWriter;
//#endif
//#if MC>=10800
@@ -120,32 +117,37 @@ public class CameraEntity
*/
private final EventHandler eventHandler = new EventHandler();
//#if MC>=11300
//#if MC>=11400
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) {
//#endif
super(mcIn, worldIn, netHandlerPlayClient, statisticsManager, recipeBookClient);
//#else
//#if MC>=11200
//$$ public CameraEntity(Minecraft mcIn, World worldIn, NetHandlerPlayClient netHandlerPlayClient, StatisticsManager statisticsManager, RecipeBook recipeBook) {
//$$ super(mcIn, worldIn, netHandlerPlayClient, statisticsManager, recipeBook);
//#else
//#if MC>=10904
//$$ public CameraEntity(Minecraft mcIn, World worldIn, NetHandlerPlayClient netHandlerPlayClient, StatisticsManager statisticsManager) {
//$$ super(mcIn, worldIn, netHandlerPlayClient, statisticsManager);
//#else
//#if MC>=10800
//$$ public CameraEntity(Minecraft mcIn, World worldIn, NetHandlerPlayClient netHandlerPlayClient, StatFileWriter statFileWriter) {
//$$ super(mcIn, worldIn, netHandlerPlayClient, statFileWriter);
//#else
//$$ public CameraEntity(Minecraft mcIn, World worldIn, Session session, NetHandlerPlayClient netHandlerPlayClient, StatFileWriter statFileWriter) {
//$$ super(mcIn, worldIn, session, netHandlerPlayClient, statFileWriter);
//#endif
//#endif
//#endif
//#endif
public CameraEntity(
MinecraftClient mcIn,
//#if MC>=11400
ClientWorld worldIn,
//#else
//$$ World worldIn,
//#endif
//#if MC<10800
//$$ Session session,
//#endif
ClientPlayNetworkHandler netHandlerPlayClient,
StatHandler statisticsManager
//#if MC>=11200
//#if MC>=11300
, ClientRecipeBook recipeBook
//#else
//$$ , RecipeBook recipeBook
//#endif
//#endif
) {
super(mcIn,
worldIn,
//#if MC<10800
//$$ session,
//#endif
netHandlerPlayClient,
statisticsManager
//#if MC>=11200
, recipeBook
//#endif
);
eventHandler.register();
if (ReplayModReplay.instance.getReplayHandler().getSpectatedUUID() == null) {
cameraController = ReplayModReplay.instance.createCameraController(this);
@@ -231,12 +233,8 @@ public class CameraEntity
float height = getHeight();
//#endif
//#if MC>=10800
//#if MC>=11300
setBoundingBox(new BoundingBox(
//#else
//$$ setEntityBoundingBox(new AxisAlignedBB(
//#endif
//#else
//$$ this.boundingBox.setBB(AxisAlignedBB.getBoundingBox(
//#endif
this.x - width / 2, this.y, this.z - width / 2,
@@ -244,11 +242,7 @@ public class CameraEntity
}
@Override
//#if MC>=11300
public void tick() {
//#else
//$$ public void onUpdate() {
//#endif
//#if MC>=10800
Entity view = getRenderViewEntity(this.client);
//#else
@@ -527,13 +521,8 @@ public class CameraEntity
//#endif
@Override
//#if MC>=11300
public void remove() {
super.remove();
//#else
//$$ public void setDead() {
//$$ super.setDead();
//#endif
eventHandler.unregister();
}

View File

@@ -2,13 +2,8 @@ package com.replaymod.replay.camera;
import de.johni0702.minecraft.gui.utils.lwjgl.vector.Vector3f;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.options.KeyBinding;
//#if MC>=11300
import net.minecraft.client.options.GameOptions;
//#else
//$$ import net.minecraft.client.settings.GameSettings;
//#endif
import net.minecraft.client.options.KeyBinding;
/**
* Camera controller performing vanilla creative-like camera movements.