Вопрос Как сделать chunk animator/как спастить chunk animator

Java:
Expand Collapse Copy
@FunctionRegister(name = "ChunkAnimator", type = Category.Render, desc = "Анимирование чанков")
public class ChunkAnimator extends Function {
    private final AnimationHandler animationHandler;
    private final SliderSetting animationDuration = new SliderSetting("Длительность анимации", 1000, 100, 5000, 100);
    private final ModeSetting animationMode = new ModeSetting("Режим анимации", "Below", "Below", "Above", "Horizont", "Player Direction", "Direction");
    private final ModeSetting easingMode = new ModeSetting("Режим интерполяции", "Linear", "Linear", "Quad", "Cubic", "Quart", "Quint", "Expo", "Sine", "Circ", "Back", "Bounce", "Elastic");

    public ChunkAnimator(AnimationHandler animationHandler) {
        this.animationHandler = animationHandler;
        addSettings(animationDuration, animationMode, easingMode);
    }

    @Subscribe
    public void onEvent(EventChunkRender event) {
        animationHandler.preRender(event.getChunkRender());
    }

    @Subscribe
    public void onEvent(EventChunkPosition event) {
        animationHandler.setOrigin(event.getChunkRender(), new BlockPos(event.getX(), event.getY(), event.getZ()));
    }

    @Subscribe
    public void onEvent(EventChangeWorld event) {
        animationHandler.clear();
    }

    public float getFunctionValue(final float t, final float b, final float c, final float d) {
        return switch (easingMode.get()) {
            case "Quad" -> Quad.easeOut(t, b, c, d);
            case "Cubic" -> Cubic.easeOut(t, b, c, d);
            case "Quart" -> Quart.easeOut(t, b, c, d);
            case "Quint" -> Quint.easeOut(t, b, c, d);
            case "Expo" -> Expo.easeOut(t, b, c, d);
            case "Sine" -> Sine.easeOut(t, b, c, d);
            case "Circ" -> Circ.easeOut(t, b, c, d);
            case "Back" -> Back.easeOut(t, b, c, d);
            case "Bounce" -> Bounce.easeOut(t, b, c, d);
            case "Elastic" -> Elastic.easeOut(t, b, c, d);
            default -> Linear.easeOut(t, b, c, d);
        };
    }

    @Getter
    @RequiredArgsConstructor
    public enum AnimationMode {
        BELOW(0),
        ABOVE(1),
        HORIZONT(2),
        PLAYER_DIRECTION(3),
        DIRECTION(4);
        private final int mode;

        @Override
        public String toString() {
            String name = name().toLowerCase();
            String[] words = name.split("_");
            StringBuilder formattedName = new StringBuilder();
            for (String word : words) {
                formattedName.append(Character.toUpperCase(word.charAt(0))).append(word.substring(1)).append(" ");
            }
            return formattedName.toString().trim();
        }
    }
}

утилки анимаций
Пожалуйста, авторизуйтесь для просмотра ссылки.
ивенты

Java:
Expand Collapse Copy
@Getter
@Setter
@AllArgsConstructor
public class EventChunkRender {
    private final ChunkRenderDispatcher.ChunkRender chunkRender;
}
хукать тут
WorldRenderer

Java:
Expand Collapse Copy
                    VertexBuffer vertexbuffer = chunkrenderdispatcher$chunkrender1.getVertexBuffer(blockLayerIn);
                    GlStateManager.pushMatrix();
                    EventChunkRender event = new EventChunkRender(chunkrenderdispatcher$chunkrender1);
                    Client.getInstance().getEventBus().post(event);
                    BlockPos blockpos = chunkrenderdispatcher$chunkrender1.getPosition();
                    GlStateManager.translated((double)blockpos.getX() - xIn, (double)blockpos.getY() - yIn, (double)blockpos.getZ() - zIn);
                    vertexbuffer.bindBuffer();
                    DefaultVertexFormats.BLOCK.setupBufferState(0L);
                    GlStateManager.lockClientState();
ну тоесть между VertexBuffer vertexbuffer = chunkrenderdispatcher$chunkrender1.getVertexBuffer(blockLayerIn);
и
GlStateManager.lockClientState();
вставлять код выше, теперь второй ивент:
Java:
Expand Collapse Copy
@Getter
@Setter
@AllArgsConstructor
public class EventChunkPosition {
    private final int x, y, z;
    private final ChunkRenderDispatcher.ChunkRender chunkRender;
}
теперь где его хукать
ChunkRenderDispatcher
EventChunkPosition event = new EventChunkPosition(x, y, z, this);
Client.getInstance().getEventBus().post(event);
между проверкой
x != this.position.getX() || y != this.position.getY() || z != this.position.getZ()
и строкой
this.stopCompileTask();
код само собой с Excellent Recode и перенесён
 
сам эту хуйню спастил с евент системой и хуй там не воркает
 
