Refactor and import cleanup (Excluding network PR changed files)

This commit is contained in:
Justin Vitale 2020-07-09 23:04:42 +10:00
parent a36a0e6f4a
commit c4ef977f16
165 changed files with 1572 additions and 1625 deletions

View file

@ -59,7 +59,7 @@ import java.util.Map;
public class StackToolTipHandler implements ItemTooltipCallback {
private static ArrayList<Block> wipBlocks = new ArrayList<>();
private static final ArrayList<Block> wipBlocks = new ArrayList<>();
public static final Map<Item, Boolean> ITEM_ID = Maps.newHashMap();
public static void setup() {
@ -73,23 +73,23 @@ public class StackToolTipHandler implements ItemTooltipCallback {
@Override
public void getTooltip(ItemStack stack, TooltipContext tooltipContext, List<Text> components) {
Item item = stack.getItem();
if (!ITEM_ID.computeIfAbsent(item, this::isTRItem))
return;
// Machine info and upgrades helper section
Block block = Block.getBlockFromItem(item);
if(wipBlocks.contains(block) || block instanceof WIP){
if (wipBlocks.contains(block) || block instanceof WIP) {
components.add(new TranslatableText("techreborn.tooltip.wip").formatted(Formatting.RED));
}
if(block instanceof BaseBlockEntityProvider){
if (block instanceof BaseBlockEntityProvider) {
ToolTipAssistUtils.addInfo(item.getTranslationKey(), components);
}
if(item instanceof UpgradeItem){
UpgradeItem upgrade = (UpgradeItem)item;
if (item instanceof UpgradeItem) {
UpgradeItem upgrade = (UpgradeItem) item;
ToolTipAssistUtils.addInfo(item.getTranslationKey(), components, false);
components.addAll(ToolTipAssistUtils.getUpgradeStats(TRContent.Upgrades.valueOf(upgrade.name.toUpperCase()), stack.getCount(), Screen.hasShiftDown()));
@ -136,11 +136,11 @@ public class StackToolTipHandler implements ItemTooltipCallback {
}
}
}
private boolean isTRItem(Item item) {
return Registry.ITEM.getId(item).getNamespace().equals("techreborn");
}
public int percentage(int MaxValue, int CurrentValue) {
if (CurrentValue == 0)
return 0;

View file

@ -56,7 +56,7 @@ public class TRRecipeHandler {
if (!recipe.getId().getNamespace().equals(TechReborn.MOD_ID)) {
return false;
}
return !recipe.getPreviewInputs().stream().anyMatch((Predicate<Ingredient>) ingredient -> ingredient.test(TRContent.Parts.UU_MATTER.getStack()));
return !recipe.getPreviewInputs().stream().anyMatch(ingredient -> ingredient.test(TRContent.Parts.UU_MATTER.getStack()));
}
}