mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-08-10 17:55:44 +00:00
GRENADE IN MY US HOLL
This commit is contained in:
parent
fc0418fda8
commit
d03abeecdd
@ -16,6 +16,7 @@ import com.hbm.explosion.vanillant.standard.ExplosionEffectWeapon;
|
||||
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
|
||||
import com.hbm.items.ItemEnumMulti;
|
||||
import com.hbm.items.weapon.grenade.ItemGrenadeShell.EnumGrenadeShell;
|
||||
import static com.hbm.items.weapon.grenade.ItemGrenadeShell.EnumGrenadeShell.*;
|
||||
import com.hbm.items.weapon.sedna.BulletConfig;
|
||||
import com.hbm.items.weapon.sedna.factory.Lego;
|
||||
|
||||
@ -33,22 +34,26 @@ public class ItemGrenadeFilling extends ItemEnumMulti {
|
||||
}
|
||||
|
||||
public static enum EnumGrenadeFilling {
|
||||
POWDER(EXPLODE_POWDER), // gunpowder
|
||||
HE(EXPLODE_HE), // high explosive
|
||||
FRAG(EXPLODE_FRAG), // high explosive with fragmentation
|
||||
DEMO(EXPLODE_DEMO), // demolition
|
||||
INC(null), // incendiary
|
||||
CLUSTER(EXPLODE_CLUSTER), // explosive pellets
|
||||
NUCLEAR(null); // nuka grenade
|
||||
POWDER(EXPLODE_POWDER, 0x424242, 0x939176, FRAG, STICK), // gunpowder
|
||||
HE(EXPLODE_HE, 0x595533, 0xA49D62, FRAG, STICK), // high explosive
|
||||
HE_FRAG(EXPLODE_FRAG, 0x595533, 0xE0BA29, FRAG, STICK), // high explosive with fragmentation
|
||||
DEMO(EXPLODE_DEMO, 0x595533, 0xDD4029, FRAG, STICK), // demolition
|
||||
INC(null, 0x5A5A5A, 0xFF5F21, FRAG, STICK), // incendiary
|
||||
CLUSTER(EXPLODE_CLUSTER, 0x5A5A5A, 0xFFC711, FRAG, STICK), // explosive pellets
|
||||
NUCLEAR(null, 0, 0, NUKE); // nuka grenade
|
||||
|
||||
// and more which i haven't decided. probably plasma, EMP, perhaps laser(?)
|
||||
|
||||
public Consumer<EntityGrenadeUniversal> explode;
|
||||
public Set<EnumGrenadeShell> compatibleShells = new HashSet();
|
||||
public int bodyColor;
|
||||
public int labelColor;
|
||||
|
||||
private EnumGrenadeFilling(Consumer<EntityGrenadeUniversal> explode, EnumGrenadeShell... compatibleShells) {
|
||||
private EnumGrenadeFilling(Consumer<EntityGrenadeUniversal> explode, int bodyColor, int labelColor, EnumGrenadeShell... compatibleShells) {
|
||||
this.explode = explode;
|
||||
for(EnumGrenadeShell shell : compatibleShells) this.compatibleShells.add(shell);
|
||||
this.bodyColor = bodyColor;
|
||||
this.labelColor = labelColor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -15,20 +15,22 @@ public class ItemGrenadeFuze extends ItemEnumMulti {
|
||||
}
|
||||
|
||||
public static enum EnumGrenadeFuze {
|
||||
S3(FUZE_3S), // 3s timed
|
||||
S7(FUZE_7S), // 7s times
|
||||
S15(FUZE_15S), // 15s timed
|
||||
IMPACT(FUZE_IMPACT), // on block/entity impact, 0.5s safety
|
||||
AIRBURST(null, null); // still have to figure out the mechanics, whether it should be an arc angle or fixed height over the floor, 2s safety
|
||||
S3(FUZE_3S, 0x000000), // 3s timed
|
||||
S7(FUZE_7S, 0x404040), // 7s times
|
||||
S15(FUZE_15S, 0x808080), // 15s timed
|
||||
IMPACT(FUZE_IMPACT, 0xE36C17), // on block/entity impact, 0.5s safety
|
||||
AIRBURST(null, null, 0xD11EB8); // still have to figure out the mechanics, whether it should be an arc angle or fixed height over the floor, 2s safety
|
||||
|
||||
public Consumer<EntityGrenadeUniversal> updateTick;
|
||||
public BiConsumer<EntityGrenadeUniversal, MovingObjectPosition> onImpact;
|
||||
public int bandColor;
|
||||
|
||||
private EnumGrenadeFuze(Consumer<EntityGrenadeUniversal> updateTick) { this(updateTick, null); }
|
||||
private EnumGrenadeFuze(BiConsumer<EntityGrenadeUniversal, MovingObjectPosition> onImpact) { this(null, onImpact); }
|
||||
private EnumGrenadeFuze(Consumer<EntityGrenadeUniversal> updateTick, BiConsumer<EntityGrenadeUniversal, MovingObjectPosition> onImpact) {
|
||||
private EnumGrenadeFuze(Consumer<EntityGrenadeUniversal> updateTick, int color) { this(updateTick, null, color); }
|
||||
private EnumGrenadeFuze(BiConsumer<EntityGrenadeUniversal, MovingObjectPosition> onImpact, int color) { this(null, onImpact, color); }
|
||||
private EnumGrenadeFuze(Consumer<EntityGrenadeUniversal> updateTick, BiConsumer<EntityGrenadeUniversal, MovingObjectPosition> onImpact, int color) {
|
||||
this.updateTick = updateTick;
|
||||
this.onImpact = onImpact;
|
||||
this.bandColor = color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -130,17 +130,10 @@ public class ItemGrenadeUniversal extends Item implements IEquipReceiver {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
// some demo crap
|
||||
list.add(make(EnumGrenadeShell.STICK, EnumGrenadeFilling.HE, EnumGrenadeFuze.S3));
|
||||
list.add(make(EnumGrenadeShell.STICK, EnumGrenadeFilling.HE, EnumGrenadeFuze.IMPACT));
|
||||
list.add(make(EnumGrenadeShell.STICK, EnumGrenadeFilling.DEMO, EnumGrenadeFuze.S7));
|
||||
list.add(make(EnumGrenadeShell.FRAG, EnumGrenadeFilling.POWDER, EnumGrenadeFuze.S3));
|
||||
list.add(make(EnumGrenadeShell.FRAG, EnumGrenadeFilling.FRAG, EnumGrenadeFuze.S3));
|
||||
list.add(make(EnumGrenadeShell.FRAG, EnumGrenadeFilling.FRAG, EnumGrenadeFuze.IMPACT));
|
||||
list.add(make(EnumGrenadeShell.FRAG, EnumGrenadeFilling.INC, EnumGrenadeFuze.S7));
|
||||
list.add(make(EnumGrenadeShell.FRAG, EnumGrenadeFilling.CLUSTER, EnumGrenadeFuze.S3));
|
||||
list.add(make(EnumGrenadeShell.TECH, EnumGrenadeFilling.NUCLEAR, EnumGrenadeFuze.S15));
|
||||
list.add(make(EnumGrenadeShell.NUKE, EnumGrenadeFilling.NUCLEAR, EnumGrenadeFuze.S15));
|
||||
|
||||
for(EnumGrenadeShell shell : EnumGrenadeShell.values()) for(EnumGrenadeFilling filling : EnumGrenadeFilling.values()) {
|
||||
if(filling.compatibleShells.contains(shell)) for(EnumGrenadeFuze fuze : EnumGrenadeFuze.values()) list.add(make(shell, filling, fuze));
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@ -1105,6 +1105,9 @@ public class ResourceManager {
|
||||
public static final ResourceLocation grenade_mk2 = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/grenade_mk2.png");
|
||||
public static final ResourceLocation grenade_aschrab_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/grenade_aschrab.png");
|
||||
public static final ResourceLocation grenade_frag_tex = new ResourceLocation(RefStrings.MODID, "textures/models/grenades/frag.png");
|
||||
public static final ResourceLocation grenade_frag_body_tex = new ResourceLocation(RefStrings.MODID, "textures/models/grenades/frag_body.png");
|
||||
public static final ResourceLocation grenade_frag_label_tex = new ResourceLocation(RefStrings.MODID, "textures/models/grenades/frag_label.png");
|
||||
public static final ResourceLocation grenade_frag_fuze_tex = new ResourceLocation(RefStrings.MODID, "textures/models/grenades/frag_fuze.png");
|
||||
public static final ResourceLocation grenade_stick_tex = new ResourceLocation(RefStrings.MODID, "textures/models/grenades/stick.png");
|
||||
public static final ResourceLocation grenade_tech_tex = new ResourceLocation(RefStrings.MODID, "textures/models/grenades/tech.png");
|
||||
public static final ResourceLocation grenade_nuka_tex = new ResourceLocation(RefStrings.MODID, "textures/models/grenades/nuka.png");
|
||||
|
||||
@ -21,6 +21,7 @@ public class RenderGrenadeUniversal extends Render {
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
|
||||
EntityGrenadeUniversal grenade = (EntityGrenadeUniversal) entity;
|
||||
|
||||
@ -39,6 +40,7 @@ public class RenderGrenadeUniversal extends Render {
|
||||
ItemStack stack = grenade.getGrenadeItem();
|
||||
ItemRenderGrenade.renderGrenade(stack, null);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
@ -1,15 +1,20 @@
|
||||
package com.hbm.render.item;
|
||||
|
||||
import com.hbm.items.weapon.grenade.ItemGrenadeFilling.EnumGrenadeFilling;
|
||||
import com.hbm.items.weapon.grenade.ItemGrenadeFuze.EnumGrenadeFuze;
|
||||
import com.hbm.items.weapon.grenade.ItemGrenadeShell.EnumGrenadeShell;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.items.weapon.grenade.ItemGrenadeUniversal;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.util.ColorUtil;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
public class ItemRenderGrenade implements IItemRenderer {
|
||||
@ -70,11 +75,11 @@ public class ItemRenderGrenade implements IItemRenderer {
|
||||
|
||||
GL11.glScaled(0.125, 0.125, 0.125);
|
||||
GL11.glTranslated(3, 1, -3);
|
||||
GL11.glRotated(135, 0, -1, 0);
|
||||
GL11.glRotated(180, 0, -1, 0);
|
||||
|
||||
if(shell == EnumGrenadeShell.FRAG) {
|
||||
renderFragBody(stack);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(ResourceManager.grenade_frag_tex);
|
||||
ResourceManager.grenades.renderPart("Frag");
|
||||
ResourceManager.grenades.renderPart("FragSpoon");
|
||||
ResourceManager.grenades.renderPart("FragRing");
|
||||
}
|
||||
@ -110,9 +115,9 @@ public class ItemRenderGrenade implements IItemRenderer {
|
||||
if(renderType == null) {
|
||||
GL11.glTranslated(0, -2, 0);
|
||||
}
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(ResourceManager.grenade_frag_tex);
|
||||
ResourceManager.grenades.renderPart("Frag");
|
||||
renderFragBody(stack);
|
||||
if(renderType != null) {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(ResourceManager.grenade_frag_tex);
|
||||
ResourceManager.grenades.renderPart("FragSpoon");
|
||||
ResourceManager.grenades.renderPart("FragRing");
|
||||
}
|
||||
@ -177,4 +182,35 @@ public class ItemRenderGrenade implements IItemRenderer {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void renderFragBody(ItemStack stack) {
|
||||
|
||||
EnumGrenadeFilling filling = ItemGrenadeUniversal.getFilling(stack);
|
||||
EnumGrenadeFuze fuze = ItemGrenadeUniversal.getFuze(stack);
|
||||
|
||||
bind(ResourceManager.grenade_frag_tex);
|
||||
ResourceManager.grenades.renderPart("Frag");
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
|
||||
GL11.glColor3f(ColorUtil.fr(filling.bodyColor), ColorUtil.fg(filling.bodyColor), ColorUtil.fb(filling.bodyColor));
|
||||
bind(ResourceManager.grenade_frag_body_tex);
|
||||
ResourceManager.grenades.renderPart("Frag");
|
||||
|
||||
GL11.glColor3f(ColorUtil.fr(filling.labelColor), ColorUtil.fg(filling.labelColor), ColorUtil.fb(filling.labelColor));
|
||||
bind(ResourceManager.grenade_frag_label_tex);
|
||||
ResourceManager.grenades.renderPart("Frag");
|
||||
|
||||
GL11.glColor3f(ColorUtil.fr(fuze.bandColor), ColorUtil.fg(fuze.bandColor), ColorUtil.fb(fuze.bandColor));
|
||||
bind(ResourceManager.grenade_frag_fuze_tex);
|
||||
ResourceManager.grenades.renderPart("Frag");
|
||||
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
public static void bind(ResourceLocation res) {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(res);
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 819 B After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 434 B |
Binary file not shown.
|
After Width: | Height: | Size: 161 B |
Binary file not shown.
|
After Width: | Height: | Size: 328 B |
Loading…
x
Reference in New Issue
Block a user