mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
An absolute ton of cleanup.
This commit is contained in:
parent
c25f4c8d60
commit
ec6cd544d2
@ -80,7 +80,7 @@ public class CommandPacketInfo extends CommandBase {
|
|||||||
if (totalCnt != 0)
|
if (totalCnt != 0)
|
||||||
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "% Remaining to process: " + BobMathUtil.roundDecimal(((double) PacketThreading.threadPool.getQueue().size() / totalCnt) * 100, 2) + "%"));
|
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "% Remaining to process: " + BobMathUtil.roundDecimal(((double) PacketThreading.threadPool.getQueue().size() / totalCnt) * 100, 2) + "%"));
|
||||||
|
|
||||||
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Time spent waiting on thread(s) last tick: " + BobMathUtil.roundDecimal(TimeUnit.NANOSECONDS.convert(PacketThreading.nanoTimeWaited, TimeUnit.MILLISECONDS), 4) + "ms"));
|
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Time spent waiting on thread(s) last tick: " + BobMathUtil.roundDecimal(TimeUnit.MILLISECONDS.convert(PacketThreading.nanoTimeWaited, TimeUnit.NANOSECONDS), 4) + "ms"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -89,7 +89,12 @@ public class EntityMissileAntiBallistic extends EntityThrowableInterp implements
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
Vec3 vec = Vec3.createVectorHelper(motionX, motionY, motionZ).normalize();
|
Vec3 vec = Vec3.createVectorHelper(motionX, motionY, motionZ).normalize();
|
||||||
MainRegistry.proxy.particleControl(posX - vec.xCoord, posY - vec.yCoord, posZ - vec.zCoord, 2);
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
data.setString("type", "ABMContrail");
|
||||||
|
data.setDouble("posX", posX - vec.xCoord);
|
||||||
|
data.setDouble("posY", posY - vec.yCoord);
|
||||||
|
data.setDouble("posZ", posZ - vec.zCoord);
|
||||||
|
MainRegistry.proxy.effectNT(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
float f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
float f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||||
|
|||||||
@ -148,7 +148,16 @@ public class EntityMissileCustom extends EntityMissileBaseNT implements IChunkLo
|
|||||||
case XENON: break;
|
case XENON: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!smoke.isEmpty()) for(int i = 0; i < velocity; i++) MainRegistry.proxy.spawnParticle(posX - v.xCoord * i, posY - v.yCoord * i, posZ - v.zCoord * i, smoke, null);
|
if(!smoke.isEmpty()) {
|
||||||
|
for (int i = 0; i < velocity; i++) {
|
||||||
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
data.setDouble("posX", posX - v.xCoord * i);
|
||||||
|
data.setDouble("posY", posY - v.yCoord * i);
|
||||||
|
data.setDouble("posZ", posZ - v.zCoord * i);
|
||||||
|
data.setString("type", smoke);
|
||||||
|
MainRegistry.proxy.effectNT(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -117,7 +117,16 @@ public class EntityArtilleryRocket extends EntityThrowableInterp implements IChu
|
|||||||
v = v.normalize();
|
v = v.normalize();
|
||||||
|
|
||||||
int offset = 6;
|
int offset = 6;
|
||||||
if(velocity > 1) for(int i = offset; i < velocity + offset; i++) MainRegistry.proxy.spawnParticle(posX + v.xCoord * i, posY + v.yCoord * i, posZ + v.zCoord * i, "exKerosene", null);
|
if(velocity > 1) {
|
||||||
|
for (int i = offset; i < velocity + offset; i++) {
|
||||||
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
data.setDouble("posX", posX + v.xCoord * i);
|
||||||
|
data.setDouble("posY", posY + v.yCoord * i);
|
||||||
|
data.setDouble("posZ", posZ + v.zCoord * i);
|
||||||
|
data.setString("type", "exKerosene");
|
||||||
|
MainRegistry.proxy.effectNT(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -35,8 +35,12 @@ public class EntityWaterSplash extends EntityThrowable {
|
|||||||
this.setDead();
|
this.setDead();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
MainRegistry.proxy.particleControl(posX, posY, posZ, 0);
|
data.setString("type", "waterSplash");
|
||||||
|
data.setDouble("posX", posX);
|
||||||
|
data.setDouble("posY", posY);
|
||||||
|
data.setDouble("posZ", posZ);
|
||||||
|
MainRegistry.proxy.effectNT(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import com.hbm.handler.HbmKeybinds.EnumKeybind;
|
|||||||
import com.hbm.handler.pollution.PollutionHandler;
|
import com.hbm.handler.pollution.PollutionHandler;
|
||||||
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
||||||
import com.hbm.handler.radiation.ChunkRadiationManager;
|
import com.hbm.handler.radiation.ChunkRadiationManager;
|
||||||
|
import com.hbm.handler.threading.PacketThreading;
|
||||||
import com.hbm.interfaces.IArmorModDash;
|
import com.hbm.interfaces.IArmorModDash;
|
||||||
import com.hbm.items.armor.ArmorFSB;
|
import com.hbm.items.armor.ArmorFSB;
|
||||||
import com.hbm.items.weapon.sedna.factory.ConfettiUtil;
|
import com.hbm.items.weapon.sedna.factory.ConfettiUtil;
|
||||||
@ -81,7 +82,6 @@ public class EntityEffectHandler {
|
|||||||
if(entity instanceof EntityPlayerMP) {
|
if(entity instanceof EntityPlayerMP) {
|
||||||
HbmLivingProps props = HbmLivingProps.getData(entity);
|
HbmLivingProps props = HbmLivingProps.getData(entity);
|
||||||
HbmPlayerProps pprps = HbmPlayerProps.getData((EntityPlayerMP) entity);
|
HbmPlayerProps pprps = HbmPlayerProps.getData((EntityPlayerMP) entity);
|
||||||
ByteBuf buf = PooledByteBufAllocator.DEFAULT.buffer();
|
|
||||||
|
|
||||||
if(pprps.shield < pprps.getEffectiveMaxShield() && entity.ticksExisted > pprps.lastDamage + 60) {
|
if(pprps.shield < pprps.getEffectiveMaxShield() && entity.ticksExisted > pprps.lastDamage + 60) {
|
||||||
int tsd = entity.ticksExisted - (pprps.lastDamage + 60);
|
int tsd = entity.ticksExisted - (pprps.lastDamage + 60);
|
||||||
@ -91,10 +91,7 @@ public class EntityEffectHandler {
|
|||||||
if(pprps.shield > pprps.getEffectiveMaxShield())
|
if(pprps.shield > pprps.getEffectiveMaxShield())
|
||||||
pprps.shield = pprps.getEffectiveMaxShield();
|
pprps.shield = pprps.getEffectiveMaxShield();
|
||||||
|
|
||||||
props.serialize(buf);
|
PacketThreading.createSendToThreadedPacket(new ExtPropPacket(props, pprps), (EntityPlayerMP) entity);
|
||||||
pprps.serialize(buf);
|
|
||||||
PacketDispatcher.wrapper.sendTo(new ExtPropPacket(buf), (EntityPlayerMP) entity);
|
|
||||||
buf.release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!entity.worldObj.isRemote) {
|
if(!entity.worldObj.isRemote) {
|
||||||
|
|||||||
@ -5,12 +5,14 @@ import java.util.Map.Entry;
|
|||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.config.RadiationConfig;
|
import com.hbm.config.RadiationConfig;
|
||||||
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.packet.PacketDispatcher;
|
import com.hbm.packet.PacketDispatcher;
|
||||||
import com.hbm.packet.toclient.AuxParticlePacket;
|
|
||||||
|
|
||||||
|
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.ChunkCoordIntPair;
|
import net.minecraft.world.ChunkCoordIntPair;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@ -108,7 +110,12 @@ public class ChunkRadiationHandlerSimple extends ChunkRadiationHandler {
|
|||||||
int z = coord.chunkZPos * 16 + world.rand.nextInt(16);
|
int z = coord.chunkZPos * 16 + world.rand.nextInt(16);
|
||||||
int y = world.getHeightValue(x, z) + world.rand.nextInt(5);
|
int y = world.getHeightValue(x, z) + world.rand.nextInt(5);
|
||||||
|
|
||||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacket(x, y, z, 3), new TargetPoint(world.provider.dimensionId, x, y, z, 100));
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
data.setString("type", "radFog");
|
||||||
|
data.setDouble("posX", x);
|
||||||
|
data.setDouble("posY", y);
|
||||||
|
data.setDouble("posZ", z);
|
||||||
|
MainRegistry.proxy.effectNT(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import com.hbm.packet.PacketDispatcher;
|
|||||||
import com.hbm.packet.PrecompiledPacket;
|
import com.hbm.packet.PrecompiledPacket;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -71,7 +72,6 @@ public class PacketThreading {
|
|||||||
// `message` can be precompiled or not.
|
// `message` can be precompiled or not.
|
||||||
if(message instanceof PrecompiledPacket)
|
if(message instanceof PrecompiledPacket)
|
||||||
((PrecompiledPacket) message).getPreBuf(); // Gets the precompiled buffer, doing nothing if it already exists.
|
((PrecompiledPacket) message).getPreBuf(); // Gets the precompiled buffer, doing nothing if it already exists.
|
||||||
|
|
||||||
totalCnt++;
|
totalCnt++;
|
||||||
|
|
||||||
Runnable task = () -> {
|
Runnable task = () -> {
|
||||||
@ -88,6 +88,31 @@ public class PacketThreading {
|
|||||||
addTask(task);
|
addTask(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a packet to the thread pool to be processed in the future. This is only compatible with the `sendTo` dispatch operation.
|
||||||
|
*
|
||||||
|
* @param message Message to process.
|
||||||
|
* @param player PlayerMP to send to.
|
||||||
|
*/
|
||||||
|
public static void createSendToThreadedPacket(IMessage message, EntityPlayerMP player) {
|
||||||
|
if(message instanceof PrecompiledPacket)
|
||||||
|
((PrecompiledPacket) message).getPreBuf();
|
||||||
|
totalCnt++;
|
||||||
|
|
||||||
|
Runnable task = () -> {
|
||||||
|
try {
|
||||||
|
lock.lock();
|
||||||
|
PacketDispatcher.wrapper.sendTo(message, player);
|
||||||
|
if (message instanceof PrecompiledPacket)
|
||||||
|
((PrecompiledPacket) message).getPreBuf().release();
|
||||||
|
} finally {
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
addTask(task);
|
||||||
|
}
|
||||||
|
|
||||||
private static void addTask(Runnable task) {
|
private static void addTask(Runnable task) {
|
||||||
if(isTriggered())
|
if(isTriggered())
|
||||||
task.run();
|
task.run();
|
||||||
@ -107,7 +132,7 @@ public class PacketThreading {
|
|||||||
for (Future<?> future : futureList) {
|
for (Future<?> future : futureList) {
|
||||||
nanoTimeWaited = System.nanoTime() - startTime;
|
nanoTimeWaited = System.nanoTime() - startTime;
|
||||||
future.get(50, TimeUnit.MILLISECONDS); // I HATE EVERYTHING
|
future.get(50, TimeUnit.MILLISECONDS); // I HATE EVERYTHING
|
||||||
if(TimeUnit.NANOSECONDS.convert(nanoTimeWaited, TimeUnit.MILLISECONDS) > 50) throw new TimeoutException(); // >50ms total time? timeout? yes sir, ooh rah!
|
if(TimeUnit.MILLISECONDS.convert(nanoTimeWaited, TimeUnit.NANOSECONDS) > 50) throw new TimeoutException(); // >50ms total time? timeout? yes sir, ooh rah!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ExecutionException ignored) {
|
} catch (ExecutionException ignored) {
|
||||||
|
|||||||
@ -836,80 +836,6 @@ public class ClientProxy extends ServerProxy {
|
|||||||
MinecraftForgeClient.registerItemRenderer(ModItems.missile_custom, new ItemRenderMissile());
|
MinecraftForgeClient.registerItemRenderer(ModItems.missile_custom, new ItemRenderMissile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
public void particleControl(double x, double y, double z, int type) {
|
|
||||||
|
|
||||||
|
|
||||||
World world = Minecraft.getMinecraft().theWorld;
|
|
||||||
TextureManager man = Minecraft.getMinecraft().renderEngine;
|
|
||||||
|
|
||||||
switch(type) {
|
|
||||||
case 0:
|
|
||||||
|
|
||||||
for(int i = 0; i < 10; i++) {
|
|
||||||
EntityCloudFX smoke = new EntityCloudFX(world, x + world.rand.nextGaussian(), y + world.rand.nextGaussian(), z + world.rand.nextGaussian(), 0.0, 0.0, 0.0);
|
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(smoke);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
|
|
||||||
EntityCloudFX smoke = new EntityCloudFX(world, x, y, z, 0.0, 0.1, 0.0);
|
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(smoke);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
|
|
||||||
ParticleContrail contrail = new ParticleContrail(man, world, x, y, z);
|
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(contrail);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
|
|
||||||
ParticleRadiationFog fog = new ParticleRadiationFog(man, world, x, y, z);
|
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(fog);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//version 2, now with strings!
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
public void spawnParticle(double x, double y, double z, String type, float args[]) {
|
|
||||||
|
|
||||||
World world = Minecraft.getMinecraft().theWorld;
|
|
||||||
TextureManager man = Minecraft.getMinecraft().renderEngine;
|
|
||||||
|
|
||||||
if("launchsmoke".equals(type) && args.length == 3) {
|
|
||||||
ParticleSmokePlume contrail = new ParticleSmokePlume(man, world, x, y, z);
|
|
||||||
contrail.motionX = args[0];
|
|
||||||
contrail.motionY = args[1];
|
|
||||||
contrail.motionZ = args[2];
|
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(contrail);
|
|
||||||
}
|
|
||||||
if("exKerosene".equals(type)) {
|
|
||||||
ParticleContrail contrail = new ParticleContrail(man, world, x, y, z, 0F, 0F, 0F, 1F);
|
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(contrail);
|
|
||||||
}
|
|
||||||
if("exSolid".equals(type)) {
|
|
||||||
ParticleContrail contrail = new ParticleContrail(man, world, x, y, z, 0.3F, 0.2F, 0.05F, 1F);
|
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(contrail);
|
|
||||||
}
|
|
||||||
if("exHydrogen".equals(type)) {
|
|
||||||
ParticleContrail contrail = new ParticleContrail(man, world, x, y, z, 0.7F, 0.7F, 0.7F, 1F);
|
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(contrail);
|
|
||||||
}
|
|
||||||
if("exBalefire".equals(type)) {
|
|
||||||
ParticleContrail contrail = new ParticleContrail(man, world, x, y, z, 0.2F, 0.7F, 0.2F, 1F);
|
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(contrail);
|
|
||||||
}
|
|
||||||
if("radSmoke".equals(type)) {
|
|
||||||
ParticleRadiationFog contrail = new ParticleRadiationFog(man, world, x, y, z);
|
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(contrail);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//mk3, only use this one
|
//mk3, only use this one
|
||||||
@Override
|
@Override
|
||||||
public void effectNT(NBTTagCompound data) {
|
public void effectNT(NBTTagCompound data) {
|
||||||
@ -933,6 +859,64 @@ public class ClientProxy extends ServerProxy {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Old MK1 system ported to MK3:
|
||||||
|
|
||||||
|
if("waterSplash".equals(type)) {
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
EntityCloudFX smoke = new EntityCloudFX(world, x + world.rand.nextGaussian(), y + world.rand.nextGaussian(), z + world.rand.nextGaussian(), 0.0, 0.0, 0.0);
|
||||||
|
Minecraft.getMinecraft().effectRenderer.addEffect(smoke);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if("cloudFX2".equals(type)) { // i have genuinely no idea what used this
|
||||||
|
EntityCloudFX smoke = new EntityCloudFX(world, x, y, z, 0.0, 0.1, 0.0);
|
||||||
|
Minecraft.getMinecraft().effectRenderer.addEffect(smoke);
|
||||||
|
}
|
||||||
|
|
||||||
|
if("ABMContrail".equals(type)) {
|
||||||
|
ParticleContrail contrail = new ParticleContrail(man, world, x, y, z);
|
||||||
|
Minecraft.getMinecraft().effectRenderer.addEffect(contrail);
|
||||||
|
}
|
||||||
|
|
||||||
|
// End MK1 porting.
|
||||||
|
|
||||||
|
// Old MK2 system ported to MK3:
|
||||||
|
|
||||||
|
if("launchSmoke".equals(type)) {
|
||||||
|
ParticleSmokePlume contrail = new ParticleSmokePlume(man, world, x, y, z);
|
||||||
|
contrail.motionX = data.getDouble("moX");
|
||||||
|
contrail.motionY = data.getDouble("moY");
|
||||||
|
contrail.motionZ = data.getDouble("moZ");
|
||||||
|
Minecraft.getMinecraft().effectRenderer.addEffect(contrail);
|
||||||
|
}
|
||||||
|
|
||||||
|
if("exKerosene".equals(type)) {
|
||||||
|
ParticleContrail contrail = new ParticleContrail(man, world, x, y, z, 0F, 0F, 0F, 1F);
|
||||||
|
Minecraft.getMinecraft().effectRenderer.addEffect(contrail);
|
||||||
|
}
|
||||||
|
|
||||||
|
if("exSolid".equals(type)) {
|
||||||
|
ParticleContrail contrail = new ParticleContrail(man, world, x, y, z, 0.3F, 0.2F, 0.05F, 1F);
|
||||||
|
Minecraft.getMinecraft().effectRenderer.addEffect(contrail);
|
||||||
|
}
|
||||||
|
|
||||||
|
if("exHydrogen".equals(type)) {
|
||||||
|
ParticleContrail contrail = new ParticleContrail(man, world, x, y, z, 0.7F, 0.7F, 0.7F, 1F);
|
||||||
|
Minecraft.getMinecraft().effectRenderer.addEffect(contrail);
|
||||||
|
}
|
||||||
|
|
||||||
|
if("exBalefire".equals(type)) {
|
||||||
|
ParticleContrail contrail = new ParticleContrail(man, world, x, y, z, 0.2F, 0.7F, 0.2F, 1F);
|
||||||
|
Minecraft.getMinecraft().effectRenderer.addEffect(contrail);
|
||||||
|
}
|
||||||
|
|
||||||
|
if("radFog".equals(type)) {
|
||||||
|
ParticleRadiationFog contrail = new ParticleRadiationFog(man, world, x, y, z);
|
||||||
|
Minecraft.getMinecraft().effectRenderer.addEffect(contrail);
|
||||||
|
}
|
||||||
|
|
||||||
|
// End MK2 porting.
|
||||||
|
|
||||||
if("missileContrail".equals(type)) {
|
if("missileContrail".equals(type)) {
|
||||||
|
|
||||||
if(Vec3.createVectorHelper(player.posX - x, player.posY - y, player.posZ - z).lengthVector() > 350) return;
|
if(Vec3.createVectorHelper(player.posX - x, player.posY - y, player.posZ - z).lengthVector() > 350) return;
|
||||||
|
|||||||
@ -37,8 +37,6 @@ public class ServerProxy {
|
|||||||
public void registerGunCfg() { }
|
public void registerGunCfg() { }
|
||||||
public void handleNHNEICompat() { }
|
public void handleNHNEICompat() { }
|
||||||
|
|
||||||
public void particleControl(double x, double y, double z, int type) { }
|
|
||||||
|
|
||||||
public void spawnParticle(double x, double y, double z, String type, float[] args) { }
|
public void spawnParticle(double x, double y, double z, String type, float[] args) { }
|
||||||
|
|
||||||
public void effectNT(NBTTagCompound data) { }
|
public void effectNT(NBTTagCompound data) { }
|
||||||
|
|||||||
@ -18,12 +18,8 @@ public class PacketDispatcher {
|
|||||||
public static void registerPackets() {
|
public static void registerPackets() {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
//Sound packet that keeps client and server separated
|
|
||||||
wrapper.registerMessage(LoopedSoundPacket.Handler.class, LoopedSoundPacket.class, i++, Side.CLIENT);
|
|
||||||
//Signals server to consume items and create template
|
//Signals server to consume items and create template
|
||||||
wrapper.registerMessage(ItemFolderPacket.Handler.class, ItemFolderPacket.class, i++, Side.SERVER);
|
wrapper.registerMessage(ItemFolderPacket.Handler.class, ItemFolderPacket.class, i++, Side.SERVER);
|
||||||
//Electricity gauge for GUI rendering
|
|
||||||
wrapper.registerMessage(AuxElectricityPacket.Handler.class, AuxElectricityPacket.class, i++, Side.CLIENT);
|
|
||||||
//Siren packet for looped sounds
|
//Siren packet for looped sounds
|
||||||
wrapper.registerMessage(TESirenPacket.Handler.class, TESirenPacket.class, i++, Side.CLIENT);
|
wrapper.registerMessage(TESirenPacket.Handler.class, TESirenPacket.class, i++, Side.CLIENT);
|
||||||
//Signals server to change ItemStacks
|
//Signals server to change ItemStacks
|
||||||
@ -44,8 +40,6 @@ public class PacketDispatcher {
|
|||||||
wrapper.registerMessage(TEFFPacket.Handler.class, TEFFPacket.class, i++, Side.CLIENT);
|
wrapper.registerMessage(TEFFPacket.Handler.class, TEFFPacket.class, i++, Side.CLIENT);
|
||||||
//Sends button information for ItemGunBase
|
//Sends button information for ItemGunBase
|
||||||
wrapper.registerMessage(GunButtonPacket.Handler.class, GunButtonPacket.class, i++, Side.SERVER);
|
wrapper.registerMessage(GunButtonPacket.Handler.class, GunButtonPacket.class, i++, Side.SERVER);
|
||||||
//Packet to send block break particles
|
|
||||||
wrapper.registerMessage(AuxParticlePacket.Handler.class, AuxParticlePacket.class, i++, Side.CLIENT);
|
|
||||||
//Signals server to buy offer from bobmazon
|
//Signals server to buy offer from bobmazon
|
||||||
wrapper.registerMessage(ItemBobmazonPacket.Handler.class, ItemBobmazonPacket.class, i++, Side.SERVER);
|
wrapper.registerMessage(ItemBobmazonPacket.Handler.class, ItemBobmazonPacket.class, i++, Side.SERVER);
|
||||||
//Packet to send missile multipart information to TEs
|
//Packet to send missile multipart information to TEs
|
||||||
@ -76,12 +70,8 @@ public class PacketDispatcher {
|
|||||||
wrapper.registerMessage(PermaSyncPacket.Handler.class, PermaSyncPacket.class, i++, Side.CLIENT);
|
wrapper.registerMessage(PermaSyncPacket.Handler.class, PermaSyncPacket.class, i++, Side.CLIENT);
|
||||||
//Syncs biome information for single positions or entire chunks
|
//Syncs biome information for single positions or entire chunks
|
||||||
wrapper.registerMessage(BiomeSyncPacket.Handler.class, BiomeSyncPacket.class, i++, Side.CLIENT);
|
wrapper.registerMessage(BiomeSyncPacket.Handler.class, BiomeSyncPacket.class, i++, Side.CLIENT);
|
||||||
|
//The not-so-convenient but not laggy one
|
||||||
//Tile sync
|
wrapper.registerMessage(BufPacket.Handler.class, BufPacket.class, i++, Side.CLIENT);
|
||||||
wrapper.registerMessage(AuxGaugePacket.Handler.class, AuxGaugePacket.class, i++, Side.CLIENT); //The horrid one
|
|
||||||
// fucking DIE
|
|
||||||
//wrapper.registerMessage(NBTPacket.Handler.class, NBTPacket.class, i++, Side.CLIENT); //The convenient but laggy one
|
|
||||||
wrapper.registerMessage(BufPacket.Handler.class, BufPacket.class, i++, Side.CLIENT); //The not-so-convenient but not laggy one
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,67 +0,0 @@
|
|||||||
package com.hbm.packet.toclient;
|
|
||||||
|
|
||||||
import api.hbm.energymk2.IEnergyHandlerMK2;
|
|
||||||
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 cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
|
|
||||||
@Deprecated //use the NBT packet instead
|
|
||||||
public class AuxElectricityPacket implements IMessage {
|
|
||||||
|
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
int z;
|
|
||||||
long charge;
|
|
||||||
|
|
||||||
public AuxElectricityPacket()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuxElectricityPacket(int x, int y, int z, long charge)
|
|
||||||
{
|
|
||||||
this.x = x;
|
|
||||||
this.y = y;
|
|
||||||
this.z = z;
|
|
||||||
this.charge = charge;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fromBytes(ByteBuf buf) {
|
|
||||||
x = buf.readInt();
|
|
||||||
y = buf.readInt();
|
|
||||||
z = buf.readInt();
|
|
||||||
charge = buf.readLong();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void toBytes(ByteBuf buf) {
|
|
||||||
buf.writeInt(x);
|
|
||||||
buf.writeInt(y);
|
|
||||||
buf.writeInt(z);
|
|
||||||
buf.writeLong(charge);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Handler implements IMessageHandler<AuxElectricityPacket, IMessage> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IMessage onMessage(AuxElectricityPacket m, MessageContext ctx) {
|
|
||||||
try {
|
|
||||||
TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z);
|
|
||||||
|
|
||||||
if (te instanceof IEnergyHandlerMK2) {
|
|
||||||
|
|
||||||
IEnergyHandlerMK2 gen = (IEnergyHandlerMK2) te;
|
|
||||||
gen.setPower(m.charge);
|
|
||||||
}
|
|
||||||
} catch (Exception x) { }
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,96 +0,0 @@
|
|||||||
package com.hbm.packet.toclient;
|
|
||||||
|
|
||||||
import com.hbm.interfaces.Spaghetti;
|
|
||||||
import com.hbm.items.weapon.ItemCustomMissilePart.PartSize;
|
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
|
||||||
import com.hbm.tileentity.bomb.TileEntityCompactLauncher;
|
|
||||||
import com.hbm.tileentity.bomb.TileEntityLaunchTable;
|
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineArcFurnace;
|
|
||||||
|
|
||||||
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 cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
|
|
||||||
@Spaghetti("Changing all machines to use TileEntityMachineBase will reduce the total chaos in this class")
|
|
||||||
@Deprecated //use the NBT packet instead
|
|
||||||
public class AuxGaugePacket implements IMessage {
|
|
||||||
|
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
int z;
|
|
||||||
int value;
|
|
||||||
int id;
|
|
||||||
|
|
||||||
public AuxGaugePacket()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuxGaugePacket(int x, int y, int z, int value, int id)
|
|
||||||
{
|
|
||||||
this.x = x;
|
|
||||||
this.y = y;
|
|
||||||
this.z = z;
|
|
||||||
this.value = value;
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fromBytes(ByteBuf buf) {
|
|
||||||
x = buf.readInt();
|
|
||||||
y = buf.readInt();
|
|
||||||
z = buf.readInt();
|
|
||||||
value = buf.readInt();
|
|
||||||
id = buf.readInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void toBytes(ByteBuf buf) {
|
|
||||||
buf.writeInt(x);
|
|
||||||
buf.writeInt(y);
|
|
||||||
buf.writeInt(z);
|
|
||||||
buf.writeInt(value);
|
|
||||||
buf.writeInt(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Handler implements IMessageHandler<AuxGaugePacket, IMessage> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IMessage onMessage(AuxGaugePacket m, MessageContext ctx) {
|
|
||||||
try {
|
|
||||||
TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z);
|
|
||||||
if (te instanceof TileEntityMachineArcFurnace) {
|
|
||||||
TileEntityMachineArcFurnace furn = (TileEntityMachineArcFurnace)te;
|
|
||||||
|
|
||||||
if(m.id == 0)
|
|
||||||
furn.dualCookTime = m.value;
|
|
||||||
}
|
|
||||||
if (te instanceof TileEntityCompactLauncher) {
|
|
||||||
TileEntityCompactLauncher launcher = (TileEntityCompactLauncher)te;
|
|
||||||
|
|
||||||
launcher.solid = m.value;
|
|
||||||
}
|
|
||||||
if (te instanceof TileEntityLaunchTable) {
|
|
||||||
TileEntityLaunchTable launcher = (TileEntityLaunchTable)te;
|
|
||||||
|
|
||||||
if(m.id == 0)
|
|
||||||
launcher.solid = m.value;
|
|
||||||
if(m.id == 1)
|
|
||||||
launcher.padSize = PartSize.values()[m.value];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(te instanceof TileEntityMachineBase) {
|
|
||||||
((TileEntityMachineBase)te).processGauge(m.value, m.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception x) {}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,60 +0,0 @@
|
|||||||
package com.hbm.packet.toclient;
|
|
||||||
|
|
||||||
import com.hbm.main.MainRegistry;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
public class AuxParticlePacket implements IMessage {
|
|
||||||
|
|
||||||
double x;
|
|
||||||
double y;
|
|
||||||
double z;
|
|
||||||
int type;
|
|
||||||
|
|
||||||
public AuxParticlePacket()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuxParticlePacket(double x, double y, double z, int type)
|
|
||||||
{
|
|
||||||
this.x = x;
|
|
||||||
this.y = y;
|
|
||||||
this.z = z;
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fromBytes(ByteBuf buf) {
|
|
||||||
x = buf.readDouble();
|
|
||||||
y = buf.readDouble();
|
|
||||||
z = buf.readDouble();
|
|
||||||
type = buf.readInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void toBytes(ByteBuf buf) {
|
|
||||||
buf.writeDouble(x);
|
|
||||||
buf.writeDouble(y);
|
|
||||||
buf.writeDouble(z);
|
|
||||||
buf.writeInt(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Handler implements IMessageHandler<AuxParticlePacket, IMessage> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IMessage onMessage(AuxParticlePacket m, MessageContext ctx) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
MainRegistry.proxy.particleControl(m.x, m.y, m.z, m.type);
|
|
||||||
|
|
||||||
} catch(Exception x) { }
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -3,44 +3,37 @@ package com.hbm.packet.toclient;
|
|||||||
import com.hbm.extprop.HbmLivingProps;
|
import com.hbm.extprop.HbmLivingProps;
|
||||||
import com.hbm.extprop.HbmPlayerProps;
|
import com.hbm.extprop.HbmPlayerProps;
|
||||||
|
|
||||||
|
import com.hbm.packet.PrecompiledPacket;
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.network.PacketBuffer;
|
|
||||||
|
|
||||||
public class ExtPropPacket implements IMessage {
|
public class ExtPropPacket extends PrecompiledPacket {
|
||||||
|
|
||||||
ByteBuf buffer;
|
HbmLivingProps props;
|
||||||
|
HbmPlayerProps pprps;
|
||||||
|
ByteBuf buf;
|
||||||
|
|
||||||
public ExtPropPacket() { }
|
public ExtPropPacket() { }
|
||||||
|
|
||||||
public ExtPropPacket(ByteBuf buf) {
|
public ExtPropPacket(HbmLivingProps props, HbmPlayerProps pprps) {
|
||||||
|
this.props = props;
|
||||||
this.buffer = Unpooled.buffer();
|
this.pprps = pprps;
|
||||||
buffer.writeBytes(buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fromBytes(ByteBuf buf) {
|
public void fromBytes(ByteBuf buf) {
|
||||||
|
this.buf = buf;
|
||||||
if (buffer == null) {
|
|
||||||
buffer = new PacketBuffer(Unpooled.buffer());
|
|
||||||
}
|
|
||||||
buffer.writeBytes(buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toBytes(ByteBuf buf) {
|
public void toBytes(ByteBuf buf) {
|
||||||
|
props.serialize(buf);
|
||||||
if (buffer == null) {
|
pprps.serialize(buf);
|
||||||
buffer = new PacketBuffer(Unpooled.buffer());
|
|
||||||
}
|
|
||||||
buf.writeBytes(buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Handler implements IMessageHandler<ExtPropPacket, IMessage> {
|
public static class Handler implements IMessageHandler<ExtPropPacket, IMessage> {
|
||||||
@ -55,10 +48,10 @@ public class ExtPropPacket implements IMessage {
|
|||||||
HbmLivingProps props = HbmLivingProps.getData(Minecraft.getMinecraft().thePlayer);
|
HbmLivingProps props = HbmLivingProps.getData(Minecraft.getMinecraft().thePlayer);
|
||||||
HbmPlayerProps pprps = HbmPlayerProps.getData(Minecraft.getMinecraft().thePlayer);
|
HbmPlayerProps pprps = HbmPlayerProps.getData(Minecraft.getMinecraft().thePlayer);
|
||||||
|
|
||||||
props.deserialize(m.buffer);
|
props.deserialize(m.buf);
|
||||||
pprps.deserialize(m.buffer);
|
pprps.deserialize(m.buf);
|
||||||
|
|
||||||
m.buffer.release();
|
m.buf.release();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,122 +0,0 @@
|
|||||||
package com.hbm.packet.toclient;
|
|
||||||
|
|
||||||
import com.hbm.interfaces.Spaghetti;
|
|
||||||
import com.hbm.sound.*;
|
|
||||||
import com.hbm.tileentity.machine.*;
|
|
||||||
|
|
||||||
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 cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
@Spaghetti("this class should be destroyed")
|
|
||||||
public class LoopedSoundPacket implements IMessage {
|
|
||||||
|
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
int z;
|
|
||||||
|
|
||||||
public LoopedSoundPacket()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public LoopedSoundPacket(int x, int y, int z)
|
|
||||||
{
|
|
||||||
this.x = x;
|
|
||||||
this.y = y;
|
|
||||||
this.z = z;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fromBytes(ByteBuf buf) {
|
|
||||||
x = buf.readInt();
|
|
||||||
y = buf.readInt();
|
|
||||||
z = buf.readInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void toBytes(ByteBuf buf) {
|
|
||||||
buf.writeInt(x);
|
|
||||||
buf.writeInt(y);
|
|
||||||
buf.writeInt(z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Handler implements IMessageHandler<LoopedSoundPacket, IMessage> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
//Tamaized, I love you!
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IMessage onMessage(LoopedSoundPacket m, MessageContext ctx) {
|
|
||||||
TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z);
|
|
||||||
|
|
||||||
if (te != null && te instanceof TileEntityMachineAssembler) {
|
|
||||||
|
|
||||||
boolean flag = true;
|
|
||||||
for(int i = 0; i < SoundLoopAssembler.list.size(); i++) {
|
|
||||||
if(SoundLoopAssembler.list.get(i).getTE() == te && !SoundLoopAssembler.list.get(i).isDonePlaying())
|
|
||||||
flag = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(flag && te.getWorldObj().isRemote && ((TileEntityMachineAssembler)te).isProgressing)
|
|
||||||
Minecraft.getMinecraft().getSoundHandler().playSound(new SoundLoopAssembler(new ResourceLocation("hbm:block.assemblerOperate"), te));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (te != null && te instanceof TileEntityMachineTurbofan) {
|
|
||||||
|
|
||||||
boolean flag = true;
|
|
||||||
for(int i = 0; i < SoundLoopTurbofan.list.size(); i++) {
|
|
||||||
if(SoundLoopTurbofan.list.get(i).getTE() == te && !SoundLoopTurbofan.list.get(i).isDonePlaying())
|
|
||||||
flag = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(flag && te.getWorldObj().isRemote && ((TileEntityMachineTurbofan)te).wasOn)
|
|
||||||
Minecraft.getMinecraft().getSoundHandler().playSound(new SoundLoopTurbofan(new ResourceLocation("hbm:block.turbofanOperate"), te));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (te != null && te instanceof TileEntityBroadcaster) {
|
|
||||||
|
|
||||||
boolean flag = true;
|
|
||||||
for(int i = 0; i < SoundLoopBroadcaster.list.size(); i++) {
|
|
||||||
if(SoundLoopBroadcaster.list.get(i).getTE() == te && !SoundLoopBroadcaster.list.get(i).isDonePlaying())
|
|
||||||
flag = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int j = te.xCoord + te.zCoord + te.yCoord;
|
|
||||||
|
|
||||||
if(flag && te.getWorldObj().isRemote)
|
|
||||||
Minecraft.getMinecraft().getSoundHandler().playSound(new SoundLoopBroadcaster(new ResourceLocation("hbm:block.broadcast" + (Math.abs(j) % 3 + 1)), te));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (te != null && te instanceof TileEntityMachineCentrifuge) {
|
|
||||||
|
|
||||||
boolean flag = true;
|
|
||||||
for(int i = 0; i < SoundLoopCentrifuge.list.size(); i++) {
|
|
||||||
if(SoundLoopCentrifuge.list.get(i).getTE() == te && !SoundLoopCentrifuge.list.get(i).isDonePlaying())
|
|
||||||
flag = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(flag && te.getWorldObj().isRemote && ((TileEntityMachineCentrifuge)te).isProgressing)
|
|
||||||
Minecraft.getMinecraft().getSoundHandler().playSound(new SoundLoopCentrifuge(new ResourceLocation("hbm:block.centrifugeOperate"), te));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (te != null && te instanceof TileEntityMachineGasCent) {
|
|
||||||
|
|
||||||
boolean flag = true;
|
|
||||||
for(int i = 0; i < SoundLoopCentrifuge.list.size(); i++) {
|
|
||||||
if(SoundLoopCentrifuge.list.get(i).getTE() == te && !SoundLoopCentrifuge.list.get(i).isDonePlaying())
|
|
||||||
flag = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(flag && te.getWorldObj().isRemote && ((TileEntityMachineGasCent)te).isProgressing)
|
|
||||||
Minecraft.getMinecraft().getSoundHandler().playSound(new SoundLoopCentrifuge(new ResourceLocation("hbm:block.centrifugeOperate"), te));
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,38 +0,0 @@
|
|||||||
package com.hbm.sound;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineAssembler;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
public class SoundLoopAssembler extends SoundLoopMachine {
|
|
||||||
|
|
||||||
public static List<SoundLoopAssembler> list = new ArrayList<SoundLoopAssembler>();
|
|
||||||
|
|
||||||
public SoundLoopAssembler(ResourceLocation path, TileEntity te) {
|
|
||||||
super(path, te);
|
|
||||||
list.add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update() {
|
|
||||||
super.update();
|
|
||||||
|
|
||||||
if(te instanceof TileEntityMachineAssembler) {
|
|
||||||
TileEntityMachineAssembler drill = (TileEntityMachineAssembler)te;
|
|
||||||
|
|
||||||
if(this.volume != 3)
|
|
||||||
volume = 3;
|
|
||||||
|
|
||||||
if(!drill.isProgressing)
|
|
||||||
this.donePlaying = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public TileEntity getTE() {
|
|
||||||
return te;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,52 +0,0 @@
|
|||||||
package com.hbm.sound;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.tileentity.machine.TileEntityBroadcaster;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.audio.ISound;
|
|
||||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
public class SoundLoopBroadcaster extends SoundLoopMachine {
|
|
||||||
|
|
||||||
public static List<SoundLoopBroadcaster> list = new ArrayList<SoundLoopBroadcaster>();
|
|
||||||
public float intendedVolume = 25.0F;
|
|
||||||
|
|
||||||
public SoundLoopBroadcaster(ResourceLocation path, TileEntity te) {
|
|
||||||
super(path, te);
|
|
||||||
list.add(this);
|
|
||||||
this.field_147666_i = ISound.AttenuationType.NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update() {
|
|
||||||
super.update();
|
|
||||||
|
|
||||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
|
||||||
float f = 0;
|
|
||||||
|
|
||||||
if(player != null) {
|
|
||||||
f = (float)Math.sqrt(Math.pow(xPosF - player.posX, 2) + Math.pow(yPosF - player.posY, 2) + Math.pow(zPosF - player.posZ, 2));
|
|
||||||
volume = func(f, intendedVolume);
|
|
||||||
|
|
||||||
if(!(player.worldObj.getTileEntity((int)xPosF, (int)yPosF, (int)zPosF) instanceof TileEntityBroadcaster)) {
|
|
||||||
this.donePlaying = true;
|
|
||||||
volume = 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
volume = intendedVolume;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public TileEntity getTE() {
|
|
||||||
return te;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float func(float f, float v) {
|
|
||||||
return (f / v) * -2 + 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
package com.hbm.sound;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineCentrifuge;
|
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineGasCent;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
public class SoundLoopCentrifuge extends SoundLoopMachine {
|
|
||||||
|
|
||||||
public static List<SoundLoopCentrifuge> list = new ArrayList<SoundLoopCentrifuge>();
|
|
||||||
|
|
||||||
public SoundLoopCentrifuge(ResourceLocation path, TileEntity te) {
|
|
||||||
super(path, te);
|
|
||||||
list.add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update() {
|
|
||||||
super.update();
|
|
||||||
|
|
||||||
if(te instanceof TileEntityMachineCentrifuge) {
|
|
||||||
TileEntityMachineCentrifuge plant = (TileEntityMachineCentrifuge)te;
|
|
||||||
|
|
||||||
if(this.volume != 1)
|
|
||||||
volume = 1;
|
|
||||||
|
|
||||||
if(!plant.isProgressing)
|
|
||||||
this.donePlaying = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(te instanceof TileEntityMachineGasCent) {
|
|
||||||
TileEntityMachineGasCent plant = (TileEntityMachineGasCent)te;
|
|
||||||
|
|
||||||
if(this.volume != 1)
|
|
||||||
volume = 1;
|
|
||||||
|
|
||||||
if(!plant.isProgressing)
|
|
||||||
this.donePlaying = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!Minecraft.getMinecraft().getSoundHandler().isSoundPlaying(this)) {
|
|
||||||
stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public TileEntity getTE() {
|
|
||||||
return te;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
package com.hbm.sound;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineTurbofan;
|
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
public class SoundLoopTurbofan extends SoundLoopMachine {
|
|
||||||
|
|
||||||
public static List<SoundLoopTurbofan> list = new ArrayList<SoundLoopTurbofan>();
|
|
||||||
|
|
||||||
public SoundLoopTurbofan(ResourceLocation path, TileEntity te) {
|
|
||||||
super(path, te);
|
|
||||||
list.add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update() {
|
|
||||||
super.update();
|
|
||||||
|
|
||||||
if(te instanceof TileEntityMachineTurbofan) {
|
|
||||||
TileEntityMachineTurbofan drill = (TileEntityMachineTurbofan)te;
|
|
||||||
|
|
||||||
if(this.volume != 10)
|
|
||||||
volume = 10;
|
|
||||||
|
|
||||||
if(!drill.wasOn)
|
|
||||||
this.donePlaying = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public TileEntity getTE() {
|
|
||||||
return te;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,10 +1,7 @@
|
|||||||
package com.hbm.tileentity;
|
package com.hbm.tileentity;
|
||||||
|
|
||||||
import com.hbm.packet.PacketDispatcher;
|
|
||||||
import com.hbm.packet.toclient.AuxGaugePacket;
|
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
@ -147,11 +144,6 @@ public abstract class TileEntityMachineBase extends TileEntityLoadedBase impleme
|
|||||||
@Override
|
@Override
|
||||||
public abstract void updateEntity();
|
public abstract void updateEntity();
|
||||||
|
|
||||||
@Deprecated public void updateGauge(int val, int id, int range) {
|
|
||||||
if(!worldObj.isRemote) PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, val, id), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range));
|
|
||||||
}
|
|
||||||
@Deprecated public void processGauge(int val, int id) { }
|
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void handleButtonPacket(int value, int meta) { }
|
public void handleButtonPacket(int value, int meta) { }
|
||||||
|
|
||||||
|
|||||||
@ -220,7 +220,15 @@ public class TileEntityCompactLauncher extends TileEntityLoadedBase implements I
|
|||||||
float moX = (float) (dir ? 0 : worldObj.rand.nextGaussian() * 0.5F);
|
float moX = (float) (dir ? 0 : worldObj.rand.nextGaussian() * 0.5F);
|
||||||
float moZ = (float) (!dir ? 0 : worldObj.rand.nextGaussian() * 0.5F);
|
float moZ = (float) (!dir ? 0 : worldObj.rand.nextGaussian() * 0.5F);
|
||||||
|
|
||||||
MainRegistry.proxy.spawnParticle(xCoord + 0.5, yCoord + 0.25, zCoord + 0.5, "launchsmoke", new float[] {moX, 0, moZ});
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
data.setDouble("posX", xCoord + 0.5);
|
||||||
|
data.setDouble("posY", yCoord + 0.25);
|
||||||
|
data.setDouble("posZ", zCoord + 0.5);
|
||||||
|
data.setString("type", "launchSmoke");
|
||||||
|
data.setDouble("moX", moX);
|
||||||
|
data.setDouble("moY", 0);
|
||||||
|
data.setDouble("moZ", moZ);
|
||||||
|
MainRegistry.proxy.effectNT(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -55,7 +55,15 @@ public class TileEntityLaunchPad extends TileEntityLaunchPadBase {
|
|||||||
float moX = (float) (worldObj.rand.nextGaussian() * 0.15F + 0.75) * dir.offsetX;
|
float moX = (float) (worldObj.rand.nextGaussian() * 0.15F + 0.75) * dir.offsetX;
|
||||||
float moZ = (float) (worldObj.rand.nextGaussian() * 0.15F + 0.75) * dir.offsetZ;
|
float moZ = (float) (worldObj.rand.nextGaussian() * 0.15F + 0.75) * dir.offsetZ;
|
||||||
|
|
||||||
MainRegistry.proxy.spawnParticle(xCoord + 0.5, yCoord + 0.25, zCoord + 0.5, "launchsmoke", new float[] {moX, 0, moZ});
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
data.setDouble("posX", xCoord + 0.5);
|
||||||
|
data.setDouble("posY", yCoord + 0.25);
|
||||||
|
data.setDouble("posZ", zCoord + 0.5);
|
||||||
|
data.setString("type", "launchSmoke");
|
||||||
|
data.setDouble("moX", moX);
|
||||||
|
data.setDouble("moY", 0);
|
||||||
|
data.setDouble("moZ", moZ);
|
||||||
|
MainRegistry.proxy.effectNT(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -219,7 +219,15 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase {
|
|||||||
float moX = (float) (worldObj.rand.nextGaussian() * 0.15F + 0.75) * dir.offsetX;
|
float moX = (float) (worldObj.rand.nextGaussian() * 0.15F + 0.75) * dir.offsetX;
|
||||||
float moZ = (float) (worldObj.rand.nextGaussian() * 0.15F + 0.75) * dir.offsetZ;
|
float moZ = (float) (worldObj.rand.nextGaussian() * 0.15F + 0.75) * dir.offsetZ;
|
||||||
|
|
||||||
MainRegistry.proxy.spawnParticle(xCoord + 0.5, yCoord + 0.25, zCoord + 0.5, "launchsmoke", new float[] {moX, 0, moZ});
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
data.setDouble("posX", xCoord + 0.5);
|
||||||
|
data.setDouble("posY", yCoord + 0.25);
|
||||||
|
data.setDouble("posZ", zCoord + 0.5);
|
||||||
|
data.setString("type", "launchSmoke");
|
||||||
|
data.setDouble("moX", moX);
|
||||||
|
data.setDouble("moY", 0);
|
||||||
|
data.setDouble("moZ", moZ);
|
||||||
|
MainRegistry.proxy.effectNT(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,7 +71,16 @@ public class TileEntityLaunchPadRusted extends TileEntityMachineBase implements
|
|||||||
float moX = (float) (worldObj.rand.nextGaussian() * 0.15F + 0.75) * dir.offsetX;
|
float moX = (float) (worldObj.rand.nextGaussian() * 0.15F + 0.75) * dir.offsetX;
|
||||||
float moZ = (float) (worldObj.rand.nextGaussian() * 0.15F + 0.75) * dir.offsetZ;
|
float moZ = (float) (worldObj.rand.nextGaussian() * 0.15F + 0.75) * dir.offsetZ;
|
||||||
|
|
||||||
MainRegistry.proxy.spawnParticle(xCoord + 0.5, yCoord + 0.25, zCoord + 0.5, "launchsmoke", new float[] {moX, 0, moZ});
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
data.setDouble("posX", xCoord + 0.5);
|
||||||
|
data.setDouble("posY", yCoord + 0.25);
|
||||||
|
data.setDouble("posZ", zCoord + 0.5);
|
||||||
|
data.setString("type", "launchSmoke");
|
||||||
|
data.setDouble("moX", moX);
|
||||||
|
data.setDouble("moY", 0);
|
||||||
|
data.setDouble("moZ", moZ);
|
||||||
|
MainRegistry.proxy.effectNT(data);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -226,7 +226,15 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide
|
|||||||
float moX = (float) (dir ? 0 : worldObj.rand.nextGaussian() * 0.65F);
|
float moX = (float) (dir ? 0 : worldObj.rand.nextGaussian() * 0.65F);
|
||||||
float moZ = (float) (!dir ? 0 : worldObj.rand.nextGaussian() * 0.65F);
|
float moZ = (float) (!dir ? 0 : worldObj.rand.nextGaussian() * 0.65F);
|
||||||
|
|
||||||
MainRegistry.proxy.spawnParticle(xCoord + 0.5, yCoord + 0.25, zCoord + 0.5, "launchsmoke", new float[] {moX, 0, moZ});
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
data.setDouble("posX", xCoord + 0.5);
|
||||||
|
data.setDouble("posY", yCoord + 0.25);
|
||||||
|
data.setDouble("posZ", zCoord + 0.5);
|
||||||
|
data.setString("type", "launchSmoke");
|
||||||
|
data.setDouble("moX", moX);
|
||||||
|
data.setDouble("moY", 0);
|
||||||
|
data.setDouble("moZ", moZ);
|
||||||
|
MainRegistry.proxy.effectNT(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -122,7 +122,7 @@ public class TileEntityBlastDoor extends TileEntityLockableBase {
|
|||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
if(state == 2) {
|
if(state == 2) {
|
||||||
PacketDispatcher.wrapper.sendToAll(new TEVaultPacket(xCoord, yCoord, zCoord, isOpening, state, 1, 0));
|
PacketDispatcher.wrapper.sendToAllAround(new TEVaultPacket(xCoord, yCoord, zCoord, isOpening, state, 1, 0), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 250));
|
||||||
isOpening = false;
|
isOpening = false;
|
||||||
state = 1;
|
state = 1;
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,17 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.hbm.lib.ModDamageSource;
|
import com.hbm.lib.ModDamageSource;
|
||||||
import com.hbm.packet.PacketDispatcher;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.packet.toclient.LoopedSoundPacket;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import com.hbm.sound.AudioWrapper;
|
||||||
|
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.potion.Potion;
|
import net.minecraft.potion.Potion;
|
||||||
@ -16,7 +19,9 @@ import net.minecraft.potion.PotionEffect;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
|
||||||
public class TileEntityBroadcaster extends TileEntity {
|
public class TileEntityBroadcaster extends TileEntityLoadedBase {
|
||||||
|
|
||||||
|
private AudioWrapper audio;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
@ -40,11 +45,54 @@ public class TileEntityBroadcaster extends TileEntity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!worldObj.isRemote) {
|
if (worldObj.isRemote) {
|
||||||
PacketDispatcher.wrapper.sendToAllAround(new LoopedSoundPacket(xCoord, yCoord, zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 150));
|
if(audio == null) {
|
||||||
|
audio = createAudioLoop();
|
||||||
|
audio.startSound();
|
||||||
|
} else if(!audio.isPlaying()) {
|
||||||
|
audio = rebootAudio(audio);
|
||||||
|
}
|
||||||
|
|
||||||
|
int intendedVolume = 25;
|
||||||
|
|
||||||
|
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||||
|
float volume;
|
||||||
|
if(player != null) {
|
||||||
|
float f = (float)Math.sqrt(Math.pow(xCoord - player.posX, 2) + Math.pow(yCoord - player.posY, 2) + Math.pow(zCoord - player.posZ, 2));
|
||||||
|
volume = (f / intendedVolume) * -2 + 2;
|
||||||
|
} else {
|
||||||
|
volume = intendedVolume;
|
||||||
|
}
|
||||||
|
|
||||||
|
audio.updateVolume(getVolume(volume));
|
||||||
|
audio.keepAlive();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChunkUnload() {
|
||||||
|
super.onChunkUnload();
|
||||||
|
if(audio != null) {
|
||||||
|
audio.stopSound();
|
||||||
|
audio = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invalidate() {
|
||||||
|
super.invalidate();
|
||||||
|
if(audio != null) {
|
||||||
|
audio.stopSound();
|
||||||
|
audio = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AudioWrapper createAudioLoop() {
|
||||||
|
Random rand = new Random(xCoord + yCoord + zCoord);
|
||||||
|
return MainRegistry.proxy.getLoopedSound("hbm:block.broadcast" + (rand.nextInt(3) + 1), xCoord, yCoord, zCoord, 1.0F, 10F, 1.0F);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getRenderBoundingBox() {
|
public AxisAlignedBB getRenderBoundingBox() {
|
||||||
return TileEntity.INFINITE_EXTENT_AABB;
|
return TileEntity.INFINITE_EXTENT_AABB;
|
||||||
|
|||||||
@ -6,18 +6,15 @@ import com.hbm.inventory.container.ContainerMachineArcFurnace;
|
|||||||
import com.hbm.inventory.gui.GUIMachineArcFurnace;
|
import com.hbm.inventory.gui.GUIMachineArcFurnace;
|
||||||
import com.hbm.items.ModItems;
|
import com.hbm.items.ModItems;
|
||||||
import com.hbm.lib.Library;
|
import com.hbm.lib.Library;
|
||||||
import com.hbm.packet.PacketDispatcher;
|
|
||||||
import com.hbm.packet.toclient.AuxElectricityPacket;
|
|
||||||
import com.hbm.packet.toclient.AuxGaugePacket;
|
|
||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||||
import com.hbm.util.CompatEnergyControl;
|
import com.hbm.util.CompatEnergyControl;
|
||||||
|
|
||||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||||
import api.hbm.tile.IInfoProviderEC;
|
import api.hbm.tile.IInfoProviderEC;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
@ -356,17 +353,29 @@ public class TileEntityMachineArcFurnace extends TileEntityLoadedBase implements
|
|||||||
|
|
||||||
power = Library.chargeTEFromItems(slots, 5, power, maxPower);
|
power = Library.chargeTEFromItems(slots, 5, power, maxPower);
|
||||||
|
|
||||||
PacketDispatcher.wrapper.sendToAllAround(new AuxElectricityPacket(xCoord, yCoord, zCoord, power), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
networkPackNT(50); // it makes no sense to refactor this to some, but I want to delete the AuxElectricityPacket already
|
||||||
PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, dualCookTime, 0), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(flag1)
|
if(flag1)
|
||||||
{
|
{
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
|
buf.writeLong(power);
|
||||||
|
buf.writeInt(dualCookTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
power = buf.readLong();
|
||||||
|
dualCookTime = buf.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPower(long i) {
|
public void setPower(long i) {
|
||||||
power = i;
|
power = i;
|
||||||
|
|||||||
@ -11,8 +11,8 @@ import com.hbm.inventory.recipes.GasCentrifugeRecipes.PseudoFluidType;
|
|||||||
import com.hbm.items.ModItems;
|
import com.hbm.items.ModItems;
|
||||||
import com.hbm.items.machine.IItemFluidIdentifier;
|
import com.hbm.items.machine.IItemFluidIdentifier;
|
||||||
import com.hbm.lib.Library;
|
import com.hbm.lib.Library;
|
||||||
import com.hbm.packet.PacketDispatcher;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.packet.toclient.LoopedSoundPacket;
|
import com.hbm.sound.AudioWrapper;
|
||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
import com.hbm.util.BufferUtil;
|
import com.hbm.util.BufferUtil;
|
||||||
@ -23,7 +23,6 @@ import com.hbm.util.fauxpointtwelve.DirPos;
|
|||||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||||
import api.hbm.fluid.IFluidStandardReceiver;
|
import api.hbm.fluid.IFluidStandardReceiver;
|
||||||
import api.hbm.tile.IInfoProviderEC;
|
import api.hbm.tile.IInfoProviderEC;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
@ -33,6 +32,7 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
@ -49,6 +49,9 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
|||||||
public PseudoFluidTank inputTank;
|
public PseudoFluidTank inputTank;
|
||||||
public PseudoFluidTank outputTank;
|
public PseudoFluidTank outputTank;
|
||||||
|
|
||||||
|
private int audioDuration = 0;
|
||||||
|
private AudioWrapper audio;
|
||||||
|
|
||||||
private static final int[] slots_io = new int[] { 0, 1, 2, 3 };
|
private static final int[] slots_io = new int[] { 0, 1, 2, 3 };
|
||||||
|
|
||||||
public TileEntityMachineGasCent() {
|
public TileEntityMachineGasCent() {
|
||||||
@ -224,10 +227,43 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
|||||||
|
|
||||||
this.networkPackNT(50);
|
this.networkPackNT(50);
|
||||||
|
|
||||||
PacketDispatcher.wrapper.sendToAllAround(new LoopedSoundPacket(xCoord, yCoord, zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
} else {
|
||||||
|
|
||||||
|
if(isProgressing) {
|
||||||
|
audioDuration += 2;
|
||||||
|
} else {
|
||||||
|
audioDuration -= 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
audioDuration = MathHelper.clamp_int(audioDuration, 0, 60);
|
||||||
|
|
||||||
|
if(audioDuration > 10) {
|
||||||
|
|
||||||
|
if(audio == null) {
|
||||||
|
audio = createAudioLoop();
|
||||||
|
audio.startSound();
|
||||||
|
} else if(!audio.isPlaying()) {
|
||||||
|
audio = rebootAudio(audio);
|
||||||
|
}
|
||||||
|
|
||||||
|
audio.updateVolume(getVolume(1F));
|
||||||
|
audio.updatePitch((audioDuration - 10) / 100F + 0.5F);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if(audio != null) {
|
||||||
|
audio.stopSound();
|
||||||
|
audio = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AudioWrapper createAudioLoop() {
|
||||||
|
return MainRegistry.proxy.getLoopedSound("hbm:block.centrifugeOperate", xCoord, yCoord, zCoord, 1.0F, 10F, 1.0F);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serialize(ByteBuf buf) {
|
public void serialize(ByteBuf buf) {
|
||||||
super.serialize(buf);
|
super.serialize(buf);
|
||||||
|
|||||||
@ -4,8 +4,6 @@ import com.hbm.config.VersatileConfig;
|
|||||||
import com.hbm.inventory.container.ContainerMachineRTG;
|
import com.hbm.inventory.container.ContainerMachineRTG;
|
||||||
import com.hbm.inventory.gui.GUIMachineRTG;
|
import com.hbm.inventory.gui.GUIMachineRTG;
|
||||||
import com.hbm.items.machine.ItemRTGPellet;
|
import com.hbm.items.machine.ItemRTGPellet;
|
||||||
import com.hbm.packet.PacketDispatcher;
|
|
||||||
import com.hbm.packet.toclient.AuxElectricityPacket;
|
|
||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||||
import com.hbm.util.CompatEnergyControl;
|
import com.hbm.util.CompatEnergyControl;
|
||||||
@ -13,9 +11,9 @@ import com.hbm.util.RTGUtil;
|
|||||||
|
|
||||||
import api.hbm.energymk2.IEnergyProviderMK2;
|
import api.hbm.energymk2.IEnergyProviderMK2;
|
||||||
import api.hbm.tile.IInfoProviderEC;
|
import api.hbm.tile.IInfoProviderEC;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
@ -221,10 +219,22 @@ public class TileEntityMachineRTG extends TileEntityLoadedBase implements ISided
|
|||||||
if(power > powerMax)
|
if(power > powerMax)
|
||||||
power = powerMax;
|
power = powerMax;
|
||||||
|
|
||||||
PacketDispatcher.wrapper.sendToAllAround(new AuxElectricityPacket(xCoord, yCoord, zCoord, power), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
networkPackNT(50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
|
buf.writeLong(power);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
power = buf.readLong();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getPower() {
|
public long getPower() {
|
||||||
return power;
|
return power;
|
||||||
|
|||||||
@ -5,16 +5,14 @@ import com.hbm.inventory.gui.GUIMachineShredder;
|
|||||||
import com.hbm.inventory.recipes.ShredderRecipes;
|
import com.hbm.inventory.recipes.ShredderRecipes;
|
||||||
import com.hbm.items.machine.ItemBlades;
|
import com.hbm.items.machine.ItemBlades;
|
||||||
import com.hbm.lib.Library;
|
import com.hbm.lib.Library;
|
||||||
import com.hbm.packet.PacketDispatcher;
|
|
||||||
import com.hbm.packet.toclient.AuxElectricityPacket;
|
|
||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||||
|
|
||||||
import api.hbm.energymk2.IBatteryItem;
|
import api.hbm.energymk2.IBatteryItem;
|
||||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
@ -271,7 +269,7 @@ public class TileEntityMachineShredder extends TileEntityLoadedBase implements I
|
|||||||
|
|
||||||
power = Library.chargeTEFromItems(slots, 29, power, maxPower);
|
power = Library.chargeTEFromItems(slots, 29, power, maxPower);
|
||||||
|
|
||||||
PacketDispatcher.wrapper.sendToAllAround(new AuxElectricityPacket(xCoord, yCoord, zCoord, power), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
networkPackNT(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(flag1)
|
if(flag1)
|
||||||
@ -280,6 +278,18 @@ public class TileEntityMachineShredder extends TileEntityLoadedBase implements I
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
|
buf.writeLong(power);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
power = buf.readLong();
|
||||||
|
}
|
||||||
|
|
||||||
private void updateConnections() {
|
private void updateConnections() {
|
||||||
|
|
||||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user