对齐名称,图标,弹药
|
@ -19,7 +19,7 @@ import net.minecraftforge.fml.common.Mod;
|
||||||
|
|
||||||
@Mod.EventBusSubscriber(value = Dist.CLIENT)
|
@Mod.EventBusSubscriber(value = Dist.CLIENT)
|
||||||
public class AmmoBarOverlay {
|
public class AmmoBarOverlay {
|
||||||
private static final ResourceLocation BUTTON = new ResourceLocation(TargetMod.MODID, "textures/gun_icon/fire_mode/button.png");
|
// private static final ResourceLocation BUTTON = new ResourceLocation(TargetMod.MODID, "textures/gun_icon/fire_mode/button.png");
|
||||||
private static final ResourceLocation LINE = new ResourceLocation(TargetMod.MODID, "textures/gun_icon/fire_mode/line.png");
|
private static final ResourceLocation LINE = new ResourceLocation(TargetMod.MODID, "textures/gun_icon/fire_mode/line.png");
|
||||||
private static final ResourceLocation SEMI = new ResourceLocation(TargetMod.MODID, "textures/gun_icon/fire_mode/semi.png");
|
private static final ResourceLocation SEMI = new ResourceLocation(TargetMod.MODID, "textures/gun_icon/fire_mode/semi.png");
|
||||||
private static final ResourceLocation BURST = new ResourceLocation(TargetMod.MODID, "textures/gun_icon/fire_mode/burst.png");
|
private static final ResourceLocation BURST = new ResourceLocation(TargetMod.MODID, "textures/gun_icon/fire_mode/burst.png");
|
||||||
|
@ -51,22 +51,22 @@ public class AmmoBarOverlay {
|
||||||
16);
|
16);
|
||||||
|
|
||||||
// 渲染开火模式切换按键
|
// 渲染开火模式切换按键
|
||||||
event.getGuiGraphics().blit(BUTTON,
|
// event.getGuiGraphics().blit(BUTTON,
|
||||||
w - 115,
|
// w - 115,
|
||||||
h - 20,
|
// h - 20,
|
||||||
0,
|
// 0,
|
||||||
0,
|
// 0,
|
||||||
10,
|
// 10,
|
||||||
10,
|
// 10,
|
||||||
10,
|
// 10,
|
||||||
10);
|
// 10);
|
||||||
|
|
||||||
event.getGuiGraphics().drawString(
|
event.getGuiGraphics().drawString(
|
||||||
Minecraft.getInstance().font,
|
Minecraft.getInstance().font,
|
||||||
TargetModKeyMappings.FIREMODE.getKey().getDisplayName().getString(),
|
"[" + TargetModKeyMappings.FIREMODE.getKey().getDisplayName().getString() + "]",
|
||||||
w - 111.5f,
|
w - 111.5f,
|
||||||
h - 20,
|
h - 20,
|
||||||
0x050505,
|
0xFFFFFF,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -74,8 +74,8 @@ public class AmmoBarOverlay {
|
||||||
ResourceLocation fireMode = getFireMode(stack);
|
ResourceLocation fireMode = getFireMode(stack);
|
||||||
|
|
||||||
event.getGuiGraphics().blit(fireMode,
|
event.getGuiGraphics().blit(fireMode,
|
||||||
w - 100,
|
w - 95,
|
||||||
h - 19,
|
h - 21,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
8,
|
8,
|
||||||
|
@ -84,8 +84,8 @@ public class AmmoBarOverlay {
|
||||||
8);
|
8);
|
||||||
|
|
||||||
event.getGuiGraphics().blit(LINE,
|
event.getGuiGraphics().blit(LINE,
|
||||||
w - 100,
|
w - 95,
|
||||||
h - 14,
|
h - 16,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
8,
|
8,
|
||||||
|
@ -101,8 +101,8 @@ public class AmmoBarOverlay {
|
||||||
event.getGuiGraphics().drawString(
|
event.getGuiGraphics().drawString(
|
||||||
Minecraft.getInstance().font,
|
Minecraft.getInstance().font,
|
||||||
getGunAmmoCount(player) + "",
|
getGunAmmoCount(player) + "",
|
||||||
w / 1.5f - 62 / 1.5f + 1,
|
w / 1.5f - 64 / 1.5f + 1,
|
||||||
h / 1.5f - 31,
|
h / 1.5f - 32,
|
||||||
0xFFFFFF,
|
0xFFFFFF,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
@ -112,21 +112,21 @@ public class AmmoBarOverlay {
|
||||||
event.getGuiGraphics().drawString(
|
event.getGuiGraphics().drawString(
|
||||||
Minecraft.getInstance().font,
|
Minecraft.getInstance().font,
|
||||||
getPlayerAmmoCount(player),
|
getPlayerAmmoCount(player),
|
||||||
w - 60,
|
w - 64,
|
||||||
h - 35,
|
h - 35,
|
||||||
0xCCCCCC,
|
0xCCCCCC,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
poseStack.scale(0.9f, 0.9f, 1f);
|
poseStack.scale(0.9f, 1f, 1f);
|
||||||
|
|
||||||
// 渲染物品名称
|
// 渲染物品名称
|
||||||
event.getGuiGraphics().drawString(
|
event.getGuiGraphics().drawString(
|
||||||
Minecraft.getInstance().font,
|
Minecraft.getInstance().font,
|
||||||
centerString(gunItem.getGunDisplayName(), 20),
|
centerString(gunItem.getGunDisplayName(), 20),
|
||||||
w / 0.9f - 128 / 0.9f,
|
w / 0.9f - 144 / 0.9f,
|
||||||
h - 34,
|
h - 60,
|
||||||
0xFFFFFF,
|
0xFFFFFF,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
@ -135,8 +135,8 @@ public class AmmoBarOverlay {
|
||||||
event.getGuiGraphics().drawString(
|
event.getGuiGraphics().drawString(
|
||||||
Minecraft.getInstance().font,
|
Minecraft.getInstance().font,
|
||||||
centerString(getGunAmmoType(stack), 20),
|
centerString(getGunAmmoType(stack), 20),
|
||||||
w / 0.9f - 128 / 0.9f,
|
w / 0.9f - 144 / 0.9f,
|
||||||
h - 26,
|
h - 51,
|
||||||
0xC8A679,
|
0xC8A679,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
@ -156,10 +156,6 @@ public class AmmoBarOverlay {
|
||||||
private static int getGunAmmoCount(Player player) {
|
private static int getGunAmmoCount(Player player) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
|
||||||
if (stack.getItem() == TargetModItems.BOCEK.get() || stack.getItem() == TargetModItems.M_79.get()
|
|
||||||
|| stack.getItem() == TargetModItems.RPG.get() || stack.getItem() == TargetModItems.TASER.get()) {
|
|
||||||
return stack.getOrCreateTag().getInt("max_ammo");
|
|
||||||
}
|
|
||||||
if (stack.getItem() == TargetModItems.MINIGUN.get()) {
|
if (stack.getItem() == TargetModItems.MINIGUN.get()) {
|
||||||
return (player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo;
|
return (player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo;
|
||||||
}
|
}
|
||||||
|
@ -174,6 +170,11 @@ public class AmmoBarOverlay {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (stack.getItem() == TargetModItems.BOCEK.get() || stack.getItem() == TargetModItems.M_79.get()
|
||||||
|
|| stack.getItem() == TargetModItems.RPG.get() || stack.getItem() == TargetModItems.TASER.get()) {
|
||||||
|
return "" + stack.getOrCreateTag().getInt("max_ammo");
|
||||||
|
}
|
||||||
|
|
||||||
if (stack.is(TargetModTags.Items.RIFLE)) {
|
if (stack.is(TargetModTags.Items.RIFLE)) {
|
||||||
return "" + (player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo;
|
return "" + (player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo;
|
||||||
}
|
}
|
||||||
|
@ -194,6 +195,18 @@ public class AmmoBarOverlay {
|
||||||
return " Arrow";
|
return " Arrow";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (stack.getItem() == TargetModItems.M_79.get()) {
|
||||||
|
return "40mm Grenade";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack.getItem() == TargetModItems.RPG.get()) {
|
||||||
|
return "Yassin105 TBG";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack.getItem() == TargetModItems.TASER.get()) {
|
||||||
|
return "Electrode Rod";
|
||||||
|
}
|
||||||
|
|
||||||
if (stack.getItem() == TargetModItems.MINIGUN.get()) {
|
if (stack.getItem() == TargetModItems.MINIGUN.get()) {
|
||||||
return "Rifle Ammo";
|
return "Rifle Ammo";
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,6 +195,6 @@ public class Hk416Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGunDisplayName() {
|
public String getGunDisplayName() {
|
||||||
return "HK416";
|
return " HK-416";
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -211,6 +211,6 @@ public class MarlinItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGunDisplayName() {
|
public String getGunDisplayName() {
|
||||||
return "MARLIN 1895";
|
return " MARLIN-1895";
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -195,6 +195,6 @@ public class Mk14Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGunDisplayName() {
|
public String getGunDisplayName() {
|
||||||
return "MK-14EBR";
|
return " MK-14";
|
||||||
}
|
}
|
||||||
}
|
}
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 4 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 119 B After Width: | Height: | Size: 119 B |
Before Width: | Height: | Size: 117 B After Width: | Height: | Size: 117 B |
Before Width: | Height: | Size: 112 B After Width: | Height: | Size: 112 B |
Before Width: | Height: | Size: 114 B After Width: | Height: | Size: 114 B |
Before Width: | Height: | Size: 7 KiB After Width: | Height: | Size: 7 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 7 KiB After Width: | Height: | Size: 7 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.2 KiB |