mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-23 11:27:54 +01:00
Remap to Mojmap, update gradle
This commit is contained in:
parent
dfbba8e3d0
commit
09e52e974f
51 changed files with 248 additions and 218 deletions
|
@ -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 {
|
||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -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
|
||||
|
|
22
gradlew
vendored
22
gradlew
vendored
|
@ -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"`
|
||||
|
|
18
gradlew.bat
vendored
18
gradlew.bat
vendored
|
@ -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
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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<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) {
|
||||
try {
|
||||
|
@ -149,7 +149,7 @@ public class ShaderSources implements ISelectiveResourceReloadListener {
|
|||
}
|
||||
|
||||
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) {
|
||||
if (s.endsWith(ext)) return true;
|
||||
}
|
||||
|
|
|
@ -82,15 +82,15 @@ public abstract class InstanceManager<T> 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()
|
||||
|
|
|
@ -109,8 +109,8 @@ public class InstanceMaterial<D extends InstanceData> {
|
|||
|
||||
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<D extends InstanceData> {
|
|||
|
||||
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<D extends InstanceData> {
|
|||
// .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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<TileEntity> tiles = tileInstanceManager.replace(world);
|
||||
world.loadedTileEntityList.forEach(tiles::add);
|
||||
world.blockEntityList.forEach(tiles::add);
|
||||
|
||||
InstanceManager<Entity> entities = entityInstanceManager.replace(world);
|
||||
world.getAllEntities()
|
||||
world.entitiesForRendering()
|
||||
.forEach(entities::add);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ public class MaterialManager<P extends WorldProgram> {
|
|||
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<P extends WorldProgram> {
|
|||
}
|
||||
|
||||
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()) {
|
||||
materialRenderer.render(layer, translate, camX, camY, camZ, callback);
|
||||
|
@ -149,9 +149,9 @@ public class MaterialManager<P extends WorldProgram> {
|
|||
}
|
||||
|
||||
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();
|
||||
|
|
|
@ -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) {
|
||||
if (!(layer == RenderType.getCutoutMipped())) return;
|
||||
if (!(layer == RenderType.cutoutMipped())) return;
|
||||
|
||||
if (material.nothingToRender()) return;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ public class MaterialSpec<D extends InstanceData> {
|
|||
private final ResourceLocation texture;
|
||||
|
||||
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) {
|
||||
|
|
|
@ -46,7 +46,7 @@ public abstract class EntityInstance<E extends Entity> 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<E extends Entity> 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 <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) {
|
||||
|
|
|
@ -32,14 +32,14 @@ public class EntityInstanceManager extends InstanceManager<Entity> {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -47,8 +47,8 @@ public abstract class TileEntityInstance<T extends TileEntity> 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<T extends TileEntity> 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 <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) {
|
||||
|
|
|
@ -32,16 +32,16 @@ public class TileInstanceManager extends InstanceManager<TileEntity> {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}));
|
||||
|
|
|
@ -11,7 +11,7 @@ public class FlwCommands {
|
|||
@SubscribeEvent
|
||||
public static void onServerStarting(FMLServerStartingEvent event) {
|
||||
CommandDispatcher<CommandSource> dispatcher = event.getServer()
|
||||
.getCommandManager()
|
||||
.getCommands()
|
||||
.getDispatcher();
|
||||
|
||||
dispatcher.register(Commands.literal("flywheel")
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -40,15 +40,15 @@ public class CrumblingMaterialManager extends MaterialManager<CrumblingProgram>
|
|||
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<CrumblingProgram> material : atlasRenderers) {
|
||||
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()) {
|
||||
glBindTexture(GL_TEXTURE_2D, textureManager.getTexture(entry.getKey())
|
||||
.getGlTextureId());
|
||||
.getId());
|
||||
SheetData atlasData = AtlasInfo.getAtlasData(entry.getKey());
|
||||
for (MaterialRenderer<CrumblingProgram> materialRenderer : entry.getValue()) {
|
||||
materialRenderer.render(layer, translate, camX, camY, camZ, p -> p.setAtlasSize(atlasData.width, atlasData.height));
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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<TileEntity> renderer = state.instanceManager;
|
||||
|
||||
TextureManager textureManager = Minecraft.getInstance().textureManager;
|
||||
ActiveRenderInfo info = Minecraft.getInstance().gameRenderer.getActiveRenderInfo();
|
||||
ActiveRenderInfo info = Minecraft.getInstance().gameRenderer.getMainCamera();
|
||||
|
||||
MaterialManager<CrumblingProgram> materials = state.materialManager;
|
||||
crumblingLayer.startDrawing();
|
||||
crumblingLayer.setupRenderState();
|
||||
|
||||
for (Int2ObjectMap.Entry<List<TileEntity>> 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<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<>();
|
||||
|
||||
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();
|
||||
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<TileEntity> tileEntities = breakingEntities.computeIfAbsent(blockDamage, $ -> new ArrayList<>());
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<String> right = event.getRight();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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<Entity> filterEntities(ClientWorld world) {
|
||||
Iterable<Entity> entities = world.getAllEntities();
|
||||
Iterable<Entity> 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<Entity> filterEntitiesOF(ClassInheritanceMultiMap<Entity> classInheritanceMultiMap) {
|
||||
if (Backend.getInstance()
|
||||
.canUseInstancing()) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<TileEntity> tiles = InstancedRenderDispatcher.getTiles(world);
|
||||
InstanceManager<Entity> 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()
|
||||
|
|
|
@ -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<TileEntity> tiles = InstancedRenderDispatcher.getTiles(world);
|
||||
InstanceManager<Entity> 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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -16,13 +16,13 @@ public class BufferBuilderReader {
|
|||
|
||||
public BufferBuilderReader(BufferBuilder builder) {
|
||||
VertexFormat vertexFormat = builder.getVertexFormat();
|
||||
Pair<BufferBuilder.DrawState, ByteBuffer> data = builder.popData();
|
||||
Pair<BufferBuilder.DrawState, ByteBuffer> data = builder.popNextBuffer();
|
||||
buffer = data.getSecond();
|
||||
|
||||
formatSize = vertexFormat.getSize();
|
||||
formatSize = vertexFormat.getVertexSize();
|
||||
|
||||
vertexCount = data.getFirst()
|
||||
.getCount();
|
||||
.vertexCount();
|
||||
|
||||
size = vertexCount * formatSize;
|
||||
|
||||
|
|
|
@ -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<MatrixStack> 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;
|
||||
};
|
||||
|
|
|
@ -20,7 +20,7 @@ public class MatrixTransformStack implements TransformStack {
|
|||
|
||||
@Override
|
||||
public TransformStack multiply(Quaternion quaternion) {
|
||||
internal.multiply(quaternion);
|
||||
internal.mulPose(quaternion);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -31,19 +31,19 @@ public class BellInstance extends TileEntityInstance<BellTileEntity> 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<BellTileEntity> 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)
|
||||
|
|
|
@ -47,8 +47,8 @@ public class ChestInstance<T extends TileEntity & IChestLid> 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<T extends TileEntity & IChestLid> 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<? 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 {
|
||||
baseRotation = Quaternion.IDENTITY;
|
||||
baseRotation = Quaternion.ONE;
|
||||
lidProgress = $ -> 0f;
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public class ChestInstance<T extends TileEntity & IChestLid> 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<T extends TileEntity & IChestLid> 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<T extends TileEntity & IChestLid> 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<T extends TileEntity & IChestLid> 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<T extends TileEntity & IChestLid> 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<T extends TileEntity & IChestLid> 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<T extends TileEntity & IChestLid> 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<T extends TileEntity & IChestLid> extends TileEntityI
|
|||
}
|
||||
|
||||
return ModelPart.builder(64, 64)
|
||||
.sprite(renderMaterial.getSprite())
|
||||
.sprite(renderMaterial.sprite())
|
||||
.cuboid()
|
||||
.textureOffset(0, 0)
|
||||
.start(1, 0, 1)
|
||||
|
|
Loading…
Reference in a new issue