Skip to content

Commit 4c6fb61

Browse files
committed
Split KirinoCore into common,client, and server modules
1 parent 0319313 commit 4c6fb61

File tree

6 files changed

+75
-60
lines changed

6 files changed

+75
-60
lines changed

patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch

Lines changed: 59 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
--- before/net/minecraft/client/renderer/EntityRenderer.java
22
+++ after/net/minecraft/client/renderer/EntityRenderer.java
3-
@@ -235,6 +235,7 @@
3+
@@ -13,7 +13,6 @@
4+
import javax.annotation.Nullable;
5+
import javax.imageio.ImageIO;
6+
import net.minecraft.block.Block;
7+
-import net.minecraft.block.BlockBed;
8+
import net.minecraft.block.material.Material;
9+
import net.minecraft.block.state.IBlockState;
10+
import net.minecraft.client.Minecraft;
11+
@@ -235,6 +234,7 @@
412
{
513
this.loadShader(new ResourceLocation("shaders/post/invert.json"));
614
}
715
+ else net.minecraftforge.client.ForgeHooksClient.loadEntityShader(entityIn, this);
816
}
917
}
1018

11-
@@ -315,7 +316,7 @@
19+
@@ -315,7 +315,7 @@
1220
this.mc.setRenderViewEntity(this.mc.player);
1321
}
1422

@@ -17,7 +25,7 @@
1725
float f4 = (float)this.mc.gameSettings.renderDistanceChunks / 32.0F;
1826
float f2 = f3 * (1.0F - f4) + f4;
1927
this.fogColor1 = this.fogColor1 + (f2 - this.fogColor1) * 0.1F;
20-
@@ -445,7 +446,7 @@
28+
@@ -445,7 +445,7 @@
2129

2230
if (d3 < d2 || d2 == 0.0)
2331
{
@@ -26,7 +34,7 @@
2634
{
2735
if (d2 == 0.0)
2836
{
29-
@@ -538,7 +539,7 @@
37+
@@ -538,7 +538,7 @@
3038
f = f * 60.0F / 70.0F;
3139
}
3240

@@ -35,7 +43,7 @@
3543
}
3644
}
3745

38-
@@ -604,13 +605,7 @@
46+
@@ -604,13 +604,7 @@
3947
{
4048
BlockPos blockpos = new BlockPos(entity);
4149
IBlockState iblockstate = this.mc.world.getBlockState(blockpos);
@@ -50,7 +58,7 @@
5058

5159
GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F, 0.0F, -1.0F, 0.0F);
5260
GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, -1.0F, 0.0F, 0.0F);
53-
@@ -683,19 +678,20 @@
61+
@@ -683,19 +677,20 @@
5462

5563
if (!this.mc.gameSettings.debugCamEnable)
5664
{
@@ -81,15 +89,15 @@
8189
}
8290

8391
GlStateManager.translate(0.0F, -f, 0.0F);
84-
@@ -825,6 +821,7 @@
92+
@@ -825,6 +820,7 @@
8593
boolean flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase
8694
&& ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping();
8795

8896
+ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(mc.renderGlobal, partialTicks, pass))
8997
if (this.mc.gameSettings.thirdPersonView == 0
9098
&& !flag
9199
&& !this.mc.gameSettings.hideGUI
92-
@@ -932,6 +929,15 @@
100+
@@ -932,6 +928,15 @@
93101
f10 = 0.25F + f7 * 0.75F;
94102
}
95103

