v1.6.1
This commit is contained in:
1 parent
a59d9c3740
commit
9993d92afa
5 files changed
+55
-13
No files matched your search
@@ -19,7 +19,9 @@ public class ManaHudRenderer {
|
|||||||
);
|
);
|
||||||
private static final int TEXTURE_WIDTH = 22;
|
private static final int TEXTURE_WIDTH = 22;
|
||||||
private static final int TEXTURE_HEIGHT = 24;
|
private static final int TEXTURE_HEIGHT = 24;
|
||||||
private static final int MAX_SEGMENT_COUNT = 10;
|
private static final int MANA_PER_STAR = 20;
|
||||||
|
private static final int MAX_SEGMENT_COUNT = 20;
|
||||||
|
private static final int SEGMENTS_PER_COLUMN = 10;
|
||||||
private static final int SLOT_WIDTH = 8;
|
private static final int SLOT_WIDTH = 8;
|
||||||
private static final int SLOT_HEIGHT = 9;
|
private static final int SLOT_HEIGHT = 9;
|
||||||
private static final int SLOT_GAP = 1;
|
private static final int SLOT_GAP = 1;
|
||||||
@@ -31,23 +33,21 @@ public class ManaHudRenderer {
|
|||||||
int maxMana = Math.max(0, mana.getMaxMana());
|
int maxMana = Math.max(0, mana.getMaxMana());
|
||||||
if(maxMana <= 0) return;
|
if(maxMana <= 0) return;
|
||||||
|
|
||||||
int segmentCount = Math.min(MAX_SEGMENT_COUNT, maxMana);
|
int segmentCount = Mth.clamp(Mth.ceil(maxMana / (float)MANA_PER_STAR), 0, MAX_SEGMENT_COUNT);
|
||||||
float segmentMana = maxMana < MAX_SEGMENT_COUNT ? 1.0F : maxMana / (float)MAX_SEGMENT_COUNT;
|
|
||||||
int currentMana = Mth.clamp(mana.getMana(), 0, maxMana);
|
int currentMana = Mth.clamp(mana.getMana(), 0, maxMana);
|
||||||
if(currentMana >= maxMana) return;
|
|
||||||
|
|
||||||
manaBarX = RenderConfigs.MANA_BAR_X.get();
|
manaBarX = RenderConfigs.MANA_BAR_X.get();
|
||||||
manaBarY = RenderConfigs.MANA_BAR_Y.get();
|
manaBarY = RenderConfigs.MANA_BAR_Y.get();
|
||||||
|
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderSystem.defaultBlendFunc();
|
RenderSystem.defaultBlendFunc();
|
||||||
float missingMana = maxMana - currentMana;
|
|
||||||
for(int i = 0; i < segmentCount; i++) {
|
for(int i = 0; i < segmentCount; i++) {
|
||||||
int bottomIndex = segmentCount - 1 - i;
|
float fill = Mth.clamp((currentMana - i * MANA_PER_STAR) / (float)MANA_PER_STAR, 0.0F, 1.0F);
|
||||||
float drained = Mth.clamp(missingMana - bottomIndex * segmentMana, 0.0F, segmentMana);
|
int column = i / SEGMENTS_PER_COLUMN;
|
||||||
float fill = 1.0F - drained / segmentMana;
|
int row = i % SEGMENTS_PER_COLUMN;
|
||||||
int slotY = manaBarY + i * (SLOT_HEIGHT + SLOT_GAP);
|
int slotX = manaBarX + column * (SLOT_WIDTH + SLOT_GAP);
|
||||||
renderSegment(guiGraphics, manaBarX, slotY, fill);
|
int slotY = manaBarY + row * (SLOT_HEIGHT + SLOT_GAP);
|
||||||
|
renderSegment(guiGraphics, slotX, slotY, fill);
|
||||||
}
|
}
|
||||||
guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F);
|
guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
renderManaText(guiGraphics, currentMana, maxMana, segmentCount);
|
renderManaText(guiGraphics, currentMana, maxMana, segmentCount);
|
||||||
@@ -87,9 +87,12 @@ public class ManaHudRenderer {
|
|||||||
Font font = Minecraft.getInstance().font;
|
Font font = Minecraft.getInstance().font;
|
||||||
String text = currentMana + "/" + maxMana;
|
String text = currentMana + "/" + maxMana;
|
||||||
int textWidth = font.width(text);
|
int textWidth = font.width(text);
|
||||||
int barCenterX = manaBarX + SLOT_WIDTH / 2;
|
int columnCount = Mth.ceil(segmentCount / (float)SEGMENTS_PER_COLUMN);
|
||||||
|
int rowCount = Math.min(segmentCount, SEGMENTS_PER_COLUMN);
|
||||||
|
int barWidth = columnCount * SLOT_WIDTH + Math.max(0, columnCount - 1) * SLOT_GAP;
|
||||||
|
int barCenterX = manaBarX + barWidth / 2;
|
||||||
int textX = Mth.clamp(barCenterX - textWidth / 2, 2, guiGraphics.guiWidth() - textWidth - 2);
|
int textX = Mth.clamp(barCenterX - textWidth / 2, 2, guiGraphics.guiWidth() - textWidth - 2);
|
||||||
int textY = manaBarY + segmentCount * SLOT_HEIGHT + (segmentCount - 1) * SLOT_GAP + 2;
|
int textY = manaBarY + rowCount * SLOT_HEIGHT + Math.max(0, rowCount - 1) * SLOT_GAP + 2;
|
||||||
|
|
||||||
guiGraphics.drawString(font, text, textX, textY, 0x66CCFF, true);
|
guiGraphics.drawString(font, text, textX, textY, 0x66CCFF, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,9 @@ public class MEntityLuminance implements EntityLuminance {
|
|||||||
StaticSummonBehaviors.TERRAPRISMA,
|
StaticSummonBehaviors.TERRAPRISMA,
|
||||||
StaticSummonBehaviors.FLAMETHROWER_FLAME,
|
StaticSummonBehaviors.FLAMETHROWER_FLAME,
|
||||||
StaticSummonBehaviors.ELF_MELTER_FLAME,
|
StaticSummonBehaviors.ELF_MELTER_FLAME,
|
||||||
StaticSummonBehaviors.STARDUST_DRAGON -> {
|
StaticSummonBehaviors.STARDUST_DRAGON,
|
||||||
|
StaticSummonBehaviors.FALLEN_STAR,
|
||||||
|
StaticSummonBehaviors.FALLEN_STAR_SUPER -> {
|
||||||
return 15;
|
return 15;
|
||||||
}
|
}
|
||||||
case StaticSummonBehaviors.CHLOROPHYTE_BULLET,
|
case StaticSummonBehaviors.CHLOROPHYTE_BULLET,
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"replace": false,
|
||||||
|
"entries": [
|
||||||
|
"lzxnoneterraria:natures_gift_simple_dungeon"
|
||||||
|
]
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"type": "neoforge:add_table",
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "neoforge:loot_table_id",
|
||||||
|
"loot_table_id": "minecraft:chests/simple_dungeon"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"table": "lzxnoneterraria:chests/natures_gift"
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:chest",
|
||||||
|
"pools": [
|
||||||
|
{
|
||||||
|
"bonus_rolls": 0.0,
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "minecraft:random_chance",
|
||||||
|
"chance": 0.12
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:item",
|
||||||
|
"name": "lzxnoneterraria:natures_gift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"rolls": 1.0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in new issue
Block a user