-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from D-Cysteine/main
v0.4.1
- Loading branch information
Showing
32 changed files
with
597 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
neiCustomDiagramVersion=0.3.1 | ||
neiCustomDiagramVersion=0.4.1 | ||
|
||
minecraftVersion=1.7.10 | ||
forgeVersion=10.13.4.1614 | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/main/java/com/github/dcysteine/neicustomdiagram/api/Formatter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.github.dcysteine.neicustomdiagram.api; | ||
|
||
public final class Formatter { | ||
public static final String INTEGER_FORMAT = "%,d"; | ||
public static final String DOUBLE_FORMAT = "%.2f"; | ||
|
||
// Static class. | ||
private Formatter() {} | ||
|
||
public static String formatInt(int i) { | ||
return String.format(INTEGER_FORMAT, i); | ||
} | ||
|
||
public static String formatDouble(double d) { | ||
return String.format(DOUBLE_FORMAT, d); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/java/com/github/dcysteine/neicustomdiagram/api/Reflection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.github.dcysteine.neicustomdiagram.api; | ||
|
||
import com.google.auto.value.AutoValue; | ||
import cpw.mods.fml.relauncher.ReflectionHelper; | ||
import net.minecraft.client.gui.inventory.GuiContainer; | ||
|
||
import java.lang.reflect.Field; | ||
|
||
/** Class containing reflection accessors for private fields. */ | ||
public final class Reflection { | ||
public static IntegerField GUI_LEFT; | ||
public static IntegerField GUI_TOP; | ||
|
||
@AutoValue | ||
public abstract static class IntegerField { | ||
public static IntegerField create(Class<?> clazz, String... fieldNames) { | ||
Field field = ReflectionHelper.findField(clazz, fieldNames); | ||
return new AutoValue_Reflection_IntegerField(field); | ||
} | ||
|
||
public abstract Field field(); | ||
|
||
public int getInt(Object obj) { | ||
try { | ||
return field().getInt(obj); | ||
} catch (IllegalAccessException e) { | ||
throw new IllegalStateException("Could not access reflection field!", e); | ||
} | ||
} | ||
} | ||
|
||
/** This method is only intended to be called during mod initialization. */ | ||
public static void initialize() { | ||
GUI_LEFT = IntegerField.create(GuiContainer.class, "guiLeft", "field_147003_i"); | ||
GUI_TOP = IntegerField.create(GuiContainer.class, "guiTop", "field_147009_r"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.