Java:
Expand Collapse Copy
@FunctionRegister(name = "ChunkAnimator", type = Category.Render, desc = "Анимирование чанков")
public class ChunkAnimator extends Function {
    private final AnimationHandler animationHandler;
    private final SliderSetting animationDuration = new SliderSetting("Длительность анимации", 1000, 100, 5000, 100);
    private final ModeSetting animationMode = new ModeSetting("Режим анимации", "Below", "Below", "Above", "Horizont", "Player Direction", "Direction");
    private final ModeSetting easingMode = new ModeSetting("Режим интерполяции", "Linear", "Linear", "Quad", "Cubic", "Quart", "Quint", "Expo", "Sine", "Circ", "Back", "Bounce", "Elastic");

    public ChunkAnimator(AnimationHandler animationHandler) {
        this.animationHandler = animationHandler;
        addSettings(animationDuration, animationMode, easingMode);
    }

    @Subscribe
    public void onEvent(EventChunkRender event) {
        animationHandler.preRender(event.getChunkRender());
    }

    @Subscribe
    public void onEvent(EventChunkPosition event) {
        animationHandler.setOrigin(event.getChunkRender(), new BlockPos(event.getX(), event.getY(), event.getZ()));
    }

    @Subscribe
    public void onEvent(EventChangeWorld event) {
        animationHandler.clear();
    }

    public float getFunctionValue(final float t, final float b, final float c, final float d) {
        return switch (easingMode.get()) {
            case "Quad" -> Quad.easeOut(t, b, c, d);
            case "Cubic" -> Cubic.easeOut(t, b, c, d);
            case "Quart" -> Quart.easeOut(t, b, c, d);
            case "Quint" -> Quint.easeOut(t, b, c, d);
            case "Expo" -> Expo.easeOut(t, b, c, d);
            case "Sine" -> Sine.easeOut(t, b, c, d);
            case "Circ" -> Circ.easeOut(t, b, c, d);
            case "Back" -> Back.easeOut(t, b, c, d);
            case "Bounce" -> Bounce.easeOut(t, b, c, d);
            case "Elastic" -> Elastic.easeOut(t, b, c, d);
            default -> Linear.easeOut(t, b, c, d);
        };
    }

    @Getter
    @RequiredArgsConstructor
    public enum AnimationMode {
        BELOW(0),
        ABOVE(1),
        HORIZONT(2),
        PLAYER_DIRECTION(3),
        DIRECTION(4);
        private final int mode;

        @Override
        public String toString() {
            String name = name().toLowerCase();
            String[] words = name.split("_");
            StringBuilder formattedName = new StringBuilder();
            for (String word : words) {
                formattedName.append(Character.toUpperCase(word.charAt(0))).append(word.substring(1)).append(" ");
            }
            return formattedName.toString().trim();
        }
    }
}

утилки анимаций
Пожалуйста, авторизуйтесь для просмотра ссылки.
ивенты

Java:
Expand Collapse Copy
@Getter
@Setter
@AllArgsConstructor
public class EventChunkRender {
    private final ChunkRenderDispatcher.ChunkRender chunkRender;
}
хукать тут
WorldRenderer

Java:
Expand Collapse Copy
                    VertexBuffer vertexbuffer = chunkrenderdispatcher$chunkrender1.getVertexBuffer(blockLayerIn);
                    GlStateManager.pushMatrix();
                    EventChunkRender event = new EventChunkRender(chunkrenderdispatcher$chunkrender1);
                    Client.getInstance().getEventBus().post(event);
                    BlockPos blockpos = chunkrenderdispatcher$chunkrender1.getPosition();
                    GlStateManager.translated((double)blockpos.getX() - xIn, (double)blockpos.getY() - yIn, (double)blockpos.getZ() - zIn);
                    vertexbuffer.bindBuffer();
                    DefaultVertexFormats.BLOCK.setupBufferState(0L);
                    GlStateManager.lockClientState();
ну тоесть между VertexBuffer vertexbuffer = chunkrenderdispatcher$chunkrender1.getVertexBuffer(blockLayerIn);
и
GlStateManager.lockClientState();
вставлять код выше, теперь второй ивент:
Java:
Expand Collapse Copy
@Getter
@Setter
@AllArgsConstructor
public class EventChunkPosition {
    private final int x, y, z;
    private final ChunkRenderDispatcher.ChunkRender chunkRender;
}
теперь где его хукать
ChunkRenderDispatcher
EventChunkPosition event = new EventChunkPosition(x, y, z, this);
Client.getInstance().getEventBus().post(event);
между проверкой
x != this.position.getX() || y != this.position.getY() || z != this.position.getZ()
и строкой
this.stopCompileTask();
код само собой с Excellent Recode и перенесён
я уже это все сам делал, там все в ошибках было
 
Назад
Сверху Снизу