diff options
-rw-r--r-- | .gitattributes | 73 | ||||
-rw-r--r-- | build.gradle | 139 | ||||
-rw-r--r-- | src/main/java/kubatech/api/LoaderReference.java | 1 | ||||
-rw-r--r-- | src/main/java/kubatech/api/network/LoadConfigPacket.java | 2 | ||||
-rw-r--r-- | src/main/java/kubatech/client/effect/EntityRenderer.java | 59 | ||||
-rw-r--r-- | src/main/java/kubatech/config/Config.java | 158 | ||||
-rw-r--r-- | src/main/java/kubatech/loaders/MobRecipeLoader.java | 28 | ||||
-rw-r--r-- | src/main/java/kubatech/nei/Mob_Handler.java | 22 |
8 files changed, 350 insertions, 132 deletions
diff --git a/.gitattributes b/.gitattributes index 9917fc4abe..f498ce52b0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,35 +1,42 @@ * text eol=lf -*.jar binary - -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.tif binary -*.tiff binary -*.ico binary -*.svg text -*.eps binary - -*.kar binary -*.m4a binary -*.mid binary -*.midi binary -*.mp3 binary -*.ogg binary -*.ra binary - -*.7z binary -*.gz binary -*.tar binary -*.tgz binary -*.zip binary - -*.patch -text - -*.bat text eol=crlf -*.cmd text eol=crlf -*.ps1 text eol=crlf - -*autogenerated binary
\ No newline at end of file +*.[jJ][aA][rR] binary + +*.[pP][nN][gG] binary +*.[jJ][pP][gG] binary +*.[jJ][pP][eE][gG] binary +*.[gG][iI][fF] binary +*.[tT][iI][fF] binary +*.[tT][iI][fF][fF] binary +*.[iI][cC][oO] binary +*.[sS][vV][gG] text +*.[eE][pP][sS] binary +*.[xX][cC][fF] binary + +*.[kK][aA][rR] binary +*.[mM]4[aA] binary +*.[mM][iI][dD] binary +*.[mM][iI][dD][iI] binary +*.[mM][pP]3 binary +*.[oO][gG][gG] binary +*.[rR][aA] binary + +*.7[zZ] binary +*.[gG][zZ] binary +*.[tT][aA][rR] binary +*.[tT][gG][zZ] binary +*.[zZ][iI][pP] binary + +*.[tT][cC][nN] binary +*.[sS][oO] binary +*.[dD][lL][lL] binary +*.[dD][yY][lL][iI][bB] binary +*.[pP][sS][dD] binary + +*.[pP][aA][tT][cC][hH] -text + +*.[bB][aA][tT] text eol=crlf +*.[cC][mM][dD] text eol=crlf +*.[pP][sS]1 text eol=crlf + +*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
\ No newline at end of file diff --git a/build.gradle b/build.gradle index 997b94dc30..252dac4ea1 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1661114848 +//version: 1662920829 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -8,6 +8,10 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import com.matthewprenger.cursegradle.CurseArtifact +import com.matthewprenger.cursegradle.CurseRelation +import com.modrinth.minotaur.dependencies.ModDependency +import com.modrinth.minotaur.dependencies.VersionDependency import org.gradle.internal.logging.text.StyledTextOutput.Style import org.gradle.internal.logging.text.StyledTextOutputFactory @@ -59,6 +63,8 @@ plugins { id 'de.undercouch.download' version '5.0.1' id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false id 'com.diffplug.spotless' version '6.7.2' apply false + id 'com.modrinth.minotaur' version '2.+' apply false + id 'com.matthewprenger.cursegradle' version '1.4.0' apply false } boolean settingsupdated = verifySettingsGradle() settingsupdated = verifyGitAttributes() || settingsupdated @@ -127,11 +133,16 @@ checkPropertyExists("containsMixinsAndOrCoreModOnly") checkPropertyExists("usesShadowedDependencies") checkPropertyExists("developmentEnvironmentUserName") -boolean noPublishedSources = project.hasProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false -boolean usesMixinDebug = project.hasProperty('usesMixinDebug') ?: project.usesMixins.toBoolean() -boolean forceEnableMixins = project.hasProperty('forceEnableMixins') ? project.forceEnableMixins.toBoolean() : false -String channel = project.hasProperty('channel') ? project.channel : 'stable' -String mappingsVersion = project.hasProperty('mappingsVersion') ? project.mappingsVersion : '12' +propertyDefaultIfUnset("noPublishedSources", false) +propertyDefaultIfUnset("usesMixinDebug", project.usesMixins) +propertyDefaultIfUnset("forceEnableMixins", false) +propertyDefaultIfUnset("channel", "stable") +propertyDefaultIfUnset("mappingsVersion", "12") +propertyDefaultIfUnset("modrinthProjectId", "") +propertyDefaultIfUnset("modrinthRelations", "") +propertyDefaultIfUnset("curseForgeProjectId", "") +propertyDefaultIfUnset("curseForgeRelations", "") + String javaSourceDir = "src/main/java/" String scalaSourceDir = "src/main/scala/" String kotlinSourceDir = "src/main/kotlin/" @@ -651,6 +662,107 @@ publishing { } } +if (modrinthProjectId.size() != 0) { + apply plugin: 'com.modrinth.minotaur' + + File changelogFile = new File("CHANGELOG.md") + + modrinth { + token = System.getenv("MODRINTH_TOKEN") + projectId = modrinthProjectId + versionNumber = identifiedVersion + versionType = identifiedVersion.endsWith("-pre") ? "beta" : "release" + changelog = changelogFile.exists() ? changelogFile.getText("UTF-8") : "" + uploadFile = jar + additionalFiles = getSecondaryArtifacts() + gameVersions = [minecraftVersion] + loaders = ["forge"] + debugMode = false + } + + if (modrinthRelations.size() != 0) { + String[] deps = modrinthRelations.split(";") + deps.each { dep -> + if (dep.size() == 0) { + return + } + String[] parts = dep.split(":") + String[] qual = parts[0].split("-") + addModrinthDep(qual[0], qual[1], parts[1]) + } + } + tasks.modrinth.dependsOn(build) + tasks.publish.dependsOn(tasks.modrinth) +} + +if (curseForgeProjectId.size() != 0) { + apply plugin: 'com.matthewprenger.cursegradle' + + File changelogFile = new File("CHANGELOG.md") + + curseforge { + apiKey = System.getenv("CURSEFORGE_TOKEN") + project { + id = curseForgeProjectId + if (changelogFile.exists()) { + changelogType = "markdown" + changelog = changelogFile + } + releaseType = identifiedVersion.endsWith("-pre") ? "beta" : "release" + addGameVersion minecraftVersion + addGameVersion "Forge" + mainArtifact jar + for (artifact in getSecondaryArtifacts()) addArtifact artifact + } + + options { + javaIntegration = false + forgeGradleIntegration = false + debug = false + } + } + + if (curseForgeRelations.size() != 0) { + String[] deps = curseForgeRelations.split(";") + deps.each { dep -> + if (dep.size() == 0) { + return + } + String[] parts = dep.split(":") + addCurseForgeRelation(parts[0], parts[1]) + } + } + tasks.curseforge.dependsOn(build) + tasks.publish.dependsOn(tasks.curseforge) +} + +def addModrinthDep(scope, type, name) { + com.modrinth.minotaur.dependencies.Dependency dep; + if (!(scope in ["required", "optional", "incompatible", "embedded"])) { + throw new Exception("Invalid modrinth dependency scope: " + scope) + } + switch (type) { + case "project": + dep = new ModDependency(name, scope) + break + case "version": + dep = new VersionDependency(name, scope) + break + default: + throw new Exception("Invalid modrinth dependency type: " + type) + } + project.modrinth.dependencies.add(dep) +} + +def addCurseForgeRelation(type, name) { + if (!(type in ["requiredDependency", "embeddedLibrary", "optionalDependency", "tool", "incompatible"])) { + throw new Exception("Invalid CurseForge relation type: " + type) + } + CurseArtifact artifact = project.curseforge.curseProjects[0].mainArtifact + CurseRelation rel = (artifact.curseRelations ?: (artifact.curseRelations = new CurseRelation())) + rel."$type"(name) +} + // Updating task updateBuildScript { doLast { @@ -963,6 +1075,21 @@ def checkPropertyExists(String propertyName) { } } +def propertyDefaultIfUnset(String propertyName, defaultValue) { + if (!project.hasProperty(propertyName) || project.property(propertyName) == "") { + project.ext.setProperty(propertyName, defaultValue) + } +} + def getFile(String relativePath) { return new File(projectDir, relativePath) } + +def getSecondaryArtifacts() { + // Because noPublishedSources from the beginning of the script is somehow not visible here... + boolean noPublishedSources = project.hasProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false + def secondaryArtifacts = [devJar] + if (!noPublishedSources) secondaryArtifacts += [sourcesJar] + if (apiPackage) secondaryArtifacts += [apiJar] + return secondaryArtifacts +} diff --git a/src/main/java/kubatech/api/LoaderReference.java b/src/main/java/kubatech/api/LoaderReference.java index 482da4204f..289ffb5d72 100644 --- a/src/main/java/kubatech/api/LoaderReference.java +++ b/src/main/java/kubatech/api/LoaderReference.java @@ -13,4 +13,5 @@ public class LoaderReference { public static final boolean GTNHCoreMod = Loader.isModLoaded("dreamcraft"); public static final boolean GTPlusPlus = Loader.isModLoaded("miscutils"); public static final boolean HarvestCraft = Loader.isModLoaded("harvestcraft"); + public static final boolean TwilightForest = Loader.isModLoaded("TwilightForest"); } diff --git a/src/main/java/kubatech/api/network/LoadConfigPacket.java b/src/main/java/kubatech/api/network/LoadConfigPacket.java index 2199eb2db9..defb139151 100644 --- a/src/main/java/kubatech/api/network/LoadConfigPacket.java +++ b/src/main/java/kubatech/api/network/LoadConfigPacket.java @@ -61,7 +61,7 @@ public class LoadConfigPacket implements IMessage { @Override public void toBytes(ByteBuf buf) { - if (!Config.mobHandlerEnabled) buf.writeBoolean(false); + if (!Config.MobHandler.mobHandlerEnabled) buf.writeBoolean(false); else { buf.writeBoolean(true); buf.writeInt(mobsToLoad.size()); diff --git a/src/main/java/kubatech/client/effect/EntityRenderer.java b/src/main/java/kubatech/client/effect/EntityRenderer.java index ed545b3cb6..1e211b6491 100644 --- a/src/main/java/kubatech/client/effect/EntityRenderer.java +++ b/src/main/java/kubatech/client/effect/EntityRenderer.java @@ -1,23 +1,29 @@ package kubatech.client.effect; import static net.minecraft.client.renderer.entity.RenderManager.*; -import static org.lwjgl.opengl.GL11.GL_MODELVIEW_STACK_DEPTH; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import kubatech.Tags; import kubatech.api.utils.MobUtils; +import kubatech.config.Config; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLiving; import net.minecraft.world.World; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; +import org.lwjgl.util.glu.GLU; @SideOnly(Side.CLIENT) public class EntityRenderer extends EntityFX { + private static final Logger LOG = LogManager.getLogger(Tags.MODID + "[Entity Renderer]"); private EntityLiving entityToRender = null; public EntityRenderer(World p_i1218_1_, double x, double y, double z, int age) { @@ -79,38 +85,36 @@ public class EntityRenderer extends EntityFX { entityToRender.worldObj = this.worldObj; entityToRender.setPosition(this.posX, this.posY, this.posZ); + Minecraft mc = Minecraft.getMinecraft(); + double rotation; - // double headrotation; + double headrotation; { double x1 = this.posX; - double x2 = Minecraft.getMinecraft().thePlayer.posX; + double x2 = mc.thePlayer.posX; double y1 = this.posZ; - double y2 = Minecraft.getMinecraft().thePlayer.posZ; + double y2 = mc.thePlayer.posZ; double k = Math.toDegrees(Math.atan2(x2 - x1, y1 - y2)); if (k < 0d) k += 360d; k -= 180d; rotation = k; } - /* - { - double y1 = this.posY; - double y2 = Minecraft.getMinecraft().thePlayer.posY; - double d = Minecraft.getMinecraft() - .thePlayer - .getDistance(this.posX, Minecraft.getMinecraft().thePlayer.posY, this.posZ); - double k = Math.toDegrees(Math.atan2(y1 - y2, d)); - if (k < 0d) k += 360d; - headrotation = k; - } - - */ + + { + double y1 = this.posY + entityToRender.getEyeHeight(); + double y2 = mc.thePlayer.posY + mc.thePlayer.getEyeHeight(); + double d = mc.thePlayer.getDistance(this.posX, y2, this.posZ); + double k = Math.toDegrees(Math.atan2(y1 - y2, d)); + if (k < 0d) k += 360d; + headrotation = k; + } entityToRender.prevRotationYawHead = entityToRender.rotationYawHead; entityToRender.prevRenderYawOffset = entityToRender.renderYawOffset; - // entityToRender.prevRotationPitch = entityToRender.rotationPitch; + entityToRender.prevRotationPitch = entityToRender.rotationPitch; entityToRender.renderYawOffset = (float) rotation; entityToRender.rotationYawHead = (float) rotation; - // entityToRender.rotationPitch = (float)headrotation; + entityToRender.rotationPitch = (float) headrotation; float p_147936_2_ = 0.5f; @@ -128,7 +132,10 @@ public class EntityRenderer extends EntityFX { GL11.glColor4f(1f, 1f, 1f, 1F); RenderHelper.enableStandardItemLighting(); GL11.glMatrixMode(GL11.GL_MODELVIEW); - int stackdepth = GL11.glGetInteger(GL_MODELVIEW_STACK_DEPTH); + + GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); + + int stackdepth = GL11.glGetInteger(GL11.GL_MODELVIEW_STACK_DEPTH); GL11.glPushMatrix(); GL11.glTranslatef( (float) (this.posX - renderPosX), (float) (this.posY - renderPosY), (float) (this.posZ - renderPosZ)); @@ -145,8 +152,18 @@ public class EntityRenderer extends EntityFX { } } - stackdepth -= GL11.glGetInteger(GL_MODELVIEW_STACK_DEPTH); + GL11.glMatrixMode(GL11.GL_MODELVIEW_MATRIX); + stackdepth -= GL11.glGetInteger(GL11.GL_MODELVIEW_STACK_DEPTH); if (stackdepth < 0) for (; stackdepth < 0; stackdepth++) GL11.glPopMatrix(); + if (stackdepth > 0) for (; stackdepth > 0; stackdepth--) GL11.glPushMatrix(); + + GL11.glPopAttrib(); + + int err; + while ((err = GL11.glGetError()) != GL11.GL_NO_ERROR) + if (Config.Debug.showRenderErrors) + LOG.error(EntityList.getEntityString(entityToRender) + " | GL ERROR: " + err + " / " + + GLU.gluErrorString(err)); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_COLOR_MATERIAL); diff --git a/src/main/java/kubatech/config/Config.java b/src/main/java/kubatech/config/Config.java index b09de66910..da6bd4a16a 100644 --- a/src/main/java/kubatech/config/Config.java +++ b/src/main/java/kubatech/config/Config.java @@ -25,26 +25,108 @@ import net.minecraftforge.common.config.Configuration; public class Config { - private static class Categories { - public static final String mobHandler = "MobHandler"; + private enum Category { + MOB_HANDLER("MobHandler"), + DEBUG("Debug"); + final String categoryName; + + Category(String s) { + categoryName = s; + } + + public String get() { + return categoryName; + } + + @Override + public String toString() { + return get(); + } } - public static boolean mobHandlerEnabled = true; + public static class MobHandler { + + public static boolean mobHandlerEnabled = true; + + public enum _CacheRegenerationTrigger { + Never, + ModAdditionRemoval, + ModAdditionRemovalChange, + Always; + + public static _CacheRegenerationTrigger get(int oridinal) { + return values()[oridinal]; + } + } + + public static _CacheRegenerationTrigger regenerationTrigger = + _CacheRegenerationTrigger.ModAdditionRemovalChange; + public static boolean includeEmptyMobs = true; + public static String[] mobBlacklist; + + private static void load(Configuration configuration) { + Category category = Category.MOB_HANDLER; + mobHandlerEnabled = configuration + .get( + category.get(), + "Enabled", + true, + "Enable \"Mob Drops\" NEI page and Extreme Extermination Chamber") + .getBoolean(); + StringBuilder c = new StringBuilder("When will cache regeneration trigger? "); + for (_CacheRegenerationTrigger value : _CacheRegenerationTrigger.values()) + c.append(value.ordinal()).append(" - ").append(value.name()).append(", "); + regenerationTrigger = _CacheRegenerationTrigger.get(configuration + .get( + category.get(), + "CacheRegenerationTrigger", + _CacheRegenerationTrigger.ModAdditionRemovalChange.ordinal(), + c.toString()) + .getInt()); + includeEmptyMobs = configuration + .get(category.get(), "IncludeEmptyMobs", true, "Include mobs that have no drops in NEI") + .getBoolean(); + mobBlacklist = configuration + .get( + category.get(), + "MobBlacklist", + new String[] { + "Giant", + "Thaumcraft.TravelingTrunk", + "chisel.snowman", + "OpenBlocks.Luggage", + "OpenBlocks.MiniMe", + "SpecialMobs.SpecialCreeper", + "SpecialMobs.SpecialZombie", + "SpecialMobs.SpecialPigZombie", + "SpecialMobs.SpecialSlime", + "SpecialMobs.SpecialSkeleton", + "SpecialMobs.SpecialEnderman", + "SpecialMobs.SpecialCaveSpider", + "SpecialMobs.SpecialGhast", + "SpecialMobs.SpecialWitch", + "SpecialMobs.SpecialSpider", + "TwilightForest.HydraHead", + "TwilightForest.RovingCube", + "TwilightForest.Harbinger Cube", + "TwilightForest.Adherent", + "SpecialMobs.SpecialSilverfish", + }, + "These mobs will be skipped when generating recipe map") + .getStringList(); + } + } - public enum _CacheRegenerationTrigger { - Never, - ModAdditionRemoval, - ModAdditionRemovalChange, - Always; + public static class Debug { + public static boolean showRenderErrors = false; - public static _CacheRegenerationTrigger get(int oridinal) { - return values()[oridinal]; + private static void load(Configuration configuration) { + Category category = Category.DEBUG; + showRenderErrors = + configuration.get(category.get(), "ShowRenderErrors", false).getBoolean(); } } - public static _CacheRegenerationTrigger regenerationTrigger = _CacheRegenerationTrigger.ModAdditionRemovalChange; - public static boolean includeEmptyMobs = true; - public static String[] mobBlacklist; public static File configFile; public static File configDirectory; @@ -61,54 +143,8 @@ public class Config { Configuration configuration = new Configuration(configFile); configuration.load(); - mobHandlerEnabled = configuration - .get( - Categories.mobHandler, - "Enabled", - true, - "Enable \"Mob Drops\" NEI page and Extreme Extermination Chamber") - .getBoolean(); - StringBuilder c = new StringBuilder("When will cache regeneration trigger? "); - for (_CacheRegenerationTrigger value : _CacheRegenerationTrigger.values()) - c.append(value.ordinal()).append(" - ").append(value.name()).append(", "); - regenerationTrigger = _CacheRegenerationTrigger.get(configuration - .get( - Categories.mobHandler, - "CacheRegenerationTrigger", - _CacheRegenerationTrigger.ModAdditionRemovalChange.ordinal(), - c.toString()) - .getInt()); - includeEmptyMobs = configuration - .get(Categories.mobHandler, "IncludeEmptyMobs", true, "Include mobs that have no drops in NEI") - .getBoolean(); - mobBlacklist = configuration - .get( - Categories.mobHandler, - "MobBlacklist", - new String[] { - "Giant", - "Thaumcraft.TravelingTrunk", - "chisel.snowman", - "OpenBlocks.Luggage", - "OpenBlocks.MiniMe", - "SpecialMobs.SpecialCreeper", - "SpecialMobs.SpecialZombie", - "SpecialMobs.SpecialPigZombie", - "SpecialMobs.SpecialSlime", - "SpecialMobs.SpecialSkeleton", - "SpecialMobs.SpecialEnderman", - "SpecialMobs.SpecialCaveSpider", - "SpecialMobs.SpecialGhast", - "SpecialMobs.SpecialWitch", - "SpecialMobs.SpecialSpider", - "TwilightForest.HydraHead", - "TwilightForest.RovingCube", - "TwilightForest.Harbinger Cube", - "TwilightForest.Adherent", - "SpecialMobs.SpecialSilverfish", - }, - "These mobs will be skipped when generating recipe map") - .getStringList(); + MobHandler.load(configuration); + Debug.load(configuration); if (configuration.hasChanged()) { configuration.save(); diff --git a/src/main/java/kubatech/loaders/MobRecipeLoader.java b/src/main/java/kubatech/loaders/MobRecipeLoader.java index 6b183aa205..62b7d819f2 100644 --- a/src/main/java/kubatech/loaders/MobRecipeLoader.java +++ b/src/main/java/kubatech/loaders/MobRecipeLoader.java @@ -57,6 +57,7 @@ import minetweaker.MineTweakerAPI; import minetweaker.api.entity.IEntityDefinition; import minetweaker.api.item.IItemStack; import minetweaker.mc1710.item.MCItemStack; +import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; @@ -67,6 +68,7 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntitySlime; import net.minecraft.entity.monster.IMob; +import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -82,7 +84,7 @@ import thaumcraft.common.items.wands.ItemWandCasting; public class MobRecipeLoader { - private static final Logger LOG = LogManager.getLogger(Tags.MODID + "[Mob Handler]"); + private static final Logger LOG = LogManager.getLogger(Tags.MODID + "[Mob Recipe Loader]"); public static final MobRecipeLoader instance = new MobRecipeLoader(); @@ -580,7 +582,7 @@ public class MobRecipeLoader { if (alreadyGenerated) return; alreadyGenerated = true; - if (!Config.mobHandlerEnabled) return; + if (!Config.MobHandler.mobHandlerEnabled) return; World f = new GT_DummyWorld() { @Override @@ -593,6 +595,17 @@ public class MobRecipeLoader { public List getEntitiesWithinAABB(Class p_72872_1_, AxisAlignedBB p_72872_2_) { return new ArrayList(); } + + @Override + public Block getBlock(int aX, int aY, int aZ) { + if (LoaderReference.TwilightForest + && new Throwable() + .getStackTrace()[1] + .getClassName() + .equals("twilightforest.client.renderer.entity.RenderTFSnowQueenIceShield")) + return Blocks.packed_ice; + return super.getBlock(aX, aY, aZ); + } }; f.isRemote = true; // quick hack to get around achievements @@ -603,17 +616,18 @@ public class MobRecipeLoader { Gson gson = GSONUtils.GSON_BUILDER.create(); String modlistversion; - if (Config.regenerationTrigger == Config._CacheRegenerationTrigger.ModAdditionRemoval) + if (Config.MobHandler.regenerationTrigger == Config.MobHandler._CacheRegenerationTrigger.ModAdditionRemoval) modlistversion = ModUtils.getModListVersionIgnoringModVersions(); else modlistversion = ModUtils.getModListVersion(); - if (Config.regenerationTrigger != Config._CacheRegenerationTrigger.Always && cache.exists()) { + if (Config.MobHandler.regenerationTrigger != Config.MobHandler._CacheRegenerationTrigger.Always + && cache.exists()) { LOG.info("Parsing Cached map"); Reader reader = null; try { reader = Files.newReader(cache, StandardCharsets.UTF_8); MobRecipeLoaderCacheStructure s = gson.fromJson(reader, MobRecipeLoaderCacheStructure.class); - if (Config.regenerationTrigger == Config._CacheRegenerationTrigger.Never + if (Config.MobHandler.regenerationTrigger == Config.MobHandler._CacheRegenerationTrigger.Never || s.version.equals(modlistversion)) { for (Map.Entry<String, ArrayList<MobDrop>> entry : s.moblist.entrySet()) { try { @@ -1133,7 +1147,7 @@ public class MobRecipeLoader { for (Map.Entry<String, GeneralMappedMob> entry : GeneralMobList.entrySet()) { String k = entry.getKey(); GeneralMappedMob v = entry.getValue(); - if (Arrays.asList(Config.mobBlacklist).contains(k)) { + if (Arrays.asList(Config.MobHandler.mobBlacklist).contains(k)) { LOG.info("Entity " + k + " is blacklisted, skipping"); continue; } @@ -1167,7 +1181,7 @@ public class MobRecipeLoader { if (drops.isEmpty()) { LOG.info("Entity " + k + " doesn't drop any items, skipping EEC map"); - if (!Config.includeEmptyMobs) continue; + if (!Config.MobHandler.includeEmptyMobs) continue; LoadConfigPacket.instance.mobsToLoad.add(k); LOG.info("Registered " + k); continue; diff --git a/src/main/java/kubatech/nei/Mob_Handler.java b/src/main/java/kubatech/nei/Mob_Handler.java index 3c83006e3d..a870c07a24 100644 --- a/src/main/java/kubatech/nei/Mob_Handler.java +++ b/src/main/java/kubatech/nei/Mob_Handler.java @@ -20,7 +20,6 @@ package kubatech.nei; import static kubatech.nei.Mob_Handler.Translations.*; -import static org.lwjgl.opengl.GL11.GL_MODELVIEW_STACK_DEPTH; import codechicken.lib.gui.GuiDraw; import codechicken.nei.NEIClientUtils; @@ -37,12 +36,14 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.Random; +import kubatech.Tags; import kubatech.api.LoaderReference; import kubatech.api.mobhandler.MobDrop; import kubatech.api.utils.FastRandom; import kubatech.api.utils.InfernalHelper; import kubatech.api.utils.MobUtils; import kubatech.api.utils.ModUtils; +import kubatech.config.Config; import kubatech.kubatech; import kubatech.loaders.MobRecipeLoader; import kubatech.tileentity.gregtech.multiblock.GT_MetaTileEntity_ExtremeExterminationChamber; @@ -64,9 +65,12 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagString; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.lwjgl.BufferUtils; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; +import org.lwjgl.util.glu.GLU; public class Mob_Handler extends TemplateRecipeHandler { @@ -109,6 +113,7 @@ public class Mob_Handler extends TemplateRecipeHandler { } } + private static final Logger LOG = LogManager.getLogger(Tags.MODID + "[Mob Handler]"); private static final Mob_Handler instance = new Mob_Handler(); private static final List<MobCachedRecipe> cachedRecipes = new ArrayList<>(); public static int cycleTicksStatic = Math.abs((int) System.currentTimeMillis()); @@ -277,7 +282,9 @@ public class Mob_Handler extends TemplateRecipeHandler { float x = buf.get(12); float y = buf.get(13); - int stackdepth = GL11.glGetInteger(GL_MODELVIEW_STACK_DEPTH); + int stackdepth = GL11.glGetInteger(GL11.GL_MODELVIEW_STACK_DEPTH); + + GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix(); @@ -303,8 +310,17 @@ public class Mob_Handler extends TemplateRecipeHandler { } } - stackdepth -= GL11.glGetInteger(GL_MODELVIEW_STACK_DEPTH); + GL11.glMatrixMode(GL11.GL_MODELVIEW_MATRIX); + stackdepth -= GL11.glGetInteger(GL11.GL_MODELVIEW_STACK_DEPTH); if (stackdepth < 0) for (; stackdepth < 0; stackdepth++) GL11.glPopMatrix(); + if (stackdepth > 0) for (; stackdepth > 0; stackdepth--) GL11.glPushMatrix(); + + GL11.glPopAttrib(); + + int err; + while ((err = GL11.glGetError()) != GL11.GL_NO_ERROR) + if (Config.Debug.showRenderErrors) + LOG.error(currentrecipe.mobname + " | GL ERROR: " + err + " / " + GLU.gluErrorString(err)); GL11.glDisable(GL11.GL_DEPTH_TEST); } |