Small cleanup
This commit is contained in:
16
build.gradle
16
build.gradle
@@ -141,21 +141,21 @@ dependencies {
|
||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||
|
||||
|
||||
compileOnly 'org.projectlombok:lombok:1.18.34'
|
||||
annotationProcessor 'org.projectlombok:lombok:1.18.34'
|
||||
compileOnly "org.projectlombok:lombok:${lombok_version}"
|
||||
annotationProcessor "org.projectlombok:lombok:${lombok_version}"
|
||||
|
||||
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
|
||||
testAnnotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
|
||||
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:0.5.0"))
|
||||
implementation(jarJar("io.github.llamalad7:mixinextras-forge:0.5.0")) {
|
||||
jarJar.ranged(it, "[0.5.0,)")
|
||||
annotationProcessor "org.spongepowered:mixin:${mixin_processor_version}:processor"
|
||||
testAnnotationProcessor "org.spongepowered:mixin:${mixin_processor_version}:processor"
|
||||
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:${mixinextras_version}"))
|
||||
implementation(jarJar("io.github.llamalad7:mixinextras-forge:${mixinextras_version}")) {
|
||||
jarJar.ranged(it, "[${mixinextras_version},)")
|
||||
}
|
||||
|
||||
implementation fg.deobf("com.lowdragmc.ldlib:ldlib-forge-${minecraft_version}:${ldlib_version}") { transitive = false }
|
||||
implementation fg.deobf("com.gregtechceu.gtceu:gtceu-${minecraft_version}:${gtm_version}") {transitive = false}
|
||||
|
||||
implementation fg.deobf("software.bernie.geckolib:geckolib-forge-${minecraft_version}:${geckolib_version}")
|
||||
implementation("com.eliotlash.mclib:mclib:20")
|
||||
implementation("com.eliotlash.mclib:mclib:${mclib_version}")
|
||||
|
||||
implementation fg.deobf("maven.modrinth:jade:${jade_version}")
|
||||
}
|
||||
|
||||
@@ -16,11 +16,11 @@ mapping_version=2023.09.03-1.20.1
|
||||
## Mod Properties
|
||||
mod_id=ibg
|
||||
mod_name=Immersed by Greg
|
||||
mod_license=LGPL-3.0 license
|
||||
mod_license=LGPL-3.0 license
|
||||
mod_version=0.1.0
|
||||
mod_group_id=com.imbgt.ibg
|
||||
mod_authors=Jika
|
||||
mod_description=Example mod description.\nNewline characters can be used and will be replaced properly.
|
||||
mod_description=Add some nice looking animated gt machine
|
||||
|
||||
|
||||
## Deps Properties
|
||||
@@ -36,3 +36,9 @@ jade_version = 11.13.1+forge
|
||||
embeddium_version = 0.3.31+mc1.20.1
|
||||
oculus_version = 1.20.1-1.8.0
|
||||
modernfix_version = DdUByV9S
|
||||
|
||||
# Additional versions (centralized to avoid hardcoding in build.gradle)
|
||||
lombok_version=1.18.34
|
||||
mixin_processor_version=0.8.5
|
||||
mixinextras_version=0.5.0
|
||||
mclib_version=20
|
||||
|
||||
@@ -44,6 +44,7 @@ public class PartBlock extends Block implements EntityBlock {
|
||||
super(p.noOcclusion());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static BlockPos masterPos(BlockGetter level, BlockPos pos) {
|
||||
BlockEntity be = level.getBlockEntity(pos);
|
||||
return (be instanceof PartBE ml) ? ml.getMasterPos() : null;
|
||||
|
||||
@@ -13,6 +13,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
public class PartBE extends BlockEntity {
|
||||
|
||||
@javax.annotation.Nullable
|
||||
private BlockPos masterPos;
|
||||
|
||||
public PartBE(BlockPos pos, BlockState st) {
|
||||
|
||||
@@ -18,6 +18,7 @@ import net.minecraftforge.client.model.data.ModelData;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import com.google.common.collect.MapMaker;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||
@@ -27,12 +28,15 @@ import software.bernie.geckolib.renderer.GeoRenderer;
|
||||
import software.bernie.geckolib.renderer.layer.GeoRenderLayer;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public final class IndicatorTintLayer<T extends BlockEntity & GeoAnimatable> extends GeoRenderLayer<T> {
|
||||
|
||||
private static final int DEFAULT_ARGB = 0xFFFFFFFF;
|
||||
private static final Map<Item, Integer> COLOR_CACHE = new ConcurrentHashMap<>();
|
||||
// Use weak keys so cached colors don't pin Item instances in memory
|
||||
private static final Map<Item, Integer> COLOR_CACHE = new MapMaker()
|
||||
.weakKeys()
|
||||
.concurrencyLevel(1)
|
||||
.makeMap();
|
||||
|
||||
private final String boneName;
|
||||
private final int layerIndex;
|
||||
@@ -53,6 +57,7 @@ public final class IndicatorTintLayer<T extends BlockEntity & GeoAnimatable> ext
|
||||
public void render(PoseStack poseStack, T animatable, BakedGeoModel model, RenderType baseType,
|
||||
MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick,
|
||||
int packedLight, int packedOverlay) {
|
||||
if (model.getBone(this.boneName).isEmpty()) return;
|
||||
final int argb = resolveColor(animatable);
|
||||
final float a = ((argb >>> 24) & 0xFF) / 255f;
|
||||
final float r = ((argb >>> 16) & 0xFF) / 255f;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// src/main/java/com/imbgt/ibg/datagen/TierTextureBakeProvider.java
|
||||
package com.imbgt.ibg.datagen;
|
||||
|
||||
import com.imbgt.ibg.block.MachineSets;
|
||||
import com.imbgt.ibg.IBG;
|
||||
import com.imbgt.ibg.block.MachineSets;
|
||||
|
||||
import com.gregtechceu.gtceu.api.GTValues;
|
||||
|
||||
@@ -29,9 +29,11 @@ import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
public final class TierTextureBakeProvider implements DataProvider {
|
||||
|
||||
private record TierTiles(BufferedImage side, BufferedImage top, BufferedImage bottom) {}
|
||||
|
||||
private final PackOutput out;
|
||||
@@ -75,7 +77,12 @@ public final class TierTextureBakeProvider implements DataProvider {
|
||||
IBG.LOGGER.warn("Missing casing tiles for tier {} — rendering overlay only", tier);
|
||||
}
|
||||
BufferedImage overlay = tryReadPng("ibg", "textures/block/" + key + ".png");
|
||||
if (overlay != null) g.drawImage(overlay, 0, 0, null);
|
||||
if (overlay != null) {
|
||||
g.drawImage(overlay, 0, 0, null);
|
||||
} else {
|
||||
IBG.LOGGER.debug("Overlay texture missing for key {} ({}): {}", key, tier,
|
||||
"assets/ibg/textures/block/" + key + ".png");
|
||||
}
|
||||
g.dispose();
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
@@ -104,10 +111,13 @@ public final class TierTextureBakeProvider implements DataProvider {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private BufferedImage tryReadPng(String ns, String path) throws IOException {
|
||||
var opt = open(ns, path);
|
||||
if (opt.isEmpty())
|
||||
if (opt.isEmpty()) {
|
||||
IBG.LOGGER.debug("Resource not found: {}/{}", ns, path);
|
||||
return null;
|
||||
}
|
||||
try (InputStream is = opt.get()) {
|
||||
return ImageIO.read(is);
|
||||
}
|
||||
@@ -167,8 +177,14 @@ public final class TierTextureBakeProvider implements DataProvider {
|
||||
int w = Math.abs(us);
|
||||
int h = Math.abs(vs);
|
||||
|
||||
if (x0 < 0) { w += x0; x0 = 0; }
|
||||
if (y0 < 0) { h += y0; y0 = 0; }
|
||||
if (x0 < 0) {
|
||||
w += x0;
|
||||
x0 = 0;
|
||||
}
|
||||
if (y0 < 0) {
|
||||
h += y0;
|
||||
y0 = 0;
|
||||
}
|
||||
if (x0 >= atlasW || y0 >= atlasH || w <= 0 || h <= 0) return;
|
||||
if (x0 + w > atlasW) w = atlasW - x0;
|
||||
if (y0 + h > atlasH) h = atlasH - y0;
|
||||
|
||||
Reference in New Issue
Block a user