A few rendering bugs fixed.
10
build.gradle
@@ -1,13 +1,9 @@
|
||||
buildscript {
|
||||
dependencies {
|
||||
classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7.+'
|
||||
}
|
||||
}
|
||||
plugins {
|
||||
id "idea"
|
||||
id "maven-publish"
|
||||
id "net.minecraftforge.gradle" version "5.1.73"
|
||||
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
|
||||
id "com.matthewprenger.cursegradle" version "1.4.0"
|
||||
id 'org.spongepowered.mixin' version '0.7.+'
|
||||
}
|
||||
|
||||
apply plugin: 'org.spongepowered.mixin'
|
||||
@@ -93,7 +89,7 @@ dependencies {
|
||||
minecraftLibrary "org.apache.commons:commons-collections4:4.4"
|
||||
|
||||
implementation fg.deobf("curse.maven:markdownmanual-502485:4873115")
|
||||
implementation fg.deobf("curse.maven:architectury-api-419699:4521273")
|
||||
implementation fg.deobf("curse.maven:architectury-api-419699:5137938")
|
||||
|
||||
compileOnly fg.deobf("mezz.jei:jei-1.20.1-common-api:15.3.0.4")
|
||||
compileOnly fg.deobf("mezz.jei:jei-1.20.1-forge-api:15.3.0.4")
|
||||
|
||||
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-7.4-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@@ -42,6 +42,7 @@ import java.util.function.Consumer;
|
||||
|
||||
public final class ClientSetup {
|
||||
private static final Set<ResourceLocation> sprites = new HashSet<ResourceLocation>();
|
||||
private static boolean readyForSprites = false;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void handleSetupEvent(final FMLClientSetupEvent event) {
|
||||
@@ -67,16 +68,6 @@ public final class ClientSetup {
|
||||
|
||||
// We need to register this manually, because static init throws errors when running data generation.
|
||||
MinecraftForge.EVENT_BUS.register(ProjectorDepthRenderer.class);
|
||||
|
||||
for (final DeviceType deviceType : DeviceTypes.DEVICE_TYPE_REGISTRY.get().getValues()) {
|
||||
sprites.add(deviceType.getBackgroundIcon());
|
||||
}
|
||||
|
||||
sprites.add(ComputerRenderer.OVERLAY_POWER_LOCATION);
|
||||
sprites.add(ComputerRenderer.OVERLAY_STATUS_LOCATION);
|
||||
sprites.add(ComputerRenderer.OVERLAY_TERMINAL_LOCATION);
|
||||
|
||||
sprites.add(ChargerRenderer.EFFECT_LOCATION);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -94,13 +85,6 @@ public final class ClientSetup {
|
||||
}
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static void collectSprites(ResourceLocation atlas, Consumer<ResourceLocation> spriteConsumer) {
|
||||
if(!Objects.equals(atlas, InventoryMenu.BLOCK_ATLAS)) return;
|
||||
|
||||
sprites.forEach(spriteConsumer);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void handleEntityRendererRegisterEvent(final EntityRenderersEvent.RegisterRenderers event) {
|
||||
event.registerEntityRenderer(Entities.ROBOT.get(), RobotRenderer::new);
|
||||
|
||||
@@ -125,9 +125,9 @@ public abstract class AbstractMachineInventoryScreen<T extends AbstractMachineTe
|
||||
protected void renderFg(final GuiGraphics graphics, final float partialTicks, final int mouseX, final int mouseY) {
|
||||
super.renderFg(graphics, partialTicks, mouseX, mouseY);
|
||||
|
||||
GuiUtils.renderMissingDeviceInfoIcon(graphics, this, DeviceTypes.FLASH_MEMORY, Sprites.WARN_ICON);
|
||||
GuiUtils.renderMissingDeviceInfoIcon(graphics, this, DeviceTypes.MEMORY, Sprites.WARN_ICON);
|
||||
GuiUtils.renderMissingDeviceInfoIcon(graphics, this, DeviceTypes.HARD_DRIVE, Sprites.INFO_ICON);
|
||||
//GuiUtils.renderMissingDeviceInfoIcon(graphics, this, DeviceTypes.FLASH_MEMORY, Sprites.WARN_ICON);
|
||||
//GuiUtils.renderMissingDeviceInfoIcon(graphics, this, DeviceTypes.MEMORY, Sprites.WARN_ICON);
|
||||
//GuiUtils.renderMissingDeviceInfoIcon(graphics, this, DeviceTypes.HARD_DRIVE, Sprites.INFO_ICON);
|
||||
|
||||
if (shouldRenderEnergyBar()) {
|
||||
final int x = leftPos - Sprites.SIDEBAR_2.width + 4;
|
||||
|
||||
@@ -4,6 +4,7 @@ package li.cil.oc2.client.gui;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.Renderable;
|
||||
@@ -54,7 +55,9 @@ public abstract class AbstractModContainerScreen<T extends AbstractContainerMenu
|
||||
|
||||
for (final Renderable widget : renderables) {
|
||||
if (widget instanceof AbstractWidget abstractWidget) {
|
||||
//abstractWidget.renderToolTip(stack, mouseX, mouseY);
|
||||
if(abstractWidget.getTooltip() == null) continue;
|
||||
System.out.println(abstractWidget.getTooltip());
|
||||
graphics.renderTooltip(Minecraft.getInstance().font, abstractWidget.getTooltip().toCharSequence(Minecraft.getInstance()), mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,8 +69,8 @@ public final class MachineTerminalWidget {
|
||||
rendererView = terminal.getRenderer();
|
||||
}
|
||||
|
||||
//final Matrix4f projectionMatrix = orthographic(0, parent.width, 0, parent.height, -10, 10f);
|
||||
final Matrix4f projectionMatrix = new Matrix4f().ortho(0, parent.width, 0, parent.height, -10, 10f);
|
||||
final Matrix4f projectionMatrix = orthographic(0, parent.width, 0, parent.height, -10, 10f);
|
||||
//final Matrix4f projectionMatrix = new Matrix4f().ortho(0, parent.width, 0, parent.height, -10, 10f);
|
||||
rendererView.render(terminalStack, projectionMatrix);
|
||||
} else {
|
||||
final Font font = getClient().font;
|
||||
|
||||
@@ -38,12 +38,9 @@ public final class GuiUtils {
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
public static <TContainer extends AbstractContainerMenu> void renderMissingDeviceInfoIcon(final GuiGraphics graphics, final AbstractContainerScreen<TContainer> screen, final DeviceType type, final Sprite icon) {
|
||||
graphics.pose().pushPose();
|
||||
graphics.pose().translate(0, 0, 100);
|
||||
findFirstSlotOfTypeIfAllSlotsOfTypeEmpty(screen.getMenu(), type).ifPresent(slot -> icon.draw(graphics,
|
||||
/*findFirstSlotOfTypeIfAllSlotsOfTypeEmpty(screen.getMenu(), type).ifPresent(slot -> icon.draw(graphics,
|
||||
screen.getGuiLeft() + slot.x - 1 + RELATIVE_ICON_POSITION,
|
||||
screen.getGuiTop() + slot.y - 1 + RELATIVE_ICON_POSITION));
|
||||
graphics.pose().popPose();
|
||||
screen.getGuiTop() + slot.y - 1 + RELATIVE_ICON_POSITION));*/
|
||||
}
|
||||
|
||||
public static <TContainer extends AbstractContainerMenu> void renderMissingDeviceInfoTooltip(final GuiGraphics graphics, final AbstractContainerScreen<TContainer> screen, final int mouseX, final int mouseY, final DeviceType type) {
|
||||
|
||||
@@ -35,11 +35,11 @@ public final class Sprite {
|
||||
}
|
||||
|
||||
public void draw(final GuiGraphics graphics, final int x, final int y, final int uOffset, final int vOffset) {
|
||||
graphics.blit(texture.location, x, y, u0 + uOffset, v0 + vOffset, width, height);
|
||||
graphics.blit(texture.location, x, y, u0 + uOffset, v0 + vOffset, width, height, texture.width, texture.height);
|
||||
}
|
||||
|
||||
public void drawFillY(final GuiGraphics graphics, final int x, final int y, final float value) {
|
||||
final int h = (int) (this.height * Mth.clamp(value, 0, 1));
|
||||
graphics.blit(texture.location, x, y + (height - h), u0, v0 + (height - h), width, h);
|
||||
graphics.blit(texture.location, x, y + (height - h), u0, v0 + (height - h), width, h, texture.width, texture.height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,19 @@ package li.cil.oc2.common.bus.device;
|
||||
|
||||
import li.cil.oc2.api.API;
|
||||
import li.cil.oc2.api.bus.device.DeviceType;
|
||||
import li.cil.oc2.client.ClientSetup;
|
||||
import li.cil.oc2.common.bus.device.util.DeviceTypeImpl;
|
||||
import li.cil.oc2.common.tags.ItemTags;
|
||||
import li.cil.oc2.common.util.RegistryUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.packs.repository.Pack;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.RegistryBuilder;
|
||||
@@ -31,7 +37,6 @@ public final class DeviceTypes {
|
||||
public static void initialize() {
|
||||
DEVICE_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus());
|
||||
|
||||
|
||||
register(ItemTags.DEVICES_MEMORY);
|
||||
register(ItemTags.DEVICES_HARD_DRIVE);
|
||||
register(ItemTags.DEVICES_FLASH_MEMORY);
|
||||
@@ -47,8 +52,10 @@ public final class DeviceTypes {
|
||||
final String id = tag.location().getPath().replaceFirst("^devices/", "");
|
||||
DEVICE_TYPES.register(id, () -> new DeviceTypeImpl(
|
||||
tag,
|
||||
new ResourceLocation(API.MOD_ID, "gui/icon/" + id),
|
||||
new ResourceLocation(API.MOD_ID, "item/" + id + "_slot"),
|
||||
text("gui.{mod}.device_type." + id)
|
||||
));
|
||||
|
||||
System.out.println("gui/icon/" + id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
package li.cil.oc2.common.mixin;
|
||||
|
||||
import li.cil.oc2.client.ClientSetup;
|
||||
import net.minecraft.client.renderer.texture.atlas.SpriteResourceLoader;
|
||||
import net.minecraft.client.renderer.texture.atlas.SpriteSource;
|
||||
import net.minecraft.client.renderer.texture.atlas.sources.SingleFile;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Mixin(SpriteResourceLoader.class)
|
||||
public class AtlasAdder {
|
||||
@ModifyVariable(
|
||||
method = "load(Lnet/minecraft/server/packs/resources/ResourceManager;Lnet/minecraft/resources/ResourceLocation;)Lnet/minecraft/client/renderer/texture/atlas/SpriteResourceLoader;",
|
||||
at = @At("STORE"),
|
||||
ordinal = 0
|
||||
)
|
||||
private static List<SpriteSource> appendSprites(List<SpriteSource> sprites, ResourceManager resourceManager, ResourceLocation atlas){
|
||||
ClientSetup.collectSprites(atlas, location -> sprites.add(new SingleFile(location, Optional.empty())));
|
||||
return sprites;
|
||||
}
|
||||
}
|
||||
@@ -818,10 +818,10 @@ public final class Terminal {
|
||||
BufferBuilder.RenderedBuffer rb = builder.end();
|
||||
|
||||
if (lines[row] == null) {
|
||||
lines[row] = new VertexBuffer(VertexBuffer.Usage.STATIC);
|
||||
lines[row] = new VertexBuffer(VertexBuffer.Usage.DYNAMIC);
|
||||
}else if (lines[row] != null) {
|
||||
lines[row].close();
|
||||
lines[row] = new VertexBuffer(VertexBuffer.Usage.STATIC);
|
||||
lines[row] = new VertexBuffer(VertexBuffer.Usage.DYNAMIC);
|
||||
}
|
||||
|
||||
if (!lines[row].isInvalid()){
|
||||
|
||||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
@@ -10,8 +10,7 @@
|
||||
"client": [
|
||||
"FrustumMixin",
|
||||
"LevelRendererMixin",
|
||||
"MinecraftMixin",
|
||||
"AtlasAdder"
|
||||
"MinecraftMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
||||