Some general cleanup

This commit is contained in:
modmuss50 2020-07-26 16:19:33 +01:00
parent bbc9dd3b37
commit b5707b144e
20 changed files with 29 additions and 59 deletions

View file

@ -93,7 +93,6 @@ public class IronAlloyFurnaceBlockEntity extends AbstractIronMachineBlockEntity
return;
}
ItemStack outputStack = ItemStack.EMPTY;
RebornRecipe currentRecipe = null;
for (RebornRecipe recipeType : ModRecipes.ALLOY_SMELTER.getRecipes(world)) {
if (hasAllInputs(recipeType)) {
@ -104,7 +103,7 @@ public class IronAlloyFurnaceBlockEntity extends AbstractIronMachineBlockEntity
if (currentRecipe == null) {
return;
}
outputStack = currentRecipe.getOutputs().get(0);
ItemStack outputStack = currentRecipe.getOutputs().get(0);
if (outputStack.isEmpty()) {
return;
}

View file

@ -29,6 +29,7 @@ import net.minecraft.entity.ExperienceOrbEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.recipe.AbstractCookingRecipe;
import net.minecraft.recipe.RecipeType;
import net.minecraft.recipe.SmeltingRecipe;
import net.minecraft.server.network.ServerPlayerEntity;
@ -76,10 +77,7 @@ public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity imple
private float getExperienceFor(ItemStack stack) {
Optional<SmeltingRecipe> recipe = world.getRecipeManager().getFirstMatch(RecipeType.SMELTING, this, world);
if (recipe.isPresent()) {
return recipe.get().getExperience();
}
return 0;
return recipe.map(AbstractCookingRecipe::getExperience).orElse(0F);
}
// AbstractIronMachineBlockEntity

View file

@ -344,11 +344,10 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
.boxed().collect(Collectors.toList());
boolean needsBalance = false;
for (int i = 0; i < split.length; i++) {
int required = split[i];
for (int required : split) {
if (slotEnvTyperubution.contains(required)) {
//We need to remove the int, not at the int, this seems to work around that
slotEnvTyperubution.remove(new Integer(required));
slotEnvTyperubution.remove(Integer.valueOf(required));
} else {
needsBalance = true;
}

View file

@ -246,11 +246,10 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
.boxed().collect(Collectors.toList());
boolean needsBalance = false;
for (int i = 0; i < split.length; i++) {
int required = split[i];
for (int required : split) {
if (slotEnvTyperubution.contains(required)) {
//We need to remove the int, not at the int, this seems to work around that
slotEnvTyperubution.remove(new Integer(required));
slotEnvTyperubution.remove(Integer.valueOf(required));
} else {
needsBalance = true;
}