Skip to content

Commit 4501f7a

Browse files
committed
整理
1 parent e37d111 commit 4501f7a

File tree

221 files changed

+2603
-2887
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+2603
-2887
lines changed

src/main/java/github/kasuminova/novaeng/NovaEngineeringCore.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@
4848
import static github.kasuminova.novaeng.mixin.NovaEngCoreEarlyMixinLoader.LOG_PREFIX;
4949

5050
@Mod(modid = NovaEngineeringCore.MOD_ID, name = NovaEngineeringCore.MOD_NAME, version = NovaEngineeringCore.VERSION,
51-
dependencies = "required-after:forge@[14.23.5.2847,);" +
52-
"required-after:modularmachinery@[2.1.0,);" +
53-
"required:theoneprobe@[1.12-1.4.28,);" +
54-
"required:appliedenergistics2@[v0.56.4,);" +
55-
"required:ae2fc@[2.6.3-r,);" +
56-
"required:configanytime@[2.0,);" +
57-
"required:mixinbooter@[8.0,);" +
58-
"required:lumenized@[1.0.2,);",
51+
dependencies = "required-after:forge@[14.23.5.2847,);" +
52+
"required-after:modularmachinery@[2.1.0,);" +
53+
"required:theoneprobe@[1.12-1.4.28,);" +
54+
"required:appliedenergistics2@[v0.56.4,);" +
55+
"required:ae2fc@[2.6.3-r,);" +
56+
"required:configanytime@[2.0,);" +
57+
"required:mixinbooter@[8.0,);" +
58+
"required:lumenized@[1.0.2,);",
5959
acceptedMinecraftVersions = "[1.12, 1.13)",
6060
acceptableRemoteVersions = "[1.21.7, 1.23.0)"
6161
)
@@ -79,14 +79,6 @@ public class NovaEngineeringCore {
7979
public static CommonProxy proxy = null;
8080
public static Logger log = LogManager.getLogger(MOD_ID);
8181

82-
public static ResourceLocation getRL(String path){
83-
return new ResourceLocation(MOD_ID,path);
84-
}
85-
86-
public static String getRLStr(String path){
87-
return MOD_ID + ":" + path;
88-
}
89-
9082
static {
9183
if (NovaEngCoreConfig.CLIENT.enableNovaEngTitle) {
9284
Thread thread = new Thread(() -> {
@@ -101,6 +93,14 @@ public static String getRLStr(String path){
10193
}
10294
}
10395

96+
public static ResourceLocation getRL(String path) {
97+
return new ResourceLocation(MOD_ID, path);
98+
}
99+
100+
public static String getRLStr(String path) {
101+
return MOD_ID + ":" + path;
102+
}
103+
104104
@Mod.EventHandler
105105
public void construction(FMLConstructionEvent event) {
106106
proxy.construction();

src/main/java/github/kasuminova/novaeng/client/ClientProxy.java

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,65 @@
8282
@Mod.EventBusSubscriber(Side.CLIENT)
8383
public class ClientProxy extends CommonProxy {
8484

85+
private static final Object2IntMap<String> colorCache = new Object2IntOpenHashMap<>();
8586
public static List<Item> items = new ObjectArrayList<>();
8687
public static List<Block> blocks = new ObjectArrayList<>();
87-
private static final Object2IntMap<String> colorCache = new Object2IntOpenHashMap<>();
8888

8989
static {
9090
colorCache.defaultReturnValue(-1);
9191
}
9292

93-
public void setColor(String od, int color) {
94-
colorCache.put(od, color);
95-
}
96-
9793
public ClientProxy() {
9894
MinecraftForge.EVENT_BUS.register(this);
9995
}
10096

97+
public static int getColorForODFirst(String odName) {
98+
var color = colorCache.getInt(odName);
99+
if (color < 0) {
100+
var od = OreDictionary.getOres(odName);
101+
if (!od.isEmpty()) {
102+
var stack = od.get(0);
103+
var item = stack.getItem();
104+
color = getColorForItemStack(od.get(0)).getRGB();
105+
} else {
106+
color = Color.WHITE.getRGB();
107+
}
108+
colorCache.put(odName, color);
109+
}
110+
return color;
111+
}
112+
113+
public static Color getColorForItemStack(ItemStack stack) {
114+
try {
115+
TextureAtlasSprite sprite;
116+
if (stack.getItem() instanceof ItemBlock) {
117+
Minecraft mc = Minecraft.getMinecraft();
118+
IBlockState state = ((ItemBlock) stack.getItem()).getBlock().getStateForPlacement(mc.world,
119+
new BlockPos(0, 0, 0), EnumFacing.UP, 0, 0, 0, stack.getMetadata(), mc.player);
120+
List<BakedQuad> quads = mc.getBlockRendererDispatcher().getModelForState(state).getQuads(state, EnumFacing.NORTH, 0);
121+
if (quads.isEmpty()) return Color.WHITE;
122+
sprite = quads.get(0).getSprite();
123+
} else sprite = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, null, null)
124+
.getQuads(null, null, 0).get(0).getSprite();
125+
IntList colours = new IntArrayList();
126+
for (int[] rows : sprite.getFrameTextureData(0))
127+
for (int colour : rows) if ((colour & 0xFF) > 0) colours.add(colour);
128+
long r = 0, g = 0, b = 0;
129+
for (int colour : colours) {
130+
r += (colour >> 16) & 0xFF;
131+
g += (colour >> 8) & 0xFF;
132+
b += colour & 0xFF;
133+
}
134+
return new Color((int) r / colours.size(), (int) g / colours.size(), (int) b / colours.size(), 255);
135+
} catch (Exception e) {
136+
return Color.WHITE;
137+
}
138+
}
139+
140+
public void setColor(String od, int color) {
141+
colorCache.put(od, color);
142+
}
143+
101144
@Override
102145
public boolean isClient() {
103146
return true;
@@ -225,47 +268,4 @@ public Object getClientGuiElement(final int ID, final EntityPlayer player, final
225268
};
226269
}
227270

228-
public static int getColorForODFirst(String odName) {
229-
var color = colorCache.getInt(odName);
230-
if (color < 0) {
231-
var od = OreDictionary.getOres(odName);
232-
if (!od.isEmpty()) {
233-
var stack = od.get(0);
234-
var item = stack.getItem();
235-
color = getColorForItemStack(od.get(0)).getRGB();
236-
} else {
237-
color = Color.WHITE.getRGB();
238-
}
239-
colorCache.put(odName, color);
240-
}
241-
return color;
242-
}
243-
244-
public static Color getColorForItemStack(ItemStack stack) {
245-
try {
246-
TextureAtlasSprite sprite;
247-
if (stack.getItem() instanceof ItemBlock) {
248-
Minecraft mc = Minecraft.getMinecraft();
249-
IBlockState state = ((ItemBlock) stack.getItem()).getBlock().getStateForPlacement(mc.world,
250-
new BlockPos(0, 0, 0), EnumFacing.UP, 0, 0, 0, stack.getMetadata(), mc.player);
251-
List<BakedQuad> quads = mc.getBlockRendererDispatcher().getModelForState(state).getQuads(state, EnumFacing.NORTH, 0);
252-
if (quads.isEmpty()) return Color.WHITE;
253-
sprite = quads.get(0).getSprite();
254-
} else sprite = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, null, null)
255-
.getQuads(null, null, 0).get(0).getSprite();
256-
IntList colours = new IntArrayList();
257-
for (int[] rows : sprite.getFrameTextureData(0))
258-
for (int colour : rows) if ((colour & 0xFF) > 0) colours.add(colour);
259-
long r = 0, g = 0, b = 0;
260-
for (int colour : colours) {
261-
r += (colour >> 16) & 0xFF;
262-
g += (colour >> 8) & 0xFF;
263-
b += colour & 0xFF;
264-
}
265-
return new Color((int) r / colours.size(), (int) g / colours.size(), (int) b / colours.size(), 255);
266-
} catch (Exception e) {
267-
return Color.WHITE;
268-
}
269-
}
270-
271271
}

src/main/java/github/kasuminova/novaeng/client/book/BookTransformerAppendModifiers.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
// adapted from Tinkers' MEMES BookTransformerAppendModifiers
1616
public class BookTransformerAppendModifiers extends SectionTransformer {
1717

18+
public static BookTransformerAppendModifiers INSTANCE_FALSE = new BookTransformerAppendModifiers(new FileRepository("tconstruct:book"), false, Register.TRAITREGISTER.modifierTraitsF);
19+
public static BookTransformerAppendModifiers INSTANCE_TRUE = new BookTransformerAppendModifiers(new FileRepository("tconstruct:book"), true, Register.TRAITREGISTER.modifierTraitsT);
1820
private final BookRepository source;
1921
private final boolean armour;
2022
private final List<Modifier> modCollector;
21-
public static BookTransformerAppendModifiers INSTANCE_FALSE = new BookTransformerAppendModifiers(new FileRepository("tconstruct:book"), false, Register.TRAITREGISTER.modifierTraitsF);
22-
public static BookTransformerAppendModifiers INSTANCE_TRUE = new BookTransformerAppendModifiers(new FileRepository("tconstruct:book"), true, Register.TRAITREGISTER.modifierTraitsT);
2323

2424
public BookTransformerAppendModifiers(BookRepository source, boolean armour, List<Modifier> modCollector) {
2525
super("modifiers");

src/main/java/github/kasuminova/novaeng/client/gui/GuiEStorageController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void onDataReceived() {
5959
public void onGraphFocusUpdate(final Graph graph) {
6060
this.widgetController.postGuiEvent(new ESGraphFocusUpdateEvent(graph));
6161
}
62-
62+
6363
public WidgetController getWidgetController() {
6464
return widgetController;
6565
}

src/main/java/github/kasuminova/novaeng/client/gui/GuiGeocentricDrill.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class GuiGeocentricDrill extends GuiContainerDynamic<ContainerGeocentricD
2929
new ResourceLocation(NovaEngineeringCore.MOD_ID, "textures/gui/guigeocentricdrill.png");
3030

3131
private final OreControlList oreControlList = new OreControlList();
32-
32+
3333
private final GeocentricDrillController owner;
3434

3535
private final Button4State dive = new Button4State();

src/main/java/github/kasuminova/novaeng/client/gui/GuiHyperNetTerminal.java

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap;
3131
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
3232
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
33+
import lombok.experimental.ExtensionMethod;
3334
import net.minecraft.client.Minecraft;
3435
import net.minecraft.client.entity.EntityPlayerSP;
3536
import net.minecraft.client.gui.FontRenderer;
@@ -57,47 +58,49 @@
5758
import java.util.Set;
5859
import java.util.stream.Collectors;
5960

61+
@ExtensionMethod(StringUtils.class)
6062
public class GuiHyperNetTerminal extends GuiContainerBase<ContainerHyperNetTerminal> {
63+
protected static final Comparator<ResearchCognitionData> comparator =
64+
(o1, o2) -> {
65+
float a = o1.getTechLevel();
66+
float b = o2.getTechLevel();
67+
if (a == b) {
68+
return 0;
69+
} else {
70+
return a > b ? 1 : -1;
71+
}
72+
};
6173
private static final ResourceLocation TEXTURES_TERMINAL = new ResourceLocation(
6274
NovaEngineeringCore.MOD_ID, "textures/gui/guiterminal.png");
6375
private static final ResourceLocation TEXTURES_TERMINAL_ELEMENTS = new ResourceLocation(
6476
NovaEngineeringCore.MOD_ID, "textures/gui/guiterminalelement.png");
65-
6677
private static final int TERMINAL_ELEMENT_WIDTH = 92;
6778
private static final int TERMINAL_ELEMENT_HEIGHT = 22;
68-
6979
private static final float FONT_SCALE = 0.72F;
7080
private static final int DATA_SCROLL_BAR_LEFT = 100;
7181
private static final int DATA_SCROLL_BAR_TOP = 44;
7282
private static final int DATA_SCROLL_BAR_HEIGHT = 198;
7383
private static final int MAX_PAGE_ELEMENTS = 9;
74-
7584
private static final int SCREEN_SCROLL_BAR_LEFT = 336;
7685
private static final int SCREEN_SCROLL_BAR_TOP = 44;
7786
private static final int SCREEN_SCROLL_BAR_HEIGHT = 118;
78-
7987
private static final int SCREEN_TEXT_MAX_LINES = 11;
8088
private static final int SCREEN_TEXT_MAX_WIDTH = 217;
81-
8289
private static String searchTextCache = "";
8390
private static ResearchDataContext currentCache = null;
84-
8591
protected final TileHyperNetTerminal terminal;
8692
protected final Set<ResearchCognitionData> unlockedData = new ObjectOpenHashSet<>();
8793
protected final List<ResearchCognitionData> lockedData = new ObjectArrayList<>();
8894
protected final List<ResearchCognitionData> unavailableData = new ObjectArrayList<>();
8995
protected final Object2DoubleOpenHashMap<ResearchCognitionData> researchingData = new Object2DoubleOpenHashMap<>();
9096
protected final List<ResearchDataContext> renderingData = new ObjectArrayList<>();
91-
9297
protected boolean darkMode = true;
9398
protected boolean showLockedResearchDesc = false;
94-
9599
protected GuiTextField searchTextField = null;
96100
protected GuiScrollbarThin dataScrollbar = null;
97101
protected GuiScrollbarThin screenScrollbar = null;
98102
protected GuiButtonImage startResearch = null;
99103
protected GuiButtonImage toggleResearchDesc = null;
100-
101104
protected ResearchDataContext current = null;
102105

103106
public GuiHyperNetTerminal(TileHyperNetTerminal terminal, EntityPlayer opening) {
@@ -500,17 +503,6 @@ protected void updateSearchTextField() {
500503
);
501504
}
502505

503-
protected static final Comparator<ResearchCognitionData> comparator =
504-
(o1, o2) -> {
505-
float a = o1.getTechLevel();
506-
float b = o2.getTechLevel();
507-
if (a == b) {
508-
return 0;
509-
} else {
510-
return a > b ? 1 : -1;
511-
}
512-
};
513-
514506
protected void updateRenderingData() {
515507
renderingData.clear();
516508

@@ -550,7 +542,7 @@ protected void updateRenderingData() {
550542

551543
String searchFilter = searchTextField.getText();
552544
if (!searchFilter.isEmpty()) {
553-
List<String> filtered = StringUtils.sortWithMatchRate(tmp.keySet(), searchFilter);
545+
List<String> filtered = searchFilter.sortWithMatchRate(tmp.keySet());
554546
if (filtered.isEmpty()) {
555547
searchTextField.setTextColor(0xFF0000);
556548
} else {

src/main/java/github/kasuminova/novaeng/client/gui/GuiSingularityCore.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,11 @@ protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouse
9898

9999
public void preRenderBloom() {
100100
Framebuffer fbo = mc.getFramebuffer();
101-
101+
102102
if (bloomFBO == null ||
103-
bloomFBO.framebufferWidth != fbo.framebufferWidth ||
104-
bloomFBO.framebufferHeight != fbo.framebufferHeight ||
105-
(fbo.isStencilEnabled() && !bloomFBO.isStencilEnabled()))
106-
{
103+
bloomFBO.framebufferWidth != fbo.framebufferWidth ||
104+
bloomFBO.framebufferHeight != fbo.framebufferHeight ||
105+
(fbo.isStencilEnabled() && !bloomFBO.isStencilEnabled())) {
107106
if (bloomFBO == null) {
108107
bloomFBO = new Framebuffer(fbo.framebufferWidth, fbo.framebufferHeight, false);
109108
bloomFBO.setFramebufferColor(0, 0, 0, 0);

src/main/java/github/kasuminova/novaeng/client/gui/config/StellarCoreConfigGuiFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class StellarCoreConfigGuiFactory implements IModGuiFactory {
1111

1212
@Override
1313
public void initialize(final Minecraft minecraftInstance) {
14-
14+
1515
}
1616

1717
@Override

src/main/java/github/kasuminova/novaeng/client/gui/widget/Button4StateWithText.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
import github.kasuminova.mmce.client.gui.util.RenderSize;
66
import github.kasuminova.mmce.client.gui.widget.Button4State;
77
import github.kasuminova.mmce.client.gui.widget.base.WidgetGui;
8+
import lombok.Getter;
89
import net.minecraft.client.Minecraft;
910
import net.minecraft.client.gui.FontRenderer;
1011

12+
@Getter
1113
public class Button4StateWithText extends Button4State {
12-
14+
1315
private int textColor = 0xFFFFFF;
1416
private String content = "";
1517

@@ -28,19 +30,11 @@ public void render(final WidgetGui gui, final RenderSize renderSize, final Rende
2830
);
2931
}
3032

31-
public String getContent() {
32-
return content;
33-
}
34-
3533
public Button4StateWithText setContent(final String content) {
3634
this.content = content;
3735
return this;
3836
}
3937

40-
public int getTextColor() {
41-
return textColor;
42-
}
43-
4438
public Button4StateWithText setTextColor(final int textColor) {
4539
this.textColor = textColor;
4640
return this;

src/main/java/github/kasuminova/novaeng/client/gui/widget/Button6State.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
import github.kasuminova.mmce.client.gui.util.TextureProperties;
77
import github.kasuminova.mmce.client.gui.widget.Button5State;
88
import github.kasuminova.mmce.client.gui.widget.base.WidgetGui;
9+
import lombok.Getter;
910

1011
import java.util.Optional;
1112

13+
@Getter
1214
public class Button6State extends Button5State {
1315

1416
protected TextureProperties clickedMouseDownTexture = TextureProperties.EMPTY;
@@ -41,17 +43,13 @@ public void render(final WidgetGui gui, final RenderSize renderSize, final Rende
4143
texture.render(textureLocation, renderPos, renderSize, gui);
4244
}
4345

44-
public TextureProperties getClickedMouseDownTexture() {
45-
return clickedMouseDownTexture;
46+
public Button6State setClickedMouseDownTexture(final TextureProperties clickedMouseDownTexture) {
47+
this.clickedMouseDownTexture = Optional.ofNullable(clickedMouseDownTexture).orElse(TextureProperties.EMPTY);
48+
return this;
4649
}
4750

4851
public Button6State setClickedMouseDownTexture(final int clickedTextureX, final int clickedTextureY) {
4952
return setClickedMouseDownTexture(TextureProperties.of(clickedTextureX, clickedTextureY));
5053
}
5154

52-
public Button6State setClickedMouseDownTexture(final TextureProperties clickedMouseDownTexture) {
53-
this.clickedMouseDownTexture = Optional.ofNullable(clickedMouseDownTexture).orElse(TextureProperties.EMPTY);
54-
return this;
55-
}
56-
5755
}

0 commit comments

Comments
 (0)