@@ -105,17 +113,17 @@
105113
if (this.mc.player.isPotionActive(MobEffects.NIGHT_VISION))
106114
{
107115
float f15 = this.getNightVisionBrightness(this.mc.player, partialTicks);
108-
@@ -1108,7 +1114,17 @@
116+
@@ -1108,7 +1113,17 @@
109117
j = Math.max(j, 60);
110118
long k = System.nanoTime() - nanoTime;
111119
long l = Math.max((long)(1000000000 / j / 4) - k, 0L);
112120
- this.renderWorld(partialTicks, System.nanoTime() + l);
113121
+
114-
+ if (com.cleanroommc.kirino.KirinoCore.KIRINO_CONFIG_HUB.isEnable()
115-
+ && com.cleanroommc.kirino.KirinoCore.KIRINO_CONFIG_HUB.isEnableRenderDelegate()
116-
+ && !com.cleanroommc.kirino.KirinoCore.isRenderUnsupported())
122+
+ if (com.cleanroommc.kirino.KirinoCommonCore.KIRINO_CONFIG_HUB.isEnable()
123+
+ && com.cleanroommc.kirino.KirinoCommonCore.KIRINO_CONFIG_HUB.isEnableRenderDelegate()
124+
+ && !com.cleanroommc.kirino.KirinoClientCore.isRenderUnsupported())
117125
+ {
118-
+ com.cleanroommc.kirino.KirinoCore.EntityRenderer$renderWorld(System.nanoTime() + l);
126+
+ com.cleanroommc.kirino.KirinoClientCore.EntityRenderer$renderWorld(System.nanoTime() + l);
119127
+ }
120128
+ else
121129
+ {
@@ -124,7 +132,7 @@
124132

125133
if (this.mc.isSingleplayer() && this.timeWorldIcon < Minecraft.getSystemTime() - 1000L)
126134
{
127-
@@ -1158,6 +1174,10 @@
135+
@@ -1158,6 +1173,10 @@
128136
GlStateManager.loadIdentity();
129137
this.setupOverlayRendering();
130138
this.renderEndNanoTime = System.nanoTime();
@@ -135,7 +143,7 @@
135143
}
136144

137145
if (this.mc.currentScreen != null)
138-
@@ -1166,7 +1186,7 @@
146+
@@ -1166,7 +1185,7 @@
139147

140148
try
141149
{
@@ -144,7 +152,7 @@
144152
}
145153
catch (Throwable throwable)
146154
{
147-
@@ -1275,7 +1295,7 @@
155+
@@ -1275,7 +1294,7 @@
148156

149157
if (this.mc.playerController.getCurrentGameType() == GameType.SPECTATOR)
150158
{
@@ -153,25 +161,25 @@
153161
}
154162
else
155163
{
156-
@@ -1323,6 +1343,17 @@
164+
@@ -1323,6 +1342,17 @@
157165

158166
private void renderWorldPass(int pass, float partialTicks, long finishTimeNano)
159167
{
160-
+ if (com.cleanroommc.kirino.KirinoCore.KIRINO_CONFIG_HUB.isEnable()
161-
+ && (!com.cleanroommc.kirino.KirinoCore.KIRINO_CONFIG_HUB.isEnableRenderDelegate()
162-
+ || com.cleanroommc.kirino.KirinoCore.isRenderUnsupported()))
168+
+ if (com.cleanroommc.kirino.KirinoCommonCore.KIRINO_CONFIG_HUB.isEnable()
169+
+ && (!com.cleanroommc.kirino.KirinoCommonCore.KIRINO_CONFIG_HUB.isEnableRenderDelegate()
170+
+ || com.cleanroommc.kirino.KirinoClientCore.isRenderUnsupported()))
163171
+ {
164-
+ if (com.cleanroommc.kirino.KirinoCore.KIRINO_ENGINE.nextExpectedPhase() == com.cleanroommc.kirino.engine.FramePhase.PREPARE)
172+
+ if (com.cleanroommc.kirino.KirinoCommonCore.KIRINO_ENGINE.nextExpectedPhase() == com.cleanroommc.kirino.engine.FramePhase.PREPARE)
165173
+ {
166-
+ com.cleanroommc.kirino.KirinoCore.runHeadlessly(com.cleanroommc.kirino.engine.FramePhase.PREPARE);
174+
+ com.cleanroommc.kirino.KirinoClientCore.runHeadlessly(com.cleanroommc.kirino.engine.FramePhase.PREPARE);
167175
+ }
168-
+ com.cleanroommc.kirino.KirinoCore.runHeadlessly(com.cleanroommc.kirino.engine.FramePhase.PRE_UPDATE);
176+
+ com.cleanroommc.kirino.KirinoClientCore.runHeadlessly(com.cleanroommc.kirino.engine.FramePhase.PRE_UPDATE);
169177
+ }
170178
+
171179
RenderGlobal renderglobal = this.mc.renderGlobal;
172180
ParticleManager particlemanager = this.mc.effectRenderer;
173181
boolean flag = this.isDrawBlockOutline();
174-
@@ -1333,7 +1364,7 @@
182+
@@ -1333,7 +1363,7 @@
175183
GlStateManager.clear(16640);
176184
this.mc.profiler.endStartSection("camera");
177185
this.setupCameraTransform(partialTicks, pass);
@@ -180,22 +188,22 @@
180188
this.mc.profiler.endStartSection("frustum");
181189
ClippingHelperImpl.getInstance();
182190
this.mc.profiler.endStartSection("culling");
183-
@@ -1377,6 +1408,14 @@
191+
@@ -1377,6 +1407,14 @@
184192
this.renderCloudsCheck(renderglobal, partialTicks, pass, d0, d1, d2);
185193
}
186194

187-
+ if (com.cleanroommc.kirino.KirinoCore.KIRINO_CONFIG_HUB.isEnable()
188-
+ && (!com.cleanroommc.kirino.KirinoCore.KIRINO_CONFIG_HUB.isEnableRenderDelegate()
189-
+ || com.cleanroommc.kirino.KirinoCore.isRenderUnsupported()))
195+
+ if (com.cleanroommc.kirino.KirinoCommonCore.KIRINO_CONFIG_HUB.isEnable()
196+
+ && (!com.cleanroommc.kirino.KirinoCommonCore.KIRINO_CONFIG_HUB.isEnableRenderDelegate()
197+
+ || com.cleanroommc.kirino.KirinoClientCore.isRenderUnsupported()))
190198
+ {
191-
+ com.cleanroommc.kirino.KirinoCore.runHeadlessly(com.cleanroommc.kirino.engine.FramePhase.UPDATE);
192-
+ com.cleanroommc.kirino.KirinoCore.runHeadlessly(com.cleanroommc.kirino.engine.FramePhase.RENDER_OPAQUE);
199+
+ com.cleanroommc.kirino.KirinoClientCore.runHeadlessly(com.cleanroommc.kirino.engine.FramePhase.UPDATE);
200+
+ com.cleanroommc.kirino.KirinoClientCore.runHeadlessly(com.cleanroommc.kirino.engine.FramePhase.RENDER_OPAQUE);
193201
+ }
194202
+
195203
this.mc.profiler.endStartSection("prepareterrain");
196204
this.setupFog(0, partialTicks);
197205
this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
198-
@@ -1396,7 +1435,9 @@
206+
@@ -1396,7 +1434,9 @@
199207
GlStateManager.disableAlpha();
200208
renderglobal.renderBlockLayer(BlockRenderLayer.SOLID, (double)partialTicks, pass, entity);
201209
GlStateManager.enableAlpha();
@@ -205,7 +213,7 @@
205213
this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
206214
renderglobal.renderBlockLayer(BlockRenderLayer.CUTOUT, (double)partialTicks, pass, entity);
207215
this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
208-
@@ -1410,7 +1451,9 @@
216+
@@ -1410,7 +1450,9 @@
209217
GlStateManager.pushMatrix();
210218
RenderHelper.enableStandardItemLighting();
211219
this.mc.profiler.endStartSection("entities");
@@ -215,24 +223,24 @@
215223
RenderHelper.disableStandardItemLighting();
216224
this.disableLightmap();
217225
}
218-
@@ -1423,6 +1466,7 @@
226+
@@ -1423,6 +1465,7 @@
219227
EntityPlayer entityplayer = (EntityPlayer)entity;
220228
GlStateManager.disableAlpha();
221229
this.mc.profiler.endStartSection("outline");
222230
+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, partialTicks))
223231
renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks);
224232
GlStateManager.enableAlpha();
225233
}
226-
@@ -1471,8 +1515,27 @@
234+
@@ -1471,8 +1514,27 @@
227235
GlStateManager.depthMask(false);
228236
this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
229237
GlStateManager.shadeModel(7425);
230238
+
231-
+ if (com.cleanroommc.kirino.KirinoCore.KIRINO_CONFIG_HUB.isEnable()
232-
+ && (!com.cleanroommc.kirino.KirinoCore.KIRINO_CONFIG_HUB.isEnableRenderDelegate()
233-
+ || com.cleanroommc.kirino.KirinoCore.isRenderUnsupported()))
239+
+ if (com.cleanroommc.kirino.KirinoCommonCore.KIRINO_CONFIG_HUB.isEnable()
240+
+ && (!com.cleanroommc.kirino.KirinoCommonCore.KIRINO_CONFIG_HUB.isEnableRenderDelegate()
241+
+ || com.cleanroommc.kirino.KirinoClientCore.isRenderUnsupported()))
234242
+ {
235-
+ com.cleanroommc.kirino.KirinoCore.runHeadlessly(com.cleanroommc.kirino.engine.FramePhase.RENDER_TRANSPARENT);
243+
+ com.cleanroommc.kirino.KirinoClientCore.runHeadlessly(com.cleanroommc.kirino.engine.FramePhase.RENDER_TRANSPARENT);
236244
+ }
237245
+
238246
this.mc.profiler.endStartSection("translucent");
@@ -251,7 +259,7 @@
251259
GlStateManager.shadeModel(7424);
252260
GlStateManager.depthMask(true);
253261
GlStateManager.enableCull();
254-
@@ -1485,6 +1548,9 @@
262+
@@ -1485,6 +1547,9 @@
255263
this.renderCloudsCheck(renderglobal, partialTicks, pass, d0, d1, d2);
256264
}
257265

