| 1 | package net.minecraft.block;
|
| 2 |
|
| 3 | import com.google.common.collect.Lists;
|
| 4 | import com.google.common.collect.Sets;
|
| 5 | import java.util.EnumSet;
|
| 6 | import java.util.List;
|
| 7 | import java.util.Random;
|
| 8 | import java.util.Set;
|
| 9 | import net.minecraft.block.material.Material;
|
| 10 | import net.minecraft.block.properties.IProperty;
|
| 11 | import net.minecraft.block.properties.PropertyEnum;
|
| 12 | import net.minecraft.block.properties.PropertyInteger;
|
| 13 | import net.minecraft.block.state.BlockState;
|
| 14 | import net.minecraft.block.state.IBlockState;
|
| 15 | import net.minecraft.init.Blocks;
|
| 16 | import net.minecraft.init.Items;
|
| 17 | import net.minecraft.item.Item;
|
| 18 | import net.minecraft.util.AxisAlignedBB;
|
| 19 | import net.minecraft.util.BlockPos;
|
| 20 | import net.minecraft.util.EnumFacing;
|
| 21 | import net.minecraft.util.EnumParticleTypes;
|
| 22 | import net.minecraft.util.EnumWorldBlockLayer;
|
| 23 | import net.minecraft.util.IStringSerializable;
|
| 24 | import net.minecraft.util.MathHelper;
|
| 25 | import net.minecraft.world.IBlockAccess;
|
| 26 | import net.minecraft.world.World;
|
| 27 |
|
| 28 | public class BlockRedstoneWire extends Block
|
| 29 | {
|
| 30 | public static final PropertyEnum<BlockRedstoneWire.EnumAttachPosition> NORTH = PropertyEnum.<BlockRedstoneWire.EnumAttachPosition>create("north", BlockRedstoneWire.EnumAttachPosition.class);
|
| 31 | public static final PropertyEnum<BlockRedstoneWire.EnumAttachPosition> EAST = PropertyEnum.<BlockRedstoneWire.EnumAttachPosition>create("east", BlockRedstoneWire.EnumAttachPosition.class);
|
| 32 | public static final PropertyEnum<BlockRedstoneWire.EnumAttachPosition> SOUTH = PropertyEnum.<BlockRedstoneWire.EnumAttachPosition>create("south", BlockRedstoneWire.EnumAttachPosition.class);
|
| 33 | public static final PropertyEnum<BlockRedstoneWire.EnumAttachPosition> WEST = PropertyEnum.<BlockRedstoneWire.EnumAttachPosition>create("west", BlockRedstoneWire.EnumAttachPosition.class);
|
| 34 | public static final PropertyInteger POWER = PropertyInteger.create("power", 0, 15);
|
| 35 | private boolean canProvidePower = true;
|
| 36 | private final Set<BlockPos> blocksNeedingUpdate = Sets.<BlockPos>newHashSet();
|
| 37 |
|
| 38 | public BlockRedstoneWire()
|
| 39 | {
|
| 40 | super(Material.circuits);
|
| 41 | this.setDefaultState(this.blockState.getBaseState().withProperty(NORTH, BlockRedstoneWire.EnumAttachPosition.NONE).withProperty(EAST, BlockRedstoneWire.EnumAttachPosition.NONE).withProperty(SOUTH, BlockRedstoneWire.EnumAttachPosition.NONE).withProperty(WEST, BlockRedstoneWire.EnumAttachPosition.NONE).withProperty(POWER, Integer.valueOf(0)));
|
| 42 | this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
|
| 43 | }
|
| 44 |
|
| 45 | /**
|
| 46 | * Get the actual Block state of this Block at the given position. This applies properties not visible in the
|
| 47 | * metadata, such as fence connections.
|
| 48 | */
|
| 49 | public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
|
| 50 | {
|
| 51 | state = state.withProperty(WEST, this.getAttachPosition(worldIn, pos, EnumFacing.WEST));
|
| 52 | state = state.withProperty(EAST, this.getAttachPosition(worldIn, pos, EnumFacing.EAST));
|
| 53 | state = state.withProperty(NORTH, this.getAttachPosition(worldIn, pos, EnumFacing.NORTH));
|
| 54 | state = state.withProperty(SOUTH, this.getAttachPosition(worldIn, pos, EnumFacing.SOUTH));
|
| 55 | return state;
|
| 56 | }
|
| 57 |
|
| 58 | private BlockRedstoneWire.EnumAttachPosition getAttachPosition(IBlockAccess worldIn, BlockPos pos, EnumFacing direction)
|
| 59 | {
|
| 60 | BlockPos blockpos = pos.offset(direction);
|
| 61 | Block block = worldIn.getBlockState(pos.offset(direction)).getBlock();
|
| 62 |
|
| 63 | if (!canConnectTo(worldIn.getBlockState(blockpos), direction) && (block.isBlockNormalCube() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos.down()))))
|
| 64 | {
|
| 65 | Block block1 = worldIn.getBlockState(pos.up()).getBlock();
|
| 66 | return !block1.isBlockNormalCube() && block.isBlockNormalCube() && canConnectUpwardsTo(worldIn.getBlockState(blockpos.up())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE;
|
| 67 | }
|
| 68 | else
|
| 69 | {
|
| 70 | return BlockRedstoneWire.EnumAttachPosition.SIDE;
|
| 71 | }
|
| 72 | }
|
| 73 |
|
| 74 | public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
|
| 75 | {
|
| 76 | return null;
|
| 77 | }
|
| 78 |
|
| 79 | /**
|
| 80 | * Used to determine ambient occlusion and culling when rebuilding chunks for render
|
| 81 | */
|
| 82 | public boolean isOpaqueCube()
|
| 83 | {
|
| 84 | return false;
|
| 85 | }
|
| 86 |
|
| 87 | public boolean isFullCube()
|
| 88 | {
|
| 89 | return false;
|
| 90 | }
|
| 91 |
|
| 92 | public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass)
|
| 93 | {
|
| 94 | IBlockState iblockstate = worldIn.getBlockState(pos);
|
| 95 | return iblockstate.getBlock() != this ? super.colorMultiplier(worldIn, pos, renderPass) : this.colorMultiplier(((Integer)iblockstate.getValue(POWER)).intValue());
|
| 96 | }
|
| 97 |
|
| 98 | public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
|
| 99 | {
|
| 100 | return World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) || worldIn.getBlockState(pos.down()).getBlock() == Blocks.glowstone;
|
| 101 | }
|
| 102 |
|
| 103 | private IBlockState updateSurroundingRedstone(World worldIn, BlockPos pos, IBlockState state)
|
| 104 | {
|
| 105 | state = this.calculateCurrentChanges(worldIn, pos, pos, state);
|
| 106 | List<BlockPos> list = Lists.newArrayList(this.blocksNeedingUpdate);
|
| 107 | this.blocksNeedingUpdate.clear();
|
| 108 |
|
| 109 | for (BlockPos blockpos : list)
|
| 110 | {
|
| 111 | worldIn.notifyNeighborsOfStateChange(blockpos, this);
|
| 112 | }
|
| 113 |
|
| 114 | return state;
|
| 115 | }
|
| 116 |
|
| 117 | private IBlockState calculateCurrentChanges(World worldIn, BlockPos pos1, BlockPos pos2, IBlockState state)
|
| 118 | {
|
| 119 | IBlockState iblockstate = state;
|
| 120 | int i = ((Integer)state.getValue(POWER)).intValue();
|
| 121 | int j = 0;
|
| 122 | j = this.getMaxCurrentStrength(worldIn, pos2, j);
|
| 123 | this.canProvidePower = false;
|
| 124 | int k = worldIn.isBlockIndirectlyGettingPowered(pos1);
|
| 125 | this.canProvidePower = true;
|
| 126 |
|
| 127 | if (k > 0 && k > j - 1)
|
| 128 | {
|
| 129 | j = k;
|
| 130 | }
|
| 131 |
|
| 132 | int l = 0;
|
| 133 |
|
| 134 | for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
|
| 135 | {
|
| 136 | BlockPos blockpos = pos1.offset(enumfacing);
|
| 137 | boolean flag = blockpos.getX() != pos2.getX() || blockpos.getZ() != pos2.getZ();
|
| 138 |
|
| 139 | if (flag)
|
| 140 | {
|
| 141 | l = this.getMaxCurrentStrength(worldIn, blockpos, l);
|
| 142 | }
|
| 143 |
|
| 144 | if (worldIn.getBlockState(blockpos).getBlock().isNormalCube() && !worldIn.getBlockState(pos1.up()).getBlock().isNormalCube())
|
| 145 | {
|
| 146 | if (flag && pos1.getY() >= pos2.getY())
|
| 147 | {
|
| 148 | l = this.getMaxCurrentStrength(worldIn, blockpos.up(), l);
|
| 149 | }
|
| 150 | }
|
| 151 | else if (!worldIn.getBlockState(blockpos).getBlock().isNormalCube() && flag && pos1.getY() <= pos2.getY())
|
| 152 | {
|
| 153 | l = this.getMaxCurrentStrength(worldIn, blockpos.down(), l);
|
| 154 | }
|
| 155 | }
|
| 156 |
|
| 157 | if (l > j)
|
| 158 | {
|
| 159 | j = l - 1;
|
| 160 | }
|
| 161 | else if (j > 0)
|
| 162 | {
|
| 163 | --j;
|
| 164 | }
|
| 165 | else
|
| 166 | {
|
| 167 | j = 0;
|
| 168 | }
|
| 169 |
|
| 170 | if (k > j - 1)
|
| 171 | {
|
| 172 | j = k;
|
| 173 | }
|
| 174 |
|
| 175 | if (i != j)
|
| 176 | {
|
| 177 | state = state.withProperty(POWER, Integer.valueOf(j));
|
| 178 |
|
| 179 | if (worldIn.getBlockState(pos1) == iblockstate)
|
| 180 | {
|
| 181 | worldIn.setBlockState(pos1, state, 2);
|
| 182 | }
|
| 183 |
|
| 184 | this.blocksNeedingUpdate.add(pos1);
|
| 185 |
|
| 186 | for (EnumFacing enumfacing1 : EnumFacing.values())
|
| 187 | {
|
| 188 | this.blocksNeedingUpdate.add(pos1.offset(enumfacing1));
|
| 189 | }
|
| 190 | }
|
| 191 |
|
| 192 | return state;
|
| 193 | }
|
| 194 |
|
| 195 | /**
|
| 196 | * Calls World.notifyNeighborsOfStateChange() for all neighboring blocks, but only if the given block is a redstone
|
| 197 | * wire.
|
| 198 | */
|
| 199 | private void notifyWireNeighborsOfStateChange(World worldIn, BlockPos pos)
|
| 200 | {
|
| 201 | if (worldIn.getBlockState(pos).getBlock() == this)
|
| 202 | {
|
| 203 | worldIn.notifyNeighborsOfStateChange(pos, this);
|
| 204 |
|
| 205 | for (EnumFacing enumfacing : EnumFacing.values())
|
| 206 | {
|
| 207 | worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this);
|
| 208 | }
|
| 209 | }
|
| 210 | }
|
| 211 |
|
| 212 | public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
|
| 213 | {
|
| 214 | if (!worldIn.isRemote)
|
| 215 | {
|
| 216 | this.updateSurroundingRedstone(worldIn, pos, state);
|
| 217 |
|
| 218 | for (EnumFacing enumfacing : EnumFacing.Plane.VERTICAL)
|
| 219 | {
|
| 220 | worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this);
|
| 221 | }
|
| 222 |
|
| 223 | for (EnumFacing enumfacing1 : EnumFacing.Plane.HORIZONTAL)
|
| 224 | {
|
| 225 | this.notifyWireNeighborsOfStateChange(worldIn, pos.offset(enumfacing1));
|
| 226 | }
|
| 227 |
|
| 228 | for (EnumFacing enumfacing2 : EnumFacing.Plane.HORIZONTAL)
|
| 229 | {
|
| 230 | BlockPos blockpos = pos.offset(enumfacing2);
|
| 231 |
|
| 232 | if (worldIn.getBlockState(blockpos).getBlock().isNormalCube())
|
| 233 | {
|
| 234 | this.notifyWireNeighborsOfStateChange(worldIn, blockpos.up());
|
| 235 | }
|
| 236 | else
|
| 237 | {
|
| 238 | this.notifyWireNeighborsOfStateChange(worldIn, blockpos.down());
|
| 239 | }
|
| 240 | }
|
| 241 | }
|
| 242 | }
|
| 243 |
|
| 244 | public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
| 245 | {
|
| 246 | super.breakBlock(worldIn, pos, state);
|
| 247 |
|
| 248 | if (!worldIn.isRemote)
|
| 249 | {
|
| 250 | for (EnumFacing enumfacing : EnumFacing.values())
|
| 251 | {
|
| 252 | worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this);
|
| 253 | }
|
| 254 |
|
| 255 | this.updateSurroundingRedstone(worldIn, pos, state);
|
| 256 |
|
| 257 | for (EnumFacing enumfacing1 : EnumFacing.Plane.HORIZONTAL)
|
| 258 | {
|
| 259 | this.notifyWireNeighborsOfStateChange(worldIn, pos.offset(enumfacing1));
|
| 260 | }
|
| 261 |
|
| 262 | for (EnumFacing enumfacing2 : EnumFacing.Plane.HORIZONTAL)
|
| 263 | {
|
| 264 | BlockPos blockpos = pos.offset(enumfacing2);
|
| 265 |
|
| 266 | if (worldIn.getBlockState(blockpos).getBlock().isNormalCube())
|
| 267 | {
|
| 268 | this.notifyWireNeighborsOfStateChange(worldIn, blockpos.up());
|
| 269 | }
|
| 270 | else
|
| 271 | {
|
| 272 | this.notifyWireNeighborsOfStateChange(worldIn, blockpos.down());
|
| 273 | }
|
| 274 | }
|
| 275 | }
|
| 276 | }
|
| 277 |
|
| 278 | private int getMaxCurrentStrength(World worldIn, BlockPos pos, int strength)
|
| 279 | {
|
| 280 | if (worldIn.getBlockState(pos).getBlock() != this)
|
| 281 | {
|
| 282 | return strength;
|
| 283 | }
|
| 284 | else
|
| 285 | {
|
| 286 | int i = ((Integer)worldIn.getBlockState(pos).getValue(POWER)).intValue();
|
| 287 | return i > strength ? i : strength;
|
| 288 | }
|
| 289 | }
|
| 290 |
|
| 291 | /**
|
| 292 | * Called when a neighboring block changes.
|
| 293 | */
|
| 294 | public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
|
| 295 | {
|
| 296 | if (!worldIn.isRemote)
|
| 297 | {
|
| 298 | if (this.canPlaceBlockAt(worldIn, pos))
|
| 299 | {
|
| 300 | this.updateSurroundingRedstone(worldIn, pos, state);
|
| 301 | }
|
| 302 | else
|
| 303 | {
|
| 304 | this.dropBlockAsItem(worldIn, pos, state, 0);
|
| 305 | worldIn.setBlockToAir(pos);
|
| 306 | }
|
| 307 | }
|
| 308 | }
|
| 309 |
|
| 310 | /**
|
| 311 | * Get the Item that this Block should drop when harvested.
|
| 312 | */
|
| 313 | public Item getItemDropped(IBlockState state, Random rand, int fortune)
|
| 314 | {
|
| 315 | return Items.redstone;
|
| 316 | }
|
| 317 |
|
| 318 | public int getStrongPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side)
|
| 319 | {
|
| 320 | return !this.canProvidePower ? 0 : this.getWeakPower(worldIn, pos, state, side);
|
| 321 | }
|
| 322 |
|
| 323 | public int getWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side)
|
| 324 | {
|
| 325 | if (!this.canProvidePower)
|
| 326 | {
|
| 327 | return 0;
|
| 328 | }
|
| 329 | else
|
| 330 | {
|
| 331 | int i = ((Integer)state.getValue(POWER)).intValue();
|
| 332 |
|
| 333 | if (i == 0)
|
| 334 | {
|
| 335 | return 0;
|
| 336 | }
|
| 337 | else if (side == EnumFacing.UP)
|
| 338 | {
|
| 339 | return i;
|
| 340 | }
|
| 341 | else
|
| 342 | {
|
| 343 | EnumSet<EnumFacing> enumset = EnumSet.<EnumFacing>noneOf(EnumFacing.class);
|
| 344 |
|
| 345 | for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
|
| 346 | {
|
| 347 | if (this.func_176339_d(worldIn, pos, enumfacing))
|
| 348 | {
|
| 349 | enumset.add(enumfacing);
|
| 350 | }
|
| 351 | }
|
| 352 |
|
| 353 | if (side.getAxis().isHorizontal() && enumset.isEmpty())
|
| 354 | {
|
| 355 | return i;
|
| 356 | }
|
| 357 | else if (enumset.contains(side) && !enumset.contains(side.rotateYCCW()) && !enumset.contains(side.rotateY()))
|
| 358 | {
|
| 359 | return i;
|
| 360 | }
|
| 361 | else
|
| 362 | {
|
| 363 | return 0;
|
| 364 | }
|
| 365 | }
|
| 366 | }
|
| 367 | }
|
| 368 |
|
| 369 | private boolean func_176339_d(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
|
| 370 | {
|
| 371 | BlockPos blockpos = pos.offset(side);
|
| 372 | IBlockState iblockstate = worldIn.getBlockState(blockpos);
|
| 373 | Block block = iblockstate.getBlock();
|
| 374 | boolean flag = block.isNormalCube();
|
| 375 | boolean flag1 = worldIn.getBlockState(pos.up()).getBlock().isNormalCube();
|
| 376 | return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down())));
|
| 377 | }
|
| 378 |
|
| 379 | protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos)
|
| 380 | {
|
| 381 | return canConnectUpwardsTo(worldIn.getBlockState(pos));
|
| 382 | }
|
| 383 |
|
| 384 | protected static boolean canConnectUpwardsTo(IBlockState state)
|
| 385 | {
|
| 386 | return canConnectTo(state, (EnumFacing)null);
|
| 387 | }
|
| 388 |
|
| 389 | protected static boolean canConnectTo(IBlockState blockState, EnumFacing side)
|
| 390 | {
|
| 391 | Block block = blockState.getBlock();
|
| 392 |
|
| 393 | if (block == Blocks.redstone_wire)
|
| 394 | {
|
| 395 | return true;
|
| 396 | }
|
| 397 | else if (Blocks.unpowered_repeater.isAssociated(block))
|
| 398 | {
|
| 399 | EnumFacing enumfacing = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING);
|
| 400 | return enumfacing == side || enumfacing.getOpposite() == side;
|
| 401 | }
|
| 402 | else
|
| 403 | {
|
| 404 | return block.canProvidePower() && side != null;
|
| 405 | }
|
| 406 | }
|
| 407 |
|
| 408 | /**
|
| 409 | * Can this block provide power. Only wire currently seems to have this change based on its state.
|
| 410 | */
|
| 411 | public boolean canProvidePower()
|
| 412 | {
|
| 413 | return this.canProvidePower;
|
| 414 | }
|
| 415 |
|
| 416 | private int colorMultiplier(int powerLevel)
|
| 417 | {
|
| 418 | float f = (float)powerLevel / 15.0F;
|
| 419 | float f1 = f * 0.6F + 0.4F;
|
| 420 |
|
| 421 | if (powerLevel == 0)
|
| 422 | {
|
| 423 | f1 = 0.3F;
|
| 424 | }
|
| 425 |
|
| 426 | float f2 = f * f * 0.7F - 0.5F;
|
| 427 | float f3 = f * f * 0.6F - 0.7F;
|
| 428 |
|
| 429 | if (f2 < 0.0F)
|
| 430 | {
|
| 431 | f2 = 0.0F;
|
| 432 | }
|
| 433 |
|
| 434 | if (f3 < 0.0F)
|
| 435 | {
|
| 436 | f3 = 0.0F;
|
| 437 | }
|
| 438 |
|
| 439 | int i = MathHelper.clamp_int((int)(f1 * 255.0F), 0, 255);
|
| 440 | int j = MathHelper.clamp_int((int)(f2 * 255.0F), 0, 255);
|
| 441 | int k = MathHelper.clamp_int((int)(f3 * 255.0F), 0, 255);
|
| 442 | return -16777216 | i << 16 | j << 8 | k;
|
| 443 | }
|
| 444 |
|
| 445 | public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
|
| 446 | {
|
| 447 | int i = ((Integer)state.getValue(POWER)).intValue();
|
| 448 |
|
| 449 | if (i != 0)
|
| 450 | {
|
| 451 | double d0 = (double)pos.getX() + 0.5D + ((double)rand.nextFloat() - 0.5D) * 0.2D;
|
| 452 | double d1 = (double)((float)pos.getY() + 0.0625F);
|
| 453 | double d2 = (double)pos.getZ() + 0.5D + ((double)rand.nextFloat() - 0.5D) * 0.2D;
|
| 454 | float f = (float)i / 15.0F;
|
| 455 | float f1 = f * 0.6F + 0.4F;
|
| 456 | float f2 = Math.max(0.0F, f * f * 0.7F - 0.5F);
|
| 457 | float f3 = Math.max(0.0F, f * f * 0.6F - 0.7F);
|
| 458 | worldIn.spawnParticle(EnumParticleTypes.REDSTONE, d0, d1, d2, (double)f1, (double)f2, (double)f3, new int[0]);
|
| 459 | }
|
| 460 | }
|
| 461 |
|
| 462 | public Item getItem(World worldIn, BlockPos pos)
|
| 463 | {
|
| 464 | return Items.redstone;
|
| 465 | }
|
| 466 |
|
| 467 | public EnumWorldBlockLayer getBlockLayer()
|
| 468 | {
|
| 469 | return EnumWorldBlockLayer.CUTOUT;
|
| 470 | }
|
| 471 |
|
| 472 | /**
|
| 473 | * Convert the given metadata into a BlockState for this Block
|
| 474 | */
|
| 475 | public IBlockState getStateFromMeta(int meta)
|
| 476 | {
|
| 477 | return this.getDefaultState().withProperty(POWER, Integer.valueOf(meta));
|
| 478 | }
|
| 479 |
|
| 480 | /**
|
| 481 | * Convert the BlockState into the correct metadata value
|
| 482 | */
|
| 483 | public int getMetaFromState(IBlockState state)
|
| 484 | {
|
| 485 | return ((Integer)state.getValue(POWER)).intValue();
|
| 486 | }
|
| 487 |
|
| 488 | protected BlockState createBlockState()
|
| 489 | {
|
| 490 | return new BlockState(this, new IProperty[] {NORTH, EAST, SOUTH, WEST, POWER});
|
| 491 | }
|
| 492 |
|
| 493 | static enum EnumAttachPosition implements IStringSerializable
|
| 494 | {
|
| 495 | UP("up"),
|
| 496 | SIDE("side"),
|
| 497 | NONE("none");
|
| 498 |
|
| 499 | private final String name;
|
| 500 |
|
| 501 | private EnumAttachPosition(String name)
|
| 502 | {
|
| 503 | this.name = name;
|
| 504 | }
|
| 505 |
|
| 506 | public String toString()
|
| 507 | {
|
| 508 | return this.getName();
|
| 509 | }
|
| 510 |
|
| 511 | public String getName()
|
| 512 | {
|
| 513 | return this.name;
|
| 514 | }
|
| 515 | }
|
| 516 | }
|
| 517 |
|