Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to GTNHLib 0.4.0+ for VBO instead of Angelica #8

Merged
merged 3 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
dependencies {
compileOnly("com.github.GTNewHorizons:Angelica:1.0.0-alpha28:dev")
implementation("com.github.GTNewHorizons:GTNHLib:0.2.4:dev")
implementation("com.github.GTNewHorizons:GTNHLib:0.4.0:dev")
}
13 changes: 12 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ accessTransformersFile = amazingtrophies_at.cfg
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false

# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
# Mixin classes will have access to "main" classes, but not the other way around.
separateMixinSourceSet =

# Adds some debug arguments like verbose output and class export.
usesMixinDebug = false

Expand Down Expand Up @@ -117,9 +122,15 @@ minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true

# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories.
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true

# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
# list of strings, with the acceptable keys being(case does not matter):
# cursemaven
# modrinth
excludeWellKnownRepositories =

# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pluginManagement {
}

plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.14'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.26'
}


6 changes: 2 additions & 4 deletions src/main/java/glowredman/amazingtrophies/AmazingTrophies.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

@Mod(
acceptedMinecraftVersions = "[1.7.10]",
dependencies = "required-after:gtnhlib@[0.0.10,);after:angelica",
dependencies = "required-after:gtnhlib@[0.4.0,);after:angelica@[1.0.0-beta4,)",
modid = AmazingTrophies.MODID,
name = AmazingTrophies.MODNAME,
version = AmazingTrophies.VERSION)
Expand All @@ -52,7 +52,7 @@ public class AmazingTrophies {
public static final String VERSION = Reference.VERSION;
public static final Logger LOGGER = LogManager.getLogger(MODNAME);
public static final Path CONFIG_DIR = getConfigDir();
public static boolean isAngelicaLoaded = false;
public static final boolean enableVBO = !Boolean.getBoolean("amazingtrophies.disableVBO");

@EventHandler
public static void construct(FMLConstructionEvent event) {
Expand All @@ -64,8 +64,6 @@ public static void construct(FMLConstructionEvent event) {

@EventHandler
public static void preInit(FMLPreInitializationEvent event) {
isAngelicaLoaded = Loader.isModLoaded("angelica");

registerConditionHandlers();

Block blockTrophy = new BlockTrophy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import net.minecraftforge.client.model.IModelCustom;
import net.minecraftforge.client.model.ModelFormatException;

import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.mixins.interfaces.IModelCustomExt;
import com.gtnewhorizon.gtnhlib.client.renderer.vbo.IModelCustomExt;

import glowredman.amazingtrophies.AmazingTrophies;

Expand All @@ -18,7 +17,7 @@ public abstract class ModelWrapper<T extends IModelCustom> {

public static ModelWrapper<? extends IModelCustom> get(ResourceLocation resource)
throws IllegalArgumentException, ModelFormatException {
if (AmazingTrophies.isAngelicaLoaded && AngelicaConfig.enableVBO) {
if (AmazingTrophies.enableVBO) {
return new ModelCustomWrapperExt(resource);
}
return new ModelCustomWrapper(resource);
Expand All @@ -44,7 +43,7 @@ private ModelCustomWrapperExt(ResourceLocation resource) throws IllegalArgumentE

@Override
public void renderAll() {
if (AngelicaConfig.enableVBO) {
if (AmazingTrophies.enableVBO) {
this.model.renderAllVBO();
} else {
this.model.renderAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import com.google.gson.JsonSyntaxException;

import cpw.mods.fml.common.registry.GameData;
import glowredman.amazingtrophies.AmazingTrophies;
import glowredman.amazingtrophies.ConfigHandler;
import glowredman.amazingtrophies.model.PedestalTrophyModelHandler;

Expand Down Expand Up @@ -155,11 +154,7 @@ public void render(double x, double y, double z, int rotation, @Nullable String
GL11.glRotatef(-90, 0.0f, 1.0f, 0.0f);
GL11.glRotatef(22.5f * rotation, 0.0f, 1.0f, 0.0f);

if (AmazingTrophies.isAngelicaLoaded) {
RenderHelperAngelica.renderModel(model);
} else {
RenderHelper.renderModel(model);
}
RenderHelperVBO.renderModel(model);

GL11.glPopAttrib();
GL11.glPopMatrix();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import com.gtnewhorizons.angelica.client.renderer.CapturingTessellator;
import com.gtnewhorizons.angelica.compat.mojang.DefaultVertexFormat;
import com.gtnewhorizons.angelica.compat.mojang.VertexBuffer;
import com.gtnewhorizons.angelica.compat.mojang.VertexFormat;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.glsm.TessellatorManager;
import com.gtnewhorizons.angelica.glsm.VBOManager;
import com.gtnewhorizon.gtnhlib.client.renderer.CapturingTessellator;
import com.gtnewhorizon.gtnhlib.client.renderer.TessellatorManager;
import com.gtnewhorizon.gtnhlib.client.renderer.vbo.VBOManager;
import com.gtnewhorizon.gtnhlib.client.renderer.vbo.VertexBuffer;
import com.gtnewhorizon.gtnhlib.client.renderer.vertex.DefaultVertexFormat;
import com.gtnewhorizon.gtnhlib.client.renderer.vertex.VertexFormat;

public class RenderHelperAngelica {
import glowredman.amazingtrophies.AmazingTrophies;

public class RenderHelperVBO {

private static void centreModel(BaseModelStructure model) {

Expand Down Expand Up @@ -95,7 +96,7 @@ public static void renderModel(final BaseModelStructure model) {

if (model == null) return;

if (!AngelicaConfig.enableVBO) {
if (!AmazingTrophies.enableVBO) {
RenderHelper.renderModel(model);
return;
}
Expand Down