Updated rubble, added rubble and grenade sounds, new pulse-gren function

This commit is contained in:
HbmMods 2018-10-18 23:31:03 +02:00
parent f96761f8ae
commit f73ed4cfdc
24 changed files with 200 additions and 49 deletions

View File

@ -1088,7 +1088,7 @@ item.grenade_if_impact.name=IF - Impact Grenade
item.grenade_if_incendiary.name=IF - Incendiary Grenade
item.grenade_if_toxic.name=IF - Toxic Grenade
item.grenade_if_concussion.name=IF - Concussion Grenade
item.grenade_if_brimstone.name=IF - Tossable Brimsstone Mine
item.grenade_if_brimstone.name=IF - Tossable Brimstone Mine
item.grenade_if_mystery.name=IF - M.-Grenade
item.grenade_if_spark.name=IF - S.-Grenade
item.grenade_if_hopwire.name=IF - Black Hole Hopwire

View File

@ -25,6 +25,7 @@
"block.vaultThudNew": {"category": "block", "sounds": [{"name": "block/vaultThudNew", "stream": false}]},
"block.lockOpen": {"category": "block", "sounds": [{"name": "block/lockOpen", "stream": false}]},
"block.lockHang": {"category": "block", "sounds": [{"name": "block/lockHang", "stream": false}]},
"block.debris": {"category": "block", "sounds": ["block/debris1", "block/debris2", "block/debris3"]},
"item.techBleep": {"category": "player", "sounds": [{"name": "tool/techBleep", "stream": false}]},
"item.techBoop": {"category": "player", "sounds": [{"name": "tool/techBoop", "stream": false}]},
@ -82,6 +83,7 @@
"weapon.laserBang": {"category": "player", "sounds": ["weapon/laserBang1", "weapon/laserBang2", "weapon/laserBang3"]},
"weapon.uziShoot": {"category": "player", "sounds": [{"name": "weapon/uziShoot", "stream": false}]},
"weapon.silencerShoot": {"category": "player", "sounds": [{"name": "weapon/silencerShoot", "stream": false}]},
"weapon.gBounce": {"category": "player", "sounds": ["weapon/gBounce1", "weapon/gBounce2", "weapon/gBounce3"]},
"weapon.reloadTurret": {"category": "player", "sounds": [{"name": "weapon/reloadTurret", "stream": false}]},
"weapon.switchmode1": {"category": "player", "sounds": [{"name": "weapon/switchmode1", "stream": false}]},

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

View File

