use of logisticspipes.config.PlayerConfig in project LogisticsPipes by RS485.
the class LogisticsEventListener method getPlayerConfig.
public static PlayerConfig getPlayerConfig(PlayerIdentifier ident) {
PlayerConfig config = LogisticsEventListener.playerConfigs.get(ident);
if (config == null) {
config = new PlayerConfig(ident);
config.readFromFile();
LogisticsEventListener.playerConfigs.put(ident, config);
}
return config;
}
use of logisticspipes.config.PlayerConfig in project LogisticsPipes by RS485.
the class LogisticsBlockGenericPipe method addDestroyEffects.
/**
* Spawn particles for when the block is destroyed. Due to the nature of how
* this is invoked, the x/y/z locations are not always guaranteed to host
* your block. So be sure to do proper sanity checks before assuming that
* the location is this block.
*
* @param worldObj
* The current world
* @param x
* X position to spawn the particle
* @param y
* Y position to spawn the particle
* @param z
* Z position to spawn the particle
* @param meta
* The metadata for the block before it was destroyed.
* @param effectRenderer
* A reference to the current effect renderer.
* @return True to prevent vanilla break particles from spawning.
*/
@SideOnly(Side.CLIENT)
@Override
public boolean addDestroyEffects(World worldObj, int x, int y, int z, int meta, EffectRenderer effectRenderer) {
CoreUnroutedPipe pipe = LogisticsBlockGenericPipe.getPipe(worldObj, x, y, z);
if (pipe == null) {
return false;
}
PlayerConfig config = LogisticsPipes.getClientPlayerConfig();
if (config.isUseNewRenderer()) {
LogisticsNewRenderPipe.renderDestruction(pipe, worldObj, x, y, z, effectRenderer);
} else {
IIcon icon = pipe.getIconProvider().getIcon(pipe.getIconIndexForItem());
byte its = 4;
for (int i = 0; i < its; ++i) {
for (int j = 0; j < its; ++j) {
for (int k = 0; k < its; ++k) {
if (pipe.isMultiBlock()) {
LPPositionSet<DoubleCoordinatesType<CoreMultiBlockPipe.SubBlockTypeForShare>> set = ((CoreMultiBlockPipe) pipe).getRotatedSubBlocks();
set.add(new DoubleCoordinatesType<>(0, 0, 0, CoreMultiBlockPipe.SubBlockTypeForShare.NON_SHARE));
for (DoubleCoordinates pos : set) {
int localx = x + pos.getXInt();
int localy = y + pos.getYInt();
int localz = z + pos.getZInt();
double px = localx + (i + 0.5D) / its;
double py = localy + (j + 0.5D) / its;
double pz = localz + (k + 0.5D) / its;
int random = rand.nextInt(6);
EntityDiggingFX fx = new EntityDiggingFX(worldObj, px, py, pz, px - localx - 0.5D, py - localy - 0.5D, pz - localz - 0.5D, LogisticsPipes.LogisticsPipeBlock, random, meta);
fx.setParticleIcon(icon);
effectRenderer.addEffect(fx.applyColourMultiplier(x, y, z));
}
} else {
double px = x + (i + 0.5D) / its;
double py = y + (j + 0.5D) / its;
double pz = z + (k + 0.5D) / its;
int random = rand.nextInt(6);
EntityDiggingFX fx = new EntityDiggingFX(worldObj, px, py, pz, px - x - 0.5D, py - y - 0.5D, pz - z - 0.5D, LogisticsPipes.LogisticsPipeBlock, random, meta);
fx.setParticleIcon(icon);
effectRenderer.addEffect(fx.applyColourMultiplier(x, y, z));
}
}
}
}
}
return true;
}
use of logisticspipes.config.PlayerConfig in project LogisticsPipes by RS485.
the class LogisticsEventListener method onPlayerLogin.
@SubscribeEvent
public void onPlayerLogin(PlayerLoggedInEvent event) {
if (MainProxy.isServer(event.player.worldObj)) {
SimpleServiceLocator.securityStationManager.sendClientAuthorizationList(event.player);
SimpleServiceLocator.craftingPermissionManager.sendCraftingPermissionsToPlayer(event.player);
}
SimpleServiceLocator.serverBufferHandler.clear(event.player);
PlayerConfig config = LogisticsEventListener.getPlayerConfig(PlayerIdentifier.get(event.player));
MainProxy.sendPacketToPlayer(PacketHandler.getPacket(PlayerConfigToClientPacket.class).setConfig(config), event.player);
}
use of logisticspipes.config.PlayerConfig in project LogisticsPipes by RS485.
the class LogisticsEventListener method onPlayerLogout.
@SubscribeEvent
public void onPlayerLogout(PlayerLoggedOutEvent event) {
SimpleServiceLocator.serverBufferHandler.clear(event.player);
PlayerIdentifier ident = PlayerIdentifier.get(event.player);
PlayerConfig config = LogisticsEventListener.playerConfigs.get(ident);
if (config != null) {
config.writeToFile();
}
LogisticsEventListener.playerConfigs.remove(ident);
}
use of logisticspipes.config.PlayerConfig in project LogisticsPipes by RS485.
the class PlayerConfigToServerPacket method readData.
@Override
public void readData(LPDataInput input) {
config = new PlayerConfig(null);
config.readData(input);
}
Aggregations