Stop using @SneakyThrows since it breaks the JDT used for source remap

This commit is contained in:
Jonas Herzig
2019-04-24 13:41:06 +02:00
parent 9968f81073
commit fa8f8f52aa
4 changed files with 30 additions and 25 deletions

View File

@@ -9,7 +9,6 @@ import com.replaymod.render.blend.data.DMesh;
import com.replaymod.render.blend.data.DObject; import com.replaymod.render.blend.data.DObject;
import com.replaymod.replaystudio.us.myles.ViaVersion.util.ReflectionUtil; import com.replaymod.replaystudio.us.myles.ViaVersion.util.ReflectionUtil;
import de.johni0702.minecraft.gui.utils.lwjgl.vector.Vector3f; import de.johni0702.minecraft.gui.utils.lwjgl.vector.Vector3f;
import lombok.SneakyThrows;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.OpenGlHelper;
@@ -70,7 +69,6 @@ public class ChunkExporter implements Exporter {
} }
@Override @Override
@SneakyThrows
public void setup() throws IOException { public void setup() throws IOException {
Minecraft mc = MCVer.getMinecraft(); Minecraft mc = MCVer.getMinecraft();

View File

@@ -7,7 +7,6 @@ import com.replaymod.render.blend.Exporter;
import com.replaymod.render.blend.data.DObject; import com.replaymod.render.blend.data.DObject;
import de.johni0702.minecraft.gui.utils.lwjgl.vector.Matrix4f; import de.johni0702.minecraft.gui.utils.lwjgl.vector.Matrix4f;
import de.johni0702.minecraft.gui.utils.lwjgl.vector.Vector3f; import de.johni0702.minecraft.gui.utils.lwjgl.vector.Vector3f;
import lombok.SneakyThrows;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
@@ -29,8 +28,7 @@ public class EntityExporter implements Exporter {
} }
@Override @Override
@SneakyThrows public void setup() {
public void setup() throws IOException {
entitiesObject = new DObject(DObject.Type.OB_EMPTY); entitiesObject = new DObject(DObject.Type.OB_EMPTY);
entitiesObject.id.name = "Entities"; entitiesObject.id.name = "Entities";
entitiesObject.layers = 1 << 1; entitiesObject.layers = 1 << 1;

View File

@@ -7,7 +7,6 @@ import com.replaymod.render.blend.Exporter;
import com.replaymod.render.blend.data.DObject; import com.replaymod.render.blend.data.DObject;
import de.johni0702.minecraft.gui.utils.lwjgl.vector.Matrix4f; import de.johni0702.minecraft.gui.utils.lwjgl.vector.Matrix4f;
import de.johni0702.minecraft.gui.utils.lwjgl.vector.Vector3f; import de.johni0702.minecraft.gui.utils.lwjgl.vector.Vector3f;
import lombok.SneakyThrows;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@@ -36,7 +35,6 @@ public class TileEntityExporter implements Exporter {
} }
@Override @Override
@SneakyThrows
public void setup() throws IOException { public void setup() throws IOException {
tileEntitiesObject = new DObject(DObject.Type.OB_EMPTY); tileEntitiesObject = new DObject(DObject.Type.OB_EMPTY);
tileEntitiesObject.id.name = "TileEntities"; tileEntitiesObject.id.name = "TileEntities";

View File

@@ -58,7 +58,6 @@ import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerAdapter; import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import lombok.SneakyThrows;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.network.EnumConnectionState; import net.minecraft.network.EnumConnectionState;
import net.minecraft.network.EnumPacketDirection; import net.minecraft.network.EnumPacketDirection;
@@ -559,7 +558,11 @@ public class QuickReplaySender extends ChannelHandlerAdapter implements ReplaySe
if (replayTime > currentTimeStamp) { if (replayTime > currentTimeStamp) {
activeThings.removeIf(thing -> { activeThings.removeIf(thing -> {
if (thing.despawnTime <= replayTime) { if (thing.despawnTime <= replayTime) {
thing.despawn(this, ctx::fireChannelRead); try {
thing.despawn(this, ctx::fireChannelRead);
} catch (IOException e) {
throw new RuntimeException(e);
}
return true; return true;
} else { } else {
return false; return false;
@@ -568,7 +571,11 @@ public class QuickReplaySender extends ChannelHandlerAdapter implements ReplaySe
thingSpawnsT.subMap(currentTimeStamp, false, replayTime, true).values() thingSpawnsT.subMap(currentTimeStamp, false, replayTime, true).values()
.forEach(things -> things.forEach(thing -> { .forEach(things -> things.forEach(thing -> {
if (thing.despawnTime > replayTime) { if (thing.despawnTime > replayTime) {
thing.spawn(this, ctx::fireChannelRead); try {
thing.spawn(this, ctx::fireChannelRead);
} catch (IOException e) {
throw new RuntimeException(e);
}
activeThings.add(thing); activeThings.add(thing);
} }
})); }));
@@ -578,7 +585,11 @@ public class QuickReplaySender extends ChannelHandlerAdapter implements ReplaySe
} else { } else {
activeThings.removeIf(thing -> { activeThings.removeIf(thing -> {
if (thing.spawnTime > replayTime) { if (thing.spawnTime > replayTime) {
thing.despawn(this, ctx::fireChannelRead); try {
thing.despawn(this, ctx::fireChannelRead);
} catch (IOException e) {
throw new RuntimeException(e);
}
return true; return true;
} else { } else {
return false; return false;
@@ -587,7 +598,11 @@ public class QuickReplaySender extends ChannelHandlerAdapter implements ReplaySe
thingDespawnsT.subMap(replayTime, false, currentTimeStamp, true).values() thingDespawnsT.subMap(replayTime, false, currentTimeStamp, true).values()
.forEach(things -> things.forEach(thing -> { .forEach(things -> things.forEach(thing -> {
if (thing.spawnTime <= replayTime) { if (thing.spawnTime <= replayTime) {
thing.spawn(this, ctx::fireChannelRead); try {
thing.spawn(this, ctx::fireChannelRead);
} catch (IOException e) {
throw new RuntimeException(e);
}
activeThings.add(thing); activeThings.add(thing);
} }
})); }));
@@ -701,8 +716,7 @@ public class QuickReplaySender extends ChannelHandlerAdapter implements ReplaySe
} }
} }
@SneakyThrows(IOException.class) private static List<Packet<?>> readPacketsFromCache(NetInput in) throws IOException {
private static List<Packet<?>> readPacketsFromCache(NetInput in) {
int size = in.readVarInt(); int size = in.readVarInt();
List<Packet<?>> packets = new ArrayList<>(size); List<Packet<?>> packets = new ArrayList<>(size);
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
@@ -859,12 +873,12 @@ public class QuickReplaySender extends ChannelHandlerAdapter implements ReplaySe
indexDespawnPackets = in.readVarInt(); indexDespawnPackets = in.readVarInt();
} }
public void spawn(QuickReplaySender sender, Consumer<Packet<?>> send) { public void spawn(QuickReplaySender sender, Consumer<Packet<?>> send) throws IOException {
sender.buf.readerIndex(indexSpawnPackets); sender.buf.readerIndex(indexSpawnPackets);
readPacketsFromCache(sender.bufInput).forEach(send); readPacketsFromCache(sender.bufInput).forEach(send);
} }
public void despawn(QuickReplaySender sender, Consumer<Packet<?>> send) { public void despawn(QuickReplaySender sender, Consumer<Packet<?>> send) throws IOException {
sender.buf.readerIndex(indexDespawnPackets); sender.buf.readerIndex(indexDespawnPackets);
readPacketsFromCache(sender.bufInput).forEach(send); readPacketsFromCache(sender.bufInput).forEach(send);
} }
@@ -921,8 +935,7 @@ public class QuickReplaySender extends ChannelHandlerAdapter implements ReplaySe
} }
@Override @Override
@SneakyThrows(IOException.class) public void spawn(QuickReplaySender sender, Consumer<Packet<?>> send) throws IOException {
public void spawn(QuickReplaySender sender, Consumer<Packet<?>> send) {
super.spawn(sender, send); super.spawn(sender, send);
sender.buf.readerIndex(index); sender.buf.readerIndex(index);
@@ -938,7 +951,7 @@ public class QuickReplaySender extends ChannelHandlerAdapter implements ReplaySe
} }
@Override @Override
public void despawn(QuickReplaySender sender, Consumer<Packet<?>> send) { public void despawn(QuickReplaySender sender, Consumer<Packet<?>> send) throws IOException {
super.despawn(sender, send); super.despawn(sender, send);
locations = null; locations = null;
} }
@@ -1017,8 +1030,7 @@ public class QuickReplaySender extends ChannelHandlerAdapter implements ReplaySe
} }
@Override @Override
@SneakyThrows(IOException.class) public void spawn(QuickReplaySender sender, Consumer<Packet<?>> send) throws IOException {
public void spawn(QuickReplaySender sender, Consumer<Packet<?>> send) {
super.spawn(sender, send); super.spawn(sender, send);
sender.buf.readerIndex(index); sender.buf.readerIndex(index);
@@ -1042,7 +1054,7 @@ public class QuickReplaySender extends ChannelHandlerAdapter implements ReplaySe
} }
@Override @Override
public void despawn(QuickReplaySender sender, Consumer<Packet<?>> send) { public void despawn(QuickReplaySender sender, Consumer<Packet<?>> send) throws IOException {
super.despawn(sender, send); super.despawn(sender, send);
blocksT = null; blocksT = null;
@@ -1112,8 +1124,7 @@ public class QuickReplaySender extends ChannelHandlerAdapter implements ReplaySe
} }
@Override @Override
@SneakyThrows(IOException.class) public void spawn(QuickReplaySender sender, Consumer<Packet<?>> send) throws IOException {
public void spawn(QuickReplaySender sender, Consumer<Packet<?>> send) {
super.spawn(sender, send); super.spawn(sender, send);
sender.buf.readerIndex(index); sender.buf.readerIndex(index);
@@ -1124,7 +1135,7 @@ public class QuickReplaySender extends ChannelHandlerAdapter implements ReplaySe
} }
@Override @Override
public void despawn(QuickReplaySender sender, Consumer<Packet<?>> send) { public void despawn(QuickReplaySender sender, Consumer<Packet<?>> send) throws IOException {
super.despawn(sender, send); super.despawn(sender, send);
rainStrengths = null; rainStrengths = null;