Compare commits
2 Commits
c89433c8dd
...
47f1043c33
| Author | SHA1 | Date | |
|---|---|---|---|
| 47f1043c33 | |||
| a711ba501d |
@@ -6,6 +6,4 @@ Icons Enhanced mejora la lectura de encantamientos y la UI sin cambiar el gamepl
|
||||
- Iconos y colores por encantamiento en los tooltips.
|
||||
- Descripciones de encantamientos.
|
||||
- Bordes en slots de inventario y contenedores.
|
||||
|
||||
## Licencia
|
||||
Apache-2.0
|
||||
- Orden de encantamientos mejorado.
|
||||
31
build.gradle
31
build.gradle
@@ -50,27 +50,22 @@ dependencies {
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${property('deps.fabric_api')}"
|
||||
}
|
||||
|
||||
def resourceExpandProps = [
|
||||
version: project.version,
|
||||
mod_id: modId,
|
||||
mod_name: modName,
|
||||
mod_description: modDescription,
|
||||
mod_license: modLicense,
|
||||
mod_author: modAuthor,
|
||||
minecraft_version: stonecutter.current.version,
|
||||
fabric_loader_version: fabricLoaderVersion
|
||||
]
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
inputs.property "mod_id", modId
|
||||
inputs.property "mod_name", modName
|
||||
inputs.property "mod_description", modDescription
|
||||
inputs.property "mod_license", modLicense
|
||||
inputs.property "mod_author", modAuthor
|
||||
inputs.property "minecraft_version", stonecutter.current.version
|
||||
inputs.property "fabric_loader_version", fabricLoaderVersion
|
||||
inputs.properties(resourceExpandProps)
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand(
|
||||
version: project.version,
|
||||
mod_id: modId,
|
||||
mod_name: modName,
|
||||
mod_description: modDescription,
|
||||
mod_license: modLicense,
|
||||
mod_author: modAuthor,
|
||||
minecraft_version: stonecutter.current.version,
|
||||
fabric_loader_version: fabricLoaderVersion
|
||||
)
|
||||
expand(resourceExpandProps)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Done to increase the memory available to gradle.
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=1G -Dfile.encoding=UTF-8
|
||||
org.gradle.parallel=true
|
||||
|
||||
# IntelliJ IDEA is not yet fully compatible with configuration cache, see: https://github.com/FabricMC/fabric-loom/issues/1349
|
||||
@@ -11,7 +11,7 @@ loom_version=1.14-SNAPSHOT
|
||||
# Mod metadata
|
||||
mod.id=iconsenhanced
|
||||
mod.name=Icons Enhanced
|
||||
mod.version=0.1.0
|
||||
mod.version=1.0.0
|
||||
mod.group=dev.dekin
|
||||
mod.description=Client-only suite of enchantment and UI improvements.
|
||||
mod.license=Apache-2.0
|
||||
|
||||
197
net/fabricmc/fabric/api/client/screen/v1/ScreenEvents.java
Normal file
197
net/fabricmc/fabric/api/client/screen/v1/ScreenEvents.java
Normal file
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.api.client.screen.v1;
|
||||
|
||||
import java.util.Objects;
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.EventFactory;
|
||||
import net.fabricmc.fabric.impl.client.screen.ScreenExtensions;
|
||||
import net.minecraft.class_310;
|
||||
import net.minecraft.class_332;
|
||||
import net.minecraft.class_437;
|
||||
|
||||
/**
|
||||
* Holds events related to {@link class_437}s.
|
||||
*
|
||||
* <p>Some events require a screen instance in order to obtain an event instance.
|
||||
* The events that require a screen instance can be identified by the use of a method passing a screen instance.
|
||||
* All events in {@link ScreenKeyboardEvents} and {@link ScreenMouseEvents} require a screen instance.
|
||||
* This registration model is used since a screen being (re)initialized will reset the screen to its default state, therefore reverting all changes a mod developer may have applied to a screen.
|
||||
* Furthermore, this design was chosen to reduce the amount of wasted iterations of events as a mod developer would only need to register screen events for rendering, ticking, keyboards and mice if needed on a per-instance basis.
|
||||
*
|
||||
* <p>The primary entrypoint into a screen is when it is being opened, this is signified by an event {@link ScreenEvents#BEFORE_INIT before} and {@link ScreenEvents#AFTER_INIT after} initialization of the screen.
|
||||
*
|
||||
* @see Screens
|
||||
* @see ScreenKeyboardEvents
|
||||
* @see ScreenMouseEvents
|
||||
*/
|
||||
|
||||
public final class ScreenEvents {
|
||||
/**
|
||||
* An event that is called before {@link class_437#method_25423(class_310, int, int) a screen is initialized} to its default state.
|
||||
* It should be noted some methods in {@link Screens} such as a screen's {@link class_437#method_64506 text renderer} may not be initialized yet, and as such their use is discouraged.
|
||||
*
|
||||
* <!--<p>Typically this event is used to register screen events such as listening to when child elements are added to the screen. ------ Uncomment when child add/remove event is added for elements-->
|
||||
* You can still use {@link ScreenEvents#AFTER_INIT} to register events such as keyboard and mouse events.
|
||||
*
|
||||
* <p>The {@link ScreenExtensions} provided by the {@code info} parameter may be used to register tick, render events, keyboard, mouse, additional and removal of child elements (including buttons).
|
||||
* For example, to register an event on inventory like screens after render, the following code could be used:
|
||||
* <pre>{@code
|
||||
* @Override
|
||||
* public void onInitializeClient() {
|
||||
* ScreenEvents.BEFORE_INIT.register((client, screen, scaledWidth, scaledHeight) -> {
|
||||
* if (screen instanceof AbstractInventoryScreen) {
|
||||
* ScreenEvents.afterRender(screen).register((screen1, matrices, mouseX, mouseY, tickDelta) -> {
|
||||
* ...
|
||||
* });
|
||||
* }
|
||||
* });
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
* <p>This event indicates a screen has been resized, and therefore is being re-initialized.
|
||||
* This event can also indicate that the previous screen has been changed.
|
||||
* @see ScreenEvents#AFTER_INIT
|
||||
*/
|
||||
public static final Event<BeforeInit> BEFORE_INIT = EventFactory.createArrayBacked(BeforeInit.class, callbacks -> (client, screen, scaledWidth, scaledHeight) -> {
|
||||
for (BeforeInit callback : callbacks) {
|
||||
callback.beforeInit(client, screen, scaledWidth, scaledHeight);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* An event that is called after {@link class_437#method_25423(class_310, int, int) a screen is initialized} to its default state.
|
||||
*
|
||||
* <p>Typically this event is used to modify a screen after the screen has been initialized.
|
||||
* Modifications such as changing sizes of buttons, removing buttons and adding/removing child elements to the screen can be done safely using this event.
|
||||
*
|
||||
* <p>For example, to add a button to the title screen, the following code could be used:
|
||||
* <pre>{@code
|
||||
* ScreenEvents.AFTER_INIT.register((client, screen, scaledWidth, scaledHeight) -> {
|
||||
* if (screen instanceof TitleScreen) {
|
||||
* Screens.getButtons(screen).add(new ButtonWidget(...));
|
||||
* }
|
||||
* });
|
||||
* }</pre>
|
||||
*
|
||||
* <p>Note that by adding an element to a screen, the element is not automatically {@link net.minecraft.class_4068 drawn}.
|
||||
* Unless the element is button, you need to call the specific {@link net.minecraft.class_4068#method_25394(class_332, int, int, float) render} methods in the corresponding screen events.
|
||||
*
|
||||
* <p>This event can also indicate that the previous screen has been closed.
|
||||
* @see ScreenEvents#BEFORE_INIT
|
||||
*/
|
||||
public static final Event<AfterInit> AFTER_INIT = EventFactory.createArrayBacked(AfterInit.class, callbacks -> (client, screen, scaledWidth, scaledHeight) -> {
|
||||
for (AfterInit callback : callbacks) {
|
||||
callback.afterInit(client, screen, scaledWidth, scaledHeight);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* An event that is called after {@link class_437#method_25432()} is called.
|
||||
* This event signifies that the screen is now closed.
|
||||
*
|
||||
* <p>This event is typically used to undo any screen specific state changes or to terminate threads spawned by a screen.
|
||||
* This event may precede initialization events {@link ScreenEvents#BEFORE_INIT} but there is no guarantee that event will be called immediately afterwards.
|
||||
*/
|
||||
public static Event<Remove> remove(class_437 screen) {
|
||||
Objects.requireNonNull(screen, "Screen cannot be null");
|
||||
|
||||
return ScreenExtensions.getExtensions(screen).fabric_getRemoveEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
* An event that is called before a screen is rendered.
|
||||
*
|
||||
* @return the event
|
||||
*/
|
||||
public static Event<BeforeRender> beforeRender(class_437 screen) {
|
||||
Objects.requireNonNull(screen, "Screen cannot be null");
|
||||
|
||||
return ScreenExtensions.getExtensions(screen).fabric_getBeforeRenderEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
* An event that is called after a screen is rendered.
|
||||
*
|
||||
* @return the event
|
||||
*/
|
||||
public static Event<AfterRender> afterRender(class_437 screen) {
|
||||
Objects.requireNonNull(screen, "Screen cannot be null");
|
||||
|
||||
return ScreenExtensions.getExtensions(screen).fabric_getAfterRenderEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
* An event that is called before a screen is ticked.
|
||||
*
|
||||
* @return the event
|
||||
*/
|
||||
public static Event<BeforeTick> beforeTick(class_437 screen) {
|
||||
Objects.requireNonNull(screen, "Screen cannot be null");
|
||||
|
||||
return ScreenExtensions.getExtensions(screen).fabric_getBeforeTickEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
* An event that is called after a screen is ticked.
|
||||
*
|
||||
* @return the event
|
||||
*/
|
||||
public static Event<AfterTick> afterTick(class_437 screen) {
|
||||
Objects.requireNonNull(screen, "Screen cannot be null");
|
||||
|
||||
return ScreenExtensions.getExtensions(screen).fabric_getAfterTickEvent();
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface BeforeInit {
|
||||
void beforeInit(class_310 client, class_437 screen, int scaledWidth, int scaledHeight);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface AfterInit {
|
||||
void afterInit(class_310 client, class_437 screen, int scaledWidth, int scaledHeight);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface Remove {
|
||||
void onRemove(class_437 screen);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface BeforeRender {
|
||||
void beforeRender(class_437 screen, class_332 drawContext, int mouseX, int mouseY, float tickDelta);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface AfterRender {
|
||||
void afterRender(class_437 screen, class_332 drawContext, int mouseX, int mouseY, float tickDelta);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface BeforeTick {
|
||||
void beforeTick(class_437 screen);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface AfterTick {
|
||||
void afterTick(class_437 screen);
|
||||
}
|
||||
|
||||
private ScreenEvents() {
|
||||
}
|
||||
}
|
||||
36
net/fabricmc/fabric/mixin/screen/GameRendererMixin.java
Normal file
36
net/fabricmc/fabric/mixin/screen/GameRendererMixin.java
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.mixin.screen;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents;
|
||||
import net.minecraft.class_332;
|
||||
import net.minecraft.class_437;
|
||||
import net.minecraft.class_757;
|
||||
|
||||
@Mixin(class_757.class)
|
||||
abstract class GameRendererMixin {
|
||||
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;renderWithTooltip(Lnet/minecraft/client/gui/DrawContext;IIF)V"))
|
||||
private void onRenderScreen(class_437 currentScreen, class_332 drawContext, int mouseX, int mouseY, float tickDelta, Operation<Void> operation) {
|
||||
ScreenEvents.beforeRender(currentScreen).invoker().beforeRender(currentScreen, drawContext, mouseX, mouseY, tickDelta);
|
||||
operation.call(currentScreen, drawContext, mouseX, mouseY, tickDelta);
|
||||
ScreenEvents.afterRender(currentScreen).invoker().afterRender(currentScreen, drawContext, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
}
|
||||
46
net/fabricmc/fabric/mixin/screen/HandledScreenMixin.java
Normal file
46
net/fabricmc/fabric/mixin/screen/HandledScreenMixin.java
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.mixin.screen;
|
||||
|
||||
import net.minecraft.class_2561;
|
||||
import net.minecraft.class_437;
|
||||
import net.minecraft.class_465;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(class_465.class)
|
||||
public abstract class HandledScreenMixin extends class_437 {
|
||||
private HandledScreenMixin(class_2561 title) {
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Inject(method = "mouseReleased", at = @At("HEAD"), cancellable = true)
|
||||
private void callSuperMouseReleased(double mouseX, double mouseY, int button, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (super.method_25406(mouseX, mouseY, button)) {
|
||||
cir.setReturnValue(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "mouseDragged", at = @At("HEAD"), cancellable = true)
|
||||
private void callSuperMouseReleased(double mouseX, double mouseY, int button, double deltaX, double deltaY, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (super.method_25403(mouseX, mouseY, button, deltaX, deltaY)) {
|
||||
cir.setReturnValue(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
280
net/fabricmc/fabric/mixin/screen/ScreenMixin.java
Normal file
280
net/fabricmc/fabric/mixin/screen/ScreenMixin.java
Normal file
@@ -0,0 +1,280 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.mixin.screen;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents;
|
||||
import net.fabricmc.fabric.api.client.screen.v1.ScreenKeyboardEvents;
|
||||
import net.fabricmc.fabric.api.client.screen.v1.ScreenMouseEvents;
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.impl.client.screen.ButtonList;
|
||||
import net.fabricmc.fabric.impl.client.screen.ScreenEventFactory;
|
||||
import net.fabricmc.fabric.impl.client.screen.ScreenExtensions;
|
||||
import net.minecraft.class_310;
|
||||
import net.minecraft.class_339;
|
||||
import net.minecraft.class_364;
|
||||
import net.minecraft.class_4068;
|
||||
import net.minecraft.class_437;
|
||||
import net.minecraft.class_6379;
|
||||
|
||||
@Mixin(class_437.class)
|
||||
abstract class ScreenMixin implements ScreenExtensions {
|
||||
@Shadow
|
||||
@Final
|
||||
protected List<class_6379> selectables;
|
||||
@Shadow
|
||||
@Final
|
||||
protected List<class_364> children;
|
||||
@Shadow
|
||||
@Final
|
||||
protected List<class_4068> drawables;
|
||||
|
||||
@Unique
|
||||
private ButtonList fabricButtons;
|
||||
@Unique
|
||||
private Event<ScreenEvents.Remove> removeEvent;
|
||||
@Unique
|
||||
private Event<ScreenEvents.BeforeTick> beforeTickEvent;
|
||||
@Unique
|
||||
private Event<ScreenEvents.AfterTick> afterTickEvent;
|
||||
@Unique
|
||||
private Event<ScreenEvents.BeforeRender> beforeRenderEvent;
|
||||
@Unique
|
||||
private Event<ScreenEvents.AfterRender> afterRenderEvent;
|
||||
|
||||
// Keyboard
|
||||
@Unique
|
||||
private Event<ScreenKeyboardEvents.AllowKeyPress> allowKeyPressEvent;
|
||||
@Unique
|
||||
private Event<ScreenKeyboardEvents.BeforeKeyPress> beforeKeyPressEvent;
|
||||
@Unique
|
||||
private Event<ScreenKeyboardEvents.AfterKeyPress> afterKeyPressEvent;
|
||||
@Unique
|
||||
private Event<ScreenKeyboardEvents.AllowKeyRelease> allowKeyReleaseEvent;
|
||||
@Unique
|
||||
private Event<ScreenKeyboardEvents.BeforeKeyRelease> beforeKeyReleaseEvent;
|
||||
@Unique
|
||||
private Event<ScreenKeyboardEvents.AfterKeyRelease> afterKeyReleaseEvent;
|
||||
|
||||
// Mouse
|
||||
@Unique
|
||||
private Event<ScreenMouseEvents.AllowMouseClick> allowMouseClickEvent;
|
||||
@Unique
|
||||
private Event<ScreenMouseEvents.BeforeMouseClick> beforeMouseClickEvent;
|
||||
@Unique
|
||||
private Event<ScreenMouseEvents.AfterMouseClick> afterMouseClickEvent;
|
||||
@Unique
|
||||
private Event<ScreenMouseEvents.AllowMouseRelease> allowMouseReleaseEvent;
|
||||
@Unique
|
||||
private Event<ScreenMouseEvents.BeforeMouseRelease> beforeMouseReleaseEvent;
|
||||
@Unique
|
||||
private Event<ScreenMouseEvents.AfterMouseRelease> afterMouseReleaseEvent;
|
||||
@Unique
|
||||
private Event<ScreenMouseEvents.AllowMouseScroll> allowMouseScrollEvent;
|
||||
@Unique
|
||||
private Event<ScreenMouseEvents.BeforeMouseScroll> beforeMouseScrollEvent;
|
||||
@Unique
|
||||
private Event<ScreenMouseEvents.AfterMouseScroll> afterMouseScrollEvent;
|
||||
|
||||
@Inject(method = "init(Lnet/minecraft/client/MinecraftClient;II)V", at = @At("HEAD"))
|
||||
private void beforeInitScreen(class_310 client, int width, int height, CallbackInfo ci) {
|
||||
beforeInit(client, width, height);
|
||||
}
|
||||
|
||||
@Inject(method = "init(Lnet/minecraft/client/MinecraftClient;II)V", at = @At("TAIL"))
|
||||
private void afterInitScreen(class_310 client, int width, int height, CallbackInfo ci) {
|
||||
afterInit(client, width, height);
|
||||
}
|
||||
|
||||
@Inject(method = "resize", at = @At("HEAD"))
|
||||
private void beforeResizeScreen(class_310 client, int width, int height, CallbackInfo ci) {
|
||||
beforeInit(client, width, height);
|
||||
}
|
||||
|
||||
@Inject(method = "resize", at = @At("TAIL"))
|
||||
private void afterResizeScreen(class_310 client, int width, int height, CallbackInfo ci) {
|
||||
afterInit(client, width, height);
|
||||
}
|
||||
|
||||
@Unique
|
||||
private void beforeInit(class_310 client, int width, int height) {
|
||||
// All elements are repopulated on the screen, so we need to reinitialize all events
|
||||
this.fabricButtons = null;
|
||||
this.removeEvent = ScreenEventFactory.createRemoveEvent();
|
||||
this.beforeRenderEvent = ScreenEventFactory.createBeforeRenderEvent();
|
||||
this.afterRenderEvent = ScreenEventFactory.createAfterRenderEvent();
|
||||
this.beforeTickEvent = ScreenEventFactory.createBeforeTickEvent();
|
||||
this.afterTickEvent = ScreenEventFactory.createAfterTickEvent();
|
||||
|
||||
// Keyboard
|
||||
this.allowKeyPressEvent = ScreenEventFactory.createAllowKeyPressEvent();
|
||||
this.beforeKeyPressEvent = ScreenEventFactory.createBeforeKeyPressEvent();
|
||||
this.afterKeyPressEvent = ScreenEventFactory.createAfterKeyPressEvent();
|
||||
this.allowKeyReleaseEvent = ScreenEventFactory.createAllowKeyReleaseEvent();
|
||||
this.beforeKeyReleaseEvent = ScreenEventFactory.createBeforeKeyReleaseEvent();
|
||||
this.afterKeyReleaseEvent = ScreenEventFactory.createAfterKeyReleaseEvent();
|
||||
|
||||
// Mouse
|
||||
this.allowMouseClickEvent = ScreenEventFactory.createAllowMouseClickEvent();
|
||||
this.beforeMouseClickEvent = ScreenEventFactory.createBeforeMouseClickEvent();
|
||||
this.afterMouseClickEvent = ScreenEventFactory.createAfterMouseClickEvent();
|
||||
this.allowMouseReleaseEvent = ScreenEventFactory.createAllowMouseReleaseEvent();
|
||||
this.beforeMouseReleaseEvent = ScreenEventFactory.createBeforeMouseReleaseEvent();
|
||||
this.afterMouseReleaseEvent = ScreenEventFactory.createAfterMouseReleaseEvent();
|
||||
this.allowMouseScrollEvent = ScreenEventFactory.createAllowMouseScrollEvent();
|
||||
this.beforeMouseScrollEvent = ScreenEventFactory.createBeforeMouseScrollEvent();
|
||||
this.afterMouseScrollEvent = ScreenEventFactory.createAfterMouseScrollEvent();
|
||||
|
||||
ScreenEvents.BEFORE_INIT.invoker().beforeInit(client, (class_437) (Object) this, width, height);
|
||||
}
|
||||
|
||||
@Unique
|
||||
private void afterInit(class_310 client, int width, int height) {
|
||||
ScreenEvents.AFTER_INIT.invoker().afterInit(client, (class_437) (Object) this, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<class_339> fabric_getButtons() {
|
||||
// Lazy init to make the list access safe after Screen#init
|
||||
if (this.fabricButtons == null) {
|
||||
this.fabricButtons = new ButtonList(this.drawables, this.selectables, this.children);
|
||||
}
|
||||
|
||||
return this.fabricButtons;
|
||||
}
|
||||
|
||||
@Unique
|
||||
private <T> Event<T> ensureEventsAreInitialized(Event<T> event) {
|
||||
if (event == null) {
|
||||
throw new IllegalStateException(String.format("[fabric-screen-api-v1] The current screen (%s) has not been correctly initialised, please send this crash log to the mod author. This is usually caused by calling setScreen on the wrong thread.", this.getClass().getName()));
|
||||
}
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event<ScreenEvents.Remove> fabric_getRemoveEvent() {
|
||||
return ensureEventsAreInitialized(this.removeEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event<ScreenEvents.BeforeTick> fabric_getBeforeTickEvent() {
|
||||
return ensureEventsAreInitialized(this.beforeTickEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event<ScreenEvents.AfterTick> fabric_getAfterTickEvent() {
|
||||
return ensureEventsAreInitialized(this.afterTickEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event<ScreenEvents.BeforeRender> fabric_getBeforeRenderEvent() {
|
||||
return ensureEventsAreInitialized(this.beforeRenderEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event<ScreenEvents.AfterRender> fabric_getAfterRenderEvent() {
|
||||
return ensureEventsAreInitialized(this.afterRenderEvent);
|
||||
}
|
||||
|
||||
// Keyboard
|
||||
|
||||
@Override
|
||||
public Event<ScreenKeyboardEvents.AllowKeyPress> fabric_getAllowKeyPressEvent() {
|
||||
return ensureEventsAreInitialized(this.allowKeyPressEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event<ScreenKeyboardEvents.BeforeKeyPress> fabric_getBeforeKeyPressEvent() {
|
||||
return ensureEventsAreInitialized(this.beforeKeyPressEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event<ScreenKeyboardEvents.AfterKeyPress> fabric_getAfterKeyPressEvent() {
|
||||
return ensureEventsAreInitialized(this.afterKeyPressEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event<ScreenKeyboardEvents.AllowKeyRelease> fabric_getAllowKeyReleaseEvent() {
|
||||
return ensureEventsAreInitialized(this.allowKeyReleaseEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event<ScreenKeyboardEvents.BeforeKeyRelease> fabric_getBeforeKeyReleaseEvent() {
|
||||
return ensureEventsAreInitialized(this.beforeKeyReleaseEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event<ScreenKeyboardEvents.AfterKeyRelease> fabric_getAfterKeyReleaseEvent() {
|
||||
return ensureEventsAreInitialized(this.afterKeyReleaseEvent);
|
||||
}
|
||||
|
||||
// Mouse
|
||||
|
||||
@Override
|
||||
public Event<ScreenMouseEvents.AllowMouseClick> fabric_getAllowMouseClickEvent() {
|
||||
return ensureEventsAreInitialized(this.allowMouseClickEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event<ScreenMouseEvents.BeforeMouseClick> fabric_getBeforeMouseClickEvent() {
|
||||
return ensureEventsAreInitialized(this.beforeMouseClickEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event<ScreenMouseEvents.AfterMouseClick> fabric_getAfterMouseClickEvent() {
|
||||
return ensureEventsAreInitialized(this.afterMouseClickEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event<ScreenMouseEvents.AllowMouseRelease> fabric_getAllowMouseReleaseEvent() {
|
||||
return ensureEventsAreInitialized(this.allowMouseReleaseEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event<ScreenMouseEvents.BeforeMouseRelease> fabric_getBeforeMouseReleaseEvent() {
|
||||
return ensureEventsAreInitialized(this.beforeMouseReleaseEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event<ScreenMouseEvents.AfterMouseRelease> fabric_getAfterMouseReleaseEvent() {
|
||||
return ensureEventsAreInitialized(this.afterMouseReleaseEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event<ScreenMouseEvents.AllowMouseScroll> fabric_getAllowMouseScrollEvent() {
|
||||
return ensureEventsAreInitialized(this.allowMouseScrollEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event<ScreenMouseEvents.BeforeMouseScroll> fabric_getBeforeMouseScrollEvent() {
|
||||
return ensureEventsAreInitialized(this.beforeMouseScrollEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event<ScreenMouseEvents.AfterMouseScroll> fabric_getAfterMouseScrollEvent() {
|
||||
return ensureEventsAreInitialized(this.afterMouseScrollEvent);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import dev.dekin.iconsenhanced.common.BorderColorLogic;
|
||||
import dev.dekin.iconsenhanced.common.ConfigManager;
|
||||
import dev.dekin.iconsenhanced.common.IconsEnhancedConfig;
|
||||
import dev.dekin.iconsenhanced.mixin.AbstractContainerScreenAccessor;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
@@ -20,7 +22,7 @@ public final class BorderRenderer {
|
||||
COLOR_LOGIC.applyConfig(ConfigManager.get());
|
||||
}
|
||||
|
||||
public static void render(Screen screen, GuiGraphics graphics, int mouseX, int mouseY) {
|
||||
public static void render(Screen screen, GuiGraphics graphics) {
|
||||
IconsEnhancedConfig config = ConfigManager.get();
|
||||
if (!config.borders.enabled) {
|
||||
return;
|
||||
@@ -30,6 +32,9 @@ public final class BorderRenderer {
|
||||
}
|
||||
|
||||
int thickness = clamp(config.borders.thickness, 1, 3);
|
||||
boolean redrawItems = config.tooltips.enabled && config.tooltips.showIcons;
|
||||
Minecraft client = redrawItems ? Minecraft.getInstance() : null;
|
||||
Font font = redrawItems ? client.font : null;
|
||||
AbstractContainerScreenAccessor accessor = (AbstractContainerScreenAccessor) handled;
|
||||
int left = accessor.iconsenhanced$getLeftPos();
|
||||
int top = accessor.iconsenhanced$getTopPos();
|
||||
@@ -39,18 +44,33 @@ public final class BorderRenderer {
|
||||
if (stack.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
int slotX = left + slot.x;
|
||||
int slotY = top + slot.y;
|
||||
int color = COLOR_LOGIC.resolve(stack);
|
||||
drawBorder(graphics, left + slot.x, top + slot.y, thickness, color);
|
||||
if ((color >>> 24) == 0) {
|
||||
continue;
|
||||
}
|
||||
drawBorder(graphics, slotX, slotY, thickness, color);
|
||||
if (redrawItems) {
|
||||
graphics.renderItem(stack, slotX, slotY);
|
||||
graphics.renderItemDecorations(font, stack, slotX, slotY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void drawBorder(GuiGraphics graphics, int x, int y, int thickness, int color) {
|
||||
int x2 = x + 16;
|
||||
int y2 = y + 16;
|
||||
graphics.fill(x, y, x2, y + thickness, color);
|
||||
graphics.fill(x, y2 - thickness, x2, y2, color);
|
||||
graphics.fill(x, y, x + thickness, y2, color);
|
||||
graphics.fill(x2 - thickness, y, x2, y2, color);
|
||||
int left = x;
|
||||
int top = y;
|
||||
int right = x + 16;
|
||||
int bottom = y + 16;
|
||||
int innerLeft = left + 1;
|
||||
int innerRight = right - 1;
|
||||
int innerTop = top + 1;
|
||||
int innerBottom = bottom - 1;
|
||||
graphics.fill(innerLeft, top, innerRight, top + thickness, color);
|
||||
graphics.fill(innerLeft, bottom - thickness, innerRight, bottom, color);
|
||||
graphics.fill(left, innerTop, left + thickness, innerBottom, color);
|
||||
graphics.fill(right - thickness, innerTop, right, innerBottom, color);
|
||||
}
|
||||
|
||||
private static int clamp(int value, int min, int max) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package dev.dekin.iconsenhanced.client;
|
||||
|
||||
import dev.dekin.iconsenhanced.common.ConfigManager;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents;
|
||||
|
||||
public final class ClientInit implements ClientModInitializer {
|
||||
@@ -10,11 +11,16 @@ public final class ClientInit implements ClientModInitializer {
|
||||
ConfigManager.load();
|
||||
BorderRenderer.applyConfig();
|
||||
TooltipAugmenter.register();
|
||||
ClientTickEvents.END_CLIENT_TICK.register(client -> TooltipAugmenter.registerLate());
|
||||
|
||||
ScreenEvents.AFTER_INIT.register((client, screen, scaledWidth, scaledHeight) -> {
|
||||
ScreenEvents.beforeRender(screen).register((current, graphics, mouseX, mouseY, delta) -> {
|
||||
TooltipAugmenter.beforeRender(current, mouseX, mouseY);
|
||||
});
|
||||
ScreenEvents.afterRender(screen).register((current, graphics, mouseX, mouseY, delta) -> {
|
||||
BorderRenderer.render(current, graphics, mouseX, mouseY);
|
||||
BorderRenderer.render(current, graphics);
|
||||
TooltipAugmenter.renderOverlay(current, graphics, mouseX, mouseY);
|
||||
TooltipAugmenter.afterRender(current);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package dev.dekin.iconsenhanced.client;
|
||||
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent;
|
||||
//? if <1.21.6 {
|
||||
/*import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import org.joml.Matrix4f;
|
||||
*///?}
|
||||
|
||||
public final class CombinedTooltipComponent implements ClientTooltipComponent {
|
||||
private static final int GAP = 2;
|
||||
|
||||
private final ClientTooltipComponent primary;
|
||||
private final ClientTooltipComponent secondary;
|
||||
|
||||
public CombinedTooltipComponent(CombinedTooltipData data) {
|
||||
this.primary = ClientTooltipComponent.create(data.primary());
|
||||
this.secondary = ClientTooltipComponent.create(data.secondary());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth(Font font) {
|
||||
return Math.max(primary.getWidth(font), secondary.getWidth(font));
|
||||
}
|
||||
|
||||
//? if >=1.21.2 {
|
||||
@Override
|
||||
public int getHeight(Font font) {
|
||||
return componentHeight(primary, font) + GAP + componentHeight(secondary, font);
|
||||
}
|
||||
//?} else {
|
||||
/*@Override
|
||||
public int getHeight() {
|
||||
return componentHeight(primary, null) + GAP + componentHeight(secondary, null);
|
||||
}
|
||||
*///?}
|
||||
|
||||
//? if >=1.21.2 {
|
||||
@Override
|
||||
public boolean showTooltipWithItemInHand() {
|
||||
return primary.showTooltipWithItemInHand() || secondary.showTooltipWithItemInHand();
|
||||
}
|
||||
//?}
|
||||
|
||||
//? if >=1.21.6 {
|
||||
@Override
|
||||
public void renderText(GuiGraphics graphics, Font font, int x, int y) {
|
||||
int primaryHeight = componentHeight(primary, font);
|
||||
primary.renderText(graphics, font, x, y);
|
||||
secondary.renderText(graphics, font, x, y + primaryHeight + GAP);
|
||||
}
|
||||
//?} else {
|
||||
/*@Override
|
||||
public void renderText(Font font, int x, int y, Matrix4f matrix, MultiBufferSource.BufferSource buffer) {
|
||||
int primaryHeight = componentHeight(primary, font);
|
||||
primary.renderText(font, x, y, matrix, buffer);
|
||||
secondary.renderText(font, x, y + primaryHeight + GAP, matrix, buffer);
|
||||
}
|
||||
*///?}
|
||||
|
||||
//? if >=1.21.2 {
|
||||
@Override
|
||||
public void renderImage(Font font, int x, int y, int width, int height, GuiGraphics graphics) {
|
||||
int primaryHeight = componentHeight(primary, font);
|
||||
primary.renderImage(font, x, y, width, height, graphics);
|
||||
secondary.renderImage(font, x, y + primaryHeight + GAP, width, height, graphics);
|
||||
}
|
||||
//?} else {
|
||||
/*@Override
|
||||
public void renderImage(Font font, int x, int y, GuiGraphics graphics) {
|
||||
int primaryHeight = componentHeight(primary, font);
|
||||
primary.renderImage(font, x, y, graphics);
|
||||
secondary.renderImage(font, x, y + primaryHeight + GAP, graphics);
|
||||
}
|
||||
*///?}
|
||||
|
||||
private static int componentHeight(ClientTooltipComponent component, Font font) {
|
||||
//? if >=1.21.2 {
|
||||
return component.getHeight(font);
|
||||
//?} else {
|
||||
/*return component.getHeight();*/
|
||||
//?}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package dev.dekin.iconsenhanced.client;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.world.inventory.tooltip.TooltipComponent;
|
||||
|
||||
public final class CombinedTooltipData implements TooltipComponent {
|
||||
private final TooltipComponent primary;
|
||||
private final TooltipComponent secondary;
|
||||
|
||||
public CombinedTooltipData(TooltipComponent primary, TooltipComponent secondary) {
|
||||
this.primary = Objects.requireNonNull(primary, "primary");
|
||||
this.secondary = Objects.requireNonNull(secondary, "secondary");
|
||||
}
|
||||
|
||||
public TooltipComponent primary() {
|
||||
return primary;
|
||||
}
|
||||
|
||||
public TooltipComponent secondary() {
|
||||
return secondary;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
package dev.dekin.iconsenhanced.client;
|
||||
|
||||
import dev.dekin.iconsenhanced.common.IconAtlas;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
//? if >=1.21.6 {
|
||||
import net.minecraft.client.renderer.RenderPipelines;
|
||||
//?}
|
||||
//? if <1.21.6 {
|
||||
/*import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import org.joml.Matrix4f;
|
||||
*///?}
|
||||
|
||||
public final class DurabilityTooltipComponent implements ClientTooltipComponent {
|
||||
private static final int TEXT_PADDING = 4;
|
||||
private static final int DETAIL_COLOR = 0xFFAAAAAA;
|
||||
private static final int TEXT_COLOR = 0xFFFFFFFF;
|
||||
private static final float DETAIL_SCALE = 0.85f;
|
||||
private static final int ICON_Y_OFFSET = -1;
|
||||
//? if <1.21.6 {
|
||||
/*private static final int FULL_BRIGHT = 0xF000F0;
|
||||
*///?}
|
||||
|
||||
private final int iconSize;
|
||||
private final int current;
|
||||
private final int max;
|
||||
private final int percent;
|
||||
private final int percentColor;
|
||||
private final Component label;
|
||||
private final String percentText;
|
||||
private final String detailText;
|
||||
|
||||
public DurabilityTooltipComponent(DurabilityTooltipData data) {
|
||||
this.iconSize = Math.max(8, data.iconSize());
|
||||
this.current = data.current();
|
||||
this.max = data.max();
|
||||
this.percent = data.percent();
|
||||
this.percentColor = data.percentColor();
|
||||
this.label = data.label();
|
||||
this.percentText = " " + percent + "%";
|
||||
this.detailText = " (" + current + "/" + max + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth(Font font) {
|
||||
int textStart = iconSize + TEXT_PADDING;
|
||||
int labelWidth = font.width(label);
|
||||
int percentWidth = font.width(percentText);
|
||||
int detailWidth = (int) Math.ceil(font.width(detailText) * DETAIL_SCALE);
|
||||
return textStart + labelWidth + percentWidth + detailWidth;
|
||||
}
|
||||
|
||||
//? if >=1.21.2 {
|
||||
@Override
|
||||
public int getHeight(Font font) {
|
||||
return Math.max(iconSize, font.lineHeight);
|
||||
}
|
||||
//?} else {
|
||||
/*@Override
|
||||
public int getHeight() {
|
||||
return Math.max(iconSize, 9);
|
||||
}
|
||||
*///?}
|
||||
|
||||
//? if >=1.21.2 {
|
||||
@Override
|
||||
public boolean showTooltipWithItemInHand() {
|
||||
return true;
|
||||
}
|
||||
//?}
|
||||
|
||||
//? if >=1.21.6 {
|
||||
@Override
|
||||
public void renderText(GuiGraphics graphics, Font font, int x, int y) {
|
||||
int rowHeight = Math.max(iconSize, font.lineHeight);
|
||||
int textX = x + iconSize + TEXT_PADDING;
|
||||
int textY = y + (rowHeight - font.lineHeight) / 2;
|
||||
|
||||
graphics.drawString(font, label, textX, textY, TEXT_COLOR, true);
|
||||
int labelWidth = font.width(label);
|
||||
int percentX = textX + labelWidth;
|
||||
graphics.drawString(font, percentText, percentX, textY, colorWithAlpha(percentColor), true);
|
||||
int percentWidth = font.width(percentText);
|
||||
int detailX = percentX + percentWidth;
|
||||
|
||||
graphics.pose().pushMatrix();
|
||||
graphics.pose().translate(detailX, textY);
|
||||
graphics.pose().scale(DETAIL_SCALE, DETAIL_SCALE);
|
||||
graphics.drawString(font, detailText, 0, 0, DETAIL_COLOR, true);
|
||||
graphics.pose().popMatrix();
|
||||
}
|
||||
//?} else {
|
||||
/*@Override
|
||||
public void renderText(Font font, int x, int y, Matrix4f matrix, MultiBufferSource.BufferSource buffer) {
|
||||
int rowHeight = Math.max(iconSize, font.lineHeight);
|
||||
int textX = x + iconSize + TEXT_PADDING;
|
||||
int textY = y + (rowHeight - font.lineHeight) / 2;
|
||||
|
||||
font.drawInBatch(label, textX, textY, TEXT_COLOR, true, matrix, buffer, Font.DisplayMode.NORMAL, 0, FULL_BRIGHT);
|
||||
int labelWidth = font.width(label);
|
||||
int percentX = textX + labelWidth;
|
||||
Component percentComponent = Component.literal(percentText);
|
||||
font.drawInBatch(percentComponent, percentX, textY, colorWithAlpha(percentColor), true, matrix, buffer, Font.DisplayMode.NORMAL, 0, FULL_BRIGHT);
|
||||
int percentWidth = font.width(percentText);
|
||||
int detailX = percentX + percentWidth;
|
||||
|
||||
Matrix4f smallMatrix = new Matrix4f(matrix);
|
||||
smallMatrix.translate(detailX, textY, 0);
|
||||
smallMatrix.scale(DETAIL_SCALE, DETAIL_SCALE, 1.0f);
|
||||
Component detailComponent = Component.literal(detailText);
|
||||
font.drawInBatch(detailComponent, 0, 0, DETAIL_COLOR, true, smallMatrix, buffer, Font.DisplayMode.NORMAL, 0, FULL_BRIGHT);
|
||||
}
|
||||
*///?}
|
||||
|
||||
//? if >=1.21.2 {
|
||||
@Override
|
||||
public void renderImage(Font font, int x, int y, int width, int height, GuiGraphics graphics) {
|
||||
int rowHeight = Math.max(iconSize, font.lineHeight);
|
||||
int iconY = y + (rowHeight - iconSize) / 2 + ICON_Y_OFFSET;
|
||||
if (iconY < y) {
|
||||
iconY = y;
|
||||
}
|
||||
drawIcon(graphics, x, iconY);
|
||||
}
|
||||
//?} else {
|
||||
/*@Override
|
||||
public void renderImage(Font font, int x, int y, GuiGraphics graphics) {
|
||||
int rowHeight = Math.max(iconSize, font.lineHeight);
|
||||
int iconY = y + (rowHeight - iconSize) / 2 + ICON_Y_OFFSET;
|
||||
if (iconY < y) {
|
||||
iconY = y;
|
||||
}
|
||||
drawIcon(graphics, x, iconY);
|
||||
}
|
||||
*///?}
|
||||
|
||||
private void drawIcon(GuiGraphics graphics, int x, int y) {
|
||||
IconAtlas.IconSprite sprite = IconAtlas.get("anvil");
|
||||
float scale = iconSize / (float) IconAtlas.ICON_SOURCE_SIZE;
|
||||
drawIconLayer(graphics, x + 1, y + 1, sprite, scale, shadowColor(TEXT_COLOR));
|
||||
drawIconLayer(graphics, x, y, sprite, scale, TEXT_COLOR);
|
||||
}
|
||||
|
||||
private static void drawIconLayer(GuiGraphics graphics, int x, int y, IconAtlas.IconSprite sprite, float scale, int color) {
|
||||
//? if >=1.21.6 {
|
||||
graphics.pose().pushMatrix();
|
||||
graphics.pose().translate(x, y);
|
||||
graphics.pose().scale(scale, scale);
|
||||
//?} else {
|
||||
/*graphics.pose().pushPose();
|
||||
graphics.pose().translate(x, y, 0);
|
||||
graphics.pose().scale(scale, scale, 1.0f);
|
||||
*///?}
|
||||
blit(graphics, 0, 0, sprite.u, sprite.v, sprite.size, color);
|
||||
//? if >=1.21.6 {
|
||||
graphics.pose().popMatrix();
|
||||
//?} else {
|
||||
/*graphics.pose().popPose();
|
||||
*///?}
|
||||
}
|
||||
|
||||
private static void blit(GuiGraphics graphics, int x, int y, int u, int v, int size, int color) {
|
||||
//? if >=1.21.6 {
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, IconAtlas.ATLAS, x, y, (float) u, (float) v, size, size, IconAtlas.ATLAS_SIZE, IconAtlas.ATLAS_SIZE, color);
|
||||
//?} else if >=1.21.2 {
|
||||
/*graphics.blit(RenderType::guiTextured, IconAtlas.ATLAS, x, y, (float) u, (float) v, size, size, IconAtlas.ATLAS_SIZE, IconAtlas.ATLAS_SIZE, color);
|
||||
*///?} else {
|
||||
/*applyColor(graphics, color);
|
||||
graphics.blit(IconAtlas.ATLAS, x, y, 0, (float) u, (float) v, size, size, IconAtlas.ATLAS_SIZE, IconAtlas.ATLAS_SIZE);
|
||||
resetColor(graphics);
|
||||
*///?}
|
||||
}
|
||||
|
||||
private static int shadowColor(int color) {
|
||||
int a = (color >>> 24) & 0xFF;
|
||||
int r = (color >>> 16) & 0xFF;
|
||||
int g = (color >>> 8) & 0xFF;
|
||||
int b = color & 0xFF;
|
||||
r = (int) (r * 0.35f);
|
||||
g = (int) (g * 0.35f);
|
||||
b = (int) (b * 0.35f);
|
||||
return (a << 24) | (r << 16) | (g << 8) | b;
|
||||
}
|
||||
|
||||
private static int colorWithAlpha(int rgb) {
|
||||
return 0xFF000000 | (rgb & 0xFFFFFF);
|
||||
}
|
||||
|
||||
//? if <1.21.2 {
|
||||
/*private static void applyColor(GuiGraphics graphics, int argb) {
|
||||
float a = ((argb >>> 24) & 0xFF) / 255f;
|
||||
float r = ((argb >>> 16) & 0xFF) / 255f;
|
||||
float g = ((argb >>> 8) & 0xFF) / 255f;
|
||||
float b = (argb & 0xFF) / 255f;
|
||||
graphics.setColor(r, g, b, a);
|
||||
}
|
||||
|
||||
private static void resetColor(GuiGraphics graphics) {
|
||||
graphics.setColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
*///?}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package dev.dekin.iconsenhanced.client;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.inventory.tooltip.TooltipComponent;
|
||||
|
||||
public final class DurabilityTooltipData implements TooltipComponent {
|
||||
private final int iconSize;
|
||||
private final int current;
|
||||
private final int max;
|
||||
private final int percent;
|
||||
private final int percentColor;
|
||||
private final Component label;
|
||||
|
||||
public DurabilityTooltipData(int iconSize, int current, int max, int percent, int percentColor, Component label) {
|
||||
this.iconSize = iconSize;
|
||||
this.current = current;
|
||||
this.max = max;
|
||||
this.percent = percent;
|
||||
this.percentColor = percentColor;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public int iconSize() {
|
||||
return iconSize;
|
||||
}
|
||||
|
||||
public int current() {
|
||||
return current;
|
||||
}
|
||||
|
||||
public int max() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public int percent() {
|
||||
return percent;
|
||||
}
|
||||
|
||||
public int percentColor() {
|
||||
return percentColor;
|
||||
}
|
||||
|
||||
public Component label() {
|
||||
return label;
|
||||
}
|
||||
}
|
||||
@@ -3,13 +3,18 @@ package dev.dekin.iconsenhanced.client;
|
||||
import dev.dekin.iconsenhanced.common.IconAtlas;
|
||||
import dev.dekin.iconsenhanced.common.TooltipLayoutModel;
|
||||
import dev.dekin.iconsenhanced.common.TooltipLayoutModel.Row;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
//? if >=1.21 {
|
||||
import net.minecraft.network.chat.TextColor;
|
||||
//? if >=1.21.6 {
|
||||
import net.minecraft.client.renderer.RenderPipelines;
|
||||
//?} else {
|
||||
//?}
|
||||
//? if <1.21.6 {
|
||||
/*import net.minecraft.client.renderer.RenderType;
|
||||
*///?}
|
||||
//? if <1.21.6 {
|
||||
/*import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import org.joml.Matrix4f;
|
||||
*///?}
|
||||
@@ -18,8 +23,9 @@ public final class EnchantTooltipComponent implements ClientTooltipComponent {
|
||||
private static final int ROW_GAP = 2;
|
||||
private static final int TEXT_PADDING = 4;
|
||||
private static final int BADGE_BG = 0xAA000000;
|
||||
private static final int BADGE_TEXT = 0xFFFFFFFF;
|
||||
//? if <1.21 {
|
||||
private static final int BADGE_TEXT = 0xFFFFFFFF;
|
||||
private static final int ICON_Y_OFFSET = -1;
|
||||
//? if <1.21.6 {
|
||||
/*private static final int FULL_BRIGHT = 0xF000F0;
|
||||
*///?}
|
||||
|
||||
@@ -29,7 +35,7 @@ public final class EnchantTooltipComponent implements ClientTooltipComponent {
|
||||
|
||||
public EnchantTooltipComponent(EnchantTooltipData data) {
|
||||
this.layout = data.layout();
|
||||
this.iconSize = Math.max(4, data.iconSize());
|
||||
this.iconSize = Math.max(1, data.iconSize());
|
||||
this.showLevelBadge = data.showLevelBadge();
|
||||
}
|
||||
|
||||
@@ -46,7 +52,7 @@ public final class EnchantTooltipComponent implements ClientTooltipComponent {
|
||||
return width;
|
||||
}
|
||||
|
||||
//? if >=1.21 {
|
||||
//? if >=1.21.2 {
|
||||
@Override
|
||||
public int getHeight(Font font) {
|
||||
return computeHeight(font);
|
||||
@@ -73,28 +79,31 @@ public final class EnchantTooltipComponent implements ClientTooltipComponent {
|
||||
return height;
|
||||
}
|
||||
|
||||
//? if >=1.21 {
|
||||
//? if >=1.21.2 {
|
||||
@Override
|
||||
public boolean showTooltipWithItemInHand() {
|
||||
return true;
|
||||
}
|
||||
//?}
|
||||
|
||||
//? if >=1.21 {
|
||||
//? if >=1.21.6 {
|
||||
@Override
|
||||
public void renderText(GuiGraphics graphics, Font font, int x, int y) {
|
||||
int yOffset = 0;
|
||||
int rowHeight = Math.max(iconSize, font.lineHeight);
|
||||
int textX = x + iconSize + TEXT_PADDING;
|
||||
for (Row row : layout.rows()) {
|
||||
for (int i = 0; i < layout.rows().size(); i++) {
|
||||
Row row = layout.rows().get(i);
|
||||
int textY = y + yOffset + (rowHeight - font.lineHeight) / 2;
|
||||
graphics.drawString(font, row.text, textX, textY, 0xFFFFFFFF, false);
|
||||
graphics.drawString(font, row.text, textX, textY, 0xFFFFFFFF, true);
|
||||
yOffset += rowHeight;
|
||||
for (Component desc : row.descriptions) {
|
||||
graphics.drawString(font, desc, textX, y + yOffset, 0xFFFFFFFF, false);
|
||||
graphics.drawString(font, desc, textX, y + yOffset, 0xFFFFFFFF, true);
|
||||
yOffset += font.lineHeight;
|
||||
}
|
||||
yOffset += ROW_GAP;
|
||||
if (i < layout.rows().size() - 1) {
|
||||
yOffset += ROW_GAP;
|
||||
}
|
||||
}
|
||||
}
|
||||
//?} else {
|
||||
@@ -103,20 +112,23 @@ public final class EnchantTooltipComponent implements ClientTooltipComponent {
|
||||
int yOffset = 0;
|
||||
int rowHeight = Math.max(iconSize, font.lineHeight);
|
||||
int textX = x + iconSize + TEXT_PADDING;
|
||||
for (Row row : layout.rows()) {
|
||||
for (int i = 0; i < layout.rows().size(); i++) {
|
||||
Row row = layout.rows().get(i);
|
||||
int textY = y + yOffset + (rowHeight - font.lineHeight) / 2;
|
||||
font.drawInBatch(row.text, textX, textY, 0xFFFFFFFF, false, matrix, buffer, Font.DisplayMode.NORMAL, 0, FULL_BRIGHT);
|
||||
font.drawInBatch(row.text, textX, textY, 0xFFFFFFFF, true, matrix, buffer, Font.DisplayMode.NORMAL, 0, FULL_BRIGHT);
|
||||
yOffset += rowHeight;
|
||||
for (Component desc : row.descriptions) {
|
||||
font.drawInBatch(desc, textX, y + yOffset, 0xFFFFFFFF, false, matrix, buffer, Font.DisplayMode.NORMAL, 0, FULL_BRIGHT);
|
||||
font.drawInBatch(desc, textX, y + yOffset, 0xFFFFFFFF, true, matrix, buffer, Font.DisplayMode.NORMAL, 0, FULL_BRIGHT);
|
||||
yOffset += font.lineHeight;
|
||||
}
|
||||
yOffset += ROW_GAP;
|
||||
if (i < layout.rows().size() - 1) {
|
||||
yOffset += ROW_GAP;
|
||||
}
|
||||
}
|
||||
}
|
||||
*///?}
|
||||
|
||||
//? if >=1.21 {
|
||||
//? if >=1.21.2 {
|
||||
@Override
|
||||
public void renderImage(Font font, int x, int y, int width, int height, GuiGraphics graphics) {
|
||||
renderIcons(font, x, y, graphics);
|
||||
@@ -131,22 +143,35 @@ public final class EnchantTooltipComponent implements ClientTooltipComponent {
|
||||
private void renderIcons(Font font, int x, int y, GuiGraphics graphics) {
|
||||
int yOffset = 0;
|
||||
int rowHeight = Math.max(iconSize, font.lineHeight);
|
||||
for (Row row : layout.rows()) {
|
||||
int iconY = y + yOffset + (rowHeight - iconSize) / 2;
|
||||
drawIcon(graphics, x, iconY, row.iconKey);
|
||||
for (int i = 0; i < layout.rows().size(); i++) {
|
||||
Row row = layout.rows().get(i);
|
||||
int baseY = y + yOffset;
|
||||
int iconY = baseY + (rowHeight - iconSize) / 2 + ICON_Y_OFFSET;
|
||||
if (iconY < baseY) {
|
||||
iconY = baseY;
|
||||
}
|
||||
drawIcon(graphics, x, iconY, row.iconKey, row.text);
|
||||
if (showLevelBadge) {
|
||||
drawBadge(graphics, font, x, iconY, row.level);
|
||||
}
|
||||
yOffset += rowHeight;
|
||||
yOffset += row.descriptions.size() * font.lineHeight;
|
||||
yOffset += ROW_GAP;
|
||||
if (i < layout.rows().size() - 1) {
|
||||
yOffset += ROW_GAP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void drawIcon(GuiGraphics graphics, int x, int y, String key) {
|
||||
private void drawIcon(GuiGraphics graphics, int x, int y, String key, Component text) {
|
||||
IconAtlas.IconSprite sprite = IconAtlas.get(key);
|
||||
float scale = iconSize / (float) IconAtlas.ICON_SOURCE_SIZE;
|
||||
//? if >=1.21 {
|
||||
int color = resolveColor(text);
|
||||
drawIconLayer(graphics, x + 1, y + 1, sprite, scale, shadowColor(color));
|
||||
drawIconLayer(graphics, x, y, sprite, scale, color);
|
||||
}
|
||||
|
||||
private static void drawIconLayer(GuiGraphics graphics, int x, int y, IconAtlas.IconSprite sprite, float scale, int color) {
|
||||
//? if >=1.21.6 {
|
||||
graphics.pose().pushMatrix();
|
||||
graphics.pose().translate(x, y);
|
||||
graphics.pose().scale(scale, scale);
|
||||
@@ -155,8 +180,8 @@ public final class EnchantTooltipComponent implements ClientTooltipComponent {
|
||||
graphics.pose().translate(x, y, 0);
|
||||
graphics.pose().scale(scale, scale, 1.0f);
|
||||
*///?}
|
||||
blit(graphics, 0, 0, sprite.u, sprite.v, sprite.size);
|
||||
//? if >=1.21 {
|
||||
blit(graphics, 0, 0, sprite.u, sprite.v, sprite.size, color);
|
||||
//? if >=1.21.6 {
|
||||
graphics.pose().popMatrix();
|
||||
//?} else {
|
||||
/*graphics.pose().popPose();
|
||||
@@ -164,7 +189,7 @@ public final class EnchantTooltipComponent implements ClientTooltipComponent {
|
||||
}
|
||||
|
||||
private void drawBadge(GuiGraphics graphics, Font font, int x, int y, int level) {
|
||||
String text = levelToRoman(level);
|
||||
String text = levelToString(level);
|
||||
if (text.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -174,30 +199,58 @@ public final class EnchantTooltipComponent implements ClientTooltipComponent {
|
||||
int badgeX = x + iconSize - badgeWidth;
|
||||
int badgeY = y - 1;
|
||||
graphics.fill(badgeX, badgeY, badgeX + badgeWidth, badgeY + badgeHeight, BADGE_BG);
|
||||
graphics.drawString(font, text, badgeX + 1, badgeY + 1, BADGE_TEXT, false);
|
||||
graphics.drawString(font, text, badgeX + 1, badgeY + 1, BADGE_TEXT, true);
|
||||
}
|
||||
|
||||
private static String levelToRoman(int level) {
|
||||
return switch (level) {
|
||||
case 1 -> "I";
|
||||
case 2 -> "II";
|
||||
case 3 -> "III";
|
||||
case 4 -> "IV";
|
||||
case 5 -> "V";
|
||||
case 6 -> "VI";
|
||||
case 7 -> "VII";
|
||||
case 8 -> "VIII";
|
||||
case 9 -> "IX";
|
||||
case 10 -> "X";
|
||||
default -> Integer.toString(level);
|
||||
};
|
||||
private static String levelToString(int level) {
|
||||
return Integer.toString(level);
|
||||
}
|
||||
|
||||
private static void blit(GuiGraphics graphics, int x, int y, int u, int v, int size) {
|
||||
//? if >=1.21 {
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, IconAtlas.ATLAS, x, y, u, v, size, size, IconAtlas.ATLAS_SIZE, IconAtlas.ATLAS_SIZE);
|
||||
//?} else {
|
||||
/*graphics.blit(IconAtlas.ATLAS, x, y, 0, (float) u, (float) v, size, size, IconAtlas.ATLAS_SIZE, IconAtlas.ATLAS_SIZE);
|
||||
private static void blit(GuiGraphics graphics, int x, int y, int u, int v, int size, int color) {
|
||||
//? if >=1.21.6 {
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, IconAtlas.ATLAS, x, y, (float) u, (float) v, size, size, IconAtlas.ATLAS_SIZE, IconAtlas.ATLAS_SIZE, color);
|
||||
//?} else if >=1.21.2 {
|
||||
/*graphics.blit(RenderType::guiTextured, IconAtlas.ATLAS, x, y, (float) u, (float) v, size, size, IconAtlas.ATLAS_SIZE, IconAtlas.ATLAS_SIZE, color);
|
||||
*///?} else {
|
||||
/*applyColor(graphics, color);
|
||||
graphics.blit(IconAtlas.ATLAS, x, y, 0, (float) u, (float) v, size, size, IconAtlas.ATLAS_SIZE, IconAtlas.ATLAS_SIZE);
|
||||
resetColor(graphics);
|
||||
*///?}
|
||||
}
|
||||
|
||||
private static int resolveColor(Component text) {
|
||||
if (text == null) {
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
TextColor color = text.getStyle().getColor();
|
||||
if (color == null) {
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
return 0xFF000000 | color.getValue();
|
||||
}
|
||||
|
||||
private static int shadowColor(int color) {
|
||||
int a = (color >>> 24) & 0xFF;
|
||||
int r = (color >>> 16) & 0xFF;
|
||||
int g = (color >>> 8) & 0xFF;
|
||||
int b = color & 0xFF;
|
||||
r = (int) (r * 0.35f);
|
||||
g = (int) (g * 0.35f);
|
||||
b = (int) (b * 0.35f);
|
||||
return (a << 24) | (r << 16) | (g << 8) | b;
|
||||
}
|
||||
|
||||
//? if <1.21.2 {
|
||||
/*private static void applyColor(GuiGraphics graphics, int argb) {
|
||||
float a = ((argb >>> 24) & 0xFF) / 255f;
|
||||
float r = ((argb >>> 16) & 0xFF) / 255f;
|
||||
float g = ((argb >>> 8) & 0xFF) / 255f;
|
||||
float b = (argb & 0xFF) / 255f;
|
||||
graphics.setColor(r, g, b, a);
|
||||
}
|
||||
|
||||
private static void resetColor(GuiGraphics graphics) {
|
||||
graphics.setColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
*///?}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package dev.dekin.iconsenhanced.client;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import dev.dekin.iconsenhanced.IconsEnhanced;
|
||||
@@ -18,38 +17,101 @@ import dev.dekin.iconsenhanced.mixin.AbstractContainerScreenAccessor;
|
||||
import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.TooltipComponentCallback;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent;
|
||||
import net.minecraft.client.gui.screens.inventory.tooltip.DefaultTooltipPositioner;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.world.inventory.Slot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.inventory.tooltip.TooltipComponent;
|
||||
//? if <1.21.6 {
|
||||
/*import net.minecraft.client.gui.screens.inventory.tooltip.TooltipRenderUtil;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Vector2ic;
|
||||
*///?}
|
||||
|
||||
public final class TooltipAugmenter {
|
||||
private static final EnchantmentAdapter ADAPTER = new DefaultEnchantmentAdapter();
|
||||
private static final EnchantSortLogic SORT_LOGIC = new EnchantSortLogic();
|
||||
private static final ThreadLocal<Boolean> CAPTURE = ThreadLocal.withInitial(() -> Boolean.FALSE);
|
||||
private static final ThreadLocal<EnchantTooltipData> CAPTURED_DATA = new ThreadLocal<>();
|
||||
private static final ThreadLocal<Integer> CAPTURED_ENCHANT_INDEX = new ThreadLocal<>();
|
||||
private static final ThreadLocal<DurabilityTooltipData> CAPTURED_DURABILITY = new ThreadLocal<>();
|
||||
private static final ThreadLocal<Integer> CAPTURED_DURABILITY_INDEX = new ThreadLocal<>();
|
||||
private static final ThreadLocal<Boolean> SUPPRESS_VANILLA = ThreadLocal.withInitial(() -> Boolean.FALSE);
|
||||
private static final ThreadLocal<Slot> SAVED_HOVERED = new ThreadLocal<>();
|
||||
private static boolean LATE_REGISTERED = false;
|
||||
private static final int DURABILITY_GREEN = 0x55FF55;
|
||||
private static final int DURABILITY_ORANGE = 0xFFAA00;
|
||||
private static final int DURABILITY_RED = 0xFF5555;
|
||||
|
||||
private TooltipAugmenter() {
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
//? if >=1.21 {
|
||||
//? if >=1.20.5 {
|
||||
ItemTooltipCallback.EVENT.register((stack, context, flag, lines) -> onTooltip(stack, lines));
|
||||
//?} else {
|
||||
/*ItemTooltipCallback.EVENT.register((stack, context, lines) -> onTooltip(stack, lines));
|
||||
*///?}
|
||||
|
||||
TooltipComponentCallback.EVENT.register(data -> {
|
||||
if (data instanceof CombinedTooltipData combined) {
|
||||
return new CombinedTooltipComponent(combined);
|
||||
}
|
||||
if (data instanceof EnchantTooltipData enchData) {
|
||||
return new EnchantTooltipComponent(enchData);
|
||||
}
|
||||
if (data instanceof DurabilityTooltipData durabilityData) {
|
||||
return new DurabilityTooltipComponent(durabilityData);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
public static void registerLate() {
|
||||
if (LATE_REGISTERED) {
|
||||
return;
|
||||
}
|
||||
LATE_REGISTERED = true;
|
||||
//? if >=1.20.5 {
|
||||
ItemTooltipCallback.EVENT.register((stack, context, flag, lines) -> suppressVanilla(lines));
|
||||
//?} else {
|
||||
/*ItemTooltipCallback.EVENT.register((stack, context, lines) -> suppressVanilla(lines));
|
||||
*///?}
|
||||
}
|
||||
|
||||
public static void beforeRender(Screen screen, int mouseX, int mouseY) {
|
||||
SUPPRESS_VANILLA.set(Boolean.FALSE);
|
||||
SAVED_HOVERED.remove();
|
||||
|
||||
IconsEnhancedConfig config = ConfigManager.get();
|
||||
if (!config.tooltips.enabled || !config.tooltips.showIcons) {
|
||||
return;
|
||||
}
|
||||
if (!(screen instanceof AbstractContainerScreen<?> handled)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Slot hovered = findHoveredSlot(handled, mouseX, mouseY);
|
||||
if (hovered == null || hovered.getItem().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SAVED_HOVERED.set(hovered);
|
||||
SUPPRESS_VANILLA.set(Boolean.TRUE);
|
||||
}
|
||||
|
||||
public static void afterRender(Screen screen) {
|
||||
SAVED_HOVERED.remove();
|
||||
SUPPRESS_VANILLA.remove();
|
||||
}
|
||||
|
||||
public static void renderOverlay(Screen screen, GuiGraphics graphics, int mouseX, int mouseY) {
|
||||
IconsEnhancedConfig config = ConfigManager.get();
|
||||
if (!config.tooltips.enabled || !config.tooltips.showIcons) {
|
||||
@@ -59,7 +121,10 @@ public final class TooltipAugmenter {
|
||||
return;
|
||||
}
|
||||
|
||||
Slot hovered = findHoveredSlot(handled, mouseX, mouseY);
|
||||
Slot hovered = SAVED_HOVERED.get();
|
||||
if (hovered == null) {
|
||||
hovered = findHoveredSlot(handled, mouseX, mouseY);
|
||||
}
|
||||
if (hovered == null) {
|
||||
return;
|
||||
}
|
||||
@@ -70,27 +135,32 @@ public final class TooltipAugmenter {
|
||||
|
||||
Minecraft client = Minecraft.getInstance();
|
||||
List<Component> lines;
|
||||
EnchantTooltipData data;
|
||||
EnchantTooltipData data = null;
|
||||
DurabilityTooltipData durabilityData = null;
|
||||
Integer enchantIndex = null;
|
||||
Integer durabilityIndex = null;
|
||||
TooltipComponent baseData = stack.getTooltipImage().orElse(null);
|
||||
try {
|
||||
CAPTURE.set(Boolean.TRUE);
|
||||
CAPTURED_DATA.remove();
|
||||
CAPTURED_ENCHANT_INDEX.remove();
|
||||
CAPTURED_DURABILITY.remove();
|
||||
CAPTURED_DURABILITY_INDEX.remove();
|
||||
lines = Screen.getTooltipFromItem(client, stack);
|
||||
data = CAPTURED_DATA.get();
|
||||
enchantIndex = CAPTURED_ENCHANT_INDEX.get();
|
||||
durabilityData = CAPTURED_DURABILITY.get();
|
||||
durabilityIndex = CAPTURED_DURABILITY_INDEX.get();
|
||||
} finally {
|
||||
CAPTURE.remove();
|
||||
CAPTURED_DATA.remove();
|
||||
CAPTURED_ENCHANT_INDEX.remove();
|
||||
CAPTURED_DURABILITY.remove();
|
||||
CAPTURED_DURABILITY_INDEX.remove();
|
||||
}
|
||||
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Optional<TooltipComponent> tooltipData = Optional.of(data);
|
||||
//? if >=1.21 {
|
||||
graphics.setTooltipForNextFrame(client.font, lines, tooltipData, mouseX, mouseY);
|
||||
//?} else {
|
||||
/*graphics.renderTooltip(client.font, lines, tooltipData, mouseX, mouseY);
|
||||
*///?}
|
||||
List<ClientTooltipComponent> components = buildComponents(lines, data, enchantIndex, durabilityData, durabilityIndex, baseData);
|
||||
renderTooltipComponents(graphics, client.font, components, mouseX, mouseY);
|
||||
}
|
||||
|
||||
private static void onTooltip(ItemStack stack, List<Component> lines) {
|
||||
@@ -99,68 +169,347 @@ public final class TooltipAugmenter {
|
||||
if (!config.tooltips.enabled) {
|
||||
return;
|
||||
}
|
||||
if (!Boolean.TRUE.equals(CAPTURE.get()) && Boolean.TRUE.equals(SUPPRESS_VANILLA.get())) {
|
||||
lines.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
List<EnchEntry> entries = ADAPTER.getEnchantments(stack);
|
||||
if (entries.isEmpty()) {
|
||||
return;
|
||||
TooltipBlock block = entries.isEmpty() ? null : TooltipBlock.find(lines, entries);
|
||||
List<EnchEntry> sorted = entries.isEmpty() ? entries : SORT_LOGIC.sort(entries, config.tooltips);
|
||||
//? if >=1.21.9 {
|
||||
boolean shiftDown = Minecraft.getInstance().hasShiftDown();
|
||||
//?} else {
|
||||
/*boolean shiftDown = Screen.hasShiftDown();*/
|
||||
//?}
|
||||
boolean canAugment = !entries.isEmpty() && block != null && block.contiguous;
|
||||
boolean hasDescriptions = canAugment && config.tooltips.showDescriptions && hasAnyDescriptions(sorted);
|
||||
Component hint = hasDescriptions && !shiftDown ? TooltipTextUtil.getShiftHint() : null;
|
||||
DurabilityTooltipData durabilityData = buildDurabilityData(stack, config.tooltips);
|
||||
boolean hasEnchantBlock = !entries.isEmpty() && block != null && block.contiguous;
|
||||
List<Component> enchantLines = List.of();
|
||||
if (hasEnchantBlock) {
|
||||
boolean shouldReplace = config.tooltips.reorderEnchantments || config.tooltips.showDescriptions;
|
||||
List<EnchEntry> ordered = config.tooltips.reorderEnchantments ? sorted : entries;
|
||||
if (shouldReplace) {
|
||||
enchantLines = buildTextLines(ordered, config.tooltips.showDescriptions, shiftDown);
|
||||
} else {
|
||||
enchantLines = new ArrayList<>(lines.subList(block.start, block.end + 1));
|
||||
}
|
||||
}
|
||||
|
||||
TooltipBlock block = TooltipBlock.find(lines, entries);
|
||||
if (!block.contiguous) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<EnchEntry> sorted = SORT_LOGIC.sort(entries, config.tooltips);
|
||||
|
||||
if (Boolean.TRUE.equals(CAPTURE.get()) && config.tooltips.showIcons) {
|
||||
EnchantTooltipData data = buildTooltipData(sorted, config.tooltips);
|
||||
CAPTURED_DATA.set(data);
|
||||
block.remove(lines);
|
||||
boolean insertEnchantComponent = hasEnchantBlock;
|
||||
if (insertEnchantComponent) {
|
||||
List<EnchEntry> iconEntries = config.tooltips.reorderEnchantments ? sorted : entries;
|
||||
EnchantTooltipData data = buildTooltipData(iconEntries, config.tooltips, shiftDown);
|
||||
CAPTURED_DATA.set(data);
|
||||
}
|
||||
if (durabilityData != null) {
|
||||
CAPTURED_DURABILITY.set(durabilityData);
|
||||
}
|
||||
ReorderedLines reordered = reorderLines(lines, block, List.of(), insertEnchantComponent,
|
||||
null, durabilityData != null, hint);
|
||||
lines.clear();
|
||||
lines.addAll(reordered.lines);
|
||||
if (insertEnchantComponent) {
|
||||
CAPTURED_ENCHANT_INDEX.set(reordered.enchantIndex);
|
||||
}
|
||||
if (durabilityData != null) {
|
||||
CAPTURED_DURABILITY_INDEX.set(reordered.durabilityIndex);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!config.tooltips.reorderEnchantments && !config.tooltips.showDescriptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<EnchEntry> ordered = config.tooltips.reorderEnchantments ? sorted : entries;
|
||||
List<Component> replacement = buildTextLines(ordered, config.tooltips.showDescriptions);
|
||||
block.replace(lines, replacement);
|
||||
Component durabilityLine = buildDurabilityLine(durabilityData);
|
||||
ReorderedLines reordered = reorderLines(lines, block, enchantLines, false, durabilityLine, false, hint);
|
||||
lines.clear();
|
||||
lines.addAll(reordered.lines);
|
||||
} catch (Exception e) {
|
||||
IconsEnhanced.LOGGER.warn("Tooltip augmentation failed.", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static EnchantTooltipData buildTooltipData(List<EnchEntry> entries, IconsEnhancedConfig.Tooltips tooltips) {
|
||||
List<TooltipLayoutModel.Row> rows = new ArrayList<>();
|
||||
for (EnchEntry entry : entries) {
|
||||
List<Component> desc = tooltips.showDescriptions
|
||||
? TooltipTextUtil.getDescriptionLines(entry.descKey)
|
||||
: List.of();
|
||||
rows.add(new TooltipLayoutModel.Row(entry.displayName, desc, entry.iconKey, entry.level, entry.isCurse));
|
||||
private static void suppressVanilla(List<Component> lines) {
|
||||
if (!Boolean.TRUE.equals(CAPTURE.get()) && Boolean.TRUE.equals(SUPPRESS_VANILLA.get())) {
|
||||
lines.clear();
|
||||
}
|
||||
return new EnchantTooltipData(new TooltipLayoutModel(rows), tooltips.iconSize, tooltips.showLevelBadge);
|
||||
}
|
||||
|
||||
private static List<Component> buildTextLines(List<EnchEntry> entries, boolean showDescriptions) {
|
||||
private static DurabilityTooltipData buildDurabilityData(ItemStack stack, IconsEnhancedConfig.Tooltips tooltips) {
|
||||
if (stack == null || !stack.isDamageableItem()) {
|
||||
return null;
|
||||
}
|
||||
int max = stack.getMaxDamage();
|
||||
if (max <= 0) {
|
||||
return null;
|
||||
}
|
||||
int current = max - stack.getDamageValue();
|
||||
if (current < 0) {
|
||||
current = 0;
|
||||
}
|
||||
int percent = Math.round((current / (float) max) * 100f);
|
||||
if (percent < 0) {
|
||||
percent = 0;
|
||||
} else if (percent > 100) {
|
||||
percent = 100;
|
||||
}
|
||||
int percentColor = durabilityPercentColor(percent);
|
||||
Component label = Component.literal("Durability:");
|
||||
return new DurabilityTooltipData(tooltips.iconSize, current, max, percent, percentColor, label);
|
||||
}
|
||||
|
||||
private static Component buildDurabilityLine(DurabilityTooltipData data) {
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
MutableComponent label = data.label().copy().withStyle(style -> style.withColor(0xFFFFFF));
|
||||
Component percent = Component.literal(" " + data.percent() + "%").withStyle(style -> style.withColor(data.percentColor()));
|
||||
Component detail = Component.literal(" (" + data.current() + "/" + data.max() + ")").withStyle(style -> style.withColor(0xAAAAAA));
|
||||
return label.append(percent).append(detail);
|
||||
}
|
||||
|
||||
private static int durabilityPercentColor(int percent) {
|
||||
if (percent <= 33) {
|
||||
return DURABILITY_RED;
|
||||
}
|
||||
if (percent <= 66) {
|
||||
return DURABILITY_ORANGE;
|
||||
}
|
||||
return DURABILITY_GREEN;
|
||||
}
|
||||
|
||||
private static EnchantTooltipData buildTooltipData(List<EnchEntry> entries, IconsEnhancedConfig.Tooltips tooltips, boolean shiftDown) {
|
||||
List<TooltipLayoutModel.Row> rows = new ArrayList<>();
|
||||
boolean showDescriptions = tooltips.showDescriptions && shiftDown;
|
||||
boolean numericLevels = true;
|
||||
for (EnchEntry entry : entries) {
|
||||
Component name = numericLevels
|
||||
? TooltipTextUtil.withNumericLevel(entry.baseName, entry.level)
|
||||
: entry.displayName;
|
||||
List<Component> desc = showDescriptions
|
||||
? TooltipTextUtil.getDescriptionLines(entry.descKey)
|
||||
: List.of();
|
||||
rows.add(new TooltipLayoutModel.Row(name, desc, entry.iconKey, entry.level, entry.isCurse));
|
||||
}
|
||||
boolean showBadge = tooltips.showLevelBadge && !numericLevels;
|
||||
return new EnchantTooltipData(new TooltipLayoutModel(rows), tooltips.iconSize, showBadge);
|
||||
}
|
||||
|
||||
private static List<Component> buildTextLines(List<EnchEntry> entries, boolean showDescriptions, boolean shiftDown) {
|
||||
List<Component> lines = new ArrayList<>();
|
||||
for (EnchEntry entry : entries) {
|
||||
lines.add(entry.displayName);
|
||||
if (showDescriptions) {
|
||||
if (showDescriptions && shiftDown) {
|
||||
lines.addAll(TooltipTextUtil.getDescriptionLines(entry.descKey));
|
||||
}
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
||||
private static List<ClientTooltipComponent> buildComponents(List<Component> lines, EnchantTooltipData data, Integer enchantIndex,
|
||||
DurabilityTooltipData durabilityData, Integer durabilityIndex, TooltipComponent baseData) {
|
||||
ClientTooltipComponent enchantComponent = data == null ? null : TooltipComponentCallback.EVENT.invoker().getComponent(data);
|
||||
ClientTooltipComponent durabilityComponent = durabilityData == null ? null : TooltipComponentCallback.EVENT.invoker().getComponent(durabilityData);
|
||||
ClientTooltipComponent baseComponent = baseData == null ? null : ClientTooltipComponent.create(baseData);
|
||||
int extra = 0;
|
||||
if (enchantComponent != null) {
|
||||
extra++;
|
||||
}
|
||||
if (durabilityComponent != null) {
|
||||
extra++;
|
||||
}
|
||||
if (baseComponent != null) {
|
||||
extra++;
|
||||
}
|
||||
List<ClientTooltipComponent> components = new ArrayList<>(lines.size() + extra);
|
||||
|
||||
int insertEnchant = enchantComponent == null || enchantIndex == null ? -1 : Math.max(0, Math.min(enchantIndex, lines.size()));
|
||||
int insertDurability = durabilityComponent == null || durabilityIndex == null ? -1 : Math.max(0, Math.min(durabilityIndex, lines.size()));
|
||||
int insertBase = baseComponent == null ? -1 : (lines.isEmpty() ? 0 : 1);
|
||||
|
||||
for (int i = 0; i <= lines.size(); i++) {
|
||||
if (i == insertEnchant && enchantComponent != null) {
|
||||
components.add(enchantComponent);
|
||||
}
|
||||
if (i == insertBase && baseComponent != null) {
|
||||
components.add(baseComponent);
|
||||
}
|
||||
if (i == insertDurability && durabilityComponent != null) {
|
||||
components.add(durabilityComponent);
|
||||
}
|
||||
if (i < lines.size()) {
|
||||
components.add(ClientTooltipComponent.create(lines.get(i).getVisualOrderText()));
|
||||
}
|
||||
}
|
||||
return components;
|
||||
}
|
||||
|
||||
private static void renderTooltipComponents(GuiGraphics graphics, Font font, List<ClientTooltipComponent> components, int mouseX, int mouseY) {
|
||||
if (components.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
//? if >=1.21.6 {
|
||||
graphics.nextStratum();
|
||||
graphics.renderTooltip(font, components, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE, null);
|
||||
//?} else {
|
||||
/*int width = 0;
|
||||
int height = components.size() == 1 ? -2 : 0;
|
||||
for (ClientTooltipComponent component : components) {
|
||||
width = Math.max(width, component.getWidth(font));
|
||||
height += componentHeight(component, font);
|
||||
}
|
||||
|
||||
Vector2ic pos = DefaultTooltipPositioner.INSTANCE.positionTooltip(graphics.guiWidth(), graphics.guiHeight(), mouseX, mouseY, width, height);
|
||||
int x = pos.x();
|
||||
int y = pos.y();
|
||||
int tooltipWidth = width;
|
||||
int tooltipHeight = height;
|
||||
graphics.pose().pushPose();
|
||||
//? if >=1.21.2 {
|
||||
TooltipRenderUtil.renderTooltipBackground(graphics, x, y, tooltipWidth, tooltipHeight, 400, null);
|
||||
//?} else {
|
||||
graphics.drawManaged(() -> TooltipRenderUtil.renderTooltipBackground(graphics, x, y, tooltipWidth, tooltipHeight, 400));
|
||||
//?}
|
||||
graphics.pose().translate(0, 0, 400);
|
||||
|
||||
//? if >=1.21.2 {
|
||||
graphics.drawSpecial(buffer -> {
|
||||
int yText = y;
|
||||
Matrix4f matrix = graphics.pose().last().pose();
|
||||
MultiBufferSource.BufferSource source = (MultiBufferSource.BufferSource) buffer;
|
||||
for (int i = 0; i < components.size(); i++) {
|
||||
ClientTooltipComponent component = components.get(i);
|
||||
component.renderText(font, x, yText, matrix, source);
|
||||
yText += componentHeight(component, font) + (i == 0 ? 2 : 0);
|
||||
}
|
||||
});
|
||||
//?} else {
|
||||
int yText = y;
|
||||
for (int i = 0; i < components.size(); i++) {
|
||||
ClientTooltipComponent component = components.get(i);
|
||||
Matrix4f matrix = graphics.pose().last().pose();
|
||||
component.renderText(font, x, yText, matrix, graphics.bufferSource());
|
||||
yText += componentHeight(component, font) + (i == 0 ? 2 : 0);
|
||||
}
|
||||
//?}
|
||||
|
||||
int yImage = y;
|
||||
for (int i = 0; i < components.size(); i++) {
|
||||
ClientTooltipComponent component = components.get(i);
|
||||
//? if >=1.21.2 {
|
||||
component.renderImage(font, x, yImage, width, height, graphics);
|
||||
//?} else {
|
||||
component.renderImage(font, x, yImage, graphics);
|
||||
//?}
|
||||
yImage += componentHeight(component, font) + (i == 0 ? 2 : 0);
|
||||
}
|
||||
graphics.pose().popPose();
|
||||
*///?}
|
||||
}
|
||||
|
||||
//? if <1.21.6 {
|
||||
/*private static int componentHeight(ClientTooltipComponent component, Font font) {
|
||||
//? if >=1.21.2 {
|
||||
return component.getHeight(font);
|
||||
//?} else {
|
||||
return component.getHeight();
|
||||
//?}
|
||||
}
|
||||
*///?}
|
||||
|
||||
private static boolean hasAnyDescriptions(List<EnchEntry> entries) {
|
||||
for (EnchEntry entry : entries) {
|
||||
if (TooltipTextUtil.hasDescription(entry.descKey)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static ReorderedLines reorderLines(List<Component> original, TooltipBlock block, List<Component> enchantLines,
|
||||
boolean insertEnchantComponent, Component durabilityLine, boolean insertDurabilityComponent, Component hint) {
|
||||
List<Component> details = new ArrayList<>();
|
||||
Component nameLine = null;
|
||||
if (!original.isEmpty()) {
|
||||
nameLine = original.get(0);
|
||||
}
|
||||
for (int i = 1; i < original.size(); i++) {
|
||||
if (block != null && block.contiguous && i >= block.start && i <= block.end) {
|
||||
continue;
|
||||
}
|
||||
details.add(original.get(i));
|
||||
}
|
||||
|
||||
List<Component> result = new ArrayList<>(original.size() + 6);
|
||||
if (nameLine != null) {
|
||||
result.add(nameLine);
|
||||
}
|
||||
|
||||
int enchantIndex = -1;
|
||||
if (insertEnchantComponent) {
|
||||
enchantIndex = result.size();
|
||||
} else if (enchantLines != null && !enchantLines.isEmpty()) {
|
||||
result.addAll(enchantLines);
|
||||
}
|
||||
|
||||
boolean hasEnchant = insertEnchantComponent || (enchantLines != null && !enchantLines.isEmpty());
|
||||
boolean hasDurability = insertDurabilityComponent || durabilityLine != null;
|
||||
|
||||
if (hasEnchant && (hasDurability || !details.isEmpty() || hint != null)) {
|
||||
result.add(blankLine());
|
||||
}
|
||||
|
||||
int durabilityIndex = -1;
|
||||
if (hasDurability) {
|
||||
if (durabilityLine != null) {
|
||||
result.add(durabilityLine);
|
||||
} else {
|
||||
durabilityIndex = result.size();
|
||||
}
|
||||
}
|
||||
|
||||
if (!details.isEmpty()) {
|
||||
result.addAll(details);
|
||||
}
|
||||
|
||||
if (!details.isEmpty() && hint != null) {
|
||||
result.add(blankLine());
|
||||
}
|
||||
|
||||
if (hint != null) {
|
||||
result.add(hint);
|
||||
}
|
||||
|
||||
return new ReorderedLines(result, enchantIndex, durabilityIndex);
|
||||
}
|
||||
|
||||
private static Component blankLine() {
|
||||
return Component.literal("");
|
||||
}
|
||||
|
||||
private static final class ReorderedLines {
|
||||
private final List<Component> lines;
|
||||
private final Integer enchantIndex;
|
||||
private final Integer durabilityIndex;
|
||||
|
||||
private ReorderedLines(List<Component> lines, Integer enchantIndex, Integer durabilityIndex) {
|
||||
this.lines = lines;
|
||||
this.enchantIndex = enchantIndex;
|
||||
this.durabilityIndex = durabilityIndex;
|
||||
}
|
||||
}
|
||||
|
||||
private static Slot findHoveredSlot(AbstractContainerScreen<?> screen, int mouseX, int mouseY) {
|
||||
AbstractContainerScreenAccessor accessor = (AbstractContainerScreenAccessor) screen;
|
||||
int left = accessor.iconsenhanced$getLeftPos();
|
||||
int top = accessor.iconsenhanced$getTopPos();
|
||||
double relX = mouseX - left;
|
||||
double relY = mouseY - top;
|
||||
for (Slot slot : screen.getMenu().slots) {
|
||||
int sx = left + slot.x;
|
||||
int sy = top + slot.y;
|
||||
if (mouseX >= sx && mouseX < sx + 16 && mouseY >= sy && mouseY < sy + 16) {
|
||||
int sx = slot.x;
|
||||
int sy = slot.y;
|
||||
if (relX >= sx - 1 && relX < sx + 17 && relY >= sy - 1 && relY < sy + 17) {
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
@@ -178,15 +527,6 @@ public final class TooltipAugmenter {
|
||||
this.contiguous = contiguous;
|
||||
}
|
||||
|
||||
private void remove(List<Component> lines) {
|
||||
lines.subList(start, end + 1).clear();
|
||||
}
|
||||
|
||||
private void replace(List<Component> lines, List<Component> replacement) {
|
||||
lines.subList(start, end + 1).clear();
|
||||
lines.addAll(start, replacement);
|
||||
}
|
||||
|
||||
private static TooltipBlock find(List<Component> lines, List<EnchEntry> entries) {
|
||||
Set<String> names = new HashSet<>();
|
||||
for (EnchEntry entry : entries) {
|
||||
|
||||
@@ -12,7 +12,9 @@ import net.minecraft.network.chat.Style;
|
||||
|
||||
public final class TooltipTextUtil {
|
||||
private static final Map<String, List<Component>> CACHE = new HashMap<>();
|
||||
private static final Style DESCRIPTION_STYLE = Style.EMPTY;
|
||||
private static final Style DESCRIPTION_STYLE = Style.EMPTY.withColor(0xAAAAAA);
|
||||
private static final Style HINT_STYLE = Style.EMPTY.withColor(0xAAAAAA);
|
||||
private static final Style SHIFT_STYLE = Style.EMPTY.withColor(0xFCA800);
|
||||
|
||||
private TooltipTextUtil() {
|
||||
}
|
||||
@@ -27,6 +29,26 @@ public final class TooltipTextUtil {
|
||||
return CACHE.computeIfAbsent(key, TooltipTextUtil::splitLines);
|
||||
}
|
||||
|
||||
public static boolean hasDescription(String key) {
|
||||
if (key == null || key.isBlank()) {
|
||||
return false;
|
||||
}
|
||||
return I18n.exists(key);
|
||||
}
|
||||
|
||||
public static Component getShiftHint() {
|
||||
Component shiftKey = Component.translatable("iconsenhanced.tooltip.shift_key").setStyle(SHIFT_STYLE);
|
||||
return Component.translatable("iconsenhanced.tooltip.shift", shiftKey).setStyle(HINT_STYLE);
|
||||
}
|
||||
|
||||
public static Component withNumericLevel(Component baseName, int level) {
|
||||
if (baseName == null) {
|
||||
return Component.literal(Integer.toString(level));
|
||||
}
|
||||
Component number = Component.literal(" " + level).setStyle(baseName.getStyle());
|
||||
return baseName.copy().append(number);
|
||||
}
|
||||
|
||||
private static List<Component> splitLines(String key) {
|
||||
String text = I18n.get(key);
|
||||
if (text == null || text.isEmpty()) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package dev.dekin.iconsenhanced.mixin;
|
||||
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
import net.minecraft.world.inventory.Slot;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@@ -11,4 +12,10 @@ public interface AbstractContainerScreenAccessor {
|
||||
|
||||
@Accessor("topPos")
|
||||
int iconsenhanced$getTopPos();
|
||||
|
||||
@Accessor("hoveredSlot")
|
||||
Slot iconsenhanced$getHoveredSlot();
|
||||
|
||||
@Accessor("hoveredSlot")
|
||||
void iconsenhanced$setHoveredSlot(Slot slot);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package dev.dekin.iconsenhanced.adapters;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
//? if <1.21 {
|
||||
//? if <1.20.5 {
|
||||
/*import java.util.Map;
|
||||
*///?}
|
||||
|
||||
@@ -12,17 +12,20 @@ import dev.dekin.iconsenhanced.common.EnchEntry;
|
||||
import dev.dekin.iconsenhanced.common.IconKeyResolver;
|
||||
import dev.dekin.iconsenhanced.common.IconKeyResolver.Visual;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
//? if <1.21 {
|
||||
//? if <1.20.5 {
|
||||
/*import net.minecraft.core.registries.BuiltInRegistries;
|
||||
*///?}
|
||||
//? if >=1.21 {
|
||||
//? if >=1.20.5 {
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.tags.EnchantmentTags;
|
||||
import net.minecraft.world.item.enchantment.ItemEnchantments;
|
||||
//? if >=1.21 {
|
||||
import net.minecraft.tags.EnchantmentTags;
|
||||
//?}
|
||||
//?} else {
|
||||
/*import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.world.item.EnchantedBookItem;
|
||||
@@ -38,7 +41,7 @@ public final class DefaultEnchantmentAdapter implements EnchantmentAdapter {
|
||||
|
||||
List<EnchEntry> entries = new ArrayList<>();
|
||||
|
||||
//? if >=1.21 {
|
||||
//? if >=1.20.5 {
|
||||
appendEntries(entries, stack.getEnchantments());
|
||||
ItemEnchantments stored = stack.get(DataComponents.STORED_ENCHANTMENTS);
|
||||
if (stored != null && !stored.isEmpty()) {
|
||||
@@ -59,7 +62,7 @@ public final class DefaultEnchantmentAdapter implements EnchantmentAdapter {
|
||||
return entries;
|
||||
}
|
||||
|
||||
//? if >=1.21 {
|
||||
//? if >=1.20.5 {
|
||||
private static void appendEntries(List<EnchEntry> entries, ItemEnchantments enchantments) {
|
||||
if (enchantments == null || enchantments.isEmpty()) {
|
||||
return;
|
||||
@@ -67,14 +70,22 @@ public final class DefaultEnchantmentAdapter implements EnchantmentAdapter {
|
||||
for (Object2IntMap.Entry<Holder<Enchantment>> entry : enchantments.entrySet()) {
|
||||
Holder<Enchantment> holder = entry.getKey();
|
||||
int level = entry.getIntValue();
|
||||
String id = holder.unwrapKey()
|
||||
.map(key -> key.identifier().toString())
|
||||
.orElse("");
|
||||
String id = holderId(holder);
|
||||
//? if >=1.21 {
|
||||
Enchantment enchantment = holder.value();
|
||||
boolean isCurse = holder.is(EnchantmentTags.CURSE);
|
||||
Visual visual = IconKeyResolver.resolve(id, isCurse);
|
||||
Component baseName = colorize(enchantment.description(), visual.color);
|
||||
Component name = colorize(Enchantment.getFullname(holder, level), visual.color);
|
||||
//?} else {
|
||||
/*Enchantment enchantment = holder.value();
|
||||
boolean isCurse = enchantment.isCurse();
|
||||
Visual visual = IconKeyResolver.resolve(id, isCurse);
|
||||
Component baseName = colorize(Component.translatable(enchantment.getDescriptionId()), visual.color);
|
||||
Component name = colorize(enchantment.getFullname(level), visual.color);
|
||||
*///?}
|
||||
String descKey = buildDescKey(id);
|
||||
entries.add(new EnchEntry(id, level, name, isCurse, visual.iconKey, descKey));
|
||||
entries.add(new EnchEntry(id, level, name, baseName, isCurse, visual.iconKey, descKey));
|
||||
}
|
||||
}
|
||||
//?} else {
|
||||
@@ -88,9 +99,10 @@ public final class DefaultEnchantmentAdapter implements EnchantmentAdapter {
|
||||
String id = BuiltInRegistries.ENCHANTMENT.getKey(enchantment).toString();
|
||||
boolean isCurse = enchantment.isCurse();
|
||||
Visual visual = IconKeyResolver.resolve(id, isCurse);
|
||||
Component baseName = colorize(Component.translatable(enchantment.getDescriptionId()), visual.color);
|
||||
Component name = colorize(enchantment.getFullname(level), visual.color);
|
||||
String descKey = buildDescKey(id);
|
||||
entries.add(new EnchEntry(id, level, name, isCurse, visual.iconKey, descKey));
|
||||
entries.add(new EnchEntry(id, level, name, baseName, isCurse, visual.iconKey, descKey));
|
||||
}
|
||||
}
|
||||
*///?}
|
||||
@@ -114,4 +126,23 @@ public final class DefaultEnchantmentAdapter implements EnchantmentAdapter {
|
||||
}
|
||||
return name.copy().withStyle(style -> style.withColor(color));
|
||||
}
|
||||
|
||||
//? if >=1.20.5 {
|
||||
private static String holderId(Holder<Enchantment> holder) {
|
||||
//? if >=1.21.11 {
|
||||
java.util.Optional<?> keyOpt = holder.unwrapKey();
|
||||
if (keyOpt.isPresent()) {
|
||||
Object raw = keyOpt.get();
|
||||
if (raw instanceof ResourceKey<?> key) {
|
||||
return key.identifier().toString();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
//?} else {
|
||||
/*return holder.unwrapKey()
|
||||
.map(key -> key.location().toString())
|
||||
.orElse("");
|
||||
*///?}
|
||||
}
|
||||
//?}
|
||||
}
|
||||
|
||||
@@ -1,115 +1,34 @@
|
||||
package dev.dekin.iconsenhanced.common;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import dev.dekin.iconsenhanced.IconsEnhanced;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Rarity;
|
||||
|
||||
public final class BorderColorLogic {
|
||||
private final Map<String, Integer> rarityColors = new HashMap<>();
|
||||
private final Map<String, Integer> customRuleColors = new HashMap<>();
|
||||
private boolean enchantedOverride;
|
||||
private int enchantedColor;
|
||||
private boolean useCustomRules;
|
||||
private String mode;
|
||||
private int alpha;
|
||||
|
||||
public void applyConfig(IconsEnhancedConfig config) {
|
||||
IconsEnhancedConfig.Borders borders = config.borders;
|
||||
rarityColors.clear();
|
||||
for (Map.Entry<String, String> entry : borders.rarityColors.entrySet()) {
|
||||
rarityColors.put(entry.getKey(), parseColor(entry.getValue(), 0xFFAAAAAA));
|
||||
}
|
||||
|
||||
customRuleColors.clear();
|
||||
for (IconsEnhancedConfig.CustomBorderRule rule : borders.customRules) {
|
||||
String id = normalizeId(rule.itemId);
|
||||
if (id == null) {
|
||||
IconsEnhanced.LOGGER.warn("Invalid border rule item id: {}", rule.itemId);
|
||||
continue;
|
||||
}
|
||||
customRuleColors.put(id, parseColor(rule.color, 0xFFFFFFFF));
|
||||
}
|
||||
|
||||
enchantedOverride = borders.enchantedOverride.enabled;
|
||||
enchantedColor = parseColor(borders.enchantedOverride.color, 0xFFFFD700);
|
||||
useCustomRules = borders.useCustomRules;
|
||||
mode = borders.mode == null ? "RARITY" : borders.mode.trim().toUpperCase();
|
||||
alpha = clamp(borders.alpha, 0, 255);
|
||||
}
|
||||
|
||||
public int resolve(ItemStack stack) {
|
||||
String itemId = BuiltInRegistries.ITEM.getKey(stack.getItem()).toString();
|
||||
if (useCustomRules) {
|
||||
Integer ruleColor = customRuleColors.get(itemId);
|
||||
if (ruleColor != null) {
|
||||
return withAlpha(ruleColor, alpha);
|
||||
}
|
||||
Rarity rarity = stack.getRarity();
|
||||
if (rarity == Rarity.COMMON) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (enchantedOverride && stack.isEnchanted()) {
|
||||
return withAlpha(enchantedColor, alpha);
|
||||
ChatFormatting formatting = rarityColor(rarity);
|
||||
if (formatting == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ("CUSTOM".equals(mode)) {
|
||||
Integer ruleColor = customRuleColors.get(itemId);
|
||||
if (ruleColor != null) {
|
||||
return withAlpha(ruleColor, alpha);
|
||||
}
|
||||
Integer rgb = formatting.getColor();
|
||||
if (rgb == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rarityColor = rarityColors.getOrDefault(rarityKey(stack.getRarity()), 0xFFAAAAAA);
|
||||
return withAlpha(rarityColor, alpha);
|
||||
return 0xFF000000 | rgb;
|
||||
}
|
||||
|
||||
private static String normalizeId(String raw) {
|
||||
if (raw == null) {
|
||||
return null;
|
||||
}
|
||||
String cleaned = raw.trim().toLowerCase(Locale.ROOT);
|
||||
if (cleaned.isEmpty() || !cleaned.contains(":")) {
|
||||
return null;
|
||||
}
|
||||
return cleaned;
|
||||
}
|
||||
|
||||
private static String rarityKey(Rarity rarity) {
|
||||
if (rarity == Rarity.UNCOMMON) {
|
||||
return "uncommon";
|
||||
}
|
||||
if (rarity == Rarity.RARE) {
|
||||
return "rare";
|
||||
}
|
||||
if (rarity == Rarity.EPIC) {
|
||||
return "epic";
|
||||
}
|
||||
return "common";
|
||||
}
|
||||
|
||||
private static int parseColor(String value, int fallback) {
|
||||
if (value == null) {
|
||||
return fallback;
|
||||
}
|
||||
try {
|
||||
String cleaned = value.trim();
|
||||
if (cleaned.isEmpty()) {
|
||||
return fallback;
|
||||
}
|
||||
return (int) Long.decode(cleaned).longValue();
|
||||
} catch (NumberFormatException ex) {
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
|
||||
private static int withAlpha(int color, int alpha) {
|
||||
return (color & 0x00FFFFFF) | ((alpha & 0xFF) << 24);
|
||||
}
|
||||
|
||||
private static int clamp(int value, int min, int max) {
|
||||
return Math.min(max, Math.max(min, value));
|
||||
private static ChatFormatting rarityColor(Rarity rarity) {
|
||||
//? if >=1.20.5 {
|
||||
return rarity.color();
|
||||
//?} else {
|
||||
/*return rarity.color;*/
|
||||
//?}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,18 +9,22 @@ public final class EnchEntry {
|
||||
public final int level;
|
||||
public final Component displayName;
|
||||
public final String displayNameString;
|
||||
public final Component baseName;
|
||||
public final String baseNameString;
|
||||
public final boolean isCurse;
|
||||
public final String iconKey;
|
||||
public final String descKey;
|
||||
|
||||
public EnchEntry(String id, int level, Component displayName, boolean isCurse, String iconKey, String descKey) {
|
||||
public EnchEntry(String id, int level, Component displayName, Component baseName, boolean isCurse, String iconKey, String descKey) {
|
||||
this.id = id == null ? "" : id;
|
||||
IdParts parts = IdParts.parse(this.id);
|
||||
this.namespace = parts.namespace;
|
||||
this.path = parts.path;
|
||||
this.level = level;
|
||||
this.displayName = displayName;
|
||||
this.displayNameString = displayName.getString();
|
||||
this.displayNameString = displayName == null ? "" : displayName.getString();
|
||||
this.baseName = baseName == null ? displayName : baseName;
|
||||
this.baseNameString = this.baseName == null ? "" : this.baseName.getString();
|
||||
this.isCurse = isCurse;
|
||||
this.iconKey = iconKey;
|
||||
this.descKey = descKey;
|
||||
|
||||
@@ -17,9 +17,9 @@ public final class EnchantSortLogic {
|
||||
|
||||
private static Comparator<EnchEntry> buildComparator(IconsEnhancedConfig.Tooltips tooltips) {
|
||||
Comparator<EnchEntry> base = switch (SortMode.fromString(tooltips.sortMode)) {
|
||||
case BY_NAME -> Comparator.comparing(entry -> entry.displayNameString.toLowerCase(Locale.ROOT));
|
||||
case BY_NAME -> Comparator.comparing(entry -> entry.baseNameString.toLowerCase(Locale.ROOT));
|
||||
case BY_LEVEL_DESC -> Comparator.<EnchEntry>comparingInt(entry -> entry.level).reversed()
|
||||
.thenComparing(entry -> entry.displayNameString.toLowerCase(Locale.ROOT));
|
||||
.thenComparing(entry -> entry.baseNameString.toLowerCase(Locale.ROOT));
|
||||
case CUSTOM_PRIORITY_LIST -> customPriorityComparator(tooltips.customPriorityList);
|
||||
case BY_VANILLA_LIKE -> Comparator
|
||||
.comparing((EnchEntry entry) -> entry.namespace)
|
||||
@@ -39,7 +39,7 @@ public final class EnchantSortLogic {
|
||||
}
|
||||
return Comparator
|
||||
.comparingInt((EnchEntry entry) -> priority.getOrDefault(entry.id, Integer.MAX_VALUE))
|
||||
.thenComparing(entry -> entry.displayNameString.toLowerCase(Locale.ROOT));
|
||||
.thenComparing(entry -> entry.baseNameString.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
public enum SortMode {
|
||||
|
||||
@@ -4,16 +4,18 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import dev.dekin.iconsenhanced.IconsEnhanced;
|
||||
//? if >=1.21 {
|
||||
//? if >=1.21.11 {
|
||||
import net.minecraft.resources.Identifier;
|
||||
//?} else {
|
||||
/*import net.minecraft.resources.ResourceLocation;
|
||||
*///?}
|
||||
|
||||
public final class IconAtlas {
|
||||
//? if >=1.21 {
|
||||
//? if >=1.21.11 {
|
||||
public static final Identifier ATLAS = Identifier.fromNamespaceAndPath(IconsEnhanced.MOD_ID, "textures/gui/enchant_icons.png");
|
||||
//?} else {
|
||||
//?} else if >=1.21 {
|
||||
/*public static final ResourceLocation ATLAS = ResourceLocation.fromNamespaceAndPath(IconsEnhanced.MOD_ID, "textures/gui/enchant_icons.png");
|
||||
*///?} else {
|
||||
/*public static final ResourceLocation ATLAS = new ResourceLocation(IconsEnhanced.MOD_ID, "textures/gui/enchant_icons.png");
|
||||
*///?}
|
||||
public static final int ICON_SOURCE_SIZE = 16;
|
||||
@@ -36,6 +38,7 @@ public final class IconAtlas {
|
||||
register("default", 10);
|
||||
register("sword", 11);
|
||||
register("trident", 12);
|
||||
register("anvil", 13);
|
||||
}
|
||||
|
||||
private IconAtlas() {
|
||||
|
||||
@@ -97,7 +97,7 @@ public final class IconsEnhancedConfig {
|
||||
public boolean cursesLast = true;
|
||||
public boolean showDescriptions = true;
|
||||
public boolean showIcons = true;
|
||||
public int iconSize = 10;
|
||||
public int iconSize = 8;
|
||||
public boolean showLevelBadge = true;
|
||||
public List<String> customPriorityList = defaultCustomPriorityList();
|
||||
|
||||
@@ -107,6 +107,10 @@ public final class IconsEnhancedConfig {
|
||||
sortMode = "CUSTOM_PRIORITY_LIST";
|
||||
changed = true;
|
||||
}
|
||||
if (iconSize == 9 || iconSize == 7 || iconSize == 6 || iconSize == 5 || iconSize == 4 || iconSize == 3 || iconSize == 2 || iconSize == 1) {
|
||||
iconSize = 8;
|
||||
changed = true;
|
||||
}
|
||||
if (customPriorityList == null || customPriorityList.isEmpty()) {
|
||||
customPriorityList = defaultCustomPriorityList();
|
||||
changed = true;
|
||||
|
||||
46
src/main/resources/assets/iconsenhanced/lang/de_de.json
Normal file
46
src/main/resources/assets/iconsenhanced/lang/de_de.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"iconsenhanced.tooltip.shift": "Halte %s für Details.",
|
||||
"iconsenhanced.tooltip.shift_key": "Shift",
|
||||
"iconsenhanced.desc.minecraft.aqua_affinity": "Erhöht die Abbaugeschwindigkeit unter Wasser.",
|
||||
"iconsenhanced.desc.minecraft.bane_of_arthropods": "Erhöht den Schaden gegen Arthropoden und verlangsamt sie.",
|
||||
"iconsenhanced.desc.minecraft.binding_curse": "Verflucht: kann nicht entfernt werden.",
|
||||
"iconsenhanced.desc.minecraft.blast_protection": "Verringert Explosionsschaden und Rückstoß.",
|
||||
"iconsenhanced.desc.minecraft.breach": "Angriffe mit dem Streitkolben ignorieren einen Teil der Rüstung.",
|
||||
"iconsenhanced.desc.minecraft.channeling": "Beschwört Blitz während eines Gewitters.",
|
||||
"iconsenhanced.desc.minecraft.density": "Erhöht den Aufprallschaden des Streitkolbens.",
|
||||
"iconsenhanced.desc.minecraft.depth_strider": "Erhöht die Bewegungsgeschwindigkeit unter Wasser.",
|
||||
"iconsenhanced.desc.minecraft.efficiency": "Erhöht die Abbaugeschwindigkeit.",
|
||||
"iconsenhanced.desc.minecraft.feather_falling": "Verringert Fallschaden.",
|
||||
"iconsenhanced.desc.minecraft.fire_aspect": "Setzt Ziele in Brand.",
|
||||
"iconsenhanced.desc.minecraft.fire_protection": "Verringert Schaden durch Feuer und Lava.",
|
||||
"iconsenhanced.desc.minecraft.flame": "Pfeile setzen Ziele in Brand.",
|
||||
"iconsenhanced.desc.minecraft.fortune": "Erhöht die Menge an Blockdrops.",
|
||||
"iconsenhanced.desc.minecraft.frost_walker": "Gefriert Wasser zu Eis.",
|
||||
"iconsenhanced.desc.minecraft.impaling": "Erhöht Schaden gegen Wasserwesen.",
|
||||
"iconsenhanced.desc.minecraft.infinity": "Pfeile werden nicht verbraucht.",
|
||||
"iconsenhanced.desc.minecraft.knockback": "Erhöht Rückstoß.",
|
||||
"iconsenhanced.desc.minecraft.looting": "Erhöht die Beute von Kreaturen.",
|
||||
"iconsenhanced.desc.minecraft.loyalty": "Der Dreizack kehrt nach dem Wurf zurück.",
|
||||
"iconsenhanced.desc.minecraft.luck_of_the_sea": "Erhöht die Chance auf Schätze beim Angeln.",
|
||||
"iconsenhanced.desc.minecraft.lure": "Erhöht die Bissrate.",
|
||||
"iconsenhanced.desc.minecraft.mending": "Repariert Gegenstände mit Erfahrung.",
|
||||
"iconsenhanced.desc.minecraft.multishot": "Schießt 3 Pfeile gleichzeitig.",
|
||||
"iconsenhanced.desc.minecraft.piercing": "Pfeile durchbohren Ziele.",
|
||||
"iconsenhanced.desc.minecraft.power": "Erhöht den Schaden des Bogens.",
|
||||
"iconsenhanced.desc.minecraft.projectile_protection": "Verringert Projektilschaden.",
|
||||
"iconsenhanced.desc.minecraft.protection": "Verringert den meisten Schaden.",
|
||||
"iconsenhanced.desc.minecraft.punch": "Erhöht Rückstoß der Pfeile.",
|
||||
"iconsenhanced.desc.minecraft.quick_charge": "Verringert die Ladezeit der Armbrust.",
|
||||
"iconsenhanced.desc.minecraft.respiration": "Verlängert die Zeit unter Wasser zu atmen.",
|
||||
"iconsenhanced.desc.minecraft.riptide": "Schleudert dich im Wasser oder Regen vorwärts.",
|
||||
"iconsenhanced.desc.minecraft.sharpness": "Erhöht Nahkampfschaden.",
|
||||
"iconsenhanced.desc.minecraft.silk_touch": "Abgebaute Blöcke fallen wie sie sind.",
|
||||
"iconsenhanced.desc.minecraft.smite": "Erhöht Schaden gegen Untote.",
|
||||
"iconsenhanced.desc.minecraft.soul_speed": "Erhöht die Geschwindigkeit auf Seelensand und Seelenerde.",
|
||||
"iconsenhanced.desc.minecraft.sweeping_edge": "Erhöht den Schaden des Schwungangriffs.",
|
||||
"iconsenhanced.desc.minecraft.swift_sneak": "Erhöht die Geschwindigkeit beim Schleichen.",
|
||||
"iconsenhanced.desc.minecraft.thorns": "Reflektiert Schaden auf Angreifer.",
|
||||
"iconsenhanced.desc.minecraft.unbreaking": "Gegenstände verlieren Haltbarkeit langsamer.",
|
||||
"iconsenhanced.desc.minecraft.vanishing_curse": "Verflucht: verschwindet beim Tod.",
|
||||
"iconsenhanced.desc.minecraft.wind_burst": "Erzeugt eine Windböe nach einem Aufprall."
|
||||
}
|
||||
@@ -1,11 +1,46 @@
|
||||
{
|
||||
"iconsenhanced.desc.minecraft.sharpness": "Increases melee damage.",
|
||||
"iconsenhanced.desc.minecraft.protection": "Reduces incoming damage.",
|
||||
"iconsenhanced.desc.minecraft.unbreaking": "Items lose durability slower.",
|
||||
"iconsenhanced.desc.minecraft.mending": "Repairs items with experience.",
|
||||
"iconsenhanced.tooltip.shift": "Hold %s for details.",
|
||||
"iconsenhanced.tooltip.shift_key": "Shift",
|
||||
"iconsenhanced.desc.minecraft.aqua_affinity": "Increases underwater mining speed.",
|
||||
"iconsenhanced.desc.minecraft.bane_of_arthropods": "Increases damage to arthropods and slows them.",
|
||||
"iconsenhanced.desc.minecraft.binding_curse": "Cursed: cannot be removed.",
|
||||
"iconsenhanced.desc.minecraft.blast_protection": "Reduces explosion damage and knockback.",
|
||||
"iconsenhanced.desc.minecraft.breach": "Mace attacks ignore some armor.",
|
||||
"iconsenhanced.desc.minecraft.channeling": "Summons lightning during thunderstorms.",
|
||||
"iconsenhanced.desc.minecraft.density": "Increases mace smash damage.",
|
||||
"iconsenhanced.desc.minecraft.depth_strider": "Increases underwater movement speed.",
|
||||
"iconsenhanced.desc.minecraft.efficiency": "Increases mining speed.",
|
||||
"iconsenhanced.desc.minecraft.feather_falling": "Reduces fall damage.",
|
||||
"iconsenhanced.desc.minecraft.fire_aspect": "Sets targets on fire.",
|
||||
"iconsenhanced.desc.minecraft.fire_protection": "Reduces fire and lava damage.",
|
||||
"iconsenhanced.desc.minecraft.flame": "Arrows ignite targets.",
|
||||
"iconsenhanced.desc.minecraft.fortune": "Increases block drop quantity.",
|
||||
"iconsenhanced.desc.minecraft.frost_walker": "Freezes water into ice.",
|
||||
"iconsenhanced.desc.minecraft.impaling": "Increases damage to aquatic mobs.",
|
||||
"iconsenhanced.desc.minecraft.infinity": "Arrows can be shot without consuming them.",
|
||||
"iconsenhanced.desc.minecraft.knockback": "Increases knockback dealt.",
|
||||
"iconsenhanced.desc.minecraft.looting": "Increases mob loot drops.",
|
||||
"iconsenhanced.desc.minecraft.loyalty": "Trident returns after throwing.",
|
||||
"iconsenhanced.desc.minecraft.luck_of_the_sea": "Increases chance of treasure fishing.",
|
||||
"iconsenhanced.desc.minecraft.lure": "Increases bite rate when fishing.",
|
||||
"iconsenhanced.desc.minecraft.mending": "Repairs items with experience.",
|
||||
"iconsenhanced.desc.minecraft.multishot": "Shoots 3 arrows at once.",
|
||||
"iconsenhanced.desc.minecraft.piercing": "Arrows pierce through targets.",
|
||||
"iconsenhanced.desc.minecraft.power": "Increases bow damage.",
|
||||
"iconsenhanced.desc.minecraft.projectile_protection": "Reduces projectile damage.",
|
||||
"iconsenhanced.desc.minecraft.protection": "Reduces most damage.",
|
||||
"iconsenhanced.desc.minecraft.punch": "Increases arrow knockback.",
|
||||
"iconsenhanced.desc.minecraft.quick_charge": "Reduces crossbow charge time.",
|
||||
"iconsenhanced.desc.minecraft.respiration": "Extends underwater breathing time.",
|
||||
"iconsenhanced.desc.minecraft.riptide": "Launches you in water or rain.",
|
||||
"iconsenhanced.desc.minecraft.sharpness": "Increases melee damage.",
|
||||
"iconsenhanced.desc.minecraft.silk_touch": "Mined blocks drop themselves.",
|
||||
"iconsenhanced.desc.minecraft.smite": "Increases damage to undead.",
|
||||
"iconsenhanced.desc.minecraft.soul_speed": "Increases speed on soul sand and soul soil.",
|
||||
"iconsenhanced.desc.minecraft.sweeping_edge": "Increases sweeping attack damage.",
|
||||
"iconsenhanced.desc.minecraft.swift_sneak": "Increases sneaking speed.",
|
||||
"iconsenhanced.desc.minecraft.thorns": "Reflects damage to attackers.",
|
||||
"iconsenhanced.desc.minecraft.binding_curse": "Cursed: stays equipped.",
|
||||
"iconsenhanced.desc.minecraft.vanishing_curse": "Cursed: disappears on death."
|
||||
"iconsenhanced.desc.minecraft.unbreaking": "Items lose durability slower.",
|
||||
"iconsenhanced.desc.minecraft.vanishing_curse": "Cursed: disappears on death.",
|
||||
"iconsenhanced.desc.minecraft.wind_burst": "Creates a wind burst after smashing."
|
||||
}
|
||||
|
||||
@@ -1,11 +1,46 @@
|
||||
{
|
||||
"iconsenhanced.desc.minecraft.sharpness": "Aumenta el dano cuerpo a cuerpo.",
|
||||
"iconsenhanced.desc.minecraft.protection": "Reduce el dano recibido.",
|
||||
"iconsenhanced.desc.minecraft.unbreaking": "Los objetos pierden durabilidad mas lento.",
|
||||
"iconsenhanced.desc.minecraft.mending": "Repara objetos con experiencia.",
|
||||
"iconsenhanced.tooltip.shift": "Manten %s para ver detalles.",
|
||||
"iconsenhanced.tooltip.shift_key": "Shift",
|
||||
"iconsenhanced.desc.minecraft.aqua_affinity": "Aumenta la velocidad de minado bajo el agua.",
|
||||
"iconsenhanced.desc.minecraft.bane_of_arthropods": "Aumenta el dano a artropodos y los ralentiza.",
|
||||
"iconsenhanced.desc.minecraft.binding_curse": "Maldito: no se puede quitar.",
|
||||
"iconsenhanced.desc.minecraft.blast_protection": "Reduce el dano y empuje de explosiones.",
|
||||
"iconsenhanced.desc.minecraft.breach": "Los golpes del mazo ignoran armadura.",
|
||||
"iconsenhanced.desc.minecraft.channeling": "Invoca rayos en tormenta.",
|
||||
"iconsenhanced.desc.minecraft.density": "Aumenta el dano del golpe aplastante.",
|
||||
"iconsenhanced.desc.minecraft.depth_strider": "Aumenta la velocidad bajo el agua.",
|
||||
"iconsenhanced.desc.minecraft.efficiency": "Aumenta la velocidad de mineria.",
|
||||
"iconsenhanced.desc.minecraft.feather_falling": "Reduce el dano de caida.",
|
||||
"iconsenhanced.desc.minecraft.fire_aspect": "Prende fuego a los objetivos.",
|
||||
"iconsenhanced.desc.minecraft.fire_protection": "Reduce el dano de fuego y lava.",
|
||||
"iconsenhanced.desc.minecraft.flame": "Las flechas prenden fuego.",
|
||||
"iconsenhanced.desc.minecraft.fortune": "Aumenta la cantidad de drops.",
|
||||
"iconsenhanced.desc.minecraft.frost_walker": "Congela el agua en hielo.",
|
||||
"iconsenhanced.desc.minecraft.impaling": "Aumenta el dano a mobs acuaticos.",
|
||||
"iconsenhanced.desc.minecraft.infinity": "Dispara flechas sin consumir.",
|
||||
"iconsenhanced.desc.minecraft.knockback": "Aumenta el empuje.",
|
||||
"iconsenhanced.desc.minecraft.looting": "Aumenta el botin de mobs.",
|
||||
"iconsenhanced.desc.minecraft.loyalty": "El tridente vuelve al lanzarlo.",
|
||||
"iconsenhanced.desc.minecraft.luck_of_the_sea": "Aumenta la suerte al pescar.",
|
||||
"iconsenhanced.desc.minecraft.lure": "Aumenta la velocidad de picada.",
|
||||
"iconsenhanced.desc.minecraft.mending": "Repara objetos con experiencia.",
|
||||
"iconsenhanced.desc.minecraft.multishot": "Dispara 3 flechas a la vez.",
|
||||
"iconsenhanced.desc.minecraft.piercing": "Las flechas atraviesan objetivos.",
|
||||
"iconsenhanced.desc.minecraft.power": "Aumenta el dano del arco.",
|
||||
"iconsenhanced.desc.minecraft.projectile_protection": "Reduce el dano de proyectiles.",
|
||||
"iconsenhanced.desc.minecraft.protection": "Reduce la mayoria del dano.",
|
||||
"iconsenhanced.desc.minecraft.punch": "Aumenta el empuje de las flechas.",
|
||||
"iconsenhanced.desc.minecraft.quick_charge": "Reduce el tiempo de carga.",
|
||||
"iconsenhanced.desc.minecraft.respiration": "Aumenta el tiempo de respiracion bajo el agua.",
|
||||
"iconsenhanced.desc.minecraft.riptide": "Te lanza en agua o lluvia.",
|
||||
"iconsenhanced.desc.minecraft.sharpness": "Aumenta el dano cuerpo a cuerpo.",
|
||||
"iconsenhanced.desc.minecraft.silk_touch": "Los bloques se sueltan tal cual.",
|
||||
"iconsenhanced.desc.minecraft.smite": "Aumenta el dano a no muertos.",
|
||||
"iconsenhanced.desc.minecraft.soul_speed": "Aumenta la velocidad en arena de almas y suelo de almas.",
|
||||
"iconsenhanced.desc.minecraft.sweeping_edge": "Aumenta el dano del barrido.",
|
||||
"iconsenhanced.desc.minecraft.swift_sneak": "Aumenta la velocidad al agacharse.",
|
||||
"iconsenhanced.desc.minecraft.thorns": "Refleja dano a atacantes.",
|
||||
"iconsenhanced.desc.minecraft.binding_curse": "Maldito: queda equipado.",
|
||||
"iconsenhanced.desc.minecraft.vanishing_curse": "Maldito: desaparece al morir."
|
||||
"iconsenhanced.desc.minecraft.unbreaking": "Los objetos pierden durabilidad mas lento.",
|
||||
"iconsenhanced.desc.minecraft.vanishing_curse": "Maldito: desaparece al morir.",
|
||||
"iconsenhanced.desc.minecraft.wind_burst": "Crea una rafaga tras aplastar."
|
||||
}
|
||||
|
||||
46
src/main/resources/assets/iconsenhanced/lang/fr_fr.json
Normal file
46
src/main/resources/assets/iconsenhanced/lang/fr_fr.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"iconsenhanced.tooltip.shift": "Maintenez %s pour les détails.",
|
||||
"iconsenhanced.tooltip.shift_key": "Maj",
|
||||
"iconsenhanced.desc.minecraft.aqua_affinity": "Augmente la vitesse de minage sous l'eau.",
|
||||
"iconsenhanced.desc.minecraft.bane_of_arthropods": "Augmente les dégâts aux arthropodes et les ralentit.",
|
||||
"iconsenhanced.desc.minecraft.binding_curse": "Maudit : ne peut pas être retiré.",
|
||||
"iconsenhanced.desc.minecraft.blast_protection": "Réduit les dégâts et le recul des explosions.",
|
||||
"iconsenhanced.desc.minecraft.breach": "Les attaques de masse ignorent une partie de l'armure.",
|
||||
"iconsenhanced.desc.minecraft.channeling": "Invoque la foudre pendant les orages.",
|
||||
"iconsenhanced.desc.minecraft.density": "Augmente les dégâts de l'impact de la masse.",
|
||||
"iconsenhanced.desc.minecraft.depth_strider": "Augmente la vitesse de déplacement sous l'eau.",
|
||||
"iconsenhanced.desc.minecraft.efficiency": "Augmente la vitesse de minage.",
|
||||
"iconsenhanced.desc.minecraft.feather_falling": "Réduit les dégâts de chute.",
|
||||
"iconsenhanced.desc.minecraft.fire_aspect": "Enflamme les cibles.",
|
||||
"iconsenhanced.desc.minecraft.fire_protection": "Réduit les dégâts de feu et de lave.",
|
||||
"iconsenhanced.desc.minecraft.flame": "Les flèches enflamment les cibles.",
|
||||
"iconsenhanced.desc.minecraft.fortune": "Augmente la quantité de butin des blocs.",
|
||||
"iconsenhanced.desc.minecraft.frost_walker": "Gèle l'eau en glace.",
|
||||
"iconsenhanced.desc.minecraft.impaling": "Augmente les dégâts contre les créatures aquatiques.",
|
||||
"iconsenhanced.desc.minecraft.infinity": "Tire des flèches sans en consommer.",
|
||||
"iconsenhanced.desc.minecraft.knockback": "Augmente le recul infligé.",
|
||||
"iconsenhanced.desc.minecraft.looting": "Augmente le butin des créatures.",
|
||||
"iconsenhanced.desc.minecraft.loyalty": "Le trident revient après le lancer.",
|
||||
"iconsenhanced.desc.minecraft.luck_of_the_sea": "Augmente les chances de trésors à la pêche.",
|
||||
"iconsenhanced.desc.minecraft.lure": "Augmente la vitesse de morsure.",
|
||||
"iconsenhanced.desc.minecraft.mending": "Répare les objets avec l'expérience.",
|
||||
"iconsenhanced.desc.minecraft.multishot": "Tire 3 flèches à la fois.",
|
||||
"iconsenhanced.desc.minecraft.piercing": "Les flèches percent les cibles.",
|
||||
"iconsenhanced.desc.minecraft.power": "Augmente les dégâts de l'arc.",
|
||||
"iconsenhanced.desc.minecraft.projectile_protection": "Réduit les dégâts de projectiles.",
|
||||
"iconsenhanced.desc.minecraft.protection": "Réduit la plupart des dégâts.",
|
||||
"iconsenhanced.desc.minecraft.punch": "Augmente le recul des flèches.",
|
||||
"iconsenhanced.desc.minecraft.quick_charge": "Réduit le temps de rechargement de l'arbalète.",
|
||||
"iconsenhanced.desc.minecraft.respiration": "Prolonge la respiration sous l'eau.",
|
||||
"iconsenhanced.desc.minecraft.riptide": "Vous propulse dans l'eau ou la pluie.",
|
||||
"iconsenhanced.desc.minecraft.sharpness": "Augmente les dégâts au corps à corps.",
|
||||
"iconsenhanced.desc.minecraft.silk_touch": "Les blocs minés se lâchent tels quels.",
|
||||
"iconsenhanced.desc.minecraft.smite": "Augmente les dégâts contre les morts-vivants.",
|
||||
"iconsenhanced.desc.minecraft.soul_speed": "Augmente la vitesse sur le sable des âmes et la terre des âmes.",
|
||||
"iconsenhanced.desc.minecraft.sweeping_edge": "Augmente les dégâts de balayage.",
|
||||
"iconsenhanced.desc.minecraft.swift_sneak": "Augmente la vitesse en se faufilant.",
|
||||
"iconsenhanced.desc.minecraft.thorns": "Renvoie des dégâts aux attaquants.",
|
||||
"iconsenhanced.desc.minecraft.unbreaking": "Les objets perdent leur durabilité plus lentement.",
|
||||
"iconsenhanced.desc.minecraft.vanishing_curse": "Maudit : disparaît à la mort.",
|
||||
"iconsenhanced.desc.minecraft.wind_burst": "Crée une rafale après un impact."
|
||||
}
|
||||
46
src/main/resources/assets/iconsenhanced/lang/it_it.json
Normal file
46
src/main/resources/assets/iconsenhanced/lang/it_it.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"iconsenhanced.tooltip.shift": "Tieni premuto %s per i dettagli.",
|
||||
"iconsenhanced.tooltip.shift_key": "Shift",
|
||||
"iconsenhanced.desc.minecraft.aqua_affinity": "Aumenta la velocità di minare sott'acqua.",
|
||||
"iconsenhanced.desc.minecraft.bane_of_arthropods": "Aumenta i danni agli artropodi e li rallenta.",
|
||||
"iconsenhanced.desc.minecraft.binding_curse": "Maledetto: non può essere rimosso.",
|
||||
"iconsenhanced.desc.minecraft.blast_protection": "Riduce i danni e il contraccolpo delle esplosioni.",
|
||||
"iconsenhanced.desc.minecraft.breach": "Gli attacchi della mazza ignorano parte dell'armatura.",
|
||||
"iconsenhanced.desc.minecraft.channeling": "Evoca fulmini durante i temporali.",
|
||||
"iconsenhanced.desc.minecraft.density": "Aumenta i danni dell'impatto della mazza.",
|
||||
"iconsenhanced.desc.minecraft.depth_strider": "Aumenta la velocità di movimento sott'acqua.",
|
||||
"iconsenhanced.desc.minecraft.efficiency": "Aumenta la velocità di minare.",
|
||||
"iconsenhanced.desc.minecraft.feather_falling": "Riduce i danni da caduta.",
|
||||
"iconsenhanced.desc.minecraft.fire_aspect": "Incendia i bersagli.",
|
||||
"iconsenhanced.desc.minecraft.fire_protection": "Riduce i danni da fuoco e lava.",
|
||||
"iconsenhanced.desc.minecraft.flame": "Le frecce incendiano i bersagli.",
|
||||
"iconsenhanced.desc.minecraft.fortune": "Aumenta la quantità di drop dei blocchi.",
|
||||
"iconsenhanced.desc.minecraft.frost_walker": "Gela l'acqua in ghiaccio.",
|
||||
"iconsenhanced.desc.minecraft.impaling": "Aumenta i danni contro le creature acquatiche.",
|
||||
"iconsenhanced.desc.minecraft.infinity": "Spara frecce senza consumarle.",
|
||||
"iconsenhanced.desc.minecraft.knockback": "Aumenta il contraccolpo.",
|
||||
"iconsenhanced.desc.minecraft.looting": "Aumenta il bottino delle creature.",
|
||||
"iconsenhanced.desc.minecraft.loyalty": "Il tridente ritorna dopo il lancio.",
|
||||
"iconsenhanced.desc.minecraft.luck_of_the_sea": "Aumenta le probabilità di tesori pescando.",
|
||||
"iconsenhanced.desc.minecraft.lure": "Aumenta la velocità di abboccata.",
|
||||
"iconsenhanced.desc.minecraft.mending": "Ripara gli oggetti con l'esperienza.",
|
||||
"iconsenhanced.desc.minecraft.multishot": "Spara 3 frecce in una volta.",
|
||||
"iconsenhanced.desc.minecraft.piercing": "Le frecce perforano i bersagli.",
|
||||
"iconsenhanced.desc.minecraft.power": "Aumenta i danni dell'arco.",
|
||||
"iconsenhanced.desc.minecraft.projectile_protection": "Riduce i danni da proiettili.",
|
||||
"iconsenhanced.desc.minecraft.protection": "Riduce la maggior parte dei danni.",
|
||||
"iconsenhanced.desc.minecraft.punch": "Aumenta il contraccolpo delle frecce.",
|
||||
"iconsenhanced.desc.minecraft.quick_charge": "Riduce il tempo di ricarica della balestra.",
|
||||
"iconsenhanced.desc.minecraft.respiration": "Aumenta il tempo di respirazione sott'acqua.",
|
||||
"iconsenhanced.desc.minecraft.riptide": "Ti lancia in acqua o sotto la pioggia.",
|
||||
"iconsenhanced.desc.minecraft.sharpness": "Aumenta i danni in mischia.",
|
||||
"iconsenhanced.desc.minecraft.silk_touch": "I blocchi minati cadono intatti.",
|
||||
"iconsenhanced.desc.minecraft.smite": "Aumenta i danni contro i non morti.",
|
||||
"iconsenhanced.desc.minecraft.soul_speed": "Aumenta la velocità su sabbia delle anime e terra delle anime.",
|
||||
"iconsenhanced.desc.minecraft.sweeping_edge": "Aumenta i danni dell'attacco in spazzata.",
|
||||
"iconsenhanced.desc.minecraft.swift_sneak": "Aumenta la velocità mentre ti accovacci.",
|
||||
"iconsenhanced.desc.minecraft.thorns": "Riflette danni agli attaccanti.",
|
||||
"iconsenhanced.desc.minecraft.unbreaking": "Gli oggetti perdono durabilità più lentamente.",
|
||||
"iconsenhanced.desc.minecraft.vanishing_curse": "Maledetto: scompare alla morte.",
|
||||
"iconsenhanced.desc.minecraft.wind_burst": "Crea una raffica dopo l'impatto."
|
||||
}
|
||||
46
src/main/resources/assets/iconsenhanced/lang/pt_br.json
Normal file
46
src/main/resources/assets/iconsenhanced/lang/pt_br.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"iconsenhanced.tooltip.shift": "Segure %s para ver detalhes.",
|
||||
"iconsenhanced.tooltip.shift_key": "Shift",
|
||||
"iconsenhanced.desc.minecraft.aqua_affinity": "Aumenta a velocidade de mineração debaixo d'água.",
|
||||
"iconsenhanced.desc.minecraft.bane_of_arthropods": "Aumenta o dano contra artrópodes e os desacelera.",
|
||||
"iconsenhanced.desc.minecraft.binding_curse": "Amaldiçoado: não pode ser removido.",
|
||||
"iconsenhanced.desc.minecraft.blast_protection": "Reduz o dano e o empurrão de explosões.",
|
||||
"iconsenhanced.desc.minecraft.breach": "Ataques da maça ignoram parte da armadura.",
|
||||
"iconsenhanced.desc.minecraft.channeling": "Invoca relâmpagos durante tempestades.",
|
||||
"iconsenhanced.desc.minecraft.density": "Aumenta o dano do impacto da maça.",
|
||||
"iconsenhanced.desc.minecraft.depth_strider": "Aumenta a velocidade de movimento debaixo d'água.",
|
||||
"iconsenhanced.desc.minecraft.efficiency": "Aumenta a velocidade de mineração.",
|
||||
"iconsenhanced.desc.minecraft.feather_falling": "Reduz o dano de queda.",
|
||||
"iconsenhanced.desc.minecraft.fire_aspect": "Incendeia os alvos.",
|
||||
"iconsenhanced.desc.minecraft.fire_protection": "Reduz o dano de fogo e lava.",
|
||||
"iconsenhanced.desc.minecraft.flame": "Flechas incendeiam os alvos.",
|
||||
"iconsenhanced.desc.minecraft.fortune": "Aumenta a quantidade de drops dos blocos.",
|
||||
"iconsenhanced.desc.minecraft.frost_walker": "Congela água em gelo.",
|
||||
"iconsenhanced.desc.minecraft.impaling": "Aumenta o dano contra criaturas aquáticas.",
|
||||
"iconsenhanced.desc.minecraft.infinity": "Dispara flechas sem consumir.",
|
||||
"iconsenhanced.desc.minecraft.knockback": "Aumenta o empurrão.",
|
||||
"iconsenhanced.desc.minecraft.looting": "Aumenta o saque de criaturas.",
|
||||
"iconsenhanced.desc.minecraft.loyalty": "O tridente volta após ser lançado.",
|
||||
"iconsenhanced.desc.minecraft.luck_of_the_sea": "Aumenta a chance de tesouros na pesca.",
|
||||
"iconsenhanced.desc.minecraft.lure": "Aumenta a velocidade de fisgada.",
|
||||
"iconsenhanced.desc.minecraft.mending": "Repara itens com experiência.",
|
||||
"iconsenhanced.desc.minecraft.multishot": "Dispara 3 flechas de uma vez.",
|
||||
"iconsenhanced.desc.minecraft.piercing": "Flechas atravessam alvos.",
|
||||
"iconsenhanced.desc.minecraft.power": "Aumenta o dano do arco.",
|
||||
"iconsenhanced.desc.minecraft.projectile_protection": "Reduz o dano de projéteis.",
|
||||
"iconsenhanced.desc.minecraft.protection": "Reduz a maioria dos danos.",
|
||||
"iconsenhanced.desc.minecraft.punch": "Aumenta o empurrão das flechas.",
|
||||
"iconsenhanced.desc.minecraft.quick_charge": "Reduz o tempo de recarga da besta.",
|
||||
"iconsenhanced.desc.minecraft.respiration": "Aumenta o tempo de respiração debaixo d'água.",
|
||||
"iconsenhanced.desc.minecraft.riptide": "Impulsiona você na água ou na chuva.",
|
||||
"iconsenhanced.desc.minecraft.sharpness": "Aumenta o dano corpo a corpo.",
|
||||
"iconsenhanced.desc.minecraft.silk_touch": "Blocos minerados caem intactos.",
|
||||
"iconsenhanced.desc.minecraft.smite": "Aumenta o dano contra mortos-vivos.",
|
||||
"iconsenhanced.desc.minecraft.soul_speed": "Aumenta a velocidade na areia das almas e na terra das almas.",
|
||||
"iconsenhanced.desc.minecraft.sweeping_edge": "Aumenta o dano do ataque em varrida.",
|
||||
"iconsenhanced.desc.minecraft.swift_sneak": "Aumenta a velocidade ao se agachar.",
|
||||
"iconsenhanced.desc.minecraft.thorns": "Reflete dano aos atacantes.",
|
||||
"iconsenhanced.desc.minecraft.unbreaking": "Itens perdem durabilidade mais lentamente.",
|
||||
"iconsenhanced.desc.minecraft.vanishing_curse": "Amaldiçoado: desaparece ao morrer.",
|
||||
"iconsenhanced.desc.minecraft.wind_burst": "Cria uma rajada após o impacto."
|
||||
}
|
||||
46
src/main/resources/assets/iconsenhanced/lang/ru_ru.json
Normal file
46
src/main/resources/assets/iconsenhanced/lang/ru_ru.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"iconsenhanced.tooltip.shift": "Удерживайте %s для подробностей.",
|
||||
"iconsenhanced.tooltip.shift_key": "Shift",
|
||||
"iconsenhanced.desc.minecraft.aqua_affinity": "Увеличивает скорость добычи под водой.",
|
||||
"iconsenhanced.desc.minecraft.bane_of_arthropods": "Увеличивает урон по членистоногим и замедляет их.",
|
||||
"iconsenhanced.desc.minecraft.binding_curse": "Проклятие: нельзя снять.",
|
||||
"iconsenhanced.desc.minecraft.blast_protection": "Снижает урон и отдачу от взрывов.",
|
||||
"iconsenhanced.desc.minecraft.breach": "Удары булавы игнорируют часть брони.",
|
||||
"iconsenhanced.desc.minecraft.channeling": "Вызывает молнии во время грозы.",
|
||||
"iconsenhanced.desc.minecraft.density": "Увеличивает урон ударом булавы.",
|
||||
"iconsenhanced.desc.minecraft.depth_strider": "Увеличивает скорость под водой.",
|
||||
"iconsenhanced.desc.minecraft.efficiency": "Увеличивает скорость добычи.",
|
||||
"iconsenhanced.desc.minecraft.feather_falling": "Снижает урон от падения.",
|
||||
"iconsenhanced.desc.minecraft.fire_aspect": "Поджигает цели.",
|
||||
"iconsenhanced.desc.minecraft.fire_protection": "Снижает урон от огня и лавы.",
|
||||
"iconsenhanced.desc.minecraft.flame": "Стрелы поджигают цели.",
|
||||
"iconsenhanced.desc.minecraft.fortune": "Увеличивает количество добычи из блоков.",
|
||||
"iconsenhanced.desc.minecraft.frost_walker": "Замораживает воду в лед.",
|
||||
"iconsenhanced.desc.minecraft.impaling": "Увеличивает урон по водным существам.",
|
||||
"iconsenhanced.desc.minecraft.infinity": "Стрелы не расходуются.",
|
||||
"iconsenhanced.desc.minecraft.knockback": "Увеличивает отдачу.",
|
||||
"iconsenhanced.desc.minecraft.looting": "Увеличивает добычу с существ.",
|
||||
"iconsenhanced.desc.minecraft.loyalty": "Трезубец возвращается после броска.",
|
||||
"iconsenhanced.desc.minecraft.luck_of_the_sea": "Повышает шанс сокровищ при рыбалке.",
|
||||
"iconsenhanced.desc.minecraft.lure": "Увеличивает скорость клева.",
|
||||
"iconsenhanced.desc.minecraft.mending": "Чинит предметы опытом.",
|
||||
"iconsenhanced.desc.minecraft.multishot": "Выпускает 3 стрелы одновременно.",
|
||||
"iconsenhanced.desc.minecraft.piercing": "Стрелы пронзают цели.",
|
||||
"iconsenhanced.desc.minecraft.power": "Увеличивает урон лука.",
|
||||
"iconsenhanced.desc.minecraft.projectile_protection": "Снижает урон от снарядов.",
|
||||
"iconsenhanced.desc.minecraft.protection": "Снижает большую часть урона.",
|
||||
"iconsenhanced.desc.minecraft.punch": "Увеличивает отдачу стрел.",
|
||||
"iconsenhanced.desc.minecraft.quick_charge": "Сокращает время перезарядки арбалета.",
|
||||
"iconsenhanced.desc.minecraft.respiration": "Увеличивает время дыхания под водой.",
|
||||
"iconsenhanced.desc.minecraft.riptide": "Отбрасывает вас в воде или под дождем.",
|
||||
"iconsenhanced.desc.minecraft.sharpness": "Увеличивает урон в ближнем бою.",
|
||||
"iconsenhanced.desc.minecraft.silk_touch": "Блоки выпадают сами.",
|
||||
"iconsenhanced.desc.minecraft.smite": "Увеличивает урон по нежити.",
|
||||
"iconsenhanced.desc.minecraft.soul_speed": "Увеличивает скорость по песку душ и земле душ.",
|
||||
"iconsenhanced.desc.minecraft.sweeping_edge": "Увеличивает урон от размашистой атаки.",
|
||||
"iconsenhanced.desc.minecraft.swift_sneak": "Увеличивает скорость приседания.",
|
||||
"iconsenhanced.desc.minecraft.thorns": "Отражает урон атакующим.",
|
||||
"iconsenhanced.desc.minecraft.unbreaking": "Снижает расход прочности.",
|
||||
"iconsenhanced.desc.minecraft.vanishing_curse": "Проклятие: исчезает после смерти.",
|
||||
"iconsenhanced.desc.minecraft.wind_burst": "Создает порыв ветра после удара."
|
||||
}
|
||||
46
src/main/resources/assets/iconsenhanced/lang/zh_cn.json
Normal file
46
src/main/resources/assets/iconsenhanced/lang/zh_cn.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"iconsenhanced.tooltip.shift": "按住%s查看详情。",
|
||||
"iconsenhanced.tooltip.shift_key": "Shift",
|
||||
"iconsenhanced.desc.minecraft.aqua_affinity": "提高水下挖掘速度。",
|
||||
"iconsenhanced.desc.minecraft.bane_of_arthropods": "提高对节肢生物的伤害并使其减速。",
|
||||
"iconsenhanced.desc.minecraft.binding_curse": "诅咒:无法移除。",
|
||||
"iconsenhanced.desc.minecraft.blast_protection": "减少爆炸伤害和击退。",
|
||||
"iconsenhanced.desc.minecraft.breach": "重锤攻击无视部分护甲。",
|
||||
"iconsenhanced.desc.minecraft.channeling": "雷雨时召唤闪电。",
|
||||
"iconsenhanced.desc.minecraft.density": "提高重锤重击伤害。",
|
||||
"iconsenhanced.desc.minecraft.depth_strider": "提高水下移动速度。",
|
||||
"iconsenhanced.desc.minecraft.efficiency": "提高挖掘速度。",
|
||||
"iconsenhanced.desc.minecraft.feather_falling": "减少摔落伤害。",
|
||||
"iconsenhanced.desc.minecraft.fire_aspect": "点燃目标。",
|
||||
"iconsenhanced.desc.minecraft.fire_protection": "减少火焰和岩浆伤害。",
|
||||
"iconsenhanced.desc.minecraft.flame": "箭矢点燃目标。",
|
||||
"iconsenhanced.desc.minecraft.fortune": "提高方块掉落数量。",
|
||||
"iconsenhanced.desc.minecraft.frost_walker": "将水冻结成冰。",
|
||||
"iconsenhanced.desc.minecraft.impaling": "提高对水生生物的伤害。",
|
||||
"iconsenhanced.desc.minecraft.infinity": "射箭不消耗箭矢。",
|
||||
"iconsenhanced.desc.minecraft.knockback": "提高击退效果。",
|
||||
"iconsenhanced.desc.minecraft.looting": "提高生物掉落。",
|
||||
"iconsenhanced.desc.minecraft.loyalty": "投掷后会返回的三叉戟。",
|
||||
"iconsenhanced.desc.minecraft.luck_of_the_sea": "提高钓鱼宝藏几率。",
|
||||
"iconsenhanced.desc.minecraft.lure": "提高鱼咬钩速度。",
|
||||
"iconsenhanced.desc.minecraft.mending": "用经验修复物品。",
|
||||
"iconsenhanced.desc.minecraft.multishot": "一次射出3支箭。",
|
||||
"iconsenhanced.desc.minecraft.piercing": "箭矢可穿透目标。",
|
||||
"iconsenhanced.desc.minecraft.power": "提高弓的伤害。",
|
||||
"iconsenhanced.desc.minecraft.projectile_protection": "减少投射物伤害。",
|
||||
"iconsenhanced.desc.minecraft.protection": "减少大部分伤害。",
|
||||
"iconsenhanced.desc.minecraft.punch": "提高箭矢击退。",
|
||||
"iconsenhanced.desc.minecraft.quick_charge": "减少弩的装填时间。",
|
||||
"iconsenhanced.desc.minecraft.respiration": "延长水下呼吸时间。",
|
||||
"iconsenhanced.desc.minecraft.riptide": "在水中或雨中推进自己。",
|
||||
"iconsenhanced.desc.minecraft.sharpness": "提高近战伤害。",
|
||||
"iconsenhanced.desc.minecraft.silk_touch": "挖掘的方块会原样掉落。",
|
||||
"iconsenhanced.desc.minecraft.smite": "提高对亡灵的伤害。",
|
||||
"iconsenhanced.desc.minecraft.soul_speed": "提高在灵魂沙和灵魂土上的速度。",
|
||||
"iconsenhanced.desc.minecraft.sweeping_edge": "提高横扫攻击伤害。",
|
||||
"iconsenhanced.desc.minecraft.swift_sneak": "提高潜行速度。",
|
||||
"iconsenhanced.desc.minecraft.thorns": "反弹伤害给攻击者。",
|
||||
"iconsenhanced.desc.minecraft.unbreaking": "降低耐久消耗。",
|
||||
"iconsenhanced.desc.minecraft.vanishing_curse": "诅咒:死亡时消失。",
|
||||
"iconsenhanced.desc.minecraft.wind_burst": "重击后产生风爆。"
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"texture": {
|
||||
"blur": false,
|
||||
"clamp": true
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,23 @@ stonecutter.active "1.21.11"
|
||||
|
||||
tasks.register("chiseledBuild") {
|
||||
group = "build"
|
||||
dependsOn(stonecutter.tree.nodes.collect { it.project.tasks.named("remapJar") })
|
||||
}
|
||||
|
||||
tasks.register("chiseledClean") {
|
||||
group = "build"
|
||||
dependsOn(stonecutter.tree.nodes.collect { it.project.tasks.named("clean") })
|
||||
}
|
||||
|
||||
gradle.projectsEvaluated {
|
||||
def remapTasks = rootProject.subprojects
|
||||
.collect { it.tasks.findByName("remapJar") }
|
||||
.findAll { it != null }
|
||||
def cleanTasks = rootProject.subprojects
|
||||
.collect { it.tasks.findByName("clean") }
|
||||
.findAll { it != null }
|
||||
tasks.named("chiseledBuild") {
|
||||
dependsOn(remapTasks)
|
||||
}
|
||||
tasks.named("chiseledClean") {
|
||||
dependsOn(cleanTasks)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user