@@ -261,22 +269,22 @@
261269
this.mc.profiler.endStartSection("hand");
262270

263271
if (this.renderHand)
264-
@@ -1492,6 +1558,14 @@
272+
@@ -1492,6 +1557,14 @@
265273
GlStateManager.clear(256);
266274
this.renderHand(partialTicks, pass);
267275
}
268276
+
269-
+ if (com.cleanroommc.kirino.KirinoCore.KIRINO_CONFIG_HUB.isEnable()
270-
+ && (!com.cleanroommc.kirino.KirinoCore.KIRINO_CONFIG_HUB.isEnableRenderDelegate()
271-
+ || com.cleanroommc.kirino.KirinoCore.isRenderUnsupported()))
277+
+ if (com.cleanroommc.kirino.KirinoCommonCore.KIRINO_CONFIG_HUB.isEnable()
278+
+ && (!com.cleanroommc.kirino.KirinoCommonCore.KIRINO_CONFIG_HUB.isEnableRenderDelegate()
279+
+ || com.cleanroommc.kirino.KirinoClientCore.isRenderUnsupported()))
272280
+ {
273-
+ com.cleanroommc.kirino.KirinoCore.runHeadlessly(com.cleanroommc.kirino.engine.FramePhase.POST_UPDATE);
274-
+ com.cleanroommc.kirino.KirinoCore.runHeadlessly(com.cleanroommc.kirino.engine.FramePhase.RENDER_OVERLAY);
281+
+ com.cleanroommc.kirino.KirinoClientCore.runHeadlessly(com.cleanroommc.kirino.engine.FramePhase.POST_UPDATE);
282+
+ com.cleanroommc.kirino.KirinoClientCore.runHeadlessly(com.cleanroommc.kirino.engine.FramePhase.RENDER_OVERLAY);
275283
+ }
276284
}
277285

