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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -58,7 +58,7 @@ 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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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,7 +108,7 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -283,7 +283,7 @@ public class BlockVolcano extends BlockContainer implements ITooltipProvider, IB
|
||||
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;
|
||||
|
||||
@ -136,6 +136,9 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IT
|
||||
}
|
||||
}
|
||||
|
||||
if(inv instanceof TileEntityCrateBase)
|
||||
nbt.setBoolean("spiders", ((TileEntityCrateBase) inv).hasSpiders);
|
||||
|
||||
if(!nbt.hasNoTags()) {
|
||||
drop.stackTagCompound = nbt;
|
||||
|
||||
@ -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 {
|
||||
@ -199,6 +204,9 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IT
|
||||
lockable.lock();
|
||||
}
|
||||
}
|
||||
if(inv instanceof TileEntityCrateBase) {
|
||||
((TileEntityCrateBase) inv).hasSpiders = stack.stackTagCompound.getBoolean("spiders");
|
||||
}
|
||||
}
|
||||
|
||||
if(this != ModBlocks.safe)
|
||||
@ -290,10 +298,32 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IT
|
||||
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) {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -87,7 +87,7 @@ public class PartEmitter extends BlockContainer implements IToolable, ITooltipPr
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -31,7 +31,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 + 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);
|
||||
}
|
||||
@ -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;
|
||||
@ -42,7 +42,7 @@ public class RBMKDebrisRadiating extends RBMKDebrisBurning {
|
||||
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);
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -47,7 +47,7 @@ public class EntityFireworks extends Entity {
|
||||
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;
|
||||
@ -73,7 +73,7 @@ public class EntityMagnusCartus extends EntityMinecart {
|
||||
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;
|
||||
|
||||
@ -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;
|
||||
@ -55,7 +55,7 @@ public class EntityDeathBlast extends Entity {
|
||||
|
||||
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;
|
||||
@ -252,7 +252,7 @@ public class EntityNukeExplosionMK3 extends EntityExplosionChunkloading {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,7 +36,7 @@ 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);
|
||||
|
||||
@ -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;
|
||||
@ -116,7 +116,7 @@ public class EntityCreeperNuclear extends EntityCreeper {
|
||||
|
||||
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;
|
||||
@ -165,7 +165,7 @@ public class EntityPigeon extends EntityCreature implements IFlyingCreature, IAn
|
||||
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;
|
||||
|
||||
@ -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;
|
||||
@ -107,7 +107,7 @@ public class EntityQuackos extends EntityDuck implements IBossDisplayData {
|
||||
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),
|
||||
|
||||
@ -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;
|
||||
@ -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;
|
||||
@ -211,8 +211,8 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -343,7 +344,7 @@ public class EntityGlyphid extends EntityMob implements IResistanceProvider {
|
||||
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));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -167,7 +168,7 @@ public class EntityGlyphidNuclear extends EntityGlyphid {
|
||||
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();
|
||||
|
||||
@ -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;
|
||||
@ -79,7 +79,7 @@ public class EntitySiegeCraft extends EntityUFOBase implements IBossDisplayData
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ public class EntitySiegeCraft extends EntityUFOBase implements IBossDisplayData
|
||||
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;
|
||||
@ -198,7 +198,7 @@ public class EntitySiegeCraft extends EntityUFOBase implements IBossDisplayData
|
||||
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) {
|
||||
@ -230,7 +230,7 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -79,7 +79,7 @@ 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();
|
||||
|
||||
@ -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;
|
||||
@ -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),
|
||||
|
||||
@ -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;
|
||||
@ -384,7 +384,7 @@ 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);
|
||||
}
|
||||
}
|
||||
@ -470,7 +470,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -86,7 +86,7 @@ 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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -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),
|
||||
|
||||
@ -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;
|
||||
@ -81,7 +80,7 @@ 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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -28,7 +28,7 @@ public class ExplosionLarge {
|
||||
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) {
|
||||
@ -37,7 +37,7 @@ public class ExplosionLarge {
|
||||
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) {
|
||||
@ -47,7 +47,7 @@ public class ExplosionLarge {
|
||||
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) {
|
||||
|
||||
@ -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;
|
||||
@ -24,7 +24,7 @@ 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
|
||||
|
||||
@ -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;
|
||||
@ -22,6 +22,6 @@ public class ExplosionEffectAmat implements IExplosionSFX {
|
||||
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;
|
||||
@ -219,7 +219,7 @@ 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);
|
||||
|
||||
@ -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;
|
||||
@ -254,12 +254,12 @@ public class BulletConfigFactory {
|
||||
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));
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -309,7 +309,7 @@ public class BulletConfigFactory {
|
||||
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));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -321,7 +321,7 @@ 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));
|
||||
}
|
||||
};
|
||||
|
||||
@ -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++) {
|
||||
|
||||
@ -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;
|
||||
@ -15,11 +15,11 @@ 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;
|
||||
private IInventory diFurnace;
|
||||
|
||||
public GUICrateIron(InventoryPlayer invPlayer, TileEntityCrateIron tedf) {
|
||||
super(new ContainerCrateIron(invPlayer, tedf));
|
||||
diFurnace = tedf;
|
||||
public GUICrateIron(InventoryPlayer invPlayer, IInventory inv) {
|
||||
super(new ContainerCrateIron(invPlayer, inv));
|
||||
diFurnace = inv;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 186;
|
||||
|
||||
@ -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;
|
||||
@ -15,9 +15,9 @@ 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;
|
||||
private IInventory diFurnace;
|
||||
|
||||
public GUICrateTemplate(InventoryPlayer invPlayer, TileEntityCrateTemplate tedf) {
|
||||
public GUICrateTemplate(InventoryPlayer invPlayer, IInventory tedf) {
|
||||
super(new ContainerCrateTemplate(invPlayer, tedf));
|
||||
diFurnace = tedf;
|
||||
|
||||
|
||||
@ -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,10 +17,14 @@ 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;
|
||||
private IInventory diFurnace;
|
||||
|
||||
public GUICrateTungsten(InventoryPlayer invPlayer, TileEntityCrateTungsten tedf) {
|
||||
public GUICrateTungsten(InventoryPlayer invPlayer, IInventory tedf) {
|
||||
super(new ContainerCrateTungsten(invPlayer, tedf));
|
||||
setupGUI(tedf);
|
||||
}
|
||||
|
||||
private void setupGUI(IInventory tedf) {
|
||||
diFurnace = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
@ -38,10 +43,14 @@ public class GUICrateTungsten extends GuiContainer {
|
||||
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,9 +15,9 @@ 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;
|
||||
private IInventory diFurnace;
|
||||
|
||||
public GUISafe(InventoryPlayer invPlayer, TileEntitySafe tedf) {
|
||||
public GUISafe(InventoryPlayer invPlayer, IInventory tedf) {
|
||||
super(new ContainerSafe(invPlayer, tedf));
|
||||
diFurnace = tedf;
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -54,7 +55,7 @@ public class ArmorBJJetpack extends ArmorBJ {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -83,7 +83,7 @@ public class ArmorDNT extends ArmorFSBPowered {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -61,7 +61,7 @@ public class ArmorDiesel extends ArmorFSBFueled {
|
||||
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;
|
||||
@ -55,7 +55,7 @@ public class ItemModKnife extends ItemArmorMod {
|
||||
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);
|
||||
|
||||
@ -80,7 +80,7 @@ public class ItemModKnife extends ItemArmorMod {
|
||||
|
||||
((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;
|
||||
@ -111,7 +111,7 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -40,7 +40,7 @@ public class JetpackBreak 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;
|
||||
@ -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;
|
||||
@ -100,7 +99,7 @@ public class ItemLemon extends ItemFood {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -69,7 +69,7 @@ public class ItemCigarette extends Item {
|
||||
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;
|
||||
|
||||
@ -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;
|
||||
@ -160,7 +160,7 @@ public class ItemBlowtorch extends Item implements IFillableItem {
|
||||
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;
|
||||
|
||||
@ -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;
|
||||
@ -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();
|
||||
@ -108,12 +108,12 @@ 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;
|
||||
|
||||
@ -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;
|
||||
@ -28,7 +28,7 @@ public class ItemChainsaw extends ItemToolAbilityFueled implements IHeldSoundPro
|
||||
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;
|
||||
@ -65,7 +65,7 @@ public class ItemPowerNetTool extends Item {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,16 +1,27 @@
|
||||
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 {
|
||||
@ -25,6 +36,42 @@ public class ItemWandD extends Item {
|
||||
|
||||
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());
|
||||
@ -43,6 +90,7 @@ public class ItemWandD extends Item {
|
||||
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();
|
||||
@ -50,6 +98,7 @@ public class ItemWandD extends Item {
|
||||
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();
|
||||
|
||||
@ -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;
|
||||
@ -226,7 +226,7 @@ public class ItemAmmoArty extends Item {
|
||||
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++) {
|
||||
@ -288,12 +288,12 @@ 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));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -164,7 +164,7 @@ public class ItemAmmoHIMARS extends Item {
|
||||
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() {
|
||||
@ -201,7 +201,7 @@ 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);
|
||||
}};
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -47,7 +47,7 @@ public class ItemCrucible extends ItemSwordAbility implements IEquipReceiver {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ public class ItemCrucible extends ItemSwordAbility implements IEquipReceiver {
|
||||
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;
|
||||
}
|
||||
@ -90,7 +90,7 @@ public class ItemCrucible extends ItemSwordAbility implements IEquipReceiver {
|
||||
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")))
|
||||
|
||||
@ -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;
|
||||
@ -834,7 +835,7 @@ 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) {
|
||||
|
||||
@ -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;
|
||||
@ -51,7 +51,7 @@ public class ConfettiUtil {
|
||||
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;
|
||||
@ -1108,7 +1108,7 @@ 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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -97,7 +97,7 @@ public class XFactoryCatapult {
|
||||
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) -> {
|
||||
@ -115,7 +115,7 @@ public class XFactoryCatapult {
|
||||
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) -> {
|
||||
|
||||
@ -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;
|
||||
@ -80,7 +80,7 @@ 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));
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -63,7 +63,7 @@ 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;
|
||||
|
||||
@ -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;
|
||||
@ -26,6 +26,6 @@ public interface IParticleCreator {
|
||||
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;
|
||||
@ -47,7 +47,7 @@ public class TileEntityFireworks extends TileEntity {
|
||||
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++;
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -111,7 +111,7 @@ public class TileEntityGeysir extends TileEntity {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -97,7 +97,7 @@ 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));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -102,7 +102,7 @@ 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) {
|
||||
|
||||
@ -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;
|
||||
@ -685,7 +685,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
|
||||
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;
|
||||
}
|
||||
|
||||
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