Remove references to antlr IntegerList in favor of fastutil IntList

This commit is contained in:
tterrag 2021-04-18 14:04:08 -04:00
parent 8a41cd57b0
commit 9697a30d76
2 changed files with 12 additions and 12 deletions

View file

@ -1,13 +1,12 @@
package com.simibubi.create.foundation.ponder;
import org.antlr.v4.runtime.misc.IntegerList;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.ColorHelper;
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
import it.unimi.dsi.fastutil.ints.IntList;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.SoundHandler;
import net.minecraft.client.gui.FontRenderer;
@ -59,7 +58,7 @@ public class PonderProgressBar extends AbstractSimiWidget {
@Override
public void onClick(double mouseX, double mouseY) {
PonderScene activeScene = ponder.getActiveScene();
IntegerList keyframeTimes = activeScene.keyframeTimes;
IntList keyframeTimes = activeScene.keyframeTimes;
int keyframeIndex = getHoveredKeyframeIndex(activeScene, mouseX);
@ -68,17 +67,17 @@ public class PonderProgressBar extends AbstractSimiWidget {
else if (keyframeIndex == keyframeTimes.size())
ponder.seekToTime(activeScene.totalTime);
else
ponder.seekToTime(keyframeTimes.get(keyframeIndex));
ponder.seekToTime(keyframeTimes.getInt(keyframeIndex));
}
public int getHoveredKeyframeIndex(PonderScene activeScene, double mouseX) {
IntegerList keyframeTimes = activeScene.keyframeTimes;
IntList keyframeTimes = activeScene.keyframeTimes;
int totalTime = activeScene.totalTime;
int clickedAtTime = (int) ((mouseX - x) / ((double) width + 4) * totalTime);
{
int lastKeyframeTime = keyframeTimes.get(keyframeTimes.size() - 1);
int lastKeyframeTime = keyframeTimes.getInt(keyframeTimes.size() - 1);
int diffToEnd = totalTime - clickedAtTime;
int diffToLast = clickedAtTime - lastKeyframeTime;
@ -91,7 +90,7 @@ public class PonderProgressBar extends AbstractSimiWidget {
int index = -1;
for (int i = 0; i < keyframeTimes.size(); i++) {
int keyframeTime = keyframeTimes.get(i);
int keyframeTime = keyframeTimes.getInt(i);
if (keyframeTime > clickedAtTime)
break;
@ -156,7 +155,7 @@ public class PonderProgressBar extends AbstractSimiWidget {
hoverEndColor = 0;
hoverStartColor = 0;
}
IntegerList keyframeTimes = activeScene.keyframeTimes;
IntList keyframeTimes = activeScene.keyframeTimes;
if (hoverIndex == -1)
drawKeyframe(ms, activeScene, true, 0, 0, hoverStartColor, hoverEndColor, 8);
@ -164,7 +163,7 @@ public class PonderProgressBar extends AbstractSimiWidget {
drawKeyframe(ms, activeScene, true, activeScene.totalTime, width + 4, hoverStartColor, hoverEndColor, 8);
for (int i = 0; i < keyframeTimes.size(); i++) {
int keyframeTime = keyframeTimes.get(i);
int keyframeTime = keyframeTimes.getInt(i);
int keyframePos = (int) (((float) keyframeTime) / ((float) activeScene.totalTime) * (width + 4));
boolean selected = i == hoverIndex;

View file

@ -13,7 +13,6 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import org.antlr.v4.runtime.misc.IntegerList;
import org.apache.commons.lang3.mutable.MutableDouble;
import org.apache.commons.lang3.mutable.MutableObject;
@ -32,6 +31,8 @@ import com.simibubi.create.foundation.utility.VecHelper;
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
import com.simibubi.create.foundation.utility.outliner.Outliner;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ActiveRenderInfo;
@ -60,7 +61,7 @@ public class PonderScene {
int textIndex;
String sceneId;
IntegerList keyframeTimes;
IntList keyframeTimes;
List<PonderInstruction> schedule, activeSchedule;
Map<UUID, PonderElement> linkedElements;
@ -110,7 +111,7 @@ public class PonderScene {
info = new SceneRenderInfo();
baseWorldSection = new WorldSectionElement();
renderViewEntity = new ArmorStandEntity(world, 0, 0, 0);
keyframeTimes = new IntegerList(4);
keyframeTimes = new IntArrayList(4);
scaleFactor = 1;
yOffset = 0;