mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 12:59:41 +00:00
Java 7 and 8 cleanup
Diamond operator <> Lambdas and method references
This commit is contained in:
1 parent
3db03edbc9
commit
b72d6efab3
234 files changed
+1614
-2253
No files matched your search
@@ -33,83 +33,80 @@ public class PacketConfigurationUpdate implements IMessageHandler<ConfigurationU
|
||||
{
|
||||
EntityPlayer player = PacketHandler.getPlayer(context);
|
||||
|
||||
PacketHandler.handlePacket(new Runnable() {
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
TileEntity tile = message.coord4D.getTileEntity(player.world);
|
||||
ITileNetwork network = CapabilityUtils.getCapability(tile, Capabilities.TILE_NETWORK_CAPABILITY, null);
|
||||
|
||||
if(tile instanceof ISideConfiguration)
|
||||
{
|
||||
ISideConfiguration config = (ISideConfiguration)tile;
|
||||
|
||||
if(message.packetType == ConfigurationPacket.EJECT)
|
||||
{
|
||||
config.getConfig().setEjecting(message.transmission, !config.getConfig().isEjecting(message.transmission));
|
||||
}
|
||||
else if(message.packetType == ConfigurationPacket.SIDE_DATA)
|
||||
{
|
||||
if(message.clickType == 0)
|
||||
{
|
||||
MekanismUtils.incrementOutput((ISideConfiguration)tile, message.transmission, message.configIndex);
|
||||
}
|
||||
else if(message.clickType == 1)
|
||||
{
|
||||
MekanismUtils.decrementOutput((ISideConfiguration)tile, message.transmission, message.configIndex);
|
||||
}
|
||||
else if(message.clickType == 2)
|
||||
{
|
||||
((ISideConfiguration)tile).getConfig().getConfig(message.transmission).set(message.configIndex, (byte) 0);
|
||||
}
|
||||
|
||||
tile.markDirty();
|
||||
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(message.coord4D, network.getNetworkedData(new ArrayList())), new Range4D(message.coord4D));
|
||||
}
|
||||
else if(message.packetType == ConfigurationPacket.EJECT_COLOR)
|
||||
{
|
||||
if(message.clickType == 0)
|
||||
{
|
||||
config.getEjector().setOutputColor(TransporterUtils.increment(config.getEjector().getOutputColor()));
|
||||
}
|
||||
else if(message.clickType == 1)
|
||||
{
|
||||
config.getEjector().setOutputColor(TransporterUtils.decrement(config.getEjector().getOutputColor()));
|
||||
}
|
||||
else if(message.clickType == 2)
|
||||
{
|
||||
config.getEjector().setOutputColor(null);
|
||||
}
|
||||
}
|
||||
else if(message.packetType == ConfigurationPacket.INPUT_COLOR)
|
||||
{
|
||||
EnumFacing side = EnumFacing.getFront(message.inputSide);
|
||||
|
||||
if(message.clickType == 0)
|
||||
{
|
||||
config.getEjector().setInputColor(side, TransporterUtils.increment(config.getEjector().getInputColor(side)));
|
||||
}
|
||||
else if(message.clickType == 1)
|
||||
{
|
||||
config.getEjector().setInputColor(side, TransporterUtils.decrement(config.getEjector().getInputColor(side)));
|
||||
}
|
||||
else if(message.clickType == 2)
|
||||
{
|
||||
config.getEjector().setInputColor(side, null);
|
||||
}
|
||||
}
|
||||
else if(message.packetType == ConfigurationPacket.STRICT_INPUT)
|
||||
{
|
||||
config.getEjector().setStrictInput(!config.getEjector().hasStrictInput());
|
||||
}
|
||||
|
||||
for(EntityPlayer p : ((TileEntityBasicBlock)config).playersUsing)
|
||||
{
|
||||
Mekanism.packetHandler.sendTo(new TileEntityMessage(message.coord4D, network.getNetworkedData(new ArrayList())), (EntityPlayerMP)p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, player);
|
||||
PacketHandler.handlePacket(() ->
|
||||
{
|
||||
TileEntity tile = message.coord4D.getTileEntity(player.world);
|
||||
ITileNetwork network = CapabilityUtils.getCapability(tile, Capabilities.TILE_NETWORK_CAPABILITY, null);
|
||||
|
||||
if(tile instanceof ISideConfiguration)
|
||||
{
|
||||
ISideConfiguration config = (ISideConfiguration)tile;
|
||||
|
||||
if(message.packetType == ConfigurationPacket.EJECT)
|
||||
{
|
||||
config.getConfig().setEjecting(message.transmission, !config.getConfig().isEjecting(message.transmission));
|
||||
}
|
||||
else if(message.packetType == ConfigurationPacket.SIDE_DATA)
|
||||
{
|
||||
if(message.clickType == 0)
|
||||
{
|
||||
MekanismUtils.incrementOutput((ISideConfiguration)tile, message.transmission, message.configIndex);
|
||||
}
|
||||
else if(message.clickType == 1)
|
||||
{
|
||||
MekanismUtils.decrementOutput((ISideConfiguration)tile, message.transmission, message.configIndex);
|
||||
}
|
||||
else if(message.clickType == 2)
|
||||
{
|
||||
((ISideConfiguration)tile).getConfig().getConfig(message.transmission).set(message.configIndex, (byte) 0);
|
||||
}
|
||||
|
||||
tile.markDirty();
|
||||
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(message.coord4D, network.getNetworkedData(new ArrayList())), new Range4D(message.coord4D));
|
||||
}
|
||||
else if(message.packetType == ConfigurationPacket.EJECT_COLOR)
|
||||
{
|
||||
if(message.clickType == 0)
|
||||
{
|
||||
config.getEjector().setOutputColor(TransporterUtils.increment(config.getEjector().getOutputColor()));
|
||||
}
|
||||
else if(message.clickType == 1)
|
||||
{
|
||||
config.getEjector().setOutputColor(TransporterUtils.decrement(config.getEjector().getOutputColor()));
|
||||
}
|
||||
else if(message.clickType == 2)
|
||||
{
|
||||
config.getEjector().setOutputColor(null);
|
||||
}
|
||||
}
|
||||
else if(message.packetType == ConfigurationPacket.INPUT_COLOR)
|
||||
{
|
||||
EnumFacing side = EnumFacing.getFront(message.inputSide);
|
||||
|
||||
if(message.clickType == 0)
|
||||
{
|
||||
config.getEjector().setInputColor(side, TransporterUtils.increment(config.getEjector().getInputColor(side)));
|
||||
}
|
||||
else if(message.clickType == 1)
|
||||
{
|
||||
config.getEjector().setInputColor(side, TransporterUtils.decrement(config.getEjector().getInputColor(side)));
|
||||
}
|
||||
else if(message.clickType == 2)
|
||||
{
|
||||
config.getEjector().setInputColor(side, null);
|
||||
}
|
||||
}
|
||||
else if(message.packetType == ConfigurationPacket.STRICT_INPUT)
|
||||
{
|
||||
config.getEjector().setStrictInput(!config.getEjector().hasStrictInput());
|
||||
}
|
||||
|
||||
for(EntityPlayer p : ((TileEntityBasicBlock)config).playersUsing)
|
||||
{
|
||||
Mekanism.packetHandler.sendTo(new TileEntityMessage(message.coord4D, network.getNetworkedData(new ArrayList())), (EntityPlayerMP)p);
|
||||
}
|
||||
}
|
||||
}, player);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user