278286
private void renderCloudsCheck(RenderGlobal renderGlobalIn, float partialTicks, int pass, double x, double y, double z)
279-
@@ -1635,6 +1709,13 @@
287+
@@ -1635,6 +1708,13 @@
280288

281289
protected void renderRainSnow(float partialTicks)
282290
{
@@ -290,7 +298,7 @@
290298
float f = this.mc.world.getRainStrength(partialTicks);
291299

292300
if (!(f <= 0.0F))
293-
@@ -1908,29 +1989,16 @@
301+
@@ -1908,29 +1988,16 @@
294302
this.fogColorGreen = (float)vec3d3.y;
295303
this.fogColorBlue = (float)vec3d3.z;
296304
}
@@ -330,7 +338,7 @@
330338
}
331339

332340
float f13 = this.fogColor2 + (this.fogColor1 - this.fogColor2) * partialTicks;
333-
@@ -1989,6 +2057,9 @@
341+
@@ -1989,6 +2056,9 @@
334342
f6 = 1.0F / this.fogColorBlue;
335343
}
336344

@@ -340,7 +348,7 @@
340348
this.fogColorRed = this.fogColorRed * (1.0F - f15) + this.fogColorRed * f6 * f15;
341349
this.fogColorGreen = this.fogColorGreen * (1.0F - f15) + this.fogColorGreen * f6 * f15;
342350
this.fogColorBlue = this.fogColorBlue * (1.0F - f15) + this.fogColorBlue * f6 * f15;
343-
@@ -2004,6 +2075,13 @@
351+
@@ -2004,6 +2074,13 @@
344352
this.fogColorBlue = f7;
345353
}
346354

@@ -354,7 +362,7 @@
354362
GlStateManager.clearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F);
355363
}
356364

