Skip to content

Commit

Permalink
Fix ModernFix compatibility issues, and some other minor stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
LambdAurora committed Aug 11, 2023
1 parent 58422f9 commit 35237f6
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 20 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,10 @@
- Fixed wrong leaf texture on cherry wood stumps.
- Fixed bad serialization of empty blackboards causing stacking issues.

### 1.0.0-beta.19

- Fixed blackboard issues with ModernFix, improved texture fetching reliability.
- Fixed glassboards not integrating correctly with LambdaBetterGrass.
- Fixed some typo in the compatibility system of wood-based features.

[EMI]: https://modrinth.com/mod/emi "EMI Modrinth page"
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
org.gradle.jvmargs=-Xmx1G

# Mod properties
mod_version=1.0.0-beta.18
mod_version=1.0.0-beta.19
maven_group=dev.lambdaurora
archives_base_name=aurorasdecorations
modrinth_id=GOqAnOfW
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@

package dev.lambdaurora.aurorasdeco.blackboard;

import dev.lambdaurora.aurorasdeco.AurorasDeco;
import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
import net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView;
import net.fabricmc.fabric.api.util.TriState;
import net.minecraft.client.texture.Sprite;
import net.minecraft.client.MinecraftClient;
import net.minecraft.feature_flags.FeatureFlagBitSet;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
import net.minecraft.screen.PlayerScreenHandler;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Direction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand All @@ -44,8 +47,7 @@
* @since 1.0.0
*/
public class Blackboard implements BlackboardHandler {
@ClientOnly
private static Sprite WHITE_SPRITE;
private static final Identifier WHITE_SPRITE_ID = AurorasDeco.id("special/white");

private final short[] pixels = new short[256];
private boolean lit;
Expand Down Expand Up @@ -219,13 +221,10 @@ public void setLit(boolean lit) {

/* Rendering */

@ClientOnly
public static void setWhiteSprite(Sprite whiteSprite) {
WHITE_SPRITE = whiteSprite;
}

@ClientOnly
public Mesh buildMesh(Direction facing, int light) {
var sprite = MinecraftClient.getInstance().getSpriteAtlas(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE).apply(WHITE_SPRITE_ID);

var meshBuilder = RendererAccess.INSTANCE.getRenderer().meshBuilder();
var emitter = meshBuilder.getEmitter();

Expand All @@ -249,7 +248,7 @@ public Mesh buildMesh(Direction facing, int light) {
int squareY = 15 - y;
emitter.square(facing, x / 16.f, squareY / 16.f,
(x + 1) / 16.f, (squareY + 1) / 16.f, 0.928f)
.spriteBake(WHITE_SPRITE, MutableQuadView.BAKE_LOCK_UV)
.spriteBake(sprite, MutableQuadView.BAKE_LOCK_UV)
.color(color, color, color, color)
.material(material);
if (light != 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

package dev.lambdaurora.aurorasdeco.client.model;

import dev.lambdaurora.aurorasdeco.AurorasDeco;
import dev.lambdaurora.aurorasdeco.blackboard.Blackboard;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.ModelBakeSettings;
Expand All @@ -28,8 +26,6 @@
import net.minecraft.client.resource.Material;
import net.minecraft.client.texture.Sprite;
import net.minecraft.client.util.ModelIdentifier;
import net.minecraft.resource.ResourceManager;
import net.minecraft.screen.PlayerScreenHandler;
import net.minecraft.util.Identifier;
import org.quiltmc.loader.api.minecraft.ClientOnly;

Expand All @@ -39,9 +35,6 @@

@ClientOnly
public class UnbakedBlackboardModel implements AuroraUnbakedModel {
private static final Material WHITE = new Material(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE,
AurorasDeco.id("special/white"));

protected final UnbakedModel baseModel;

public static UnbakedBlackboardModel of(ModelIdentifier id, UnbakedModel baseModel,
Expand Down Expand Up @@ -79,7 +72,6 @@ public BakedModel bake(
protected BakedModel bakeBaseModel(
ModelBaker loader, Function<Material, Sprite> textureGetter, ModelBakeSettings rotationContainer, Identifier modelId
) {
Blackboard.setWhiteSprite(textureGetter.apply(WHITE));
return this.baseModel.bake(loader, textureGetter, rotationContainer, modelId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public class UnbakedGlassboardModel extends UnbakedBlackboardModel {
LOGGER.warn("Could not load glassboard model part (" + corner + ", " + type + "): could not locate the blockstate file.");
} else {
try (var reader = new InputStreamReader(resource.get().open())) {

deserializationContext.setStateFactory(block.getStateManager());
var map = ModelVariantMap.fromJson(deserializationContext, reader);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,10 @@ public enum ComponentType {
return topId;

// For mods that don't use standard texture paths but logically evil.
topId = new Identifier(componentId.getNamespace(), "block/" + component.woodType().getId().getPath() + "/log/top");
topId = new Identifier(
componentId.getNamespace(),
"block/" + component.woodType().getId().getPath() + "/" + component.woodType().getLogType() + "/top"
);
if (resourceManager.getResource(AuroraUtil.toAbsoluteTexturesId(topId)).isPresent())
return topId;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "layer",
"data": "aurorasdeco:bettergrass/data/blackboard"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "layer",
"data": "aurorasdeco:bettergrass/data/blackboard"
}

0 comments on commit 35237f6

Please sign in to comment.