diff --git a/build.gradle b/build.gradle index b8b9555a8..03f6f37b4 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { maven { url = 'https://repo.spongepowered.org/repository/maven-public/' } } dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT' } } @@ -27,12 +27,10 @@ version = "${mc_update_version}-${mod_version}" + (dev ? ".${buildnumber}" : '') group = 'com.jozufozu.flywheel' archivesBaseName = 'flywheel' -sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' +java.toolchain.languageVersion = JavaLanguageVersion.of(8) minecraft { - mappings channel: 'snapshot', version: "${mcp_mappings}" - // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. - + mappings channel: 'official', version: "${minecraft_version}" accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') runs { diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7a3265ee9..5c2d1cf01 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a055b814c..549d84424 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-bin.zip diff --git a/gradlew b/gradlew index cccdd3d51..83f2acfdc 100755 --- a/gradlew +++ b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` diff --git a/gradlew.bat b/gradlew.bat index f9553162f..9618d8d96 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/src/main/java/com/jozufozu/flywheel/backend/Backend.java b/src/main/java/com/jozufozu/flywheel/backend/Backend.java index 325b5653d..239aedf01 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/Backend.java +++ b/src/main/java/com/jozufozu/flywheel/backend/Backend.java @@ -187,15 +187,15 @@ public class Backend { if (world instanceof IFlywheelWorld && ((IFlywheelWorld) world).supportsFlywheel()) return true; - return world == Minecraft.getInstance().world; + return world == Minecraft.getInstance().level; } public static boolean isGameActive() { - return !(Minecraft.getInstance().world == null || Minecraft.getInstance().player == null); + return !(Minecraft.getInstance().level == null || Minecraft.getInstance().player == null); } public static void reloadWorldRenderers() { - RenderWork.enqueue(Minecraft.getInstance().worldRenderer::loadRenderers); + RenderWork.enqueue(Minecraft.getInstance().levelRenderer::allChanged); } public static void init() { diff --git a/src/main/java/com/jozufozu/flywheel/backend/OptifineHandler.java b/src/main/java/com/jozufozu/flywheel/backend/OptifineHandler.java index c4d825c90..37ac4451c 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/OptifineHandler.java +++ b/src/main/java/com/jozufozu/flywheel/backend/OptifineHandler.java @@ -55,7 +55,7 @@ public class OptifineHandler { public static void refresh() { if (optifine == null) return; - File dir = Minecraft.getInstance().gameDir; + File dir = Minecraft.getInstance().gameDirectory; File shaderOptions = new File(dir, "optionsshaders.txt"); diff --git a/src/main/java/com/jozufozu/flywheel/backend/ShaderSources.java b/src/main/java/com/jozufozu/flywheel/backend/ShaderSources.java index 512617641..e9e75c023 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/ShaderSources.java +++ b/src/main/java/com/jozufozu/flywheel/backend/ShaderSources.java @@ -63,7 +63,7 @@ public class ShaderSources implements ISelectiveResourceReloadListener { this.backend = backend; IResourceManager manager = backend.minecraft.getResourceManager(); if (manager instanceof IReloadableResourceManager) { - ((IReloadableResourceManager) manager).addReloadListener(this); + ((IReloadableResourceManager) manager).registerReloadListener(this); } } @@ -97,7 +97,7 @@ public class ShaderSources implements ISelectiveResourceReloadListener { // no need to hog all that memory shaderSource.clear(); - ClientWorld world = Minecraft.getInstance().world; + ClientWorld world = Minecraft.getInstance().level; if (Backend.isFlywheelWorld(world)) { // TODO: looks like it might be good to have another event here InstancedRenderDispatcher.loadAllInWorld(world); @@ -108,7 +108,7 @@ public class ShaderSources implements ISelectiveResourceReloadListener { } private void loadProgramSpecs(IResourceManager manager) { - Collection programSpecs = manager.getAllResourceLocations(PROGRAM_DIR, s -> s.endsWith(".json")); + Collection programSpecs = manager.listResources(PROGRAM_DIR, s -> s.endsWith(".json")); for (ResourceLocation location : programSpecs) { try { @@ -149,7 +149,7 @@ public class ShaderSources implements ISelectiveResourceReloadListener { } private void loadShaderSources(IResourceManager manager) { - Collection allShaders = manager.getAllResourceLocations(SHADER_DIR, s -> { + Collection allShaders = manager.listResources(SHADER_DIR, s -> { for (String ext : EXTENSIONS) { if (s.endsWith(ext)) return true; } diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceManager.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceManager.java index 41159f061..3233cd7fa 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceManager.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceManager.java @@ -82,15 +82,15 @@ public abstract class InstanceManager implements MaterialManager.OriginShiftL frame++; processQueuedAdditions(); - Vector3f look = info.getHorizontalPlane(); - float lookX = look.getX(); - float lookY = look.getY(); - float lookZ = look.getZ(); + Vector3f look = info.getLookVector(); + float lookX = look.x(); + float lookY = look.y(); + float lookZ = look.z(); // integer camera pos - int cX = (int) info.getProjectedView().x; - int cY = (int) info.getProjectedView().y; - int cZ = (int) info.getProjectedView().z; + int cX = (int) info.getPosition().x; + int cY = (int) info.getPosition().y; + int cZ = (int) info.getPosition().z; if (dynamicInstances.size() > 0) { dynamicInstances.object2ObjectEntrySet() diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceMaterial.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceMaterial.java index 5266a2759..ea46a0de4 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceMaterial.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceMaterial.java @@ -109,8 +109,8 @@ public class InstanceMaterial { private BufferedModel buildModel(BlockState renderedState) { BlockRendererDispatcher dispatcher = Minecraft.getInstance() - .getBlockRendererDispatcher(); - return buildModel(dispatcher.getModelForState(renderedState), renderedState); + .getBlockRenderer(); + return buildModel(dispatcher.getBlockModel(renderedState), renderedState); } private BufferedModel buildModel(IBakedModel model, BlockState renderedState) { @@ -156,8 +156,8 @@ public class InstanceMaterial { public static BufferBuilder getBufferBuilder(IBakedModel model, BlockState referenceState, MatrixStack ms) { Minecraft mc = Minecraft.getInstance(); - BlockRendererDispatcher dispatcher = mc.getBlockRendererDispatcher(); - BlockModelRenderer blockRenderer = dispatcher.getBlockModelRenderer(); + BlockRendererDispatcher dispatcher = mc.getBlockRenderer(); + BlockModelRenderer blockRenderer = dispatcher.getModelRenderer(); BufferBuilder builder = new BufferBuilder(512); // BakedQuadWrapper quadReader = new BakedQuadWrapper(); @@ -168,8 +168,8 @@ public class InstanceMaterial { // .collect(Collectors.toList()); builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); - blockRenderer.renderModel(mc.world, model, referenceState, BlockPos.ZERO.up(255), ms, builder, true, mc.world.rand, 42, OverlayTexture.DEFAULT_UV, VirtualEmptyModelData.INSTANCE); - builder.finishDrawing(); + blockRenderer.renderModel(mc.level, model, referenceState, BlockPos.ZERO.above(255), ms, builder, true, mc.level.random, 42, OverlayTexture.NO_OVERLAY, VirtualEmptyModelData.INSTANCE); + builder.end(); return builder; } diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/InstancedRenderDispatcher.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/InstancedRenderDispatcher.java index 6f85062d4..27bcbfacc 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/InstancedRenderDispatcher.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/InstancedRenderDispatcher.java @@ -50,10 +50,10 @@ public class InstancedRenderDispatcher { return; } Minecraft mc = Minecraft.getInstance(); - ClientWorld world = mc.world; + ClientWorld world = mc.level; AnimationTickHolder.tick(); - Entity renderViewEntity = mc.renderViewEntity != null ? mc.renderViewEntity : mc.player; + Entity renderViewEntity = mc.cameraEntity != null ? mc.cameraEntity : mc.player; if (renderViewEntity == null) return; @@ -62,11 +62,11 @@ public class InstancedRenderDispatcher { } public static void enqueueUpdate(TileEntity te) { - getTiles(te.getWorld()).queueUpdate(te); + getTiles(te.getLevel()).queueUpdate(te); } public static void enqueueUpdate(Entity entity) { - getEntities(entity.world).queueUpdate(entity); + getEntities(entity.level).queueUpdate(entity); } @SubscribeEvent @@ -84,12 +84,12 @@ public class InstancedRenderDispatcher { if (!Backend.getInstance() .canUseInstancing(world)) return; - event.type.startDrawing(); + event.type.setupRenderState(); materialManagers.get(world) .render(event.type, event.viewProjection, event.camX, event.camY, event.camZ); - event.type.endDrawing(); + event.type.clearRenderState(); } @SubscribeEvent @@ -105,10 +105,10 @@ public class InstancedRenderDispatcher { materialManagers.replace(world, MaterialManager::delete); InstanceManager tiles = tileInstanceManager.replace(world); - world.loadedTileEntityList.forEach(tiles::add); + world.blockEntityList.forEach(tiles::add); InstanceManager entities = entityInstanceManager.replace(world); - world.getAllEntities() + world.entitiesForRendering() .forEach(entities::add); } } diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/MaterialManager.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/MaterialManager.java index 41b422e6c..568c1f21e 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/MaterialManager.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/MaterialManager.java @@ -76,7 +76,7 @@ public class MaterialManager

{ camY -= originCoordinate.getY(); camZ -= originCoordinate.getZ(); - Matrix4f translate = Matrix4f.translate((float) -camX, (float) -camY, (float) -camZ); + Matrix4f translate = Matrix4f.createTranslateMatrix((float) -camX, (float) -camY, (float) -camZ); translate.multiplyBackward(viewProjection); @@ -85,7 +85,7 @@ public class MaterialManager

{ } for (Map.Entry>> entry : renderers.entrySet()) { - Minecraft.getInstance().textureManager.bindTexture(entry.getKey()); + Minecraft.getInstance().textureManager.bind(entry.getKey()); for (MaterialRenderer

materialRenderer : entry.getValue()) { materialRenderer.render(layer, translate, camX, camY, camZ, callback); @@ -149,9 +149,9 @@ public class MaterialManager

{ } public void checkAndShiftOrigin(ActiveRenderInfo info) { - int cX = MathHelper.floor(info.getProjectedView().x); - int cY = MathHelper.floor(info.getProjectedView().y); - int cZ = MathHelper.floor(info.getProjectedView().z); + int cX = MathHelper.floor(info.getPosition().x); + int cY = MathHelper.floor(info.getPosition().y); + int cZ = MathHelper.floor(info.getPosition().z); int dX = cX - originCoordinate.getX(); int dY = cY - originCoordinate.getY(); diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/MaterialRenderer.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/MaterialRenderer.java index 1a8b8d1da..ee04fb373 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/MaterialRenderer.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/MaterialRenderer.java @@ -19,7 +19,7 @@ public class MaterialRenderer

{ } public void render(RenderType layer, Matrix4f viewProjection, double camX, double camY, double camZ, IProgramCallback

setup) { - if (!(layer == RenderType.getCutoutMipped())) return; + if (!(layer == RenderType.cutoutMipped())) return; if (material.nothingToRender()) return; diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/MaterialSpec.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/MaterialSpec.java index 405bc4772..f22f911db 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/MaterialSpec.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/MaterialSpec.java @@ -16,7 +16,7 @@ public class MaterialSpec { private final ResourceLocation texture; public MaterialSpec(ResourceLocation name, ResourceLocation programSpec, VertexFormat modelFormat, VertexFormat instanceFormat, IInstanceFactory instanceFactory) { - this(name, programSpec, modelFormat, instanceFormat, PlayerContainer.BLOCK_ATLAS_TEXTURE, instanceFactory); + this(name, programSpec, modelFormat, instanceFormat, PlayerContainer.BLOCK_ATLAS, instanceFactory); } public MaterialSpec(ResourceLocation name, ResourceLocation programSpec, VertexFormat modelFormat, VertexFormat instanceFormat, ResourceLocation texture, IInstanceFactory instanceFactory) { diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/entity/EntityInstance.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/entity/EntityInstance.java index 4dd4134c5..ae4050bac 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/entity/EntityInstance.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/entity/EntityInstance.java @@ -46,7 +46,7 @@ public abstract class EntityInstance implements IInstance { public EntityInstance(MaterialManager materialManager, E entity) { this.materialManager = materialManager; this.entity = entity; - this.world = entity.world; + this.world = entity.level; } /** @@ -92,22 +92,22 @@ public abstract class EntityInstance implements IInstance { * represents should be rendered at to appear in the correct location. */ public Vector3f getInstancePosition() { - Vector3d pos = entity.getPositionVec(); + Vector3d pos = entity.position(); Vector3i origin = materialManager.getOriginCoordinate(); return new Vector3f((float) (pos.x - origin.getX()), (float) (pos.y - origin.getY()), (float) (pos.z - origin.getZ())); } @Override public BlockPos getWorldPosition() { - return entity.getBlockPos(); + return entity.blockPosition(); } protected void relight(BlockPos pos, IFlatLight... models) { - relight(world.getLightLevel(LightType.BLOCK, pos), world.getLightLevel(LightType.SKY, pos), models); + relight(world.getBrightness(LightType.BLOCK, pos), world.getBrightness(LightType.SKY, pos), models); } protected > void relight(BlockPos pos, Stream models) { - relight(world.getLightLevel(LightType.BLOCK, pos), world.getLightLevel(LightType.SKY, pos), models); + relight(world.getBrightness(LightType.BLOCK, pos), world.getBrightness(LightType.SKY, pos), models); } protected void relight(int block, int sky, IFlatLight... models) { diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/entity/EntityInstanceManager.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/entity/EntityInstanceManager.java index 5c6a533f5..98429f8d5 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/entity/EntityInstanceManager.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/entity/EntityInstanceManager.java @@ -32,14 +32,14 @@ public class EntityInstanceManager extends InstanceManager { protected boolean canCreateInstance(Entity entity) { if (!entity.isAlive()) return false; - World world = entity.world; + World world = entity.level; if (world == null) return false; if (Backend.isFlywheelWorld(world)) { - BlockPos pos = entity.getBlockPos(); + BlockPos pos = entity.blockPosition(); - IBlockReader existingChunk = world.getExistingChunk(pos.getX() >> 4, pos.getZ() >> 4); + IBlockReader existingChunk = world.getChunkForCollisions(pos.getX() >> 4, pos.getZ() >> 4); return existingChunk != null; } diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/tile/TileEntityInstance.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/tile/TileEntityInstance.java index a8ab6c263..038d571ff 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/tile/TileEntityInstance.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/tile/TileEntityInstance.java @@ -47,8 +47,8 @@ public abstract class TileEntityInstance implements IInsta public TileEntityInstance(MaterialManager materialManager, T tile) { this.materialManager = materialManager; this.tile = tile; - this.world = tile.getWorld(); - this.pos = tile.getPos(); + this.world = tile.getLevel(); + this.pos = tile.getBlockPos(); this.blockState = tile.getBlockState(); this.instancePos = pos.subtract(materialManager.getOriginCoordinate()); } @@ -105,11 +105,11 @@ public abstract class TileEntityInstance implements IInsta } protected void relight(BlockPos pos, IFlatLight... models) { - relight(world.getLightLevel(LightType.BLOCK, pos), world.getLightLevel(LightType.SKY, pos), models); + relight(world.getBrightness(LightType.BLOCK, pos), world.getBrightness(LightType.SKY, pos), models); } protected > void relight(BlockPos pos, Stream models) { - relight(world.getLightLevel(LightType.BLOCK, pos), world.getLightLevel(LightType.SKY, pos), models); + relight(world.getBrightness(LightType.BLOCK, pos), world.getBrightness(LightType.SKY, pos), models); } protected void relight(int block, int sky, IFlatLight... models) { diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/tile/TileInstanceManager.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/tile/TileInstanceManager.java index 07b957ac7..c9dc7dd5f 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/tile/TileInstanceManager.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/tile/TileInstanceManager.java @@ -32,16 +32,16 @@ public class TileInstanceManager extends InstanceManager { protected boolean canCreateInstance(TileEntity tile) { if (tile.isRemoved()) return false; - World world = tile.getWorld(); + World world = tile.getLevel(); if (world == null) return false; - if (world.isAirBlock(tile.getPos())) return false; + if (world.isEmptyBlock(tile.getBlockPos())) return false; if (Backend.isFlywheelWorld(world)) { - BlockPos pos = tile.getPos(); + BlockPos pos = tile.getBlockPos(); - IBlockReader existingChunk = world.getExistingChunk(pos.getX() >> 4, pos.getZ() >> 4); + IBlockReader existingChunk = world.getChunkForCollisions(pos.getX() >> 4, pos.getZ() >> 4); return existingChunk != null; } diff --git a/src/main/java/com/jozufozu/flywheel/config/BooleanConfig.java b/src/main/java/com/jozufozu/flywheel/config/BooleanConfig.java index 3a3ce1059..1c3874c7a 100644 --- a/src/main/java/com/jozufozu/flywheel/config/BooleanConfig.java +++ b/src/main/java/com/jozufozu/flywheel/config/BooleanConfig.java @@ -37,7 +37,7 @@ public enum BooleanConfig { if (state == BooleanDirective.DISPLAY) { ITextComponent text = new StringTextComponent("Flywheel Renderer is currently: ").append(boolToText(FlwConfig.get().client.enabled.get())); - player.sendStatusMessage(text, false); + player.displayClientMessage(text, false); return; } @@ -46,10 +46,10 @@ public enum BooleanConfig { FlwConfig.get().client.enabled.set(enabled); - ITextComponent text = boolToText(FlwConfig.get().client.enabled.get()).append(new StringTextComponent(" Flywheel Renderer").formatted(TextFormatting.WHITE)); - ITextComponent error = new StringTextComponent("Flywheel Renderer does not support Optifine Shaders").formatted(TextFormatting.RED); + ITextComponent text = boolToText(FlwConfig.get().client.enabled.get()).append(new StringTextComponent(" Flywheel Renderer").withStyle(TextFormatting.WHITE)); + ITextComponent error = new StringTextComponent("Flywheel Renderer does not support Optifine Shaders").withStyle(TextFormatting.RED); - player.sendStatusMessage(cannotUseER ? error : text, false); + player.displayClientMessage(cannotUseER ? error : text, false); Backend.reloadWorldRenderers(); } @@ -60,18 +60,18 @@ public enum BooleanConfig { if (state == BooleanDirective.DISPLAY) { ITextComponent text = new StringTextComponent("Normal overlay is currently: ").append(boolToText(FlwConfig.get().client.normalDebug.get())); - player.sendStatusMessage(text, false); + player.displayClientMessage(text, false); return; } FlwConfig.get().client.normalDebug.set(state.get()); - ITextComponent text = boolToText(FlwConfig.get().client.normalDebug.get()).append(new StringTextComponent(" Normal Overlay").formatted(TextFormatting.WHITE)); + ITextComponent text = boolToText(FlwConfig.get().client.normalDebug.get()).append(new StringTextComponent(" Normal Overlay").withStyle(TextFormatting.WHITE)); - player.sendStatusMessage(text, false); + player.displayClientMessage(text, false); } private static IFormattableTextComponent boolToText(boolean b) { - return b ? new StringTextComponent("enabled").formatted(TextFormatting.DARK_GREEN) : new StringTextComponent("disabled").formatted(TextFormatting.RED); + return b ? new StringTextComponent("enabled").withStyle(TextFormatting.DARK_GREEN) : new StringTextComponent("disabled").withStyle(TextFormatting.RED); } } diff --git a/src/main/java/com/jozufozu/flywheel/config/BooleanConfigCommand.java b/src/main/java/com/jozufozu/flywheel/config/BooleanConfigCommand.java index 4be416c0b..61b2cd351 100644 --- a/src/main/java/com/jozufozu/flywheel/config/BooleanConfigCommand.java +++ b/src/main/java/com/jozufozu/flywheel/config/BooleanConfigCommand.java @@ -23,21 +23,21 @@ public class BooleanConfigCommand { return Commands.literal(name) .executes(context -> { ServerPlayerEntity player = context.getSource() - .asPlayer(); + .getPlayerOrException(); FlwPackets.channel.send(PacketDistributor.PLAYER.with(() -> player), new SConfigureBooleanPacket(value, BooleanDirective.DISPLAY)); return Command.SINGLE_SUCCESS; }) .then(Commands.literal("on") .executes(context -> { ServerPlayerEntity player = context.getSource() - .asPlayer(); + .getPlayerOrException(); FlwPackets.channel.send(PacketDistributor.PLAYER.with(() -> player), new SConfigureBooleanPacket(value, BooleanDirective.TRUE)); return Command.SINGLE_SUCCESS; })) .then(Commands.literal("off") .executes(context -> { ServerPlayerEntity player = context.getSource() - .asPlayer(); + .getPlayerOrException(); FlwPackets.channel.send(PacketDistributor.PLAYER.with(() -> player), new SConfigureBooleanPacket(value, BooleanDirective.FALSE)); return Command.SINGLE_SUCCESS; })); diff --git a/src/main/java/com/jozufozu/flywheel/config/FlwCommands.java b/src/main/java/com/jozufozu/flywheel/config/FlwCommands.java index 8e24e33f0..f107683a3 100644 --- a/src/main/java/com/jozufozu/flywheel/config/FlwCommands.java +++ b/src/main/java/com/jozufozu/flywheel/config/FlwCommands.java @@ -11,7 +11,7 @@ public class FlwCommands { @SubscribeEvent public static void onServerStarting(FMLServerStartingEvent event) { CommandDispatcher dispatcher = event.getServer() - .getCommandManager() + .getCommands() .getDispatcher(); dispatcher.register(Commands.literal("flywheel") diff --git a/src/main/java/com/jozufozu/flywheel/core/AtlasStitcher.java b/src/main/java/com/jozufozu/flywheel/core/AtlasStitcher.java index b335186e3..49f658d3a 100644 --- a/src/main/java/com/jozufozu/flywheel/core/AtlasStitcher.java +++ b/src/main/java/com/jozufozu/flywheel/core/AtlasStitcher.java @@ -29,8 +29,8 @@ public class AtlasStitcher { public void onTextureStitch(TextureStitchEvent.Pre event) { if (!event.getMap() - .getId() - .equals(PlayerContainer.BLOCK_ATLAS_TEXTURE)) return; + .location() + .equals(PlayerContainer.BLOCK_ATLAS)) return; sprites.forEach(StitchedSprite::reset); sprites.stream() diff --git a/src/main/java/com/jozufozu/flywheel/core/StitchedSprite.java b/src/main/java/com/jozufozu/flywheel/core/StitchedSprite.java index 7f1d0b0e6..5d8498e55 100644 --- a/src/main/java/com/jozufozu/flywheel/core/StitchedSprite.java +++ b/src/main/java/com/jozufozu/flywheel/core/StitchedSprite.java @@ -22,7 +22,7 @@ public class StitchedSprite { public TextureAtlasSprite getSprite() { if (sprite == null) { sprite = Minecraft.getInstance() - .getSpriteAtlas(PlayerContainer.BLOCK_ATLAS_TEXTURE) + .getTextureAtlas(PlayerContainer.BLOCK_ATLAS) .apply(loc); } diff --git a/src/main/java/com/jozufozu/flywheel/core/atlas/AtlasInfo.java b/src/main/java/com/jozufozu/flywheel/core/atlas/AtlasInfo.java index 5875e6136..fe7dc6358 100644 --- a/src/main/java/com/jozufozu/flywheel/core/atlas/AtlasInfo.java +++ b/src/main/java/com/jozufozu/flywheel/core/atlas/AtlasInfo.java @@ -25,11 +25,11 @@ public class AtlasInfo { } public static SheetData getAtlasData(TextureAtlasSprite texture) { - return getAtlasData(texture.getAtlas()); + return getAtlasData(texture.atlas()); } public static SheetData getAtlasData(AtlasTexture atlas) { - return getAtlasData(atlas.getId()); + return getAtlasData(atlas.location()); } public static SheetData getAtlasData(ResourceLocation loc) { diff --git a/src/main/java/com/jozufozu/flywheel/core/crumbling/CrumblingMaterialManager.java b/src/main/java/com/jozufozu/flywheel/core/crumbling/CrumblingMaterialManager.java index 9d8974ade..b85640569 100644 --- a/src/main/java/com/jozufozu/flywheel/core/crumbling/CrumblingMaterialManager.java +++ b/src/main/java/com/jozufozu/flywheel/core/crumbling/CrumblingMaterialManager.java @@ -40,15 +40,15 @@ public class CrumblingMaterialManager extends MaterialManager camY -= originCoordinate.getY(); camZ -= originCoordinate.getZ(); - Matrix4f translate = Matrix4f.translate((float) -camX, (float) -camY, (float) -camZ); + Matrix4f translate = Matrix4f.createTranslateMatrix((float) -camX, (float) -camY, (float) -camZ); translate.multiplyBackward(viewProjection); TextureManager textureManager = Minecraft.getInstance().textureManager; glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, textureManager.getTexture(PlayerContainer.BLOCK_ATLAS_TEXTURE) - .getGlTextureId()); + glBindTexture(GL_TEXTURE_2D, textureManager.getTexture(PlayerContainer.BLOCK_ATLAS) + .getId()); for (MaterialRenderer material : atlasRenderers) { material.render(layer, translate, camX, camY, camZ, CrumblingProgram::setDefaultAtlasSize); @@ -56,7 +56,7 @@ public class CrumblingMaterialManager extends MaterialManager for (Map.Entry>> entry : renderers.entrySet()) { glBindTexture(GL_TEXTURE_2D, textureManager.getTexture(entry.getKey()) - .getGlTextureId()); + .getId()); SheetData atlasData = AtlasInfo.getAtlasData(entry.getKey()); for (MaterialRenderer materialRenderer : entry.getValue()) { materialRenderer.render(layer, translate, camX, camY, camZ, p -> p.setAtlasSize(atlasData.width, atlasData.height)); diff --git a/src/main/java/com/jozufozu/flywheel/core/crumbling/CrumblingProgram.java b/src/main/java/com/jozufozu/flywheel/core/crumbling/CrumblingProgram.java index d7e4514ec..b7d53d891 100644 --- a/src/main/java/com/jozufozu/flywheel/core/crumbling/CrumblingProgram.java +++ b/src/main/java/com/jozufozu/flywheel/core/crumbling/CrumblingProgram.java @@ -36,7 +36,7 @@ public class CrumblingProgram extends WorldProgram { } public void setDefaultAtlasSize() { - SheetData atlasData = AtlasInfo.getAtlasData(PlayerContainer.BLOCK_ATLAS_TEXTURE); + SheetData atlasData = AtlasInfo.getAtlasData(PlayerContainer.BLOCK_ATLAS); if (atlasData == null) return; int width = atlasData.width; @@ -46,10 +46,10 @@ public class CrumblingProgram extends WorldProgram { } public void setAtlasSize(int width, int height) { - AtlasTexture blockAtlas = AtlasInfo.getAtlas(PlayerContainer.BLOCK_ATLAS_TEXTURE); + AtlasTexture blockAtlas = AtlasInfo.getAtlas(PlayerContainer.BLOCK_ATLAS); if (blockAtlas == null) return; - TextureAtlasSprite sprite = blockAtlas.getSprite(ModelBakery.BLOCK_DESTRUCTION_STAGE_TEXTURES.get(0)); + TextureAtlasSprite sprite = blockAtlas.getSprite(ModelBakery.BREAKING_LOCATIONS.get(0)); setTextureScale(width / (float) sprite.getWidth(), height / (float) sprite.getHeight()); } diff --git a/src/main/java/com/jozufozu/flywheel/core/crumbling/CrumblingRenderer.java b/src/main/java/com/jozufozu/flywheel/core/crumbling/CrumblingRenderer.java index 409b5273f..75ee052dd 100644 --- a/src/main/java/com/jozufozu/flywheel/core/crumbling/CrumblingRenderer.java +++ b/src/main/java/com/jozufozu/flywheel/core/crumbling/CrumblingRenderer.java @@ -54,7 +54,7 @@ public class CrumblingRenderer { INVALIDATOR = state.getSecond(); } - private static final RenderType crumblingLayer = ModelBakery.BLOCK_DESTRUCTION_RENDER_LAYERS.get(0); + private static final RenderType crumblingLayer = ModelBakery.DESTROY_TYPES.get(0); public static void renderBreaking(ClientWorld world, Matrix4f viewProjection, double cameraX, double cameraY, double cameraZ) { if (!Backend.getInstance() @@ -69,14 +69,14 @@ public class CrumblingRenderer { InstanceManager renderer = state.instanceManager; TextureManager textureManager = Minecraft.getInstance().textureManager; - ActiveRenderInfo info = Minecraft.getInstance().gameRenderer.getActiveRenderInfo(); + ActiveRenderInfo info = Minecraft.getInstance().gameRenderer.getMainCamera(); MaterialManager materials = state.materialManager; - crumblingLayer.startDrawing(); + crumblingLayer.setupRenderState(); for (Int2ObjectMap.Entry> stage : activeStages.int2ObjectEntrySet()) { int i = stage.getIntKey(); - Texture breaking = textureManager.getTexture(ModelBakery.BLOCK_DESTRUCTION_STAGE_TEXTURES.get(i)); + Texture breaking = textureManager.getTexture(ModelBakery.BREAKING_LOCATIONS.get(i)); // something about when we call this means that the textures are not ready for use on the first frame they should appear if (breaking != null) { @@ -85,38 +85,38 @@ public class CrumblingRenderer { renderer.beginFrame(info); glActiveTexture(GL_TEXTURE4); - glBindTexture(GL_TEXTURE_2D, breaking.getGlTextureId()); - materials.render(RenderType.getCutoutMipped(), viewProjection, cameraX, cameraY, cameraZ); + glBindTexture(GL_TEXTURE_2D, breaking.getId()); + materials.render(RenderType.cutoutMipped(), viewProjection, cameraX, cameraY, cameraZ); renderer.invalidate(); } } - crumblingLayer.endDrawing(); + crumblingLayer.clearRenderState(); glActiveTexture(GL_TEXTURE0); - Texture breaking = textureManager.getTexture(ModelBakery.BLOCK_DESTRUCTION_STAGE_TEXTURES.get(0)); - if (breaking != null) glBindTexture(GL_TEXTURE_2D, breaking.getGlTextureId()); + Texture breaking = textureManager.getTexture(ModelBakery.BREAKING_LOCATIONS.get(0)); + if (breaking != null) glBindTexture(GL_TEXTURE_2D, breaking.getId()); } /** * Associate each breaking stage with a list of all tile entities at that stage. */ private static Int2ObjectMap> getActiveStageTiles(ClientWorld world) { - Long2ObjectMap> breakingProgressions = Minecraft.getInstance().worldRenderer.blockBreakingProgressions; + Long2ObjectMap> breakingProgressions = Minecraft.getInstance().levelRenderer.destructionProgress; Int2ObjectMap> breakingEntities = new Int2ObjectArrayMap<>(); for (Long2ObjectMap.Entry> entry : breakingProgressions.long2ObjectEntrySet()) { - BlockPos breakingPos = BlockPos.fromLong(entry.getLongKey()); + BlockPos breakingPos = BlockPos.of(entry.getLongKey()); SortedSet progresses = entry.getValue(); if (progresses != null && !progresses.isEmpty()) { int blockDamage = progresses.last() - .getPartialBlockDamage(); + .getProgress(); - TileEntity tileEntity = world.getTileEntity(breakingPos); + TileEntity tileEntity = world.getBlockEntity(breakingPos); if (tileEntity != null) { List tileEntities = breakingEntities.computeIfAbsent(blockDamage, $ -> new ArrayList<>()); diff --git a/src/main/java/com/jozufozu/flywheel/core/materials/OrientedData.java b/src/main/java/com/jozufozu/flywheel/core/materials/OrientedData.java index a74bf3a73..4a3010abd 100644 --- a/src/main/java/com/jozufozu/flywheel/core/materials/OrientedData.java +++ b/src/main/java/com/jozufozu/flywheel/core/materials/OrientedData.java @@ -31,7 +31,7 @@ public class OrientedData extends BasicData { } public OrientedData setPosition(Vector3f pos) { - return setPosition(pos.getX(), pos.getY(), pos.getZ()); + return setPosition(pos.x(), pos.y(), pos.z()); } public OrientedData setPosition(float x, float y, float z) { @@ -56,11 +56,11 @@ public class OrientedData extends BasicData { } public OrientedData setPivot(Vector3f pos) { - return setPosition(pos.getX(), pos.getY(), pos.getZ()); + return setPosition(pos.x(), pos.y(), pos.z()); } public OrientedData setPivot(Vector3d pos) { - return setPosition((float) pos.getX(), (float) pos.getY(), (float) pos.getZ()); + return setPosition((float) pos.x(), (float) pos.y(), (float) pos.z()); } public OrientedData setPivot(Vec3 pos) { @@ -76,7 +76,7 @@ public class OrientedData extends BasicData { } public OrientedData setRotation(Quaternion q) { - return setRotation(q.getX(), q.getY(), q.getZ(), q.getW()); + return setRotation(q.i(), q.j(), q.k(), q.r()); } public OrientedData setRotation(float x, float y, float z, float w) { diff --git a/src/main/java/com/jozufozu/flywheel/core/model/PartBuilder.java b/src/main/java/com/jozufozu/flywheel/core/model/PartBuilder.java index 5aa2e92d9..5fe981d58 100644 --- a/src/main/java/com/jozufozu/flywheel/core/model/PartBuilder.java +++ b/src/main/java/com/jozufozu/flywheel/core/model/PartBuilder.java @@ -166,25 +166,25 @@ public class PartBuilder { public void quad(VecBuffer buffer, Vector3f[] vertices, float minU, float minV, float maxU, float maxV, Direction dir) { - Vector3f normal = dir.getUnitVector(); + Vector3f normal = dir.step(); - buffer.putVec3(vertices[0].getX(), vertices[0].getY(), vertices[0].getZ()).putVec3(nb(normal.getX()), nb(normal.getY()), nb(normal.getZ())).putVec2(maxU, minV); - buffer.putVec3(vertices[1].getX(), vertices[1].getY(), vertices[1].getZ()).putVec3(nb(normal.getX()), nb(normal.getY()), nb(normal.getZ())).putVec2(minU, minV); - buffer.putVec3(vertices[2].getX(), vertices[2].getY(), vertices[2].getZ()).putVec3(nb(normal.getX()), nb(normal.getY()), nb(normal.getZ())).putVec2(minU, maxV); - buffer.putVec3(vertices[3].getX(), vertices[3].getY(), vertices[3].getZ()).putVec3(nb(normal.getX()), nb(normal.getY()), nb(normal.getZ())).putVec2(maxU, maxV); + buffer.putVec3(vertices[0].x(), vertices[0].y(), vertices[0].z()).putVec3(nb(normal.x()), nb(normal.y()), nb(normal.z())).putVec2(maxU, minV); + buffer.putVec3(vertices[1].x(), vertices[1].y(), vertices[1].z()).putVec3(nb(normal.x()), nb(normal.y()), nb(normal.z())).putVec2(minU, minV); + buffer.putVec3(vertices[2].x(), vertices[2].y(), vertices[2].z()).putVec3(nb(normal.x()), nb(normal.y()), nb(normal.z())).putVec2(minU, maxV); + buffer.putVec3(vertices[3].x(), vertices[3].y(), vertices[3].z()).putVec3(nb(normal.x()), nb(normal.y()), nb(normal.z())).putVec2(maxU, maxV); } public float getU(float u) { if (sprite != null) - return sprite.getInterpolatedU(u * 16 / partBuilder.sizeU); + return sprite.getU(u * 16 / partBuilder.sizeU); else return u; } public float getV(float v) { if (sprite != null) - return sprite.getInterpolatedV(v * 16 / partBuilder.sizeV); + return sprite.getV(v * 16 / partBuilder.sizeV); else return v; } diff --git a/src/main/java/com/jozufozu/flywheel/core/model/Readable.java b/src/main/java/com/jozufozu/flywheel/core/model/Readable.java index 6d6d569b1..6f2399111 100644 --- a/src/main/java/com/jozufozu/flywheel/core/model/Readable.java +++ b/src/main/java/com/jozufozu/flywheel/core/model/Readable.java @@ -108,9 +108,9 @@ public class Readable { } } - this.normal = p_i225951_9_.getUnitVector(); + this.normal = p_i225951_9_.step(); if (p_i225951_8_) { - this.normal.multiplyComponentwise(-1.0F, 1.0F, 1.0F); + this.normal.mul(-1.0F, 1.0F, 1.0F); } } diff --git a/src/main/java/com/jozufozu/flywheel/core/shader/GlFog.java b/src/main/java/com/jozufozu/flywheel/core/shader/GlFog.java index 66f69cd1f..1b36fd2e7 100644 --- a/src/main/java/com/jozufozu/flywheel/core/shader/GlFog.java +++ b/src/main/java/com/jozufozu/flywheel/core/shader/GlFog.java @@ -8,23 +8,23 @@ public class GlFog { public static float[] FOG_COLOR = new float[]{0, 0, 0, 0}; public static boolean fogEnabled() { - return GlStateManager.FOG.field_179049_a.field_179201_b; + return GlStateManager.FOG.enable.enabled; } public static int getFogModeGlEnum() { - return GlStateManager.FOG.field_179047_b; + return GlStateManager.FOG.mode; } public static float getFogDensity() { - return GlStateManager.FOG.field_179048_c; + return GlStateManager.FOG.density; } public static float getFogEnd() { - return GlStateManager.FOG.field_179046_e; + return GlStateManager.FOG.end; } public static float getFogStart() { - return GlStateManager.FOG.field_179045_d; + return GlStateManager.FOG.start; } public static WorldFog getFogMode() { diff --git a/src/main/java/com/jozufozu/flywheel/event/EntityWorldHandler.java b/src/main/java/com/jozufozu/flywheel/event/EntityWorldHandler.java index 56f4c7be8..10707ea24 100644 --- a/src/main/java/com/jozufozu/flywheel/event/EntityWorldHandler.java +++ b/src/main/java/com/jozufozu/flywheel/event/EntityWorldHandler.java @@ -13,13 +13,13 @@ public class EntityWorldHandler { @SubscribeEvent public static void onEntityJoinWorld(EntityJoinWorldEvent event) { - if (event.getWorld().isRemote) InstancedRenderDispatcher.getEntities(event.getWorld()) + if (event.getWorld().isClientSide) InstancedRenderDispatcher.getEntities(event.getWorld()) .queueAdd(event.getEntity()); } @SubscribeEvent public static void onEntityLeaveWorld(EntityLeaveWorldEvent event) { - if (event.getWorld().isRemote) InstancedRenderDispatcher.getEntities(event.getWorld()) + if (event.getWorld().isClientSide) InstancedRenderDispatcher.getEntities(event.getWorld()) .remove(event.getEntity()); } } diff --git a/src/main/java/com/jozufozu/flywheel/event/ForgeEvents.java b/src/main/java/com/jozufozu/flywheel/event/ForgeEvents.java index 279d6b44e..0f6e9da62 100644 --- a/src/main/java/com/jozufozu/flywheel/event/ForgeEvents.java +++ b/src/main/java/com/jozufozu/flywheel/event/ForgeEvents.java @@ -20,7 +20,7 @@ public class ForgeEvents { @SubscribeEvent public static void addToDebugScreen(RenderGameOverlayEvent.Text event) { - if (Minecraft.getInstance().gameSettings.showDebugInfo) { + if (Minecraft.getInstance().options.renderDebug) { ArrayList right = event.getRight(); diff --git a/src/main/java/com/jozufozu/flywheel/light/GridAlignedBB.java b/src/main/java/com/jozufozu/flywheel/light/GridAlignedBB.java index 53bc3f6b4..030ea78f6 100644 --- a/src/main/java/com/jozufozu/flywheel/light/GridAlignedBB.java +++ b/src/main/java/com/jozufozu/flywheel/light/GridAlignedBB.java @@ -46,7 +46,7 @@ public class GridAlignedBB { } public static GridAlignedBB from(SectionPos pos) { - return new GridAlignedBB(pos.getWorldStartX(), pos.getWorldStartY(), pos.getWorldStartZ(), pos.getWorldEndX() + 1, pos.getWorldEndY() + 1, pos.getWorldEndZ() + 1); + return new GridAlignedBB(pos.minBlockX(), pos.minBlockY(), pos.minBlockZ(), pos.maxBlockX() + 1, pos.maxBlockY() + 1, pos.maxBlockZ() + 1); } public static GridAlignedBB from(BlockPos start, BlockPos end) { @@ -122,8 +122,8 @@ public class GridAlignedBB { } public void mirrorAbout(Direction.Axis axis) { - Vector3i axisVec = Direction.getFacingFromAxis(Direction.AxisDirection.POSITIVE, axis) - .getDirectionVec(); + Vector3i axisVec = Direction.get(Direction.AxisDirection.POSITIVE, axis) + .getNormal(); int flipX = axisVec.getX() - 1; int flipY = axisVec.getY() - 1; int flipZ = axisVec.getZ() - 1; diff --git a/src/main/java/com/jozufozu/flywheel/light/LightUpdater.java b/src/main/java/com/jozufozu/flywheel/light/LightUpdater.java index 3f1123258..df8956e4a 100644 --- a/src/main/java/com/jozufozu/flywheel/light/LightUpdater.java +++ b/src/main/java/com/jozufozu/flywheel/light/LightUpdater.java @@ -81,12 +81,12 @@ public class LightUpdater { LongRBTreeSet sections = clearSections(listener); LongRBTreeSet chunks = clearSections(listener); - int minX = SectionPos.toChunk(volume.minX); - int minY = SectionPos.toChunk(volume.minY); - int minZ = SectionPos.toChunk(volume.minZ); - int maxX = SectionPos.toChunk(volume.maxX); - int maxY = SectionPos.toChunk(volume.maxY); - int maxZ = SectionPos.toChunk(volume.maxZ); + int minX = SectionPos.blockToSectionCoord(volume.minX); + int minY = SectionPos.blockToSectionCoord(volume.minY); + int minZ = SectionPos.blockToSectionCoord(volume.minZ); + int maxX = SectionPos.blockToSectionCoord(volume.maxX); + int maxY = SectionPos.blockToSectionCoord(volume.maxY); + int maxZ = SectionPos.blockToSectionCoord(volume.maxZ); for (int x = minX; x <= maxX; x++) { for (int z = minZ; z <= maxZ; z++) { @@ -114,7 +114,7 @@ public class LightUpdater { if (set == null || set.isEmpty()) return; - GridAlignedBB chunkBox = GridAlignedBB.from(SectionPos.from(sectionPos)); + GridAlignedBB chunkBox = GridAlignedBB.from(SectionPos.of(sectionPos)); set.removeIf(listener -> listener.onLightUpdate(world, type, chunkBox.copy())); } diff --git a/src/main/java/com/jozufozu/flywheel/light/LightVolume.java b/src/main/java/com/jozufozu/flywheel/light/LightVolume.java index ae41c7f55..f5a70b5b2 100644 --- a/src/main/java/com/jozufozu/flywheel/light/LightVolume.java +++ b/src/main/java/com/jozufozu/flywheel/light/LightVolume.java @@ -172,10 +172,10 @@ public class LightVolume { int shiftZ = textureVolume.minZ; sampleVolume.forEachContained((x, y, z) -> { - pos.setPos(x, y, z); + pos.set(x, y, z); - int blockLight = world.getLightLevel(LightType.BLOCK, pos); - int skyLight = world.getLightLevel(LightType.SKY, pos); + int blockLight = world.getBrightness(LightType.BLOCK, pos); + int skyLight = world.getBrightness(LightType.SKY, pos); writeLight(x - shiftX, y - shiftY, z - shiftZ, blockLight, skyLight); }); @@ -196,9 +196,9 @@ public class LightVolume { int zShift = textureVolume.minZ; worldVolume.forEachContained((x, y, z) -> { - pos.setPos(x, y, z); + pos.set(x, y, z); - int light = world.getLightLevel(LightType.BLOCK, pos); + int light = world.getBrightness(LightType.BLOCK, pos); writeBlock(x - xShift, y - yShift, z - zShift, light); }); @@ -219,9 +219,9 @@ public class LightVolume { int zShift = textureVolume.minZ; worldVolume.forEachContained((x, y, z) -> { - pos.setPos(x, y, z); + pos.set(x, y, z); - int light = world.getLightLevel(LightType.SKY, pos); + int light = world.getBrightness(LightType.SKY, pos); writeSky(x - xShift, y - yShift, z - zShift, light); }); @@ -242,10 +242,10 @@ public class LightVolume { int zShift = textureVolume.minZ; worldVolume.forEachContained((x, y, z) -> { - pos.setPos(x, y, z); + pos.set(x, y, z); - int block = world.getLightLevel(LightType.BLOCK, pos); - int sky = world.getLightLevel(LightType.SKY, pos); + int block = world.getBrightness(LightType.BLOCK, pos); + int sky = world.getBrightness(LightType.SKY, pos); writeLight(x - xShift, y - yShift, z - zShift, block, sky); }); diff --git a/src/main/java/com/jozufozu/flywheel/mixin/CancelEntityRenderMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/CancelEntityRenderMixin.java index 84e78bee5..dcc929ec5 100644 --- a/src/main/java/com/jozufozu/flywheel/mixin/CancelEntityRenderMixin.java +++ b/src/main/java/com/jozufozu/flywheel/mixin/CancelEntityRenderMixin.java @@ -21,9 +21,9 @@ import net.minecraft.util.ClassInheritanceMultiMap; public class CancelEntityRenderMixin { @Group(name = "entityFilter", min = 1, max = 1) - @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;getAllEntities()Ljava/lang/Iterable;")) + @Redirect(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;entitiesForRendering()Ljava/lang/Iterable;")) private Iterable filterEntities(ClientWorld world) { - Iterable entities = world.getAllEntities(); + Iterable entities = world.entitiesForRendering(); if (Backend.getInstance() .canUseInstancing()) { @@ -38,7 +38,7 @@ public class CancelEntityRenderMixin { } @Group(name = "entityFilter") - @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/ClassInheritanceMultiMap;iterator()Ljava/util/Iterator;")) + @Redirect(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/ClassInheritanceMultiMap;iterator()Ljava/util/Iterator;")) private Iterator filterEntitiesOF(ClassInheritanceMultiMap classInheritanceMultiMap) { if (Backend.getInstance() .canUseInstancing()) { diff --git a/src/main/java/com/jozufozu/flywheel/mixin/FixFabulousDepthMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/FixFabulousDepthMixin.java index 94e62df11..8c8c85077 100644 --- a/src/main/java/com/jozufozu/flywheel/mixin/FixFabulousDepthMixin.java +++ b/src/main/java/com/jozufozu/flywheel/mixin/FixFabulousDepthMixin.java @@ -22,6 +22,6 @@ public class FixFabulousDepthMixin { @Inject(method = "render", at = @At(value = "INVOKE", ordinal = 1, target = "Lnet/minecraft/client/shader/ShaderGroup;render(F)V")) private void disableTransparencyShaderDepth(MatrixStack p_228426_1_, float p_228426_2_, long p_228426_3_, boolean p_228426_5_, ActiveRenderInfo p_228426_6_, GameRenderer p_228426_7_, LightTexture p_228426_8_, Matrix4f p_228426_9_, CallbackInfo ci) { - GlStateManager.depthMask(false); + GlStateManager._depthMask(false); } } diff --git a/src/main/java/com/jozufozu/flywheel/mixin/RenderHooksMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/RenderHooksMixin.java index cddb3a9dc..4a0437c5d 100644 --- a/src/main/java/com/jozufozu/flywheel/mixin/RenderHooksMixin.java +++ b/src/main/java/com/jozufozu/flywheel/mixin/RenderHooksMixin.java @@ -49,8 +49,8 @@ public class RenderHooksMixin { */ @Inject(at = @At("TAIL"), method = "renderLayer") private void renderLayer(RenderType type, MatrixStack stack, double camX, double camY, double camZ, CallbackInfo ci) { - Matrix4f view = stack.peek() - .getModel(); + Matrix4f view = stack.last() + .pose(); Matrix4f viewProjection = view.copy(); viewProjection.multiplyBackward(Backend.getInstance() .getProjectionMatrix()); @@ -75,13 +75,13 @@ public class RenderHooksMixin { if (!Backend.getInstance() .available()) return; - Matrix4f view = stack.peek() - .getModel(); + Matrix4f view = stack.last() + .pose(); Matrix4f viewProjection = view.copy(); viewProjection.multiplyBackward(Backend.getInstance() .getProjectionMatrix()); - Vector3d cameraPos = info.getProjectedView(); + Vector3d cameraPos = info.getPosition(); CrumblingRenderer.renderBreaking(world, viewProjection, cameraPos.x, cameraPos.y, cameraPos.z); if (!OptifineHandler.usingShaders()) GL20.glUseProgram(0); @@ -92,6 +92,6 @@ public class RenderHooksMixin { @Inject(at = @At("TAIL"), method = "scheduleBlockRerenderIfNeeded") private void checkUpdate(BlockPos pos, BlockState lastState, BlockState newState, CallbackInfo ci) { InstancedRenderDispatcher.getTiles(world) - .update(world.getTileEntity(pos)); + .update(world.getBlockEntity(pos)); } } diff --git a/src/main/java/com/jozufozu/flywheel/mixin/light/LightUpdateMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/light/LightUpdateMixin.java index 2c5cddc0b..ebcc79d40 100644 --- a/src/main/java/com/jozufozu/flywheel/mixin/light/LightUpdateMixin.java +++ b/src/main/java/com/jozufozu/flywheel/mixin/light/LightUpdateMixin.java @@ -36,25 +36,25 @@ public abstract class LightUpdateMixin extends AbstractChunkProvider { @Inject(at = @At("HEAD"), method = "markLightChanged") private void onLightUpdate(LightType type, SectionPos pos, CallbackInfo ci) { ClientChunkProvider thi = ((ClientChunkProvider) (Object) this); - ClientWorld world = (ClientWorld) thi.getWorld(); + ClientWorld world = (ClientWorld) thi.getLevel(); - Chunk chunk = thi.getChunk(pos.getSectionX(), pos.getSectionZ(), false); + Chunk chunk = thi.getChunk(pos.x(), pos.z(), false); - int sectionY = pos.getSectionY(); + int sectionY = pos.y(); if (ChunkUtil.isValidSection(chunk, sectionY)) { InstanceManager tiles = InstancedRenderDispatcher.getTiles(world); InstanceManager entities = InstancedRenderDispatcher.getEntities(world); - chunk.getTileEntityMap() + chunk.getBlockEntities() .entrySet() .stream() - .filter(entry -> SectionPos.toChunk(entry.getKey() + .filter(entry -> SectionPos.blockToSectionCoord(entry.getKey() .getY()) == sectionY) .map(Map.Entry::getValue) .forEach(tiles::onLightUpdate); - chunk.getEntityLists()[sectionY].forEach(entities::onLightUpdate); + chunk.getEntitySections()[sectionY].forEach(entities::onLightUpdate); } LightUpdater.getInstance() diff --git a/src/main/java/com/jozufozu/flywheel/mixin/light/NetworkLightUpdateMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/light/NetworkLightUpdateMixin.java index a026e4698..4f81a37e7 100644 --- a/src/main/java/com/jozufozu/flywheel/mixin/light/NetworkLightUpdateMixin.java +++ b/src/main/java/com/jozufozu/flywheel/mixin/light/NetworkLightUpdateMixin.java @@ -27,25 +27,25 @@ public class NetworkLightUpdateMixin { @Inject(at = @At("TAIL"), method = "handleUpdateLight") private void onLightPacket(SUpdateLightPacket packet, CallbackInfo ci) { RenderWork.enqueue(() -> { - ClientWorld world = Minecraft.getInstance().world; + ClientWorld world = Minecraft.getInstance().level; if (world == null) return; - int chunkX = packet.getChunkX(); - int chunkZ = packet.getChunkZ(); + int chunkX = packet.getX(); + int chunkZ = packet.getZ(); - Chunk chunk = world.getChunkProvider() + Chunk chunk = world.getChunkSource() .getChunk(chunkX, chunkZ, false); if (chunk != null) { InstanceManager tiles = InstancedRenderDispatcher.getTiles(world); InstanceManager entities = InstancedRenderDispatcher.getEntities(world); - chunk.getTileEntityMap() + chunk.getBlockEntities() .values() .forEach(tiles::onLightUpdate); - Arrays.stream(chunk.getEntityLists()) + Arrays.stream(chunk.getEntitySections()) .flatMap(ClassInheritanceMultiMap::stream) .forEach(entities::onLightUpdate); } diff --git a/src/main/java/com/jozufozu/flywheel/util/AngleHelper.java b/src/main/java/com/jozufozu/flywheel/util/AngleHelper.java index 1f4c2cec8..706e1999f 100644 --- a/src/main/java/com/jozufozu/flywheel/util/AngleHelper.java +++ b/src/main/java/com/jozufozu/flywheel/util/AngleHelper.java @@ -9,7 +9,7 @@ public class AngleHelper { * Legacy method. See {@link #horizontalAngleNew(Direction)} for new method. */ public static float horizontalAngle(Direction facing) { - float angle = facing.getHorizontalAngle(); + float angle = facing.toYRot(); if (facing.getAxis() == Axis.X) angle = -angle; return angle; } @@ -22,7 +22,7 @@ public class AngleHelper { .isVertical()) { return 0; } - float angle = facing.getHorizontalAngle(); + float angle = facing.toYRot(); if (facing.getAxis() == Axis.X) angle = -angle; return angle; } diff --git a/src/main/java/com/jozufozu/flywheel/util/AnimationTickHolder.java b/src/main/java/com/jozufozu/flywheel/util/AnimationTickHolder.java index 52718181d..d5143f3a2 100644 --- a/src/main/java/com/jozufozu/flywheel/util/AnimationTickHolder.java +++ b/src/main/java/com/jozufozu/flywheel/util/AnimationTickHolder.java @@ -14,7 +14,7 @@ public class AnimationTickHolder { public static void tick() { if (!Minecraft.getInstance() - .isGamePaused()) { + .isPaused()) { ticks = (ticks + 1) % 1_728_000; // wrap around every 24 hours so we maintain enough floating point precision } else { paused_ticks = (paused_ticks + 1) % 1_728_000; @@ -35,6 +35,6 @@ public class AnimationTickHolder { public static float getPartialTicks() { Minecraft mc = Minecraft.getInstance(); - return (mc.isGamePaused() ? mc.renderPartialTicksPaused : mc.getRenderPartialTicks()); + return (mc.isPaused() ? mc.pausePartialTick : mc.getFrameTime()); } } diff --git a/src/main/java/com/jozufozu/flywheel/util/BakedQuadWrapper.java b/src/main/java/com/jozufozu/flywheel/util/BakedQuadWrapper.java index e31aacdb1..24d41fde3 100644 --- a/src/main/java/com/jozufozu/flywheel/util/BakedQuadWrapper.java +++ b/src/main/java/com/jozufozu/flywheel/util/BakedQuadWrapper.java @@ -17,12 +17,12 @@ public class BakedQuadWrapper { public BakedQuadWrapper(BakedQuad quad) { this.quad = quad; - this.vertexData = quad.getVertexData(); + this.vertexData = quad.getVertices(); } public void setQuad(BakedQuad quad) { this.quad = quad; - this.vertexData = this.quad.getVertexData(); + this.vertexData = this.quad.getVertices(); } public static BakedQuadWrapper of(BakedQuad quad) { @@ -125,7 +125,7 @@ public class BakedQuadWrapper { } public void setPos(int vertexIndex, Vector3f pos) { - setPos(vertexIndex, pos.getX(), pos.getY(), pos.getZ()); + setPos(vertexIndex, pos.x(), pos.y(), pos.z()); } public void setColor(int vertexIndex, int color) { @@ -172,7 +172,7 @@ public class BakedQuadWrapper { } public void setNormal(int vertexIndex, Vector3f normal) { - setNormal(vertexIndex, normal.getX(), normal.getY(), normal.getZ()); + setNormal(vertexIndex, normal.x(), normal.y(), normal.z()); } private static class FormatCache { diff --git a/src/main/java/com/jozufozu/flywheel/util/BufferBuilderReader.java b/src/main/java/com/jozufozu/flywheel/util/BufferBuilderReader.java index a85db6ab4..5e2c2fdb3 100644 --- a/src/main/java/com/jozufozu/flywheel/util/BufferBuilderReader.java +++ b/src/main/java/com/jozufozu/flywheel/util/BufferBuilderReader.java @@ -16,13 +16,13 @@ public class BufferBuilderReader { public BufferBuilderReader(BufferBuilder builder) { VertexFormat vertexFormat = builder.getVertexFormat(); - Pair data = builder.popData(); + Pair data = builder.popNextBuffer(); buffer = data.getSecond(); - formatSize = vertexFormat.getSize(); + formatSize = vertexFormat.getVertexSize(); vertexCount = data.getFirst() - .getCount(); + .vertexCount(); size = vertexCount * formatSize; diff --git a/src/main/java/com/jozufozu/flywheel/util/RenderUtil.java b/src/main/java/com/jozufozu/flywheel/util/RenderUtil.java index 85dea40d3..4698835ad 100644 --- a/src/main/java/com/jozufozu/flywheel/util/RenderUtil.java +++ b/src/main/java/com/jozufozu/flywheel/util/RenderUtil.java @@ -29,18 +29,18 @@ public class RenderUtil { } public static float[] writeMatrixStack(MatrixStack stack) { - return writeMatrixStack(stack.peek() - .getModel(), stack.peek() - .getNormal()); + return writeMatrixStack(stack.last() + .pose(), stack.last() + .normal()); } // GPUs want matrices in column major order. public static float[] writeMatrixStack(Matrix4f model, Matrix3f normal) { - return new float[]{model.a00, model.a10, model.a20, model.a30, model.a01, model.a11, model.a21, model.a31, model.a02, model.a12, model.a22, model.a32, model.a03, model.a13, model.a23, model.a33, normal.a00, normal.a10, normal.a20, normal.a01, normal.a11, normal.a21, normal.a02, normal.a12, normal.a22,}; + return new float[]{model.m00, model.m10, model.m20, model.m30, model.m01, model.m11, model.m21, model.m31, model.m02, model.m12, model.m22, model.m32, model.m03, model.m13, model.m23, model.m33, normal.m00, normal.m10, normal.m20, normal.m01, normal.m11, normal.m21, normal.m02, normal.m12, normal.m22,}; } public static float[] writeMatrix(Matrix4f model) { - return new float[]{model.a00, model.a10, model.a20, model.a30, model.a01, model.a11, model.a21, model.a31, model.a02, model.a12, model.a22, model.a32, model.a03, model.a13, model.a23, model.a33,}; + return new float[]{model.m00, model.m10, model.m20, model.m30, model.m01, model.m11, model.m21, model.m31, model.m02, model.m12, model.m22, model.m32, model.m03, model.m13, model.m23, model.m33,}; } public static Supplier rotateToFace(Direction facing) { @@ -51,11 +51,11 @@ public class RenderUtil { // .rotateY(AngleHelper.horizontalAngle(facing)) // .rotateX(AngleHelper.verticalAngle(facing)) // .unCentre(); - stack.peek() - .getModel() + stack.last() + .pose() .setTranslation(0.5f, 0.5f, 0.5f); - stack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(AngleHelper.horizontalAngle(facing))); - stack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(AngleHelper.verticalAngle(facing))); + stack.mulPose(Vector3f.YP.rotationDegrees(AngleHelper.horizontalAngle(facing))); + stack.mulPose(Vector3f.XP.rotationDegrees(AngleHelper.verticalAngle(facing))); stack.translate(-0.5f, -0.5f, -0.5f); return stack; }; diff --git a/src/main/java/com/jozufozu/flywheel/util/transform/MatrixTransformStack.java b/src/main/java/com/jozufozu/flywheel/util/transform/MatrixTransformStack.java index 0ae2e605b..93867511e 100644 --- a/src/main/java/com/jozufozu/flywheel/util/transform/MatrixTransformStack.java +++ b/src/main/java/com/jozufozu/flywheel/util/transform/MatrixTransformStack.java @@ -20,7 +20,7 @@ public class MatrixTransformStack implements TransformStack { @Override public TransformStack multiply(Quaternion quaternion) { - internal.multiply(quaternion); + internal.mulPose(quaternion); return this; } diff --git a/src/main/java/com/jozufozu/flywheel/util/transform/TransformStack.java b/src/main/java/com/jozufozu/flywheel/util/transform/TransformStack.java index f50571a43..e5c4addd2 100644 --- a/src/main/java/com/jozufozu/flywheel/util/transform/TransformStack.java +++ b/src/main/java/com/jozufozu/flywheel/util/transform/TransformStack.java @@ -20,26 +20,26 @@ public interface TransformStack { default TransformStack rotate(Direction axis, float radians) { if (radians == 0) return this; - return multiply(axis.getUnitVector() - .getRadialQuaternion(radians)); + return multiply(axis.step() + .rotation(radians)); } default TransformStack rotate(double angle, Direction.Axis axis) { Vector3f vec = - axis == Direction.Axis.X ? Vector3f.POSITIVE_X : axis == Direction.Axis.Y ? Vector3f.POSITIVE_Y : Vector3f.POSITIVE_Z; + axis == Direction.Axis.X ? Vector3f.XP : axis == Direction.Axis.Y ? Vector3f.YP : Vector3f.ZP; return multiply(vec, angle); } default TransformStack rotateX(double angle) { - return multiply(Vector3f.POSITIVE_X, angle); + return multiply(Vector3f.XP, angle); } default TransformStack rotateY(double angle) { - return multiply(Vector3f.POSITIVE_Y, angle); + return multiply(Vector3f.YP, angle); } default TransformStack rotateZ(double angle) { - return multiply(Vector3f.POSITIVE_Z, angle); + return multiply(Vector3f.ZP, angle); } default TransformStack centre() { @@ -74,6 +74,6 @@ public interface TransformStack { default TransformStack multiply(Vector3f axis, double angle) { if (angle == 0) return this; - return multiply(axis.getDegreesQuaternion((float) angle)); + return multiply(axis.rotationDegrees((float) angle)); } } diff --git a/src/main/java/com/jozufozu/flywheel/util/vec/Vec4.java b/src/main/java/com/jozufozu/flywheel/util/vec/Vec4.java index 3b2dbd185..34cb79ed7 100644 --- a/src/main/java/com/jozufozu/flywheel/util/vec/Vec4.java +++ b/src/main/java/com/jozufozu/flywheel/util/vec/Vec4.java @@ -29,11 +29,11 @@ public class Vec4 { public Vec4 multiply(Quaternion quat) { Quaternion quaternion = new Quaternion(quat); - quaternion.multiply(new Quaternion(this.getX(), this.getY(), this.getZ(), 0.0F)); + quaternion.mul(new Quaternion(this.getX(), this.getY(), this.getZ(), 0.0F)); Quaternion quaternion1 = new Quaternion(quat); - quaternion1.conjugate(); - quaternion.multiply(quaternion1); - return set(quaternion.getX(), quaternion.getY(), quaternion.getZ(), this.getW()); + quaternion1.conj(); + quaternion.mul(quaternion1); + return set(quaternion.i(), quaternion.j(), quaternion.k(), this.getW()); } public Vec3 xyz() { diff --git a/src/main/java/com/jozufozu/flywheel/vanilla/BellInstance.java b/src/main/java/com/jozufozu/flywheel/vanilla/BellInstance.java index 5dafb5b6e..0209fd586 100644 --- a/src/main/java/com/jozufozu/flywheel/vanilla/BellInstance.java +++ b/src/main/java/com/jozufozu/flywheel/vanilla/BellInstance.java @@ -31,19 +31,19 @@ public class BellInstance extends TileEntityInstance implements @Override public void beginFrame() { - float ringTime = (float)tile.ringingTicks + AnimationTickHolder.getPartialTicks(); + float ringTime = (float)tile.ticks + AnimationTickHolder.getPartialTicks(); if (ringTime == lastRingTime) return; lastRingTime = ringTime; - if (tile.isRinging) { + if (tile.shaking) { float angle = MathHelper.sin(ringTime / (float) Math.PI) / (4.0F + ringTime / 3.0F); - Vector3f ringAxis = tile.ringDirection.rotateYCCW().getUnitVector(); + Vector3f ringAxis = tile.clickDirection.getCounterClockWise().step(); - bell.setRotation(ringAxis.getRadialQuaternion(angle)); + bell.setRotation(ringAxis.rotation(angle)); } else { - bell.setRotation(Quaternion.IDENTITY); + bell.setRotation(Quaternion.ONE); } } @@ -65,7 +65,7 @@ public class BellInstance extends TileEntityInstance implements private static BufferedModel createBellModel() { return ModelPart.builder(32, 32) - .sprite(BellTileEntityRenderer.field_217653_c.getSprite()) + .sprite(BellTileEntityRenderer.BELL_RESOURCE_LOCATION.sprite()) .cuboid() .start(5.0F, 6.0F, 5.0F) .size(6.0F, 7.0F, 6.0F) diff --git a/src/main/java/com/jozufozu/flywheel/vanilla/ChestInstance.java b/src/main/java/com/jozufozu/flywheel/vanilla/ChestInstance.java index 14d4e57bd..149e97355 100644 --- a/src/main/java/com/jozufozu/flywheel/vanilla/ChestInstance.java +++ b/src/main/java/com/jozufozu/flywheel/vanilla/ChestInstance.java @@ -47,8 +47,8 @@ public class ChestInstance extends TileEntityI Block block = blockState.getBlock(); - chestType = blockState.contains(ChestBlock.TYPE) ? blockState.get(ChestBlock.TYPE) : ChestType.SINGLE; - renderMaterial = Atlases.getChestTexture(tile, chestType, isChristmas()); + chestType = blockState.hasProperty(ChestBlock.TYPE) ? blockState.getValue(ChestBlock.TYPE) : ChestType.SINGLE; + renderMaterial = Atlases.chooseMaterial(tile, chestType, isChristmas()); body = baseInstance() .setPosition(getInstancePosition()); @@ -59,21 +59,21 @@ public class ChestInstance extends TileEntityI // MatrixStack stack = new MatrixStack(); // // stack.push(); - float horizontalAngle = blockState.get(ChestBlock.FACING).getHorizontalAngle(); + float horizontalAngle = blockState.getValue(ChestBlock.FACING).toYRot(); - baseRotation = Vector3f.POSITIVE_Y.getDegreesQuaternion(-horizontalAngle); + baseRotation = Vector3f.YP.rotationDegrees(-horizontalAngle); body.setRotation(baseRotation); AbstractChestBlock chestBlock = (AbstractChestBlock) block; - TileEntityMerger.ICallbackWrapper wrapper = chestBlock.getBlockEntitySource(blockState, world, getWorldPosition(), true); + TileEntityMerger.ICallbackWrapper wrapper = chestBlock.combine(blockState, world, getWorldPosition(), true); - this.lidProgress = wrapper.apply(ChestBlock.getAnimationProgressRetriever(tile)); + this.lidProgress = wrapper.apply(ChestBlock.opennessCombiner(tile)); } else { - baseRotation = Quaternion.IDENTITY; + baseRotation = Quaternion.ONE; lidProgress = $ -> 0f; } } @@ -99,7 +99,7 @@ public class ChestInstance extends TileEntityI .multiply(baseRotation) .unCentre() .translate(0, 0, 1f / 16f) - .multiply(Vector3f.POSITIVE_X.getRadialQuaternion(angleX)) + .multiply(Vector3f.XP.rotation(angleX)) .translate(0, 0, -1f / 16f); lid.setTransform(stack.unwrap()); @@ -119,15 +119,15 @@ public class ChestInstance extends TileEntityI private OrientedData baseInstance() { - return materialManager.getMaterial(Materials.ORIENTED, renderMaterial.getAtlasId()) - .get("base_" + renderMaterial.getTextureId(), this::getBaseModel) + return materialManager.getMaterial(Materials.ORIENTED, renderMaterial.atlasLocation()) + .get("base_" + renderMaterial.texture(), this::getBaseModel) .createInstance(); } private ModelData lidInstance() { - return materialManager.getMaterial(Materials.TRANSFORMED, renderMaterial.getAtlasId()) - .get("lid_" + renderMaterial.getTextureId(), this::getLidModel) + return materialManager.getMaterial(Materials.TRANSFORMED, renderMaterial.atlasLocation()) + .get("lid_" + renderMaterial.texture(), this::getLidModel) .createInstance(); } @@ -136,7 +136,7 @@ public class ChestInstance extends TileEntityI switch (chestType) { case LEFT: return ModelPart.builder(64, 64) - .sprite(renderMaterial.getSprite()) + .sprite(renderMaterial.sprite()) .cuboid() .textureOffset(0, 19) .start(0, 0, 1) @@ -145,7 +145,7 @@ public class ChestInstance extends TileEntityI .build(); case RIGHT: return ModelPart.builder(64, 64) - .sprite(renderMaterial.getSprite()) + .sprite(renderMaterial.sprite()) .cuboid() .textureOffset(0, 19) .start(1, 0, 1) @@ -155,7 +155,7 @@ public class ChestInstance extends TileEntityI } return ModelPart.builder(64, 64) - .sprite(renderMaterial.getSprite()) + .sprite(renderMaterial.sprite()) .cuboid() .textureOffset(0, 19) .start(1, 0, 1) @@ -169,7 +169,7 @@ public class ChestInstance extends TileEntityI switch (chestType) { case LEFT: return ModelPart.builder(64, 64) - .sprite(renderMaterial.getSprite()) + .sprite(renderMaterial.sprite()) .cuboid() .textureOffset(0, 0) .start(0, 0, 1) @@ -182,7 +182,7 @@ public class ChestInstance extends TileEntityI .build(); case RIGHT: return ModelPart.builder(64, 64) - .sprite(renderMaterial.getSprite()) + .sprite(renderMaterial.sprite()) .cuboid() .textureOffset(0, 0) .start(1, 0, 1) @@ -196,7 +196,7 @@ public class ChestInstance extends TileEntityI } return ModelPart.builder(64, 64) - .sprite(renderMaterial.getSprite()) + .sprite(renderMaterial.sprite()) .cuboid() .textureOffset(0, 0) .start(1, 0, 1)