44import java .util .*;
55import java .util .concurrent .atomic .AtomicInteger ;
66import java .util .stream .IntStream ;
7- import com .mojang .blaze3d .matrix . MatrixStack ;
7+ import com .mojang .blaze3d .vertex . PoseStack ;
88import com .mojang .blaze3d .systems .RenderSystem ;
99import dev .compactmods .crafting .CompactCrafting ;
1010import dev .compactmods .crafting .Registration ;
2525import mezz .jei .api .helpers .IGuiHelper ;
2626import mezz .jei .api .ingredients .IIngredients ;
2727import mezz .jei .api .recipe .category .IRecipeCategory ;
28- import net .minecraft .block .BlockState ;
29- import net . minecraft . client . MainWindow ;
28+ import net .minecraft .world . level . block . state .BlockState ;
29+ import com . mojang . blaze3d . platform . Window ;
3030import net .minecraft .client .Minecraft ;
31- import net .minecraft .client .audio . SimpleSound ;
32- import net .minecraft .client .audio . SoundHandler ;
33- import net .minecraft .client .gui .AbstractGui ;
34- import net .minecraft .client .renderer .BlockRendererDispatcher ;
35- import net .minecraft .client .renderer .IRenderTypeBuffer ;
31+ import net .minecraft .client .resources . sounds . SimpleSoundInstance ;
32+ import net .minecraft .client .sounds . SoundManager ;
33+ import net .minecraft .client .gui .GuiComponent ;
34+ import net .minecraft .client .renderer .block . BlockRenderDispatcher ;
35+ import net .minecraft .client .renderer .MultiBufferSource ;
3636import net .minecraft .client .renderer .texture .OverlayTexture ;
37- import net .minecraft .client .resources .I18n ;
38- import net .minecraft .item .Item ;
39- import net .minecraft .item .ItemStack ;
40- import net .minecraft .item .Items ;
41- import net .minecraft .tileentity . TileEntity ;
42- import net .minecraft .util .ResourceLocation ;
43- import net .minecraft .util .SoundEvents ;
44- import net .minecraft .util . math . AxisAlignedBB ;
45- import net .minecraft .util . math .BlockPos ;
46- import net . minecraft . util . math . vector .Matrix4f ;
47- import net . minecraft . util . math . vector .Quaternion ;
48- import net .minecraft .util . math . vector . Vector3d ;
49- import net .minecraft .util . text . IFormattableTextComponent ;
50- import net .minecraft .util . text . TextFormatting ;
51- import net .minecraft .util . text . TranslationTextComponent ;
37+ import net .minecraft .client .resources .language . I18n ;
38+ import net .minecraft .world . item .Item ;
39+ import net .minecraft .world . item .ItemStack ;
40+ import net .minecraft .world . item .Items ;
41+ import net .minecraft .world . level . block . entity . BlockEntity ;
42+ import net .minecraft .resources .ResourceLocation ;
43+ import net .minecraft .sounds .SoundEvents ;
44+ import net .minecraft .world . phys . AABB ;
45+ import net .minecraft .core .BlockPos ;
46+ import com . mojang . math .Matrix4f ;
47+ import com . mojang . math .Quaternion ;
48+ import net .minecraft .world . phys . Vec3 ;
49+ import net .minecraft .network . chat . MutableComponent ;
50+ import net .minecraft .ChatFormatting ;
51+ import net .minecraft .network . chat . TranslatableComponent ;
5252import net .minecraftforge .client .model .data .EmptyModelData ;
5353import net .minecraftforge .client .model .data .IModelData ;
5454import org .lwjgl .BufferUtils ;
@@ -57,7 +57,7 @@ public class JeiMiniaturizationCraftingCategory implements IRecipeCategory<Minia
5757
5858 public static final ResourceLocation UID = new ResourceLocation (CompactCrafting .MOD_ID , "miniaturization" );
5959 private final IDrawable icon ;
60- private final BlockRendererDispatcher blocks ;
60+ private final BlockRenderDispatcher blocks ;
6161 private RenderingWorld previewLevel ;
6262
6363 private IGuiHelper guiHelper ;
@@ -184,18 +184,18 @@ public void setRecipe(IRecipeLayout recipeLayout, MiniaturizationRecipe recipe,
184184 int finalCatalystSlot = catalystSlot ;
185185 guiItemStacks .addTooltipCallback ((slot , b , itemStack , tooltip ) -> {
186186 if (slot >= 0 && slot < recipe .getComponents ().size ()) {
187- IFormattableTextComponent text =
188- new TranslationTextComponent (CompactCrafting .MOD_ID + ".jei.miniaturization.component" )
189- .withStyle (TextFormatting .GRAY )
190- .withStyle (TextFormatting .ITALIC );
187+ MutableComponent text =
188+ new TranslatableComponent (CompactCrafting .MOD_ID + ".jei.miniaturization.component" )
189+ .withStyle (ChatFormatting .GRAY )
190+ .withStyle (ChatFormatting .ITALIC );
191191
192192 tooltip .add (text );
193193 }
194194
195195 if (slot == finalCatalystSlot ) {
196- IFormattableTextComponent text = new TranslationTextComponent (CompactCrafting .MOD_ID + ".jei.miniaturization.catalyst" )
197- .withStyle (TextFormatting .YELLOW )
198- .withStyle (TextFormatting .ITALIC );
196+ MutableComponent text = new TranslatableComponent (CompactCrafting .MOD_ID + ".jei.miniaturization.catalyst" )
197+ .withStyle (ChatFormatting .YELLOW )
198+ .withStyle (ChatFormatting .ITALIC );
199199
200200 tooltip .add (text );
201201 }
@@ -262,25 +262,25 @@ private void addOutputSlots(MiniaturizationRecipe recipe, int GUTTER_X, int OFFS
262262 @ Override
263263 public boolean handleClick (MiniaturizationRecipe recipe , double mouseX , double mouseY , int mouseButton ) {
264264
265- SoundHandler handler = Minecraft .getInstance ().getSoundManager ();
265+ SoundManager handler = Minecraft .getInstance ().getSoundManager ();
266266
267267
268268 if (explodeToggle .contains (mouseX , mouseY )) {
269269 explodeMulti = exploded ? 1.0d : 1.6d ;
270270 exploded = !exploded ;
271- handler .play (SimpleSound .forUI (SoundEvents .UI_BUTTON_CLICK , 1.0F ));
271+ handler .play (SimpleSoundInstance .forUI (SoundEvents .UI_BUTTON_CLICK , 1.0F ));
272272 return true ;
273273 }
274274
275275 if (layerSwap .contains (mouseX , mouseY )) {
276276 singleLayer = !singleLayer ;
277- handler .play (SimpleSound .forUI (SoundEvents .UI_BUTTON_CLICK , 1.0F ));
277+ handler .play (SimpleSoundInstance .forUI (SoundEvents .UI_BUTTON_CLICK , 1.0F ));
278278 return true ;
279279 }
280280
281281 if (layerUp .contains (mouseX , mouseY ) && singleLayer ) {
282282 if (singleLayerOffset < recipe .getDimensions ().getYsize () - 1 ) {
283- handler .play (SimpleSound .forUI (SoundEvents .UI_BUTTON_CLICK , 1.0F ));
283+ handler .play (SimpleSoundInstance .forUI (SoundEvents .UI_BUTTON_CLICK , 1.0F ));
284284 singleLayerOffset ++;
285285 }
286286
@@ -289,7 +289,7 @@ public boolean handleClick(MiniaturizationRecipe recipe, double mouseX, double m
289289
290290 if (layerDown .contains (mouseX , mouseY ) && singleLayer ) {
291291 if (singleLayerOffset > 0 ) {
292- handler .play (SimpleSound .forUI (SoundEvents .UI_BUTTON_CLICK , 1.0F ));
292+ handler .play (SimpleSoundInstance .forUI (SoundEvents .UI_BUTTON_CLICK , 1.0F ));
293293 singleLayerOffset --;
294294 }
295295
@@ -301,7 +301,7 @@ public boolean handleClick(MiniaturizationRecipe recipe, double mouseX, double m
301301
302302 //region Rendering help
303303 private void drawScaledTexture (
304- MatrixStack matrixStack ,
304+ PoseStack matrixStack ,
305305 ResourceLocation texture ,
306306 ScreenArea area ,
307307 float u , float v ,
@@ -312,17 +312,17 @@ private void drawScaledTexture(
312312 minecraft .getTextureManager ().bind (texture );
313313
314314 RenderSystem .enableDepthTest ();
315- AbstractGui .blit (matrixStack , area .x , area .y , area .width , area .height ,
315+ GuiComponent .blit (matrixStack , area .x , area .y , area .width , area .height ,
316316 u , v , uWidth , vHeight , textureWidth , textureHeight );
317317 }
318318
319319 //endregion
320320
321321 @ Override
322- public void draw (MiniaturizationRecipe recipe , MatrixStack mx , double mouseX , double mouseY ) {
323- AxisAlignedBB dims = recipe .getDimensions ();
322+ public void draw (MiniaturizationRecipe recipe , PoseStack mx , double mouseX , double mouseY ) {
323+ AABB dims = recipe .getDimensions ();
324324
325- MainWindow mainWindow = Minecraft .getInstance ().getWindow ();
325+ Window mainWindow = Minecraft .getInstance ().getWindow ();
326326
327327 drawScaledTexture (mx ,
328328 new ResourceLocation (CompactCrafting .MOD_ID , "textures/gui/jei-arrow-field.png" ),
@@ -349,25 +349,25 @@ public void draw(MiniaturizationRecipe recipe, MatrixStack mx, double mouseX, do
349349 if (previewLevel != null ) renderRecipe (recipe , mx , dims , guiScaleFactor , scissorBounds );
350350 }
351351
352- private void renderRecipe (MiniaturizationRecipe recipe , MatrixStack mx , AxisAlignedBB dims , double guiScaleFactor , ScreenArea scissorBounds ) {
352+ private void renderRecipe (MiniaturizationRecipe recipe , PoseStack mx , AABB dims , double guiScaleFactor , ScreenArea scissorBounds ) {
353353 try {
354- AbstractGui .fill (
354+ GuiComponent .fill (
355355 mx ,
356356 scissorBounds .x , scissorBounds .y ,
357357 scissorBounds .x + scissorBounds .width ,
358358 scissorBounds .height ,
359359 0xFF404040
360360 );
361361
362- IRenderTypeBuffer . Impl buffers = Minecraft .getInstance ().renderBuffers ().bufferSource ();
362+ MultiBufferSource . BufferSource buffers = Minecraft .getInstance ().renderBuffers ().bufferSource ();
363363
364364 final double scale = Minecraft .getInstance ().getWindow ().getGuiScale ();
365365 final Matrix4f matrix = mx .last ().pose ();
366366 final FloatBuffer buf = BufferUtils .createFloatBuffer (16 );
367367 matrix .store (buf );
368368
369369 // { x, y, z }
370- Vector3d translation = new Vector3d (
370+ Vec3 translation = new Vec3 (
371371 buf .get (12 ) * scale ,
372372 buf .get (13 ) * scale ,
373373 buf .get (14 ) * scale );
@@ -397,7 +397,7 @@ private void renderRecipe(MiniaturizationRecipe recipe, MatrixStack mx, AxisAlig
397397 // 03 = 11
398398 // 01 = 13
399399
400- Vector3d dimsVec = new Vector3d (dims .getXsize (), dims .getYsize (), dims .getZsize ());
400+ Vec3 dimsVec = new Vec3 (dims .getXsize (), dims .getYsize (), dims .getZsize ());
401401 float recipeAvgDim = (float ) dimsVec .length ();
402402 float previewScale = (float ) ((3 + Math .exp (3 - (recipeAvgDim / 5 ))) / explodeMulti );
403403 mx .scale (previewScale , -previewScale , previewScale );
@@ -414,7 +414,7 @@ private void renderRecipe(MiniaturizationRecipe recipe, MatrixStack mx, AxisAlig
414414 }
415415 }
416416
417- private void drawActualRecipe (MiniaturizationRecipe recipe , MatrixStack mx , AxisAlignedBB dims , IRenderTypeBuffer . Impl buffers ) {
417+ private void drawActualRecipe (MiniaturizationRecipe recipe , PoseStack mx , AABB dims , MultiBufferSource . BufferSource buffers ) {
418418 double gameTime = Minecraft .getInstance ().level .getGameTime ();
419419 double test = Math .toDegrees (gameTime ) / 15 ;
420420 mx .mulPose (new Quaternion (35f ,
@@ -446,7 +446,7 @@ private void drawActualRecipe(MiniaturizationRecipe recipe, MatrixStack mx, Axis
446446 }
447447 }
448448
449- private void renderPreviewControls (MatrixStack mx , AxisAlignedBB dims ) {
449+ private void renderPreviewControls (PoseStack mx , AABB dims ) {
450450 mx .pushPose ();
451451 mx .translate (0 , 0 , 10 );
452452
@@ -477,11 +477,11 @@ private void renderPreviewControls(MatrixStack mx, AxisAlignedBB dims) {
477477 mx .popPose ();
478478 }
479479
480- private void renderRecipeLayer (MiniaturizationRecipe recipe , MatrixStack mx , IRenderTypeBuffer . Impl buffers , IRecipeLayer l , int layerY ) {
480+ private void renderRecipeLayer (MiniaturizationRecipe recipe , PoseStack mx , MultiBufferSource . BufferSource buffers , IRecipeLayer l , int layerY ) {
481481 // Begin layer
482482 mx .pushPose ();
483483
484- AxisAlignedBB layerBounds = BlockSpaceUtil .getLayerBounds (recipe .getDimensions (), layerY );
484+ AABB layerBounds = BlockSpaceUtil .getLayerBounds (recipe .getDimensions (), layerY );
485485 BlockPos .betweenClosedStream (layerBounds ).forEach (filledPos -> {
486486 mx .pushPose ();
487487
@@ -504,20 +504,20 @@ private void renderRecipeLayer(MiniaturizationRecipe recipe, MatrixStack mx, IRe
504504 mx .popPose ();
505505 }
506506
507- private void renderComponent (MatrixStack mx , IRenderTypeBuffer . Impl buffers , IRecipeBlockComponent state , BlockPos filledPos ) {
507+ private void renderComponent (PoseStack mx , MultiBufferSource . BufferSource buffers , IRecipeBlockComponent state , BlockPos filledPos ) {
508508 // TODO - Render switching at fixed interval
509509 if (state .didErrorRendering ())
510510 return ;
511511
512512 BlockState state1 = state .getRenderState ();
513513 // Thanks Immersive, Astral, and others
514- IRenderTypeBuffer light = CCRenderTypes .disableLighting (buffers );
514+ MultiBufferSource light = CCRenderTypes .disableLighting (buffers );
515515
516516 IModelData data = EmptyModelData .INSTANCE ;
517517 if (previewLevel != null && state1 .hasTileEntity ()) {
518518 // create fake world instance
519519 // get tile entity - extend EmptyBlockReader with impl
520- TileEntity be = previewLevel .getBlockEntity (filledPos );
520+ BlockEntity be = previewLevel .getBlockEntity (filledPos );
521521 if (be != null )
522522 data = be .getModelData ();
523523 }
0 commit comments