mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-10-26 14:24:14 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cdc57215e3 | ||
|
|
9f42531f37 | ||
|
|
95453b430e |
No files matched your search
@@ -10,6 +10,7 @@ dependencies {
|
||||
compileOnly("com.github.GTNewHorizons:CodeChickenCore:1.4.12:dev") {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:inventory-tweaks:1.7.1:dev") {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.11-GTNH:dev') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:Botania:1.13.36-GTNH:dev") {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.461:dev") {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:Backhand:1.8.8:dev") {transitive = false}
|
||||
|
||||
|
||||
@@ -186,6 +186,11 @@ modrinthRelations =
|
||||
# Leave this empty if you don't want to publish on CurseForge.
|
||||
curseForgeProjectId =
|
||||
|
||||
# Comma-separated supported CurseForge environments: client, server (case-insensitive).
|
||||
# Use client or server for mods that only support one environment. Defaults to client,server.
|
||||
# These tags describe where the mod can run, not whether installation is required on both sides.
|
||||
curseForgeEnvironments = client,server
|
||||
|
||||
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||
# Syntax: type1:name1;type2:name2;...
|
||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c2dd35c9d0aaf0ba6ad0791320f99dfc/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/e5810bd7fd1f8a586644409d395a7e55/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7b3c4877c0749019e6805bb61e421497/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/8e1d9ee5d0f13e442218f6884a306da1/redirect
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9064f22734b42ac03e85df04b632e167/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/4d0277c49991306ac78048580fe34bcf/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a9fa3b809e484a1e1ac4308a5dda661a/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/aa99913fa6d767d899ffc96082da01ca/redirect
|
||||
toolchainVersion=25
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.24'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.34'
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
@@ -48,7 +49,7 @@ public class ResourceHandler {
|
||||
private static ResourceLocation particles = new ResourceLocation(
|
||||
References.RESOURCESPREFIX + "textures/particle/particles.png");
|
||||
private static Map<String, ResourceLocation> cachedResources = new HashMap<String, ResourceLocation>();
|
||||
public static Map<String, CustomResourceLocation> downloadedImages = new HashMap<String, CustomResourceLocation>();
|
||||
public static Map<String, CustomResourceLocation> downloadedImages = new ConcurrentHashMap<>();
|
||||
|
||||
private static String savePath;
|
||||
private static File saveFolder;
|
||||
@@ -64,7 +65,6 @@ public class ResourceHandler {
|
||||
if (downloadThread.isReloadRequired()) LogHelper.info("Image Download Finished");
|
||||
downloadStatus = downloadThread.wasSuccessful ? 1 : 2;
|
||||
FMLCommonHandler.instance().bus().unregister(this);
|
||||
addRSPack(event != null);
|
||||
downloadThread = null;
|
||||
}
|
||||
}
|
||||
@@ -74,6 +74,10 @@ public class ResourceHandler {
|
||||
|
||||
if (event != null) savePath = event.getModConfigurationDirectory().getParentFile().getAbsolutePath()
|
||||
+ "/config/draconicevolution";
|
||||
|
||||
// Register the namespace before FML's final reload; folder-pack files are resolved on demand.
|
||||
getImagesFolder();
|
||||
addRSPack();
|
||||
GUIManual.loadPages();
|
||||
|
||||
downloadThread = new DownloadThread(GUIManual.imageURLs);
|
||||
@@ -83,7 +87,7 @@ public class ResourceHandler {
|
||||
public static class DownloadThread extends Thread {
|
||||
|
||||
private List<String> imageURLs;
|
||||
private boolean isFinished = false;
|
||||
private volatile boolean isFinished = false;
|
||||
private boolean wasSuccessful = true;
|
||||
private boolean reloadRequired = false;
|
||||
|
||||
@@ -171,7 +175,7 @@ public class ResourceHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private static void addRSPack(boolean refreash) {
|
||||
private static void addRSPack() {
|
||||
File rspack = new File(getConfigFolder(), "/resources");
|
||||
if (!rspack.exists()) return;
|
||||
|
||||
@@ -200,7 +204,6 @@ public class ResourceHandler {
|
||||
|
||||
f.set(Minecraft.getMinecraft(), defaultResourcePacks);
|
||||
LogHelper.info("RS Added");
|
||||
if (refreash) Minecraft.getMinecraft().refreshResources();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
-194
@@ -1,194 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.client.render.tile;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.ITickable;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.ChunkEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.brandon3055.draconicevolution.client.render.item.RenderMobSoul;
|
||||
import com.brandon3055.draconicevolution.common.items.MobSoul;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TilePlacedItem;
|
||||
import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class PlacedItemDisplayListCache {
|
||||
|
||||
private static final long GLINT_TTL_MS = 33L;
|
||||
private static final long ANIMATED_TTL_MS = 50L;
|
||||
private static final long MOBSOUL_TTL_MS = 1000L;
|
||||
private static final long PRUNE_INTERVAL_MS = 1000L;
|
||||
|
||||
private final Map<TilePlacedItem, CacheEntry> displayListCache = new HashMap<>();
|
||||
private int atlasVersion;
|
||||
private long nextPruneMs;
|
||||
|
||||
public PlacedItemDisplayListCache() {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
public CacheEntry getOrCompile(TilePlacedItem tile, ItemStack stack, int meta, Runnable renderBody) {
|
||||
CacheEntry entry = displayListCache.get(tile);
|
||||
if (entry == null || !entry.isValid(stack, meta, tile.rotation, atlasVersion) || entry.needsRefresh()) {
|
||||
dispose(tile);
|
||||
entry = compile(tile, stack, meta, renderBody);
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
private CacheEntry compile(TilePlacedItem tile, ItemStack stack, int meta, Runnable renderBody) {
|
||||
int listId = GL11.glGenLists(1);
|
||||
boolean mobSoul = stack.getItem() instanceof MobSoul;
|
||||
boolean previousRotationFlag = RenderMobSoul.applyTimeRotation;
|
||||
GL11.glNewList(listId, GL11.GL_COMPILE);
|
||||
try {
|
||||
if (mobSoul) RenderMobSoul.applyTimeRotation = false;
|
||||
renderBody.run();
|
||||
GL11.glEndList();
|
||||
} catch (RuntimeException | Error t) {
|
||||
GL11.glEndList();
|
||||
GL11.glDeleteLists(listId, 1);
|
||||
RenderItem.renderInFrame = false;
|
||||
throw t;
|
||||
} finally {
|
||||
RenderMobSoul.applyTimeRotation = previousRotationFlag;
|
||||
}
|
||||
CacheEntry entry = new CacheEntry(
|
||||
listId,
|
||||
stack,
|
||||
stack.stackSize,
|
||||
meta,
|
||||
tile.rotation,
|
||||
getTTL(stack, mobSoul),
|
||||
mobSoul,
|
||||
atlasVersion);
|
||||
displayListCache.put(tile, entry);
|
||||
return entry;
|
||||
}
|
||||
|
||||
private long getTTL(ItemStack stack, boolean mobSoul) {
|
||||
if (mobSoul) {
|
||||
// "Any" soul swaps mob every second while named souls only need per-frame rotation outside the list
|
||||
return isAnyMobSoul(stack) ? MOBSOUL_TTL_MS : Long.MAX_VALUE;
|
||||
}
|
||||
|
||||
if (stack.hasEffect()) return GLINT_TTL_MS; // Glint scroll (~30 fps)
|
||||
if (stack.getItem().getIconIndex(stack) instanceof ITickable) return ANIMATED_TTL_MS; // 20 Hz sprite ticks
|
||||
return Long.MAX_VALUE; // static (event-invalidated)
|
||||
}
|
||||
|
||||
private boolean isAnyMobSoul(ItemStack stack) {
|
||||
return "Any".equals(ItemNBTHelper.getString(stack, "Name", "Pig"));
|
||||
}
|
||||
|
||||
public void dispose(TilePlacedItem tile) {
|
||||
CacheEntry entry = displayListCache.remove(tile);
|
||||
if (entry != null) GL11.glDeleteLists(entry.listId, 1);
|
||||
}
|
||||
|
||||
private void pruneInvalidEntries() {
|
||||
if (displayListCache.isEmpty()) return;
|
||||
long now = Minecraft.getSystemTime();
|
||||
if (now < nextPruneMs) return;
|
||||
nextPruneMs = now + PRUNE_INTERVAL_MS;
|
||||
|
||||
Iterator<Map.Entry<TilePlacedItem, CacheEntry>> it = displayListCache.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<TilePlacedItem, CacheEntry> entry = it.next();
|
||||
TilePlacedItem tile = entry.getKey();
|
||||
if (tile.isInvalid() || tile.getWorldObj() == null || tile.getStack() == null) {
|
||||
GL11.glDeleteLists(entry.getValue().listId, 1);
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void clearAll() {
|
||||
for (CacheEntry entry : displayListCache.values()) {
|
||||
GL11.glDeleteLists(entry.listId, 1);
|
||||
}
|
||||
displayListCache.clear();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRenderWorldLast(RenderWorldLastEvent event) {
|
||||
pruneInvalidEntries();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTextureStitch(TextureStitchEvent.Post event) {
|
||||
atlasVersion++;
|
||||
clearAll();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onChunkUnload(ChunkEvent.Unload event) {
|
||||
if (!event.world.isRemote) return;
|
||||
Chunk chunk = event.getChunk();
|
||||
Iterator<Map.Entry<TilePlacedItem, CacheEntry>> it = displayListCache.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<TilePlacedItem, CacheEntry> e = it.next();
|
||||
TilePlacedItem tile = e.getKey();
|
||||
if ((tile.xCoord >> 4) == chunk.xPosition && (tile.zCoord >> 4) == chunk.zPosition) {
|
||||
GL11.glDeleteLists(e.getValue().listId, 1);
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldUnload(WorldEvent.Unload event) {
|
||||
if (!event.world.isRemote) return;
|
||||
clearAll();
|
||||
}
|
||||
|
||||
public static class CacheEntry {
|
||||
|
||||
public final int listId;
|
||||
public final ItemStack stack;
|
||||
public final int stackSize;
|
||||
public final int meta;
|
||||
public final float rotation;
|
||||
public final long ttlMs;
|
||||
public final boolean mobSoul;
|
||||
public final int atlasVersion;
|
||||
private long lastCompileMs;
|
||||
|
||||
private CacheEntry(int listId, ItemStack stack, int stackSize, int meta, float rotation, long ttlMs,
|
||||
boolean mobSoul, int atlasVersion) {
|
||||
this.listId = listId;
|
||||
this.stack = stack;
|
||||
this.stackSize = stackSize;
|
||||
this.meta = meta;
|
||||
this.rotation = rotation;
|
||||
this.ttlMs = ttlMs;
|
||||
this.mobSoul = mobSoul;
|
||||
this.atlasVersion = atlasVersion;
|
||||
this.lastCompileMs = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
private boolean isValid(ItemStack stack, int meta, float rotation, int atlasVersion) {
|
||||
// checking the pointer of the stack is enough
|
||||
return this.stack == stack && this.stackSize == stack.stackSize
|
||||
&& this.meta == meta
|
||||
&& this.rotation == rotation
|
||||
&& this.atlasVersion == atlasVersion;
|
||||
}
|
||||
|
||||
private boolean needsRefresh() {
|
||||
return ttlMs != Long.MAX_VALUE && System.currentTimeMillis() - lastCompileMs >= ttlMs;
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-20
@@ -14,8 +14,6 @@ import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.brandon3055.draconicevolution.client.render.item.RenderMobSoul;
|
||||
import com.brandon3055.draconicevolution.client.render.tile.PlacedItemDisplayListCache.CacheEntry;
|
||||
import com.brandon3055.draconicevolution.common.items.MobSoul;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TilePlacedItem;
|
||||
|
||||
@@ -29,29 +27,17 @@ public class RenderTilePlacedItem extends TileEntitySpecialRenderer {
|
||||
private static final float MOBSOUL_CENTER_Z = 0.5F;
|
||||
|
||||
private final EntityItem cachedEntity = new EntityItem(null, 0, 0, 0, new ItemStack(Items.apple));
|
||||
private final PlacedItemDisplayListCache displayListCache = new PlacedItemDisplayListCache();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float timeSinceLastTick) {
|
||||
if (!(te instanceof TilePlacedItem tile)) return;
|
||||
ItemStack stack = tile.getStack();
|
||||
if (stack == null) {
|
||||
displayListCache.dispose(tile);
|
||||
return;
|
||||
}
|
||||
// I think without this check it could have thrown a NPE if an item being displayed was removed
|
||||
if (stack == null || stack.getItem() == null) return;
|
||||
if (tile.getWorldObj() == null) return;
|
||||
int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
CacheEntry entry = displayListCache.getOrCompile(tile, stack, meta, () -> renderItem(tile));
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glTranslated(x, y, z);
|
||||
if (entry.mobSoul) {
|
||||
GL11.glTranslated(MOBSOUL_CENTER_X, MOBSOUL_CENTER_Y, MOBSOUL_CENTER_Z);
|
||||
GL11.glRotatef(RenderMobSoul.getRotationAngle(), 0F, 1F, 0F);
|
||||
GL11.glTranslated(-MOBSOUL_CENTER_X, -MOBSOUL_CENTER_Y, -MOBSOUL_CENTER_Z);
|
||||
}
|
||||
GL11.glCallList(entry.listId);
|
||||
GL11.glPopAttrib();
|
||||
renderItem(tile);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -86,7 +72,6 @@ public class RenderTilePlacedItem extends TileEntitySpecialRenderer {
|
||||
GL11.glTranslatef(0.0F, -0.18F, 0.0F);
|
||||
}
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT);
|
||||
RenderItem.renderInFrame = true;
|
||||
try {
|
||||
this.cachedEntity.setEntityItemStack(stack);
|
||||
@@ -96,9 +81,8 @@ public class RenderTilePlacedItem extends TileEntitySpecialRenderer {
|
||||
} finally {
|
||||
this.cachedEntity.setEntityItemStack(null);
|
||||
this.cachedEntity.setWorld(null);
|
||||
RenderItem.renderInFrame = false;
|
||||
}
|
||||
RenderItem.renderInFrame = false;
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
private void metaAdjustItemTool(int meta) {
|
||||
|
||||
@@ -39,9 +39,11 @@ import com.gtnewhorizon.gtnhlib.GTNHLib;
|
||||
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.IBauble;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileSolegnolia;
|
||||
|
||||
/**
|
||||
* Created by brandon3055 on 9/3/2016.
|
||||
@@ -50,6 +52,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles")
|
||||
public class Magnet extends ItemDE implements IBauble, IConfigurableItem {
|
||||
|
||||
private static final boolean BOTANIA_LOADED = Loader.isModLoaded("Botania");
|
||||
|
||||
private IIcon draconium;
|
||||
private IIcon awakened;
|
||||
|
||||
@@ -120,6 +124,9 @@ public class Magnet extends ItemDE implements IBauble, IConfigurableItem {
|
||||
if (IConfigurableItem.ProfileHelper.getBoolean(stack, References.MAGNET_SNEAK, true) && entity.isSneaking()) {
|
||||
return;
|
||||
}
|
||||
if (BOTANIA_LOADED && SubTileSolegnolia.hasSolegnoliaAround(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
int range = stack.getItemDamage() == 0 ? 8 : 32;
|
||||
List<EntityItem> items = world.getEntitiesWithinAABB(
|
||||
|
||||
Reference in new issue
Block a user