Fixed the nuke rendering not being added

This commit is contained in:
2026-06-19 13:01:32 -05:00
parent e5a7ce4b3d
commit 1b120edd93
11 changed files with 121 additions and 18 deletions

View File

@@ -1,5 +1,7 @@
package net.minecraft.src;
import net.minecraft.src.mml.Entities.EntityNukePrimed;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -167,5 +169,7 @@ public class EntityList {
addMapping(EntityIronGolem.class, "VillagerGolem", 99);
addMapping(EntityVillager.class, "Villager", 120, 5651507, 12422002);
addMapping(EntityEnderCrystal.class, "EnderCrystal", 200);
addMapping(EntityNukePrimed.class, "PrimedNuke", 100);
}
}

View File

@@ -1,5 +1,7 @@
package net.minecraft.src;
import net.minecraft.src.mml.Entities.EntityNukePrimed;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
@@ -78,6 +80,8 @@ public class EntityTracker {
this.addEntityToTracker(var1, 256, Integer.MAX_VALUE, false);
} else if(var1 instanceof EntityItemFrame) {
this.addEntityToTracker(var1, 160, Integer.MAX_VALUE, false);
} /*bmCustomEntity*/else if(var1 instanceof EntityNukePrimed) {
this.addEntityToTracker(var1, 160, 3, true);
}
}

View File