@ -61,7 +61,7 @@ public class EntityBlackHole extends Entity {
rubble.posX = x0 + 0.5F;
rubble.posY = y0;
rubble.posZ = z0 + 0.5F;
rubble.setMetaBasedOnMat(worldObj.getBlock(x0, y0, z0).getMaterial());
rubble.setMetaBasedOnBlock(worldObj.getBlock(x0, y0, z0), worldObj.getBlockMetadata(x0, y0, z0));
worldObj.spawnEntityInWorld(rubble);

View File

@ -146,6 +146,11 @@ public abstract class EntityGrenadeBouncyBase extends Entity implements IProject
bounce = true;
Vec3 mot = Vec3.createVectorHelper(motionX, motionY, motionZ);
if(mot.lengthVector() > 0.05)
worldObj.playSoundAtEntity(this, "hbm:weapon.gBounce", 2.0F, 1.0F);
motionX *= getBounceMod();
motionY *= getBounceMod();
motionZ *= getBounceMod();

View File

@ -1,7 +1,12 @@
package com.hbm.entity.projectile;
import com.hbm.lib.ModDamageSource;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.ParticleBurstPacket;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.util.MovingObjectPosition;
@ -21,7 +26,8 @@ public class EntityRubble extends EntityThrowable {
@Override
public void entityInit() {
this.dataWatcher.addObject(16, Byte.valueOf((byte)0));
this.dataWatcher.addObject(16, (int)Integer.valueOf(0));
this.dataWatcher.addObject(17, (int)Integer.valueOf(0));
}
public EntityRubble(World p_i1775_1_, double p_i1775_2_, double p_i1775_4_, double p_i1775_6_)
@ -41,25 +47,18 @@ public class EntityRubble extends EntityThrowable {
if(this.ticksExisted > 2) {
this.setDead();
if(!this.worldObj.isRemote)
worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 0.1F, true);
worldObj.playSoundAtEntity(this, "hbm:block.debris", 1.5F, 1.0F);
//worldObj.playAuxSFX(2001, (int)posX, (int)posY, (int)posZ, this.dataWatcher.getWatchableObjectInt(16) + (this.dataWatcher.getWatchableObjectInt(17) << 12));
if(!worldObj.isRemote)
PacketDispatcher.wrapper.sendToAll(new ParticleBurstPacket((int)posX - 1, (int)posY, (int)posZ - 1, this.dataWatcher.getWatchableObjectInt(16), this.dataWatcher.getWatchableObjectInt(17)));
}
}
public void setMetaBasedOnMat(Material mat) {
if(mat == Material.anvil || mat == Material.iron)
this.dataWatcher.updateObject(16, (byte)0);
else if(mat == Material.rock || mat == Material.piston || mat == Material.redstoneLight)
this.dataWatcher.updateObject(16, (byte)1);
else if(mat == Material.cactus || mat == Material.coral || mat == Material.gourd || mat == Material.leaves || mat == Material.plants || mat == Material.sponge)
this.dataWatcher.updateObject(16, (byte)2);
else if(mat == Material.clay || mat == Material.sand)
this.dataWatcher.updateObject(16, (byte)3);
else if(mat == Material.ground || mat == Material.grass)
this.dataWatcher.updateObject(16, (byte)4);
else if(mat == Material.wood)
this.dataWatcher.updateObject(16, (byte)5);
else
this.dataWatcher.updateObject(16, (byte)6);
public void setMetaBasedOnBlock(Block b, int i) {
this.dataWatcher.updateObject(16, Block.getIdFromBlock(b));
this.dataWatcher.updateObject(17, i);
}
}

View File

@ -395,6 +395,10 @@ public class ExplosionChaos {
public static void pDestruction(World world, int x, int y, int z) {
EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double)((float)x + 0.5F), (double)((float)y + 0.5F), (double)((float)z + 0.5F), world.getBlock(x, y, z), world.getBlockMetadata(x, y, z));
world.spawnEntityInWorld(entityfallingblock);
/*
if (Blocks.air.getBlockHardness(world, x, y, z) != Float.POSITIVE_INFINITY) {
Block b = world.getBlock(x, y, z);
TileEntity t = world.getTileEntity(x, y, z);
@ -439,7 +443,7 @@ public class ExplosionChaos {
world.setBlock(x, y, z, ModBlocks.block_scrap);
else
world.setBlock(x, y, z, Blocks.air);
}
}*/
}
public static void cluster(World world, int x, int y, int z, int count, int gravity) {
@ -1242,7 +1246,7 @@ public class ExplosionChaos {
rubble.posZ = j + 0.5F;
rubble.motionY = 0.025F * 10 + 0.15F;
rubble.setMetaBasedOnMat(b.getMaterial());
rubble.setMetaBasedOnBlock(b, world.getBlockMetadata(i, y, j));
world.spawnEntityInWorld(rubble);

View File

@ -88,7 +88,7 @@ public class ExplosionLarge {
rubble.motionY = 0.75 * (1 + ((count + rand.nextInt(count * 5))) / 25);
rubble.motionX = rand.nextGaussian() * 0.75 * (1 + (count / 50));
rubble.motionZ = rand.nextGaussian() * 0.75 * (1 + (count / 50));
rubble.getDataWatcher().updateObject(16, (byte)rand.nextInt(7));
rubble.setMetaBasedOnBlock(Blocks.stone, 0);
world.spawnEntityInWorld(rubble);
}
}
@ -235,7 +235,7 @@ public class ExplosionLarge {
rubble.posX = x0 + 0.5F;
rubble.posY = y0 + 0.5F;
rubble.posZ = z0 + 0.5F;
rubble.setMetaBasedOnMat(world.getBlock((int)x0, (int)y0, (int)z0).getMaterial());
rubble.setMetaBasedOnBlock(world.getBlock((int)x0, (int)y0, (int)z0), world.getBlockMetadata((int)x0, (int)y0, (int)z0));
Vec3 vec4 = Vec3.createVectorHelper(posX - rubble.posX, posY - rubble.posY, posZ - rubble.posZ);
vec4.normalize();

View File

@ -2126,7 +2126,7 @@ public class ModItems {
grenade_if_concussion = new ItemGrenade(4).setUnlocalizedName("grenade_if_concussion").setCreativeTab(null).setTextureName(RefStrings.MODID + ":grenade_if_concussion");
grenade_if_brimstone = new ItemGrenade(5).setUnlocalizedName("grenade_if_brimstone").setCreativeTab(null).setTextureName(RefStrings.MODID + ":grenade_if_brimstone");
grenade_if_mystery = new ItemGrenade(5).setUnlocalizedName("grenade_if_mystery").setCreativeTab(null).setTextureName(RefStrings.MODID + ":grenade_if_mystery");
grenade_if_spark = new ItemGrenade(5).setUnlocalizedName("grenade_if_spark").setCreativeTab(null).setTextureName(RefStrings.MODID + ":grenade_if_spark");
grenade_if_spark = new ItemGrenade(7).setUnlocalizedName("grenade_if_spark").setCreativeTab(null).setTextureName(RefStrings.MODID + ":grenade_if_spark");
grenade_if_hopwire = new ItemGrenade(7).setUnlocalizedName("grenade_if_hopwire").setCreativeTab(null).setTextureName(RefStrings.MODID + ":grenade_if_hopwire");
grenade_if_null = new ItemGrenade(7).setUnlocalizedName("grenade_if_null").setCreativeTab(null).setTextureName(RefStrings.MODID + ":grenade_if_null");

View File

@ -159,7 +159,7 @@ public class WeaponSpecial extends ItemSword {
rubble.posY = y;
rubble.posZ = z + 0.5F;
rubble.setMetaBasedOnMat(world.getBlock(x, y, z).getMaterial());
rubble.setMetaBasedOnBlock(world.getBlock(x, y, z), world.getBlockMetadata(x, y, z));
Vec3 vec = player.getLookVec();
double dX = vec.xCoord * 5;

View File

@ -185,7 +185,7 @@ public class ItemMultitoolPassive extends Item {
rubble.posZ = z1 + 0.5F;
rubble.motionY = 0.025F * w1 + 0.15F;
rubble.setMetaBasedOnMat(b.getMaterial());
rubble.setMetaBasedOnBlock(b, world.getBlockMetadata(x1, y1, z1));
world.spawnEntityInWorld(rubble);

View File

@ -49,6 +49,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
public class ItemGrenade extends Item {
@ -234,6 +235,59 @@ public class ItemGrenade extends Item {
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
list.add("Fuse: " + translateFuse());
if (this == ModItems.grenade_if_generic) {
list.add("");
list.add(EnumChatFormatting.ITALIC + "\"How do you like " + EnumChatFormatting.RESET + EnumChatFormatting.GRAY + "them" + EnumChatFormatting.ITALIC + " apples?\"");
}
if (this == ModItems.grenade_if_he) {
list.add("");
list.add(EnumChatFormatting.ITALIC + "\"You better run, you better take cover!\"");
}
if (this == ModItems.grenade_if_bouncy) {
list.add("");
list.add(EnumChatFormatting.ITALIC + "\"Boing!\"");
}
if (this == ModItems.grenade_if_sticky) {
list.add("");
list.add(EnumChatFormatting.ITALIC + "\"This one is the booger grenade.\"");
}
if (this == ModItems.grenade_if_impact) {
list.add("");
list.add(EnumChatFormatting.ITALIC + "\"Tossable boom.\"");
}
if (this == ModItems.grenade_if_incendiary) {
list.add("");
list.add(EnumChatFormatting.ITALIC + "\"Flaming wheel of destruction!\"");
}
if (this == ModItems.grenade_if_toxic) {
list.add("");
list.add(EnumChatFormatting.ITALIC + "\"TOXIC SHOCK\"");
}
if (this == ModItems.grenade_if_concussion) {
list.add("");
list.add(EnumChatFormatting.ITALIC + "\"Oof ouch owie, my bones!\"");
}
if (this == ModItems.grenade_if_brimstone) {
list.add("");
list.add(EnumChatFormatting.ITALIC + "\"Zoop!\"");
}
if (this == ModItems.grenade_if_mystery) {
list.add("");
list.add(EnumChatFormatting.ITALIC + "\"It's a mystery!\"");
}
if (this == ModItems.grenade_if_spark) {
list.add("");
list.add(EnumChatFormatting.ITALIC + "\"31-31-31-31-31-31-31-31-31-31-31-31-31\"");
}
if (this == ModItems.grenade_if_hopwire) {
list.add("");
list.add(EnumChatFormatting.ITALIC + "\"All I ever wished for was a bike that didn't fall over.\"");
}
if (this == ModItems.grenade_if_null) {
list.add("");
list.add(EnumChatFormatting.ITALIC + "java.lang.NullPointerException");
}
}
public static int getFuseTicks(Item grenade) {

View File

@ -822,7 +822,7 @@ public class MainRegistry
EntityRegistry.registerModEntity(EntityMissileBHole.class, "entity_missile_blackhole", 100, this, 1000, 1, true);
EntityRegistry.registerModEntity(EntityMissileSchrabidium.class, "entity_missile_schrabidium", 101, this, 1000, 1, true);
EntityRegistry.registerModEntity(EntityMissileEMP.class, "entity_missile_emp", 102, this, 1000, 1, true);
EntityRegistry.registerModEntity(EntityChlorineFX.class, "entity_d_smoke_fx", 103, this, 1000, 1, true);
EntityRegistry.registerModEntity(EntityChlorineFX.class, "entity_chlorine_fx", 103, this, 1000, 1, true);
EntityRegistry.registerModEntity(EntityPinkCloudFX.class, "entity_pink_cloud_fx", 104, this, 1000, 1, true);
EntityRegistry.registerModEntity(EntityCloudFX.class, "entity_cloud_fx", 105, this, 1000, 1, true);
EntityRegistry.registerModEntity(EntityGrenadePC.class, "entity_grenade_pink_cloud", 106, this, 250, 1, true);

View File

@ -69,6 +69,8 @@ public class PacketDispatcher {
wrapper.registerMessage(TEVaultPacket.Handler.class, TEVaultPacket.class, i++, Side.CLIENT);
//Packet to send sat info to players
wrapper.registerMessage(SatPanelPacket.Handler.class, SatPanelPacket.class, i++, Side.CLIENT);
//Packet to send block break particles
wrapper.registerMessage(ParticleBurstPacket.Handler.class, ParticleBurstPacket.class, i++, Side.CLIENT);
}
}

View File

@ -0,0 +1,64 @@
package com.hbm.packet;
import com.hbm.tileentity.machine.TileEntityMachineAssembler;
import com.hbm.tileentity.machine.TileEntityMachinePumpjack;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.tileentity.TileEntity;
public class ParticleBurstPacket implements IMessage {
int x;
int y;
int z;
int block;
int meta;
public ParticleBurstPacket()
{
}
public ParticleBurstPacket(int x, int y, int z, int block, int meta)
{
this.x = x;
this.y = y;
this.z = z;
this.block = block;
this.meta = meta;
}
@Override
public void fromBytes(ByteBuf buf) {
x = buf.readInt();
y = buf.readInt();
z = buf.readInt();
block = buf.readInt();
meta = buf.readInt();
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(x);
buf.writeInt(y);
buf.writeInt(z);
buf.writeInt(block);
buf.writeInt(meta);
}
public static class Handler implements IMessageHandler<ParticleBurstPacket, IMessage> {
@Override
public IMessage onMessage(ParticleBurstPacket m, MessageContext ctx) {
Minecraft.getMinecraft().effectRenderer.addBlockDestroyEffects(m.x, m.y, m.z, Block.getBlockById(m.block), (m.meta << 12));
return null;
}
}
}

View File

@ -1,12 +1,19 @@
package com.hbm.render.entity;
import java.lang.reflect.Field;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings;
import com.hbm.render.model.ModelRubble;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
public class RenderRubble extends Render {
@ -25,28 +32,40 @@ public class RenderRubble extends Render {
GL11.glScalef(1.0F, 1.0F, 1.0F);
GL11.glRotatef(180, 1, 0, 0);
GL11.glRotatef((rocket.ticksExisted % 360) * 10, 1, 1, 1);
byte b = rocket.getDataWatcher().getWatchableObjectByte(16);
if(b == 0)
bindTexture(new ResourceLocation(RefStrings.MODID + ":textures/models/ModelRubbleMetal.png"));
if(b == 1)
bindTexture(new ResourceLocation(RefStrings.MODID + ":textures/models/ModelRubbleRock.png"));
if(b == 2)
bindTexture(new ResourceLocation(RefStrings.MODID + ":textures/models/ModelRubblePlant.png"));
if(b == 3)
bindTexture(new ResourceLocation(RefStrings.MODID + ":textures/models/ModelRubbleSand.png"));
if(b == 4)
bindTexture(new ResourceLocation(RefStrings.MODID + ":textures/models/ModelRubbleGround.png"));
if(b == 5)
bindTexture(new ResourceLocation(RefStrings.MODID + ":textures/models/ModelRubbleWood.png"));
if(b == 6)
bindTexture(new ResourceLocation(RefStrings.MODID + ":textures/models/ModelRubbleScrap.png"));
try {
int block = rocket.getDataWatcher().getWatchableObjectInt(16);
int meta = rocket.getDataWatcher().getWatchableObjectInt(17);
Block b = Block.getBlockById(block);
RenderBlocks rb = RenderBlocks.getInstance();
String s = rb.getBlockIconFromSideAndMetadata(b, 0, meta).getIconName();
if(s == null || s.isEmpty())
s = "minecraft:stone";
String[] split = s.split(":");
String prefix = "";
String suffix = "";
if(split.length == 2) {
prefix = split[0];
suffix = split[1];
} else {
prefix = "minecraft";
suffix = s;
}
bindTexture(new ResourceLocation(prefix + ":textures/blocks/" + suffix + ".png"));
mine.renderAll(0.0625F);
} catch(Exception ex) { }
mine.renderAll(0.0625F);
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
return new ResourceLocation(RefStrings.MODID + ":textures/models/ModelRubbleScrap.png");

View File

@ -24,8 +24,8 @@ public class ModelRubble extends ModelBase {
ModelRenderer Shape10;
public ModelRubble() {
textureWidth = 64;
textureHeight = 32;
textureWidth = 16;
textureHeight = 16;
Shape1 = new ModelRenderer(this, 0, 0);
Shape1.addBox(0F, 0F, 0F, 14, 6, 6);

View File

@ -24,12 +24,14 @@ public class TileEntityLandmine extends TileEntity {
if(!worldObj.isRemote) {
Block block = worldObj.getBlock(xCoord, yCoord, zCoord);
double range = 1;
double height = 1;
if (block == ModBlocks.mine_ap) {
range = 1.5D;
}
if (block == ModBlocks.mine_he) {
range = 2;
height = 5;
}
if (block == ModBlocks.mine_shrap) {
range = 1.5D;
@ -39,7 +41,7 @@ public class TileEntityLandmine extends TileEntity {
}
List<Object> list = worldObj.getEntitiesWithinAABBExcludingEntity(null,
AxisAlignedBB.getBoundingBox(xCoord - range, yCoord - 1, zCoord - range, xCoord + range, yCoord + 1, zCoord + range));
AxisAlignedBB.getBoundingBox(xCoord - range, yCoord - height, zCoord - range, xCoord + range, yCoord + height, zCoord + range));
boolean flag = false;
for (Object o : list) {