From 195cbecdb311fd7e3ce9b72e85da7136f60d995e Mon Sep 17 00:00:00 2001 From: Sebastian Hartte Date: Mon, 22 Jun 2020 02:47:09 +0200 Subject: [PATCH] - Dead code removal - Fixes crafting slot getRemainingItems --- .../container/slot/AppEngCraftingSlot.java | 3 +- .../container/slot/SlotCraftingTerm.java | 3 +- src/main/java/appeng/util/Platform.java | 139 ------------------ 3 files changed, 3 insertions(+), 142 deletions(-) diff --git a/src/main/java/appeng/container/slot/AppEngCraftingSlot.java b/src/main/java/appeng/container/slot/AppEngCraftingSlot.java index 60ad01648..ed9861409 100644 --- a/src/main/java/appeng/container/slot/AppEngCraftingSlot.java +++ b/src/main/java/appeng/container/slot/AppEngCraftingSlot.java @@ -139,6 +139,7 @@ public class AppEngCraftingSlot extends AppEngSlot { // refactoring. protected NonNullList getRemainingItems(CraftingInventory ic, World world) { return world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, ic, world) - .map(iCraftingRecipe -> iCraftingRecipe.getRemainingItems(ic)).orElse(null); + .map(iCraftingRecipe -> iCraftingRecipe.getRemainingItems(ic)) + .orElse(NonNullList.withSize(9, ItemStack.EMPTY)); } } diff --git a/src/main/java/appeng/container/slot/SlotCraftingTerm.java b/src/main/java/appeng/container/slot/SlotCraftingTerm.java index 5d0b15494..fef6e53bb 100644 --- a/src/main/java/appeng/container/slot/SlotCraftingTerm.java +++ b/src/main/java/appeng/container/slot/SlotCraftingTerm.java @@ -174,8 +174,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot { } } - return world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, ic, world).map(r -> r.getRemainingItems(ic)) - .orElse(NonNullList.create()); + return super.getRemainingItems(ic, world); } private int capCraftingAttempts(final int maxTimesToCraft) { diff --git a/src/main/java/appeng/util/Platform.java b/src/main/java/appeng/util/Platform.java index 2dfb84e97..1ca6d9374 100644 --- a/src/main/java/appeng/util/Platform.java +++ b/src/main/java/appeng/util/Platform.java @@ -296,22 +296,6 @@ public class Platform { return true; } -// -// /* -// * Checks to see if a block is air? -// */ -// public static boolean isBlockAir( final World w, final BlockPos pos ) -// { -// try -// { -// return w.getBlockState( pos ).getBlock().isAir( w.getBlockState( pos ), w, pos ); -// } -// catch( final Throwable e ) -// { -// return false; -// } -// } - public static ItemStack[] getBlockDrops(final World w, final BlockPos pos) { // FIXME: Check assumption here and if this could only EVER be called with a // server world @@ -329,52 +313,6 @@ public class Platform { return out.toArray(new ItemStack[0]); } -// public static AEPartLocation cycleOrientations( final AEPartLocation dir, final boolean upAndDown ) -// { -// if( upAndDown ) -// { -// switch( dir ) -// { -// case NORTH: -// return AEPartLocation.SOUTH; -// case SOUTH: -// return AEPartLocation.EAST; -// case EAST: -// return AEPartLocation.WEST; -// case WEST: -// return AEPartLocation.NORTH; -// case UP: -// return AEPartLocation.UP; -// case DOWN: -// return AEPartLocation.DOWN; -// case INTERNAL: -// return AEPartLocation.INTERNAL; -// } -// } -// else -// { -// switch( dir ) -// { -// case UP: -// return AEPartLocation.DOWN; -// case DOWN: -// return AEPartLocation.NORTH; -// case NORTH: -// return AEPartLocation.SOUTH; -// case SOUTH: -// return AEPartLocation.EAST; -// case EAST: -// return AEPartLocation.WEST; -// case WEST: -// return AEPartLocation.UP; -// case INTERNAL: -// return AEPartLocation.INTERNAL; -// } -// } -// -// return AEPartLocation.INTERNAL; -// } - /* * Generates Item entities in the world similar to how items are generally * dropped. @@ -550,38 +488,6 @@ public class Platform { FAKE_PLAYERS.put(w, p); return p; } -// -// public static int MC2MEColor( final int color ) -// { -// switch( color ) -// { -// case 4: // "blue" -// return 0; -// case 0: // "black" -// return 1; -// case 15: // "white" -// return 2; -// case 3: // "brown" -// return 3; -// case 1: // "red" -// return 4; -// case 11: // "yellow" -// return 5; -// case 2: // "green" -// return 6; -// -// case 5: // "purple" -// case 6: // "cyan" -// case 7: // "silver" -// case 8: // "gray" -// case 9: // "pink" -// case 10: // "lime" -// case 12: // "lightBlue" -// case 13: // "magenta" -// case 14: // "orange" -// } -// return -1; -// } /** * Returns a random element from the given collection. @@ -790,12 +696,6 @@ public class Platform { return forward; } -// @OnlyIn( Dist.CLIENT ) -// public static String gui_localize( final String string ) -// { -// return I18n.format( string ); -// } - public static LookDirection getPlayerRay(final PlayerEntity playerIn) { double reachDistance = playerIn.getAttribute(PlayerEntity.REACH_DISTANCE).getValue(); return getPlayerRay(playerIn, reachDistance); @@ -1274,50 +1174,11 @@ public class Platform { return false; } -// public static List findPreferred( final ItemStack[] is ) -// { -// final IParts parts = AEApi.instance().definitions().parts(); -// -// for( final ItemStack stack : is ) -// { -// if( parts.cableGlass().sameAs( AEColor.TRANSPARENT, stack ) ) -// { -// return Collections.singletonList( stack ); -// } -// -// if( parts.cableCovered().sameAs( AEColor.TRANSPARENT, stack ) ) -// { -// return Collections.singletonList( stack ); -// } -// -// if( parts.cableSmart().sameAs( AEColor.TRANSPARENT, stack ) ) -// { -// return Collections.singletonList( stack ); -// } -// -// if( parts.cableDenseSmart().sameAs( AEColor.TRANSPARENT, stack ) ) -// { -// return Collections.singletonList( stack ); -// } -// } -// -// return Lists.newArrayList( is ); -// } - public static float getEyeOffset(final PlayerEntity player) { assert player.world.isRemote : "Valid only on client"; // FIXME: The entire premise of this seems broken return (float) (player.getPosY() + player.getEyeHeight() - /* FIXME player.getDefaultEyeHeight() */ 1.62F); } -// -// // public static void addStat( final int playerID, final Achievement achievement ) -// // { -// // final PlayerEntity p = AEApi.instance().registries().players().findPlayer( playerID ); -// // if( p != null ) -// // { -// // p.addStat( achievement, 1 ); -// // } -// // } public static boolean isRecipePrioritized(final ItemStack what) { final IMaterials materials = AEApi.instance().definitions().materials();