diff options
| author | shedaniel <daniel@shedaniel.me> | 2020-04-05 16:05:57 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2020-04-05 16:52:42 +0800 |
| commit | 46f55f394bf62c12057875a778c0c489e768f70f (patch) | |
| tree | 71ab0c8d872ec2d1c8521c32535e79b11cbf6210 /src/main/java/me | |
| parent | 74aed6ab1bfbd8606a38485a814a794d6ac5dc05 (diff) | |
| download | RoughlyEnoughItems-46f55f394bf62c12057875a778c0c489e768f70f.tar.gz RoughlyEnoughItems-46f55f394bf62c12057875a778c0c489e768f70f.tar.bz2 RoughlyEnoughItems-46f55f394bf62c12057875a778c0c489e768f70f.zip | |
9 patch textures
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'src/main/java/me')
9 files changed, 53 insertions, 49 deletions
diff --git a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java index 8a6672230..8050e8bf8 100644 --- a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java +++ b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java @@ -111,7 +111,7 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer { @Deprecated public static REIPluginEntry registerPlugin(REIPluginEntry plugin) { plugins.put(plugin.getPluginIdentifier(), plugin); - RoughlyEnoughItemsCore.LOGGER.debug("[REI] Registered plugin %s from %s", plugin.getPluginIdentifier().toString(), plugin.getClass().getSimpleName()); + RoughlyEnoughItemsCore.LOGGER.debug("Registered plugin %s from %s", plugin.getPluginIdentifier().toString(), plugin.getClass().getSimpleName()); return plugin; } @@ -151,7 +151,7 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer { public static void syncRecipes(long[] lastSync) { if (lastSync != null) { if (lastSync[0] > 0 && System.currentTimeMillis() - lastSync[0] <= 5000) { - RoughlyEnoughItemsCore.LOGGER.warn("[REI] Suppressing Sync Recipes!"); + RoughlyEnoughItemsCore.LOGGER.warn("Suppressing Sync Recipes!"); return; } lastSync[0] = System.currentTimeMillis(); @@ -178,7 +178,7 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer { for (ModContainer modContainer : FabricLoader.getInstance().getAllMods()) { //noinspection deprecation if (modContainer.getMetadata().containsCustomElement("roughlyenoughitems:plugins")) - RoughlyEnoughItemsCore.LOGGER.error("[REI] REI plugin from " + modContainer.getMetadata().getId() + " is not loaded because it is too old!"); + RoughlyEnoughItemsCore.LOGGER.error("REI plugin from " + modContainer.getMetadata().getId() + " is not loaded because it is too old!"); } ClientSidePacketRegistry.INSTANCE.register(RoughlyEnoughItemsNetwork.CREATE_ITEMS_MESSAGE_PACKET, (packetContext, packetByteBuf) -> { @@ -225,7 +225,7 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer { registerPlugin(reiPlugin); } catch (Exception e) { e.printStackTrace(); - RoughlyEnoughItemsCore.LOGGER.error("[REI] Can't load REI plugins from %s: %s", reiPlugin.getClass(), e.getLocalizedMessage()); + RoughlyEnoughItemsCore.LOGGER.error("Can't load REI plugins from %s: %s", reiPlugin.getClass(), e.getLocalizedMessage()); } } for (REIPluginV0 reiPlugin : FabricLoader.getInstance().getEntrypoints("rei_plugins_v0", REIPluginV0.class)) { @@ -233,7 +233,7 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer { registerPlugin(reiPlugin); } catch (Exception e) { e.printStackTrace(); - RoughlyEnoughItemsCore.LOGGER.error("[REI] Can't load REI plugins from %s: %s", reiPlugin.getClass(), e.getLocalizedMessage()); + RoughlyEnoughItemsCore.LOGGER.error("Can't load REI plugins from %s: %s", reiPlugin.getClass(), e.getLocalizedMessage()); } } diff --git a/src/main/java/me/shedaniel/rei/gui/subsets/SubsetsMenu.java b/src/main/java/me/shedaniel/rei/gui/subsets/SubsetsMenu.java index fa0a479f2..5176e8285 100644 --- a/src/main/java/me/shedaniel/rei/gui/subsets/SubsetsMenu.java +++ b/src/main/java/me/shedaniel/rei/gui/subsets/SubsetsMenu.java @@ -166,7 +166,7 @@ public class SubsetsMenu extends WidgetWithBounds { } else { String translationKey = "subsets.rei." + entry.getKey().replace(':', '.'); if (!I18n.hasTranslation(translationKey)) - RoughlyEnoughItemsCore.LOGGER.warn("[REI] Subsets menu " + translationKey + " does not have a translation"); + RoughlyEnoughItemsCore.LOGGER.warn("Subsets menu " + translationKey + " does not have a translation"); entries.add(new SubMenuEntry(I18n.translate(translationKey), buildEntries(entryMap))); } } diff --git a/src/main/java/me/shedaniel/rei/gui/widget/ButtonWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/ButtonWidget.java index 8a489ad86..3de704419 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/ButtonWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/ButtonWidget.java @@ -27,6 +27,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import me.shedaniel.math.api.Point; import me.shedaniel.math.api.Rectangle; import me.shedaniel.rei.impl.ScreenHelper; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.Element; import net.minecraft.client.sound.PositionedSoundInstance; import net.minecraft.sound.SoundEvents; @@ -87,21 +88,22 @@ public abstract class ButtonWidget extends WidgetWithBounds { RenderSystem.enableBlend(); RenderSystem.blendFuncSeparate(770, 771, 1, 0); RenderSystem.blendFunc(770, 771); - //Four Corners - blit(x, y, getBlitOffset(), 0, textureOffset * 80, 4, 4, 512, 256); - blit(x + width - 4, y, getBlitOffset(), 252, textureOffset * 80, 4, 4, 512, 256); - blit(x, y + height - 4, getBlitOffset(), 0, textureOffset * 80 + 76, 4, 4, 512, 256); - blit(x + width - 4, y + height - 4, getBlitOffset(), 252, textureOffset * 80 + 76, 4, 4, 512, 256); - - //Sides - blit(x + 4, y, getBlitOffset(), 4, textureOffset * 80, MathHelper.ceil((width - 8) / 2f), 4, 512, 256); - blit(x + 4, y + height - 4, getBlitOffset(), 4, textureOffset * 80 + 76, MathHelper.ceil((width - 8) / 2f), 4, 512, 256); - blit(x + 4 + MathHelper.ceil((width - 8) / 2f), y + height - 4, getBlitOffset(), 252 - MathHelper.floor((width - 8) / 2f), textureOffset * 80 + 76, MathHelper.floor((width - 8) / 2f), 4, 512, 256); - blit(x + 4 + MathHelper.ceil((width - 8) / 2f), y, getBlitOffset(), 252 - MathHelper.floor((width - 8) / 2f), textureOffset * 80, MathHelper.floor((width - 8) / 2f), 4, 512, 256); - for (int i = y + 4; i < y + height - 4; i += 76) { - blit(x, i, getBlitOffset(), 0, 4 + textureOffset * 80, MathHelper.ceil(width / 2f), MathHelper.clamp(y + height - 4 - i, 0, 76), 512, 256); - blit(x + MathHelper.ceil(width / 2f), i, getBlitOffset(), 256 - MathHelper.floor(width / 2f), 4 + textureOffset * 80, MathHelper.floor(width / 2f), MathHelper.clamp(y + height - 4 - i, 0, 76), 512, 256); - } + // 9 Patch Texture + + // Four Corners + blit(x, y, getZ(), 0, textureOffset * 80, 8, 8, 512, 256); + blit(x + width - 8, y, getZ(), 248, textureOffset * 80, 8, 8, 512, 256); + blit(x, y + height - 8, getZ(), 0, textureOffset * 80 + 72, 8, 8, 512, 256); + blit(x + width - 8, y + height - 8, getZ(), 248, textureOffset * 80 + 72, 8, 8, 512, 256); + + // Sides + DrawableHelper.innerBlit(x + 8, x + width - 8, y, y + 8, getZ(), (8) / 256f, (248) / 256f, (textureOffset * 80) / 512f, (textureOffset * 80 + 8) / 512f); + DrawableHelper.innerBlit(x + 8, x + width - 8, y + height - 8, y + height, getZ(), (8) / 256f, (248) / 256f, (textureOffset * 80 + 72) / 512f, (textureOffset * 80 + 80) / 512f); + DrawableHelper.innerBlit(x, x + 8, y + 8, y + height - 8, getZ(), (0) / 256f, (8) / 256f, (textureOffset * 80 + 8) / 512f, (textureOffset * 80 + 72) / 512f); + DrawableHelper.innerBlit(x + width - 8, x + width, y + 8, y + height - 8, getZ(), (248) / 256f, (256) / 256f, (textureOffset * 80 + 8) / 512f, (textureOffset * 80 + 72) / 512f); + + // Center + DrawableHelper.innerBlit(x + 8, x + width - 8, y + 8, y + height - 8, getZ(), (8) / 256f, (248) / 256f, (textureOffset * 80 + 8) / 512f, (textureOffset * 80 + 72) / 512f); } @Override diff --git a/src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java index ca2dfa88c..70fdc23df 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java @@ -640,7 +640,7 @@ public class EntryListWidget extends WidgetWithBounds { long ended = System.nanoTime(); long time = ended - started; if (ConfigObject.getInstance().doDebugSearchTimeRequired()) - RoughlyEnoughItemsCore.LOGGER.info("[REI] Search Used: %.2fms", time * 1e-6); + RoughlyEnoughItemsCore.LOGGER.info("Search Used: %.2fms", time * 1e-6); updateEntriesPosition(); } diff --git a/src/main/java/me/shedaniel/rei/gui/widget/PanelWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/PanelWidget.java index 8b6108d56..2e0dca89f 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/PanelWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/PanelWidget.java @@ -29,7 +29,9 @@ import me.shedaniel.rei.api.ConfigObject; import me.shedaniel.rei.gui.config.RecipeBorderType; import me.shedaniel.rei.gui.config.RecipeScreenType; import me.shedaniel.rei.impl.ScreenHelper; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.util.Identifier; +import org.jetbrains.annotations.ApiStatus; import java.util.Collections; import java.util.List; @@ -89,30 +91,30 @@ public class PanelWidget extends WidgetWithBounds { int xTextureOffset = getXTextureOffset(); int yTextureOffset = getYTextureOffset(); - //Four Corners - this.blit(x, y, 106 + xTextureOffset, 124 + yTextureOffset, 4, 4); - this.blit(x + width - 4, y, 252 + xTextureOffset, 124 + yTextureOffset, 4, 4); - this.blit(x, y + height - 4, 106 + xTextureOffset, 186 + yTextureOffset, 4, 4); - this.blit(x + width - 4, y + height - 4, 252 + xTextureOffset, 186 + yTextureOffset, 4, 4); + // 9 Patch Texture - //Sides - for (int xx = 4; xx < width - 4; xx += 128) { - int thisWidth = Math.min(128, width - 4 - xx); - this.blit(x + xx, y, 110 + xTextureOffset, 124 + yTextureOffset, thisWidth, 4); - this.blit(x + xx, y + height - 4, 110 + xTextureOffset, 186 + yTextureOffset, thisWidth, 4); - } - for (int yy = 4; yy < height - 4; yy += 50) { - int thisHeight = Math.min(50, height - 4 - yy); - this.blit(x, y + yy, 106 + xTextureOffset, 128 + yTextureOffset, 4, thisHeight); - this.blit(x + width - 4, y + yy, 252 + xTextureOffset, 128 + yTextureOffset, 4, thisHeight); - } - fillGradient(x + 4, y + 4, x + width - 4, y + height - 4, getInnerColor(), getInnerColor()); + // Four Corners + this.blit(x, y, 106 + xTextureOffset, 124 + yTextureOffset, 8, 8); + this.blit(x + width - 8, y, 248 + xTextureOffset, 124 + yTextureOffset, 8, 8); + this.blit(x, y + height - 8, 106 + xTextureOffset, 182 + yTextureOffset, 8, 8); + this.blit(x + width - 8, y + height - 8, 248 + xTextureOffset, 182 + yTextureOffset, 8, 8); + + // Sides + DrawableHelper.innerBlit(x + 8, x + width - 8, y, y + 8, getZ(), (114 + xTextureOffset) / 256f, (248 + xTextureOffset) / 256f, (124 + yTextureOffset) / 256f, (132 + yTextureOffset) / 256f); + DrawableHelper.innerBlit(x + 8, x + width - 8, y + height - 8, y + height, getZ(), (114 + xTextureOffset) / 256f, (248 + xTextureOffset) / 256f, (182 + yTextureOffset) / 256f, (190 + yTextureOffset) / 256f); + DrawableHelper.innerBlit(x, x + 8, y + 8, y + height - 8, getZ(), (106 + xTextureOffset) / 256f, (114 + xTextureOffset) / 256f, (132 + yTextureOffset) / 256f, (182 + yTextureOffset) / 256f); + DrawableHelper.innerBlit(x + width - 8, x + width, y + 8, y + height - 8, getZ(), (248 + xTextureOffset) / 256f, (256 + xTextureOffset) / 256f, (132 + yTextureOffset) / 256f, (182 + yTextureOffset) / 256f); + + // Center + DrawableHelper.innerBlit(x + 8, x + width - 8, y + 8, y + height - 8, getZ(), (114 + xTextureOffset) / 256f, (248 + xTextureOffset) / 256f, (132 + yTextureOffset) / 256f, (182 + yTextureOffset) / 256f); } protected boolean isRendering() { return ConfigObject.getInstance().getRecipeScreenType() != RecipeScreenType.VILLAGER; } + @ApiStatus.ScheduledForRemoval + @Deprecated protected int getInnerColor() { return ScreenHelper.isDarkModeEnabled() ? -13750738 : -3750202; } diff --git a/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java b/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java index f19aafd9b..8888795fe 100644 --- a/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java +++ b/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java @@ -124,7 +124,7 @@ public class ConfigManagerImpl implements ConfigManager { Collections.singletonList(new FilteringEntry(getUnsafely(field, config, new ArrayList<>()), getUnsafely(field, defaults), list -> setUnsafely(field, config, list))) , (field) -> field.getType() == List.class, ConfigObjectImpl.UseFilteringScreen.class); saveConfig(); - RoughlyEnoughItemsCore.LOGGER.info("[REI] Config is loaded."); + RoughlyEnoughItemsCore.LOGGER.info("Config is loaded."); } @Override diff --git a/src/main/java/me/shedaniel/rei/impl/EntryRegistryImpl.java b/src/main/java/me/shedaniel/rei/impl/EntryRegistryImpl.java index 9b2d7623d..4de5099f7 100644 --- a/src/main/java/me/shedaniel/rei/impl/EntryRegistryImpl.java +++ b/src/main/java/me/shedaniel/rei/impl/EntryRegistryImpl.java @@ -101,7 +101,7 @@ public class EntryRegistryImpl implements EntryRegistry { preFilteredList.add(stack); } long time = System.currentTimeMillis() - started; - RoughlyEnoughItemsCore.LOGGER.info("[REI] Refiltered %d entries in %dms.", filteredStacks.size(), time); + RoughlyEnoughItemsCore.LOGGER.info("Refiltered %d entries in %dms.", filteredStacks.size(), time); } public void reset() { diff --git a/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java b/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java index 972023cad..14a909ee4 100644 --- a/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java +++ b/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java @@ -293,7 +293,7 @@ public class RecipeHelperImpl implements RecipeHelper { ((DisplayHelperImpl) DisplayHelper.getInstance()).setBaseBoundsHandler(baseBoundsHandler); List<REIPluginEntry> plugins = RoughlyEnoughItemsCore.getPlugins(); plugins.sort(Comparator.comparingInt(REIPluginEntry::getPriority).reversed()); - RoughlyEnoughItemsCore.LOGGER.info("[REI] Loading %d plugins: %s", plugins.size(), plugins.stream().map(REIPluginEntry::getPluginIdentifier).map(Identifier::toString).collect(Collectors.joining(", "))); + RoughlyEnoughItemsCore.LOGGER.info("Loading %d plugins: %s", plugins.size(), plugins.stream().map(REIPluginEntry::getPluginIdentifier).map(Identifier::toString).collect(Collectors.joining(", "))); Collections.reverse(plugins); ((EntryRegistryImpl) EntryRegistry.getInstance()).reset(); @SuppressWarnings("OptionalGetWithoutIsPresent") @@ -314,7 +314,7 @@ public class RecipeHelperImpl implements RecipeHelper { reiPluginV0s.add((REIPluginV0) plugin); } } catch (Throwable e) { - RoughlyEnoughItemsCore.LOGGER.error("[REI] " + plugin.getPluginIdentifier().toString() + " plugin failed to pre register!", e); + RoughlyEnoughItemsCore.LOGGER.error(plugin.getPluginIdentifier().toString() + " plugin failed to pre register!", e); } } for (REIPluginV0 plugin : reiPluginV0s) { @@ -326,7 +326,7 @@ public class RecipeHelperImpl implements RecipeHelper { plugin.registerRecipeDisplays(this); plugin.registerOthers(this); } catch (Throwable e) { - RoughlyEnoughItemsCore.LOGGER.error("[REI] " + identifier.toString() + " plugin failed to load!", e); + RoughlyEnoughItemsCore.LOGGER.error(identifier.toString() + " plugin failed to load!", e); } } @@ -335,7 +335,7 @@ public class RecipeHelperImpl implements RecipeHelper { try { plugin.postRegister(); } catch (Throwable e) { - RoughlyEnoughItemsCore.LOGGER.error("[REI] " + identifier.toString() + " plugin failed to post register!", e); + RoughlyEnoughItemsCore.LOGGER.error(identifier.toString() + " plugin failed to post register!", e); } } if (!recipeFunctions.isEmpty()) { @@ -347,7 +347,7 @@ public class RecipeHelperImpl implements RecipeHelper { registerDisplay(recipeFunction.category, (RecipeDisplay) recipeFunction.mappingFunction.apply(recipe), 0); } } catch (Exception e) { - RoughlyEnoughItemsCore.LOGGER.error("[REI] Failed to add recipes!", e); + RoughlyEnoughItemsCore.LOGGER.error("Failed to add recipes!", e); } } } @@ -395,7 +395,7 @@ public class RecipeHelperImpl implements RecipeHelper { displayVisibilityHandlers.sort(VISIBILITY_HANDLER_COMPARATOR); long usedTime = System.currentTimeMillis() - startTime; - RoughlyEnoughItemsCore.LOGGER.info("[REI] Registered %d stack entries, %d recipes displays, %d exclusion zones suppliers, %d overlay decider, %d visibility handlers and %d categories (%s) in %d ms.", EntryRegistry.getInstance().getStacksList().size(), recipeCount[0], BaseBoundsHandler.getInstance().supplierSize(), DisplayHelper.getInstance().getAllOverlayDeciders().size(), getDisplayVisibilityHandlers().size(), categories.size(), categories.keySet().stream().map(RecipeCategory::getCategoryName).collect(Collectors.joining(", ")), usedTime); + RoughlyEnoughItemsCore.LOGGER.info("Registered %d stack entries, %d recipes displays, %d exclusion zones suppliers, %d overlay decider, %d visibility handlers and %d categories (%s) in %d ms.", EntryRegistry.getInstance().getStacksList().size(), recipeCount[0], BaseBoundsHandler.getInstance().supplierSize(), DisplayHelper.getInstance().getAllOverlayDeciders().size(), getDisplayVisibilityHandlers().size(), categories.size(), categories.keySet().stream().map(RecipeCategory::getCategoryName).collect(Collectors.joining(", ")), usedTime); } @Override @@ -471,7 +471,7 @@ public class RecipeHelperImpl implements RecipeHelper { return visibility == ActionResult.SUCCESS; } } catch (Throwable throwable) { - RoughlyEnoughItemsCore.LOGGER.error("[REI] Failed to check if the recipe is visible!", throwable); + RoughlyEnoughItemsCore.LOGGER.error("Failed to check if the recipe is visible!", throwable); } return true; } diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java b/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java index 366a24443..4796b469f 100644 --- a/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java +++ b/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java @@ -265,7 +265,7 @@ public class DefaultPlugin implements REIPluginV0 { } } time = System.currentTimeMillis() - time; - RoughlyEnoughItemsCore.LOGGER.info("[REI] Applied Check Tags for potion in %dms.", time); + RoughlyEnoughItemsCore.LOGGER.info("Applied Check Tags for potion in %dms.", time); } private void applyPotionTransformer(EntryStack stack) { |
