Remap to Mojmap, update gradle

This commit is contained in:
Jozufozu 2021-07-15 11:36:24 -07:00
parent dfbba8e3d0
commit 09e52e974f
51 changed files with 248 additions and 218 deletions

View file

@ -6,7 +6,7 @@ buildscript {
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' } maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
} }
dependencies { 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' 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' group = 'com.jozufozu.flywheel'
archivesBaseName = 'flywheel' archivesBaseName = 'flywheel'
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' java.toolchain.languageVersion = JavaLanguageVersion.of(8)
minecraft { minecraft {
mappings channel: 'snapshot', version: "${mcp_mappings}" mappings channel: 'official', version: "${minecraft_version}"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs { runs {

Binary file not shown.

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-bin.zip

22
gradlew vendored
View file

@ -1,5 +1,21 @@
#!/usr/bin/env sh #!/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 ## Gradle start up script for UN*X
@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"` 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. # 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. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" 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\"" GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi fi
# For Cygwin, switch paths to Windows format before running java # For Cygwin or MSYS, switch paths to Windows format before running java
if $cygwin ; then if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"` APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"` JAVACMD=`cygpath --unix "$JAVACMD"`

18
gradlew.bat vendored
View file

@ -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 @if "%DEBUG%" == "" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% 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. @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 @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome

View file

@ -187,15 +187,15 @@ public class Backend {
if (world instanceof IFlywheelWorld && ((IFlywheelWorld) world).supportsFlywheel()) return true; if (world instanceof IFlywheelWorld && ((IFlywheelWorld) world).supportsFlywheel()) return true;
return world == Minecraft.getInstance().world; return world == Minecraft.getInstance().level;
} }
public static boolean isGameActive() { 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() { public static void reloadWorldRenderers() {
RenderWork.enqueue(Minecraft.getInstance().worldRenderer::loadRenderers); RenderWork.enqueue(Minecraft.getInstance().levelRenderer::allChanged);
} }
public static void init() { public static void init() {

View file

@ -55,7 +55,7 @@ public class OptifineHandler {
public static void refresh() { public static void refresh() {
if (optifine == null) return; if (optifine == null) return;
File dir = Minecraft.getInstance().gameDir; File dir = Minecraft.getInstance().gameDirectory;
File shaderOptions = new File(dir, "optionsshaders.txt"); File shaderOptions = new File(dir, "optionsshaders.txt");

View file

@ -63,7 +63,7 @@ public class ShaderSources implements ISelectiveResourceReloadListener {
this.backend = backend; this.backend = backend;
IResourceManager manager = backend.minecraft.getResourceManager(); IResourceManager manager = backend.minecraft.getResourceManager();
if (manager instanceof IReloadableResourceManager) { 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 // no need to hog all that memory
shaderSource.clear(); shaderSource.clear();
ClientWorld world = Minecraft.getInstance().world; ClientWorld world = Minecraft.getInstance().level;
if (Backend.isFlywheelWorld(world)) { if (Backend.isFlywheelWorld(world)) {
// TODO: looks like it might be good to have another event here // TODO: looks like it might be good to have another event here
InstancedRenderDispatcher.loadAllInWorld(world); InstancedRenderDispatcher.loadAllInWorld(world);
@ -108,7 +108,7 @@ public class ShaderSources implements ISelectiveResourceReloadListener {
} }
private void loadProgramSpecs(IResourceManager manager) { private void loadProgramSpecs(IResourceManager manager) {
Collection<ResourceLocation> programSpecs = manager.getAllResourceLocations(PROGRAM_DIR, s -> s.endsWith(".json")); Collection<ResourceLocation> programSpecs = manager.listResources(PROGRAM_DIR, s -> s.endsWith(".json"));
for (ResourceLocation location : programSpecs) { for (ResourceLocation location : programSpecs) {
try { try {
@ -149,7 +149,7 @@ public class ShaderSources implements ISelectiveResourceReloadListener {
} }
private void loadShaderSources(IResourceManager manager) { private void loadShaderSources(IResourceManager manager) {
Collection<ResourceLocation> allShaders = manager.getAllResourceLocations(SHADER_DIR, s -> { Collection<ResourceLocation> allShaders = manager.listResources(SHADER_DIR, s -> {
for (String ext : EXTENSIONS) { for (String ext : EXTENSIONS) {
if (s.endsWith(ext)) return true; if (s.endsWith(ext)) return true;
} }

View file

@ -82,15 +82,15 @@ public abstract class InstanceManager<T> implements MaterialManager.OriginShiftL
frame++; frame++;
processQueuedAdditions(); processQueuedAdditions();
Vector3f look = info.getHorizontalPlane(); Vector3f look = info.getLookVector();
float lookX = look.getX(); float lookX = look.x();
float lookY = look.getY(); float lookY = look.y();
float lookZ = look.getZ(); float lookZ = look.z();
// integer camera pos // integer camera pos
int cX = (int) info.getProjectedView().x; int cX = (int) info.getPosition().x;
int cY = (int) info.getProjectedView().y; int cY = (int) info.getPosition().y;
int cZ = (int) info.getProjectedView().z; int cZ = (int) info.getPosition().z;
if (dynamicInstances.size() > 0) { if (dynamicInstances.size() > 0) {
dynamicInstances.object2ObjectEntrySet() dynamicInstances.object2ObjectEntrySet()

View file

@ -109,8 +109,8 @@ public class InstanceMaterial<D extends InstanceData> {
private BufferedModel buildModel(BlockState renderedState) { private BufferedModel buildModel(BlockState renderedState) {
BlockRendererDispatcher dispatcher = Minecraft.getInstance() BlockRendererDispatcher dispatcher = Minecraft.getInstance()
.getBlockRendererDispatcher(); .getBlockRenderer();
return buildModel(dispatcher.getModelForState(renderedState), renderedState); return buildModel(dispatcher.getBlockModel(renderedState), renderedState);
} }
private BufferedModel buildModel(IBakedModel model, BlockState renderedState) { private BufferedModel buildModel(IBakedModel model, BlockState renderedState) {
@ -156,8 +156,8 @@ public class InstanceMaterial<D extends InstanceData> {
public static BufferBuilder getBufferBuilder(IBakedModel model, BlockState referenceState, MatrixStack ms) { public static BufferBuilder getBufferBuilder(IBakedModel model, BlockState referenceState, MatrixStack ms) {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
BlockRendererDispatcher dispatcher = mc.getBlockRendererDispatcher(); BlockRendererDispatcher dispatcher = mc.getBlockRenderer();
BlockModelRenderer blockRenderer = dispatcher.getBlockModelRenderer(); BlockModelRenderer blockRenderer = dispatcher.getModelRenderer();
BufferBuilder builder = new BufferBuilder(512); BufferBuilder builder = new BufferBuilder(512);
// BakedQuadWrapper quadReader = new BakedQuadWrapper(); // BakedQuadWrapper quadReader = new BakedQuadWrapper();
@ -168,8 +168,8 @@ public class InstanceMaterial<D extends InstanceData> {
// .collect(Collectors.toList()); // .collect(Collectors.toList());
builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); 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); blockRenderer.renderModel(mc.level, model, referenceState, BlockPos.ZERO.above(255), ms, builder, true, mc.level.random, 42, OverlayTexture.NO_OVERLAY, VirtualEmptyModelData.INSTANCE);
builder.finishDrawing(); builder.end();
return builder; return builder;
} }

View file

@ -50,10 +50,10 @@ public class InstancedRenderDispatcher {
return; return;
} }
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
ClientWorld world = mc.world; ClientWorld world = mc.level;
AnimationTickHolder.tick(); AnimationTickHolder.tick();
Entity renderViewEntity = mc.renderViewEntity != null ? mc.renderViewEntity : mc.player; Entity renderViewEntity = mc.cameraEntity != null ? mc.cameraEntity : mc.player;
if (renderViewEntity == null) return; if (renderViewEntity == null) return;
@ -62,11 +62,11 @@ public class InstancedRenderDispatcher {
} }
public static void enqueueUpdate(TileEntity te) { public static void enqueueUpdate(TileEntity te) {
getTiles(te.getWorld()).queueUpdate(te); getTiles(te.getLevel()).queueUpdate(te);
} }
public static void enqueueUpdate(Entity entity) { public static void enqueueUpdate(Entity entity) {
getEntities(entity.world).queueUpdate(entity); getEntities(entity.level).queueUpdate(entity);
} }
@SubscribeEvent @SubscribeEvent
@ -84,12 +84,12 @@ public class InstancedRenderDispatcher {
if (!Backend.getInstance() if (!Backend.getInstance()
.canUseInstancing(world)) return; .canUseInstancing(world)) return;
event.type.startDrawing(); event.type.setupRenderState();
materialManagers.get(world) materialManagers.get(world)
.render(event.type, event.viewProjection, event.camX, event.camY, event.camZ); .render(event.type, event.viewProjection, event.camX, event.camY, event.camZ);
event.type.endDrawing(); event.type.clearRenderState();
} }
@SubscribeEvent @SubscribeEvent
@ -105,10 +105,10 @@ public class InstancedRenderDispatcher {
materialManagers.replace(world, MaterialManager::delete); materialManagers.replace(world, MaterialManager::delete);
InstanceManager<TileEntity> tiles = tileInstanceManager.replace(world); InstanceManager<TileEntity> tiles = tileInstanceManager.replace(world);
world.loadedTileEntityList.forEach(tiles::add); world.blockEntityList.forEach(tiles::add);
InstanceManager<Entity> entities = entityInstanceManager.replace(world); InstanceManager<Entity> entities = entityInstanceManager.replace(world);
world.getAllEntities() world.entitiesForRendering()
.forEach(entities::add); .forEach(entities::add);
} }
} }

View file

@ -76,7 +76,7 @@ public class MaterialManager<P extends WorldProgram> {
camY -= originCoordinate.getY(); camY -= originCoordinate.getY();
camZ -= originCoordinate.getZ(); 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); translate.multiplyBackward(viewProjection);
@ -85,7 +85,7 @@ public class MaterialManager<P extends WorldProgram> {
} }
for (Map.Entry<ResourceLocation, ArrayList<MaterialRenderer<P>>> entry : renderers.entrySet()) { for (Map.Entry<ResourceLocation, ArrayList<MaterialRenderer<P>>> entry : renderers.entrySet()) {
Minecraft.getInstance().textureManager.bindTexture(entry.getKey()); Minecraft.getInstance().textureManager.bind(entry.getKey());
for (MaterialRenderer<P> materialRenderer : entry.getValue()) { for (MaterialRenderer<P> materialRenderer : entry.getValue()) {
materialRenderer.render(layer, translate, camX, camY, camZ, callback); materialRenderer.render(layer, translate, camX, camY, camZ, callback);
@ -149,9 +149,9 @@ public class MaterialManager<P extends WorldProgram> {
} }
public void checkAndShiftOrigin(ActiveRenderInfo info) { public void checkAndShiftOrigin(ActiveRenderInfo info) {
int cX = MathHelper.floor(info.getProjectedView().x); int cX = MathHelper.floor(info.getPosition().x);
int cY = MathHelper.floor(info.getProjectedView().y); int cY = MathHelper.floor(info.getPosition().y);
int cZ = MathHelper.floor(info.getProjectedView().z); int cZ = MathHelper.floor(info.getPosition().z);
int dX = cX - originCoordinate.getX(); int dX = cX - originCoordinate.getX();
int dY = cY - originCoordinate.getY(); int dY = cY - originCoordinate.getY();

View file

@ -19,7 +19,7 @@ public class MaterialRenderer<P extends WorldProgram> {
} }
public void render(RenderType layer, Matrix4f viewProjection, double camX, double camY, double camZ, IProgramCallback<P> setup) { public void render(RenderType layer, Matrix4f viewProjection, double camX, double camY, double camZ, IProgramCallback<P> setup) {
if (!(layer == RenderType.getCutoutMipped())) return; if (!(layer == RenderType.cutoutMipped())) return;
if (material.nothingToRender()) return; if (material.nothingToRender()) return;

View file

@ -16,7 +16,7 @@ public class MaterialSpec<D extends InstanceData> {
private final ResourceLocation texture; private final ResourceLocation texture;
public MaterialSpec(ResourceLocation name, ResourceLocation programSpec, VertexFormat modelFormat, VertexFormat instanceFormat, IInstanceFactory<D> instanceFactory) { public MaterialSpec(ResourceLocation name, ResourceLocation programSpec, VertexFormat modelFormat, VertexFormat instanceFormat, IInstanceFactory<D> 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<D> instanceFactory) { public MaterialSpec(ResourceLocation name, ResourceLocation programSpec, VertexFormat modelFormat, VertexFormat instanceFormat, ResourceLocation texture, IInstanceFactory<D> instanceFactory) {

View file

@ -46,7 +46,7 @@ public abstract class EntityInstance<E extends Entity> implements IInstance {
public EntityInstance(MaterialManager<?> materialManager, E entity) { public EntityInstance(MaterialManager<?> materialManager, E entity) {
this.materialManager = materialManager; this.materialManager = materialManager;
this.entity = entity; this.entity = entity;
this.world = entity.world; this.world = entity.level;
} }
/** /**
@ -92,22 +92,22 @@ public abstract class EntityInstance<E extends Entity> implements IInstance {
* represents should be rendered at to appear in the correct location. * represents should be rendered at to appear in the correct location.
*/ */
public Vector3f getInstancePosition() { public Vector3f getInstancePosition() {
Vector3d pos = entity.getPositionVec(); Vector3d pos = entity.position();
Vector3i origin = materialManager.getOriginCoordinate(); Vector3i origin = materialManager.getOriginCoordinate();
return new Vector3f((float) (pos.x - origin.getX()), (float) (pos.y - origin.getY()), (float) (pos.z - origin.getZ())); return new Vector3f((float) (pos.x - origin.getX()), (float) (pos.y - origin.getY()), (float) (pos.z - origin.getZ()));
} }
@Override @Override
public BlockPos getWorldPosition() { public BlockPos getWorldPosition() {
return entity.getBlockPos(); return entity.blockPosition();
} }
protected void relight(BlockPos pos, IFlatLight<?>... models) { 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 <L extends IFlatLight<?>> void relight(BlockPos pos, Stream<L> models) { protected <L extends IFlatLight<?>> void relight(BlockPos pos, Stream<L> 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) { protected void relight(int block, int sky, IFlatLight<?>... models) {

View file

@ -32,14 +32,14 @@ public class EntityInstanceManager extends InstanceManager<Entity> {
protected boolean canCreateInstance(Entity entity) { protected boolean canCreateInstance(Entity entity) {
if (!entity.isAlive()) return false; if (!entity.isAlive()) return false;
World world = entity.world; World world = entity.level;
if (world == null) return false; if (world == null) return false;
if (Backend.isFlywheelWorld(world)) { 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; return existingChunk != null;
} }

View file

@ -47,8 +47,8 @@ public abstract class TileEntityInstance<T extends TileEntity> implements IInsta
public TileEntityInstance(MaterialManager<?> materialManager, T tile) { public TileEntityInstance(MaterialManager<?> materialManager, T tile) {
this.materialManager = materialManager; this.materialManager = materialManager;
this.tile = tile; this.tile = tile;
this.world = tile.getWorld(); this.world = tile.getLevel();
this.pos = tile.getPos(); this.pos = tile.getBlockPos();
this.blockState = tile.getBlockState(); this.blockState = tile.getBlockState();
this.instancePos = pos.subtract(materialManager.getOriginCoordinate()); this.instancePos = pos.subtract(materialManager.getOriginCoordinate());
} }
@ -105,11 +105,11 @@ public abstract class TileEntityInstance<T extends TileEntity> implements IInsta
} }
protected void relight(BlockPos pos, IFlatLight<?>... models) { 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 <L extends IFlatLight<?>> void relight(BlockPos pos, Stream<L> models) { protected <L extends IFlatLight<?>> void relight(BlockPos pos, Stream<L> 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) { protected void relight(int block, int sky, IFlatLight<?>... models) {

View file

@ -32,16 +32,16 @@ public class TileInstanceManager extends InstanceManager<TileEntity> {
protected boolean canCreateInstance(TileEntity tile) { protected boolean canCreateInstance(TileEntity tile) {
if (tile.isRemoved()) return false; if (tile.isRemoved()) return false;
World world = tile.getWorld(); World world = tile.getLevel();
if (world == null) return false; if (world == null) return false;
if (world.isAirBlock(tile.getPos())) return false; if (world.isEmptyBlock(tile.getBlockPos())) return false;
if (Backend.isFlywheelWorld(world)) { 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; return existingChunk != null;
} }

View file

@ -37,7 +37,7 @@ public enum BooleanConfig {
if (state == BooleanDirective.DISPLAY) { if (state == BooleanDirective.DISPLAY) {
ITextComponent text = new StringTextComponent("Flywheel Renderer is currently: ").append(boolToText(FlwConfig.get().client.enabled.get())); ITextComponent text = new StringTextComponent("Flywheel Renderer is currently: ").append(boolToText(FlwConfig.get().client.enabled.get()));
player.sendStatusMessage(text, false); player.displayClientMessage(text, false);
return; return;
} }
@ -46,10 +46,10 @@ public enum BooleanConfig {
FlwConfig.get().client.enabled.set(enabled); FlwConfig.get().client.enabled.set(enabled);
ITextComponent text = boolToText(FlwConfig.get().client.enabled.get()).append(new StringTextComponent(" Flywheel Renderer").formatted(TextFormatting.WHITE)); 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").formatted(TextFormatting.RED); 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(); Backend.reloadWorldRenderers();
} }
@ -60,18 +60,18 @@ public enum BooleanConfig {
if (state == BooleanDirective.DISPLAY) { if (state == BooleanDirective.DISPLAY) {
ITextComponent text = new StringTextComponent("Normal overlay is currently: ").append(boolToText(FlwConfig.get().client.normalDebug.get())); ITextComponent text = new StringTextComponent("Normal overlay is currently: ").append(boolToText(FlwConfig.get().client.normalDebug.get()));
player.sendStatusMessage(text, false); player.displayClientMessage(text, false);
return; return;
} }
FlwConfig.get().client.normalDebug.set(state.get()); 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) { 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);
} }
} }

View file

@ -23,21 +23,21 @@ public class BooleanConfigCommand {
return Commands.literal(name) return Commands.literal(name)
.executes(context -> { .executes(context -> {
ServerPlayerEntity player = context.getSource() ServerPlayerEntity player = context.getSource()
.asPlayer(); .getPlayerOrException();
FlwPackets.channel.send(PacketDistributor.PLAYER.with(() -> player), new SConfigureBooleanPacket(value, BooleanDirective.DISPLAY)); FlwPackets.channel.send(PacketDistributor.PLAYER.with(() -> player), new SConfigureBooleanPacket(value, BooleanDirective.DISPLAY));
return Command.SINGLE_SUCCESS; return Command.SINGLE_SUCCESS;
}) })
.then(Commands.literal("on") .then(Commands.literal("on")
.executes(context -> { .executes(context -> {
ServerPlayerEntity player = context.getSource() ServerPlayerEntity player = context.getSource()
.asPlayer(); .getPlayerOrException();
FlwPackets.channel.send(PacketDistributor.PLAYER.with(() -> player), new SConfigureBooleanPacket(value, BooleanDirective.TRUE)); FlwPackets.channel.send(PacketDistributor.PLAYER.with(() -> player), new SConfigureBooleanPacket(value, BooleanDirective.TRUE));
return Command.SINGLE_SUCCESS; return Command.SINGLE_SUCCESS;
})) }))
.then(Commands.literal("off") .then(Commands.literal("off")
.executes(context -> { .executes(context -> {
ServerPlayerEntity player = context.getSource() ServerPlayerEntity player = context.getSource()
.asPlayer(); .getPlayerOrException();
FlwPackets.channel.send(PacketDistributor.PLAYER.with(() -> player), new SConfigureBooleanPacket(value, BooleanDirective.FALSE)); FlwPackets.channel.send(PacketDistributor.PLAYER.with(() -> player), new SConfigureBooleanPacket(value, BooleanDirective.FALSE));
return Command.SINGLE_SUCCESS; return Command.SINGLE_SUCCESS;
})); }));

View file

@ -11,7 +11,7 @@ public class FlwCommands {
@SubscribeEvent @SubscribeEvent
public static void onServerStarting(FMLServerStartingEvent event) { public static void onServerStarting(FMLServerStartingEvent event) {
CommandDispatcher<CommandSource> dispatcher = event.getServer() CommandDispatcher<CommandSource> dispatcher = event.getServer()
.getCommandManager() .getCommands()
.getDispatcher(); .getDispatcher();
dispatcher.register(Commands.literal("flywheel") dispatcher.register(Commands.literal("flywheel")

View file

@ -29,8 +29,8 @@ public class AtlasStitcher {
public void onTextureStitch(TextureStitchEvent.Pre event) { public void onTextureStitch(TextureStitchEvent.Pre event) {
if (!event.getMap() if (!event.getMap()
.getId() .location()
.equals(PlayerContainer.BLOCK_ATLAS_TEXTURE)) return; .equals(PlayerContainer.BLOCK_ATLAS)) return;
sprites.forEach(StitchedSprite::reset); sprites.forEach(StitchedSprite::reset);
sprites.stream() sprites.stream()

View file

@ -22,7 +22,7 @@ public class StitchedSprite {
public TextureAtlasSprite getSprite() { public TextureAtlasSprite getSprite() {
if (sprite == null) { if (sprite == null) {
sprite = Minecraft.getInstance() sprite = Minecraft.getInstance()
.getSpriteAtlas(PlayerContainer.BLOCK_ATLAS_TEXTURE) .getTextureAtlas(PlayerContainer.BLOCK_ATLAS)
.apply(loc); .apply(loc);
} }

View file

@ -25,11 +25,11 @@ public class AtlasInfo {
} }
public static SheetData getAtlasData(TextureAtlasSprite texture) { public static SheetData getAtlasData(TextureAtlasSprite texture) {
return getAtlasData(texture.getAtlas()); return getAtlasData(texture.atlas());
} }
public static SheetData getAtlasData(AtlasTexture atlas) { public static SheetData getAtlasData(AtlasTexture atlas) {
return getAtlasData(atlas.getId()); return getAtlasData(atlas.location());
} }
public static SheetData getAtlasData(ResourceLocation loc) { public static SheetData getAtlasData(ResourceLocation loc) {

View file

@ -40,15 +40,15 @@ public class CrumblingMaterialManager extends MaterialManager<CrumblingProgram>
camY -= originCoordinate.getY(); camY -= originCoordinate.getY();
camZ -= originCoordinate.getZ(); 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); translate.multiplyBackward(viewProjection);
TextureManager textureManager = Minecraft.getInstance().textureManager; TextureManager textureManager = Minecraft.getInstance().textureManager;
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, textureManager.getTexture(PlayerContainer.BLOCK_ATLAS_TEXTURE) glBindTexture(GL_TEXTURE_2D, textureManager.getTexture(PlayerContainer.BLOCK_ATLAS)
.getGlTextureId()); .getId());
for (MaterialRenderer<CrumblingProgram> material : atlasRenderers) { for (MaterialRenderer<CrumblingProgram> material : atlasRenderers) {
material.render(layer, translate, camX, camY, camZ, CrumblingProgram::setDefaultAtlasSize); material.render(layer, translate, camX, camY, camZ, CrumblingProgram::setDefaultAtlasSize);
@ -56,7 +56,7 @@ public class CrumblingMaterialManager extends MaterialManager<CrumblingProgram>
for (Map.Entry<ResourceLocation, ArrayList<MaterialRenderer<CrumblingProgram>>> entry : renderers.entrySet()) { for (Map.Entry<ResourceLocation, ArrayList<MaterialRenderer<CrumblingProgram>>> entry : renderers.entrySet()) {
glBindTexture(GL_TEXTURE_2D, textureManager.getTexture(entry.getKey()) glBindTexture(GL_TEXTURE_2D, textureManager.getTexture(entry.getKey())
.getGlTextureId()); .getId());
SheetData atlasData = AtlasInfo.getAtlasData(entry.getKey()); SheetData atlasData = AtlasInfo.getAtlasData(entry.getKey());
for (MaterialRenderer<CrumblingProgram> materialRenderer : entry.getValue()) { for (MaterialRenderer<CrumblingProgram> materialRenderer : entry.getValue()) {
materialRenderer.render(layer, translate, camX, camY, camZ, p -> p.setAtlasSize(atlasData.width, atlasData.height)); materialRenderer.render(layer, translate, camX, camY, camZ, p -> p.setAtlasSize(atlasData.width, atlasData.height));

View file

@ -36,7 +36,7 @@ public class CrumblingProgram extends WorldProgram {
} }
public void setDefaultAtlasSize() { public void setDefaultAtlasSize() {
SheetData atlasData = AtlasInfo.getAtlasData(PlayerContainer.BLOCK_ATLAS_TEXTURE); SheetData atlasData = AtlasInfo.getAtlasData(PlayerContainer.BLOCK_ATLAS);
if (atlasData == null) return; if (atlasData == null) return;
int width = atlasData.width; int width = atlasData.width;
@ -46,10 +46,10 @@ public class CrumblingProgram extends WorldProgram {
} }
public void setAtlasSize(int width, int height) { 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; 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()); setTextureScale(width / (float) sprite.getWidth(), height / (float) sprite.getHeight());
} }

View file

@ -54,7 +54,7 @@ public class CrumblingRenderer {
INVALIDATOR = state.getSecond(); 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) { public static void renderBreaking(ClientWorld world, Matrix4f viewProjection, double cameraX, double cameraY, double cameraZ) {
if (!Backend.getInstance() if (!Backend.getInstance()
@ -69,14 +69,14 @@ public class CrumblingRenderer {
InstanceManager<TileEntity> renderer = state.instanceManager; InstanceManager<TileEntity> renderer = state.instanceManager;
TextureManager textureManager = Minecraft.getInstance().textureManager; TextureManager textureManager = Minecraft.getInstance().textureManager;
ActiveRenderInfo info = Minecraft.getInstance().gameRenderer.getActiveRenderInfo(); ActiveRenderInfo info = Minecraft.getInstance().gameRenderer.getMainCamera();
MaterialManager<CrumblingProgram> materials = state.materialManager; MaterialManager<CrumblingProgram> materials = state.materialManager;
crumblingLayer.startDrawing(); crumblingLayer.setupRenderState();
for (Int2ObjectMap.Entry<List<TileEntity>> stage : activeStages.int2ObjectEntrySet()) { for (Int2ObjectMap.Entry<List<TileEntity>> stage : activeStages.int2ObjectEntrySet()) {
int i = stage.getIntKey(); 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 // 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) { if (breaking != null) {
@ -85,38 +85,38 @@ public class CrumblingRenderer {
renderer.beginFrame(info); renderer.beginFrame(info);
glActiveTexture(GL_TEXTURE4); glActiveTexture(GL_TEXTURE4);
glBindTexture(GL_TEXTURE_2D, breaking.getGlTextureId()); glBindTexture(GL_TEXTURE_2D, breaking.getId());
materials.render(RenderType.getCutoutMipped(), viewProjection, cameraX, cameraY, cameraZ); materials.render(RenderType.cutoutMipped(), viewProjection, cameraX, cameraY, cameraZ);
renderer.invalidate(); renderer.invalidate();
} }
} }
crumblingLayer.endDrawing(); crumblingLayer.clearRenderState();
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
Texture breaking = textureManager.getTexture(ModelBakery.BLOCK_DESTRUCTION_STAGE_TEXTURES.get(0)); Texture breaking = textureManager.getTexture(ModelBakery.BREAKING_LOCATIONS.get(0));
if (breaking != null) glBindTexture(GL_TEXTURE_2D, breaking.getGlTextureId()); if (breaking != null) glBindTexture(GL_TEXTURE_2D, breaking.getId());
} }
/** /**
* Associate each breaking stage with a list of all tile entities at that stage. * Associate each breaking stage with a list of all tile entities at that stage.
*/ */
private static Int2ObjectMap<List<TileEntity>> getActiveStageTiles(ClientWorld world) { private static Int2ObjectMap<List<TileEntity>> getActiveStageTiles(ClientWorld world) {
Long2ObjectMap<SortedSet<DestroyBlockProgress>> breakingProgressions = Minecraft.getInstance().worldRenderer.blockBreakingProgressions; Long2ObjectMap<SortedSet<DestroyBlockProgress>> breakingProgressions = Minecraft.getInstance().levelRenderer.destructionProgress;
Int2ObjectMap<List<TileEntity>> breakingEntities = new Int2ObjectArrayMap<>(); Int2ObjectMap<List<TileEntity>> breakingEntities = new Int2ObjectArrayMap<>();
for (Long2ObjectMap.Entry<SortedSet<DestroyBlockProgress>> entry : breakingProgressions.long2ObjectEntrySet()) { for (Long2ObjectMap.Entry<SortedSet<DestroyBlockProgress>> entry : breakingProgressions.long2ObjectEntrySet()) {
BlockPos breakingPos = BlockPos.fromLong(entry.getLongKey()); BlockPos breakingPos = BlockPos.of(entry.getLongKey());
SortedSet<DestroyBlockProgress> progresses = entry.getValue(); SortedSet<DestroyBlockProgress> progresses = entry.getValue();
if (progresses != null && !progresses.isEmpty()) { if (progresses != null && !progresses.isEmpty()) {
int blockDamage = progresses.last() int blockDamage = progresses.last()
.getPartialBlockDamage(); .getProgress();
TileEntity tileEntity = world.getTileEntity(breakingPos); TileEntity tileEntity = world.getBlockEntity(breakingPos);
if (tileEntity != null) { if (tileEntity != null) {
List<TileEntity> tileEntities = breakingEntities.computeIfAbsent(blockDamage, $ -> new ArrayList<>()); List<TileEntity> tileEntities = breakingEntities.computeIfAbsent(blockDamage, $ -> new ArrayList<>());

View file

@ -31,7 +31,7 @@ public class OrientedData extends BasicData {
} }
public OrientedData setPosition(Vector3f pos) { 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) { public OrientedData setPosition(float x, float y, float z) {
@ -56,11 +56,11 @@ public class OrientedData extends BasicData {
} }
public OrientedData setPivot(Vector3f pos) { 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) { 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) { public OrientedData setPivot(Vec3 pos) {
@ -76,7 +76,7 @@ public class OrientedData extends BasicData {
} }
public OrientedData setRotation(Quaternion q) { 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) { public OrientedData setRotation(float x, float y, float z, float w) {

View file

@ -166,25 +166,25 @@ public class PartBuilder {
public void quad(VecBuffer buffer, Vector3f[] vertices, float minU, float minV, float maxU, float maxV, Direction dir) { 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[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].getX(), vertices[1].getY(), vertices[1].getZ()).putVec3(nb(normal.getX()), nb(normal.getY()), nb(normal.getZ())).putVec2(minU, 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].getX(), vertices[2].getY(), vertices[2].getZ()).putVec3(nb(normal.getX()), nb(normal.getY()), nb(normal.getZ())).putVec2(minU, maxV); 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].getX(), vertices[3].getY(), vertices[3].getZ()).putVec3(nb(normal.getX()), nb(normal.getY()), nb(normal.getZ())).putVec2(maxU, 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) { public float getU(float u) {
if (sprite != null) if (sprite != null)
return sprite.getInterpolatedU(u * 16 / partBuilder.sizeU); return sprite.getU(u * 16 / partBuilder.sizeU);
else else
return u; return u;
} }
public float getV(float v) { public float getV(float v) {
if (sprite != null) if (sprite != null)
return sprite.getInterpolatedV(v * 16 / partBuilder.sizeV); return sprite.getV(v * 16 / partBuilder.sizeV);
else else
return v; return v;
} }

View file

@ -108,9 +108,9 @@ public class Readable {
} }
} }
this.normal = p_i225951_9_.getUnitVector(); this.normal = p_i225951_9_.step();
if (p_i225951_8_) { if (p_i225951_8_) {
this.normal.multiplyComponentwise(-1.0F, 1.0F, 1.0F); this.normal.mul(-1.0F, 1.0F, 1.0F);
} }
} }

View file

@ -8,23 +8,23 @@ public class GlFog {
public static float[] FOG_COLOR = new float[]{0, 0, 0, 0}; public static float[] FOG_COLOR = new float[]{0, 0, 0, 0};
public static boolean fogEnabled() { public static boolean fogEnabled() {
return GlStateManager.FOG.field_179049_a.field_179201_b; return GlStateManager.FOG.enable.enabled;
} }
public static int getFogModeGlEnum() { public static int getFogModeGlEnum() {
return GlStateManager.FOG.field_179047_b; return GlStateManager.FOG.mode;
} }
public static float getFogDensity() { public static float getFogDensity() {
return GlStateManager.FOG.field_179048_c; return GlStateManager.FOG.density;
} }
public static float getFogEnd() { public static float getFogEnd() {
return GlStateManager.FOG.field_179046_e; return GlStateManager.FOG.end;
} }
public static float getFogStart() { public static float getFogStart() {
return GlStateManager.FOG.field_179045_d; return GlStateManager.FOG.start;
} }
public static WorldFog getFogMode() { public static WorldFog getFogMode() {

View file

@ -13,13 +13,13 @@ public class EntityWorldHandler {
@SubscribeEvent @SubscribeEvent
public static void onEntityJoinWorld(EntityJoinWorldEvent event) { 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()); .queueAdd(event.getEntity());
} }
@SubscribeEvent @SubscribeEvent
public static void onEntityLeaveWorld(EntityLeaveWorldEvent event) { 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()); .remove(event.getEntity());
} }
} }

View file

@ -20,7 +20,7 @@ public class ForgeEvents {
@SubscribeEvent @SubscribeEvent
public static void addToDebugScreen(RenderGameOverlayEvent.Text event) { public static void addToDebugScreen(RenderGameOverlayEvent.Text event) {
if (Minecraft.getInstance().gameSettings.showDebugInfo) { if (Minecraft.getInstance().options.renderDebug) {
ArrayList<String> right = event.getRight(); ArrayList<String> right = event.getRight();

View file

@ -46,7 +46,7 @@ public class GridAlignedBB {
} }
public static GridAlignedBB from(SectionPos pos) { 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) { public static GridAlignedBB from(BlockPos start, BlockPos end) {
@ -122,8 +122,8 @@ public class GridAlignedBB {
} }
public void mirrorAbout(Direction.Axis axis) { public void mirrorAbout(Direction.Axis axis) {
Vector3i axisVec = Direction.getFacingFromAxis(Direction.AxisDirection.POSITIVE, axis) Vector3i axisVec = Direction.get(Direction.AxisDirection.POSITIVE, axis)
.getDirectionVec(); .getNormal();
int flipX = axisVec.getX() - 1; int flipX = axisVec.getX() - 1;
int flipY = axisVec.getY() - 1; int flipY = axisVec.getY() - 1;
int flipZ = axisVec.getZ() - 1; int flipZ = axisVec.getZ() - 1;

View file

@ -81,12 +81,12 @@ public class LightUpdater {
LongRBTreeSet sections = clearSections(listener); LongRBTreeSet sections = clearSections(listener);
LongRBTreeSet chunks = clearSections(listener); LongRBTreeSet chunks = clearSections(listener);
int minX = SectionPos.toChunk(volume.minX); int minX = SectionPos.blockToSectionCoord(volume.minX);
int minY = SectionPos.toChunk(volume.minY); int minY = SectionPos.blockToSectionCoord(volume.minY);
int minZ = SectionPos.toChunk(volume.minZ); int minZ = SectionPos.blockToSectionCoord(volume.minZ);
int maxX = SectionPos.toChunk(volume.maxX); int maxX = SectionPos.blockToSectionCoord(volume.maxX);
int maxY = SectionPos.toChunk(volume.maxY); int maxY = SectionPos.blockToSectionCoord(volume.maxY);
int maxZ = SectionPos.toChunk(volume.maxZ); int maxZ = SectionPos.blockToSectionCoord(volume.maxZ);
for (int x = minX; x <= maxX; x++) { for (int x = minX; x <= maxX; x++) {
for (int z = minZ; z <= maxZ; z++) { for (int z = minZ; z <= maxZ; z++) {
@ -114,7 +114,7 @@ public class LightUpdater {
if (set == null || set.isEmpty()) return; 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())); set.removeIf(listener -> listener.onLightUpdate(world, type, chunkBox.copy()));
} }

View file

@ -172,10 +172,10 @@ public class LightVolume {
int shiftZ = textureVolume.minZ; int shiftZ = textureVolume.minZ;
sampleVolume.forEachContained((x, y, z) -> { sampleVolume.forEachContained((x, y, z) -> {
pos.setPos(x, y, z); pos.set(x, y, z);
int blockLight = world.getLightLevel(LightType.BLOCK, pos); int blockLight = world.getBrightness(LightType.BLOCK, pos);
int skyLight = world.getLightLevel(LightType.SKY, pos); int skyLight = world.getBrightness(LightType.SKY, pos);
writeLight(x - shiftX, y - shiftY, z - shiftZ, blockLight, skyLight); writeLight(x - shiftX, y - shiftY, z - shiftZ, blockLight, skyLight);
}); });
@ -196,9 +196,9 @@ public class LightVolume {
int zShift = textureVolume.minZ; int zShift = textureVolume.minZ;
worldVolume.forEachContained((x, y, z) -> { 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); writeBlock(x - xShift, y - yShift, z - zShift, light);
}); });
@ -219,9 +219,9 @@ public class LightVolume {
int zShift = textureVolume.minZ; int zShift = textureVolume.minZ;
worldVolume.forEachContained((x, y, z) -> { 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); writeSky(x - xShift, y - yShift, z - zShift, light);
}); });
@ -242,10 +242,10 @@ public class LightVolume {
int zShift = textureVolume.minZ; int zShift = textureVolume.minZ;
worldVolume.forEachContained((x, y, z) -> { worldVolume.forEachContained((x, y, z) -> {
pos.setPos(x, y, z); pos.set(x, y, z);
int block = world.getLightLevel(LightType.BLOCK, pos); int block = world.getBrightness(LightType.BLOCK, pos);
int sky = world.getLightLevel(LightType.SKY, pos); int sky = world.getBrightness(LightType.SKY, pos);
writeLight(x - xShift, y - yShift, z - zShift, block, sky); writeLight(x - xShift, y - yShift, z - zShift, block, sky);
}); });

View file

@ -21,9 +21,9 @@ import net.minecraft.util.ClassInheritanceMultiMap;
public class CancelEntityRenderMixin { public class CancelEntityRenderMixin {
@Group(name = "entityFilter", min = 1, max = 1) @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<Entity> filterEntities(ClientWorld world) { private Iterable<Entity> filterEntities(ClientWorld world) {
Iterable<Entity> entities = world.getAllEntities(); Iterable<Entity> entities = world.entitiesForRendering();
if (Backend.getInstance() if (Backend.getInstance()
.canUseInstancing()) { .canUseInstancing()) {
@ -38,7 +38,7 @@ public class CancelEntityRenderMixin {
} }
@Group(name = "entityFilter") @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<Entity> filterEntitiesOF(ClassInheritanceMultiMap<Entity> classInheritanceMultiMap) { private Iterator<Entity> filterEntitiesOF(ClassInheritanceMultiMap<Entity> classInheritanceMultiMap) {
if (Backend.getInstance() if (Backend.getInstance()
.canUseInstancing()) { .canUseInstancing()) {

View file

@ -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")) @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) { 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);
} }
} }

View file

@ -49,8 +49,8 @@ public class RenderHooksMixin {
*/ */
@Inject(at = @At("TAIL"), method = "renderLayer") @Inject(at = @At("TAIL"), method = "renderLayer")
private void renderLayer(RenderType type, MatrixStack stack, double camX, double camY, double camZ, CallbackInfo ci) { private void renderLayer(RenderType type, MatrixStack stack, double camX, double camY, double camZ, CallbackInfo ci) {
Matrix4f view = stack.peek() Matrix4f view = stack.last()
.getModel(); .pose();
Matrix4f viewProjection = view.copy(); Matrix4f viewProjection = view.copy();
viewProjection.multiplyBackward(Backend.getInstance() viewProjection.multiplyBackward(Backend.getInstance()
.getProjectionMatrix()); .getProjectionMatrix());
@ -75,13 +75,13 @@ public class RenderHooksMixin {
if (!Backend.getInstance() if (!Backend.getInstance()
.available()) return; .available()) return;
Matrix4f view = stack.peek() Matrix4f view = stack.last()
.getModel(); .pose();
Matrix4f viewProjection = view.copy(); Matrix4f viewProjection = view.copy();
viewProjection.multiplyBackward(Backend.getInstance() viewProjection.multiplyBackward(Backend.getInstance()
.getProjectionMatrix()); .getProjectionMatrix());
Vector3d cameraPos = info.getProjectedView(); Vector3d cameraPos = info.getPosition();
CrumblingRenderer.renderBreaking(world, viewProjection, cameraPos.x, cameraPos.y, cameraPos.z); CrumblingRenderer.renderBreaking(world, viewProjection, cameraPos.x, cameraPos.y, cameraPos.z);
if (!OptifineHandler.usingShaders()) GL20.glUseProgram(0); if (!OptifineHandler.usingShaders()) GL20.glUseProgram(0);
@ -92,6 +92,6 @@ public class RenderHooksMixin {
@Inject(at = @At("TAIL"), method = "scheduleBlockRerenderIfNeeded") @Inject(at = @At("TAIL"), method = "scheduleBlockRerenderIfNeeded")
private void checkUpdate(BlockPos pos, BlockState lastState, BlockState newState, CallbackInfo ci) { private void checkUpdate(BlockPos pos, BlockState lastState, BlockState newState, CallbackInfo ci) {
InstancedRenderDispatcher.getTiles(world) InstancedRenderDispatcher.getTiles(world)
.update(world.getTileEntity(pos)); .update(world.getBlockEntity(pos));
} }
} }

View file

@ -36,25 +36,25 @@ public abstract class LightUpdateMixin extends AbstractChunkProvider {
@Inject(at = @At("HEAD"), method = "markLightChanged") @Inject(at = @At("HEAD"), method = "markLightChanged")
private void onLightUpdate(LightType type, SectionPos pos, CallbackInfo ci) { private void onLightUpdate(LightType type, SectionPos pos, CallbackInfo ci) {
ClientChunkProvider thi = ((ClientChunkProvider) (Object) this); 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)) { if (ChunkUtil.isValidSection(chunk, sectionY)) {
InstanceManager<TileEntity> tiles = InstancedRenderDispatcher.getTiles(world); InstanceManager<TileEntity> tiles = InstancedRenderDispatcher.getTiles(world);
InstanceManager<Entity> entities = InstancedRenderDispatcher.getEntities(world); InstanceManager<Entity> entities = InstancedRenderDispatcher.getEntities(world);
chunk.getTileEntityMap() chunk.getBlockEntities()
.entrySet() .entrySet()
.stream() .stream()
.filter(entry -> SectionPos.toChunk(entry.getKey() .filter(entry -> SectionPos.blockToSectionCoord(entry.getKey()
.getY()) == sectionY) .getY()) == sectionY)
.map(Map.Entry::getValue) .map(Map.Entry::getValue)
.forEach(tiles::onLightUpdate); .forEach(tiles::onLightUpdate);
chunk.getEntityLists()[sectionY].forEach(entities::onLightUpdate); chunk.getEntitySections()[sectionY].forEach(entities::onLightUpdate);
} }
LightUpdater.getInstance() LightUpdater.getInstance()

View file

@ -27,25 +27,25 @@ public class NetworkLightUpdateMixin {
@Inject(at = @At("TAIL"), method = "handleUpdateLight") @Inject(at = @At("TAIL"), method = "handleUpdateLight")
private void onLightPacket(SUpdateLightPacket packet, CallbackInfo ci) { private void onLightPacket(SUpdateLightPacket packet, CallbackInfo ci) {
RenderWork.enqueue(() -> { RenderWork.enqueue(() -> {
ClientWorld world = Minecraft.getInstance().world; ClientWorld world = Minecraft.getInstance().level;
if (world == null) return; if (world == null) return;
int chunkX = packet.getChunkX(); int chunkX = packet.getX();
int chunkZ = packet.getChunkZ(); int chunkZ = packet.getZ();
Chunk chunk = world.getChunkProvider() Chunk chunk = world.getChunkSource()
.getChunk(chunkX, chunkZ, false); .getChunk(chunkX, chunkZ, false);
if (chunk != null) { if (chunk != null) {
InstanceManager<TileEntity> tiles = InstancedRenderDispatcher.getTiles(world); InstanceManager<TileEntity> tiles = InstancedRenderDispatcher.getTiles(world);
InstanceManager<Entity> entities = InstancedRenderDispatcher.getEntities(world); InstanceManager<Entity> entities = InstancedRenderDispatcher.getEntities(world);
chunk.getTileEntityMap() chunk.getBlockEntities()
.values() .values()
.forEach(tiles::onLightUpdate); .forEach(tiles::onLightUpdate);
Arrays.stream(chunk.getEntityLists()) Arrays.stream(chunk.getEntitySections())
.flatMap(ClassInheritanceMultiMap::stream) .flatMap(ClassInheritanceMultiMap::stream)
.forEach(entities::onLightUpdate); .forEach(entities::onLightUpdate);
} }

View file

@ -9,7 +9,7 @@ public class AngleHelper {
* Legacy method. See {@link #horizontalAngleNew(Direction)} for new method. * Legacy method. See {@link #horizontalAngleNew(Direction)} for new method.
*/ */
public static float horizontalAngle(Direction facing) { public static float horizontalAngle(Direction facing) {
float angle = facing.getHorizontalAngle(); float angle = facing.toYRot();
if (facing.getAxis() == Axis.X) angle = -angle; if (facing.getAxis() == Axis.X) angle = -angle;
return angle; return angle;
} }
@ -22,7 +22,7 @@ public class AngleHelper {
.isVertical()) { .isVertical()) {
return 0; return 0;
} }
float angle = facing.getHorizontalAngle(); float angle = facing.toYRot();
if (facing.getAxis() == Axis.X) angle = -angle; if (facing.getAxis() == Axis.X) angle = -angle;
return angle; return angle;
} }

View file

@ -14,7 +14,7 @@ public class AnimationTickHolder {
public static void tick() { public static void tick() {
if (!Minecraft.getInstance() if (!Minecraft.getInstance()
.isGamePaused()) { .isPaused()) {
ticks = (ticks + 1) % 1_728_000; // wrap around every 24 hours so we maintain enough floating point precision ticks = (ticks + 1) % 1_728_000; // wrap around every 24 hours so we maintain enough floating point precision
} else { } else {
paused_ticks = (paused_ticks + 1) % 1_728_000; paused_ticks = (paused_ticks + 1) % 1_728_000;
@ -35,6 +35,6 @@ public class AnimationTickHolder {
public static float getPartialTicks() { public static float getPartialTicks() {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
return (mc.isGamePaused() ? mc.renderPartialTicksPaused : mc.getRenderPartialTicks()); return (mc.isPaused() ? mc.pausePartialTick : mc.getFrameTime());
} }
} }

View file

@ -17,12 +17,12 @@ public class BakedQuadWrapper {
public BakedQuadWrapper(BakedQuad quad) { public BakedQuadWrapper(BakedQuad quad) {
this.quad = quad; this.quad = quad;
this.vertexData = quad.getVertexData(); this.vertexData = quad.getVertices();
} }
public void setQuad(BakedQuad quad) { public void setQuad(BakedQuad quad) {
this.quad = quad; this.quad = quad;
this.vertexData = this.quad.getVertexData(); this.vertexData = this.quad.getVertices();
} }
public static BakedQuadWrapper of(BakedQuad quad) { public static BakedQuadWrapper of(BakedQuad quad) {
@ -125,7 +125,7 @@ public class BakedQuadWrapper {
} }
public void setPos(int vertexIndex, Vector3f pos) { 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) { public void setColor(int vertexIndex, int color) {
@ -172,7 +172,7 @@ public class BakedQuadWrapper {
} }
public void setNormal(int vertexIndex, Vector3f normal) { 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 { private static class FormatCache {

View file

@ -16,13 +16,13 @@ public class BufferBuilderReader {
public BufferBuilderReader(BufferBuilder builder) { public BufferBuilderReader(BufferBuilder builder) {
VertexFormat vertexFormat = builder.getVertexFormat(); VertexFormat vertexFormat = builder.getVertexFormat();
Pair<BufferBuilder.DrawState, ByteBuffer> data = builder.popData(); Pair<BufferBuilder.DrawState, ByteBuffer> data = builder.popNextBuffer();
buffer = data.getSecond(); buffer = data.getSecond();
formatSize = vertexFormat.getSize(); formatSize = vertexFormat.getVertexSize();
vertexCount = data.getFirst() vertexCount = data.getFirst()
.getCount(); .vertexCount();
size = vertexCount * formatSize; size = vertexCount * formatSize;

View file

@ -29,18 +29,18 @@ public class RenderUtil {
} }
public static float[] writeMatrixStack(MatrixStack stack) { public static float[] writeMatrixStack(MatrixStack stack) {
return writeMatrixStack(stack.peek() return writeMatrixStack(stack.last()
.getModel(), stack.peek() .pose(), stack.last()
.getNormal()); .normal());
} }
// GPUs want matrices in column major order. // GPUs want matrices in column major order.
public static float[] writeMatrixStack(Matrix4f model, Matrix3f normal) { 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) { 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<MatrixStack> rotateToFace(Direction facing) { public static Supplier<MatrixStack> rotateToFace(Direction facing) {
@ -51,11 +51,11 @@ public class RenderUtil {
// .rotateY(AngleHelper.horizontalAngle(facing)) // .rotateY(AngleHelper.horizontalAngle(facing))
// .rotateX(AngleHelper.verticalAngle(facing)) // .rotateX(AngleHelper.verticalAngle(facing))
// .unCentre(); // .unCentre();
stack.peek() stack.last()
.getModel() .pose()
.setTranslation(0.5f, 0.5f, 0.5f); .setTranslation(0.5f, 0.5f, 0.5f);
stack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(AngleHelper.horizontalAngle(facing))); stack.mulPose(Vector3f.YP.rotationDegrees(AngleHelper.horizontalAngle(facing)));
stack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(AngleHelper.verticalAngle(facing))); stack.mulPose(Vector3f.XP.rotationDegrees(AngleHelper.verticalAngle(facing)));
stack.translate(-0.5f, -0.5f, -0.5f); stack.translate(-0.5f, -0.5f, -0.5f);
return stack; return stack;
}; };

View file

@ -20,7 +20,7 @@ public class MatrixTransformStack implements TransformStack {
@Override @Override
public TransformStack multiply(Quaternion quaternion) { public TransformStack multiply(Quaternion quaternion) {
internal.multiply(quaternion); internal.mulPose(quaternion);
return this; return this;
} }

View file

@ -20,26 +20,26 @@ public interface TransformStack {
default TransformStack rotate(Direction axis, float radians) { default TransformStack rotate(Direction axis, float radians) {
if (radians == 0) if (radians == 0)
return this; return this;
return multiply(axis.getUnitVector() return multiply(axis.step()
.getRadialQuaternion(radians)); .rotation(radians));
} }
default TransformStack rotate(double angle, Direction.Axis axis) { default TransformStack rotate(double angle, Direction.Axis axis) {
Vector3f vec = 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); return multiply(vec, angle);
} }
default TransformStack rotateX(double angle) { default TransformStack rotateX(double angle) {
return multiply(Vector3f.POSITIVE_X, angle); return multiply(Vector3f.XP, angle);
} }
default TransformStack rotateY(double angle) { default TransformStack rotateY(double angle) {
return multiply(Vector3f.POSITIVE_Y, angle); return multiply(Vector3f.YP, angle);
} }
default TransformStack rotateZ(double angle) { default TransformStack rotateZ(double angle) {
return multiply(Vector3f.POSITIVE_Z, angle); return multiply(Vector3f.ZP, angle);
} }
default TransformStack centre() { default TransformStack centre() {
@ -74,6 +74,6 @@ public interface TransformStack {
default TransformStack multiply(Vector3f axis, double angle) { default TransformStack multiply(Vector3f axis, double angle) {
if (angle == 0) if (angle == 0)
return this; return this;
return multiply(axis.getDegreesQuaternion((float) angle)); return multiply(axis.rotationDegrees((float) angle));
} }
} }

View file

@ -29,11 +29,11 @@ public class Vec4 {
public Vec4 multiply(Quaternion quat) { public Vec4 multiply(Quaternion quat) {
Quaternion quaternion = new 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); Quaternion quaternion1 = new Quaternion(quat);
quaternion1.conjugate(); quaternion1.conj();
quaternion.multiply(quaternion1); quaternion.mul(quaternion1);
return set(quaternion.getX(), quaternion.getY(), quaternion.getZ(), this.getW()); return set(quaternion.i(), quaternion.j(), quaternion.k(), this.getW());
} }
public Vec3 xyz() { public Vec3 xyz() {

View file

@ -31,19 +31,19 @@ public class BellInstance extends TileEntityInstance<BellTileEntity> implements
@Override @Override
public void beginFrame() { public void beginFrame() {
float ringTime = (float)tile.ringingTicks + AnimationTickHolder.getPartialTicks(); float ringTime = (float)tile.ticks + AnimationTickHolder.getPartialTicks();
if (ringTime == lastRingTime) return; if (ringTime == lastRingTime) return;
lastRingTime = ringTime; lastRingTime = ringTime;
if (tile.isRinging) { if (tile.shaking) {
float angle = MathHelper.sin(ringTime / (float) Math.PI) / (4.0F + ringTime / 3.0F); 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 { } else {
bell.setRotation(Quaternion.IDENTITY); bell.setRotation(Quaternion.ONE);
} }
} }
@ -65,7 +65,7 @@ public class BellInstance extends TileEntityInstance<BellTileEntity> implements
private static BufferedModel createBellModel() { private static BufferedModel createBellModel() {
return ModelPart.builder(32, 32) return ModelPart.builder(32, 32)
.sprite(BellTileEntityRenderer.field_217653_c.getSprite()) .sprite(BellTileEntityRenderer.BELL_RESOURCE_LOCATION.sprite())
.cuboid() .cuboid()
.start(5.0F, 6.0F, 5.0F) .start(5.0F, 6.0F, 5.0F)
.size(6.0F, 7.0F, 6.0F) .size(6.0F, 7.0F, 6.0F)

View file

@ -47,8 +47,8 @@ public class ChestInstance<T extends TileEntity & IChestLid> extends TileEntityI
Block block = blockState.getBlock(); Block block = blockState.getBlock();
chestType = blockState.contains(ChestBlock.TYPE) ? blockState.get(ChestBlock.TYPE) : ChestType.SINGLE; chestType = blockState.hasProperty(ChestBlock.TYPE) ? blockState.getValue(ChestBlock.TYPE) : ChestType.SINGLE;
renderMaterial = Atlases.getChestTexture(tile, chestType, isChristmas()); renderMaterial = Atlases.chooseMaterial(tile, chestType, isChristmas());
body = baseInstance() body = baseInstance()
.setPosition(getInstancePosition()); .setPosition(getInstancePosition());
@ -59,21 +59,21 @@ public class ChestInstance<T extends TileEntity & IChestLid> extends TileEntityI
// MatrixStack stack = new MatrixStack(); // MatrixStack stack = new MatrixStack();
// //
// stack.push(); // 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); body.setRotation(baseRotation);
AbstractChestBlock<?> chestBlock = (AbstractChestBlock<?>) block; AbstractChestBlock<?> chestBlock = (AbstractChestBlock<?>) block;
TileEntityMerger.ICallbackWrapper<? extends ChestTileEntity> wrapper = chestBlock.getBlockEntitySource(blockState, world, getWorldPosition(), true); TileEntityMerger.ICallbackWrapper<? extends ChestTileEntity> wrapper = chestBlock.combine(blockState, world, getWorldPosition(), true);
this.lidProgress = wrapper.apply(ChestBlock.getAnimationProgressRetriever(tile)); this.lidProgress = wrapper.apply(ChestBlock.opennessCombiner(tile));
} else { } else {
baseRotation = Quaternion.IDENTITY; baseRotation = Quaternion.ONE;
lidProgress = $ -> 0f; lidProgress = $ -> 0f;
} }
} }
@ -99,7 +99,7 @@ public class ChestInstance<T extends TileEntity & IChestLid> extends TileEntityI
.multiply(baseRotation) .multiply(baseRotation)
.unCentre() .unCentre()
.translate(0, 0, 1f / 16f) .translate(0, 0, 1f / 16f)
.multiply(Vector3f.POSITIVE_X.getRadialQuaternion(angleX)) .multiply(Vector3f.XP.rotation(angleX))
.translate(0, 0, -1f / 16f); .translate(0, 0, -1f / 16f);
lid.setTransform(stack.unwrap()); lid.setTransform(stack.unwrap());
@ -119,15 +119,15 @@ public class ChestInstance<T extends TileEntity & IChestLid> extends TileEntityI
private OrientedData baseInstance() { private OrientedData baseInstance() {
return materialManager.getMaterial(Materials.ORIENTED, renderMaterial.getAtlasId()) return materialManager.getMaterial(Materials.ORIENTED, renderMaterial.atlasLocation())
.get("base_" + renderMaterial.getTextureId(), this::getBaseModel) .get("base_" + renderMaterial.texture(), this::getBaseModel)
.createInstance(); .createInstance();
} }
private ModelData lidInstance() { private ModelData lidInstance() {
return materialManager.getMaterial(Materials.TRANSFORMED, renderMaterial.getAtlasId()) return materialManager.getMaterial(Materials.TRANSFORMED, renderMaterial.atlasLocation())
.get("lid_" + renderMaterial.getTextureId(), this::getLidModel) .get("lid_" + renderMaterial.texture(), this::getLidModel)
.createInstance(); .createInstance();
} }
@ -136,7 +136,7 @@ public class ChestInstance<T extends TileEntity & IChestLid> extends TileEntityI
switch (chestType) { switch (chestType) {
case LEFT: case LEFT:
return ModelPart.builder(64, 64) return ModelPart.builder(64, 64)
.sprite(renderMaterial.getSprite()) .sprite(renderMaterial.sprite())
.cuboid() .cuboid()
.textureOffset(0, 19) .textureOffset(0, 19)
.start(0, 0, 1) .start(0, 0, 1)
@ -145,7 +145,7 @@ public class ChestInstance<T extends TileEntity & IChestLid> extends TileEntityI
.build(); .build();
case RIGHT: case RIGHT:
return ModelPart.builder(64, 64) return ModelPart.builder(64, 64)
.sprite(renderMaterial.getSprite()) .sprite(renderMaterial.sprite())
.cuboid() .cuboid()
.textureOffset(0, 19) .textureOffset(0, 19)
.start(1, 0, 1) .start(1, 0, 1)
@ -155,7 +155,7 @@ public class ChestInstance<T extends TileEntity & IChestLid> extends TileEntityI
} }
return ModelPart.builder(64, 64) return ModelPart.builder(64, 64)
.sprite(renderMaterial.getSprite()) .sprite(renderMaterial.sprite())
.cuboid() .cuboid()
.textureOffset(0, 19) .textureOffset(0, 19)
.start(1, 0, 1) .start(1, 0, 1)
@ -169,7 +169,7 @@ public class ChestInstance<T extends TileEntity & IChestLid> extends TileEntityI
switch (chestType) { switch (chestType) {
case LEFT: case LEFT:
return ModelPart.builder(64, 64) return ModelPart.builder(64, 64)
.sprite(renderMaterial.getSprite()) .sprite(renderMaterial.sprite())
.cuboid() .cuboid()
.textureOffset(0, 0) .textureOffset(0, 0)
.start(0, 0, 1) .start(0, 0, 1)
@ -182,7 +182,7 @@ public class ChestInstance<T extends TileEntity & IChestLid> extends TileEntityI
.build(); .build();
case RIGHT: case RIGHT:
return ModelPart.builder(64, 64) return ModelPart.builder(64, 64)
.sprite(renderMaterial.getSprite()) .sprite(renderMaterial.sprite())
.cuboid() .cuboid()
.textureOffset(0, 0) .textureOffset(0, 0)
.start(1, 0, 1) .start(1, 0, 1)
@ -196,7 +196,7 @@ public class ChestInstance<T extends TileEntity & IChestLid> extends TileEntityI
} }
return ModelPart.builder(64, 64) return ModelPart.builder(64, 64)
.sprite(renderMaterial.getSprite()) .sprite(renderMaterial.sprite())
.cuboid() .cuboid()
.textureOffset(0, 0) .textureOffset(0, 0)
.start(1, 0, 1) .start(1, 0, 1)