Skip to content

Commit

Permalink
Backport to Minecraft 1.16.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmangohands committed Nov 5, 2020
1 parent 7a82d73 commit d938f3b
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.5.28'
id 'fabric-loom' version '0.5-SNAPSHOT'
}

sourceCompatibility = JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -77,4 +77,4 @@ task sourcesJar(type: Jar, dependsOn: classes) {

jar {
from "LICENSE.txt"
}
}
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.16.4
yarn_mappings=1.16.4+build.1
minecraft_version=1.16.1
yarn_mappings=1.16.1+build.21
loader_version=0.10.6+build.214

# Mod Properties
Expand All @@ -14,4 +14,4 @@ archives_base_name=sodium-fabric

# If true, third-party mods will be loaded during runtime in the developer run configurations
use_third_party_mods = true
databreaker_version = 0.2.6
databreaker_version = 0.2.6
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import net.minecraft.client.options.AttackIndicator;
import net.minecraft.client.options.GraphicsMode;
import net.minecraft.client.options.Option;
import net.minecraft.client.options.ParticlesMode;
import net.minecraft.client.options.ParticlesOption;
import net.minecraft.client.util.Window;

import java.util.ArrayList;
Expand Down Expand Up @@ -165,10 +165,10 @@ public static OptionPage quality() {
.setBinding((opts, value) -> opts.quality.weatherQuality = value, opts -> opts.quality.weatherQuality)
.setImpact(OptionImpact.MEDIUM)
.build())
.add(OptionImpl.createBuilder(ParticlesMode.class, vanillaOpts)
.add(OptionImpl.createBuilder(ParticlesOption.class, vanillaOpts)
.setName("Particle Quality")
.setTooltip("Controls the maximum number of particles which can be present on screen at any one time.")
.setControl(opt -> new CyclingControl<>(opt, ParticlesMode.class, new String[] { "High", "Medium", "Low" }))
.setControl(opt -> new CyclingControl<>(opt, ParticlesOption.class, new String[] { "High", "Medium", "Low" }))
.setBinding((opts, value) -> opts.particles = value, (opts) -> opts.particles)
.setImpact(OptionImpact.MEDIUM)
.build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
import net.minecraft.client.gui.screen.VideoOptionsScreen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
import net.minecraft.text.OrderedText;
import net.minecraft.text.StringRenderable;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Formatting;
import net.minecraft.util.Language;
import org.lwjgl.glfw.GLFW;

import java.util.ArrayList;
Expand Down Expand Up @@ -193,12 +192,12 @@ private void renderOptionTooltip(MatrixStack matrixStack, ControlElement<?> elem
int boxX = dim.getLimitX() + boxPadding;

Option<?> option = element.getOption();
List<OrderedText> tooltip = new ArrayList<>(this.textRenderer.wrapLines(option.getTooltip(), boxWidth - (textPadding * 2)));
List<StringRenderable> tooltip = new ArrayList<>(this.textRenderer.wrapLines(option.getTooltip(), boxWidth - (textPadding * 2)));

OptionImpact impact = option.getImpact();

if (impact != null) {
tooltip.add(Language.getInstance().reorder(new LiteralText(Formatting.GRAY + "Performance Impact: " + impact.toDisplayString())));
tooltip.add(new LiteralText(Formatting.GRAY + "Performance Impact: " + impact.toDisplayString()));
}

int boxHeight = (tooltip.size() * 12) + boxPadding;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public void renderTileEntities(MatrixStack matrices, BufferBuilderStorage buffer

if (stage >= 0) {
MatrixStack.Entry entry = matrices.peek();
VertexConsumer transformer = new OverlayVertexConsumer(bufferBuilders.getEffectVertexConsumers().getBuffer(ModelLoader.BLOCK_DESTRUCTION_RENDER_LAYERS.get(stage)), entry.getModel(), entry.getNormal());
VertexConsumer transformer = new TransformingVertexConsumer(bufferBuilders.getEffectVertexConsumers().getBuffer(ModelLoader.BLOCK_DESTRUCTION_RENDER_LAYERS.get(stage)), entry.getModel(), entry.getNormal());
consumer = (layer) -> layer.hasCrumbling() ? VertexConsumers.dual(transformer, immediate.getBuffer(layer)) : immediate.getBuffer(layer);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,9 @@ private void unloadChunk(int x, int z) {
}

private ChunkRenderContainer<T> createChunkRender(long pos) {
int x = ChunkSectionPos.unpackX(pos);
int y = ChunkSectionPos.unpackY(pos);
int z = ChunkSectionPos.unpackZ(pos);
int x = ChunkSectionPos.getX(pos);
int y = ChunkSectionPos.getY(pos);
int z = ChunkSectionPos.getZ(pos);

ChunkRenderContainer<T> render = new ChunkRenderContainer<>(this.backend, this.renderer, x, y, z);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,13 @@ public void setListener(ChunkStatusListener listener) {
private void onChunkLoaded(int x, int z, WorldChunk chunk) {
// [VanillaCopy] Mark the chunk as eligible for block and sky lighting
LightingProvider lightEngine = this.getLightingProvider();
lightEngine.setColumnEnabled(new ChunkPos(x, z), true);
lightEngine.setLightEnabled(new ChunkPos(x, z), true);

ChunkSection[] sections = chunk.getSectionArray();

// [VanillaCopy] Notify the light engine that this chunk's sections have been updated
for (int y = 0; y < sections.length; ++y) {
lightEngine.setSectionStatus(ChunkSectionPos.from(x, y, z), ChunkSection.isEmpty(sections[y]));
lightEngine.updateSectionStatus(ChunkSectionPos.from(x, y, z), ChunkSection.isEmpty(sections[y]));
}

// Sodium doesn't actually use vanilla's global color cache, but we keep it around for compatibility purposes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ public void init(ChunkBuilder<?> builder, World world, ChunkSectionPos chunkPos,
ChunkSectionPos sectionPos = ChunkSectionPos.from(chunkX, chunkY, chunkZ);
int sectionIdx = getLocalSectionIndex(chunkXLocal, chunkYLocal, chunkZLocal);

this.blockLightArrays[sectionIdx] = blockLightProvider.getLightSection(sectionPos);
this.skyLightArrays[sectionIdx] = skyLightProvider.getLightSection(sectionPos);
this.blockLightArrays[sectionIdx] = blockLightProvider.getLightArray(sectionPos);
this.skyLightArrays[sectionIdx] = skyLightProvider.getLightArray(sectionPos);

ChunkSection section = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public abstract class MixinClientWorld implements ClientWorldExtended {
* Captures the biome generation seed so that our own caches can make use of it.
*/
@Inject(method = "<init>", at = @At("RETURN"))
private void init(ClientPlayNetworkHandler clientPlayNetworkHandler, ClientWorld.Properties properties, RegistryKey<World> registryKey, DimensionType dimensionType, int i, Supplier<Profiler> supplier, WorldRenderer worldRenderer, boolean bl, long seed, CallbackInfo ci) {
private void init(ClientPlayNetworkHandler clientPlayNetworkHandler, ClientWorld.Properties properties, RegistryKey<World> registryKey, RegistryKey<DimensionType> registryKey2, DimensionType dimensionType, int i, Supplier<Profiler> supplier, WorldRenderer worldRenderer, boolean bl, long seed, CallbackInfo ci) {
this.biomeSeed = seed;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ public abstract class MixinClientWorld extends World {
protected abstract void addParticle(BlockPos pos, BlockState state, ParticleEffect parameters, boolean bl);

protected MixinClientWorld(MutableWorldProperties mutableWorldProperties, RegistryKey<World> registryKey,
DimensionType dimensionType, Supplier<Profiler> profiler, boolean bl, boolean bl2, long l) {
super(mutableWorldProperties, registryKey, dimensionType, profiler, bl, bl2, l);
RegistryKey<DimensionType> registryKey2, DimensionType dimensionType,
Supplier<Profiler> profiler, boolean bl, boolean bl2, long l) {
super(mutableWorldProperties, registryKey, registryKey2, dimensionType, profiler, bl, bl2, l);
}

@Redirect(method = "doRandomBlockDisplayTicks", at = @At(value = "NEW", target = "java/util/Random"))
Expand Down Expand Up @@ -87,7 +88,7 @@ private void performBiomeParticleDisplayTick(BlockPos pos, Random random) {
.orElse(null);

if (config != null && config.shouldAddParticle(random)) {
this.addParticle(config.getParticle(),
this.addParticle(config.getParticleType(),
pos.getX() + random.nextDouble(),
pos.getY() + random.nextDouble(),
pos.getZ() + random.nextDouble(),
Expand Down

0 comments on commit d938f3b

Please sign in to comment.