Format sourcecode
This commit is contained in:
@@ -96,7 +96,7 @@ public abstract class AppEngPacket implements Packet
|
||||
|
||||
// TODO: Figure out why Forge/Minecraft on the server sets the stream data buffer to PooledUnsafeDirectByteBuf
|
||||
|
||||
public ByteArrayInputStream getPacketByteArray ( ByteBuf stream, int readerIndex, int readableBytes )
|
||||
public ByteArrayInputStream getPacketByteArray( ByteBuf stream, int readerIndex, int readableBytes )
|
||||
{
|
||||
final ByteArrayInputStream bytes;
|
||||
if( stream.hasArray() )
|
||||
@@ -112,7 +112,7 @@ public abstract class AppEngPacket implements Packet
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public ByteArrayInputStream getPacketByteArray ( ByteBuf stream )
|
||||
public ByteArrayInputStream getPacketByteArray( ByteBuf stream )
|
||||
{
|
||||
return getPacketByteArray( stream, 0, stream.readableBytes() );
|
||||
}
|
||||
|
||||
@@ -352,7 +352,8 @@ public enum GuiBridge implements IGuiHandler
|
||||
|
||||
if( target == null )
|
||||
{
|
||||
throw new IllegalStateException( "Cannot find " + this.containerClass.getName() + "( " + this.typeName( inventory ) + ", " + this.typeName( tE ) + " )" );
|
||||
throw new IllegalStateException( "Cannot find " + this.containerClass.getName() + "( " + this.typeName( inventory ) + ", " + this
|
||||
.typeName( tE ) + " )" );
|
||||
}
|
||||
|
||||
final Object o = target.newInstance( inventory, tE );
|
||||
@@ -489,7 +490,8 @@ public enum GuiBridge implements IGuiHandler
|
||||
|
||||
if( target == null )
|
||||
{
|
||||
throw new IllegalStateException( "Cannot find " + this.containerClass.getName() + "( " + this.typeName( inventory ) + ", " + this.typeName( tE ) + " )" );
|
||||
throw new IllegalStateException( "Cannot find " + this.containerClass.getName() + "( " + this.typeName( inventory ) + ", " + this
|
||||
.typeName( tE ) + " )" );
|
||||
}
|
||||
|
||||
return target.newInstance( inventory, tE );
|
||||
|
||||
@@ -48,7 +48,8 @@ public class AppEngClientPacketHandler extends AppEngPacketHandlerBase implement
|
||||
final int packetType = stream.readInt();
|
||||
final AppEngPacket pack = PacketTypes.getPacket( packetType ).parsePacket( stream );
|
||||
|
||||
final PacketCallState callState = new PacketCallState(){
|
||||
final PacketCallState callState = new PacketCallState()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void call( final AppEngPacket appEngPacket )
|
||||
|
||||
@@ -48,7 +48,8 @@ public final class AppEngServerPacketHandler extends AppEngPacketHandlerBase imp
|
||||
final int packetType = stream.readInt();
|
||||
final AppEngPacket pack = PacketTypes.getPacket( packetType ).parsePacket( stream );
|
||||
|
||||
final PacketCallState callState = new PacketCallState(){
|
||||
final PacketCallState callState = new PacketCallState()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void call( final AppEngPacket appEngPacket )
|
||||
|
||||
@@ -69,7 +69,7 @@ public class PacketClick extends AppEngPacket
|
||||
this.hitX = stream.readFloat();
|
||||
this.hitY = stream.readFloat();
|
||||
this.hitZ = stream.readFloat();
|
||||
this.hand = EnumHand.values()[ stream.readByte() ];
|
||||
this.hand = EnumHand.values()[stream.readByte()];
|
||||
}
|
||||
|
||||
// api
|
||||
@@ -111,7 +111,8 @@ public class PacketClick extends AppEngPacket
|
||||
if( is.getItem() instanceof ToolNetworkTool )
|
||||
{
|
||||
final ToolNetworkTool tnt = (ToolNetworkTool) is.getItem();
|
||||
tnt.serverSideToolLogic( is, player, this.hand, player.world, new BlockPos( this.x, this.y, this.z ), this.side, this.hitX, this.hitY, this.hitZ );
|
||||
tnt.serverSideToolLogic( is, player, this.hand, player.world, new BlockPos( this.x, this.y, this.z ), this.side, this.hitX, this.hitY,
|
||||
this.hitZ );
|
||||
}
|
||||
|
||||
else if( maybeMemoryCard.isSameAs( is ) )
|
||||
|
||||
@@ -58,7 +58,8 @@ public class PacketCompressedNBT extends AppEngPacket
|
||||
this.data = null;
|
||||
this.compressFrame = null;
|
||||
|
||||
final GZIPInputStream gzReader = new GZIPInputStream( new InputStream(){
|
||||
final GZIPInputStream gzReader = new GZIPInputStream( new InputStream()
|
||||
{
|
||||
|
||||
@Override
|
||||
public int read() throws IOException
|
||||
@@ -86,7 +87,8 @@ public class PacketCompressedNBT extends AppEngPacket
|
||||
|
||||
this.in = din;
|
||||
|
||||
this.compressFrame = new GZIPOutputStream( new OutputStream(){
|
||||
this.compressFrame = new GZIPOutputStream( new OutputStream()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void write( final int value ) throws IOException
|
||||
|
||||
@@ -172,7 +172,8 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
final IAEItemStack in = AEItemStack.create( currentItem );
|
||||
if( in != null )
|
||||
{
|
||||
final IAEItemStack out = realForFake == Actionable.SIMULATE ? null : Platform.poweredInsert( energy, storage, in, cct.getActionSource() );
|
||||
final IAEItemStack out = realForFake == Actionable.SIMULATE ? null : Platform.poweredInsert( energy, storage, in,
|
||||
cct.getActionSource() );
|
||||
if( out != null )
|
||||
{
|
||||
craftMatrix.setInventorySlotContents( x, out.getItemStack() );
|
||||
@@ -191,7 +192,8 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
if( !patternItem.isEmpty() && currentItem.isEmpty() )
|
||||
{
|
||||
// Grab from network by recipe
|
||||
ItemStack whichItem = Platform.extractItemsByRecipe( energy, cct.getActionSource(), storage, player.world, r, is, testInv, patternItem, x, all, realForFake, filter );
|
||||
ItemStack whichItem = Platform.extractItemsByRecipe( energy, cct.getActionSource(), storage, player.world, r, is, testInv,
|
||||
patternItem, x, all, realForFake, filter );
|
||||
|
||||
// If that doesn't get it, grab exact items from network (?)
|
||||
// TODO see if this code is necessary
|
||||
@@ -246,7 +248,8 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor( player, EnumFacing.UP );
|
||||
final AEItemStack request = AEItemStack.create( patternItem );
|
||||
final boolean isSimulated = mode == Actionable.SIMULATE;
|
||||
final boolean checkFuzzy = request.isOre() || patternItem.getItemDamage() == OreDictionary.WILDCARD_VALUE || patternItem.hasTagCompound() || patternItem.isItemStackDamageable();
|
||||
final boolean checkFuzzy = request.isOre() || patternItem.getItemDamage() == OreDictionary.WILDCARD_VALUE || patternItem.hasTagCompound() || patternItem
|
||||
.isItemStackDamageable();
|
||||
|
||||
if( !checkFuzzy )
|
||||
{
|
||||
|
||||
@@ -82,7 +82,8 @@ public class PacketMEInventoryUpdate extends AppEngPacket
|
||||
|
||||
// int originalBytes = stream.readableBytes();
|
||||
|
||||
final GZIPInputStream gzReader = new GZIPInputStream( new InputStream(){
|
||||
final GZIPInputStream gzReader = new GZIPInputStream( new InputStream()
|
||||
{
|
||||
@Override
|
||||
public int read() throws IOException
|
||||
{
|
||||
@@ -132,7 +133,8 @@ public class PacketMEInventoryUpdate extends AppEngPacket
|
||||
this.data.writeInt( this.getPacketID() );
|
||||
this.data.writeByte( this.ref );
|
||||
|
||||
this.compressFrame = new GZIPOutputStream( new OutputStream(){
|
||||
this.compressFrame = new GZIPOutputStream( new OutputStream()
|
||||
{
|
||||
@Override
|
||||
public void write( final int value ) throws IOException
|
||||
{
|
||||
|
||||
@@ -52,7 +52,7 @@ public class PacketPartPlacement extends AppEngPacket
|
||||
this.z = stream.readInt();
|
||||
this.face = stream.readByte();
|
||||
this.eyeHeight = stream.readFloat();
|
||||
this.hand = EnumHand.values()[ stream.readByte() ];
|
||||
this.hand = EnumHand.values()[stream.readByte()];
|
||||
}
|
||||
|
||||
// api
|
||||
@@ -77,7 +77,8 @@ public class PacketPartPlacement extends AppEngPacket
|
||||
final EntityPlayerMP sender = (EntityPlayerMP) player;
|
||||
AppEng.proxy.updateRenderMode( sender );
|
||||
PartPlacement.setEyeHeight( this.eyeHeight );
|
||||
PartPlacement.place( sender.getHeldItem( hand ), new BlockPos( this.x, this.y, this.z ), EnumFacing.VALUES[this.face], sender, hand, sender.world, PartPlacement.PlaceType.INTERACT_FIRST_PASS, 0 );
|
||||
PartPlacement.place( sender.getHeldItem( hand ), new BlockPos( this.x, this.y, this.z ), EnumFacing.VALUES[this.face], sender, hand, sender.world,
|
||||
PartPlacement.PlaceType.INTERACT_FIRST_PASS, 0 );
|
||||
AppEng.proxy.updateRenderMode( null );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,16 +91,19 @@ public class PacketTransitionEffect extends AppEngPacket
|
||||
{
|
||||
if( AppEng.proxy.shouldAddParticles( Platform.getRandom() ) )
|
||||
{
|
||||
final EnergyFx fx = new EnergyFx( world, this.x + ( this.mode ? ( Platform.getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), this.y + ( this.mode ? ( Platform.getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), this.z + ( this.mode ? ( Platform.getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), Items.DIAMOND );
|
||||
final EnergyFx fx = new EnergyFx( world, this.x + ( this.mode ? ( Platform
|
||||
.getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), this.y + ( this.mode ? ( Platform
|
||||
.getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), this.z + ( this.mode ? ( Platform
|
||||
.getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), Items.DIAMOND );
|
||||
|
||||
if( !this.mode )
|
||||
{
|
||||
fx.fromItem( this.d );
|
||||
}
|
||||
|
||||
fx.setMotionX( -0.1f * this.d.xOffset);
|
||||
fx.setMotionY( -0.1f * this.d.yOffset);
|
||||
fx.setMotionZ( -0.1f * this.d.zOffset);
|
||||
fx.setMotionX( -0.1f * this.d.xOffset );
|
||||
fx.setMotionY( -0.1f * this.d.yOffset );
|
||||
fx.setMotionZ( -0.1f * this.d.zOffset );
|
||||
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
|
||||
}
|
||||
@@ -110,7 +113,11 @@ public class PacketTransitionEffect extends AppEngPacket
|
||||
{
|
||||
final Block block = world.getBlockState( new BlockPos( (int) this.x, (int) this.y, (int) this.z ) ).getBlock();
|
||||
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound( new PositionedSoundRecord( block.getSoundType().getBreakSound(), SoundCategory.BLOCKS, ( block.getSoundType().getVolume() + 1.0F ) / 2.0F, block.getSoundType().getPitch() * 0.8F, (float) this.x + 0.5F, (float) this.y + 0.5F, (float) this.z + 0.5F ) );
|
||||
Minecraft.getMinecraft()
|
||||
.getSoundHandler()
|
||||
.playSound( new PositionedSoundRecord( block.getSoundType()
|
||||
.getBreakSound(), SoundCategory.BLOCKS, ( block.getSoundType().getVolume() + 1.0F ) / 2.0F, block.getSoundType()
|
||||
.getPitch() * 0.8F, (float) this.x + 0.5F, (float) this.y + 0.5F, (float) this.z + 0.5F ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,9 @@ public class PacketValueConfig extends AppEngPacket
|
||||
{
|
||||
final Container c = player.openContainer;
|
||||
|
||||
if( this.Name.equals( "Item" ) && ( ( !player.getHeldItem( EnumHand.MAIN_HAND ).isEmpty() && player.getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof IMouseWheelItem ) || ( !player.getHeldItem( EnumHand.OFF_HAND ).isEmpty() && player.getHeldItem(EnumHand.OFF_HAND).getItem() instanceof IMouseWheelItem ) ) )
|
||||
if( this.Name.equals( "Item" ) && ( ( !player.getHeldItem( EnumHand.MAIN_HAND ).isEmpty() && player.getHeldItem( EnumHand.MAIN_HAND )
|
||||
.getItem() instanceof IMouseWheelItem ) || ( !player.getHeldItem( EnumHand.OFF_HAND )
|
||||
.isEmpty() && player.getHeldItem( EnumHand.OFF_HAND ).getItem() instanceof IMouseWheelItem ) ) )
|
||||
{
|
||||
final EnumHand hand;
|
||||
if( !player.getHeldItem( EnumHand.MAIN_HAND ).isEmpty() && player.getHeldItem( EnumHand.MAIN_HAND ).getItem() instanceof IMouseWheelItem )
|
||||
|
||||
Reference in New Issue
Block a user