mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge pull request #1998 from BallOfEnergy1/Optimization
Crates, but backpacks!
This commit is contained in:
commit
ffa8a0c5bb
@ -48,7 +48,7 @@ credits=HbMinecraft,\
|
||||
\ TehTemmie (reacher radiation function),\
|
||||
\ Silly541 (config for safe ME drives),\
|
||||
\ Voxelstice (OpenComputers integration, turbine spinup),\
|
||||
\ BallOfEnergy1 (OpenComputers integration),\
|
||||
\ BallOfEnergy1 (OpenComputers integration, RBMK and packet optimization, crate backpacks),\
|
||||
\ sdddddf80 (recipe configs, chinese localization, custom machine holograms),\
|
||||
\ Abel1502 (optimization, crate upgrade recipes, strand caster improvements, varous tweaks),\
|
||||
\ SuperCraftAlex (tooltips)\
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package api.hbm.energymk2;
|
||||
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.util.Compat;
|
||||
|
||||
@ -18,29 +18,29 @@ public interface IEnergyProviderMK2 extends IEnergyHandlerMK2 {
|
||||
public default void usePower(long power) {
|
||||
this.setPower(this.getPower() - power);
|
||||
}
|
||||
|
||||
|
||||
public default long getProviderSpeed() {
|
||||
return this.getMaxPower();
|
||||
}
|
||||
|
||||
|
||||
public default void tryProvide(World world, int x, int y, int z, ForgeDirection dir) {
|
||||
|
||||
TileEntity te = Compat.getTileStandard(world, x, y, z);
|
||||
boolean red = false;
|
||||
|
||||
|
||||
if(te instanceof IEnergyConductorMK2) {
|
||||
IEnergyConductorMK2 con = (IEnergyConductorMK2) te;
|
||||
if(con.canConnect(dir.getOpposite())) {
|
||||
|
||||
|
||||
PowerNode node = Nodespace.getNode(world, x, y, z);
|
||||
|
||||
|
||||
if(node != null && node.net != null) {
|
||||
node.net.addProvider(this);
|
||||
red = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(te instanceof IEnergyReceiverMK2 && te != this) {
|
||||
IEnergyReceiverMK2 rec = (IEnergyReceiverMK2) te;
|
||||
if(rec.canConnect(dir.getOpposite())) {
|
||||
@ -51,7 +51,7 @@ public interface IEnergyProviderMK2 extends IEnergyHandlerMK2 {
|
||||
this.usePower(toTransfer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(particleDebug) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "network");
|
||||
@ -62,7 +62,7 @@ public interface IEnergyProviderMK2 extends IEnergyHandlerMK2 {
|
||||
data.setDouble("mX", dir.offsetX * (red ? 0.025 : 0.1));
|
||||
data.setDouble("mY", dir.offsetY * (red ? 0.025 : 0.1));
|
||||
data.setDouble("mZ", dir.offsetZ * (red ? 0.025 : 0.1));
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY, posZ), new TargetPoint(world.provider.dimensionId, posX, posY, posZ, 25));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, posX, posY, posZ), new TargetPoint(world.provider.dimensionId, posX, posY, posZ, 25));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package api.hbm.energymk2;
|
||||
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.interfaces.NotableComments;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.util.Compat;
|
||||
|
||||
@ -26,28 +26,28 @@ public interface IEnergyReceiverMK2 extends IEnergyHandlerMK2 {
|
||||
this.setPower(this.getMaxPower());
|
||||
return overshoot;
|
||||
}
|
||||
|
||||
|
||||
public default long getReceiverSpeed() {
|
||||
return this.getMaxPower();
|
||||
}
|
||||
|
||||
|
||||
public default void trySubscribe(World world, int x, int y, int z, ForgeDirection dir) {
|
||||
|
||||
TileEntity te = Compat.getTileStandard(world, x, y, z);
|
||||
boolean red = false;
|
||||
|
||||
|
||||
if(te instanceof IEnergyConductorMK2) {
|
||||
IEnergyConductorMK2 con = (IEnergyConductorMK2) te;
|
||||
if(!con.canConnect(dir.getOpposite())) return;
|
||||
|
||||
|
||||
PowerNode node = Nodespace.getNode(world, x, y, z);
|
||||
|
||||
|
||||
if(node != null && node.net != null) {
|
||||
node.net.addReceiver(this);
|
||||
red = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(particleDebug) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "network");
|
||||
@ -58,24 +58,24 @@ public interface IEnergyReceiverMK2 extends IEnergyHandlerMK2 {
|
||||
data.setDouble("mX", -dir.offsetX * (red ? 0.025 : 0.1));
|
||||
data.setDouble("mY", -dir.offsetY * (red ? 0.025 : 0.1));
|
||||
data.setDouble("mZ", -dir.offsetZ * (red ? 0.025 : 0.1));
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY, posZ), new TargetPoint(world.provider.dimensionId, posX, posY, posZ, 25));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, posX, posY, posZ), new TargetPoint(world.provider.dimensionId, posX, posY, posZ, 25));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public default void tryUnsubscribe(World world, int x, int y, int z) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
|
||||
if(te instanceof IEnergyConductorMK2) {
|
||||
IEnergyConductorMK2 con = (IEnergyConductorMK2) te;
|
||||
PowerNode node = con.createNode();
|
||||
|
||||
|
||||
if(node != null && node.net != null) {
|
||||
node.net.removeReceiver(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public enum ConnectionPriority {
|
||||
LOWEST,
|
||||
LOW,
|
||||
|
||||
0
src/main/java/api/hbm/fluid/IFluidUser.java
Normal file
0
src/main/java/api/hbm/fluid/IFluidUser.java
Normal file
@ -2972,13 +2972,13 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(water_door, water_door.getUnlocalizedName());
|
||||
|
||||
//Crates
|
||||
register(crate_iron);
|
||||
register(crate_steel);
|
||||
register(crate_desh);
|
||||
register(crate_tungsten);
|
||||
register(crate_template);
|
||||
register(safe);
|
||||
register(mass_storage);
|
||||
register(crate_iron, ItemBlockStorageCrate.class);
|
||||
register(crate_steel, ItemBlockStorageCrate.class);
|
||||
register(crate_desh, ItemBlockStorageCrate.class);
|
||||
register(crate_tungsten, ItemBlockStorageCrate.class);
|
||||
register(crate_template, ItemBlockStorageCrate.class);
|
||||
register(safe, ItemBlockStorageCrate.class);
|
||||
register(mass_storage, ItemBlockStorageCrate.class);
|
||||
|
||||
//Junk
|
||||
GameRegistry.registerBlock(boxcar, boxcar.getUnlocalizedName());
|
||||
|
||||
@ -5,9 +5,9 @@ import java.util.Random;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.config.BombConfig;
|
||||
import com.hbm.entity.logic.EntityBalefire;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.interfaces.IBomb;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.tileentity.bomb.TileEntityCrashedBomb;
|
||||
|
||||
@ -108,10 +108,10 @@ public class BlockCrashedBomb extends BlockContainer implements IBomb {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "muke");
|
||||
data.setBoolean("balefire", true);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x + 0.5, y + 0.5, z + 0.5), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 0.5, z + 0.5, 250));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, x + 0.5, y + 0.5, z + 0.5), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 0.5, z + 0.5, 250));
|
||||
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
||||
return BombReturnCode.DETONATED;
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.entity.projectile.EntityShrapnel;
|
||||
import com.hbm.explosion.ExplosionNT;
|
||||
import com.hbm.explosion.ExplosionNT.ExAttrib;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -43,10 +43,10 @@ public class BlockVolcano extends BlockContainer implements ITooltipProvider, IB
|
||||
public int getSubCount() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
|
||||
|
||||
for(int i = 0; i < 5; ++i) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
@ -54,14 +54,14 @@ public class BlockVolcano extends BlockContainer implements ITooltipProvider, IB
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
|
||||
|
||||
int meta = stack.getItemDamage();
|
||||
|
||||
|
||||
if(meta == META_SMOLDERING) {
|
||||
list.add(EnumChatFormatting.GOLD + "SHIELD VOLCANO");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
list.add(BlockVolcano.isGrowing(meta) ? (EnumChatFormatting.RED + "DOES GROW") : (EnumChatFormatting.DARK_GRAY + "DOES NOT GROW"));
|
||||
list.add(BlockVolcano.isExtinguishing(meta) ? (EnumChatFormatting.RED + "DOES EXTINGUISH") : (EnumChatFormatting.DARK_GRAY + "DOES NOT EXTINGUISH"));
|
||||
}
|
||||
@ -71,25 +71,25 @@ public class BlockVolcano extends BlockContainer implements ITooltipProvider, IB
|
||||
public static final int META_GROWING_ACTIVE = 2;
|
||||
public static final int META_GROWING_EXTINGUISHING = 3;
|
||||
public static final int META_SMOLDERING = 4;
|
||||
|
||||
|
||||
public static boolean isGrowing(int meta) {
|
||||
return meta == META_GROWING_ACTIVE || meta == META_GROWING_EXTINGUISHING;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isExtinguishing(int meta) {
|
||||
return meta == META_STATIC_EXTINGUISHING || meta == META_GROWING_EXTINGUISHING;
|
||||
}
|
||||
|
||||
|
||||
public static class TileEntityVolcanoCore extends TileEntity {
|
||||
|
||||
private static List<ExAttrib> volcanoExplosion = Arrays.asList(new ExAttrib[] {ExAttrib.NODROP, ExAttrib.LAVA_V, ExAttrib.NOSOUND, ExAttrib.ALLMOD, ExAttrib.NOHURT});
|
||||
private static List<ExAttrib> volcanoRadExplosion = Arrays.asList(new ExAttrib[] {ExAttrib.NODROP, ExAttrib.LAVA_R, ExAttrib.NOSOUND, ExAttrib.ALLMOD, ExAttrib.NOHURT});
|
||||
|
||||
|
||||
public int volcanoTimer;
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
this.volcanoTimer++;
|
||||
|
||||
@ -99,24 +99,24 @@ public class BlockVolcano extends BlockContainer implements ITooltipProvider, IB
|
||||
this.blastMagmaChannel();
|
||||
this.raiseMagma();
|
||||
}
|
||||
|
||||
|
||||
double magmaChamber = this.magmaChamberSize();
|
||||
if(magmaChamber > 0) this.blastMagmaChamber(magmaChamber);
|
||||
|
||||
|
||||
Object[] melting = this.surfaceMeltingParams();
|
||||
if(melting != null) this.meltSurface((int)melting[0], (double)melting[1], (double)melting[2]);
|
||||
|
||||
|
||||
//self-explanatory
|
||||
if(this.isSpewing()) this.spawnBlobs();
|
||||
if(this.isSmoking()) this.spawnSmoke();
|
||||
|
||||
|
||||
//generates a 3x3x3 cube of lava
|
||||
this.surroundLava();
|
||||
}
|
||||
|
||||
|
||||
if(this.volcanoTimer >= this.getUpdateRate()) {
|
||||
this.volcanoTimer = 0;
|
||||
|
||||
|
||||
if(this.shouldGrow()) {
|
||||
worldObj.setBlock(xCoord, yCoord + 1, zCoord, this.getBlockType(), this.getBlockMetadata(), 3);
|
||||
worldObj.setBlock(xCoord, yCoord, zCoord, getLava());
|
||||
@ -128,16 +128,16 @@ public class BlockVolcano extends BlockContainer implements ITooltipProvider, IB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isRadioacitve() {
|
||||
return this.getBlockType() == ModBlocks.volcano_rad_core;
|
||||
}
|
||||
|
||||
|
||||
protected Block getLava() {
|
||||
if(isRadioacitve()) return ModBlocks.rad_lava_block;
|
||||
return ModBlocks.volcanic_lava_block;
|
||||
}
|
||||
|
||||
|
||||
protected List<ExAttrib> getExpAttrb() {
|
||||
return this.isRadioacitve() ? this.volcanoRadExplosion : this.volcanoExplosion;
|
||||
}
|
||||
@ -153,42 +153,42 @@ public class BlockVolcano extends BlockContainer implements ITooltipProvider, IB
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setInteger("tier", this.volcanoTimer);
|
||||
}
|
||||
|
||||
|
||||
private boolean shouldGrow() {
|
||||
return isGrowing() && yCoord < 200;
|
||||
}
|
||||
|
||||
|
||||
private boolean isGrowing() {
|
||||
int meta = this.getBlockMetadata();
|
||||
return meta == META_GROWING_ACTIVE || meta == META_GROWING_EXTINGUISHING;
|
||||
}
|
||||
|
||||
|
||||
private boolean isExtinguishing() {
|
||||
int meta = this.getBlockMetadata();
|
||||
return meta == META_STATIC_EXTINGUISHING || meta == META_GROWING_EXTINGUISHING;
|
||||
}
|
||||
|
||||
|
||||
private boolean isSmoking() {
|
||||
return this.getBlockMetadata() != META_SMOLDERING;
|
||||
}
|
||||
|
||||
|
||||
private boolean isSpewing() {
|
||||
return this.getBlockMetadata() != META_SMOLDERING;
|
||||
}
|
||||
|
||||
|
||||
private boolean hasVerticalChannel() {
|
||||
return this.getBlockMetadata() != META_SMOLDERING;
|
||||
}
|
||||
|
||||
|
||||
private double magmaChamberSize() {
|
||||
return this.getBlockMetadata() == META_SMOLDERING ? 15 : 0;
|
||||
}
|
||||
|
||||
|
||||
/* count per tick, radius, depth */
|
||||
private Object[] surfaceMeltingParams() {
|
||||
return this.getBlockMetadata() == META_SMOLDERING ? new Object[] {50, 50D, 10D} : null;
|
||||
}
|
||||
|
||||
|
||||
private int getUpdateRate() {
|
||||
switch(this.getBlockMetadata()) {
|
||||
case META_STATIC_EXTINGUISHING: return 60 * 60 * 20; //once per hour
|
||||
@ -197,7 +197,7 @@ public class BlockVolcano extends BlockContainer implements ITooltipProvider, IB
|
||||
default: return 10;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Causes two magma explosions, one from bedrock to the core and one from the core to 15 blocks above. */
|
||||
private void blastMagmaChannel() {
|
||||
ExplosionNT explosion = new ExplosionNT(worldObj, null, xCoord + 0.5, yCoord + worldObj.rand.nextInt(15) + 1.5, zCoord + 0.5, 7);
|
||||
@ -205,53 +205,53 @@ public class BlockVolcano extends BlockContainer implements ITooltipProvider, IB
|
||||
ExplosionNT explosion2 = new ExplosionNT(worldObj, null, xCoord + 0.5 + worldObj.rand.nextGaussian() * 3, worldObj.rand.nextInt(yCoord + 1), zCoord + 0.5 + worldObj.rand.nextGaussian() * 3, 10);
|
||||
explosion2.addAllAttrib(getExpAttrb()).explode();
|
||||
}
|
||||
|
||||
|
||||
/** Causes two magma explosions at a random position around the core, one at normal and one at half range. */
|
||||
private void blastMagmaChamber(double size) {
|
||||
|
||||
|
||||
for(int i = 0; i < 2; i++) {
|
||||
double dist = size / (double) (i + 1);
|
||||
ExplosionNT explosion = new ExplosionNT(worldObj, null, xCoord + 0.5 + worldObj.rand.nextGaussian() * dist, yCoord + 0.5 + worldObj.rand.nextGaussian() * dist, zCoord + 0.5 + worldObj.rand.nextGaussian() * dist, 7);
|
||||
explosion.addAllAttrib(getExpAttrb()).explode();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Randomly selects surface blocks and converts them into lava if solid or air if not solid. */
|
||||
private void meltSurface(int count, double radius, double depth) {
|
||||
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
int x = (int) Math.floor(xCoord + worldObj.rand.nextGaussian() * radius);
|
||||
int z = (int) Math.floor(zCoord + worldObj.rand.nextGaussian() * radius);
|
||||
//gaussian distribution makes conversions more likely on the surface and rarer at the bottom
|
||||
int y = worldObj.getHeightValue(x, z) + 1 - (int) Math.floor(Math.abs(worldObj.rand.nextGaussian() * depth));
|
||||
|
||||
|
||||
Block b = worldObj.getBlock(x, y, z);
|
||||
|
||||
|
||||
if(!b.isAir(worldObj, x, y, z) && b.getExplosionResistance(null) < Blocks.obsidian.getExplosionResistance(null)) {
|
||||
//turn into lava if solid block, otherwise just break
|
||||
worldObj.setBlock(x, y, z, b.isNormalCube() ? this.getLava() : Blocks.air);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Increases the magma level in a small radius around the core. */
|
||||
private void raiseMagma() {
|
||||
|
||||
int rX = xCoord - 10 + worldObj.rand.nextInt(21);
|
||||
int rY = yCoord + worldObj.rand.nextInt(11);
|
||||
int rZ = zCoord - 10 + worldObj.rand.nextInt(21);
|
||||
|
||||
|
||||
if(worldObj.getBlock(rX, rY, rZ) == Blocks.air && worldObj.getBlock(rX, rY - 1, rZ) == this.getLava())
|
||||
worldObj.setBlock(rX, rY, rZ, this.getLava());
|
||||
}
|
||||
|
||||
|
||||
/** Creates a 3x3x3 lava sphere around the core. */
|
||||
private void surroundLava() {
|
||||
|
||||
|
||||
for(int i = -1; i <= 1; i++) {
|
||||
for(int j = -1; j <= 1; j++) {
|
||||
for(int k = -1; k <= 1; k++) {
|
||||
|
||||
|
||||
if(i != 0 || j != 0 || k != 0) {
|
||||
worldObj.setBlock(xCoord + i, yCoord + j, zCoord + k, this.getLava());
|
||||
}
|
||||
@ -259,10 +259,10 @@ public class BlockVolcano extends BlockContainer implements ITooltipProvider, IB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Spews specially tagged shrapnels which create volcanic lava and monoxide clouds. */
|
||||
private void spawnBlobs() {
|
||||
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
EntityShrapnel frag = new EntityShrapnel(worldObj);
|
||||
frag.setLocationAndAngles(xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, 0.0F, 0.0F);
|
||||
@ -277,13 +277,13 @@ public class BlockVolcano extends BlockContainer implements ITooltipProvider, IB
|
||||
worldObj.spawnEntityInWorld(frag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** I SEE SMOKE, AND WHERE THERE'S SMOKE THERE'S FIRE! */
|
||||
private void spawnSmoke() {
|
||||
NBTTagCompound dPart = new NBTTagCompound();
|
||||
dPart.setString("type", "vanillaExt");
|
||||
dPart.setString("mode", "volcano");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(dPart, xCoord + 0.5, yCoord + 10, zCoord + 0.5), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 10, zCoord + 0.5, 250));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(dPart, xCoord + 0.5, yCoord + 10, zCoord + 0.5), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 10, zCoord + 0.5, 250));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ import java.awt.Color;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
@ -169,7 +169,7 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
||||
data.setFloat("yaw", 90);
|
||||
}
|
||||
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z),
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, x, y, z),
|
||||
new TargetPoint(worldObj.provider.dimensionId, x, y, z, 100));
|
||||
|
||||
color = prevColor;
|
||||
|
||||
@ -100,64 +100,67 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IT
|
||||
if(this == ModBlocks.safe) return new TileEntitySafe();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private static boolean dropInv = true;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
|
||||
|
||||
if(!player.capabilities.isCreativeMode && !world.isRemote && willHarvest) {
|
||||
|
||||
|
||||
ItemStack drop = new ItemStack(this);
|
||||
ISidedInventory inv = (ISidedInventory)world.getTileEntity(x, y, z);
|
||||
|
||||
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
|
||||
|
||||
if(inv != null) {
|
||||
|
||||
|
||||
for(int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
|
||||
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if(stack == null)
|
||||
continue;
|
||||
|
||||
|
||||
NBTTagCompound slot = new NBTTagCompound();
|
||||
stack.writeToNBT(slot);
|
||||
nbt.setTag("slot" + i, slot);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(inv instanceof TileEntityLockableBase) {
|
||||
TileEntityLockableBase lockable = (TileEntityLockableBase) inv;
|
||||
|
||||
|
||||
if(lockable.isLocked()) {
|
||||
nbt.setInteger("lock", lockable.getPins());
|
||||
nbt.setDouble("lockMod", lockable.getMod());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(inv instanceof TileEntityCrateBase)
|
||||
nbt.setBoolean("spiders", ((TileEntityCrateBase) inv).hasSpiders);
|
||||
|
||||
if(!nbt.hasNoTags()) {
|
||||
drop.stackTagCompound = nbt;
|
||||
|
||||
|
||||
try {
|
||||
byte[] abyte = CompressedStreamTools.compress(nbt);
|
||||
|
||||
|
||||
if(abyte.length > 6000) {
|
||||
player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "Warning: Container NBT exceeds 6kB, contents will be ejected!"));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(this)));
|
||||
return world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
} catch(IOException e) { }
|
||||
}
|
||||
|
||||
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, drop));
|
||||
}
|
||||
|
||||
|
||||
dropInv = false;
|
||||
boolean flag = world.setBlockToAir(x, y, z);
|
||||
dropInv = true;
|
||||
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
@ -172,6 +175,8 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IT
|
||||
TileEntity entity = world.getTileEntity(x, y, z);
|
||||
if(entity instanceof TileEntityCrateBase && ((TileEntityCrateBase) entity).canAccess(player)) {
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||
TileEntityCrateBase crate = (TileEntityCrateBase) entity;
|
||||
TileEntityCrateBase.spawnSpiders(player, world, crate);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
@ -181,24 +186,27 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IT
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
|
||||
|
||||
ISidedInventory inv = (ISidedInventory)world.getTileEntity(x, y, z);
|
||||
|
||||
|
||||
if(inv != null && stack.hasTagCompound()) {
|
||||
|
||||
|
||||
for(int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
inv.setInventorySlotContents(i, ItemStack.loadItemStackFromNBT(stack.stackTagCompound.getCompoundTag("slot" + i)));
|
||||
}
|
||||
|
||||
|
||||
if(inv instanceof TileEntityLockableBase) {
|
||||
TileEntityLockableBase lockable = (TileEntityLockableBase) inv;
|
||||
|
||||
|
||||
if(stack.stackTagCompound.hasKey("lock")) {
|
||||
lockable.setPins(stack.stackTagCompound.getInteger("lock"));
|
||||
lockable.setMod(stack.stackTagCompound.getDouble("lockMod"));
|
||||
lockable.lock();
|
||||
}
|
||||
}
|
||||
if(inv instanceof TileEntityCrateBase) {
|
||||
((TileEntityCrateBase) inv).hasSpiders = stack.stackTagCompound.getBoolean("spiders");
|
||||
}
|
||||
}
|
||||
|
||||
if(this != ModBlocks.safe)
|
||||
@ -219,37 +227,37 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IT
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
|
||||
if(dropInv) {
|
||||
ISidedInventory sided = (ISidedInventory) world.getTileEntity(x, y, z);
|
||||
Random rand = world.rand;
|
||||
|
||||
|
||||
if(sided != null) {
|
||||
for(int i1 = 0; i1 < sided.getSizeInventory(); ++i1) {
|
||||
ItemStack itemstack = sided.getStackInSlot(i1);
|
||||
|
||||
|
||||
if(itemstack != null) {
|
||||
float f = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = rand.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
|
||||
while(itemstack.stackSize > 0) {
|
||||
int j1 = rand.nextInt(21) + 10;
|
||||
|
||||
|
||||
if(j1 > itemstack.stackSize) {
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
|
||||
if(itemstack.hasTagCompound()) {
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) rand.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) rand.nextGaussian() * f3 + 0.2F;
|
||||
@ -258,7 +266,7 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
world.func_147453_f(x, y, z, block);
|
||||
}
|
||||
}
|
||||
@ -275,12 +283,12 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IT
|
||||
public int getSubCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
|
||||
return Container.calcRedstoneFromInventory((IInventory) world.getTileEntity(x, y, z));
|
||||
@ -289,27 +297,49 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IT
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
if(stack.hasTagCompound()) {
|
||||
|
||||
|
||||
if(stack.stackTagCompound.getBoolean("spiders")) {
|
||||
if(stack.stackTagCompound.hasKey("lock")) {
|
||||
list.add(EnumChatFormatting.RED + "This container is locked.");
|
||||
}
|
||||
list.add(EnumChatFormatting.GRAY + "" + EnumChatFormatting.ITALIC + "Skittering emanates from within..."); // lamo
|
||||
return;
|
||||
}
|
||||
|
||||
if(stack.stackTagCompound.hasKey("lock")) {
|
||||
list.add(EnumChatFormatting.RED + "This container is locked."); // Sorry people who want to see what's in it while it's locked...
|
||||
|
||||
for(int i = 0; i < 104; i++) {
|
||||
ItemStack content = ItemStack.loadItemStackFromNBT(stack.stackTagCompound.getCompoundTag("slot" + i));
|
||||
if(content != null) {
|
||||
list.add(EnumChatFormatting.YELLOW + "It feels heavy...");
|
||||
return;
|
||||
}
|
||||
}
|
||||
list.add(EnumChatFormatting.YELLOW + "It feels empty...");
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> contents = new ArrayList();
|
||||
int amount = 0;
|
||||
|
||||
for(int i = 0; i < 100; i++) { //whatever the biggest container is, i can't be bothered to check
|
||||
|
||||
for(int i = 0; i < 104; i++) { //whatever the biggest container is, i can't be bothered to check
|
||||
ItemStack content = ItemStack.loadItemStackFromNBT(stack.stackTagCompound.getCompoundTag("slot" + i));
|
||||
|
||||
|
||||
if(content != null) {
|
||||
amount++;
|
||||
|
||||
|
||||
if(contents.size() < 10) {
|
||||
contents.add(EnumChatFormatting.AQUA + " - " + content.getDisplayName() + (content.stackSize > 1 ? (" x" + content.stackSize) : ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!contents.isEmpty()) {
|
||||
list.add(EnumChatFormatting.AQUA + "Contains:");
|
||||
list.addAll(contents);
|
||||
amount -= contents.size();
|
||||
|
||||
|
||||
if(amount > 0) {
|
||||
list.add(EnumChatFormatting.AQUA + "...and " + amount + " more.");
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ package com.hbm.blocks.generic;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.util.ParticleUtil;
|
||||
|
||||
@ -41,7 +41,7 @@ public class PartEmitter extends BlockContainer implements IToolable, ITooltipPr
|
||||
te.markDirty();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -50,21 +50,21 @@ public class PartEmitter extends BlockContainer implements IToolable, ITooltipPr
|
||||
public static final int range = 150;
|
||||
public int effect = 0;
|
||||
public static final int effectCount = 4;
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
double x = xCoord + 0.5;
|
||||
double y = yCoord + 0.5;
|
||||
double z = zCoord + 0.5;
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
|
||||
if(effect == 1) {
|
||||
ParticleUtil.spawnGasFlame(worldObj, xCoord + worldObj.rand.nextDouble(), yCoord + 4.5 + worldObj.rand.nextDouble(), zCoord + worldObj.rand.nextDouble(), worldObj.rand.nextGaussian() * 0.2, 0.1, worldObj.rand.nextGaussian() * 0.2);
|
||||
}
|
||||
|
||||
|
||||
if(effect == 2) {
|
||||
data.setString("type", "tower");
|
||||
data.setFloat("lift", 5F);
|
||||
@ -79,15 +79,15 @@ public class PartEmitter extends BlockContainer implements IToolable, ITooltipPr
|
||||
data.setFloat("base", 1F);
|
||||
data.setFloat("max", 10F);
|
||||
data.setInteger("life", 750 + worldObj.rand.nextInt(250));
|
||||
|
||||
|
||||
x = xCoord + 0.5 + worldObj.rand.nextDouble() * 3 - 1.5;
|
||||
y = yCoord + 1;
|
||||
z = zCoord + 0.5 + worldObj.rand.nextDouble() * 3 - 1.5;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(data.hasKey("type")) {
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -98,7 +98,7 @@ public class PartEmitter extends BlockContainer implements IToolable, ITooltipPr
|
||||
this.writeToNBT(nbt);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
this.readFromNBT(pkt.func_148857_g());
|
||||
@ -121,4 +121,4 @@ public class PartEmitter extends BlockContainer implements IToolable, ITooltipPr
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
list.add(EnumChatFormatting.GOLD + "Use hand drill to cycle special effects");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,8 +4,8 @@ import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.machine.BlockICF.TileEntityBlockICF;
|
||||
import com.hbm.blocks.machine.BlockICFLaserComponent.EnumICFPart;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.tileentity.machine.TileEntityICFController;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
@ -209,7 +209,7 @@ public class MachineICFController extends BlockContainer implements ILookOverlay
|
||||
data.setInteger("expires", 5_000);
|
||||
data.setDouble("dist", 128D);
|
||||
if(message != null) data.setString("label", message);
|
||||
PacketDispatcher.wrapper.sendTo(new AuxParticlePacketNT(data, x, y, z), (EntityPlayerMP) player);
|
||||
PacketThreading.createSendToThreadedPacket(new AuxParticlePacketNT(data, x, y, z), (EntityPlayerMP) player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,9 +3,9 @@ package com.hbm.blocks.machine;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.machine.BlockPWR.TileEntityBlockPWR;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.tileentity.machine.TileEntityPWRController;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
@ -194,7 +194,7 @@ public class MachinePWRController extends BlockContainer implements ITooltipProv
|
||||
data.setInteger("expires", 5_000);
|
||||
data.setDouble("dist", 128D);
|
||||
if(message != null) data.setString("label", message);
|
||||
PacketDispatcher.wrapper.sendTo(new AuxParticlePacketNT(data, x, y, z), (EntityPlayerMP) player);
|
||||
PacketThreading.createSendToThreadedPacket(new AuxParticlePacketNT(data, x, y, z), (EntityPlayerMP) player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,10 +5,10 @@ import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.inventory.material.Mats;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityZirnoxDestroyed;
|
||||
@ -49,29 +49,29 @@ public class ZirnoxDestroyed extends BlockDummyable {
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
|
||||
|
||||
Block block = world.getBlock(x, y + 1, z);
|
||||
|
||||
|
||||
if(block == Blocks.air) {
|
||||
if(rand.nextInt(10) == 0)
|
||||
world.setBlock(x, y + 1, z, ModBlocks.gas_meltdown);
|
||||
|
||||
|
||||
} else if(block == ModBlocks.foam_layer || block == ModBlocks.block_foam) {
|
||||
if(rand.nextInt(25) == 0) {
|
||||
int pos[] = this.findCore(world, x, y, z);
|
||||
|
||||
|
||||
if(pos != null) {
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
|
||||
|
||||
if(te instanceof TileEntityZirnoxDestroyed)
|
||||
((TileEntityZirnoxDestroyed)te).onFire = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(rand.nextInt(10) == 0 && world.getBlock(x, y + 1, z) == Blocks.air)
|
||||
world.setBlock(x, y + 1, z, ModBlocks.gas_meltdown);
|
||||
|
||||
|
||||
super.updateTick(world, x, y, z, rand);
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ public class ZirnoxDestroyed extends BlockDummyable {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "rbmkflame");
|
||||
data.setInteger("maxAge", 90);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x + 0.25 + world.rand.nextDouble() * 0.5, y + 1.75, z + 0.25 + world.rand.nextDouble() * 0.5), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 1.75, z + 0.5, 75));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, x + 0.25 + world.rand.nextDouble() * 0.5, y + 1.75, z + 0.25 + world.rand.nextDouble() * 0.5), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 1.75, z + 0.5, 75));
|
||||
MainRegistry.proxy.effectNT(data);
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5, z + 0.5, "fire.fire", 1.0F + world.rand.nextFloat(), world.rand.nextFloat() * 0.7F + 0.3F);
|
||||
}
|
||||
@ -117,7 +117,7 @@ public class ZirnoxDestroyed extends BlockDummyable {
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
return new int[] {1, 0, 2, 2, 2, 2,};
|
||||
return new int[] {1, 0, 2, 2, 2, 2,};
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -129,4 +129,4 @@ public class ZirnoxDestroyed extends BlockDummyable {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,8 +3,8 @@ package com.hbm.blocks.machine.rbmk;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -24,29 +24,29 @@ public class RBMKDebrisBurning extends RBMKDebris {
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
|
||||
|
||||
if(!world.isRemote) {
|
||||
|
||||
|
||||
if(rand.nextInt(5) == 0) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "rbmkflame");
|
||||
data.setInteger("maxAge", 300);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x + 0.25 + rand.nextDouble() * 0.5, y + 1.75, z + 0.25 + rand.nextDouble() * 0.5), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 1.75, z + 0.5, 75));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, x + 0.25 + rand.nextDouble() * 0.5, y + 1.75, z + 0.25 + rand.nextDouble() * 0.5), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 1.75, z + 0.5, 75));
|
||||
MainRegistry.proxy.effectNT(data);
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5, z + 0.5, "fire.fire", 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F);
|
||||
}
|
||||
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(rand.nextInt(6));
|
||||
Block block = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
||||
|
||||
if(rand.nextInt(10) == 0 && block == Blocks.air) {
|
||||
world.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, ModBlocks.gas_meltdown);
|
||||
}
|
||||
|
||||
|
||||
//Foam helps stop the fire; Boron smothers it. 1.66% chance every 100-120 seconds for one side
|
||||
int chance = block == ModBlocks.foam_layer || block == ModBlocks.block_foam ||
|
||||
block == ModBlocks.sand_boron_layer || block == ModBlocks.sand_boron ? 10 : 100;
|
||||
|
||||
|
||||
if(rand.nextInt(chance) == 0) {
|
||||
world.setBlock(x, y, z, ModBlocks.pribris);
|
||||
} else {
|
||||
@ -63,7 +63,7 @@ public class RBMKDebrisBurning extends RBMKDebris {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "rbmkflame");
|
||||
data.setInteger("maxAge", 300);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x + 0.25 + world.rand.nextDouble() * 0.5, y + 1.75, z + 0.25 + world.rand.nextDouble() * 0.5), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 1.75, z + 0.5, 75));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, x + 0.25 + world.rand.nextDouble() * 0.5, y + 1.75, z + 0.25 + world.rand.nextDouble() * 0.5), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 1.75, z + 0.5, 75));
|
||||
MainRegistry.proxy.effectNT(data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,8 +4,8 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.util.ContaminationUtil;
|
||||
import com.hbm.util.ContaminationUtil.ContaminationType;
|
||||
@ -33,88 +33,88 @@ public class RBMKDebrisRadiating extends RBMKDebrisBurning {
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
|
||||
|
||||
if(!world.isRemote) {
|
||||
|
||||
|
||||
radiate(world, x, y, z);
|
||||
|
||||
|
||||
if(rand.nextInt(5) == 0) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "rbmkflame");
|
||||
data.setInteger("maxAge", 300);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x + rand.nextDouble(), y + 1.75, z + rand.nextDouble()), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 1.75, z + 0.5, 75));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, x + rand.nextDouble(), y + 1.75, z + rand.nextDouble()), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 1.75, z + 0.5, 75));
|
||||
//MainRegistry.proxy.effectNT(data);
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5, z + 0.5, "fire.fire", 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F);
|
||||
|
||||
}
|
||||
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(rand.nextInt(6));
|
||||
Block block = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
||||
|
||||
|
||||
if(rand.nextInt(10) == 0 && block == Blocks.air) {
|
||||
world.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, ModBlocks.gas_meltdown);
|
||||
}
|
||||
|
||||
|
||||
//Boron sand helps stop the fission reaction; 0.66% chance every 20-40 ticks for one side
|
||||
int chance = block == ModBlocks.sand_boron_layer || block == ModBlocks.sand_boron ? 25 : 1000;
|
||||
|
||||
|
||||
if(rand.nextInt(chance) == 0) {
|
||||
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
|
||||
if(meta < 15) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta + 1, 2);
|
||||
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
|
||||
} else {
|
||||
world.setBlock(x, y, z, ModBlocks.pribris_burning);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void radiate(World world, int x, int y, int z) {
|
||||
|
||||
|
||||
float rads = 1000000F;
|
||||
double range = 100D;
|
||||
|
||||
|
||||
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(x + 0.5, y + 0.5, z + 0.5, x + 0.5, y + 0.5, z + 0.5).expand(range, range, range));
|
||||
|
||||
|
||||
for(EntityLivingBase e : entities) {
|
||||
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(e.posX - (x + 0.5), (e.posY + e.getEyeHeight()) - (y + 0.5), e.posZ - (z + 0.5));
|
||||
double len = vec.lengthVector();
|
||||
vec = vec.normalize();
|
||||
|
||||
|
||||
float res = 0;
|
||||
|
||||
|
||||
for(int i = 1; i < len; i++) {
|
||||
|
||||
int ix = (int)Math.floor(x + 0.5 + vec.xCoord * i);
|
||||
int iy = (int)Math.floor(y + 0.5 + vec.yCoord * i);
|
||||
int iz = (int)Math.floor(z + 0.5 + vec.zCoord * i);
|
||||
|
||||
|
||||
res += world.getBlock(ix, iy, iz).getExplosionResistance(null);
|
||||
}
|
||||
|
||||
|
||||
if(res < 1)
|
||||
res = 1;
|
||||
|
||||
|
||||
float eRads = rads;
|
||||
eRads /= (float)res;
|
||||
eRads /= (float)(len * len);
|
||||
|
||||
|
||||
ContaminationUtil.contaminate(e, HazardType.RADIATION, ContaminationType.CREATIVE, eRads);
|
||||
|
||||
|
||||
if(len < 5) {
|
||||
e.attackEntityFrom(DamageSource.inFire, 100);
|
||||
}
|
||||
|
||||
|
||||
if(e instanceof EntityPlayer && len < 10) {
|
||||
EntityPlayer p = (EntityPlayer) e;
|
||||
|
||||
|
||||
if(p.getHeldItem() != null && p.getHeldItem().getItem() == ModItems.marshmallow && p.getHeldItem().getItemDamage() != 1 && p.getRNG().nextInt(100) == 0) {
|
||||
p.getHeldItem().setItemDamage(1);
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.hbm.entity.item;
|
||||
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -9,7 +9,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityFireworks extends Entity {
|
||||
|
||||
|
||||
int color;
|
||||
int character;
|
||||
|
||||
@ -26,28 +26,28 @@ public class EntityFireworks extends Entity {
|
||||
|
||||
@Override
|
||||
protected void entityInit() { }
|
||||
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
|
||||
|
||||
this.moveEntity(0.0, 3.0D, 0.0);
|
||||
this.worldObj.spawnParticle("flame", posX, posY, posZ, 0.0, -0.3, 0.0);
|
||||
this.worldObj.spawnParticle("smoke", posX, posY, posZ, 0.0, -0.2, 0.0);
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
|
||||
ticksExisted++;
|
||||
|
||||
|
||||
if(this.ticksExisted > 30) {
|
||||
|
||||
|
||||
this.worldObj.playSoundEffect(posX, posY, posZ, "fireworks.blast", 20, 1F + this.rand.nextFloat() * 0.2F);
|
||||
|
||||
|
||||
this.setDead();
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "fireworks");
|
||||
data.setInteger("color", color);
|
||||
data.setInteger("char", character);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY, posZ), new TargetPoint(this.worldObj.provider.dimensionId, posX, posY, posZ, 300));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, posX, posY, posZ), new TargetPoint(this.worldObj.provider.dimensionId, posX, posY, posZ, 300));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.hbm.entity.item;
|
||||
|
||||
import com.hbm.entity.cart.EntityMinecartBogie;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -12,7 +12,7 @@ import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityMagnusCartus extends EntityMinecart {
|
||||
|
||||
|
||||
public EntityMinecartBogie bogie;
|
||||
|
||||
public EntityMagnusCartus(World world) {
|
||||
@ -33,12 +33,12 @@ public class EntityMagnusCartus extends EntityMinecart {
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(25, new Integer(0));
|
||||
}
|
||||
|
||||
|
||||
public void setBogie(EntityMinecartBogie bogie) {
|
||||
this.bogie = bogie;
|
||||
this.dataWatcher.updateObject(25, bogie.getEntityId());
|
||||
}
|
||||
|
||||
|
||||
public int getBogieID() {
|
||||
return this.dataWatcher.getWatchableObjectInt(25);
|
||||
}
|
||||
@ -46,12 +46,12 @@ public class EntityMagnusCartus extends EntityMinecart {
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
|
||||
double dist = 3.0D;
|
||||
double force = 0.3D;
|
||||
|
||||
|
||||
if(bogie == null) {
|
||||
Vec3 vec = Vec3.createVectorHelper(dist, 0, 0);
|
||||
vec.rotateAroundY(rand.nextFloat() * 6.28F);
|
||||
@ -59,7 +59,7 @@ public class EntityMagnusCartus extends EntityMinecart {
|
||||
this.setBogie(bog);
|
||||
worldObj.spawnEntityInWorld(bog);
|
||||
}
|
||||
|
||||
|
||||
Vec3 delta = Vec3.createVectorHelper(posX - bogie.posX, posY - bogie.posY, posZ - bogie.posZ);
|
||||
delta = delta.normalize();
|
||||
delta.xCoord *= dist;
|
||||
@ -69,17 +69,17 @@ public class EntityMagnusCartus extends EntityMinecart {
|
||||
double x = posX - delta.xCoord;
|
||||
double y = posY - delta.yCoord;
|
||||
double z = posZ - delta.zCoord;
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "vanillaExt");
|
||||
data.setString("mode", "reddust");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(this.dimension, x, y, z, 25));
|
||||
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(this.dimension, x, y, z, 25));
|
||||
|
||||
Vec3 pull = Vec3.createVectorHelper(x - bogie.posX, y - bogie.posY, z - bogie.posZ);
|
||||
bogie.motionX += pull.xCoord * force;
|
||||
bogie.motionY += pull.yCoord * force;
|
||||
bogie.motionZ += pull.zCoord * force;
|
||||
|
||||
|
||||
if(pull.lengthVector() > 1) {
|
||||
this.motionX -= pull.xCoord * force;
|
||||
this.motionY -= pull.yCoord * force;
|
||||
@ -87,13 +87,13 @@ public class EntityMagnusCartus extends EntityMinecart {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
super.readEntityFromNBT(nbt);
|
||||
int bogieID = nbt.getInteger("bogie");
|
||||
Entity e = worldObj.getEntityByID(bogieID);
|
||||
|
||||
|
||||
if(e instanceof EntityMinecartBogie) {
|
||||
this.setBogie((EntityMinecartBogie) e);
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ package com.hbm.entity.logic;
|
||||
|
||||
import com.hbm.entity.projectile.EntityBulletBaseNT;
|
||||
import com.hbm.handler.BulletConfigSyncingUtil;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -14,7 +14,7 @@ import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityDeathBlast extends Entity {
|
||||
|
||||
|
||||
public static final int maxAge = 60;
|
||||
|
||||
public EntityDeathBlast(World p_i1582_1_) {
|
||||
@ -30,21 +30,21 @@ public class EntityDeathBlast extends Entity {
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound nbt) { }
|
||||
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
|
||||
|
||||
if(this.ticksExisted >= maxAge && !worldObj.isRemote) {
|
||||
this.setDead();
|
||||
|
||||
|
||||
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFacNoRad(worldObj, 40, posX, posY, posZ));
|
||||
|
||||
|
||||
int count = 100;
|
||||
for(int i = 0; i < count; i++) {
|
||||
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(0.2, 0, 0);
|
||||
vec.rotateAroundY((float)(2 * Math.PI * i / (float)count));
|
||||
|
||||
|
||||
EntityBulletBaseNT laser = new EntityBulletBaseNT(worldObj, BulletConfigSyncingUtil.MASKMAN_BOLT);
|
||||
laser.setPosition(posX, posY + 2, posZ);
|
||||
laser.motionX = vec.xCoord;
|
||||
@ -52,10 +52,10 @@ public class EntityDeathBlast extends Entity {
|
||||
laser.motionY = -0.01;
|
||||
worldObj.spawnEntityInWorld(laser);
|
||||
}
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "muke");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(worldObj.provider.dimensionId, posX, posY, posZ, 250));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(worldObj.provider.dimensionId, posX, posY, posZ, 250));
|
||||
worldObj.playSoundEffect(posX, posY, posZ, "hbm:weapon.mukeExplosion", 25.0F, 0.9F);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import com.hbm.config.BombConfig;
|
||||
@ -16,7 +17,6 @@ import com.hbm.explosion.ExplosionNukeGeneric;
|
||||
import com.hbm.explosion.ExplosionSolinium;
|
||||
import com.hbm.interfaces.Spaghetti;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -27,7 +27,7 @@ import net.minecraft.world.World;
|
||||
|
||||
@Spaghetti("why???")
|
||||
public class EntityNukeExplosionMK3 extends EntityExplosionChunkloading {
|
||||
|
||||
|
||||
public int age = 0;
|
||||
public int destructionRange = 0;
|
||||
public ExplosionNukeAdvanced exp;
|
||||
@ -55,14 +55,14 @@ public class EntityNukeExplosionMK3 extends EntityExplosionChunkloading {
|
||||
did2 = nbt.getBoolean("did2");
|
||||
waste = nbt.getBoolean("waste");
|
||||
extType = nbt.getInteger("extType");
|
||||
|
||||
|
||||
long time = nbt.getLong("milliTime");
|
||||
|
||||
|
||||
if(BombConfig.limitExplosionLifespan > 0 && System.currentTimeMillis() - time > BombConfig.limitExplosionLifespan * 1000) {
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
|
||||
if(this.waste) {
|
||||
exp = new ExplosionNukeAdvanced((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, this.destructionRange, this.coefficient, 0);
|
||||
exp.readFromNbt(nbt, "exp_");
|
||||
@ -97,9 +97,9 @@ public class EntityNukeExplosionMK3 extends EntityExplosionChunkloading {
|
||||
nbt.setBoolean("did2", did2);
|
||||
nbt.setBoolean("waste", waste);
|
||||
nbt.setInteger("extType", extType);
|
||||
|
||||
|
||||
nbt.setLong("milliTime", System.currentTimeMillis());
|
||||
|
||||
|
||||
if(exp != null)
|
||||
exp.saveToNbt(nbt, "exp_");
|
||||
if(wst != null)
|
||||
@ -110,7 +110,7 @@ public class EntityNukeExplosionMK3 extends EntityExplosionChunkloading {
|
||||
expl.saveToNbt(nbt, "expl_");
|
||||
if(sol != null)
|
||||
sol.saveToNbt(nbt, "sol_");
|
||||
|
||||
|
||||
}
|
||||
|
||||
public EntityNukeExplosionMK3(World p_i1582_1_) {
|
||||
@ -122,15 +122,15 @@ public class EntityNukeExplosionMK3 extends EntityExplosionChunkloading {
|
||||
super.onUpdate();
|
||||
|
||||
if(!worldObj.isRemote) loadChunk((int) Math.floor(posX / 16D), (int) Math.floor(posZ / 16D));
|
||||
|
||||
|
||||
if(!this.did)
|
||||
{
|
||||
for(Object player : this.worldObj.playerEntities)
|
||||
((EntityPlayer)player).triggerAchievement(MainRegistry.achManhattan);
|
||||
|
||||
|
||||
if(GeneralConfig.enableExtendedLogging && !worldObj.isRemote)
|
||||
MainRegistry.logger.log(Level.INFO, "[NUKE] Initialized mk3 explosion at " + posX + " / " + posY + " / " + posZ + " with strength " + destructionRange + "!");
|
||||
|
||||
|
||||
if(this.waste)
|
||||
{
|
||||
exp = new ExplosionNukeAdvanced((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, this.destructionRange, this.coefficient, 0);
|
||||
@ -142,15 +142,15 @@ public class EntityNukeExplosionMK3 extends EntityExplosionChunkloading {
|
||||
if(extType == 1)
|
||||
sol = new ExplosionSolinium((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, this.destructionRange, this.coefficient, this.coefficient2);
|
||||
}
|
||||
|
||||
|
||||
this.did = true;
|
||||
}
|
||||
|
||||
|
||||
speed += 1; //increase speed to keep up with expansion
|
||||
|
||||
|
||||
boolean flag = false;
|
||||
boolean flag3 = false;
|
||||
|
||||
|
||||
for(int i = 0; i < this.speed; i++) {
|
||||
if(waste) {
|
||||
flag = exp.update();
|
||||
@ -176,17 +176,17 @@ public class EntityNukeExplosionMK3 extends EntityExplosionChunkloading {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!flag)
|
||||
{
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
||||
|
||||
|
||||
if(waste || extType != 1) {
|
||||
ExplosionNukeGeneric.dealDamage(this.worldObj, this.posX, this.posY, this.posZ, this.destructionRange * 2);
|
||||
} else {
|
||||
ExplosionHurtUtil.doRadiation(worldObj, posX, posY, posZ, 15000, 250000, this.destructionRange);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
if (!did2 && waste) {
|
||||
EntityFalloutRain fallout = new EntityFalloutRain(this.worldObj, (int)(this.destructionRange * 1.8) * 10);
|
||||
@ -197,18 +197,18 @@ public class EntityNukeExplosionMK3 extends EntityExplosionChunkloading {
|
||||
|
||||
this.worldObj.spawnEntityInWorld(fallout);
|
||||
//this.worldObj.getWorldInfo().setRaining(true);
|
||||
|
||||
|
||||
did2 = true;
|
||||
}
|
||||
}
|
||||
|
||||
age++;
|
||||
}
|
||||
|
||||
|
||||
public static HashMap<ATEntry, Long> at = new HashMap();
|
||||
|
||||
|
||||
public static EntityNukeExplosionMK3 statFacFleija(World world, double x, double y, double z, int range) {
|
||||
|
||||
|
||||
EntityNukeExplosionMK3 entity = new EntityNukeExplosionMK3(world);
|
||||
entity.posX = x;
|
||||
entity.posY = y;
|
||||
@ -217,63 +217,63 @@ public class EntityNukeExplosionMK3 extends EntityExplosionChunkloading {
|
||||
entity.speed = BombConfig.blastSpeed;
|
||||
entity.coefficient = 1.0F;
|
||||
entity.waste = false;
|
||||
|
||||
|
||||
Iterator<Entry<ATEntry, Long>> it = at.entrySet().iterator();
|
||||
|
||||
|
||||
while(it.hasNext()) {
|
||||
|
||||
|
||||
Entry<ATEntry, Long> next = it.next();
|
||||
if(next.getValue() < world.getTotalWorldTime()) {
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
ATEntry entry = next.getKey();
|
||||
if(entry.dim != world.provider.dimensionId) continue;
|
||||
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(x - entry.x, y - entry.y, z - entry.z);
|
||||
|
||||
|
||||
if(vec.lengthVector() < 300) {
|
||||
entity.setDead();
|
||||
|
||||
/* just to make sure */
|
||||
if(!world.isRemote) {
|
||||
|
||||
|
||||
for(int i = 0; i < 2; i++) {
|
||||
double ix = i == 0 ? x : (entry.x + 0.5);
|
||||
double iy = i == 0 ? y : (entry.y + 0.5);
|
||||
double iz = i == 0 ? z : (entry.z + 0.5);
|
||||
|
||||
|
||||
world.playSoundEffect(ix, iy, iz, "hbm:entity.ufoBlast", 15.0F, 0.7F + world.rand.nextFloat() * 0.2F);
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "plasmablast");
|
||||
data.setFloat("r", 0.0F);
|
||||
data.setFloat("g", 0.75F);
|
||||
data.setFloat("b", 1.0F);
|
||||
data.setFloat("scale", 7.5F);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, ix, iy, iz), new TargetPoint(entry.dim, ix, iy, iz, 150));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, ix, iy, iz), new TargetPoint(entry.dim, ix, iy, iz, 150));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
public EntityNukeExplosionMK3 makeSol() {
|
||||
this.extType = 1;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public static class ATEntry {
|
||||
public int dim;
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
|
||||
|
||||
public ATEntry(int dim, int x, int y, int z) {
|
||||
this.dim = dim;
|
||||
this.x = x;
|
||||
|
||||
@ -6,9 +6,9 @@ import java.util.List;
|
||||
|
||||
import com.hbm.explosion.ExplosionNT;
|
||||
import com.hbm.explosion.ExplosionNT.ExAttrib;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -36,10 +36,10 @@ public class EntityMissileShuttle extends EntityMissileBaseNT {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "rbmkmush");
|
||||
data.setFloat("scale", 10);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, this.posX + 0.5, this.posY + 1, this.posZ + 0.5), new TargetPoint(worldObj.provider.dimensionId,this.posX + 0.5, this.posY + 1, this.posZ + 0.5, 250));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, this.posX + 0.5, this.posY + 1, this.posZ + 0.5), new TargetPoint(worldObj.provider.dimensionId,this.posX + 0.5, this.posY + 1, this.posZ + 0.5, 250));
|
||||
MainRegistry.proxy.effectNT(data);
|
||||
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "hbm:weapon.robin_explosion", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "hbm:weapon.robin_explosion", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -58,7 +58,7 @@ public class EntityMissileShuttle extends EntityMissileBaseNT {
|
||||
public ItemStack getDebrisRareDrop() {
|
||||
return new ItemStack(ModItems.missile_generic);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return "radar.target.shuttle";
|
||||
@ -68,4 +68,4 @@ public class EntityMissileShuttle extends EntityMissileBaseNT {
|
||||
public ItemStack getMissileItemForInfo() {
|
||||
return new ItemStack(ModItems.missile_shuttle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,12 +5,12 @@ import java.util.List;
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK5;
|
||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||
import com.hbm.explosion.ExplosionNukeSmall;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.inventory.OreDictManager.DictFrame;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.util.ContaminationUtil;
|
||||
import com.hbm.util.ContaminationUtil.ContaminationType;
|
||||
@ -46,7 +46,7 @@ public class EntityCreeperNuclear extends EntityCreeper {
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float amount) {
|
||||
|
||||
|
||||
// for some reason the nuclear explosion would damage the already dead entity, reviving it and forcing it to play the death animation
|
||||
if(this.isDead) return false;
|
||||
|
||||
@ -96,9 +96,9 @@ public class EntityCreeperNuclear extends EntityCreeper {
|
||||
ContaminationUtil.contaminate((EntityLivingBase) e, HazardType.RADIATION, ContaminationType.CREATIVE, 0.25F);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
|
||||
if(this.isEntityAlive() && this.getHealth() < this.getMaxHealth() && this.ticksExisted % 10 == 0) {
|
||||
this.heal(1.0F);
|
||||
}
|
||||
@ -109,14 +109,14 @@ public class EntityCreeperNuclear extends EntityCreeper {
|
||||
if(!this.worldObj.isRemote) {
|
||||
|
||||
this.setDead();
|
||||
|
||||
|
||||
boolean flag = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing");
|
||||
|
||||
if(this.getPowered()) {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "muke");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(dimension, posX, posY, posZ, 250));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(dimension, posX, posY, posZ, 250));
|
||||
worldObj.playSoundEffect(posX, posY + 0.5, posZ, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
|
||||
|
||||
if(flag) {
|
||||
|
||||
@ -2,10 +2,10 @@ package com.hbm.entity.mob;
|
||||
|
||||
import com.hbm.entity.projectile.EntityBullet;
|
||||
import com.hbm.entity.projectile.EntityChopperMine;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import api.hbm.entity.IRadiationImmune;
|
||||
@ -254,7 +254,7 @@ public class EntityHunterChopper extends EntityFlying implements IMob, IBossDisp
|
||||
data.setString("mode", "meteor");
|
||||
data.setInteger("count", 10);
|
||||
data.setDouble("width", 1);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY, posZ), new TargetPoint(dimension, posX, posY, posZ, 100));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, posX, posY, posZ), new TargetPoint(dimension, posX, posY, posZ, 100));
|
||||
}
|
||||
|
||||
rotationYaw += 20;
|
||||
|
||||
@ -7,8 +7,8 @@ import com.hbm.entity.mob.ai.EntityAIStartFlying;
|
||||
import com.hbm.entity.mob.ai.EntityAIStopFlying;
|
||||
import com.hbm.entity.mob.ai.EntityAISwimmingConditional;
|
||||
import com.hbm.entity.mob.ai.EntityAIWanderConditional;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.tool.ItemFertilizer;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -31,7 +31,7 @@ import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
|
||||
public class EntityPigeon extends EntityCreature implements IFlyingCreature, IAnimals {
|
||||
|
||||
|
||||
public float fallTime;
|
||||
public float dest;
|
||||
public float prevDest;
|
||||
@ -50,16 +50,16 @@ public class EntityPigeon extends EntityCreature implements IFlyingCreature, IAn
|
||||
this.tasks.addTask(7, new EntityAILookIdle(this));
|
||||
this.setSize(0.5F, 1.0F);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float amount) {
|
||||
|
||||
|
||||
if(amount >= this.getMaxHealth() * 2 && !worldObj.isRemote) {
|
||||
this.setDead();
|
||||
|
||||
|
||||
for(int i = 0; i < 10; i++) {
|
||||
Vec3 vec = Vec3.createVectorHelper(rand.nextGaussian(), rand.nextGaussian(), rand.nextGaussian()).normalize();
|
||||
|
||||
|
||||
EntityItem feather = new EntityItem(worldObj);
|
||||
feather.setEntityItemStack(new ItemStack(Items.feather));
|
||||
feather.setPosition(posX + vec.xCoord, posY + height / 2D + vec.yCoord, posZ + vec.zCoord);
|
||||
@ -68,13 +68,13 @@ public class EntityPigeon extends EntityCreature implements IFlyingCreature, IAn
|
||||
feather.motionZ = vec.zCoord * 0.5;
|
||||
worldObj.spawnEntityInWorld(feather);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return super.attackEntityFrom(source, amount);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isAIEnabled() {
|
||||
return true;
|
||||
@ -91,7 +91,7 @@ public class EntityPigeon extends EntityCreature implements IFlyingCreature, IAn
|
||||
protected Item getDropItem() {
|
||||
return Items.feather;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void func_145780_a(int x, int y, int z, Block block) {
|
||||
this.playSound("mob.chicken.step", 0.15F, 1.0F);
|
||||
@ -121,15 +121,15 @@ public class EntityPigeon extends EntityCreature implements IFlyingCreature, IAn
|
||||
public void setFlyingState(int state) {
|
||||
this.dataWatcher.updateObject(12, (byte) state);
|
||||
}
|
||||
|
||||
|
||||
public boolean isFat() {
|
||||
return this.dataWatcher.getWatchableObjectByte(13) == 1;
|
||||
}
|
||||
|
||||
|
||||
public void setFat(boolean fat) {
|
||||
this.dataWatcher.updateObject(13, (byte) (fat ? 1 : 0));
|
||||
}
|
||||
|
||||
|
||||
protected String getLivingSound() {
|
||||
return null;
|
||||
}
|
||||
@ -145,51 +145,51 @@ public class EntityPigeon extends EntityCreature implements IFlyingCreature, IAn
|
||||
@Override
|
||||
protected void updateAITasks() {
|
||||
super.updateAITasks();
|
||||
|
||||
|
||||
if(this.getFlyingState() == this.STATE_FLYING) {
|
||||
int height = worldObj.getHeightValue((int) Math.floor(posX), (int) Math.floor(posZ));
|
||||
|
||||
|
||||
boolean ceil = posY - height > 10;
|
||||
|
||||
|
||||
this.motionY = this.getRNG().nextGaussian() * 0.05 + (ceil ? 0 : 0.04) + (this.isInWater() ? 0.2 : 0);
|
||||
|
||||
|
||||
if(onGround) this.motionY = Math.abs(this.motionY) + 0.1D;
|
||||
|
||||
|
||||
this.moveForward = 1.5F;
|
||||
if(this.getRNG().nextInt(20) == 0) this.rotationYaw += this.getRNG().nextGaussian() * 30;
|
||||
|
||||
|
||||
if(this.isFat() && this.getRNG().nextInt(50) == 0) {
|
||||
|
||||
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setString("type", "sweat");
|
||||
nbt.setInteger("count", 3);
|
||||
nbt.setInteger("block", Block.getIdFromBlock(Blocks.wool));
|
||||
nbt.setInteger("entity", getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(dimension, posX, posY, posZ, 50));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(dimension, posX, posY, posZ, 50));
|
||||
|
||||
int x = (int) Math.floor(posX);
|
||||
int y = (int) Math.floor(posY) - 1;
|
||||
int z = (int) Math.floor(posZ);
|
||||
EntityPlayer player = FakePlayerFactory.getMinecraft((WorldServer)worldObj);
|
||||
|
||||
|
||||
for(int i = 0; i < 25; i++) {
|
||||
|
||||
|
||||
if(ItemFertilizer.fertilize(worldObj, x, y - i, z, player, true)) {
|
||||
worldObj.playAuxSFX(2005, x, y - i, z, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(this.getRNG().nextInt(10) == 0) {
|
||||
this.setFat(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else if(!this.onGround && this.motionY < 0.0D) {
|
||||
this.motionY *= 0.8D;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLivingUpdate() {
|
||||
super.onLivingUpdate();
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -97,23 +97,23 @@ public class EntityQuackos extends EntityDuck implements IBossDisplayData {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* BOW
|
||||
*/
|
||||
public void despawn() {
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
for(int i = 0; i < 150; i++) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "bf");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data,
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data,
|
||||
posX + rand.nextDouble() * 20 - 10,
|
||||
posY + rand.nextDouble() * 25,
|
||||
posZ + rand.nextDouble() * 20 - 10),
|
||||
new TargetPoint(dimension, posX, posY, posZ, 150));
|
||||
}
|
||||
|
||||
|
||||
dropItem(ModItems.spawn_duck, 3);
|
||||
}
|
||||
this.isDead = true;
|
||||
@ -150,7 +150,7 @@ public class EntityQuackos extends EntityDuck implements IBossDisplayData {
|
||||
@Override
|
||||
public void onLivingUpdate() {
|
||||
super.onLivingUpdate();
|
||||
|
||||
|
||||
if(!worldObj.isRemote && this.posY < -30) {
|
||||
this.setPosition(this.posX + rand.nextGaussian() * 30, 256, this.posZ + rand.nextGaussian() * 30);
|
||||
}
|
||||
|
||||
@ -4,9 +4,9 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.entity.projectile.EntityBulletBaseMK4;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.weapon.sedna.factory.XFactory762mm;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.tileentity.machine.TileEntityTesla;
|
||||
@ -23,7 +23,7 @@ import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityTaintCrab extends EntityCyberCrab {
|
||||
|
||||
|
||||
public List<double[]> targets = new ArrayList();
|
||||
|
||||
public EntityTaintCrab(World p_i1733_1_) {
|
||||
@ -48,7 +48,7 @@ public class EntityTaintCrab extends EntityCyberCrab {
|
||||
targets = TileEntityTesla.zap(worldObj, posX, posY + 1.25, posZ, 10, this);
|
||||
|
||||
List<EntityLivingBase> targets = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(posX - 5, posY - 5, posZ - 5, posX + 5, posY + 5, posZ + 5));
|
||||
|
||||
|
||||
for(EntityLivingBase e : targets) {
|
||||
if(!(e instanceof EntityCyberCrab)) e.addPotionEffect(new PotionEffect(HbmPotion.radiation.id, 10, 15));
|
||||
}
|
||||
@ -67,7 +67,7 @@ public class EntityTaintCrab extends EntityCyberCrab {
|
||||
|
||||
@Override
|
||||
public void attackEntityWithRangedAttack(EntityLivingBase entity, float f) {
|
||||
|
||||
|
||||
EntityBulletBaseMK4 bullet = new EntityBulletBaseMK4(this, XFactory762mm.r762_fmj, 10F, 0F, 0F, 0F, 0F);
|
||||
Vec3 motion = Vec3.createVectorHelper(posX - entity.posX, posY - entity.posZ - entity.height / 2, posZ - entity.posZ);
|
||||
motion = motion.normalize();
|
||||
@ -77,7 +77,7 @@ public class EntityTaintCrab extends EntityCyberCrab {
|
||||
data.setDouble("mX", bullet.motionX * 0.3);
|
||||
data.setDouble("mY", bullet.motionY * 0.3);
|
||||
data.setDouble("mZ", bullet.motionZ * 0.3);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(this.dimension, posX, posY, posZ, 50));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(this.dimension, posX, posY, posZ, 50));
|
||||
this.worldObj.spawnEntityInWorld(bullet);
|
||||
this.playSound("hbm:weapon.sawShoot", 1.0F, 0.5F);
|
||||
}
|
||||
|
||||
@ -6,10 +6,10 @@ import java.util.List;
|
||||
import com.hbm.entity.projectile.EntityBulletBaseNT;
|
||||
import com.hbm.explosion.ExplosionNukeSmall;
|
||||
import com.hbm.handler.BulletConfigSyncingUtil;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.util.ContaminationUtil;
|
||||
import com.hbm.util.ContaminationUtil.ContaminationType;
|
||||
@ -47,7 +47,7 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I
|
||||
public int beamTimer;
|
||||
private Entity target;
|
||||
private List<Entity> secondaries = new ArrayList();
|
||||
|
||||
|
||||
public EntityUFO(World p_i1587_1_) {
|
||||
super(p_i1587_1_);
|
||||
this.setSize(15F, 4F);
|
||||
@ -61,18 +61,18 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I
|
||||
protected boolean canDespawn() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float amount) {
|
||||
|
||||
|
||||
if(hurtCooldown > 0)
|
||||
return false;
|
||||
|
||||
|
||||
boolean hit = super.attackEntityFrom(source, amount);
|
||||
|
||||
|
||||
if(hit)
|
||||
hurtCooldown = 5;
|
||||
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
@ -84,14 +84,14 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I
|
||||
|
||||
@Override
|
||||
protected void updateEntityActionState() {
|
||||
|
||||
|
||||
if(!this.worldObj.isRemote) {
|
||||
|
||||
|
||||
if(this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) {
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(this.hurtCooldown > 0) {
|
||||
this.hurtCooldown--;
|
||||
}
|
||||
@ -103,29 +103,29 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I
|
||||
if(this.scanCooldown > 0) {
|
||||
this.scanCooldown--;
|
||||
}
|
||||
|
||||
|
||||
if(this.target != null && !this.target.isEntityAlive()) {
|
||||
this.target = null;
|
||||
}
|
||||
|
||||
|
||||
if(this.scanCooldown <= 0) {
|
||||
List<Entity> entities = worldObj.getEntitiesWithinAABB(Entity.class, this.boundingBox.expand(100, 50, 100));
|
||||
this.secondaries.clear();
|
||||
this.target = null;
|
||||
|
||||
|
||||
for(Entity entity : entities) {
|
||||
|
||||
|
||||
if(!entity.isEntityAlive() || !canAttackClass(entity.getClass()))
|
||||
continue;
|
||||
|
||||
|
||||
if(entity instanceof EntityPlayer) {
|
||||
|
||||
|
||||
if(((EntityPlayer)entity).capabilities.isCreativeMode)
|
||||
continue;
|
||||
|
||||
|
||||
if(((EntityPlayer)entity).isPotionActive(Potion.invisibility.id))
|
||||
continue;
|
||||
|
||||
|
||||
if(this.target == null) {
|
||||
this.target = entity;
|
||||
} else {
|
||||
@ -134,38 +134,38 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(entity instanceof EntityLivingBase && this.getDistanceSqToEntity(entity) < 100 * 100 && this.canEntityBeSeen(entity) && entity != this.target) {
|
||||
this.secondaries.add(entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(this.target == null && !this.secondaries.isEmpty())
|
||||
this.target = this.secondaries.get(rand.nextInt(this.secondaries.size()));
|
||||
|
||||
|
||||
this.scanCooldown = 50;
|
||||
}
|
||||
|
||||
|
||||
if(this.target != null && this.courseChangeCooldown <= 0) {
|
||||
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(this.posX - this.target.posX, 0, this.posZ - this.target.posZ);
|
||||
|
||||
|
||||
if(rand.nextInt(3) > 0)
|
||||
vec.rotateAroundY((float)Math.PI * 2 * rand.nextFloat());
|
||||
|
||||
|
||||
double length = vec.lengthVector();
|
||||
double overshoot = 35;
|
||||
|
||||
|
||||
int wX = (int)Math.floor(this.target.posX - vec.xCoord / length * overshoot);
|
||||
int wZ = (int)Math.floor(this.target.posZ - vec.zCoord / length * overshoot);
|
||||
|
||||
|
||||
this.setWaypoint(wX, Math.max(this.worldObj.getHeightValue(wX, wZ) + 20 + rand.nextInt(15), (int) this.target.posY + 15), wZ);
|
||||
|
||||
|
||||
this.courseChangeCooldown = 40 + rand.nextInt(20);
|
||||
}
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
|
||||
if(beamTimer <= 0 && this.getBeam()) {
|
||||
this.setBeam(false);
|
||||
}
|
||||
@ -175,10 +175,10 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I
|
||||
if(dist < 25)
|
||||
this.beamTimer = 30;
|
||||
}
|
||||
|
||||
|
||||
if(beamTimer > 0) {
|
||||
this.beamTimer--;
|
||||
|
||||
|
||||
if(!this.getBeam()) {
|
||||
worldObj.playSoundAtEntity(this, "hbm:entity.ufoBeam", 10.0F, 1.0F);
|
||||
this.setBeam(true);
|
||||
@ -187,51 +187,51 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I
|
||||
int ix = (int)Math.floor(this.posX);
|
||||
int iz = (int)Math.floor(this.posZ);
|
||||
int iy = 0;
|
||||
|
||||
|
||||
for(int i = (int)Math.ceil(this.posY); i >= 0; i--) {
|
||||
|
||||
|
||||
if(this.worldObj.getBlock(ix, i, iz) != Blocks.air) {
|
||||
iy = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(iy < this.posY) {
|
||||
List<Entity> entities = worldObj.getEntitiesWithinAABBExcludingEntity(this, AxisAlignedBB.getBoundingBox(this.posX, iy, this.posZ, this.posX, this.posY, this.posZ).expand(5, 0, 5));
|
||||
|
||||
|
||||
for(Entity e : entities) {
|
||||
if(this.canAttackClass(e.getClass())) {
|
||||
e.attackEntityFrom(ModDamageSource.causeCombineDamage(this, e), 1000F);
|
||||
e.setFire(5);
|
||||
|
||||
|
||||
if(e instanceof EntityLivingBase)
|
||||
ContaminationUtil.contaminate((EntityLivingBase)e, HazardType.RADIATION, ContaminationType.CREATIVE, 5F);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "ufo");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, iy + 0.5, posZ), new TargetPoint(dimension, posX, iy + 0.5, posZ, 150));
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX + this.motionX * 0.5, iy + 0.5, posZ + this.motionZ * 0.5), new TargetPoint(dimension, posX + this.motionX * 0.5, iy + 0.5, posZ + this.motionZ * 0.5, 150));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, posX, iy + 0.5, posZ), new TargetPoint(dimension, posX, iy + 0.5, posZ, 150));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, posX + this.motionX * 0.5, iy + 0.5, posZ + this.motionZ * 0.5), new TargetPoint(dimension, posX + this.motionX * 0.5, iy + 0.5, posZ + this.motionZ * 0.5, 150));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(this.ticksExisted % 300 < 200) {
|
||||
|
||||
|
||||
if(this.ticksExisted % 4 == 0) {
|
||||
|
||||
|
||||
if(!this.secondaries.isEmpty()){
|
||||
Entity e = this.secondaries.get(rand.nextInt(this.secondaries.size()));
|
||||
|
||||
|
||||
if(!e.isEntityAlive())
|
||||
this.secondaries.remove(e);
|
||||
else
|
||||
laserAttack(e);
|
||||
|
||||
|
||||
} else if(this.target != null) {
|
||||
laserAttack(this.target);
|
||||
}
|
||||
|
||||
|
||||
} else if(this.ticksExisted % 4 == 2) {
|
||||
if(this.target != null) {
|
||||
laserAttack(this.target);
|
||||
@ -240,41 +240,41 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I
|
||||
} else {
|
||||
|
||||
if(this.ticksExisted % 20 == 0) {
|
||||
|
||||
|
||||
if(!this.secondaries.isEmpty()){
|
||||
Entity e = this.secondaries.get(rand.nextInt(this.secondaries.size()));
|
||||
|
||||
|
||||
if(!e.isEntityAlive())
|
||||
this.secondaries.remove(e);
|
||||
else
|
||||
rocketAttack(e);
|
||||
|
||||
|
||||
} else if(this.target != null) {
|
||||
rocketAttack(this.target);
|
||||
}
|
||||
|
||||
|
||||
} else if(this.ticksExisted % 20 == 10) {
|
||||
if(this.target != null) {
|
||||
rocketAttack(this.target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.motionX = 0;
|
||||
this.motionY = 0;
|
||||
this.motionZ = 0;
|
||||
|
||||
|
||||
if(this.courseChangeCooldown > 0) {
|
||||
|
||||
|
||||
double deltaX = this.getX() - this.posX;
|
||||
double deltaY = this.getY() - this.posY;
|
||||
double deltaZ = this.getZ() - this.posZ;
|
||||
Vec3 delta = Vec3.createVectorHelper(deltaX, deltaY, deltaZ);
|
||||
double len = delta.lengthVector();
|
||||
double speed = this.target instanceof EntityPlayer ? 5D : 2D;
|
||||
|
||||
|
||||
if(len > 5) {
|
||||
if(isCourseTraversable(this.getX(), this.getY(), this.getZ(), len)) {
|
||||
this.motionX = delta.xCoord * speed / len;
|
||||
@ -286,22 +286,22 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void onDeathUpdate() {
|
||||
|
||||
|
||||
if(this.getBeam())
|
||||
this.setBeam(false);
|
||||
|
||||
|
||||
this.motionY -= 0.05D;
|
||||
|
||||
|
||||
if(this.deathTime == -10) {
|
||||
worldObj.playSoundAtEntity(this, "hbm:entity.chopperDamage", 10.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
||||
if(this.deathTime == 19 && !worldObj.isRemote) {
|
||||
worldObj.newExplosion(this, posX, posY, posZ, 10F, true, true);
|
||||
ExplosionNukeSmall.explode(worldObj, posX, posY, posZ, ExplosionNukeSmall.PARAMS_MEDIUM);
|
||||
|
||||
|
||||
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.boundingBox.expand(200, 200, 200));
|
||||
|
||||
for(EntityPlayer player : players) {
|
||||
@ -309,12 +309,12 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I
|
||||
player.inventory.addItemStackToInventory(new ItemStack(ModItems.coin_ufo));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
super.onDeathUpdate();
|
||||
}
|
||||
|
||||
|
||||
private void laserAttack(Entity e) {
|
||||
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(this.posX - e.posX, 0, this.posZ - e.posZ);
|
||||
vec.rotateAroundY((float) Math.toRadians(-80 + rand.nextInt(160)));
|
||||
vec = vec.normalize();
|
||||
@ -333,7 +333,7 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I
|
||||
this.worldObj.spawnEntityInWorld(bullet);
|
||||
this.playSound("hbm:weapon.ballsLaser", 5.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
||||
private void rocketAttack(Entity e) {
|
||||
|
||||
Vec3 heading = Vec3.createVectorHelper(e.posX - this.posX, e.posY + e.height / 2 - posY - 0.5D, e.posZ - this.posZ);
|
||||
@ -347,7 +347,7 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I
|
||||
this.worldObj.spawnEntityInWorld(bullet);
|
||||
this.playSound("hbm:turret.richard_fire", 5.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canAttackClass(Class clazz) {
|
||||
return clazz != this.getClass() && clazz != EntityBulletBaseNT.class;
|
||||
@ -361,9 +361,9 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I
|
||||
this.dataWatcher.addObject(18, 0);
|
||||
this.dataWatcher.addObject(19, 0);
|
||||
}
|
||||
|
||||
|
||||
private boolean isCourseTraversable(double p_70790_1_, double p_70790_3_, double p_70790_5_, double p_70790_7_) {
|
||||
|
||||
|
||||
double d4 = (this.getX() - this.posX) / p_70790_7_;
|
||||
double d5 = (this.getY() - this.posY) / p_70790_7_;
|
||||
double d6 = (this.getZ() - this.posZ) / p_70790_7_;
|
||||
@ -379,7 +379,7 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected float getSoundVolume() {
|
||||
return 10.0F;
|
||||
@ -394,12 +394,12 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I
|
||||
protected String getDeathSound() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound p_70014_1_) {
|
||||
super.writeEntityToNBT(p_70014_1_);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound p_70037_1_) {
|
||||
super.readEntityFromNBT(p_70037_1_);
|
||||
@ -430,7 +430,7 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I
|
||||
public int getZ() {
|
||||
return this.dataWatcher.getWatchableObjectInt(19);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isInRangeToRenderDist(double distance) {
|
||||
|
||||
@ -15,6 +15,7 @@ import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.standard.*;
|
||||
import com.hbm.handler.pollution.PollutionHandler;
|
||||
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.main.ResourceManager;
|
||||
@ -83,7 +84,7 @@ public class EntityGlyphid extends EntityMob implements IResistanceProvider {
|
||||
public static final int TASK_TERRAFORM = 5;
|
||||
/** If any task other than IDLE is interrupted by an obstacle, initiates digging behavior which is also communicated to nearby glyohids */
|
||||
public static final int TASK_DIG = 6;
|
||||
|
||||
|
||||
protected boolean hasWaypoint = false;
|
||||
/** Yeah, fuck, whatever, anything goes now */
|
||||
protected EntityWaypoint taskWaypoint = null;
|
||||
@ -97,7 +98,7 @@ public class EntityGlyphid extends EntityMob implements IResistanceProvider {
|
||||
public static final int DW_WALL = 16;
|
||||
public static final int DW_ARMOR = 17;
|
||||
public static final int DW_SUBTYPE = 18;
|
||||
|
||||
|
||||
public EntityGlyphid(World world) {
|
||||
super(world);
|
||||
this.setSize(1.75F, 1F);
|
||||
@ -127,7 +128,7 @@ public class EntityGlyphid extends EntityMob implements IResistanceProvider {
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(GlyphidStats.getStats().getGrunt().speed * (variant == TYPE_RADIOACTIVE ? 2D : 1D));
|
||||
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(GlyphidStats.getStats().getGrunt().damage * (variant == TYPE_RADIOACTIVE ? 5D : 1D));
|
||||
}
|
||||
|
||||
|
||||
public StatBundle getStats() {
|
||||
return GlyphidStats.getStats().statsGrunt;
|
||||
}
|
||||
@ -137,15 +138,15 @@ public class EntityGlyphid extends EntityMob implements IResistanceProvider {
|
||||
if(damage.isDamageAbsolute() || damage.isUnblockable()) return new float[] {0F, 0F};
|
||||
StatBundle stats = this.getStats();
|
||||
float threshold = stats.thresholdMultForArmor * getGlyphidArmor() / 5F;
|
||||
|
||||
|
||||
if(damage == ModDamageSource.nuclearBlast) return new float[] {threshold * 0.25F, 0F}; // nukes shred shrough glyphids
|
||||
if(damage.damageType.equals(DamageClass.LASER.name().toLowerCase(Locale.US))) return new float[] {threshold * 0.5F, stats.resistanceMult * 0.5F}; //lasers are quite powerful too
|
||||
if(damage.damageType.equals(DamageClass.ELECTRIC.name().toLowerCase(Locale.US))) return new float[] {threshold * 0.25F, stats.resistanceMult * 0.25F}; //electricity even more so
|
||||
if(damage.damageType.equals(DamageClass.SUBATOMIC.name().toLowerCase(Locale.US))) return new float[] {0F, stats.resistanceMult * 0.1F}; //and particles are almsot commpletely unaffected
|
||||
|
||||
|
||||
if(damage.isFireDamage()) return new float[] {0F, stats.resistanceMult * 0.2F}; //fire ignores DT and most DR
|
||||
if(damage.isExplosion()) return new float[] {threshold * 0.5F, stats.resistanceMult * 0.35F}; //explosions are still subject to DT and reduce DR by a fair amount
|
||||
|
||||
|
||||
return new float[] {threshold, stats.resistanceMult};
|
||||
}
|
||||
|
||||
@ -249,7 +250,7 @@ public class EntityGlyphid extends EntityMob implements IResistanceProvider {
|
||||
}
|
||||
|
||||
if(hasWaypoint) {
|
||||
|
||||
|
||||
if(canDig()) {
|
||||
|
||||
MovingObjectPosition obstacle = findWaypointObstruction();
|
||||
@ -268,7 +269,7 @@ public class EntityGlyphid extends EntityMob implements IResistanceProvider {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.worldObj.theProfiler.endSection();
|
||||
}
|
||||
}
|
||||
@ -318,11 +319,11 @@ public class EntityGlyphid extends EntityMob implements IResistanceProvider {
|
||||
protected boolean canDespawn() {
|
||||
return entityToAttack == null && getCurrentTask() == TASK_IDLE && this.ticksExisted > 100;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDeath(DamageSource source) {
|
||||
super.onDeath(source);
|
||||
|
||||
|
||||
if(doesInfectedSpawnMaggots() && this.dataWatcher.getWatchableObjectByte(DW_SUBTYPE) == TYPE_INFECTED) {
|
||||
|
||||
int j = 2 + this.rand.nextInt(3);
|
||||
@ -339,12 +340,12 @@ public class EntityGlyphid extends EntityMob implements IResistanceProvider {
|
||||
}
|
||||
|
||||
worldObj.playSoundEffect(posX, posY, posZ, "mob.zombie.woodbreak", 2.0F, 0.95F + worldObj.rand.nextFloat() * 0.2F);
|
||||
|
||||
|
||||
NBTTagCompound vdat = new NBTTagCompound();
|
||||
vdat.setString("type", "giblets");
|
||||
vdat.setInteger("ent", this.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(vdat, posX, posY + height * 0.5, posZ), new TargetPoint(dimension, posX, posY + height * 0.5, posZ, 150));
|
||||
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(vdat, posX, posY + height * 0.5, posZ), new TargetPoint(dimension, posX, posY + height * 0.5, posZ, 150));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -357,17 +358,17 @@ public class EntityGlyphid extends EntityMob implements IResistanceProvider {
|
||||
|
||||
/** Provides a direct entrypoint from outside to access the superclass' implementation because otherwise we end up with infinite recursion */
|
||||
public boolean attackSuperclass(DamageSource source, float amount) {
|
||||
|
||||
|
||||
/*NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "debug");
|
||||
data.setInteger("color", 0x0000ff);
|
||||
data.setFloat("scale", 2.5F);
|
||||
data.setString("text", "" + (int) amount);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY + 2, posZ), new TargetPoint(dimension, posX, posY + 2, posZ, 50));*/
|
||||
|
||||
|
||||
return super.attackEntityFrom(source, amount);
|
||||
}
|
||||
|
||||
|
||||
public boolean doesInfectedSpawnMaggots() {
|
||||
return true;
|
||||
}
|
||||
@ -392,7 +393,7 @@ public class EntityGlyphid extends EntityMob implements IResistanceProvider {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getGlyphidArmor() {
|
||||
int total = 0;
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(DW_ARMOR);
|
||||
@ -453,12 +454,12 @@ public class EntityGlyphid extends EntityMob implements IResistanceProvider {
|
||||
public boolean attackEntityAsMob(Entity victim) {
|
||||
if(this.isSwingInProgress) return false;
|
||||
this.swingItem();
|
||||
|
||||
|
||||
if(this.dataWatcher.getWatchableObjectByte(DW_SUBTYPE) == TYPE_INFECTED && victim instanceof EntityLivingBase) {
|
||||
((EntityLivingBase) victim).addPotionEffect(new PotionEffect(Potion.poison.id, 100, 2));
|
||||
((EntityLivingBase) victim).addPotionEffect(new PotionEffect(Potion.confusion.id, 100, 0));
|
||||
}
|
||||
|
||||
|
||||
return super.attackEntityAsMob(victim);
|
||||
}
|
||||
|
||||
@ -540,14 +541,14 @@ public class EntityGlyphid extends EntityMob implements IResistanceProvider {
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case TASK_DIG:
|
||||
shouldDig = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -617,7 +618,7 @@ public class EntityGlyphid extends EntityMob implements IResistanceProvider {
|
||||
|
||||
}
|
||||
///DIGGING END
|
||||
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound nbt) {
|
||||
super.writeEntityToNBT(nbt);
|
||||
|
||||
@ -10,6 +10,7 @@ import com.hbm.explosion.vanillant.standard.BlockMutatorDebris;
|
||||
import com.hbm.explosion.vanillant.standard.BlockProcessorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.EntityProcessorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
@ -29,14 +30,14 @@ import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class EntityGlyphidNuclear extends EntityGlyphid {
|
||||
|
||||
|
||||
public int deathTicks;
|
||||
public EntityGlyphidNuclear(World world) {
|
||||
super(world);
|
||||
this.setSize(2.5F, 1.75F);
|
||||
this.isImmuneToFire = true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResourceLocation getSkin() {
|
||||
return ResourceManager.glyphid_nuclear_tex;
|
||||
@ -54,7 +55,7 @@ public class EntityGlyphidNuclear extends EntityGlyphid {
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(GlyphidStats.getStats().getNuclear().speed);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(GlyphidStats.getStats().getNuclear().damage);
|
||||
}
|
||||
|
||||
|
||||
public StatBundle getStats() {
|
||||
return GlyphidStats.getStats().statsNuclear;
|
||||
}
|
||||
@ -120,7 +121,7 @@ public class EntityGlyphidNuclear extends EntityGlyphid {
|
||||
communicate(TASK_INITIATE_RETREAT, null);
|
||||
hasWaypoint = true;
|
||||
}
|
||||
|
||||
|
||||
if(deathTicks == 90){
|
||||
int radius = 8;
|
||||
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(this.posX, this.posY, this.posZ, this.posX, this.posY, this.posZ).expand(radius, radius, radius);
|
||||
@ -134,7 +135,7 @@ public class EntityGlyphidNuclear extends EntityGlyphid {
|
||||
}
|
||||
}
|
||||
if(this.deathTicks == 100) {
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
ExplosionVNT vnt = new ExplosionVNT(worldObj, posX, posY, posZ, 25, this);
|
||||
|
||||
@ -154,22 +155,22 @@ public class EntityGlyphidNuclear extends EntityGlyphid {
|
||||
vnt.setBlockAllocator(new BlockAllocatorStandard(24));
|
||||
vnt.setBlockProcessor(new BlockProcessorStandard().withBlockEffect(new BlockMutatorDebris(ModBlocks.volcanic_lava_block, 0)).setNoDrop());
|
||||
}
|
||||
|
||||
|
||||
vnt.setEntityProcessor(new EntityProcessorStandard());
|
||||
vnt.setPlayerProcessor(new PlayerProcessorStandard());
|
||||
vnt.explode();
|
||||
|
||||
worldObj.playSoundEffect(posX, posY, posZ, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "muke");
|
||||
// if the FX type is "muke", apply random BF effect
|
||||
if(MainRegistry.polaroidID == 11 || rand.nextInt(100) == 0) {
|
||||
data.setBoolean("balefire", true);
|
||||
}
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(dimension, posX, posY, posZ, 250));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(dimension, posX, posY, posZ, 250));
|
||||
}
|
||||
|
||||
|
||||
this.setDead();
|
||||
} else {
|
||||
if(!worldObj.isRemote && this.deathTicks % 10 == 0) {
|
||||
|
||||
@ -4,8 +4,8 @@ import java.util.List;
|
||||
|
||||
import com.hbm.entity.mob.EntityUFOBase;
|
||||
import com.hbm.entity.projectile.EntitySiegeLaser;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.util.ContaminationUtil;
|
||||
import com.hbm.util.ContaminationUtil.ContaminationType;
|
||||
@ -27,7 +27,7 @@ import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntitySiegeCraft extends EntityUFOBase implements IBossDisplayData {
|
||||
|
||||
|
||||
private int attackCooldown;
|
||||
private int beamCountdown;
|
||||
|
||||
@ -37,52 +37,52 @@ public class EntitySiegeCraft extends EntityUFOBase implements IBossDisplayData
|
||||
this.isImmuneToFire = true;
|
||||
this.ignoreFrustumCheck = true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float damage) {
|
||||
|
||||
|
||||
if(this.isEntityInvulnerable())
|
||||
return false;
|
||||
|
||||
|
||||
SiegeTier tier = this.getTier();
|
||||
|
||||
|
||||
if(tier.fireProof && source.isFireDamage()) {
|
||||
this.extinguish();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//noFF can't be harmed by other mobs
|
||||
if(tier.noFriendlyFire && source instanceof EntityDamageSource && !(((EntityDamageSource) source).getEntity() instanceof EntityPlayer))
|
||||
return false;
|
||||
|
||||
|
||||
damage -= tier.dt;
|
||||
|
||||
|
||||
if(damage < 0) {
|
||||
worldObj.playSoundAtEntity(this, "random.break", 5F, 1.0F + rand.nextFloat() * 0.5F);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
damage *= (1F - tier.dr);
|
||||
|
||||
|
||||
return super.attackEntityFrom(source, damage);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDeathUpdate() {
|
||||
|
||||
|
||||
this.beamCountdown = 200;
|
||||
this.setBeam(false);
|
||||
|
||||
|
||||
this.motionY -= 0.05D;
|
||||
|
||||
|
||||
if(this.deathTime == 19 && !worldObj.isRemote) {
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "tinytot");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(this.dimension, posX, posY, posZ, 250));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(this.dimension, posX, posY, posZ, 250));
|
||||
worldObj.playSoundEffect(posX, posY, posZ, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
||||
super.onDeathUpdate();
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ public class EntitySiegeCraft extends EntityUFOBase implements IBossDisplayData
|
||||
this.getDataWatcher().addObject(15, 0F);
|
||||
this.getDataWatcher().addObject(16, (byte) 0);
|
||||
}
|
||||
|
||||
|
||||
public void setTier(SiegeTier tier) {
|
||||
this.getDataWatcher().updateObject(12, tier.id);
|
||||
|
||||
@ -103,26 +103,26 @@ public class EntitySiegeCraft extends EntityUFOBase implements IBossDisplayData
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(tier.health * 25);
|
||||
this.setHealth(this.getMaxHealth());
|
||||
}
|
||||
|
||||
|
||||
public SiegeTier getTier() {
|
||||
SiegeTier tier = SiegeTier.tiers[this.getDataWatcher().getWatchableObjectInt(12)];
|
||||
return tier != null ? tier : SiegeTier.CLAY;
|
||||
}
|
||||
|
||||
|
||||
public void setBeam(boolean beam) {
|
||||
this.getDataWatcher().updateObject(16, beam ? (byte) 1 : (byte) 0);
|
||||
}
|
||||
|
||||
|
||||
public boolean getBeam() {
|
||||
return this.getDataWatcher().getWatchableObjectByte(16) == 1;
|
||||
}
|
||||
|
||||
|
||||
public void setLockon(double x, double y, double z) {
|
||||
this.getDataWatcher().updateObject(13, (float) x);
|
||||
this.getDataWatcher().updateObject(14, (float) y);
|
||||
this.getDataWatcher().updateObject(15, (float) z);
|
||||
}
|
||||
|
||||
|
||||
public Vec3 getLockon() {
|
||||
return Vec3.createVectorHelper(
|
||||
this.getDataWatcher().getWatchableObjectFloat(13),
|
||||
@ -156,7 +156,7 @@ public class EntitySiegeCraft extends EntityUFOBase implements IBossDisplayData
|
||||
if(this.scanCooldown > 0) {
|
||||
this.scanCooldown--;
|
||||
}
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
if(this.attackCooldown > 0) {
|
||||
this.attackCooldown--;
|
||||
@ -164,64 +164,64 @@ public class EntitySiegeCraft extends EntityUFOBase implements IBossDisplayData
|
||||
if(this.beamCountdown > 0) {
|
||||
this.beamCountdown--;
|
||||
}
|
||||
|
||||
|
||||
if(rand.nextInt(50) == 0) {
|
||||
|
||||
|
||||
NBTTagCompound dPart = new NBTTagCompound();
|
||||
dPart.setString("type", "tau");
|
||||
dPart.setByte("count", (byte)(2 + rand.nextInt(3)));
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(dPart, posX + rand.nextGaussian() * 2, posY + rand.nextGaussian(), posZ + rand.nextGaussian() * 2), new TargetPoint(worldObj.provider.dimensionId, posX, posY, posZ, 50));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(dPart, posX + rand.nextGaussian() * 2, posY + rand.nextGaussian(), posZ + rand.nextGaussian() * 2), new TargetPoint(worldObj.provider.dimensionId, posX, posY, posZ, 50));
|
||||
}
|
||||
|
||||
|
||||
boolean beam = false;
|
||||
|
||||
|
||||
if(this.target == null || this.beamCountdown <= 0) {
|
||||
this.beamCountdown = 300; //200 - 100: nothing, 100 - 40: update lockon, 40 - 20: fix lockon, 20 - 0: beam
|
||||
} else {
|
||||
|
||||
|
||||
if(this.beamCountdown >= 60 && this.beamCountdown < 120) {
|
||||
double x = this.target.posX;
|
||||
double y = this.target.posY + this.target.height * 0.5;
|
||||
double z = this.target.posZ;
|
||||
this.setLockon(x, y, z);
|
||||
|
||||
|
||||
if(this.beamCountdown == 110) {
|
||||
worldObj.playSoundAtEntity(this.target, "hbm:weapon.stingerLockOn", 2F, 0.75F);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(this.beamCountdown >= 40 && this.beamCountdown < 100) {
|
||||
|
||||
|
||||
Vec3 lockon = this.getLockon();
|
||||
NBTTagCompound fx = new NBTTagCompound();
|
||||
fx.setString("type", "vanillaburst");
|
||||
fx.setString("mode", "reddust");
|
||||
fx.setDouble("motion", 0.2D);
|
||||
fx.setInteger("count", 5);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(fx, lockon.xCoord, lockon.yCoord, lockon.zCoord), new TargetPoint(this.dimension, lockon.xCoord, lockon.yCoord, lockon.zCoord, 100));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(fx, lockon.xCoord, lockon.yCoord, lockon.zCoord), new TargetPoint(this.dimension, lockon.xCoord, lockon.yCoord, lockon.zCoord, 100));
|
||||
}
|
||||
|
||||
|
||||
if(this.beamCountdown < 40) {
|
||||
|
||||
Vec3 lockon = this.getLockon();
|
||||
|
||||
|
||||
if(this.beamCountdown == 39) {
|
||||
worldObj.playSoundEffect(lockon.xCoord, lockon.yCoord, lockon.zCoord, "hbm:entity.ufoBlast", 5.0F, 0.9F + worldObj.rand.nextFloat() * 0.2F);
|
||||
}
|
||||
|
||||
|
||||
List<Entity> entities = worldObj.getEntitiesWithinAABBExcludingEntity(this, AxisAlignedBB.getBoundingBox(lockon.xCoord, lockon.yCoord, lockon.zCoord, lockon.xCoord, lockon.yCoord, lockon.zCoord).expand(2, 2, 2));
|
||||
|
||||
|
||||
for(Entity e : entities) {
|
||||
if(this.canAttackClass(e.getClass())) {
|
||||
e.attackEntityFrom(ModDamageSource.causeCombineDamage(this, e), 1000F);
|
||||
e.setFire(5);
|
||||
|
||||
|
||||
if(e instanceof EntityLivingBase)
|
||||
ContaminationUtil.contaminate((EntityLivingBase)e, HazardType.RADIATION, ContaminationType.CREATIVE, 5F);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "plasmablast");
|
||||
data.setFloat("r", 0.0F);
|
||||
@ -230,36 +230,36 @@ public class EntitySiegeCraft extends EntityUFOBase implements IBossDisplayData
|
||||
data.setFloat("pitch", -90 + rand.nextFloat() * 180);
|
||||
data.setFloat("yaw", rand.nextFloat() * 180F);
|
||||
data.setFloat("scale", 5F);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, lockon.xCoord, lockon.yCoord, lockon.zCoord), new TargetPoint(dimension, lockon.xCoord, lockon.yCoord, lockon.zCoord, 150));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, lockon.xCoord, lockon.yCoord, lockon.zCoord), new TargetPoint(dimension, lockon.xCoord, lockon.yCoord, lockon.zCoord, 150));
|
||||
beam = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.setBeam(beam);
|
||||
|
||||
|
||||
if(this.attackCooldown == 0 && this.target != null) {
|
||||
this.attackCooldown = 30 + rand.nextInt(10);
|
||||
|
||||
|
||||
double x = posX;
|
||||
double y = posY;
|
||||
double z = posZ;
|
||||
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(target.posX - x, target.posY + target.height * 0.5 - y, target.posZ - z).normalize();
|
||||
SiegeTier tier = this.getTier();
|
||||
|
||||
|
||||
float health = getHealth() / getMaxHealth();
|
||||
|
||||
int r = (int)(0xff * (1 - health));
|
||||
int g = (int)(0xff * health);
|
||||
int b = 0;
|
||||
int color = (r << 16) | (g << 8) | b;
|
||||
|
||||
|
||||
for(int i = 0; i < 7; i++) {
|
||||
|
||||
|
||||
Vec3 copy = Vec3.createVectorHelper(vec.xCoord, vec.yCoord, vec.zCoord);
|
||||
|
||||
|
||||
copy.rotateAroundY((float)Math.PI / 180F * (i - 3) * 5F);
|
||||
|
||||
|
||||
EntitySiegeLaser laser = new EntitySiegeLaser(worldObj, this);
|
||||
laser.setPosition(x, y, z);
|
||||
laser.setThrowableHeading(copy.xCoord, copy.yCoord, copy.zCoord, 1F, 0.0F);
|
||||
@ -269,11 +269,11 @@ public class EntitySiegeCraft extends EntityUFOBase implements IBossDisplayData
|
||||
if(tier.laserIncendiary) laser.setIncendiary();
|
||||
worldObj.spawnEntityInWorld(laser);
|
||||
}
|
||||
|
||||
|
||||
this.playSound("hbm:weapon.ballsLaser", 2.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(this.courseChangeCooldown > 0) {
|
||||
approachPosition(this.target == null ? 0.25D : 0.5D + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue() * 1);
|
||||
}
|
||||
@ -306,7 +306,7 @@ public class EntitySiegeCraft extends EntityUFOBase implements IBossDisplayData
|
||||
|
||||
@Override
|
||||
protected void dropFewItems(boolean byPlayer, int fortune) {
|
||||
|
||||
|
||||
if(byPlayer) {
|
||||
for(ItemStack drop : this.getTier().dropItem) {
|
||||
this.entityDropItem(drop.copy(), 0F);
|
||||
|
||||
@ -10,7 +10,7 @@ import com.hbm.explosion.vanillant.standard.BlockProcessorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.EntityProcessorCrossSmooth;
|
||||
import com.hbm.explosion.vanillant.standard.ExplosionEffectWeapon;
|
||||
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -24,14 +24,14 @@ import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityBombletZeta extends EntityThrowable {
|
||||
|
||||
|
||||
public int type = 0;
|
||||
|
||||
public EntityBombletZeta(World p_i1582_1_) {
|
||||
super(p_i1582_1_);
|
||||
this.ignoreFrustumCheck = true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
|
||||
@ -79,14 +79,14 @@ public class EntityBombletZeta extends EntityThrowable {
|
||||
data.setString("type", "muke");
|
||||
if(rand.nextInt(100) == 0)
|
||||
data.setBoolean("balefire", true);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(dimension, posX, posY, posZ, 250));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(dimension, posX, posY, posZ, 250));
|
||||
worldObj.playSoundEffect(posX, posY, posZ, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
|
||||
}
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void rotation() {
|
||||
float f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
|
||||
@ -115,7 +115,7 @@ public class EntityBombletZeta extends EntityThrowable {
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition p_70184_1_) {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isInRangeToRenderDist(double distance)
|
||||
|
||||
@ -4,8 +4,8 @@ import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.explosion.ExplosionLarge;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -26,7 +26,7 @@ public class EntityBoxcar extends EntityThrowable {
|
||||
this.ignoreFrustumCheck = true;
|
||||
this.isImmuneToFire = true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
|
||||
@ -34,7 +34,7 @@ public class EntityBoxcar extends EntityThrowable {
|
||||
for(int i = 0; i < 50; i++) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "bf");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data,
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data,
|
||||
posX + (rand.nextDouble() - 0.5) * 3,
|
||||
posY + (rand.nextDouble() - 0.5) * 15,
|
||||
posZ + (rand.nextDouble() - 0.5) * 3),
|
||||
@ -46,7 +46,7 @@ public class EntityBoxcar extends EntityThrowable {
|
||||
this.lastTickPosY = this.prevPosY = posY;
|
||||
this.lastTickPosZ = this.prevPosZ = posZ;
|
||||
this.setPosition(posX + this.motionX, posY + this.motionY, posZ + this.motionZ);
|
||||
|
||||
|
||||
this.motionY -= 0.03;
|
||||
if(motionY < -1.5)
|
||||
motionY = -1.5;
|
||||
@ -73,7 +73,7 @@ public class EntityBoxcar extends EntityThrowable {
|
||||
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition p_70184_1_) { }
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isInRangeToRenderDist(double distance) {
|
||||
|
||||
@ -23,9 +23,9 @@ import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
|
||||
import com.hbm.handler.BulletConfigSyncingUtil;
|
||||
import com.hbm.handler.BulletConfiguration;
|
||||
import com.hbm.handler.GunConfiguration;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.weapon.ItemGunBase;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.util.ArmorUtil;
|
||||
@ -58,7 +58,7 @@ import net.minecraft.world.World;
|
||||
* @author hbm
|
||||
*/
|
||||
public class EntityBulletBaseNT extends EntityThrowableInterp implements IBulletBase {
|
||||
|
||||
|
||||
@Override public double prevX() { return prevRenderX; }
|
||||
@Override public double prevY() { return prevRenderY; }
|
||||
@Override public double prevZ() { return prevRenderZ; }
|
||||
@ -66,7 +66,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
@Override public void prevY(double d) { prevRenderY = d; }
|
||||
@Override public void prevZ(double d) { prevRenderZ = d; }
|
||||
@Override public List<Pair<Vec3, Double>> nodes() { return this.trailNodes; }
|
||||
|
||||
|
||||
private BulletConfiguration config;
|
||||
public float overrideDamage;
|
||||
|
||||
@ -74,7 +74,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
public double prevRenderY;
|
||||
public double prevRenderZ;
|
||||
public final List<Pair<Vec3, Double>> trailNodes = new ArrayList<Pair<Vec3, Double>>();
|
||||
|
||||
|
||||
public BulletConfiguration getConfig() {
|
||||
return config;
|
||||
}
|
||||
@ -92,15 +92,15 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
this.dataWatcher.updateObject(16, (byte)this.config.style);
|
||||
this.dataWatcher.updateObject(17, (byte)this.config.trail);
|
||||
this.renderDistanceWeight = 10.0D;
|
||||
|
||||
|
||||
if(this.config == null) {
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
this.setSize(0.5F, 0.5F);
|
||||
}
|
||||
|
||||
|
||||
public EntityBulletBaseNT(World world, int config, EntityLivingBase entity) {
|
||||
super(world);
|
||||
this.config = BulletConfigSyncingUtil.pullConfig(config);
|
||||
@ -108,11 +108,11 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
this.dataWatcher.updateObject(16, (byte)this.config.style);
|
||||
this.dataWatcher.updateObject(17, (byte)this.config.trail);
|
||||
thrower = entity;
|
||||
|
||||
|
||||
ItemStack gun = entity.getHeldItem();
|
||||
boolean offsetShot = true;
|
||||
boolean accuracyBoost = false;
|
||||
|
||||
|
||||
if(gun != null && gun.getItem() instanceof ItemGunBase) {
|
||||
GunConfiguration cfg = ((ItemGunBase) gun.getItem()).mainConfig;
|
||||
|
||||
@ -129,10 +129,10 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
}
|
||||
|
||||
this.setLocationAndAngles(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ, entity.rotationYaw, entity.rotationPitch);
|
||||
|
||||
|
||||
if(offsetShot) {
|
||||
double sideOffset = 0.16D;
|
||||
|
||||
|
||||
this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * sideOffset;
|
||||
this.posY -= 0.1D;
|
||||
this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * sideOffset;
|
||||
@ -140,7 +140,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
this.posY -= 0.1D;
|
||||
}
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
|
||||
|
||||
this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
|
||||
this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
|
||||
this.motionY = (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI));
|
||||
@ -153,7 +153,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
|
||||
public EntityBulletBaseNT(World world, int config, EntityLivingBase entity, EntityLivingBase target, float motion, float deviation) {
|
||||
super(world);
|
||||
|
||||
|
||||
this.config = BulletConfigSyncingUtil.pullConfig(config);
|
||||
this.dataWatcher.updateObject(18, config);
|
||||
this.dataWatcher.updateObject(16, (byte)this.config.style);
|
||||
@ -190,17 +190,17 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
//bullet config sync
|
||||
this.dataWatcher.addObject(18, Integer.valueOf((int) 0));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
|
||||
|
||||
if(config == null) config = BulletConfigSyncingUtil.pullConfig(dataWatcher.getWatchableObjectInt(18));
|
||||
|
||||
if(config == null){
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(worldObj.isRemote && config.style == BulletConfiguration.STYLE_TAU) {
|
||||
if(trailNodes.isEmpty()) {
|
||||
this.ignoreFrustumCheck = true;
|
||||
@ -209,9 +209,9 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
trailNodes.add(new Pair<Vec3, Double>(Vec3.createVectorHelper(0, 0, 0), 1D));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(worldObj.isRemote && this.config.blackPowder && this.ticksExisted == 1) {
|
||||
|
||||
|
||||
for(int i = 0; i < 15; i++) {
|
||||
double mod = rand.nextDouble();
|
||||
this.worldObj.spawnParticle("smoke", this.posX, this.posY, this.posZ,
|
||||
@ -219,38 +219,38 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
(this.motionY + rand.nextGaussian() * 0.05) * mod,
|
||||
(this.motionZ + rand.nextGaussian() * 0.05) * mod);
|
||||
}
|
||||
|
||||
|
||||
double mod = 0.5;
|
||||
this.worldObj.spawnParticle("flame", this.posX + this.motionX * mod, this.posY + this.motionY * mod, this.posZ + this.motionZ * mod, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
|
||||
if(config.maxAge == 0) {
|
||||
if(this.config.bntUpdate != null) this.config.bntUpdate.behaveUpdate(this);
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(this.ticksExisted > config.maxAge) this.setDead();
|
||||
}
|
||||
|
||||
|
||||
if(this.config.bntUpdate != null) this.config.bntUpdate.behaveUpdate(this);
|
||||
|
||||
this.prevPosX = posX;
|
||||
this.prevPosY = posY;
|
||||
this.prevPosZ = posZ;
|
||||
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
|
||||
if(worldObj.isRemote && !config.vPFX.isEmpty()) {
|
||||
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(posX - prevPosX, posY - prevPosY, posZ - prevPosZ);
|
||||
double motion = Math.max(vec.lengthVector(), 0.1);
|
||||
vec = vec.normalize();
|
||||
|
||||
|
||||
for(double d = 0; d < motion; d += 0.5) {
|
||||
|
||||
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setString("type", "vanillaExt");
|
||||
nbt.setString("mode", config.vPFX);
|
||||
@ -264,9 +264,9 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition mop) {
|
||||
|
||||
|
||||
if(mop.typeOfHit == MovingObjectType.BLOCK) {
|
||||
|
||||
|
||||
boolean hRic = rand.nextInt(100) < config.HBRC;
|
||||
boolean doesRic = config.doesRicochet && hRic;
|
||||
|
||||
@ -313,7 +313,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
|
||||
this.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
||||
onRicochet(mop.blockX, mop.blockY, mop.blockZ);
|
||||
|
||||
|
||||
//worldObj.setBlock((int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ), Blocks.dirt);
|
||||
|
||||
} else {
|
||||
@ -326,44 +326,44 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
/*this.posX += (mop.hitVec.xCoord - this.posX) * 0.6;
|
||||
this.posY += (mop.hitVec.yCoord - this.posY) * 0.6;
|
||||
this.posZ += (mop.hitVec.zCoord - this.posZ) * 0.6;*/
|
||||
|
||||
|
||||
this.motionX *= config.bounceMod;
|
||||
this.motionY *= config.bounceMod;
|
||||
this.motionZ *= config.bounceMod;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(mop.entityHit != null) {
|
||||
|
||||
DamageSource damagesource = this.config.getDamage(this, this.thrower);
|
||||
Entity victim = mop.entityHit;
|
||||
|
||||
|
||||
if(!config.doesPenetrate) {
|
||||
this.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
||||
onEntityImpact(victim);
|
||||
} else {
|
||||
onEntityHurt(victim);
|
||||
}
|
||||
|
||||
|
||||
float damage = rand.nextFloat() * (config.dmgMax - config.dmgMin) + config.dmgMin;
|
||||
|
||||
|
||||
if(overrideDamage != 0)
|
||||
damage = overrideDamage;
|
||||
|
||||
|
||||
boolean headshot = false;
|
||||
|
||||
|
||||
if(victim instanceof EntityLivingBase && this.config.headshotMult > 1F) {
|
||||
EntityLivingBase living = (EntityLivingBase) victim;
|
||||
double head = living.height - living.getEyeHeight();
|
||||
|
||||
|
||||
if(!!living.isEntityAlive() && mop.hitVec != null && mop.hitVec.yCoord > (living.posY + living.height - head * 2)) {
|
||||
damage *= this.config.headshotMult;
|
||||
headshot = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(victim != null && !victim.attackEntityFrom(damagesource, damage)) {
|
||||
|
||||
try {
|
||||
@ -371,7 +371,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
float dmg = (float) damage + lastDamage.getFloat(victim);
|
||||
if(!victim.attackEntityFrom(damagesource, dmg)) headshot = false;
|
||||
} catch (Exception x) { }
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote && headshot) {
|
||||
@ -384,25 +384,25 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
data.setDouble("motion", 0.1D);
|
||||
data.setString("mode", "blockdust");
|
||||
data.setInteger("block", Block.getIdFromBlock(Blocks.redstone_block));
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, living.posX, living.posY + living.height - head, living.posZ), new TargetPoint(living.dimension, living.posX, living.posY, living.posZ, 50));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, living.posX, living.posY + living.height - head, living.posZ), new TargetPoint(living.dimension, living.posX, living.posY, living.posZ, 50));
|
||||
worldObj.playSoundEffect(victim.posX, victim.posY, victim.posZ, "mob.zombie.woodbreak", 1.0F, 0.95F + rand.nextFloat() * 0.2F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//for when a bullet dies by hitting a block
|
||||
private void onBlockImpact(int bX, int bY, int bZ, int sideHit) {
|
||||
Block block = worldObj.getBlock(bX, bY, bZ);
|
||||
|
||||
|
||||
if(config.bntImpact != null)
|
||||
config.bntImpact.behaveBlockHit(this, bX, bY, bZ, sideHit);
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
if(!config.liveAfterImpact && !config.isSpectral && bY > -1 && !this.inGround) this.setDead();
|
||||
if(!config.doesPenetrate && bY == -1) this.setDead();
|
||||
}
|
||||
|
||||
|
||||
if(config.incendiary > 0 && !this.worldObj.isRemote) {
|
||||
if(worldObj.rand.nextInt(3) == 0 && worldObj.getBlock((int)posX, (int)posY, (int)posZ) == Blocks.air) worldObj.setBlock((int)posX, (int)posY, (int)posZ, Blocks.fire);
|
||||
if(worldObj.rand.nextInt(3) == 0 && worldObj.getBlock((int)posX + 1, (int)posY, (int)posZ) == Blocks.air) worldObj.setBlock((int)posX + 1, (int)posY, (int)posZ, Blocks.fire);
|
||||
@ -415,22 +415,22 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
|
||||
if(config.emp > 0)
|
||||
ExplosionNukeGeneric.empBlast(this.worldObj, (int)(this.posX + 0.5D), (int)(this.posY + 0.5D), (int)(this.posZ + 0.5D), config.emp);
|
||||
|
||||
|
||||
if(config.emp > 3) {
|
||||
if (!this.worldObj.isRemote) {
|
||||
|
||||
|
||||
EntityEMPBlast cloud = new EntityEMPBlast(this.worldObj, config.emp);
|
||||
cloud.posX = this.posX;
|
||||
cloud.posY = this.posY + 0.5F;
|
||||
cloud.posZ = this.posZ;
|
||||
|
||||
|
||||
this.worldObj.spawnEntityInWorld(cloud);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(config.jolt > 0 && !worldObj.isRemote)
|
||||
ExplosionLarge.jolt(worldObj, posX, posY, posZ, config.jolt, 150, 0.25);
|
||||
|
||||
|
||||
if(config.explosive > 0 && !worldObj.isRemote) {
|
||||
//worldObj.newExplosion(this.thrower, posX, posY, posZ, config.explosive, config.incendiary > 0, config.blockDamage);
|
||||
ExplosionVNT vnt = new ExplosionVNT(worldObj, posX, posY, posZ, config.explosive, this.thrower);
|
||||
@ -442,21 +442,21 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
vnt.setSFX(new ExplosionEffectStandard());
|
||||
vnt.explode();
|
||||
}
|
||||
|
||||
|
||||
if(config.shrapnel > 0 && !worldObj.isRemote)
|
||||
ExplosionLarge.spawnShrapnels(worldObj, posX, posY, posZ, config.shrapnel);
|
||||
|
||||
|
||||
if(config.chlorine > 0 && !worldObj.isRemote) {
|
||||
ExplosionChaos.spawnChlorine(worldObj, posX, posY, posZ, config.chlorine, 1.5, 0);
|
||||
worldObj.playSoundEffect((double)(posX + 0.5F), (double)(posY + 0.5F), (double)(posZ + 0.5F), "random.fizz", 5.0F, 2.6F + (rand.nextFloat() - rand.nextFloat()) * 0.8F);
|
||||
}
|
||||
|
||||
|
||||
if(config.rainbow > 0 && !worldObj.isRemote) {
|
||||
EntityNukeExplosionMK3 ex = EntityNukeExplosionMK3.statFacFleija(worldObj, posX, posY, posZ, config.rainbow);
|
||||
if(!ex.isDead) {
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 100.0f, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
|
||||
worldObj.spawnEntityInWorld(ex);
|
||||
|
||||
|
||||
EntityCloudFleijaRainbow cloud = new EntityCloudFleijaRainbow(this.worldObj, config.rainbow);
|
||||
cloud.posX = this.posX;
|
||||
cloud.posY = this.posY;
|
||||
@ -464,74 +464,74 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
this.worldObj.spawnEntityInWorld(cloud);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(config.nuke > 0 && !worldObj.isRemote) {
|
||||
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, config.nuke, posX, posY, posZ));
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "muke");
|
||||
if(MainRegistry.polaroidID == 11 || rand.nextInt(100) == 0) data.setBoolean("balefire", true);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(dimension, posX, posY, posZ, 250));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(dimension, posX, posY, posZ, 250));
|
||||
worldObj.playSoundEffect(posX, posY, posZ, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
||||
if(config.destroysBlocks && !worldObj.isRemote) {
|
||||
if(block.getBlockHardness(worldObj, bX, bY, bZ) <= 120)
|
||||
worldObj.func_147480_a(bX, bY, bZ, false);
|
||||
} else if(config.doesBreakGlass && !worldObj.isRemote) {
|
||||
if(block == Blocks.glass || block == Blocks.glass_pane || block == Blocks.stained_glass || block == Blocks.stained_glass_pane)
|
||||
worldObj.func_147480_a(bX, bY, bZ, false);
|
||||
|
||||
|
||||
if(block instanceof BlockDetonatable) {
|
||||
((BlockDetonatable) block).onShot(worldObj, bX, bY, bZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//for when a bullet dies by hitting a block
|
||||
private void onRicochet(int bX, int bY, int bZ) {
|
||||
|
||||
|
||||
if(config.bntRicochet != null)
|
||||
config.bntRicochet.behaveBlockRicochet(this, bX, bY, bZ);
|
||||
}
|
||||
|
||||
|
||||
//for when a bullet dies by hitting an entity
|
||||
private void onEntityImpact(Entity e) {
|
||||
onEntityHurt(e);
|
||||
onBlockImpact(-1, -1, -1, -1);
|
||||
|
||||
|
||||
if(config.bntHit != null)
|
||||
config.bntHit.behaveEntityHit(this, e);
|
||||
|
||||
|
||||
//this.setDead();
|
||||
}
|
||||
|
||||
|
||||
//for when a bullet hurts an entity, not necessarily dying
|
||||
private void onEntityHurt(Entity e) {
|
||||
|
||||
|
||||
if(config.bntHurt != null)
|
||||
config.bntHurt.behaveEntityHurt(this, e);
|
||||
|
||||
|
||||
if(config.incendiary > 0 && !worldObj.isRemote) {
|
||||
e.setFire(config.incendiary);
|
||||
}
|
||||
|
||||
|
||||
if(config.leadChance > 0 && !worldObj.isRemote && worldObj.rand.nextInt(100) < config.leadChance && e instanceof EntityLivingBase) {
|
||||
((EntityLivingBase)e).addPotionEffect(new PotionEffect(HbmPotion.lead.id, 10 * 20, 0));
|
||||
}
|
||||
|
||||
|
||||
if(e instanceof EntityLivingBase && config.effects != null && !config.effects.isEmpty() && !worldObj.isRemote) {
|
||||
|
||||
|
||||
for(PotionEffect effect : config.effects) {
|
||||
((EntityLivingBase)e).addPotionEffect(new PotionEffect(effect));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(config.instakill && e instanceof EntityLivingBase && !worldObj.isRemote) {
|
||||
|
||||
|
||||
if(!(e instanceof EntityPlayer && ((EntityPlayer)e).capabilities.isCreativeMode))
|
||||
((EntityLivingBase)e).setHealth(0.0F);
|
||||
}
|
||||
|
||||
|
||||
if(config.caustic > 0 && e instanceof EntityPlayer){
|
||||
ArmorUtil.damageSuit((EntityPlayer)e, 0, config.caustic);
|
||||
ArmorUtil.damageSuit((EntityPlayer)e, 1, config.caustic);
|
||||
@ -587,12 +587,12 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
this.config = BulletConfigSyncingUtil.pullConfig(cfg);
|
||||
this.dataWatcher.updateObject(16, (byte)this.config.style);
|
||||
this.dataWatcher.updateObject(17, (byte)this.config.trail);
|
||||
|
||||
|
||||
if(this.config == null) {
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
this.overrideDamage = nbt.getFloat("damage");
|
||||
this.dataWatcher.updateObject(18, cfg);
|
||||
}
|
||||
@ -603,7 +603,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
nbt.setInteger("config", dataWatcher.getWatchableObjectInt(18));
|
||||
nbt.setFloat("damage", this.overrideDamage);
|
||||
}
|
||||
|
||||
|
||||
public static interface IBulletHurtBehaviorNT { public void behaveEntityHurt(EntityBulletBaseNT bullet, Entity hit); }
|
||||
public static interface IBulletHitBehaviorNT { public void behaveEntityHit(EntityBulletBaseNT bullet, Entity hit); }
|
||||
public static interface IBulletRicochetBehaviorNT { public void behaveBlockRicochet(EntityBulletBaseNT bullet, int x, int y, int z); }
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package com.hbm.entity.projectile;
|
||||
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -37,21 +37,21 @@ public class EntityCog extends EntityThrowableInterp {
|
||||
this.dataWatcher.addObject(10, new Integer(0));
|
||||
this.dataWatcher.addObject(11, new Integer(0));
|
||||
}
|
||||
|
||||
|
||||
public EntityCog setOrientation(int rot) {
|
||||
this.dataWatcher.updateObject(10, rot);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public EntityCog setMeta(int meta) {
|
||||
this.dataWatcher.updateObject(11, meta);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public int getOrientation() {
|
||||
return this.dataWatcher.getWatchableObjectInt(10);
|
||||
}
|
||||
|
||||
|
||||
public int getMeta() {
|
||||
return this.dataWatcher.getWatchableObjectInt(11);
|
||||
}
|
||||
@ -60,10 +60,10 @@ public class EntityCog extends EntityThrowableInterp {
|
||||
public boolean interactFirst(EntityPlayer player) {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
|
||||
if(player.inventory.addItemStackToInventory(new ItemStack(ModItems.gear_large, 1, this.getMeta())))
|
||||
this.setDead();
|
||||
|
||||
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ public class EntityCog extends EntityThrowableInterp {
|
||||
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition mop) {
|
||||
|
||||
|
||||
if(worldObj != null && mop != null && mop.typeOfHit == MovingObjectType.ENTITY && mop.entityHit.isEntityAlive()) {
|
||||
Entity e = mop.entityHit;
|
||||
e.attackEntityFrom(ModDamageSource.rubble, 1000);
|
||||
@ -86,18 +86,18 @@ public class EntityCog extends EntityThrowableInterp {
|
||||
vdat.setString("type", "giblets");
|
||||
vdat.setInteger("ent", e.getEntityId());
|
||||
vdat.setInteger("cDiv", 5);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(vdat, e.posX, e.posY + e.height * 0.5, e.posZ), new TargetPoint(e.dimension, e.posX, e.posY + e.height * 0.5, e.posZ, 150));
|
||||
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(vdat, e.posX, e.posY + e.height * 0.5, e.posZ), new TargetPoint(e.dimension, e.posX, e.posY + e.height * 0.5, e.posZ, 150));
|
||||
|
||||
worldObj.playSoundEffect(e.posX, e.posY, e.posZ, "mob.zombie.woodbreak", 2.0F, 0.95F + worldObj.rand.nextFloat() * 0.2F);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(this.ticksExisted > 1 && worldObj != null && mop != null && mop.typeOfHit == MovingObjectType.BLOCK) {
|
||||
|
||||
|
||||
int orientation = this.dataWatcher.getWatchableObjectInt(10);
|
||||
|
||||
if(orientation < 6) {
|
||||
|
||||
|
||||
if(Vec3.createVectorHelper(motionX, motionY, motionZ).lengthVector() < 0.75) {
|
||||
this.dataWatcher.updateObject(10, orientation + 6);
|
||||
orientation += 6;
|
||||
@ -107,13 +107,13 @@ public class EntityCog extends EntityThrowableInterp {
|
||||
this.motionY *= 1 - (Math.abs(side.offsetY) * 2);
|
||||
this.motionZ *= 1 - (Math.abs(side.offsetZ) * 2);
|
||||
worldObj.createExplosion(this, posX, posY, posZ, 3F, false);
|
||||
|
||||
|
||||
if(worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ).getExplosionResistance(this) < 50) {
|
||||
worldObj.func_147480_a(mop.blockX, mop.blockY, mop.blockZ, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(orientation >= 6) {
|
||||
this.motionX = 0;
|
||||
this.motionY = 0;
|
||||
@ -122,20 +122,20 @@ public class EntityCog extends EntityThrowableInterp {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
int orientation = this.dataWatcher.getWatchableObjectInt(10);
|
||||
if(orientation >= 6 && !this.inGround) {
|
||||
this.dataWatcher.updateObject(10, orientation - 6);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
super.onUpdate();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isInRangeToRenderDist(double distance) {
|
||||
|
||||
@ -4,8 +4,8 @@ import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.explosion.ExplosionLarge;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -26,7 +26,7 @@ public class EntityDuchessGambit extends EntityThrowable {
|
||||
this.ignoreFrustumCheck = true;
|
||||
this.isImmuneToFire = true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
|
||||
@ -34,7 +34,7 @@ public class EntityDuchessGambit extends EntityThrowable {
|
||||
for(int i = 0; i < 50; i++) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "bf");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data,
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data,
|
||||
posX + (rand.nextDouble() - 0.5) * 5,
|
||||
posY + (rand.nextDouble() - 0.5) * 7,
|
||||
posZ + (rand.nextDouble() - 0.5) * 20),
|
||||
@ -47,7 +47,7 @@ public class EntityDuchessGambit extends EntityThrowable {
|
||||
this.lastTickPosY = this.prevPosY = posY;
|
||||
this.lastTickPosZ = this.prevPosZ = posZ;
|
||||
this.setPosition(posX + this.motionX, posY + this.motionY, posZ + this.motionZ);
|
||||
|
||||
|
||||
this.motionY -= 0.03;
|
||||
if(motionY < -1.5)
|
||||
motionY = -1.5;
|
||||
@ -81,9 +81,9 @@ public class EntityDuchessGambit extends EntityThrowable {
|
||||
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition p_70184_1_) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isInRangeToRenderDist(double distance)
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
package com.hbm.entity.projectile;
|
||||
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -37,16 +36,16 @@ public class EntitySawblade extends EntityThrowableInterp {
|
||||
this.dataWatcher.addObject(10, new Integer(0));
|
||||
this.dataWatcher.addObject(11, new Integer(0));
|
||||
}
|
||||
|
||||
|
||||
public EntitySawblade setOrientation(int rot) {
|
||||
this.dataWatcher.updateObject(10, rot);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public int getOrientation() {
|
||||
return this.dataWatcher.getWatchableObjectInt(10);
|
||||
}
|
||||
|
||||
|
||||
public int getMeta() {
|
||||
return this.dataWatcher.getWatchableObjectInt(11);
|
||||
}
|
||||
@ -55,10 +54,10 @@ public class EntitySawblade extends EntityThrowableInterp {
|
||||
public boolean interactFirst(EntityPlayer player) {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
|
||||
if(player.inventory.addItemStackToInventory(new ItemStack(ModItems.sawblade)))
|
||||
this.setDead();
|
||||
|
||||
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@ -72,7 +71,7 @@ public class EntitySawblade extends EntityThrowableInterp {
|
||||
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition mop) {
|
||||
|
||||
|
||||
if(worldObj != null && mop != null && mop.typeOfHit == MovingObjectType.ENTITY && mop.entityHit.isEntityAlive()) {
|
||||
Entity e = mop.entityHit;
|
||||
e.attackEntityFrom(ModDamageSource.rubble, 1000);
|
||||
@ -81,18 +80,18 @@ public class EntitySawblade extends EntityThrowableInterp {
|
||||
vdat.setString("type", "giblets");
|
||||
vdat.setInteger("ent", e.getEntityId());
|
||||
vdat.setInteger("cDiv", 5);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(vdat, e.posX, e.posY + e.height * 0.5, e.posZ), new TargetPoint(e.dimension, e.posX, e.posY + e.height * 0.5, e.posZ, 150));
|
||||
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(vdat, e.posX, e.posY + e.height * 0.5, e.posZ), new TargetPoint(e.dimension, e.posX, e.posY + e.height * 0.5, e.posZ, 150));
|
||||
|
||||
worldObj.playSoundEffect(e.posX, e.posY, e.posZ, "mob.zombie.woodbreak", 2.0F, 0.95F + worldObj.rand.nextFloat() * 0.2F);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(this.ticksExisted > 1 && worldObj != null && mop != null && mop.typeOfHit == MovingObjectType.BLOCK) {
|
||||
|
||||
|
||||
int orientation = this.dataWatcher.getWatchableObjectInt(10);
|
||||
|
||||
if(orientation < 6) {
|
||||
|
||||
|
||||
if(Vec3.createVectorHelper(motionX, motionY, motionZ).lengthVector() < 0.75) {
|
||||
this.dataWatcher.updateObject(10, orientation + 6);
|
||||
orientation += 6;
|
||||
@ -102,13 +101,13 @@ public class EntitySawblade extends EntityThrowableInterp {
|
||||
this.motionY *= 1 - (Math.abs(side.offsetY) * 2);
|
||||
this.motionZ *= 1 - (Math.abs(side.offsetZ) * 2);
|
||||
worldObj.createExplosion(this, posX, posY, posZ, 3F, false);
|
||||
|
||||
|
||||
if(worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ).getExplosionResistance(this) < 50) {
|
||||
worldObj.func_147480_a(mop.blockX, mop.blockY, mop.blockZ, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(orientation >= 6) {
|
||||
this.motionX = 0;
|
||||
this.motionY = 0;
|
||||
@ -117,20 +116,20 @@ public class EntitySawblade extends EntityThrowableInterp {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
int orientation = this.dataWatcher.getWatchableObjectInt(10);
|
||||
if(orientation >= 6 && !this.inGround) {
|
||||
this.dataWatcher.updateObject(10, orientation - 6);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
super.onUpdate();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isInRangeToRenderDist(double distance) {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.hbm.entity.projectile;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.particle.helper.ExplosionCreator;
|
||||
|
||||
@ -21,7 +21,7 @@ public class EntityTorpedo extends EntityThrowable {
|
||||
this.ignoreFrustumCheck = true;
|
||||
this.isImmuneToFire = true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
|
||||
@ -29,7 +29,7 @@ public class EntityTorpedo extends EntityThrowable {
|
||||
for(int i = 0; i < 15; i++) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "bf");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data,
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data,
|
||||
posX + (rand.nextDouble() - 0.5) * 2,
|
||||
posY + (rand.nextDouble() - 0.5) * 1,
|
||||
posZ + (rand.nextDouble() - 0.5) * 2),
|
||||
@ -40,9 +40,9 @@ public class EntityTorpedo extends EntityThrowable {
|
||||
this.lastTickPosX = this.prevPosX = posX;
|
||||
this.lastTickPosY = this.prevPosY = posY;
|
||||
this.lastTickPosZ = this.prevPosZ = posZ;
|
||||
|
||||
|
||||
this.setPosition(posX + this.motionX, posY + this.motionY, posZ + this.motionZ);
|
||||
|
||||
|
||||
this.motionY -= 0.04;
|
||||
if(motionY < -2.5) motionY = -2.5;
|
||||
|
||||
@ -59,7 +59,7 @@ public class EntityTorpedo extends EntityThrowable {
|
||||
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition p_70184_1_) { }
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isInRangeToRenderDist(double distance) {
|
||||
|
||||
@ -5,7 +5,7 @@ import java.util.Random;
|
||||
|
||||
import com.hbm.entity.projectile.EntityRubble;
|
||||
import com.hbm.entity.projectile.EntityShrapnel;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.util.ParticleUtil;
|
||||
|
||||
@ -19,51 +19,51 @@ import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ExplosionLarge {
|
||||
|
||||
|
||||
static Random rand = new Random();
|
||||
|
||||
@Deprecated public static void spawnParticles(World world, double x, double y, double z, int count) {
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "smoke");
|
||||
data.setString("mode", "cloud");
|
||||
data.setInteger("count", count);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(world.provider.dimensionId, x, y, z, 250));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(world.provider.dimensionId, x, y, z, 250));
|
||||
}
|
||||
|
||||
public static void spawnParticlesRadial(World world, double x, double y, double z, int count) {
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "smoke");
|
||||
data.setString("mode", "radial");
|
||||
data.setInteger("count", count);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(world.provider.dimensionId, x, y, z, 250));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(world.provider.dimensionId, x, y, z, 250));
|
||||
}
|
||||
|
||||
public static void spawnShock(World world, double x, double y, double z, int count, double strength) {
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "smoke");
|
||||
data.setString("mode", "shock");
|
||||
data.setInteger("count", count);
|
||||
data.setDouble("strength", strength);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y + 0.5, z), new TargetPoint(world.provider.dimensionId, x, y, z, 250));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, x, y + 0.5, z), new TargetPoint(world.provider.dimensionId, x, y, z, 250));
|
||||
}
|
||||
|
||||
public static void spawnBurst(World world, double x, double y, double z, int count, double strength) {
|
||||
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(strength, 0, 0);
|
||||
vec.rotateAroundY(rand.nextInt(360));
|
||||
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
ParticleUtil.spawnGasFlame(world, x, y, z, vec.xCoord, 0.0, vec.zCoord);
|
||||
|
||||
|
||||
vec.rotateAroundY(360 / count);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void spawnRubble(World world, double x, double y, double z, int count) {
|
||||
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
EntityRubble rubble = new EntityRubble(world);
|
||||
rubble.posX = x;
|
||||
@ -76,9 +76,9 @@ public class ExplosionLarge {
|
||||
world.spawnEntityInWorld(rubble);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void spawnShrapnels(World world, double x, double y, double z, int count) {
|
||||
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
EntityShrapnel shrapnel = new EntityShrapnel(world);
|
||||
shrapnel.posX = x;
|
||||
@ -91,9 +91,9 @@ public class ExplosionLarge {
|
||||
world.spawnEntityInWorld(shrapnel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void spawnTracers(World world, double x, double y, double z, int count) {
|
||||
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
EntityShrapnel shrapnel = new EntityShrapnel(world);
|
||||
shrapnel.posX = x;
|
||||
@ -106,9 +106,9 @@ public class ExplosionLarge {
|
||||
world.spawnEntityInWorld(shrapnel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void spawnShrapnelShower(World world, double x, double y, double z, double motionX, double motionY, double motionZ, int count, double deviation) {
|
||||
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
EntityShrapnel shrapnel = new EntityShrapnel(world);
|
||||
shrapnel.posX = x;
|
||||
@ -121,9 +121,9 @@ public class ExplosionLarge {
|
||||
world.spawnEntityInWorld(shrapnel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void spawnMissileDebris(World world, double x, double y, double z, double motionX, double motionY, double motionZ, double deviation, List<ItemStack> debris, ItemStack rareDrop) {
|
||||
|
||||
|
||||
if(debris != null) {
|
||||
for(int i = 0; i < debris.size(); i++) {
|
||||
if(debris.get(i) != null) {
|
||||
@ -136,23 +136,23 @@ public class ExplosionLarge {
|
||||
item.posX = item.posX + item.motionX * 2;
|
||||
item.posY = item.posY + item.motionY * 2;
|
||||
item.posZ = item.posZ + item.motionZ * 2;
|
||||
|
||||
|
||||
world.spawnEntityInWorld(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(rareDrop != null && rand.nextInt(10) == 0) {
|
||||
EntityItem item = new EntityItem(world, x, y, z, rareDrop.copy());
|
||||
item.motionX = motionX + rand.nextGaussian() * deviation * 0.1;
|
||||
item.motionY = motionY + rand.nextGaussian() * deviation * 0.1;
|
||||
item.motionZ = motionZ + rand.nextGaussian() * deviation * 0.1;
|
||||
|
||||
|
||||
world.spawnEntityInWorld(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Deprecated public static void explode(World world, double x, double y, double z, float strength, boolean cloud, boolean rubble, boolean shrapnel, Entity exploder) {
|
||||
world.createExplosion(exploder, x, y, z, strength, true);
|
||||
if(cloud)
|
||||
@ -162,7 +162,7 @@ public class ExplosionLarge {
|
||||
if(shrapnel)
|
||||
spawnShrapnels(world, x, y, z, shrapnelFunction((int)strength));
|
||||
}
|
||||
|
||||
|
||||
@Deprecated public static void explode(World world, double x, double y, double z, float strength, boolean cloud, boolean rubble, boolean shrapnel) {
|
||||
world.createExplosion(null, x, y, z, strength, true);
|
||||
if(cloud)
|
||||
@ -172,7 +172,7 @@ public class ExplosionLarge {
|
||||
if(shrapnel)
|
||||
spawnShrapnels(world, x, y, z, shrapnelFunction((int)strength));
|
||||
}
|
||||
|
||||
|
||||
@Deprecated public static void explodeFire(World world, double x, double y, double z, float strength, boolean cloud, boolean rubble, boolean shrapnel) {
|
||||
world.newExplosion((Entity)null, (float)x, (float)y, (float)z, strength, true, true);
|
||||
if(cloud)
|
||||
@ -182,60 +182,60 @@ public class ExplosionLarge {
|
||||
if(shrapnel)
|
||||
spawnShrapnels(world, x, y, z, shrapnelFunction((int)strength));
|
||||
}
|
||||
|
||||
|
||||
public static void buster(World world, double x, double y, double z, Vec3 vector, float strength, float depth) {
|
||||
|
||||
|
||||
vector = vector.normalize();
|
||||
|
||||
|
||||
for(int i = 0; i < depth; i += 2) {
|
||||
|
||||
|
||||
world.createExplosion((Entity)null, x + vector.xCoord * i, y + vector.yCoord * i, z + vector.zCoord * i, strength, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void jolt(World world, double posX, double posY, double posZ, double strength, int count, double vel) {
|
||||
|
||||
|
||||
for(int j = 0; j < count; j++) {
|
||||
|
||||
|
||||
double phi = rand.nextDouble() * (Math.PI * 2);
|
||||
double costheta = rand.nextDouble() * 2 - 1;
|
||||
double theta = Math.acos(costheta);
|
||||
double x = Math.sin( theta) * Math.cos( phi );
|
||||
double y = Math.sin( theta) * Math.sin( phi );
|
||||
double z = Math.cos( theta );
|
||||
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(x, y, z);
|
||||
|
||||
|
||||
for(int i = 0; i < strength; i ++) {
|
||||
double x0 = posX + (vec.xCoord * i);
|
||||
double y0 = posY + (vec.yCoord * i);
|
||||
double z0 = posZ + (vec.zCoord * i);
|
||||
|
||||
|
||||
if(!world.isRemote) {
|
||||
if(world.getBlock((int)x0, (int)y0, (int)z0).getMaterial().isLiquid()) {
|
||||
world.setBlock((int)x0, (int)y0, (int)z0, Blocks.air);
|
||||
}
|
||||
|
||||
|
||||
if(world.getBlock((int)x0, (int)y0, (int)z0) != Blocks.air) {
|
||||
|
||||
|
||||
if(world.getBlock((int)x0, (int)y0, (int)z0).getExplosionResistance(null, world, (int)x0, (int)y0, (int)z0, posX, posY, posZ) > 70)
|
||||
continue;
|
||||
|
||||
|
||||
EntityRubble rubble = new EntityRubble(world);
|
||||
rubble.posX = x0 + 0.5F;
|
||||
rubble.posY = y0 + 0.5F;
|
||||
rubble.posZ = z0 + 0.5F;
|
||||
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();
|
||||
|
||||
rubble.motionX = vec4.xCoord * vel;
|
||||
rubble.motionY = vec4.yCoord * vel;
|
||||
rubble.motionZ = vec4.zCoord * vel;
|
||||
|
||||
|
||||
world.spawnEntityInWorld(rubble);
|
||||
|
||||
|
||||
world.setBlock((int)x0, (int)y0, (int)z0, Blocks.air);
|
||||
break;
|
||||
}
|
||||
@ -243,17 +243,17 @@ public class ExplosionLarge {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static int cloudFunction(int i) {
|
||||
return (int)(850 * (1 - Math.pow(Math.E, -i/15)) + 15);
|
||||
}
|
||||
|
||||
|
||||
public static int rubbleFunction(int i) {
|
||||
return i/10;
|
||||
}
|
||||
|
||||
|
||||
public static int shrapnelFunction(int i) {
|
||||
return i/3;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -4,8 +4,8 @@ import com.hbm.config.BombConfig;
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK5;
|
||||
import com.hbm.explosion.ExplosionNT.ExAttrib;
|
||||
import com.hbm.handler.radiation.ChunkRadiationManager;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -15,7 +15,7 @@ import net.minecraft.world.World;
|
||||
@Deprecated public class ExplosionNukeSmall {
|
||||
|
||||
public static void explode(World world, double posX, double posY, double posZ, MukeParams params) {
|
||||
|
||||
|
||||
// spawn particles, if present
|
||||
if(params.particle != null) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
@ -24,20 +24,20 @@ import net.minecraft.world.World;
|
||||
if(params.particle.equals("muke") && (MainRegistry.polaroidID == 11 || world.rand.nextInt(100) == 0)) {
|
||||
data.setBoolean("balefire", true);
|
||||
}
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(world.provider.dimensionId, posX, posY, posZ, 250));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(world.provider.dimensionId, posX, posY, posZ, 250));
|
||||
}
|
||||
|
||||
|
||||
// play the sound in any case
|
||||
world.playSoundEffect(posX, posY, posZ, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
|
||||
|
||||
|
||||
if(params.shrapnelCount > 0) ExplosionLarge.spawnShrapnels(world, posX, posY, posZ, params.shrapnelCount);
|
||||
if(params.miniNuke && !params.safe) new ExplosionNT(world, null, posX, posY, posZ, params.blastRadius).addAllAttrib(params.explosionAttribs).overrideResolution(params.resolution).explode();
|
||||
if(params.killRadius > 0) ExplosionNukeGeneric.dealDamage(world, posX, posY, posZ, params.killRadius);
|
||||
if(!params.miniNuke) world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, (int) params.blastRadius, posX, posY, posZ));
|
||||
|
||||
|
||||
if(params.miniNuke) {
|
||||
float radMod = params.radiationLevel / 3F;
|
||||
|
||||
|
||||
for(int i = -2; i <= 2; i++) {
|
||||
for(int j = -2; j <= 2; j++) {
|
||||
if(Math.abs(i) + Math.abs(j) < 4) {
|
||||
@ -53,7 +53,7 @@ import net.minecraft.world.World;
|
||||
public static MukeParams PARAMS_LOW = new MukeParams() {{ blastRadius = 15F; killRadius = 45F; radiationLevel = 2; }};
|
||||
public static MukeParams PARAMS_MEDIUM = new MukeParams() {{ blastRadius = 20F; killRadius = 55F; radiationLevel = 3; }};
|
||||
public static MukeParams PARAMS_HIGH = new MukeParams() {{ miniNuke = false; blastRadius = BombConfig.fatmanRadius; shrapnelCount = 0; }};
|
||||
|
||||
|
||||
/* more sensible approach with more customization options, idea shamelessly stolen from Martin */
|
||||
public static class MukeParams {
|
||||
public boolean miniNuke = true;
|
||||
|
||||
@ -2,7 +2,7 @@ package com.hbm.explosion.vanillant.standard;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.interfaces.IExplosionSFX;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -13,15 +13,15 @@ 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));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(world.provider.dimensionId, x, y, z, 200));
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import java.util.UUID;
|
||||
|
||||
import com.hbm.config.RadiationConfig;
|
||||
import com.hbm.entity.mob.EntityDuck;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
@ -164,7 +165,7 @@ public class HbmLivingProps implements IExtendedEntityProperties {
|
||||
data.setInteger("count", 50);
|
||||
data.setInteger("block", Block.getIdFromBlock(Blocks.soul_sand));
|
||||
data.setInteger("entity", entity.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 50));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 50));
|
||||
}
|
||||
|
||||
if(entity instanceof EntityPlayer) {
|
||||
|
||||
@ -22,7 +22,6 @@ import com.hbm.items.armor.ArmorFSB;
|
||||
import com.hbm.items.weapon.sedna.factory.ConfettiUtil;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.packet.toclient.ExtPropPacket;
|
||||
import com.hbm.particle.helper.FlameCreator;
|
||||
@ -238,7 +237,7 @@ public class EntityEffectHandler {
|
||||
nbt.setString("mode", "blood");
|
||||
nbt.setInteger("count", 25);
|
||||
nbt.setInteger("entity", entity.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
|
||||
|
||||
if((world.getTotalWorldTime() + r600) % 600 == 1) {
|
||||
world.playSoundEffect(ix, iy, iz, "hbm:player.vomit", 1.0F, 1.0F);
|
||||
@ -253,7 +252,7 @@ public class EntityEffectHandler {
|
||||
nbt.setString("mode", "normal");
|
||||
nbt.setInteger("count", 15);
|
||||
nbt.setInteger("entity", entity.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
|
||||
|
||||
if((world.getTotalWorldTime() + r1200) % 1200 == 1) {
|
||||
world.playSoundEffect(ix, iy, iz, "hbm:player.vomit", 1.0F, 1.0F);
|
||||
@ -269,7 +268,7 @@ public class EntityEffectHandler {
|
||||
nbt.setInteger("count", 1);
|
||||
nbt.setInteger("block", Block.getIdFromBlock(Blocks.redstone_block));
|
||||
nbt.setInteger("entity", entity.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
|
||||
|
||||
}
|
||||
} else {
|
||||
@ -303,7 +302,7 @@ public class EntityEffectHandler {
|
||||
data.setInteger("count", 1);
|
||||
data.setInteger("block", Block.getIdFromBlock(Blocks.soul_sand));
|
||||
data.setInteger("entity", entity.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -408,7 +407,7 @@ public class EntityEffectHandler {
|
||||
nbt.setString("mode", "blood");
|
||||
nbt.setInteger("count", 25);
|
||||
nbt.setInteger("entity", entity.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
|
||||
|
||||
if((contagion + entity.getEntityId()) % 200 == 19)
|
||||
world.playSoundEffect(entity.posX, entity.posY, entity.posZ, "hbm:player.vomit", 1.0F, 1.0F);
|
||||
@ -484,7 +483,7 @@ public class EntityEffectHandler {
|
||||
nbt.setString("mode", "blood");
|
||||
nbt.setInteger("count", 5);
|
||||
nbt.setInteger("entity", entity.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
|
||||
}
|
||||
|
||||
if(coughsCoal) {
|
||||
@ -493,7 +492,7 @@ public class EntityEffectHandler {
|
||||
nbt.setString("mode", "smoke");
|
||||
nbt.setInteger("count", coughsALotOfCoal ? 50 : 10);
|
||||
nbt.setInteger("entity", entity.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -520,7 +519,7 @@ public class EntityEffectHandler {
|
||||
nbt.setInteger("count", 1);
|
||||
nbt.setInteger("block", Block.getIdFromBlock(Blocks.coal_block));
|
||||
nbt.setInteger("entity", entity.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,9 +2,9 @@ package com.hbm.handler;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.generic.BlockBobble.BobbleType;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.tool.IItemAbility;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.util.ContaminationUtil;
|
||||
@ -37,22 +37,22 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class WeaponAbility {
|
||||
|
||||
|
||||
public abstract void onHit(World world, EntityPlayer player, Entity victim, IItemAbility tool);
|
||||
public abstract String getName();
|
||||
public abstract String getFullName();
|
||||
|
||||
|
||||
public static class RadiationAbility extends WeaponAbility {
|
||||
|
||||
|
||||
float rad;
|
||||
|
||||
|
||||
public RadiationAbility(float rad) {
|
||||
this.rad = rad;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHit(World world, EntityPlayer player, Entity victim, IItemAbility tool) {
|
||||
|
||||
|
||||
if(victim instanceof EntityLivingBase)
|
||||
ContaminationUtil.contaminate((EntityLivingBase)victim, HazardType.RADIATION, ContaminationType.CREATIVE, rad);
|
||||
}
|
||||
@ -67,20 +67,20 @@ public abstract class WeaponAbility {
|
||||
return I18n.format(getName()) + " (" + rad + ")";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class VampireAbility extends WeaponAbility {
|
||||
|
||||
|
||||
float amount;
|
||||
|
||||
|
||||
public VampireAbility(float amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHit(World world, EntityPlayer player, Entity victim, IItemAbility tool) {
|
||||
|
||||
|
||||
if(victim instanceof EntityLivingBase) {
|
||||
|
||||
|
||||
EntityLivingBase living = (EntityLivingBase) victim;
|
||||
if(living.getHealth() <= 0) return;
|
||||
living.setHealth(living.getHealth() - amount);
|
||||
@ -99,20 +99,20 @@ public abstract class WeaponAbility {
|
||||
return I18n.format(getName()) + " (" + amount + ")";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class StunAbility extends WeaponAbility {
|
||||
|
||||
|
||||
int duration;
|
||||
|
||||
|
||||
public StunAbility(int duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHit(World world, EntityPlayer player, Entity victim, IItemAbility tool) {
|
||||
|
||||
|
||||
if(victim instanceof EntityLivingBase) {
|
||||
|
||||
|
||||
EntityLivingBase living = (EntityLivingBase) victim;
|
||||
|
||||
living.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, duration * 20, 4));
|
||||
@ -130,20 +130,20 @@ public abstract class WeaponAbility {
|
||||
return I18n.format(getName()) + " (" + duration + ")";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class PhosphorusAbility extends WeaponAbility {
|
||||
|
||||
|
||||
int duration;
|
||||
|
||||
|
||||
public PhosphorusAbility(int duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHit(World world, EntityPlayer player, Entity victim, IItemAbility tool) {
|
||||
|
||||
|
||||
if(victim instanceof EntityLivingBase) {
|
||||
|
||||
|
||||
EntityLivingBase living = (EntityLivingBase) victim;
|
||||
|
||||
living.addPotionEffect(new PotionEffect(HbmPotion.phosphorus.id, duration * 20, 4));
|
||||
@ -160,18 +160,18 @@ public abstract class WeaponAbility {
|
||||
return I18n.format(getName()) + " (" + duration + ")";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class FireAbility extends WeaponAbility {
|
||||
|
||||
|
||||
int duration;
|
||||
|
||||
|
||||
public FireAbility(int duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHit(World world, EntityPlayer player, Entity victim, IItemAbility tool) {
|
||||
|
||||
|
||||
if(victim instanceof EntityLivingBase) {
|
||||
victim.setFire(duration);
|
||||
}
|
||||
@ -187,31 +187,31 @@ public abstract class WeaponAbility {
|
||||
return I18n.format(getName()) + " (" + duration + ")";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class ChainsawAbility extends WeaponAbility {
|
||||
|
||||
|
||||
int divider;
|
||||
|
||||
|
||||
public ChainsawAbility(int divider) {
|
||||
this.divider = divider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHit(World world, EntityPlayer player, Entity victim, IItemAbility tool) {
|
||||
|
||||
|
||||
if(victim instanceof EntityLivingBase) {
|
||||
|
||||
|
||||
EntityLivingBase living = (EntityLivingBase) victim;
|
||||
|
||||
|
||||
if(living.getHealth() <= 0.0F) {
|
||||
|
||||
|
||||
int count = Math.min((int)Math.ceil(living.getMaxHealth() / divider), 250); //safeguard to prevent funnies from bosses with obscene health
|
||||
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
living.entityDropItem(new ItemStack(ModItems.nitra_small), 1);
|
||||
world.spawnEntityInWorld(new EntityXPOrb(world, living.posX, living.posY, living.posZ, 1));
|
||||
}
|
||||
|
||||
|
||||
if(player instanceof EntityPlayerMP) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "vanillaburst");
|
||||
@ -219,9 +219,9 @@ public abstract class WeaponAbility {
|
||||
data.setDouble("motion", 0.1D);
|
||||
data.setString("mode", "blockdust");
|
||||
data.setInteger("block", Block.getIdFromBlock(Blocks.redstone_block));
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, living.posX, living.posY + living.height * 0.5, living.posZ), new TargetPoint(living.dimension, living.posX, living.posY, living.posZ, 50));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, living.posX, living.posY + living.height * 0.5, living.posZ), new TargetPoint(living.dimension, living.posX, living.posY, living.posZ, 50));
|
||||
}
|
||||
|
||||
|
||||
world.playSoundEffect(living.posX, living.posY + living.height * 0.5, living.posZ, "hbm:weapon.chainsaw", 0.5F, 1.0F);
|
||||
}
|
||||
}
|
||||
@ -237,28 +237,28 @@ public abstract class WeaponAbility {
|
||||
return I18n.format(getName()) + " (1:" + divider + ")";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class BeheaderAbility extends WeaponAbility {
|
||||
|
||||
@Override
|
||||
public void onHit(World world, EntityPlayer player, Entity victim, IItemAbility tool) {
|
||||
|
||||
|
||||
if(victim instanceof EntityLivingBase && ((EntityLivingBase) victim).getHealth() <= 0.0F) {
|
||||
|
||||
|
||||
EntityLivingBase living = (EntityLivingBase) victim;
|
||||
|
||||
|
||||
if(living instanceof EntitySkeleton) {
|
||||
|
||||
|
||||
if(((EntitySkeleton)living).getSkeletonType() == 0) {
|
||||
living.entityDropItem(new ItemStack(Items.skull, 1, 0), 0.0F);
|
||||
} else {
|
||||
|
||||
|
||||
if(world.rand.nextInt(20) == 0)
|
||||
living.entityDropItem(new ItemStack(Items.skull, 1, 1), 0.0F);
|
||||
else
|
||||
living.entityDropItem(new ItemStack(Items.coal, 3), 0.0F);
|
||||
}
|
||||
|
||||
|
||||
} else if(living instanceof EntityZombie) {
|
||||
living.entityDropItem(new ItemStack(Items.skull, 1, 2), 0.0F);
|
||||
} else if(living instanceof EntityCreeper) {
|
||||
@ -268,7 +268,7 @@ public abstract class WeaponAbility {
|
||||
} else if(living instanceof EntitySlime) {
|
||||
living.entityDropItem(new ItemStack(Items.slime_ball, 3), 0.0F);
|
||||
} else if(living instanceof EntityPlayer) {
|
||||
|
||||
|
||||
ItemStack head = new ItemStack(Items.skull, 1, 3);
|
||||
head.stackTagCompound = new NBTTagCompound();
|
||||
head.stackTagCompound.setString("SkullOwner", ((EntityPlayer) living).getDisplayName());
|
||||
@ -290,22 +290,22 @@ public abstract class WeaponAbility {
|
||||
return I18n.format(getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class BobbleAbility extends WeaponAbility {
|
||||
|
||||
@Override
|
||||
public void onHit(World world, EntityPlayer player, Entity victim, IItemAbility tool) {
|
||||
|
||||
|
||||
if(victim instanceof EntityMob && ((EntityMob) victim).getHealth() <= 0.0F) {
|
||||
|
||||
|
||||
EntityMob mob = (EntityMob) victim;
|
||||
|
||||
|
||||
int chance = 1000;
|
||||
|
||||
|
||||
if(mob.getMaxHealth() > 20) {
|
||||
chance = 750;
|
||||
}
|
||||
|
||||
|
||||
if(world.rand.nextInt(chance) == 0)
|
||||
mob.entityDropItem(new ItemStack(ModBlocks.bobblehead, 1, world.rand.nextInt(BobbleType.values().length - 1) + 1), 0.0F);
|
||||
}
|
||||
|
||||
@ -7,8 +7,8 @@ import com.hbm.entity.projectile.EntityBulletBaseNT.*;
|
||||
import com.hbm.explosion.ExplosionNukeSmall;
|
||||
import com.hbm.explosion.ExplosionNukeSmall.MukeParams;
|
||||
import com.hbm.handler.BulletConfiguration;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.util.ArmorRegistry;
|
||||
@ -27,15 +27,15 @@ import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class BulletConfigFactory {
|
||||
|
||||
|
||||
public static final float defaultSpread = 0.005F;
|
||||
|
||||
|
||||
/// STANDARD CONFIGS ///
|
||||
//do not include damage or ammo
|
||||
public static BulletConfiguration standardBulletConfig() {
|
||||
|
||||
|
||||
BulletConfiguration bullet = new BulletConfiguration();
|
||||
|
||||
|
||||
bullet.velocity = 5.0F;
|
||||
bullet.spread = defaultSpread;
|
||||
bullet.wear = 10;
|
||||
@ -54,7 +54,7 @@ public class BulletConfigFactory {
|
||||
bullet.style = BulletConfiguration.STYLE_NORMAL;
|
||||
bullet.plink = BulletConfiguration.PLINK_BULLET;
|
||||
bullet.leadChance = 5;
|
||||
|
||||
|
||||
return bullet;
|
||||
}
|
||||
public static BulletConfiguration standardPistolConfig() {
|
||||
@ -63,11 +63,11 @@ public class BulletConfigFactory {
|
||||
bullet.plink = BulletConfiguration.PLINK_BULLET;
|
||||
return bullet;
|
||||
}
|
||||
|
||||
|
||||
public static BulletConfiguration standardBuckshotConfig() {
|
||||
|
||||
|
||||
BulletConfiguration bullet = new BulletConfiguration();
|
||||
|
||||
|
||||
bullet.velocity = 5.0F;
|
||||
bullet.spread = defaultSpread * 10F;
|
||||
bullet.wear = 10;
|
||||
@ -85,14 +85,14 @@ public class BulletConfigFactory {
|
||||
bullet.style = BulletConfiguration.STYLE_PELLET;
|
||||
bullet.plink = BulletConfiguration.PLINK_BULLET;
|
||||
bullet.leadChance = 10;
|
||||
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
|
||||
public static BulletConfiguration standardRocketConfig() {
|
||||
|
||||
|
||||
BulletConfiguration bullet = new BulletConfiguration();
|
||||
|
||||
|
||||
bullet.velocity = 2.0F;
|
||||
bullet.spread = defaultSpread;
|
||||
bullet.wear = 10;
|
||||
@ -111,14 +111,14 @@ public class BulletConfigFactory {
|
||||
bullet.style = BulletConfiguration.STYLE_ROCKET;
|
||||
bullet.plink = BulletConfiguration.PLINK_GRENADE;
|
||||
bullet.vPFX = "smoke";
|
||||
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
|
||||
public static BulletConfiguration standardGrenadeConfig() {
|
||||
|
||||
|
||||
BulletConfiguration bullet = new BulletConfiguration();
|
||||
|
||||
|
||||
bullet.velocity = 2.0F;
|
||||
bullet.spread = defaultSpread;
|
||||
bullet.wear = 10;
|
||||
@ -137,14 +137,14 @@ public class BulletConfigFactory {
|
||||
bullet.style = BulletConfiguration.STYLE_GRENADE;
|
||||
bullet.plink = BulletConfiguration.PLINK_GRENADE;
|
||||
bullet.vPFX = "smoke";
|
||||
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
|
||||
public static BulletConfiguration standardShellConfig() {
|
||||
|
||||
|
||||
BulletConfiguration bullet = new BulletConfiguration();
|
||||
|
||||
|
||||
bullet.velocity = 3.0F;
|
||||
bullet.spread = defaultSpread;
|
||||
bullet.wear = 10;
|
||||
@ -162,14 +162,14 @@ public class BulletConfigFactory {
|
||||
bullet.style = BulletConfiguration.STYLE_GRENADE;
|
||||
bullet.plink = BulletConfiguration.PLINK_GRENADE;
|
||||
bullet.vPFX = "smoke";
|
||||
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
|
||||
public static BulletConfiguration standardNukeConfig() {
|
||||
|
||||
|
||||
BulletConfiguration bullet = new BulletConfiguration();
|
||||
|
||||
|
||||
bullet.velocity = 3.0F;
|
||||
bullet.spread = defaultSpread;
|
||||
bullet.wear = 10;
|
||||
@ -188,10 +188,10 @@ public class BulletConfigFactory {
|
||||
bullet.doesBreakGlass = false;
|
||||
bullet.style = BulletConfiguration.STYLE_NUKE;
|
||||
bullet.plink = BulletConfiguration.PLINK_GRENADE;
|
||||
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Sizes:
|
||||
* 0 - safe
|
||||
@ -201,89 +201,89 @@ public class BulletConfigFactory {
|
||||
* 4 - big
|
||||
*/
|
||||
public static void nuclearExplosion(Entity entity, int x, int y, int z, MukeParams params) {
|
||||
|
||||
|
||||
if(!entity.worldObj.isRemote) {
|
||||
|
||||
double posX = entity.posX;
|
||||
double posY = entity.posY + 0.5;
|
||||
double posZ = entity.posZ;
|
||||
|
||||
|
||||
if(y >= 0) {
|
||||
posX = x + 0.5;
|
||||
posY = y + 1.5;
|
||||
posZ = z + 0.5;
|
||||
}
|
||||
|
||||
|
||||
ExplosionNukeSmall.explode(entity.worldObj, posX, posY, posZ, params);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void makeFlechette(BulletConfiguration bullet) {
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
bulletnt.getStuck(x, y, z, sideHit);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static IBulletImpactBehaviorNT getPhosphorousEffect(final int radius, final int duration, final int count, final double motion, float hazeChance) {
|
||||
|
||||
|
||||
IBulletImpactBehaviorNT impact = new IBulletImpactBehaviorNT() {
|
||||
|
||||
@Override
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
|
||||
|
||||
|
||||
List<Entity> hit = bullet.worldObj.getEntitiesWithinAABBExcludingEntity(bullet, AxisAlignedBB.getBoundingBox(bullet.posX - radius, bullet.posY - radius, bullet.posZ - radius, bullet.posX + radius, bullet.posY + radius, bullet.posZ + radius));
|
||||
|
||||
|
||||
for(Entity e : hit) {
|
||||
|
||||
|
||||
if(!Library.isObstructed(bullet.worldObj, bullet.posX, bullet.posY, bullet.posZ, e.posX, e.posY + e.getEyeHeight(), e.posZ)) {
|
||||
e.setFire(5);
|
||||
|
||||
|
||||
if(e instanceof EntityLivingBase) {
|
||||
|
||||
|
||||
PotionEffect eff = new PotionEffect(HbmPotion.phosphorus.id, duration, 0, true);
|
||||
eff.getCurativeItems().clear();
|
||||
((EntityLivingBase)e).addPotionEffect(eff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "vanillaburst");
|
||||
data.setString("mode", "flame");
|
||||
data.setInteger("count", count);
|
||||
data.setDouble("motion", motion);
|
||||
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 50));
|
||||
|
||||
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 50));
|
||||
|
||||
if(bullet.worldObj.rand.nextFloat() < hazeChance) {
|
||||
NBTTagCompound haze = new NBTTagCompound();
|
||||
haze.setString("type", "haze");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(haze, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 150));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(haze, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 150));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return impact;
|
||||
}
|
||||
|
||||
|
||||
public static IBulletImpactBehaviorNT getGasEffect(final int radius, final int duration) {
|
||||
|
||||
|
||||
IBulletImpactBehaviorNT impact = new IBulletImpactBehaviorNT() {
|
||||
|
||||
@Override
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
|
||||
|
||||
|
||||
List<Entity> hit = bullet.worldObj.getEntitiesWithinAABBExcludingEntity(bullet, AxisAlignedBB.getBoundingBox(bullet.posX - radius, bullet.posY - radius, bullet.posZ - radius, bullet.posX + radius, bullet.posY + radius, bullet.posZ + radius));
|
||||
|
||||
|
||||
for(Entity e : hit) {
|
||||
|
||||
|
||||
if(!Library.isObstructed(bullet.worldObj, bullet.posX, bullet.posY, bullet.posZ, e.posX, e.posY + e.getEyeHeight(), e.posZ)) {
|
||||
|
||||
|
||||
if(e instanceof EntityLivingBase) {
|
||||
|
||||
|
||||
EntityLivingBase entity = (EntityLivingBase) e;
|
||||
|
||||
|
||||
if(ArmorRegistry.hasAllProtection(entity, 3, HazardClass.GAS_LUNG))
|
||||
continue;
|
||||
|
||||
@ -302,75 +302,75 @@ public class BulletConfigFactory {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "vanillaburst");
|
||||
data.setString("mode", "cloud");
|
||||
data.setInteger("count", 15);
|
||||
data.setDouble("motion", 0.1D);
|
||||
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 50));
|
||||
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 50));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return impact;
|
||||
}
|
||||
|
||||
|
||||
public static IBulletUpdateBehaviorNT getLaserSteering() {
|
||||
|
||||
|
||||
IBulletUpdateBehaviorNT onUpdate = new IBulletUpdateBehaviorNT() {
|
||||
|
||||
@Override
|
||||
public void behaveUpdate(EntityBulletBaseNT bullet) {
|
||||
|
||||
|
||||
if(bullet.getThrower() == null || !(bullet.getThrower() instanceof EntityPlayer))
|
||||
return;
|
||||
|
||||
|
||||
if(Vec3.createVectorHelper(bullet.posX - bullet.getThrower().posX, bullet.posY - bullet.getThrower().posY, bullet.posZ - bullet.getThrower().posZ).lengthVector() > 100)
|
||||
return;
|
||||
|
||||
|
||||
MovingObjectPosition mop = Library.rayTrace((EntityPlayer)bullet.getThrower(), 200, 1);
|
||||
|
||||
|
||||
if(mop == null || mop.hitVec == null)
|
||||
return;
|
||||
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(mop.hitVec.xCoord - bullet.posX, mop.hitVec.yCoord - bullet.posY, mop.hitVec.zCoord - bullet.posZ);
|
||||
|
||||
|
||||
if(vec.lengthVector() < 3)
|
||||
return;
|
||||
|
||||
|
||||
vec = vec.normalize();
|
||||
|
||||
|
||||
double speed = Vec3.createVectorHelper(bullet.motionX, bullet.motionY, bullet.motionZ).lengthVector();
|
||||
|
||||
bullet.motionX = vec.xCoord * speed;
|
||||
bullet.motionY = vec.yCoord * speed;
|
||||
bullet.motionZ = vec.zCoord * speed;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
return onUpdate;
|
||||
}
|
||||
|
||||
|
||||
public static IBulletUpdateBehaviorNT getHomingBehavior(final double range, final double angle) {
|
||||
|
||||
IBulletUpdateBehaviorNT onUpdate = new IBulletUpdateBehaviorNT() {
|
||||
|
||||
@Override
|
||||
public void behaveUpdate(EntityBulletBaseNT bullet) {
|
||||
|
||||
|
||||
if(bullet.worldObj.isRemote)
|
||||
return;
|
||||
|
||||
|
||||
if(bullet.worldObj.getEntityByID(bullet.getEntityData().getInteger("homingTarget")) == null) {
|
||||
chooseTarget(bullet);
|
||||
}
|
||||
|
||||
|
||||
Entity target = bullet.worldObj.getEntityByID(bullet.getEntityData().getInteger("homingTarget"));
|
||||
|
||||
|
||||
if(target != null) {
|
||||
|
||||
|
||||
Vec3 delta = Vec3.createVectorHelper(target.posX - bullet.posX, target.posY + target.height / 2 - bullet.posY, target.posZ - bullet.posZ);
|
||||
delta = delta.normalize();
|
||||
double vel = Vec3.createVectorHelper(bullet.motionX, bullet.motionY, bullet.motionZ).lengthVector();
|
||||
@ -380,32 +380,32 @@ public class BulletConfigFactory {
|
||||
bullet.motionZ = delta.zCoord * vel;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void chooseTarget(EntityBulletBaseNT bullet) {
|
||||
|
||||
|
||||
List<EntityLivingBase> entities = bullet.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, bullet.boundingBox.expand(range, range, range));
|
||||
|
||||
|
||||
Vec3 mot = Vec3.createVectorHelper(bullet.motionX, bullet.motionY, bullet.motionZ);
|
||||
|
||||
|
||||
EntityLivingBase target = null;
|
||||
double targetAngle = angle;
|
||||
|
||||
|
||||
for(EntityLivingBase e : entities) {
|
||||
|
||||
|
||||
if(!e.isEntityAlive() || e == bullet.getThrower())
|
||||
continue;
|
||||
|
||||
|
||||
Vec3 delta = Vec3.createVectorHelper(e.posX - bullet.posX, e.posY + e.height / 2 - bullet.posY, e.posZ - bullet.posZ);
|
||||
|
||||
|
||||
if(bullet.worldObj.func_147447_a(Vec3.createVectorHelper(bullet.posX, bullet.posY, bullet.posZ), Vec3.createVectorHelper(e.posX, e.posY + e.height / 2, e.posZ), false, true, false) != null)
|
||||
continue;
|
||||
|
||||
|
||||
double dist = e.getDistanceSqToEntity(bullet);
|
||||
|
||||
|
||||
if(dist < range * range) {
|
||||
|
||||
|
||||
double deltaAngle = BobMathUtil.getCrossAngle(mot, delta);
|
||||
|
||||
|
||||
if(deltaAngle < targetAngle) {
|
||||
//Checks if the bullet is not already inside the entity's bounding box, so it doesn't pick the same target
|
||||
if(bullet.getConfig().doesPenetrate && bullet.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, bullet.boundingBox.expand(2, 2, 2)) == null) {
|
||||
@ -416,13 +416,13 @@ public class BulletConfigFactory {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(target != null) {
|
||||
bullet.getEntityData().setInteger("homingTarget", target.getEntityId());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return onUpdate;
|
||||
}
|
||||
/** Resets the bullet's target **/
|
||||
|
||||
@ -8,11 +8,11 @@ import com.hbm.entity.projectile.EntityBulletBaseNT.IBulletUpdateBehaviorNT;
|
||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||
import com.hbm.handler.BulletConfigSyncingUtil;
|
||||
import com.hbm.handler.BulletConfiguration;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
|
||||
@ -26,7 +26,7 @@ import net.minecraft.util.Vec3;
|
||||
public class GunNPCFactory {
|
||||
|
||||
public static BulletConfiguration getMaskmanOrb() {
|
||||
|
||||
|
||||
BulletConfiguration bullet = new BulletConfiguration();
|
||||
|
||||
bullet.ammo = new ComparableStack(ModItems.coin_maskman);
|
||||
@ -49,9 +49,9 @@ public class GunNPCFactory {
|
||||
bullet.style = BulletConfiguration.STYLE_ORB;
|
||||
bullet.trail = 1;
|
||||
bullet.explosive = 1.5F;
|
||||
|
||||
|
||||
bullet.bntUpdate = (bulletnt) -> {
|
||||
|
||||
|
||||
if(bulletnt.worldObj.isRemote)
|
||||
return;
|
||||
|
||||
@ -72,14 +72,14 @@ public class GunNPCFactory {
|
||||
bulletnt.worldObj.spawnEntityInWorld(bolt);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
|
||||
public static BulletConfiguration getMaskmanBolt() {
|
||||
|
||||
|
||||
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
|
||||
|
||||
|
||||
bullet.ammo = new ComparableStack(ModItems.coin_maskman);
|
||||
bullet.spread = 0.0F;
|
||||
bullet.dmgMin = 15;
|
||||
@ -90,14 +90,14 @@ public class GunNPCFactory {
|
||||
bullet.setToBolt(BulletConfiguration.BOLT_LACUNAE);
|
||||
bullet.vPFX = "reddust";
|
||||
bullet.damageType = ModDamageSource.s_laser;
|
||||
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
|
||||
public static BulletConfiguration getMaskmanBullet() {
|
||||
|
||||
|
||||
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
|
||||
|
||||
|
||||
bullet.ammo = new ComparableStack(ModItems.coin_maskman);
|
||||
bullet.spread = 0.0F;
|
||||
bullet.dmgMin = 5;
|
||||
@ -106,14 +106,14 @@ public class GunNPCFactory {
|
||||
bullet.leadChance = 15;
|
||||
bullet.style = BulletConfiguration.STYLE_FLECHETTE;
|
||||
bullet.vPFX = "bluedust";
|
||||
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
|
||||
public static BulletConfiguration getMaskmanTracer() {
|
||||
|
||||
|
||||
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
|
||||
|
||||
|
||||
bullet.ammo = new ComparableStack(ModItems.coin_maskman);
|
||||
bullet.spread = 0.0F;
|
||||
bullet.dmgMin = 15;
|
||||
@ -123,9 +123,9 @@ public class GunNPCFactory {
|
||||
bullet.setToBolt(BulletConfiguration.BOLT_NIGHTMARE);
|
||||
bullet.vPFX = "reddust";
|
||||
bullet.damageType = ModDamageSource.s_laser;
|
||||
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
|
||||
|
||||
if(bulletnt.worldObj.isRemote)
|
||||
return;
|
||||
|
||||
@ -135,14 +135,14 @@ public class GunNPCFactory {
|
||||
meteor.setThrower(bulletnt.getThrower());
|
||||
bulletnt.worldObj.spawnEntityInWorld(meteor);
|
||||
};
|
||||
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
|
||||
public static BulletConfiguration getMaskmanRocket() {
|
||||
|
||||
|
||||
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
|
||||
|
||||
|
||||
bullet.ammo = new ComparableStack(ModItems.coin_maskman);
|
||||
bullet.gravity = 0.1D;
|
||||
bullet.velocity = 1.0F;
|
||||
@ -151,14 +151,14 @@ public class GunNPCFactory {
|
||||
bullet.blockDamage = false;
|
||||
bullet.explosive = 5.0F;
|
||||
bullet.style = BulletConfiguration.STYLE_ROCKET;
|
||||
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
|
||||
public static BulletConfiguration getMaskmanMeteor() {
|
||||
|
||||
|
||||
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
|
||||
|
||||
|
||||
bullet.ammo = new ComparableStack(ModItems.coin_maskman);
|
||||
bullet.gravity = 0.1D;
|
||||
bullet.velocity = 1.0F;
|
||||
@ -168,7 +168,7 @@ public class GunNPCFactory {
|
||||
bullet.incendiary = 3;
|
||||
bullet.explosive = 2.5F;
|
||||
bullet.style = BulletConfiguration.STYLE_METEOR;
|
||||
|
||||
|
||||
bullet.bntUpdate = (bulletnt) -> {
|
||||
|
||||
if(!bulletnt.worldObj.isRemote)
|
||||
@ -186,14 +186,14 @@ public class GunNPCFactory {
|
||||
MainRegistry.proxy.effectNT(nbt);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
public static BulletConfiguration getWormBolt() {
|
||||
|
||||
|
||||
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
|
||||
|
||||
|
||||
bullet.ammo = new ComparableStack(ModItems.coin_worm);
|
||||
bullet.spread = 0.0F;
|
||||
bullet.maxAge = 60;
|
||||
@ -203,14 +203,14 @@ public class GunNPCFactory {
|
||||
bullet.doesRicochet = false;
|
||||
bullet.setToBolt(BulletConfiguration.BOLT_WORM);
|
||||
bullet.damageType = ModDamageSource.s_laser;
|
||||
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
|
||||
public static BulletConfiguration getWormHeadBolt() {
|
||||
|
||||
|
||||
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
|
||||
|
||||
|
||||
bullet.ammo = new ComparableStack(ModItems.coin_worm);
|
||||
bullet.spread = 0.0F;
|
||||
bullet.maxAge = 100;
|
||||
@ -220,46 +220,46 @@ public class GunNPCFactory {
|
||||
bullet.doesRicochet = false;
|
||||
bullet.setToBolt(BulletConfiguration.BOLT_LASER);
|
||||
bullet.damageType = ModDamageSource.s_laser;
|
||||
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
|
||||
public static BulletConfiguration getRocketUFOConfig() {
|
||||
|
||||
|
||||
BulletConfiguration bullet = GunRocketFactory.getRocketConfig();
|
||||
|
||||
|
||||
bullet.vPFX = "reddust";
|
||||
bullet.destroysBlocks = false;
|
||||
bullet.explosive = 0F;
|
||||
|
||||
|
||||
bullet.bntUpdate = new IBulletUpdateBehaviorNT() {
|
||||
|
||||
|
||||
double angle = 90;
|
||||
double range = 100;
|
||||
|
||||
@Override
|
||||
public void behaveUpdate(EntityBulletBaseNT bullet) {
|
||||
|
||||
|
||||
if(bullet.worldObj.isRemote)
|
||||
return;
|
||||
|
||||
|
||||
if(bullet.worldObj.getEntityByID(bullet.getEntityData().getInteger("homingTarget")) == null) {
|
||||
chooseTarget(bullet);
|
||||
}
|
||||
|
||||
|
||||
Entity target = bullet.worldObj.getEntityByID(bullet.getEntityData().getInteger("homingTarget"));
|
||||
|
||||
|
||||
if(target != null) {
|
||||
|
||||
|
||||
if(bullet.getDistanceSqToEntity(target) < 5) {
|
||||
bullet.getConfig().bntImpact.behaveBlockHit(bullet, -1, -1, -1, -1);
|
||||
bullet.setDead();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Vec3 delta = Vec3.createVectorHelper(target.posX - bullet.posX, target.posY + target.height / 2 - bullet.posY, target.posZ - bullet.posZ);
|
||||
delta = delta.normalize();
|
||||
|
||||
|
||||
double vel = Vec3.createVectorHelper(bullet.motionX, bullet.motionY, bullet.motionZ).lengthVector();
|
||||
|
||||
bullet.motionX = delta.xCoord * vel;
|
||||
@ -267,45 +267,45 @@ public class GunNPCFactory {
|
||||
bullet.motionZ = delta.zCoord * vel;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void chooseTarget(EntityBulletBaseNT bullet) {
|
||||
|
||||
|
||||
List<EntityLivingBase> entities = bullet.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, bullet.boundingBox.expand(range, range, range));
|
||||
|
||||
|
||||
Vec3 mot = Vec3.createVectorHelper(bullet.motionX, bullet.motionY, bullet.motionZ);
|
||||
|
||||
|
||||
EntityLivingBase target = null;
|
||||
double targetAngle = angle;
|
||||
|
||||
|
||||
for(EntityLivingBase e : entities) {
|
||||
|
||||
|
||||
if(!e.isEntityAlive() || e == bullet.getThrower())
|
||||
continue;
|
||||
|
||||
|
||||
Vec3 delta = Vec3.createVectorHelper(e.posX - bullet.posX, e.posY + e.height / 2 - bullet.posY, e.posZ - bullet.posZ);
|
||||
|
||||
|
||||
if(bullet.worldObj.func_147447_a(Vec3.createVectorHelper(bullet.posX, bullet.posY, bullet.posZ), Vec3.createVectorHelper(e.posX, e.posY + e.height / 2, e.posZ), false, true, false) != null)
|
||||
continue;
|
||||
|
||||
|
||||
double dist = e.getDistanceSqToEntity(bullet);
|
||||
|
||||
|
||||
if(dist < range * range) {
|
||||
|
||||
|
||||
double deltaAngle = BobMathUtil.getCrossAngle(mot, delta);
|
||||
|
||||
|
||||
if(deltaAngle < targetAngle) {
|
||||
target = e;
|
||||
targetAngle = deltaAngle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(target != null) {
|
||||
bullet.getEntityData().setInteger("homingTarget", target.getEntityId());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
|
||||
bulletnt.worldObj.playSoundEffect(bulletnt.posX, bulletnt.posY, bulletnt.posZ, "hbm:entity.ufoBlast", 5.0F, 0.9F + bulletnt.worldObj.rand.nextFloat() * 0.2F);
|
||||
@ -321,11 +321,11 @@ public class GunNPCFactory {
|
||||
data.setFloat("pitch", -30F + 30F * i);
|
||||
data.setFloat("yaw", bulletnt.worldObj.rand.nextFloat() * 180F);
|
||||
data.setFloat("scale", 5F);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bulletnt.posX, bulletnt.posY, bulletnt.posZ),
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, bulletnt.posX, bulletnt.posY, bulletnt.posZ),
|
||||
new TargetPoint(bulletnt.worldObj.provider.dimensionId, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 100));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return bullet;
|
||||
}
|
||||
}
|
||||
|
||||
@ -376,7 +376,19 @@ public class RBMKNeutronHandler {
|
||||
TileEntityRBMKControl rod = (TileEntityRBMKControl) lastNode.tile;
|
||||
if(rod.getMult() > 0.0D) {
|
||||
this.fluxQuantity *= rod.getMult();
|
||||
irradiateFromFlux(new BlockPos(lastNode.tile.xCoord + this.vector.xCoord, lastNode.tile.yCoord, lastNode.tile.zCoord + this.vector.zCoord));
|
||||
BlockPos posAfter = new BlockPos(lastNode.tile.xCoord + this.vector.xCoord, lastNode.tile.yCoord, lastNode.tile.zCoord + this.vector.zCoord);
|
||||
|
||||
// The below code checks if the block after the control rod is actually a block or if it's an RBMK rod.
|
||||
// Resolves GitHub issue #1933.
|
||||
if(NeutronNodeWorld.getNode(worldObj, pos) == null) {
|
||||
TileEntity te = blockPosToTE(worldObj, posAfter);
|
||||
if (te instanceof TileEntityRBMKBase) {
|
||||
RBMKNeutronNode nodeAfter = makeNode(NeutronNodeWorld.getOrAddWorld(worldObj), (TileEntityRBMKBase) te);
|
||||
NeutronNodeWorld.getOrAddWorld(worldObj).addNode(nodeAfter);
|
||||
} else {
|
||||
irradiateFromFlux(posAfter); // I'm so mad about this...
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -388,7 +400,7 @@ public class RBMKNeutronHandler {
|
||||
// holy fucking shit
|
||||
// I have had this one line cause me like tens of problems
|
||||
// I FUCKING HATE THIS
|
||||
// total count of bugs fixed attributed to this function: 13
|
||||
// total count of bugs fixed attributed to this function: 14
|
||||
Block block = origin.tile.getWorldObj().getBlock(pos.getX(), pos.getY() + h, pos.getZ());
|
||||
if(block.isOpaqueCube())
|
||||
hits += 1;
|
||||
|
||||
76
src/main/java/com/hbm/handler/neutron/package-info.java
Normal file
76
src/main/java/com/hbm/handler/neutron/package-info.java
Normal file
@ -0,0 +1,76 @@
|
||||
package com.hbm.handler.neutron;
|
||||
|
||||
/*
|
||||
Hello all, especially Bobcat!!
|
||||
This very well could be my last contribution here, so let's make it quick (I am 24 vicodin deep and in a majorly depressive state).
|
||||
|
||||
Neutron Nodespace:
|
||||
The neutron nodespace is a system inspired by the power net nodespace that allows for caching and
|
||||
calculation of neutron streams from node to node. This is used in both the RBMK and the Chicago Pile,
|
||||
and is planned to be used in future reactors if needed.
|
||||
|
||||
How actually does the Neutron Nodespace work?
|
||||
The neutron system is separated into a few different parts:
|
||||
1. The Neutron Node World
|
||||
Neutron node worlds hold, well, the neutron nodes for a world. Each world has its own list, and the
|
||||
nodes are updated based on their respective adding/removing functions. Only adding nodes is done automatically when a stream
|
||||
passes through an unregistered node, so unregistering nodes must be done manually. This can also be done using a system
|
||||
that automatically clears any unused nodes after a certain amount of time, see checkNode() in RBMKNeutronHandler for an example.
|
||||
|
||||
2. The Neutron Node
|
||||
Neutron nodes are the actual nodes that interact with neutron streams. These hold a few parameters,
|
||||
namely the neutron type (held as a NeutronType enum), the position of the node, the TileEntity
|
||||
the node is encapsulating (optional for blocks), and a special data field. The data field is fully
|
||||
optional and is mostly used in the RBMK space for holding data about the columns themselves to speed
|
||||
up grabbing data. This field can hold any sort of data and is meant to be used similar to an NBT storage.
|
||||
|
||||
3. The Neutron Stream
|
||||
Neutron streams are where the magic happens (figuratively speaking). Neutron streams can be defined
|
||||
as a specific type, allowing them only to interact with one type of neutron node. Neutron streams have
|
||||
a few values, including their origin (in the form of a NeutronNode object), flux quantity, flux ratio, and the
|
||||
stream vector. The flux quantity and ratio (double 0-1) is a special way of handling the slow/fast flux. The flux ratio can be
|
||||
calculated by taking the amount of fast flux over the total amount of flux (flux quantity). The amount of fast flux
|
||||
can be calculated by doing the inverse of this, meaning multiplying the flux quantity by the flux ratio. The slow
|
||||
flux can be found in nearly the same way, simply by multiplying the flux quantity by one minus the flux ratio. The stream
|
||||
vector determines the "direction" of the neutron stream, and can be defined as any rotational vector.
|
||||
The neutron stream class has a few functions that can be used:
|
||||
1. Iterator<BlockPos> getBlocks(int range): This function returns an iterator over all the blocks in a stream's
|
||||
path, determined by a given range and the stream's vector.
|
||||
2. void runStreamInteraction(World worldObj): This abstract function must be defined in any implementation of the
|
||||
neutron stream algorithm. This can be seen in the `RBMKNeutronHandler` and the `PileNeutronHandler`. This function
|
||||
will be run *once* for each and every stream, then they will be removed from the list.
|
||||
*Each neutron stream only lasts for a single tick in an optimal system.*
|
||||
|
||||
Using the Neutron Nodespace:
|
||||
Using the neutron nodespace in a new system is not extremely complex, but also requires a few interlocking steps.
|
||||
New systems should contain a main handler class, normally in the format of nameOfSystemNeutronHandler (see PileNeutronHandler
|
||||
and RBMKNeutronHandler). This is required to contain at least two things:
|
||||
1. Extension of the abstract NeutronStream class.
|
||||
This is required for the system to operate, as it contains the main code for actually handling the interactions for the stream.
|
||||
2. Extension of the abstract NeutronNode class.
|
||||
This is also required, as this holds the constructor for defining the node type. This can also, optionally, contain special
|
||||
functions for interfacing with the data field inside the node structure.
|
||||
|
||||
Additional code for handling the streams as they are processed can be placed inside the NeutronHandler class, right above the loop
|
||||
for processing all the stream interactions. This can be done for optimizing out gamerule checking and the like.
|
||||
|
||||
As mentioned before, the nodes have to be manually destroyed by the TE, normally done within `invalidate()`.
|
||||
There is also an experimental system for automatically clearing nodes from the nodespace when streams have not passed through
|
||||
them every second. This can be seen at the end of the onServerTick() function in the NeutronHandler class. Additional
|
||||
checks for other types can be added here if needed/desired.
|
||||
|
||||
As a final note, this system is potentially way more complicated than it could need to be.
|
||||
For any extra examples, below is a few files that contain some basic neutron nodespace code that can serve as a base for making new
|
||||
systems.
|
||||
|
||||
Stream Creation:
|
||||
2D Generic stream creation: spreadFlux() in tileentity.machine.rbmk.TileEntityRBMKRod
|
||||
2D Non-cardinal direction stream creation: spreadFlux() in tileentity.machine.rbmk.TileEntityRBMKRodReaSim
|
||||
3D non-cardinal direction stream creation: castRay() in tileentity.machine.pile.TileEntityPileBase
|
||||
|
||||
Node Management:
|
||||
Node invalidation: invalidate() in tileentity.machine.rbmk.TileEntityRBMKBase and tileentity.machine.pile.TileEntityPileBase
|
||||
|
||||
See handler.neutron.PileNeutronHandler and handler.neutron.RBMKNeutronHandler for example system handlers.
|
||||
See handler.neutron.NeutronHandler for the overarching class.
|
||||
*/
|
||||
@ -4,7 +4,8 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.PrecompiledPacket;
|
||||
import com.hbm.packet.threading.PrecompiledPacket;
|
||||
import com.hbm.packet.threading.ThreadedPacket;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@ -63,23 +64,37 @@ public class PacketThreading {
|
||||
}
|
||||
}
|
||||
|
||||
// Prepares a packet by making a PreBuf (or invalidating due to incorrect class).
|
||||
private static boolean preparePacket(IMessage message) {
|
||||
// `message` can be precompiled or not.
|
||||
if(message instanceof PrecompiledPacket)
|
||||
((PrecompiledPacket) message).getCompiledBuffer(); // Gets the precompiled buffer, doing nothing if it already exists.
|
||||
totalCnt++;
|
||||
|
||||
if(!(message instanceof ThreadedPacket)) {
|
||||
MainRegistry.logger.error("Invalid packet class, expected ThreadedPacket, got {}.", message.getClass().getSimpleName());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a packet to the thread pool to be processed in the future. This is only compatible with the `sendToAllAround` dispatch operation.
|
||||
* @param message Message to process.
|
||||
* @param target TargetPoint to send to.
|
||||
*/
|
||||
public static void createAllAroundThreadedPacket(IMessage message, TargetPoint target) {
|
||||
// `message` can be precompiled or not.
|
||||
if(message instanceof PrecompiledPacket)
|
||||
((PrecompiledPacket) message).getPreBuf(); // Gets the precompiled buffer, doing nothing if it already exists.
|
||||
totalCnt++;
|
||||
|
||||
if(preparePacket(message))
|
||||
return;
|
||||
|
||||
ThreadedPacket packet = (ThreadedPacket) message;
|
||||
|
||||
Runnable task = () -> {
|
||||
try {
|
||||
lock.lock();
|
||||
PacketDispatcher.wrapper.sendToAllAround(message, target);
|
||||
if (message instanceof PrecompiledPacket)
|
||||
((PrecompiledPacket) message).getPreBuf().release();
|
||||
packet.getCompiledBuffer().release();
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
@ -95,16 +110,17 @@ public class PacketThreading {
|
||||
* @param player PlayerMP to send to.
|
||||
*/
|
||||
public static void createSendToThreadedPacket(IMessage message, EntityPlayerMP player) {
|
||||
if(message instanceof PrecompiledPacket)
|
||||
((PrecompiledPacket) message).getPreBuf();
|
||||
totalCnt++;
|
||||
|
||||
if(preparePacket(message))
|
||||
return;
|
||||
|
||||
ThreadedPacket packet = (ThreadedPacket) message;
|
||||
|
||||
Runnable task = () -> {
|
||||
try {
|
||||
lock.lock();
|
||||
PacketDispatcher.wrapper.sendTo(message, player);
|
||||
if (message instanceof PrecompiledPacket)
|
||||
((PrecompiledPacket) message).getPreBuf().release();
|
||||
packet.getCompiledBuffer().release();
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.inventory.container;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerCrateBase extends ContainerBase {
|
||||
|
||||
@ -14,6 +15,14 @@ public class ContainerCrateBase extends ContainerBase {
|
||||
tile.openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int index, int button, int mode, EntityPlayer player) {
|
||||
// prevents the player from moving around the currently open box
|
||||
if(mode == 2 && button == player.inventory.currentItem) return null;
|
||||
if(index == player.inventory.currentItem + 27 + this.tile.getSizeInventory()) return null;
|
||||
return super.slotClick(index, button, mode, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer p_75134_1_) {
|
||||
super.onContainerClosed(p_75134_1_);
|
||||
|
||||
@ -1,14 +1,13 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.tileentity.machine.storage.TileEntityCrateIron;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
@invtweaks.api.container.ChestContainer(rowSize = 9, isLargeChest = false)
|
||||
public class ContainerCrateIron extends ContainerCrateBase {
|
||||
|
||||
public ContainerCrateIron(InventoryPlayer invPlayer, TileEntityCrateIron tedf) {
|
||||
|
||||
public ContainerCrateIron(InventoryPlayer invPlayer, IInventory tedf) {
|
||||
super(invPlayer,tedf);
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
|
||||
@ -1,14 +1,13 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.tileentity.machine.storage.TileEntityCrateTemplate;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
@invtweaks.api.container.ChestContainer(rowSize = 9, isLargeChest = false)
|
||||
public class ContainerCrateTemplate extends ContainerCrateBase {
|
||||
|
||||
public ContainerCrateTemplate(InventoryPlayer invPlayer, TileEntityCrateTemplate tedf) {
|
||||
|
||||
public ContainerCrateTemplate(InventoryPlayer invPlayer, IInventory tedf) {
|
||||
super(invPlayer,tedf);
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
@ -19,4 +18,4 @@ public class ContainerCrateTemplate extends ContainerCrateBase {
|
||||
|
||||
this.playerInv(invPlayer, 8, 86, 144);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,14 +1,13 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.tileentity.machine.storage.TileEntityCrateTungsten;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
@invtweaks.api.container.ChestContainer(rowSize = 9, isLargeChest = false)
|
||||
public class ContainerCrateTungsten extends ContainerCrateBase {
|
||||
|
||||
public ContainerCrateTungsten(InventoryPlayer invPlayer, TileEntityCrateTungsten te) {
|
||||
public ContainerCrateTungsten(InventoryPlayer invPlayer, IInventory te) {
|
||||
super(invPlayer,te);
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
|
||||
@ -1,19 +1,18 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.tileentity.machine.storage.TileEntitySafe;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
//@invtweaks.api.container.ChestContainer(rowSize = 5)
|
||||
public class ContainerSafe extends Container {
|
||||
|
||||
private TileEntitySafe diFurnace;
|
||||
private IInventory diFurnace;
|
||||
|
||||
public ContainerSafe(InventoryPlayer invPlayer, TileEntitySafe tedf) {
|
||||
public ContainerSafe(InventoryPlayer invPlayer, IInventory tedf) {
|
||||
diFurnace = tedf;
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerCrateIron;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.storage.TileEntityCrateIron;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
@ -13,22 +13,22 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUICrateIron extends GuiContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_crate_iron.png");
|
||||
private TileEntityCrateIron diFurnace;
|
||||
|
||||
public GUICrateIron(InventoryPlayer invPlayer, TileEntityCrateIron tedf) {
|
||||
super(new ContainerCrateIron(invPlayer, tedf));
|
||||
diFurnace = tedf;
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_crate_iron.png");
|
||||
private IInventory diFurnace;
|
||||
|
||||
public GUICrateIron(InventoryPlayer invPlayer, IInventory inv) {
|
||||
super(new ContainerCrateIron(invPlayer, inv));
|
||||
diFurnace = inv;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 186;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
|
||||
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerCrateTemplate;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.storage.TileEntityCrateTemplate;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
@ -13,22 +13,22 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUICrateTemplate extends GuiContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_crate_template.png");
|
||||
private TileEntityCrateTemplate diFurnace;
|
||||
|
||||
public GUICrateTemplate(InventoryPlayer invPlayer, TileEntityCrateTemplate tedf) {
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_crate_template.png");
|
||||
private IInventory diFurnace;
|
||||
|
||||
public GUICrateTemplate(InventoryPlayer invPlayer, IInventory tedf) {
|
||||
super(new ContainerCrateTemplate(invPlayer, tedf));
|
||||
diFurnace = tedf;
|
||||
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 168;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
|
||||
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
@ -39,4 +39,4 @@ public class GUICrateTemplate extends GuiContainer {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import com.hbm.tileentity.machine.storage.TileEntityCrateTungsten;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerCrateTungsten;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.storage.TileEntityCrateTungsten;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
@ -16,33 +17,41 @@ public class GUICrateTungsten extends GuiContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_crate_tungsten.png");
|
||||
private static ResourceLocation texture_hot = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_crate_tungsten_hot.png");
|
||||
private TileEntityCrateTungsten diFurnace;
|
||||
|
||||
public GUICrateTungsten(InventoryPlayer invPlayer, TileEntityCrateTungsten tedf) {
|
||||
private IInventory diFurnace;
|
||||
|
||||
public GUICrateTungsten(InventoryPlayer invPlayer, IInventory tedf) {
|
||||
super(new ContainerCrateTungsten(invPlayer, tedf));
|
||||
setupGUI(tedf);
|
||||
}
|
||||
|
||||
private void setupGUI(IInventory tedf) {
|
||||
diFurnace = tedf;
|
||||
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 168;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
|
||||
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 0xffffff);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 0xffffff);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
if(diFurnace.getWorldObj().getBlockMetadata(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord) == 0)
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
else
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture_hot);
|
||||
|
||||
|
||||
if (diFurnace instanceof TileEntityCrateTungsten) {
|
||||
TileEntityCrateTungsten crate = (TileEntityCrateTungsten) diFurnace;
|
||||
if(crate.getWorldObj().getBlockMetadata(crate.xCoord, crate.yCoord, crate.zCoord) == 0)
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
else
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture_hot);
|
||||
} else
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture); // Assuming it's in the inventory, we don't need to worry about it somehow being heated :ayo:
|
||||
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerSafe;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.storage.TileEntitySafe;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
@ -15,24 +15,24 @@ import net.minecraft.util.ResourceLocation;
|
||||
public class GUISafe extends GuiContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_safe.png");
|
||||
private TileEntitySafe diFurnace;
|
||||
|
||||
public GUISafe(InventoryPlayer invPlayer, TileEntitySafe tedf) {
|
||||
private IInventory diFurnace;
|
||||
|
||||
public GUISafe(InventoryPlayer invPlayer, IInventory tedf) {
|
||||
super(new ContainerSafe(invPlayer, tedf));
|
||||
diFurnace = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 168;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
|
||||
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.items.armor;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.extprop.HbmPlayerProps;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.render.model.ModelArmorBJ;
|
||||
@ -33,51 +34,51 @@ public class ArmorBJJetpack extends ArmorBJ {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
|
||||
|
||||
|
||||
if(model == null) {
|
||||
model = new ModelArmorBJ(5);
|
||||
}
|
||||
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
|
||||
|
||||
|
||||
super.onArmorTick(world, player, stack);
|
||||
|
||||
|
||||
HbmPlayerProps props = HbmPlayerProps.getData(player);
|
||||
|
||||
|
||||
if(!world.isRemote) {
|
||||
|
||||
|
||||
if(this.hasFSBArmor(player) && props.isJetpackActive()) {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "jetpack_bj");
|
||||
data.setInteger("player", player.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, player.posX, player.posY, player.posZ), new TargetPoint(world.provider.dimensionId, player.posX, player.posY, player.posZ, 100));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, player.posX, player.posY, player.posZ), new TargetPoint(world.provider.dimensionId, player.posX, player.posY, player.posZ, 100));
|
||||
}
|
||||
}
|
||||
|
||||
if(this.hasFSBArmor(player)) {
|
||||
|
||||
|
||||
ArmorUtil.resetFlightTime(player);
|
||||
|
||||
|
||||
if(props.isJetpackActive()) {
|
||||
|
||||
|
||||
if(player.motionY < 0.4D)
|
||||
player.motionY += 0.1D;
|
||||
|
||||
|
||||
player.fallDistance = 0;
|
||||
|
||||
|
||||
world.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:weapon.immolatorShoot", 0.125F, 1.5F);
|
||||
|
||||
|
||||
} else if(player.isSneaking()) {
|
||||
|
||||
|
||||
if(player.motionY < -0.08) {
|
||||
|
||||
|
||||
double mo = player.motionY * -0.4;
|
||||
player.motionY += mo;
|
||||
|
||||
|
||||
Vec3 vec = player.getLookVec();
|
||||
vec.xCoord *= mo;
|
||||
vec.yCoord *= mo;
|
||||
|
||||
@ -5,8 +5,8 @@ import java.util.UUID;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.hbm.extprop.HbmPlayerProps;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.render.model.ModelArmorDNT;
|
||||
import com.hbm.util.ArmorUtil;
|
||||
@ -53,42 +53,42 @@ public class ArmorDNT extends ArmorFSBPowered {
|
||||
|
||||
return models[armorSlot];
|
||||
}
|
||||
|
||||
|
||||
private static final UUID speed = UUID.fromString("6ab858ba-d712-485c-bae9-e5e765fc555a");
|
||||
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
|
||||
|
||||
super.onArmorTick(world, player, stack);
|
||||
|
||||
|
||||
if(this != ModItems.dns_plate)
|
||||
return;
|
||||
|
||||
HbmPlayerProps props = HbmPlayerProps.getData(player);
|
||||
|
||||
|
||||
/// SPEED ///
|
||||
Multimap multimap = super.getAttributeModifiers(stack);
|
||||
multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(speed, "DNT SPEED", 0.25, 0));
|
||||
player.getAttributeMap().removeAttributeModifiers(multimap);
|
||||
|
||||
|
||||
if(player.isSprinting()) {
|
||||
player.getAttributeMap().applyAttributeModifiers(multimap);
|
||||
}
|
||||
|
||||
if(!world.isRemote) {
|
||||
|
||||
|
||||
/// JET ///
|
||||
if(this.hasFSBArmor(player) && (props.isJetpackActive() || (!player.onGround && !player.isSneaking() && props.enableBackpack))) {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "jetpack_dns");
|
||||
data.setInteger("player", player.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, player.posX, player.posY, player.posZ), new TargetPoint(world.provider.dimensionId, player.posX, player.posY, player.posZ, 100));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, player.posX, player.posY, player.posZ), new TargetPoint(world.provider.dimensionId, player.posX, player.posY, player.posZ, 100));
|
||||
}
|
||||
}
|
||||
|
||||
if(this.hasFSBArmor(player)) {
|
||||
|
||||
|
||||
ArmorUtil.resetFlightTime(player);
|
||||
|
||||
if(props.isJetpackActive()) {
|
||||
@ -102,7 +102,7 @@ public class ArmorDNT extends ArmorFSBPowered {
|
||||
|
||||
} else if(!player.isSneaking() && !player.onGround && props.enableBackpack) {
|
||||
player.fallDistance = 0;
|
||||
|
||||
|
||||
if(player.motionY < -1)
|
||||
player.motionY += 0.4D;
|
||||
else if(player.motionY < -0.1)
|
||||
@ -112,7 +112,7 @@ public class ArmorDNT extends ArmorFSBPowered {
|
||||
|
||||
player.motionX *= 1.05D;
|
||||
player.motionZ *= 1.05D;
|
||||
|
||||
|
||||
if(player.moveForward != 0) {
|
||||
player.motionX += player.getLookVec().xCoord * 0.25 * player.moveForward;
|
||||
player.motionZ += player.getLookVec().zCoord * 0.25 * player.moveForward;
|
||||
@ -120,13 +120,13 @@ public class ArmorDNT extends ArmorFSBPowered {
|
||||
|
||||
world.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:weapon.immolatorShoot", 0.125F, 1.5F);
|
||||
}
|
||||
|
||||
|
||||
if(player.isSneaking() && !player.onGround) {
|
||||
player.motionY -= 0.1D;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handleAttack(LivingAttackEvent event) {
|
||||
|
||||
@ -136,14 +136,14 @@ public class ArmorDNT extends ArmorFSBPowered {
|
||||
EntityPlayer player = (EntityPlayer) e;
|
||||
|
||||
if(ArmorFSB.hasFSBArmor(player)) {
|
||||
|
||||
|
||||
if(event.source.isExplosion()) {
|
||||
return;
|
||||
}
|
||||
|
||||
//e.worldObj.playSoundAtEntity(e, "random.break", 5F, 1.0F + e.getRNG().nextFloat() * 0.5F);
|
||||
HbmPlayerProps.plink(player, "random.break", 0.5F, 1.0F + e.getRNG().nextFloat() * 0.5F);
|
||||
|
||||
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
@ -158,12 +158,12 @@ public class ArmorDNT extends ArmorFSBPowered {
|
||||
EntityPlayer player = (EntityPlayer) e;
|
||||
|
||||
if(ArmorFSB.hasFSBArmor(player)) {
|
||||
|
||||
|
||||
if(event.source.isExplosion()) {
|
||||
event.ammount *= 0.001F;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
event.ammount = 0;
|
||||
}
|
||||
}
|
||||
@ -183,7 +183,7 @@ public class ArmorDNT extends ArmorFSBPowered {
|
||||
list.add(EnumChatFormatting.AQUA + " " + I18n.format(Potion.potionTypes[effect.getPotionID()].getName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
list.add(EnumChatFormatting.RED + " " + I18nUtil.resolveKey("armor.vats"));
|
||||
list.add(EnumChatFormatting.RED + " " + I18nUtil.resolveKey("armor.thermal"));
|
||||
list.add(EnumChatFormatting.RED + " " + I18nUtil.resolveKey("armor.hardLanding"));
|
||||
|
||||
@ -3,10 +3,10 @@ package com.hbm.items.armor;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.hbm.handler.ArmorModHandler;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.render.model.ModelArmorDiesel;
|
||||
|
||||
@ -27,7 +27,7 @@ public class ArmorDiesel extends ArmorFSBFueled {
|
||||
public ArmorDiesel(ArmorMaterial material, int slot, String texture, FluidType fuelType, int maxFuel, int fillRate, int consumption, int drain) {
|
||||
super(material, slot, texture, fuelType, maxFuel, fillRate, consumption, drain);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Multimap getItemAttributeModifiers() {
|
||||
|
||||
@ -42,26 +42,26 @@ public class ArmorDiesel extends ArmorFSBFueled {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
|
||||
|
||||
|
||||
if(models == null) {
|
||||
models = new ModelArmorDiesel[4];
|
||||
|
||||
|
||||
for(int i = 0; i < 4; i++)
|
||||
models[i] = new ModelArmorDiesel(i);
|
||||
}
|
||||
|
||||
|
||||
return models[armorSlot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
|
||||
super.onArmorTick(world, player, stack);
|
||||
|
||||
|
||||
if(!world.isRemote && this == ModItems.dieselsuit_legs && this.hasFSBArmor(player) && world.getTotalWorldTime() % 3 == 0) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "bnuuy");
|
||||
data.setInteger("player", player.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, player.posX, player.posY, player.posZ), new TargetPoint(world.provider.dimensionId, player.posX, player.posY, player.posZ, 100));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, player.posX, player.posY, player.posZ), new TargetPoint(world.provider.dimensionId, player.posX, player.posY, player.posZ, 100));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,8 +4,8 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.hbm.handler.ArmorModHandler;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -20,7 +20,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class ItemModKnife extends ItemArmorMod {
|
||||
|
||||
|
||||
public static final UUID trigamma_UUID = UUID.fromString("86d44ca9-44f1-4ca6-bdbb-d9d33bead251");
|
||||
|
||||
public ItemModKnife() {
|
||||
@ -29,11 +29,11 @@ public class ItemModKnife extends ItemArmorMod {
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
|
||||
|
||||
|
||||
list.add(EnumChatFormatting.RED + "Pain.");
|
||||
list.add("");
|
||||
list.add(EnumChatFormatting.RED + "Hurts, doesn't it?");
|
||||
|
||||
|
||||
list.add("");
|
||||
super.addInformation(stack, player, list, bool);
|
||||
}
|
||||
@ -42,45 +42,45 @@ public class ItemModKnife extends ItemArmorMod {
|
||||
public void addDesc(List list, ItemStack stack, ItemStack armor) {
|
||||
list.add(EnumChatFormatting.RED + " " + stack.getDisplayName());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void modUpdate(EntityLivingBase entity, ItemStack armor) {
|
||||
|
||||
|
||||
if(!entity.worldObj.isRemote) {
|
||||
|
||||
|
||||
if(entity.ticksExisted % 50 == 0 && entity.getMaxHealth() > 2F) {
|
||||
|
||||
entity.worldObj.playSoundAtEntity(entity, "hbm:entity.slicer", 1.0F, 1.0F);
|
||||
|
||||
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setString("type", "bloodvomit");
|
||||
nbt.setInteger("entity", entity.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
|
||||
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
|
||||
|
||||
IAttributeInstance attributeinstance = entity.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth);
|
||||
|
||||
|
||||
float health = entity.getMaxHealth();
|
||||
|
||||
|
||||
try {
|
||||
attributeinstance.removeModifier(attributeinstance.getModifier(trigamma_UUID));
|
||||
} catch(Exception ex) { }
|
||||
|
||||
|
||||
attributeinstance.applyModifier(new AttributeModifier(trigamma_UUID, "digamma", -(entity.getMaxHealth() - health + 2), 0));
|
||||
|
||||
|
||||
if(entity instanceof EntityPlayerMP) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "properJolt");
|
||||
|
||||
|
||||
if(entity.getMaxHealth() > 2F) {
|
||||
data.setInteger("time", 10000 + entity.getRNG().nextInt(10000));
|
||||
data.setInteger("maxTime", 10000);
|
||||
} else {
|
||||
data.setInteger("time", 0);
|
||||
data.setInteger("maxTime", 0);
|
||||
|
||||
|
||||
((EntityPlayer)entity).triggerAchievement(MainRegistry.achSomeWounds);
|
||||
}
|
||||
PacketDispatcher.wrapper.sendTo(new AuxParticlePacketNT(data, 0, 0, 0), (EntityPlayerMP)entity);
|
||||
PacketThreading.createSendToThreadedPacket(new AuxParticlePacketNT(data, 0, 0, 0), (EntityPlayerMP)entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,8 +4,8 @@ import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.ArmorModHandler;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.ISatChip;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.saveddata.SatelliteSavedData;
|
||||
import com.hbm.saveddata.satellites.Satellite;
|
||||
@ -27,12 +27,12 @@ public class ItemModLens extends ItemArmorMod implements ISatChip {
|
||||
public ItemModLens() {
|
||||
super(ArmorModHandler.extra, true, false, false, false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
|
||||
list.add(EnumChatFormatting.AQUA + "Satellite Frequency: " + this.getFreq(itemstack));
|
||||
list.add("");
|
||||
|
||||
|
||||
super.addInformation(itemstack, player, list, bool);
|
||||
}
|
||||
|
||||
@ -46,12 +46,12 @@ public class ItemModLens extends ItemArmorMod implements ISatChip {
|
||||
World world = entity.worldObj;
|
||||
if(world.isRemote) return;
|
||||
if(!(entity instanceof EntityPlayerMP)) return;
|
||||
|
||||
|
||||
EntityPlayerMP player = (EntityPlayerMP) entity;
|
||||
ItemStack lens = ArmorModHandler.pryMods(armor)[ArmorModHandler.extra];
|
||||
|
||||
|
||||
if(lens == null) return;
|
||||
|
||||
|
||||
int freq = this.getFreq(lens);
|
||||
Satellite sat = SatelliteSavedData.getData(world).getSatFromFreq(freq);
|
||||
if(!(sat instanceof SatelliteScanner)) return;
|
||||
@ -60,22 +60,22 @@ public class ItemModLens extends ItemArmorMod implements ISatChip {
|
||||
int y = (int) Math.floor(player.posY);
|
||||
int z = (int) Math.floor(player.posZ);
|
||||
int range = 3;
|
||||
|
||||
|
||||
int cX = x >> 4;
|
||||
int cZ = z >> 4;
|
||||
|
||||
|
||||
int height = Math.max(Math.min(y + 10, 255), 64);
|
||||
int seg = (int) (world.getTotalWorldTime() % height);
|
||||
|
||||
|
||||
int hits = 0;
|
||||
|
||||
|
||||
for(int chunkX = cX - range; chunkX <= cX + range; chunkX++) {
|
||||
for(int chunkZ = cZ - range; chunkZ <= cZ + range; chunkZ++) {
|
||||
Chunk c = world.getChunkFromChunkCoords(chunkX, chunkZ);
|
||||
|
||||
|
||||
for(int ix = 0; ix < 16; ix++) {
|
||||
for(int iz = 0; iz < 16; iz++) {
|
||||
|
||||
|
||||
Block b = c.getBlock(ix, seg, iz);
|
||||
int aX = (chunkX << 4) + ix;
|
||||
int aZ = (chunkZ << 4) + iz;
|
||||
@ -94,14 +94,14 @@ public class ItemModLens extends ItemArmorMod implements ISatChip {
|
||||
if(addIf(ModBlocks.crate_ammo, b, 1, aX, seg, aZ, null, 0x800000, player)) hits++;
|
||||
if(addIf(ModBlocks.crate_can, b, 1, aX, seg, aZ, null, 0x800000, player)) hits++;
|
||||
if(addIf(ModBlocks.ore_bedrock, b, 1, aX, seg, aZ, "Bedrock Ore", 0xff0000, player)) hits++;
|
||||
|
||||
|
||||
if(hits > 100) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean addIf(Block target, Block b, int chance, int x, int y, int z, String label, int color, EntityPlayerMP player) {
|
||||
|
||||
if(target == b && player.getRNG().nextInt(chance) == 0) {
|
||||
@ -111,10 +111,10 @@ public class ItemModLens extends ItemArmorMod implements ISatChip {
|
||||
data.setInteger("expires", 15_000);
|
||||
data.setDouble("dist", 300D);
|
||||
if(label != null) data.setString("label", label);
|
||||
PacketDispatcher.wrapper.sendTo(new AuxParticlePacketNT(data, x, y, z), player);
|
||||
PacketThreading.createSendToThreadedPacket(new AuxParticlePacketNT(data, x, y, z), player);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,8 +3,9 @@ package com.hbm.items.armor;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.extprop.HbmPlayerProps;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -40,7 +41,7 @@ public class JetpackBooster extends JetpackFueledBase {
|
||||
data.setString("type", "jetpack");
|
||||
data.setInteger("player", player.getEntityId());
|
||||
data.setInteger("mode", 1);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, player.posX, player.posY, player.posZ), new TargetPoint(world.provider.dimensionId, player.posX, player.posY, player.posZ, 100));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, player.posX, player.posY, player.posZ), new TargetPoint(world.provider.dimensionId, player.posX, player.posY, player.posZ, 100));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,8 +3,8 @@ package com.hbm.items.armor;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.extprop.HbmPlayerProps;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -30,34 +30,34 @@ public class JetpackBreak extends JetpackFueledBase {
|
||||
}
|
||||
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
|
||||
|
||||
|
||||
HbmPlayerProps props = HbmPlayerProps.getData(player);
|
||||
|
||||
|
||||
if(!world.isRemote) {
|
||||
|
||||
|
||||
if(getFuel(stack) > 0 && (props.isJetpackActive() || (!player.onGround && !player.isSneaking() && props.enableBackpack))) {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "jetpack");
|
||||
data.setInteger("player", player.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, player.posX, player.posY, player.posZ), new TargetPoint(world.provider.dimensionId, player.posX, player.posY, player.posZ, 100));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, player.posX, player.posY, player.posZ), new TargetPoint(world.provider.dimensionId, player.posX, player.posY, player.posZ, 100));
|
||||
}
|
||||
}
|
||||
|
||||
if(getFuel(stack) > 0) {
|
||||
|
||||
|
||||
if(props.isJetpackActive()) {
|
||||
player.fallDistance = 0;
|
||||
|
||||
|
||||
if(player.motionY < 0.4D)
|
||||
player.motionY += 0.1D;
|
||||
|
||||
|
||||
world.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:weapon.flamethrowerShoot", 0.25F, 1.5F);
|
||||
this.useUpFuel(player, stack, 5);
|
||||
|
||||
|
||||
} else if(!player.isSneaking() && !player.onGround && props.enableBackpack) {
|
||||
player.fallDistance = 0;
|
||||
|
||||
|
||||
if(player.motionY < -1)
|
||||
player.motionY += 0.2D;
|
||||
else if(player.motionY < -0.1)
|
||||
@ -67,20 +67,20 @@ public class JetpackBreak extends JetpackFueledBase {
|
||||
|
||||
player.motionX *= 1.025D;
|
||||
player.motionZ *= 1.025D;
|
||||
|
||||
|
||||
world.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:weapon.flamethrowerShoot", 0.25F, 1.5F);
|
||||
this.useUpFuel(player, stack, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
|
||||
list.add("Regular jetpack that will automatically hover mid-air.");
|
||||
list.add("Sneaking will stop hover mode.");
|
||||
list.add("Hover mode will consume less fuel and increase air-mobility.");
|
||||
|
||||
|
||||
super.addInformation(stack, player, list, ext);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,8 +3,8 @@ package com.hbm.items.armor;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.extprop.HbmPlayerProps;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -38,7 +38,7 @@ public class JetpackRegular extends JetpackFueledBase {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "jetpack");
|
||||
data.setInteger("player", player.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, player.posX, player.posY, player.posZ), new TargetPoint(world.provider.dimensionId, player.posX, player.posY, player.posZ, 100));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, player.posX, player.posY, player.posZ), new TargetPoint(world.provider.dimensionId, player.posX, player.posY, player.posZ, 100));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,8 +3,8 @@ package com.hbm.items.armor;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.extprop.HbmPlayerProps;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -40,7 +40,7 @@ public class JetpackVectorized extends JetpackFueledBase {
|
||||
data.setString("type", "jetpack");
|
||||
data.setInteger("player", player.getEntityId());
|
||||
data.setInteger("mode", 1);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, player.posX, player.posY, player.posZ), new TargetPoint(world.provider.dimensionId, player.posX, player.posY, player.posZ, 100));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, player.posX, player.posY, player.posZ), new TargetPoint(world.provider.dimensionId, player.posX, player.posY, player.posZ, 100));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
290
src/main/java/com/hbm/items/block/ItemBlockStorageCrate.java
Normal file
290
src/main/java/com/hbm/items/block/ItemBlockStorageCrate.java
Normal file
@ -0,0 +1,290 @@
|
||||
package com.hbm.items.block;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.container.*;
|
||||
import com.hbm.inventory.gui.*;
|
||||
import com.hbm.items.tool.ItemKey;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.machine.storage.*;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
|
||||
public class ItemBlockStorageCrate extends ItemBlockBase implements IGUIProvider {
|
||||
|
||||
public ItemBlockStorageCrate(Block block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
Block block = Block.getBlockFromItem(player.getHeldItem().getItem());
|
||||
if(block == ModBlocks.mass_storage) return stack; // Genuinely can't figure out how to make this part work, so I'm just not gonna mess with it.
|
||||
|
||||
if(!world.isRemote && stack.stackSize == 1) {
|
||||
if (stack.stackTagCompound != null && stack.stackTagCompound.hasKey("lock")) {
|
||||
for (ItemStack item : player.inventory.mainInventory) {
|
||||
if(item == null) // Skip if no item.
|
||||
continue;
|
||||
if(!(item.getItem() instanceof ItemKey)) // Skip if item isn't a key.
|
||||
continue;
|
||||
if(item.stackTagCompound == null) // Skip if there is no NBT (wouldn't open it anyway).
|
||||
continue;
|
||||
if (item.stackTagCompound.getInteger("pins") == stack.stackTagCompound.getInteger("lock")) { // Check if pins are equal (if it can open it)
|
||||
TileEntityCrateBase.spawnSpiders(player, world, stack);
|
||||
player.openGui(MainRegistry.instance, 0, world, 0, 0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return stack; // Return early if it was locked.
|
||||
}
|
||||
TileEntityCrateBase.spawnSpiders(player, world, stack);
|
||||
player.openGui(MainRegistry.instance, 0, world, 0, 0, 0); // If there is no lock then don't bother checking.
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
Block block = Block.getBlockFromItem(player.getHeldItem().getItem());
|
||||
if(block == ModBlocks.crate_iron) return new ContainerCrateIron(player.inventory, new InventoryCrate(player, player.getHeldItem()));
|
||||
if(block == ModBlocks.crate_steel) return new ContainerCrateSteel(player.inventory, new InventoryCrate(player, player.getHeldItem()));
|
||||
if(block == ModBlocks.crate_desh) return new ContainerCrateDesh(player.inventory, new InventoryCrate(player, player.getHeldItem()));
|
||||
if(block == ModBlocks.crate_tungsten) return new ContainerCrateTungsten(player.inventory, new InventoryCrate(player, player.getHeldItem()));
|
||||
if(block == ModBlocks.crate_template) return new ContainerCrateTemplate(player.inventory, new InventoryCrate(player, player.getHeldItem()));
|
||||
if(block == ModBlocks.safe) return new ContainerSafe(player.inventory, new InventoryCrate(player, player.getHeldItem()));
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
Block block = Block.getBlockFromItem(player.getHeldItem().getItem());
|
||||
if(block == ModBlocks.crate_iron) return new GUICrateIron(player.inventory, new InventoryCrate(player, player.getHeldItem()));
|
||||
if(block == ModBlocks.crate_steel) return new GUICrateSteel(player.inventory, new InventoryCrate(player, player.getHeldItem()));
|
||||
if(block == ModBlocks.crate_desh) return new GUICrateDesh(player.inventory, new InventoryCrate(player, player.getHeldItem()));
|
||||
if(block == ModBlocks.crate_tungsten) return new GUICrateTungsten(player.inventory, new InventoryCrate(player, player.getHeldItem()));
|
||||
if(block == ModBlocks.crate_template) return new GUICrateTemplate(player.inventory, new InventoryCrate(player, player.getHeldItem()));
|
||||
if(block == ModBlocks.safe) return new GUISafe(player.inventory, new InventoryCrate(player, player.getHeldItem()));
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
public static class InventoryCrate implements IInventory {
|
||||
|
||||
public final EntityPlayer player;
|
||||
public final ItemStack crate;
|
||||
public ItemStack[] slots;
|
||||
|
||||
private boolean toMarkDirty = false;
|
||||
|
||||
public InventoryCrate(EntityPlayer player, ItemStack crate) {
|
||||
|
||||
this.player = player;
|
||||
this.crate = crate;
|
||||
|
||||
slots = new ItemStack[this.getSizeInventory()];
|
||||
if(crate.stackTagCompound == null)
|
||||
crate.stackTagCompound = new NBTTagCompound();
|
||||
else if(!player.worldObj.isRemote) {
|
||||
for (int i = 0; i < this.getSizeInventory(); i++)
|
||||
this.setInventorySlotContents(i, ItemStack.loadItemStackFromNBT(crate.stackTagCompound.getCompoundTag("slot" + i)));
|
||||
}
|
||||
toMarkDirty = true;
|
||||
this.markDirty();
|
||||
toMarkDirty = false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static TileEntityCrateBase findCrateType(Item crate) {
|
||||
Block block = Block.getBlockFromItem(crate);
|
||||
if(block == ModBlocks.crate_iron) return new TileEntityCrateIron();
|
||||
if(block == ModBlocks.crate_steel) return new TileEntityCrateSteel();
|
||||
if(block == ModBlocks.crate_desh) return new TileEntityCrateDesh();
|
||||
if(block == ModBlocks.crate_tungsten) return new TileEntityCrateTungsten();
|
||||
if(block == ModBlocks.crate_template) return new TileEntityCrateTemplate();
|
||||
if(block == ModBlocks.safe) return new TileEntitySafe();
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return findCrateType(crate.getItem()).getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return findCrateType(crate.getItem()).getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return slots[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
ItemStack stack = getStackInSlot(slot);
|
||||
if (stack != null) {
|
||||
if (stack.stackSize > amount) {
|
||||
stack = stack.splitStack(amount);
|
||||
} else {
|
||||
setInventorySlotContents(slot, null);
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
ItemStack stack = getStackInSlot(slot);
|
||||
setInventorySlotContents(slot, null);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
if(stack != null) {
|
||||
stack.stackSize = Math.min(stack.stackSize, this.getInventoryStackLimit());
|
||||
}
|
||||
|
||||
slots[slot] = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return crate.hasDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() { // I HATE THIS SO MUCH
|
||||
|
||||
if(player.worldObj.isRemote) { // go the fuck away
|
||||
return;
|
||||
}
|
||||
|
||||
if(!toMarkDirty) { // ok fuck you too
|
||||
return;
|
||||
}
|
||||
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
|
||||
int invSize = this.getSizeInventory();
|
||||
|
||||
for(int i = 0; i < invSize; i++) {
|
||||
|
||||
ItemStack stack = this.getStackInSlot(i);
|
||||
if(stack == null)
|
||||
continue;
|
||||
|
||||
NBTTagCompound slot = new NBTTagCompound();
|
||||
stack.writeToNBT(slot);
|
||||
nbt.setTag("slot" + i, slot);
|
||||
}
|
||||
|
||||
if(crate.stackTagCompound != null) { // yes it's a bit jank, but it wants to clear otherwise so...
|
||||
if(crate.stackTagCompound.hasKey("lock"))
|
||||
nbt.setInteger("lock", crate.stackTagCompound.getInteger("lock"));
|
||||
if(crate.stackTagCompound.hasKey("lockMod"))
|
||||
nbt.setDouble("lockMod", crate.stackTagCompound.getDouble("lockMod"));
|
||||
if(crate.stackTagCompound.hasKey("spiders"))
|
||||
nbt.setBoolean("spiders", crate.stackTagCompound.getBoolean("spiders")); // fuck you!!
|
||||
}
|
||||
|
||||
if(!nbt.hasNoTags()) {
|
||||
|
||||
Random random = new Random();
|
||||
|
||||
try {
|
||||
byte[] abyte = CompressedStreamTools.compress(nbt);
|
||||
|
||||
if(abyte.length > 6000) {
|
||||
player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "Warning: Container NBT exceeds 6kB, contents will be ejected!"));
|
||||
for(int i1 = 0; i1 < invSize; ++i1) {
|
||||
ItemStack itemstack = this.getStackInSlot(i1);
|
||||
|
||||
if(itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = random.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while(itemstack.stackSize > 0) {
|
||||
int j1 = random.nextInt(21) + 10;
|
||||
|
||||
if(j1 > itemstack.stackSize) {
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(player.worldObj, player.posX + f, player.posY + f1, player.posZ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if(itemstack.hasTagCompound()) {
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3 + player.motionX;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F + player.motionY;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3 + player.motionZ;
|
||||
player.worldObj.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
crate.setTagCompound(null); // Wipe tag compound to clear crate.
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, crate);
|
||||
return;
|
||||
}
|
||||
} catch(IOException ignored) { }
|
||||
}
|
||||
|
||||
crate.setTagCompound(nbt);
|
||||
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, crate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:block.crateOpen", 1.0F, 0.8F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
toMarkDirty = true;
|
||||
markDirty();
|
||||
toMarkDirty = false;
|
||||
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:block.crateClose", 1.0F, 0.8F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,10 +2,9 @@ package com.hbm.items.food;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
@ -20,55 +19,55 @@ public class ItemLemon extends ItemFood {
|
||||
|
||||
public ItemLemon(int p_i45339_1_, float p_i45339_2_, boolean p_i45339_3_) {
|
||||
super(p_i45339_1_, p_i45339_2_, p_i45339_3_);
|
||||
|
||||
|
||||
if(this == ModItems.med_ipecac || this == ModItems.med_ptsd) {
|
||||
this.setAlwaysEdible();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool)
|
||||
{
|
||||
if(this == ModItems.lemon) {
|
||||
list.add("Eh, good enough.");
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.med_ipecac) {
|
||||
list.add("Bitter juice that will cause your stomach");
|
||||
list.add("to forcefully eject its contents.");
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.med_ptsd) {
|
||||
list.add("This isn't even PTSD mediaction, it's just");
|
||||
list.add("Ipecac in a different bottle!");
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.med_schizophrenia) {
|
||||
list.add("Makes the voices go away. Just for a while.");
|
||||
list.add("");
|
||||
list.add("...");
|
||||
list.add("Better not take it.");
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.med_schizophrenia) {
|
||||
list.add("Makes the voices go away. Just for a while.");
|
||||
list.add("");
|
||||
list.add("...");
|
||||
list.add("Better not take it.");
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.loops) {
|
||||
list.add("Brøther, may I have some lööps?");
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.loop_stew) {
|
||||
list.add("A very, very healthy breakfast.");
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.twinkie) {
|
||||
list.add("Expired 600 years ago!");
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.pudding) {
|
||||
list.add("What if he did?");
|
||||
list.add("What if he didn't?");
|
||||
@ -96,18 +95,18 @@ public class ItemLemon extends ItemFood {
|
||||
{
|
||||
if(this == ModItems.med_ipecac || this == ModItems.med_ptsd) {
|
||||
player.addPotionEffect(new PotionEffect(Potion.hunger.id, 50, 49));
|
||||
|
||||
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setString("type", "vomit");
|
||||
nbt.setInteger("entity", player.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(player.dimension, player.posX, player.posY, player.posZ, 25));
|
||||
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(player.dimension, player.posX, player.posY, player.posZ, 25));
|
||||
|
||||
world.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:entity.vomit", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.med_schizophrenia) {
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.loop_stew) {
|
||||
player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 20 * 20, 1));
|
||||
player.addPotionEffect(new PotionEffect(Potion.resistance.id, 60 * 20, 2));
|
||||
@ -119,12 +118,12 @@ public class ItemLemon extends ItemFood {
|
||||
public ItemStack onEaten(ItemStack stack, World worldObj, EntityPlayer player)
|
||||
{
|
||||
ItemStack sta = super.onEaten(stack, worldObj, player);
|
||||
|
||||
|
||||
if(this == ModItems.loop_stew)
|
||||
return new ItemStack(Items.bowl);
|
||||
|
||||
|
||||
return sta;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,9 +3,9 @@ package com.hbm.items.special;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.extprop.HbmLivingProps;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -44,41 +44,41 @@ public class ItemCigarette extends Item {
|
||||
stack.stackSize--;
|
||||
|
||||
if(!world.isRemote) {
|
||||
|
||||
|
||||
if(this == ModItems.cigarette) {
|
||||
HbmLivingProps.incrementBlackLung(player, 2000);
|
||||
HbmLivingProps.incrementAsbestos(player, 2000);
|
||||
HbmLivingProps.incrementRadiation(player, 100F);
|
||||
|
||||
|
||||
ItemStack helmet = player.getEquipmentInSlot(4);
|
||||
if(helmet != null && helmet.getItem() == ModItems.no9) {
|
||||
player.triggerAchievement(MainRegistry.achNo9);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.crackpipe) {
|
||||
HbmLivingProps.incrementBlackLung(player, 500);
|
||||
player.addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 0));
|
||||
player.heal(10F);
|
||||
}
|
||||
|
||||
|
||||
world.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:player.cough", 1.0F, 1.0F);
|
||||
|
||||
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setString("type", "vomit");
|
||||
nbt.setString("mode", "smoke");
|
||||
nbt.setInteger("count", 30);
|
||||
nbt.setInteger("entity", player.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(player.dimension, player.posX, player.posY, player.posZ, 25));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(player.dimension, player.posX, player.posY, player.posZ, 25));
|
||||
}
|
||||
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
|
||||
|
||||
if(this == ModItems.cigarette) {
|
||||
list.add(EnumChatFormatting.RED + "✓ Asbestos filter");
|
||||
list.add(EnumChatFormatting.RED + "✓ High in tar");
|
||||
|
||||
@ -3,12 +3,12 @@ package com.hbm.items.tool;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
@ -31,10 +31,10 @@ public class ItemBlowtorch extends Item implements IFillableItem {
|
||||
this.setMaxStackSize(1);
|
||||
this.setFull3D();
|
||||
this.setCreativeTab(MainRegistry.controlTab);
|
||||
|
||||
|
||||
ToolType.TORCH.register(new ItemStack(this));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Item setUnlocalizedName(String unlocalizedName) {
|
||||
super.setUnlocalizedName(unlocalizedName);
|
||||
@ -47,20 +47,20 @@ public class ItemBlowtorch extends Item implements IFillableItem {
|
||||
|
||||
if(this == ModItems.blowtorch) return type == Fluids.GAS;
|
||||
if(this == ModItems.acetylene_torch) return type == Fluids.UNSATURATEDS || type == Fluids.OXYGEN;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int tryFill(FluidType type, int amount, ItemStack stack) {
|
||||
|
||||
|
||||
if(!acceptsFluid(type, stack))
|
||||
return amount;
|
||||
|
||||
|
||||
int toFill = Math.min(amount, 50);
|
||||
toFill = Math.min(toFill, getMaxFill(type) - this.getFill(stack, type));
|
||||
this.setFill(stack, type, this.getFill(stack, type) + toFill);
|
||||
|
||||
|
||||
return amount - toFill;
|
||||
}
|
||||
|
||||
@ -68,25 +68,25 @@ public class ItemBlowtorch extends Item implements IFillableItem {
|
||||
if(!stack.hasTagCompound()) {
|
||||
initNBT(stack);
|
||||
}
|
||||
|
||||
|
||||
//just in case
|
||||
String name = Fluids.toNameCompat(type);
|
||||
if(stack.stackTagCompound.hasKey(name)) {
|
||||
int fill = stack.stackTagCompound.getInteger(name);
|
||||
stack.stackTagCompound.removeTag(name);
|
||||
stack.stackTagCompound.setInteger(Integer.toString(type.getID()), fill);
|
||||
|
||||
|
||||
return fill;
|
||||
}
|
||||
|
||||
|
||||
return stack.stackTagCompound.getInteger(Integer.toString(type.getID()));
|
||||
}
|
||||
|
||||
|
||||
public int getMaxFill(FluidType type) {
|
||||
if(type == Fluids.GAS) return 4_000;
|
||||
if(type == Fluids.UNSATURATEDS) return 8_000;
|
||||
if(type == Fluids.OXYGEN) return 16_000;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -94,12 +94,12 @@ public class ItemBlowtorch extends Item implements IFillableItem {
|
||||
if(!stack.hasTagCompound()) {
|
||||
initNBT(stack);
|
||||
}
|
||||
|
||||
|
||||
stack.stackTagCompound.setInteger(Integer.toString(type.getID()), fill);
|
||||
}
|
||||
|
||||
|
||||
public void initNBT(ItemStack stack) {
|
||||
|
||||
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
|
||||
if(this == ModItems.blowtorch) {
|
||||
@ -110,7 +110,7 @@ public class ItemBlowtorch extends Item implements IFillableItem {
|
||||
this.setFill(stack, Fluids.OXYGEN, this.getMaxFill(Fluids.OXYGEN));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static ItemStack getEmptyTool(Item item) {
|
||||
ItemBlowtorch tool = (ItemBlowtorch) item;
|
||||
ItemStack stack = new ItemStack(item);
|
||||
@ -122,51 +122,51 @@ public class ItemBlowtorch extends Item implements IFillableItem {
|
||||
tool.setFill(stack, Fluids.UNSATURATEDS, 0);
|
||||
tool.setFill(stack, Fluids.OXYGEN, 0);
|
||||
}
|
||||
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float fX, float fY, float fZ) {
|
||||
|
||||
|
||||
Block b = world.getBlock(x, y, z);
|
||||
|
||||
|
||||
if(b instanceof IToolable) {
|
||||
|
||||
|
||||
if(this == ModItems.blowtorch) {
|
||||
if(this.getFill(stack, Fluids.GAS) < 1000) return false;
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.acetylene_torch) {
|
||||
if(this.getFill(stack, Fluids.UNSATURATEDS) < 20) return false;
|
||||
if(this.getFill(stack, Fluids.OXYGEN) < 10) return false;
|
||||
}
|
||||
|
||||
|
||||
if(((IToolable)b).onScrew(world, player, x, y, z, side, fX, fY, fZ, ToolType.TORCH)) {
|
||||
|
||||
|
||||
if(!world.isRemote) {
|
||||
|
||||
|
||||
if(this == ModItems.blowtorch) {
|
||||
this.setFill(stack, Fluids.GAS, this.getFill(stack, Fluids.GAS) - 250);
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.acetylene_torch) {
|
||||
this.setFill(stack, Fluids.UNSATURATEDS, this.getFill(stack, Fluids.UNSATURATEDS) - 20);
|
||||
this.setFill(stack, Fluids.OXYGEN, this.getFill(stack, Fluids.OXYGEN) - 10);
|
||||
}
|
||||
|
||||
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
|
||||
|
||||
NBTTagCompound dPart = new NBTTagCompound();
|
||||
dPart.setString("type", "tau");
|
||||
dPart.setByte("count", (byte) 10);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(dPart, x + fX, y + fY, z + fZ), new TargetPoint(world.provider.dimensionId, x, y, z, 50));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(dPart, x + fX, y + fY, z + fZ), new TargetPoint(world.provider.dimensionId, x, y, z, 50));
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -177,27 +177,27 @@ public class ItemBlowtorch extends Item implements IFillableItem {
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
|
||||
|
||||
double frac = 0D;
|
||||
|
||||
|
||||
if(this == ModItems.blowtorch) {
|
||||
frac = (double) this.getFill(stack, Fluids.GAS) / (double) this.getMaxFill(Fluids.GAS);
|
||||
}
|
||||
|
||||
|
||||
if(this == ModItems.acetylene_torch) {
|
||||
frac = Math.min(
|
||||
(double) this.getFill(stack, Fluids.UNSATURATEDS) / (double) this.getMaxFill(Fluids.UNSATURATEDS),
|
||||
(double) this.getFill(stack, Fluids.OXYGEN) / (double) this.getMaxFill(Fluids.OXYGEN)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return 1 - frac;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
|
||||
|
||||
if(this == ModItems.blowtorch) {
|
||||
list.add(EnumChatFormatting.YELLOW + getFillGauge(stack, Fluids.GAS));
|
||||
}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
package com.hbm.items.tool;
|
||||
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.inventory.material.Mats;
|
||||
import com.hbm.items.IAnimatedItem;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.render.anim.BusAnimation;
|
||||
import com.hbm.render.anim.BusAnimationSequence;
|
||||
@ -32,29 +32,29 @@ public class ItemBoltgun extends Item implements IAnimatedItem {
|
||||
public ItemBoltgun() {
|
||||
this.setMaxStackSize(1);
|
||||
this.setCreativeTab(MainRegistry.controlTab);
|
||||
|
||||
|
||||
ToolType.BOLT.register(new ItemStack(this));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Item setUnlocalizedName(String unlocalizedName) {
|
||||
super.setUnlocalizedName(unlocalizedName);
|
||||
this.setTextureName(RefStrings.MODID + ":"+ unlocalizedName);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
|
||||
|
||||
|
||||
World world = player.worldObj;
|
||||
if(!entity.isEntityAlive()) return false;
|
||||
|
||||
|
||||
ItemStack[] bolts = new ItemStack[] { new ItemStack(ModItems.bolt_spike), Mats.MAT_STEEL.make(ModItems.bolt), Mats.MAT_TUNGSTEN.make(ModItems.bolt), Mats.MAT_DURA.make(ModItems.bolt)};
|
||||
|
||||
|
||||
for(ItemStack bolt : bolts) {
|
||||
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
ItemStack slot = player.inventory.getStackInSlot(i);
|
||||
|
||||
|
||||
if(slot != null) {
|
||||
if(slot.getItem() == bolt.getItem() && slot.getItemDamage() == bolt.getItemDamage()) {
|
||||
if(!world.isRemote) {
|
||||
@ -62,7 +62,7 @@ public class ItemBoltgun extends Item implements IAnimatedItem {
|
||||
player.inventory.decrStackSize(i, 1);
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
EntityDamageUtil.attackEntityFromIgnoreIFrame(entity, DamageSource.causePlayerDamage(player).setDamageBypassesArmor(), 10F);
|
||||
|
||||
|
||||
if(!entity.isEntityAlive() && entity instanceof EntityPlayer) {
|
||||
((EntityPlayer) entity).triggerAchievement(MainRegistry.achGoFish);
|
||||
}
|
||||
@ -72,7 +72,7 @@ public class ItemBoltgun extends Item implements IAnimatedItem {
|
||||
data.setString("mode", "largeexplode");
|
||||
data.setFloat("size", 1F);
|
||||
data.setByte("count", (byte)1);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, entity.posX, entity.posY + entity.height / 2 - entity.yOffset, entity.posZ), new TargetPoint(world.provider.dimensionId, entity.posX, entity.posY, entity.posZ, 50));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, entity.posX, entity.posY + entity.height / 2 - entity.yOffset, entity.posZ), new TargetPoint(world.provider.dimensionId, entity.posX, entity.posY, entity.posZ, 50));
|
||||
} else {
|
||||
// doing this on the client outright removes the packet delay and makes the animation silky-smooth
|
||||
NBTTagCompound d0 = new NBTTagCompound();
|
||||
@ -85,15 +85,15 @@ public class ItemBoltgun extends Item implements IAnimatedItem {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float fX, float fY, float fZ) {
|
||||
|
||||
|
||||
Block b = world.getBlock(x, y, z);
|
||||
|
||||
|
||||
if(b instanceof IToolable && ((IToolable)b).onScrew(world, player, x, y, z, side, fX, fY, fZ, ToolType.BOLT)) {
|
||||
|
||||
if(!world.isRemote) {
|
||||
@ -108,17 +108,17 @@ public class ItemBoltgun extends Item implements IAnimatedItem {
|
||||
data.setString("mode", "largeexplode");
|
||||
data.setFloat("size", 1F);
|
||||
data.setByte("count", (byte)1);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x + fX + dir.offsetX * off, y + fY + dir.offsetY * off, z + fZ + dir.offsetZ * off), new TargetPoint(world.provider.dimensionId, x, y, z, 50));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, x + fX + dir.offsetX * off, y + fY + dir.offsetY * off, z + fZ + dir.offsetZ * off), new TargetPoint(world.provider.dimensionId, x, y, z, 50));
|
||||
|
||||
NBTTagCompound d0 = new NBTTagCompound();
|
||||
d0.setString("type", "anim");
|
||||
d0.setString("mode", "generic");
|
||||
PacketDispatcher.wrapper.sendTo(new AuxParticlePacketNT(d0, 0, 0, 0), (EntityPlayerMP) player);
|
||||
PacketThreading.createSendToThreadedPacket(new AuxParticlePacketNT(d0, 0, 0, 0), (EntityPlayerMP) player);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package com.hbm.items.tool;
|
||||
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.items.IHeldSoundProvider;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@ -18,18 +18,18 @@ public class ItemChainsaw extends ItemToolAbilityFueled implements IHeldSoundPro
|
||||
|
||||
@Override
|
||||
public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) {
|
||||
|
||||
|
||||
if(!(entityLiving instanceof EntityPlayerMP))
|
||||
return false;
|
||||
|
||||
|
||||
if(stack.getItemDamage() >= stack.getMaxDamage())
|
||||
return false;
|
||||
|
||||
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setString("type", "anim");
|
||||
nbt.setString("mode", "sSwing");
|
||||
PacketDispatcher.wrapper.sendTo(new AuxParticlePacketNT(nbt, 0, 0, 0), (EntityPlayerMP)entityLiving);
|
||||
|
||||
PacketThreading.createSendToThreadedPacket(new AuxParticlePacketNT(nbt, 0, 0, 0), (EntityPlayerMP)entityLiving);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ package com.hbm.items.tool;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.util.ChatBuilder;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
@ -26,29 +26,29 @@ public class ItemPowerNetTool extends Item {
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float fX, float fY, float fZ) {
|
||||
|
||||
|
||||
Block b = world.getBlock(x, y, z);
|
||||
|
||||
|
||||
if(b instanceof BlockDummyable) {
|
||||
int[] pos = ((BlockDummyable) b).findCore(world, x, y, z);
|
||||
|
||||
|
||||
if(pos != null) {
|
||||
x = pos[0];
|
||||
y = pos[1];
|
||||
z = pos[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
|
||||
if(world.isRemote)
|
||||
return true;
|
||||
|
||||
|
||||
if((te instanceof IEnergyConductorMK2)) {
|
||||
PowerNode node = Nodespace.getNode(world, x, y, z);
|
||||
|
||||
|
||||
if(node != null && node.hasValidNet()) {
|
||||
|
||||
|
||||
PowerNetMK2 net = node.net;
|
||||
String id = Integer.toHexString(net.hashCode());
|
||||
player.addChatComponentMessage(ChatBuilder.start("Start of diagnostic for network " + id).color(EnumChatFormatting.GOLD).flush());
|
||||
@ -56,29 +56,29 @@ public class ItemPowerNetTool extends Item {
|
||||
player.addChatComponentMessage(ChatBuilder.start("Providers: " + net.providerEntries.size()).color(EnumChatFormatting.YELLOW).flush());
|
||||
player.addChatComponentMessage(ChatBuilder.start("Receivers: " + net.receiverEntries.size()).color(EnumChatFormatting.YELLOW).flush());
|
||||
player.addChatComponentMessage(ChatBuilder.start("End of diagnostic for network " + id).color(EnumChatFormatting.GOLD).flush());
|
||||
|
||||
|
||||
for(PowerNode link : net.links) {
|
||||
|
||||
|
||||
for(BlockPos pos : link.positions) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "debug");
|
||||
data.setInteger("color", 0xffff00);
|
||||
data.setFloat("scale", 0.5F);
|
||||
data.setString("text", id);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5), new TargetPoint(world.provider.dimensionId, pos.getX(), pos.getY(), pos.getZ(), radius));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5), new TargetPoint(world.provider.dimensionId, pos.getX(), pos.getY(), pos.getZ(), radius));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
player.addChatComponentMessage(ChatBuilder.start("Error: No network found!").color(EnumChatFormatting.RED).flush());
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private static final int radius = 20;
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,30 +1,77 @@
|
||||
package com.hbm.items.tool;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard;
|
||||
import com.hbm.itempool.ItemPool;
|
||||
import com.hbm.itempool.ItemPoolsSingle;
|
||||
import com.hbm.lib.HbmWorldGen;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.particle.helper.ExplosionCreator;
|
||||
|
||||
import com.hbm.tileentity.machine.storage.TileEntityCrateBase;
|
||||
import com.hbm.tileentity.machine.storage.TileEntitySafe;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemWandD extends Item {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
|
||||
|
||||
if(world.isRemote)
|
||||
return stack;
|
||||
|
||||
|
||||
MovingObjectPosition pos = Library.rayTrace(player, 500, 1, false, true, false);
|
||||
|
||||
|
||||
if(pos != null) {
|
||||
|
||||
|
||||
int y = world.getHeightValue(pos.blockX, pos.blockZ);
|
||||
|
||||
Random rand = new Random();
|
||||
|
||||
if(world.getBlock(pos.blockX, y - 1, pos.blockZ).canPlaceTorchOnTop(world, pos.blockX, y - 1, pos.blockZ)) {
|
||||
world.setBlock(pos.blockX, y, pos.blockZ, ModBlocks.safe, rand.nextInt(4) + 2, 2);
|
||||
TileEntitySafe safe = (TileEntitySafe) world.getTileEntity(pos.blockX, y, pos.blockZ);
|
||||
|
||||
switch(rand.nextInt(10)) {
|
||||
case 0: case 1: case 2: case 3:
|
||||
safe.setMod(1);
|
||||
WeightedRandomChestContent.generateChestContents(rand, ItemPool.getPool(ItemPoolsSingle.POOL_VAULT_RUSTY), safe, rand.nextInt(4) + 3);
|
||||
break;
|
||||
case 4: case 5: case 6:
|
||||
safe.setMod(0.1);
|
||||
WeightedRandomChestContent.generateChestContents(rand, ItemPool.getPool(ItemPoolsSingle.POOL_VAULT_STANDARD), safe, rand.nextInt(3) + 2);
|
||||
break;
|
||||
case 7: case 8:
|
||||
safe.setMod(0.02);
|
||||
WeightedRandomChestContent.generateChestContents(rand, ItemPool.getPool(ItemPoolsSingle.POOL_VAULT_REINFORCED), safe, rand.nextInt(3) + 1);
|
||||
break;
|
||||
case 9:
|
||||
safe.setMod(0.0);
|
||||
WeightedRandomChestContent.generateChestContents(rand, ItemPool.getPool(ItemPoolsSingle.POOL_VAULT_UNBREAKABLE), safe, rand.nextInt(2) + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
safe.setPins(rand.nextInt(999) + 1);
|
||||
safe.lock();
|
||||
|
||||
safe.fillWithSpiders(); // debug
|
||||
|
||||
if(GeneralConfig.enableDebugMode)
|
||||
MainRegistry.logger.info("[Debug] Successfully spawned safe at " + pos.blockX + " " + (y + 1) +" " + pos.blockZ);
|
||||
}
|
||||
|
||||
/*ExplosionVNT vnt = new ExplosionVNT(world, pos.hitVec.xCoord, pos.hitVec.yCoord, pos.hitVec.zCoord, 7);
|
||||
vnt.setBlockAllocator(new BlockAllocatorBulkie(60));
|
||||
vnt.setBlockProcessor(new BlockProcessorStandard().withBlockEffect(new BlockMutatorBulkie(ModBlocks.block_slag)).setNoDrop());
|
||||
@ -32,25 +79,27 @@ public class ItemWandD extends Item {
|
||||
vnt.setPlayerProcessor(new PlayerProcessorStandard());
|
||||
vnt.setSFX(new ExplosionEffectStandard());
|
||||
vnt.explode();*/
|
||||
|
||||
|
||||
//PollutionHandler.incrementPollution(world, pos.blockX, pos.blockY, pos.blockZ, PollutionType.SOOT, 15);
|
||||
|
||||
|
||||
/*int i = pos.blockX >> 4;
|
||||
int j = pos.blockZ >> 4;
|
||||
|
||||
|
||||
i = (i << 4) + 8;
|
||||
j = (j << 4) + 8;
|
||||
Component comp = new RuralHouse1(world.rand, i, j);
|
||||
comp.addComponentParts(world, world.rand, new StructureBoundingBox(i, j, i + 32, j + 32));*/
|
||||
|
||||
|
||||
/*
|
||||
ExplosionVNT vnt = new ExplosionVNT(world, pos.blockX + 0.5, pos.blockY + 1, pos.blockZ + 0.5, 15F);
|
||||
vnt.makeStandard();
|
||||
vnt.setSFX();
|
||||
vnt.setBlockAllocator(new BlockAllocatorStandard(32));
|
||||
vnt.explode();
|
||||
|
||||
|
||||
ExplosionCreator.composeEffectStandard(world, pos.blockX + 0.5, pos.blockY + 0.5, pos.blockZ + 0.5);
|
||||
|
||||
*/
|
||||
|
||||
/*for(int i = 0; i < 10; i++) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "debris");
|
||||
@ -59,20 +108,20 @@ public class ItemWandD extends Item {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "oomph");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, pos.blockX, pos.blockY, pos.blockZ), new TargetPoint(world.provider.dimensionId, pos.blockX, pos.blockY, pos.blockZ, 100));*/
|
||||
|
||||
|
||||
/*TimeAnalyzer.startCount("setBlock");
|
||||
world.setBlock(pos.blockX, pos.blockY, pos.blockZ, Blocks.dirt);
|
||||
TimeAnalyzer.startEndCount("getBlock");
|
||||
world.getBlock(pos.blockX, pos.blockY, pos.blockZ);
|
||||
TimeAnalyzer.endCount();
|
||||
TimeAnalyzer.dump();*/
|
||||
|
||||
|
||||
/*TomSaveData data = TomSaveData.forWorld(world);
|
||||
data.impact = true;
|
||||
data.fire = 0F;
|
||||
data.dust = 0F;
|
||||
data.markDirty();*/
|
||||
|
||||
|
||||
/*for(int i = -5; i <= 5; i++) {
|
||||
for(int j = -5; j <= 5; j++) {
|
||||
WorldUtil.setBiome(world, pos.blockX + i, pos.blockZ + j, BiomeGenCraterBase.craterBiome);
|
||||
@ -80,39 +129,39 @@ public class ItemWandD extends Item {
|
||||
}
|
||||
|
||||
WorldUtil.syncBiomeChange(world, pos.blockX, pos.blockZ);*/
|
||||
|
||||
|
||||
/*EntityTomBlast tom = new EntityTomBlast(world);
|
||||
tom.posX = pos.blockX;
|
||||
tom.posY = pos.blockY;
|
||||
tom.posZ = pos.blockZ;
|
||||
tom.destructionRange = 600;
|
||||
world.spawnEntityInWorld(tom);*/
|
||||
|
||||
|
||||
/*List<EntityNukeTorex> del = world.getEntitiesWithinAABB(EntityNukeTorex.class, AxisAlignedBB.getBoundingBox(pos.blockX, pos.blockY + 1, pos.blockZ, pos.blockX, pos.blockY + 1, pos.blockZ).expand(50, 50, 50));
|
||||
|
||||
|
||||
if(!del.isEmpty()) {
|
||||
for(EntityNukeTorex torex : del) torex.setDead();
|
||||
} else {
|
||||
EntityNukeTorex.statFac(world, pos.blockX, pos.blockY + 1, pos.blockZ, 150);
|
||||
}*/
|
||||
|
||||
|
||||
/*EntityTracker entitytracker = ((WorldServer) world).getEntityTracker();
|
||||
IntHashMap map = ReflectionHelper.getPrivateValue(EntityTracker.class, entitytracker, "trackedEntityIDs", "field_72794_c");
|
||||
EntityTrackerEntry entry = (EntityTrackerEntry) map.lookup(torex.getEntityId());
|
||||
entry.blocksDistanceThreshold = 1000;*/
|
||||
//world.spawnEntityInWorld(EntityNukeExplosionMK5.statFacNoRad(world, 150, pos.blockX, pos.blockY + 1, pos.blockZ));
|
||||
|
||||
|
||||
//DungeonToolbox.generateBedrockOreWithChance(world, world.rand, pos.blockX, pos.blockZ, EnumBedrockOre.TITANIUM, new FluidStack(Fluids.SULFURIC_ACID, 500), 2, 1);
|
||||
|
||||
|
||||
/*EntitySiegeTunneler tunneler = new EntitySiegeTunneler(world);
|
||||
tunneler.setPosition(pos.blockX, pos.blockY + 1, pos.blockZ);
|
||||
tunneler.onSpawnWithEgg(null);
|
||||
world.spawnEntityInWorld(tunneler);*/
|
||||
|
||||
|
||||
//CellularDungeonFactory.meteor.generate(world, x, y, z, world.rand);
|
||||
|
||||
|
||||
/*int r = 5;
|
||||
|
||||
|
||||
int x = pos.blockX;
|
||||
int y = pos.blockY;
|
||||
int z = pos.blockZ;
|
||||
@ -124,24 +173,24 @@ public class ItemWandD extends Item {
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
//new Bunker().generate(world, world.rand, x, y, z);
|
||||
|
||||
|
||||
/*EntityBlockSpider spider = new EntityBlockSpider(world);
|
||||
spider.setPosition(x + 0.5, y, z + 0.5);
|
||||
spider.makeBlock(world.getBlock(x, y, z), world.getBlockMetadata(x, y, z));
|
||||
world.setBlockToAir(x, y, z);
|
||||
world.spawnEntityInWorld(spider);*/
|
||||
|
||||
|
||||
|
||||
|
||||
/*NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "rift");
|
||||
data.setDouble("posX", x);
|
||||
data.setDouble("posY", y + 1);
|
||||
data.setDouble("posZ", z);
|
||||
|
||||
|
||||
MainRegistry.proxy.effectNT(data);*/
|
||||
|
||||
|
||||
//new Spaceship().generate_r0(world, world.rand, x - 4, y, z - 8);
|
||||
|
||||
//new Ruin001().generate_r0(world, world.rand, x, y - 8, z);
|
||||
@ -149,11 +198,11 @@ public class ItemWandD extends Item {
|
||||
//CellularDungeonFactory.jungle.generate(world, x, y, z, world.rand);
|
||||
//CellularDungeonFactory.jungle.generate(world, x, y + 4, z, world.rand);
|
||||
//CellularDungeonFactory.jungle.generate(world, x, y + 8, z, world.rand);
|
||||
|
||||
|
||||
//new AncientTomb().build(world, world.rand, x, y + 10, z);
|
||||
|
||||
|
||||
//new ArcticVault().trySpawn(world, x, y, z);
|
||||
|
||||
|
||||
/*for(int ix = x - 10; ix <= x + 10; ix++) {
|
||||
for(int iz = z - 10; iz <= z + 10; iz++) {
|
||||
|
||||
@ -175,7 +224,7 @@ public class ItemWandD extends Item {
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
||||
@ -20,10 +20,10 @@ import com.hbm.explosion.vanillant.standard.EntityProcessorCross;
|
||||
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
|
||||
import com.hbm.handler.pollution.PollutionHandler;
|
||||
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.particle.SpentCasing;
|
||||
import com.hbm.particle.SpentCasing.CasingType;
|
||||
@ -50,7 +50,7 @@ import net.minecraft.util.Vec3;
|
||||
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
||||
|
||||
public class ItemAmmoArty extends Item {
|
||||
|
||||
|
||||
public static Random rand = new Random();
|
||||
public static ArtilleryShell[] itemTypes = new ArtilleryShell[ /* >>> */ 12 /* <<< */ ];
|
||||
/* item types */
|
||||
@ -67,7 +67,7 @@ public class ItemAmmoArty extends Item {
|
||||
public final int PHOSGENE = 10;
|
||||
public final int MUSTARD = 11;
|
||||
/* non-item shell types */
|
||||
|
||||
|
||||
public ItemAmmoArty() {
|
||||
this.setHasSubtypes(true);
|
||||
this.setCreativeTab(MainRegistry.weaponTab);
|
||||
@ -97,7 +97,7 @@ public class ItemAmmoArty extends Item {
|
||||
String r = EnumChatFormatting.RED + "";
|
||||
String y = EnumChatFormatting.YELLOW + "";
|
||||
String b = EnumChatFormatting.BLUE + "";
|
||||
|
||||
|
||||
switch(stack.getItemDamage()) {
|
||||
case NORMAL:
|
||||
list.add(y + "Strength: 10");
|
||||
@ -137,7 +137,7 @@ public class ItemAmmoArty extends Item {
|
||||
list.add(r + "minecraft's unicode has to offer)");
|
||||
break;
|
||||
case CARGO:
|
||||
|
||||
|
||||
if(stack.hasTagCompound() && stack.stackTagCompound.getCompoundTag("cargo") != null) {
|
||||
ItemStack cargo = ItemStack.loadItemStackFromNBT(stack.stackTagCompound.getCompoundTag("cargo"));
|
||||
list.add(y + cargo.getDisplayName());
|
||||
@ -153,53 +153,53 @@ public class ItemAmmoArty extends Item {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister reg) {
|
||||
|
||||
|
||||
this.icons = new IIcon[itemTypes.length];
|
||||
|
||||
for(int i = 0; i < icons.length; i++) {
|
||||
this.icons[i] = reg.registerIcon(RefStrings.MODID + ":" + itemTypes[i].name);
|
||||
}
|
||||
|
||||
|
||||
this.iconCargo = reg.registerIcon(RefStrings.MODID + ":ammo_arty_cargo_full");
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconIndex(ItemStack stack) {
|
||||
|
||||
|
||||
if(stack.getItemDamage() == CARGO && stack.hasTagCompound() && stack.stackTagCompound.getCompoundTag("cargo") != null) {
|
||||
return this.iconCargo;
|
||||
}
|
||||
|
||||
|
||||
return this.getIconFromDamage(stack.getItemDamage());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return this.icons[meta];
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return "item." + itemTypes[Math.abs(stack.getItemDamage()) % itemTypes.length].name;
|
||||
}
|
||||
|
||||
|
||||
protected static SpentCasing SIXTEEN_INCH_CASE = new SpentCasing(CasingType.STRAIGHT).setScale(15F, 15F, 10F).setupSmoke(1F, 1D, 200, 60).setMaxAge(300).setBounceMotion(1F, 0.5F);
|
||||
|
||||
|
||||
public abstract class ArtilleryShell {
|
||||
|
||||
|
||||
String name;
|
||||
public SpentCasing casing;
|
||||
|
||||
|
||||
public ArtilleryShell(String name, int casingColor) {
|
||||
this.name = name;
|
||||
this.casing = SIXTEEN_INCH_CASE.clone().register(name).setColor(casingColor);
|
||||
}
|
||||
|
||||
|
||||
public abstract void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop);
|
||||
public void onUpdate(EntityArtilleryShell shell) { }
|
||||
}
|
||||
|
||||
|
||||
public static void standardExplosion(EntityArtilleryShell shell, MovingObjectPosition mop, float size, float rangeMod, boolean breaksBlocks) {
|
||||
Vec3 vec = Vec3.createVectorHelper(shell.motionX, shell.motionY, shell.motionZ).normalize();
|
||||
ExplosionVNT xnt = new ExplosionVNT(shell.worldObj, mop.hitVec.xCoord - vec.xCoord, mop.hitVec.yCoord - vec.yCoord, mop.hitVec.zCoord - vec.zCoord, size);
|
||||
@ -213,22 +213,22 @@ public class ItemAmmoArty extends Item {
|
||||
xnt.explode();
|
||||
shell.killAndClear();
|
||||
}
|
||||
|
||||
|
||||
public static void standardCluster(EntityArtilleryShell shell, int clusterType, int amount, double splitHeight, double deviation) {
|
||||
if(!shell.getWhistle() || shell.motionY > 0) return;
|
||||
if(shell.getTargetHeight() + splitHeight < shell.posY) return;
|
||||
|
||||
|
||||
shell.killAndClear();
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "plasmablast");
|
||||
data.setFloat("r", 1.0F);
|
||||
data.setFloat("g", 1.0F);
|
||||
data.setFloat("b", 1.0F);
|
||||
data.setFloat("scale", 50F);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, shell.posX, shell.posY, shell.posZ),
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, shell.posX, shell.posY, shell.posZ),
|
||||
new TargetPoint(shell.dimension, shell.posX, shell.posY, shell.posZ, 500));
|
||||
|
||||
|
||||
for(int i = 0; i < amount; i++) {
|
||||
EntityArtilleryShell cluster = new EntityArtilleryShell(shell.worldObj);
|
||||
cluster.setType(clusterType);
|
||||
@ -242,7 +242,7 @@ public class ItemAmmoArty extends Item {
|
||||
shell.worldObj.spawnEntityInWorld(cluster);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void init() {
|
||||
/* STANDARD SHELLS */
|
||||
this.itemTypes[NORMAL] = new ArtilleryShell("ammo_arty", SpentCasing.COLOR_CASE_16INCH) { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { standardExplosion(shell, mop, 10F, 3F, false); ExplosionCreator.composeEffect(shell.worldObj, mop.blockX + 0.5, mop.blockY + 0.5, mop.blockZ + 0.5, 10, 2F, 0.5F, 25F, 5, 0, 20, 0.75F, 1F, -2F, 150); }};
|
||||
@ -257,7 +257,7 @@ public class ItemAmmoArty extends Item {
|
||||
ExplosionNukeSmall.explode(shell.worldObj, mop.hitVec.xCoord - vec.xCoord, mop.hitVec.yCoord - vec.yCoord, mop.hitVec.zCoord - vec.zCoord, ExplosionNukeSmall.PARAMS_MEDIUM);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* FULL NUKE */
|
||||
this.itemTypes[NUKE] = new ArtilleryShell("ammo_arty_nuke", SpentCasing.COLOR_CASE_16INCH_NUKE) {
|
||||
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
||||
@ -266,7 +266,7 @@ public class ItemAmmoArty extends Item {
|
||||
shell.setDead();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* PHOSPHORUS */
|
||||
this.itemTypes[PHOSPHORUS] = new ArtilleryShell("ammo_arty_phosphorus", SpentCasing.COLOR_CASE_16INCH_PHOS) {
|
||||
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
||||
@ -288,15 +288,15 @@ public class ItemAmmoArty extends Item {
|
||||
for(int i = 0; i < 5; i++) {
|
||||
NBTTagCompound haze = new NBTTagCompound();
|
||||
haze.setString("type", "haze");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(haze, mop.hitVec.xCoord + shell.worldObj.rand.nextGaussian() * 10, mop.hitVec.yCoord, mop.hitVec.zCoord + shell.worldObj.rand.nextGaussian() * 10), new TargetPoint(shell.dimension, shell.posX, shell.posY, shell.posZ, 150));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(haze, mop.hitVec.xCoord + shell.worldObj.rand.nextGaussian() * 10, mop.hitVec.yCoord, mop.hitVec.zCoord + shell.worldObj.rand.nextGaussian() * 10), new TargetPoint(shell.dimension, shell.posX, shell.posY, shell.posZ, 150));
|
||||
}
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "rbmkmush");
|
||||
data.setFloat("scale", 10);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord), new TargetPoint(shell.dimension, shell.posX, shell.posY, shell.posZ, 250));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord), new TargetPoint(shell.dimension, shell.posX, shell.posY, shell.posZ, 250));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* THIS DOOFUS */
|
||||
this.itemTypes[CARGO] = new ArtilleryShell("ammo_arty_cargo", SpentCasing.COLOR_CASE_16INCH) { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
||||
if(mop.typeOfHit == MovingObjectType.BLOCK) {
|
||||
@ -304,7 +304,7 @@ public class ItemAmmoArty extends Item {
|
||||
shell.getStuck(mop.blockX, mop.blockY, mop.blockZ, mop.sideHit);
|
||||
}
|
||||
}};
|
||||
|
||||
|
||||
/* GAS */
|
||||
this.itemTypes[CHLORINE] = new ArtilleryShell("ammo_arty_chlorine", SpentCasing.COLOR_CASE_16INCH) {
|
||||
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
||||
@ -363,7 +363,7 @@ public class ItemAmmoArty extends Item {
|
||||
PollutionHandler.incrementPollution(shell.worldObj, mop.blockX, mop.blockY, mop.blockZ, PollutionType.POISON, 30F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* CLUSTER SHELLS */
|
||||
this.itemTypes[PHOSPHORUS_MULTI] = new ArtilleryShell("ammo_arty_phosphorus_multi", SpentCasing.COLOR_CASE_16INCH_PHOS) {
|
||||
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { ItemAmmoArty.this.itemTypes[PHOSPHORUS].onImpact(shell, mop); }
|
||||
|
||||
@ -13,9 +13,9 @@ import com.hbm.explosion.vanillant.standard.BlockMutatorDebris;
|
||||
import com.hbm.explosion.vanillant.standard.BlockProcessorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.EntityProcessorCross;
|
||||
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.particle.helper.ExplosionCreator;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
@ -39,7 +39,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class ItemAmmoHIMARS extends Item {
|
||||
|
||||
|
||||
public static HIMARSRocket[] itemTypes = new HIMARSRocket[ /* >>> */ 8 /* <<< */ ];
|
||||
|
||||
public static final int SMALL = 0;
|
||||
@ -50,7 +50,7 @@ public class ItemAmmoHIMARS extends Item {
|
||||
public static final int LARGE_TB = 5;
|
||||
public static final int SMALL_MINI_NUKE = 6;
|
||||
public static final int SMALL_LAVA = 7;
|
||||
|
||||
|
||||
public ItemAmmoHIMARS() {
|
||||
this.setHasSubtypes(true);
|
||||
this.setCreativeTab(MainRegistry.weaponTab);
|
||||
@ -78,7 +78,7 @@ public class ItemAmmoHIMARS extends Item {
|
||||
String r = EnumChatFormatting.RED + "";
|
||||
String y = EnumChatFormatting.YELLOW + "";
|
||||
String b = EnumChatFormatting.BLUE + "";
|
||||
|
||||
|
||||
switch(stack.getItemDamage()) {
|
||||
case SMALL:
|
||||
list.add(y + "Strength: 20");
|
||||
@ -123,30 +123,30 @@ public class ItemAmmoHIMARS extends Item {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return "item.ammo_himars_" + itemTypes[Math.abs(stack.getItemDamage()) % itemTypes.length].name;
|
||||
}
|
||||
|
||||
|
||||
public abstract class HIMARSRocket {
|
||||
|
||||
|
||||
public final String name;
|
||||
public final ResourceLocation texture;
|
||||
public final int amount;
|
||||
public final int modelType; /* 0 = sixfold/standard ; 1 = single */
|
||||
|
||||
|
||||
public HIMARSRocket(String name, String texture, int type) {
|
||||
this.name = name;
|
||||
this.texture = new ResourceLocation(RefStrings.MODID + ":textures/models/projectiles/" + texture + ".png");
|
||||
this.amount = type == 0 ? 6 : 1;
|
||||
this.modelType = type;
|
||||
}
|
||||
|
||||
|
||||
public abstract void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop);
|
||||
public void onUpdate(EntityArtilleryRocket rocket) { }
|
||||
}
|
||||
|
||||
|
||||
public static void standardExplosion(EntityArtilleryRocket rocket, MovingObjectPosition mop, float size, float rangeMod, boolean breaksBlocks, Block slag, int slagMeta) {
|
||||
Vec3 vec = Vec3.createVectorHelper(rocket.motionX, rocket.motionY, rocket.motionZ).normalize();
|
||||
ExplosionVNT xnt = new ExplosionVNT(rocket.worldObj, mop.hitVec.xCoord - vec.xCoord, mop.hitVec.yCoord - vec.yCoord, mop.hitVec.zCoord - vec.zCoord, size);
|
||||
@ -159,14 +159,14 @@ public class ItemAmmoHIMARS extends Item {
|
||||
xnt.explode();
|
||||
rocket.killAndClear();
|
||||
}
|
||||
|
||||
|
||||
public static void standardMush(EntityArtilleryRocket rocket, MovingObjectPosition mop, float size) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "rbmkmush");
|
||||
data.setFloat("scale", size);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord), new TargetPoint(rocket.dimension, rocket.posX, rocket.posY, rocket.posZ, 250));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord), new TargetPoint(rocket.dimension, rocket.posX, rocket.posY, rocket.posZ, 250));
|
||||
}
|
||||
|
||||
|
||||
private void init() {
|
||||
/* STANDARD ROCKETS */
|
||||
this.itemTypes[SMALL] = new HIMARSRocket("standard", "himars_standard", 0) { public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) { standardExplosion(rocket, mop, 20F, 3F, false, ModBlocks.block_slag, 1); ExplosionCreator.composeEffect(rocket.worldObj, mop.blockX + 0.5, mop.blockY + 0.5, mop.blockZ + 0.5, 15, 5F, 1F, 45F, 10, 0, 50, 1F, 3F, -2F, 200); }};
|
||||
@ -181,7 +181,7 @@ public class ItemAmmoHIMARS extends Item {
|
||||
ExplosionNukeSmall.explode(rocket.worldObj, mop.hitVec.xCoord - vec.xCoord, mop.hitVec.yCoord - vec.yCoord, mop.hitVec.zCoord - vec.zCoord, ExplosionNukeSmall.PARAMS_MEDIUM);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.itemTypes[SMALL_WP] = new HIMARSRocket("standard_wp", "himars_standard_wp", 0) {
|
||||
public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) {
|
||||
rocket.worldObj.playSoundEffect(rocket.posX, rocket.posY, rocket.posZ, "hbm:weapon.explosionMedium", 20.0F, 0.9F + rocket.worldObj.rand.nextFloat() * 0.2F);
|
||||
@ -201,11 +201,11 @@ public class ItemAmmoHIMARS extends Item {
|
||||
for(int i = 0; i < 10; i++) {
|
||||
NBTTagCompound haze = new NBTTagCompound();
|
||||
haze.setString("type", "haze");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(haze, mop.hitVec.xCoord + rocket.worldObj.rand.nextGaussian() * 15, mop.hitVec.yCoord, mop.hitVec.zCoord + rocket.worldObj.rand.nextGaussian() * 15), new TargetPoint(rocket.dimension, rocket.posX, rocket.posY, rocket.posZ, 150));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(haze, mop.hitVec.xCoord + rocket.worldObj.rand.nextGaussian() * 15, mop.hitVec.yCoord, mop.hitVec.zCoord + rocket.worldObj.rand.nextGaussian() * 15), new TargetPoint(rocket.dimension, rocket.posX, rocket.posY, rocket.posZ, 150));
|
||||
}
|
||||
standardMush(rocket, mop, 15);
|
||||
}};
|
||||
|
||||
|
||||
this.itemTypes[SMALL_TB] = new HIMARSRocket("standard_tb", "himars_standard_tb", 0) {
|
||||
public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) {
|
||||
rocket.worldObj.playSoundEffect(rocket.posX, rocket.posY, rocket.posZ, "hbm:weapon.explosionMedium", 20.0F, 0.9F + rocket.worldObj.rand.nextFloat() * 0.2F);
|
||||
@ -213,7 +213,7 @@ public class ItemAmmoHIMARS extends Item {
|
||||
ExplosionLarge.spawnShrapnels(rocket.worldObj, (int) mop.hitVec.xCoord, (int) mop.hitVec.yCoord, (int) mop.hitVec.zCoord, 30);
|
||||
standardMush(rocket, mop, 20);
|
||||
}};
|
||||
|
||||
|
||||
this.itemTypes[LARGE_TB] = new HIMARSRocket("single_tb", "himars_single_tb", 1) {
|
||||
public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) {
|
||||
rocket.worldObj.playSoundEffect(rocket.posX, rocket.posY, rocket.posZ, "hbm:weapon.explosionMedium", 20.0F, 0.9F + rocket.worldObj.rand.nextFloat() * 0.2F);
|
||||
|
||||
@ -4,9 +4,9 @@ import java.util.List;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.IEquipReceiver;
|
||||
import com.hbm.items.tool.ItemSwordAbility;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.util.ShadyUtil;
|
||||
|
||||
@ -35,101 +35,101 @@ public class ItemCrucible extends ItemSwordAbility implements IEquipReceiver {
|
||||
|
||||
@Override
|
||||
public void onEquip(EntityPlayer player, ItemStack stack) {
|
||||
|
||||
|
||||
if(!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItemDamage() < player.getHeldItem().getMaxDamage()) {
|
||||
|
||||
|
||||
World world = player.worldObj;
|
||||
world.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:weapon.cDeploy", 1.0F, 1.0F);
|
||||
|
||||
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setString("type", "anim");
|
||||
nbt.setString("mode", "crucible");
|
||||
PacketDispatcher.wrapper.sendTo(new AuxParticlePacketNT(nbt, 0, 0, 0), (EntityPlayerMP)player);
|
||||
PacketThreading.createSendToThreadedPacket(new AuxParticlePacketNT(nbt, 0, 0, 0), (EntityPlayerMP)player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) {
|
||||
|
||||
|
||||
if(!(entityLiving instanceof EntityPlayerMP))
|
||||
return false;
|
||||
|
||||
|
||||
if(entityLiving instanceof EntityPlayer && ((EntityPlayer)entityLiving).getUniqueID().toString().equals(ShadyUtil.Tankish)) {
|
||||
stack.setItemDamage(0);
|
||||
}
|
||||
|
||||
|
||||
if(stack.getItemDamage() >= stack.getMaxDamage())
|
||||
return false;
|
||||
|
||||
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setString("type", "anim");
|
||||
nbt.setString("mode", "cSwing");
|
||||
PacketDispatcher.wrapper.sendTo(new AuxParticlePacketNT(nbt, 0, 0, 0), (EntityPlayerMP)entityLiving);
|
||||
|
||||
PacketThreading.createSendToThreadedPacket(new AuxParticlePacketNT(nbt, 0, 0, 0), (EntityPlayerMP)entityLiving);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase victim, EntityLivingBase attacker) {
|
||||
|
||||
|
||||
boolean active = stack.getItemDamage() < stack.getMaxDamage();
|
||||
|
||||
|
||||
if(active) {
|
||||
|
||||
|
||||
attacker.worldObj.playSoundEffect(victim.posX, victim.posY, victim.posZ, "mob.zombie.woodbreak", 1.0F, 0.75F + victim.getRNG().nextFloat() * 0.2F);
|
||||
|
||||
|
||||
if(!attacker.worldObj.isRemote && !victim.isEntityAlive()) {
|
||||
int count = Math.min((int)Math.ceil(victim.getMaxHealth() / 3D), 250);
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "vanillaburst");
|
||||
data.setInteger("count", count * 4);
|
||||
data.setDouble("motion", 0.1D);
|
||||
data.setString("mode", "blockdust");
|
||||
data.setInteger("block", Block.getIdFromBlock(Blocks.redstone_block));
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, victim.posX, victim.posY + victim.height * 0.5, victim.posZ), new TargetPoint(victim.dimension, victim.posX, victim.posY + victim.height * 0.5, victim.posZ, 50));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, victim.posX, victim.posY + victim.height * 0.5, victim.posZ), new TargetPoint(victim.dimension, victim.posX, victim.posY + victim.height * 0.5, victim.posZ, 50));
|
||||
}
|
||||
|
||||
|
||||
if(attacker instanceof EntityPlayer && (((EntityPlayer)attacker).getDisplayName().equals("Tankish") || ((EntityPlayer)attacker).getDisplayName().equals("Tankish020")))
|
||||
return true;
|
||||
|
||||
|
||||
return super.hitEntity(stack, victim, attacker);
|
||||
} else {
|
||||
|
||||
|
||||
if(!attacker.worldObj.isRemote && attacker instanceof EntityPlayer)
|
||||
((EntityPlayer)attacker).addChatComponentMessage(new ChatComponentText("Not enough energy.").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Multimap getAttributeModifiers(ItemStack stack) {
|
||||
|
||||
Multimap multimap = HashMultimap.create();
|
||||
|
||||
|
||||
if(stack.getItemDamage() < stack.getMaxDamage()) {
|
||||
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Tool modifier", (double) this.damage, 0));
|
||||
multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Tool modifier", movement, 1));
|
||||
}
|
||||
|
||||
|
||||
return multimap;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
|
||||
|
||||
String charge = EnumChatFormatting.RED + "Charge [";
|
||||
|
||||
|
||||
for(int i = 2; i >= 0; i--)
|
||||
if(stack.getItemDamage() <= i)
|
||||
charge += "||||||";
|
||||
else
|
||||
charge += " ";
|
||||
|
||||
|
||||
charge += "]";
|
||||
|
||||
|
||||
list.add(charge);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.hbm.items.weapon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import com.hbm.config.GeneralConfig;
|
||||
@ -53,7 +54,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
|
||||
public GunConfiguration mainConfig;
|
||||
public GunConfiguration altConfig;
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean m1;// = false;
|
||||
@SideOnly(Side.CLIENT)
|
||||
@ -63,7 +64,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
mainConfig = config;
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
|
||||
public ItemGunBase(GunConfiguration config, GunConfiguration alt) {
|
||||
this(config);
|
||||
altConfig = alt;
|
||||
@ -71,11 +72,11 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean isCurrentItem) {
|
||||
|
||||
|
||||
if(entity instanceof EntityPlayer) {
|
||||
|
||||
|
||||
isCurrentItem = ((EntityPlayer)entity).getHeldItem() == stack;
|
||||
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT && world.isRemote) {
|
||||
updateClient(stack, world, (EntityPlayer)entity, slot, isCurrentItem);
|
||||
} else {
|
||||
@ -86,15 +87,15 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void updateClient(ItemStack stack, World world, EntityPlayer entity, int slot, boolean isCurrentItem) {
|
||||
|
||||
|
||||
if(!world.isRemote)
|
||||
return;
|
||||
|
||||
|
||||
boolean clickLeft = Mouse.isButtonDown(0);
|
||||
boolean clickRight = Mouse.isButtonDown(1);
|
||||
boolean left = m1;
|
||||
boolean right = m2;
|
||||
|
||||
|
||||
if(isCurrentItem) {
|
||||
if(left && right) {
|
||||
PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(false, (byte) 0));
|
||||
@ -102,21 +103,21 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
m1 = false;
|
||||
m2 = false;
|
||||
}
|
||||
|
||||
|
||||
if(left && !clickLeft) {
|
||||
PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(false, (byte) 0));
|
||||
m1 = false;
|
||||
endActionClient(stack, world, entity, true);
|
||||
}
|
||||
|
||||
|
||||
if(right && !clickRight) {
|
||||
PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(false, (byte) 1));
|
||||
m2 = false;
|
||||
endActionClient(stack, world, entity, false);
|
||||
}
|
||||
|
||||
|
||||
if(mainConfig.reloadType != GunConfiguration.RELOAD_NONE || (altConfig != null && altConfig.reloadType != 0)) {
|
||||
|
||||
|
||||
if(GameSettings.isKeyDown(HbmKeybinds.reloadKey) && Minecraft.getMinecraft().currentScreen == null && (getMag(stack) < mainConfig.ammoCap || hasInfinity(stack, mainConfig))) {
|
||||
PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(true, (byte) 2));
|
||||
setIsReloading(stack, true);
|
||||
@ -125,9 +126,9 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void updateServer(ItemStack stack, World world, EntityPlayer player, int slot, boolean isCurrentItem) {
|
||||
|
||||
|
||||
if(getDelay(stack) > 0 && isCurrentItem)
|
||||
setDelay(stack, getDelay(stack) - 1);
|
||||
|
||||
@ -137,7 +138,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
|
||||
int burstDuration = getBurstDuration(stack);
|
||||
if(burstDuration > 0) {
|
||||
|
||||
|
||||
if(altConfig == null) {
|
||||
if (burstDuration % mainConfig.firingDuration == 0 && tryShoot(stack, world, player, true)) {
|
||||
fire(stack, world, player);
|
||||
@ -155,96 +156,96 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
if(getIsAltDown(stack) && !isCurrentItem) {
|
||||
setIsAltDown(stack, false);
|
||||
}
|
||||
|
||||
|
||||
if(GeneralConfig.enableGuns && mainConfig.firingMode == 1 && getIsMouseDown(stack) && tryShoot(stack, world, player, isCurrentItem)) {
|
||||
fire(stack, world, player);
|
||||
setDelay(stack, mainConfig.rateOfFire);
|
||||
}
|
||||
|
||||
|
||||
if(getIsReloading(stack) && isCurrentItem) {
|
||||
reload2(stack, world, player);
|
||||
}
|
||||
|
||||
|
||||
BulletConfiguration queued = getCasing(stack);
|
||||
int timer = getCasingTimer(stack);
|
||||
|
||||
|
||||
if(queued != null && timer > 0) {
|
||||
|
||||
|
||||
timer--;
|
||||
|
||||
|
||||
if(timer <= 0) {
|
||||
trySpawnCasing(player, mainConfig.ejector, queued, stack);
|
||||
}
|
||||
|
||||
|
||||
setCasingTimer(stack, timer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//whether or not the gun can shoot in its current state
|
||||
protected boolean tryShoot(ItemStack stack, World world, EntityPlayer player, boolean main) {
|
||||
|
||||
|
||||
//cancel reload when trying to shoot if it's a single reload weapon and at least one round is loaded
|
||||
if(getIsReloading(stack) && mainConfig.reloadType == GunConfiguration.RELOAD_SINGLE && getMag(stack) > 0) {
|
||||
setReloadCycle(stack, 0);
|
||||
setIsReloading(stack, false);
|
||||
}
|
||||
|
||||
|
||||
if(main && getDelay(stack) == 0 && !getIsReloading(stack) && getItemWear(stack) < mainConfig.durability) {
|
||||
return hasAmmo(stack, player, main);
|
||||
}
|
||||
|
||||
|
||||
if(!main && altConfig != null && getDelay(stack) == 0 && !getIsReloading(stack) && getItemWear(stack) < mainConfig.durability) {
|
||||
|
||||
|
||||
return hasAmmo(stack, player, false);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public boolean hasAmmo(ItemStack stack, EntityPlayer player, boolean main) {
|
||||
|
||||
|
||||
GunConfiguration config = mainConfig;
|
||||
|
||||
|
||||
if(!main)
|
||||
config = altConfig;
|
||||
|
||||
|
||||
if(config.reloadType == GunConfiguration.RELOAD_NONE) {
|
||||
return getBeltSize(player, getBeltType(player, stack, main)) > 0;
|
||||
|
||||
|
||||
} else {
|
||||
//return getMag(stack) >= 0 + config.roundsPerCycle;
|
||||
return getMag(stack) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//called every time the gun shoots successfully, calls spawnProjectile(), sets item wear
|
||||
protected void fire(ItemStack stack, World world, EntityPlayer player) {
|
||||
|
||||
BulletConfiguration config = null;
|
||||
|
||||
|
||||
if(mainConfig.reloadType == GunConfiguration.RELOAD_NONE) {
|
||||
config = getBeltCfg(player, stack, true);
|
||||
} else {
|
||||
config = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
|
||||
}
|
||||
|
||||
|
||||
int bullets = config.bulletsMin;
|
||||
|
||||
|
||||
for(int k = 0; k < mainConfig.roundsPerCycle; k++) {
|
||||
|
||||
|
||||
if(!hasAmmo(stack, player, true))
|
||||
break;
|
||||
|
||||
|
||||
if(config.bulletsMax > config.bulletsMin)
|
||||
bullets += world.rand.nextInt(config.bulletsMax - config.bulletsMin);
|
||||
|
||||
|
||||
for(int i = 0; i < bullets; i++) {
|
||||
spawnProjectile(world, player, stack, BulletConfigSyncingUtil.getKey(config));
|
||||
}
|
||||
|
||||
|
||||
useUpAmmo(player, stack, true);
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
|
||||
|
||||
int wear = (int) Math.ceil(config.wear / (1F + EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack)));
|
||||
setItemWear(stack, getItemWear(stack) + wear);
|
||||
}
|
||||
@ -253,58 +254,58 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
AnimType animType = getMag(stack) == 0 ? AnimType.CYCLE_EMPTY : AnimType.CYCLE;
|
||||
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(animType.ordinal()), (EntityPlayerMP) player);
|
||||
}
|
||||
|
||||
|
||||
String firingSound = mainConfig.firingSound;
|
||||
if (getMag(stack) == 0 && mainConfig.firingSoundEmpty != null) firingSound = mainConfig.firingSoundEmpty;
|
||||
world.playSoundAtEntity(player, firingSound, mainConfig.firingVolume, mainConfig.firingPitch);
|
||||
|
||||
|
||||
if(mainConfig.ejector != null && !mainConfig.ejector.getAfterReload())
|
||||
queueCasing(player, mainConfig.ejector, config, stack);
|
||||
}
|
||||
|
||||
|
||||
//unlike fire(), being called does not automatically imply success, some things may still have to be handled before spawning the projectile
|
||||
protected void altFire(ItemStack stack, World world, EntityPlayer player) {
|
||||
|
||||
|
||||
if(altConfig == null)
|
||||
return;
|
||||
|
||||
BulletConfiguration config = altConfig.reloadType == GunConfiguration.RELOAD_NONE ? getBeltCfg(player, stack, false) : BulletConfigSyncingUtil.pullConfig(altConfig.config.get(getMagType(stack)));
|
||||
|
||||
|
||||
int bullets = config.bulletsMin;
|
||||
|
||||
|
||||
for(int k = 0; k < altConfig.roundsPerCycle; k++) {
|
||||
|
||||
|
||||
if(altConfig.reloadType != GunConfiguration.RELOAD_NONE && !hasAmmo(stack, player, true))
|
||||
break;
|
||||
|
||||
|
||||
if(config.bulletsMax > config.bulletsMin)
|
||||
bullets += world.rand.nextInt(config.bulletsMax - config.bulletsMin);
|
||||
|
||||
|
||||
for(int i = 0; i < bullets; i++) {
|
||||
spawnProjectile(world, player, stack, BulletConfigSyncingUtil.getKey(config));
|
||||
}
|
||||
|
||||
if(player instanceof EntityPlayerMP)
|
||||
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(AnimType.ALT_CYCLE.ordinal()), (EntityPlayerMP) player);
|
||||
|
||||
|
||||
useUpAmmo(player, stack, false);
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
|
||||
|
||||
setItemWear(stack, getItemWear(stack) + config.wear);
|
||||
}
|
||||
|
||||
|
||||
world.playSoundAtEntity(player, altConfig.firingSound, mainConfig.firingVolume, altConfig.firingPitch);
|
||||
|
||||
|
||||
if(altConfig.ejector != null)
|
||||
queueCasing(player, altConfig.ejector, config, stack);
|
||||
}
|
||||
|
||||
|
||||
//spawns the actual projectile, can be overridden to change projectile entity
|
||||
protected void spawnProjectile(World world, EntityPlayer player, ItemStack stack, int config) {
|
||||
EntityBulletBaseNT bullet = new EntityBulletBaseNT(world, config, player);
|
||||
world.spawnEntityInWorld(bullet);
|
||||
}
|
||||
|
||||
|
||||
//called on click (server side, called by mouse packet) for semi-automatics and specific events
|
||||
public void startAction(ItemStack stack, World world, EntityPlayer player, boolean main) {
|
||||
|
||||
@ -320,7 +321,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
setDelay(stack, mainConfig.rateOfFire);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!main && altConfig != null && tryShoot(stack, world, player, main)) {
|
||||
|
||||
if(altConfig.firingMode == GunConfiguration.FIRE_BURST && getBurstDuration(stack) <= 0){
|
||||
@ -331,38 +332,38 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//called on click (client side, called by mouse click event)
|
||||
public void startActionClient(ItemStack stack, World world, EntityPlayer player, boolean main) { }
|
||||
|
||||
|
||||
//called on click release (server side, called by mouse packet) for release actions like charged shots
|
||||
public void endAction(ItemStack stack, World world, EntityPlayer player, boolean main) { }
|
||||
|
||||
|
||||
//called on click release (client side, called by update cycle)
|
||||
public void endActionClient(ItemStack stack, World world, EntityPlayer player, boolean main) { }
|
||||
|
||||
|
||||
//current reload
|
||||
protected void reload2(ItemStack stack, World world, EntityPlayer player) {
|
||||
|
||||
|
||||
if(getMag(stack) >= mainConfig.ammoCap) {
|
||||
setIsReloading(stack, false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(getReloadCycle(stack) <= 0) {
|
||||
|
||||
|
||||
BulletConfiguration prevCfg = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
|
||||
|
||||
|
||||
BulletConfiguration cfg = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
|
||||
ComparableStack ammo = (ComparableStack) cfg.ammo.copy();
|
||||
|
||||
|
||||
final int countNeeded = (mainConfig.reloadType == GunConfiguration.RELOAD_FULL) ? mainConfig.ammoCap - getMag(stack) : 1;
|
||||
final int availableStacks = InventoryUtil.countAStackMatches(player, ammo, true);
|
||||
final int availableFills = availableStacks * cfg.ammoCount;
|
||||
final boolean hasLoaded = availableFills > 0;
|
||||
final int toAdd = Math.min(availableFills * cfg.ammoCount, countNeeded);
|
||||
final int toConsume = (int) Math.ceil((double) toAdd / cfg.ammoCount);
|
||||
|
||||
|
||||
// Skip logic if cannot reload
|
||||
if(availableFills == 0) {
|
||||
setIsReloading(stack, false);
|
||||
@ -370,7 +371,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
}
|
||||
|
||||
String reloadSound = mainConfig.reloadSoundEmpty != null && getMag(stack) == 0 ? mainConfig.reloadSoundEmpty : mainConfig.reloadSound;
|
||||
|
||||
|
||||
ammo.stacksize = toConsume;
|
||||
setMag(stack, getMag(stack) + toAdd);
|
||||
if (getMag(stack) >= mainConfig.ammoCap) {
|
||||
@ -383,103 +384,103 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
if (availableFills > 1 && !mainConfig.reloadSoundEnd)
|
||||
world.playSoundAtEntity(player, reloadSound, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
||||
if(hasLoaded && mainConfig.reloadSoundEnd)
|
||||
world.playSoundAtEntity(player, reloadSound, 1.0F, 1.0F);
|
||||
|
||||
|
||||
if(mainConfig.ejector != null && mainConfig.ejector.getAfterReload())
|
||||
queueCasing(player, mainConfig.ejector, prevCfg, stack);
|
||||
|
||||
|
||||
InventoryUtil.tryConsumeAStack(player.inventory.mainInventory, 0, player.inventory.mainInventory.length - 1, ammo);
|
||||
} else {
|
||||
setReloadCycle(stack, getReloadCycle(stack) - 1);
|
||||
}
|
||||
|
||||
|
||||
if(stack != player.getHeldItem()) {
|
||||
setReloadCycle(stack, 0);
|
||||
setIsReloading(stack, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//initiates a reload
|
||||
public void startReloadAction(ItemStack stack, World world, EntityPlayer player) {
|
||||
|
||||
|
||||
if(getMag(stack) == 0)
|
||||
resetAmmoType(stack, world, player);
|
||||
|
||||
|
||||
if(player.isSneaking() && hasInfinity(stack, mainConfig)) {
|
||||
|
||||
|
||||
if(getMag(stack) == mainConfig.ammoCap) {
|
||||
setMag(stack, 0);
|
||||
this.resetAmmoType(stack, world, player);
|
||||
world.playSoundAtEntity(player, "tile.piston.out", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(getMag(stack) == mainConfig.ammoCap)
|
||||
return;
|
||||
|
||||
if(getIsReloading(stack))
|
||||
return;
|
||||
|
||||
|
||||
if(!mainConfig.reloadSoundEnd) {
|
||||
String reloadSound = mainConfig.reloadSoundEmpty != null && getMag(stack) == 0 ? mainConfig.reloadSoundEmpty : mainConfig.reloadSound;
|
||||
world.playSoundAtEntity(player, reloadSound, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
||||
if(!world.isRemote) {
|
||||
AnimType reloadType = getMag(stack) == 0 ? AnimType.RELOAD_EMPTY : AnimType.RELOAD;
|
||||
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(reloadType.ordinal()), (EntityPlayerMP) player);
|
||||
}
|
||||
|
||||
|
||||
setIsReloading(stack, true);
|
||||
resetReloadCycle(player, stack);
|
||||
}
|
||||
|
||||
|
||||
public boolean canReload(ItemStack stack, World world, EntityPlayer player) {
|
||||
|
||||
|
||||
if(getMag(stack) == mainConfig.ammoCap && hasInfinity(stack, mainConfig))
|
||||
return true;
|
||||
|
||||
if(getMag(stack) == 0) {
|
||||
|
||||
|
||||
for(int config : mainConfig.config) {
|
||||
if(InventoryUtil.doesPlayerHaveAStack(player, BulletConfigSyncingUtil.pullConfig(config).ammo, false, false)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
ComparableStack ammo = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack))).ammo;
|
||||
return InventoryUtil.doesPlayerHaveAStack(player, ammo, false, false);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//searches the player's inv for next fitting ammo type and changes the gun's mag
|
||||
protected void resetAmmoType(ItemStack stack, World world, EntityPlayer player) {
|
||||
|
||||
for(int config : mainConfig.config) {
|
||||
BulletConfiguration cfg = BulletConfigSyncingUtil.pullConfig(config);
|
||||
|
||||
|
||||
if(InventoryUtil.doesPlayerHaveAStack(player, cfg.ammo, false, false)) {
|
||||
setMagType(stack, mainConfig.config.indexOf(config));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//item mouseover text
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
|
||||
|
||||
|
||||
ComparableStack ammo = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack))).ammo;
|
||||
|
||||
|
||||
list.add(I18nUtil.resolveKey(HbmCollection.ammo, mainConfig.ammoCap > 0 ? I18nUtil.resolveKey(HbmCollection.ammoMag, getMag(stack), mainConfig.ammoCap) : I18nUtil.resolveKey(HbmCollection.ammoBelt)));
|
||||
|
||||
|
||||
try {
|
||||
list.add(I18nUtil.resolveKey(HbmCollection.ammoType, ammo.toStack().getDisplayName()));
|
||||
|
||||
@ -498,22 +499,22 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
|
||||
addAdditionalInformation(stack, list);
|
||||
}
|
||||
|
||||
|
||||
protected void addAdditionalInformation(ItemStack stack, List<String> list) {
|
||||
final BulletConfiguration bulletConfig = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
|
||||
list.add(I18nUtil.resolveKey(HbmCollection.gunDamage, bulletConfig.dmgMin, bulletConfig.dmgMax));
|
||||
if(bulletConfig.bulletsMax != 1)
|
||||
list.add(I18nUtil.resolveKey(HbmCollection.gunPellets, bulletConfig.bulletsMin, bulletConfig.bulletsMax));
|
||||
int dura = Math.max(mainConfig.durability - getItemWear(stack), 0);
|
||||
|
||||
|
||||
list.add(I18nUtil.resolveKey(HbmCollection.durability, dura + " / " + mainConfig.durability));
|
||||
|
||||
|
||||
list.add("");
|
||||
String unloc = "gun.name." + mainConfig.name;
|
||||
String loc = I18nUtil.resolveKey(unloc);
|
||||
list.add(I18nUtil.resolveKey(HbmCollection.gunName, unloc.equals(loc) ? mainConfig.name : loc));
|
||||
list.add(I18nUtil.resolveKey(HbmCollection.gunMaker, I18nUtil.resolveKey(mainConfig.manufacturer.getKey())));
|
||||
|
||||
|
||||
if(!mainConfig.comment.isEmpty()) {
|
||||
list.add("");
|
||||
for(String s : mainConfig.comment)
|
||||
@ -527,67 +528,67 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
list.add("RoF Cooldown: " + getDelay(stack));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//returns ammo item of belt-weapons
|
||||
public static ComparableStack getBeltType(EntityPlayer player, ItemStack stack, boolean main) {
|
||||
ItemGunBase gun = (ItemGunBase)stack.getItem();
|
||||
GunConfiguration guncfg = main ? gun.mainConfig : (gun.altConfig != null ? gun.altConfig : gun.mainConfig);
|
||||
|
||||
for(Integer config : guncfg.config) {
|
||||
|
||||
|
||||
BulletConfiguration cfg = BulletConfigSyncingUtil.pullConfig(config);
|
||||
|
||||
|
||||
if(InventoryUtil.doesPlayerHaveAStack(player, cfg.ammo, false, true)) {
|
||||
return cfg.ammo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return BulletConfigSyncingUtil.pullConfig(guncfg.config.get(0)).ammo;
|
||||
}
|
||||
|
||||
|
||||
//returns BCFG of belt-weapons
|
||||
public static BulletConfiguration getBeltCfg(EntityPlayer player, ItemStack stack, boolean main) {
|
||||
ItemGunBase gun = (ItemGunBase)stack.getItem();
|
||||
GunConfiguration guncfg = main ? gun.mainConfig : (gun.altConfig != null ? gun.altConfig : gun.mainConfig);
|
||||
getBeltType(player, stack, main);
|
||||
|
||||
|
||||
for(int config : guncfg.config) {
|
||||
|
||||
|
||||
BulletConfiguration cfg = BulletConfigSyncingUtil.pullConfig(config);
|
||||
|
||||
|
||||
if(InventoryUtil.doesPlayerHaveAStack(player, cfg.ammo, false, false)) {
|
||||
return cfg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return BulletConfigSyncingUtil.pullConfig(guncfg.config.get(0));
|
||||
}
|
||||
|
||||
//returns ammo capacity of belt-weapons for current ammo
|
||||
public static int getBeltSize(EntityPlayer player, ComparableStack ammo) {
|
||||
|
||||
|
||||
int amount = 0;
|
||||
|
||||
|
||||
for(ItemStack stack : player.inventory.mainInventory) {
|
||||
if(stack != null && ammo.matchesRecipe(stack, true)) {
|
||||
amount += stack.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
|
||||
//reduces ammo count for mag and belt-based weapons, should be called AFTER firing
|
||||
public void useUpAmmo(EntityPlayer player, ItemStack stack, boolean main) {
|
||||
|
||||
|
||||
if(!main && altConfig == null)
|
||||
return;
|
||||
|
||||
|
||||
GunConfiguration config = mainConfig;
|
||||
|
||||
|
||||
if(!main)
|
||||
config = altConfig;
|
||||
|
||||
|
||||
if(hasInfinity(stack, config)) return;
|
||||
if(isTrenchMaster(player) && player.getRNG().nextInt(3) == 0) return;
|
||||
if(hasAoS(player) && player.getRNG().nextInt(3) == 0) return;
|
||||
@ -598,93 +599,93 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
InventoryUtil.doesPlayerHaveAStack(player, getBeltType(player, stack, main), true, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean hasInfinity(ItemStack stack, GunConfiguration config) {
|
||||
return config.allowsInfinity && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;
|
||||
}
|
||||
|
||||
|
||||
/// sets reload cycle to config defult ///
|
||||
public static void resetReloadCycle(EntityPlayer player, ItemStack stack) {
|
||||
writeNBT(stack, "reload", getReloadDuration(player, stack));
|
||||
}
|
||||
|
||||
|
||||
/// if reloading routine is active ///
|
||||
public static void setIsReloading(ItemStack stack, boolean b) {
|
||||
writeNBT(stack, "isReloading", b ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
public static boolean getIsReloading(ItemStack stack) {
|
||||
return readNBT(stack, "isReloading") == 1;
|
||||
}
|
||||
|
||||
|
||||
/// if left mouse button is down ///
|
||||
public static void setIsMouseDown(ItemStack stack, boolean b) {
|
||||
writeNBT(stack, "isMouseDown", b ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
public static boolean getIsMouseDown(ItemStack stack) {
|
||||
return readNBT(stack, "isMouseDown") == 1;
|
||||
}
|
||||
|
||||
|
||||
/// if alt mouse button is down ///
|
||||
public static void setIsAltDown(ItemStack stack, boolean b) {
|
||||
writeNBT(stack, "isAltDown", b ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
public static boolean getIsAltDown(ItemStack stack) {
|
||||
return readNBT(stack, "isAltDown") == 1;
|
||||
}
|
||||
|
||||
|
||||
/// RoF cooldown ///
|
||||
public static void setDelay(ItemStack stack, int i) {
|
||||
writeNBT(stack, "dlay", i);
|
||||
}
|
||||
|
||||
|
||||
public static int getDelay(ItemStack stack) {
|
||||
return readNBT(stack, "dlay");
|
||||
}
|
||||
|
||||
|
||||
/// Gun wear ///
|
||||
public static void setItemWear(ItemStack stack, int i) {
|
||||
writeNBT(stack, "wear", i);
|
||||
}
|
||||
|
||||
|
||||
public static int getItemWear(ItemStack stack) {
|
||||
return readNBT(stack, "wear");
|
||||
}
|
||||
|
||||
|
||||
/// R/W cycle animation timer ///
|
||||
public static void setCycleAnim(ItemStack stack, int i) {
|
||||
writeNBT(stack, "cycle", i);
|
||||
}
|
||||
|
||||
|
||||
public static int getCycleAnim(ItemStack stack) {
|
||||
return readNBT(stack, "cycle");
|
||||
}
|
||||
|
||||
|
||||
/// R/W reload animation timer ///
|
||||
public static void setReloadCycle(ItemStack stack, int i) {
|
||||
writeNBT(stack, "reload", i);
|
||||
}
|
||||
|
||||
|
||||
public static int getReloadCycle(ItemStack stack) {
|
||||
return readNBT(stack, "reload");
|
||||
}
|
||||
|
||||
|
||||
/// magazine capacity ///
|
||||
public static void setMag(ItemStack stack, int i) {
|
||||
writeNBT(stack, "magazine", i);
|
||||
}
|
||||
|
||||
|
||||
public static int getMag(ItemStack stack) {
|
||||
return readNBT(stack, "magazine");
|
||||
}
|
||||
|
||||
|
||||
/// magazine type (int specified by index in bullet config list) ///
|
||||
public static void setMagType(ItemStack stack, int i) {
|
||||
writeNBT(stack, "magazineType", i);
|
||||
}
|
||||
|
||||
|
||||
public static int getMagType(ItemStack stack) {
|
||||
return readNBT(stack, "magazineType");
|
||||
}
|
||||
@ -696,39 +697,39 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
public static int getBurstDuration(ItemStack stack) {
|
||||
return readNBT(stack, "bduration");
|
||||
}
|
||||
|
||||
|
||||
/// queued casing for ejection ///
|
||||
public static void setCasing(ItemStack stack, BulletConfiguration bullet) {
|
||||
writeNBT(stack, "casing", BulletConfigSyncingUtil.getKey(bullet));
|
||||
}
|
||||
|
||||
|
||||
public static BulletConfiguration getCasing(ItemStack stack) {
|
||||
return BulletConfigSyncingUtil.pullConfig(readNBT(stack, "casing"));
|
||||
}
|
||||
|
||||
|
||||
/// timer for ejecting casing ///
|
||||
public static void setCasingTimer(ItemStack stack, int i) {
|
||||
writeNBT(stack, "casingTimer", i);
|
||||
}
|
||||
|
||||
|
||||
public static int getCasingTimer(ItemStack stack) {
|
||||
return readNBT(stack, "casingTimer");
|
||||
}
|
||||
|
||||
|
||||
/// NBT utility ///
|
||||
public static void writeNBT(ItemStack stack, String key, int value) {
|
||||
|
||||
|
||||
if(!stack.hasTagCompound())
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
|
||||
|
||||
stack.stackTagCompound.setInteger(key, value);
|
||||
}
|
||||
|
||||
|
||||
public static int readNBT(ItemStack stack, String key) {
|
||||
|
||||
|
||||
if(!stack.hasTagCompound())
|
||||
return 0;
|
||||
|
||||
|
||||
return stack.stackTagCompound.getInteger(key);
|
||||
}
|
||||
|
||||
@ -740,56 +741,56 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderHUD(Pre event, ElementType type, EntityPlayer player, ItemStack stack) {
|
||||
|
||||
|
||||
ItemGunBase gun = ((ItemGunBase)stack.getItem());
|
||||
GunConfiguration gcfg = gun.mainConfig;
|
||||
|
||||
|
||||
if(type == ElementType.HOTBAR) {
|
||||
int mag = ItemGunBase.getMagType(stack);
|
||||
if(gun.mainConfig.config.size() == 0) return;
|
||||
BulletConfiguration bcfg = BulletConfigSyncingUtil.pullConfig(gun.mainConfig.config.get(mag < gun.mainConfig.config.size() ? mag : 0));
|
||||
|
||||
|
||||
if(bcfg == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ComparableStack ammo = bcfg.ammo;
|
||||
int count = ItemGunBase.getMag(stack);
|
||||
int max = gcfg.ammoCap;
|
||||
boolean showammo = gcfg.showAmmo;
|
||||
|
||||
|
||||
if(gcfg.reloadType == GunConfiguration.RELOAD_NONE) {
|
||||
ammo = ItemGunBase.getBeltType(player, stack, true);
|
||||
count = ItemGunBase.getBeltSize(player, ammo);
|
||||
max = -1;
|
||||
}
|
||||
|
||||
|
||||
int dura = ItemGunBase.getItemWear(stack) * 50 / gcfg.durability;
|
||||
|
||||
|
||||
RenderScreenOverlay.renderAmmo(event.resolution, Minecraft.getMinecraft().ingameGUI, ammo.toStack(), count, max, dura, showammo);
|
||||
|
||||
|
||||
if(gun.altConfig != null && gun.altConfig.reloadType == GunConfiguration.RELOAD_NONE) {
|
||||
ComparableStack oldAmmo = ammo;
|
||||
ammo = ItemGunBase.getBeltType(player, stack, false);
|
||||
|
||||
|
||||
if(!ammo.isApplicable(oldAmmo)) {
|
||||
count = ItemGunBase.getBeltSize(player, ammo);
|
||||
RenderScreenOverlay.renderAmmoAlt(event.resolution, Minecraft.getMinecraft().ingameGUI, ammo.toStack(), count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(type == ElementType.CROSSHAIRS && GeneralConfig.enableCrosshairs) {
|
||||
|
||||
event.setCanceled(true);
|
||||
|
||||
|
||||
if(!(gcfg.hasSights && player.isSneaking()))
|
||||
RenderScreenOverlay.renderCustomCrosshairs(event.resolution, Minecraft.getMinecraft().ingameGUI, ((IHoldableWeapon)player.getHeldItem().getItem()).getCrosshair());
|
||||
else
|
||||
RenderScreenOverlay.renderCustomCrosshairs(event.resolution, Minecraft.getMinecraft().ingameGUI, Crosshair.NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BusAnimation getAnimation(ItemStack stack, AnimType type) {
|
||||
GunConfiguration config = ((ItemGunBase) stack.getItem()).mainConfig;
|
||||
@ -799,20 +800,20 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
}
|
||||
return config.animations.get(type);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onEquip(EntityPlayer player, ItemStack stack) {
|
||||
if(!mainConfig.equipSound.isEmpty() && !player.worldObj.isRemote) {
|
||||
player.worldObj.playSoundAtEntity(player, mainConfig.equipSound, 1, 1);
|
||||
}
|
||||
|
||||
|
||||
if(player instanceof EntityPlayerMP) PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(AnimType.EQUIP.ordinal()), (EntityPlayerMP) player);
|
||||
}
|
||||
|
||||
|
||||
protected static void queueCasing(Entity entity, CasingEjector ejector, BulletConfiguration bullet, ItemStack stack) {
|
||||
|
||||
|
||||
if(ejector == null || bullet == null || bullet.spentCasing == null) return;
|
||||
|
||||
|
||||
if(ejector.getDelay() <= 0) {
|
||||
trySpawnCasing(entity, ejector, bullet, stack);
|
||||
} else {
|
||||
@ -820,13 +821,13 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
setCasingTimer(stack, ejector.getDelay());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected static void trySpawnCasing(Entity entity, CasingEjector ejector, BulletConfiguration bullet, ItemStack stack) {
|
||||
|
||||
|
||||
if(ejector == null) return; //abort if the gun can't eject bullets at all
|
||||
if(bullet == null) return; //abort if there's no valid bullet cfg
|
||||
if(bullet.spentCasing == null) return; //abort if the bullet is caseless
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "casing");
|
||||
data.setFloat("pitch", (float) Math.toRadians(entity.rotationPitch));
|
||||
@ -834,9 +835,9 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
data.setBoolean("crouched", entity.isSneaking());
|
||||
data.setString("name", bullet.spentCasing.getName());
|
||||
data.setInteger("ej", ejector.getId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 50));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 50));
|
||||
}
|
||||
|
||||
|
||||
public static int getReloadDuration(EntityPlayer player, ItemStack stack) {
|
||||
GunConfiguration config = ((ItemGunBase) stack.getItem()).mainConfig;
|
||||
int cycle = config.reloadDuration;
|
||||
@ -844,11 +845,11 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
if(isTrenchMaster(player)) return Math.max(1, cycle / 2);
|
||||
return cycle;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isTrenchMaster(EntityPlayer player) {
|
||||
return player.inventory.armorInventory[2] != null && player.inventory.armorInventory[2].getItem() == ModItems.trenchmaster_plate && ArmorFSB.hasFSBArmor(player);
|
||||
}
|
||||
|
||||
|
||||
public static boolean hasAoS(EntityPlayer player) {
|
||||
if(player.inventory.armorInventory[3] != null) {
|
||||
ItemStack[] mods = ArmorModHandler.pryMods(player.inventory.armorInventory[3]);
|
||||
|
||||
@ -3,7 +3,7 @@ package com.hbm.items.weapon.sedna.factory;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.hbm.entity.mob.*;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.particle.helper.AshesCreator;
|
||||
import com.hbm.particle.helper.SkeletonCreator;
|
||||
@ -18,7 +18,7 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class ConfettiUtil {
|
||||
|
||||
|
||||
public static void decideConfetti(EntityLivingBase entity, DamageSource source) {
|
||||
if(entity.isEntityAlive()) return;
|
||||
if(source.damageType.equals(DamageClass.LASER.name().toLowerCase(Locale.US))) pulverize(entity);
|
||||
@ -47,11 +47,11 @@ public class ConfettiUtil {
|
||||
if(entity instanceof EntityTaintCrab) return;
|
||||
if(entity instanceof EntitySkeleton) return;
|
||||
if(entity instanceof EntitySlime) return;
|
||||
|
||||
|
||||
NBTTagCompound vdat = new NBTTagCompound();
|
||||
vdat.setString("type", "giblets");
|
||||
vdat.setInteger("ent", entity.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(vdat, entity.posX, entity.posY + entity.height * 0.5, entity.posZ), new TargetPoint(entity.dimension, entity.posX, entity.posY + entity.height * 0.5, entity.posZ, 150));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(vdat, entity.posX, entity.posY + entity.height * 0.5, entity.posZ), new TargetPoint(entity.dimension, entity.posX, entity.posY + entity.height * 0.5, entity.posZ, 150));
|
||||
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.zombie.woodbreak", 2.0F, 0.95F + entity.getRNG().nextFloat() * 0.2F);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import java.util.function.BiConsumer;
|
||||
|
||||
import com.hbm.config.ClientConfig;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
|
||||
import com.hbm.items.weapon.sedna.Receiver;
|
||||
import com.hbm.items.weapon.sedna.impl.ItemGunStinger;
|
||||
@ -12,7 +13,6 @@ import com.hbm.items.weapon.sedna.mags.IMagazine;
|
||||
import com.hbm.items.weapon.sedna.mods.WeaponModManager;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.particle.SpentCasing;
|
||||
import com.hbm.particle.helper.CasingCreator;
|
||||
@ -32,13 +32,13 @@ import net.minecraft.util.MovingObjectPosition;
|
||||
* The orchestra only knows what animation is or was playing and how long it started, but not if it is still active.
|
||||
* Orchestras are useful for things like playing server-side sound, spawning casings or sending particle packets.*/
|
||||
public class Orchestras {
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> DEBUG_ORCHESTRA = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
|
||||
|
||||
if(type == AnimType.RELOAD) {
|
||||
if(timer == 3) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverCock", 1F, 1F);
|
||||
if(timer == 10) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
|
||||
@ -64,7 +64,7 @@ public class Orchestras {
|
||||
if(timer == 16) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_PEPPERBOX = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
@ -90,7 +90,7 @@ public class Orchestras {
|
||||
if(timer == 45) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 1F, 0.6F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_ATLAS = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
@ -118,7 +118,7 @@ public class Orchestras {
|
||||
if(timer == 34) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_DANI = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
@ -146,7 +146,7 @@ public class Orchestras {
|
||||
if(timer == 34) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_HENRY = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
@ -183,7 +183,7 @@ public class Orchestras {
|
||||
if(timer == 12) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.leverCock", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_GREASEGUN = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
@ -203,7 +203,7 @@ public class Orchestras {
|
||||
if(type == AnimType.CYCLE_DRY) {
|
||||
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 1F, 0.8F);
|
||||
if(timer == 11) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.pistolCock", 1F, 0.8F);
|
||||
|
||||
|
||||
}
|
||||
if(type == AnimType.RELOAD) {
|
||||
if(timer == 2) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magRemove", 1F, 1F);
|
||||
@ -219,7 +219,7 @@ public class Orchestras {
|
||||
if(timer == 26) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.pistolCock", 1F, 0.8F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_MARESLEG = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
@ -254,7 +254,7 @@ public class Orchestras {
|
||||
if(timer == 8) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.leverCock", 1F, 0.8F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_MARESLEG_SHORT = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
@ -289,14 +289,14 @@ public class Orchestras {
|
||||
if(timer == 8) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.leverCock", 1F, 0.8F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_MARESLEG_AKIMBO = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
|
||||
|
||||
|
||||
if(type == AnimType.CYCLE) {
|
||||
if(timer == 14) {
|
||||
int offset = ctx.configIndex == 0 ? -1 : 1;
|
||||
@ -306,10 +306,10 @@ public class Orchestras {
|
||||
if(timer == 8) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.leverCock", 1F, 0.8F);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ORCHESTRA_MARESLEG_SHORT.accept(stack, ctx);
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_FLAREGUN = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
@ -348,13 +348,13 @@ public class Orchestras {
|
||||
if(entity.worldObj.isRemote) return;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
|
||||
|
||||
if(type == AnimType.RELOAD) {
|
||||
if(timer == 3) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverCock", 1F, 1F);
|
||||
if(timer == 10) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
|
||||
if(timer == 34) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
|
||||
if(timer == 40) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 1F);
|
||||
|
||||
|
||||
if(timer == 16) {
|
||||
Receiver rec = ctx.config.getReceivers(stack)[0];
|
||||
IMagazine mag = rec.getMagazine(stack);
|
||||
@ -381,7 +381,7 @@ public class Orchestras {
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
|
||||
|
||||
|
||||
if(type == AnimType.CYCLE) {
|
||||
if(timer == 1) {
|
||||
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
|
||||
@ -415,7 +415,7 @@ public class Orchestras {
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
|
||||
|
||||
|
||||
if(ClientConfig.GUN_ANIMS_LEGACY.get()) {
|
||||
if(type == AnimType.CYCLE) {
|
||||
if(timer == 0) {
|
||||
@ -467,7 +467,7 @@ public class Orchestras {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_LIBERATOR = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
@ -510,14 +510,14 @@ public class Orchestras {
|
||||
if(timer == 20) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 0.9F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_CONGOLAKE = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
|
||||
|
||||
|
||||
if(type == AnimType.CYCLE) {
|
||||
if(timer == 15) {
|
||||
IMagazine mag = ctx.config.getReceivers(stack)[0].getMagazine(stack);
|
||||
@ -533,15 +533,15 @@ public class Orchestras {
|
||||
if(timer == 27) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.glClose", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_FLAMER = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
|
||||
|
||||
if(type == AnimType.CYCLE && entity.worldObj.isRemote) {
|
||||
AudioWrapper runningAudio = ItemGunBaseNT.loopedSounds.get(entity);
|
||||
|
||||
|
||||
if(timer < 5) {
|
||||
//start sound
|
||||
if(runningAudio == null || !runningAudio.isPlaying()) {
|
||||
@ -565,7 +565,7 @@ public class Orchestras {
|
||||
if(runningAudio != null && runningAudio.isPlaying()) runningAudio.stopSound();
|
||||
}
|
||||
if(entity.worldObj.isRemote) return;
|
||||
|
||||
|
||||
if(type == AnimType.RELOAD) {
|
||||
if(timer == 15) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.openLatch", 1F, 1F);
|
||||
if(timer == 35) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.impact", 0.5F, 1F);
|
||||
@ -574,13 +574,13 @@ public class Orchestras {
|
||||
if(timer == 85) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.pressureValve", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_FLAMER_DAYBREAKER = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
|
||||
|
||||
if(type == AnimType.RELOAD) {
|
||||
if(timer == 15) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.openLatch", 1F, 1F);
|
||||
if(timer == 35) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.impact", 0.5F, 1F);
|
||||
@ -589,14 +589,14 @@ public class Orchestras {
|
||||
if(timer == 85) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.pressureValve", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_LAG = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
|
||||
|
||||
|
||||
if(type == AnimType.CYCLE) {
|
||||
if(timer == 1) {
|
||||
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
|
||||
@ -606,7 +606,7 @@ public class Orchestras {
|
||||
if(type == AnimType.CYCLE_DRY) {
|
||||
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 1F, 1F);
|
||||
if(timer == 8) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverCock", 1F, 1F);
|
||||
|
||||
|
||||
}
|
||||
if(type == AnimType.RELOAD) {
|
||||
if(timer == 8) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magRemove", 1F, 1F);
|
||||
@ -619,7 +619,7 @@ public class Orchestras {
|
||||
if(timer == 36) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magInsert", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_UZI = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
@ -639,7 +639,7 @@ public class Orchestras {
|
||||
if(type == AnimType.CYCLE_DRY) {
|
||||
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 1F, 1F);
|
||||
if(timer == 8) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.pistolCock", 1F, 1F);
|
||||
|
||||
|
||||
}
|
||||
if(type == AnimType.RELOAD) {
|
||||
if(timer == 4) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magRemove", 1F, 1F);
|
||||
@ -651,7 +651,7 @@ public class Orchestras {
|
||||
if(timer == 31) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.pistolCock", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_UZI_AKIMBO = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
@ -671,7 +671,7 @@ public class Orchestras {
|
||||
if(type == AnimType.CYCLE_DRY) {
|
||||
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 1F, 1F);
|
||||
if(timer == 8) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.pistolCock", 1F, 1F);
|
||||
|
||||
|
||||
}
|
||||
if(type == AnimType.RELOAD) {
|
||||
if(timer == 4) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magRemove", 1F, 1F);
|
||||
@ -683,14 +683,14 @@ public class Orchestras {
|
||||
if(timer == 31) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.pistolCock", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_SPAS = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
|
||||
|
||||
|
||||
if(type == AnimType.CYCLE || type == AnimType.ALT_CYCLE) {
|
||||
if(timer == 8) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.shotgunCock", 1F, 1F);
|
||||
if(timer == 10) {
|
||||
@ -723,25 +723,25 @@ public class Orchestras {
|
||||
if(timer == 29) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.shotgunCockClose", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_PANERSCHRECK = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
|
||||
|
||||
if(type == AnimType.RELOAD) {
|
||||
if(timer == 30) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.insertCanister", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_G3 = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
|
||||
|
||||
|
||||
if(type == AnimType.CYCLE) {
|
||||
if(timer == 0) {
|
||||
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
|
||||
@ -751,7 +751,7 @@ public class Orchestras {
|
||||
if(type == AnimType.CYCLE_DRY) {
|
||||
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 1F, 0.8F);
|
||||
if(timer == 5) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.pistolCock", 1F, 0.9F);
|
||||
|
||||
|
||||
}
|
||||
if(type == AnimType.RELOAD) {
|
||||
if(timer == 2) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magRemove", 1F, 1F);
|
||||
@ -770,7 +770,7 @@ public class Orchestras {
|
||||
if(timer == 28) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_STINGER = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
@ -795,20 +795,20 @@ public class Orchestras {
|
||||
if(runningAudio != null && runningAudio.isPlaying()) runningAudio.stopSound();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(type == AnimType.RELOAD) {
|
||||
if(timer == 30) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.insertCanister", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_CHEMTHROWER = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
|
||||
|
||||
if(type == AnimType.CYCLE && entity.worldObj.isRemote) {
|
||||
AudioWrapper runningAudio = ItemGunBaseNT.loopedSounds.get(entity);
|
||||
|
||||
|
||||
if(timer < 5) {
|
||||
//start sound
|
||||
if(runningAudio == null || !runningAudio.isPlaying()) {
|
||||
@ -832,7 +832,7 @@ public class Orchestras {
|
||||
if(runningAudio != null && runningAudio.isPlaying()) runningAudio.stopSound();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_M2 = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
@ -843,7 +843,7 @@ public class Orchestras {
|
||||
if(type == AnimType.EQUIP) {
|
||||
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:turret.howard_reload", 1F, 1F);
|
||||
}
|
||||
|
||||
|
||||
if(type == AnimType.CYCLE) {
|
||||
if(timer == 0) {
|
||||
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
|
||||
@ -851,7 +851,7 @@ public class Orchestras {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_SHREDDER = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
@ -874,7 +874,7 @@ public class Orchestras {
|
||||
if(timer == 28) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magInsert", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_SHREDDER_SEXY = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
@ -886,7 +886,7 @@ public class Orchestras {
|
||||
ItemGunBaseNT.setTimer(stack, 0, 20);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(type == AnimType.CYCLE_DRY) {
|
||||
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 1F, 1F);
|
||||
}
|
||||
@ -899,25 +899,25 @@ public class Orchestras {
|
||||
if(timer == 28) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magInsert", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_QUADRO = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
|
||||
|
||||
if(type == AnimType.RELOAD) {
|
||||
if(timer == 30) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.insertCanister", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_MINIGUN = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
|
||||
|
||||
|
||||
if(type == AnimType.CYCLE) {
|
||||
if(timer == 0) {
|
||||
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
|
||||
@ -936,7 +936,7 @@ public class Orchestras {
|
||||
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverSpin", 1F, 0.75F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_MISSILE_LAUNCHER = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
@ -951,13 +951,13 @@ public class Orchestras {
|
||||
if(timer == 30) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.insertCanister", 1F, 1F);
|
||||
if(timer == 42) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.boltClose", 1F, 0.9F);
|
||||
}
|
||||
|
||||
|
||||
if(type == AnimType.JAMMED || type == AnimType.INSPECT) {
|
||||
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.boltOpen", 1F, 0.9F);
|
||||
if(timer == 27) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.boltClose", 1F, 0.9F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_TESLA = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
@ -975,7 +975,7 @@ public class Orchestras {
|
||||
if(timer == 12) entity.worldObj.playSoundAtEntity(entity, "hbm:block.squeakyToy", 0.25F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_STG77 = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
@ -1005,7 +1005,7 @@ public class Orchestras {
|
||||
if(type == AnimType.INSPECT) {
|
||||
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 0.9F);
|
||||
if(timer == 10) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
|
||||
|
||||
|
||||
if(timer == 114) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
|
||||
if(timer == 124) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 1F);
|
||||
}
|
||||
@ -1032,21 +1032,21 @@ public class Orchestras {
|
||||
if(type == AnimType.INSPECT) {
|
||||
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 0.9F);
|
||||
if(timer == 11) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
|
||||
|
||||
|
||||
if(timer == 72) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
|
||||
if(timer == 84) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 1F);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_TAU = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
|
||||
|
||||
if(type == AnimType.SPINUP && entity.worldObj.isRemote) {
|
||||
AudioWrapper runningAudio = ItemGunBaseNT.loopedSounds.get(entity);
|
||||
|
||||
|
||||
if(timer < 300) {
|
||||
if(runningAudio == null || !runningAudio.isPlaying()) {
|
||||
AudioWrapper audio = MainRegistry.proxy.getLoopedSound("hbm:weapon.fire.tauLoop", (float) entity.posX, (float) entity.posY, (float) entity.posZ, 1F, 15F, 0.75F, 10);
|
||||
@ -1069,15 +1069,15 @@ public class Orchestras {
|
||||
if(runningAudio != null && runningAudio.isPlaying()) runningAudio.stopSound();
|
||||
}
|
||||
if(entity.worldObj.isRemote) return;
|
||||
|
||||
|
||||
if(type == AnimType.CYCLE) {
|
||||
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.fire.tau", 0.5F, 0.9F + entity.getRNG().nextFloat() * 0.2F);
|
||||
}
|
||||
|
||||
|
||||
if(type == AnimType.ALT_CYCLE) {
|
||||
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.fire.tau", 0.5F, 0.7F + entity.getRNG().nextFloat() * 0.2F);
|
||||
}
|
||||
|
||||
|
||||
if(type == AnimType.SPINUP) {
|
||||
if(timer % 10 == 0 && timer < 130) {
|
||||
IMagazine mag = ctx.config.getReceivers(stack)[0].getMagazine(stack);
|
||||
@ -1087,14 +1087,14 @@ public class Orchestras {
|
||||
}
|
||||
mag.useUpAmmo(stack, ctx.inventory, 1);
|
||||
}
|
||||
|
||||
|
||||
if(timer > 200) {
|
||||
ItemGunBaseNT.playAnimation(ctx.getPlayer(), stack, AnimType.CYCLE_DRY, ctx.configIndex);
|
||||
|
||||
|
||||
entity.attackEntityFrom(ModDamageSource.tauBlast, 1_000F);
|
||||
|
||||
|
||||
ItemGunBaseNT.setWear(stack, ctx.configIndex, Math.min(ItemGunBaseNT.getWear(stack, ctx.configIndex) + 10_000F, ctx.config.getDurability(stack)));
|
||||
|
||||
|
||||
entity.worldObj.playSoundEffect(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ, "hbm:entity.ufoBlast", 5.0F, 0.9F);
|
||||
entity.worldObj.playSoundEffect(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ, "fireworks.blast", 5.0F, 0.5F);
|
||||
|
||||
@ -1108,24 +1108,24 @@ public class Orchestras {
|
||||
data.setFloat("pitch", -60F + 60F * i);
|
||||
data.setFloat("yaw", yaw);
|
||||
data.setFloat("scale", 2F);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ),
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ),
|
||||
new TargetPoint(entity.dimension, entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ, 100));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_FATMAN = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
|
||||
|
||||
if(type == AnimType.RELOAD) {
|
||||
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.fatmanFull", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_LASRIFLE = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
@ -1135,38 +1135,38 @@ public class Orchestras {
|
||||
if(type == AnimType.CYCLE_DRY) {
|
||||
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 1F, 1.5F);
|
||||
}
|
||||
|
||||
|
||||
if(type == AnimType.RELOAD) {
|
||||
if(timer == 2) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
|
||||
if(timer == 18) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.impact", 0.25F, 1F);
|
||||
if(timer == 30) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magInsert", 1F, 1F);
|
||||
if(timer == 38) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 1F);
|
||||
}
|
||||
|
||||
|
||||
if(type == AnimType.INSPECT) {
|
||||
if(timer == 2) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
|
||||
if(timer == 12) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magInsert", 1F, 1F);
|
||||
if(timer == 20) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 1F);
|
||||
}
|
||||
|
||||
|
||||
if(type == AnimType.JAMMED) {
|
||||
if(timer == 2) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
|
||||
if(timer == 22) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magInsert", 1F, 1F);
|
||||
if(timer == 30) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_COILGUN = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
|
||||
|
||||
if(type == AnimType.RELOAD) {
|
||||
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.coilgunReload", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_HANGMAN = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
@ -1176,9 +1176,9 @@ public class Orchestras {
|
||||
if(type == AnimType.CYCLE_DRY) {
|
||||
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 1F, 1F);
|
||||
}
|
||||
|
||||
|
||||
if(type == AnimType.RELOAD) {
|
||||
|
||||
|
||||
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverCock", 1F, 0.8F);
|
||||
if(timer == 5) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallRemove", 1F, 0.8F);
|
||||
if(timer == 25) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 1F);
|
||||
@ -1191,7 +1191,7 @@ public class Orchestras {
|
||||
if(casing != null) for(int i = 0; i < mag.getCapacity(stack); i++) CasingCreator.composeEffect(entity.worldObj, entity, 0.25, -0.25, -0.125, -0.05, 0, 0, 0.01, -6.5F + (float)entity.getRNG().nextGaussian() * 3F, (float)entity.getRNG().nextGaussian() * 5F, casing.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(type == AnimType.INSPECT) {
|
||||
if(timer == 16 && ctx.getPlayer() != null) {
|
||||
MovingObjectPosition mop = EntityDamageUtil.getMouseOver(ctx.getPlayer(), 3.0D);
|
||||
@ -1210,7 +1210,7 @@ public class Orchestras {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(type == AnimType.JAMMED) {
|
||||
if(timer == 10) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverCock", 1F, 0.8F);
|
||||
if(timer == 15) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallRemove", 1F, 0.8F);
|
||||
@ -1218,51 +1218,51 @@ public class Orchestras {
|
||||
if(timer == 25) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverCock", 1F, 0.75F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_BOLTER = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
|
||||
|
||||
|
||||
if(type == AnimType.CYCLE) {
|
||||
if(timer == 1) {
|
||||
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
|
||||
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.5, aiming ? 0 : -0.125, aiming ? -0.0625 : -0.25D, 0, 0.18, -0.12, 0.01, -10F + (float)entity.getRNG().nextGaussian() * 5F, 10F + entity.getRNG().nextFloat() * 10F, casing.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(type == AnimType.RELOAD) {
|
||||
if(timer == 5) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magRemove", 1F, 1F);
|
||||
if(timer == 26) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magInsert", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_FOLLY = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
|
||||
|
||||
if(type == AnimType.RELOAD) {
|
||||
if(timer == 20) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.screw", 1F, 1F);
|
||||
if(timer == 80) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.insertRocket", 1F, 1F);
|
||||
if(timer == 120) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.screw", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_DOUBLE_BARREL = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||
|
||||
|
||||
if(type == AnimType.RELOAD) {
|
||||
if(timer == 5) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverCock", 1F, 0.75F);
|
||||
if(timer == 19) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallInsert", 1F, 0.9F);
|
||||
if(timer == 29) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 0.8F);
|
||||
|
||||
|
||||
if(timer == 12) {
|
||||
IMagazine mag = ctx.config.getReceivers(stack)[0].getMagazine(stack);
|
||||
int toEject = mag.getAmountAfterReload(stack) - mag.getAmount(stack, ctx.inventory);
|
||||
@ -1270,17 +1270,17 @@ public class Orchestras {
|
||||
if(casing != null) for(int i = 0; i < toEject; i++) CasingCreator.composeEffect(entity.worldObj, entity, 0, -0.1875, -0.375D, -0.24, 0.18, 0, 0.01, -20F + (float)entity.getRNG().nextGaussian() * 5F, (float)entity.getRNG().nextGaussian() * 2.5F, casing.getName(), true, 60, 0.5D, 20);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(type == AnimType.INSPECT) {
|
||||
if(timer == 5) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverCock", 1F, 0.75F);
|
||||
if(timer == 19) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 0.8F);
|
||||
}
|
||||
|
||||
|
||||
if(type == AnimType.CYCLE_DRY) {
|
||||
if(timer == 2) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 1F, 1F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_ABERRATOR = (stack, ctx) -> {
|
||||
EntityLivingBase entity = ctx.entity;
|
||||
if(entity.worldObj.isRemote) return;
|
||||
@ -1293,7 +1293,7 @@ public class Orchestras {
|
||||
if(timer == 32) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallInsert", 1F, 0.75F);
|
||||
if(timer == 42) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.pistolCock", 1F, 0.75F);
|
||||
}
|
||||
|
||||
|
||||
if(type == AnimType.CYCLE) {
|
||||
if(timer == 1) {
|
||||
int cba = (stack.getItem() == ModItems.gun_aberrator_eott && ctx.configIndex == 0) ? -1 : 1;
|
||||
|
||||
@ -13,6 +13,7 @@ import com.hbm.explosion.vanillant.standard.EntityProcessorCrossSmooth;
|
||||
import com.hbm.explosion.vanillant.standard.ExplosionEffectWeapon;
|
||||
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
|
||||
import com.hbm.handler.radiation.ChunkRadiationManager;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.weapon.sedna.BulletConfig;
|
||||
import com.hbm.items.weapon.sedna.Crosshair;
|
||||
@ -24,7 +25,6 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
|
||||
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
|
||||
import com.hbm.items.weapon.sedna.mags.MagazineSingleReload;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.render.anim.BusAnimation;
|
||||
import com.hbm.render.anim.BusAnimationSequence;
|
||||
@ -44,37 +44,37 @@ public class XFactoryCatapult {
|
||||
public static BulletConfig nuke_high;
|
||||
public static BulletConfig nuke_tots;
|
||||
public static BulletConfig nuke_hive;
|
||||
|
||||
|
||||
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_NUKE_STANDARD = (bullet, mop) -> {
|
||||
if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3 && mop.entityHit == bullet.getThrower()) return;
|
||||
if(bullet.isDead) return;
|
||||
bullet.setDead();
|
||||
|
||||
|
||||
ExplosionVNT vnt = new ExplosionVNT(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 10);
|
||||
vnt.setEntityProcessor(new EntityProcessorCrossSmooth(2, bullet.damage).withRangeMod(1.5F));
|
||||
vnt.setPlayerProcessor(new PlayerProcessorStandard());
|
||||
vnt.explode();
|
||||
|
||||
|
||||
incrementRad(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 1F);
|
||||
spawnMush(bullet, mop);
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_NUKE_DEMO = (bullet, mop) -> {
|
||||
if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3 && mop.entityHit == bullet.getThrower()) return;
|
||||
if(bullet.isDead) return;
|
||||
bullet.setDead();
|
||||
|
||||
|
||||
ExplosionVNT vnt = new ExplosionVNT(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 10);
|
||||
vnt.setBlockAllocator(new BlockAllocatorStandard(64));
|
||||
vnt.setBlockProcessor(new BlockProcessorStandard());
|
||||
vnt.setEntityProcessor(new EntityProcessorCrossSmooth(2, bullet.damage).withRangeMod(1.5F));
|
||||
vnt.setPlayerProcessor(new PlayerProcessorStandard());
|
||||
vnt.explode();
|
||||
|
||||
|
||||
incrementRad(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 1.5F);
|
||||
spawnMush(bullet, mop);
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_NUKE_HIGH = (bullet, mop) -> {
|
||||
if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3 && mop.entityHit == bullet.getThrower()) return;
|
||||
if(bullet.isDead) return;
|
||||
@ -82,7 +82,7 @@ public class XFactoryCatapult {
|
||||
bullet.worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(bullet.worldObj, 35, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord));
|
||||
spawnMush(bullet, mop);
|
||||
};
|
||||
|
||||
|
||||
public static void incrementRad(World world, double posX, double posY, double posZ, float mult) {
|
||||
for(int i = -2; i <= 2; i++) { for(int j = -2; j <= 2; j++) {
|
||||
if(Math.abs(i) + Math.abs(j) < 4) {
|
||||
@ -91,33 +91,33 @@ public class XFactoryCatapult {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void spawnMush(EntityBulletBaseMK4 bullet, MovingObjectPosition mop) {
|
||||
bullet.worldObj.playSoundEffect(mop.hitVec.xCoord, mop.hitVec.yCoord + 0.5, mop.hitVec.zCoord, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "muke");
|
||||
data.setBoolean("balefire", MainRegistry.polaroidID == 11 || bullet.worldObj.rand.nextInt(100) == 0);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, mop.hitVec.xCoord, mop.hitVec.yCoord + 0.5, mop.hitVec.zCoord), new TargetPoint(bullet.dimension, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 250));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, mop.hitVec.xCoord, mop.hitVec.yCoord + 0.5, mop.hitVec.zCoord), new TargetPoint(bullet.dimension, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 250));
|
||||
}
|
||||
|
||||
|
||||
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_NUKE_TINYTOT = (bullet, mop) -> {
|
||||
if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3 && mop.entityHit == bullet.getThrower()) return;
|
||||
if(bullet.isDead) return;
|
||||
bullet.setDead();
|
||||
|
||||
|
||||
ExplosionVNT vnt = new ExplosionVNT(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 5);
|
||||
vnt.setEntityProcessor(new EntityProcessorCrossSmooth(2, bullet.damage).withRangeMod(1.5F));
|
||||
vnt.setPlayerProcessor(new PlayerProcessorStandard());
|
||||
vnt.explode();
|
||||
|
||||
|
||||
incrementRad(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 0.25F);
|
||||
bullet.worldObj.playSoundEffect(mop.hitVec.xCoord, mop.hitVec.yCoord + 0.5, mop.hitVec.zCoord, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "tinytot");
|
||||
data.setBoolean("balefire", MainRegistry.polaroidID == 11 || bullet.worldObj.rand.nextInt(100) == 0);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, mop.hitVec.xCoord, mop.hitVec.yCoord + 0.5, mop.hitVec.zCoord), new TargetPoint(bullet.dimension, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 250));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, mop.hitVec.xCoord, mop.hitVec.yCoord + 0.5, mop.hitVec.zCoord), new TargetPoint(bullet.dimension, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 250));
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_NUKE_HIVE = (bullet, mop) -> {
|
||||
if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3 && mop.entityHit == bullet.getThrower()) return;
|
||||
if(bullet.isDead) return;
|
||||
@ -128,7 +128,7 @@ public class XFactoryCatapult {
|
||||
vnt.setSFX(new ExplosionEffectWeapon(10, 2.5F, 1F));
|
||||
vnt.explode();
|
||||
};
|
||||
|
||||
|
||||
public static void init() {
|
||||
|
||||
nuke_standard = new BulletConfig().setItem(EnumAmmo.NUKE_STANDARD).setLife(300).setVel(3F).setGrav(0.025F).setOnImpact(LAMBDA_NUKE_STANDARD);
|
||||
@ -148,7 +148,7 @@ public class XFactoryCatapult {
|
||||
.anim(LAMBDA_FATMAN_ANIMS).orchestra(Orchestras.ORCHESTRA_FATMAN)
|
||||
).setUnlocalizedName("gun_fatman");
|
||||
}
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_FATMAN = (stack, ctx) -> { };
|
||||
|
||||
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_FATMAN_ANIMS = (stack, type) -> {
|
||||
|
||||
@ -9,6 +9,7 @@ import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.standard.EntityProcessorCrossSmooth;
|
||||
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
|
||||
import com.hbm.extprop.HbmLivingProps;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.weapon.sedna.BulletConfig;
|
||||
import com.hbm.items.weapon.sedna.Crosshair;
|
||||
@ -22,7 +23,6 @@ import com.hbm.items.weapon.sedna.mags.MagazineBelt;
|
||||
import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.render.anim.BusAnimation;
|
||||
import com.hbm.render.anim.BusAnimationSequence;
|
||||
@ -44,7 +44,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class XFactoryEnergy {
|
||||
|
||||
|
||||
public static final ResourceLocation scope_luna = new ResourceLocation(RefStrings.MODID, "textures/misc/scope_luna.png");
|
||||
|
||||
public static BulletConfig energy_tesla;
|
||||
@ -53,16 +53,16 @@ public class XFactoryEnergy {
|
||||
public static BulletConfig energy_las;
|
||||
public static BulletConfig energy_las_overcharge;
|
||||
public static BulletConfig energy_las_ir;
|
||||
|
||||
|
||||
public static BiConsumer<EntityBulletBeamBase, MovingObjectPosition> LAMBDA_LIGHTNING_HIT = (beam, mop) -> {
|
||||
|
||||
|
||||
if(mop.typeOfHit == mop.typeOfHit.BLOCK) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(mop.sideHit);
|
||||
mop.hitVec.xCoord += dir.offsetX * 0.5;
|
||||
mop.hitVec.yCoord += dir.offsetY * 0.5;
|
||||
mop.hitVec.zCoord += dir.offsetZ * 0.5;
|
||||
}
|
||||
|
||||
|
||||
ExplosionVNT vnt = new ExplosionVNT(beam.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 2F, beam.getThrower());
|
||||
vnt.setEntityProcessor(new EntityProcessorCrossSmooth(1, beam.damage).setDamageClass(beam.config.dmgClass));
|
||||
vnt.setPlayerProcessor(new PlayerProcessorStandard());
|
||||
@ -80,10 +80,10 @@ public class XFactoryEnergy {
|
||||
data.setFloat("pitch", -60F + 60F * i);
|
||||
data.setFloat("yaw", yaw);
|
||||
data.setFloat("scale", 2F);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord),
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord),
|
||||
new TargetPoint(beam.worldObj.provider.dimensionId, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 100));
|
||||
}
|
||||
|
||||
|
||||
if(mop.typeOfHit == mop.typeOfHit.ENTITY) {
|
||||
if(mop.entityHit instanceof EntityLivingBase) {
|
||||
((EntityLivingBase) mop.entityHit).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 60, 9));
|
||||
@ -91,10 +91,10 @@ public class XFactoryEnergy {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<EntityBulletBeamBase, MovingObjectPosition> LAMBDA_IR_HIT = (beam, mop) -> {
|
||||
BulletConfig.LAMBDA_STANDARD_BEAM_HIT.accept(beam, mop);
|
||||
|
||||
|
||||
if(mop.typeOfHit == mop.typeOfHit.ENTITY) {
|
||||
if(mop.entityHit instanceof EntityLivingBase) {
|
||||
EntityLivingBase living = (EntityLivingBase) mop.entityHit;
|
||||
@ -113,13 +113,13 @@ public class XFactoryEnergy {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EntityFireLingering fire = new EntityFireLingering(beam.worldObj).setArea(2, 1).setDuration(100).setType(EntityFireLingering.TYPE_DIESEL);
|
||||
fire.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
||||
beam.worldObj.spawnEntityInWorld(fire);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static void init() {
|
||||
|
||||
energy_tesla = new BulletConfig().setItem(EnumAmmo.CAPACITOR).setCasing(new ItemStack(ModItems.ingot_polymer, 2), 4).setupDamageClass(DamageClass.ELECTRIC).setBeam().setSpread(0.0F).setLife(5).setRenderRotations(false).setDoesPenetrate(true)
|
||||
@ -153,7 +153,7 @@ public class XFactoryEnergy {
|
||||
.anim(LAMBDA_LASRIFLE).orchestra(Orchestras.ORCHESTRA_LASRIFLE)
|
||||
).setUnlocalizedName("gun_lasrifle");
|
||||
}
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_ENERGY = (stack, ctx) -> { };
|
||||
|
||||
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_TESLA_ANIMS = (stack, type) -> {
|
||||
@ -171,7 +171,7 @@ public class XFactoryEnergy {
|
||||
.addBus("YOMI", new BusAnimationSequence().addPos(8, -4, 0, 0).addPos(4, -1, 0, 500, IType.SIN_DOWN).addPos(4, -1, 0, 1000).addPos(6, -6, 0, 500, IType.SIN_UP))
|
||||
.addBus("SQUEEZE", new BusAnimationSequence().addPos(1, 1, 1, 0).addPos(1, 1, 1, 750).addPos(1, 1, 0.5, 125).addPos(1, 1, 1, 125));
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
@ -197,7 +197,7 @@ public class XFactoryEnergy {
|
||||
.addBus("MAG", new BusAnimationSequence().addPos(0, 0, 0, 350).addPos(0, -2, 0, 200, IType.SIN_UP).addPos(0, -0.25, 0, 250, IType.SIN_FULL).addPos(0, -0.25, 0, 150).addPos(0, 0, 0, 350))
|
||||
.addBus("EQUIP", new BusAnimationSequence().addPos(0, 0, 0, 800).addPos(-2, 0, 0, 100, IType.SIN_DOWN).addPos(0, 0, 0, 100, IType.SIN_FULL));
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import com.hbm.entity.effect.EntityNukeTorex;
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK5;
|
||||
import com.hbm.entity.projectile.EntityBulletBaseMK4;
|
||||
import com.hbm.entity.projectile.EntityBulletBeamBase;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.weapon.sedna.BulletConfig;
|
||||
import com.hbm.items.weapon.sedna.Crosshair;
|
||||
@ -20,7 +21,6 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
|
||||
import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
|
||||
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmoSecret;
|
||||
import com.hbm.items.weapon.sedna.mags.MagazineSingleReload;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.render.anim.BusAnimation;
|
||||
import com.hbm.render.anim.BusAnimationSequence;
|
||||
@ -46,12 +46,12 @@ public class XFactoryFolly {
|
||||
|
||||
public static BulletConfig folly_sm;
|
||||
public static BulletConfig folly_nuke;
|
||||
|
||||
|
||||
public static Consumer<Entity> LAMBDA_SM_UPDATE = (entity) -> {
|
||||
if(entity.worldObj.isRemote) return;
|
||||
EntityBulletBeamBase beam = (EntityBulletBeamBase) entity;
|
||||
Vec3NT dir = new Vec3NT(beam.headingX, beam.headingY, beam.headingZ).normalizeSelf();
|
||||
|
||||
|
||||
if(beam.ticksExisted < 50) {
|
||||
double spacing = 10;
|
||||
double dist = beam.ticksExisted * spacing;
|
||||
@ -63,20 +63,20 @@ public class XFactoryFolly {
|
||||
data.setFloat("pitch", (float) beam.rotationPitch + 90);
|
||||
data.setFloat("yaw", (float) -beam.rotationYaw);
|
||||
data.setFloat("scale", 2F + beam.ticksExisted / (float)(beam.beamLength / spacing) * 3F);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, beam.posX + dir.xCoord * dist, beam.posY + dir.yCoord * dist, beam.posZ + dir.zCoord * dist), new TargetPoint(beam.dimension, beam.posX, beam.posY, beam.posZ, 250));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, beam.posX + dir.xCoord * dist, beam.posY + dir.yCoord * dist, beam.posZ + dir.zCoord * dist), new TargetPoint(beam.dimension, beam.posX, beam.posY, beam.posZ, 250));
|
||||
}
|
||||
|
||||
|
||||
if(entity.ticksExisted != 2) return;
|
||||
|
||||
|
||||
if(beam.thrower != null) ContaminationUtil.contaminate(beam.thrower, HazardType.RADIATION, ContaminationType.CREATIVE, 150F);
|
||||
|
||||
List<Entity> entities = beam.worldObj.getEntitiesWithinAABBExcludingEntity(beam, beam.boundingBox.addCoord(beam.headingX, beam.headingY, beam.headingZ).expand(1.0D, 1.0D, 1.0D));
|
||||
|
||||
|
||||
for(int i = 1; i < beam.beamLength; i += 2) {
|
||||
int x = (int) Math.floor(beam.posX + dir.xCoord * i);
|
||||
int y = (int) Math.floor(beam.posY + dir.yCoord * i);
|
||||
int z = (int) Math.floor(beam.posZ + dir.zCoord * i);
|
||||
|
||||
|
||||
for(int ix = x - 1; ix <= x + 1; ix++) for(int iy = y - 1; iy <= y + 1; iy++) for(int iz = z - 1; iz <= z + 1; iz++) {
|
||||
if(iy > 0 && iy < 256) beam.worldObj.setBlock(ix, iy, iz, Blocks.air);
|
||||
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(ix - 1, iy - 1, iz - 1, ix + 2, iy + 2, iz + 2);
|
||||
@ -87,7 +87,7 @@ public class XFactoryFolly {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_NUKE_IMPACT = (bullet, mop) -> {
|
||||
if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 2) return;
|
||||
if(bullet.isDead) return;
|
||||
@ -95,7 +95,7 @@ public class XFactoryFolly {
|
||||
bullet.worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(bullet.worldObj, 100, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord));
|
||||
EntityNukeTorex.statFac(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 100);
|
||||
};
|
||||
|
||||
|
||||
public static void init() {
|
||||
|
||||
folly_sm = new BulletConfig().setItem(EnumAmmoSecret.FOLLY_SM).setupDamageClass(DamageClass.SUBATOMIC).setBeam().setLife(100).setVel(2F).setGrav(0.015D).setRenderRotations(false).setSpectral(true).setDoesPenetrate(true)
|
||||
@ -114,7 +114,7 @@ public class XFactoryFolly {
|
||||
.anim(LAMBDA_FOLLY_ANIMS).orchestra(Orchestras.ORCHESTRA_FOLLY)
|
||||
).setUnlocalizedName("gun_folly");
|
||||
}
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_TOGGLE_AIM = (stack, ctx) -> {
|
||||
if(ItemGunBaseNT.getState(stack, ctx.configIndex) == GunState.IDLE) {
|
||||
boolean wasAiming = ItemGunBaseNT.getIsAiming(stack);
|
||||
@ -122,18 +122,18 @@ public class XFactoryFolly {
|
||||
if(!wasAiming) ItemGunBaseNT.playAnimation(ctx.getPlayer(), stack, AnimType.SPINUP, ctx.configIndex);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_FIRE = (stack, ctx) -> {
|
||||
Lego.doStandardFire(stack, ctx, AnimType.CYCLE, false);
|
||||
};
|
||||
|
||||
|
||||
public static BiFunction<ItemStack, LambdaContext, Boolean> LAMBDA_CAN_FIRE = (stack, ctx) -> {
|
||||
if(!ItemGunBaseNT.getIsAiming(stack)) return false;
|
||||
if(ItemGunBaseNT.getLastAnim(stack, ctx.configIndex) != AnimType.SPINUP) return false;
|
||||
if(ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex) < 100) return false;
|
||||
return ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmount(stack, ctx.inventory) > 0;
|
||||
};
|
||||
|
||||
|
||||
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_FOLLY = (stack, ctx) -> {
|
||||
ItemGunBaseNT.setupRecoil(25, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5));
|
||||
};
|
||||
@ -151,7 +151,7 @@ public class XFactoryFolly {
|
||||
.addBus("BREECH", new BusAnimationSequence().addPos(0, 0, 0, 1000).addPos(0, 0, -0.5, 1000, IType.SIN_FULL).addPos(0, -4, -0.5, 1000, IType.SIN_FULL).addPos(0, -4, -0.5, 2000).addPos(0, 0, -0.5, 1000, IType.SIN_FULL).addPos(0, 0, 0, 1000, IType.SIN_FULL))
|
||||
.addBus("SHELL", new BusAnimationSequence().addPos(0, -4, -4.5, 0).addPos(0, -4, -4.5, 3000).addPos(0, 0, -4.5, 1000, IType.SIN_FULL).addPos(0, 0, 0, 500, IType.SIN_UP));
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
@ -513,6 +513,9 @@ public class HbmWorldGen implements IWorldGenerator {
|
||||
safe.setPins(rand.nextInt(999) + 1);
|
||||
safe.lock();
|
||||
|
||||
if(rand.nextInt(10) < 3) // 30% chance; those safes have been sitting there for ages, they gotta have some spiders in them
|
||||
safe.fillWithSpiders();
|
||||
|
||||
if(GeneralConfig.enableDebugMode)
|
||||
MainRegistry.logger.info("[Debug] Successfully spawned safe at " + x + " " + (y + 1) +" " + z);
|
||||
}
|
||||
@ -703,8 +706,8 @@ public class HbmWorldGen implements IWorldGenerator {
|
||||
int d = 16 + rand.nextInt(96);
|
||||
|
||||
for(int y = d - 5; y <= d; y++)
|
||||
if(world.getBlock(x, y + 1, z) == Blocks.air && world.getBlock(x, y, z) == Blocks.netherrack)
|
||||
world.setBlock(x, y, z, ModBlocks.ore_nether_smoldering);
|
||||
if(world.getBlock(x, y + 1, z) == Blocks.air && world.getBlock(x, y, z) == Blocks.netherrack)
|
||||
world.setBlock(x, y, z, ModBlocks.ore_nether_smoldering);
|
||||
}
|
||||
|
||||
for(int k = 0; k < 1; k++){
|
||||
@ -713,8 +716,8 @@ public class HbmWorldGen implements IWorldGenerator {
|
||||
int d = 16 + rand.nextInt(96);
|
||||
|
||||
for(int y = d - 5; y <= d; y++)
|
||||
if(world.getBlock(x, y + 1, z) == Blocks.air && world.getBlock(x, y, z) == Blocks.netherrack)
|
||||
world.setBlock(x, y, z, ModBlocks.geysir_nether);
|
||||
if(world.getBlock(x, y + 1, z) == Blocks.air && world.getBlock(x, y, z) == Blocks.netherrack)
|
||||
world.setBlock(x, y, z, ModBlocks.geysir_nether);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,8 @@ package com.hbm.main;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.generic.BlockAshes;
|
||||
import com.hbm.blocks.generic.BlockCrate;
|
||||
import com.hbm.blocks.generic.BlockStorageCrate;
|
||||
import com.hbm.config.ClientConfig;
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.entity.mob.EntityHunterChopper;
|
||||
@ -59,6 +61,7 @@ import com.hbm.tileentity.bomb.TileEntityNukeCustom;
|
||||
import com.hbm.tileentity.bomb.TileEntityNukeCustom.CustomNukeEntry;
|
||||
import com.hbm.tileentity.bomb.TileEntityNukeCustom.EnumEntryType;
|
||||
import com.hbm.tileentity.machine.TileEntityNukeFurnace;
|
||||
import com.hbm.tileentity.machine.storage.TileEntityCrateBase;
|
||||
import com.hbm.util.*;
|
||||
import com.hbm.util.ArmorRegistry.HazardClass;
|
||||
import com.hbm.wiaj.GuiWorldInAJar;
|
||||
@ -100,6 +103,7 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.play.client.C03PacketPlayer;
|
||||
import net.minecraft.network.play.client.C0CPacketInput;
|
||||
@ -117,6 +121,7 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import net.minecraftforge.client.event.sound.PlaySoundEvent17;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.hbm.main;
|
||||
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.packet.PrecompiledPacket;
|
||||
import com.hbm.packet.threading.ThreadedPacket;
|
||||
import cpw.mods.fml.common.network.FMLEmbeddedChannel;
|
||||
import cpw.mods.fml.common.network.FMLOutboundHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
@ -21,6 +21,7 @@ import io.netty.handler.codec.CodecException;
|
||||
import io.netty.handler.codec.MessageToMessageCodec;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
@ -55,8 +56,8 @@ public class NetworkHandler {
|
||||
discriminator = types.get(msgClass);
|
||||
outboundBuf.writeByte(discriminator);
|
||||
|
||||
if(msg instanceof PrecompiledPacket) // Precompiled packet to avoid race conditions/speed up serialization.
|
||||
outboundBuf.writeBytes(((PrecompiledPacket) msg).getPreBuf());
|
||||
if(msg instanceof ThreadedPacket) // Precompiled packet to avoid race conditions/speed up serialization.
|
||||
outboundBuf.writeBytes(((ThreadedPacket) msg).getCompiledBuffer());
|
||||
else if(msg instanceof IMessage)
|
||||
((IMessage) msg).toBytes(outboundBuf);
|
||||
else
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
package com.hbm.packet;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
/**
|
||||
* Abstract class for precompiled packets. This should be used if the packet is going to be threaded through the `PacketThreading` handler.
|
||||
*/
|
||||
public abstract class PrecompiledPacket implements IMessage {
|
||||
|
||||
ByteBuf preCompiledBuf;
|
||||
|
||||
/**
|
||||
* Returns a precompiled buffer used to avoid race conditions when sending certain packets in threads.
|
||||
* @return The precompiled packet in a `ByteBuf`.
|
||||
*/
|
||||
public ByteBuf getPreBuf() {
|
||||
if(preCompiledBuf == null || preCompiledBuf.readableBytes() <= 0 /* No data written */)
|
||||
this.makePreBuf();
|
||||
return preCompiledBuf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forcefully creates the precompiled buffer, use `getPreBuf()` whenever possible.
|
||||
*/
|
||||
public void makePreBuf() {
|
||||
if(preCompiledBuf != null)
|
||||
preCompiledBuf.release();
|
||||
|
||||
preCompiledBuf = Unpooled.buffer();
|
||||
|
||||
this.toBytes(preCompiledBuf); // Create buffer and read data to it.
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.hbm.packet.threading;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
/**
|
||||
* Abstract class for precompiled packets.
|
||||
* Contains no content of its own; purely for distinction between precompiling and normal packets.
|
||||
* */
|
||||
public abstract class PrecompiledPacket extends ThreadedPacket { }
|
||||
31
src/main/java/com/hbm/packet/threading/ThreadedPacket.java
Normal file
31
src/main/java/com/hbm/packet/threading/ThreadedPacket.java
Normal file
@ -0,0 +1,31 @@
|
||||
package com.hbm.packet.threading;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
/**
|
||||
* This is the base class for any packets passing through the PacketThreading system.
|
||||
*/
|
||||
public abstract class ThreadedPacket implements IMessage {
|
||||
|
||||
ByteBuf compiledBuffer;
|
||||
|
||||
public void compile() {
|
||||
if(compiledBuffer != null)
|
||||
compiledBuffer.release();
|
||||
|
||||
compiledBuffer = Unpooled.buffer();
|
||||
|
||||
this.toBytes(compiledBuffer); // Create buffer and read data to it.
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the compiled buffer.
|
||||
*/
|
||||
public ByteBuf getCompiledBuffer() {
|
||||
if(compiledBuffer == null || compiledBuffer.readableBytes() <= 0 /* No data written */)
|
||||
this.compile();
|
||||
return compiledBuffer;
|
||||
}
|
||||
}
|
||||
@ -1,56 +1,40 @@
|
||||
package com.hbm.packet.toclient;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.hbm.main.MainRegistry;
|
||||
|
||||
import com.hbm.packet.threading.ThreadedPacket;
|
||||
import com.hbm.util.BufferUtil;
|
||||
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 io.netty.buffer.Unpooled;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
|
||||
public class AuxParticlePacketNT implements IMessage {
|
||||
public class AuxParticlePacketNT extends ThreadedPacket {
|
||||
|
||||
PacketBuffer buffer;
|
||||
ByteBuf buffer;
|
||||
|
||||
NBTTagCompound nbt;
|
||||
|
||||
public AuxParticlePacketNT() { }
|
||||
|
||||
public AuxParticlePacketNT(NBTTagCompound nbt, double x, double y, double z) {
|
||||
|
||||
this.buffer = new PacketBuffer(Unpooled.buffer());
|
||||
|
||||
nbt.setDouble("posX", x);
|
||||
nbt.setDouble("posY", y);
|
||||
nbt.setDouble("posZ", z);
|
||||
|
||||
try {
|
||||
buffer.writeNBTTagCompoundToBuffer(nbt);
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.nbt = nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
|
||||
if (buffer == null) {
|
||||
buffer = new PacketBuffer(Unpooled.buffer());
|
||||
}
|
||||
buffer.writeBytes(buf);
|
||||
this.nbt = BufferUtil.readNBT(buf);
|
||||
this.buffer = buf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
|
||||
if (buffer == null) {
|
||||
buffer = new PacketBuffer(Unpooled.buffer());
|
||||
}
|
||||
buf.writeBytes(buffer);
|
||||
BufferUtil.writeNBT(buf, nbt);
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<AuxParticlePacketNT, IMessage> {
|
||||
@ -61,22 +45,12 @@ public class AuxParticlePacketNT implements IMessage {
|
||||
if(Minecraft.getMinecraft().theWorld == null)
|
||||
return null;
|
||||
|
||||
if(m.nbt != null)
|
||||
MainRegistry.proxy.effectNT(m.nbt);
|
||||
|
||||
try {
|
||||
|
||||
NBTTagCompound nbt = m.buffer.readNBTTagCompoundFromBuffer();
|
||||
|
||||
if(nbt != null)
|
||||
MainRegistry.proxy.effectNT(nbt);
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
m.buffer.release();
|
||||
}
|
||||
m.buffer.release();
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.hbm.packet.toclient;
|
||||
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PrecompiledPacket;
|
||||
import com.hbm.packet.threading.PrecompiledPacket;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
|
||||
@ -3,7 +3,7 @@ package com.hbm.packet.toclient;
|
||||
import com.hbm.extprop.HbmLivingProps;
|
||||
import com.hbm.extprop.HbmPlayerProps;
|
||||
|
||||
import com.hbm.packet.PrecompiledPacket;
|
||||
import com.hbm.packet.threading.PrecompiledPacket;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
|
||||
@ -2,7 +2,7 @@ package com.hbm.particle.helper;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -24,8 +24,8 @@ public interface IParticleCreator {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void makeParticle(World world, EntityPlayer player, TextureManager texman, Random rand, double x, double y, double z, NBTTagCompound data);
|
||||
|
||||
|
||||
public static void sendPacket(World world, double x, double y, double z, int range, NBTTagCompound data) {
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(world.provider.dimensionId, x, y, z, range));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(world.provider.dimensionId, x, y, z, range));
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,7 +68,8 @@ public class TileEntityLoadedBase extends TileEntity implements ILoadedTile, IBu
|
||||
if(worldObj.isRemote) return;
|
||||
|
||||
BufPacket packet = new BufPacket(xCoord, yCoord, zCoord, this);
|
||||
ByteBuf preBuf = packet.getPreBuf();
|
||||
|
||||
ByteBuf preBuf = packet.getCompiledBuffer();
|
||||
|
||||
// Don't send unnecessary packets, except for maybe one every second or so.
|
||||
// If we stop sending duplicate packets entirely, this causes issues when
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.hbm.tileentity.bomb;
|
||||
|
||||
import com.hbm.entity.item.EntityFireworks;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -13,70 +13,70 @@ public class TileEntityFireworks extends TileEntity {
|
||||
public int color = 0xff0000;
|
||||
public String message = "NUCLEAR TECH";
|
||||
public int charges;
|
||||
|
||||
|
||||
int index;
|
||||
int delay;
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
|
||||
if(worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord) && !message.isEmpty() && charges > 0) {
|
||||
|
||||
|
||||
delay--;
|
||||
|
||||
|
||||
if(delay <= 0) {
|
||||
delay = 30;
|
||||
|
||||
|
||||
int c = (int)(message.charAt(index));
|
||||
|
||||
|
||||
int mod = index % 9;
|
||||
|
||||
double offX = (mod / 3 - 1) * 0.3125;
|
||||
double offZ = (mod % 3 - 1) * 0.3125;
|
||||
|
||||
|
||||
EntityFireworks fireworks = new EntityFireworks(worldObj, xCoord + 0.5 + offX, yCoord + 1.5, zCoord + 0.5 + offZ, color, c);
|
||||
worldObj.spawnEntityInWorld(fireworks);
|
||||
|
||||
|
||||
worldObj.playSoundAtEntity(fireworks, "hbm:weapon.rocketFlame", 3.0F, 1.0F);
|
||||
|
||||
|
||||
charges--;
|
||||
this.markDirty();
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "vanillaExt");
|
||||
data.setString("mode", "flame");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.5 + offX, yCoord + 1.125, zCoord + 0.5 + offZ), new TargetPoint(this.worldObj.provider.dimensionId, xCoord + 0.5 + offX, yCoord + 1.125, zCoord + 0.5 + offZ, 100));
|
||||
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, xCoord + 0.5 + offX, yCoord + 1.125, zCoord + 0.5 + offZ), new TargetPoint(this.worldObj.provider.dimensionId, xCoord + 0.5 + offX, yCoord + 1.125, zCoord + 0.5 + offZ, 100));
|
||||
|
||||
index++;
|
||||
|
||||
|
||||
if(index >= message.length()) {
|
||||
index = 0;
|
||||
delay = 100;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
delay = 0;
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
|
||||
this.charges = nbt.getInteger("charges");
|
||||
this.color = nbt.getInteger("color");
|
||||
this.message = nbt.getString("message");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
|
||||
nbt.setInteger("charges", charges);
|
||||
nbt.setInteger("color", color);
|
||||
nbt.setString("message", message);
|
||||
|
||||
@ -7,7 +7,7 @@ import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.entity.particle.EntityOrangeFX;
|
||||
import com.hbm.entity.projectile.EntityShrapnel;
|
||||
import com.hbm.entity.projectile.EntityWaterSplash;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -23,18 +23,18 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityGeysir extends TileEntity {
|
||||
|
||||
|
||||
int timer;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
if (!this.worldObj.isRemote && worldObj.getBlock(xCoord, yCoord + 1, zCoord) == Blocks.air) {
|
||||
|
||||
|
||||
timer--;
|
||||
|
||||
|
||||
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
|
||||
|
||||
if(timer <= 0) {
|
||||
timer = getDelay();
|
||||
|
||||
@ -43,44 +43,44 @@ public class TileEntityGeysir extends TileEntity {
|
||||
else
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 2);
|
||||
}
|
||||
|
||||
|
||||
if(meta == 1) {
|
||||
perform();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void water() {
|
||||
|
||||
|
||||
EntityWaterSplash fx = new EntityWaterSplash(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5);
|
||||
|
||||
fx.motionX = worldObj.rand.nextGaussian() * 0.35;
|
||||
fx.motionZ = worldObj.rand.nextGaussian() * 0.35;
|
||||
fx.motionY = 2;
|
||||
|
||||
|
||||
worldObj.spawnEntityInWorld(fx);
|
||||
}
|
||||
|
||||
|
||||
private void chlorine() {
|
||||
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
EntityOrangeFX fx = new EntityOrangeFX(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, 0.0, 0.0, 0.0);
|
||||
|
||||
|
||||
fx.motionX = worldObj.rand.nextGaussian() * 0.45;
|
||||
fx.motionZ = worldObj.rand.nextGaussian() * 0.45;
|
||||
fx.motionY = timer * 0.3;
|
||||
|
||||
|
||||
worldObj.spawnEntityInWorld(fx);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void vapor() {
|
||||
|
||||
List<Entity> entities = this.worldObj.getEntitiesWithinAABB(Entity.class,
|
||||
AxisAlignedBB.getBoundingBox(this.xCoord - 0.5, this.yCoord + 0.5, this.zCoord - 0.5, this.xCoord + 1.5,
|
||||
this.yCoord + 2, this.zCoord + 1.5));
|
||||
|
||||
|
||||
if (!entities.isEmpty()) {
|
||||
for (Entity e : entities) {
|
||||
|
||||
@ -89,72 +89,72 @@ public class TileEntityGeysir extends TileEntity {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void fire() {
|
||||
|
||||
|
||||
int range = 32;
|
||||
if(worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5).expand(range, range, range)).isEmpty())
|
||||
return;
|
||||
|
||||
|
||||
if(worldObj.rand.nextInt(3) == 0) {
|
||||
EntityShrapnel fx = new EntityShrapnel(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5);
|
||||
fx.motionX = worldObj.rand.nextGaussian() * 0.05;
|
||||
fx.motionZ = worldObj.rand.nextGaussian() * 0.05;
|
||||
fx.motionY = 0.5 + worldObj.rand.nextDouble() * timer * 0.01;
|
||||
|
||||
|
||||
worldObj.spawnEntityInWorld(fx);
|
||||
}
|
||||
|
||||
|
||||
if(timer % 2 == 0) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "gasfire");
|
||||
data.setDouble("mX", worldObj.rand.nextGaussian() * 0.05);
|
||||
data.setDouble("mY", 0.2);
|
||||
data.setDouble("mZ", worldObj.rand.nextGaussian() * 0.05);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, this.xCoord + 0.5F, this.yCoord + 1.1F, this.zCoord + 0.5F), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 75));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, this.xCoord + 0.5F, this.yCoord + 1.1F, this.zCoord + 0.5F), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 75));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private int getDelay() {
|
||||
|
||||
|
||||
Block b = worldObj.getBlock(xCoord, yCoord, zCoord);
|
||||
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
Random rand = worldObj.rand;
|
||||
|
||||
|
||||
if(b == ModBlocks.geysir_water) {
|
||||
|
||||
|
||||
return (meta == 0 ? 30 : 100 + rand.nextInt(40));
|
||||
|
||||
|
||||
} else if(b == ModBlocks.geysir_chlorine) {
|
||||
|
||||
|
||||
return (meta == 0 ? 20 : 400 + rand.nextInt(100));
|
||||
|
||||
|
||||
} else if(b == ModBlocks.geysir_vapor) {
|
||||
|
||||
|
||||
return (meta == 0 ? 20 : 30 + rand.nextInt(20));
|
||||
|
||||
|
||||
} else if(b == ModBlocks.geysir_nether) {
|
||||
|
||||
|
||||
return (meta == 0 ? (rand.nextBoolean() ? 300 : 450) : 80 + rand.nextInt(60));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
private void perform() {
|
||||
|
||||
Block b = worldObj.getBlock(xCoord, yCoord, zCoord);
|
||||
|
||||
|
||||
if(b == ModBlocks.geysir_water) {
|
||||
water();
|
||||
|
||||
|
||||
} else if(b == ModBlocks.geysir_chlorine) {
|
||||
chlorine();
|
||||
|
||||
|
||||
} else if(b == ModBlocks.geysir_vapor) {
|
||||
vapor();
|
||||
|
||||
|
||||
} else if(b == ModBlocks.geysir_nether) {
|
||||
fire();
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.handler.pollution.PollutionHandler;
|
||||
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.inventory.container.ContainerCrucible;
|
||||
import com.hbm.inventory.gui.GUICrucible;
|
||||
import com.hbm.inventory.material.MaterialShapes;
|
||||
@ -18,7 +19,6 @@ import com.hbm.inventory.material.NTMMaterial;
|
||||
import com.hbm.inventory.recipes.CrucibleRecipes;
|
||||
import com.hbm.inventory.recipes.CrucibleRecipes.CrucibleRecipe;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.tileentity.IConfigurableMachine;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
@ -171,7 +171,7 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
|
||||
data.setFloat("off", 0.625F);
|
||||
data.setFloat("base", 0.625F);
|
||||
data.setFloat("len", Math.max(1F, yCoord - (float) (Math.ceil(impact.yCoord) - 0.875)));
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.5D + dir.offsetX * 1.875D, yCoord, zCoord + 0.5D + dir.offsetZ * 1.875D), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 50));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, xCoord + 0.5D + dir.offsetX * 1.875D, yCoord, zCoord + 0.5D + dir.offsetZ * 1.875D), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 50));
|
||||
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
|
||||
data.setFloat("off", 0.625F);
|
||||
data.setFloat("base", 0.625F);
|
||||
data.setFloat("len", Math.max(1F, yCoord - (float) (Math.ceil(impact.yCoord) - 0.875)));
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.5D + dir.offsetX * 1.875D, yCoord, zCoord + 0.5D + dir.offsetZ * 1.875D), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 50));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, xCoord + 0.5D + dir.offsetX * 1.875D, yCoord, zCoord + 0.5D + dir.offsetZ * 1.875D), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 50));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.inventory.UpgradeManagerNT;
|
||||
import com.hbm.inventory.container.ContainerElectrolyserFluid;
|
||||
@ -24,7 +25,6 @@ import com.hbm.inventory.recipes.ElectrolyserMetalRecipes.ElectrolysisMetalRecip
|
||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.*;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
@ -180,7 +180,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
||||
data.setFloat("off", 0.625F);
|
||||
data.setFloat("base", 0.625F);
|
||||
data.setFloat("len", Math.max(1F, yCoord - (float) (Math.ceil(impact.yCoord) - 0.875) + 2));
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.5D + dir.offsetX * 5.875D, yCoord + 2, zCoord + 0.5D + dir.offsetZ * 5.875D), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 50));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, xCoord + 0.5D + dir.offsetX * 5.875D, yCoord + 2, zCoord + 0.5D + dir.offsetZ * 5.875D), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 50));
|
||||
|
||||
if(this.leftStack.amount <= 0) this.leftStack = null;
|
||||
}
|
||||
@ -203,7 +203,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
||||
data.setFloat("off", 0.625F);
|
||||
data.setFloat("base", 0.625F);
|
||||
data.setFloat("len", Math.max(1F, yCoord - (float) (Math.ceil(impact.yCoord) - 0.875) + 2));
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.5D + dir.offsetX * 5.875D, yCoord + 2, zCoord + 0.5D + dir.offsetZ * 5.875D), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 50));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, xCoord + 0.5D + dir.offsetX * 5.875D, yCoord + 2, zCoord + 0.5D + dir.offsetZ * 5.875D), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 50));
|
||||
|
||||
if(this.rightStack.amount <= 0) this.rightStack = null;
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.inventory.material.Mats;
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.inventory.material.NTMMaterial;
|
||||
import com.hbm.util.CrucibleUtil;
|
||||
@ -27,16 +27,16 @@ public class TileEntityFoundryOutlet extends TileEntityFoundryBase{
|
||||
/** inverts redstone behavior, i.e. when TRUE, the outlet will be blocked by default and only open with redstone */
|
||||
public boolean invertRedstone = false;
|
||||
public boolean lastClosed = false;
|
||||
|
||||
|
||||
/** if TRUE, prevents all fluids from flowing through the outlet and renders a small barrier */
|
||||
public boolean isClosed() {
|
||||
return invertRedstone ^ this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
|
||||
if(worldObj.isRemote) {
|
||||
boolean isClosed = isClosed();
|
||||
if(this.lastClosed != isClosed || this.filter != this.lastFilter) {
|
||||
@ -49,47 +49,47 @@ public class TileEntityFoundryOutlet extends TileEntityFoundryBase{
|
||||
|
||||
@Override public boolean canAcceptPartialPour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) { return false; }
|
||||
@Override public MaterialStack pour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) { return stack; }
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canAcceptPartialFlow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) {
|
||||
|
||||
|
||||
if(filter != null && (filter != stack.material ^ invertFilter)) return false;
|
||||
if(isClosed()) return false;
|
||||
if(side != ForgeDirection.getOrientation(this.getBlockMetadata()).getOpposite()) return false;
|
||||
|
||||
|
||||
Vec3 start = Vec3.createVectorHelper(x + 0.5, y - 0.125, z + 0.5);
|
||||
Vec3 end = Vec3.createVectorHelper(x + 0.5, y + 0.125 - 4, z + 0.5);
|
||||
|
||||
|
||||
MovingObjectPosition[] mop = new MovingObjectPosition[1];
|
||||
ICrucibleAcceptor acc = CrucibleUtil.getPouringTarget(world, start, end, mop);
|
||||
|
||||
|
||||
if(acc == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return acc.canAcceptPartialPour(world, mop[0].blockX, mop[0].blockY, mop[0].blockZ, mop[0].hitVec.xCoord, mop[0].hitVec.yCoord, mop[0].hitVec.zCoord, ForgeDirection.UP, stack);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MaterialStack flow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) {
|
||||
|
||||
|
||||
Vec3 start = Vec3.createVectorHelper(x + 0.5, y - 0.125, z + 0.5);
|
||||
Vec3 end = Vec3.createVectorHelper(x + 0.5, y + 0.125 - 4, z + 0.5);
|
||||
|
||||
|
||||
MovingObjectPosition[] mop = new MovingObjectPosition[1];
|
||||
ICrucibleAcceptor acc = CrucibleUtil.getPouringTarget(world, start, end, mop);
|
||||
|
||||
|
||||
if(acc == null)
|
||||
return stack;
|
||||
|
||||
|
||||
MaterialStack didPour = acc.pour(world, mop[0].blockX, mop[0].blockY, mop[0].blockZ, mop[0].hitVec.xCoord, mop[0].hitVec.yCoord, mop[0].hitVec.zCoord, ForgeDirection.UP, stack);
|
||||
|
||||
|
||||
|
||||
if(stack != null) {
|
||||
|
||||
|
||||
ForgeDirection dir = side.getOpposite();
|
||||
double hitY = mop[0].blockY + 1;
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "foundry");
|
||||
data.setInteger("color", stack.material.moltenColor);
|
||||
@ -97,10 +97,10 @@ public class TileEntityFoundryOutlet extends TileEntityFoundryBase{
|
||||
data.setFloat("off", 0.375F);
|
||||
data.setFloat("base", 0F);
|
||||
data.setFloat("len", Math.max(1F, yCoord - (float) (Math.ceil(hitY) - 0.875)));
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.5D - dir.offsetX * 0.125, yCoord + 0.125, zCoord + 0.5D - dir.offsetZ * 0.125), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord, zCoord + 0.5, 50));
|
||||
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, xCoord + 0.5D - dir.offsetX * 0.125, yCoord + 0.125, zCoord + 0.5D - dir.offsetZ * 0.125), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord, zCoord + 0.5, 50));
|
||||
|
||||
}
|
||||
|
||||
|
||||
return didPour;
|
||||
}
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@ package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.generic.BlockDynamicSlag.TileEntitySlag;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.util.Compat;
|
||||
|
||||
@ -17,7 +17,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityFoundrySlagtap extends TileEntityFoundryOutlet implements ICrucibleAcceptor {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canAcceptPartialFlow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) {
|
||||
if(filter != null && (filter != stack.material ^ invertFilter)) return false;
|
||||
@ -26,37 +26,37 @@ public class TileEntityFoundrySlagtap extends TileEntityFoundryOutlet implements
|
||||
|
||||
Vec3 start = Vec3.createVectorHelper(x + 0.5, y - 0.125, z + 0.5);
|
||||
Vec3 end = Vec3.createVectorHelper(x + 0.5, y + 0.125 - 15, z + 0.5);
|
||||
|
||||
|
||||
MovingObjectPosition mop = world.func_147447_a(start, end, true, true, true);
|
||||
|
||||
|
||||
if(mop == null || mop.typeOfHit != mop.typeOfHit.BLOCK) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MaterialStack flow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) {
|
||||
|
||||
|
||||
if(stack == null || stack.material == null || stack.amount <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Vec3 start = Vec3.createVectorHelper(x + 0.5, y - 0.125, z + 0.5);
|
||||
Vec3 end = Vec3.createVectorHelper(x + 0.5, y + 0.125 - 15, z + 0.5);
|
||||
|
||||
|
||||
MovingObjectPosition mop = world.func_147447_a(start, end, true, true, true);
|
||||
|
||||
|
||||
if(mop == null || mop.typeOfHit != mop.typeOfHit.BLOCK) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Block hit = world.getBlock(mop.blockX, mop.blockY, mop.blockZ);
|
||||
Block above = world.getBlock(mop.blockX, mop.blockY + 1, mop.blockZ);
|
||||
|
||||
|
||||
boolean didFlow = false;
|
||||
|
||||
|
||||
if(hit == ModBlocks.slag) {
|
||||
TileEntitySlag tile = (TileEntitySlag) Compat.getTileStandard(world, mop.blockX, mop.blockY, mop.blockZ);
|
||||
if(tile.mat == stack.material) {
|
||||
@ -78,7 +78,7 @@ public class TileEntityFoundrySlagtap extends TileEntityFoundryOutlet implements
|
||||
world.markBlockForUpdate(mop.blockX, mop.blockY, mop.blockZ);
|
||||
world.scheduleBlockUpdate(mop.blockX, mop.blockY, mop.blockZ, ModBlocks.slag, 1);
|
||||
}
|
||||
|
||||
|
||||
if(stack.amount > 0 && above.isReplaceable(world, mop.blockX, mop.blockY + 1, mop.blockZ)) {
|
||||
world.setBlock(mop.blockX, mop.blockY + 1, mop.blockZ, ModBlocks.slag);
|
||||
TileEntitySlag tile = (TileEntitySlag) Compat.getTileStandard(world, mop.blockX, mop.blockY + 1, mop.blockZ);
|
||||
@ -90,11 +90,11 @@ public class TileEntityFoundrySlagtap extends TileEntityFoundryOutlet implements
|
||||
world.markBlockForUpdate(mop.blockX, mop.blockY + 1, mop.blockZ);
|
||||
world.scheduleBlockUpdate(mop.blockX, mop.blockY + 1, mop.blockZ, ModBlocks.slag, 1);
|
||||
}
|
||||
|
||||
|
||||
if(didFlow) {
|
||||
ForgeDirection dir = side.getOpposite();
|
||||
double hitY = mop.blockY;
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "foundry");
|
||||
data.setInteger("color", stack.material.moltenColor);
|
||||
@ -102,13 +102,13 @@ public class TileEntityFoundrySlagtap extends TileEntityFoundryOutlet implements
|
||||
data.setFloat("off", 0.375F);
|
||||
data.setFloat("base", 0F);
|
||||
data.setFloat("len", Math.max(1F, yCoord - (float) (Math.ceil(hitY))));
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.5D - dir.offsetX * 0.125, yCoord + 0.125, zCoord + 0.5D - dir.offsetZ * 0.125), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord, zCoord + 0.5, 50));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, xCoord + 0.5D - dir.offsetX * 0.125, yCoord + 0.125, zCoord + 0.5D - dir.offsetZ * 0.125), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord, zCoord + 0.5, 50));
|
||||
}
|
||||
|
||||
|
||||
if(stack.amount <= 0) {
|
||||
stack = null;
|
||||
}
|
||||
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
||||
@ -9,13 +9,13 @@ import java.util.List;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.machine.BlockHadronCoil;
|
||||
import com.hbm.blocks.machine.BlockHadronPlating;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.inventory.container.ContainerHadron;
|
||||
import com.hbm.inventory.gui.GUIHadron;
|
||||
import com.hbm.inventory.recipes.HadronRecipes;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
@ -38,30 +38,30 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityHadron extends TileEntityMachineBase implements IEnergyReceiverMK2, IGUIProvider {
|
||||
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 10000000;
|
||||
|
||||
|
||||
public boolean isOn = false;
|
||||
public boolean analysisOnly = false;
|
||||
public int ioMode = 0;
|
||||
public static final int MODE_DEFAULT = 0;
|
||||
public static final int MODE_HOPPER = 1;
|
||||
public static final int MODE_SINGLE = 2;
|
||||
|
||||
|
||||
private int delay;
|
||||
public EnumHadronState state = EnumHadronState.IDLE;
|
||||
private static final int delaySuccess = 20;
|
||||
private static final int delayNoResult = 60;
|
||||
private static final int delayError = 100;
|
||||
|
||||
|
||||
public boolean stat_success = false;
|
||||
public EnumHadronState stat_state = EnumHadronState.IDLE;
|
||||
public int stat_charge = 0;
|
||||
public int stat_x = 0;
|
||||
public int stat_y = 0;
|
||||
public int stat_z = 0;
|
||||
|
||||
|
||||
public TileEntityHadron() {
|
||||
super(5);
|
||||
}
|
||||
@ -70,9 +70,9 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
public String getName() {
|
||||
return "container.hadron";
|
||||
}
|
||||
|
||||
|
||||
private static final int[] access = new int[] {0, 1, 2, 3};
|
||||
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return access;
|
||||
@ -86,33 +86,33 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
|
||||
if(i != 0 && i != 1) return false;
|
||||
|
||||
|
||||
if(this.ioMode == MODE_SINGLE) {
|
||||
return slots[i] == null;
|
||||
}
|
||||
|
||||
|
||||
//makes sure that equal items like the antimatter capsules are spread out evenly
|
||||
if(slots[0] != null && slots[1] != null && slots[0].getItem() == slots[1].getItem() && slots[0].getItemDamage() == slots[1].getItemDamage()) {
|
||||
if(i == 0) return slots[1].stackSize - slots[0].stackSize >= 0;
|
||||
if(i == 1) return slots[0].stackSize - slots[1].stackSize >= 0;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 4, power, maxPower);
|
||||
drawPower();
|
||||
|
||||
particles.addAll(particlesToAdd);
|
||||
particlesToAdd.clear();
|
||||
|
||||
|
||||
if(delay <= 0 && this.isOn && particles.size() < maxParticles && slots[0] != null && slots[1] != null && power >= maxPower * 0.75) {
|
||||
|
||||
|
||||
if(ioMode != MODE_HOPPER || (slots[0].stackSize > 1 && slots[1].stackSize > 1)) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
|
||||
particles.add(new Particle(slots[0], slots[1], dir, xCoord, yCoord, zCoord));
|
||||
@ -122,20 +122,20 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
this.state = EnumHadronState.PROGRESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(delay > 0)
|
||||
delay--;
|
||||
else if(particles.isEmpty()) {
|
||||
this.state = EnumHadronState.IDLE;
|
||||
}
|
||||
|
||||
|
||||
if(!particles.isEmpty())
|
||||
updateParticles();
|
||||
|
||||
|
||||
for(Particle p : particlesToRemove) {
|
||||
particles.remove(p);
|
||||
}
|
||||
|
||||
|
||||
particlesToRemove.clear();
|
||||
|
||||
//Sort the virtual particles by momentum, and run through them until we have enough momentum to complete the recipe
|
||||
@ -156,14 +156,14 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
|
||||
particlesCompleted.clear();
|
||||
}
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("isOn", isOn);
|
||||
data.setLong("power", power);
|
||||
data.setBoolean("analysis", analysisOnly);
|
||||
data.setInteger("ioMode", ioMode);
|
||||
data.setByte("state", (byte) state.ordinal());
|
||||
|
||||
|
||||
data.setBoolean("stat_success", stat_success);
|
||||
data.setByte("stat_state", (byte) stat_state.ordinal());
|
||||
data.setInteger("stat_charge", stat_charge);
|
||||
@ -173,11 +173,11 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
this.networkPackNT(50);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void process(Particle p, ItemStack[] result) {
|
||||
//Collapse this particle to real by consuming power
|
||||
p.consumePower();
|
||||
|
||||
|
||||
if(result == null) {
|
||||
this.state = HadronRecipes.returnCode;
|
||||
this.setStats(this.state, p.momentum, false);
|
||||
@ -185,27 +185,27 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
worldObj.playSoundEffect(p.posX, p.posY, p.posZ, "random.orb", 2, 0.5F);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if((slots[2] == null || (slots[2].getItem() == result[0].getItem() && slots[2].stackSize < slots[2].getMaxStackSize())) &&
|
||||
(slots[3] == null || (slots[3].getItem() == result[1].getItem() && slots[3].stackSize < slots[3].getMaxStackSize()))) {
|
||||
|
||||
|
||||
for(int i = 2; i <= 3; i++) {
|
||||
if(slots[i] == null)
|
||||
slots[i] = result[i - 2].copy();
|
||||
else
|
||||
slots[i].stackSize++;
|
||||
}
|
||||
|
||||
|
||||
if(result[0].getItem() == ModItems.particle_digamma) {
|
||||
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class,
|
||||
AxisAlignedBB.getBoundingBox(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5)
|
||||
.expand(128, 50, 128));
|
||||
|
||||
|
||||
for(EntityPlayer player : players)
|
||||
player.triggerAchievement(MainRegistry.achOmega12);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
worldObj.playSoundEffect(p.posX, p.posY, p.posZ, "random.orb", 2, 1F);
|
||||
this.delay = delaySuccess;
|
||||
this.state = EnumHadronState.SUCCESS;
|
||||
@ -248,7 +248,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
|
||||
@Override
|
||||
public void handleButtonPacket(int value, int meta) {
|
||||
|
||||
|
||||
if(meta == 0)
|
||||
this.isOn = !this.isOn;
|
||||
if(meta == 1)
|
||||
@ -257,55 +257,55 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
this.ioMode++;
|
||||
if(ioMode > 2) ioMode = 0;
|
||||
}
|
||||
|
||||
|
||||
this.markChanged();
|
||||
}
|
||||
|
||||
|
||||
private void drawPower() {
|
||||
|
||||
|
||||
for(ForgeDirection dir : getRandomDirs()) {
|
||||
|
||||
|
||||
if(power == maxPower)
|
||||
return;
|
||||
|
||||
int x = xCoord + dir.offsetX * 2;
|
||||
int y = yCoord + dir.offsetY * 2;
|
||||
int z = zCoord + dir.offsetZ * 2;
|
||||
|
||||
|
||||
TileEntity te = worldObj.getTileEntity(x, y, z);
|
||||
|
||||
|
||||
if(te instanceof TileEntityHadronPower) {
|
||||
|
||||
|
||||
TileEntityHadronPower plug = (TileEntityHadronPower)te;
|
||||
|
||||
|
||||
long toDraw = Math.min(maxPower - power, plug.getPower());
|
||||
this.setPower(power + toDraw);
|
||||
plug.setPower(plug.getPower() - toDraw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void finishParticle(Particle p) {
|
||||
particlesToRemove.add(p);
|
||||
|
||||
|
||||
if(!p.isExpired())
|
||||
particlesCompleted.add(p);
|
||||
|
||||
|
||||
p.expired = true;
|
||||
}
|
||||
|
||||
|
||||
static final int maxParticles = 1;
|
||||
List<Particle> particles = new ArrayList<Particle>();
|
||||
List<Particle> particlesToRemove = new ArrayList<Particle>();
|
||||
List<Particle> particlesToAdd = new ArrayList<Particle>();
|
||||
List<Particle> particlesCompleted = new ArrayList<Particle>();
|
||||
|
||||
|
||||
private void updateParticles() {
|
||||
for(Particle particle : particles) {
|
||||
particle.update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
@ -315,7 +315,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
this.analysisOnly = nbt.getBoolean("analysis");
|
||||
this.ioMode = nbt.getInteger("ioMode");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
@ -325,7 +325,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
nbt.setBoolean("analysis", analysisOnly);
|
||||
nbt.setInteger("ioMode", ioMode);
|
||||
}
|
||||
|
||||
|
||||
public int getPowerScaled(int i) {
|
||||
return (int)(power * i / maxPower);
|
||||
}
|
||||
@ -345,18 +345,18 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
public long getMaxPower() {
|
||||
return maxPower;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection dir) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void setStats(EnumHadronState state, int count, boolean success) {
|
||||
this.stat_state = state;
|
||||
this.stat_charge = count;
|
||||
this.stat_success = success;
|
||||
}
|
||||
|
||||
|
||||
private void setExpireStats(EnumHadronState state, int count, int x, int y, int z) {
|
||||
this.stat_state = state;
|
||||
this.stat_charge = count;
|
||||
@ -365,11 +365,11 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
this.stat_z = z;
|
||||
this.stat_success = false;
|
||||
}
|
||||
|
||||
|
||||
public void expire(Particle particle, EnumHadronState reason) {
|
||||
if(particle.expired)
|
||||
return;
|
||||
|
||||
|
||||
particle.consumePower();
|
||||
for(Particle p : particles) {
|
||||
p.expired = true;
|
||||
@ -384,9 +384,9 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
delay = delayError;
|
||||
setExpireStats(reason, particle.momentum, particle.posX, particle.posY, particle.posZ);
|
||||
}
|
||||
|
||||
|
||||
public class Particle {
|
||||
|
||||
|
||||
//Starting values
|
||||
ItemStack item1;
|
||||
ItemStack item2;
|
||||
@ -394,7 +394,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
int posX;
|
||||
int posY;
|
||||
int posZ;
|
||||
|
||||
|
||||
//Progressing values
|
||||
int momentum;
|
||||
int charge;
|
||||
@ -402,7 +402,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
boolean isCheckExempt = false;
|
||||
int cl0 = 0;
|
||||
int cl1 = 0;
|
||||
|
||||
|
||||
boolean expired = false;
|
||||
boolean cloned = false;
|
||||
|
||||
@ -414,7 +414,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
//Quantum particles should only traverse a schottky direction ONCE
|
||||
//Keep a list of traversed diodes and directions
|
||||
HashMap<TileEntityHadronDiode, List<ForgeDirection>> history = new HashMap<TileEntityHadronDiode, List<ForgeDirection>>();
|
||||
|
||||
|
||||
public Particle(ItemStack item1, ItemStack item2, ForgeDirection dir, int posX, int posY, int posZ) {
|
||||
this.item1 = item1.copy();
|
||||
this.item2 = item2.copy();
|
||||
@ -424,7 +424,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
this.posX = posX;
|
||||
this.posY = posY;
|
||||
this.posZ = posZ;
|
||||
|
||||
|
||||
this.charge = 750;
|
||||
this.momentum = 0;
|
||||
}
|
||||
@ -450,13 +450,13 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
public boolean isExpired() {
|
||||
return this.expired;
|
||||
}
|
||||
|
||||
|
||||
public void update() {
|
||||
|
||||
|
||||
if(expired) //just in case
|
||||
return;
|
||||
|
||||
@ -468,12 +468,12 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
}
|
||||
|
||||
makeSteppy(this);
|
||||
|
||||
|
||||
if(!this.isExpired()) //only important for when the current segment is the core
|
||||
checkSegment(this);
|
||||
|
||||
|
||||
isCheckExempt = false; //clearing up the exemption we might have held from the previous turn, AFTER stepping
|
||||
|
||||
|
||||
if(charge < 0)
|
||||
expire(this, EnumHadronState.ERROR_NO_CHARGE);
|
||||
|
||||
@ -481,14 +481,14 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
if(cl1 > 0) cl1--;
|
||||
}
|
||||
|
||||
public void incrementCharge(int coilVal) {
|
||||
public void incrementCharge(int coilVal) {
|
||||
//not the best code ever made but it works, dammit
|
||||
if(cl1 > 0) {
|
||||
|
||||
|
||||
double mult = 2D - (cl1 - 15D) * (cl1 - 15D) / 225D;
|
||||
mult = Math.max(mult, 0.1D);
|
||||
coilVal *= mult;
|
||||
|
||||
|
||||
} else if(cl0 > 0) {
|
||||
if(cl0 > 10) {
|
||||
coilVal *= 0.75;
|
||||
@ -496,7 +496,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
coilVal *= 1.10;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.momentum += coilVal;
|
||||
}
|
||||
|
||||
@ -508,53 +508,53 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Moves the particle and does all the checks required to do so
|
||||
* Handles diode entering behavior and whatnot
|
||||
* @param p
|
||||
*/
|
||||
public void makeSteppy(Particle p) {
|
||||
|
||||
|
||||
ForgeDirection dir = p.dir;
|
||||
|
||||
p.posX += dir.offsetX;
|
||||
p.posY += dir.offsetY;
|
||||
p.posZ += dir.offsetZ;
|
||||
|
||||
|
||||
int x = p.posX;
|
||||
int y = p.posY;
|
||||
int z = p.posZ;
|
||||
|
||||
|
||||
Block block = worldObj.getBlock(x, y, z);
|
||||
TileEntity te = worldObj.getTileEntity(x, y, z);
|
||||
|
||||
|
||||
if(te instanceof TileEntityHadron) {
|
||||
|
||||
if(p.analysis != 3)
|
||||
expire(p, EnumHadronState.ERROR_NO_ANALYSIS);
|
||||
else
|
||||
this.finishParticle(p);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(block.getMaterial() != Material.air && block != ModBlocks.hadron_diode)
|
||||
expire(p, EnumHadronState.ERROR_OBSTRUCTED_CHANNEL);
|
||||
|
||||
|
||||
if(block == ModBlocks.hadron_diode)
|
||||
p.isCheckExempt = true;
|
||||
|
||||
|
||||
if(isValidCoil(worldObj.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)))
|
||||
p.isCheckExempt = true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* All the checks done *after* the particle moves one tile
|
||||
* @param p
|
||||
*/
|
||||
public void checkSegment(Particle p) {
|
||||
|
||||
|
||||
ForgeDirection dir = p.dir;
|
||||
int x = p.posX;
|
||||
int y = p.posY;
|
||||
@ -565,60 +565,60 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
int dX = 1 - Math.abs(dir.offsetX);
|
||||
int dY = 1 - Math.abs(dir.offsetY);
|
||||
int dZ = 1 - Math.abs(dir.offsetZ);
|
||||
|
||||
|
||||
//whether the particle has entered an analysis chamber
|
||||
//-> all coils have to be air
|
||||
//-> all platings have to be analysis chamber walls
|
||||
boolean analysis = true;
|
||||
//ensures coolers are useful throughout their initial segment
|
||||
int totalValue = 0;
|
||||
|
||||
|
||||
for(int a = x - dX * 2; a <= x + dX * 2; a++) {
|
||||
for(int b = y - dY * 2; b <= y + dY * 2; b++) {
|
||||
for(int c = z - dZ * 2; c <= z + dZ * 2;c++) {
|
||||
|
||||
|
||||
Block block = worldObj.getBlock(a, b, c);
|
||||
int meta = worldObj.getBlockMetadata(a, b, c);
|
||||
|
||||
|
||||
/** ignore the center for now */
|
||||
if(a == x && b == y && c == z) {
|
||||
|
||||
|
||||
//we are either in a diode or the core - no analysis for you now
|
||||
if(block.getMaterial() != Material.air)
|
||||
analysis = false;
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
int ix = Math.abs(x - a);
|
||||
int iy = Math.abs(y - b);
|
||||
int iz = Math.abs(z - c);
|
||||
|
||||
|
||||
/** check coils, all abs deltas are 1 or less */
|
||||
if(ix <= 1 && iy <= 1 && iz <= 1) {
|
||||
|
||||
|
||||
//are we exempt from the coil examination? nice, skip checks only for inner magnets, not the corners!
|
||||
if(p.isCheckExempt && ix + iy + iz == 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//coil is air, analysis can remain true
|
||||
if(block.getMaterial() == Material.air && analysis) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//not air -> not an analysis chamber
|
||||
analysis = false;
|
||||
|
||||
|
||||
int coilVal = coilValue(block);
|
||||
|
||||
|
||||
//not a valid coil: kablam!
|
||||
if(!isValidCoil(block)) {
|
||||
expire(p, EnumHadronState.ERROR_EXPECTED_COIL);
|
||||
} else {
|
||||
p.charge -= coilVal;
|
||||
totalValue += coilVal;
|
||||
|
||||
|
||||
if(block == ModBlocks.hadron_cooler) {
|
||||
if(meta == 0) p.cl0 += 10;
|
||||
if(meta == 1) p.cl1 += 5;
|
||||
@ -627,37 +627,37 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/** now we check the plating, sum of all local positions being 3 or less gives us the outer plating without corners */
|
||||
if(ix + iy + iz <= 3) {
|
||||
|
||||
|
||||
//if the plating is for the analysis chamber, continue no matter what
|
||||
if(isAnalysis(block))
|
||||
continue;
|
||||
|
||||
//no analysis chamber -> turn off analysis and proceed
|
||||
analysis = false;
|
||||
|
||||
|
||||
//a plating? good, continue
|
||||
if(isPlating(block))
|
||||
continue;
|
||||
|
||||
|
||||
TileEntity te = worldObj.getTileEntity(a, b, c);
|
||||
|
||||
|
||||
//power plugs are also ok, might as well succ some energy when passing
|
||||
if(te instanceof TileEntityHadronPower) {
|
||||
|
||||
|
||||
TileEntityHadronPower plug = (TileEntityHadronPower)te;
|
||||
|
||||
|
||||
long bit = 10000; //how much HE one "charge point" is
|
||||
int times = (int) (plug.getPower() / bit); //how many charges the plug has to offer
|
||||
|
||||
|
||||
p.charge += times;
|
||||
p.plugs.add(plug);
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//Are we exempt from checking the plating? skip all the plating blocks where branches could be
|
||||
if(p.isCheckExempt && ix + iy + iz == 2) {
|
||||
continue;
|
||||
@ -670,22 +670,22 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
}
|
||||
//all errors prior to this point come from bad construction, where exact momentum is irrelevant
|
||||
p.incrementCharge(totalValue);
|
||||
|
||||
|
||||
if(analysis) {
|
||||
|
||||
|
||||
p.analysis++;
|
||||
|
||||
|
||||
//if the analysis chamber is too big, destroy
|
||||
if(p.analysis > 3)
|
||||
expire(p, EnumHadronState.ERROR_ANALYSIS_TOO_LONG);
|
||||
|
||||
|
||||
if(p.analysis == 2) {
|
||||
//Only pop for the first particle
|
||||
if(this.state != EnumHadronState.ANALYSIS) {
|
||||
this.worldObj.playSoundEffect(p.posX + 0.5, p.posY + 0.5, p.posZ + 0.5, "fireworks.blast", 2.0F, 2F);
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "hadron");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, p.posX + 0.5, p.posY + 0.5, p.posZ + 0.5), new TargetPoint(worldObj.provider.dimensionId, p.posX + 0.5, p.posY + 0.5, p.posZ + 0.5, 25));
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, p.posX + 0.5, p.posY + 0.5, p.posZ + 0.5), new TargetPoint(worldObj.provider.dimensionId, p.posX + 0.5, p.posY + 0.5, p.posZ + 0.5, 25));
|
||||
}
|
||||
this.state = EnumHadronState.ANALYSIS;
|
||||
}
|
||||
@ -694,7 +694,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
if(this.analysisOnly && p.analysis == 2) {
|
||||
this.finishParticle(p);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
//if the analysis stops despite being short of 3 steps in the analysis chamber, destroy
|
||||
@ -702,16 +702,16 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
expire(p, EnumHadronState.ERROR_ANALYSIS_TOO_SHORT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks whether we can go forward or if we might want to do a turn
|
||||
* Handles the better part of the diode behavior
|
||||
* @param p
|
||||
*/
|
||||
public void changeDirection(Particle p) {
|
||||
|
||||
|
||||
ForgeDirection dir = p.dir;
|
||||
|
||||
|
||||
int x = p.posX;
|
||||
int y = p.posY;
|
||||
int z = p.posZ;
|
||||
@ -719,38 +719,38 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
int nx = x + dir.offsetX;
|
||||
int ny = y + dir.offsetY;
|
||||
int nz = z + dir.offsetZ;
|
||||
|
||||
|
||||
Block next = worldObj.getBlock(nx, ny, nz);
|
||||
|
||||
|
||||
TileEntity te = worldObj.getTileEntity(nx, ny, nz);
|
||||
|
||||
|
||||
//the next block appears to be a diode, let's see if we can enter
|
||||
if(te instanceof TileEntityHadronDiode) {
|
||||
TileEntityHadronDiode diode = (TileEntityHadronDiode)te;
|
||||
|
||||
|
||||
if(diode.getConfig(p.dir.getOpposite().ordinal()) != DiodeConfig.IN) {
|
||||
//it appears as if we have slammed into the side of a diode, ouch
|
||||
expire(p, EnumHadronState.ERROR_DIODE_COLLISION);
|
||||
}
|
||||
|
||||
|
||||
//there's a diode ahead, turn off checks so we can make the curve
|
||||
p.isCheckExempt = true;
|
||||
|
||||
|
||||
//the *next* block is a diode, we are not in it yet, which means no turning and no check exemption. too bad kiddo.
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//instead of the next TE, we are looking at the current one - the diode (maybe)
|
||||
te = worldObj.getTileEntity(x, y, z);
|
||||
|
||||
|
||||
//if we are currently in a diode, we might want to consider changing dirs
|
||||
if(te instanceof TileEntityHadronDiode) {
|
||||
|
||||
|
||||
//since we are *in* a diode, we might want to call the warrant officer for
|
||||
//an exemption for the coil check, because curves NEED holes to turn into, and
|
||||
//checking for coils in spaces where there cannot be coils is quite not-good
|
||||
p.isCheckExempt = true;
|
||||
|
||||
|
||||
TileEntityHadronDiode diode = (TileEntityHadronDiode)te;
|
||||
|
||||
boolean hasTurnedCurrent = false;
|
||||
@ -783,30 +783,30 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//next step is air or the core, proceed
|
||||
if(next.getMaterial() == Material.air || next == ModBlocks.hadron_core)
|
||||
return;
|
||||
|
||||
|
||||
//so, the next block is most certainly a wall. not good. perhaps we could try turning?
|
||||
if(isValidCoil(next)) {
|
||||
|
||||
|
||||
ForgeDirection validDir = ForgeDirection.UNKNOWN;
|
||||
|
||||
|
||||
List<ForgeDirection> dirs = getRandomDirs();
|
||||
|
||||
|
||||
//let's look at every direction we could go in
|
||||
for(ForgeDirection d : dirs) {
|
||||
|
||||
|
||||
if(d == dir || d == dir.getOpposite())
|
||||
continue;
|
||||
|
||||
|
||||
//there is air! we can pass!
|
||||
if(worldObj.getBlock(x + d.offsetX, y + d.offsetY, z + d.offsetZ).getMaterial() == Material.air) {
|
||||
|
||||
|
||||
if(validDir == ForgeDirection.UNKNOWN) {
|
||||
validDir = d;
|
||||
|
||||
|
||||
//it seems like there are two or more possible ways, which is not allowed without a diode
|
||||
//sorry kid, nothing personal
|
||||
} else {
|
||||
@ -815,7 +815,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//set the new direction
|
||||
p.dir = validDir;
|
||||
p.isCheckExempt = true;
|
||||
@ -824,13 +824,13 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
|
||||
expire(p, EnumHadronState.ERROR_OBSTRUCTED_CHANNEL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Dear god please grant me the gift of death and end my eternal torment
|
||||
* @return
|
||||
*/
|
||||
private List<ForgeDirection> getRandomDirs() {
|
||||
|
||||
|
||||
List<Integer> rands = Arrays.asList(new Integer[] {0, 1, 2, 3, 4, 5} );
|
||||
Collections.shuffle(rands);
|
||||
List<ForgeDirection> dirs = new ArrayList();
|
||||
@ -839,25 +839,25 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
}
|
||||
return dirs;
|
||||
}
|
||||
|
||||
|
||||
public boolean isValidCoil(Block b) {
|
||||
if(coilValue(b) > 0) return true;
|
||||
|
||||
|
||||
if(b == ModBlocks.hadron_cooler) return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public int coilValue(Block b) {
|
||||
|
||||
|
||||
if(b instanceof BlockHadronCoil)
|
||||
return ((BlockHadronCoil)b).factor;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
public boolean isPlating(Block b) {
|
||||
|
||||
|
||||
return b instanceof BlockHadronPlating ||
|
||||
b instanceof BlockHadronCoil ||
|
||||
b == ModBlocks.hadron_plating_glass ||
|
||||
@ -865,13 +865,13 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
b == ModBlocks.hadron_access ||
|
||||
b == ModBlocks.hadron_cooler;
|
||||
}
|
||||
|
||||
|
||||
public boolean isAnalysis(Block b) {
|
||||
|
||||
|
||||
return b == ModBlocks.hadron_analysis ||
|
||||
b == ModBlocks.hadron_analysis_glass;
|
||||
}
|
||||
|
||||
|
||||
public static enum EnumHadronState {
|
||||
IDLE(0x8080ff),
|
||||
PROGRESS(0xffff00),
|
||||
@ -891,14 +891,14 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
ERROR_DIODE_COLLISION(0xff0000, true),
|
||||
ERROR_BRANCHING_TURN(0xff0000, true),
|
||||
ERROR_GENERIC(0xff0000, true);
|
||||
|
||||
|
||||
public int color;
|
||||
public boolean showCoord;
|
||||
|
||||
|
||||
private EnumHadronState(int color) {
|
||||
this(color, false);
|
||||
}
|
||||
|
||||
|
||||
private EnumHadronState(int color, boolean showCoord) {
|
||||
this.color = color;
|
||||
this.showCoord = showCoord;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user