Skip to content

Commit

Permalink
Gu-2349239048230948230498 (#27)
Browse files Browse the repository at this point in the history
* Fuck

* Fuck pt2

* fix causal fabric coil rendering (#24)

* it work

* fix z-fighting

* I LOVE RENDERING I LOVE RENDERING I LOVE RENDERING I LOVE RENDERING I LOVE RENDERING I LOVE RENDERING I LOVE RENDERING I LOVE RENDERING I LOVE RENDERING I LOVE RENDERING I LOVE RENDERING I LOVE RENDERING I LOVE RENDERING (#25)

* I hate Fusion Reactors Mk1

* shader ""compat"" by using a scrolling texture if shaders are enabled (#26)

* Updating Cores KubeSchema

---------

Co-authored-by: screret <68943070+screret@users.noreply.github.com>
  • Loading branch information
Ghostipedia and screret authored Aug 19, 2024
1 parent 5ac6d2f commit 006192e
Show file tree
Hide file tree
Showing 397 changed files with 896 additions and 70 deletions.
13 changes: 10 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ loom {

repositories {
mavenCentral()

flatDir {
dirs 'lib'
}
// Ad Astra
maven {
url "https://maven.teamresourceful.com/repository/maven-public/"
Expand Down Expand Up @@ -105,7 +107,7 @@ repositories {
name "tterrag maven"
url "https://maven.tterrag.com/"
}

maven { url = "https://api.modrinth.com/maven" }
}

dependencies {
Expand Down Expand Up @@ -141,7 +143,7 @@ dependencies {
// modCompileOnly("curse.maven:blood-magic-224791:4779713") // API
// modRuntimeOnly("curse.maven:blood-magic-224791:4779711") // Runtime to test in game
modImplementation("curse.maven:blood-magic-224791:4779711")

// modImplementation("gtceu-1.20.1-1.3.1-build_947.jar")

//modImplementation("curse.maven:cold-sweat-506194:4805548")
modImplementation('software.bernie.geckolib:geckolib-forge-1.20.1:4.2.2')
Expand All @@ -156,6 +158,11 @@ dependencies {
modRuntimeOnly("dev.toma.configuration:configuration-forge-${project.minecraft_version}:${project.configuration_version}")
modRuntimeOnly("mezz.jei:jei-${project.minecraft_version}-forge:${project.jei_version}") { transitive = false }

modImplementation("maven.modrinth:embeddium:0.3.19+mc1.20.1")
modImplementation("maven.modrinth:oculus:1.20.1-1.7.0")
// oculus needs this apparently??? idk
forgeRuntimeLibrary(runtimeOnly("org.anarres:jcpp:1.4.14"))

// Mixin Extras
implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:${project.mixinextras_version}"))
implementation(include("io.github.llamalad7:mixinextras-forge:${project.mixinextras_version}"))
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ mod_id=cosmiccore
mod_author=Ghostipedia

# Dependencies
gtceu_version=1.3.1
ldlib_version=1.0.25.r
gtceu_version=1.4.0
ldlib_version=1.0.26.b
registrate_version=MC1.20-1.3.3
kubejs_version=2001.6.4-build.120
patchouli_version=81
curios_version=5.4.3
configuration_version=2.2.0
jei_version=15.3.0.4
jei_version=15.12.1.46
mixinextras_version=0.2.0
# Ad Astra
ad_astra_version=1.15.18
Expand Down
Binary file added lib/gtceu-1.20.1-1.3.1-build_947.jar
Binary file not shown.
1 change: 1 addition & 0 deletions src/generated/resources/assets/cosmiccore/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"gui.cosmiccore.soul_hatch.owner": "%d :ɹǝuʍO ʞɹoʍʇǝN",
"item.cosmiccore.aram_chip": "dıɥƆ WⱯᴚⱯ",
"item.cosmiccore.aram_wafer": "ɹǝɟɐM WⱯᴚⱯ",
"item.cosmiccore.asc_blood_orb": "qɹO pooןᗺ ʇuɐpuǝɔsⱯ",
"item.cosmiccore.blackstone_pustule": "ǝןnʇsnԀ ǝuoʇsʞɔɐןᗺ",
"item.cosmiccore.cosmic_processor": "ɹossǝɔoɹԀ ɔıɯsoƆ",
"item.cosmiccore.cosmic_processor_assembly": "ʎןqɯǝssⱯ ɹossǝɔoɹԀ ɔıɯsoƆ",
Expand Down
1 change: 1 addition & 0 deletions src/generated/resources/assets/cosmiccore/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"gui.cosmiccore.soul_hatch.owner": "Network Owner: %d",
"item.cosmiccore.aram_chip": "ARAM Chip",
"item.cosmiccore.aram_wafer": "ARAM Wafer",
"item.cosmiccore.asc_blood_orb": "Ascendant Blood Orb",
"item.cosmiccore.blackstone_pustule": "Blackstone Pustule",
"item.cosmiccore.cosmic_processor": "Cosmic Processor",
"item.cosmiccore.cosmic_processor_assembly": "Cosmic Processor Assembly",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "cosmiccore:item/asc_blood_orb"
}
}
20 changes: 11 additions & 9 deletions src/main/java/com/ghostipedia/cosmiccore/CosmicCore.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
package com.ghostipedia.cosmiccore;

import com.ghostipedia.cosmiccore.api.data.CosmicCoreMaterialIconType;
import com.ghostipedia.cosmiccore.api.data.CosmicCoreTagPrefix;
import com.ghostipedia.cosmiccore.api.pattern.CosmicPredicates;
import com.ghostipedia.cosmiccore.api.registries.CosmicRegistration;
import com.ghostipedia.cosmiccore.api.capability.CosmicCapabilities;
import com.ghostipedia.cosmiccore.client.CosmicCoreClient;
import com.ghostipedia.cosmiccore.common.data.*;
import com.ghostipedia.cosmiccore.common.data.materials.CosmicMaterialSet;
import com.ghostipedia.cosmiccore.common.data.materials.CosmicMaterials;
import com.ghostipedia.cosmiccore.gtbridge.CosmicRecipeTypes;
import com.gregtechceu.gtceu.api.GTCEuAPI;
import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.api.data.chemical.material.event.MaterialEvent;
import com.gregtechceu.gtceu.api.data.chemical.material.event.MaterialRegistryEvent;
import com.gregtechceu.gtceu.api.data.chemical.material.registry.MaterialRegistry;
import com.gregtechceu.gtceu.api.machine.MachineDefinition;
import com.gregtechceu.gtceu.api.recipe.GTRecipeType;
import com.gregtechceu.gtceu.common.block.CoilBlock;
import com.gregtechceu.gtceu.common.data.machines.GCyMMachines;
import com.gregtechceu.gtceu.config.ConfigHolder;
import com.lowdragmc.lowdraglib.Platform;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
Expand All @@ -28,14 +26,13 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;


@Mod(CosmicCore.MOD_ID)
public class CosmicCore {
public static final String MOD_ID = "cosmiccore", NAME = "CosmicCore";
public static final Logger LOGGER = LoggerFactory.getLogger(NAME);
public static MaterialRegistry MATERIAL_REGISTRY;

//Init Everything
public CosmicCore() {
CosmicCore.init();
Expand All @@ -45,12 +42,17 @@ public CosmicCore() {
// bus.addGenericListener(Class.class, this::registerRecipeConditions);
// bus.addGenericListener(MachineDefinition.class, this::registerMachines);
bus.addGenericListener(MachineDefinition.class, this::registerMachines);

if (Platform.isClient()) {
bus.register(CosmicCoreClient.class);
}
}

public static void init() {
ConfigHolder.init();
CosmicCreativeModeTabs.init();
CosmicBlocks.init();
CosmicBlockEntities.init();
CosmicItems.init();
CosmicRegistration.REGISTRATE.registerRegistrate();
CosmicCoreDatagen.init();
Expand All @@ -66,10 +68,10 @@ public static ResourceLocation id(String path) {
public void registerMaterialRegistry(MaterialRegistryEvent event) {
MATERIAL_REGISTRY = GTCEuAPI.materialManager.createRegistry(CosmicCore.MOD_ID);
}

@SubscribeEvent
public void registerMaterials(MaterialEvent event) {
public void registerMaterials(MaterialEvent event) {
CosmicMaterials.register();

}

@SubscribeEvent
Expand All @@ -94,4 +96,4 @@ public void registerMachines(GTCEuAPI.RegisterEvent<ResourceLocation, MachineDef
public void registerCapabilities(RegisterCapabilitiesEvent event) {
CosmicCapabilities.register(event);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.ghostipedia.cosmiccore.client;

import com.ghostipedia.cosmiccore.CosmicCore;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import lombok.Getter;
import net.minecraft.client.renderer.ShaderInstance;
import net.minecraftforge.client.event.RegisterShadersEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;

import java.io.IOException;

@SuppressWarnings("unused")
public class CosmicCoreClient {

private CosmicCoreClient() {}

@Getter
private static ShaderInstance nebulaeShader;

@SubscribeEvent
public static void shaderRegistry(RegisterShadersEvent event) {
try {
event.registerShader(new ShaderInstance(event.getResourceProvider(), CosmicCore.id("rendertype_nebulae"), DefaultVertexFormat.POSITION), (shaderInstance) -> nebulaeShader = shaderInstance);
} catch (IOException e) {
throw new RuntimeException(e);
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.ghostipedia.cosmiccore.client.renderer;

import com.ghostipedia.cosmiccore.client.CosmicCoreClient;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.minecraft.client.renderer.RenderType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

@OnlyIn(Dist.CLIENT)
public class CosmicCoreRenderTypes extends RenderType {

protected static final ShaderStateShard NEBULAE_SHADER = new ShaderStateShard(CosmicCoreClient::getNebulaeShader);

private static final RenderType NEBULAE = RenderType.create("nebulae",
DefaultVertexFormat.POSITION, VertexFormat.Mode.QUADS, 256, false, false,
RenderType.CompositeState.builder()
.setShaderState(NEBULAE_SHADER)
.createCompositeState(false));

private CosmicCoreRenderTypes(String name, VertexFormat format, VertexFormat.Mode mode, int bufferSize,
boolean affectsCrumbling, boolean sortOnUpload, Runnable setupState, Runnable clearState) {
super(name, format, mode, bufferSize, affectsCrumbling, sortOnUpload, setupState, clearState);
}

public static RenderType nebulae() {
return NEBULAE;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
package com.ghostipedia.cosmiccore.client.renderer.block;

import com.ghostipedia.cosmiccore.CosmicCore;
import com.ghostipedia.cosmiccore.client.renderer.CosmicCoreRenderTypes;
import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.client.renderer.block.TextureOverrideRenderer;
import com.lowdragmc.lowdraglib.LDLib;
import com.lowdragmc.lowdraglib.client.bakedpipeline.Quad;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.irisshaders.iris.Iris;
import net.irisshaders.iris.uniforms.SystemTimeUniforms;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.joml.Matrix3f;
import org.joml.Matrix4f;

import java.util.List;
import java.util.Map;

public class NebulaeCoilRenderer extends TextureOverrideRenderer {

public static final ResourceLocation NEBULAE_LOCATION = CosmicCore.id("textures/entity/nebulae.png");

public NebulaeCoilRenderer(ResourceLocation model, @NotNull Map<String, ResourceLocation> override) {
super(model, override);
}

@Override
public List<BakedQuad> renderModel(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, @Nullable BlockState state, @Nullable Direction side, RandomSource rand) {
return super.renderModel(level, pos, state, side, rand)
.stream()
.map(quad -> Quad.from(quad, 0.001F).rebake())
.toList();
}

@Override
public boolean hasTESR(BlockEntity blockEntity) {
return true;
}

@Override
public void render(BlockEntity blockEntity, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int combinedLight, int combinedOverlay) {
poseStack.pushPose();
Matrix4f pose = poseStack.last().pose();

if (LDLib.isModLoaded(GTValues.MODID_OCULUS) && Iris.getCurrentPack().isPresent()) {
VertexConsumer consumer = buffer.getBuffer(RenderType.entitySolid(NEBULAE_LOCATION));

Matrix3f normal = poseStack.last().normal();
// animation with a period of 20 seconds.
// note that texture coordinates are wrapping, not clamping.
float progress = (SystemTimeUniforms.TIMER.getFrameTimeCounter() * 0.05f) % 1f;

this.renderFaceOculus(blockEntity, pose, normal, consumer, progress,
0.0F, 1.0F, 1.0F,
1.0F, 1.0F, 1.0F,
1.0F, 1.0F, 0.0F,
0.0F, 1.0F, 0.0F,
Direction.UP);
this.renderFaceOculus(blockEntity, pose, normal, consumer, progress,
0.0F, 0.0F, 1.0F,
0.0F, 0.0F, 0.0F,
1.0F, 0.0F, 0.0F,
1.0F, 0.0F, 1.0F,
Direction.DOWN);
this.renderFaceOculus(blockEntity, pose, normal, consumer, progress,
0.0F, 1.0F, 0.0F,
1.0F, 1.0F, 0.0F,
1.0F, 0.0F, 0.0F,
0.0F, 0.0F, 0.0F,
Direction.NORTH);
this.renderFaceOculus(blockEntity, pose, normal, consumer, progress,
0.0F, 1.0F, 1.0F,
0.0F, 1.0F, 0.0F,
0.0F, 0.0F, 0.0F,
0.0F, 0.0F, 1.0F,
Direction.WEST);
this.renderFaceOculus(blockEntity, pose, normal, consumer, progress,
0.0F, 1.0F, 1.0F,
0.0F, 0.0F, 1.0F,
1.0F, 0.0F, 1.0F,
1.0F, 1.0F, 1.0F,
Direction.SOUTH);
this.renderFaceOculus(blockEntity, pose, normal, consumer, progress,
1.0F, 1.0F, 1.0F,
1.0F, 0.0F, 1.0F,
1.0F, 0.0F, 0.0F,
1.0F, 1.0F, 0.0F,
Direction.EAST);
} else {
VertexConsumer consumer = buffer.getBuffer(CosmicCoreRenderTypes.nebulae());

this.renderFace(blockEntity, pose, consumer, 0.0F, 1.0F, 0.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, Direction.SOUTH);
this.renderFace(blockEntity, pose, consumer, 0.0F, 1.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, Direction.NORTH);
this.renderFace(blockEntity, pose, consumer, 1.0F, 1.0F, 1.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.0F, Direction.EAST);
this.renderFace(blockEntity, pose, consumer, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 1.0F, 1.0F, 0.0F, Direction.WEST);
this.renderFace(blockEntity, pose, consumer, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 1.0F, Direction.DOWN);
this.renderFace(blockEntity, pose, consumer, 0.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 0.0F, 0.0F, Direction.UP);
}

poseStack.popPose();
}

private void renderFace(
BlockEntity blockEntity, Matrix4f pose, VertexConsumer consumer, float x0, float x1, float y0, float y1, float z0, float z1, float z2, float z3, Direction direction
) {
if (Block.shouldRenderFace(blockEntity.getBlockState(), blockEntity.getLevel(), blockEntity.getBlockPos(), direction, blockEntity.getBlockPos().relative(direction))) {
consumer.vertex(pose, x0, y0, z0).endVertex();
consumer.vertex(pose, x1, y0, z1).endVertex();
consumer.vertex(pose, x1, y1, z2).endVertex();
consumer.vertex(pose, x0, y1, z3).endVertex();
}
}

private void renderFaceOculus(BlockEntity blockEntity, Matrix4f pose, Matrix3f normal, VertexConsumer vertexConsumer,
float progress,
float x0, float y0, float z0,
float x1, float y1, float z1,
float x2, float y2, float z2,
float x3, float y3, float z3,
Direction direction) {
if (!Block.shouldRenderFace(blockEntity.getBlockState(), blockEntity.getLevel(), blockEntity.getBlockPos(), direction, blockEntity.getBlockPos().relative(direction))) {
return;
}

float nx = direction.getStepX();
float ny = direction.getStepY();
float nz = direction.getStepZ();

vertexConsumer.vertex(pose, x0, y0, z0).color(1.0f, 1.0f, 1.0f, 1.0f)
.uv(progress, progress)
.overlayCoords(OverlayTexture.NO_OVERLAY).uv2(LightTexture.FULL_BRIGHT)
.normal(normal, nx, ny, nz).endVertex();

vertexConsumer.vertex(pose, x1, y1, z1).color(1.0f, 1.0f, 1.0f, 1.0f)
.uv(progress, 0.2F + progress)
.overlayCoords(OverlayTexture.NO_OVERLAY).uv2(LightTexture.FULL_BRIGHT)
.normal(normal, nx, ny, nz).endVertex();

vertexConsumer.vertex(pose, x2, y2, z2).color(1.0f, 1.0f, 1.0f, 1.0f)
.uv(0.2F + progress, 0.2F + progress)
.overlayCoords(OverlayTexture.NO_OVERLAY).uv2(LightTexture.FULL_BRIGHT)
.normal(normal, nx, ny, nz).endVertex();

vertexConsumer.vertex(pose, x3, y3, z3).color(1.0f, 1.0f, 1.0f, 1.0f)
.uv(0.2F + progress, progress)
.overlayCoords(OverlayTexture.NO_OVERLAY).uv2(LightTexture.FULL_BRIGHT)
.normal(normal, nx, ny, nz).endVertex();
}
}
Loading

0 comments on commit 006192e

Please sign in to comment.