text
stringlengths 30
1.67M
|
|---|
<s> package net . minecraft . src ; import java . util . Random ; public class BlockPortal extends BlockBreakable { public BlockPortal ( int par1 , int par2 ) { super ( par1 , par2 , Material . portal , false ) ; } public AxisAlignedBB getCollisionBoundingBoxFromPool ( World par1World , int par2 , int par3 , int i ) { return null ; } public void setBlockBoundsBasedOnState ( IBlockAccess par1IBlockAccess , int par2 , int par3 , int par4 ) { if ( par1IBlockAccess . getBlockId ( par2 - <NUM_LIT:1> , par3 , par4 ) == blockID || par1IBlockAccess . getBlockId ( par2 + <NUM_LIT:1> , par3 , par4 ) == blockID ) { float f = <NUM_LIT> ; float f2 = <NUM_LIT> ; setBlockBounds ( <NUM_LIT> - f , <NUM_LIT> , <NUM_LIT> - f2 , <NUM_LIT> + f , <NUM_LIT> , <NUM_LIT> + f2 ) ; } else { float f1 = <NUM_LIT> ; float f3 = <NUM_LIT> ; setBlockBounds ( <NUM_LIT> - f1 , <NUM_LIT> , <NUM_LIT> - f3 , <NUM_LIT> + f1 , <NUM_LIT> , <NUM_LIT> + f3 ) ; } } public boolean isOpaqueCube ( ) { return false ; } public boolean renderAsNormalBlock ( ) { return false ; } public boolean tryToCreatePortal ( World par1World , int par2 , int par3 , int par4 ) { int i = <NUM_LIT:0> ; int j = <NUM_LIT:0> ; if ( par1World . getBlockId ( par2 - <NUM_LIT:1> , par3 , par4 ) == Block . obsidian . blockID || par1World . getBlockId ( par2 + <NUM_LIT:1> , par3 , par4 ) == Block . obsidian . blockID ) { i = <NUM_LIT:1> ; } if ( par1World . getBlockId ( par2 , par3 , par4 - <NUM_LIT:1> ) == Block . obsidian . blockID || par1World . getBlockId ( par2 , par3 , par4 + <NUM_LIT:1> ) == Block . obsidian . blockID ) { j = <NUM_LIT:1> ; } if ( i == j ) { return false ; } if ( par1World . getBlockId ( par2 - i , par3 , par4 - j ) == <NUM_LIT:0> ) { par2 -= i ; par4 -= j ; } for ( int k = - <NUM_LIT:1> ; k <= <NUM_LIT:2> ; k ++ ) { for ( int i1 = - <NUM_LIT:1> ; i1 <= <NUM_LIT:3> ; i1 ++ ) { boolean flag = k == - <NUM_LIT:1> || k == <NUM_LIT:2> || i1 == - <NUM_LIT:1> || i1 == <NUM_LIT:3> ; if ( ( k == - <NUM_LIT:1> || k == <NUM_LIT:2> ) && ( i1 == - <NUM_LIT:1> || i1 == <NUM_LIT:3> ) ) { continue ; } int k1 = par1World . getBlockId ( par2 + i * k , par3 + i1 , par4 + j * k ) ; if ( flag ) { if ( k1 != Block . obsidian . blockID ) { return false ; } continue ; } if ( k1 != <NUM_LIT:0> && k1 != Block . fire . blockID ) { return false ; } } } par1World . editingBlocks = true ; for ( int l = <NUM_LIT:0> ; l < <NUM_LIT:2> ; l ++ ) { for ( int j1 = <NUM_LIT:0> ; j1 < <NUM_LIT:3> ; j1 ++ ) { par1World . setBlockWithNotify ( par2 + i * l , par3 + j1 , par4 + j * l , Block . portal . blockID ) ; } } par1World . editingBlocks = false ; return true ; } public void onNeighborBlockChange ( World par1World , int par2 , int par3 , int par4 , int par5 ) { int i = <NUM_LIT:0> ; int j = <NUM_LIT:1> ; if ( par1World . getBlockId ( par2 - <NUM_LIT:1> , par3 , par4 ) == blockID || par1World . getBlockId ( par2 + <NUM_LIT:1> , par3 , par4 ) == blockID ) { i = <NUM_LIT:1> ; j = <NUM_LIT:0> ; } int k ; for ( k = par3 ; par1World . getBlockId ( par2 , k - <NUM_LIT:1> , par4 ) == blockID ; k -- ) { } if ( par1World . getBlockId ( par2 , k - <NUM_LIT:1> , par4 ) != Block . obsidian . blockID ) { par1World . setBlockWithNotify ( par2 , par3 , par4 , <NUM_LIT:0> ) ; return ; } int l ; for ( l = <NUM_LIT:1> ; l < <NUM_LIT:4> && par1World . getBlockId ( par2 , k + l , par4 ) == blockID ; l ++ ) { } if ( l != <NUM_LIT:3> || par1World . getBlockId ( par2 , k + l , par4 ) != Block . obsidian . blockID ) { par1World . setBlockWithNotify ( par2 , par3 , par4 , <NUM_LIT:0> ) ; return ; } boolean flag = par1World . getBlockId ( par2 - <NUM_LIT:1> , par3 , par4 ) == blockID || par1World . getBlockId ( par2 + <NUM_LIT:1> , par3 , par4 ) == blockID ; boolean flag1 = par1World . getBlockId ( par2 , par3 , par4 - <NUM_LIT:1> ) == blockID || par1World . getBlockId ( par2 , par3 , par4 + <NUM_LIT:1> ) == blockID ; if ( flag && flag1 ) { par1World . setBlockWithNotify ( par2 , par3 , par4 , <NUM_LIT:0> ) ; return ; } if ( ( par1World . getBlockId ( par2 + i , par3 , par4 + j ) != Block . obsidian . blockID || par1World . getBlockId ( par2 - i , par3 , par4 - j ) != blockID ) && ( par1World . getBlockId ( par2 - i , par3 , par4 - j ) != Block . obsidian . blockID || par1World . getBlockId ( par2 + i , par3 , par4 + j ) != blockID ) ) { par1World . setBlockWithNotify ( par2 , par3 , par4 , <NUM_LIT:0> ) ; return ; } else { return ; } } public int quantityDropped ( Random par1Random ) { return <NUM_LIT:0> ; } public void onEntityCollidedWithBlock ( World par1World , int par2 , int par3 , int par4 , Entity par5Entity ) { if ( par5Entity . ridingEntity == null && par5Entity . riddenByEntity == null ) { par5Entity . setInPortal ( ) ; } } } </s>
|
<s> package net . minecraft . src ; public interface ICommandListener { public abstract void log ( String s ) ; public abstract String getUsername ( ) ; } </s>
|
<s> package net . minecraft . src ; import java . io . * ; public class Packet32EntityLook extends Packet30Entity { public Packet32EntityLook ( ) { rotating = true ; } public Packet32EntityLook ( int par1 , byte par2 , byte par3 ) { super ( par1 ) ; yaw = par2 ; pitch = par3 ; rotating = true ; } public void readPacketData ( DataInputStream par1DataInputStream ) throws IOException { super . readPacketData ( par1DataInputStream ) ; yaw = par1DataInputStream . readByte ( ) ; pitch = par1DataInputStream . readByte ( ) ; } public void writePacketData ( DataOutputStream par1DataOutputStream ) throws IOException { super . writePacketData ( par1DataOutputStream ) ; par1DataOutputStream . writeByte ( yaw ) ; par1DataOutputStream . writeByte ( pitch ) ; } public int getPacketSize ( ) { return <NUM_LIT:6> ; } } </s>
|
<s> package net . minecraft . src ; public class MapCoord { public byte field_28202_a ; public byte centerX ; public byte centerZ ; public byte iconRotation ; final MapData data ; public MapCoord ( MapData par1MapData , byte par2 , byte par3 , byte par4 , byte par5 ) { data = par1MapData ; field_28202_a = par2 ; centerX = par3 ; centerZ = par4 ; iconRotation = par5 ; } } </s>
|
<s> package net . minecraft . src ; public interface IProgressUpdate { public abstract void displaySavingString ( String s ) ; public abstract void displayLoadingString ( String s ) ; public abstract void setLoadingProgress ( int i ) ; } </s>
|
<s> package net . minecraft . src ; public class ItemDoor extends Item { private Material doorMaterial ; public ItemDoor ( int par1 , Material par2Material ) { super ( par1 ) ; doorMaterial = par2Material ; maxStackSize = <NUM_LIT:1> ; } public boolean onItemUse ( ItemStack par1ItemStack , EntityPlayer par2EntityPlayer , World par3World , int par4 , int par5 , int par6 , int par7 ) { if ( par7 != <NUM_LIT:1> ) { return false ; } par5 ++ ; Block block ; if ( doorMaterial == Material . wood ) { block = Block . doorWood ; } else { block = Block . doorSteel ; } if ( ! par2EntityPlayer . canPlayerEdit ( par4 , par5 , par6 ) || ! par2EntityPlayer . canPlayerEdit ( par4 , par5 + <NUM_LIT:1> , par6 ) ) { return false ; } if ( ! block . canPlaceBlockAt ( par3World , par4 , par5 , par6 ) ) { return false ; } else { int i = MathHelper . floor_double ( ( double ) ( ( ( par2EntityPlayer . rotationYaw + <NUM_LIT> ) * <NUM_LIT> ) / <NUM_LIT> ) - <NUM_LIT> ) & <NUM_LIT:3> ; placeDoorBlock ( par3World , par4 , par5 , par6 , i , block ) ; par1ItemStack . stackSize -- ; return true ; } } public static void placeDoorBlock ( World par0World , int par1 , int par2 , int par3 , int par4 , Block par5Block ) { byte byte0 = <NUM_LIT:0> ; byte byte1 = <NUM_LIT:0> ; if ( par4 == <NUM_LIT:0> ) { byte1 = <NUM_LIT:1> ; } if ( par4 == <NUM_LIT:1> ) { byte0 = - <NUM_LIT:1> ; } if ( par4 == <NUM_LIT:2> ) { byte1 = - <NUM_LIT:1> ; } if ( par4 == <NUM_LIT:3> ) { byte0 = <NUM_LIT:1> ; } int i = ( par0World . isBlockNormalCube ( par1 - byte0 , par2 , par3 - byte1 ) ? <NUM_LIT:1> : <NUM_LIT:0> ) + ( par0World . isBlockNormalCube ( par1 - byte0 , par2 + <NUM_LIT:1> , par3 - byte1 ) ? <NUM_LIT:1> : <NUM_LIT:0> ) ; int j = ( par0World . isBlockNormalCube ( par1 + byte0 , par2 , par3 + byte1 ) ? <NUM_LIT:1> : <NUM_LIT:0> ) + ( par0World . isBlockNormalCube ( par1 + byte0 , par2 + <NUM_LIT:1> , par3 + byte1 ) ? <NUM_LIT:1> : <NUM_LIT:0> ) ; boolean flag = par0World . getBlockId ( par1 - byte0 , par2 , par3 - byte1 ) == par5Block . blockID || par0World . getBlockId ( par1 - byte0 , par2 + <NUM_LIT:1> , par3 - byte1 ) == par5Block . blockID ; boolean flag1 = par0World . getBlockId ( par1 + byte0 , par2 , par3 + byte1 ) == par5Block . blockID || par0World . getBlockId ( par1 + byte0 , par2 + <NUM_LIT:1> , par3 + byte1 ) == par5Block . blockID ; boolean flag2 = false ; if ( flag && ! flag1 ) { flag2 = true ; } else if ( j > i ) { flag2 = true ; } par0World . editingBlocks = true ; par0World . setBlockAndMetadataWithNotify ( par1 , par2 , par3 , par5Block . blockID , par4 ) ; par0World . setBlockAndMetadataWithNotify ( par1 , par2 + <NUM_LIT:1> , par3 , par5Block . blockID , <NUM_LIT:8> | ( flag2 ? <NUM_LIT:1> : <NUM_LIT:0> ) ) ; par0World . editingBlocks = false ; par0World . notifyBlocksOfNeighborChange ( par1 , par2 , par3 , par5Block . blockID ) ; par0World . notifyBlocksOfNeighborChange ( par1 , par2 + <NUM_LIT:1> , par3 , par5Block . blockID ) ; } } </s>
|
<s> package net . minecraft . src ; public class GenLayerShore extends GenLayer { public GenLayerShore ( long par1 , GenLayer par3GenLayer ) { super ( par1 ) ; parent = par3GenLayer ; } public int [ ] getInts ( int par1 , int par2 , int par3 , int par4 ) { int ai [ ] = parent . getInts ( par1 - <NUM_LIT:1> , par2 - <NUM_LIT:1> , par3 + <NUM_LIT:2> , par4 + <NUM_LIT:2> ) ; int ai1 [ ] = IntCache . getIntCache ( par3 * par4 ) ; for ( int i = <NUM_LIT:0> ; i < par4 ; i ++ ) { for ( int j = <NUM_LIT:0> ; j < par3 ; j ++ ) { initChunkSeed ( j + par1 , i + par2 ) ; int k = ai [ j + <NUM_LIT:1> + ( i + <NUM_LIT:1> ) * ( par3 + <NUM_LIT:2> ) ] ; if ( k == BiomeGenBase . mushroomIsland . biomeID ) { int l = ai [ j + <NUM_LIT:1> + ( ( i + <NUM_LIT:1> ) - <NUM_LIT:1> ) * ( par3 + <NUM_LIT:2> ) ] ; int k1 = ai [ j + <NUM_LIT:1> + <NUM_LIT:1> + ( i + <NUM_LIT:1> ) * ( par3 + <NUM_LIT:2> ) ] ; int j2 = ai [ ( ( j + <NUM_LIT:1> ) - <NUM_LIT:1> ) + ( i + <NUM_LIT:1> ) * ( par3 + <NUM_LIT:2> ) ] ; int i3 = ai [ j + <NUM_LIT:1> + ( i + <NUM_LIT:1> + <NUM_LIT:1> ) * ( par3 + <NUM_LIT:2> ) ] ; if ( l == BiomeGenBase . ocean . biomeID || k1 == BiomeGenBase . ocean . biomeID || j2 == BiomeGenBase . ocean . biomeID || i3 == BiomeGenBase . ocean . biomeID ) { ai1 [ j + i * par3 ] = BiomeGenBase . mushroomIslandShore . biomeID ; } else { ai1 [ j + i * par3 ] = k ; } continue ; } if ( k != BiomeGenBase . ocean . biomeID && k != BiomeGenBase . river . biomeID && k != BiomeGenBase . swampland . biomeID && k != BiomeGenBase . extremeHills . biomeID ) { int i1 = ai [ j + <NUM_LIT:1> + ( ( i + <NUM_LIT:1> ) - <NUM_LIT:1> ) * ( par3 + <NUM_LIT:2> ) ] ; int l1 = ai [ j + <NUM_LIT:1> + <NUM_LIT:1> + ( i + <NUM_LIT:1> ) * ( par3 + <NUM_LIT:2> ) ] ; int k2 = ai [ ( ( j + <NUM_LIT:1> ) - <NUM_LIT:1> ) + ( i + <NUM_LIT:1> ) * ( par3 + <NUM_LIT:2> ) ] ; int j3 = ai [ j + <NUM_LIT:1> + ( i + <NUM_LIT:1> + <NUM_LIT:1> ) * ( par3 + <NUM_LIT:2> ) ] ; if ( i1 == BiomeGenBase . ocean . biomeID || l1 == BiomeGenBase . ocean . biomeID || k2 == BiomeGenBase . ocean . biomeID || j3 == BiomeGenBase . ocean . biomeID ) { ai1 [ j + i * par3 ] = BiomeGenBase . beach . biomeID ; } else { ai1 [ j + i * par3 ] = k ; } continue ; } if ( k == BiomeGenBase . extremeHills . biomeID ) { int j1 = ai [ j + <NUM_LIT:1> + ( ( i + <NUM_LIT:1> ) - <NUM_LIT:1> ) * ( par3 + <NUM_LIT:2> ) ] ; int i2 = ai [ j + <NUM_LIT:1> + <NUM_LIT:1> + ( i + <NUM_LIT:1> ) * ( par3 + <NUM_LIT:2> ) ] ; int l2 = ai [ ( ( j + <NUM_LIT:1> ) - <NUM_LIT:1> ) + ( i + <NUM_LIT:1> ) * ( par3 + <NUM_LIT:2> ) ] ; int k3 = ai [ j + <NUM_LIT:1> + ( i + <NUM_LIT:1> + <NUM_LIT:1> ) * ( par3 + <NUM_LIT:2> ) ] ; if ( j1 != BiomeGenBase . extremeHills . biomeID || i2 != BiomeGenBase . extremeHills . biomeID || l2 != BiomeGenBase . extremeHills . biomeID || k3 != BiomeGenBase . extremeHills . biomeID ) { ai1 [ j + i * par3 ] = BiomeGenBase . extremeHillsEdge . biomeID ; } else { ai1 [ j + i * par3 ] = k ; } } else { ai1 [ j + i * par3 ] = k ; } } } return ai1 ; } } </s>
|
<s> package net . minecraft . src ; import java . io . * ; public class Packet106Transaction extends Packet { public int windowId ; public short shortWindowId ; public boolean accepted ; public Packet106Transaction ( ) { } public Packet106Transaction ( int par1 , short par2 , boolean par3 ) { windowId = par1 ; shortWindowId = par2 ; accepted = par3 ; } public void processPacket ( NetHandler par1NetHandler ) { par1NetHandler . handleTransaction ( this ) ; } public void readPacketData ( DataInputStream par1DataInputStream ) throws IOException { windowId = par1DataInputStream . readByte ( ) ; shortWindowId = par1DataInputStream . readShort ( ) ; accepted = par1DataInputStream . readByte ( ) != <NUM_LIT:0> ; } public void writePacketData ( DataOutputStream par1DataOutputStream ) throws IOException { par1DataOutputStream . writeByte ( windowId ) ; par1DataOutputStream . writeShort ( shortWindowId ) ; par1DataOutputStream . writeByte ( accepted ? <NUM_LIT:1> : <NUM_LIT:0> ) ; } public int getPacketSize ( ) { return <NUM_LIT:4> ; } } </s>
|
<s> package net . minecraft . src ; import java . util . ArrayList ; import java . util . List ; public class IntCache { private static int intCacheSize = <NUM_LIT> ; private static List freeSmallArrays = new ArrayList ( ) ; private static List inUseSmallArrays = new ArrayList ( ) ; private static List freeLargeArrays = new ArrayList ( ) ; private static List inUseLargeArrays = new ArrayList ( ) ; public IntCache ( ) { } public static int [ ] getIntCache ( int par0 ) { if ( par0 <= <NUM_LIT> ) { if ( freeSmallArrays . size ( ) == <NUM_LIT:0> ) { int ai [ ] = new int [ <NUM_LIT> ] ; inUseSmallArrays . add ( ai ) ; return ai ; } else { int ai1 [ ] = ( int [ ] ) freeSmallArrays . remove ( freeSmallArrays . size ( ) - <NUM_LIT:1> ) ; inUseSmallArrays . add ( ai1 ) ; return ai1 ; } } if ( par0 > intCacheSize ) { intCacheSize = par0 ; freeLargeArrays . clear ( ) ; inUseLargeArrays . clear ( ) ; int ai2 [ ] = new int [ intCacheSize ] ; inUseLargeArrays . add ( ai2 ) ; return ai2 ; } if ( freeLargeArrays . size ( ) == <NUM_LIT:0> ) { int ai3 [ ] = new int [ intCacheSize ] ; inUseLargeArrays . add ( ai3 ) ; return ai3 ; } else { int ai4 [ ] = ( int [ ] ) freeLargeArrays . remove ( freeLargeArrays . size ( ) - <NUM_LIT:1> ) ; inUseLargeArrays . add ( ai4 ) ; return ai4 ; } } public static void resetIntCache ( ) { if ( freeLargeArrays . size ( ) > <NUM_LIT:0> ) { freeLargeArrays . remove ( freeLargeArrays . size ( ) - <NUM_LIT:1> ) ; } if ( freeSmallArrays . size ( ) > <NUM_LIT:0> ) { freeSmallArrays . remove ( freeSmallArrays . size ( ) - <NUM_LIT:1> ) ; } freeLargeArrays . addAll ( inUseLargeArrays ) ; freeSmallArrays . addAll ( inUseSmallArrays ) ; inUseLargeArrays . clear ( ) ; inUseSmallArrays . clear ( ) ; } } </s>
|
<s> package net . minecraft . src ; import java . util . Random ; public class BlockRedstoneOre extends Block { private boolean glowing ; public BlockRedstoneOre ( int par1 , int par2 , boolean par3 ) { super ( par1 , par2 , Material . rock ) ; if ( par3 ) { setTickRandomly ( true ) ; } glowing = par3 ; } public int tickRate ( ) { return <NUM_LIT:30> ; } public void onBlockClicked ( World par1World , int par2 , int par3 , int par4 , EntityPlayer par5EntityPlayer ) { glow ( par1World , par2 , par3 , par4 ) ; super . onBlockClicked ( par1World , par2 , par3 , par4 , par5EntityPlayer ) ; } public void onEntityWalking ( World par1World , int par2 , int par3 , int par4 , Entity par5Entity ) { glow ( par1World , par2 , par3 , par4 ) ; super . onEntityWalking ( par1World , par2 , par3 , par4 , par5Entity ) ; } public boolean blockActivated ( World par1World , int par2 , int par3 , int par4 , EntityPlayer par5EntityPlayer ) { glow ( par1World , par2 , par3 , par4 ) ; return super . blockActivated ( par1World , par2 , par3 , par4 , par5EntityPlayer ) ; } private void glow ( World par1World , int par2 , int par3 , int par4 ) { sparkle ( par1World , par2 , par3 , par4 ) ; if ( blockID == Block . oreRedstone . blockID ) { par1World . setBlockWithNotify ( par2 , par3 , par4 , Block . oreRedstoneGlowing . blockID ) ; } } public void updateTick ( World par1World , int par2 , int par3 , int par4 , Random par5Random ) { if ( blockID == Block . oreRedstoneGlowing . blockID ) { par1World . setBlockWithNotify ( par2 , par3 , par4 , Block . oreRedstone . blockID ) ; } } public int idDropped ( int par1 , Random par2Random , int par3 ) { return Item . redstone . shiftedIndex ; } public int quantityDroppedWithBonus ( int par1 , Random par2Random ) { return quantityDropped ( par2Random ) + par2Random . nextInt ( par1 + <NUM_LIT:1> ) ; } public int quantityDropped ( Random par1Random ) { return <NUM_LIT:4> + par1Random . nextInt ( <NUM_LIT:2> ) ; } private void sparkle ( World par1World , int par2 , int par3 , int par4 ) { Random random = par1World . rand ; double d = <NUM_LIT> ; for ( int i = <NUM_LIT:0> ; i < <NUM_LIT:6> ; i ++ ) { double d1 = ( float ) par2 + random . nextFloat ( ) ; double d2 = ( float ) par3 + random . nextFloat ( ) ; double d3 = ( float ) par4 + random . nextFloat ( ) ; if ( i == <NUM_LIT:0> && ! par1World . isBlockOpaqueCube ( par2 , par3 + <NUM_LIT:1> , par4 ) ) { d2 = ( double ) ( par3 + <NUM_LIT:1> ) + d ; } if ( i == <NUM_LIT:1> && ! par1World . isBlockOpaqueCube ( par2 , par3 - <NUM_LIT:1> , par4 ) ) { d2 = ( double ) ( par3 + <NUM_LIT:0> ) - d ; } if ( i == <NUM_LIT:2> && ! par1World . isBlockOpaqueCube ( par2 , par3 , par4 + <NUM_LIT:1> ) ) { d3 = ( double ) ( par4 + <NUM_LIT:1> ) + d ; } if ( i == <NUM_LIT:3> && ! par1World . isBlockOpaqueCube ( par2 , par3 , par4 - <NUM_LIT:1> ) ) { d3 = ( double ) ( par4 + <NUM_LIT:0> ) - d ; } if ( i == <NUM_LIT:4> && ! par1World . isBlockOpaqueCube ( par2 + <NUM_LIT:1> , par3 , par4 ) ) { d1 = ( double ) ( par2 + <NUM_LIT:1> ) + d ; } if ( i == <NUM_LIT:5> && ! par1World . isBlockOpaqueCube ( par2 - <NUM_LIT:1> , par3 , par4 ) ) { d1 = ( double ) ( par2 + <NUM_LIT:0> ) - d ; } if ( d1 < ( double ) par2 || d1 > ( double ) ( par2 + <NUM_LIT:1> ) || d2 < <NUM_LIT> || d2 > ( double ) ( par3 + <NUM_LIT:1> ) || d3 < ( double ) par4 || d3 > ( double ) ( par4 + <NUM_LIT:1> ) ) { par1World . spawnParticle ( "<STR_LIT>" , d1 , d2 , d3 , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ; } } } protected ItemStack createStackedBlock ( int par1 ) { return new ItemStack ( Block . oreRedstone ) ; } } </s>
|
<s> package net . minecraft . src ; import java . util . * ; public class Village { private final World worldObj ; private final List villageDoorInfoList = new ArrayList ( ) ; private final ChunkCoordinates centerHelper = new ChunkCoordinates ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) ; private final ChunkCoordinates center = new ChunkCoordinates ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) ; private int villageRadius ; private int lastAddDoorTimestamp ; private int tickCounter ; private int numVillagers ; private List villageAgressors ; private int numIronGolems ; public Village ( World par1World ) { villageRadius = <NUM_LIT:0> ; lastAddDoorTimestamp = <NUM_LIT:0> ; tickCounter = <NUM_LIT:0> ; numVillagers = <NUM_LIT:0> ; villageAgressors = new ArrayList ( ) ; numIronGolems = <NUM_LIT:0> ; worldObj = par1World ; } public void tick ( int par1 ) { tickCounter = par1 ; removeDeadAndOutOfRangeDoors ( ) ; removeDeadAndOldAgressors ( ) ; if ( par1 % <NUM_LIT:20> == <NUM_LIT:0> ) { updateNumVillagers ( ) ; } if ( par1 % <NUM_LIT:30> == <NUM_LIT:0> ) { updateNumIronGolems ( ) ; } int i = numVillagers / <NUM_LIT:16> ; if ( numIronGolems < i && villageDoorInfoList . size ( ) > <NUM_LIT:20> && worldObj . rand . nextInt ( <NUM_LIT> ) == <NUM_LIT:0> ) { Vec3D vec3d = tryGetIronGolemSpawningLocation ( MathHelper . floor_float ( center . posX ) , MathHelper . floor_float ( center . posY ) , MathHelper . floor_float ( center . posZ ) , <NUM_LIT:2> , <NUM_LIT:4> , <NUM_LIT:2> ) ; if ( vec3d != null ) { EntityIronGolem entityirongolem = new EntityIronGolem ( worldObj ) ; entityirongolem . setPosition ( vec3d . xCoord , vec3d . yCoord , vec3d . zCoord ) ; worldObj . spawnEntityInWorld ( entityirongolem ) ; numIronGolems ++ ; } } } private Vec3D tryGetIronGolemSpawningLocation ( int par1 , int par2 , int par3 , int par4 , int par5 , int par6 ) { for ( int i = <NUM_LIT:0> ; i < <NUM_LIT:10> ; i ++ ) { int j = ( par1 + worldObj . rand . nextInt ( <NUM_LIT:16> ) ) - <NUM_LIT:8> ; int k = ( par2 + worldObj . rand . nextInt ( <NUM_LIT:6> ) ) - <NUM_LIT:3> ; int l = ( par3 + worldObj . rand . nextInt ( <NUM_LIT:16> ) ) - <NUM_LIT:8> ; if ( isInRange ( j , k , l ) && isValidIronGolemSpawningLocation ( j , k , l , par4 , par5 , par6 ) ) { return Vec3D . createVector ( j , k , l ) ; } } return null ; } private boolean isValidIronGolemSpawningLocation ( int par1 , int par2 , int par3 , int par4 , int par5 , int par6 ) { if ( ! worldObj . isBlockNormalCube ( par1 , par2 - <NUM_LIT:1> , par3 ) ) { return false ; } int i = par1 - par4 / <NUM_LIT:2> ; int j = par3 - par6 / <NUM_LIT:2> ; for ( int k = i ; k < i + par4 ; k ++ ) { for ( int l = par2 ; l < par2 + par5 ; l ++ ) { for ( int i1 = j ; i1 < j + par6 ; i1 ++ ) { if ( worldObj . isBlockNormalCube ( k , l , i1 ) ) { return false ; } } } } return true ; } private void updateNumIronGolems ( ) { List list = worldObj . getEntitiesWithinAABB ( net . minecraft . src . EntityIronGolem . class , AxisAlignedBB . getBoundingBoxFromPool ( center . posX - villageRadius , center . posY - <NUM_LIT:4> , center . posZ - villageRadius , center . posX + villageRadius , center . posY + <NUM_LIT:4> , center . posZ + villageRadius ) ) ; numIronGolems = list . size ( ) ; } private void updateNumVillagers ( ) { List list = worldObj . getEntitiesWithinAABB ( net . minecraft . src . EntityVillager . class , AxisAlignedBB . getBoundingBoxFromPool ( center . posX - villageRadius , center . posY - <NUM_LIT:4> , center . posZ - villageRadius , center . posX + villageRadius , center . posY + <NUM_LIT:4> , center . posZ + villageRadius ) ) ; numVillagers = list . size ( ) ; } public ChunkCoordinates getCenter ( ) { return center ; } public int getVillageRadius ( ) { return villageRadius ; } public int getNumVillageDoors ( ) { return villageDoorInfoList . size ( ) ; } public int getTicksSinceLastDoorAdding ( ) { return tickCounter - lastAddDoorTimestamp ; } public int getNumVillagers ( ) { return numVillagers ; } public boolean isInRange ( int par1 , int par2 , int par3 ) { return center . getDistanceSquared ( par1 , par2 , par3 ) < ( float ) ( villageRadius * villageRadius ) ; } public List getVillageDoorInfoList ( ) { return villageDoorInfoList ; } public VillageDoorInfo findNearestDoor ( int par1 , int par2 , int par3 ) { VillageDoorInfo villagedoorinfo = null ; int i = <NUM_LIT> ; Iterator iterator = villageDoorInfoList . iterator ( ) ; do { if ( ! iterator . hasNext ( ) ) { break ; } VillageDoorInfo villagedoorinfo1 = ( VillageDoorInfo ) iterator . next ( ) ; int j = villagedoorinfo1 . getDistanceSquared ( par1 , par2 , par3 ) ; if ( j < i ) { villagedoorinfo = villagedoorinfo1 ; i = j ; } } while ( true ) ; return villagedoorinfo ; } public VillageDoorInfo findNearestDoorUnrestricted ( int par1 , int par2 , int par3 ) { VillageDoorInfo villagedoorinfo = null ; int i = <NUM_LIT> ; Iterator iterator = villageDoorInfoList . iterator ( ) ; do { if ( ! iterator . hasNext ( ) ) { break ; } VillageDoorInfo villagedoorinfo1 = ( VillageDoorInfo ) iterator . next ( ) ; int j = villagedoorinfo1 . getDistanceSquared ( par1 , par2 , par3 ) ; if ( j > <NUM_LIT> ) { j *= <NUM_LIT:1000> ; } else { j = villagedoorinfo1 . getDoorOpeningRestrictionCounter ( ) ; } if ( j < i ) { villagedoorinfo = villagedoorinfo1 ; i = j ; } } while ( true ) ; return villagedoorinfo ; } public VillageDoorInfo getVillageDoorAt ( int par1 , int par2 , int par3 ) { if ( center . getDistanceSquared ( par1 , par2 , par3 ) > ( float ) ( villageRadius * villageRadius ) ) { return null ; } for ( Iterator iterator = villageDoorInfoList . iterator ( ) ; iterator . hasNext ( ) ; ) { VillageDoorInfo villagedoorinfo = ( VillageDoorInfo ) iterator . next ( ) ; if ( villagedoorinfo . posX == par1 && villagedoorinfo . posZ == par3 && Math . abs ( villagedoorinfo . posY - par2 ) <= <NUM_LIT:1> ) { return villagedoorinfo ; } } return null ; } public void addVillageDoorInfo ( VillageDoorInfo par1VillageDoorInfo ) { villageDoorInfoList . add ( par1VillageDoorInfo ) ; centerHelper . posX += par1VillageDoorInfo . posX ; centerHelper . posY += par1VillageDoorInfo . posY ; centerHelper . posZ += par1VillageDoorInfo . posZ ; updateVillageRadiusAndCenter ( ) ; lastAddDoorTimestamp = par1VillageDoorInfo . lastActivityTimestamp ; } public boolean isAnnihilated ( ) { return villageDoorInfoList . isEmpty ( ) ; } public void addOrRenewAgressor ( EntityLiving par1EntityLiving ) { for ( Iterator iterator = villageAgressors . iterator ( ) ; iterator . hasNext ( ) ; ) { VillageAgressor villageagressor = ( VillageAgressor ) iterator . next ( ) ; if ( villageagressor . agressor == par1EntityLiving ) { villageagressor . agressionTime = tickCounter ; return ; } } villageAgressors . add ( new VillageAgressor ( this , par1EntityLiving , tickCounter ) ) ; } public EntityLiving findNearestVillageAggressor ( EntityLiving par1EntityLiving ) { double d = Double . MAX_VALUE ; VillageAgressor villageagressor = null ; for ( int i = <NUM_LIT:0> ; i < villageAgressors . size ( ) ; i ++ ) { VillageAgressor villageagressor1 = ( VillageAgressor ) villageAgressors . get ( i ) ; double d1 = villageagressor1 . agressor . getDistanceSqToEntity ( par1EntityLiving ) ; if ( d1 <= d ) { villageagressor = villageagressor1 ; d = d1 ; } } return villageagressor == null ? null : villageagressor . agressor ; } private void removeDeadAndOldAgressors ( ) { Iterator iterator = villageAgressors . iterator ( ) ; do { if ( ! iterator . hasNext ( ) ) { break ; } VillageAgressor villageagressor = ( VillageAgressor ) iterator . next ( ) ; if ( ! villageagressor . agressor . isEntityAlive ( ) || Math . abs ( tickCounter - villageagressor . agressionTime ) > <NUM_LIT> ) { iterator . remove ( ) ; } } while ( true ) ; } private void removeDeadAndOutOfRangeDoors ( ) { boolean flag = false ; boolean flag1 = worldObj . rand . nextInt ( <NUM_LIT> ) == <NUM_LIT:0> ; Iterator iterator = villageDoorInfoList . iterator ( ) ; do { if ( ! iterator . hasNext ( ) ) { break ; } VillageDoorInfo villagedoorinfo = ( VillageDoorInfo ) iterator . next ( ) ; if ( flag1 ) { villagedoorinfo . resetDoorOpeningRestrictionCounter ( ) ; } if ( ! isBlockDoor ( villagedoorinfo . posX , villagedoorinfo . posY , villagedoorinfo . posZ ) || Math . abs ( tickCounter - villagedoorinfo . lastActivityTimestamp ) > <NUM_LIT> ) { centerHelper . posX -= villagedoorinfo . posX ; centerHelper . posY -= villagedoorinfo . posY ; centerHelper . posZ -= villagedoorinfo . posZ ; flag = true ; villagedoorinfo . isDetachedFromVillageFlag = true ; iterator . remove ( ) ; } } while ( true ) ; if ( flag ) { updateVillageRadiusAndCenter ( ) ; } } private boolean isBlockDoor ( int par1 , int par2 , int par3 ) { int i = worldObj . getBlockId ( par1 , par2 , par3 ) ; if ( i <= <NUM_LIT:0> ) { return false ; } else { return i == Block . doorWood . blockID ; } } private void updateVillageRadiusAndCenter ( ) { int i = villageDoorInfoList . size ( ) ; if ( i == <NUM_LIT:0> ) { center . set ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) ; villageRadius = <NUM_LIT:0> ; return ; } center . set ( centerHelper . posX / i , centerHelper . posY / i , centerHelper . posZ / i ) ; int j = <NUM_LIT:0> ; for ( Iterator iterator = villageDoorInfoList . iterator ( ) ; iterator . hasNext ( ) ; ) { VillageDoorInfo villagedoorinfo = ( VillageDoorInfo ) iterator . next ( ) ; j = Math . max ( villagedoorinfo . getDistanceSquared ( center . posX , center . posY , center . posZ ) , j ) ; } villageRadius = Math . max ( <NUM_LIT:32> , ( int ) Math . sqrt ( j ) + <NUM_LIT:1> ) ; } } </s>
|
<s> package net . minecraft . src ; public class GenLayerIsland extends GenLayer { public GenLayerIsland ( long par1 ) { super ( par1 ) ; } public int [ ] getInts ( int par1 , int par2 , int par3 , int par4 ) { int ai [ ] = IntCache . getIntCache ( par3 * par4 ) ; for ( int i = <NUM_LIT:0> ; i < par4 ; i ++ ) { for ( int j = <NUM_LIT:0> ; j < par3 ; j ++ ) { initChunkSeed ( par1 + j , par2 + i ) ; ai [ j + i * par3 ] = nextInt ( <NUM_LIT:10> ) != <NUM_LIT:0> ? <NUM_LIT:0> : <NUM_LIT:1> ; } } if ( par1 > - par3 && par1 <= <NUM_LIT:0> && par2 > - par4 && par2 <= <NUM_LIT:0> ) { ai [ - par1 + - par2 * par3 ] = <NUM_LIT:1> ; } return ai ; } } </s>
|
<s> package net . minecraft . src ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . HashMap ; import java . util . Map ; public class AchievementMap { public static AchievementMap instance = new AchievementMap ( ) ; private Map guidMap ; private AchievementMap ( ) { guidMap = new HashMap ( ) ; try { BufferedReader bufferedreader = new BufferedReader ( new InputStreamReader ( ( net . minecraft . src . AchievementMap . class ) . getResourceAsStream ( "<STR_LIT>" ) ) ) ; String s ; while ( ( s = bufferedreader . readLine ( ) ) != null ) { String as [ ] = s . split ( "<STR_LIT:U+002C>" ) ; int i = Integer . parseInt ( as [ <NUM_LIT:0> ] ) ; guidMap . put ( Integer . valueOf ( i ) , as [ <NUM_LIT:1> ] ) ; } bufferedreader . close ( ) ; } catch ( Exception exception ) { exception . printStackTrace ( ) ; } } public static String getGuid ( int par0 ) { return ( String ) instance . guidMap . get ( Integer . valueOf ( par0 ) ) ; } } </s>
|
<s> package net . minecraft . src ; import java . util . ArrayList ; import java . util . List ; public class AxisAlignedBB { private static List boundingBoxes = new ArrayList ( ) ; private static int numBoundingBoxesInUse = <NUM_LIT:0> ; public double minX ; public double minY ; public double minZ ; public double maxX ; public double maxY ; public double maxZ ; public static AxisAlignedBB getBoundingBox ( double par0 , double par2 , double par4 , double par6 , double par8 , double par10 ) { return new AxisAlignedBB ( par0 , par2 , par4 , par6 , par8 , par10 ) ; } public static void clearBoundingBoxPool ( ) { numBoundingBoxesInUse = <NUM_LIT:0> ; } public static AxisAlignedBB getBoundingBoxFromPool ( double par0 , double par2 , double par4 , double par6 , double par8 , double par10 ) { if ( numBoundingBoxesInUse >= boundingBoxes . size ( ) ) { boundingBoxes . add ( getBoundingBox ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) ; } return ( ( AxisAlignedBB ) boundingBoxes . get ( numBoundingBoxesInUse ++ ) ) . setBounds ( par0 , par2 , par4 , par6 , par8 , par10 ) ; } private AxisAlignedBB ( double par1 , double par3 , double par5 , double par7 , double par9 , double par11 ) { minX = par1 ; minY = par3 ; minZ = par5 ; maxX = par7 ; maxY = par9 ; maxZ = par11 ; } public AxisAlignedBB setBounds ( double par1 , double par3 , double par5 , double par7 , double par9 , double par11 ) { minX = par1 ; minY = par3 ; minZ = par5 ; maxX = par7 ; maxY = par9 ; maxZ = par11 ; return this ; } public AxisAlignedBB addCoord ( double par1 , double par3 , double par5 ) { double d = minX ; double d1 = minY ; double d2 = minZ ; double d3 = maxX ; double d4 = maxY ; double d5 = maxZ ; if ( par1 < <NUM_LIT> ) { d += par1 ; } if ( par1 > <NUM_LIT> ) { d3 += par1 ; } if ( par3 < <NUM_LIT> ) { d1 += par3 ; } if ( par3 > <NUM_LIT> ) { d4 += par3 ; } if ( par5 < <NUM_LIT> ) { d2 += par5 ; } if ( par5 > <NUM_LIT> ) { d5 += par5 ; } return getBoundingBoxFromPool ( d , d1 , d2 , d3 , d4 , d5 ) ; } public AxisAlignedBB expand ( double par1 , double par3 , double par5 ) { double d = minX - par1 ; double d1 = minY - par3 ; double d2 = minZ - par5 ; double d3 = maxX + par1 ; double d4 = maxY + par3 ; double d5 = maxZ + par5 ; return getBoundingBoxFromPool ( d , d1 , d2 , d3 , d4 , d5 ) ; } public AxisAlignedBB getOffsetBoundingBox ( double par1 , double par3 , double par5 ) { return getBoundingBoxFromPool ( minX + par1 , minY + par3 , minZ + par5 , maxX + par1 , maxY + par3 , maxZ + par5 ) ; } public double calculateXOffset ( AxisAlignedBB par1AxisAlignedBB , double par2 ) { if ( par1AxisAlignedBB . maxY <= minY || par1AxisAlignedBB . minY >= maxY ) { return par2 ; } if ( par1AxisAlignedBB . maxZ <= minZ || par1AxisAlignedBB . minZ >= maxZ ) { return par2 ; } if ( par2 > <NUM_LIT> && par1AxisAlignedBB . maxX <= minX ) { double d = minX - par1AxisAlignedBB . maxX ; if ( d < par2 ) { par2 = d ; } } if ( par2 < <NUM_LIT> && par1AxisAlignedBB . minX >= maxX ) { double d1 = maxX - par1AxisAlignedBB . minX ; if ( d1 > par2 ) { par2 = d1 ; } } return par2 ; } public double calculateYOffset ( AxisAlignedBB par1AxisAlignedBB , double par2 ) { if ( par1AxisAlignedBB . maxX <= minX || par1AxisAlignedBB . minX >= maxX ) { return par2 ; } if ( par1AxisAlignedBB . maxZ <= minZ || par1AxisAlignedBB . minZ >= maxZ ) { return par2 ; } if ( par2 > <NUM_LIT> && par1AxisAlignedBB . maxY <= minY ) { double d = minY - par1AxisAlignedBB . maxY ; if ( d < par2 ) { par2 = d ; } } if ( par2 < <NUM_LIT> && par1AxisAlignedBB . minY >= maxY ) { double d1 = maxY - par1AxisAlignedBB . minY ; if ( d1 > par2 ) { par2 = d1 ; } } return par2 ; } public double calculateZOffset ( AxisAlignedBB par1AxisAlignedBB , double par2 ) { if ( par1AxisAlignedBB . maxX <= minX || par1AxisAlignedBB . minX >= maxX ) { return par2 ; } if ( par1AxisAlignedBB . maxY <= minY || par1AxisAlignedBB . minY >= maxY ) { return par2 ; } if ( par2 > <NUM_LIT> && par1AxisAlignedBB . maxZ <= minZ ) { double d = minZ - par1AxisAlignedBB . maxZ ; if ( d < par2 ) { par2 = d ; } } if ( par2 < <NUM_LIT> && par1AxisAlignedBB . minZ >= maxZ ) { double d1 = maxZ - par1AxisAlignedBB . minZ ; if ( d1 > par2 ) { par2 = d1 ; } } return par2 ; } public boolean intersectsWith ( AxisAlignedBB par1AxisAlignedBB ) { if ( par1AxisAlignedBB . maxX <= minX || par1AxisAlignedBB . minX >= maxX ) { return false ; } if ( par1AxisAlignedBB . maxY <= minY || par1AxisAlignedBB . minY >= maxY ) { return false ; } return par1AxisAlignedBB . maxZ > minZ && par1AxisAlignedBB . minZ < maxZ ; } public AxisAlignedBB offset ( double par1 , double par3 , double par5 ) { minX += par1 ; minY += par3 ; minZ += par5 ; maxX += par1 ; maxY += par3 ; maxZ += par5 ; return this ; } public boolean isVecInside ( Vec3D par1Vec3D ) { if ( par1Vec3D . xCoord <= minX || par1Vec3D . xCoord >= maxX ) { return false ; } if ( par1Vec3D . yCoord <= minY || par1Vec3D . yCoord >= maxY ) { return false ; } return par1Vec3D . zCoord > minZ && par1Vec3D . zCoord < maxZ ; } public AxisAlignedBB contract ( double par1 , double par3 , double par5 ) { double d = minX + par1 ; double d1 = minY + par3 ; double d2 = minZ + par5 ; double d3 = maxX - par1 ; double d4 = maxY - par3 ; double d5 = maxZ - par5 ; return getBoundingBoxFromPool ( d , d1 , d2 , d3 , d4 , d5 ) ; } public AxisAlignedBB copy ( ) { return getBoundingBoxFromPool ( minX , minY , minZ , maxX , maxY , maxZ ) ; } public MovingObjectPosition calculateIntercept ( Vec3D par1Vec3D , Vec3D par2Vec3D ) { Vec3D vec3d = par1Vec3D . getIntermediateWithXValue ( par2Vec3D , minX ) ; Vec3D vec3d1 = par1Vec3D . getIntermediateWithXValue ( par2Vec3D , maxX ) ; Vec3D vec3d2 = par1Vec3D . getIntermediateWithYValue ( par2Vec3D , minY ) ; Vec3D vec3d3 = par1Vec3D . getIntermediateWithYValue ( par2Vec3D , maxY ) ; Vec3D vec3d4 = par1Vec3D . getIntermediateWithZValue ( par2Vec3D , minZ ) ; Vec3D vec3d5 = par1Vec3D . getIntermediateWithZValue ( par2Vec3D , maxZ ) ; if ( ! isVecInYZ ( vec3d ) ) { vec3d = null ; } if ( ! isVecInYZ ( vec3d1 ) ) { vec3d1 = null ; } if ( ! isVecInXZ ( vec3d2 ) ) { vec3d2 = null ; } if ( ! isVecInXZ ( vec3d3 ) ) { vec3d3 = null ; } if ( ! isVecInXY ( vec3d4 ) ) { vec3d4 = null ; } if ( ! isVecInXY ( vec3d5 ) ) { vec3d5 = null ; } Vec3D vec3d6 = null ; if ( vec3d != null && ( vec3d6 == null || par1Vec3D . squareDistanceTo ( vec3d ) < par1Vec3D . squareDistanceTo ( vec3d6 ) ) ) { vec3d6 = vec3d ; } if ( vec3d1 != null && ( vec3d6 == null || par1Vec3D . squareDistanceTo ( vec3d1 ) < par1Vec3D . squareDistanceTo ( vec3d6 ) ) ) { vec3d6 = vec3d1 ; } if ( vec3d2 != null && ( vec3d6 == null || par1Vec3D . squareDistanceTo ( vec3d2 ) < par1Vec3D . squareDistanceTo ( vec3d6 ) ) ) { vec3d6 = vec3d2 ; } if ( vec3d3 != null && ( vec3d6 == null || par1Vec3D . squareDistanceTo ( vec3d3 ) < par1Vec3D . squareDistanceTo ( vec3d6 ) ) ) { vec3d6 = vec3d3 ; } if ( vec3d4 != null && ( vec3d6 == null || par1Vec3D . squareDistanceTo ( vec3d4 ) < par1Vec3D . squareDistanceTo ( vec3d6 ) ) ) { vec3d6 = vec3d4 ; } if ( vec3d5 != null && ( vec3d6 == null || par1Vec3D . squareDistanceTo ( vec3d5 ) < par1Vec3D . squareDistanceTo ( vec3d6 ) ) ) { vec3d6 = vec3d5 ; } if ( vec3d6 == null ) { return null ; } byte byte0 = - <NUM_LIT:1> ; if ( vec3d6 == vec3d ) { byte0 = <NUM_LIT:4> ; } if ( vec3d6 == vec3d1 ) { byte0 = <NUM_LIT:5> ; } if ( vec3d6 == vec3d2 ) { byte0 = <NUM_LIT:0> ; } if ( vec3d6 == vec3d3 ) { byte0 = <NUM_LIT:1> ; } if ( vec3d6 == vec3d4 ) { byte0 = <NUM_LIT:2> ; } if ( vec3d6 == vec3d5 ) { byte0 = <NUM_LIT:3> ; } return new MovingObjectPosition ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , byte0 , vec3d6 ) ; } private boolean isVecInYZ ( Vec3D par1Vec3D ) { if ( par1Vec3D == null ) { return false ; } else { return par1Vec3D . yCoord >= minY && par1Vec3D . yCoord <= maxY && par1Vec3D . zCoord >= minZ && par1Vec3D . zCoord <= maxZ ; } } private boolean isVecInXZ ( Vec3D par1Vec3D ) { if ( par1Vec3D == null ) { return false ; } else { return par1Vec3D . xCoord >= minX && par1Vec3D . xCoord <= maxX && par1Vec3D . zCoord >= minZ && par1Vec3D . zCoord <= maxZ ; } } private boolean isVecInXY ( Vec3D par1Vec3D ) { if ( par1Vec3D == null ) { return false ; } else { return par1Vec3D . xCoord >= minX && par1Vec3D . xCoord <= maxX && par1Vec3D . yCoord >= minY && par1Vec3D . yCoord <= maxY ; } } public void setBB ( AxisAlignedBB par1AxisAlignedBB ) { minX = par1AxisAlignedBB . minX ; minY = par1AxisAlignedBB . minY ; minZ = par1AxisAlignedBB . minZ ; maxX = par1AxisAlignedBB . maxX ; maxY = par1AxisAlignedBB . maxY ; maxZ = par1AxisAlignedBB . maxZ ; } public String toString ( ) { return ( new StringBuilder ( ) ) . append ( "<STR_LIT>" ) . append ( minX ) . append ( "<STR_LIT:U+002CU+0020>" ) . append ( minY ) . append ( "<STR_LIT:U+002CU+0020>" ) . append ( minZ ) . append ( "<STR_LIT>" ) . append ( maxX ) . append ( "<STR_LIT:U+002CU+0020>" ) . append ( maxY ) . append ( "<STR_LIT:U+002CU+0020>" ) . append ( maxZ ) . append ( "<STR_LIT:]>" ) . toString ( ) ; } } </s>
|
<s> package net . minecraft . src ; import java . util . * ; public class EntityPainting extends Entity { private int tickCounter1 ; public int direction ; public int xPosition ; public int yPosition ; public int zPosition ; public EnumArt art ; public EntityPainting ( World par1World ) { super ( par1World ) ; tickCounter1 = <NUM_LIT:0> ; direction = <NUM_LIT:0> ; yOffset = <NUM_LIT> ; setSize ( <NUM_LIT> , <NUM_LIT> ) ; } public EntityPainting ( World par1World , int par2 , int par3 , int par4 , int par5 ) { this ( par1World ) ; xPosition = par2 ; yPosition = par3 ; zPosition = par4 ; ArrayList arraylist = new ArrayList ( ) ; EnumArt aenumart [ ] = EnumArt . values ( ) ; int i = aenumart . length ; for ( int j = <NUM_LIT:0> ; j < i ; j ++ ) { EnumArt enumart = aenumart [ j ] ; art = enumart ; func_179_a ( par5 ) ; if ( onValidSurface ( ) ) { arraylist . add ( enumart ) ; } } if ( arraylist . size ( ) > <NUM_LIT:0> ) { art = ( EnumArt ) arraylist . get ( rand . nextInt ( arraylist . size ( ) ) ) ; } func_179_a ( par5 ) ; } protected void entityInit ( ) { } public void func_179_a ( int par1 ) { direction = par1 ; prevRotationYaw = rotationYaw = par1 * <NUM_LIT> ; float f = art . sizeX ; float f1 = art . sizeY ; float f2 = art . sizeX ; if ( par1 == <NUM_LIT:0> || par1 == <NUM_LIT:2> ) { f2 = <NUM_LIT> ; } else { f = <NUM_LIT> ; } f /= <NUM_LIT> ; f1 /= <NUM_LIT> ; f2 /= <NUM_LIT> ; float f3 = ( float ) xPosition + <NUM_LIT> ; float f4 = ( float ) yPosition + <NUM_LIT> ; float f5 = ( float ) zPosition + <NUM_LIT> ; float f6 = <NUM_LIT> ; if ( par1 == <NUM_LIT:0> ) { f5 -= f6 ; } if ( par1 == <NUM_LIT:1> ) { f3 -= f6 ; } if ( par1 == <NUM_LIT:2> ) { f5 += f6 ; } if ( par1 == <NUM_LIT:3> ) { f3 += f6 ; } if ( par1 == <NUM_LIT:0> ) { f3 -= func_180_c ( art . sizeX ) ; } if ( par1 == <NUM_LIT:1> ) { f5 += func_180_c ( art . sizeX ) ; } if ( par1 == <NUM_LIT:2> ) { f3 += func_180_c ( art . sizeX ) ; } if ( par1 == <NUM_LIT:3> ) { f5 -= func_180_c ( art . sizeX ) ; } f4 += func_180_c ( art . sizeY ) ; setPosition ( f3 , f4 , f5 ) ; float f7 = - <NUM_LIT> ; boundingBox . setBounds ( f3 - f - f7 , f4 - f1 - f7 , f5 - f2 - f7 , f3 + f + f7 , f4 + f1 + f7 , f5 + f2 + f7 ) ; } private float func_180_c ( int par1 ) { if ( par1 == <NUM_LIT:32> ) { return <NUM_LIT> ; } return par1 != <NUM_LIT> ? <NUM_LIT> : <NUM_LIT> ; } public void onUpdate ( ) { if ( tickCounter1 ++ == <NUM_LIT:100> && ! worldObj . isRemote ) { tickCounter1 = <NUM_LIT:0> ; if ( ! isDead && ! onValidSurface ( ) ) { setDead ( ) ; worldObj . spawnEntityInWorld ( new EntityItem ( worldObj , posX , posY , posZ , new ItemStack ( Item . painting ) ) ) ; } } } public boolean onValidSurface ( ) { if ( worldObj . getCollidingBoundingBoxes ( this , boundingBox ) . size ( ) > <NUM_LIT:0> ) { return false ; } int i = art . sizeX / <NUM_LIT:16> ; int j = art . sizeY / <NUM_LIT:16> ; int k = xPosition ; int l = yPosition ; int i1 = zPosition ; if ( direction == <NUM_LIT:0> ) { k = MathHelper . floor_double ( posX - ( double ) ( ( float ) art . sizeX / <NUM_LIT> ) ) ; } if ( direction == <NUM_LIT:1> ) { i1 = MathHelper . floor_double ( posZ - ( double ) ( ( float ) art . sizeX / <NUM_LIT> ) ) ; } if ( direction == <NUM_LIT:2> ) { k = MathHelper . floor_double ( posX - ( double ) ( ( float ) art . sizeX / <NUM_LIT> ) ) ; } if ( direction == <NUM_LIT:3> ) { i1 = MathHelper . floor_double ( posZ - ( double ) ( ( float ) art . sizeX / <NUM_LIT> ) ) ; } l = MathHelper . floor_double ( posY - ( double ) ( ( float ) art . sizeY / <NUM_LIT> ) ) ; for ( int j1 = <NUM_LIT:0> ; j1 < i ; j1 ++ ) { for ( int k1 = <NUM_LIT:0> ; k1 < j ; k1 ++ ) { Material material ; if ( direction == <NUM_LIT:0> || direction == <NUM_LIT:2> ) { material = worldObj . getBlockMaterial ( k + j1 , l + k1 , zPosition ) ; } else { material = worldObj . getBlockMaterial ( xPosition , l + k1 , i1 + j1 ) ; } if ( ! material . isSolid ( ) ) { return false ; } } } List list = worldObj . getEntitiesWithinAABBExcludingEntity ( this , boundingBox ) ; for ( int l1 = <NUM_LIT:0> ; l1 < list . size ( ) ; l1 ++ ) { if ( list . get ( l1 ) instanceof EntityPainting ) { return false ; } } return true ; } public boolean canBeCollidedWith ( ) { return true ; } public boolean attackEntityFrom ( DamageSource par1DamageSource , int par2 ) { if ( ! isDead && ! worldObj . isRemote ) { setDead ( ) ; setBeenAttacked ( ) ; worldObj . spawnEntityInWorld ( new EntityItem ( worldObj , posX , posY , posZ , new ItemStack ( Item . painting ) ) ) ; } return true ; } public void writeEntityToNBT ( NBTTagCompound par1NBTTagCompound ) { par1NBTTagCompound . setByte ( "<STR_LIT>" , ( byte ) direction ) ; par1NBTTagCompound . setString ( "<STR_LIT>" , art . title ) ; par1NBTTagCompound . setInteger ( "<STR_LIT>" , xPosition ) ; par1NBTTagCompound . setInteger ( "<STR_LIT>" , yPosition ) ; par1NBTTagCompound . setInteger ( "<STR_LIT>" , zPosition ) ; } public void readEntityFromNBT ( NBTTagCompound par1NBTTagCompound ) { direction = par1NBTTagCompound . getByte ( "<STR_LIT>" ) ; xPosition = par1NBTTagCompound . getInteger ( "<STR_LIT>" ) ; yPosition = par1NBTTagCompound . getInteger ( "<STR_LIT>" ) ; zPosition = par1NBTTagCompound . getInteger ( "<STR_LIT>" ) ; String s = par1NBTTagCompound . getString ( "<STR_LIT>" ) ; EnumArt aenumart [ ] = EnumArt . values ( ) ; int i = aenumart . length ; for ( int j = <NUM_LIT:0> ; j < i ; j ++ ) { EnumArt enumart = aenumart [ j ] ; if ( enumart . title . equals ( s ) ) { art = enumart ; } } if ( art == null ) { art = EnumArt . Kebab ; } func_179_a ( direction ) ; } public void moveEntity ( double par1 , double par3 , double par5 ) { if ( ! worldObj . isRemote && ! isDead && par1 * par1 + par3 * par3 + par5 * par5 > <NUM_LIT> ) { setDead ( ) ; worldObj . spawnEntityInWorld ( new EntityItem ( worldObj , posX , posY , posZ , new ItemStack ( Item . painting ) ) ) ; } } public void addVelocity ( double par1 , double par3 , double par5 ) { if ( ! worldObj . isRemote && ! isDead && par1 * par1 + par3 * par3 + par5 * par5 > <NUM_LIT> ) { setDead ( ) ; worldObj . spawnEntityInWorld ( new EntityItem ( worldObj , posX , posY , posZ , new ItemStack ( Item . painting ) ) ) ; } } } </s>
|
<s> package net . minecraft . src ; import java . util . List ; import java . util . Random ; public class ComponentNetherBridgeCorridor5 extends ComponentNetherBridgePiece { public ComponentNetherBridgeCorridor5 ( int par1 , Random par2Random , StructureBoundingBox par3StructureBoundingBox , int par4 ) { super ( par1 ) ; coordBaseMode = par4 ; boundingBox = par3StructureBoundingBox ; } public void buildComponent ( StructureComponent par1StructureComponent , List par2List , Random par3Random ) { getNextComponentNormal ( ( ComponentNetherBridgeStartPiece ) par1StructureComponent , par2List , par3Random , <NUM_LIT:1> , <NUM_LIT:0> , true ) ; } public static ComponentNetherBridgeCorridor5 createValidComponent ( List par0List , Random par1Random , int par2 , int par3 , int par4 , int par5 , int par6 ) { StructureBoundingBox structureboundingbox = StructureBoundingBox . getComponentToAddBoundingBox ( par2 , par3 , par4 , - <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:5> , <NUM_LIT:7> , <NUM_LIT:5> , par5 ) ; if ( ! isAboveGround ( structureboundingbox ) || StructureComponent . findIntersecting ( par0List , structureboundingbox ) != null ) { return null ; } else { return new ComponentNetherBridgeCorridor5 ( par6 , par1Random , structureboundingbox , par5 ) ; } } public boolean addComponentParts ( World par1World , Random par2Random , StructureBoundingBox par3StructureBoundingBox ) { fillWithBlocks ( par1World , par3StructureBoundingBox , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT:1> , <NUM_LIT:4> , Block . netherBrick . blockID , Block . netherBrick . blockID , false ) ; fillWithBlocks ( par1World , par3StructureBoundingBox , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:4> , <NUM_LIT:0> , <NUM_LIT:0> , false ) ; fillWithBlocks ( par1World , par3StructureBoundingBox , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:5> , <NUM_LIT:4> , Block . netherBrick . blockID , Block . netherBrick . blockID , false ) ; fillWithBlocks ( par1World , par3StructureBoundingBox , <NUM_LIT:4> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:4> , Block . netherBrick . blockID , Block . netherBrick . blockID , false ) ; fillWithBlocks ( par1World , par3StructureBoundingBox , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT:1> , Block . netherFence . blockID , Block . netherFence . blockID , false ) ; fillWithBlocks ( par1World , par3StructureBoundingBox , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT:3> , Block . netherFence . blockID , Block . netherFence . blockID , false ) ; fillWithBlocks ( par1World , par3StructureBoundingBox , <NUM_LIT:4> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:4> , <NUM_LIT:4> , <NUM_LIT:1> , Block . netherFence . blockID , Block . netherFence . blockID , false ) ; fillWithBlocks ( par1World , par3StructureBoundingBox , <NUM_LIT:4> , <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:4> , <NUM_LIT:3> , Block . netherFence . blockID , Block . netherFence . blockID , false ) ; fillWithBlocks ( par1World , par3StructureBoundingBox , <NUM_LIT:0> , <NUM_LIT:6> , <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT:6> , <NUM_LIT:4> , Block . netherBrick . blockID , Block . netherBrick . blockID , false ) ; for ( int i = <NUM_LIT:0> ; i <= <NUM_LIT:4> ; i ++ ) { for ( int j = <NUM_LIT:0> ; j <= <NUM_LIT:4> ; j ++ ) { fillCurrentPositionBlocksDownwards ( par1World , Block . netherBrick . blockID , <NUM_LIT:0> , i , - <NUM_LIT:1> , j , par3StructureBoundingBox ) ; } } return true ; } } </s>
|
<s> package net . minecraft . src ; import java . io . PrintStream ; import java . util . * ; public class Chunk { public static boolean isLit ; private ExtendedBlockStorage storageArrays [ ] ; private byte blockBiomeArray [ ] ; public int precipitationHeightMap [ ] ; public boolean updateSkylightColumns [ ] ; public boolean isChunkLoaded ; public World worldObj ; public int heightMap [ ] ; public final int xPosition ; public final int zPosition ; private boolean isGapLightingUpdated ; public Map chunkTileEntityMap ; public List entityLists [ ] ; public boolean isTerrainPopulated ; public boolean isModified ; public boolean hasEntities ; public long lastSaveTime ; public boolean field_50025_o ; private int queuedLightChecks ; boolean field_35638_u ; public Chunk ( World par1World , int par2 , int par3 ) { storageArrays = new ExtendedBlockStorage [ <NUM_LIT:16> ] ; blockBiomeArray = new byte [ <NUM_LIT> ] ; precipitationHeightMap = new int [ <NUM_LIT> ] ; updateSkylightColumns = new boolean [ <NUM_LIT> ] ; isGapLightingUpdated = false ; chunkTileEntityMap = new HashMap ( ) ; isTerrainPopulated = false ; isModified = false ; hasEntities = false ; lastSaveTime = <NUM_LIT> ; field_50025_o = false ; queuedLightChecks = <NUM_LIT> ; field_35638_u = false ; entityLists = new List [ <NUM_LIT:16> ] ; worldObj = par1World ; xPosition = par2 ; zPosition = par3 ; heightMap = new int [ <NUM_LIT> ] ; for ( int i = <NUM_LIT:0> ; i < entityLists . length ; i ++ ) { entityLists [ i ] = new ArrayList ( ) ; } Arrays . fill ( precipitationHeightMap , - <NUM_LIT> ) ; Arrays . fill ( blockBiomeArray , ( byte ) - <NUM_LIT:1> ) ; } public Chunk ( World par1World , byte par2ArrayOfByte [ ] , int par3 , int par4 ) { this ( par1World , par3 , par4 ) ; int i = par2ArrayOfByte . length / <NUM_LIT> ; for ( int j = <NUM_LIT:0> ; j < <NUM_LIT:16> ; j ++ ) { for ( int k = <NUM_LIT:0> ; k < <NUM_LIT:16> ; k ++ ) { for ( int l = <NUM_LIT:0> ; l < i ; l ++ ) { byte byte0 = par2ArrayOfByte [ j << <NUM_LIT:11> | k << <NUM_LIT:7> | l ] ; if ( byte0 == <NUM_LIT:0> ) { continue ; } int i1 = l > > <NUM_LIT:4> ; if ( storageArrays [ i1 ] == null ) { storageArrays [ i1 ] = new ExtendedBlockStorage ( i1 << <NUM_LIT:4> ) ; } storageArrays [ i1 ] . setExtBlockID ( j , l & <NUM_LIT> , k , byte0 ) ; } } } } public boolean isAtLocation ( int par1 , int par2 ) { return par1 == xPosition && par2 == zPosition ; } public int getHeightValue ( int par1 , int par2 ) { return heightMap [ par2 << <NUM_LIT:4> | par1 ] ; } public int getTopFilledSegment ( ) { for ( int i = storageArrays . length - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) { if ( storageArrays [ i ] != null ) { return storageArrays [ i ] . getYLocation ( ) ; } } return <NUM_LIT:0> ; } public ExtendedBlockStorage [ ] getBlockStorageArray ( ) { return storageArrays ; } public void generateSkylightMap ( ) { int i = getTopFilledSegment ( ) ; for ( int j = <NUM_LIT:0> ; j < <NUM_LIT:16> ; j ++ ) { for ( int l = <NUM_LIT:0> ; l < <NUM_LIT:16> ; l ++ ) { precipitationHeightMap [ j + ( l << <NUM_LIT:4> ) ] = - <NUM_LIT> ; int j1 = ( i + <NUM_LIT:16> ) - <NUM_LIT:1> ; do { if ( j1 <= <NUM_LIT:0> ) { break ; } if ( getBlockLightOpacity ( j , j1 - <NUM_LIT:1> , l ) != <NUM_LIT:0> ) { heightMap [ l << <NUM_LIT:4> | j ] = j1 ; break ; } j1 -- ; } while ( true ) ; if ( worldObj . worldProvider . hasNoSky ) { continue ; } j1 = <NUM_LIT:15> ; int k1 = ( i + <NUM_LIT:16> ) - <NUM_LIT:1> ; do { j1 -= getBlockLightOpacity ( j , k1 , l ) ; if ( j1 > <NUM_LIT:0> ) { ExtendedBlockStorage extendedblockstorage = storageArrays [ k1 > > <NUM_LIT:4> ] ; if ( extendedblockstorage != null ) { extendedblockstorage . setExtSkylightValue ( j , k1 & <NUM_LIT> , l , j1 ) ; worldObj . func_48086_o ( ( xPosition << <NUM_LIT:4> ) + j , k1 , ( zPosition << <NUM_LIT:4> ) + l ) ; } } } while ( -- k1 > <NUM_LIT:0> && j1 > <NUM_LIT:0> ) ; } } isModified = true ; for ( int k = <NUM_LIT:0> ; k < <NUM_LIT:16> ; k ++ ) { for ( int i1 = <NUM_LIT:0> ; i1 < <NUM_LIT:16> ; i1 ++ ) { propagateSkylightOcclusion ( k , i1 ) ; } } } public void func_4053_c ( ) { } private void propagateSkylightOcclusion ( int par1 , int par2 ) { updateSkylightColumns [ par1 + par2 * <NUM_LIT:16> ] = true ; isGapLightingUpdated = true ; } private void updateSkylight_do ( ) { Profiler . startSection ( "<STR_LIT>" ) ; if ( worldObj . doChunksNearChunkExist ( xPosition * <NUM_LIT:16> + <NUM_LIT:8> , <NUM_LIT:0> , zPosition * <NUM_LIT:16> + <NUM_LIT:8> , <NUM_LIT:16> ) ) { for ( int i = <NUM_LIT:0> ; i < <NUM_LIT:16> ; i ++ ) { for ( int j = <NUM_LIT:0> ; j < <NUM_LIT:16> ; j ++ ) { if ( ! updateSkylightColumns [ i + j * <NUM_LIT:16> ] ) { continue ; } updateSkylightColumns [ i + j * <NUM_LIT:16> ] = false ; int k = getHeightValue ( i , j ) ; int l = xPosition * <NUM_LIT:16> + i ; int i1 = zPosition * <NUM_LIT:16> + j ; int j1 = worldObj . getHeightValue ( l - <NUM_LIT:1> , i1 ) ; int k1 = worldObj . getHeightValue ( l + <NUM_LIT:1> , i1 ) ; int l1 = worldObj . getHeightValue ( l , i1 - <NUM_LIT:1> ) ; int i2 = worldObj . getHeightValue ( l , i1 + <NUM_LIT:1> ) ; if ( k1 < j1 ) { j1 = k1 ; } if ( l1 < j1 ) { j1 = l1 ; } if ( i2 < j1 ) { j1 = i2 ; } checkSkylightNeighborHeight ( l , i1 , j1 ) ; checkSkylightNeighborHeight ( l - <NUM_LIT:1> , i1 , k ) ; checkSkylightNeighborHeight ( l + <NUM_LIT:1> , i1 , k ) ; checkSkylightNeighborHeight ( l , i1 - <NUM_LIT:1> , k ) ; checkSkylightNeighborHeight ( l , i1 + <NUM_LIT:1> , k ) ; } } isGapLightingUpdated = false ; } Profiler . endSection ( ) ; } private void checkSkylightNeighborHeight ( int par1 , int par2 , int par3 ) { int i = worldObj . getHeightValue ( par1 , par2 ) ; if ( i > par3 ) { updateSkylightNeighborHeight ( par1 , par2 , par3 , i + <NUM_LIT:1> ) ; } else if ( i < par3 ) { updateSkylightNeighborHeight ( par1 , par2 , i , par3 + <NUM_LIT:1> ) ; } } private void updateSkylightNeighborHeight ( int par1 , int par2 , int par3 , int par4 ) { if ( par4 > par3 && worldObj . doChunksNearChunkExist ( par1 , <NUM_LIT:0> , par2 , <NUM_LIT:16> ) ) { for ( int i = par3 ; i < par4 ; i ++ ) { worldObj . updateLightByType ( EnumSkyBlock . Sky , par1 , i , par2 ) ; } isModified = true ; } } private void relightBlock ( int par1 , int par2 , int par3 ) { int i = heightMap [ par3 << <NUM_LIT:4> | par1 ] & <NUM_LIT> ; int j = i ; if ( par2 > i ) { j = par2 ; } for ( ; j > <NUM_LIT:0> && getBlockLightOpacity ( par1 , j - <NUM_LIT:1> , par3 ) == <NUM_LIT:0> ; j -- ) { } if ( j == i ) { return ; } worldObj . markBlocksDirtyVertical ( par1 , par3 , j , i ) ; heightMap [ par3 << <NUM_LIT:4> | par1 ] = j ; int k = xPosition * <NUM_LIT:16> + par1 ; int l = zPosition * <NUM_LIT:16> + par3 ; if ( ! worldObj . worldProvider . hasNoSky ) { if ( j < i ) { for ( int i1 = j ; i1 < i ; i1 ++ ) { ExtendedBlockStorage extendedblockstorage = storageArrays [ i1 > > <NUM_LIT:4> ] ; if ( extendedblockstorage != null ) { extendedblockstorage . setExtSkylightValue ( par1 , i1 & <NUM_LIT> , par3 , <NUM_LIT:15> ) ; worldObj . func_48086_o ( ( xPosition << <NUM_LIT:4> ) + par1 , i1 , ( zPosition << <NUM_LIT:4> ) + par3 ) ; } } } else { for ( int j1 = i ; j1 < j ; j1 ++ ) { ExtendedBlockStorage extendedblockstorage1 = storageArrays [ j1 > > <NUM_LIT:4> ] ; if ( extendedblockstorage1 != null ) { extendedblockstorage1 . setExtSkylightValue ( par1 , j1 & <NUM_LIT> , par3 , <NUM_LIT:0> ) ; worldObj . func_48086_o ( ( xPosition << <NUM_LIT:4> ) + par1 , j1 , ( zPosition << <NUM_LIT:4> ) + par3 ) ; } } } int k1 = <NUM_LIT:15> ; do { if ( j <= <NUM_LIT:0> || k1 <= <NUM_LIT:0> ) { break ; } j -- ; int i2 = getBlockLightOpacity ( par1 , j , par3 ) ; if ( i2 == <NUM_LIT:0> ) { i2 = <NUM_LIT:1> ; } k1 -= i2 ; if ( k1 < <NUM_LIT:0> ) { k1 = <NUM_LIT:0> ; } ExtendedBlockStorage extendedblockstorage2 = storageArrays [ j > > <NUM_LIT:4> ] ; if ( extendedblockstorage2 != null ) { extendedblockstorage2 . setExtSkylightValue ( par1 , j & <NUM_LIT> , par3 , k1 ) ; } } while ( true ) ; } int l1 = heightMap [ par3 << <NUM_LIT:4> | par1 ] ; int j2 = i ; int k2 = l1 ; if ( k2 < j2 ) { int l2 = j2 ; j2 = k2 ; k2 = l2 ; } if ( ! worldObj . worldProvider . hasNoSky ) { updateSkylightNeighborHeight ( k - <NUM_LIT:1> , l , j2 , k2 ) ; updateSkylightNeighborHeight ( k + <NUM_LIT:1> , l , j2 , k2 ) ; updateSkylightNeighborHeight ( k , l - <NUM_LIT:1> , j2 , k2 ) ; updateSkylightNeighborHeight ( k , l + <NUM_LIT:1> , j2 , k2 ) ; updateSkylightNeighborHeight ( k , l , j2 , k2 ) ; } isModified = true ; } public int getBlockLightOpacity ( int par1 , int par2 , int par3 ) { return Block . lightOpacity [ getBlockID ( par1 , par2 , par3 ) ] ; } public int getBlockID ( int par1 , int par2 , int par3 ) { if ( par2 > > <NUM_LIT:4> >= storageArrays . length ) { return <NUM_LIT:0> ; } ExtendedBlockStorage extendedblockstorage = storageArrays [ par2 > > <NUM_LIT:4> ] ; if ( extendedblockstorage != null ) { return extendedblockstorage . getExtBlockID ( par1 , par2 & <NUM_LIT> , par3 ) ; } else { return <NUM_LIT:0> ; } } public int getBlockMetadata ( int par1 , int par2 , int par3 ) { if ( par2 > > <NUM_LIT:4> >= storageArrays . length ) { return <NUM_LIT:0> ; } ExtendedBlockStorage extendedblockstorage = storageArrays [ par2 > > <NUM_LIT:4> ] ; if ( extendedblockstorage != null ) { return extendedblockstorage . getExtBlockMetadata ( par1 , par2 & <NUM_LIT> , par3 ) ; } else { return <NUM_LIT:0> ; } } public boolean setBlockID ( int par1 , int par2 , int par3 , int par4 ) { return setBlockIDWithMetadata ( par1 , par2 , par3 , par4 , <NUM_LIT:0> ) ; } public boolean setBlockIDWithMetadata ( int par1 , int par2 , int par3 , int par4 , int par5 ) { int i = par3 << <NUM_LIT:4> | par1 ; if ( par2 >= precipitationHeightMap [ i ] - <NUM_LIT:1> ) { precipitationHeightMap [ i ] = - <NUM_LIT> ; } int j = heightMap [ i ] ; int k = getBlockID ( par1 , par2 , par3 ) ; if ( k == par4 && getBlockMetadata ( par1 , par2 , par3 ) == par5 ) { return false ; } ExtendedBlockStorage extendedblockstorage = storageArrays [ par2 > > <NUM_LIT:4> ] ; boolean flag = false ; if ( extendedblockstorage == null ) { if ( par4 == <NUM_LIT:0> ) { return false ; } extendedblockstorage = storageArrays [ par2 > > <NUM_LIT:4> ] = new ExtendedBlockStorage ( ( par2 > > <NUM_LIT:4> ) << <NUM_LIT:4> ) ; flag = par2 >= j ; } extendedblockstorage . setExtBlockID ( par1 , par2 & <NUM_LIT> , par3 , par4 ) ; int l = xPosition * <NUM_LIT:16> + par1 ; int i1 = zPosition * <NUM_LIT:16> + par3 ; if ( k != <NUM_LIT:0> ) { if ( ! worldObj . isRemote ) { Block . blocksList [ k ] . onBlockRemoval ( worldObj , l , par2 , i1 ) ; } else if ( ( Block . blocksList [ k ] instanceof BlockContainer ) && k != par4 ) { worldObj . removeBlockTileEntity ( l , par2 , i1 ) ; } } if ( extendedblockstorage . getExtBlockID ( par1 , par2 & <NUM_LIT> , par3 ) != par4 ) { return false ; } extendedblockstorage . setExtBlockMetadata ( par1 , par2 & <NUM_LIT> , par3 , par5 ) ; if ( flag ) { generateSkylightMap ( ) ; } else { if ( Block . lightOpacity [ par4 & <NUM_LIT> ] > <NUM_LIT:0> ) { if ( par2 >= j ) { relightBlock ( par1 , par2 + <NUM_LIT:1> , par3 ) ; } } else if ( par2 == j - <NUM_LIT:1> ) { relightBlock ( par1 , par2 , par3 ) ; } propagateSkylightOcclusion ( par1 , par3 ) ; } if ( par4 != <NUM_LIT:0> ) { if ( ! worldObj . isRemote ) { Block . blocksList [ par4 ] . onBlockAdded ( worldObj , l , par2 , i1 ) ; } if ( Block . blocksList [ par4 ] instanceof BlockContainer ) { TileEntity tileentity = getChunkBlockTileEntity ( par1 , par2 , par3 ) ; if ( tileentity == null ) { tileentity = ( ( BlockContainer ) Block . blocksList [ par4 ] ) . getBlockEntity ( ) ; worldObj . setBlockTileEntity ( l , par2 , i1 , tileentity ) ; } if ( tileentity != null ) { tileentity . updateContainingBlockInfo ( ) ; } } } else if ( k > <NUM_LIT:0> && ( Block . blocksList [ k ] instanceof BlockContainer ) ) { TileEntity tileentity1 = getChunkBlockTileEntity ( par1 , par2 , par3 ) ; if ( tileentity1 != null ) { tileentity1 . updateContainingBlockInfo ( ) ; } } isModified = true ; return true ; } public boolean setBlockMetadata ( int par1 , int par2 , int par3 , int par4 ) { ExtendedBlockStorage extendedblockstorage = storageArrays [ par2 > > <NUM_LIT:4> ] ; if ( extendedblockstorage == null ) { return false ; } int i = extendedblockstorage . getExtBlockMetadata ( par1 , par2 & <NUM_LIT> , par3 ) ; if ( i == par4 ) { return false ; } isModified = true ; extendedblockstorage . setExtBlockMetadata ( par1 , par2 & <NUM_LIT> , par3 , par4 ) ; int j = extendedblockstorage . getExtBlockID ( par1 , par2 & <NUM_LIT> , par3 ) ; if ( j > <NUM_LIT:0> && ( Block . blocksList [ j ] instanceof BlockContainer ) ) { TileEntity tileentity = getChunkBlockTileEntity ( par1 , par2 , par3 ) ; if ( tileentity != null ) { tileentity . updateContainingBlockInfo ( ) ; tileentity . blockMetadata = par4 ; } } return true ; } public int getSavedLightValue ( EnumSkyBlock par1EnumSkyBlock , int par2 , int par3 , int par4 ) { ExtendedBlockStorage extendedblockstorage = storageArrays [ par3 > > <NUM_LIT:4> ] ; if ( extendedblockstorage == null ) { return par1EnumSkyBlock . defaultLightValue ; } if ( par1EnumSkyBlock == EnumSkyBlock . Sky ) { return extendedblockstorage . getExtSkylightValue ( par2 , par3 & <NUM_LIT> , par4 ) ; } if ( par1EnumSkyBlock == EnumSkyBlock . Block ) { return extendedblockstorage . getExtBlocklightValue ( par2 , par3 & <NUM_LIT> , par4 ) ; } else { return par1EnumSkyBlock . defaultLightValue ; } } public void setLightValue ( EnumSkyBlock par1EnumSkyBlock , int par2 , int par3 , int par4 , int par5 ) { ExtendedBlockStorage extendedblockstorage = storageArrays [ par3 > > <NUM_LIT:4> ] ; if ( extendedblockstorage == null ) { extendedblockstorage = storageArrays [ par3 > > <NUM_LIT:4> ] = new ExtendedBlockStorage ( ( par3 > > <NUM_LIT:4> ) << <NUM_LIT:4> ) ; generateSkylightMap ( ) ; } isModified = true ; if ( par1EnumSkyBlock == EnumSkyBlock . Sky ) { if ( ! worldObj . worldProvider . hasNoSky ) { extendedblockstorage . setExtSkylightValue ( par2 , par3 & <NUM_LIT> , par4 , par5 ) ; } } else if ( par1EnumSkyBlock == EnumSkyBlock . Block ) { extendedblockstorage . setExtBlocklightValue ( par2 , par3 & <NUM_LIT> , par4 , par5 ) ; } else { return ; } } public int getBlockLightValue ( int par1 , int par2 , int par3 , int par4 ) { ExtendedBlockStorage extendedblockstorage = storageArrays [ par2 > > <NUM_LIT:4> ] ; if ( extendedblockstorage == null ) { if ( ! worldObj . worldProvider . hasNoSky && par4 < EnumSkyBlock . Sky . defaultLightValue ) { return EnumSkyBlock . Sky . defaultLightValue - par4 ; } else { return <NUM_LIT:0> ; } } int i = worldObj . worldProvider . hasNoSky ? <NUM_LIT:0> : extendedblockstorage . getExtSkylightValue ( par1 , par2 & <NUM_LIT> , par3 ) ; if ( i > <NUM_LIT:0> ) { isLit = true ; } i -= par4 ; int j = extendedblockstorage . getExtBlocklightValue ( par1 , par2 & <NUM_LIT> , par3 ) ; if ( j > i ) { i = j ; } return i ; } public void addEntity ( Entity par1Entity ) { hasEntities = true ; int i = MathHelper . floor_double ( par1Entity . posX / <NUM_LIT> ) ; int j = MathHelper . floor_double ( par1Entity . posZ / <NUM_LIT> ) ; if ( i != xPosition || j != zPosition ) { System . out . println ( ( new StringBuilder ( ) ) . append ( "<STR_LIT>" ) . append ( par1Entity ) . toString ( ) ) ; Thread . dumpStack ( ) ; } int k = MathHelper . floor_double ( par1Entity . posY / <NUM_LIT> ) ; if ( k < <NUM_LIT:0> ) { k = <NUM_LIT:0> ; } if ( k >= entityLists . length ) { k = entityLists . length - <NUM_LIT:1> ; } par1Entity . addedToChunk = true ; par1Entity . chunkCoordX = xPosition ; par1Entity . chunkCoordY = k ; par1Entity . chunkCoordZ = zPosition ; entityLists [ k ] . add ( par1Entity ) ; } public void removeEntity ( Entity par1Entity ) { removeEntityAtIndex ( par1Entity , par1Entity . chunkCoordY ) ; } public void removeEntityAtIndex ( Entity par1Entity , int par2 ) { if ( par2 < <NUM_LIT:0> ) { par2 = <NUM_LIT:0> ; } if ( par2 >= entityLists . length ) { par2 = entityLists . length - <NUM_LIT:1> ; } entityLists [ par2 ] . remove ( par1Entity ) ; } public boolean canBlockSeeTheSky ( int par1 , int par2 , int par3 ) { return par2 >= heightMap [ par3 << <NUM_LIT:4> | par1 ] ; } public TileEntity getChunkBlockTileEntity ( int par1 , int par2 , int par3 ) { ChunkPosition chunkposition = new ChunkPosition ( par1 , par2 , par3 ) ; TileEntity tileentity = ( TileEntity ) chunkTileEntityMap . get ( chunkposition ) ; if ( tileentity == null ) { int i = getBlockID ( par1 , par2 , par3 ) ; if ( i <= <NUM_LIT:0> || ! Block . blocksList [ i ] . hasTileEntity ( ) ) { return null ; } if ( tileentity == null ) { tileentity = ( ( BlockContainer ) Block . blocksList [ i ] ) . getBlockEntity ( ) ; worldObj . setBlockTileEntity ( xPosition * <NUM_LIT:16> + par1 , par2 , zPosition * <NUM_LIT:16> + par3 , tileentity ) ; } tileentity = ( TileEntity ) chunkTileEntityMap . get ( chunkposition ) ; } if ( tileentity != null && tileentity . isInvalid ( ) ) { chunkTileEntityMap . remove ( chunkposition ) ; return null ; } else { return tileentity ; } } public void addTileEntity ( TileEntity par1TileEntity ) { int i = par1TileEntity . xCoord - xPosition * <NUM_LIT:16> ; int j = par1TileEntity . yCoord ; int k = par1TileEntity . zCoord - zPosition * <NUM_LIT:16> ; setChunkBlockTileEntity ( i , j , k , par1TileEntity ) ; if ( isChunkLoaded ) { worldObj . loadedTileEntityList . add ( par1TileEntity ) ; } } public void setChunkBlockTileEntity ( int par1 , int par2 , int par3 , TileEntity par4TileEntity ) { ChunkPosition chunkposition = new ChunkPosition ( par1 , par2 , par3 ) ; par4TileEntity . worldObj = worldObj ; par4TileEntity . xCoord = xPosition * <NUM_LIT:16> + par1 ; par4TileEntity . yCoord = par2 ; par4TileEntity . zCoord = zPosition * <NUM_LIT:16> + par3 ; if ( getBlockID ( par1 , par2 , par3 ) == <NUM_LIT:0> || ! ( Block . blocksList [ getBlockID ( par1 , par2 , par3 ) ] instanceof BlockContainer ) ) { return ; } else { par4TileEntity . validate ( ) ; chunkTileEntityMap . put ( chunkposition , par4TileEntity ) ; return ; } } public void removeChunkBlockTileEntity ( int par1 , int par2 , int par3 ) { ChunkPosition chunkposition = new ChunkPosition ( par1 , par2 , par3 ) ; if ( isChunkLoaded ) { TileEntity tileentity = ( TileEntity ) chunkTileEntityMap . remove ( chunkposition ) ; if ( tileentity != null ) { tileentity . invalidate ( ) ; } } } public void onChunkLoad ( ) { isChunkLoaded = true ; worldObj . addTileEntity ( chunkTileEntityMap . values ( ) ) ; for ( int i = <NUM_LIT:0> ; i < entityLists . length ; i ++ ) { worldObj . addLoadedEntities ( entityLists [ i ] ) ; } } public void onChunkUnload ( ) { isChunkLoaded = false ; TileEntity tileentity ; for ( Iterator iterator = chunkTileEntityMap . values ( ) . iterator ( ) ; iterator . hasNext ( ) ; worldObj . markTileEntityForDespawn ( tileentity ) ) { tileentity = ( TileEntity ) iterator . next ( ) ; } for ( int i = <NUM_LIT:0> ; i < entityLists . length ; i ++ ) { worldObj . unloadEntities ( entityLists [ i ] ) ; } } public void setChunkModified ( ) { isModified = true ; } public void getEntitiesWithinAABBForEntity ( Entity par1Entity , AxisAlignedBB par2AxisAlignedBB , List par3List ) { int i = MathHelper . floor_double ( ( par2AxisAlignedBB . minY - <NUM_LIT> ) / <NUM_LIT> ) ; int j = MathHelper . floor_double ( ( par2AxisAlignedBB . maxY + <NUM_LIT> ) / <NUM_LIT> ) ; if ( i < <NUM_LIT:0> ) { i = <NUM_LIT:0> ; } if ( j >= entityLists . length ) { j = entityLists . length - <NUM_LIT:1> ; } for ( int k = i ; k <= j ; k ++ ) { List list = entityLists [ k ] ; for ( int l = <NUM_LIT:0> ; l < list . size ( ) ; l ++ ) { Entity entity = ( Entity ) list . get ( l ) ; if ( entity == par1Entity || ! entity . boundingBox . intersectsWith ( par2AxisAlignedBB ) ) { continue ; } par3List . add ( entity ) ; Entity aentity [ ] = entity . getParts ( ) ; if ( aentity == null ) { continue ; } for ( int i1 = <NUM_LIT:0> ; i1 < aentity . length ; i1 ++ ) { Entity entity1 = aentity [ i1 ] ; if ( entity1 != par1Entity && entity1 . boundingBox . intersectsWith ( par2AxisAlignedBB ) ) { par3List . add ( entity1 ) ; } } } } } public void getEntitiesOfTypeWithinAAAB ( Class par1Class , AxisAlignedBB par2AxisAlignedBB , List par3List ) { int i = MathHelper . floor_double ( ( par2AxisAlignedBB . minY - <NUM_LIT> ) / <NUM_LIT> ) ; int j = MathHelper . floor_double ( ( par2AxisAlignedBB . maxY + <NUM_LIT> ) / <NUM_LIT> ) ; if ( i < <NUM_LIT:0> ) { i = <NUM_LIT:0> ; } else if ( i >= entityLists . length ) { i = entityLists . length - <NUM_LIT:1> ; } if ( j >= entityLists . length ) { j = entityLists . length - <NUM_LIT:1> ; } else if ( j < <NUM_LIT:0> ) { j = <NUM_LIT:0> ; } for ( int k = i ; k <= j ; k ++ ) { List list = entityLists [ k ] ; for ( int l = <NUM_LIT:0> ; l < list . size ( ) ; l ++ ) { Entity entity = ( Entity ) list . get ( l ) ; if ( par1Class . isAssignableFrom ( entity . getClass ( ) ) && entity . boundingBox . intersectsWith ( par2AxisAlignedBB ) ) { par3List . add ( entity ) ; } } } } public boolean needsSaving ( boolean par1 ) { if ( par1 ) { if ( hasEntities && worldObj . getWorldTime ( ) != lastSaveTime ) { return true ; } } else if ( hasEntities && worldObj . getWorldTime ( ) >= lastSaveTime + <NUM_LIT> ) { return true ; } return isModified ; } public Random getRandomWithSeed ( long par1 ) { return new Random ( worldObj . getSeed ( ) + ( long ) ( xPosition * xPosition * <NUM_LIT> ) + ( long ) ( xPosition * <NUM_LIT> ) + ( long ) ( zPosition * zPosition ) * <NUM_LIT> + ( long ) ( zPosition * <NUM_LIT> ) ^ par1 ) ; } public boolean isEmpty ( ) { return false ; } public void removeUnknownBlocks ( ) { ExtendedBlockStorage aextendedblockstorage [ ] = storageArrays ; int i = aextendedblockstorage . length ; for ( int j = <NUM_LIT:0> ; j < i ; j ++ ) { ExtendedBlockStorage extendedblockstorage = aextendedblockstorage [ j ] ; if ( extendedblockstorage != null ) { extendedblockstorage . func_48603_e ( ) ; } } } public void populateChunk ( IChunkProvider par1IChunkProvider , IChunkProvider par2IChunkProvider , int par3 , int par4 ) { if ( ! isTerrainPopulated && par1IChunkProvider . chunkExists ( par3 + <NUM_LIT:1> , par4 + <NUM_LIT:1> ) && par1IChunkProvider . chunkExists ( par3 , par4 + <NUM_LIT:1> ) && par1IChunkProvider . chunkExists ( par3 + <NUM_LIT:1> , par4 ) ) { par1IChunkProvider . populate ( par2IChunkProvider , par3 , par4 ) ; } if ( par1IChunkProvider . chunkExists ( par3 - <NUM_LIT:1> , par4 ) && ! par1IChunkProvider . provideChunk ( par3 - <NUM_LIT:1> , par4 ) . isTerrainPopulated && par1IChunkProvider . chunkExists ( par3 - <NUM_LIT:1> , par4 + <NUM_LIT:1> ) && par1IChunkProvider . chunkExists ( par3 , par4 + <NUM_LIT:1> ) && par1IChunkProvider . chunkExists ( par3 - <NUM_LIT:1> , par4 + <NUM_LIT:1> ) ) { par1IChunkProvider . populate ( par2IChunkProvider , par3 - <NUM_LIT:1> , par4 ) ; } if ( par1IChunkProvider . chunkExists ( par3 , par4 - <NUM_LIT:1> ) && ! par1IChunkProvider . provideChunk ( par3 , par4 - <NUM_LIT:1> ) . isTerrainPopulated && par1IChunkProvider . chunkExists ( par3 + <NUM_LIT:1> , par4 - <NUM_LIT:1> ) && par1IChunkProvider . chunkExists ( par3 + <NUM_LIT:1> , par4 - <NUM_LIT:1> ) && par1IChunkProvider . chunkExists ( par3 + <NUM_LIT:1> , par4 ) ) { par1IChunkProvider . populate ( par2IChunkProvider , par3 , par4 - <NUM_LIT:1> ) ; } if ( par1IChunkProvider . chunkExists ( par3 - <NUM_LIT:1> , par4 - <NUM_LIT:1> ) && ! par1IChunkProvider . provideChunk ( par3 - <NUM_LIT:1> , par4 - <NUM_LIT:1> ) . isTerrainPopulated && par1IChunkProvider . chunkExists ( par3 , par4 - <NUM_LIT:1> ) && par1IChunkProvider . chunkExists ( par3 - <NUM_LIT:1> , par4 ) ) { par1IChunkProvider . populate ( par2IChunkProvider , par3 - <NUM_LIT:1> , par4 - <NUM_LIT:1> ) ; } } public int getPrecipitationHeight ( int par1 , int par2 ) { int i = par1 | par2 << <NUM_LIT:4> ; int j = precipitationHeightMap [ i ] ; if ( j == - <NUM_LIT> ) { int k = getTopFilledSegment ( ) + <NUM_LIT:15> ; for ( j = - <NUM_LIT:1> ; k > <NUM_LIT:0> && j == - <NUM_LIT:1> ; ) { int l = getBlockID ( par1 , k , par2 ) ; Material material = l != <NUM_LIT:0> ? Block . blocksList [ l ] . blockMaterial : Material . air ; if ( ! material . blocksMovement ( ) && ! material . isLiquid ( ) ) { k -- ; } else { j = k + <NUM_LIT:1> ; } } precipitationHeightMap [ i ] = j ; } return j ; } public void updateSkylight ( ) { if ( isGapLightingUpdated && ! worldObj . worldProvider . hasNoSky ) { updateSkylight_do ( ) ; } } public ChunkCoordIntPair getChunkCoordIntPair ( ) { return new ChunkCoordIntPair ( xPosition , zPosition ) ; } public boolean getAreLevelsEmpty ( int par1 , int par2 ) { if ( par1 < <NUM_LIT:0> ) { par1 = <NUM_LIT:0> ; } if ( par2 >= <NUM_LIT> ) { par2 = <NUM_LIT:255> ; } for ( int i = par1 ; i <= par2 ; i += <NUM_LIT:16> ) { ExtendedBlockStorage extendedblockstorage = storageArrays [ i > > <NUM_LIT:4> ] ; if ( extendedblockstorage != null && ! extendedblockstorage . getIsEmpty ( ) ) { return false ; } } return true ; } public void setStorageArrays ( ExtendedBlockStorage par1ArrayOfExtendedBlockStorage [ ] ) { storageArrays = par1ArrayOfExtendedBlockStorage ; } public BiomeGenBase func_48560_a ( int par1 , int par2 , WorldChunkManager par3WorldChunkManager ) { int i = blockBiomeArray [ par2 << <NUM_LIT:4> | par1 ] & <NUM_LIT> ; if ( i == <NUM_LIT:255> ) { BiomeGenBase biomegenbase = par3WorldChunkManager . getBiomeGenAt ( ( xPosition << <NUM_LIT:4> ) + par1 , ( zPosition << <NUM_LIT:4> ) + par2 ) ; i = biomegenbase . biomeID ; blockBiomeArray [ par2 << <NUM_LIT:4> | par1 ] = ( byte ) ( i & <NUM_LIT> ) ; } if ( BiomeGenBase . biomeList [ i ] == null ) { return BiomeGenBase . plains ; } else { return BiomeGenBase . biomeList [ i ] ; } } public byte [ ] getBiomeArray ( ) { return blockBiomeArray ; } public void setBiomeArray ( byte par1ArrayOfByte [ ] ) { blockBiomeArray = par1ArrayOfByte ; } public void resetRelightChecks ( ) { queuedLightChecks = <NUM_LIT:0> ; } public void enqueueRelightChecks ( ) { for ( int i = <NUM_LIT:0> ; i < <NUM_LIT:8> ; i ++ ) { if ( queuedLightChecks >= <NUM_LIT> ) { return ; } int j = queuedLightChecks % <NUM_LIT:16> ; int k = ( queuedLightChecks / <NUM_LIT:16> ) % <NUM_LIT:16> ; int l = queuedLightChecks / <NUM_LIT> ; queuedLightChecks ++ ; int i1 = ( xPosition << <NUM_LIT:4> ) + k ; int j1 = ( zPosition << <NUM_LIT:4> ) + l ; for ( int k1 = <NUM_LIT:0> ; k1 < <NUM_LIT:16> ; k1 ++ ) { int l1 = ( j << <NUM_LIT:4> ) + k1 ; if ( ( storageArrays [ j ] != null || k1 != <NUM_LIT:0> && k1 != <NUM_LIT:15> && k != <NUM_LIT:0> && k != <NUM_LIT:15> && l != <NUM_LIT:0> && l != <NUM_LIT:15> ) && ( storageArrays [ j ] == null || storageArrays [ j ] . getExtBlockID ( k , k1 , l ) != <NUM_LIT:0> ) ) { continue ; } if ( Block . lightValue [ worldObj . getBlockId ( i1 , l1 - <NUM_LIT:1> , j1 ) ] > <NUM_LIT:0> ) { worldObj . updateAllLightTypes ( i1 , l1 - <NUM_LIT:1> , j1 ) ; } if ( Block . lightValue [ worldObj . getBlockId ( i1 , l1 + <NUM_LIT:1> , j1 ) ] > <NUM_LIT:0> ) { worldObj . updateAllLightTypes ( i1 , l1 + <NUM_LIT:1> , j1 ) ; } if ( Block . lightValue [ worldObj . getBlockId ( i1 - <NUM_LIT:1> , l1 , j1 ) ] > <NUM_LIT:0> ) { worldObj . updateAllLightTypes ( i1 - <NUM_LIT:1> , l1 , j1 ) ; } if ( Block . lightValue [ worldObj . getBlockId ( i1 + <NUM_LIT:1> , l1 , j1 ) ] > <NUM_LIT:0> ) { worldObj . updateAllLightTypes ( i1 + <NUM_LIT:1> , l1 , j1 ) ; } if ( Block . lightValue [ worldObj . getBlockId ( i1 , l1 , j1 - <NUM_LIT:1> ) ] > <NUM_LIT:0> ) { worldObj . updateAllLightTypes ( i1 , l1 , j1 - <NUM_LIT:1> ) ; } if ( Block . lightValue [ worldObj . getBlockId ( i1 , l1 , j1 + <NUM_LIT:1> ) ] > <NUM_LIT:0> ) { worldObj . updateAllLightTypes ( i1 , l1 , j1 + <NUM_LIT:1> ) ; } worldObj . updateAllLightTypes ( i1 , l1 , j1 ) ; } } } } </s>
|
<s> package net . minecraft . src ; class EntityAITaskEntry { public EntityAIBase action ; public int priority ; final EntityAITasks tasks ; public EntityAITaskEntry ( EntityAITasks par1EntityAITasks , int par2 , EntityAIBase par3EntityAIBase ) { tasks = par1EntityAITasks ; priority = par2 ; action = par3EntityAIBase ; } } </s>
|
<s> package net . minecraft . src ; import java . util . Iterator ; import java . util . List ; public class EntityAIHurtByTarget extends EntityAITarget { boolean field_48300_a ; public EntityAIHurtByTarget ( EntityLiving par1EntityLiving , boolean par2 ) { super ( par1EntityLiving , <NUM_LIT> , false ) ; field_48300_a = par2 ; setMutexBits ( <NUM_LIT:1> ) ; } public boolean shouldExecute ( ) { return func_48284_a ( taskOwner . getAITarget ( ) , true ) ; } public void startExecuting ( ) { taskOwner . setAttackTarget ( taskOwner . getAITarget ( ) ) ; if ( field_48300_a ) { List list = taskOwner . worldObj . getEntitiesWithinAABB ( taskOwner . getClass ( ) , AxisAlignedBB . getBoundingBoxFromPool ( taskOwner . posX , taskOwner . posY , taskOwner . posZ , taskOwner . posX + <NUM_LIT> , taskOwner . posY + <NUM_LIT> , taskOwner . posZ + <NUM_LIT> ) . expand ( field_48288_d , <NUM_LIT> , field_48288_d ) ) ; Iterator iterator = list . iterator ( ) ; do { if ( ! iterator . hasNext ( ) ) { break ; } Entity entity = ( Entity ) iterator . next ( ) ; EntityLiving entityliving = ( EntityLiving ) entity ; if ( taskOwner != entityliving && entityliving . getAttackTarget ( ) == null ) { entityliving . setAttackTarget ( taskOwner . getAITarget ( ) ) ; } } while ( true ) ; } super . startExecuting ( ) ; } } </s>
|
<s> package net . minecraft . src ; import java . util . * ; public class ContainerEnchantment extends Container { public IInventory tableInventory ; private World worldPointer ; private int posX ; private int posY ; private int posZ ; private Random rand ; public long nameSeed ; public int enchantLevels [ ] ; public ContainerEnchantment ( InventoryPlayer par1InventoryPlayer , World par2World , int par3 , int par4 , int par5 ) { tableInventory = new SlotEnchantmentTable ( this , "<STR_LIT>" , <NUM_LIT:1> ) ; rand = new Random ( ) ; enchantLevels = new int [ <NUM_LIT:3> ] ; worldPointer = par2World ; posX = par3 ; posY = par4 ; posZ = par5 ; addSlot ( new SlotEnchantment ( this , tableInventory , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> ) ) ; for ( int i = <NUM_LIT:0> ; i < <NUM_LIT:3> ; i ++ ) { for ( int k = <NUM_LIT:0> ; k < <NUM_LIT:9> ; k ++ ) { addSlot ( new Slot ( par1InventoryPlayer , k + i * <NUM_LIT:9> + <NUM_LIT:9> , <NUM_LIT:8> + k * <NUM_LIT> , <NUM_LIT> + i * <NUM_LIT> ) ) ; } } for ( int j = <NUM_LIT:0> ; j < <NUM_LIT:9> ; j ++ ) { addSlot ( new Slot ( par1InventoryPlayer , j , <NUM_LIT:8> + j * <NUM_LIT> , <NUM_LIT> ) ) ; } } public void onCraftGuiOpened ( ICrafting par1ICrafting ) { super . onCraftGuiOpened ( par1ICrafting ) ; par1ICrafting . updateCraftingInventoryInfo ( this , <NUM_LIT:0> , enchantLevels [ <NUM_LIT:0> ] ) ; par1ICrafting . updateCraftingInventoryInfo ( this , <NUM_LIT:1> , enchantLevels [ <NUM_LIT:1> ] ) ; par1ICrafting . updateCraftingInventoryInfo ( this , <NUM_LIT:2> , enchantLevels [ <NUM_LIT:2> ] ) ; } public void updateCraftingResults ( ) { super . updateCraftingResults ( ) ; for ( int i = <NUM_LIT:0> ; i < crafters . size ( ) ; i ++ ) { ICrafting icrafting = ( ICrafting ) crafters . get ( i ) ; icrafting . updateCraftingInventoryInfo ( this , <NUM_LIT:0> , enchantLevels [ <NUM_LIT:0> ] ) ; icrafting . updateCraftingInventoryInfo ( this , <NUM_LIT:1> , enchantLevels [ <NUM_LIT:1> ] ) ; icrafting . updateCraftingInventoryInfo ( this , <NUM_LIT:2> , enchantLevels [ <NUM_LIT:2> ] ) ; } } public void onCraftMatrixChanged ( IInventory par1IInventory ) { if ( par1IInventory == tableInventory ) { ItemStack itemstack = par1IInventory . getStackInSlot ( <NUM_LIT:0> ) ; if ( itemstack == null || ! itemstack . isItemEnchantable ( ) ) { for ( int i = <NUM_LIT:0> ; i < <NUM_LIT:3> ; i ++ ) { enchantLevels [ i ] = <NUM_LIT:0> ; } } else { nameSeed = rand . nextLong ( ) ; if ( ! worldPointer . isRemote ) { int j = <NUM_LIT:0> ; for ( int k = - <NUM_LIT:1> ; k <= <NUM_LIT:1> ; k ++ ) { for ( int i1 = - <NUM_LIT:1> ; i1 <= <NUM_LIT:1> ; i1 ++ ) { if ( k == <NUM_LIT:0> && i1 == <NUM_LIT:0> || ! worldPointer . isAirBlock ( posX + i1 , posY , posZ + k ) || ! worldPointer . isAirBlock ( posX + i1 , posY + <NUM_LIT:1> , posZ + k ) ) { continue ; } if ( worldPointer . getBlockId ( posX + i1 * <NUM_LIT:2> , posY , posZ + k * <NUM_LIT:2> ) == Block . bookShelf . blockID ) { j ++ ; } if ( worldPointer . getBlockId ( posX + i1 * <NUM_LIT:2> , posY + <NUM_LIT:1> , posZ + k * <NUM_LIT:2> ) == Block . bookShelf . blockID ) { j ++ ; } if ( i1 == <NUM_LIT:0> || k == <NUM_LIT:0> ) { continue ; } if ( worldPointer . getBlockId ( posX + i1 * <NUM_LIT:2> , posY , posZ + k ) == Block . bookShelf . blockID ) { j ++ ; } if ( worldPointer . getBlockId ( posX + i1 * <NUM_LIT:2> , posY + <NUM_LIT:1> , posZ + k ) == Block . bookShelf . blockID ) { j ++ ; } if ( worldPointer . getBlockId ( posX + i1 , posY , posZ + k * <NUM_LIT:2> ) == Block . bookShelf . blockID ) { j ++ ; } if ( worldPointer . getBlockId ( posX + i1 , posY + <NUM_LIT:1> , posZ + k * <NUM_LIT:2> ) == Block . bookShelf . blockID ) { j ++ ; } } } for ( int l = <NUM_LIT:0> ; l < <NUM_LIT:3> ; l ++ ) { enchantLevels [ l ] = EnchantmentHelper . calcItemStackEnchantability ( rand , l , j , itemstack ) ; } updateCraftingResults ( ) ; } } } } public boolean enchantItem ( EntityPlayer par1EntityPlayer , int par2 ) { ItemStack itemstack = tableInventory . getStackInSlot ( <NUM_LIT:0> ) ; if ( enchantLevels [ par2 ] > <NUM_LIT:0> && itemstack != null && ( par1EntityPlayer . experienceLevel >= enchantLevels [ par2 ] || par1EntityPlayer . capabilities . isCreativeMode ) ) { if ( ! worldPointer . isRemote ) { List list = EnchantmentHelper . buildEnchantmentList ( rand , itemstack , enchantLevels [ par2 ] ) ; if ( list != null ) { par1EntityPlayer . removeExperience ( enchantLevels [ par2 ] ) ; EnchantmentData enchantmentdata ; for ( Iterator iterator = list . iterator ( ) ; iterator . hasNext ( ) ; itemstack . addEnchantment ( enchantmentdata . enchantmentobj , enchantmentdata . enchantmentLevel ) ) { enchantmentdata = ( EnchantmentData ) iterator . next ( ) ; } onCraftMatrixChanged ( tableInventory ) ; } } return true ; } else { return false ; } } public void onCraftGuiClosed ( EntityPlayer par1EntityPlayer ) { super . onCraftGuiClosed ( par1EntityPlayer ) ; if ( worldPointer . isRemote ) { return ; } ItemStack itemstack = tableInventory . getStackInSlotOnClosing ( <NUM_LIT:0> ) ; if ( itemstack != null ) { par1EntityPlayer . dropPlayerItem ( itemstack ) ; } } public boolean canInteractWith ( EntityPlayer par1EntityPlayer ) { if ( worldPointer . getBlockId ( posX , posY , posZ ) != Block . enchantmentTable . blockID ) { return false ; } return par1EntityPlayer . getDistanceSq ( ( double ) posX + <NUM_LIT> , ( double ) posY + <NUM_LIT> , ( double ) posZ + <NUM_LIT> ) <= <NUM_LIT> ; } public ItemStack transferStackInSlot ( int par1 ) { ItemStack itemstack = null ; Slot slot = ( Slot ) inventorySlots . get ( par1 ) ; if ( slot != null && slot . getHasStack ( ) ) { ItemStack itemstack1 = slot . getStack ( ) ; itemstack = itemstack1 . copy ( ) ; if ( par1 == <NUM_LIT:0> ) { if ( ! mergeItemStack ( itemstack1 , <NUM_LIT:1> , <NUM_LIT> , true ) ) { return null ; } } else { return null ; } if ( itemstack1 . stackSize == <NUM_LIT:0> ) { slot . putStack ( null ) ; } else { slot . onSlotChanged ( ) ; } if ( itemstack1 . stackSize != itemstack . stackSize ) { slot . onPickupFromSlot ( itemstack1 ) ; } else { return null ; } } return itemstack ; } } </s>
|
<s> package net . minecraft . src ; import java . util . List ; public class MapInfo { public final EntityPlayer entityplayerObj ; public int field_28119_b [ ] ; public int field_28125_c [ ] ; private int field_28123_e ; private int field_28122_f ; private byte field_28121_g [ ] ; final MapData mapDataObj ; public MapInfo ( MapData par1MapData , EntityPlayer par2EntityPlayer ) { mapDataObj = par1MapData ; field_28119_b = new int [ <NUM_LIT> ] ; field_28125_c = new int [ <NUM_LIT> ] ; field_28123_e = <NUM_LIT:0> ; field_28122_f = <NUM_LIT:0> ; entityplayerObj = par2EntityPlayer ; for ( int i = <NUM_LIT:0> ; i < field_28119_b . length ; i ++ ) { field_28119_b [ i ] = <NUM_LIT:0> ; field_28125_c [ i ] = <NUM_LIT> ; } } public byte [ ] func_28118_a ( ItemStack par1ItemStack ) { if ( -- field_28122_f < <NUM_LIT:0> ) { field_28122_f = <NUM_LIT:4> ; byte abyte0 [ ] = new byte [ mapDataObj . playersVisibleOnMap . size ( ) * <NUM_LIT:3> + <NUM_LIT:1> ] ; abyte0 [ <NUM_LIT:0> ] = <NUM_LIT:1> ; for ( int j = <NUM_LIT:0> ; j < mapDataObj . playersVisibleOnMap . size ( ) ; j ++ ) { MapCoord mapcoord = ( MapCoord ) mapDataObj . playersVisibleOnMap . get ( j ) ; abyte0 [ j * <NUM_LIT:3> + <NUM_LIT:1> ] = ( byte ) ( mapcoord . field_28202_a + ( mapcoord . iconRotation & <NUM_LIT> ) * <NUM_LIT:16> ) ; abyte0 [ j * <NUM_LIT:3> + <NUM_LIT:2> ] = mapcoord . centerX ; abyte0 [ j * <NUM_LIT:3> + <NUM_LIT:3> ] = mapcoord . centerZ ; } boolean flag = true ; if ( field_28121_g == null || field_28121_g . length != abyte0 . length ) { flag = false ; } else { int l = <NUM_LIT:0> ; do { if ( l >= abyte0 . length ) { break ; } if ( abyte0 [ l ] != field_28121_g [ l ] ) { flag = false ; break ; } l ++ ; } while ( true ) ; } if ( ! flag ) { field_28121_g = abyte0 ; return abyte0 ; } } for ( int i = <NUM_LIT:0> ; i < <NUM_LIT:10> ; i ++ ) { int k = ( field_28123_e * <NUM_LIT:11> ) % <NUM_LIT> ; field_28123_e ++ ; if ( field_28119_b [ k ] >= <NUM_LIT:0> ) { int i1 = ( field_28125_c [ k ] - field_28119_b [ k ] ) + <NUM_LIT:1> ; int j1 = field_28119_b [ k ] ; byte abyte1 [ ] = new byte [ i1 + <NUM_LIT:3> ] ; abyte1 [ <NUM_LIT:0> ] = <NUM_LIT:0> ; abyte1 [ <NUM_LIT:1> ] = ( byte ) k ; abyte1 [ <NUM_LIT:2> ] = ( byte ) j1 ; for ( int k1 = <NUM_LIT:0> ; k1 < abyte1 . length - <NUM_LIT:3> ; k1 ++ ) { abyte1 [ k1 + <NUM_LIT:3> ] = mapDataObj . colors [ ( k1 + j1 ) * <NUM_LIT> + k ] ; } field_28125_c [ k ] = - <NUM_LIT:1> ; field_28119_b [ k ] = - <NUM_LIT:1> ; return abyte1 ; } } return null ; } } </s>
|
<s> package net . minecraft . src ; import java . util . List ; import java . util . Random ; public class ComponentMineshaftCorridor extends StructureComponent { private final boolean hasRails ; private final boolean hasSpiders ; private boolean spawnerPlaced ; private int sectionCount ; public ComponentMineshaftCorridor ( int par1 , Random par2Random , StructureBoundingBox par3StructureBoundingBox , int par4 ) { super ( par1 ) ; coordBaseMode = par4 ; boundingBox = par3StructureBoundingBox ; hasRails = par2Random . nextInt ( <NUM_LIT:3> ) == <NUM_LIT:0> ; hasSpiders = ! hasRails && par2Random . nextInt ( <NUM_LIT> ) == <NUM_LIT:0> ; if ( coordBaseMode == <NUM_LIT:2> || coordBaseMode == <NUM_LIT:0> ) { sectionCount = par3StructureBoundingBox . getZSize ( ) / <NUM_LIT:5> ; } else { sectionCount = par3StructureBoundingBox . getXSize ( ) / <NUM_LIT:5> ; } } public static StructureBoundingBox findValidPlacement ( List par0List , Random par1Random , int par2 , int par3 , int par4 , int par5 ) { StructureBoundingBox structureboundingbox = new StructureBoundingBox ( par2 , par3 , par4 , par2 , par3 + <NUM_LIT:2> , par4 ) ; int i = par1Random . nextInt ( <NUM_LIT:3> ) + <NUM_LIT:2> ; do { if ( i <= <NUM_LIT:0> ) { break ; } int j = i * <NUM_LIT:5> ; switch ( par5 ) { case <NUM_LIT:2> : structureboundingbox . maxX = par2 + <NUM_LIT:2> ; structureboundingbox . minZ = par4 - ( j - <NUM_LIT:1> ) ; break ; case <NUM_LIT:0> : structureboundingbox . maxX = par2 + <NUM_LIT:2> ; structureboundingbox . maxZ = par4 + ( j - <NUM_LIT:1> ) ; break ; case <NUM_LIT:1> : structureboundingbox . minX = par2 - ( j - <NUM_LIT:1> ) ; structureboundingbox . maxZ = par4 + <NUM_LIT:2> ; break ; case <NUM_LIT:3> : structureboundingbox . maxX = par2 + ( j - <NUM_LIT:1> ) ; structureboundingbox . maxZ = par4 + <NUM_LIT:2> ; break ; } if ( StructureComponent . findIntersecting ( par0List , structureboundingbox ) == null ) { break ; } i -- ; } while ( true ) ; if ( i > <NUM_LIT:0> ) { return structureboundingbox ; } else { return null ; } } public void buildComponent ( StructureComponent par1StructureComponent , List par2List , Random par3Random ) { int i = getComponentType ( ) ; int j = par3Random . nextInt ( <NUM_LIT:4> ) ; switch ( coordBaseMode ) { case <NUM_LIT:2> : if ( j <= <NUM_LIT:1> ) { StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . minX , ( boundingBox . minY - <NUM_LIT:1> ) + par3Random . nextInt ( <NUM_LIT:3> ) , boundingBox . minZ - <NUM_LIT:1> , coordBaseMode , i ) ; } else if ( j == <NUM_LIT:2> ) { StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . minX - <NUM_LIT:1> , ( boundingBox . minY - <NUM_LIT:1> ) + par3Random . nextInt ( <NUM_LIT:3> ) , boundingBox . minZ , <NUM_LIT:1> , i ) ; } else { StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . maxX + <NUM_LIT:1> , ( boundingBox . minY - <NUM_LIT:1> ) + par3Random . nextInt ( <NUM_LIT:3> ) , boundingBox . minZ , <NUM_LIT:3> , i ) ; } break ; case <NUM_LIT:0> : if ( j <= <NUM_LIT:1> ) { StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . minX , ( boundingBox . minY - <NUM_LIT:1> ) + par3Random . nextInt ( <NUM_LIT:3> ) , boundingBox . maxZ + <NUM_LIT:1> , coordBaseMode , i ) ; } else if ( j == <NUM_LIT:2> ) { StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . minX - <NUM_LIT:1> , ( boundingBox . minY - <NUM_LIT:1> ) + par3Random . nextInt ( <NUM_LIT:3> ) , boundingBox . maxZ - <NUM_LIT:3> , <NUM_LIT:1> , i ) ; } else { StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . maxX + <NUM_LIT:1> , ( boundingBox . minY - <NUM_LIT:1> ) + par3Random . nextInt ( <NUM_LIT:3> ) , boundingBox . maxZ - <NUM_LIT:3> , <NUM_LIT:3> , i ) ; } break ; case <NUM_LIT:1> : if ( j <= <NUM_LIT:1> ) { StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . minX - <NUM_LIT:1> , ( boundingBox . minY - <NUM_LIT:1> ) + par3Random . nextInt ( <NUM_LIT:3> ) , boundingBox . minZ , coordBaseMode , i ) ; } else if ( j == <NUM_LIT:2> ) { StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . minX , ( boundingBox . minY - <NUM_LIT:1> ) + par3Random . nextInt ( <NUM_LIT:3> ) , boundingBox . minZ - <NUM_LIT:1> , <NUM_LIT:2> , i ) ; } else { StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . minX , ( boundingBox . minY - <NUM_LIT:1> ) + par3Random . nextInt ( <NUM_LIT:3> ) , boundingBox . maxZ + <NUM_LIT:1> , <NUM_LIT:0> , i ) ; } break ; case <NUM_LIT:3> : if ( j <= <NUM_LIT:1> ) { StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . maxX + <NUM_LIT:1> , ( boundingBox . minY - <NUM_LIT:1> ) + par3Random . nextInt ( <NUM_LIT:3> ) , boundingBox . minZ , coordBaseMode , i ) ; } else if ( j == <NUM_LIT:2> ) { StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . maxX - <NUM_LIT:3> , ( boundingBox . minY - <NUM_LIT:1> ) + par3Random . nextInt ( <NUM_LIT:3> ) , boundingBox . minZ - <NUM_LIT:1> , <NUM_LIT:2> , i ) ; } else { StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . maxX - <NUM_LIT:3> , ( boundingBox . minY - <NUM_LIT:1> ) + par3Random . nextInt ( <NUM_LIT:3> ) , boundingBox . maxZ + <NUM_LIT:1> , <NUM_LIT:0> , i ) ; } break ; } if ( i < <NUM_LIT:8> ) { if ( coordBaseMode == <NUM_LIT:2> || coordBaseMode == <NUM_LIT:0> ) { for ( int k = boundingBox . minZ + <NUM_LIT:3> ; k + <NUM_LIT:3> <= boundingBox . maxZ ; k += <NUM_LIT:5> ) { int i1 = par3Random . nextInt ( <NUM_LIT:5> ) ; if ( i1 == <NUM_LIT:0> ) { StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . minX - <NUM_LIT:1> , boundingBox . minY , k , <NUM_LIT:1> , i + <NUM_LIT:1> ) ; } else if ( i1 == <NUM_LIT:1> ) { StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . maxX + <NUM_LIT:1> , boundingBox . minY , k , <NUM_LIT:3> , i + <NUM_LIT:1> ) ; } } } else { for ( int l = boundingBox . minX + <NUM_LIT:3> ; l + <NUM_LIT:3> <= boundingBox . maxX ; l += <NUM_LIT:5> ) { int j1 = par3Random . nextInt ( <NUM_LIT:5> ) ; if ( j1 == <NUM_LIT:0> ) { StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , l , boundingBox . minY , boundingBox . minZ - <NUM_LIT:1> , <NUM_LIT:2> , i + <NUM_LIT:1> ) ; continue ; } if ( j1 == <NUM_LIT:1> ) { StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , l , boundingBox . minY , boundingBox . maxZ + <NUM_LIT:1> , <NUM_LIT:0> , i + <NUM_LIT:1> ) ; } } } } } public boolean addComponentParts ( World par1World , Random par2Random , StructureBoundingBox par3StructureBoundingBox ) { if ( isLiquidInStructureBoundingBox ( par1World , par3StructureBoundingBox ) ) { return false ; } int i = sectionCount * <NUM_LIT:5> - <NUM_LIT:1> ; fillWithBlocks ( par1World , par3StructureBoundingBox , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:1> , i , <NUM_LIT:0> , <NUM_LIT:0> , false ) ; randomlyFillWithBlocks ( par1World , par3StructureBoundingBox , par2Random , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:2> , i , <NUM_LIT:0> , <NUM_LIT:0> , false ) ; if ( hasSpiders ) { randomlyFillWithBlocks ( par1World , par3StructureBoundingBox , par2Random , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:1> , i , Block . web . blockID , <NUM_LIT:0> , false ) ; } for ( int j = <NUM_LIT:0> ; j < sectionCount ; j ++ ) { int i1 = <NUM_LIT:2> + j * <NUM_LIT:5> ; fillWithBlocks ( par1World , par3StructureBoundingBox , <NUM_LIT:0> , <NUM_LIT:0> , i1 , <NUM_LIT:0> , <NUM_LIT:1> , i1 , Block . fence . blockID , <NUM_LIT:0> , false ) ; fillWithBlocks ( par1World , par3StructureBoundingBox , <NUM_LIT:2> , <NUM_LIT:0> , i1 , <NUM_LIT:2> , <NUM_LIT:1> , i1 , Block . fence . blockID , <NUM_LIT:0> , false ) ; if ( par2Random . nextInt ( <NUM_LIT:4> ) != <NUM_LIT:0> ) { fillWithBlocks ( par1World , par3StructureBoundingBox , <NUM_LIT:0> , <NUM_LIT:2> , i1 , <NUM_LIT:2> , <NUM_LIT:2> , i1 , Block . planks . blockID , <NUM_LIT:0> , false ) ; } else { fillWithBlocks ( par1World , par3StructureBoundingBox , <NUM_LIT:0> , <NUM_LIT:2> , i1 , <NUM_LIT:0> , <NUM_LIT:2> , i1 , Block . planks . blockID , <NUM_LIT:0> , false ) ; fillWithBlocks ( par1World , par3StructureBoundingBox , <NUM_LIT:2> , <NUM_LIT:2> , i1 , <NUM_LIT:2> , <NUM_LIT:2> , i1 , Block . planks . blockID , <NUM_LIT:0> , false ) ; } randomlyPlaceBlock ( par1World , par3StructureBoundingBox , par2Random , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:2> , i1 - <NUM_LIT:1> , Block . web . blockID , <NUM_LIT:0> ) ; randomlyPlaceBlock ( par1World , par3StructureBoundingBox , par2Random , <NUM_LIT> , <NUM_LIT:2> , <NUM_LIT:2> , i1 - <NUM_LIT:1> , Block . web . blockID , <NUM_LIT:0> ) ; randomlyPlaceBlock ( par1World , par3StructureBoundingBox , par2Random , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:2> , i1 + <NUM_LIT:1> , Block . web . blockID , <NUM_LIT:0> ) ; randomlyPlaceBlock ( par1World , par3StructureBoundingBox , par2Random , <NUM_LIT> , <NUM_LIT:2> , <NUM_LIT:2> , i1 + <NUM_LIT:1> , Block . web . blockID , <NUM_LIT:0> ) ; randomlyPlaceBlock ( par1World , par3StructureBoundingBox , par2Random , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:2> , i1 - <NUM_LIT:2> , Block . web . blockID , <NUM_LIT:0> ) ; randomlyPlaceBlock ( par1World , par3StructureBoundingBox , par2Random , <NUM_LIT> , <NUM_LIT:2> , <NUM_LIT:2> , i1 - <NUM_LIT:2> , Block . web . blockID , <NUM_LIT:0> ) ; randomlyPlaceBlock ( par1World , par3StructureBoundingBox , par2Random , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:2> , i1 + <NUM_LIT:2> , Block . web . blockID , <NUM_LIT:0> ) ; randomlyPlaceBlock ( par1World , par3StructureBoundingBox , par2Random , <NUM_LIT> , <NUM_LIT:2> , <NUM_LIT:2> , i1 + <NUM_LIT:2> , Block . web . blockID , <NUM_LIT:0> ) ; randomlyPlaceBlock ( par1World , par3StructureBoundingBox , par2Random , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:2> , i1 - <NUM_LIT:1> , Block . torchWood . blockID , <NUM_LIT:0> ) ; randomlyPlaceBlock ( par1World , par3StructureBoundingBox , par2Random , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:2> , i1 + <NUM_LIT:1> , Block . torchWood . blockID , <NUM_LIT:0> ) ; if ( par2Random . nextInt ( <NUM_LIT:100> ) == <NUM_LIT:0> ) { createTreasureChestAtCurrentPosition ( par1World , par3StructureBoundingBox , par2Random , <NUM_LIT:2> , <NUM_LIT:0> , i1 - <NUM_LIT:1> , StructureMineshaftPieces . getTreasurePieces ( ) , <NUM_LIT:3> + par2Random . nextInt ( <NUM_LIT:4> ) ) ; } if ( par2Random . nextInt ( <NUM_LIT:100> ) == <NUM_LIT:0> ) { createTreasureChestAtCurrentPosition ( par1World , par3StructureBoundingBox , par2Random , <NUM_LIT:0> , <NUM_LIT:0> , i1 + <NUM_LIT:1> , StructureMineshaftPieces . getTreasurePieces ( ) , <NUM_LIT:3> + par2Random . nextInt ( <NUM_LIT:4> ) ) ; } if ( ! hasSpiders || spawnerPlaced ) { continue ; } int l1 = getYWithOffset ( <NUM_LIT:0> ) ; int j2 = ( i1 - <NUM_LIT:1> ) + par2Random . nextInt ( <NUM_LIT:3> ) ; int k2 = getXWithOffset ( <NUM_LIT:1> , j2 ) ; j2 = getZWithOffset ( <NUM_LIT:1> , j2 ) ; if ( ! par3StructureBoundingBox . isVecInside ( k2 , l1 , j2 ) ) { continue ; } spawnerPlaced = true ; par1World . setBlockWithNotify ( k2 , l1 , j2 , Block . mobSpawner . blockID ) ; TileEntityMobSpawner tileentitymobspawner = ( TileEntityMobSpawner ) par1World . getBlockTileEntity ( k2 , l1 , j2 ) ; if ( tileentitymobspawner != null ) { tileentitymobspawner . setMobID ( "<STR_LIT>" ) ; } } for ( int k = <NUM_LIT:0> ; k <= <NUM_LIT:2> ; k ++ ) { for ( int j1 = <NUM_LIT:0> ; j1 <= i ; j1 ++ ) { int i2 = getBlockIdAtCurrentPosition ( par1World , k , - <NUM_LIT:1> , j1 , par3StructureBoundingBox ) ; if ( i2 == <NUM_LIT:0> ) { placeBlockAtCurrentPosition ( par1World , Block . planks . blockID , <NUM_LIT:0> , k , - <NUM_LIT:1> , j1 , par3StructureBoundingBox ) ; } } } if ( hasRails ) { for ( int l = <NUM_LIT:0> ; l <= i ; l ++ ) { int k1 = getBlockIdAtCurrentPosition ( par1World , <NUM_LIT:1> , - <NUM_LIT:1> , l , par3StructureBoundingBox ) ; if ( k1 > <NUM_LIT:0> && Block . opaqueCubeLookup [ k1 ] ) { randomlyPlaceBlock ( par1World , par3StructureBoundingBox , par2Random , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , l , Block . rail . blockID , getMetadataWithOffset ( Block . rail . blockID , <NUM_LIT:0> ) ) ; } } } return true ; } } </s>
|
<s> package net . minecraft . src ; public class TileEntityNote extends TileEntity { public byte note ; public boolean previousRedstoneState ; public TileEntityNote ( ) { note = <NUM_LIT:0> ; previousRedstoneState = false ; } public void writeToNBT ( NBTTagCompound par1NBTTagCompound ) { super . writeToNBT ( par1NBTTagCompound ) ; par1NBTTagCompound . setByte ( "<STR_LIT>" , note ) ; } public void readFromNBT ( NBTTagCompound par1NBTTagCompound ) { super . readFromNBT ( par1NBTTagCompound ) ; note = par1NBTTagCompound . getByte ( "<STR_LIT>" ) ; if ( note < <NUM_LIT:0> ) { note = <NUM_LIT:0> ; } if ( note > <NUM_LIT:24> ) { note = <NUM_LIT:24> ; } } public void changePitch ( ) { note = ( byte ) ( ( note + <NUM_LIT:1> ) % <NUM_LIT> ) ; onInventoryChanged ( ) ; } public void triggerNote ( World par1World , int par2 , int par3 , int par4 ) { if ( par1World . getBlockMaterial ( par2 , par3 + <NUM_LIT:1> , par4 ) != Material . air ) { return ; } Material material = par1World . getBlockMaterial ( par2 , par3 - <NUM_LIT:1> , par4 ) ; byte byte0 = <NUM_LIT:0> ; if ( material == Material . rock ) { byte0 = <NUM_LIT:1> ; } if ( material == Material . sand ) { byte0 = <NUM_LIT:2> ; } if ( material == Material . glass ) { byte0 = <NUM_LIT:3> ; } if ( material == Material . wood ) { byte0 = <NUM_LIT:4> ; } par1World . playNoteAt ( par2 , par3 , par4 , byte0 , note ) ; } } </s>
|
<s> package net . minecraft . src ; public class EnchantmentArrowDamage extends Enchantment { public EnchantmentArrowDamage ( int par1 , int par2 ) { super ( par1 , par2 , EnumEnchantmentType . bow ) ; setName ( "<STR_LIT>" ) ; } public int getMinEnchantability ( int par1 ) { return <NUM_LIT:1> + ( par1 - <NUM_LIT:1> ) * <NUM_LIT:10> ; } public int getMaxEnchantability ( int par1 ) { return getMinEnchantability ( par1 ) + <NUM_LIT:15> ; } public int getMaxLevel ( ) { return <NUM_LIT:5> ; } } </s>
|
<s> package net . minecraft . src ; import java . io . PrintStream ; import java . util . Random ; public class Item { protected static Random itemRand = new Random ( ) ; public static Item itemsList [ ] = new Item [ <NUM_LIT> ] ; public static Item shovelSteel ; public static Item pickaxeSteel ; public static Item axeSteel ; public static Item flintAndSteel = ( new ItemFlintAndSteel ( <NUM_LIT:3> ) ) . setIconCoord ( <NUM_LIT:5> , <NUM_LIT:0> ) . setItemName ( "<STR_LIT>" ) ; public static Item appleRed = ( new ItemFood ( <NUM_LIT:4> , <NUM_LIT:4> , <NUM_LIT> , false ) ) . setIconCoord ( <NUM_LIT:10> , <NUM_LIT:0> ) . setItemName ( "<STR_LIT>" ) ; public static Item bow = ( new ItemBow ( <NUM_LIT:5> ) ) . setIconCoord ( <NUM_LIT:5> , <NUM_LIT:1> ) . setItemName ( "<STR_LIT>" ) ; public static Item arrow = ( new Item ( <NUM_LIT:6> ) ) . setIconCoord ( <NUM_LIT:5> , <NUM_LIT:2> ) . setItemName ( "<STR_LIT>" ) ; public static Item coal = ( new ItemCoal ( <NUM_LIT:7> ) ) . setIconCoord ( <NUM_LIT:7> , <NUM_LIT:0> ) . setItemName ( "<STR_LIT>" ) ; public static Item diamond = ( new Item ( <NUM_LIT:8> ) ) . setIconCoord ( <NUM_LIT:7> , <NUM_LIT:3> ) . setItemName ( "<STR_LIT>" ) ; public static Item ingotIron = ( new Item ( <NUM_LIT:9> ) ) . setIconCoord ( <NUM_LIT:7> , <NUM_LIT:1> ) . setItemName ( "<STR_LIT>" ) ; public static Item ingotGold = ( new Item ( <NUM_LIT:10> ) ) . setIconCoord ( <NUM_LIT:7> , <NUM_LIT:2> ) . setItemName ( "<STR_LIT>" ) ; public static Item swordSteel ; public static Item swordWood ; public static Item shovelWood ; public static Item pickaxeWood ; public static Item axeWood ; public static Item swordStone ; public static Item shovelStone ; public static Item pickaxeStone ; public static Item axeStone ; public static Item swordDiamond ; public static Item shovelDiamond ; public static Item pickaxeDiamond ; public static Item axeDiamond ; public static Item stick = ( new Item ( <NUM_LIT:24> ) ) . setIconCoord ( <NUM_LIT:5> , <NUM_LIT:3> ) . setFull3D ( ) . setItemName ( "<STR_LIT>" ) ; public static Item bowlEmpty = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:7> , <NUM_LIT:4> ) . setItemName ( "<STR_LIT>" ) ; public static Item bowlSoup = ( new ItemSoup ( <NUM_LIT> , <NUM_LIT:8> ) ) . setIconCoord ( <NUM_LIT:8> , <NUM_LIT:4> ) . setItemName ( "<STR_LIT>" ) ; public static Item swordGold ; public static Item shovelGold ; public static Item pickaxeGold ; public static Item axeGold ; public static Item silk = ( new Item ( <NUM_LIT:31> ) ) . setIconCoord ( <NUM_LIT:8> , <NUM_LIT:0> ) . setItemName ( "<STR_LIT:string>" ) ; public static Item feather = ( new Item ( <NUM_LIT:32> ) ) . setIconCoord ( <NUM_LIT:8> , <NUM_LIT:1> ) . setItemName ( "<STR_LIT>" ) ; public static Item gunpowder ; public static Item hoeWood ; public static Item hoeStone ; public static Item hoeSteel ; public static Item hoeDiamond ; public static Item hoeGold ; public static Item seeds ; public static Item wheat = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:9> , <NUM_LIT:1> ) . setItemName ( "<STR_LIT>" ) ; public static Item bread = ( new ItemFood ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT> , false ) ) . setIconCoord ( <NUM_LIT:9> , <NUM_LIT:2> ) . setItemName ( "<STR_LIT>" ) ; public static Item helmetLeather ; public static Item plateLeather ; public static Item legsLeather ; public static Item bootsLeather ; public static Item helmetChain ; public static Item plateChain ; public static Item legsChain ; public static Item bootsChain ; public static Item helmetSteel ; public static Item plateSteel ; public static Item legsSteel ; public static Item bootsSteel ; public static Item helmetDiamond ; public static Item plateDiamond ; public static Item legsDiamond ; public static Item bootsDiamond ; public static Item helmetGold ; public static Item plateGold ; public static Item legsGold ; public static Item bootsGold ; public static Item flint = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:6> , <NUM_LIT:0> ) . setItemName ( "<STR_LIT>" ) ; public static Item porkRaw = ( new ItemFood ( <NUM_LIT> , <NUM_LIT:3> , <NUM_LIT> , true ) ) . setIconCoord ( <NUM_LIT:7> , <NUM_LIT:5> ) . setItemName ( "<STR_LIT>" ) ; public static Item porkCooked = ( new ItemFood ( <NUM_LIT> , <NUM_LIT:8> , <NUM_LIT> , true ) ) . setIconCoord ( <NUM_LIT:8> , <NUM_LIT:5> ) . setItemName ( "<STR_LIT>" ) ; public static Item painting = ( new ItemPainting ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:10> , <NUM_LIT:1> ) . setItemName ( "<STR_LIT>" ) ; public static Item appleGold ; public static Item sign = ( new ItemSign ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:10> , <NUM_LIT:2> ) . setItemName ( "<STR_LIT>" ) ; public static Item doorWood ; public static Item bucketEmpty ; public static Item bucketWater ; public static Item bucketLava ; public static Item minecartEmpty = ( new ItemMinecart ( <NUM_LIT> , <NUM_LIT:0> ) ) . setIconCoord ( <NUM_LIT:7> , <NUM_LIT:8> ) . setItemName ( "<STR_LIT>" ) ; public static Item saddle = ( new ItemSaddle ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:8> , <NUM_LIT:6> ) . setItemName ( "<STR_LIT>" ) ; public static Item doorSteel ; public static Item redstone ; public static Item snowball = ( new ItemSnowball ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT> , <NUM_LIT:0> ) . setItemName ( "<STR_LIT>" ) ; public static Item boat = ( new ItemBoat ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:8> , <NUM_LIT:8> ) . setItemName ( "<STR_LIT>" ) ; public static Item leather = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:7> , <NUM_LIT:6> ) . setItemName ( "<STR_LIT>" ) ; public static Item bucketMilk ; public static Item brick = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:6> , <NUM_LIT:1> ) . setItemName ( "<STR_LIT>" ) ; public static Item clay = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:9> , <NUM_LIT:3> ) . setItemName ( "<STR_LIT>" ) ; public static Item reed ; public static Item paper = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:10> , <NUM_LIT:3> ) . setItemName ( "<STR_LIT>" ) ; public static Item book = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:11> , <NUM_LIT:3> ) . setItemName ( "<STR_LIT>" ) ; public static Item slimeBall = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT> , <NUM_LIT:1> ) . setItemName ( "<STR_LIT>" ) ; public static Item minecartCrate = ( new ItemMinecart ( <NUM_LIT> , <NUM_LIT:1> ) ) . setIconCoord ( <NUM_LIT:7> , <NUM_LIT:9> ) . setItemName ( "<STR_LIT>" ) ; public static Item minecartPowered = ( new ItemMinecart ( <NUM_LIT> , <NUM_LIT:2> ) ) . setIconCoord ( <NUM_LIT:7> , <NUM_LIT:10> ) . setItemName ( "<STR_LIT>" ) ; public static Item egg = ( new ItemEgg ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:12> , <NUM_LIT:0> ) . setItemName ( "<STR_LIT>" ) ; public static Item compass = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:6> , <NUM_LIT:3> ) . setItemName ( "<STR_LIT>" ) ; public static Item fishingRod = ( new ItemFishingRod ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:5> , <NUM_LIT:4> ) . setItemName ( "<STR_LIT>" ) ; public static Item pocketSundial = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:6> , <NUM_LIT:4> ) . setItemName ( "<STR_LIT>" ) ; public static Item lightStoneDust ; public static Item fishRaw = ( new ItemFood ( <NUM_LIT> , <NUM_LIT:2> , <NUM_LIT> , false ) ) . setIconCoord ( <NUM_LIT:9> , <NUM_LIT:5> ) . setItemName ( "<STR_LIT>" ) ; public static Item fishCooked = ( new ItemFood ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT> , false ) ) . setIconCoord ( <NUM_LIT:10> , <NUM_LIT:5> ) . setItemName ( "<STR_LIT>" ) ; public static Item dyePowder = ( new ItemDye ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT> , <NUM_LIT:4> ) . setItemName ( "<STR_LIT>" ) ; public static Item bone = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:12> , <NUM_LIT:1> ) . setItemName ( "<STR_LIT>" ) . setFull3D ( ) ; public static Item sugar ; public static Item cake ; public static Item bed = ( new ItemBed ( <NUM_LIT> ) ) . setMaxStackSize ( <NUM_LIT:1> ) . setIconCoord ( <NUM_LIT> , <NUM_LIT:2> ) . setItemName ( "<STR_LIT>" ) ; public static Item redstoneRepeater ; public static Item cookie = ( new ItemFood ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT> , false ) ) . setIconCoord ( <NUM_LIT:12> , <NUM_LIT:5> ) . setItemName ( "<STR_LIT>" ) ; public static ItemMap map = ( ItemMap ) ( new ItemMap ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:12> , <NUM_LIT:3> ) . setItemName ( "<STR_LIT>" ) ; public static ItemShears shears = ( ItemShears ) ( new ItemShears ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT> , <NUM_LIT:5> ) . setItemName ( "<STR_LIT>" ) ; public static Item melon = ( new ItemFood ( <NUM_LIT> , <NUM_LIT:2> , <NUM_LIT> , false ) ) . setIconCoord ( <NUM_LIT> , <NUM_LIT:6> ) . setItemName ( "<STR_LIT>" ) ; public static Item pumpkinSeeds ; public static Item melonSeeds ; public static Item beefRaw = ( new ItemFood ( <NUM_LIT> , <NUM_LIT:3> , <NUM_LIT> , true ) ) . setIconCoord ( <NUM_LIT:9> , <NUM_LIT:6> ) . setItemName ( "<STR_LIT>" ) ; public static Item beefCooked = ( new ItemFood ( <NUM_LIT> , <NUM_LIT:8> , <NUM_LIT> , true ) ) . setIconCoord ( <NUM_LIT:10> , <NUM_LIT:6> ) . setItemName ( "<STR_LIT>" ) ; public static Item chickenRaw ; public static Item chickenCooked = ( new ItemFood ( <NUM_LIT> , <NUM_LIT:6> , <NUM_LIT> , true ) ) . setIconCoord ( <NUM_LIT:10> , <NUM_LIT:7> ) . setItemName ( "<STR_LIT>" ) ; public static Item rottenFlesh ; public static Item enderPearl = ( new ItemEnderPearl ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:11> , <NUM_LIT:6> ) . setItemName ( "<STR_LIT>" ) ; public static Item blazeRod = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:12> , <NUM_LIT:6> ) . setItemName ( "<STR_LIT>" ) ; public static Item ghastTear ; public static Item goldNugget = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:12> , <NUM_LIT:7> ) . setItemName ( "<STR_LIT>" ) ; public static Item netherStalkSeeds ; public static ItemPotion potion = ( ItemPotion ) ( new ItemPotion ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT> , <NUM_LIT:8> ) . setItemName ( "<STR_LIT>" ) ; public static Item glassBottle = ( new ItemGlassBottle ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:12> , <NUM_LIT:8> ) . setItemName ( "<STR_LIT>" ) ; public static Item spiderEye ; public static Item fermentedSpiderEye ; public static Item blazePowder ; public static Item magmaCream ; public static Item brewingStand ; public static Item cauldron ; public static Item eyeOfEnder = ( new ItemEnderEye ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:11> , <NUM_LIT:9> ) . setItemName ( "<STR_LIT>" ) ; public static Item speckledMelon ; public static Item monsterPlacer = ( new ItemMonsterPlacer ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:9> , <NUM_LIT:9> ) . setItemName ( "<STR_LIT>" ) ; public static Item expBottle = ( new ItemExpBottle ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:11> , <NUM_LIT:10> ) . setItemName ( "<STR_LIT>" ) ; public static Item fireballCharge = ( new ItemFireball ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT> , <NUM_LIT:2> ) . setItemName ( "<STR_LIT>" ) ; public static Item record13 = ( new ItemRecord ( <NUM_LIT> , "<STR_LIT>" ) ) . setIconCoord ( <NUM_LIT:0> , <NUM_LIT:15> ) . setItemName ( "<STR_LIT>" ) ; public static Item recordCat = ( new ItemRecord ( <NUM_LIT> , "<STR_LIT>" ) ) . setIconCoord ( <NUM_LIT:1> , <NUM_LIT:15> ) . setItemName ( "<STR_LIT>" ) ; public static Item recordBlocks = ( new ItemRecord ( <NUM_LIT> , "<STR_LIT>" ) ) . setIconCoord ( <NUM_LIT:2> , <NUM_LIT:15> ) . setItemName ( "<STR_LIT>" ) ; public static Item recordChirp = ( new ItemRecord ( <NUM_LIT> , "<STR_LIT>" ) ) . setIconCoord ( <NUM_LIT:3> , <NUM_LIT:15> ) . setItemName ( "<STR_LIT>" ) ; public static Item recordFar = ( new ItemRecord ( <NUM_LIT> , "<STR_LIT>" ) ) . setIconCoord ( <NUM_LIT:4> , <NUM_LIT:15> ) . setItemName ( "<STR_LIT>" ) ; public static Item recordMall = ( new ItemRecord ( <NUM_LIT> , "<STR_LIT>" ) ) . setIconCoord ( <NUM_LIT:5> , <NUM_LIT:15> ) . setItemName ( "<STR_LIT>" ) ; public static Item recordMellohi = ( new ItemRecord ( <NUM_LIT> , "<STR_LIT>" ) ) . setIconCoord ( <NUM_LIT:6> , <NUM_LIT:15> ) . setItemName ( "<STR_LIT>" ) ; public static Item recordStal = ( new ItemRecord ( <NUM_LIT> , "<STR_LIT>" ) ) . setIconCoord ( <NUM_LIT:7> , <NUM_LIT:15> ) . setItemName ( "<STR_LIT>" ) ; public static Item recordStrad = ( new ItemRecord ( <NUM_LIT> , "<STR_LIT>" ) ) . setIconCoord ( <NUM_LIT:8> , <NUM_LIT:15> ) . setItemName ( "<STR_LIT>" ) ; public static Item recordWard = ( new ItemRecord ( <NUM_LIT> , "<STR_LIT>" ) ) . setIconCoord ( <NUM_LIT:9> , <NUM_LIT:15> ) . setItemName ( "<STR_LIT>" ) ; public static Item record11 = ( new ItemRecord ( <NUM_LIT> , "<STR_LIT>" ) ) . setIconCoord ( <NUM_LIT:10> , <NUM_LIT:15> ) . setItemName ( "<STR_LIT>" ) ; public final int shiftedIndex ; protected int maxStackSize ; private int maxDamage ; protected int iconIndex ; protected boolean bFull3D ; protected boolean hasSubtypes ; private Item containerItem ; private String potionEffect ; private String itemName ; protected Item ( int par1 ) { maxStackSize = <NUM_LIT> ; maxDamage = <NUM_LIT:0> ; bFull3D = false ; hasSubtypes = false ; containerItem = null ; potionEffect = null ; shiftedIndex = <NUM_LIT> + par1 ; if ( itemsList [ <NUM_LIT> + par1 ] != null ) { System . out . println ( ( new StringBuilder ( ) ) . append ( "<STR_LIT>" ) . append ( par1 ) . toString ( ) ) ; } itemsList [ <NUM_LIT> + par1 ] = this ; } public Item setIconIndex ( int par1 ) { iconIndex = par1 ; return this ; } public Item setMaxStackSize ( int par1 ) { maxStackSize = par1 ; return this ; } public Item setIconCoord ( int par1 , int par2 ) { iconIndex = par1 + par2 * <NUM_LIT:16> ; return this ; } public boolean onItemUse ( ItemStack par1ItemStack , EntityPlayer par2EntityPlayer , World par3World , int i , int j , int k , int l ) { return false ; } public float getStrVsBlock ( ItemStack par1ItemStack , Block par2Block ) { return <NUM_LIT> ; } public ItemStack onItemRightClick ( ItemStack par1ItemStack , World par2World , EntityPlayer par3EntityPlayer ) { return par1ItemStack ; } public ItemStack onFoodEaten ( ItemStack par1ItemStack , World par2World , EntityPlayer par3EntityPlayer ) { return par1ItemStack ; } public int getItemStackLimit ( ) { return maxStackSize ; } public int getMetadata ( int par1 ) { return <NUM_LIT:0> ; } public boolean getHasSubtypes ( ) { return hasSubtypes ; } protected Item setHasSubtypes ( boolean par1 ) { hasSubtypes = par1 ; return this ; } public int getMaxDamage ( ) { return maxDamage ; } protected Item setMaxDamage ( int par1 ) { maxDamage = par1 ; return this ; } public boolean isDamageable ( ) { return maxDamage > <NUM_LIT:0> && ! hasSubtypes ; } public boolean hitEntity ( ItemStack par1ItemStack , EntityLiving par2EntityLiving , EntityLiving par3EntityLiving ) { return false ; } public boolean onBlockDestroyed ( ItemStack par1ItemStack , int par2 , int par3 , int i , int j , EntityLiving entityliving ) { return false ; } public int getDamageVsEntity ( Entity par1Entity ) { return <NUM_LIT:1> ; } public boolean canHarvestBlock ( Block par1Block ) { return false ; } public void useItemOnEntity ( ItemStack itemstack , EntityLiving entityliving ) { } public Item setFull3D ( ) { bFull3D = true ; return this ; } public Item setItemName ( String par1Str ) { itemName = ( new StringBuilder ( ) ) . append ( "<STR_LIT>" ) . append ( par1Str ) . toString ( ) ; return this ; } public String getItemName ( ) { return itemName ; } public String getItemNameIS ( ItemStack par1ItemStack ) { return itemName ; } public Item setContainerItem ( Item par1Item ) { containerItem = par1Item ; return this ; } public boolean doesContainerItemLeaveCraftingGrid ( ItemStack par1ItemStack ) { return true ; } public boolean func_46003_i ( ) { return false ; } public Item getContainerItem ( ) { return containerItem ; } public boolean hasContainerItem ( ) { return containerItem != null ; } public String getStatName ( ) { return StatCollector . translateToLocal ( ( new StringBuilder ( ) ) . append ( getItemName ( ) ) . append ( "<STR_LIT>" ) . toString ( ) ) ; } public void onUpdate ( ItemStack itemstack , World world , Entity entity , int i , boolean flag ) { } public void onCreated ( ItemStack itemstack , World world , EntityPlayer entityplayer ) { } public boolean func_28019_b ( ) { return false ; } public EnumAction getItemUseAction ( ItemStack par1ItemStack ) { return EnumAction . none ; } public int getMaxItemUseDuration ( ItemStack par1ItemStack ) { return <NUM_LIT:0> ; } public void onPlayerStoppedUsing ( ItemStack itemstack , World world , EntityPlayer entityplayer , int i ) { } protected Item setPotionEffect ( String par1Str ) { potionEffect = par1Str ; return this ; } public String getPotionEffect ( ) { return potionEffect ; } public boolean isPotionIngredient ( ) { return potionEffect != null ; } public boolean isItemTool ( ItemStack par1ItemStack ) { return getItemStackLimit ( ) == <NUM_LIT:1> && isDamageable ( ) ; } protected MovingObjectPosition getMovingObjectPositionFromPlayer ( World par1World , EntityPlayer par2EntityPlayer , boolean par3 ) { float f = <NUM_LIT> ; float f1 = par2EntityPlayer . prevRotationPitch + ( par2EntityPlayer . rotationPitch - par2EntityPlayer . prevRotationPitch ) * f ; float f2 = par2EntityPlayer . prevRotationYaw + ( par2EntityPlayer . rotationYaw - par2EntityPlayer . prevRotationYaw ) * f ; double d = par2EntityPlayer . prevPosX + ( par2EntityPlayer . posX - par2EntityPlayer . prevPosX ) * ( double ) f ; double d1 = ( par2EntityPlayer . prevPosY + ( par2EntityPlayer . posY - par2EntityPlayer . prevPosY ) * ( double ) f + <NUM_LIT> ) - ( double ) par2EntityPlayer . yOffset ; double d2 = par2EntityPlayer . prevPosZ + ( par2EntityPlayer . posZ - par2EntityPlayer . prevPosZ ) * ( double ) f ; Vec3D vec3d = Vec3D . createVector ( d , d1 , d2 ) ; float f3 = MathHelper . cos ( - f2 * <NUM_LIT> - ( float ) Math . PI ) ; float f4 = MathHelper . sin ( - f2 * <NUM_LIT> - ( float ) Math . PI ) ; float f5 = - MathHelper . cos ( - f1 * <NUM_LIT> ) ; float f6 = MathHelper . sin ( - f1 * <NUM_LIT> ) ; float f7 = f4 * f5 ; float f8 = f6 ; float f9 = f3 * f5 ; double d3 = <NUM_LIT> ; Vec3D vec3d1 = vec3d . addVector ( ( double ) f7 * d3 , ( double ) f8 * d3 , ( double ) f9 * d3 ) ; MovingObjectPosition movingobjectposition = par1World . rayTraceBlocks_do_do ( vec3d , vec3d1 , par3 , ! par3 ) ; return movingobjectposition ; } public int getItemEnchantability ( ) { return <NUM_LIT:0> ; } static { shovelSteel = ( new ItemSpade ( <NUM_LIT:0> , EnumToolMaterial . IRON ) ) . setIconCoord ( <NUM_LIT:2> , <NUM_LIT:5> ) . setItemName ( "<STR_LIT>" ) ; pickaxeSteel = ( new ItemPickaxe ( <NUM_LIT:1> , EnumToolMaterial . IRON ) ) . setIconCoord ( <NUM_LIT:2> , <NUM_LIT:6> ) . setItemName ( "<STR_LIT>" ) ; axeSteel = ( new ItemAxe ( <NUM_LIT:2> , EnumToolMaterial . IRON ) ) . setIconCoord ( <NUM_LIT:2> , <NUM_LIT:7> ) . setItemName ( "<STR_LIT>" ) ; swordSteel = ( new ItemSword ( <NUM_LIT:11> , EnumToolMaterial . IRON ) ) . setIconCoord ( <NUM_LIT:2> , <NUM_LIT:4> ) . setItemName ( "<STR_LIT>" ) ; swordWood = ( new ItemSword ( <NUM_LIT:12> , EnumToolMaterial . WOOD ) ) . setIconCoord ( <NUM_LIT:0> , <NUM_LIT:4> ) . setItemName ( "<STR_LIT>" ) ; shovelWood = ( new ItemSpade ( <NUM_LIT> , EnumToolMaterial . WOOD ) ) . setIconCoord ( <NUM_LIT:0> , <NUM_LIT:5> ) . setItemName ( "<STR_LIT>" ) ; pickaxeWood = ( new ItemPickaxe ( <NUM_LIT> , EnumToolMaterial . WOOD ) ) . setIconCoord ( <NUM_LIT:0> , <NUM_LIT:6> ) . setItemName ( "<STR_LIT>" ) ; axeWood = ( new ItemAxe ( <NUM_LIT:15> , EnumToolMaterial . WOOD ) ) . setIconCoord ( <NUM_LIT:0> , <NUM_LIT:7> ) . setItemName ( "<STR_LIT>" ) ; swordStone = ( new ItemSword ( <NUM_LIT:16> , EnumToolMaterial . STONE ) ) . setIconCoord ( <NUM_LIT:1> , <NUM_LIT:4> ) . setItemName ( "<STR_LIT>" ) ; shovelStone = ( new ItemSpade ( <NUM_LIT> , EnumToolMaterial . STONE ) ) . setIconCoord ( <NUM_LIT:1> , <NUM_LIT:5> ) . setItemName ( "<STR_LIT>" ) ; pickaxeStone = ( new ItemPickaxe ( <NUM_LIT> , EnumToolMaterial . STONE ) ) . setIconCoord ( <NUM_LIT:1> , <NUM_LIT:6> ) . setItemName ( "<STR_LIT>" ) ; axeStone = ( new ItemAxe ( <NUM_LIT> , EnumToolMaterial . STONE ) ) . setIconCoord ( <NUM_LIT:1> , <NUM_LIT:7> ) . setItemName ( "<STR_LIT>" ) ; swordDiamond = ( new ItemSword ( <NUM_LIT:20> , EnumToolMaterial . EMERALD ) ) . setIconCoord ( <NUM_LIT:3> , <NUM_LIT:4> ) . setItemName ( "<STR_LIT>" ) ; shovelDiamond = ( new ItemSpade ( <NUM_LIT> , EnumToolMaterial . EMERALD ) ) . setIconCoord ( <NUM_LIT:3> , <NUM_LIT:5> ) . setItemName ( "<STR_LIT>" ) ; pickaxeDiamond = ( new ItemPickaxe ( <NUM_LIT> , EnumToolMaterial . EMERALD ) ) . setIconCoord ( <NUM_LIT:3> , <NUM_LIT:6> ) . setItemName ( "<STR_LIT>" ) ; axeDiamond = ( new ItemAxe ( <NUM_LIT> , EnumToolMaterial . EMERALD ) ) . setIconCoord ( <NUM_LIT:3> , <NUM_LIT:7> ) . setItemName ( "<STR_LIT>" ) ; swordGold = ( new ItemSword ( <NUM_LIT> , EnumToolMaterial . GOLD ) ) . setIconCoord ( <NUM_LIT:4> , <NUM_LIT:4> ) . setItemName ( "<STR_LIT>" ) ; shovelGold = ( new ItemSpade ( <NUM_LIT> , EnumToolMaterial . GOLD ) ) . setIconCoord ( <NUM_LIT:4> , <NUM_LIT:5> ) . setItemName ( "<STR_LIT>" ) ; pickaxeGold = ( new ItemPickaxe ( <NUM_LIT> , EnumToolMaterial . GOLD ) ) . setIconCoord ( <NUM_LIT:4> , <NUM_LIT:6> ) . setItemName ( "<STR_LIT>" ) ; axeGold = ( new ItemAxe ( <NUM_LIT:30> , EnumToolMaterial . GOLD ) ) . setIconCoord ( <NUM_LIT:4> , <NUM_LIT:7> ) . setItemName ( "<STR_LIT>" ) ; gunpowder = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:8> , <NUM_LIT:2> ) . setItemName ( "<STR_LIT>" ) . setPotionEffect ( PotionHelper . gunpowderEffect ) ; hoeWood = ( new ItemHoe ( <NUM_LIT> , EnumToolMaterial . WOOD ) ) . setIconCoord ( <NUM_LIT:0> , <NUM_LIT:8> ) . setItemName ( "<STR_LIT>" ) ; hoeStone = ( new ItemHoe ( <NUM_LIT> , EnumToolMaterial . STONE ) ) . setIconCoord ( <NUM_LIT:1> , <NUM_LIT:8> ) . setItemName ( "<STR_LIT>" ) ; hoeSteel = ( new ItemHoe ( <NUM_LIT> , EnumToolMaterial . IRON ) ) . setIconCoord ( <NUM_LIT:2> , <NUM_LIT:8> ) . setItemName ( "<STR_LIT>" ) ; hoeDiamond = ( new ItemHoe ( <NUM_LIT> , EnumToolMaterial . EMERALD ) ) . setIconCoord ( <NUM_LIT:3> , <NUM_LIT:8> ) . setItemName ( "<STR_LIT>" ) ; hoeGold = ( new ItemHoe ( <NUM_LIT> , EnumToolMaterial . GOLD ) ) . setIconCoord ( <NUM_LIT:4> , <NUM_LIT:8> ) . setItemName ( "<STR_LIT>" ) ; seeds = ( new ItemSeeds ( <NUM_LIT> , Block . crops . blockID , Block . tilledField . blockID ) ) . setIconCoord ( <NUM_LIT:9> , <NUM_LIT:0> ) . setItemName ( "<STR_LIT>" ) ; helmetLeather = ( new ItemArmor ( <NUM_LIT> , EnumArmorMaterial . CLOTH , <NUM_LIT:0> , <NUM_LIT:0> ) ) . setIconCoord ( <NUM_LIT:0> , <NUM_LIT:0> ) . setItemName ( "<STR_LIT>" ) ; plateLeather = ( new ItemArmor ( <NUM_LIT> , EnumArmorMaterial . CLOTH , <NUM_LIT:0> , <NUM_LIT:1> ) ) . setIconCoord ( <NUM_LIT:0> , <NUM_LIT:1> ) . setItemName ( "<STR_LIT>" ) ; legsLeather = ( new ItemArmor ( <NUM_LIT> , EnumArmorMaterial . CLOTH , <NUM_LIT:0> , <NUM_LIT:2> ) ) . setIconCoord ( <NUM_LIT:0> , <NUM_LIT:2> ) . setItemName ( "<STR_LIT>" ) ; bootsLeather = ( new ItemArmor ( <NUM_LIT> , EnumArmorMaterial . CLOTH , <NUM_LIT:0> , <NUM_LIT:3> ) ) . setIconCoord ( <NUM_LIT:0> , <NUM_LIT:3> ) . setItemName ( "<STR_LIT>" ) ; helmetChain = ( new ItemArmor ( <NUM_LIT> , EnumArmorMaterial . CHAIN , <NUM_LIT:1> , <NUM_LIT:0> ) ) . setIconCoord ( <NUM_LIT:1> , <NUM_LIT:0> ) . setItemName ( "<STR_LIT>" ) ; plateChain = ( new ItemArmor ( <NUM_LIT> , EnumArmorMaterial . CHAIN , <NUM_LIT:1> , <NUM_LIT:1> ) ) . setIconCoord ( <NUM_LIT:1> , <NUM_LIT:1> ) . setItemName ( "<STR_LIT>" ) ; legsChain = ( new ItemArmor ( <NUM_LIT> , EnumArmorMaterial . CHAIN , <NUM_LIT:1> , <NUM_LIT:2> ) ) . setIconCoord ( <NUM_LIT:1> , <NUM_LIT:2> ) . setItemName ( "<STR_LIT>" ) ; bootsChain = ( new ItemArmor ( <NUM_LIT> , EnumArmorMaterial . CHAIN , <NUM_LIT:1> , <NUM_LIT:3> ) ) . setIconCoord ( <NUM_LIT:1> , <NUM_LIT:3> ) . setItemName ( "<STR_LIT>" ) ; helmetSteel = ( new ItemArmor ( <NUM_LIT> , EnumArmorMaterial . IRON , <NUM_LIT:2> , <NUM_LIT:0> ) ) . setIconCoord ( <NUM_LIT:2> , <NUM_LIT:0> ) . setItemName ( "<STR_LIT>" ) ; plateSteel = ( new ItemArmor ( <NUM_LIT> , EnumArmorMaterial . IRON , <NUM_LIT:2> , <NUM_LIT:1> ) ) . setIconCoord ( <NUM_LIT:2> , <NUM_LIT:1> ) . setItemName ( "<STR_LIT>" ) ; legsSteel = ( new ItemArmor ( <NUM_LIT> , EnumArmorMaterial . IRON , <NUM_LIT:2> , <NUM_LIT:2> ) ) . setIconCoord ( <NUM_LIT:2> , <NUM_LIT:2> ) . setItemName ( "<STR_LIT>" ) ; bootsSteel = ( new ItemArmor ( <NUM_LIT> , EnumArmorMaterial . IRON , <NUM_LIT:2> , <NUM_LIT:3> ) ) . setIconCoord ( <NUM_LIT:2> , <NUM_LIT:3> ) . setItemName ( "<STR_LIT>" ) ; helmetDiamond = ( new ItemArmor ( <NUM_LIT> , EnumArmorMaterial . DIAMOND , <NUM_LIT:3> , <NUM_LIT:0> ) ) . setIconCoord ( <NUM_LIT:3> , <NUM_LIT:0> ) . setItemName ( "<STR_LIT>" ) ; plateDiamond = ( new ItemArmor ( <NUM_LIT> , EnumArmorMaterial . DIAMOND , <NUM_LIT:3> , <NUM_LIT:1> ) ) . setIconCoord ( <NUM_LIT:3> , <NUM_LIT:1> ) . setItemName ( "<STR_LIT>" ) ; legsDiamond = ( new ItemArmor ( <NUM_LIT> , EnumArmorMaterial . DIAMOND , <NUM_LIT:3> , <NUM_LIT:2> ) ) . setIconCoord ( <NUM_LIT:3> , <NUM_LIT:2> ) . setItemName ( "<STR_LIT>" ) ; bootsDiamond = ( new ItemArmor ( <NUM_LIT> , EnumArmorMaterial . DIAMOND , <NUM_LIT:3> , <NUM_LIT:3> ) ) . setIconCoord ( <NUM_LIT:3> , <NUM_LIT:3> ) . setItemName ( "<STR_LIT>" ) ; helmetGold = ( new ItemArmor ( <NUM_LIT> , EnumArmorMaterial . GOLD , <NUM_LIT:4> , <NUM_LIT:0> ) ) . setIconCoord ( <NUM_LIT:4> , <NUM_LIT:0> ) . setItemName ( "<STR_LIT>" ) ; plateGold = ( new ItemArmor ( <NUM_LIT> , EnumArmorMaterial . GOLD , <NUM_LIT:4> , <NUM_LIT:1> ) ) . setIconCoord ( <NUM_LIT:4> , <NUM_LIT:1> ) . setItemName ( "<STR_LIT>" ) ; legsGold = ( new ItemArmor ( <NUM_LIT> , EnumArmorMaterial . GOLD , <NUM_LIT:4> , <NUM_LIT:2> ) ) . setIconCoord ( <NUM_LIT:4> , <NUM_LIT:2> ) . setItemName ( "<STR_LIT>" ) ; bootsGold = ( new ItemArmor ( <NUM_LIT> , EnumArmorMaterial . GOLD , <NUM_LIT:4> , <NUM_LIT:3> ) ) . setIconCoord ( <NUM_LIT:4> , <NUM_LIT:3> ) . setItemName ( "<STR_LIT>" ) ; appleGold = ( new ItemAppleGold ( <NUM_LIT> , <NUM_LIT:4> , <NUM_LIT> , false ) ) . setAlwaysEdible ( ) . setPotionEffect ( Potion . regeneration . id , <NUM_LIT:5> , <NUM_LIT:0> , <NUM_LIT> ) . setIconCoord ( <NUM_LIT:11> , <NUM_LIT:0> ) . setItemName ( "<STR_LIT>" ) ; doorWood = ( new ItemDoor ( <NUM_LIT> , Material . wood ) ) . setIconCoord ( <NUM_LIT:11> , <NUM_LIT:2> ) . setItemName ( "<STR_LIT>" ) ; bucketEmpty = ( new ItemBucket ( <NUM_LIT> , <NUM_LIT:0> ) ) . setIconCoord ( <NUM_LIT:10> , <NUM_LIT:4> ) . setItemName ( "<STR_LIT>" ) ; bucketWater = ( new ItemBucket ( <NUM_LIT> , Block . waterMoving . blockID ) ) . setIconCoord ( <NUM_LIT:11> , <NUM_LIT:4> ) . setItemName ( "<STR_LIT>" ) . setContainerItem ( bucketEmpty ) ; bucketLava = ( new ItemBucket ( <NUM_LIT> , Block . lavaMoving . blockID ) ) . setIconCoord ( <NUM_LIT:12> , <NUM_LIT:4> ) . setItemName ( "<STR_LIT>" ) . setContainerItem ( bucketEmpty ) ; doorSteel = ( new ItemDoor ( <NUM_LIT> , Material . iron ) ) . setIconCoord ( <NUM_LIT:12> , <NUM_LIT:2> ) . setItemName ( "<STR_LIT>" ) ; redstone = ( new ItemRedstone ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:8> , <NUM_LIT:3> ) . setItemName ( "<STR_LIT>" ) . setPotionEffect ( PotionHelper . redstoneEffect ) ; bucketMilk = ( new ItemBucketMilk ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT> , <NUM_LIT:4> ) . setItemName ( "<STR_LIT>" ) . setContainerItem ( bucketEmpty ) ; reed = ( new ItemReed ( <NUM_LIT> , Block . reed ) ) . setIconCoord ( <NUM_LIT:11> , <NUM_LIT:1> ) . setItemName ( "<STR_LIT>" ) ; lightStoneDust = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:9> , <NUM_LIT:4> ) . setItemName ( "<STR_LIT>" ) . setPotionEffect ( PotionHelper . glowstoneEffect ) ; sugar = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT> , <NUM_LIT:0> ) . setItemName ( "<STR_LIT>" ) . setPotionEffect ( PotionHelper . sugarEffect ) ; cake = ( new ItemReed ( <NUM_LIT> , Block . cake ) ) . setMaxStackSize ( <NUM_LIT:1> ) . setIconCoord ( <NUM_LIT> , <NUM_LIT:1> ) . setItemName ( "<STR_LIT>" ) ; redstoneRepeater = ( new ItemReed ( <NUM_LIT:100> , Block . redstoneRepeaterIdle ) ) . setIconCoord ( <NUM_LIT:6> , <NUM_LIT:5> ) . setItemName ( "<STR_LIT>" ) ; pumpkinSeeds = ( new ItemSeeds ( <NUM_LIT> , Block . pumpkinStem . blockID , Block . tilledField . blockID ) ) . setIconCoord ( <NUM_LIT> , <NUM_LIT:3> ) . setItemName ( "<STR_LIT>" ) ; melonSeeds = ( new ItemSeeds ( <NUM_LIT> , Block . melonStem . blockID , Block . tilledField . blockID ) ) . setIconCoord ( <NUM_LIT> , <NUM_LIT:3> ) . setItemName ( "<STR_LIT>" ) ; chickenRaw = ( new ItemFood ( <NUM_LIT> , <NUM_LIT:2> , <NUM_LIT> , true ) ) . setPotionEffect ( Potion . hunger . id , <NUM_LIT:30> , <NUM_LIT:0> , <NUM_LIT> ) . setIconCoord ( <NUM_LIT:9> , <NUM_LIT:7> ) . setItemName ( "<STR_LIT>" ) ; rottenFlesh = ( new ItemFood ( <NUM_LIT> , <NUM_LIT:4> , <NUM_LIT> , true ) ) . setPotionEffect ( Potion . hunger . id , <NUM_LIT:30> , <NUM_LIT:0> , <NUM_LIT> ) . setIconCoord ( <NUM_LIT:11> , <NUM_LIT:5> ) . setItemName ( "<STR_LIT>" ) ; ghastTear = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:11> , <NUM_LIT:7> ) . setItemName ( "<STR_LIT>" ) . setPotionEffect ( PotionHelper . ghastTearEffect ) ; netherStalkSeeds = ( new ItemSeeds ( <NUM_LIT> , Block . netherStalk . blockID , Block . slowSand . blockID ) ) . setIconCoord ( <NUM_LIT> , <NUM_LIT:7> ) . setItemName ( "<STR_LIT>" ) . setPotionEffect ( "<STR_LIT>" ) ; spiderEye = ( new ItemFood ( <NUM_LIT> , <NUM_LIT:2> , <NUM_LIT> , false ) ) . setPotionEffect ( Potion . poison . id , <NUM_LIT:5> , <NUM_LIT:0> , <NUM_LIT> ) . setIconCoord ( <NUM_LIT:11> , <NUM_LIT:8> ) . setItemName ( "<STR_LIT>" ) . setPotionEffect ( PotionHelper . spiderEyeEffect ) ; fermentedSpiderEye = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:10> , <NUM_LIT:8> ) . setItemName ( "<STR_LIT>" ) . setPotionEffect ( PotionHelper . fermentedSpiderEyeEffect ) ; blazePowder = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT> , <NUM_LIT:9> ) . setItemName ( "<STR_LIT>" ) . setPotionEffect ( PotionHelper . blazePowderEffect ) ; magmaCream = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT> , <NUM_LIT:10> ) . setItemName ( "<STR_LIT>" ) . setPotionEffect ( PotionHelper . magmaCreamEffect ) ; brewingStand = ( new ItemReed ( <NUM_LIT> , Block . brewingStand ) ) . setIconCoord ( <NUM_LIT:12> , <NUM_LIT:10> ) . setItemName ( "<STR_LIT>" ) ; cauldron = ( new ItemReed ( <NUM_LIT> , Block . cauldron ) ) . setIconCoord ( <NUM_LIT:12> , <NUM_LIT:9> ) . setItemName ( "<STR_LIT>" ) ; speckledMelon = ( new Item ( <NUM_LIT> ) ) . setIconCoord ( <NUM_LIT:9> , <NUM_LIT:8> ) . setItemName ( "<STR_LIT>" ) . setPotionEffect ( PotionHelper . speckledMelonEffect ) ; StatList . initStats ( ) ; } } </s>
|
<s> package net . minecraft . src ; public class EnchantmentProtection extends Enchantment { private static final String protectionName [ ] = { "<STR_LIT:all>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ; private static final int baseEnchantability [ ] = { <NUM_LIT:1> , <NUM_LIT:10> , <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:3> } ; private static final int levelEnchantability [ ] = { <NUM_LIT:16> , <NUM_LIT:8> , <NUM_LIT:6> , <NUM_LIT:8> , <NUM_LIT:6> } ; private static final int thresholdEnchantability [ ] = { <NUM_LIT:20> , <NUM_LIT:12> , <NUM_LIT:10> , <NUM_LIT:12> , <NUM_LIT:15> } ; public final int protectionType ; public EnchantmentProtection ( int par1 , int par2 , int par3 ) { super ( par1 , par2 , EnumEnchantmentType . armor ) ; protectionType = par3 ; if ( par3 == <NUM_LIT:2> ) { type = EnumEnchantmentType . armor_feet ; } } public int getMinEnchantability ( int par1 ) { return baseEnchantability [ protectionType ] + ( par1 - <NUM_LIT:1> ) * levelEnchantability [ protectionType ] ; } public int getMaxEnchantability ( int par1 ) { return getMinEnchantability ( par1 ) + thresholdEnchantability [ protectionType ] ; } public int getMaxLevel ( ) { return <NUM_LIT:4> ; } public int calcModifierDamage ( int par1 , DamageSource par2DamageSource ) { if ( par2DamageSource . canHarmInCreative ( ) ) { return <NUM_LIT:0> ; } int i = ( <NUM_LIT:6> + par1 * par1 ) / <NUM_LIT:2> ; if ( protectionType == <NUM_LIT:0> ) { return i ; } if ( protectionType == <NUM_LIT:1> && par2DamageSource . fireDamage ( ) ) { return i ; } if ( protectionType == <NUM_LIT:2> && par2DamageSource == DamageSource . fall ) { return i * <NUM_LIT:2> ; } if ( protectionType == <NUM_LIT:3> && par2DamageSource == DamageSource . explosion ) { return i ; } if ( protectionType == <NUM_LIT:4> && par2DamageSource . isProjectile ( ) ) { return i ; } else { return <NUM_LIT:0> ; } } public boolean canApplyTogether ( Enchantment par1Enchantment ) { if ( par1Enchantment instanceof EnchantmentProtection ) { EnchantmentProtection enchantmentprotection = ( EnchantmentProtection ) par1Enchantment ; if ( enchantmentprotection . protectionType == protectionType ) { return false ; } return protectionType == <NUM_LIT:2> || enchantmentprotection . protectionType == <NUM_LIT:2> ; } else { return super . canApplyTogether ( par1Enchantment ) ; } } } </s>
|
<s> package net . minecraft . src ; import java . util . Random ; public class EntityZombie extends EntityMob { public EntityZombie ( World par1World ) { super ( par1World ) ; texture = "<STR_LIT>" ; moveSpeed = <NUM_LIT> ; attackStrength = <NUM_LIT:4> ; getNavigator ( ) . setBreakDoors ( true ) ; tasks . addTask ( <NUM_LIT:0> , new EntityAISwimming ( this ) ) ; tasks . addTask ( <NUM_LIT:1> , new EntityAIBreakDoor ( this ) ) ; tasks . addTask ( <NUM_LIT:2> , new EntityAIAttackOnCollide ( this , net . minecraft . src . EntityPlayer . class , moveSpeed , false ) ) ; tasks . addTask ( <NUM_LIT:3> , new EntityAIAttackOnCollide ( this , net . minecraft . src . EntityVillager . class , moveSpeed , true ) ) ; tasks . addTask ( <NUM_LIT:4> , new EntityAIMoveTwardsRestriction ( this , moveSpeed ) ) ; tasks . addTask ( <NUM_LIT:5> , new EntityAIMoveThroughVillage ( this , moveSpeed , false ) ) ; tasks . addTask ( <NUM_LIT:6> , new EntityAIWander ( this , moveSpeed ) ) ; tasks . addTask ( <NUM_LIT:7> , new EntityAIWatchClosest ( this , net . minecraft . src . EntityPlayer . class , <NUM_LIT> ) ) ; tasks . addTask ( <NUM_LIT:7> , new EntityAILookIdle ( this ) ) ; targetTasks . addTask ( <NUM_LIT:1> , new EntityAIHurtByTarget ( this , false ) ) ; targetTasks . addTask ( <NUM_LIT:2> , new EntityAINearestAttackableTarget ( this , net . minecraft . src . EntityPlayer . class , <NUM_LIT> , <NUM_LIT:0> , true ) ) ; targetTasks . addTask ( <NUM_LIT:2> , new EntityAINearestAttackableTarget ( this , net . minecraft . src . EntityVillager . class , <NUM_LIT> , <NUM_LIT:0> , false ) ) ; } public int getMaxHealth ( ) { return <NUM_LIT:20> ; } public int getTotalArmorValue ( ) { return <NUM_LIT:2> ; } protected boolean isAIEnabled ( ) { return true ; } public void onLivingUpdate ( ) { if ( worldObj . isDaytime ( ) && ! worldObj . isRemote ) { float f = getBrightness ( <NUM_LIT> ) ; if ( f > <NUM_LIT> && worldObj . canBlockSeeTheSky ( MathHelper . floor_double ( posX ) , MathHelper . floor_double ( posY ) , MathHelper . floor_double ( posZ ) ) && rand . nextFloat ( ) * <NUM_LIT> < ( f - <NUM_LIT> ) * <NUM_LIT> ) { setFire ( <NUM_LIT:8> ) ; } } super . onLivingUpdate ( ) ; } protected String getLivingSound ( ) { return "<STR_LIT>" ; } protected String getHurtSound ( ) { return "<STR_LIT>" ; } protected String getDeathSound ( ) { return "<STR_LIT>" ; } protected int getDropItemId ( ) { return Item . rottenFlesh . shiftedIndex ; } public EnumCreatureAttribute getCreatureAttribute ( ) { return EnumCreatureAttribute . UNDEAD ; } protected void dropRareDrop ( int par1 ) { switch ( rand . nextInt ( <NUM_LIT:4> ) ) { case <NUM_LIT:0> : dropItem ( Item . swordSteel . shiftedIndex , <NUM_LIT:1> ) ; break ; case <NUM_LIT:1> : dropItem ( Item . helmetSteel . shiftedIndex , <NUM_LIT:1> ) ; break ; case <NUM_LIT:2> : dropItem ( Item . ingotIron . shiftedIndex , <NUM_LIT:1> ) ; break ; case <NUM_LIT:3> : dropItem ( Item . shovelSteel . shiftedIndex , <NUM_LIT:1> ) ; break ; } } } </s>
|
<s> package net . minecraft . src ; public enum EnumDoor { OPENING , WOOD_DOOR , GRATES , IRON_DOOR ; } </s>
|
<s> package net . minecraft . src ; import java . util . * ; public abstract class MapGenStructure extends MapGenBase { protected HashMap coordMap ; public MapGenStructure ( ) { coordMap = new HashMap ( ) ; } public void generate ( IChunkProvider par1IChunkProvider , World par2World , int par3 , int par4 , byte par5ArrayOfByte [ ] ) { super . generate ( par1IChunkProvider , par2World , par3 , par4 , par5ArrayOfByte ) ; } protected void recursiveGenerate ( World par1World , int par2 , int par3 , int par4 , int par5 , byte par6ArrayOfByte [ ] ) { if ( coordMap . containsKey ( Long . valueOf ( ChunkCoordIntPair . chunkXZ2Int ( par2 , par3 ) ) ) ) { return ; } rand . nextInt ( ) ; if ( canSpawnStructureAtCoords ( par2 , par3 ) ) { StructureStart structurestart = getStructureStart ( par2 , par3 ) ; coordMap . put ( Long . valueOf ( ChunkCoordIntPair . chunkXZ2Int ( par2 , par3 ) ) , structurestart ) ; } } public boolean generateStructuresInChunk ( World par1World , Random par2Random , int par3 , int par4 ) { int i = ( par3 << <NUM_LIT:4> ) + <NUM_LIT:8> ; int j = ( par4 << <NUM_LIT:4> ) + <NUM_LIT:8> ; boolean flag = false ; Iterator iterator = coordMap . values ( ) . iterator ( ) ; do { if ( ! iterator . hasNext ( ) ) { break ; } StructureStart structurestart = ( StructureStart ) iterator . next ( ) ; if ( structurestart . isSizeableStructure ( ) && structurestart . getBoundingBox ( ) . intersectsWith ( i , j , i + <NUM_LIT:15> , j + <NUM_LIT:15> ) ) { structurestart . generateStructure ( par1World , par2Random , new StructureBoundingBox ( i , j , i + <NUM_LIT:15> , j + <NUM_LIT:15> ) ) ; flag = true ; } } while ( true ) ; return flag ; } public boolean func_40204_a ( int par1 , int par2 , int par3 ) { Iterator iterator = coordMap . values ( ) . iterator ( ) ; label0 : do { if ( iterator . hasNext ( ) ) { StructureStart structurestart = ( StructureStart ) iterator . next ( ) ; if ( ! structurestart . isSizeableStructure ( ) || ! structurestart . getBoundingBox ( ) . intersectsWith ( par1 , par3 , par1 , par3 ) ) { continue ; } Iterator iterator1 = structurestart . getComponents ( ) . iterator ( ) ; StructureComponent structurecomponent ; do { if ( ! iterator1 . hasNext ( ) ) { continue label0 ; } structurecomponent = ( StructureComponent ) iterator1 . next ( ) ; } while ( ! structurecomponent . getBoundingBox ( ) . isVecInside ( par1 , par2 , par3 ) ) ; break ; } else { return false ; } } while ( true ) ; return true ; } public ChunkPosition getNearestInstance ( World par1World , int par2 , int par3 , int par4 ) { worldObj = par1World ; rand . setSeed ( par1World . getSeed ( ) ) ; long l = rand . nextLong ( ) ; long l1 = rand . nextLong ( ) ; long l2 = ( long ) ( par2 > > <NUM_LIT:4> ) * l ; long l3 = ( long ) ( par4 > > <NUM_LIT:4> ) * l1 ; rand . setSeed ( l2 ^ l3 ^ par1World . getSeed ( ) ) ; recursiveGenerate ( par1World , par2 > > <NUM_LIT:4> , par4 > > <NUM_LIT:4> , <NUM_LIT:0> , <NUM_LIT:0> , null ) ; double d = Double . MAX_VALUE ; ChunkPosition chunkposition = null ; Object obj = coordMap . values ( ) . iterator ( ) ; do { if ( ! ( ( Iterator ) ( obj ) ) . hasNext ( ) ) { break ; } StructureStart structurestart = ( StructureStart ) ( ( Iterator ) ( obj ) ) . next ( ) ; if ( structurestart . isSizeableStructure ( ) ) { StructureComponent structurecomponent = ( StructureComponent ) structurestart . getComponents ( ) . get ( <NUM_LIT:0> ) ; ChunkPosition chunkposition2 = structurecomponent . getCenter ( ) ; int i = chunkposition2 . x - par2 ; int k = chunkposition2 . y - par3 ; int j1 = chunkposition2 . z - par4 ; double d1 = i + i * k * k + j1 * j1 ; if ( d1 < d ) { d = d1 ; chunkposition = chunkposition2 ; } } } while ( true ) ; if ( chunkposition != null ) { return chunkposition ; } obj = func_40203_a ( ) ; if ( obj != null ) { ChunkPosition chunkposition1 = null ; Iterator iterator = ( ( List ) ( obj ) ) . iterator ( ) ; do { if ( ! iterator . hasNext ( ) ) { break ; } ChunkPosition chunkposition3 = ( ChunkPosition ) iterator . next ( ) ; int j = chunkposition3 . x - par2 ; int i1 = chunkposition3 . y - par3 ; int k1 = chunkposition3 . z - par4 ; double d2 = j + j * i1 * i1 + k1 * k1 ; if ( d2 < d ) { d = d2 ; chunkposition1 = chunkposition3 ; } } while ( true ) ; return chunkposition1 ; } else { return null ; } } protected List func_40203_a ( ) { return null ; } protected abstract boolean canSpawnStructureAtCoords ( int i , int j ) ; protected abstract StructureStart getStructureStart ( int i , int j ) ; } </s>
|
<s> package net . minecraft . src ; import java . util . ArrayList ; import java . util . List ; import net . minecraft . server . MinecraftServer ; public class WorldServer extends World { public ChunkProviderServer chunkProviderServer ; public boolean disableSpawnProtection ; public boolean levelSaving ; private MinecraftServer mcServer ; private IntHashMap entityInstanceIdMap ; public WorldServer ( MinecraftServer par1MinecraftServer , ISaveHandler par2ISaveHandler , String par3Str , int par4 , WorldSettings par5WorldSettings ) { super ( par2ISaveHandler , par3Str , par5WorldSettings , WorldProvider . getProviderForDimension ( par4 ) ) ; disableSpawnProtection = false ; mcServer = par1MinecraftServer ; if ( entityInstanceIdMap == null ) { entityInstanceIdMap = new IntHashMap ( ) ; } } public void updateEntityWithOptionalForce ( Entity par1Entity , boolean par2 ) { if ( ! mcServer . spawnPeacefulMobs && ( ( par1Entity instanceof EntityAnimal ) || ( par1Entity instanceof EntityWaterMob ) ) ) { par1Entity . setDead ( ) ; } if ( ! mcServer . field_44002_p && ( par1Entity instanceof INpc ) ) { par1Entity . setDead ( ) ; } if ( par1Entity . riddenByEntity == null || ! ( par1Entity . riddenByEntity instanceof EntityPlayer ) ) { super . updateEntityWithOptionalForce ( par1Entity , par2 ) ; } } public void func_12017_b ( Entity par1Entity , boolean par2 ) { super . updateEntityWithOptionalForce ( par1Entity , par2 ) ; } protected IChunkProvider createChunkProvider ( ) { IChunkLoader ichunkloader = saveHandler . getChunkLoader ( worldProvider ) ; chunkProviderServer = new ChunkProviderServer ( this , ichunkloader , worldProvider . getChunkProvider ( ) ) ; return chunkProviderServer ; } public List getTileEntityList ( int par1 , int par2 , int par3 , int par4 , int par5 , int par6 ) { ArrayList arraylist = new ArrayList ( ) ; for ( int i = <NUM_LIT:0> ; i < loadedTileEntityList . size ( ) ; i ++ ) { TileEntity tileentity = ( TileEntity ) loadedTileEntityList . get ( i ) ; if ( tileentity . xCoord >= par1 && tileentity . yCoord >= par2 && tileentity . zCoord >= par3 && tileentity . xCoord < par4 && tileentity . yCoord < par5 && tileentity . zCoord < par6 ) { arraylist . add ( tileentity ) ; } } return arraylist ; } public boolean canMineBlock ( EntityPlayer par1EntityPlayer , int par2 , int par3 , int par4 ) { int i = MathHelper . abs ( par2 - worldInfo . getSpawnX ( ) ) ; int j = MathHelper . abs ( par4 - worldInfo . getSpawnZ ( ) ) ; if ( i > j ) { j = i ; } return j > <NUM_LIT:16> || mcServer . configManager . isOp ( par1EntityPlayer . username ) ; } protected void generateSpawnPoint ( ) { if ( entityInstanceIdMap == null ) { entityInstanceIdMap = new IntHashMap ( ) ; } super . generateSpawnPoint ( ) ; } protected void obtainEntitySkin ( Entity par1Entity ) { super . obtainEntitySkin ( par1Entity ) ; entityInstanceIdMap . addKey ( par1Entity . entityId , par1Entity ) ; Entity aentity [ ] = par1Entity . getParts ( ) ; if ( aentity != null ) { for ( int i = <NUM_LIT:0> ; i < aentity . length ; i ++ ) { entityInstanceIdMap . addKey ( aentity [ i ] . entityId , aentity [ i ] ) ; } } } protected void releaseEntitySkin ( Entity par1Entity ) { super . releaseEntitySkin ( par1Entity ) ; entityInstanceIdMap . removeObject ( par1Entity . entityId ) ; Entity aentity [ ] = par1Entity . getParts ( ) ; if ( aentity != null ) { for ( int i = <NUM_LIT:0> ; i < aentity . length ; i ++ ) { entityInstanceIdMap . removeObject ( aentity [ i ] . entityId ) ; } } } public Entity func_6158_a ( int par1 ) { return ( Entity ) entityInstanceIdMap . lookup ( par1 ) ; } public boolean addWeatherEffect ( Entity par1Entity ) { if ( super . addWeatherEffect ( par1Entity ) ) { mcServer . configManager . sendPacketToPlayersAroundPoint ( par1Entity . posX , par1Entity . posY , par1Entity . posZ , <NUM_LIT> , worldProvider . worldType , new Packet71Weather ( par1Entity ) ) ; return true ; } else { return false ; } } public void setEntityState ( Entity par1Entity , byte par2 ) { Packet38EntityStatus packet38entitystatus = new Packet38EntityStatus ( par1Entity . entityId , par2 ) ; mcServer . getEntityTracker ( worldProvider . worldType ) . sendPacketToTrackedPlayersAndTrackedEntity ( par1Entity , packet38entitystatus ) ; } public Explosion newExplosion ( Entity par1Entity , double par2 , double par4 , double par6 , float par8 , boolean par9 ) { Explosion explosion = new Explosion ( this , par1Entity , par2 , par4 , par6 , par8 ) ; explosion . isFlaming = par9 ; explosion . doExplosionA ( ) ; explosion . doExplosionB ( false ) ; mcServer . configManager . sendPacketToPlayersAroundPoint ( par2 , par4 , par6 , <NUM_LIT> , worldProvider . worldType , new Packet60Explosion ( par2 , par4 , par6 , par8 , explosion . destroyedBlockPositions ) ) ; return explosion ; } public void playNoteAt ( int par1 , int par2 , int par3 , int par4 , int par5 ) { super . playNoteAt ( par1 , par2 , par3 , par4 , par5 ) ; mcServer . configManager . sendPacketToPlayersAroundPoint ( par1 , par2 , par3 , <NUM_LIT> , worldProvider . worldType , new Packet54PlayNoteBlock ( par1 , par2 , par3 , par4 , par5 ) ) ; } public void func_30006_w ( ) { saveHandler . func_22093_e ( ) ; } protected void updateWeather ( ) { boolean flag = isRaining ( ) ; super . updateWeather ( ) ; if ( flag != isRaining ( ) ) { if ( flag ) { mcServer . configManager . sendPacketToAllPlayers ( new Packet70Bed ( <NUM_LIT:2> , <NUM_LIT:0> ) ) ; } else { mcServer . configManager . sendPacketToAllPlayers ( new Packet70Bed ( <NUM_LIT:1> , <NUM_LIT:0> ) ) ; } } } } </s>
|
<s> package net . minecraft . src ; public class ItemMap extends ItemMapBase { protected ItemMap ( int par1 ) { super ( par1 ) ; setMaxStackSize ( <NUM_LIT:1> ) ; } public MapData getMapData ( ItemStack par1ItemStack , World par2World ) { String s = ( new StringBuilder ( ) ) . append ( "<STR_LIT>" ) . append ( par1ItemStack . getItemDamage ( ) ) . toString ( ) ; MapData mapdata = ( MapData ) par2World . loadItemData ( net . minecraft . src . MapData . class , ( new StringBuilder ( ) ) . append ( "<STR_LIT>" ) . append ( par1ItemStack . getItemDamage ( ) ) . toString ( ) ) ; if ( mapdata == null ) { par1ItemStack . setItemDamage ( par2World . getUniqueDataId ( "<STR_LIT>" ) ) ; String s1 = ( new StringBuilder ( ) ) . append ( "<STR_LIT>" ) . append ( par1ItemStack . getItemDamage ( ) ) . toString ( ) ; mapdata = new MapData ( s1 ) ; mapdata . xCenter = par2World . getWorldInfo ( ) . getSpawnX ( ) ; mapdata . zCenter = par2World . getWorldInfo ( ) . getSpawnZ ( ) ; mapdata . scale = <NUM_LIT:3> ; mapdata . dimension = ( byte ) par2World . worldProvider . worldType ; mapdata . markDirty ( ) ; par2World . setItemData ( s1 , mapdata ) ; } return mapdata ; } public void updateMapData ( World par1World , Entity par2Entity , MapData par3MapData ) { if ( par1World . worldProvider . worldType != par3MapData . dimension ) { return ; } char c = '<STR_LIT>' ; char c1 = '<STR_LIT>' ; int i = <NUM_LIT:1> << par3MapData . scale ; int j = par3MapData . xCenter ; int k = par3MapData . zCenter ; int l = MathHelper . floor_double ( par2Entity . posX - ( double ) j ) / i + c / <NUM_LIT:2> ; int i1 = MathHelper . floor_double ( par2Entity . posZ - ( double ) k ) / i + c1 / <NUM_LIT:2> ; int j1 = <NUM_LIT> / i ; if ( par1World . worldProvider . hasNoSky ) { j1 /= <NUM_LIT:2> ; } par3MapData . field_28159_g ++ ; for ( int k1 = ( l - j1 ) + <NUM_LIT:1> ; k1 < l + j1 ; k1 ++ ) { if ( ( k1 & <NUM_LIT> ) != ( par3MapData . field_28159_g & <NUM_LIT> ) ) { continue ; } int l1 = <NUM_LIT:255> ; int i2 = <NUM_LIT:0> ; double d = <NUM_LIT> ; for ( int j2 = i1 - j1 - <NUM_LIT:1> ; j2 < i1 + j1 ; j2 ++ ) { if ( k1 < <NUM_LIT:0> || j2 < - <NUM_LIT:1> || k1 >= c || j2 >= c1 ) { continue ; } int k2 = k1 - l ; int l2 = j2 - i1 ; boolean flag = k2 * k2 + l2 * l2 > ( j1 - <NUM_LIT:2> ) * ( j1 - <NUM_LIT:2> ) ; int i3 = ( ( j / i + k1 ) - c / <NUM_LIT:2> ) * i ; int j3 = ( ( k / i + j2 ) - c1 / <NUM_LIT:2> ) * i ; int k3 = <NUM_LIT:0> ; int l3 = <NUM_LIT:0> ; int i4 = <NUM_LIT:0> ; int ai [ ] = new int [ <NUM_LIT> ] ; Chunk chunk = par1World . getChunkFromBlockCoords ( i3 , j3 ) ; int j4 = i3 & <NUM_LIT> ; int k4 = j3 & <NUM_LIT> ; int l4 = <NUM_LIT:0> ; double d1 = <NUM_LIT> ; if ( par1World . worldProvider . hasNoSky ) { int i5 = i3 + j3 * <NUM_LIT> ; i5 = i5 * i5 * <NUM_LIT> + i5 * <NUM_LIT:11> ; if ( ( i5 > > <NUM_LIT:20> & <NUM_LIT:1> ) == <NUM_LIT:0> ) { ai [ Block . dirt . blockID ] += <NUM_LIT:10> ; } else { ai [ Block . stone . blockID ] += <NUM_LIT:10> ; } d1 = <NUM_LIT> ; } else { for ( int j5 = <NUM_LIT:0> ; j5 < i ; j5 ++ ) { for ( int l5 = <NUM_LIT:0> ; l5 < i ; l5 ++ ) { int j6 = chunk . getHeightValue ( j5 + j4 , l5 + k4 ) + <NUM_LIT:1> ; int l6 = <NUM_LIT:0> ; if ( j6 > <NUM_LIT:1> ) { boolean flag1 = false ; do { flag1 = true ; l6 = chunk . getBlockID ( j5 + j4 , j6 - <NUM_LIT:1> , l5 + k4 ) ; if ( l6 == <NUM_LIT:0> ) { flag1 = false ; } else if ( j6 > <NUM_LIT:0> && l6 > <NUM_LIT:0> && Block . blocksList [ l6 ] . blockMaterial . materialMapColor == MapColor . airColor ) { flag1 = false ; } if ( ! flag1 ) { j6 -- ; l6 = chunk . getBlockID ( j5 + j4 , j6 - <NUM_LIT:1> , l5 + k4 ) ; } } while ( j6 > <NUM_LIT:0> && ! flag1 ) ; if ( j6 > <NUM_LIT:0> && l6 != <NUM_LIT:0> && Block . blocksList [ l6 ] . blockMaterial . isLiquid ( ) ) { int i7 = j6 - <NUM_LIT:1> ; int k7 = <NUM_LIT:0> ; do { k7 = chunk . getBlockID ( j5 + j4 , i7 -- , l5 + k4 ) ; l4 ++ ; } while ( i7 > <NUM_LIT:0> && k7 != <NUM_LIT:0> && Block . blocksList [ k7 ] . blockMaterial . isLiquid ( ) ) ; } } d1 += ( double ) j6 / ( double ) ( i * i ) ; ai [ l6 ] ++ ; } } } l4 /= i * i ; k3 /= i * i ; l3 /= i * i ; i4 /= i * i ; int k5 = <NUM_LIT:0> ; int i6 = <NUM_LIT:0> ; for ( int k6 = <NUM_LIT:0> ; k6 < <NUM_LIT> ; k6 ++ ) { if ( ai [ k6 ] > k5 ) { i6 = k6 ; k5 = ai [ k6 ] ; } } double d2 = ( ( d1 - d ) * <NUM_LIT> ) / ( double ) ( i + <NUM_LIT:4> ) + ( ( double ) ( k1 + j2 & <NUM_LIT:1> ) - <NUM_LIT> ) * <NUM_LIT> ; byte byte0 = <NUM_LIT:1> ; if ( d2 > <NUM_LIT> ) { byte0 = <NUM_LIT:2> ; } if ( d2 < - <NUM_LIT> ) { byte0 = <NUM_LIT:0> ; } int j7 = <NUM_LIT:0> ; if ( i6 > <NUM_LIT:0> ) { MapColor mapcolor = Block . blocksList [ i6 ] . blockMaterial . materialMapColor ; if ( mapcolor == MapColor . waterColor ) { double d3 = ( double ) l4 * <NUM_LIT> + ( double ) ( k1 + j2 & <NUM_LIT:1> ) * <NUM_LIT> ; byte0 = <NUM_LIT:1> ; if ( d3 < <NUM_LIT> ) { byte0 = <NUM_LIT:2> ; } if ( d3 > <NUM_LIT> ) { byte0 = <NUM_LIT:0> ; } } j7 = mapcolor . colorIndex ; } d = d1 ; if ( j2 < <NUM_LIT:0> || k2 * k2 + l2 * l2 >= j1 * j1 || flag && ( k1 + j2 & <NUM_LIT:1> ) == <NUM_LIT:0> ) { continue ; } byte byte1 = par3MapData . colors [ k1 + j2 * c ] ; byte byte2 = ( byte ) ( j7 * <NUM_LIT:4> + byte0 ) ; if ( byte1 == byte2 ) { continue ; } if ( l1 > j2 ) { l1 = j2 ; } if ( i2 < j2 ) { i2 = j2 ; } par3MapData . colors [ k1 + j2 * c ] = byte2 ; } if ( l1 <= i2 ) { par3MapData . func_28153_a ( k1 , l1 , i2 ) ; } } } public void onUpdate ( ItemStack par1ItemStack , World par2World , Entity par3Entity , int par4 , boolean par5 ) { if ( par2World . isRemote ) { return ; } MapData mapdata = getMapData ( par1ItemStack , par2World ) ; if ( par3Entity instanceof EntityPlayer ) { EntityPlayer entityplayer = ( EntityPlayer ) par3Entity ; mapdata . func_28155_a ( entityplayer , par1ItemStack ) ; } if ( par5 ) { updateMapData ( par2World , par3Entity , mapdata ) ; } } public void onCreated ( ItemStack par1ItemStack , World par2World , EntityPlayer par3EntityPlayer ) { par1ItemStack . setItemDamage ( par2World . getUniqueDataId ( "<STR_LIT>" ) ) ; String s = ( new StringBuilder ( ) ) . append ( "<STR_LIT>" ) . append ( par1ItemStack . getItemDamage ( ) ) . toString ( ) ; MapData mapdata = new MapData ( s ) ; par2World . setItemData ( s , mapdata ) ; mapdata . xCenter = MathHelper . floor_double ( par3EntityPlayer . posX ) ; mapdata . zCenter = MathHelper . floor_double ( par3EntityPlayer . posZ ) ; mapdata . scale = <NUM_LIT:3> ; mapdata . dimension = ( byte ) par2World . worldProvider . worldType ; mapdata . markDirty ( ) ; } public Packet getUpdatePacket ( ItemStack par1ItemStack , World par2World , EntityPlayer par3EntityPlayer ) { byte abyte0 [ ] = getMapData ( par1ItemStack , par2World ) . func_28154_a ( par1ItemStack , par2World , par3EntityPlayer ) ; if ( abyte0 == null ) { return null ; } else { return new Packet131MapData ( ( short ) Item . map . shiftedIndex , ( short ) par1ItemStack . getItemDamage ( ) , abyte0 ) ; } } } </s>
|
<s> package net . minecraft . src ; public class GenLayerRiver extends GenLayer { public GenLayerRiver ( long par1 , GenLayer par3GenLayer ) { super ( par1 ) ; super . parent = par3GenLayer ; } public int [ ] getInts ( int par1 , int par2 , int par3 , int par4 ) { int i = par1 - <NUM_LIT:1> ; int j = par2 - <NUM_LIT:1> ; int k = par3 + <NUM_LIT:2> ; int l = par4 + <NUM_LIT:2> ; int ai [ ] = parent . getInts ( i , j , k , l ) ; int ai1 [ ] = IntCache . getIntCache ( par3 * par4 ) ; for ( int i1 = <NUM_LIT:0> ; i1 < par4 ; i1 ++ ) { for ( int j1 = <NUM_LIT:0> ; j1 < par3 ; j1 ++ ) { int k1 = ai [ j1 + <NUM_LIT:0> + ( i1 + <NUM_LIT:1> ) * k ] ; int l1 = ai [ j1 + <NUM_LIT:2> + ( i1 + <NUM_LIT:1> ) * k ] ; int i2 = ai [ j1 + <NUM_LIT:1> + ( i1 + <NUM_LIT:0> ) * k ] ; int j2 = ai [ j1 + <NUM_LIT:1> + ( i1 + <NUM_LIT:2> ) * k ] ; int k2 = ai [ j1 + <NUM_LIT:1> + ( i1 + <NUM_LIT:1> ) * k ] ; if ( k2 == <NUM_LIT:0> || k1 == <NUM_LIT:0> || l1 == <NUM_LIT:0> || i2 == <NUM_LIT:0> || j2 == <NUM_LIT:0> ) { ai1 [ j1 + i1 * par3 ] = BiomeGenBase . river . biomeID ; continue ; } if ( k2 != k1 || k2 != i2 || k2 != l1 || k2 != j2 ) { ai1 [ j1 + i1 * par3 ] = BiomeGenBase . river . biomeID ; } else { ai1 [ j1 + i1 * par3 ] = - <NUM_LIT:1> ; } } } return ai1 ; } } </s>
|
<s> package net . minecraft . src ; import java . io . * ; public class Packet130UpdateSign extends Packet { public int xPosition ; public int yPosition ; public int zPosition ; public String signLines [ ] ; public Packet130UpdateSign ( ) { isChunkDataPacket = true ; } public Packet130UpdateSign ( int par1 , int par2 , int par3 , String par4ArrayOfStr [ ] ) { isChunkDataPacket = true ; xPosition = par1 ; yPosition = par2 ; zPosition = par3 ; signLines = par4ArrayOfStr ; } public void readPacketData ( DataInputStream par1DataInputStream ) throws IOException { xPosition = par1DataInputStream . readInt ( ) ; yPosition = par1DataInputStream . readShort ( ) ; zPosition = par1DataInputStream . readInt ( ) ; signLines = new String [ <NUM_LIT:4> ] ; for ( int i = <NUM_LIT:0> ; i < <NUM_LIT:4> ; i ++ ) { signLines [ i ] = readString ( par1DataInputStream , <NUM_LIT:15> ) ; } } public void writePacketData ( DataOutputStream par1DataOutputStream ) throws IOException { par1DataOutputStream . writeInt ( xPosition ) ; par1DataOutputStream . writeShort ( yPosition ) ; par1DataOutputStream . writeInt ( zPosition ) ; for ( int i = <NUM_LIT:0> ; i < <NUM_LIT:4> ; i ++ ) { writeString ( signLines [ i ] , par1DataOutputStream ) ; } } public void processPacket ( NetHandler par1NetHandler ) { par1NetHandler . handleUpdateSign ( this ) ; } public int getPacketSize ( ) { int i = <NUM_LIT:0> ; for ( int j = <NUM_LIT:0> ; j < <NUM_LIT:4> ; j ++ ) { i += signLines [ j ] . length ( ) ; } return i ; } } </s>
|
<s> package net . minecraft . src ; public class BlockOreStorage extends Block { public BlockOreStorage ( int par1 , int par2 ) { super ( par1 , Material . iron ) ; blockIndexInTexture = par2 ; } public int getBlockTextureFromSide ( int par1 ) { return blockIndexInTexture ; } } </s>
|
<s> package net . minecraft . src ; import java . awt . event . ActionEvent ; import java . awt . event . ActionListener ; import javax . swing . JTextField ; import net . minecraft . server . MinecraftServer ; class ServerGuiCommandListener implements ActionListener { final JTextField textField ; final ServerGUI mcServerGui ; ServerGuiCommandListener ( ServerGUI par1ServerGUI , JTextField par2JTextField ) { mcServerGui = par1ServerGUI ; textField = par2JTextField ; } public void actionPerformed ( ActionEvent par1ActionEvent ) { String s = textField . getText ( ) . trim ( ) ; if ( s . length ( ) > <NUM_LIT:0> ) { ServerGUI . getMinecraftServer ( mcServerGui ) . addCommand ( s , mcServerGui ) ; } textField . setText ( "<STR_LIT>" ) ; } } </s>
|
<s> package net . minecraft . src ; public abstract class NetHandler { public NetHandler ( ) { } public abstract boolean isServerHandler ( ) ; public void func_48070_a ( Packet51MapChunk packet51mapchunk ) { } public void registerPacket ( Packet packet ) { } public void handleErrorMessage ( String s , Object aobj [ ] ) { } public void handleKickDisconnect ( Packet255KickDisconnect par1Packet255KickDisconnect ) { registerPacket ( par1Packet255KickDisconnect ) ; } public void handleLogin ( Packet1Login par1Packet1Login ) { registerPacket ( par1Packet1Login ) ; } public void handleFlying ( Packet10Flying par1Packet10Flying ) { registerPacket ( par1Packet10Flying ) ; } public void handleMultiBlockChange ( Packet52MultiBlockChange par1Packet52MultiBlockChange ) { registerPacket ( par1Packet52MultiBlockChange ) ; } public void handleBlockDig ( Packet14BlockDig par1Packet14BlockDig ) { registerPacket ( par1Packet14BlockDig ) ; } public void handleBlockChange ( Packet53BlockChange par1Packet53BlockChange ) { registerPacket ( par1Packet53BlockChange ) ; } public void handlePreChunk ( Packet50PreChunk par1Packet50PreChunk ) { registerPacket ( par1Packet50PreChunk ) ; } public void handleNamedEntitySpawn ( Packet20NamedEntitySpawn par1Packet20NamedEntitySpawn ) { registerPacket ( par1Packet20NamedEntitySpawn ) ; } public void handleEntity ( Packet30Entity par1Packet30Entity ) { registerPacket ( par1Packet30Entity ) ; } public void handleEntityTeleport ( Packet34EntityTeleport par1Packet34EntityTeleport ) { registerPacket ( par1Packet34EntityTeleport ) ; } public void handlePlace ( Packet15Place par1Packet15Place ) { registerPacket ( par1Packet15Place ) ; } public void handleBlockItemSwitch ( Packet16BlockItemSwitch par1Packet16BlockItemSwitch ) { registerPacket ( par1Packet16BlockItemSwitch ) ; } public void handleDestroyEntity ( Packet29DestroyEntity par1Packet29DestroyEntity ) { registerPacket ( par1Packet29DestroyEntity ) ; } public void handlePickupSpawn ( Packet21PickupSpawn par1Packet21PickupSpawn ) { registerPacket ( par1Packet21PickupSpawn ) ; } public void handleCollect ( Packet22Collect par1Packet22Collect ) { registerPacket ( par1Packet22Collect ) ; } public void handleChat ( Packet3Chat par1Packet3Chat ) { registerPacket ( par1Packet3Chat ) ; } public void handleVehicleSpawn ( Packet23VehicleSpawn par1Packet23VehicleSpawn ) { registerPacket ( par1Packet23VehicleSpawn ) ; } public void handleAnimation ( Packet18Animation par1Packet18Animation ) { registerPacket ( par1Packet18Animation ) ; } public void handleEntityAction ( Packet19EntityAction par1Packet19EntityAction ) { registerPacket ( par1Packet19EntityAction ) ; } public void handleHandshake ( Packet2Handshake par1Packet2Handshake ) { registerPacket ( par1Packet2Handshake ) ; } public void handleMobSpawn ( Packet24MobSpawn par1Packet24MobSpawn ) { registerPacket ( par1Packet24MobSpawn ) ; } public void handleUpdateTime ( Packet4UpdateTime par1Packet4UpdateTime ) { registerPacket ( par1Packet4UpdateTime ) ; } public void handleSpawnPosition ( Packet6SpawnPosition par1Packet6SpawnPosition ) { registerPacket ( par1Packet6SpawnPosition ) ; } public void handleEntityVelocity ( Packet28EntityVelocity par1Packet28EntityVelocity ) { registerPacket ( par1Packet28EntityVelocity ) ; } public void handleEntityMetadata ( Packet40EntityMetadata par1Packet40EntityMetadata ) { registerPacket ( par1Packet40EntityMetadata ) ; } public void handleAttachEntity ( Packet39AttachEntity par1Packet39AttachEntity ) { registerPacket ( par1Packet39AttachEntity ) ; } public void handleUseEntity ( Packet7UseEntity par1Packet7UseEntity ) { registerPacket ( par1Packet7UseEntity ) ; } public void handleEntityStatus ( Packet38EntityStatus par1Packet38EntityStatus ) { registerPacket ( par1Packet38EntityStatus ) ; } public void handleUpdateHealth ( Packet8UpdateHealth par1Packet8UpdateHealth ) { registerPacket ( par1Packet8UpdateHealth ) ; } public void handleRespawn ( Packet9Respawn par1Packet9Respawn ) { registerPacket ( par1Packet9Respawn ) ; } public void handleExplosion ( Packet60Explosion par1Packet60Explosion ) { registerPacket ( par1Packet60Explosion ) ; } public void handleOpenWindow ( Packet100OpenWindow par1Packet100OpenWindow ) { registerPacket ( par1Packet100OpenWindow ) ; } public void handleCloseWindow ( Packet101CloseWindow par1Packet101CloseWindow ) { registerPacket ( par1Packet101CloseWindow ) ; } public void handleWindowClick ( Packet102WindowClick par1Packet102WindowClick ) { registerPacket ( par1Packet102WindowClick ) ; } public void handleSetSlot ( Packet103SetSlot par1Packet103SetSlot ) { registerPacket ( par1Packet103SetSlot ) ; } public void handleWindowItems ( Packet104WindowItems par1Packet104WindowItems ) { registerPacket ( par1Packet104WindowItems ) ; } public void handleUpdateSign ( Packet130UpdateSign par1Packet130UpdateSign ) { registerPacket ( par1Packet130UpdateSign ) ; } public void handleUpdateProgressbar ( Packet105UpdateProgressbar par1Packet105UpdateProgressbar ) { registerPacket ( par1Packet105UpdateProgressbar ) ; } public void handlePlayerInventory ( Packet5PlayerInventory par1Packet5PlayerInventory ) { registerPacket ( par1Packet5PlayerInventory ) ; } public void handleTransaction ( Packet106Transaction par1Packet106Transaction ) { registerPacket ( par1Packet106Transaction ) ; } public void handleEntityPainting ( Packet25EntityPainting par1Packet25EntityPainting ) { registerPacket ( par1Packet25EntityPainting ) ; } public void handlePlayNoteBlock ( Packet54PlayNoteBlock par1Packet54PlayNoteBlock ) { registerPacket ( par1Packet54PlayNoteBlock ) ; } public void handleStatistic ( Packet200Statistic par1Packet200Statistic ) { registerPacket ( par1Packet200Statistic ) ; } public void handleSleep ( Packet17Sleep par1Packet17Sleep ) { registerPacket ( par1Packet17Sleep ) ; } public void handleBed ( Packet70Bed par1Packet70Bed ) { registerPacket ( par1Packet70Bed ) ; } public void handleWeather ( Packet71Weather par1Packet71Weather ) { registerPacket ( par1Packet71Weather ) ; } public void handleMapData ( Packet131MapData par1Packet131MapData ) { registerPacket ( par1Packet131MapData ) ; } public void handleDoorChange ( Packet61DoorChange par1Packet61DoorChange ) { registerPacket ( par1Packet61DoorChange ) ; } public void handleServerPing ( Packet254ServerPing par1Packet254ServerPing ) { registerPacket ( par1Packet254ServerPing ) ; } public void handleEntityEffect ( Packet41EntityEffect par1Packet41EntityEffect ) { registerPacket ( par1Packet41EntityEffect ) ; } public void handleRemoveEntityEffect ( Packet42RemoveEntityEffect par1Packet42RemoveEntityEffect ) { registerPacket ( par1Packet42RemoveEntityEffect ) ; } public void handlePlayerInfo ( Packet201PlayerInfo par1Packet201PlayerInfo ) { registerPacket ( par1Packet201PlayerInfo ) ; } public void handleKeepAlive ( Packet0KeepAlive par1Packet0KeepAlive ) { registerPacket ( par1Packet0KeepAlive ) ; } public void handleExperience ( Packet43Experience par1Packet43Experience ) { registerPacket ( par1Packet43Experience ) ; } public void handleCreativeSetSlot ( Packet107CreativeSetSlot par1Packet107CreativeSetSlot ) { registerPacket ( par1Packet107CreativeSetSlot ) ; } public void handleEntityExpOrb ( Packet26EntityExpOrb par1Packet26EntityExpOrb ) { registerPacket ( par1Packet26EntityExpOrb ) ; } public void handleEnchantItem ( Packet108EnchantItem packet108enchantitem ) { } public void handleCustomPayload ( Packet250CustomPayload packet250custompayload ) { } public void handleEntityHeadRotation ( Packet35EntityHeadRotation par1Packet35EntityHeadRotation ) { registerPacket ( par1Packet35EntityHeadRotation ) ; } public void handleTileEntityData ( Packet132TileEntityData par1Packet132TileEntityData ) { registerPacket ( par1Packet132TileEntityData ) ; } public void func_50003_a ( Packet202PlayerAbilities par1Packet202PlayerAbilities ) { registerPacket ( par1Packet202PlayerAbilities ) ; } } </s>
|
<s> package net . minecraft . src ; public class EnchantmentArrowFire extends Enchantment { public EnchantmentArrowFire ( int par1 , int par2 ) { super ( par1 , par2 , EnumEnchantmentType . bow ) ; setName ( "<STR_LIT>" ) ; } public int getMinEnchantability ( int par1 ) { return <NUM_LIT:20> ; } public int getMaxEnchantability ( int par1 ) { return <NUM_LIT> ; } public int getMaxLevel ( ) { return <NUM_LIT:1> ; } } </s>
|
<s> package net . minecraft . src ; import java . util . List ; public interface ICrafting { public abstract void updateCraftingInventory ( Container container , List list ) ; public abstract void updateCraftingInventorySlot ( Container container , int i , ItemStack itemstack ) ; public abstract void updateCraftingInventoryInfo ( Container container , int i , int j ) ; } </s>
|
<s> package net . minecraft . src ; public class ExtendedBlockStorage { private int yBase ; private int blockRefCount ; private int tickRefCount ; private byte blockLSBArray [ ] ; private NibbleArray blockMSBArray ; private NibbleArray blockMetadataArray ; private NibbleArray blocklightArray ; private NibbleArray skylightArray ; public ExtendedBlockStorage ( int par1 ) { yBase = par1 ; blockLSBArray = new byte [ <NUM_LIT> ] ; blockMetadataArray = new NibbleArray ( blockLSBArray . length , <NUM_LIT:4> ) ; skylightArray = new NibbleArray ( blockLSBArray . length , <NUM_LIT:4> ) ; blocklightArray = new NibbleArray ( blockLSBArray . length , <NUM_LIT:4> ) ; } public int getExtBlockID ( int par1 , int par2 , int par3 ) { int i = blockLSBArray [ par2 << <NUM_LIT:8> | par3 << <NUM_LIT:4> | par1 ] & <NUM_LIT> ; if ( blockMSBArray != null ) { return blockMSBArray . get ( par1 , par2 , par3 ) << <NUM_LIT:8> | i ; } else { return i ; } } public void setExtBlockID ( int par1 , int par2 , int par3 , int par4 ) { int i = blockLSBArray [ par2 << <NUM_LIT:8> | par3 << <NUM_LIT:4> | par1 ] & <NUM_LIT> ; if ( blockMSBArray != null ) { i = blockMSBArray . get ( par1 , par2 , par3 ) << <NUM_LIT:8> | i ; } if ( i == <NUM_LIT:0> && par4 != <NUM_LIT:0> ) { blockRefCount ++ ; if ( Block . blocksList [ par4 ] != null && Block . blocksList [ par4 ] . getTickRandomly ( ) ) { tickRefCount ++ ; } } else if ( i != <NUM_LIT:0> && par4 == <NUM_LIT:0> ) { blockRefCount -- ; if ( Block . blocksList [ i ] != null && Block . blocksList [ i ] . getTickRandomly ( ) ) { tickRefCount -- ; } } else if ( Block . blocksList [ i ] != null && Block . blocksList [ i ] . getTickRandomly ( ) && ( Block . blocksList [ par4 ] == null || ! Block . blocksList [ par4 ] . getTickRandomly ( ) ) ) { tickRefCount -- ; } else if ( ( Block . blocksList [ i ] == null || ! Block . blocksList [ i ] . getTickRandomly ( ) ) && Block . blocksList [ par4 ] != null && Block . blocksList [ par4 ] . getTickRandomly ( ) ) { tickRefCount ++ ; } blockLSBArray [ par2 << <NUM_LIT:8> | par3 << <NUM_LIT:4> | par1 ] = ( byte ) ( par4 & <NUM_LIT> ) ; if ( par4 > <NUM_LIT:255> ) { if ( blockMSBArray == null ) { blockMSBArray = new NibbleArray ( blockLSBArray . length , <NUM_LIT:4> ) ; } blockMSBArray . set ( par1 , par2 , par3 , ( par4 & <NUM_LIT> ) > > <NUM_LIT:8> ) ; } else if ( blockMSBArray != null ) { blockMSBArray . set ( par1 , par2 , par3 , <NUM_LIT:0> ) ; } } public int getExtBlockMetadata ( int par1 , int par2 , int par3 ) { return blockMetadataArray . get ( par1 , par2 , par3 ) ; } public void setExtBlockMetadata ( int par1 , int par2 , int par3 , int par4 ) { blockMetadataArray . set ( par1 , par2 , par3 , par4 ) ; } public boolean getIsEmpty ( ) { return blockRefCount == <NUM_LIT:0> ; } public boolean getNeedsRandomTick ( ) { return tickRefCount > <NUM_LIT:0> ; } public int getYLocation ( ) { return yBase ; } public void setExtSkylightValue ( int par1 , int par2 , int par3 , int par4 ) { skylightArray . set ( par1 , par2 , par3 , par4 ) ; } public int getExtSkylightValue ( int par1 , int par2 , int par3 ) { return skylightArray . get ( par1 , par2 , par3 ) ; } public void setExtBlocklightValue ( int par1 , int par2 , int par3 , int par4 ) { blocklightArray . set ( par1 , par2 , par3 , par4 ) ; } public int getExtBlocklightValue ( int par1 , int par2 , int par3 ) { return blocklightArray . get ( par1 , par2 , par3 ) ; } public void func_48599_d ( ) { blockRefCount = <NUM_LIT:0> ; tickRefCount = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < <NUM_LIT:16> ; i ++ ) { for ( int j = <NUM_LIT:0> ; j < <NUM_LIT:16> ; j ++ ) { for ( int k = <NUM_LIT:0> ; k < <NUM_LIT:16> ; k ++ ) { int l = getExtBlockID ( i , j , k ) ; if ( l <= <NUM_LIT:0> ) { continue ; } if ( Block . blocksList [ l ] == null ) { blockLSBArray [ j << <NUM_LIT:8> | k << <NUM_LIT:4> | i ] = <NUM_LIT:0> ; if ( blockMSBArray != null ) { blockMSBArray . set ( i , j , k , <NUM_LIT:0> ) ; } continue ; } blockRefCount ++ ; if ( Block . blocksList [ l ] . getTickRandomly ( ) ) { tickRefCount ++ ; } } } } } public void func_48603_e ( ) { } public int func_48587_f ( ) { return blockRefCount ; } public byte [ ] func_48590_g ( ) { return blockLSBArray ; } public NibbleArray getBlockMSBArray ( ) { return blockMSBArray ; } public NibbleArray func_48594_i ( ) { return blockMetadataArray ; } public NibbleArray getBlocklightArray ( ) { return blocklightArray ; } public NibbleArray getSkylightArray ( ) { return skylightArray ; } public void setBlockLSBArray ( byte par1ArrayOfByte [ ] ) { blockLSBArray = par1ArrayOfByte ; } public void setBlockMSBArray ( NibbleArray par1NibbleArray ) { blockMSBArray = par1NibbleArray ; } public void setBlockMetadataArray ( NibbleArray par1NibbleArray ) { blockMetadataArray = par1NibbleArray ; } public void setBlocklightArray ( NibbleArray par1NibbleArray ) { blocklightArray = par1NibbleArray ; } public void setSkylightArray ( NibbleArray par1NibbleArray ) { skylightArray = par1NibbleArray ; } } </s>
|
<s> package net . minecraft . src ; import java . util . Random ; public class TileEntityDispenser extends TileEntity implements IInventory { private ItemStack dispenserContents [ ] ; private Random dispenserRandom ; public TileEntityDispenser ( ) { dispenserContents = new ItemStack [ <NUM_LIT:9> ] ; dispenserRandom = new Random ( ) ; } public int getSizeInventory ( ) { return <NUM_LIT:9> ; } public ItemStack getStackInSlot ( int par1 ) { return dispenserContents [ par1 ] ; } public ItemStack decrStackSize ( int par1 , int par2 ) { if ( dispenserContents [ par1 ] != null ) { if ( dispenserContents [ par1 ] . stackSize <= par2 ) { ItemStack itemstack = dispenserContents [ par1 ] ; dispenserContents [ par1 ] = null ; onInventoryChanged ( ) ; return itemstack ; } ItemStack itemstack1 = dispenserContents [ par1 ] . splitStack ( par2 ) ; if ( dispenserContents [ par1 ] . stackSize == <NUM_LIT:0> ) { dispenserContents [ par1 ] = null ; } onInventoryChanged ( ) ; return itemstack1 ; } else { return null ; } } public ItemStack getStackInSlotOnClosing ( int par1 ) { if ( dispenserContents [ par1 ] != null ) { ItemStack itemstack = dispenserContents [ par1 ] ; dispenserContents [ par1 ] = null ; return itemstack ; } else { return null ; } } public ItemStack getRandomStackFromInventory ( ) { int i = - <NUM_LIT:1> ; int j = <NUM_LIT:1> ; for ( int k = <NUM_LIT:0> ; k < dispenserContents . length ; k ++ ) { if ( dispenserContents [ k ] != null && dispenserRandom . nextInt ( j ++ ) == <NUM_LIT:0> ) { i = k ; } } if ( i >= <NUM_LIT:0> ) { return decrStackSize ( i , <NUM_LIT:1> ) ; } else { return null ; } } public void setInventorySlotContents ( int par1 , ItemStack par2ItemStack ) { dispenserContents [ par1 ] = par2ItemStack ; if ( par2ItemStack != null && par2ItemStack . stackSize > getInventoryStackLimit ( ) ) { par2ItemStack . stackSize = getInventoryStackLimit ( ) ; } onInventoryChanged ( ) ; } public String getInvName ( ) { return "<STR_LIT>" ; } public void readFromNBT ( NBTTagCompound par1NBTTagCompound ) { super . readFromNBT ( par1NBTTagCompound ) ; NBTTagList nbttaglist = par1NBTTagCompound . getTagList ( "<STR_LIT>" ) ; dispenserContents = new ItemStack [ getSizeInventory ( ) ] ; for ( int i = <NUM_LIT:0> ; i < nbttaglist . tagCount ( ) ; i ++ ) { NBTTagCompound nbttagcompound = ( NBTTagCompound ) nbttaglist . tagAt ( i ) ; int j = nbttagcompound . getByte ( "<STR_LIT>" ) & <NUM_LIT> ; if ( j >= <NUM_LIT:0> && j < dispenserContents . length ) { dispenserContents [ j ] = ItemStack . loadItemStackFromNBT ( nbttagcompound ) ; } } } public void writeToNBT ( NBTTagCompound par1NBTTagCompound ) { super . writeToNBT ( par1NBTTagCompound ) ; NBTTagList nbttaglist = new NBTTagList ( ) ; for ( int i = <NUM_LIT:0> ; i < dispenserContents . length ; i ++ ) { if ( dispenserContents [ i ] != null ) { NBTTagCompound nbttagcompound = new NBTTagCompound ( ) ; nbttagcompound . setByte ( "<STR_LIT>" , ( byte ) i ) ; dispenserContents [ i ] . writeToNBT ( nbttagcompound ) ; nbttaglist . appendTag ( nbttagcompound ) ; } } par1NBTTagCompound . setTag ( "<STR_LIT>" , nbttaglist ) ; } public int getInventoryStackLimit ( ) { return <NUM_LIT> ; } public boolean isUseableByPlayer ( EntityPlayer par1EntityPlayer ) { if ( worldObj . getBlockTileEntity ( xCoord , yCoord , zCoord ) != this ) { return false ; } return par1EntityPlayer . getDistanceSq ( ( double ) xCoord + <NUM_LIT> , ( double ) yCoord + <NUM_LIT> , ( double ) zCoord + <NUM_LIT> ) <= <NUM_LIT> ; } public void openChest ( ) { } public void closeChest ( ) { } } </s>
|
<s> package net . minecraft . src ; import java . util . Random ; public class ItemEgg extends Item { public ItemEgg ( int par1 ) { super ( par1 ) ; maxStackSize = <NUM_LIT:16> ; } public ItemStack onItemRightClick ( ItemStack par1ItemStack , World par2World , EntityPlayer par3EntityPlayer ) { if ( ! par3EntityPlayer . capabilities . isCreativeMode ) { par1ItemStack . stackSize -- ; } par2World . playSoundAtEntity ( par3EntityPlayer , "<STR_LIT>" , <NUM_LIT> , <NUM_LIT> / ( itemRand . nextFloat ( ) * <NUM_LIT> + <NUM_LIT> ) ) ; if ( ! par2World . isRemote ) { par2World . spawnEntityInWorld ( new EntityEgg ( par2World , par3EntityPlayer ) ) ; } return par1ItemStack ; } } </s>
|
<s> package net . minecraft . src ; public enum EnumEnchantmentType { all , armor , armor_feet , armor_legs , armor_torso , armor_head , weapon , digger , bow ; public boolean canEnchantItem ( Item par1Item ) { if ( this == all ) { return true ; } if ( par1Item instanceof ItemArmor ) { if ( this == armor ) { return true ; } ItemArmor itemarmor = ( ItemArmor ) par1Item ; if ( itemarmor . armorType == <NUM_LIT:0> ) { return this == armor_head ; } if ( itemarmor . armorType == <NUM_LIT:2> ) { return this == armor_legs ; } if ( itemarmor . armorType == <NUM_LIT:1> ) { return this == armor_torso ; } if ( itemarmor . armorType == <NUM_LIT:3> ) { return this == armor_feet ; } else { return false ; } } if ( par1Item instanceof ItemSword ) { return this == weapon ; } if ( par1Item instanceof ItemTool ) { return this == digger ; } if ( par1Item instanceof ItemBow ) { return this == bow ; } else { return false ; } } } </s>
|
<s> package net . minecraft . src ; import java . io . * ; public class Packet70Bed extends Packet { public static final String bedChat [ ] = { "<STR_LIT>" , null , null , "<STR_LIT>" } ; public int bedState ; public int gameMode ; public Packet70Bed ( ) { } public Packet70Bed ( int par1 , int par2 ) { bedState = par1 ; gameMode = par2 ; } public void readPacketData ( DataInputStream par1DataInputStream ) throws IOException { bedState = par1DataInputStream . readByte ( ) ; gameMode = par1DataInputStream . readByte ( ) ; } public void writePacketData ( DataOutputStream par1DataOutputStream ) throws IOException { par1DataOutputStream . writeByte ( bedState ) ; par1DataOutputStream . writeByte ( gameMode ) ; } public void processPacket ( NetHandler par1NetHandler ) { par1NetHandler . handleBed ( this ) ; } public int getPacketSize ( ) { return <NUM_LIT:2> ; } } </s>
|
<s> package net . minecraft . src ; import java . io . * ; public class RConOutputStream { private ByteArrayOutputStream byteArrayOutput ; private DataOutputStream output ; public RConOutputStream ( int par1 ) { byteArrayOutput = new ByteArrayOutputStream ( par1 ) ; output = new DataOutputStream ( byteArrayOutput ) ; } public void writeByteArray ( byte par1ArrayOfByte [ ] ) throws IOException { output . write ( par1ArrayOfByte , <NUM_LIT:0> , par1ArrayOfByte . length ) ; } public void writeString ( String par1Str ) throws IOException { output . writeBytes ( par1Str ) ; output . write ( <NUM_LIT:0> ) ; } public void writeInt ( int par1 ) throws IOException { output . write ( par1 ) ; } public void writeShort ( short par1 ) throws IOException { output . writeShort ( Short . reverseBytes ( par1 ) ) ; } public byte [ ] toByteArray ( ) { return byteArrayOutput . toByteArray ( ) ; } public void reset ( ) { byteArrayOutput . reset ( ) ; } } </s>
|
<s> package net . minecraft . src ; public class ItemReed extends Item { private int spawnID ; public ItemReed ( int par1 , Block par2Block ) { super ( par1 ) ; spawnID = par2Block . blockID ; } public boolean onItemUse ( ItemStack par1ItemStack , EntityPlayer par2EntityPlayer , World par3World , int par4 , int par5 , int par6 , int par7 ) { int i = par3World . getBlockId ( par4 , par5 , par6 ) ; if ( i == Block . snow . blockID ) { par7 = <NUM_LIT:1> ; } else if ( i != Block . vine . blockID && i != Block . tallGrass . blockID && i != Block . deadBush . blockID ) { if ( par7 == <NUM_LIT:0> ) { par5 -- ; } if ( par7 == <NUM_LIT:1> ) { par5 ++ ; } if ( par7 == <NUM_LIT:2> ) { par6 -- ; } if ( par7 == <NUM_LIT:3> ) { par6 ++ ; } if ( par7 == <NUM_LIT:4> ) { par4 -- ; } if ( par7 == <NUM_LIT:5> ) { par4 ++ ; } } if ( ! par2EntityPlayer . canPlayerEdit ( par4 , par5 , par6 ) ) { return false ; } if ( par1ItemStack . stackSize == <NUM_LIT:0> ) { return false ; } if ( par3World . canBlockBePlacedAt ( spawnID , par4 , par5 , par6 , false , par7 ) ) { Block block = Block . blocksList [ spawnID ] ; if ( par3World . setBlockWithNotify ( par4 , par5 , par6 , spawnID ) ) { if ( par3World . getBlockId ( par4 , par5 , par6 ) == spawnID ) { Block . blocksList [ spawnID ] . onBlockPlaced ( par3World , par4 , par5 , par6 , par7 ) ; Block . blocksList [ spawnID ] . onBlockPlacedBy ( par3World , par4 , par5 , par6 , par2EntityPlayer ) ; } par3World . playSoundEffect ( ( float ) par4 + <NUM_LIT> , ( float ) par5 + <NUM_LIT> , ( float ) par6 + <NUM_LIT> , block . stepSound . getStepSound ( ) , ( block . stepSound . getVolume ( ) + <NUM_LIT> ) / <NUM_LIT> , block . stepSound . getPitch ( ) * <NUM_LIT> ) ; par1ItemStack . stackSize -- ; } } return true ; } } </s>
|
<s> package net . minecraft . src ; import java . util . * ; public class EntityDragon extends EntityDragonBase { public double targetX ; public double targetY ; public double targetZ ; public double field_40144_d [ ] [ ] ; public int field_40145_e ; public EntityDragonPart dragonPartArray [ ] ; public EntityDragonPart dragonPartHead ; public EntityDragonPart dragonPartBody ; public EntityDragonPart dragonPartTail1 ; public EntityDragonPart dragonPartTail2 ; public EntityDragonPart dragonPartTail3 ; public EntityDragonPart dragonPartWing1 ; public EntityDragonPart dragonPartWing2 ; public float field_40149_n ; public float field_40150_o ; public boolean field_40160_p ; public boolean field_40159_q ; private Entity target ; public int field_40158_r ; public EntityEnderCrystal healingEnderCrystal ; public EntityDragon ( World par1World ) { super ( par1World ) ; field_40144_d = new double [ <NUM_LIT> ] [ <NUM_LIT:3> ] ; field_40145_e = - <NUM_LIT:1> ; field_40149_n = <NUM_LIT> ; field_40150_o = <NUM_LIT> ; field_40160_p = false ; field_40159_q = false ; field_40158_r = <NUM_LIT:0> ; healingEnderCrystal = null ; dragonPartArray = ( new EntityDragonPart [ ] { dragonPartHead = new EntityDragonPart ( this , "<STR_LIT>" , <NUM_LIT> , <NUM_LIT> ) , dragonPartBody = new EntityDragonPart ( this , "<STR_LIT:body>" , <NUM_LIT> , <NUM_LIT> ) , dragonPartTail1 = new EntityDragonPart ( this , "<STR_LIT>" , <NUM_LIT> , <NUM_LIT> ) , dragonPartTail2 = new EntityDragonPart ( this , "<STR_LIT>" , <NUM_LIT> , <NUM_LIT> ) , dragonPartTail3 = new EntityDragonPart ( this , "<STR_LIT>" , <NUM_LIT> , <NUM_LIT> ) , dragonPartWing1 = new EntityDragonPart ( this , "<STR_LIT>" , <NUM_LIT> , <NUM_LIT> ) , dragonPartWing2 = new EntityDragonPart ( this , "<STR_LIT>" , <NUM_LIT> , <NUM_LIT> ) } ) ; maxHealth = <NUM_LIT> ; setEntityHealth ( maxHealth ) ; texture = "<STR_LIT>" ; setSize ( <NUM_LIT> , <NUM_LIT> ) ; noClip = true ; isImmuneToFire = true ; targetY = <NUM_LIT> ; ignoreFrustumCheck = true ; } protected void entityInit ( ) { super . entityInit ( ) ; dataWatcher . addObject ( <NUM_LIT:16> , new Integer ( maxHealth ) ) ; } public double [ ] func_40139_a ( int par1 , float par2 ) { if ( health <= <NUM_LIT:0> ) { par2 = <NUM_LIT> ; } par2 = <NUM_LIT> - par2 ; int i = field_40145_e - par1 * <NUM_LIT:1> & <NUM_LIT> ; int j = field_40145_e - par1 * <NUM_LIT:1> - <NUM_LIT:1> & <NUM_LIT> ; double ad [ ] = new double [ <NUM_LIT:3> ] ; double d = field_40144_d [ i ] [ <NUM_LIT:0> ] ; double d1 ; for ( d1 = field_40144_d [ j ] [ <NUM_LIT:0> ] - d ; d1 < - <NUM_LIT> ; d1 += <NUM_LIT> ) { } for ( ; d1 >= <NUM_LIT> ; d1 -= <NUM_LIT> ) { } ad [ <NUM_LIT:0> ] = d + d1 * ( double ) par2 ; d = field_40144_d [ i ] [ <NUM_LIT:1> ] ; d1 = field_40144_d [ j ] [ <NUM_LIT:1> ] - d ; ad [ <NUM_LIT:1> ] = d + d1 * ( double ) par2 ; ad [ <NUM_LIT:2> ] = field_40144_d [ i ] [ <NUM_LIT:2> ] + ( field_40144_d [ j ] [ <NUM_LIT:2> ] - field_40144_d [ i ] [ <NUM_LIT:2> ] ) * ( double ) par2 ; return ad ; } public void onLivingUpdate ( ) { field_40149_n = field_40150_o ; if ( ! worldObj . isRemote ) { dataWatcher . updateObject ( <NUM_LIT:16> , Integer . valueOf ( health ) ) ; } if ( health <= <NUM_LIT:0> ) { float f = ( rand . nextFloat ( ) - <NUM_LIT> ) * <NUM_LIT> ; float f2 = ( rand . nextFloat ( ) - <NUM_LIT> ) * <NUM_LIT> ; float f4 = ( rand . nextFloat ( ) - <NUM_LIT> ) * <NUM_LIT> ; worldObj . spawnParticle ( "<STR_LIT>" , posX + ( double ) f , posY + <NUM_LIT> + ( double ) f2 , posZ + ( double ) f4 , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ; return ; } updateDragonEnderCrystal ( ) ; float f1 = <NUM_LIT> / ( MathHelper . sqrt_double ( motionX * motionX + motionZ * motionZ ) * <NUM_LIT> + <NUM_LIT> ) ; f1 *= ( float ) Math . pow ( <NUM_LIT> , motionY ) ; if ( field_40159_q ) { field_40150_o += f1 * <NUM_LIT> ; } else { field_40150_o += f1 ; } for ( ; rotationYaw >= <NUM_LIT> ; rotationYaw -= <NUM_LIT> ) { } for ( ; rotationYaw < - <NUM_LIT> ; rotationYaw += <NUM_LIT> ) { } if ( field_40145_e < <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < field_40144_d . length ; i ++ ) { field_40144_d [ i ] [ <NUM_LIT:0> ] = rotationYaw ; field_40144_d [ i ] [ <NUM_LIT:1> ] = posY ; } } if ( ++ field_40145_e == field_40144_d . length ) { field_40145_e = <NUM_LIT:0> ; } field_40144_d [ field_40145_e ] [ <NUM_LIT:0> ] = rotationYaw ; field_40144_d [ field_40145_e ] [ <NUM_LIT:1> ] = posY ; if ( worldObj . isRemote ) { if ( newPosRotationIncrements > <NUM_LIT:0> ) { double d = posX + ( newPosX - posX ) / ( double ) newPosRotationIncrements ; double d2 = posY + ( newPosY - posY ) / ( double ) newPosRotationIncrements ; double d4 = posZ + ( newPosZ - posZ ) / ( double ) newPosRotationIncrements ; double d6 ; for ( d6 = newRotationYaw - ( double ) rotationYaw ; d6 < - <NUM_LIT> ; d6 += <NUM_LIT> ) { } for ( ; d6 >= <NUM_LIT> ; d6 -= <NUM_LIT> ) { } rotationYaw += d6 / ( double ) newPosRotationIncrements ; rotationPitch += ( newRotationPitch - ( double ) rotationPitch ) / ( double ) newPosRotationIncrements ; newPosRotationIncrements -- ; setPosition ( d , d2 , d4 ) ; setRotation ( rotationYaw , rotationPitch ) ; } } else { double d1 = targetX - posX ; double d3 = targetY - posY ; double d5 = targetZ - posZ ; double d7 = d1 * d1 + d3 * d3 + d5 * d5 ; if ( target != null ) { targetX = target . posX ; targetZ = target . posZ ; double d8 = targetX - posX ; double d10 = targetZ - posZ ; double d12 = Math . sqrt ( d8 * d8 + d10 * d10 ) ; double d13 = ( <NUM_LIT> + d12 / <NUM_LIT> ) - <NUM_LIT> ; if ( d13 > <NUM_LIT> ) { d13 = <NUM_LIT> ; } targetY = target . boundingBox . minY + d13 ; } else { targetX += rand . nextGaussian ( ) * <NUM_LIT> ; targetZ += rand . nextGaussian ( ) * <NUM_LIT> ; } if ( field_40160_p || d7 < <NUM_LIT> || d7 > <NUM_LIT> || isCollidedHorizontally || isCollidedVertically ) { func_41037_w ( ) ; } d3 /= MathHelper . sqrt_double ( d1 * d1 + d5 * d5 ) ; float f10 = <NUM_LIT> ; if ( d3 < ( double ) ( - f10 ) ) { d3 = - f10 ; } if ( d3 > ( double ) f10 ) { d3 = f10 ; } motionY += d3 * <NUM_LIT> ; for ( ; rotationYaw < - <NUM_LIT> ; rotationYaw += <NUM_LIT> ) { } for ( ; rotationYaw >= <NUM_LIT> ; rotationYaw -= <NUM_LIT> ) { } double d9 = <NUM_LIT> - ( Math . atan2 ( d1 , d5 ) * <NUM_LIT> ) / Math . PI ; double d11 ; for ( d11 = d9 - ( double ) rotationYaw ; d11 < - <NUM_LIT> ; d11 += <NUM_LIT> ) { } for ( ; d11 >= <NUM_LIT> ; d11 -= <NUM_LIT> ) { } if ( d11 > <NUM_LIT> ) { d11 = <NUM_LIT> ; } if ( d11 < - <NUM_LIT> ) { d11 = - <NUM_LIT> ; } Vec3D vec3d = Vec3D . createVector ( targetX - posX , targetY - posY , targetZ - posZ ) . normalize ( ) ; Vec3D vec3d1 = Vec3D . createVector ( MathHelper . sin ( ( rotationYaw * ( float ) Math . PI ) / <NUM_LIT> ) , motionY , - MathHelper . cos ( ( rotationYaw * ( float ) Math . PI ) / <NUM_LIT> ) ) . normalize ( ) ; float f18 = ( float ) ( vec3d1 . dotProduct ( vec3d ) + <NUM_LIT> ) / <NUM_LIT> ; if ( f18 < <NUM_LIT> ) { f18 = <NUM_LIT> ; } randomYawVelocity *= <NUM_LIT> ; float f19 = MathHelper . sqrt_double ( motionX * motionX + motionZ * motionZ ) * <NUM_LIT> + <NUM_LIT> ; double d14 = Math . sqrt ( motionX * motionX + motionZ * motionZ ) * <NUM_LIT> + <NUM_LIT> ; if ( d14 > <NUM_LIT> ) { d14 = <NUM_LIT> ; } randomYawVelocity += d11 * ( <NUM_LIT> / d14 / ( double ) f19 ) ; rotationYaw += randomYawVelocity * <NUM_LIT> ; float f20 = ( float ) ( <NUM_LIT> / ( d14 + <NUM_LIT> ) ) ; float f21 = <NUM_LIT> ; moveFlying ( <NUM_LIT> , - <NUM_LIT> , f21 * ( f18 * f20 + ( <NUM_LIT> - f20 ) ) ) ; if ( field_40159_q ) { moveEntity ( motionX * <NUM_LIT> , motionY * <NUM_LIT> , motionZ * <NUM_LIT> ) ; } else { moveEntity ( motionX , motionY , motionZ ) ; } Vec3D vec3d2 = Vec3D . createVector ( motionX , motionY , motionZ ) . normalize ( ) ; float f22 = ( float ) ( vec3d2 . dotProduct ( vec3d1 ) + <NUM_LIT> ) / <NUM_LIT> ; f22 = <NUM_LIT> + <NUM_LIT> * f22 ; motionX *= f22 ; motionZ *= f22 ; motionY *= <NUM_LIT> ; } renderYawOffset = rotationYaw ; dragonPartHead . width = dragonPartHead . height = <NUM_LIT> ; dragonPartTail1 . width = dragonPartTail1 . height = <NUM_LIT> ; dragonPartTail2 . width = dragonPartTail2 . height = <NUM_LIT> ; dragonPartTail3 . width = dragonPartTail3 . height = <NUM_LIT> ; dragonPartBody . height = <NUM_LIT> ; dragonPartBody . width = <NUM_LIT> ; dragonPartWing1 . height = <NUM_LIT> ; dragonPartWing1 . width = <NUM_LIT> ; dragonPartWing2 . height = <NUM_LIT> ; dragonPartWing2 . width = <NUM_LIT> ; float f3 = ( ( ( float ) ( func_40139_a ( <NUM_LIT:5> , <NUM_LIT> ) [ <NUM_LIT:1> ] - func_40139_a ( <NUM_LIT:10> , <NUM_LIT> ) [ <NUM_LIT:1> ] ) * <NUM_LIT> ) / <NUM_LIT> ) * ( float ) Math . PI ; float f5 = MathHelper . cos ( f3 ) ; float f6 = - MathHelper . sin ( f3 ) ; float f7 = ( rotationYaw * ( float ) Math . PI ) / <NUM_LIT> ; float f8 = MathHelper . sin ( f7 ) ; float f9 = MathHelper . cos ( f7 ) ; dragonPartBody . onUpdate ( ) ; dragonPartBody . setLocationAndAngles ( posX + ( double ) ( f8 * <NUM_LIT> ) , posY , posZ - ( double ) ( f9 * <NUM_LIT> ) , <NUM_LIT> , <NUM_LIT> ) ; dragonPartWing1 . onUpdate ( ) ; dragonPartWing1 . setLocationAndAngles ( posX + ( double ) ( f9 * <NUM_LIT> ) , posY + <NUM_LIT> , posZ + ( double ) ( f8 * <NUM_LIT> ) , <NUM_LIT> , <NUM_LIT> ) ; dragonPartWing2 . onUpdate ( ) ; dragonPartWing2 . setLocationAndAngles ( posX - ( double ) ( f9 * <NUM_LIT> ) , posY + <NUM_LIT> , posZ - ( double ) ( f8 * <NUM_LIT> ) , <NUM_LIT> , <NUM_LIT> ) ; if ( ! worldObj . isRemote ) { func_41033_v ( ) ; } if ( ! worldObj . isRemote && maxHurtTime == <NUM_LIT:0> ) { collideWithEntities ( worldObj . getEntitiesWithinAABBExcludingEntity ( this , dragonPartWing1 . boundingBox . expand ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) . offset ( <NUM_LIT> , - <NUM_LIT> , <NUM_LIT> ) ) ) ; collideWithEntities ( worldObj . getEntitiesWithinAABBExcludingEntity ( this , dragonPartWing2 . boundingBox . expand ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) . offset ( <NUM_LIT> , - <NUM_LIT> , <NUM_LIT> ) ) ) ; attackEntitiesInList ( worldObj . getEntitiesWithinAABBExcludingEntity ( this , dragonPartHead . boundingBox . expand ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) ) ; } double ad [ ] = func_40139_a ( <NUM_LIT:5> , <NUM_LIT> ) ; double ad1 [ ] = func_40139_a ( <NUM_LIT:0> , <NUM_LIT> ) ; float f11 = MathHelper . sin ( ( rotationYaw * ( float ) Math . PI ) / <NUM_LIT> - randomYawVelocity * <NUM_LIT> ) ; float f12 = MathHelper . cos ( ( rotationYaw * ( float ) Math . PI ) / <NUM_LIT> - randomYawVelocity * <NUM_LIT> ) ; dragonPartHead . onUpdate ( ) ; dragonPartHead . setLocationAndAngles ( posX + ( double ) ( f11 * <NUM_LIT> * f5 ) , posY + ( ad1 [ <NUM_LIT:1> ] - ad [ <NUM_LIT:1> ] ) * <NUM_LIT> + ( double ) ( f6 * <NUM_LIT> ) , posZ - ( double ) ( f12 * <NUM_LIT> * f5 ) , <NUM_LIT> , <NUM_LIT> ) ; for ( int j = <NUM_LIT:0> ; j < <NUM_LIT:3> ; j ++ ) { EntityDragonPart entitydragonpart = null ; if ( j == <NUM_LIT:0> ) { entitydragonpart = dragonPartTail1 ; } if ( j == <NUM_LIT:1> ) { entitydragonpart = dragonPartTail2 ; } if ( j == <NUM_LIT:2> ) { entitydragonpart = dragonPartTail3 ; } double ad2 [ ] = func_40139_a ( <NUM_LIT:12> + j * <NUM_LIT:2> , <NUM_LIT> ) ; float f13 = ( rotationYaw * ( float ) Math . PI ) / <NUM_LIT> + ( ( simplifyAngle ( ad2 [ <NUM_LIT:0> ] - ad [ <NUM_LIT:0> ] ) * ( float ) Math . PI ) / <NUM_LIT> ) * <NUM_LIT> ; float f14 = MathHelper . sin ( f13 ) ; float f15 = MathHelper . cos ( f13 ) ; float f16 = <NUM_LIT> ; float f17 = ( float ) ( j + <NUM_LIT:1> ) * <NUM_LIT> ; entitydragonpart . onUpdate ( ) ; entitydragonpart . setLocationAndAngles ( posX - ( double ) ( ( f8 * f16 + f14 * f17 ) * f5 ) , ( ( posY + ( ad2 [ <NUM_LIT:1> ] - ad [ <NUM_LIT:1> ] ) * <NUM_LIT> ) - ( double ) ( ( f17 + f16 ) * f6 ) ) + <NUM_LIT> , posZ + ( double ) ( ( f9 * f16 + f15 * f17 ) * f5 ) , <NUM_LIT> , <NUM_LIT> ) ; } if ( ! worldObj . isRemote ) { field_40159_q = destroyBlocksInAABB ( dragonPartHead . boundingBox ) | destroyBlocksInAABB ( dragonPartBody . boundingBox ) ; } } private void updateDragonEnderCrystal ( ) { if ( healingEnderCrystal != null ) { if ( healingEnderCrystal . isDead ) { if ( ! worldObj . isRemote ) { attackEntityFromPart ( dragonPartHead , DamageSource . explosion , <NUM_LIT:10> ) ; } healingEnderCrystal = null ; } else if ( ticksExisted % <NUM_LIT:10> == <NUM_LIT:0> && health < maxHealth ) { health ++ ; } } if ( rand . nextInt ( <NUM_LIT:10> ) == <NUM_LIT:0> ) { float f = <NUM_LIT> ; List list = worldObj . getEntitiesWithinAABB ( net . minecraft . src . EntityEnderCrystal . class , boundingBox . expand ( f , f , f ) ) ; EntityEnderCrystal entityendercrystal = null ; double d = Double . MAX_VALUE ; Iterator iterator = list . iterator ( ) ; do { if ( ! iterator . hasNext ( ) ) { break ; } Entity entity = ( Entity ) iterator . next ( ) ; double d1 = entity . getDistanceSqToEntity ( this ) ; if ( d1 < d ) { d = d1 ; entityendercrystal = ( EntityEnderCrystal ) entity ; } } while ( true ) ; healingEnderCrystal = entityendercrystal ; } } private void func_41033_v ( ) { } private void collideWithEntities ( List par1List ) { double d = ( dragonPartBody . boundingBox . minX + dragonPartBody . boundingBox . maxX ) / <NUM_LIT> ; double d1 = ( dragonPartBody . boundingBox . minZ + dragonPartBody . boundingBox . maxZ ) / <NUM_LIT> ; Iterator iterator = par1List . iterator ( ) ; do { if ( ! iterator . hasNext ( ) ) { break ; } Entity entity = ( Entity ) iterator . next ( ) ; if ( entity instanceof EntityLiving ) { double d2 = entity . posX - d ; double d3 = entity . posZ - d1 ; double d4 = d2 * d2 + d3 * d3 ; entity . addVelocity ( ( d2 / d4 ) * <NUM_LIT> , <NUM_LIT> , ( d3 / d4 ) * <NUM_LIT> ) ; } } while ( true ) ; } private void attackEntitiesInList ( List par1List ) { for ( int i = <NUM_LIT:0> ; i < par1List . size ( ) ; i ++ ) { Entity entity = ( Entity ) par1List . get ( i ) ; if ( entity instanceof EntityLiving ) { entity . attackEntityFrom ( DamageSource . causeMobDamage ( this ) , <NUM_LIT:10> ) ; } } } private void func_41037_w ( ) { field_40160_p = false ; if ( rand . nextInt ( <NUM_LIT:2> ) == <NUM_LIT:0> && worldObj . playerEntities . size ( ) > <NUM_LIT:0> ) { target = ( Entity ) worldObj . playerEntities . get ( rand . nextInt ( worldObj . playerEntities . size ( ) ) ) ; } else { boolean flag = false ; do { targetX = <NUM_LIT> ; targetY = <NUM_LIT> + rand . nextFloat ( ) * <NUM_LIT> ; targetZ = <NUM_LIT> ; targetX += rand . nextFloat ( ) * <NUM_LIT> - <NUM_LIT> ; targetZ += rand . nextFloat ( ) * <NUM_LIT> - <NUM_LIT> ; double d = posX - targetX ; double d1 = posY - targetY ; double d2 = posZ - targetZ ; flag = d * d + d1 * d1 + d2 * d2 > <NUM_LIT> ; } while ( ! flag ) ; target = null ; } } private float simplifyAngle ( double par1 ) { for ( ; par1 >= <NUM_LIT> ; par1 -= <NUM_LIT> ) { } for ( ; par1 < - <NUM_LIT> ; par1 += <NUM_LIT> ) { } return ( float ) par1 ; } private boolean destroyBlocksInAABB ( AxisAlignedBB par1AxisAlignedBB ) { int i = MathHelper . floor_double ( par1AxisAlignedBB . minX ) ; int j = MathHelper . floor_double ( par1AxisAlignedBB . minY ) ; int k = MathHelper . floor_double ( par1AxisAlignedBB . minZ ) ; int l = MathHelper . floor_double ( par1AxisAlignedBB . maxX ) ; int i1 = MathHelper . floor_double ( par1AxisAlignedBB . maxY ) ; int j1 = MathHelper . floor_double ( par1AxisAlignedBB . maxZ ) ; boolean flag = false ; boolean flag1 = false ; for ( int k1 = i ; k1 <= l ; k1 ++ ) { for ( int l1 = j ; l1 <= i1 ; l1 ++ ) { for ( int i2 = k ; i2 <= j1 ; i2 ++ ) { int j2 = worldObj . getBlockId ( k1 , l1 , i2 ) ; if ( j2 == <NUM_LIT:0> ) { continue ; } if ( j2 == Block . obsidian . blockID || j2 == Block . whiteStone . blockID || j2 == Block . bedrock . blockID ) { flag = true ; } else { flag1 = true ; worldObj . setBlockWithNotify ( k1 , l1 , i2 , <NUM_LIT:0> ) ; } } } } if ( flag1 ) { double d = par1AxisAlignedBB . minX + ( par1AxisAlignedBB . maxX - par1AxisAlignedBB . minX ) * ( double ) rand . nextFloat ( ) ; double d1 = par1AxisAlignedBB . minY + ( par1AxisAlignedBB . maxY - par1AxisAlignedBB . minY ) * ( double ) rand . nextFloat ( ) ; double d2 = par1AxisAlignedBB . minZ + ( par1AxisAlignedBB . maxZ - par1AxisAlignedBB . minZ ) * ( double ) rand . nextFloat ( ) ; worldObj . spawnParticle ( "<STR_LIT>" , d , d1 , d2 , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ; } return flag ; } public boolean attackEntityFromPart ( EntityDragonPart par1EntityDragonPart , DamageSource par2DamageSource , int par3 ) { if ( par1EntityDragonPart != dragonPartHead ) { par3 = par3 / <NUM_LIT:4> + <NUM_LIT:1> ; } float f = ( rotationYaw * ( float ) Math . PI ) / <NUM_LIT> ; float f1 = MathHelper . sin ( f ) ; float f2 = MathHelper . cos ( f ) ; targetX = posX + ( double ) ( f1 * <NUM_LIT> ) + ( double ) ( ( rand . nextFloat ( ) - <NUM_LIT> ) * <NUM_LIT> ) ; targetY = posY + ( double ) ( rand . nextFloat ( ) * <NUM_LIT> ) + <NUM_LIT> ; targetZ = ( posZ - ( double ) ( f2 * <NUM_LIT> ) ) + ( double ) ( ( rand . nextFloat ( ) - <NUM_LIT> ) * <NUM_LIT> ) ; target = null ; if ( ( par2DamageSource . getEntity ( ) instanceof EntityPlayer ) || par2DamageSource == DamageSource . explosion ) { superAttackFrom ( par2DamageSource , par3 ) ; } return true ; } protected void onDeathUpdate ( ) { field_40158_r ++ ; if ( field_40158_r >= <NUM_LIT> && field_40158_r <= <NUM_LIT> ) { float f = ( rand . nextFloat ( ) - <NUM_LIT> ) * <NUM_LIT> ; float f1 = ( rand . nextFloat ( ) - <NUM_LIT> ) * <NUM_LIT> ; float f2 = ( rand . nextFloat ( ) - <NUM_LIT> ) * <NUM_LIT> ; worldObj . spawnParticle ( "<STR_LIT>" , posX + ( double ) f , posY + <NUM_LIT> + ( double ) f1 , posZ + ( double ) f2 , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ; } if ( ! worldObj . isRemote && field_40158_r > <NUM_LIT> && field_40158_r % <NUM_LIT:5> == <NUM_LIT:0> ) { for ( int i = <NUM_LIT:1000> ; i > <NUM_LIT:0> ; ) { int k = EntityXPOrb . getXPSplit ( i ) ; i -= k ; worldObj . spawnEntityInWorld ( new EntityXPOrb ( worldObj , posX , posY , posZ , k ) ) ; } } moveEntity ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ; renderYawOffset = rotationYaw += <NUM_LIT> ; if ( field_40158_r == <NUM_LIT> ) { for ( int j = <NUM_LIT> ; j > <NUM_LIT:0> ; ) { int l = EntityXPOrb . getXPSplit ( j ) ; j -= l ; worldObj . spawnEntityInWorld ( new EntityXPOrb ( worldObj , posX , posY , posZ , l ) ) ; } createEnderPortal ( MathHelper . floor_double ( posX ) , MathHelper . floor_double ( posZ ) ) ; onEntityDeath ( ) ; setDead ( ) ; } } private void createEnderPortal ( int par1 , int par2 ) { byte byte0 = <NUM_LIT> ; BlockEndPortal . bossDefeated = true ; int i = <NUM_LIT:4> ; for ( int j = byte0 - <NUM_LIT:1> ; j <= byte0 + <NUM_LIT:32> ; j ++ ) { for ( int k = par1 - i ; k <= par1 + i ; k ++ ) { for ( int l = par2 - i ; l <= par2 + i ; l ++ ) { double d = k - par1 ; double d1 = l - par2 ; double d2 = MathHelper . sqrt_double ( d * d + d1 * d1 ) ; if ( d2 > ( double ) i - <NUM_LIT> ) { continue ; } if ( j < byte0 ) { if ( d2 <= ( double ) ( i - <NUM_LIT:1> ) - <NUM_LIT> ) { worldObj . setBlockWithNotify ( k , j , l , Block . bedrock . blockID ) ; } continue ; } if ( j > byte0 ) { worldObj . setBlockWithNotify ( k , j , l , <NUM_LIT:0> ) ; continue ; } if ( d2 > ( double ) ( i - <NUM_LIT:1> ) - <NUM_LIT> ) { worldObj . setBlockWithNotify ( k , j , l , Block . bedrock . blockID ) ; } else { worldObj . setBlockWithNotify ( k , j , l , Block . endPortal . blockID ) ; } } } } worldObj . setBlockWithNotify ( par1 , byte0 + <NUM_LIT:0> , par2 , Block . bedrock . blockID ) ; worldObj . setBlockWithNotify ( par1 , byte0 + <NUM_LIT:1> , par2 , Block . bedrock . blockID ) ; worldObj . setBlockWithNotify ( par1 , byte0 + <NUM_LIT:2> , par2 , Block . bedrock . blockID ) ; worldObj . setBlockWithNotify ( par1 - <NUM_LIT:1> , byte0 + <NUM_LIT:2> , par2 , Block . torchWood . blockID ) ; worldObj . setBlockWithNotify ( par1 + <NUM_LIT:1> , byte0 + <NUM_LIT:2> , par2 , Block . torchWood . blockID ) ; worldObj . setBlockWithNotify ( par1 , byte0 + <NUM_LIT:2> , par2 - <NUM_LIT:1> , Block . torchWood . blockID ) ; worldObj . setBlockWithNotify ( par1 , byte0 + <NUM_LIT:2> , par2 + <NUM_LIT:1> , Block . torchWood . blockID ) ; worldObj . setBlockWithNotify ( par1 , byte0 + <NUM_LIT:3> , par2 , Block . bedrock . blockID ) ; worldObj . setBlockWithNotify ( par1 , byte0 + <NUM_LIT:4> , par2 , Block . dragonEgg . blockID ) ; BlockEndPortal . bossDefeated = false ; } protected void despawnEntity ( ) { } public Entity [ ] getParts ( ) { return dragonPartArray ; } public boolean canBeCollidedWith ( ) { return false ; } } </s>
|
<s> package net . minecraft . src ; final class EnchantmentModifierDamage implements IEnchantmentModifier { public int damageModifier ; public DamageSource damageSource ; private EnchantmentModifierDamage ( ) { } public void calculateModifier ( Enchantment par1Enchantment , int par2 ) { damageModifier += par1Enchantment . calcModifierDamage ( par2 , damageSource ) ; } EnchantmentModifierDamage ( Empty3 par1Empty3 ) { this ( ) ; } } </s>
|
<s> package net . minecraft . src ; public class MapColor { public static final MapColor mapColorArray [ ] = new MapColor [ <NUM_LIT:16> ] ; public static final MapColor airColor = new MapColor ( <NUM_LIT:0> , <NUM_LIT:0> ) ; public static final MapColor grassColor = new MapColor ( <NUM_LIT:1> , <NUM_LIT> ) ; public static final MapColor sandColor = new MapColor ( <NUM_LIT:2> , <NUM_LIT> ) ; public static final MapColor clothColor = new MapColor ( <NUM_LIT:3> , <NUM_LIT> ) ; public static final MapColor tntColor = new MapColor ( <NUM_LIT:4> , <NUM_LIT> ) ; public static final MapColor iceColor = new MapColor ( <NUM_LIT:5> , <NUM_LIT> ) ; public static final MapColor ironColor = new MapColor ( <NUM_LIT:6> , <NUM_LIT> ) ; public static final MapColor foliageColor = new MapColor ( <NUM_LIT:7> , <NUM_LIT> ) ; public static final MapColor snowColor = new MapColor ( <NUM_LIT:8> , <NUM_LIT> ) ; public static final MapColor clayColor = new MapColor ( <NUM_LIT:9> , <NUM_LIT> ) ; public static final MapColor dirtColor = new MapColor ( <NUM_LIT:10> , <NUM_LIT> ) ; public static final MapColor stoneColor = new MapColor ( <NUM_LIT:11> , <NUM_LIT> ) ; public static final MapColor waterColor = new MapColor ( <NUM_LIT:12> , <NUM_LIT> ) ; public static final MapColor woodColor = new MapColor ( <NUM_LIT> , <NUM_LIT> ) ; public final int colorValue ; public final int colorIndex ; private MapColor ( int par1 , int par2 ) { colorIndex = par1 ; colorValue = par2 ; mapColorArray [ par1 ] = this ; } } </s>
|
<s> package net . minecraft . src ; public class WorldProviderHell extends WorldProvider { public WorldProviderHell ( ) { } public void registerWorldChunkManager ( ) { worldChunkMgr = new WorldChunkManagerHell ( BiomeGenBase . hell , <NUM_LIT> , <NUM_LIT> ) ; isHellWorld = true ; hasNoSky = true ; worldType = - <NUM_LIT:1> ; } protected void generateLightBrightnessTable ( ) { float f = <NUM_LIT> ; for ( int i = <NUM_LIT:0> ; i <= <NUM_LIT:15> ; i ++ ) { float f1 = <NUM_LIT> - ( float ) i / <NUM_LIT> ; lightBrightnessTable [ i ] = ( ( <NUM_LIT> - f1 ) / ( f1 * <NUM_LIT> + <NUM_LIT> ) ) * ( <NUM_LIT> - f ) + f ; } } public IChunkProvider getChunkProvider ( ) { return new ChunkProviderHell ( worldObj , worldObj . getSeed ( ) ) ; } public boolean func_48567_d ( ) { return false ; } public boolean canCoordinateBeSpawn ( int par1 , int par2 ) { return false ; } public float calculateCelestialAngle ( long par1 , float par3 ) { return <NUM_LIT> ; } public boolean canRespawnHere ( ) { return false ; } } </s>
|
<s> package net . minecraft . src ; public class ItemSapling extends ItemBlock { public ItemSapling ( int par1 ) { super ( par1 ) ; setMaxDamage ( <NUM_LIT:0> ) ; setHasSubtypes ( true ) ; } public int getMetadata ( int par1 ) { return par1 ; } } </s>
|
<s> package net . minecraft . src ; public class EntityDamageSourceIndirect extends EntityDamageSource { private Entity indirectEntity ; public EntityDamageSourceIndirect ( String par1Str , Entity par2Entity , Entity par3Entity ) { super ( par1Str , par2Entity ) ; indirectEntity = par3Entity ; } public Entity getSourceOfDamage ( ) { return damageSourceEntity ; } public Entity getEntity ( ) { return indirectEntity ; } public String getDeathMessage ( EntityPlayer par1EntityPlayer ) { return StatCollector . translateToLocalFormatted ( ( new StringBuilder ( ) ) . append ( "<STR_LIT>" ) . append ( damageType ) . toString ( ) , new Object [ ] { par1EntityPlayer . username , indirectEntity . getUsername ( ) } ) ; } } </s>
|
<s> package net . minecraft . src ; import java . util . logging . * ; public class ConsoleLogManager { public static Logger logger = Logger . getLogger ( "<STR_LIT>" ) ; public ConsoleLogManager ( ) { } public static void init ( ) { ConsoleLogFormatter consolelogformatter = new ConsoleLogFormatter ( ) ; logger . setUseParentHandlers ( false ) ; ConsoleHandler consolehandler = new ConsoleHandler ( ) ; consolehandler . setFormatter ( consolelogformatter ) ; logger . addHandler ( consolehandler ) ; try { FileHandler filehandler = new FileHandler ( "<STR_LIT>" , true ) ; filehandler . setFormatter ( consolelogformatter ) ; logger . addHandler ( filehandler ) ; } catch ( Exception exception ) { logger . log ( Level . WARNING , "<STR_LIT>" , exception ) ; } } } </s>
|
<s> package net . minecraft . src ; import java . io . * ; import java . util . * ; public class AnvilChunkLoader implements IChunkLoader , IThreadedFileIO { private List field_48469_a ; private Set field_48467_b ; private Object field_48468_c ; private final File chunkSaveLocation ; public AnvilChunkLoader ( File par1File ) { field_48469_a = new ArrayList ( ) ; field_48467_b = new HashSet ( ) ; field_48468_c = new Object ( ) ; chunkSaveLocation = par1File ; } public Chunk loadChunk ( World par1World , int par2 , int par3 ) throws IOException { NBTTagCompound nbttagcompound = null ; ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair ( par2 , par3 ) ; synchronized ( field_48468_c ) { if ( field_48467_b . contains ( chunkcoordintpair ) ) { int i = <NUM_LIT:0> ; do { if ( i >= field_48469_a . size ( ) ) { break ; } if ( ( ( AnvilChunkLoaderPending ) field_48469_a . get ( i ) ) . field_48581_a . equals ( chunkcoordintpair ) ) { nbttagcompound = ( ( AnvilChunkLoaderPending ) field_48469_a . get ( i ) ) . field_48580_b ; break ; } i ++ ; } while ( true ) ; } } if ( nbttagcompound == null ) { java . io . DataInputStream datainputstream = RegionFileCache . getChunkInputStream ( chunkSaveLocation , par2 , par3 ) ; if ( datainputstream != null ) { nbttagcompound = CompressedStreamTools . read ( datainputstream ) ; } else { return null ; } } return func_48464_a ( par1World , par2 , par3 , nbttagcompound ) ; } protected Chunk func_48464_a ( World par1World , int par2 , int par3 , NBTTagCompound par4NBTTagCompound ) { if ( ! par4NBTTagCompound . hasKey ( "<STR_LIT>" ) ) { System . out . println ( ( new StringBuilder ( ) ) . append ( "<STR_LIT>" ) . append ( par2 ) . append ( "<STR_LIT:U+002C>" ) . append ( par3 ) . append ( "<STR_LIT>" ) . toString ( ) ) ; return null ; } if ( ! par4NBTTagCompound . getCompoundTag ( "<STR_LIT>" ) . hasKey ( "<STR_LIT>" ) ) { System . out . println ( ( new StringBuilder ( ) ) . append ( "<STR_LIT>" ) . append ( par2 ) . append ( "<STR_LIT:U+002C>" ) . append ( par3 ) . append ( "<STR_LIT>" ) . toString ( ) ) ; return null ; } Chunk chunk = func_48465_a ( par1World , par4NBTTagCompound . getCompoundTag ( "<STR_LIT>" ) ) ; if ( ! chunk . isAtLocation ( par2 , par3 ) ) { System . out . println ( ( new StringBuilder ( ) ) . append ( "<STR_LIT>" ) . append ( par2 ) . append ( "<STR_LIT:U+002C>" ) . append ( par3 ) . append ( "<STR_LIT>" ) . append ( par2 ) . append ( "<STR_LIT:U+002CU+0020>" ) . append ( par3 ) . append ( "<STR_LIT>" ) . append ( chunk . xPosition ) . append ( "<STR_LIT:U+002CU+0020>" ) . append ( chunk . zPosition ) . append ( "<STR_LIT:)>" ) . toString ( ) ) ; par4NBTTagCompound . setInteger ( "<STR_LIT>" , par2 ) ; par4NBTTagCompound . setInteger ( "<STR_LIT>" , par3 ) ; chunk = func_48465_a ( par1World , par4NBTTagCompound . getCompoundTag ( "<STR_LIT>" ) ) ; } chunk . removeUnknownBlocks ( ) ; return chunk ; } public void saveChunk ( World par1World , Chunk par2Chunk ) throws IOException { par1World . checkSessionLock ( ) ; try { NBTTagCompound nbttagcompound = new NBTTagCompound ( ) ; NBTTagCompound nbttagcompound1 = new NBTTagCompound ( ) ; nbttagcompound . setTag ( "<STR_LIT>" , nbttagcompound1 ) ; func_48462_a ( par2Chunk , par1World , nbttagcompound1 ) ; func_48463_a ( par2Chunk . getChunkCoordIntPair ( ) , nbttagcompound ) ; } catch ( Exception exception ) { exception . printStackTrace ( ) ; } } protected void func_48463_a ( ChunkCoordIntPair par1ChunkCoordIntPair , NBTTagCompound par2NBTTagCompound ) { synchronized ( field_48468_c ) { if ( field_48467_b . contains ( par1ChunkCoordIntPair ) ) { for ( int i = <NUM_LIT:0> ; i < field_48469_a . size ( ) ; i ++ ) { if ( ( ( AnvilChunkLoaderPending ) field_48469_a . get ( i ) ) . field_48581_a . equals ( par1ChunkCoordIntPair ) ) { field_48469_a . set ( i , new AnvilChunkLoaderPending ( par1ChunkCoordIntPair , par2NBTTagCompound ) ) ; return ; } } } field_48469_a . add ( new AnvilChunkLoaderPending ( par1ChunkCoordIntPair , par2NBTTagCompound ) ) ; field_48467_b . add ( par1ChunkCoordIntPair ) ; ThreadedFileIOBase . threadedIOInstance . queueIO ( this ) ; return ; } } public boolean writeNextIO ( ) { AnvilChunkLoaderPending anvilchunkloaderpending = null ; synchronized ( field_48468_c ) { if ( field_48469_a . size ( ) > <NUM_LIT:0> ) { anvilchunkloaderpending = ( AnvilChunkLoaderPending ) field_48469_a . remove ( <NUM_LIT:0> ) ; field_48467_b . remove ( anvilchunkloaderpending . field_48581_a ) ; } else { return false ; } } if ( anvilchunkloaderpending != null ) { try { func_48461_a ( anvilchunkloaderpending ) ; } catch ( Exception exception ) { exception . printStackTrace ( ) ; } } return true ; } private void func_48461_a ( AnvilChunkLoaderPending par1AnvilChunkLoaderPending ) throws IOException { DataOutputStream dataoutputstream = RegionFileCache . getChunkOutputStream ( chunkSaveLocation , par1AnvilChunkLoaderPending . field_48581_a . chunkXPos , par1AnvilChunkLoaderPending . field_48581_a . chunkZPos ) ; CompressedStreamTools . write ( par1AnvilChunkLoaderPending . field_48580_b , dataoutputstream ) ; dataoutputstream . close ( ) ; } public void saveExtraChunkData ( World world , Chunk chunk ) throws IOException { } public void chunkTick ( ) { } public void saveExtraData ( ) { } private void func_48462_a ( Chunk par1Chunk , World par2World , NBTTagCompound par3NBTTagCompound ) { par2World . checkSessionLock ( ) ; par3NBTTagCompound . setInteger ( "<STR_LIT>" , par1Chunk . xPosition ) ; par3NBTTagCompound . setInteger ( "<STR_LIT>" , par1Chunk . zPosition ) ; par3NBTTagCompound . setLong ( "<STR_LIT>" , par2World . getWorldTime ( ) ) ; par3NBTTagCompound . func_48446_a ( "<STR_LIT>" , par1Chunk . heightMap ) ; par3NBTTagCompound . setBoolean ( "<STR_LIT>" , par1Chunk . isTerrainPopulated ) ; ExtendedBlockStorage aextendedblockstorage [ ] = par1Chunk . getBlockStorageArray ( ) ; NBTTagList nbttaglist = new NBTTagList ( "<STR_LIT>" ) ; ExtendedBlockStorage aextendedblockstorage1 [ ] = aextendedblockstorage ; int i = aextendedblockstorage1 . length ; for ( int k = <NUM_LIT:0> ; k < i ; k ++ ) { ExtendedBlockStorage extendedblockstorage = aextendedblockstorage1 [ k ] ; if ( extendedblockstorage == null || extendedblockstorage . func_48587_f ( ) == <NUM_LIT:0> ) { continue ; } NBTTagCompound nbttagcompound = new NBTTagCompound ( ) ; nbttagcompound . setByte ( "<STR_LIT:Y>" , ( byte ) ( extendedblockstorage . getYLocation ( ) > > <NUM_LIT:4> & <NUM_LIT> ) ) ; nbttagcompound . setByteArray ( "<STR_LIT>" , extendedblockstorage . func_48590_g ( ) ) ; if ( extendedblockstorage . getBlockMSBArray ( ) != null ) { nbttagcompound . setByteArray ( "<STR_LIT>" , extendedblockstorage . getBlockMSBArray ( ) . data ) ; } nbttagcompound . setByteArray ( "<STR_LIT>" , extendedblockstorage . func_48594_i ( ) . data ) ; nbttagcompound . setByteArray ( "<STR_LIT>" , extendedblockstorage . getSkylightArray ( ) . data ) ; nbttagcompound . setByteArray ( "<STR_LIT>" , extendedblockstorage . getBlocklightArray ( ) . data ) ; nbttaglist . appendTag ( nbttagcompound ) ; } par3NBTTagCompound . setTag ( "<STR_LIT>" , nbttaglist ) ; par3NBTTagCompound . setByteArray ( "<STR_LIT>" , par1Chunk . getBiomeArray ( ) ) ; par1Chunk . hasEntities = false ; NBTTagList nbttaglist1 = new NBTTagList ( ) ; label0 : for ( int j = <NUM_LIT:0> ; j < par1Chunk . entityLists . length ; j ++ ) { Iterator iterator = par1Chunk . entityLists [ j ] . iterator ( ) ; do { if ( ! iterator . hasNext ( ) ) { continue label0 ; } Entity entity = ( Entity ) iterator . next ( ) ; par1Chunk . hasEntities = true ; NBTTagCompound nbttagcompound1 = new NBTTagCompound ( ) ; if ( entity . addEntityID ( nbttagcompound1 ) ) { nbttaglist1 . appendTag ( nbttagcompound1 ) ; } } while ( true ) ; } par3NBTTagCompound . setTag ( "<STR_LIT>" , nbttaglist1 ) ; NBTTagList nbttaglist2 = new NBTTagList ( ) ; NBTTagCompound nbttagcompound2 ; for ( Iterator iterator1 = par1Chunk . chunkTileEntityMap . values ( ) . iterator ( ) ; iterator1 . hasNext ( ) ; nbttaglist2 . appendTag ( nbttagcompound2 ) ) { TileEntity tileentity = ( TileEntity ) iterator1 . next ( ) ; nbttagcompound2 = new NBTTagCompound ( ) ; tileentity . writeToNBT ( nbttagcompound2 ) ; } par3NBTTagCompound . setTag ( "<STR_LIT>" , nbttaglist2 ) ; List list = par2World . getPendingBlockUpdates ( par1Chunk , false ) ; if ( list != null ) { long l = par2World . getWorldTime ( ) ; NBTTagList nbttaglist3 = new NBTTagList ( ) ; NBTTagCompound nbttagcompound3 ; for ( Iterator iterator2 = list . iterator ( ) ; iterator2 . hasNext ( ) ; nbttaglist3 . appendTag ( nbttagcompound3 ) ) { NextTickListEntry nextticklistentry = ( NextTickListEntry ) iterator2 . next ( ) ; nbttagcompound3 = new NBTTagCompound ( ) ; nbttagcompound3 . setInteger ( "<STR_LIT:i>" , nextticklistentry . blockID ) ; nbttagcompound3 . setInteger ( "<STR_LIT:x>" , nextticklistentry . xCoord ) ; nbttagcompound3 . setInteger ( "<STR_LIT:y>" , nextticklistentry . yCoord ) ; nbttagcompound3 . setInteger ( "<STR_LIT>" , nextticklistentry . zCoord ) ; nbttagcompound3 . setInteger ( "<STR_LIT:t>" , ( int ) ( nextticklistentry . scheduledTime - l ) ) ; } par3NBTTagCompound . setTag ( "<STR_LIT>" , nbttaglist3 ) ; } } private Chunk func_48465_a ( World par1World , NBTTagCompound par2NBTTagCompound ) { int i = par2NBTTagCompound . getInteger ( "<STR_LIT>" ) ; int j = par2NBTTagCompound . getInteger ( "<STR_LIT>" ) ; Chunk chunk = new Chunk ( par1World , i , j ) ; chunk . heightMap = par2NBTTagCompound . func_48445_l ( "<STR_LIT>" ) ; chunk . isTerrainPopulated = par2NBTTagCompound . getBoolean ( "<STR_LIT>" ) ; NBTTagList nbttaglist = par2NBTTagCompound . getTagList ( "<STR_LIT>" ) ; byte byte0 = <NUM_LIT:16> ; ExtendedBlockStorage aextendedblockstorage [ ] = new ExtendedBlockStorage [ byte0 ] ; for ( int k = <NUM_LIT:0> ; k < nbttaglist . tagCount ( ) ; k ++ ) { NBTTagCompound nbttagcompound = ( NBTTagCompound ) nbttaglist . tagAt ( k ) ; byte byte1 = nbttagcompound . getByte ( "<STR_LIT:Y>" ) ; ExtendedBlockStorage extendedblockstorage = new ExtendedBlockStorage ( byte1 << <NUM_LIT:4> ) ; extendedblockstorage . setBlockLSBArray ( nbttagcompound . getByteArray ( "<STR_LIT>" ) ) ; if ( nbttagcompound . hasKey ( "<STR_LIT>" ) ) { extendedblockstorage . setBlockMSBArray ( new NibbleArray ( nbttagcompound . getByteArray ( "<STR_LIT>" ) , <NUM_LIT:4> ) ) ; } extendedblockstorage . setBlockMetadataArray ( new NibbleArray ( nbttagcompound . getByteArray ( "<STR_LIT>" ) , <NUM_LIT:4> ) ) ; extendedblockstorage . setSkylightArray ( new NibbleArray ( nbttagcompound . getByteArray ( "<STR_LIT>" ) , <NUM_LIT:4> ) ) ; extendedblockstorage . setBlocklightArray ( new NibbleArray ( nbttagcompound . getByteArray ( "<STR_LIT>" ) , <NUM_LIT:4> ) ) ; extendedblockstorage . func_48599_d ( ) ; aextendedblockstorage [ byte1 ] = extendedblockstorage ; } chunk . setStorageArrays ( aextendedblockstorage ) ; if ( par2NBTTagCompound . hasKey ( "<STR_LIT>" ) ) { chunk . setBiomeArray ( par2NBTTagCompound . getByteArray ( "<STR_LIT>" ) ) ; } NBTTagList nbttaglist1 = par2NBTTagCompound . getTagList ( "<STR_LIT>" ) ; if ( nbttaglist1 != null ) { for ( int l = <NUM_LIT:0> ; l < nbttaglist1 . tagCount ( ) ; l ++ ) { NBTTagCompound nbttagcompound1 = ( NBTTagCompound ) nbttaglist1 . tagAt ( l ) ; Entity entity = EntityList . createEntityFromNBT ( nbttagcompound1 , par1World ) ; chunk . hasEntities = true ; if ( entity != null ) { chunk . addEntity ( entity ) ; } } } NBTTagList nbttaglist2 = par2NBTTagCompound . getTagList ( "<STR_LIT>" ) ; if ( nbttaglist2 != null ) { for ( int i1 = <NUM_LIT:0> ; i1 < nbttaglist2 . tagCount ( ) ; i1 ++ ) { NBTTagCompound nbttagcompound2 = ( NBTTagCompound ) nbttaglist2 . tagAt ( i1 ) ; TileEntity tileentity = TileEntity . createAndLoadEntity ( nbttagcompound2 ) ; if ( tileentity != null ) { chunk . addTileEntity ( tileentity ) ; } } } if ( par2NBTTagCompound . hasKey ( "<STR_LIT>" ) ) { NBTTagList nbttaglist3 = par2NBTTagCompound . getTagList ( "<STR_LIT>" ) ; if ( nbttaglist3 != null ) { for ( int j1 = <NUM_LIT:0> ; j1 < nbttaglist3 . tagCount ( ) ; j1 ++ ) { NBTTagCompound nbttagcompound3 = ( NBTTagCompound ) nbttaglist3 . tagAt ( j1 ) ; par1World . scheduleBlockUpdateFromLoad ( nbttagcompound3 . getInteger ( "<STR_LIT:x>" ) , nbttagcompound3 . getInteger ( "<STR_LIT:y>" ) , nbttagcompound3 . getInteger ( "<STR_LIT>" ) , nbttagcompound3 . getInteger ( "<STR_LIT:i>" ) , nbttagcompound3 . getInteger ( "<STR_LIT:t>" ) ) ; } } } return chunk ; } } </s>
|
<s> package net . minecraft . src ; import java . util . List ; public class ContainerDispenser extends Container { private TileEntityDispenser tileEntityDispenser ; public ContainerDispenser ( IInventory par1IInventory , TileEntityDispenser par2TileEntityDispenser ) { tileEntityDispenser = par2TileEntityDispenser ; for ( int i = <NUM_LIT:0> ; i < <NUM_LIT:3> ; i ++ ) { for ( int l = <NUM_LIT:0> ; l < <NUM_LIT:3> ; l ++ ) { addSlot ( new Slot ( par2TileEntityDispenser , l + i * <NUM_LIT:3> , <NUM_LIT> + l * <NUM_LIT> , <NUM_LIT> + i * <NUM_LIT> ) ) ; } } for ( int j = <NUM_LIT:0> ; j < <NUM_LIT:3> ; j ++ ) { for ( int i1 = <NUM_LIT:0> ; i1 < <NUM_LIT:9> ; i1 ++ ) { addSlot ( new Slot ( par1IInventory , i1 + j * <NUM_LIT:9> + <NUM_LIT:9> , <NUM_LIT:8> + i1 * <NUM_LIT> , <NUM_LIT> + j * <NUM_LIT> ) ) ; } } for ( int k = <NUM_LIT:0> ; k < <NUM_LIT:9> ; k ++ ) { addSlot ( new Slot ( par1IInventory , k , <NUM_LIT:8> + k * <NUM_LIT> , <NUM_LIT> ) ) ; } } public boolean canInteractWith ( EntityPlayer par1EntityPlayer ) { return tileEntityDispenser . isUseableByPlayer ( par1EntityPlayer ) ; } public ItemStack transferStackInSlot ( int par1 ) { ItemStack itemstack = null ; Slot slot = ( Slot ) inventorySlots . get ( par1 ) ; if ( slot != null && slot . getHasStack ( ) ) { ItemStack itemstack1 = slot . getStack ( ) ; itemstack = itemstack1 . copy ( ) ; if ( par1 < <NUM_LIT:9> ) { if ( ! mergeItemStack ( itemstack1 , <NUM_LIT:9> , <NUM_LIT> , true ) ) { return null ; } } else if ( ! mergeItemStack ( itemstack1 , <NUM_LIT:0> , <NUM_LIT:9> , false ) ) { return null ; } if ( itemstack1 . stackSize == <NUM_LIT:0> ) { slot . putStack ( null ) ; } else { slot . onSlotChanged ( ) ; } if ( itemstack1 . stackSize != itemstack . stackSize ) { slot . onPickupFromSlot ( itemstack1 ) ; } else { return null ; } } return itemstack ; } } </s>
|
<s> package net . minecraft . src ; import java . util . Random ; public abstract class EntityMob extends EntityCreature implements IMob { protected int attackStrength ; public EntityMob ( World par1World ) { super ( par1World ) ; attackStrength = <NUM_LIT:2> ; experienceValue = <NUM_LIT:5> ; } public void onLivingUpdate ( ) { float f = getBrightness ( <NUM_LIT> ) ; if ( f > <NUM_LIT> ) { entityAge += <NUM_LIT:2> ; } super . onLivingUpdate ( ) ; } public void onUpdate ( ) { super . onUpdate ( ) ; if ( ! worldObj . isRemote && worldObj . difficultySetting == <NUM_LIT:0> ) { setDead ( ) ; } } protected Entity findPlayerToAttack ( ) { EntityPlayer entityplayer = worldObj . getClosestVulnerablePlayerToEntity ( this , <NUM_LIT> ) ; if ( entityplayer != null && canEntityBeSeen ( entityplayer ) ) { return entityplayer ; } else { return null ; } } public boolean attackEntityFrom ( DamageSource par1DamageSource , int par2 ) { if ( super . attackEntityFrom ( par1DamageSource , par2 ) ) { Entity entity = par1DamageSource . getEntity ( ) ; if ( riddenByEntity == entity || ridingEntity == entity ) { return true ; } if ( entity != this ) { entityToAttack = entity ; } return true ; } else { return false ; } } public boolean attackEntityAsMob ( Entity par1Entity ) { int i = attackStrength ; if ( isPotionActive ( Potion . damageBoost ) ) { i += <NUM_LIT:3> << getActivePotionEffect ( Potion . damageBoost ) . getAmplifier ( ) ; } if ( isPotionActive ( Potion . weakness ) ) { i -= <NUM_LIT:2> << getActivePotionEffect ( Potion . weakness ) . getAmplifier ( ) ; } return par1Entity . attackEntityFrom ( DamageSource . causeMobDamage ( this ) , i ) ; } protected void attackEntity ( Entity par1Entity , float par2 ) { if ( attackTime <= <NUM_LIT:0> && par2 < <NUM_LIT> && par1Entity . boundingBox . maxY > boundingBox . minY && par1Entity . boundingBox . minY < boundingBox . maxY ) { attackTime = <NUM_LIT:20> ; attackEntityAsMob ( par1Entity ) ; } } public float getBlockPathWeight ( int par1 , int par2 , int par3 ) { return <NUM_LIT> - worldObj . getLightBrightness ( par1 , par2 , par3 ) ; } public void writeEntityToNBT ( NBTTagCompound par1NBTTagCompound ) { super . writeEntityToNBT ( par1NBTTagCompound ) ; } public void readEntityFromNBT ( NBTTagCompound par1NBTTagCompound ) { super . readEntityFromNBT ( par1NBTTagCompound ) ; } protected boolean isValidLightLevel ( ) { int i = MathHelper . floor_double ( posX ) ; int j = MathHelper . floor_double ( boundingBox . minY ) ; int k = MathHelper . floor_double ( posZ ) ; if ( worldObj . getSavedLightValue ( EnumSkyBlock . Sky , i , j , k ) > rand . nextInt ( <NUM_LIT:32> ) ) { return false ; } int l = worldObj . getBlockLightValue ( i , j , k ) ; if ( worldObj . isThundering ( ) ) { int i1 = worldObj . skylightSubtracted ; worldObj . skylightSubtracted = <NUM_LIT:10> ; l = worldObj . getBlockLightValue ( i , j , k ) ; worldObj . skylightSubtracted = i1 ; } return l <= rand . nextInt ( <NUM_LIT:8> ) ; } public boolean getCanSpawnHere ( ) { return isValidLightLevel ( ) && super . getCanSpawnHere ( ) ; } } </s>
|
<s> package net . minecraft . src ; import java . util . ArrayList ; import java . util . Random ; public class ComponentVillageStartPiece extends ComponentVillageWell { public WorldChunkManager worldChunkMngr ; public int terrainType ; public StructureVillagePieceWeight structVillagePieceWeight ; public ArrayList structureVillageWeightedPieceList ; public ArrayList field_35389_e ; public ArrayList field_35387_f ; public ComponentVillageStartPiece ( WorldChunkManager par1WorldChunkManager , int par2 , Random par3Random , int par4 , int par5 , ArrayList par6ArrayList , int par7 ) { super ( <NUM_LIT:0> , par3Random , par4 , par5 ) ; field_35389_e = new ArrayList ( ) ; field_35387_f = new ArrayList ( ) ; worldChunkMngr = par1WorldChunkManager ; structureVillageWeightedPieceList = par6ArrayList ; terrainType = par7 ; } public WorldChunkManager getWorldChunkManager ( ) { return worldChunkMngr ; } } </s>
|
<s> package net . minecraft . src ; import java . util . List ; import java . util . Random ; public class ComponentMineshaftCross extends StructureComponent { private final int corridorDirection ; private final boolean isMultipleFloors ; public ComponentMineshaftCross ( int par1 , Random par2Random , StructureBoundingBox par3StructureBoundingBox , int par4 ) { super ( par1 ) ; corridorDirection = par4 ; boundingBox = par3StructureBoundingBox ; isMultipleFloors = par3StructureBoundingBox . getYSize ( ) > <NUM_LIT:3> ; } public static StructureBoundingBox findValidPlacement ( List par0List , Random par1Random , int par2 , int par3 , int par4 , int par5 ) { StructureBoundingBox structureboundingbox = new StructureBoundingBox ( par2 , par3 , par4 , par2 , par3 + <NUM_LIT:2> , par4 ) ; if ( par1Random . nextInt ( <NUM_LIT:4> ) == <NUM_LIT:0> ) { structureboundingbox . maxY += <NUM_LIT:4> ; } switch ( par5 ) { case <NUM_LIT:2> : structureboundingbox . minX = par2 - <NUM_LIT:1> ; structureboundingbox . maxX = par2 + <NUM_LIT:3> ; structureboundingbox . minZ = par4 - <NUM_LIT:4> ; break ; case <NUM_LIT:0> : structureboundingbox . minX = par2 - <NUM_LIT:1> ; structureboundingbox . maxX = par2 + <NUM_LIT:3> ; structureboundingbox . maxZ = par4 + <NUM_LIT:4> ; break ; case <NUM_LIT:1> : structureboundingbox . minX = par2 - <NUM_LIT:4> ; structureboundingbox . minZ = par4 - <NUM_LIT:1> ; structureboundingbox . maxZ = par4 + <NUM_LIT:3> ; break ; case <NUM_LIT:3> : structureboundingbox . maxX = par2 + <NUM_LIT:4> ; structureboundingbox . minZ = par4 - <NUM_LIT:1> ; structureboundingbox . maxZ = par4 + <NUM_LIT:3> ; break ; } if ( StructureComponent . findIntersecting ( par0List , structureboundingbox ) != null ) { return null ; } else { return structureboundingbox ; } } public void buildComponent ( StructureComponent par1StructureComponent , List par2List , Random par3Random ) { int i = getComponentType ( ) ; switch ( corridorDirection ) { case <NUM_LIT:2> : StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . minX + <NUM_LIT:1> , boundingBox . minY , boundingBox . minZ - <NUM_LIT:1> , <NUM_LIT:2> , i ) ; StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . minX - <NUM_LIT:1> , boundingBox . minY , boundingBox . minZ + <NUM_LIT:1> , <NUM_LIT:1> , i ) ; StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . maxX + <NUM_LIT:1> , boundingBox . minY , boundingBox . minZ + <NUM_LIT:1> , <NUM_LIT:3> , i ) ; break ; case <NUM_LIT:0> : StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . minX + <NUM_LIT:1> , boundingBox . minY , boundingBox . maxZ + <NUM_LIT:1> , <NUM_LIT:0> , i ) ; StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . minX - <NUM_LIT:1> , boundingBox . minY , boundingBox . minZ + <NUM_LIT:1> , <NUM_LIT:1> , i ) ; StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . maxX + <NUM_LIT:1> , boundingBox . minY , boundingBox . minZ + <NUM_LIT:1> , <NUM_LIT:3> , i ) ; break ; case <NUM_LIT:1> : StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . minX + <NUM_LIT:1> , boundingBox . minY , boundingBox . minZ - <NUM_LIT:1> , <NUM_LIT:2> , i ) ; StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . minX + <NUM_LIT:1> , boundingBox . minY , boundingBox . maxZ + <NUM_LIT:1> , <NUM_LIT:0> , i ) ; StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . minX - <NUM_LIT:1> , boundingBox . minY , boundingBox . minZ + <NUM_LIT:1> , <NUM_LIT:1> , i ) ; break ; case <NUM_LIT:3> : StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . minX + <NUM_LIT:1> , boundingBox . minY , boundingBox . minZ - <NUM_LIT:1> , <NUM_LIT:2> , i ) ; StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . minX + <NUM_LIT:1> , boundingBox . minY , boundingBox . maxZ + <NUM_LIT:1> , <NUM_LIT:0> , i ) ; StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . maxX + <NUM_LIT:1> , boundingBox . minY , boundingBox . minZ + <NUM_LIT:1> , <NUM_LIT:3> , i ) ; break ; } if ( isMultipleFloors ) { if ( par3Random . nextBoolean ( ) ) { StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . minX + <NUM_LIT:1> , boundingBox . minY + <NUM_LIT:3> + <NUM_LIT:1> , boundingBox . minZ - <NUM_LIT:1> , <NUM_LIT:2> , i ) ; } if ( par3Random . nextBoolean ( ) ) { StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . minX - <NUM_LIT:1> , boundingBox . minY + <NUM_LIT:3> + <NUM_LIT:1> , boundingBox . minZ + <NUM_LIT:1> , <NUM_LIT:1> , i ) ; } if ( par3Random . nextBoolean ( ) ) { StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . maxX + <NUM_LIT:1> , boundingBox . minY + <NUM_LIT:3> + <NUM_LIT:1> , boundingBox . minZ + <NUM_LIT:1> , <NUM_LIT:3> , i ) ; } if ( par3Random . nextBoolean ( ) ) { StructureMineshaftPieces . getNextComponent ( par1StructureComponent , par2List , par3Random , boundingBox . minX + <NUM_LIT:1> , boundingBox . minY + <NUM_LIT:3> + <NUM_LIT:1> , boundingBox . maxZ + <NUM_LIT:1> , <NUM_LIT:0> , i ) ; } } } public boolean addComponentParts ( World par1World , Random par2Random , StructureBoundingBox par3StructureBoundingBox ) { if ( isLiquidInStructureBoundingBox ( par1World , par3StructureBoundingBox ) ) { return false ; } if ( isMultipleFloors ) { fillWithBlocks ( par1World , par3StructureBoundingBox , boundingBox . minX + <NUM_LIT:1> , boundingBox . minY , boundingBox . minZ , boundingBox . maxX - <NUM_LIT:1> , ( boundingBox . minY + <NUM_LIT:3> ) - <NUM_LIT:1> , boundingBox . maxZ , <NUM_LIT:0> , <NUM_LIT:0> , false ) ; fillWithBlocks ( par1World , par3StructureBoundingBox , boundingBox . minX , boundingBox . minY , boundingBox . minZ + <NUM_LIT:1> , boundingBox . maxX , ( boundingBox . minY + <NUM_LIT:3> ) - <NUM_LIT:1> , boundingBox . maxZ - <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , false ) ; fillWithBlocks ( par1World , par3StructureBoundingBox , boundingBox . minX + <NUM_LIT:1> , boundingBox . maxY - <NUM_LIT:2> , boundingBox . minZ , boundingBox . maxX - <NUM_LIT:1> , boundingBox . maxY , boundingBox . maxZ , <NUM_LIT:0> , <NUM_LIT:0> , false ) ; fillWithBlocks ( par1World , par3StructureBoundingBox , boundingBox . minX , boundingBox . maxY - <NUM_LIT:2> , boundingBox . minZ + <NUM_LIT:1> , boundingBox . maxX , boundingBox . maxY , boundingBox . maxZ - <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , false ) ; fillWithBlocks ( par1World , par3StructureBoundingBox , boundingBox . minX + <NUM_LIT:1> , boundingBox . minY + <NUM_LIT:3> , boundingBox . minZ + <NUM_LIT:1> , boundingBox . maxX - <NUM_LIT:1> , boundingBox . minY + <NUM_LIT:3> , boundingBox . maxZ - <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , false ) ; } else { fillWithBlocks ( par1World , par3StructureBoundingBox , boundingBox . minX + <NUM_LIT:1> , boundingBox . minY , boundingBox . minZ , boundingBox . maxX - <NUM_LIT:1> , boundingBox . maxY , boundingBox . maxZ , <NUM_LIT:0> , <NUM_LIT:0> , false ) ; fillWithBlocks ( par1World , par3StructureBoundingBox , boundingBox . minX , boundingBox . minY , boundingBox . minZ + <NUM_LIT:1> , boundingBox . maxX , boundingBox . maxY , boundingBox . maxZ - <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , false ) ; } fillWithBlocks ( par1World , par3StructureBoundingBox , boundingBox . minX + <NUM_LIT:1> , boundingBox . minY , boundingBox . minZ + <NUM_LIT:1> , boundingBox . minX + <NUM_LIT:1> , boundingBox . maxY , boundingBox . minZ + <NUM_LIT:1> , Block . planks . blockID , <NUM_LIT:0> , false ) ; fillWithBlocks ( par1World , par3StructureBoundingBox , boundingBox . minX + <NUM_LIT:1> , boundingBox . minY , boundingBox . maxZ - <NUM_LIT:1> , boundingBox . minX + <NUM_LIT:1> , boundingBox . maxY , boundingBox . maxZ - <NUM_LIT:1> , Block . planks . blockID , <NUM_LIT:0> , false ) ; fillWithBlocks ( par1World , par3StructureBoundingBox , boundingBox . maxX - <NUM_LIT:1> , boundingBox . minY , boundingBox . minZ + <NUM_LIT:1> , boundingBox . maxX - <NUM_LIT:1> , boundingBox . maxY , boundingBox . minZ + <NUM_LIT:1> , Block . planks . blockID , <NUM_LIT:0> , false ) ; fillWithBlocks ( par1World , par3StructureBoundingBox , boundingBox . maxX - <NUM_LIT:1> , boundingBox . minY , boundingBox . maxZ - <NUM_LIT:1> , boundingBox . maxX - <NUM_LIT:1> , boundingBox . maxY , boundingBox . maxZ - <NUM_LIT:1> , Block . planks . blockID , <NUM_LIT:0> , false ) ; for ( int i = boundingBox . minX ; i <= boundingBox . maxX ; i ++ ) { for ( int j = boundingBox . minZ ; j <= boundingBox . maxZ ; j ++ ) { int k = getBlockIdAtCurrentPosition ( par1World , i , boundingBox . minY - <NUM_LIT:1> , j , par3StructureBoundingBox ) ; if ( k == <NUM_LIT:0> ) { placeBlockAtCurrentPosition ( par1World , Block . planks . blockID , <NUM_LIT:0> , i , boundingBox . minY - <NUM_LIT:1> , j , par3StructureBoundingBox ) ; } } } return true ; } } </s>
|
<s> package net . minecraft . src ; public class ItemLilyPad extends ItemColored { public ItemLilyPad ( int par1 ) { super ( par1 , false ) ; } public ItemStack onItemRightClick ( ItemStack par1ItemStack , World par2World , EntityPlayer par3EntityPlayer ) { MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer ( par2World , par3EntityPlayer , true ) ; if ( movingobjectposition == null ) { return par1ItemStack ; } if ( movingobjectposition . typeOfHit == EnumMovingObjectType . TILE ) { int i = movingobjectposition . blockX ; int j = movingobjectposition . blockY ; int k = movingobjectposition . blockZ ; if ( ! par2World . canMineBlock ( par3EntityPlayer , i , j , k ) ) { return par1ItemStack ; } if ( ! par3EntityPlayer . canPlayerEdit ( i , j , k ) ) { return par1ItemStack ; } if ( par2World . getBlockMaterial ( i , j , k ) == Material . water && par2World . getBlockMetadata ( i , j , k ) == <NUM_LIT:0> && par2World . isAirBlock ( i , j + <NUM_LIT:1> , k ) ) { par2World . setBlockWithNotify ( i , j + <NUM_LIT:1> , k , Block . waterlily . blockID ) ; if ( ! par3EntityPlayer . capabilities . isCreativeMode ) { par1ItemStack . stackSize -- ; } } } return par1ItemStack ; } } </s>
|
<s> package net . minecraft . src ; import java . io . * ; public class Packet19EntityAction extends Packet { public int entityId ; public int state ; public Packet19EntityAction ( ) { } public void readPacketData ( DataInputStream par1DataInputStream ) throws IOException { entityId = par1DataInputStream . readInt ( ) ; state = par1DataInputStream . readByte ( ) ; } public void writePacketData ( DataOutputStream par1DataOutputStream ) throws IOException { par1DataOutputStream . writeInt ( entityId ) ; par1DataOutputStream . writeByte ( state ) ; } public void processPacket ( NetHandler par1NetHandler ) { par1NetHandler . handleEntityAction ( this ) ; } public int getPacketSize ( ) { return <NUM_LIT:5> ; } } </s>
|
<s> package net . minecraft . src ; import java . io . * ; public class Packet12PlayerLook extends Packet10Flying { public Packet12PlayerLook ( ) { rotating = true ; } public void readPacketData ( DataInputStream par1DataInputStream ) throws IOException { yaw = par1DataInputStream . readFloat ( ) ; pitch = par1DataInputStream . readFloat ( ) ; super . readPacketData ( par1DataInputStream ) ; } public void writePacketData ( DataOutputStream par1DataOutputStream ) throws IOException { par1DataOutputStream . writeFloat ( yaw ) ; par1DataOutputStream . writeFloat ( pitch ) ; super . writePacketData ( par1DataOutputStream ) ; } public int getPacketSize ( ) { return <NUM_LIT:9> ; } } </s>
|
<s> package net . minecraft . src ; import java . util . Random ; public class WorldGenMinable extends WorldGenerator { private int minableBlockId ; private int numberOfBlocks ; public WorldGenMinable ( int par1 , int par2 ) { minableBlockId = par1 ; numberOfBlocks = par2 ; } public boolean generate ( World par1World , Random par2Random , int par3 , int par4 , int par5 ) { float f = par2Random . nextFloat ( ) * ( float ) Math . PI ; double d = ( float ) ( par3 + <NUM_LIT:8> ) + ( MathHelper . sin ( f ) * ( float ) numberOfBlocks ) / <NUM_LIT> ; double d1 = ( float ) ( par3 + <NUM_LIT:8> ) - ( MathHelper . sin ( f ) * ( float ) numberOfBlocks ) / <NUM_LIT> ; double d2 = ( float ) ( par5 + <NUM_LIT:8> ) + ( MathHelper . cos ( f ) * ( float ) numberOfBlocks ) / <NUM_LIT> ; double d3 = ( float ) ( par5 + <NUM_LIT:8> ) - ( MathHelper . cos ( f ) * ( float ) numberOfBlocks ) / <NUM_LIT> ; double d4 = ( par4 + par2Random . nextInt ( <NUM_LIT:3> ) ) - <NUM_LIT:2> ; double d5 = ( par4 + par2Random . nextInt ( <NUM_LIT:3> ) ) - <NUM_LIT:2> ; for ( int i = <NUM_LIT:0> ; i <= numberOfBlocks ; i ++ ) { double d6 = d + ( ( d1 - d ) * ( double ) i ) / ( double ) numberOfBlocks ; double d7 = d4 + ( ( d5 - d4 ) * ( double ) i ) / ( double ) numberOfBlocks ; double d8 = d2 + ( ( d3 - d2 ) * ( double ) i ) / ( double ) numberOfBlocks ; double d9 = ( par2Random . nextDouble ( ) * ( double ) numberOfBlocks ) / <NUM_LIT> ; double d10 = ( double ) ( MathHelper . sin ( ( ( float ) i * ( float ) Math . PI ) / ( float ) numberOfBlocks ) + <NUM_LIT> ) * d9 + <NUM_LIT> ; double d11 = ( double ) ( MathHelper . sin ( ( ( float ) i * ( float ) Math . PI ) / ( float ) numberOfBlocks ) + <NUM_LIT> ) * d9 + <NUM_LIT> ; int j = MathHelper . floor_double ( d6 - d10 / <NUM_LIT> ) ; int k = MathHelper . floor_double ( d7 - d11 / <NUM_LIT> ) ; int l = MathHelper . floor_double ( d8 - d10 / <NUM_LIT> ) ; int i1 = MathHelper . floor_double ( d6 + d10 / <NUM_LIT> ) ; int j1 = MathHelper . floor_double ( d7 + d11 / <NUM_LIT> ) ; int k1 = MathHelper . floor_double ( d8 + d10 / <NUM_LIT> ) ; for ( int l1 = j ; l1 <= i1 ; l1 ++ ) { double d12 = ( ( ( double ) l1 + <NUM_LIT> ) - d6 ) / ( d10 / <NUM_LIT> ) ; if ( d12 * d12 >= <NUM_LIT> ) { continue ; } for ( int i2 = k ; i2 <= j1 ; i2 ++ ) { double d13 = ( ( ( double ) i2 + <NUM_LIT> ) - d7 ) / ( d11 / <NUM_LIT> ) ; if ( d12 * d12 + d13 * d13 >= <NUM_LIT> ) { continue ; } for ( int j2 = l ; j2 <= k1 ; j2 ++ ) { double d14 = ( ( ( double ) j2 + <NUM_LIT> ) - d8 ) / ( d10 / <NUM_LIT> ) ; if ( d12 * d12 + d13 * d13 + d14 * d14 < <NUM_LIT> && par1World . getBlockId ( l1 , i2 , j2 ) == Block . stone . blockID ) { par1World . setBlock ( l1 , i2 , j2 , minableBlockId ) ; } } } } } return true ; } } </s>
|
<s> package net . minecraft . src ; import java . util . List ; import java . util . Random ; public class ComponentStrongholdStairs extends ComponentStronghold { private final boolean field_35327_a ; private final EnumDoor doorType ; public ComponentStrongholdStairs ( int par1 , Random par2Random , int par3 , int par4 ) { super ( par1 ) ; field_35327_a = true ; coordBaseMode = par2Random . nextInt ( <NUM_LIT:4> ) ; doorType = EnumDoor . OPENING ; switch ( coordBaseMode ) { case <NUM_LIT:0> : case <NUM_LIT:2> : boundingBox = new StructureBoundingBox ( par3 , <NUM_LIT> , par4 , ( par3 + <NUM_LIT:5> ) - <NUM_LIT:1> , <NUM_LIT> , ( par4 + <NUM_LIT:5> ) - <NUM_LIT:1> ) ; break ; default : boundingBox = new StructureBoundingBox ( par3 , <NUM_LIT> , par4 , ( par3 + <NUM_LIT:5> ) - <NUM_LIT:1> , <NUM_LIT> , ( par4 + <NUM_LIT:5> ) - <NUM_LIT:1> ) ; break ; } } public ComponentStrongholdStairs ( int par1 , Random par2Random , StructureBoundingBox par3StructureBoundingBox , int par4 ) { super ( par1 ) ; field_35327_a = false ; coordBaseMode = par4 ; doorType = getRandomDoor ( par2Random ) ; boundingBox = par3StructureBoundingBox ; } public void buildComponent ( StructureComponent par1StructureComponent , List par2List , Random par3Random ) { if ( field_35327_a ) { StructureStrongholdPieces . setComponentType ( net . minecraft . src . ComponentStrongholdCrossing . class ) ; } getNextComponentNormal ( ( ComponentStrongholdStairs2 ) par1StructureComponent , par2List , par3Random , <NUM_LIT:1> , <NUM_LIT:1> ) ; } public static ComponentStrongholdStairs getStrongholdStairsComponent ( List par0List , Random par1Random , int par2 , int par3 , int par4 , int par5 , int par6 ) { StructureBoundingBox structureboundingbox = StructureBoundingBox . getComponentToAddBoundingBox ( par2 , par3 , par4 , - <NUM_LIT:1> , - <NUM_LIT:7> , <NUM_LIT:0> , <NUM_LIT:5> , <NUM_LIT:11> , <NUM_LIT:5> , par5 ) ; if ( ! canStrongholdGoDeeper ( structureboundingbox ) || StructureComponent . findIntersecting ( par0List , structureboundingbox ) != null ) { return null ; } else { return new ComponentStrongholdStairs ( par6 , par1Random , structureboundingbox , par5 ) ; } } public boolean addComponentParts ( World par1World , Random par2Random , StructureBoundingBox par3StructureBoundingBox ) { if ( isLiquidInStructureBoundingBox ( par1World , par3StructureBoundingBox ) ) { return false ; } else { if ( ! field_35327_a ) ; fillWithRandomizedBlocks ( par1World , par3StructureBoundingBox , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT:10> , <NUM_LIT:4> , true , par2Random , StructureStrongholdPieces . getStrongholdStones ( ) ) ; placeDoor ( par1World , par2Random , par3StructureBoundingBox , doorType , <NUM_LIT:1> , <NUM_LIT:7> , <NUM_LIT:0> ) ; placeDoor ( par1World , par2Random , par3StructureBoundingBox , EnumDoor . OPENING , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:4> ) ; placeBlockAtCurrentPosition ( par1World , Block . stoneBrick . blockID , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:6> , <NUM_LIT:1> , par3StructureBoundingBox ) ; placeBlockAtCurrentPosition ( par1World , Block . stoneBrick . blockID , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:5> , <NUM_LIT:1> , par3StructureBoundingBox ) ; placeBlockAtCurrentPosition ( par1World , Block . stairSingle . blockID , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:6> , <NUM_LIT:1> , par3StructureBoundingBox ) ; placeBlockAtCurrentPosition ( par1World , Block . stoneBrick . blockID , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:5> , <NUM_LIT:2> , par3StructureBoundingBox ) ; placeBlockAtCurrentPosition ( par1World , Block . stoneBrick . blockID , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:4> , <NUM_LIT:3> , par3StructureBoundingBox ) ; placeBlockAtCurrentPosition ( par1World , Block . stairSingle . blockID , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:5> , <NUM_LIT:3> , par3StructureBoundingBox ) ; placeBlockAtCurrentPosition ( par1World , Block . stoneBrick . blockID , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:4> , <NUM_LIT:3> , par3StructureBoundingBox ) ; placeBlockAtCurrentPosition ( par1World , Block . stoneBrick . blockID , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT:3> , par3StructureBoundingBox ) ; placeBlockAtCurrentPosition ( par1World , Block . stairSingle . blockID , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:3> , par3StructureBoundingBox ) ; placeBlockAtCurrentPosition ( par1World , Block . stoneBrick . blockID , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT:2> , par3StructureBoundingBox ) ; placeBlockAtCurrentPosition ( par1World , Block . stoneBrick . blockID , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT:2> , <NUM_LIT:1> , par3StructureBoundingBox ) ; placeBlockAtCurrentPosition ( par1World , Block . stairSingle . blockID , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT:1> , par3StructureBoundingBox ) ; placeBlockAtCurrentPosition ( par1World , Block . stoneBrick . blockID , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:2> , <NUM_LIT:1> , par3StructureBoundingBox ) ; placeBlockAtCurrentPosition ( par1World , Block . stoneBrick . blockID , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , par3StructureBoundingBox ) ; placeBlockAtCurrentPosition ( par1World , Block . stairSingle . blockID , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:1> , par3StructureBoundingBox ) ; placeBlockAtCurrentPosition ( par1World , Block . stoneBrick . blockID , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:2> , par3StructureBoundingBox ) ; placeBlockAtCurrentPosition ( par1World , Block . stairSingle . blockID , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:3> , par3StructureBoundingBox ) ; return true ; } } } </s>
|
<s> package net . minecraft . src ; import java . io . * ; public class Packet103SetSlot extends Packet { public int windowId ; public int itemSlot ; public ItemStack myItemStack ; public Packet103SetSlot ( ) { } public Packet103SetSlot ( int par1 , int par2 , ItemStack par3ItemStack ) { windowId = par1 ; itemSlot = par2 ; myItemStack = par3ItemStack != null ? par3ItemStack . copy ( ) : par3ItemStack ; } public void processPacket ( NetHandler par1NetHandler ) { par1NetHandler . handleSetSlot ( this ) ; } public void readPacketData ( DataInputStream par1DataInputStream ) throws IOException { windowId = par1DataInputStream . readByte ( ) ; itemSlot = par1DataInputStream . readShort ( ) ; myItemStack = readItemStack ( par1DataInputStream ) ; } public void writePacketData ( DataOutputStream par1DataOutputStream ) throws IOException { par1DataOutputStream . writeByte ( windowId ) ; par1DataOutputStream . writeShort ( itemSlot ) ; writeItemStack ( myItemStack , par1DataOutputStream ) ; } public int getPacketSize ( ) { return <NUM_LIT:8> ; } } </s>
|
<s> package net . minecraft . src ; import java . io . * ; public class Packet21PickupSpawn extends Packet { public int entityId ; public int xPosition ; public int yPosition ; public int zPosition ; public byte rotation ; public byte pitch ; public byte roll ; public int itemID ; public int count ; public int itemDamage ; public Packet21PickupSpawn ( ) { } public Packet21PickupSpawn ( EntityItem par1EntityItem ) { entityId = par1EntityItem . entityId ; itemID = par1EntityItem . item . itemID ; count = par1EntityItem . item . stackSize ; itemDamage = par1EntityItem . item . getItemDamage ( ) ; xPosition = MathHelper . floor_double ( par1EntityItem . posX * <NUM_LIT> ) ; yPosition = MathHelper . floor_double ( par1EntityItem . posY * <NUM_LIT> ) ; zPosition = MathHelper . floor_double ( par1EntityItem . posZ * <NUM_LIT> ) ; rotation = ( byte ) ( int ) ( par1EntityItem . motionX * <NUM_LIT> ) ; pitch = ( byte ) ( int ) ( par1EntityItem . motionY * <NUM_LIT> ) ; roll = ( byte ) ( int ) ( par1EntityItem . motionZ * <NUM_LIT> ) ; } public void readPacketData ( DataInputStream par1DataInputStream ) throws IOException { entityId = par1DataInputStream . readInt ( ) ; itemID = par1DataInputStream . readShort ( ) ; count = par1DataInputStream . readByte ( ) ; itemDamage = par1DataInputStream . readShort ( ) ; xPosition = par1DataInputStream . readInt ( ) ; yPosition = par1DataInputStream . readInt ( ) ; zPosition = par1DataInputStream . readInt ( ) ; rotation = par1DataInputStream . readByte ( ) ; pitch = par1DataInputStream . readByte ( ) ; roll = par1DataInputStream . readByte ( ) ; } public void writePacketData ( DataOutputStream par1DataOutputStream ) throws IOException { par1DataOutputStream . writeInt ( entityId ) ; par1DataOutputStream . writeShort ( itemID ) ; par1DataOutputStream . writeByte ( count ) ; par1DataOutputStream . writeShort ( itemDamage ) ; par1DataOutputStream . writeInt ( xPosition ) ; par1DataOutputStream . writeInt ( yPosition ) ; par1DataOutputStream . writeInt ( zPosition ) ; par1DataOutputStream . writeByte ( rotation ) ; par1DataOutputStream . writeByte ( pitch ) ; par1DataOutputStream . writeByte ( roll ) ; } public void processPacket ( NetHandler par1NetHandler ) { par1NetHandler . handlePickupSpawn ( this ) ; } public int getPacketSize ( ) { return <NUM_LIT:24> ; } } </s>
|
<s> package net . minecraft . src ; public class EntitySmallFireball extends EntityFireball { public EntitySmallFireball ( World par1World ) { super ( par1World ) ; setSize ( <NUM_LIT> , <NUM_LIT> ) ; } public EntitySmallFireball ( World par1World , EntityLiving par2EntityLiving , double par3 , double par5 , double par7 ) { super ( par1World , par2EntityLiving , par3 , par5 , par7 ) ; setSize ( <NUM_LIT> , <NUM_LIT> ) ; } public EntitySmallFireball ( World par1World , double par2 , double par4 , double par6 , double par8 , double par10 , double par12 ) { super ( par1World , par2 , par4 , par6 , par8 , par10 , par12 ) ; setSize ( <NUM_LIT> , <NUM_LIT> ) ; } protected void func_40063_a ( MovingObjectPosition par1MovingObjectPosition ) { if ( ! worldObj . isRemote ) { if ( par1MovingObjectPosition . entityHit != null ) { if ( ! par1MovingObjectPosition . entityHit . isImmuneToFire ( ) && par1MovingObjectPosition . entityHit . attackEntityFrom ( DamageSource . causeFireballDamage ( this , shootingEntity ) , <NUM_LIT:5> ) ) { par1MovingObjectPosition . entityHit . setFire ( <NUM_LIT:5> ) ; } } else { int i = par1MovingObjectPosition . blockX ; int j = par1MovingObjectPosition . blockY ; int k = par1MovingObjectPosition . blockZ ; switch ( par1MovingObjectPosition . sideHit ) { case <NUM_LIT:1> : j ++ ; break ; case <NUM_LIT:0> : j -- ; break ; case <NUM_LIT:2> : k -- ; break ; case <NUM_LIT:3> : k ++ ; break ; case <NUM_LIT:5> : i ++ ; break ; case <NUM_LIT:4> : i -- ; break ; } if ( worldObj . isAirBlock ( i , j , k ) ) { worldObj . setBlockWithNotify ( i , j , k , Block . fire . blockID ) ; } } setDead ( ) ; } } public boolean canBeCollidedWith ( ) { return false ; } public boolean attackEntityFrom ( DamageSource par1DamageSource , int par2 ) { return false ; } } </s>
|
<s> package at . droidcode . commands ; import android . graphics . Canvas ; import android . graphics . Paint ; import android . graphics . Path ; import android . graphics . Point ; public class Command implements Runnable { private Canvas cmdCanvas ; private final Paint cmdPaint ; private final Path cmdPath ; private final Point cmdPoint ; public Command ( Paint paint , Path path ) { cmdPaint = new Paint ( paint ) ; cmdPath = new Path ( path ) ; cmdPoint = null ; } public Command ( Paint paint , Point point ) { cmdPaint = new Paint ( paint ) ; cmdPath = null ; cmdPoint = new Point ( point ) ; } public Command ( Paint paint ) { cmdPaint = new Paint ( paint ) ; cmdPath = null ; cmdPoint = null ; } void setCanvas ( Canvas canvas ) { cmdCanvas = canvas ; } @ Override public void run ( ) { if ( cmdPath != null ) { cmdCanvas . drawPath ( cmdPath , cmdPaint ) ; } else if ( cmdPoint != null ) { cmdCanvas . drawPoint ( cmdPoint . x , cmdPoint . y , cmdPaint ) ; } else { cmdCanvas . drawPaint ( cmdPaint ) ; } } } </s>
|
<s> package at . droidcode . commands ; import java . util . LinkedList ; import android . graphics . Bitmap ; import android . graphics . Bitmap . Config ; import android . graphics . Canvas ; import android . graphics . Color ; import android . graphics . Paint ; import android . graphics . PorterDuff ; import android . graphics . PorterDuffXfermode ; public class CommandManager { private static final int MAXCOMMANDS = <NUM_LIT> ; private Bitmap originalBitmap ; private int commandIndex ; private final Canvas bitmapCanvas ; private final Paint transparencyPaint ; private final LinkedList < Command > commandStack ; public CommandManager ( ) { commandIndex = <NUM_LIT:0> ; commandStack = new LinkedList < Command > ( ) ; bitmapCanvas = new Canvas ( ) ; transparencyPaint = new Paint ( ) ; transparencyPaint . setColor ( Color . TRANSPARENT ) ; transparencyPaint . setXfermode ( new PorterDuffXfermode ( PorterDuff . Mode . CLEAR ) ) ; } public void clear ( ) { if ( originalBitmap != null ) { originalBitmap . recycle ( ) ; originalBitmap = null ; } commandStack . clear ( ) ; commandIndex = <NUM_LIT:0> ; } public void reset ( Bitmap originalBitmap ) { if ( this . originalBitmap != null ) { this . originalBitmap . recycle ( ) ; commandStack . clear ( ) ; commandIndex = <NUM_LIT:0> ; } this . originalBitmap = originalBitmap . copy ( Config . ARGB_8888 , true ) ; bitmapCanvas . setBitmap ( this . originalBitmap ) ; } public synchronized void commitCommand ( Command command , Canvas canvas ) { command . setCanvas ( canvas ) ; command . run ( ) ; if ( commandIndex < commandStack . size ( ) ) { for ( int i = commandStack . size ( ) ; i > commandIndex ; i -- ) { commandStack . removeLast ( ) ; } } if ( commandIndex == MAXCOMMANDS ) { Command removed = commandStack . removeFirst ( ) ; removed . setCanvas ( bitmapCanvas ) ; removed . run ( ) ; } else { commandIndex ++ ; } commandStack . add ( command ) ; } public synchronized void undoLast ( Canvas canvas ) { if ( commandIndex > <NUM_LIT:0> ) { canvas . drawPaint ( transparencyPaint ) ; canvas . drawBitmap ( originalBitmap , <NUM_LIT:0> , <NUM_LIT:0> , null ) ; commandIndex -- ; for ( int i = <NUM_LIT:0> ; i < commandIndex ; i ++ ) { Command command = commandStack . get ( i ) ; command . run ( ) ; } } } public synchronized void redoLast ( Canvas canvas ) { if ( commandIndex < commandStack . size ( ) ) { Command command = commandStack . get ( commandIndex ) ; command . run ( ) ; commandIndex ++ ; } } } </s>
|
<s> package at . droidcode . threadpaint . api ; import android . content . SharedPreferences ; public interface PreferencesCallback { void preferenceChanged ( SharedPreferences preferences , String key ) ; } </s>
|
<s> package at . droidcode . threadpaint . api ; public interface ToolButtonAnimator { void fadeOutToolButtons ( ) ; void fadeInToolButtons ( ) ; } </s>
|
<s> package at . droidcode . threadpaint ; import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . RandomAccessFile ; import java . nio . MappedByteBuffer ; import java . nio . channels . FileChannel ; import java . nio . channels . FileChannel . MapMode ; import android . app . Activity ; import android . content . Context ; import android . content . pm . ActivityInfo ; import android . content . res . Resources ; import android . graphics . Bitmap ; import android . graphics . BitmapFactory ; import android . os . Environment ; import android . util . Log ; import android . util . TypedValue ; import android . view . Display ; import android . view . Surface ; import android . view . WindowManager ; import android . widget . Toast ; public final class Utils { private Utils ( ) { } public static int dp2px ( Context context , int dp ) { final Resources res = context . getResources ( ) ; float px = TypedValue . applyDimension ( TypedValue . COMPLEX_UNIT_DIP , dp , res . getDisplayMetrics ( ) ) ; return Math . round ( px ) ; } public static int sreenWidthPx ( Context context , float percent ) { return Math . round ( context . getResources ( ) . getDisplayMetrics ( ) . widthPixels * percent ) ; } public static void lockScreenOrientation ( boolean lock , Activity activity ) { int screenOrientation = ActivityInfo . SCREEN_ORIENTATION_SENSOR ; if ( lock ) { Display display = ( ( WindowManager ) activity . getSystemService ( Context . WINDOW_SERVICE ) ) . getDefaultDisplay ( ) ; switch ( display . getRotation ( ) ) { case Surface . ROTATION_0 : screenOrientation = ActivityInfo . SCREEN_ORIENTATION_PORTRAIT ; break ; case Surface . ROTATION_90 : screenOrientation = ActivityInfo . SCREEN_ORIENTATION_LANDSCAPE ; break ; case Surface . ROTATION_270 : screenOrientation = ActivityInfo . SCREEN_ORIENTATION_LANDSCAPE ; break ; } } activity . setRequestedOrientation ( screenOrientation ) ; } public static Bitmap decodeFile ( Context c , File f ) { Bitmap tmpBitmap = null ; try { BitmapFactory . Options o = new BitmapFactory . Options ( ) ; o . inJustDecodeBounds = true ; BitmapFactory . decodeStream ( new FileInputStream ( f ) , null , o ) ; final int REQUIRED_SIZE = <NUM_LIT> ; int tmpWidth = o . outWidth , tmpHeight = o . outHeight ; int scale = <NUM_LIT:1> ; while ( tmpWidth / <NUM_LIT:2> > REQUIRED_SIZE || tmpHeight / <NUM_LIT:2> > REQUIRED_SIZE ) { tmpWidth /= <NUM_LIT:2> ; tmpHeight /= <NUM_LIT:2> ; scale *= <NUM_LIT:2> ; } BitmapFactory . Options o2 = new BitmapFactory . Options ( ) ; o2 . inSampleSize = scale ; tmpBitmap = BitmapFactory . decodeStream ( new FileInputStream ( f ) , null , o2 ) ; File file = new File ( c . getExternalFilesDir ( Environment . DIRECTORY_PICTURES ) , "<STR_LIT>" ) ; file . getParentFile ( ) . mkdirs ( ) ; RandomAccessFile randomAccessFile = new RandomAccessFile ( file , "<STR_LIT>" ) ; int width = tmpBitmap . getWidth ( ) ; int height = tmpBitmap . getHeight ( ) ; FileChannel channel = randomAccessFile . getChannel ( ) ; MappedByteBuffer map = channel . map ( MapMode . READ_WRITE , <NUM_LIT:0> , width * height * <NUM_LIT:4> ) ; tmpBitmap . copyPixelsToBuffer ( map ) ; tmpBitmap . recycle ( ) ; tmpBitmap = Bitmap . createBitmap ( width , height , Bitmap . Config . ARGB_8888 ) ; map . position ( <NUM_LIT:0> ) ; tmpBitmap . copyPixelsFromBuffer ( map ) ; channel . close ( ) ; randomAccessFile . close ( ) ; file . delete ( ) ; } catch ( FileNotFoundException e ) { Log . e ( TpApplication . TAG , "<STR_LIT>" , e ) ; } catch ( IOException e ) { Log . e ( TpApplication . TAG , "<STR_LIT>" , e ) ; } return tmpBitmap ; } public static class ToastRunnable implements Runnable { private final Context context ; private final String text ; public ToastRunnable ( Context c , String message ) { context = c ; text = message ; } @ Override public void run ( ) { Toast . makeText ( context , text , Toast . LENGTH_SHORT ) . show ( ) ; } } } </s>
|
<s> package at . droidcode . threadpaint ; import static at . droidcode . threadpaint . TpApplication . TAG ; import java . io . File ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import android . app . Activity ; import android . app . ProgressDialog ; import android . content . Intent ; import android . content . SharedPreferences ; import android . database . Cursor ; import android . graphics . Bitmap ; import android . graphics . Color ; import android . net . Uri ; import android . os . Bundle ; import android . provider . MediaStore ; import android . util . Log ; import android . view . Menu ; import android . view . MenuInflater ; import android . view . MenuItem ; import android . view . View ; import android . view . animation . Animation ; import android . view . animation . AnimationUtils ; import android . widget . Button ; import android . widget . Toast ; import at . droidcode . threadpaint . TpPreferencesActivity . Preference ; import at . droidcode . threadpaint . api . PreferencesCallback ; import at . droidcode . threadpaint . api . ToolButtonAnimator ; import at . droidcode . threadpaint . dialog . BrushPickerDialog ; import at . droidcode . threadpaint . dialog . ColorPickerDialog ; import at . droidcode . threadpaint . dialog . SaveFileDialog ; import at . droidcode . threadpaint . ui . PaintView ; public class TpMainActivity extends Activity implements ToolButtonAnimator , PreferencesCallback { public static Activity instance ; private static final int REQ_LOAD = <NUM_LIT:1> ; private PaintView paintView ; private List < View > toolButtons ; private ColorPickerDialog colorPickerDialog ; private BrushPickerDialog brushPickerDialog ; private Button buttonColor ; private Button buttonBrush ; private Button buttonMove ; private Button buttonFill ; private Button buttonErase ; private Button buttonUndo ; private Button buttonRedo ; @ Override public void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( R . layout . activity_threadpaint ) ; instance = this ; paintView = ( PaintView ) findViewById ( R . id . view_paint_view ) ; paintView . setToolButtonAnimator ( this ) ; buttonColor = ( Button ) findViewById ( R . id . btn_tool_color ) ; buttonBrush = ( Button ) findViewById ( R . id . btn_tool_brush ) ; buttonMove = ( Button ) findViewById ( R . id . btn_tool_move ) ; buttonFill = ( Button ) findViewById ( R . id . btn_tool_fill ) ; buttonErase = ( Button ) findViewById ( R . id . btn_tool_erase ) ; buttonUndo = ( Button ) findViewById ( R . id . btn_tool_undo ) ; buttonRedo = ( Button ) findViewById ( R . id . btn_tool_redo ) ; toolButtons = new ArrayList < View > ( ) ; Collections . addAll ( toolButtons , buttonColor , buttonBrush , buttonMove , buttonFill , buttonErase , buttonUndo , buttonRedo ) ; setSelectedBackground ( buttonBrush ) ; TpPreferencesActivity . addCallbackForPreference ( this , Preference . LOCKORIENTATION ) ; TpPreferencesActivity . addCallbackForPreference ( this , Preference . MOVETHRESHOLD ) ; } @ Override public void onDestroy ( ) { Log . w ( TAG , "<STR_LIT>" ) ; TpPreferencesActivity . removeCallback ( this ) ; paintView . stopPaintThread ( ) ; super . onDestroy ( ) ; } @ Override protected void onSaveInstanceState ( Bundle b ) { Log . d ( TAG , "<STR_LIT>" ) ; paintView . saveState ( b ) ; } @ Override protected void onRestoreInstanceState ( Bundle b ) { Log . d ( TAG , "<STR_LIT>" ) ; paintView . restoreState ( b ) ; } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { MenuInflater inflater = getMenuInflater ( ) ; inflater . inflate ( R . menu . menu , menu ) ; return true ; } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { switch ( item . getItemId ( ) ) { case R . id . menu_save : showSaveDialog ( ) ; return true ; case R . id . menu_load : Intent intent = new Intent ( Intent . ACTION_GET_CONTENT ) ; intent . setType ( "<STR_LIT>" ) ; startActivityForResult ( intent , REQ_LOAD ) ; return true ; case R . id . menu_clear : paintView . resetCanvas ( ) ; return true ; case R . id . menu_prefs : Intent i = new Intent ( this , TpPreferencesActivity . class ) ; startActivity ( i ) ; return true ; default : return super . onOptionsItemSelected ( item ) ; } } public void onToolButtonClicked ( View button ) { switch ( button . getId ( ) ) { case R . id . btn_tool_color : showColorPickerDialog ( ) ; break ; case R . id . btn_tool_brush : if ( paintView . selectedTool ( ) == PaintView . Tool . BRUSH ) { showBrushPickerDialog ( ) ; } else { paintView . selectTool ( PaintView . Tool . BRUSH ) ; setSelectedBackground ( buttonBrush ) ; } break ; case R . id . btn_tool_move : paintView . selectTool ( PaintView . Tool . MOVE ) ; setSelectedBackground ( buttonMove ) ; break ; case R . id . btn_tool_fill : paintView . fillWithPaint ( ) ; break ; case R . id . btn_tool_erase : paintView . selectTool ( PaintView . Tool . ERASE ) ; paintView . setPaintColor ( Color . TRANSPARENT ) ; setSelectedBackground ( buttonErase ) ; break ; case R . id . btn_tool_undo : paintView . undo ( ) ; break ; case R . id . btn_tool_redo : paintView . redo ( ) ; break ; } } private void setSelectedBackground ( Button button ) { buttonColor . setBackgroundResource ( R . drawable . button_tool_color ) ; buttonBrush . setBackgroundResource ( R . drawable . button_tool_brush ) ; buttonMove . setBackgroundResource ( R . drawable . button_tool_move ) ; buttonFill . setBackgroundResource ( R . drawable . button_tool_fill ) ; buttonErase . setBackgroundResource ( R . drawable . button_tool_erase ) ; switch ( button . getId ( ) ) { case R . id . btn_tool_color : button . setBackgroundResource ( R . drawable . button_tool_color_selected ) ; break ; case R . id . btn_tool_brush : button . setBackgroundResource ( R . drawable . button_tool_brush_selected ) ; break ; case R . id . btn_tool_move : button . setBackgroundResource ( R . drawable . button_tool_move_selected ) ; break ; case R . id . btn_tool_fill : button . setBackgroundResource ( R . drawable . button_tool_fill_selected ) ; break ; case R . id . btn_tool_erase : button . setBackgroundResource ( R . drawable . button_tool_erase_selected ) ; break ; } } @ Override public void onActivityResult ( int requestCode , int resultCode , Intent data ) { switch ( requestCode ) { case REQ_LOAD : if ( resultCode == RESULT_OK ) { Uri imageUri = data . getData ( ) ; String [ ] filePathColumn = { MediaStore . Images . Media . DATA } ; Cursor cursor = getContentResolver ( ) . query ( imageUri , filePathColumn , null , null , null ) ; cursor . moveToFirst ( ) ; int columnIndex = cursor . getColumnIndex ( filePathColumn [ <NUM_LIT:0> ] ) ; final File imageFile = new File ( cursor . getString ( columnIndex ) ) ; cursor . close ( ) ; String loadMessge = getResources ( ) . getString ( R . string . dialog_load ) ; final ProgressDialog load = ProgressDialog . show ( TpMainActivity . this , "<STR_LIT>" , loadMessge , true ) ; Thread thread = new Thread ( ) { @ Override public void run ( ) { Bitmap bitmap = Utils . decodeFile ( TpMainActivity . this , imageFile ) ; paintView . setBitmap ( bitmap ) ; load . dismiss ( ) ; } } ; thread . start ( ) ; } break ; } } @ Override public void fadeOutToolButtons ( ) { Animation fadeOut = AnimationUtils . loadAnimation ( this , R . anim . alpha_out ) ; animateViews ( toolButtons , fadeOut ) ; } @ Override public void fadeInToolButtons ( ) { Animation fadeIn = AnimationUtils . loadAnimation ( this , R . anim . alpha_in ) ; animateViews ( toolButtons , fadeIn ) ; } private void animateViews ( List < View > views , Animation a ) { for ( int i = <NUM_LIT:0> ; i < views . size ( ) ; i ++ ) { a . reset ( ) ; views . get ( i ) . clearAnimation ( ) ; views . get ( i ) . startAnimation ( a ) ; } } private void showColorPickerDialog ( ) { if ( colorPickerDialog == null ) { colorPickerDialog = new ColorPickerDialog ( this , paintView ) ; } colorPickerDialog . show ( ) ; } private void showBrushPickerDialog ( ) { if ( brushPickerDialog == null ) { brushPickerDialog = new BrushPickerDialog ( this , paintView ) ; } brushPickerDialog . show ( ) ; } private void showSaveDialog ( ) { final SaveFileDialog dialog = new SaveFileDialog ( this , paintView . getBitmap ( ) ) ; dialog . show ( ) ; } @ Override public void preferenceChanged ( SharedPreferences preferences , String key ) { if ( key . equals ( Preference . LOCKORIENTATION . key ( ) ) ) { boolean lock = preferences . getBoolean ( key , true ) ; Log . d ( TAG , "<STR_LIT>" + lock ) ; Utils . lockScreenOrientation ( lock , this ) ; } else if ( key . equals ( Preference . MOVETHRESHOLD . key ( ) ) ) { float f = <NUM_LIT:1.0f> ; try { f = Float . parseFloat ( preferences . getString ( key , "<STR_LIT>" ) ) ; } catch ( NumberFormatException e ) { Log . e ( TAG , "<STR_LIT>" , e ) ; CharSequence text = getResources ( ) . getString ( R . string . toast_float_parse_error ) ; Toast . makeText ( this , text , Toast . LENGTH_SHORT ) . show ( ) ; } Log . d ( TAG , "<STR_LIT>" + Float . toString ( f ) ) ; paintView . setMoveThreshold ( f ) ; } } } </s>
|
<s> package at . droidcode . threadpaint ; import android . app . Application ; public class TpApplication extends Application { public static final String TAG = "<STR_LIT>" ; private static final int MAX_STROKE_WIDTH_DP = <NUM_LIT> ; private int maxStrokeWidthPx ; @ Override public void onCreate ( ) { super . onCreate ( ) ; maxStrokeWidthPx = Utils . dp2px ( getApplicationContext ( ) , MAX_STROKE_WIDTH_DP ) ; } public int maxStrokeWidth ( ) { return maxStrokeWidthPx ; } } </s>
|
<s> package at . droidcode . threadpaint . dialog ; import android . content . Context ; import android . graphics . Bitmap ; import android . graphics . BitmapFactory ; import android . graphics . BitmapShader ; import android . graphics . Canvas ; import android . graphics . Paint ; import android . graphics . Paint . Style ; import android . graphics . RectF ; import android . graphics . Shader ; import android . util . AttributeSet ; import android . view . MotionEvent ; import android . view . View ; import at . droidcode . threadpaint . R ; import at . droidcode . threadpaint . Utils ; public abstract class ShapeView extends View { interface ShapeClickedListener { void onShapeClicked ( ) ; } private final int centerX ; private float shapeDiameter ; private float shapeRadius ; private final RectF rectFullInset ; private final RectF rectFull ; private final RectF rectFrame ; private final Paint shapePaint ; private final Paint framePaint ; private final Paint checkeredPattern ; private Shape shape ; private boolean trackingCenter ; private boolean highlightCenter ; private final int indicatorFrameWidth ; private ShapeClickedListener shapeClickedListener ; enum Shape { CIRCLE , RECT } ; protected ShapeView ( Context c , AttributeSet attrs ) { super ( c , attrs ) ; shape = Shape . CIRCLE ; shapeDiameter = Utils . dp2px ( c , <NUM_LIT:100> ) ; shapeRadius = shapeDiameter / <NUM_LIT> ; centerX = Utils . sreenWidthPx ( c , <NUM_LIT> ) / <NUM_LIT:2> ; indicatorFrameWidth = Utils . dp2px ( c , <NUM_LIT:5> ) ; shapePaint = new Paint ( Paint . ANTI_ALIAS_FLAG ) ; framePaint = new Paint ( Paint . ANTI_ALIAS_FLAG ) ; framePaint . setStrokeWidth ( indicatorFrameWidth ) ; framePaint . setStyle ( Style . STROKE ) ; float r = Math . round ( shapeRadius * <NUM_LIT> ) ; rectFull = new RectF ( - r , - r , r , r ) ; rectFullInset = new RectF ( rectFull ) ; rectFullInset . inset ( <NUM_LIT> , <NUM_LIT> ) ; r += indicatorFrameWidth ; rectFrame = new RectF ( - r , - r , r , r ) ; Bitmap checkerboard = BitmapFactory . decodeResource ( c . getResources ( ) , R . drawable . transparent ) ; BitmapShader shader = new BitmapShader ( checkerboard , Shader . TileMode . REPEAT , Shader . TileMode . REPEAT ) ; checkeredPattern = new Paint ( ) ; checkeredPattern . setShader ( shader ) ; } final int getCenterX ( ) { return centerX ; } final float getShapeRadius ( ) { return shapeRadius ; } final boolean trackingCenter ( ) { return trackingCenter ; } final void setShapeClickedListener ( ShapeClickedListener l ) { shapeClickedListener = l ; } final void setShape ( Shape s ) { shape = s ; invalidate ( ) ; } final void setShapeDiameter ( float d ) { shapeDiameter = d ; shapeRadius = shapeDiameter / <NUM_LIT> ; shapeDimensionsChanged ( ) ; } final void setShapeRadius ( float r ) { shapeRadius = r ; shapeDiameter = shapeRadius * <NUM_LIT> ; shapeDimensionsChanged ( ) ; } private void shapeDimensionsChanged ( ) { float r = Math . round ( shapeRadius * <NUM_LIT> ) ; rectFull . set ( - r , - r , r , r ) ; r += indicatorFrameWidth ; rectFrame . set ( - r , - r , r , r ) ; invalidate ( ) ; } void setShapeColorAlpha ( int a ) { shapePaint . setAlpha ( a ) ; invalidate ( ) ; } final void setShapeColor ( int color ) { shapePaint . setColor ( color ) ; framePaint . setColor ( color ) ; invalidate ( ) ; } final int getShapeColor ( ) { return shapePaint . getColor ( ) ; } private static final int FULL = <NUM_LIT> ; private static final int DIMMED = <NUM_LIT> ; @ Override protected void onDraw ( Canvas canvas ) { canvas . translate ( centerX , centerX ) ; if ( shape == Shape . RECT ) { canvas . drawRect ( rectFull , checkeredPattern ) ; canvas . drawRect ( rectFull , shapePaint ) ; } else { canvas . drawCircle ( <NUM_LIT:0> , <NUM_LIT:0> , shapeRadius - <NUM_LIT> , checkeredPattern ) ; canvas . drawCircle ( <NUM_LIT:0> , <NUM_LIT:0> , shapeRadius , shapePaint ) ; } if ( trackingCenter ) { if ( ! highlightCenter ) { framePaint . setAlpha ( DIMMED ) ; } else { framePaint . setAlpha ( FULL ) ; } if ( shape == Shape . RECT ) { canvas . drawRect ( rectFrame , framePaint ) ; } else { canvas . drawCircle ( <NUM_LIT:0> , <NUM_LIT:0> , shapeRadius + framePaint . getStrokeWidth ( ) , framePaint ) ; } } } @ Override protected final void onMeasure ( int widthMeasureSpec , int heightMeasureSpec ) { setMeasuredDimension ( centerX * <NUM_LIT:2> , centerX * <NUM_LIT:2> ) ; } @ Override public final boolean onTouchEvent ( MotionEvent event ) { final int action = event . getAction ( ) ; final float x = event . getX ( ) - centerX ; final float y = event . getY ( ) - centerX ; final boolean inCenter = Math . sqrt ( x * x + y * y ) <= shapeRadius ; switch ( action ) { case MotionEvent . ACTION_DOWN : trackingCenter = inCenter ; if ( inCenter ) { highlightCenter = true ; invalidate ( ) ; } break ; case MotionEvent . ACTION_MOVE : if ( highlightCenter != inCenter ) { highlightCenter = inCenter ; invalidate ( ) ; } break ; case MotionEvent . ACTION_UP : if ( trackingCenter && inCenter && shapeClickedListener != null ) { shapeClickedListener . onShapeClicked ( ) ; } trackingCenter = false ; break ; } handleMotionEvent ( action , x , y ) ; return true ; } protected abstract void handleMotionEvent ( int action , float x , float y ) ; } </s>
|
<s> package at . droidcode . threadpaint . dialog ; import android . app . AlertDialog ; import android . content . Context ; import android . graphics . Paint ; import android . graphics . Paint . Cap ; import android . os . Bundle ; import android . view . View ; import android . widget . Button ; import android . widget . SeekBar ; import at . droidcode . threadpaint . R ; import at . droidcode . threadpaint . TpApplication ; import at . droidcode . threadpaint . dialog . ShapeView . Shape ; import at . droidcode . threadpaint . dialog . ShapeView . ShapeClickedListener ; import at . droidcode . threadpaint . ui . PaintView ; public class ColorPickerDialog extends AlertDialog implements ShapeClickedListener , SeekBar . OnSeekBarChangeListener { public interface OnPaintChangedListener { void colorChanged ( int color ) ; } private ColorDialView colorDialView ; private final PaintView paintView ; private final OnPaintChangedListener paintListener ; public ColorPickerDialog ( Context context , PaintView p ) { super ( context ) ; paintView = p ; paintListener = p . getOnPaintChangedListener ( ) ; } @ Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( R . layout . dialog_colorpicker ) ; colorDialView = ( ColorDialView ) findViewById ( R . id . view_colordial ) ; colorDialView . setShapeClickedListener ( this ) ; int x = ( ( TpApplication ) getContext ( ) . getApplicationContext ( ) ) . maxStrokeWidth ( ) ; colorDialView . setShapeDiameter ( x * <NUM_LIT> ) ; final Button toggleButton = ( Button ) findViewById ( R . id . btn_colorpicker_toggle_color ) ; toggleButton . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { if ( colorDialView . isGreyscale ( ) ) { toggleButton . setText ( R . string . btn_grey ) ; colorDialView . setGreyscale ( false ) ; } else { toggleButton . setText ( R . string . btn_color ) ; colorDialView . setGreyscale ( true ) ; } } } ) ; final int color = getContext ( ) . getResources ( ) . getColor ( R . color . stroke_standard ) ; colorDialView . setShapeColor ( color ) ; final SeekBar alphaSeekBar = ( SeekBar ) findViewById ( R . id . seekbar_color_alpha ) ; alphaSeekBar . setOnSeekBarChangeListener ( this ) ; } @ Override public void show ( ) { super . show ( ) ; Paint pathPaint = paintView . getPathPaint ( ) ; colorDialView . setShapeColor ( pathPaint . getColor ( ) ) ; if ( pathPaint . getStrokeCap ( ) == Cap . SQUARE ) { colorDialView . setShape ( Shape . RECT ) ; } else { colorDialView . setShape ( Shape . CIRCLE ) ; } } @ Override public void onShapeClicked ( ) { paintListener . colorChanged ( colorDialView . getShapeColor ( ) ) ; dismiss ( ) ; } @ Override public void onProgressChanged ( SeekBar seekBar , int progress , boolean fromUser ) { colorDialView . setShapeColorAlpha ( Math . round ( <NUM_LIT:255> * ( progress / <NUM_LIT> ) ) ) ; } @ Override public void onStartTrackingTouch ( SeekBar seekBar ) { } @ Override public void onStopTrackingTouch ( SeekBar seekBar ) { } } </s>
|
<s> package at . droidcode . threadpaint . dialog ; import android . content . Context ; import android . util . AttributeSet ; public class BrushTipView extends ShapeView { public BrushTipView ( Context c , AttributeSet attrs ) { super ( c , attrs ) ; } @ Override protected void handleMotionEvent ( int action , float x , float y ) { } } </s>
|
<s> package at . droidcode . threadpaint . dialog ; import android . app . AlertDialog ; import android . content . Context ; import android . graphics . Paint . Cap ; import android . os . Bundle ; import android . view . View ; import android . widget . Button ; import android . widget . SeekBar ; import android . widget . SeekBar . OnSeekBarChangeListener ; import at . droidcode . threadpaint . R ; import at . droidcode . threadpaint . TpApplication ; import at . droidcode . threadpaint . dialog . ShapeView . Shape ; import at . droidcode . threadpaint . dialog . ShapeView . ShapeClickedListener ; import at . droidcode . threadpaint . ui . PaintView ; public class BrushPickerDialog extends AlertDialog implements View . OnClickListener , OnSeekBarChangeListener , ShapeClickedListener { public interface OnBrushChangedListener { void capChanged ( Cap cap ) ; void strokeChanged ( int width ) ; } private BrushTipView brushTipView ; private final PaintView paintView ; private final int maxStrokeWidth ; private final OnBrushChangedListener brushListener ; public BrushPickerDialog ( Context context , PaintView p ) { super ( context ) ; maxStrokeWidth = ( ( TpApplication ) context . getApplicationContext ( ) ) . maxStrokeWidth ( ) ; brushListener = p . getOnBrushChangedListener ( ) ; paintView = p ; } @ Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( R . layout . dialog_brushpicker ) ; brushTipView = ( BrushTipView ) findViewById ( R . id . view_brushtip ) ; brushTipView . setShapeClickedListener ( this ) ; int x = ( ( TpApplication ) getContext ( ) . getApplicationContext ( ) ) . maxStrokeWidth ( ) ; brushTipView . setShapeDiameter ( x / <NUM_LIT> ) ; final Button round = ( Button ) findViewById ( R . id . btn_cap_round ) ; round . setOnClickListener ( this ) ; final Button square = ( Button ) findViewById ( R . id . btn_cap_squared ) ; square . setOnClickListener ( this ) ; final SeekBar strokeSeekBar = ( SeekBar ) findViewById ( R . id . seekbar_brush_tip ) ; strokeSeekBar . setOnSeekBarChangeListener ( this ) ; } @ Override public void show ( ) { super . show ( ) ; brushTipView . setShapeColor ( paintView . getPathPaint ( ) . getColor ( ) ) ; } @ Override public void onClick ( View v ) { switch ( v . getId ( ) ) { case R . id . btn_cap_round : brushListener . capChanged ( Cap . ROUND ) ; brushTipView . setShape ( Shape . CIRCLE ) ; break ; case R . id . btn_cap_squared : brushListener . capChanged ( Cap . SQUARE ) ; brushTipView . setShape ( Shape . RECT ) ; break ; default : dismiss ( ) ; } } @ Override public void onProgressChanged ( SeekBar seekBar , int progress , boolean fromUser ) { final float percent = ( float ) progress / ( float ) seekBar . getMax ( ) ; final int strokeWidth = Math . round ( maxStrokeWidth * percent ) ; final BrushTipView colorPickerView = ( BrushTipView ) findViewById ( R . id . view_brushtip ) ; colorPickerView . setShapeRadius ( strokeWidth / <NUM_LIT:2> ) ; } @ Override public void onStartTrackingTouch ( SeekBar seekBar ) { } @ Override public void onStopTrackingTouch ( SeekBar seekBar ) { final float percent = ( float ) seekBar . getProgress ( ) / ( float ) seekBar . getMax ( ) ; final int strokeWidth = Math . round ( maxStrokeWidth * percent ) ; brushListener . strokeChanged ( strokeWidth ) ; } @ Override public void onShapeClicked ( ) { dismiss ( ) ; } } </s>
|
<s> package at . droidcode . threadpaint . dialog ; import static at . droidcode . threadpaint . TpApplication . TAG ; import java . io . File ; import java . io . FileOutputStream ; import android . app . Dialog ; import android . content . Context ; import android . graphics . Bitmap ; import android . media . MediaScannerConnection ; import android . os . Bundle ; import android . os . Environment ; import android . util . Log ; import android . view . Gravity ; import android . view . View ; import android . widget . EditText ; import android . widget . Toast ; import at . droidcode . threadpaint . R ; import at . droidcode . threadpaint . TpMainActivity ; import at . droidcode . threadpaint . Utils . ToastRunnable ; public class SaveFileDialog extends Dialog implements View . OnClickListener { private final Bitmap bitmapToSave ; private EditText editText ; private class SaveBitmapThread extends Thread { private final String filename ; private static final int QUALITY = <NUM_LIT> ; private static final String ENDING = "<STR_LIT>" ; SaveBitmapThread ( String name ) { filename = name + ENDING ; } @ Override public void run ( ) { Context context = getContext ( ) ; if ( Environment . getExternalStorageState ( ) . equals ( Environment . MEDIA_MOUNTED ) ) { File file = new File ( context . getExternalFilesDir ( Environment . DIRECTORY_PICTURES ) , filename ) ; try { FileOutputStream fileOutputStream = new FileOutputStream ( file ) ; bitmapToSave . compress ( Bitmap . CompressFormat . PNG , QUALITY , fileOutputStream ) ; String [ ] paths = new String [ ] { file . getAbsolutePath ( ) } ; MediaScannerConnection . scanFile ( context , paths , null , null ) ; String success = context . getResources ( ) . getString ( R . string . toast_save_success ) ; TpMainActivity . instance . runOnUiThread ( new ToastRunnable ( context , success ) ) ; } catch ( Exception e ) { Log . e ( TAG , "<STR_LIT>" + file , e ) ; } } else { String error = context . getResources ( ) . getString ( R . string . toast_media_not_mounted ) ; TpMainActivity . instance . runOnUiThread ( new ToastRunnable ( context , error ) ) ; } } } public SaveFileDialog ( Context context , Bitmap bitmap ) { super ( context ) ; bitmapToSave = bitmap ; } @ Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( R . layout . dialog_savefile ) ; setTitle ( getContext ( ) . getResources ( ) . getString ( R . string . dialog_save ) ) ; findViewById ( R . id . btn_savefile_save ) . setOnClickListener ( this ) ; findViewById ( R . id . btn_savefile_cancel ) . setOnClickListener ( this ) ; editText = ( EditText ) findViewById ( R . id . txt_savefile_name ) ; editText . setText ( getContext ( ) . getResources ( ) . getString ( R . string . default_filename ) ) ; } @ Override public void onClick ( View v ) { switch ( v . getId ( ) ) { case R . id . btn_savefile_save : String filename = editText . getText ( ) . toString ( ) ; if ( filename . length ( ) == <NUM_LIT:0> ) { CharSequence text = getContext ( ) . getResources ( ) . getString ( R . string . toast_filename_error ) ; Toast toast = Toast . makeText ( getContext ( ) , text , Toast . LENGTH_SHORT ) ; toast . setGravity ( Gravity . TOP , <NUM_LIT:0> , <NUM_LIT:0> ) ; toast . show ( ) ; } else { new SaveBitmapThread ( filename ) . start ( ) ; dismiss ( ) ; } break ; case R . id . btn_savefile_cancel : cancel ( ) ; break ; } } } </s>
|
<s> package at . droidcode . threadpaint . dialog ; import android . content . Context ; import android . content . res . TypedArray ; import android . graphics . Canvas ; import android . graphics . Color ; import android . graphics . Paint ; import android . graphics . RectF ; import android . graphics . SweepGradient ; import android . util . AttributeSet ; import android . view . MotionEvent ; import at . droidcode . threadpaint . R ; public class ColorDialView extends ShapeView { private final RectF ovalRect ; private final Paint gradientPaint ; private int [ ] colorSpectrum ; private boolean isGreyscale ; private int alpha ; public ColorDialView ( Context c , AttributeSet attrs ) { super ( c , attrs ) ; gradientPaint = new Paint ( Paint . ANTI_ALIAS_FLAG ) ; gradientPaint . setStyle ( Paint . Style . STROKE ) ; gradientPaint . setStrokeWidth ( getShapeRadius ( ) / <NUM_LIT:2> ) ; alpha = <NUM_LIT> ; float r = getCenterX ( ) - ( gradientPaint . getStrokeWidth ( ) / <NUM_LIT:2> ) ; ovalRect = new RectF ( - r , - r , r , r ) ; setGreyscale ( false ) ; } public boolean isGreyscale ( ) { return isGreyscale ; } final void setGreyscale ( boolean b ) { isGreyscale = b ; final TypedArray colorArray ; if ( b ) { colorArray = getContext ( ) . getResources ( ) . obtainTypedArray ( R . array . grey_spectrum ) ; setShapeColor ( Color . WHITE ) ; } else { colorArray = getContext ( ) . getResources ( ) . obtainTypedArray ( R . array . color_spectrum ) ; final int color = getContext ( ) . getResources ( ) . getColor ( R . color . stroke_standard ) ; setShapeColor ( color ) ; } colorSpectrum = new int [ colorArray . length ( ) ] ; for ( int i = <NUM_LIT:0> ; i < colorArray . length ( ) ; i ++ ) { colorSpectrum [ i ] = colorArray . getColor ( i , Color . BLACK ) ; } colorArray . recycle ( ) ; gradientPaint . setShader ( new SweepGradient ( <NUM_LIT:0> , <NUM_LIT:0> , colorSpectrum , null ) ) ; invalidate ( ) ; } @ Override final void setShapeColorAlpha ( int a ) { alpha = a ; super . setShapeColorAlpha ( a ) ; } @ Override protected void onDraw ( Canvas canvas ) { super . onDraw ( canvas ) ; canvas . drawOval ( ovalRect , gradientPaint ) ; } private static int ave ( int s , int d , float p ) { return s + java . lang . Math . round ( p * ( d - s ) ) ; } private int interpColor ( float unit ) { if ( unit <= <NUM_LIT:0> ) { return colorSpectrum [ <NUM_LIT:0> ] ; } if ( unit >= <NUM_LIT:1> ) { return colorSpectrum [ colorSpectrum . length - <NUM_LIT:1> ] ; } float p = unit * ( colorSpectrum . length - <NUM_LIT:1> ) ; int i = ( int ) p ; p -= i ; int c0 = colorSpectrum [ i ] ; int c1 = colorSpectrum [ i + <NUM_LIT:1> ] ; int r = ave ( Color . red ( c0 ) , Color . red ( c1 ) , p ) ; int g = ave ( Color . green ( c0 ) , Color . green ( c1 ) , p ) ; int b = ave ( Color . blue ( c0 ) , Color . blue ( c1 ) , p ) ; return Color . argb ( alpha , r , g , b ) ; } private static final float PI = <NUM_LIT> ; @ Override protected void handleMotionEvent ( int action , float x , float y ) { if ( action == MotionEvent . ACTION_MOVE && ! trackingCenter ( ) ) { float angle = ( float ) java . lang . Math . atan2 ( y , x ) ; float unit = angle / ( <NUM_LIT:2> * PI ) ; if ( unit < <NUM_LIT:0> ) { unit += <NUM_LIT:1> ; } setShapeColor ( interpColor ( unit ) ) ; invalidate ( ) ; } } } </s>
|
<s> package at . droidcode . threadpaint . ui ; import android . graphics . Bitmap ; import android . graphics . Bitmap . Config ; import android . graphics . BitmapFactory ; import android . graphics . BitmapShader ; import android . graphics . Canvas ; import android . graphics . Color ; import android . graphics . Paint ; import android . graphics . Paint . Cap ; import android . graphics . Path ; import android . graphics . Point ; import android . graphics . PointF ; import android . graphics . PorterDuff ; import android . graphics . PorterDuffXfermode ; import android . graphics . Rect ; import android . graphics . Shader ; import android . graphics . Xfermode ; import android . util . Log ; import android . view . SurfaceHolder ; import at . droidcode . commands . Command ; import at . droidcode . commands . CommandManager ; import at . droidcode . threadpaint . R ; import at . droidcode . threadpaint . TpApplication ; import at . droidcode . threadpaint . dialog . BrushPickerDialog ; import at . droidcode . threadpaint . dialog . ColorPickerDialog ; public class PaintRunner extends TpRunner implements ColorPickerDialog . OnPaintChangedListener , BrushPickerDialog . OnBrushChangedListener { private Bitmap drawingBitmap ; private final Path pathToDraw ; private final Canvas bitmapCanvas ; private final Rect rectSurface ; private final Rect rectBitmap ; private final PointF surfaceCenter ; private final Point scroll ; private float zoom ; private final Paint bitmapPathPaint ; private final Paint canvasPathPaint ; private final Paint checkeredPattern ; private final Xfermode eraseXfermode ; private final SurfaceHolder surfaceHolder ; private final CommandManager commandManager ; private class DrawLoop implements Runnable { @ Override public void run ( ) { Canvas canvas = null ; try { canvas = surfaceHolder . lockCanvas ( ) ; doDraw ( canvas ) ; } finally { if ( canvas != null ) { surfaceHolder . unlockCanvasAndPost ( canvas ) ; } } } } public PaintRunner ( PaintView paintView ) { surfaceHolder = paintView . getHolder ( ) ; commandManager = new CommandManager ( ) ; super . setRunnable ( new DrawLoop ( ) ) ; pathToDraw = new Path ( ) ; pathToDraw . incReserve ( <NUM_LIT> ) ; bitmapCanvas = new Canvas ( ) ; rectSurface = new Rect ( ) ; rectBitmap = new Rect ( ) ; surfaceCenter = new PointF ( ) ; scroll = new Point ( <NUM_LIT:0> , <NUM_LIT:0> ) ; zoom = <NUM_LIT> ; final TpApplication appContext = ( TpApplication ) paintView . getContext ( ) . getApplicationContext ( ) ; final int color = appContext . getResources ( ) . getColor ( R . color . stroke_standard ) ; bitmapPathPaint = new Paint ( ) ; bitmapPathPaint . setColor ( color ) ; bitmapPathPaint . setAntiAlias ( true ) ; bitmapPathPaint . setDither ( true ) ; bitmapPathPaint . setStyle ( Paint . Style . STROKE ) ; bitmapPathPaint . setStrokeJoin ( Paint . Join . ROUND ) ; bitmapPathPaint . setStrokeCap ( Paint . Cap . ROUND ) ; bitmapPathPaint . setStrokeWidth ( appContext . maxStrokeWidth ( ) / <NUM_LIT:2> ) ; canvasPathPaint = new Paint ( bitmapPathPaint ) ; Bitmap checkerboard = BitmapFactory . decodeResource ( appContext . getResources ( ) , R . drawable . transparent ) ; BitmapShader shader = new BitmapShader ( checkerboard , Shader . TileMode . REPEAT , Shader . TileMode . REPEAT ) ; checkeredPattern = new Paint ( ) ; checkeredPattern . setShader ( shader ) ; eraseXfermode = new PorterDuffXfermode ( PorterDuff . Mode . CLEAR ) ; } @ Override public synchronized void stop ( ) { super . stop ( ) ; commandManager . clear ( ) ; drawingBitmap . recycle ( ) ; drawingBitmap = null ; } private void doDraw ( Canvas canvas ) { canvas . scale ( zoom , zoom , surfaceCenter . x , surfaceCenter . y ) ; canvas . translate ( scroll . x , scroll . y ) ; canvas . drawPaint ( checkeredPattern ) ; canvas . drawBitmap ( drawingBitmap , <NUM_LIT:0> , <NUM_LIT:0> , null ) ; canvas . drawPath ( pathToDraw , canvasPathPaint ) ; } @ Override public void colorChanged ( int color ) { bitmapPathPaint . setColor ( color ) ; canvasPathPaint . setColor ( color ) ; if ( Color . alpha ( color ) == <NUM_LIT:0x00> ) { bitmapPathPaint . setXfermode ( eraseXfermode ) ; canvasPathPaint . reset ( ) ; canvasPathPaint . setStyle ( bitmapPathPaint . getStyle ( ) ) ; canvasPathPaint . setStrokeJoin ( bitmapPathPaint . getStrokeJoin ( ) ) ; canvasPathPaint . setStrokeCap ( bitmapPathPaint . getStrokeCap ( ) ) ; canvasPathPaint . setStrokeWidth ( bitmapPathPaint . getStrokeWidth ( ) ) ; canvasPathPaint . setShader ( checkeredPattern . getShader ( ) ) ; } else { bitmapPathPaint . setXfermode ( null ) ; canvasPathPaint . set ( bitmapPathPaint ) ; } } @ Override public void capChanged ( Cap cap ) { bitmapPathPaint . setStrokeCap ( cap ) ; canvasPathPaint . setStrokeCap ( cap ) ; } @ Override public void strokeChanged ( int width ) { bitmapPathPaint . setStrokeWidth ( width ) ; canvasPathPaint . setStrokeWidth ( width ) ; } void setSurfaceSize ( int width , int height ) { synchronized ( pThread ) { resetPerspective ( ) ; rectSurface . set ( <NUM_LIT:0> , <NUM_LIT:0> , width , height ) ; surfaceCenter . x = rectSurface . exactCenterX ( ) ; surfaceCenter . y = rectSurface . exactCenterY ( ) ; if ( drawingBitmap == null ) { Log . w ( TpApplication . TAG , "<STR_LIT>" ) ; drawingBitmap = Bitmap . createBitmap ( width , height , Config . ARGB_8888 ) ; rectBitmap . set ( <NUM_LIT:0> , <NUM_LIT:0> , width , height ) ; bitmapCanvas . setBitmap ( drawingBitmap ) ; commandManager . reset ( drawingBitmap ) ; } } } void setBitmap ( Bitmap bitmap ) { synchronized ( pThread ) { if ( drawingBitmap != null ) { drawingBitmap . recycle ( ) ; } resetPerspective ( ) ; drawingBitmap = bitmap ; commandManager . reset ( bitmap ) ; bitmapCanvas . setBitmap ( drawingBitmap ) ; rectBitmap . set ( <NUM_LIT:0> , <NUM_LIT:0> , bitmap . getWidth ( ) , bitmap . getHeight ( ) ) ; } } Bitmap getBitmap ( ) { return drawingBitmap ; } Paint getPaint ( ) { return bitmapPathPaint ; } float getZoom ( ) { return zoom ; } void startPath ( float x , float y ) { pathToDraw . rewind ( ) ; translate ( x , y ) ; pathToDraw . moveTo ( translate . x , translate . y ) ; } void updatePath ( float x1 , float y1 , float x2 , float y2 ) { translate ( ( x1 + x2 ) / <NUM_LIT> , ( y1 + y2 ) / <NUM_LIT> ) ; float cx = translate . x ; float cy = translate . y ; translate ( x2 , y2 ) ; pathToDraw . quadTo ( cx , cy , translate . x , translate . y ) ; } void finishPath ( ) { synchronized ( pThread ) { Command command = new Command ( bitmapPathPaint , pathToDraw ) ; commandManager . commitCommand ( command , bitmapCanvas ) ; pathToDraw . rewind ( ) ; } } void drawPoint ( float x , float y ) { synchronized ( pThread ) { translate ( x , y ) ; Command command = new Command ( bitmapPathPaint , translate ) ; commandManager . commitCommand ( command , bitmapCanvas ) ; } } void scroll ( int dx , int dy ) { synchronized ( pThread ) { float surfaceZoomedWidth = rectSurface . right / zoom ; float surfaceZoomedHeight = rectSurface . bottom / zoom ; if ( ( surfaceZoomedWidth - rectBitmap . right ) > <NUM_LIT:0> && ( surfaceZoomedHeight - rectBitmap . bottom ) > <NUM_LIT:0> ) { scroll . set ( <NUM_LIT:0> , <NUM_LIT:0> ) ; } else { scroll . offset ( Math . round ( dx / zoom ) , Math . round ( dy / zoom ) ) ; float pivotX = surfaceCenter . x - ( surfaceCenter . x / zoom ) ; float pivotY = surfaceCenter . y - ( surfaceCenter . y / zoom ) ; float xMax = ( surfaceZoomedWidth - rectBitmap . right ) + pivotX ; float yMax = ( surfaceZoomedHeight - rectBitmap . bottom ) + pivotY ; if ( scroll . x < xMax ) { scroll . x = Math . round ( xMax ) ; } if ( scroll . y < yMax ) { scroll . y = Math . round ( yMax ) ; } if ( scroll . x - pivotX > <NUM_LIT:0> ) { scroll . x = Math . round ( pivotX ) ; } if ( scroll . y - pivotY > <NUM_LIT:0> ) { scroll . y = Math . round ( pivotY ) ; } } } } void zoom ( float scale ) { synchronized ( pThread ) { if ( zoom >= <NUM_LIT:1> ) { zoom = scale ; } if ( zoom < <NUM_LIT:1> ) { zoom = <NUM_LIT:1> ; } } } private final Point translate = new Point ( ) ; private void translate ( float x , float y ) { translate . x = ( int ) ( ( x - surfaceCenter . x ) / zoom + surfaceCenter . x - scroll . x ) ; translate . y = ( int ) ( ( y - surfaceCenter . y ) / zoom + surfaceCenter . y - scroll . y ) ; } private void resetPerspective ( ) { zoom = <NUM_LIT> ; scroll . set ( <NUM_LIT:0> , <NUM_LIT:0> ) ; bitmapCanvas . setMatrix ( null ) ; } void fillWithPaint ( ) { Command command = new Command ( bitmapPathPaint ) ; commandManager . commitCommand ( command , bitmapCanvas ) ; } void resetCanvas ( ) { Bitmap bitmap = Bitmap . createBitmap ( rectSurface . right , rectSurface . bottom , Config . ARGB_8888 ) ; setBitmap ( bitmap ) ; } void undo ( ) { synchronized ( pThread ) { commandManager . undoLast ( bitmapCanvas ) ; } } void redo ( ) { synchronized ( pThread ) { commandManager . redoLast ( bitmapCanvas ) ; } } } </s>
|
<s> package at . droidcode . threadpaint . ui ; import static at . droidcode . threadpaint . TpApplication . TAG ; import android . content . Context ; import android . graphics . Bitmap ; import android . graphics . Paint ; import android . os . Bundle ; import android . util . AttributeSet ; import android . util . FloatMath ; import android . util . Log ; import android . view . MotionEvent ; import android . view . SurfaceHolder ; import android . view . SurfaceView ; import android . view . View ; import at . droidcode . threadpaint . api . ToolButtonAnimator ; import at . droidcode . threadpaint . dialog . BrushPickerDialog . OnBrushChangedListener ; import at . droidcode . threadpaint . dialog . ColorPickerDialog . OnPaintChangedListener ; public class PaintView extends SurfaceView implements SurfaceHolder . Callback , View . OnTouchListener { public enum Tool { BRUSH , MOVE , ERASE } ; private Tool selectedTool ; private float moveThreshold ; private final PaintRunner paintRunner ; private ToolButtonAnimator toolButtonAnimator ; private static final String STATE_BITMAP = "<STR_LIT>" ; public PaintView ( Context context , AttributeSet attrs ) { super ( context , attrs ) ; Log . d ( TAG , "<STR_LIT>" ) ; SurfaceHolder holder = getHolder ( ) ; holder . addCallback ( this ) ; setFocusable ( true ) ; setOnTouchListener ( this ) ; selectedTool = Tool . BRUSH ; moveThreshold = <NUM_LIT:1.0f> ; paintRunner = new PaintRunner ( this ) ; } @ Override public void surfaceChanged ( SurfaceHolder holder , int format , int width , int height ) { Log . w ( TAG , "<STR_LIT>" ) ; paintRunner . setSurfaceSize ( width , height ) ; } @ Override public void surfaceCreated ( SurfaceHolder holder ) { Log . w ( TAG , "<STR_LIT>" ) ; paintRunner . start ( ) ; } @ Override public void surfaceDestroyed ( SurfaceHolder holder ) { Log . w ( TAG , "<STR_LIT>" ) ; paintRunner . setPaused ( true ) ; } public synchronized void saveState ( Bundle b ) { b . putParcelable ( STATE_BITMAP , getBitmap ( ) ) ; } public synchronized void restoreState ( Bundle savedState ) { Log . d ( TAG , "<STR_LIT>" ) ; Bitmap savedBmp = ( Bitmap ) savedState . getParcelable ( STATE_BITMAP ) ; if ( ! savedBmp . isRecycled ( ) ) { paintRunner . setBitmap ( savedBmp ) ; } } public void stopPaintThread ( ) { paintRunner . stop ( ) ; } public void setToolButtonAnimator ( ToolButtonAnimator animator ) { toolButtonAnimator = animator ; } public void setMoveThreshold ( float f ) { moveThreshold = f ; } public Tool selectedTool ( ) { return selectedTool ; } public void selectTool ( Tool tool ) { selectedTool = tool ; } public Bitmap getBitmap ( ) { return paintRunner . getBitmap ( ) ; } public Paint getPathPaint ( ) { return paintRunner . getPaint ( ) ; } public synchronized void setBitmap ( Bitmap bitmap ) { Log . d ( TAG , "<STR_LIT>" ) ; paintRunner . setBitmap ( bitmap ) ; } public void setPaintColor ( int color ) { paintRunner . colorChanged ( color ) ; } public void fillWithPaint ( ) { paintRunner . fillWithPaint ( ) ; } public void resetCanvas ( ) { paintRunner . resetCanvas ( ) ; } public void undo ( ) { paintRunner . undo ( ) ; } public void redo ( ) { paintRunner . redo ( ) ; } public OnPaintChangedListener getOnPaintChangedListener ( ) { return paintRunner ; } public OnBrushChangedListener getOnBrushChangedListener ( ) { return paintRunner ; } private float xTouchCoordinate ; private float yTouchCoordinate ; private float previousX ; private float previousY ; private float oldDist ; private boolean hasMoved ; private boolean pinchToZoom ; @ Override public boolean onTouch ( View v , MotionEvent event ) { xTouchCoordinate = event . getX ( ) ; yTouchCoordinate = event . getY ( ) ; switch ( event . getAction ( ) ) { case MotionEvent . ACTION_DOWN : previousX = xTouchCoordinate ; previousY = yTouchCoordinate ; hasMoved = false ; break ; case MotionEvent . ACTION_MOVE : float dx = Math . abs ( xTouchCoordinate - previousX ) ; float dy = Math . abs ( yTouchCoordinate - previousY ) ; if ( dx > moveThreshold || dy > moveThreshold ) { hasMoved = true ; } break ; } handlePinchToZoom ( event ) ; if ( ! pinchToZoom ) { switch ( selectedTool ) { case ERASE : case BRUSH : handleBrushTool ( event ) ; break ; case MOVE : handleMoveTool ( event ) ; break ; } } previousX = xTouchCoordinate ; previousY = yTouchCoordinate ; return true ; } private void handleBrushTool ( MotionEvent event ) { switch ( event . getAction ( ) ) { case MotionEvent . ACTION_DOWN : paintRunner . startPath ( xTouchCoordinate , yTouchCoordinate ) ; toolButtonAnimator . fadeOutToolButtons ( ) ; break ; case MotionEvent . ACTION_MOVE : if ( hasMoved ) { paintRunner . updatePath ( previousX , previousY , xTouchCoordinate , yTouchCoordinate ) ; } break ; case MotionEvent . ACTION_UP : if ( hasMoved ) { paintRunner . finishPath ( ) ; } else { paintRunner . drawPoint ( xTouchCoordinate , yTouchCoordinate ) ; } toolButtonAnimator . fadeInToolButtons ( ) ; break ; } } private float spacing ( MotionEvent event ) { float x = event . getX ( <NUM_LIT:0> ) - event . getX ( <NUM_LIT:1> ) ; float y = event . getY ( <NUM_LIT:0> ) - event . getY ( <NUM_LIT:1> ) ; return FloatMath . sqrt ( x * x + y * y ) ; } private void handleMoveTool ( MotionEvent event ) { switch ( event . getAction ( ) ) { case MotionEvent . ACTION_MOVE : int dx = Math . round ( xTouchCoordinate - previousX ) ; int dy = Math . round ( yTouchCoordinate - previousY ) ; paintRunner . scroll ( dx , dy ) ; break ; } } private void handlePinchToZoom ( MotionEvent event ) { switch ( event . getAction ( ) ) { case MotionEvent . ACTION_POINTER_2_DOWN : oldDist = spacing ( event ) / paintRunner . getZoom ( ) ; pinchToZoom = true ; break ; case MotionEvent . ACTION_MOVE : if ( pinchToZoom ) { float newDist = spacing ( event ) ; if ( newDist > <NUM_LIT:10> ) { float scale = newDist / oldDist ; paintRunner . zoom ( scale ) ; } } break ; default : pinchToZoom = false ; } } } </s>
|
<s> package at . droidcode . threadpaint . ui ; import static at . droidcode . threadpaint . TpApplication . TAG ; import java . lang . Thread . State ; import android . util . Log ; import at . droidcode . threadpaint . TpApplication ; public class TpRunner { protected final Thread pThread ; private Runnable pRunnable ; private boolean running ; private boolean paused ; public TpRunner ( ) { pThread = new Thread ( new InternalRunnable ( ) ) ; pThread . setDaemon ( true ) ; } private class InternalRunnable implements Runnable { @ Override public void run ( ) { internalRun ( ) ; } } private void internalRun ( ) { while ( running ) { synchronized ( pThread ) { if ( paused ) { try { pThread . wait ( ) ; } catch ( InterruptedException e ) { Log . e ( TpApplication . TAG , "<STR_LIT>" , e ) ; } } else { pRunnable . run ( ) ; } } } } public synchronized void setRunnable ( Runnable runnable ) { pRunnable = runnable ; } public synchronized void start ( ) { if ( pRunnable == null || pThread . getState ( ) . equals ( State . TERMINATED ) ) { return ; } running = true ; if ( paused ) { setPaused ( false ) ; } else { pThread . start ( ) ; } } public synchronized void stop ( ) { running = false ; setPaused ( false ) ; if ( pThread . isAlive ( ) ) { boolean retry = true ; while ( retry ) { try { pThread . join ( ) ; retry = false ; } catch ( InterruptedException e ) { Log . e ( TAG , "<STR_LIT>" , e ) ; } } } } public synchronized void setPaused ( boolean pause ) { synchronized ( pThread ) { if ( ! pause && paused ) { pThread . notify ( ) ; } paused = pause ; } } } </s>
|
<s> package at . droidcode . threadpaint ; import java . util . ArrayList ; import java . util . Hashtable ; import java . util . Map ; import android . content . SharedPreferences ; import android . content . SharedPreferences . OnSharedPreferenceChangeListener ; import android . os . Bundle ; import android . preference . PreferenceActivity ; import android . preference . PreferenceManager ; import at . droidcode . threadpaint . api . PreferencesCallback ; public class TpPreferencesActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener , PreferencesCallback { public enum Preference { LOCKORIENTATION ( "<STR_LIT>" ) , MOVETHRESHOLD ( "<STR_LIT>" ) ; private final String key ; Preference ( String k ) { key = k ; } String key ( ) { return key ; } } private static final Map < String , ArrayList < PreferencesCallback > > ACTIVITY_DIRECTORY = new Hashtable < String , ArrayList < PreferencesCallback > > ( ) ; @ Override public void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; addPreferencesFromResource ( R . xml . preferences ) ; final SharedPreferences prefs = PreferenceManager . getDefaultSharedPreferences ( getApplicationContext ( ) ) ; prefs . registerOnSharedPreferenceChangeListener ( this ) ; addCallbackForPreference ( this , Preference . LOCKORIENTATION ) ; } @ Override public void onDestroy ( ) { removeCallback ( this ) ; super . onDestroy ( ) ; } public static void addCallbackForPreference ( PreferencesCallback c , Preference preference ) { if ( ACTIVITY_DIRECTORY . containsKey ( preference . key ( ) ) ) { ACTIVITY_DIRECTORY . get ( preference . key ( ) ) . add ( c ) ; } else { final ArrayList < PreferencesCallback > list = new ArrayList < PreferencesCallback > ( <NUM_LIT:1> ) ; list . add ( c ) ; ACTIVITY_DIRECTORY . put ( preference . key ( ) , list ) ; } } public static boolean removeCallback ( PreferencesCallback c ) { boolean result = false ; for ( Preference p : Preference . values ( ) ) { ArrayList < PreferencesCallback > list = ACTIVITY_DIRECTORY . get ( p ) ; if ( list != null ) { list . remove ( c ) ; } } return result ; } @ Override public void onSharedPreferenceChanged ( SharedPreferences sharedPreferences , String key ) { ArrayList < PreferencesCallback > callbacks = ACTIVITY_DIRECTORY . get ( key ) ; if ( callbacks != null ) { for ( int i = <NUM_LIT:0> ; i < callbacks . size ( ) ; i ++ ) { callbacks . get ( i ) . preferenceChanged ( sharedPreferences , key ) ; } } } @ Override public void preferenceChanged ( SharedPreferences preferences , String key ) { if ( key . equals ( Preference . LOCKORIENTATION . key ( ) ) ) { boolean lock = preferences . getBoolean ( key , true ) ; Utils . lockScreenOrientation ( lock , this ) ; } } } </s>
|
<s> package com . datastax . tutorial ; import me . prettyprint . hector . api . Keyspace ; import me . prettyprint . hector . api . beans . OrderedRows ; import me . prettyprint . hector . api . factory . HFactory ; import me . prettyprint . hector . api . query . QueryResult ; import me . prettyprint . hector . api . query . RangeSlicesQuery ; public class GetRangeSlicesForStateCity extends TutorialCommand { public GetRangeSlicesForStateCity ( Keyspace keyspace ) { super ( keyspace ) ; } @ Override public QueryResult < OrderedRows < String , String , String > > execute ( ) { RangeSlicesQuery < String , String , String > rangeSlicesQuery = HFactory . createRangeSlicesQuery ( keyspace , stringSerializer , stringSerializer , stringSerializer ) ; rangeSlicesQuery . setColumnFamily ( "<STR_LIT>" ) ; rangeSlicesQuery . setColumnNames ( "<STR_LIT>" , "<STR_LIT:state>" , "<STR_LIT>" , "<STR_LIT>" ) ; rangeSlicesQuery . setKeys ( "<STR_LIT>" , "<STR_LIT>" ) ; rangeSlicesQuery . setRowCount ( <NUM_LIT:5> ) ; QueryResult < OrderedRows < String , String , String > > results = rangeSlicesQuery . execute ( ) ; return results ; } } </s>
|
<s> package com . datastax . tutorial ; import me . prettyprint . cassandra . serializers . LongSerializer ; import me . prettyprint . cassandra . serializers . StringSerializer ; import me . prettyprint . hector . api . Keyspace ; import me . prettyprint . hector . api . ResultStatus ; import me . prettyprint . hector . api . Serializer ; import me . prettyprint . hector . api . query . QueryResult ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; public abstract class TutorialCommand { protected Logger log = LoggerFactory . getLogger ( TutorialCommand . class ) ; protected Keyspace keyspace ; public TutorialCommand ( Keyspace keyspace ) { this . keyspace = keyspace ; } public abstract ResultStatus execute ( ) ; static StringSerializer stringSerializer = StringSerializer . get ( ) ; static LongSerializer longSerializer = LongSerializer . get ( ) ; } </s>
|
<s> package com . datastax . tutorial ; import me . prettyprint . cassandra . model . HColumnImpl ; import me . prettyprint . cassandra . serializers . DynamicCompositeSerializer ; import me . prettyprint . cassandra . serializers . LongSerializer ; import me . prettyprint . hector . api . Keyspace ; import me . prettyprint . hector . api . ResultStatus ; import me . prettyprint . hector . api . beans . AbstractComposite ; import me . prettyprint . hector . api . beans . ColumnSlice ; import me . prettyprint . hector . api . beans . Composite ; import me . prettyprint . hector . api . beans . DynamicComposite ; import me . prettyprint . hector . api . factory . HFactory ; import me . prettyprint . hector . api . mutation . Mutator ; import me . prettyprint . hector . api . query . QueryResult ; import me . prettyprint . hector . api . query . SliceQuery ; public class DynamicCompositeIndex extends TutorialCommand { private static DynamicCompositeSerializer dcs = new DynamicCompositeSerializer ( ) ; public DynamicCompositeIndex ( Keyspace keyspace ) { super ( keyspace ) ; } @ Override public ResultStatus execute ( ) { Mutator < String > mutator = HFactory . createMutator ( keyspace , stringSerializer ) ; HColumnImpl < DynamicComposite , String > column = new HColumnImpl < DynamicComposite , String > ( dcs , stringSerializer ) ; column . setClock ( keyspace . createClock ( ) ) ; DynamicComposite dc = new DynamicComposite ( ) ; dc . add ( <NUM_LIT:0> , "<STR_LIT>" ) ; dc . add ( <NUM_LIT:1> , <NUM_LIT> ) ; dc . add ( <NUM_LIT:2> , <NUM_LIT> ) ; column . setName ( dc ) ; column . setValue ( "<STR_LIT>" ) ; mutator . addInsertion ( "<STR_LIT>" , "<STR_LIT>" , column ) ; column = new HColumnImpl < DynamicComposite , String > ( dcs , stringSerializer ) ; column . setClock ( keyspace . createClock ( ) ) ; dc = new DynamicComposite ( ) ; dc . add ( <NUM_LIT:0> , "<STR_LIT>" ) ; column . setName ( dc ) ; column . setValue ( "<STR_LIT>" ) ; mutator . addInsertion ( "<STR_LIT>" , "<STR_LIT>" , column ) ; column = new HColumnImpl < DynamicComposite , String > ( dcs , stringSerializer ) ; column . setClock ( keyspace . createClock ( ) ) ; dc = new DynamicComposite ( ) ; dc . add ( <NUM_LIT:0> , "<STR_LIT>" ) ; dc . add ( <NUM_LIT:1> , <NUM_LIT> ) ; dc . add ( <NUM_LIT:2> , <NUM_LIT> ) ; column . setName ( dc ) ; column . setValue ( "<STR_LIT>" ) ; mutator . addInsertion ( "<STR_LIT>" , "<STR_LIT>" , column ) ; column = new HColumnImpl < DynamicComposite , String > ( dcs , stringSerializer ) ; column . setClock ( keyspace . createClock ( ) ) ; dc = new DynamicComposite ( ) ; dc . add ( <NUM_LIT:0> , "<STR_LIT>" ) ; dc . add ( <NUM_LIT:1> , <NUM_LIT> ) ; column . setName ( dc ) ; column . setValue ( "<STR_LIT>" ) ; mutator . addInsertion ( "<STR_LIT>" , "<STR_LIT>" , column ) ; column = new HColumnImpl < DynamicComposite , String > ( dcs , stringSerializer ) ; column . setClock ( keyspace . createClock ( ) ) ; dc = new DynamicComposite ( ) ; dc . add ( <NUM_LIT:0> , "<STR_LIT>" ) ; dc . add ( <NUM_LIT:1> , <NUM_LIT> ) ; dc . add ( <NUM_LIT:2> , <NUM_LIT> ) ; column . setName ( dc ) ; column . setValue ( "<STR_LIT>" ) ; mutator . addInsertion ( "<STR_LIT>" , "<STR_LIT>" , column ) ; column = new HColumnImpl < DynamicComposite , String > ( dcs , stringSerializer ) ; column . setClock ( keyspace . createClock ( ) ) ; dc = new DynamicComposite ( ) ; dc . add ( <NUM_LIT:0> , "<STR_LIT>" ) ; dc . add ( <NUM_LIT:1> , <NUM_LIT> ) ; dc . add ( <NUM_LIT:2> , <NUM_LIT> ) ; column . setName ( dc ) ; column . setValue ( "<STR_LIT>" ) ; mutator . addInsertion ( "<STR_LIT>" , "<STR_LIT>" , column ) ; column = new HColumnImpl < DynamicComposite , String > ( dcs , stringSerializer ) ; column . setClock ( keyspace . createClock ( ) ) ; dc = new DynamicComposite ( ) ; dc . add ( <NUM_LIT:0> , "<STR_LIT>" ) ; dc . add ( <NUM_LIT:1> , <NUM_LIT> ) ; dc . add ( <NUM_LIT:2> , <NUM_LIT> ) ; column . setName ( dc ) ; column . setValue ( "<STR_LIT>" ) ; mutator . addInsertion ( "<STR_LIT>" , "<STR_LIT>" , column ) ; mutator . execute ( ) ; SliceQuery < String , DynamicComposite , String > sliceQuery = HFactory . createSliceQuery ( keyspace , stringSerializer , dcs , stringSerializer ) ; sliceQuery . setColumnFamily ( "<STR_LIT>" ) ; sliceQuery . setKey ( "<STR_LIT>" ) ; DynamicComposite startRange = new DynamicComposite ( ) ; startRange . add ( <NUM_LIT:0> , "<STR_LIT>" ) ; DynamicComposite endRange = new DynamicComposite ( ) ; endRange . add ( <NUM_LIT:0> , "<STR_LIT>" ) ; endRange . addComponent ( new Long ( <NUM_LIT> ) , LongSerializer . get ( ) , "<STR_LIT>" , AbstractComposite . ComponentEquality . GREATER_THAN_EQUAL ) ; sliceQuery . setRange ( startRange , endRange , false , <NUM_LIT:10> ) ; QueryResult < ColumnSlice < DynamicComposite , String > > result = sliceQuery . execute ( ) ; return result ; } } </s>
|
<s> package com . datastax . tutorial ; import me . prettyprint . cassandra . model . IndexedSlicesQuery ; import me . prettyprint . hector . api . Keyspace ; import me . prettyprint . hector . api . beans . OrderedRows ; import me . prettyprint . hector . api . factory . HFactory ; import me . prettyprint . hector . api . query . QueryResult ; public class GetIndexedSlicesForCityState extends TutorialCommand { public GetIndexedSlicesForCityState ( Keyspace keyspace ) { super ( keyspace ) ; } @ Override public QueryResult < OrderedRows < String , String , String > > execute ( ) { IndexedSlicesQuery < String , String , String > indexedSlicesQuery = HFactory . createIndexedSlicesQuery ( keyspace , stringSerializer , stringSerializer , stringSerializer ) ; indexedSlicesQuery . setColumnFamily ( "<STR_LIT>" ) ; indexedSlicesQuery . setColumnNames ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; indexedSlicesQuery . addEqualsExpression ( "<STR_LIT:state>" , "<STR_LIT>" ) ; indexedSlicesQuery . addEqualsExpression ( "<STR_LIT>" , "<STR_LIT>" ) ; indexedSlicesQuery . addGteExpression ( "<STR_LIT>" , "<STR_LIT>" ) ; QueryResult < OrderedRows < String , String , String > > result = indexedSlicesQuery . execute ( ) ; return result ; } } </s>
|
<s> package com . datastax . tutorial ; import me . prettyprint . hector . api . Keyspace ; import me . prettyprint . hector . api . factory . HFactory ; import me . prettyprint . hector . api . mutation . MutationResult ; import me . prettyprint . hector . api . mutation . Mutator ; import me . prettyprint . hector . api . query . QueryResult ; public class DeleteRowsForColumnFamily extends TutorialCommand { public DeleteRowsForColumnFamily ( Keyspace keyspace ) { super ( keyspace ) ; } @ Override public QueryResult < ? > execute ( ) { Mutator < String > mutator = HFactory . createMutator ( keyspace , stringSerializer ) ; mutator . addDeletion ( "<STR_LIT>" , "<STR_LIT>" , null , stringSerializer ) ; mutator . addDeletion ( "<STR_LIT>" , "<STR_LIT>" , null , stringSerializer ) ; mutator . addDeletion ( "<STR_LIT>" , "<STR_LIT>" , null , stringSerializer ) ; MutationResult mr = mutator . execute ( ) ; return null ; } } </s>
|
<s> package com . datastax . tutorial ; import java . io . BufferedReader ; import java . io . FileInputStream ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . List ; import java . util . concurrent . Callable ; import java . util . concurrent . ExecutorService ; import java . util . concurrent . Executors ; import java . util . concurrent . Future ; import me . prettyprint . cassandra . serializers . StringSerializer ; import me . prettyprint . hector . api . factory . HFactory ; import me . prettyprint . hector . api . mutation . Mutator ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; public class NpanxxDatasetLoader extends TutorialBase { private static Logger log = LoggerFactory . getLogger ( NpanxxDatasetLoader . class ) ; private static ExecutorService exec ; public static void main ( String [ ] args ) { long startTime = System . currentTimeMillis ( ) ; init ( ) ; String fileLocation = properties . getProperty ( "<STR_LIT>" ) ; BufferedReader reader ; exec = Executors . newFixedThreadPool ( <NUM_LIT:10> ) ; try { reader = new BufferedReader ( new InputStreamReader ( new FileInputStream ( fileLocation ) ) ) ; List < String > lines = new ArrayList < String > ( <NUM_LIT:1000> ) ; String line = reader . readLine ( ) ; List < Future < Integer > > sums = new ArrayList < Future < Integer > > ( ) ; while ( line != null ) { lines . add ( line ) ; if ( lines . size ( ) % <NUM_LIT:1000> == <NUM_LIT:0> ) { doParse ( lines , sums ) ; } line = reader . readLine ( ) ; } doParse ( lines , sums ) ; int total = <NUM_LIT:0> ; for ( Future < Integer > future : sums ) { total = total + future . get ( ) . intValue ( ) ; } log . info ( "<STR_LIT>" , total ) ; log . info ( "<STR_LIT>" , System . currentTimeMillis ( ) - startTime ) ; } catch ( Exception e ) { log . error ( "<STR_LIT>" , e ) ; } finally { exec . shutdown ( ) ; } tutorialCluster . getConnectionManager ( ) . shutdown ( ) ; } private static void doParse ( List < String > lines , List < Future < Integer > > sums ) { Future < Integer > f = exec . submit ( new NpanxxDatasetLoader ( ) . new LineParser ( new ArrayList ( lines ) ) ) ; sums . add ( f ) ; lines . clear ( ) ; } class LineParser implements Callable < Integer > { List < String > lines ; LineParser ( List < String > lines ) { this . lines = lines ; } public Integer call ( ) throws Exception { int count = <NUM_LIT:0> ; NpanxxLine npanxxLine ; Mutator < String > mutator = HFactory . createMutator ( tutorialKeyspace , StringSerializer . get ( ) ) ; for ( String row : lines ) { npanxxLine = new NpanxxLine ( row ) ; String key = npanxxLine . getNpa ( ) + npanxxLine . getNxx ( ) ; mutator . addInsertion ( key , "<STR_LIT>" , HFactory . createStringColumn ( "<STR_LIT>" , npanxxLine . getCity ( ) ) ) ; mutator . addInsertion ( key , "<STR_LIT>" , HFactory . createStringColumn ( "<STR_LIT>" , Double . toString ( npanxxLine . getLat ( ) ) ) ) ; mutator . addInsertion ( key , "<STR_LIT>" , HFactory . createStringColumn ( "<STR_LIT>" , Double . toString ( npanxxLine . getLng ( ) ) ) ) ; mutator . addInsertion ( key , "<STR_LIT>" , HFactory . createStringColumn ( "<STR_LIT:state>" , npanxxLine . getState ( ) ) ) ; if ( count % <NUM_LIT> == <NUM_LIT:0> ) { mutator . execute ( ) ; mutator . discardPendingMutations ( ) ; } count ++ ; } mutator . execute ( ) ; log . info ( "<STR_LIT>" , count ) ; return Integer . valueOf ( count ) ; } } static class NpanxxLine { private String [ ] vals = new String [ <NUM_LIT:10> ] ; NpanxxLine ( String line ) { vals = line . split ( "<STR_LIT>" ) ; } String getNpa ( ) { return vals [ <NUM_LIT:0> ] ; } String getNxx ( ) { return vals [ <NUM_LIT:1> ] ; } double getLat ( ) { return Double . parseDouble ( vals [ <NUM_LIT:2> ] ) ; } double getLng ( ) { return Double . parseDouble ( vals [ <NUM_LIT:3> ] ) ; } String getState ( ) { return vals [ <NUM_LIT:5> ] ; } String getCity ( ) { StringBuilder cityName = new StringBuilder ( <NUM_LIT> ) ; for ( int i = <NUM_LIT:6> ; i < vals . length ; i ++ ) { cityName . append ( vals [ i ] ) . append ( "<STR_LIT:U+0020>" ) ; } return cityName . toString ( ) ; } } } </s>
|
<s> package com . datastax . tutorial ; import me . prettyprint . cassandra . model . HColumnImpl ; import me . prettyprint . cassandra . serializers . CompositeSerializer ; import me . prettyprint . cassandra . serializers . StringSerializer ; import me . prettyprint . hector . api . Keyspace ; import me . prettyprint . hector . api . ResultStatus ; import me . prettyprint . hector . api . beans . ColumnSlice ; import me . prettyprint . hector . api . beans . Composite ; import me . prettyprint . hector . api . beans . HColumn ; import me . prettyprint . hector . api . factory . HFactory ; import me . prettyprint . hector . api . mutation . Mutator ; import me . prettyprint . hector . api . query . QueryResult ; import me . prettyprint . hector . api . query . SliceQuery ; public class StaticCompositeIndex extends TutorialCommand { private static final CompositeSerializer cs = new CompositeSerializer ( ) ; public StaticCompositeIndex ( Keyspace keyspace ) { super ( keyspace ) ; } @ Override public ResultStatus execute ( ) { Mutator < String > mutator = HFactory . createMutator ( keyspace , stringSerializer ) ; HColumnImpl < Composite , String > column = new HColumnImpl < Composite , String > ( cs , stringSerializer ) ; column . setClock ( keyspace . createClock ( ) ) ; Composite dc = new Composite ( ) ; dc . add ( <NUM_LIT:0> , "<STR_LIT>" ) ; dc . add ( <NUM_LIT:1> , <NUM_LIT> ) ; dc . add ( <NUM_LIT:2> , <NUM_LIT> ) ; column . setName ( dc ) ; column . setValue ( "<STR_LIT>" ) ; mutator . addInsertion ( "<STR_LIT>" , "<STR_LIT>" , column ) ; column = new HColumnImpl < Composite , String > ( cs , stringSerializer ) ; column . setClock ( keyspace . createClock ( ) ) ; dc = new Composite ( ) ; dc . add ( <NUM_LIT:0> , "<STR_LIT>" ) ; dc . add ( <NUM_LIT:1> , <NUM_LIT> ) ; dc . add ( <NUM_LIT:2> , <NUM_LIT> ) ; column . setName ( dc ) ; column . setValue ( "<STR_LIT>" ) ; mutator . addInsertion ( "<STR_LIT>" , "<STR_LIT>" , column ) ; column = new HColumnImpl < Composite , String > ( cs , stringSerializer ) ; column . setClock ( keyspace . createClock ( ) ) ; dc = new Composite ( ) ; dc . add ( <NUM_LIT:0> , "<STR_LIT>" ) ; dc . add ( <NUM_LIT:1> , <NUM_LIT> ) ; dc . add ( <NUM_LIT:2> , <NUM_LIT> ) ; column . setName ( dc ) ; column . setValue ( "<STR_LIT>" ) ; mutator . addInsertion ( "<STR_LIT>" , "<STR_LIT>" , column ) ; column = new HColumnImpl < Composite , String > ( cs , stringSerializer ) ; column . setClock ( keyspace . createClock ( ) ) ; dc = new Composite ( ) ; dc . add ( <NUM_LIT:0> , "<STR_LIT>" ) ; dc . add ( <NUM_LIT:1> , <NUM_LIT> ) ; dc . add ( <NUM_LIT:2> , <NUM_LIT> ) ; column . setName ( dc ) ; column . setValue ( "<STR_LIT>" ) ; mutator . addInsertion ( "<STR_LIT>" , "<STR_LIT>" , column ) ; column = new HColumnImpl < Composite , String > ( cs , stringSerializer ) ; column . setClock ( keyspace . createClock ( ) ) ; dc = new Composite ( ) ; dc . add ( <NUM_LIT:0> , "<STR_LIT>" ) ; dc . add ( <NUM_LIT:1> , <NUM_LIT> ) ; dc . add ( <NUM_LIT:2> , <NUM_LIT> ) ; column . setName ( dc ) ; column . setValue ( "<STR_LIT>" ) ; mutator . addInsertion ( "<STR_LIT>" , "<STR_LIT>" , column ) ; column = new HColumnImpl < Composite , String > ( cs , stringSerializer ) ; column . setClock ( keyspace . createClock ( ) ) ; dc = new Composite ( ) ; dc . add ( <NUM_LIT:0> , "<STR_LIT>" ) ; dc . add ( <NUM_LIT:1> , <NUM_LIT> ) ; dc . add ( <NUM_LIT:2> , <NUM_LIT> ) ; column . setName ( dc ) ; column . setValue ( "<STR_LIT>" ) ; mutator . addInsertion ( "<STR_LIT>" , "<STR_LIT>" , column ) ; mutator . execute ( ) ; SliceQuery < String , Composite , String > sliceQuery = HFactory . createSliceQuery ( keyspace , stringSerializer , cs , stringSerializer ) ; sliceQuery . setColumnFamily ( "<STR_LIT>" ) ; sliceQuery . setKey ( "<STR_LIT>" ) ; Composite startRange = new Composite ( ) ; startRange . add ( <NUM_LIT:0> , "<STR_LIT:A>" ) ; Composite endRange = new Composite ( ) ; endRange . add ( <NUM_LIT:0> , "<STR_LIT:B>" ) ; sliceQuery . setRange ( startRange , endRange , false , <NUM_LIT:10> ) ; QueryResult < ColumnSlice < Composite , String > > result = sliceQuery . execute ( ) ; ColumnSlice < Composite , String > cs = result . get ( ) ; for ( HColumn < Composite , String > col : cs . getColumns ( ) ) { System . out . println ( col . getName ( ) . getComponents ( ) ) ; System . out . println ( col . getName ( ) . get ( <NUM_LIT:0> , StringSerializer . get ( ) ) ) ; } return result ; } } </s>
|
<s> package com . datastax . tutorial ; import java . util . Iterator ; import me . prettyprint . hector . api . ResultStatus ; import me . prettyprint . hector . api . beans . ColumnSlice ; import me . prettyprint . hector . api . beans . Row ; import me . prettyprint . hector . api . beans . Rows ; import me . prettyprint . hector . api . query . QueryResult ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; public class TutorialRunner extends TutorialBase { private static Logger log = LoggerFactory . getLogger ( TutorialRunner . class ) ; public static void main ( String [ ] args ) { init ( ) ; TutorialCommand command = loadCommand ( args [ <NUM_LIT:0> ] ) ; if ( command != null ) { try { ResultStatus result = command . execute ( ) ; if ( result != null ) printResults ( result ) ; } catch ( Exception e ) { log . error ( "<STR_LIT>" , e ) ; } } tutorialCluster . getConnectionManager ( ) . shutdown ( ) ; } @ SuppressWarnings ( "<STR_LIT:unchecked>" ) private static void printResults ( ResultStatus result ) { log . info ( "<STR_LIT>" ) ; log . info ( "<STR_LIT>" , result . getExecutionTimeMicro ( ) , result . getHostUsed ( ) . getName ( ) ) ; log . info ( "<STR_LIT>" ) ; if ( result instanceof QueryResult ) { System . out . println ( ( ( QueryResult ) result ) . get ( ) ) ; QueryResult < ? > qr = ( QueryResult ) result ; if ( qr . get ( ) instanceof Rows ) { Rows < ? , ? , ? > rows = ( Rows ) qr . get ( ) ; for ( Row row : rows ) { log . info ( "<STR_LIT>" , row . getKey ( ) ) ; for ( Iterator iter = row . getColumnSlice ( ) . getColumns ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { log . info ( "<STR_LIT>" , iter . next ( ) ) ; } } } else if ( qr . get ( ) instanceof ColumnSlice ) { for ( Iterator iter = ( ( ColumnSlice ) qr . get ( ) ) . getColumns ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { log . info ( "<STR_LIT>" , iter . next ( ) ) ; } } else { log . info ( "<STR_LIT>" , qr . get ( ) ) ; } } log . info ( "<STR_LIT>" ) ; } private static TutorialCommand loadCommand ( String cmd ) { if ( cmd . equalsIgnoreCase ( "<STR_LIT:get>" ) ) { return new GetCityForNpanxx ( tutorialKeyspace ) ; } else if ( cmd . equalsIgnoreCase ( "<STR_LIT>" ) ) { return new GetSliceForNpanxx ( tutorialKeyspace ) ; } else if ( cmd . equalsIgnoreCase ( "<STR_LIT>" ) ) { return new GetRangeSlicesForStateCity ( tutorialKeyspace ) ; } else if ( cmd . equalsIgnoreCase ( "<STR_LIT>" ) ) { return new GetSliceForAreaCodeCity ( tutorialKeyspace ) ; } else if ( cmd . equalsIgnoreCase ( "<STR_LIT>" ) ) { return new GetSliceForStateCity ( tutorialKeyspace ) ; } else if ( cmd . equalsIgnoreCase ( "<STR_LIT>" ) ) { return new MultigetSliceForNpanxx ( tutorialKeyspace ) ; } else if ( cmd . equalsIgnoreCase ( "<STR_LIT>" ) ) { return new GetIndexedSlicesForCityState ( tutorialKeyspace ) ; } else if ( cmd . equalsIgnoreCase ( "<STR_LIT>" ) ) { return new GetIndexedSlicesHandleRawBytes ( tutorialKeyspace ) ; } else if ( cmd . equalsIgnoreCase ( "<STR_LIT>" ) ) { return new InsertRowsForColumnFamilies ( tutorialKeyspace ) ; } else if ( cmd . equalsIgnoreCase ( "<STR_LIT>" ) ) { return new DeleteRowsForColumnFamily ( tutorialKeyspace ) ; } else if ( cmd . equalsIgnoreCase ( "<STR_LIT>" ) ) { return new GetNpanxxHColumnFamily ( tutorialKeyspace ) ; } else if ( cmd . equalsIgnoreCase ( "<STR_LIT>" ) ) { return new StaticCompositeIndex ( tutorialKeyspace ) ; } else if ( cmd . equalsIgnoreCase ( "<STR_LIT>" ) ) { return new DynamicCompositeIndex ( tutorialKeyspace ) ; } log . error ( "<STR_LIT>" , cmd ) ; return null ; } } </s>
|
<s> package com . datastax . tutorial ; import me . prettyprint . hector . api . Keyspace ; import me . prettyprint . hector . api . beans . HColumn ; import me . prettyprint . hector . api . factory . HFactory ; import me . prettyprint . hector . api . query . ColumnQuery ; import me . prettyprint . hector . api . query . QueryResult ; public class GetCityForNpanxx extends TutorialCommand { public GetCityForNpanxx ( Keyspace keyspace ) { super ( keyspace ) ; } @ Override public QueryResult < HColumn < String , String > > execute ( ) { ColumnQuery < String , String , String > columnQuery = HFactory . createStringColumnQuery ( keyspace ) ; columnQuery . setColumnFamily ( "<STR_LIT>" ) ; columnQuery . setKey ( "<STR_LIT>" ) ; columnQuery . setName ( "<STR_LIT>" ) ; QueryResult < HColumn < String , String > > result = columnQuery . execute ( ) ; return result ; } } </s>
|
<s> package com . datastax . tutorial ; import java . util . ArrayList ; import java . util . List ; import java . util . concurrent . Callable ; import java . util . concurrent . ExecutorService ; import java . util . concurrent . Executors ; import java . util . concurrent . Future ; import me . prettyprint . cassandra . serializers . LongSerializer ; import me . prettyprint . cassandra . serializers . StringSerializer ; import me . prettyprint . cassandra . service . KeyIterator ; import me . prettyprint . cassandra . utils . TimeUUIDUtils ; import me . prettyprint . hector . api . beans . HColumn ; import me . prettyprint . hector . api . factory . HFactory ; import me . prettyprint . hector . api . mutation . Mutator ; import org . apache . commons . lang . RandomStringUtils ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; public class KeyIteratorExample extends TutorialBase { private Logger log = LoggerFactory . getLogger ( KeyIteratorExample . class ) ; public static void main ( String [ ] args ) { long startTime = System . currentTimeMillis ( ) ; init ( ) ; ExecutorService exec = Executors . newFixedThreadPool ( <NUM_LIT:5> ) ; List < Future < Integer > > futures = new ArrayList < Future < Integer > > ( ) ; for ( int x = <NUM_LIT:0> ; x < <NUM_LIT> ; x ++ ) { futures . add ( exec . submit ( new KeyIteratorExample ( ) . new RowInserter ( ) ) ) ; } int total = <NUM_LIT:0> ; try { for ( Future < Integer > f : futures ) { total += f . get ( ) . intValue ( ) ; } } catch ( Exception ex ) { ex . printStackTrace ( ) ; } int keyCount = <NUM_LIT:0> ; KeyIterator < String > keyIterator = new KeyIterator < String > ( tutorialKeyspace , "<STR_LIT>" , StringSerializer . get ( ) ) ; for ( String key : keyIterator ) { keyCount ++ ; } System . out . printf ( "<STR_LIT>" , keyCount ) ; exec . shutdown ( ) ; } class RowInserter implements Callable < Integer > { public Integer call ( ) { Mutator < String > mutator = HFactory . createMutator ( tutorialKeyspace , StringSerializer . get ( ) ) ; int count = <NUM_LIT:0> ; String myKey = TimeUUIDUtils . getTimeUUID ( tutorialKeyspace . createClock ( ) ) . toString ( ) ; for ( int x = <NUM_LIT:0> ; x < <NUM_LIT:1000> ; x ++ ) { mutator . addInsertion ( myKey , "<STR_LIT>" , buildColumnFor ( x ) ) ; if ( x % <NUM_LIT> == <NUM_LIT:0> ) { myKey = TimeUUIDUtils . getTimeUUID ( tutorialKeyspace . createClock ( ) ) . toString ( ) ; count ++ ; } } mutator . execute ( ) ; log . debug ( "<STR_LIT>" , count ) ; return Integer . valueOf ( count ) ; } } private HColumn < Long , String > buildColumnFor ( int colName ) { HColumn < Long , String > column = HFactory . createColumn ( new Long ( colName ) , RandomStringUtils . randomAlphanumeric ( <NUM_LIT:32> ) , LongSerializer . get ( ) , StringSerializer . get ( ) ) ; return column ; } } </s>
|
<s> package com . datastax . tutorial ; import java . io . IOException ; import java . util . Properties ; import me . prettyprint . cassandra . model . ConfigurableConsistencyLevel ; import me . prettyprint . hector . api . Cluster ; import me . prettyprint . hector . api . HConsistencyLevel ; import me . prettyprint . hector . api . Keyspace ; import me . prettyprint . hector . api . factory . HFactory ; public class TutorialBase { protected static Cluster tutorialCluster ; protected static Keyspace tutorialKeyspace ; protected static Properties properties ; protected static void init ( ) { properties = new Properties ( ) ; try { properties . load ( TutorialBase . class . getResourceAsStream ( "<STR_LIT>" ) ) ; } catch ( IOException ioe ) { ioe . printStackTrace ( ) ; } tutorialCluster = HFactory . getOrCreateCluster ( properties . getProperty ( "<STR_LIT>" , "<STR_LIT>" ) , properties . getProperty ( "<STR_LIT>" , "<STR_LIT>" ) ) ; ConfigurableConsistencyLevel ccl = new ConfigurableConsistencyLevel ( ) ; ccl . setDefaultReadConsistencyLevel ( HConsistencyLevel . ONE ) ; tutorialKeyspace = HFactory . createKeyspace ( properties . getProperty ( "<STR_LIT>" , "<STR_LIT>" ) , tutorialCluster , ccl ) ; } } </s>
|
<s> package com . datastax . tutorial ; import me . prettyprint . cassandra . model . IndexedSlicesQuery ; import me . prettyprint . cassandra . serializers . BytesArraySerializer ; import me . prettyprint . hector . api . Keyspace ; import me . prettyprint . hector . api . beans . OrderedRows ; import me . prettyprint . hector . api . factory . HFactory ; import me . prettyprint . hector . api . query . QueryResult ; public class GetIndexedSlicesHandleRawBytes extends TutorialCommand { private static final BytesArraySerializer bas = BytesArraySerializer . get ( ) ; public GetIndexedSlicesHandleRawBytes ( Keyspace keyspace ) { super ( keyspace ) ; } @ Override public QueryResult < OrderedRows < String , String , byte [ ] > > execute ( ) { IndexedSlicesQuery < String , String , byte [ ] > indexedSlicesQuery = HFactory . createIndexedSlicesQuery ( keyspace , stringSerializer , stringSerializer , bas ) ; indexedSlicesQuery . setColumnFamily ( "<STR_LIT>" ) ; indexedSlicesQuery . setColumnNames ( "<STR_LIT>" , "<STR_LIT:state>" , "<STR_LIT>" , "<STR_LIT>" ) ; indexedSlicesQuery . addEqualsExpression ( "<STR_LIT:state>" , stringSerializer . toBytes ( "<STR_LIT>" ) ) ; indexedSlicesQuery . addEqualsExpression ( "<STR_LIT>" , stringSerializer . toBytes ( "<STR_LIT>" ) ) ; indexedSlicesQuery . addGteExpression ( "<STR_LIT>" , stringSerializer . toBytes ( "<STR_LIT>" ) ) ; QueryResult < OrderedRows < String , String , byte [ ] > > result = indexedSlicesQuery . execute ( ) ; String city = stringSerializer . fromBytes ( result . get ( ) . iterator ( ) . next ( ) . getColumnSlice ( ) . getColumnByName ( "<STR_LIT>" ) . getValue ( ) ) ; log . info ( "<STR_LIT>" , city , result . get ( ) . iterator ( ) . next ( ) . getColumnSlice ( ) . getColumnByName ( "<STR_LIT>" ) . getValue ( ) ) ; return result ; } } </s>
|
<s> package com . datastax . tutorial ; import me . prettyprint . hector . api . Keyspace ; import me . prettyprint . hector . api . beans . Rows ; import me . prettyprint . hector . api . factory . HFactory ; import me . prettyprint . hector . api . query . MultigetSliceQuery ; import me . prettyprint . hector . api . query . QueryResult ; public class MultigetSliceForNpanxx extends TutorialCommand { public MultigetSliceForNpanxx ( Keyspace keyspace ) { super ( keyspace ) ; } @ Override public QueryResult < Rows < String , String , String > > execute ( ) { MultigetSliceQuery < String , String , String > multigetSlicesQuery = HFactory . createMultigetSliceQuery ( keyspace , stringSerializer , stringSerializer , stringSerializer ) ; multigetSlicesQuery . setColumnFamily ( "<STR_LIT>" ) ; multigetSlicesQuery . setColumnNames ( "<STR_LIT>" , "<STR_LIT:state>" , "<STR_LIT>" , "<STR_LIT>" ) ; multigetSlicesQuery . setKeys ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ; QueryResult < Rows < String , String , String > > results = multigetSlicesQuery . execute ( ) ; return results ; } } </s>
|
<s> package com . datastax . tutorial . composite ; import java . util . Iterator ; import com . datastax . tutorial . TutorialBase ; import me . prettyprint . cassandra . serializers . CompositeSerializer ; import me . prettyprint . cassandra . serializers . StringSerializer ; import me . prettyprint . cassandra . service . ColumnSliceIterator ; import me . prettyprint . hector . api . beans . Composite ; import me . prettyprint . hector . api . beans . HColumn ; import me . prettyprint . hector . api . factory . HFactory ; import me . prettyprint . hector . api . query . SliceQuery ; public class CompositeQuery extends TutorialBase { private static String key = "<STR_LIT>" ; private static String startArg = "<STR_LIT>" ; public static void main ( String [ ] args ) { init ( ) ; CompositeQuery compositeQuery = new CompositeQuery ( ) ; Composite start = compositeFrom ( startArg , Composite . ComponentEquality . EQUAL ) ; Composite end = compositeFrom ( startArg , Composite . ComponentEquality . GREATER_THAN_EQUAL ) ; compositeQuery . printColumnsFor ( start , end ) ; } public void printColumnsFor ( Composite start , Composite end ) { CompositeQueryIterator iter = new CompositeQueryIterator ( key , start , end ) ; System . out . printf ( "<STR_LIT>" , startArg ) ; int count = <NUM_LIT:0> ; for ( HColumn < Composite , String > column : iter ) { System . out . printf ( "<STR_LIT>" , column . getName ( ) . get ( <NUM_LIT:0> , StringSerializer . get ( ) ) , column . getName ( ) . get ( <NUM_LIT:1> , StringSerializer . get ( ) ) , column . getName ( ) . get ( <NUM_LIT:2> , StringSerializer . get ( ) ) , column . getValue ( ) ) ; count ++ ; } System . out . printf ( "<STR_LIT>" , count ) ; } public static Composite compositeFrom ( String componentName , Composite . ComponentEquality equalityOp ) { Composite composite = new Composite ( ) ; composite . addComponent ( <NUM_LIT:0> , componentName , equalityOp ) ; return composite ; } class CompositeQueryIterator implements Iterable < HColumn < Composite , String > > { private final String key ; private final ColumnSliceIterator < String , Composite , String > sliceIterator ; private Composite start ; private Composite end ; CompositeQueryIterator ( String key , Composite start , Composite end ) { this . key = key ; this . start = start ; this . end = end ; SliceQuery < String , Composite , String > sliceQuery = HFactory . createSliceQuery ( tutorialKeyspace , StringSerializer . get ( ) , new CompositeSerializer ( ) , StringSerializer . get ( ) ) ; sliceQuery . setColumnFamily ( "<STR_LIT>" ) ; sliceQuery . setKey ( key ) ; sliceIterator = new ColumnSliceIterator ( sliceQuery , start , end , false ) ; } public Iterator < HColumn < Composite , String > > iterator ( ) { return sliceIterator ; } } } </s>
|
<s> package com . datastax . tutorial . composite ; import java . io . BufferedReader ; import java . io . FileInputStream ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . List ; import java . util . concurrent . Callable ; import java . util . concurrent . ExecutorService ; import java . util . concurrent . Executors ; import java . util . concurrent . Future ; import com . datastax . tutorial . TutorialBase ; import me . prettyprint . cassandra . serializers . CompositeSerializer ; import me . prettyprint . cassandra . serializers . StringSerializer ; import me . prettyprint . hector . api . beans . Composite ; import me . prettyprint . hector . api . beans . HColumn ; import me . prettyprint . hector . api . factory . HFactory ; import me . prettyprint . hector . api . mutation . Mutator ; import org . apache . commons . lang . StringEscapeUtils ; import org . apache . commons . lang . StringUtils ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; public class CompositeDataLoader extends TutorialBase { private static Logger log = LoggerFactory . getLogger ( CompositeDataLoader . class ) ; private static ExecutorService exec ; public static final String COMPOSITE_KEY = "<STR_LIT>" ; public static final String COUNTRY_STATE_CITY_CF = "<STR_LIT>" ; public static void main ( String [ ] args ) { long startTime = System . currentTimeMillis ( ) ; init ( ) ; String fileLocation = properties . getProperty ( "<STR_LIT>" , "<STR_LIT>" ) ; BufferedReader reader ; exec = Executors . newFixedThreadPool ( <NUM_LIT:5> ) ; try { reader = new BufferedReader ( new InputStreamReader ( new FileInputStream ( fileLocation ) ) ) ; List < String > lines = new ArrayList < String > ( <NUM_LIT:1000> ) ; String line = reader . readLine ( ) ; List < Future < Integer > > sums = new ArrayList < Future < Integer > > ( ) ; while ( line != null ) { lines . add ( line ) ; if ( lines . size ( ) % <NUM_LIT> == <NUM_LIT:0> ) { doParse ( lines , sums ) ; } line = reader . readLine ( ) ; } doParse ( lines , sums ) ; int total = <NUM_LIT:0> ; for ( Future < Integer > future : sums ) { total = total + future . get ( ) . intValue ( ) ; } log . info ( "<STR_LIT>" , total , System . currentTimeMillis ( ) - startTime ) ; } catch ( Exception e ) { log . error ( "<STR_LIT>" , e ) ; } finally { exec . shutdown ( ) ; } tutorialCluster . getConnectionManager ( ) . shutdown ( ) ; } private static void doParse ( List < String > lines , List < Future < Integer > > sums ) { Future < Integer > f = exec . submit ( new CompositeDataLoader ( ) . new LineParser ( new ArrayList ( lines ) ) ) ; sums . add ( f ) ; lines . clear ( ) ; } class LineParser implements Callable < Integer > { List < String > lines ; LineParser ( List < String > lines ) { this . lines = lines ; } public Integer call ( ) throws Exception { int count = <NUM_LIT:0> ; GeoDataLine geoDataLine ; Mutator < String > mutator = HFactory . createMutator ( tutorialKeyspace , StringSerializer . get ( ) ) ; for ( String row : lines ) { geoDataLine = new GeoDataLine ( row ) ; mutator . addInsertion ( COMPOSITE_KEY , COUNTRY_STATE_CITY_CF , geoDataLine . staticColumnFrom ( ) ) ; count ++ ; } mutator . execute ( ) ; log . debug ( "<STR_LIT>" , count ) ; return Integer . valueOf ( count ) ; } } static class GeoDataLine { public static final char SEPARATOR_CHAR = '<CHAR_LIT:U+002C>' ; private String [ ] vals = new String [ <NUM_LIT:10> ] ; GeoDataLine ( String line ) { vals = StringUtils . split ( StringEscapeUtils . unescapeCsv ( line ) , SEPARATOR_CHAR ) ; log . debug ( "<STR_LIT>" , vals . length , line ) ; } HColumn < Composite , String > staticColumnFrom ( ) { Composite composite = new Composite ( ) ; composite . addComponent ( getCountryCode ( ) , StringSerializer . get ( ) ) ; composite . addComponent ( getAdmin1Code ( ) , StringSerializer . get ( ) ) ; composite . addComponent ( StringEscapeUtils . unescapeCsv ( getAsciiName ( ) ) , StringSerializer . get ( ) ) ; HColumn < Composite , String > col = HFactory . createColumn ( composite , getTimezone ( ) , new CompositeSerializer ( ) , StringSerializer . get ( ) ) ; return col ; } String getCountryCode ( ) { return vals [ <NUM_LIT:0> ] ; } String getAdmin1Code ( ) { return vals [ <NUM_LIT:1> ] ; } String getAsciiName ( ) { return vals [ <NUM_LIT:2> ] ; } String getTimezone ( ) { return vals [ <NUM_LIT:3> ] ; } } } </s>
|
<s> package com . datastax . tutorial ; import me . prettyprint . cassandra . service . HColumnFamilyImpl ; import me . prettyprint . hector . api . HColumnFamily ; import me . prettyprint . hector . api . Keyspace ; import me . prettyprint . hector . api . ResultStatus ; import me . prettyprint . hector . api . query . SliceQuery ; public class GetNpanxxHColumnFamily extends TutorialCommand { public GetNpanxxHColumnFamily ( Keyspace keyspace ) { super ( keyspace ) ; } @ Override public ResultStatus execute ( ) { HColumnFamily < String , String > columnFamily = new HColumnFamilyImpl < String , String > ( keyspace , "<STR_LIT>" , stringSerializer , stringSerializer ) ; columnFamily . addKey ( "<STR_LIT>" ) ; columnFamily . addColumnName ( "<STR_LIT>" ) . addColumnName ( "<STR_LIT:state>" ) . addColumnName ( "<STR_LIT>" ) . addColumnName ( "<STR_LIT>" ) ; log . info ( "<STR_LIT>" , new Object [ ] { columnFamily . getString ( "<STR_LIT>" ) , columnFamily . getString ( "<STR_LIT:state>" ) , columnFamily . getString ( "<STR_LIT>" ) , columnFamily . getString ( "<STR_LIT>" ) } ) ; return columnFamily ; } } </s>
|
<s> package com . datastax . tutorial ; import me . prettyprint . hector . api . Keyspace ; import me . prettyprint . hector . api . beans . ColumnSlice ; import me . prettyprint . hector . api . factory . HFactory ; import me . prettyprint . hector . api . query . QueryResult ; import me . prettyprint . hector . api . query . SliceQuery ; public class GetSliceForNpanxx extends TutorialCommand { public GetSliceForNpanxx ( Keyspace keyspace ) { super ( keyspace ) ; } @ Override public QueryResult < ColumnSlice < String , String > > execute ( ) { SliceQuery < String , String , String > sliceQuery = HFactory . createSliceQuery ( keyspace , stringSerializer , stringSerializer , stringSerializer ) ; sliceQuery . setColumnFamily ( "<STR_LIT>" ) ; sliceQuery . setKey ( "<STR_LIT>" ) ; sliceQuery . setColumnNames ( "<STR_LIT>" , "<STR_LIT:state>" , "<STR_LIT>" , "<STR_LIT>" ) ; QueryResult < ColumnSlice < String , String > > result = sliceQuery . execute ( ) ; return result ; } } </s>
|
<s> package com . datastax . tutorial ; import me . prettyprint . hector . api . Keyspace ; import me . prettyprint . hector . api . factory . HFactory ; import me . prettyprint . hector . api . mutation . MutationResult ; import me . prettyprint . hector . api . mutation . Mutator ; import me . prettyprint . hector . api . query . QueryResult ; public class InsertRowsForColumnFamilies extends TutorialCommand { public InsertRowsForColumnFamilies ( Keyspace keyspace ) { super ( keyspace ) ; } @ Override public QueryResult < ? > execute ( ) { Mutator < String > mutator = HFactory . createMutator ( keyspace , stringSerializer ) ; mutator . addInsertion ( "<STR_LIT>" , "<STR_LIT>" , HFactory . createColumn ( <NUM_LIT> , "<STR_LIT>" , longSerializer , stringSerializer ) ) ; mutator . addInsertion ( "<STR_LIT>" , "<STR_LIT>" , HFactory . createStringColumn ( "<STR_LIT>" , "<STR_LIT>" ) ) ; mutator . addInsertion ( "<STR_LIT>" , "<STR_LIT>" , HFactory . createStringColumn ( "<STR_LIT>" , "<STR_LIT>" ) ) ; mutator . addInsertion ( "<STR_LIT>" , "<STR_LIT>" , HFactory . createStringColumn ( "<STR_LIT>" , "<STR_LIT>" ) ) ; mutator . addInsertion ( "<STR_LIT>" , "<STR_LIT>" , HFactory . createStringColumn ( "<STR_LIT>" , "<STR_LIT>" ) ) ; mutator . addInsertion ( "<STR_LIT>" , "<STR_LIT>" , HFactory . createStringColumn ( "<STR_LIT:state>" , "<STR_LIT>" ) ) ; MutationResult mr = mutator . execute ( ) ; return null ; } } </s>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.