Update to 1.19
This commit is contained in:
parent
ce4667b6b4
commit
2039236aec
9 changed files with 97 additions and 77 deletions
|
@ -22,7 +22,7 @@ public class AutoWalk {
|
|||
static long lastPress;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onKeyPress(InputEvent.KeyInputEvent event) {
|
||||
public static void onKeyPress(InputEvent.Key event) {
|
||||
if(Keybindings.AUTOWALK.matches(event.getKey(), event.getScanCode()) && Minecraft.getInstance().screen == null && Keybindings.AUTOWALK.isDown())
|
||||
{
|
||||
lastPress = Instant.now().getEpochSecond();
|
||||
|
@ -36,10 +36,11 @@ public class AutoWalk {
|
|||
|
||||
private static void startWalking() {
|
||||
isWalking=true;
|
||||
autoJump = Minecraft.getInstance().options.autoJump;
|
||||
Minecraft.getInstance().options.autoJump = true;
|
||||
autoJump = Minecraft.getInstance().options.autoJump().get();
|
||||
Minecraft.getInstance().options.autoJump().set(true);
|
||||
|
||||
Minecraft.getInstance().player.sendMessage(ChatHelpers.macro(Messages.ESSENTIALS_PREFIX + "!Dark_Green!AutoWalking started"), new UUID(0,0));
|
||||
|
||||
Minecraft.getInstance().player.displayClientMessage(ChatHelpers.macro(Messages.ESSENTIALS_PREFIX + "!Dark_Green!AutoWalking started"), false);
|
||||
|
||||
runner = new Thread(()->{
|
||||
while(AutoWalk.isWalking)
|
||||
|
@ -55,10 +56,10 @@ public class AutoWalk {
|
|||
isWalking=false;
|
||||
runner.interrupt();
|
||||
runner=null;
|
||||
Minecraft.getInstance().options.autoJump = autoJump;
|
||||
Minecraft.getInstance().options.autoJump().set(autoJump);
|
||||
Minecraft.getInstance().options.keyUp.setDown(false);
|
||||
|
||||
Minecraft.getInstance().player.sendMessage(ChatHelpers.macro(Messages.ESSENTIALS_PREFIX + "!Dark_Green!AutoWalking stopped"), new UUID(0,0));
|
||||
Minecraft.getInstance().player.displayClientMessage(ChatHelpers.macro(Messages.ESSENTIALS_PREFIX + "!Dark_Green!AutoWalking stopped"), false);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,10 @@ import net.minecraft.world.entity.ai.attributes.Attributes;
|
|||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.gui.ForgeIngameGui;
|
||||
import net.minecraftforge.client.event.RenderGuiOverlayEvent;
|
||||
import net.minecraftforge.client.gui.overlay.ForgeGui;
|
||||
import net.minecraftforge.client.gui.overlay.GuiOverlayManager;
|
||||
import net.minecraftforge.client.gui.overlay.NamedGuiOverlay;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
@ -77,12 +79,28 @@ public class HeartsRenderer {
|
|||
* @param event Event instance
|
||||
*/
|
||||
@SubscribeEvent(priority = EventPriority.LOW)
|
||||
public void renderHealthbar(RenderGameOverlayEvent.PreLayer event) {
|
||||
if (event.isCanceled() || !AEClientConfig.getInstance().EnableHearts || event.getOverlay() != ForgeIngameGui.PLAYER_HEALTH_ELEMENT) {
|
||||
public void renderHealthbar(RenderGuiOverlayEvent.Pre event) {
|
||||
NamedGuiOverlay ActualOverlay = GuiOverlayManager.findOverlay(new ResourceLocation("minecraft:player_health"));
|
||||
|
||||
if (ActualOverlay == null) {
|
||||
if (GuiOverlayManager.getOverlays() == null) {
|
||||
AriasEssentials.LOGGER.info("Overlays non existent?!");
|
||||
}
|
||||
for (NamedGuiOverlay overlay : GuiOverlayManager.getOverlays()) {
|
||||
// Next print
|
||||
// LibZontreck.LOGGER.info("GUI OVERLAY: "+overlay.id().getPath());
|
||||
|
||||
if (overlay.id().getPath().equals("player_health")) {
|
||||
ActualOverlay = overlay;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.isCanceled() || !AEClientConfig.getInstance().EnableHearts || event.getOverlay() != ActualOverlay) {
|
||||
return;
|
||||
}
|
||||
// ensure its visible
|
||||
if (!(mc.gui instanceof ForgeIngameGui gui) || mc.options.hideGui || !gui.shouldDrawSurvivalElements()) {
|
||||
if (!(mc.gui instanceof ForgeGui gui) || mc.options.hideGui || !gui.shouldDrawSurvivalElements()) {
|
||||
return;
|
||||
}
|
||||
Entity renderViewEnity = this.mc.getCameraEntity();
|
||||
|
@ -94,7 +112,7 @@ public class HeartsRenderer {
|
|||
this.mc.getProfiler().push("health");
|
||||
|
||||
// extra setup stuff from us
|
||||
int left_height = gui.left_height;
|
||||
int left_height = gui.leftHeight;
|
||||
int width = this.mc.getWindow().getGuiScaledWidth();
|
||||
int height = this.mc.getWindow().getGuiScaledHeight();
|
||||
int updateCounter = this.mc.gui.getGuiTicks();
|
||||
|
@ -103,13 +121,13 @@ public class HeartsRenderer {
|
|||
// changes are indicated by comment
|
||||
|
||||
int health = Mth.ceil(player.getHealth());
|
||||
boolean highlight = this.healthUpdateCounter > (long) updateCounter && (this.healthUpdateCounter - (long) updateCounter) / 3L % 2L == 1L;
|
||||
boolean highlight = this.healthUpdateCounter > (long) updateCounter
|
||||
&& (this.healthUpdateCounter - (long) updateCounter) / 3L % 2L == 1L;
|
||||
|
||||
if (health < this.playerHealth && player.invulnerableTime > 0) {
|
||||
this.lastSystemTime = Util.getMillis();
|
||||
this.healthUpdateCounter = (updateCounter + 20);
|
||||
}
|
||||
else if (health > this.playerHealth && player.invulnerableTime > 0) {
|
||||
} else if (health > this.playerHealth && player.invulnerableTime > 0) {
|
||||
this.lastSystemTime = Util.getMillis();
|
||||
this.healthUpdateCounter = (updateCounter + 10);
|
||||
}
|
||||
|
@ -127,7 +145,8 @@ public class HeartsRenderer {
|
|||
float healthMax = attrMaxHealth == null ? 0 : (float) attrMaxHealth.getValue();
|
||||
float absorb = Mth.ceil(player.getAbsorptionAmount());
|
||||
|
||||
// CHANGE: simulate 10 hearts max if there's more, so vanilla only renders one row max
|
||||
// CHANGE: simulate 10 hearts max if there's more, so vanilla only renders one
|
||||
// row max
|
||||
healthMax = Math.min(healthMax, 20f);
|
||||
health = Math.min(health, 20);
|
||||
absorb = Math.min(absorb, 20);
|
||||
|
@ -139,9 +158,10 @@ public class HeartsRenderer {
|
|||
|
||||
int left = width / 2 - 91;
|
||||
int top = height - left_height;
|
||||
// change: these are unused below, unneeded? should these adjust the Forge variable?
|
||||
//left_height += (healthRows * rowHeight);
|
||||
//if (rowHeight != 10) left_height += 10 - rowHeight;
|
||||
// change: these are unused below, unneeded? should these adjust the Forge
|
||||
// variable?
|
||||
// left_height += (healthRows * rowHeight);
|
||||
// if (rowHeight != 10) left_height += 10 - rowHeight;
|
||||
|
||||
this.regen = -1;
|
||||
if (player.hasEffect(MobEffects.REGENERATION)) {
|
||||
|
@ -152,46 +172,46 @@ public class HeartsRenderer {
|
|||
final int TOP = 9 * (this.mc.level.getLevelData().isHardcore() ? 5 : 0);
|
||||
final int BACKGROUND = (highlight ? 25 : 16);
|
||||
int MARGIN = 16;
|
||||
if (player.hasEffect(MobEffects.POISON)) MARGIN += 36;
|
||||
else if (player.hasEffect(MobEffects.WITHER)) MARGIN += 72;
|
||||
if (player.hasEffect(MobEffects.POISON))
|
||||
MARGIN += 36;
|
||||
else if (player.hasEffect(MobEffects.WITHER))
|
||||
MARGIN += 72;
|
||||
float absorbRemaining = absorb;
|
||||
|
||||
PoseStack matrixStack = event.getMatrixStack();
|
||||
PoseStack matrixStack = event.getPoseStack();
|
||||
for (int i = Mth.ceil((healthMax + absorb) / 2.0F) - 1; i >= 0; --i) {
|
||||
int row = Mth.ceil((float) (i + 1) / 10.0F) - 1;
|
||||
int x = left + i % 10 * 8;
|
||||
int y = top - row * rowHeight;
|
||||
|
||||
if (health <= 4) y += this.rand.nextInt(2);
|
||||
if (i == this.regen) y -= 2;
|
||||
if (health <= 4)
|
||||
y += this.rand.nextInt(2);
|
||||
if (i == this.regen)
|
||||
y -= 2;
|
||||
|
||||
this.blit(matrixStack, x, y, BACKGROUND, TOP, 9, 9);
|
||||
|
||||
if (highlight) {
|
||||
if (i * 2 + 1 < healthLast) {
|
||||
this.blit(matrixStack, x, y, MARGIN + 54, TOP, 9, 9); //6
|
||||
}
|
||||
else if (i * 2 + 1 == healthLast) {
|
||||
this.blit(matrixStack, x, y, MARGIN + 63, TOP, 9, 9); //7
|
||||
this.blit(matrixStack, x, y, MARGIN + 54, TOP, 9, 9); // 6
|
||||
} else if (i * 2 + 1 == healthLast) {
|
||||
this.blit(matrixStack, x, y, MARGIN + 63, TOP, 9, 9); // 7
|
||||
}
|
||||
}
|
||||
|
||||
if (absorbRemaining > 0.0F) {
|
||||
if (absorbRemaining == absorb && absorb % 2.0F == 1.0F) {
|
||||
this.blit(matrixStack, x, y, MARGIN + 153, TOP, 9, 9); //17
|
||||
this.blit(matrixStack, x, y, MARGIN + 153, TOP, 9, 9); // 17
|
||||
absorbRemaining -= 1.0F;
|
||||
}
|
||||
else {
|
||||
this.blit(matrixStack, x, y, MARGIN + 144, TOP, 9, 9); //16
|
||||
} else {
|
||||
this.blit(matrixStack, x, y, MARGIN + 144, TOP, 9, 9); // 16
|
||||
absorbRemaining -= 2.0F;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (i * 2 + 1 < health) {
|
||||
this.blit(matrixStack, x, y, MARGIN + 36, TOP, 9, 9); //4
|
||||
}
|
||||
else if (i * 2 + 1 == health) {
|
||||
this.blit(matrixStack, x, y, MARGIN + 45, TOP, 9, 9); //5
|
||||
this.blit(matrixStack, x, y, MARGIN + 36, TOP, 9, 9); // 4
|
||||
} else if (i * 2 + 1 == health) {
|
||||
this.blit(matrixStack, x, y, MARGIN + 45, TOP, 9, 9); // 5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -200,22 +220,24 @@ public class HeartsRenderer {
|
|||
this.renderExtraAbsorption(matrixStack, left, top - rowHeight, player);
|
||||
|
||||
RenderSystem.setShaderTexture(0, ICON_VANILLA);
|
||||
gui.left_height += 10;
|
||||
gui.leftHeight += 10;
|
||||
if (absorb > 0) {
|
||||
gui.left_height += 10;
|
||||
gui.leftHeight += 10;
|
||||
}
|
||||
|
||||
event.setCanceled(true);
|
||||
RenderSystem.disableBlend();
|
||||
this.mc.getProfiler().pop();
|
||||
MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.PostLayer(matrixStack, event, ForgeIngameGui.PLAYER_HEALTH_ELEMENT));
|
||||
MinecraftForge.EVENT_BUS
|
||||
.post(new RenderGuiOverlayEvent.Post(mc.getWindow(), event.getPoseStack(), event.getPartialTick(), ActualOverlay));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the texture from potion effects
|
||||
* @param player Player instance
|
||||
* @return Texture offset for potion effects
|
||||
*
|
||||
* @param player Player instance
|
||||
* @return Texture offset for potion effects
|
||||
*/
|
||||
private int getPotionOffset(Player player) {
|
||||
int potionOffset = 0;
|
||||
|
@ -236,10 +258,11 @@ public class HeartsRenderer {
|
|||
|
||||
/**
|
||||
* Renders the health above 10 hearts
|
||||
* @param matrixStack Matrix stack instance
|
||||
* @param xBasePos Health bar top corner
|
||||
* @param yBasePos Health bar top corner
|
||||
* @param player Player instance
|
||||
*
|
||||
* @param matrixStack Matrix stack instance
|
||||
* @param xBasePos Health bar top corner
|
||||
* @param yBasePos Health bar top corner
|
||||
* @param player Player instance
|
||||
*/
|
||||
private void renderExtraHearts(PoseStack matrixStack, int xBasePos, int yBasePos, Player player) {
|
||||
int potionOffset = this.getPotionOffset(player);
|
||||
|
@ -253,10 +276,11 @@ public class HeartsRenderer {
|
|||
|
||||
/**
|
||||
* Renders the absorption health above 10 hearts
|
||||
* @param matrixStack Matrix stack instance
|
||||
* @param xBasePos Health bar top corner
|
||||
* @param yBasePos Health bar top corner
|
||||
* @param player Player instance
|
||||
*
|
||||
* @param matrixStack Matrix stack instance
|
||||
* @param xBasePos Health bar top corner
|
||||
* @param yBasePos Health bar top corner
|
||||
* @param player Player instance
|
||||
*/
|
||||
private void renderExtraAbsorption(PoseStack matrixStack, int xBasePos, int yBasePos, Player player) {
|
||||
int potionOffset = this.getPotionOffset(player);
|
||||
|
@ -269,8 +293,9 @@ public class HeartsRenderer {
|
|||
|
||||
/**
|
||||
* Gets the texture offset from the regen effect
|
||||
* @param i Heart index
|
||||
* @param offset Current offset
|
||||
*
|
||||
* @param i Heart index
|
||||
* @param offset Current offset
|
||||
*/
|
||||
private int getYRegenOffset(int i, int offset) {
|
||||
return i + offset == this.regen ? -2 : 0;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
|
||||
modLoader="javafml" #mandatory
|
||||
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
|
||||
loaderVersion="[40,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
loaderVersion="[43,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
|
||||
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
||||
license="GPLv3"
|
||||
|
@ -51,7 +51,7 @@ modId="forge" #mandatory
|
|||
# Does this dependency have to exist - if not, ordering below must be specified
|
||||
mandatory=true #mandatory
|
||||
# The version range of the dependency
|
||||
versionRange="[40,)" #mandatory
|
||||
versionRange="[43,)" #mandatory
|
||||
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
|
||||
ordering="NONE"
|
||||
# Side this dependency is applied on - BOTH, CLIENT or SERVER
|
||||
|
@ -61,10 +61,10 @@ side="BOTH"
|
|||
modId="minecraft"
|
||||
mandatory=true
|
||||
# This version range declares a minimum of the current minecraft version up to but not including the next major version
|
||||
versionRange="[1.18.2,1.19)"
|
||||
versionRange="[1.19,1.20)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
[[dependencies.libzontreck]]
|
||||
[[dependencies.ariasessentials]]
|
||||
modId="libzontreck"
|
||||
mandatory=true
|
||||
versionRange="[1.10,1.11)"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"pack": {
|
||||
"description": "Aria's Essentials resources",
|
||||
"pack_format": 9,
|
||||
"forge:resource_pack_format": 8,
|
||||
"forge:data_pack_format": 9
|
||||
"forge:resource_pack_format": 9,
|
||||
"forge:data_pack_format": 10
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue