mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
ore layer system, new amat cell explosion, particle settings for jetpack
This commit is contained in:
parent
abc87d6fa9
commit
980fe377a0
@ -11,7 +11,9 @@ import com.hbm.explosion.vanillant.interfaces.IExplosionSFX;
|
||||
import com.hbm.explosion.vanillant.interfaces.IPlayerProcessor;
|
||||
import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.BlockProcessorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.CustomDamageHandlerAmat;
|
||||
import com.hbm.explosion.vanillant.standard.EntityProcessorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.ExplosionEffectAmat;
|
||||
import com.hbm.explosion.vanillant.standard.ExplosionEffectStandard;
|
||||
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
|
||||
|
||||
@ -127,4 +129,16 @@ public class ExplosionVNT {
|
||||
this.setSFX(new ExplosionEffectStandard());
|
||||
return this;
|
||||
}
|
||||
|
||||
public ExplosionVNT makeAmat() {
|
||||
this.setBlockAllocator(new BlockAllocatorStandard(this.size < 15 ? 16 : 32));
|
||||
this.setBlockProcessor(new BlockProcessorStandard()
|
||||
.setNoDrop());
|
||||
this.setEntityProcessor(new EntityProcessorStandard()
|
||||
.withRangeMod(2F)
|
||||
.withDamageMod(new CustomDamageHandlerAmat(50F)));
|
||||
this.setPlayerProcessor(new PlayerProcessorStandard());
|
||||
this.setSFX(new ExplosionEffectAmat());
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
package com.hbm.explosion.vanillant.interfaces;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public interface ICustomDamageHandler {
|
||||
|
||||
public void handleAttack(ExplosionVNT explosion, Entity entity, double distanceScaled);
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package com.hbm.explosion.vanillant.interfaces;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
|
||||
public interface IEntityRangeMutator {
|
||||
|
||||
public float mutateRange(ExplosionVNT explosion, float range);
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.hbm.explosion.vanillant.standard;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.interfaces.ICustomDamageHandler;
|
||||
import com.hbm.util.ContaminationUtil;
|
||||
import com.hbm.util.ContaminationUtil.ContaminationType;
|
||||
import com.hbm.util.ContaminationUtil.HazardType;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
public class CustomDamageHandlerAmat implements ICustomDamageHandler {
|
||||
|
||||
protected float radiation;
|
||||
|
||||
public CustomDamageHandlerAmat(float radiation) {
|
||||
this.radiation = radiation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleAttack(ExplosionVNT explosion, Entity entity, double distanceScaled) {
|
||||
if(entity instanceof EntityLivingBase)
|
||||
ContaminationUtil.contaminate((EntityLivingBase)entity, HazardType.RADIATION, ContaminationType.CREATIVE, (float) (radiation * (1D - distanceScaled) * explosion.size));
|
||||
}
|
||||
}
|
||||
@ -4,7 +4,9 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.interfaces.ICustomDamageHandler;
|
||||
import com.hbm.explosion.vanillant.interfaces.IEntityProcessor;
|
||||
import com.hbm.explosion.vanillant.interfaces.IEntityRangeMutator;
|
||||
|
||||
import net.minecraft.enchantment.EnchantmentProtection;
|
||||
import net.minecraft.entity.Entity;
|
||||
@ -17,6 +19,9 @@ import net.minecraftforge.event.ForgeEventFactory;
|
||||
|
||||
public class EntityProcessorStandard implements IEntityProcessor {
|
||||
|
||||
protected IEntityRangeMutator range;
|
||||
protected ICustomDamageHandler damage;
|
||||
|
||||
@Override
|
||||
public HashMap<EntityPlayer, Vec3> process(ExplosionVNT explosion, World world, double x, double y, double z, float size) {
|
||||
|
||||
@ -24,6 +29,10 @@ public class EntityProcessorStandard implements IEntityProcessor {
|
||||
|
||||
size *= 2.0F;
|
||||
|
||||
if(range != null) {
|
||||
size = range.mutateRange(explosion, size);
|
||||
}
|
||||
|
||||
double minX = x - (double) size - 1.0D;
|
||||
double maxX = x + (double) size + 1.0D;
|
||||
double minY = y - (double) size - 1.0D;
|
||||
@ -67,10 +76,29 @@ public class EntityProcessorStandard implements IEntityProcessor {
|
||||
if(entity instanceof EntityPlayer) {
|
||||
affectedPlayers.put((EntityPlayer) entity, Vec3.createVectorHelper(deltaX * knockback, deltaY * knockback, deltaZ * knockback));
|
||||
}
|
||||
|
||||
if(damage != null) {
|
||||
damage.handleAttack(explosion, entity, distanceScaled);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return affectedPlayers;
|
||||
}
|
||||
|
||||
public EntityProcessorStandard withRangeMod(float mod) {
|
||||
range = new IEntityRangeMutator() {
|
||||
@Override
|
||||
public float mutateRange(ExplosionVNT explosion, float range) {
|
||||
return range * mod;
|
||||
}
|
||||
};
|
||||
return this;
|
||||
}
|
||||
|
||||
public EntityProcessorStandard withDamageMod(ICustomDamageHandler damage) {
|
||||
this.damage = damage;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
package com.hbm.explosion.vanillant.standard;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.interfaces.IExplosionSFX;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ExplosionEffectAmat implements IExplosionSFX {
|
||||
|
||||
@Override
|
||||
public void doEffect(ExplosionVNT explosion, World world, double x, double y, double z, float size) {
|
||||
|
||||
if(size < 15)
|
||||
world.playSoundEffect(x, y, z, "random.explode", 4.0F, (1.4F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.2F) * 0.7F);
|
||||
else
|
||||
world.playSoundEffect(x, y, z, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "amat");
|
||||
data.setFloat("scale", size);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(world.provider.dimensionId, x, y, z, 200));
|
||||
}
|
||||
}
|
||||
@ -403,7 +403,7 @@ public class RecipesCommon {
|
||||
}
|
||||
|
||||
public static class MetaBlock {
|
||||
|
||||
|
||||
public Block block;
|
||||
public int meta;
|
||||
|
||||
@ -415,6 +415,14 @@ public class RecipesCommon {
|
||||
public MetaBlock(Block block) {
|
||||
this(block, 0);
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + Block.getIdFromBlock(block);
|
||||
result = prime * result + meta;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ import com.hbm.explosion.ExplosionChaos;
|
||||
import com.hbm.explosion.ExplosionLarge;
|
||||
import com.hbm.explosion.ExplosionNT;
|
||||
import com.hbm.explosion.ExplosionNT.ExAttrib;
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.interfaces.IBomb;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.MainRegistry;
|
||||
@ -85,15 +86,12 @@ public class ItemDrop extends Item {
|
||||
|
||||
if (stack.getItem() != null && stack.getItem() == ModItems.cell_antimatter && WeaponConfig.dropCell) {
|
||||
if (!entityItem.worldObj.isRemote) {
|
||||
entityItem.worldObj.createExplosion(entityItem, entityItem.posX, entityItem.posY,
|
||||
entityItem.posZ, 10.0F, true);
|
||||
new ExplosionVNT(entityItem.worldObj, entityItem.posX, entityItem.posY, entityItem.posZ, 3F).makeAmat().explode();
|
||||
}
|
||||
}
|
||||
if (stack.getItem() != null && stack.getItem() == ModItems.pellet_antimatter && WeaponConfig.dropCell) {
|
||||
if (!entityItem.worldObj.isRemote) {
|
||||
new ExplosionNT(entityItem.worldObj, entityItem, entityItem.posX, entityItem.posY, entityItem.posZ, 30).overrideResolution(64).addAttrib(ExAttrib.FIRE).addAttrib(ExAttrib.NOSOUND).explode();
|
||||
ExplosionLarge.spawnParticles(entityItem.worldObj, entityItem.posX, entityItem.posY, entityItem.posZ, ExplosionLarge.cloudFunction(100));
|
||||
entityItem.worldObj.playSoundEffect(entityItem.posX, entityItem.posY, entityItem.posZ, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
|
||||
new ExplosionVNT(entityItem.worldObj, entityItem.posX, entityItem.posY, entityItem.posZ, 20F).makeAmat().explode();
|
||||
}
|
||||
}
|
||||
if (stack.getItem() != null && stack.getItem() == ModItems.cell_anti_schrabidium && WeaponConfig.dropCell) {
|
||||
|
||||
@ -745,7 +745,6 @@ public class ClientProxy extends ServerProxy {
|
||||
@Deprecated
|
||||
@Override
|
||||
public void spawnParticle(double x, double y, double z, String type, float args[]) {
|
||||
|
||||
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
TextureManager man = Minecraft.getMinecraft().renderEngine;
|
||||
@ -789,6 +788,7 @@ public class ClientProxy extends ServerProxy {
|
||||
|
||||
TextureManager man = Minecraft.getMinecraft().renderEngine;
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
int particleSetting = Minecraft.getMinecraft().gameSettings.particleSetting;
|
||||
Random rand = world.rand;
|
||||
String type = data.getString("type");
|
||||
double x = data.getDouble("posX");
|
||||
@ -1095,6 +1095,9 @@ public class ClientProxy extends ServerProxy {
|
||||
|
||||
if("jetpack".equals(type)) {
|
||||
|
||||
if(particleSetting == 2)
|
||||
return;
|
||||
|
||||
Entity ent = world.getEntityByID(data.getInteger("player"));
|
||||
|
||||
if(ent instanceof EntityPlayer) {
|
||||
@ -1132,35 +1135,43 @@ public class ClientProxy extends ServerProxy {
|
||||
moZ -= look.zCoord * 0.1D;
|
||||
}
|
||||
|
||||
Vec3 pos = Vec3.createVectorHelper(ix, iy, iz);
|
||||
Vec3 thrust = Vec3.createVectorHelper(moX, moY, moZ);
|
||||
thrust = thrust.normalize();
|
||||
Vec3 target = pos.addVector(thrust.xCoord * 10, thrust.yCoord * 10, thrust.zCoord * 10);
|
||||
MovingObjectPosition mop = player.worldObj.func_147447_a(pos, target, false, false, true);
|
||||
|
||||
if(mop != null && mop.typeOfHit == MovingObjectType.BLOCK && mop.sideHit == 1) {
|
||||
if(particleSetting == 0) {
|
||||
Vec3 pos = Vec3.createVectorHelper(ix, iy, iz);
|
||||
Vec3 thrust = Vec3.createVectorHelper(moX, moY, moZ);
|
||||
thrust = thrust.normalize();
|
||||
Vec3 target = pos.addVector(thrust.xCoord * 10, thrust.yCoord * 10, thrust.zCoord * 10);
|
||||
MovingObjectPosition mop = player.worldObj.func_147447_a(pos, target, false, false, true);
|
||||
|
||||
Block b = world.getBlock(mop.blockX, mop.blockY, mop.blockZ);
|
||||
int meta = world.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ);
|
||||
|
||||
Vec3 delta = Vec3.createVectorHelper(ix - mop.hitVec.xCoord, iy - mop.hitVec.yCoord, iz - mop.hitVec.zCoord);
|
||||
Vec3 vel = Vec3.createVectorHelper(0.75 - delta.lengthVector() * 0.075, 0, 0);
|
||||
|
||||
for(int i = 0; i < (10 - delta.lengthVector()); i++) {
|
||||
vel.rotateAroundY(world.rand.nextFloat() * (float)Math.PI * 2F);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityBlockDustFX(world, mop.hitVec.xCoord, mop.hitVec.yCoord + 0.1, mop.hitVec.zCoord, vel.xCoord, 0.1, vel.zCoord, b, meta));
|
||||
if(mop != null && mop.typeOfHit == MovingObjectType.BLOCK && mop.sideHit == 1) {
|
||||
|
||||
Block b = world.getBlock(mop.blockX, mop.blockY, mop.blockZ);
|
||||
int meta = world.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ);
|
||||
|
||||
Vec3 delta = Vec3.createVectorHelper(ix - mop.hitVec.xCoord, iy - mop.hitVec.yCoord, iz - mop.hitVec.zCoord);
|
||||
Vec3 vel = Vec3.createVectorHelper(0.75 - delta.lengthVector() * 0.075, 0, 0);
|
||||
|
||||
for(int i = 0; i < (10 - delta.lengthVector()); i++) {
|
||||
vel.rotateAroundY(world.rand.nextFloat() * (float)Math.PI * 2F);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityBlockDustFX(world, mop.hitVec.xCoord, mop.hitVec.yCoord + 0.1, mop.hitVec.zCoord, vel.xCoord, 0.1, vel.zCoord, b, meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityFlameFX(world, ix + ox, iy, iz + oz, p.motionX + moX * 2, p.motionY + moY * 2, p.motionZ + moZ * 2));
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityFlameFX(world, ix - ox, iy, iz - oz, p.motionX + moX * 2, p.motionY + moY * 2, p.motionZ + moZ * 2));
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new net.minecraft.client.particle.EntitySmokeFX(world, ix + ox, iy, iz + oz, p.motionX + moX * 3, p.motionY + moY * 3, p.motionZ + moZ * 3));
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new net.minecraft.client.particle.EntitySmokeFX(world, ix - ox, iy, iz - oz, p.motionX + moX * 3, p.motionY + moY * 3, p.motionZ + moZ * 3));
|
||||
|
||||
if(particleSetting == 0) {
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new net.minecraft.client.particle.EntitySmokeFX(world, ix + ox, iy, iz + oz, p.motionX + moX * 3, p.motionY + moY * 3, p.motionZ + moZ * 3));
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new net.minecraft.client.particle.EntitySmokeFX(world, ix - ox, iy, iz - oz, p.motionX + moX * 3, p.motionY + moY * 3, p.motionZ + moZ * 3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if("jetpack_bj".equals(type)) {
|
||||
|
||||
if(particleSetting == 2)
|
||||
return;
|
||||
|
||||
Entity ent = world.getEntityByID(data.getInteger("player"));
|
||||
|
||||
if(ent instanceof EntityPlayer) {
|
||||
@ -1180,22 +1191,24 @@ public class ClientProxy extends ServerProxy {
|
||||
double ox = offset.xCoord;
|
||||
double oz = offset.zCoord;
|
||||
|
||||
Vec3 pos = Vec3.createVectorHelper(ix, iy, iz);
|
||||
Vec3 thrust = Vec3.createVectorHelper(0, -1, 0);
|
||||
Vec3 target = pos.addVector(thrust.xCoord * 10, thrust.yCoord * 10, thrust.zCoord * 10);
|
||||
MovingObjectPosition mop = player.worldObj.func_147447_a(pos, target, false, false, true);
|
||||
|
||||
if(mop != null && mop.typeOfHit == MovingObjectType.BLOCK && mop.sideHit == 1) {
|
||||
if(particleSetting == 0) {
|
||||
Vec3 pos = Vec3.createVectorHelper(ix, iy, iz);
|
||||
Vec3 thrust = Vec3.createVectorHelper(0, -1, 0);
|
||||
Vec3 target = pos.addVector(thrust.xCoord * 10, thrust.yCoord * 10, thrust.zCoord * 10);
|
||||
MovingObjectPosition mop = player.worldObj.func_147447_a(pos, target, false, false, true);
|
||||
|
||||
Block b = world.getBlock(mop.blockX, mop.blockY, mop.blockZ);
|
||||
int meta = world.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ);
|
||||
|
||||
Vec3 delta = Vec3.createVectorHelper(ix - mop.hitVec.xCoord, iy - mop.hitVec.yCoord, iz - mop.hitVec.zCoord);
|
||||
Vec3 vel = Vec3.createVectorHelper(0.75 - delta.lengthVector() * 0.075, 0, 0);
|
||||
|
||||
for(int i = 0; i < (10 - delta.lengthVector()); i++) {
|
||||
vel.rotateAroundY(world.rand.nextFloat() * (float)Math.PI * 2F);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityBlockDustFX(world, mop.hitVec.xCoord, mop.hitVec.yCoord + 0.1, mop.hitVec.zCoord, vel.xCoord, 0.1, vel.zCoord, b, meta));
|
||||
if(mop != null && mop.typeOfHit == MovingObjectType.BLOCK && mop.sideHit == 1) {
|
||||
|
||||
Block b = world.getBlock(mop.blockX, mop.blockY, mop.blockZ);
|
||||
int meta = world.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ);
|
||||
|
||||
Vec3 delta = Vec3.createVectorHelper(ix - mop.hitVec.xCoord, iy - mop.hitVec.yCoord, iz - mop.hitVec.zCoord);
|
||||
Vec3 vel = Vec3.createVectorHelper(0.75 - delta.lengthVector() * 0.075, 0, 0);
|
||||
|
||||
for(int i = 0; i < (10 - delta.lengthVector()); i++) {
|
||||
vel.rotateAroundY(world.rand.nextFloat() * (float)Math.PI * 2F);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityBlockDustFX(world, mop.hitVec.xCoord, mop.hitVec.yCoord + 0.1, mop.hitVec.zCoord, vel.xCoord, 0.1, vel.zCoord, b, meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1210,6 +1223,9 @@ public class ClientProxy extends ServerProxy {
|
||||
|
||||
if("jetpack_dns".equals(type)) {
|
||||
|
||||
if(particleSetting == 2)
|
||||
return;
|
||||
|
||||
Entity ent = world.getEntityByID(data.getInteger("player"));
|
||||
|
||||
if(ent instanceof EntityPlayer) {
|
||||
@ -1227,22 +1243,24 @@ public class ClientProxy extends ServerProxy {
|
||||
double ox = offset.xCoord;
|
||||
double oz = offset.zCoord;
|
||||
|
||||
Vec3 pos = Vec3.createVectorHelper(ix, iy, iz);
|
||||
Vec3 thrust = Vec3.createVectorHelper(0, -1, 0);
|
||||
Vec3 target = pos.addVector(thrust.xCoord * 10, thrust.yCoord * 10, thrust.zCoord * 10);
|
||||
MovingObjectPosition mop = player.worldObj.func_147447_a(pos, target, false, false, true);
|
||||
|
||||
if(mop != null && mop.typeOfHit == MovingObjectType.BLOCK && mop.sideHit == 1) {
|
||||
if(particleSetting == 0) {
|
||||
Vec3 pos = Vec3.createVectorHelper(ix, iy, iz);
|
||||
Vec3 thrust = Vec3.createVectorHelper(0, -1, 0);
|
||||
Vec3 target = pos.addVector(thrust.xCoord * 10, thrust.yCoord * 10, thrust.zCoord * 10);
|
||||
MovingObjectPosition mop = player.worldObj.func_147447_a(pos, target, false, false, true);
|
||||
|
||||
Block b = world.getBlock(mop.blockX, mop.blockY, mop.blockZ);
|
||||
int meta = world.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ);
|
||||
|
||||
Vec3 delta = Vec3.createVectorHelper(ix - mop.hitVec.xCoord, iy - mop.hitVec.yCoord, iz - mop.hitVec.zCoord);
|
||||
Vec3 vel = Vec3.createVectorHelper(0.75 - delta.lengthVector() * 0.075, 0, 0);
|
||||
|
||||
for(int i = 0; i < (10 - delta.lengthVector()); i++) {
|
||||
vel.rotateAroundY(world.rand.nextFloat() * (float)Math.PI * 2F);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityBlockDustFX(world, mop.hitVec.xCoord, mop.hitVec.yCoord + 0.1, mop.hitVec.zCoord, vel.xCoord, 0.1, vel.zCoord, b, meta));
|
||||
if(mop != null && mop.typeOfHit == MovingObjectType.BLOCK && mop.sideHit == 1) {
|
||||
|
||||
Block b = world.getBlock(mop.blockX, mop.blockY, mop.blockZ);
|
||||
int meta = world.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ);
|
||||
|
||||
Vec3 delta = Vec3.createVectorHelper(ix - mop.hitVec.xCoord, iy - mop.hitVec.yCoord, iz - mop.hitVec.zCoord);
|
||||
Vec3 vel = Vec3.createVectorHelper(0.75 - delta.lengthVector() * 0.075, 0, 0);
|
||||
|
||||
for(int i = 0; i < (10 - delta.lengthVector()); i++) {
|
||||
vel.rotateAroundY(world.rand.nextFloat() * (float)Math.PI * 2F);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityBlockDustFX(world, mop.hitVec.xCoord, mop.hitVec.yCoord + 0.1, mop.hitVec.zCoord, vel.xCoord, 0.1, vel.zCoord, b, meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1372,7 +1390,7 @@ public class ClientProxy extends ServerProxy {
|
||||
if("vomit".equals(type)) {
|
||||
|
||||
Entity e = world.getEntityByID(data.getInteger("entity"));
|
||||
int count = data.getInteger("count");
|
||||
int count = data.getInteger("count") / (particleSetting + 1);
|
||||
|
||||
if(e instanceof EntityLivingBase) {
|
||||
|
||||
@ -1453,12 +1471,13 @@ public class ClientProxy extends ServerProxy {
|
||||
fx.setLift(data.getFloat("lift"));
|
||||
fx.setBaseScale(data.getFloat("base"));
|
||||
fx.setMaxScale(data.getFloat("max"));
|
||||
fx.setLife(data.getInteger("life"));
|
||||
fx.setLife(data.getInteger("life") / (particleSetting + 1));
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
|
||||
}
|
||||
|
||||
if("deadleaf".equals(type)) {
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleDeadLeaf(man, world, x, y, z));
|
||||
if(particleSetting == 0 || (particleSetting == 1 && rand.nextBoolean()))
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleDeadLeaf(man, world, x, y, z));
|
||||
}
|
||||
|
||||
if("anim".equals(type)) {
|
||||
@ -1534,6 +1553,10 @@ public class ClientProxy extends ServerProxy {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if("amat".equals(type)) {
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleAmatFlash(world, x, y, z, data.getFloat("scale")));
|
||||
}
|
||||
}
|
||||
|
||||
private HashMap<Integer, Long> vanished = new HashMap();
|
||||
|
||||
@ -5,6 +5,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.dispenser.BehaviorProjectileDispense;
|
||||
import net.minecraft.dispenser.IPosition;
|
||||
import net.minecraft.entity.IProjectile;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
@ -71,6 +72,7 @@ import com.hbm.tileentity.bomb.TileEntityNukeCustom;
|
||||
import com.hbm.tileentity.machine.*;
|
||||
import com.hbm.tileentity.machine.rbmk.RBMKDials;
|
||||
import com.hbm.util.ArmorUtil;
|
||||
import com.hbm.world.feature.OreLayer;
|
||||
import com.hbm.world.feature.SchistStratum;
|
||||
import com.hbm.world.generator.CellularDungeonFactory;
|
||||
|
||||
@ -988,6 +990,8 @@ public class MainRegistry {
|
||||
SchistStratum schist = new SchistStratum();
|
||||
MinecraftForge.EVENT_BUS.register(schist); //DecorateBiomeEvent.Pre
|
||||
|
||||
new OreLayer(Blocks.coal_ore, 0.2F).setThreshold(4).setRangeMult(3).setYLevel(70);
|
||||
|
||||
OreDictManager oreMan = new OreDictManager();
|
||||
MinecraftForge.EVENT_BUS.register(oreMan); //OreRegisterEvent
|
||||
|
||||
|
||||
145
src/main/java/com/hbm/particle/ParticleAmatFlash.java
Normal file
145
src/main/java/com/hbm/particle/ParticleAmatFlash.java
Normal file
@ -0,0 +1,145 @@
|
||||
package com.hbm.particle;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ParticleAmatFlash extends EntityFX {
|
||||
|
||||
public ParticleAmatFlash(World world, double x, double y, double z, float scale) {
|
||||
super(world, x, y, z);
|
||||
this.particleMaxAge = 10;
|
||||
this.particleScale = scale;
|
||||
}
|
||||
|
||||
public int getFXLayer() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
public void renderParticle(Tessellator tess, float interp, float x, float y, float z, float tx, float tz) {
|
||||
|
||||
float pX = (float) ((this.prevPosX + (this.posX - this.prevPosX) * (double) interp - interpPosX));
|
||||
float pY = (float) ((this.prevPosY + (this.posY - this.prevPosY) * (double) interp - interpPosY));
|
||||
float pZ = (float) ((this.prevPosZ + (this.posZ - this.prevPosZ) * (double) interp - interpPosZ));
|
||||
|
||||
GL11.glTranslatef(pX, pY, pZ);
|
||||
|
||||
GL11.glScalef(0.2F * particleScale, 0.2F * particleScale, 0.2F * particleScale);
|
||||
|
||||
double intensity = (double) (this.particleAge + interp) / (double) this.particleMaxAge;
|
||||
double inverse = 1.0D - intensity;
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
Random random = new Random(432L);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDepthMask(false);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
float scale = 0.5F;
|
||||
|
||||
for(int i = 0; i < 100; i++) {
|
||||
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
float vert1 = (random.nextFloat() * 20.0F + 5.0F + 1 * 10.0F) * (float) (intensity * scale);
|
||||
float vert2 = (random.nextFloat() * 2.0F + 1.0F + 1 * 2.0F) * (float) (intensity * scale);
|
||||
|
||||
tessellator.startDrawing(6);
|
||||
|
||||
tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, (float) inverse);
|
||||
tessellator.addVertex(0.0D, 0.0D, 0.0D);
|
||||
tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 0.0F);
|
||||
tessellator.addVertex(-0.866D * vert2, vert1, -0.5F * vert2);
|
||||
tessellator.addVertex(0.866D * vert2, vert1, -0.5F * vert2);
|
||||
tessellator.addVertex(0.0D, vert1, 1.0F * vert2);
|
||||
tessellator.addVertex(-0.866D * vert2, vert1, -0.5F * vert2);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
|
||||
/*GL11.glScalef(0.2F * particleScale, 0.2F * particleScale, 0.2F * particleScale);
|
||||
|
||||
double intensity = (double) this.particleAge / (double) this.particleMaxAge;
|
||||
double inverse = 1.0D - intensity;
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
Random random = new Random(432L);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDepthMask(false);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
float scale = 0.002F;
|
||||
|
||||
for(int i = 0; i < 300; i++) {
|
||||
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
float vert1 = (random.nextFloat() * 20.0F + 5.0F + 1 * 10.0F) * (float) (intensity * scale);
|
||||
float vert2 = (random.nextFloat() * 2.0F + 1.0F + 1 * 2.0F) * (float) (intensity * scale);
|
||||
|
||||
tessellator.startDrawing(6);
|
||||
|
||||
tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, (float) inverse);
|
||||
tessellator.addVertex(x + 0.0D, y + 0.0D, z + 0.0D);
|
||||
tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 0.0F);
|
||||
tessellator.addVertex(-0.866D * vert2, vert1, -0.5F * vert2);
|
||||
tessellator.addVertex(0.866D * vert2, vert1, -0.5F * vert2);
|
||||
tessellator.addVertex(0.0D, vert1, 1.0F * vert2);
|
||||
tessellator.addVertex(-0.866D * vert2, vert1, -0.5F * vert2);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
RenderHelper.enableStandardItemLighting();*/
|
||||
}
|
||||
}
|
||||
109
src/main/java/com/hbm/world/feature/OreLayer.java
Normal file
109
src/main/java/com/hbm/world/feature/OreLayer.java
Normal file
@ -0,0 +1,109 @@
|
||||
package com.hbm.world.feature;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.inventory.RecipesCommon.MetaBlock;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.PlayerInformPacket;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.NoiseGeneratorPerlin;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
|
||||
|
||||
public class OreLayer {
|
||||
|
||||
private NoiseGeneratorPerlin noise;
|
||||
private MetaBlock ore;
|
||||
private Block target;
|
||||
private float density;
|
||||
/** The number that is being deducted flat from the result of the perlin noise before all other processing. Increase this to make strata rarer. */
|
||||
private int threshold = 5;
|
||||
/** The mulitplier for the remaining bit after the threshold has been deducted. Increase to make strata wavier. */
|
||||
private int rangeMult = 3;
|
||||
/** The maximum range after multiplying - anything above this will be subtracted from (maxRange * 2) to yield the proper range. Increase this to make strata thicker. */
|
||||
private int maxRange = 4;
|
||||
/** The y-level around which the stratum is centered. */
|
||||
private int yLevel = 30;
|
||||
|
||||
public OreLayer(Block ore, float density) {
|
||||
this(ore, 0, Blocks.stone, density);
|
||||
}
|
||||
|
||||
public OreLayer(Block ore, int meta, Block target, float density) {
|
||||
this.ore = new MetaBlock(ore, meta);
|
||||
this.target = target;
|
||||
this.density = density;
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
public OreLayer setThreshold(int threshold) {
|
||||
this.threshold = threshold;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OreLayer setRangeMult(int rangeMult) {
|
||||
this.rangeMult = rangeMult;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OreLayer setMaxRange(int maxRange) {
|
||||
this.maxRange = maxRange;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OreLayer setYLevel(int yLevel) {
|
||||
this.yLevel = yLevel;
|
||||
return this;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDecorate(DecorateBiomeEvent.Pre event) {
|
||||
|
||||
if(this.noise == null) {
|
||||
this.noise = new NoiseGeneratorPerlin(new Random(event.world.getSeed() + (ore.getID() * 31) + yLevel), 4);
|
||||
}
|
||||
|
||||
World world = event.world;
|
||||
|
||||
if(world.provider.dimensionId != 0)
|
||||
return;
|
||||
|
||||
int cX = event.chunkX;
|
||||
int cZ = event.chunkZ;
|
||||
|
||||
double scale = 0.01D;
|
||||
|
||||
for(int x = cX; x < cX + 16; x++) {
|
||||
for(int z = cZ; z < cZ + 16; z++) {
|
||||
|
||||
double n = noise.func_151601_a(x * scale, z * scale);
|
||||
|
||||
if(n > threshold) {
|
||||
int range = (int)((n - threshold) * rangeMult);
|
||||
|
||||
if(range > maxRange)
|
||||
range = (maxRange * 2) - range;
|
||||
|
||||
if(range < 0)
|
||||
continue;
|
||||
|
||||
for(int y = yLevel - range; y <= yLevel + range; y++) {
|
||||
|
||||
if(event.rand.nextFloat() < density) {
|
||||
Block genTarget = world.getBlock(x, y, z);
|
||||
|
||||
if(genTarget.isReplaceableOreGen(world, x, y, z, target)) {
|
||||
world.setBlock(x, y, z, ore.block, ore.meta, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user