@@ -1,5 +1,7 @@
package net.minecraft.src;
import net.minecraft.src.mml.Entities.EntityNukePrimed;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -359,6 +361,8 @@ public class EntityTrackerEntry {
return new Packet23VehicleSpawn(this.myEntity, 62);
} else if(this.myEntity instanceof EntityTNTPrimed) {
return new Packet23VehicleSpawn(this.myEntity, 50);
} /*bmCustomEntity*/else if(this.myEntity instanceof EntityNukePrimed) {
return new Packet23VehicleSpawn(this.myEntity, 300);
} else if(this.myEntity instanceof EntityEnderCrystal) {
return new Packet23VehicleSpawn(this.myEntity, 51);
} else if(this.myEntity instanceof EntityFallingSand) {

View File

@@ -16,7 +16,7 @@ public class Explosion {
public boolean isWasting = false;
public boolean isWatering = false;
public boolean isCustomExplosion = false;
@@ -131,7 +131,12 @@ public class Explosion {
}
public void doExplosionB(boolean var1) {
this.worldObj.playSoundEffect(this.explosionX, this.explosionY, this.explosionZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
if (!this.isCustomExplosion) {
this.worldObj.playSoundEffect(this.explosionX, this.explosionY, this.explosionZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
} else if (isCustomExplosion) {
this.worldObj.playSoundEffect(this.explosionX, this.explosionY, this.explosionZ, "mod.boom", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
}
if(this.explosionSize >= 2.0F && this.isSmoking) {
this.worldObj.spawnParticle("hugeexplosion", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D);
} else {

View File

@@ -19,6 +19,7 @@ import java.util.Map;
import java.util.Random;
import javax.crypto.SecretKey;
import net.minecraft.client.Minecraft;
import net.minecraft.src.mml.Entities.EntityNukePrimed;
import org.lwjgl.input.Keyboard;
public class NetClientHandler extends NetHandler {
@@ -179,6 +180,8 @@ public class NetClientHandler extends NetHandler {
} else if(var1.type == 70) {
var8 = new EntityFallingSand(this.worldClient, var2, var4, var6, var1.throwerEntityId & '\uffff', var1.throwerEntityId >> 16);
var1.throwerEntityId = 0;
} /*bmCustomEntry*/else if(var1.type == 300) {
var8 = new EntityNukePrimed(this.worldClient, var2, var4, var6, (EntityLiving)null);
}
if(var8 != null) {

View File

@@ -3,6 +3,9 @@ package net.minecraft.src;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import net.minecraft.src.mml.Entities.EntityNukePrimed;
import net.minecraft.src.mml.Render.RenderNukePrimed;
import org.lwjgl.opengl.GL11;
public class RenderManager {
@@ -80,6 +83,12 @@ public class RenderManager {
this.entityRenderMap.put(EntityBoat.class, new RenderBoat());
this.entityRenderMap.put(EntityFishHook.class, new RenderFish());
this.entityRenderMap.put(EntityLightningBolt.class, new RenderLightningBolt());
this.entityRenderMap.put(EntityNukePrimed.class, new RenderNukePrimed());
Iterator var1 = this.entityRenderMap.values().iterator();
while(var1.hasNext()) {

View File

@@ -1677,6 +1677,7 @@ public abstract class World implements IBlockAccess {
var11.isSmoking = var10;
var11.isWasting = isWasting;
var11.isWatering = isWatering;
var11.isCustomExplosion = true;
var11.doExplosionA();
var11.doExplosionB(true);
return var11;

View File

@@ -16,7 +16,7 @@ public class BlockNuke extends Block {
}
public Icon getIcon(int side, int var2) {
return side == 0 ? this.TextureBottom : (side == 1 ? this.TextureTop : this.blockIcon);
return side == 0 ? this.TextureBottom : (side == 1 ? this.TextureTop : (side == 2 ? this.TextureTop : this.blockIcon));
}
public void onBlockAdded(World var1, int var2, int var3, int var4) {

View File

@@ -60,13 +60,17 @@ public class EntityNukePrimed extends Entity {
this.motionY *= -0.5D;
}
this.moveEntity(this.motionX, this.motionY, this.motionZ);
// Spawn smoke fizz while ticking down on the client side
if (this.worldObj.isRemote) {
this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D);
}
if (this.fuse-- <= 0) {
this.setDead();
if (!this.worldObj.isRemote) {
this.explode();
} else {
this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ , 0.0D, 0.0D, 0.0D);
}
}
@@ -78,9 +82,11 @@ public class EntityNukePrimed extends Entity {
}
protected void writeEntityToNBT(NBTTagCompound var1) {
var1.setByte("Fuse", (byte)this.fuse);
}
protected void readEntityFromNBT(NBTTagCompound var1) {
this.fuse = var1.getByte("Fuse");
}
public float getShadowSize() {

View File

@@ -0,0 +1,59 @@
package net.minecraft.src.mml.Render;
import net.minecraft.src.Block;
import net.minecraft.src.Entity;
import net.minecraft.src.Render;
import net.minecraft.src.RenderBlocks;
import net.minecraft.src.mml.Entities.EntityNukePrimed;
import org.lwjgl.opengl.GL11;
public class RenderNukePrimed extends Render {
private RenderBlocks blockRenderer = new RenderBlocks();
public RenderNukePrimed() {
this.shadowSize = 0.5F;
}
public void renderPrimedNuke(EntityNukePrimed var1, double var2, double var4, double var6, float var8, float var9) {
GL11.glPushMatrix();
GL11.glTranslatef((float)var2, (float)var4, (float)var6);
float var10;
if((float)var1.fuse - var9 + 1.0F < 10.0F) {
var10 = 1.0F - ((float)var1.fuse - var9 + 1.0F) / 10.0F;
if(var10 < 0.0F) {
var10 = 0.0F;
}
if(var10 > 1.0F) {
var10 = 1.0F;
}
var10 *= var10;
var10 *= var10;
float var11 = 1.0F + var10 * 0.3F;
GL11.glScalef(var11, var11, var11);
}
var10 = (1.0F - ((float)var1.fuse - var9 + 1.0F) / 100.0F) * 0.8F;
this.loadTexture("/terrain.png");
this.blockRenderer.renderBlockAsItem(Block.nuke, 0, var1.getBrightness(var9));
if(var1.fuse / 5 % 2 == 0) {
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA);
GL11.glColor4f(1.0F, 1.0F, 1.0F, var10);
this.blockRenderer.renderBlockAsItem(Block.tnt, 0, 1.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
GL11.glPopMatrix();
}
public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) {
this.renderPrimedNuke((EntityNukePrimed)var1, var2, var4, var6, var8, var9);
}
}