357-
@@ -2014,7 +2092,9 @@
365+
@@ -2014,7 +2091,9 @@
358366
GlStateManager.glNormal3f(0.0F, -1.0F, 0.0F);
359367
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
360368
IBlockState iblockstate = ActiveRenderInfo.getBlockStateAtEntityViewpoint(this.mc.world, entity, partialTicks);
@@ -365,7 +373,7 @@
365373
if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(MobEffects.BLINDNESS))
366374
{
367375
float f1 = 5.0F;
368-
@@ -2100,6 +2180,7 @@
376+
@@ -2100,6 +2179,7 @@
369377
GlStateManager.setFogStart(f * 0.05F);
370378
GlStateManager.setFogEnd(Math.min(f, 192.0F) * 0.5F);
371379
}

patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,14 @@
152152
int j = pos.getY();
153153
int k = pos.getZ();
154154
this.markBlocksForUpdate(i - 1, j - 1, k - 1, i + 1, j + 1, k + 1, (flags & 8) != 0);
155-
+ com.cleanroommc.kirino.KirinoCore.RenderGlobal$notifyBlockUpdate(i, j, k, oldState, newState);
155+
+ com.cleanroommc.kirino.KirinoClientCore.RenderGlobal$notifyBlockUpdate(i, j, k, oldState, newState);
156156
}
157157

158158
@Override
159159
public void notifyLightSet(BlockPos pos)
160160
{
161161
this.setLightUpdates.add(pos.toImmutable());
162-
+ com.cleanroommc.kirino.KirinoCore.RenderGlobal$notifyLightUpdate(pos.getX(), pos.getY(), pos.getZ());
162+
+ com.cleanroommc.kirino.KirinoClientCore.RenderGlobal$notifyLightUpdate(pos.getX(), pos.getY(), pos.getZ());
163163
}
164164

165165
@Override

projects/kirino

Submodule kirino updated 22 files

src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
import java.util.concurrent.TimeUnit;
3636
import java.util.function.Predicate;
3737

38-
import com.cleanroommc.kirino.KirinoCore;
38+
import com.cleanroommc.kirino.KirinoClientCore;
39+
import com.cleanroommc.kirino.KirinoCommonCore;
3940
import net.minecraft.client.Minecraft;
4041
import net.minecraft.client.entity.EntityPlayerSP;
4142
import net.minecraft.client.gui.Gui;
@@ -227,7 +228,7 @@ public void beginMinecraftLoading(Minecraft minecraft, List<IResourcePack> resou
227228
return;
228229
}
229230

230-
KirinoCore.configEvent();
231+
KirinoCommonCore.configEvent();
231232

232233
List<String> injectedModContainers = FMLCommonHandler.instance().beginLoading(this);
233234
try
@@ -289,7 +290,7 @@ public void beginMinecraftLoading(Minecraft minecraft, List<IResourcePack> resou
289290
}
290291
}
291292

292-
KirinoCore.init();
293+
KirinoClientCore.init();
293294
}
294295

295296
private void detectOptifine()
@@ -398,7 +399,7 @@ public void finishMinecraftLoading()
398399
Loader.instance().loadingComplete();
399400
SplashProgress.finish();
400401

401-
KirinoCore.postInit();
402+
KirinoClientCore.postInit();
402403
}
403404

404405
public void extendModList()

src/main/java/net/minecraftforge/fml/common/Loader.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
import com.cleanroommc.common.CleanroomContainer;
4141
import com.cleanroommc.common.MixinContainer;
4242
import com.cleanroommc.common.ConfigAnytimeContainer;
43-
import com.cleanroommc.kirino.KirinoCore;
43+
import com.cleanroommc.kirino.KirinoClientCore;
44+
import com.cleanroommc.kirino.KirinoCommonCore;
4445
import net.minecraft.util.ResourceLocation;
4546
import net.minecraftforge.common.ForgeVersion;
4647
import net.minecraftforge.common.capabilities.CapabilityManager;
@@ -376,7 +377,7 @@ private ModDiscoverer identifyMods(List<String> additionalContainers)
376377
mods.add(new InjectedModContainer(new CleanroomContainer(), FMLSanityChecker.fmlLocation));
377378
mods.add(new InjectedModContainer(new MixinContainer(), FMLSanityChecker.fmlLocation));
378379
mods.add(new InjectedModContainer(new ConfigAnytimeContainer(), FMLSanityChecker.fmlLocation));
379-
KirinoCore.identifyMods(mods);
380+
KirinoCommonCore.identifyMods(mods);
380381

381382
for (String cont : injectedContainers)
382383
{

0 commit comments

Comments
 (0)