some HIMARS rendering stuff, cargo shell impact fix

This commit is contained in:
Bob 2022-10-13 22:55:19 +02:00
parent 00b6ef249e
commit 0c5b2bcf57
8 changed files with 67 additions and 10 deletions

View File

@ -203,6 +203,7 @@ public class EntityMappings {
addEntity(EntityMinecartSemtex.class, "entity_ntm_cart_semtex", 250, false);
addEntity(EntityNukeTorex.class, "entity_effect_torex", 250, false);
addEntity(EntityArtilleryShell.class, "entity_artillery_shell", 1000);
addEntity(EntityArtilleryRocket.class, "entity_himars", 1000);
addEntity(EntitySiegeTunneler.class, "entity_meme_tunneler", 1000);
addEntity(EntitySPV.class, "entity_self_propelled_vehicle_mark_1", 1000);
addEntity(EntityCog.class, "entity_stray_cog", 1000);

View File

@ -259,6 +259,9 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile {
this.stuckBlockZ = z;
this.stuckBlock = worldObj.getBlock(x, y, z);
this.inGround = true;
this.motionX = 0;
this.motionY = 0;
this.motionZ = 0;
}
public double getGravityVelocity() {

View File

@ -44,14 +44,12 @@ public class ItemAmmoHIMARS extends Item {
public abstract class HIMARSRocket {
ResourceLocation texture;
int amount;
int modelType; /* 0 = sixfold/standard ; 1 = single */
public HIMARSRocket() { }
public final ResourceLocation texture;
public final int amount;
public final int modelType; /* 0 = sixfold/standard ; 1 = single */
public HIMARSRocket(String name, int type, int amount) {
this.texture = new ResourceLocation(RefStrings.MODID + ":textures/models/projectiles/" + name);
this.texture = new ResourceLocation(RefStrings.MODID + ":textures/models/projectiles/" + name + ".png");
this.amount = amount;
this.modelType = type;
}

View File

@ -561,6 +561,7 @@ public class ClientProxy extends ServerProxy {
RenderingRegistry.registerEntityRenderingHandler(EntityRBMKDebris.class, new RenderRBMKDebris());
RenderingRegistry.registerEntityRenderingHandler(EntityZirnoxDebris.class, new RenderZirnoxDebris());
RenderingRegistry.registerEntityRenderingHandler(EntityArtilleryShell.class, new RenderArtilleryShell());
RenderingRegistry.registerEntityRenderingHandler(EntityArtilleryRocket.class, new RenderArtilleryRocket());
RenderingRegistry.registerEntityRenderingHandler(EntityCog.class, new RenderCog());
RenderingRegistry.registerEntityRenderingHandler(EntitySawblade.class, new RenderSawblade());
RenderingRegistry.registerEntityRenderingHandler(EntityChemical.class, new RenderChemical());

View File

@ -0,0 +1,39 @@
package com.hbm.render.entity.projectile;
import org.lwjgl.opengl.GL11;
import com.hbm.items.weapon.ItemAmmoHIMARS;
import com.hbm.main.ResourceManager;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
public class RenderArtilleryRocket extends Render {
@Override
public void doRender(Entity shell, double x, double y, double z, float f0, float f1) {
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
GL11.glRotatef(shell.prevRotationYaw + (shell.rotationYaw - shell.prevRotationYaw) * f1 - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(shell.prevRotationPitch + (shell.rotationPitch - shell.prevRotationPitch) * f1 - 90, 0.0F, 0.0F, 1.0F);
this.bindEntityTexture(shell);
boolean fog = GL11.glIsEnabled(GL11.GL_FOG);
if(fog) GL11.glDisable(GL11.GL_FOG);
GL11.glShadeModel(GL11.GL_SMOOTH);
ResourceManager.turret_himars.renderPart("RocketStandard");
GL11.glShadeModel(GL11.GL_FLAT);
if(fog) GL11.glEnable(GL11.GL_FOG);
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
return ItemAmmoHIMARS.itemTypes[0].texture;
}
}

View File

@ -7,6 +7,8 @@ import org.lwjgl.opengl.GL11;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.generic.BlockBobble.BobbleType;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.ItemAmmoHIMARS;
import com.hbm.items.weapon.ItemAmmoHIMARS.HIMARSRocket;
import com.hbm.main.ResourceManager;
import com.hbm.render.tileentity.RenderBobble;
import com.hbm.render.tileentity.RenderDemonLamp;
@ -1356,6 +1358,20 @@ public class ItemRenderLibrary {
ResourceManager.sawmill.renderPart("Blade");
}});
renderers.put(ModItems.ammo_himars, new ItemRenderBase( ) {
public void renderInventory() {
GL11.glTranslated(0, 2.5, 0);
GL11.glScaled(4, 4, 4);
}
public void renderCommonWithStack(ItemStack item) {
GL11.glRotated(-45, 0, 1, 0);
GL11.glRotated(90, 1, 0, 0);
HIMARSRocket type = ItemAmmoHIMARS.itemTypes[item.getItemDamage()];
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(type.texture); ResourceManager.turret_himars.renderPart(type.modelType == 0 ? "RocketStandard" : "RocketSingle");
GL11.glShadeModel(GL11.GL_FLAT);
}});
//hi there! it seems you are trying to register a new item renderer, most likely for a tile entity.
//please refer to the comment at the start of the file on how to do this without adding to this gigantic pile of feces.
}

View File

@ -38,16 +38,15 @@ public class RenderTurretHIMARS extends TileEntitySpecialRenderer implements IIt
ResourceManager.turret_himars.renderPart("Carriage");
GL11.glTranslated(0, 2.25, 2);
GL11.glRotated(pitch + 15, 1, 0, 0);
GL11.glRotated(pitch, 1, 0, 0);
GL11.glTranslated(0, -2.25, -2);
ResourceManager.turret_himars.renderPart("Launcher");
//GL11.glTranslated(0, 0, -5 + (System.currentTimeMillis() / 1000D) % 5D);
ResourceManager.turret_himars.renderPart("Crane");
bindTexture(ResourceManager.himars_standard_tex);
ResourceManager.turret_himars.renderPart("TubeStandard");
ResourceManager.turret_himars.renderPart("CapStandard1");
/*ResourceManager.turret_himars.renderPart("CapStandard1");
ResourceManager.turret_himars.renderPart("CapStandard2");
ResourceManager.turret_himars.renderPart("CapStandard4");
ResourceManager.turret_himars.renderPart("CapStandard4");*/
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB