Skip to content

Commit

Permalink
add compat to hodgepodge
Browse files Browse the repository at this point in the history
turns out we just cannot call render block here since our blocks are not 1x1x1 and I definitely don't want to do one draw call for every hint particle
  • Loading branch information
Glease committed Aug 25, 2022
1 parent 5b6b51f commit 7389f34
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/com/gtnewhorizon/structurelib/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ public void preInit(FMLPreInitializationEvent e) {
MinecraftForge.EVENT_BUS.register(new ForgeEventHandler());
}

static void markTextureUsed(IIcon icon) {
if (StructureLib.COMPAT instanceof IStructureCompat)
((IStructureCompat) StructureLib.COMPAT).markTextureUsed(icon);
}

private static class HintGroup {
private final List<HintParticleInfo> hints = new LinkedList<>();
private int creationTime = -1;
Expand Down Expand Up @@ -310,6 +315,8 @@ public void draw(Tessellator tes) {
for (int i = 0; i < 6; i++) {
if (icons[i] == null) continue;

markTextureUsed(icons[i]);

double u = icons[i].getMinU();
double U = icons[i].getMaxU();
double v = icons[i].getMinV();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.gtnewhorizon.structurelib;

import net.minecraft.util.IIcon;

public interface IStructureCompat {
void markTextureUsed(IIcon o);
}
11 changes: 11 additions & 0 deletions src/main/java/com/gtnewhorizon/structurelib/StructureLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.gtnewhorizon.structurelib.net.SetChannelDataMessage;
import com.gtnewhorizon.structurelib.net.UpdateHintParticleMessage;
import com.gtnewhorizon.structurelib.util.XSTR;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
Expand Down Expand Up @@ -38,6 +39,7 @@
acceptableRemoteVersions = "*",
guiFactory = "com.gtnewhorizon.structurelib.GuiFactory")
public class StructureLib {
private static final String STRUCTURECOMPAT_MODID = "structurecompat";
public static boolean DEBUG_MODE;
public static boolean PANIC_MODE = Boolean.getBoolean("structurelib.panic");
public static Logger LOGGER = LogManager.getLogger("StructureLib");
Expand Down Expand Up @@ -71,6 +73,8 @@ public class StructureLib {
@Mod.Instance
static StructureLib INSTANCE;

static Object COMPAT;

static Block blockHint;
static Item itemBlockHint;
static Item itemFrontRotationTool;
Expand All @@ -95,6 +99,13 @@ public void preInit(FMLPreInitializationEvent e) {
itemConstructableTrigger.getUnlocalizedName());
proxy.preInit(e);
NetworkRegistry.INSTANCE.registerGuiHandler(instance(), new GuiHandler());

if (Loader.isModLoaded(STRUCTURECOMPAT_MODID)) {
COMPAT = Loader.instance()
.getIndexedModList()
.get(STRUCTURECOMPAT_MODID)
.getMod();
}
}

@Mod.EventHandler
Expand Down

0 comments on commit 7389f34

Please sign in to comment.