summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/bukkit
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/bukkit')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftArt.java85
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftChunk.java69
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java35
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftEffect.java7
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java5
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftParticle.java148
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftServer.java179
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftSound.java383
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftStatistic.java177
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftWorld.java121
-rw-r--r--src/main/java/org/bukkit/craftbukkit/Main.java12
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java5
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftBed.java57
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java277
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java9
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java92
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftBrewingStand.java5
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftChest.java30
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java5
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java17
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java3
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftEnchantingTable.java5
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftFlowerPot.java46
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java5
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftJukebox.java17
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java5
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java83
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java150
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftStructureBlock.java55
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/CraftAgeable.java23
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/CraftAnaloguePowerable.java23
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/CraftAttachable.java18
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/CraftBisected.java18
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java356
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/CraftDirectional.java23
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/CraftLevelled.java23
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/CraftLightable.java18
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/CraftMultipleFacing.java46
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/CraftOpenable.java18
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/CraftOrientable.java23
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/CraftPowerable.java18
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/CraftRail.java23
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/CraftRotatable.java107
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/CraftSnowable.java18
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/CraftWaterlogged.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBed.java25
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBrewingStand.java39
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBubbleColumn.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftCake.java24
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftChest.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftCommandBlock.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftComparator.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftDaylightDetector.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftDispenser.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftDoor.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftEndPortalFrame.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftFarmland.java24
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftGate.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftHopper.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftJukebox.java14
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftLeaves.java30
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftNoteBlock.java30
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftPiston.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftPistonHead.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftRedstoneWire.java49
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftRepeater.java40
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftSapling.java24
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftSeaPickle.java29
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftSlab.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftSnow.java29
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftStairs.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftStructureBlock.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftSwitch.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftTechnicalPiston.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftTripwire.java19
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/data/type/CraftTurtleEgg.java45
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftAnvil.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftBanner.java118
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftBannerWall.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftBed.java54
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftBeetroot.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftBrewingStand.java49
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftBubbleColumn.java29
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftCactus.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftCake.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftCarrots.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftCauldron.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftChest.java62
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftChestTrapped.java62
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftChorusFlower.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftChorusFruit.java57
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftCobbleWall.java71
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftCocoa.java53
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftCommand.java48
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftCoralFan.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftCrops.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftDaylightDetector.java48
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftDirtSnow.java29
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftDispenser.java48
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftDoor.java90
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftDropper.java48
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftEndRod.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftEnderChest.java48
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftEnderPortalFrame.java48
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftFence.java71
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftFenceGate.java76
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftFire.java76
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftFloorSign.java132
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftFluids.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftFurnace.java48
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftGlassPane.java71
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftGlazedTerracotta.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftGrass.java29
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftHay.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftHopper.java48
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftHugeMushroom.java57
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftIceFrost.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftIronBars.java71
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftJukeBox.java24
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftKelp.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftLadder.java48
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftLeaves.java40
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftLever.java62
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftLogAbstract.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftMinecartDetector.java48
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftMinecartTrack.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftMycel.java29
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftNetherWart.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftNote.java54
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftObserver.java48
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftPiston.java48
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftPistonExtension.java62
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftPistonMoving.java48
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftPortal.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftPotatoes.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftPoweredRail.java48
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftPressurePlateBinary.java29
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftPressurePlateWeighted.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftPumpkinCarved.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneComparator.java62
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneLamp.java29
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneOre.java29
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneTorch.java29
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneTorchWall.java48
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneWire.java78
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftReed.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftRepeater.java83
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftRotatable.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftSapling.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftSeaPickle.java53
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftShulkerBox.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftSkull.java118
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftSkullPlayer.java118
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftSkullPlayerWall.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftSkullWall.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftSnow.java39
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftSoil.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftStainedGlassPane.java71
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftStairs.java76
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftStem.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftStemAttached.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftStepAbstract.java43
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftStoneButton.java62
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftStructure.java29
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftTallPlantFlower.java29
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftTallPlantShearable.java29
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftTallSeaGrass.java29
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftTorchWall.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftTrapdoor.java90
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftTripwire.java99
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftTripwireHook.java62
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftTurtleEgg.java55
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftVine.java57
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftWallSign.java48
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftWitherSkull.java118
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftWitherSkullWall.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/impl/CraftWoodButton.java62
-rw-r--r--src/main/java/org/bukkit/craftbukkit/boss/CraftBossBar.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java12
-rw-r--r--src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java56
-rw-r--r--src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java14
-rw-r--r--src/main/java/org/bukkit/craftbukkit/command/CraftCommandMap.java17
-rw-r--r--src/main/java/org/bukkit/craftbukkit/command/CraftFunctionCommandSender.java47
-rw-r--r--src/main/java/org/bukkit/craftbukkit/command/ProxiedNativeCommandSender.java8
-rw-r--r--src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java163
-rw-r--r--src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java62
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java28
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java28
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java28
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java10
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java18
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java34
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java12
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java6
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java53
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java65
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java10
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java24
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java5
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java6
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java38
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java89
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java6
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftPufferFish.java38
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java28
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java28
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java111
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java28
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java8
-rw-r--r--src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java125
-rw-r--r--src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java133
-rw-r--r--src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java248
-rw-r--r--src/main/java/org/bukkit/craftbukkit/generator/InternalChunkGenerator.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java84
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftFurnaceRecipe.java17
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java67
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCrafting.java5
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java16
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryDoubleChest.java3
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java17
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java127
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java178
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java40
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java186
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCharge.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java97
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java16
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java92
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaTropicalFishBucket.java168
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java9
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java9
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/InventoryWrapper.java15
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java35
-rw-r--r--src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java6
-rw-r--r--src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java10
-rw-r--r--src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java8
-rw-r--r--src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/tag/CraftBlockTag.java28
-rw-r--r--src/main/java/org/bukkit/craftbukkit/tag/CraftItemTag.java28
-rw-r--r--src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java39
-rw-r--r--src/main/java/org/bukkit/craftbukkit/util/Commodore.java268
-rw-r--r--src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java18
-rw-r--r--src/main/java/org/bukkit/craftbukkit/util/CraftEvil.java80
-rw-r--r--src/main/java/org/bukkit/craftbukkit/util/CraftLegacy.java366
-rw-r--r--src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java196
-rw-r--r--src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java254
-rw-r--r--src/main/java/org/bukkit/craftbukkit/util/StructureGrowDelegate.java70
-rw-r--r--src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java2
262 files changed, 10700 insertions, 2125 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftArt.java b/src/main/java/org/bukkit/craftbukkit/CraftArt.java
index 6f94348d..1b17fd2b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftArt.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftArt.java
@@ -1,74 +1,33 @@
package org.bukkit.craftbukkit;
-import net.minecraft.server.EntityPainting.EnumArt;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.BiMap;
+import com.google.common.collect.ImmutableBiMap;
+import net.minecraft.server.MinecraftKey;
+import net.minecraft.server.Paintings;
import org.bukkit.Art;
-// Safety class, will break if either side changes
public class CraftArt {
+ private static final BiMap<Paintings, Art> artwork;
- public static Art NotchToBukkit(EnumArt art) {
- switch (art) {
- case KEBAB: return Art.KEBAB;
- case AZTEC: return Art.AZTEC;
- case ALBAN: return Art.ALBAN;
- case AZTEC_2: return Art.AZTEC2;
- case BOMB: return Art.BOMB;
- case PLANT: return Art.PLANT;
- case WASTELAND: return Art.WASTELAND;
- case POOL: return Art.POOL;
- case COURBET: return Art.COURBET;
- case SEA: return Art.SEA;
- case SUNSET: return Art.SUNSET;
- case CREEBET: return Art.CREEBET;
- case WANDERER: return Art.WANDERER;
- case GRAHAM: return Art.GRAHAM;
- case MATCH: return Art.MATCH;
- case BUST: return Art.BUST;
- case STAGE: return Art.STAGE;
- case VOID: return Art.VOID;
- case SKULL_AND_ROSES: return Art.SKULL_AND_ROSES;
- case FIGHTERS: return Art.FIGHTERS;
- case POINTER: return Art.POINTER;
- case PIGSCENE: return Art.PIGSCENE;
- case BURNING_SKULL: return Art.BURNINGSKULL;
- case SKELETON: return Art.SKELETON;
- case DONKEY_KONG: return Art.DONKEYKONG;
- case WITHER: return Art.WITHER;
- default:
- throw new AssertionError(art);
+ static {
+ ImmutableBiMap.Builder<Paintings, Art> artworkBuilder = ImmutableBiMap.builder();
+ for (MinecraftKey key : Paintings.a.keySet()) {
+ artworkBuilder.put(Paintings.a.get(key), Art.getByName(key.getKey()));
}
+
+ artwork = artworkBuilder.build();
}
- public static EnumArt BukkitToNotch(Art art) {
- switch (art) {
- case KEBAB: return EnumArt.KEBAB;
- case AZTEC: return EnumArt.AZTEC;
- case ALBAN: return EnumArt.ALBAN;
- case AZTEC2: return EnumArt.AZTEC_2;
- case BOMB: return EnumArt.BOMB;
- case PLANT: return EnumArt.PLANT;
- case WASTELAND: return EnumArt.WASTELAND;
- case POOL: return EnumArt.POOL;
- case COURBET: return EnumArt.COURBET;
- case SEA: return EnumArt.SEA;
- case SUNSET: return EnumArt.SUNSET;
- case CREEBET: return EnumArt.CREEBET;
- case WANDERER: return EnumArt.WANDERER;
- case GRAHAM: return EnumArt.GRAHAM;
- case MATCH: return EnumArt.MATCH;
- case BUST: return EnumArt.BUST;
- case STAGE: return EnumArt.STAGE;
- case VOID: return EnumArt.VOID;
- case SKULL_AND_ROSES: return EnumArt.SKULL_AND_ROSES;
- case FIGHTERS: return EnumArt.FIGHTERS;
- case POINTER: return EnumArt.POINTER;
- case PIGSCENE: return EnumArt.PIGSCENE;
- case BURNINGSKULL: return EnumArt.BURNING_SKULL;
- case SKELETON: return EnumArt.SKELETON;
- case DONKEYKONG: return EnumArt.DONKEY_KONG;
- case WITHER: return EnumArt.WITHER;
- default:
- throw new AssertionError(art);
- }
+ public static Art NotchToBukkit(Paintings art) {
+ Art bukkit = artwork.get(art);
+ Preconditions.checkArgument(bukkit != null);
+ return bukkit;
+ }
+
+ public static Paintings BukkitToNotch(Art art) {
+ Paintings nms = artwork.inverse().get(art);
+ Preconditions.checkArgument(nms != null);
+ return nms;
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
index 0cc838cc..b0297c64 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -20,7 +20,7 @@ public class CraftChunk implements Chunk {
private final int x;
private final int z;
private static final byte[] emptyData = new byte[2048];
- private static final short[] emptyBlockIDs = new short[4096];
+ private static final DataPaletteBlock<IBlockData> emptyBlockIDs = new ChunkSection(0, false).getBlocks();
private static final byte[] emptySkyLight = new byte[2048];
public CraftChunk(net.minecraft.server.Chunk chunk) {
@@ -69,7 +69,7 @@ public class CraftChunk implements Chunk {
}
public Block getBlock(int x, int y, int z) {
- return new CraftBlock(this, (getX() << 4) | (x & 0xF), y, (getZ() << 4) | (z & 0xF));
+ return new CraftBlock(worldServer, new BlockPosition((this.x << 4) | x, y, (this.z << 4) | z));
}
public Entity[] getEntities() {
@@ -133,7 +133,7 @@ public class CraftChunk implements Chunk {
@Override
public boolean isSlimeChunk() {
// 987234911L is deterimined in EntitySlime when seeing if a slime can spawn in a chunk
- return getHandle().a(987234911L).nextInt(10) == 0;
+ return SeededRandom.a(getX(), getZ(), getWorld().getSeed(), 987234911L).nextInt(10) == 0;
}
public boolean unload(boolean save) {
@@ -152,8 +152,7 @@ public class CraftChunk implements Chunk {
net.minecraft.server.Chunk chunk = getHandle();
ChunkSection[] cs = chunk.getSections();
- short[][] sectionBlockIDs = new short[cs.length][];
- byte[][] sectionBlockData = new byte[cs.length][];
+ DataPaletteBlock[] sectionBlockIDs = new DataPaletteBlock[cs.length];
byte[][] sectionSkyLights = new byte[cs.length][];
byte[][] sectionEmitLights = new byte[cs.length][];
boolean[] sectionEmpty = new boolean[cs.length];
@@ -161,28 +160,20 @@ public class CraftChunk implements Chunk {
for (int i = 0; i < cs.length; i++) {
if (cs[i] == null) { // Section is empty?
sectionBlockIDs[i] = emptyBlockIDs;
- sectionBlockData[i] = emptyData;
sectionSkyLights[i] = emptySkyLight;
sectionEmitLights[i] = emptyData;
sectionEmpty[i] = true;
} else { // Not empty
- short[] blockids = new short[4096];
+ NBTTagCompound data = new NBTTagCompound();
+ cs[i].getBlocks().b(data, "Spigot", "Magic");
- byte[] rawIds = new byte[4096];
- NibbleArray data = new NibbleArray();
- cs[i].getBlocks().exportData(rawIds, data);
-
- byte[] dataValues = sectionBlockData[i] = data.asBytes();
-
- // Copy base IDs
- for (int j = 0; j < 4096; j++) {
- blockids[j] = (short) (rawIds[j] & 0xFF);
- }
+ DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.server.Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData()); // TODO: snapshot whole ChunkSection
+ blockids.a(data, "Spigot", "Magic");
sectionBlockIDs[i] = blockids;
if (cs[i].getSkyLightArray() == null) {
- sectionSkyLights[i] = emptyData;
+ sectionSkyLights[i] = emptySkyLight;
} else {
sectionSkyLights[i] = new byte[2048];
System.arraycopy(cs[i].getSkyLightArray().asBytes(), 0, sectionSkyLights[i], 0, 2048);
@@ -192,57 +183,46 @@ public class CraftChunk implements Chunk {
}
}
- int[] hmap = null;
+ HeightMap hmap = null;
if (includeMaxBlockY) {
- hmap = new int[256]; // Get copy of height map
- System.arraycopy(chunk.heightMap, 0, hmap, 0, 256);
+ hmap = new HeightMap(null, HeightMap.Type.LIGHT_BLOCKING);
+ hmap.a(chunk.heightMap.get(HeightMap.Type.LIGHT_BLOCKING).b());
}
BiomeBase[] biome = null;
double[] biomeTemp = null;
- double[] biomeRain = null;
if (includeBiome || includeBiomeTempRain) {
- WorldChunkManager wcm = chunk.world.getWorldChunkManager();
+ WorldChunkManager wcm = worldServer.getChunkProvider().getChunkGenerator().getWorldChunkManager();
if (includeBiome) {
biome = new BiomeBase[256];
for (int i = 0; i < 256; i++) {
- biome[i] = chunk.getBiome(new BlockPosition(i & 0xF, 0, i >> 4), wcm);
+ biome[i] = chunk.getBiome(new BlockPosition(i & 0xF, 0, i >> 4));
}
}
if (includeBiomeTempRain) {
biomeTemp = new double[256];
- biomeRain = new double[256];
float[] dat = getTemperatures(wcm, getX() << 4, getZ() << 4);
for (int i = 0; i < 256; i++) {
biomeTemp[i] = dat[i];
}
-
- /* Removed 15w46a
- dat = wcm.getWetness(null, getX() << 4, getZ() << 4, 16, 16);
-
- for (int i = 0; i < 256; i++) {
- biomeRain[i] = dat[i];
- }
- */
}
}
World world = getWorld();
- return new CraftChunkSnapshot(getX(), getZ(), world.getName(), world.getFullTime(), sectionBlockIDs, sectionBlockData, sectionSkyLights, sectionEmitLights, sectionEmpty, hmap, biome, biomeTemp, biomeRain);
+ return new CraftChunkSnapshot(getX(), getZ(), world.getName(), world.getFullTime(), sectionBlockIDs, sectionSkyLights, sectionEmitLights, sectionEmpty, hmap, biome, biomeTemp);
}
public static ChunkSnapshot getEmptyChunkSnapshot(int x, int z, CraftWorld world, boolean includeBiome, boolean includeBiomeTempRain) {
BiomeBase[] biome = null;
double[] biomeTemp = null;
- double[] biomeRain = null;
if (includeBiome || includeBiomeTempRain) {
- WorldChunkManager wcm = world.getHandle().getWorldChunkManager();
+ WorldChunkManager wcm = world.getHandle().getChunkProvider().getChunkGenerator().getWorldChunkManager();
if (includeBiome) {
biome = new BiomeBase[256];
@@ -253,44 +233,33 @@ public class CraftChunk implements Chunk {
if (includeBiomeTempRain) {
biomeTemp = new double[256];
- biomeRain = new double[256];
float[] dat = getTemperatures(wcm, x << 4, z << 4);
for (int i = 0; i < 256; i++) {
biomeTemp[i] = dat[i];
}
-
- /* Removed 15w46a
- dat = wcm.getWetness(null, x << 4, z << 4, 16, 16);
-
- for (int i = 0; i < 256; i++) {
- biomeRain[i] = dat[i];
- }
- */
}
}
/* Fill with empty data */
int hSection = world.getMaxHeight() >> 4;
- short[][] blockIDs = new short[hSection][];
+ DataPaletteBlock[] blockIDs = new DataPaletteBlock[hSection];
byte[][] skyLight = new byte[hSection][];
byte[][] emitLight = new byte[hSection][];
- byte[][] blockData = new byte[hSection][];
boolean[] empty = new boolean[hSection];
for (int i = 0; i < hSection; i++) {
blockIDs[i] = emptyBlockIDs;
skyLight[i] = emptySkyLight;
emitLight[i] = emptyData;
- blockData[i] = emptyData;
empty[i] = true;
}
- return new CraftChunkSnapshot(x, z, world.getName(), world.getFullTime(), blockIDs, blockData, skyLight, emitLight, empty, new int[256], biome, biomeTemp, biomeRain);
+ return new CraftChunkSnapshot(x, z, world.getName(), world.getFullTime(), blockIDs, skyLight, emitLight, empty, new HeightMap(null, HeightMap.Type.LIGHT_BLOCKING), biome, biomeTemp);
}
private static float[] getTemperatures(WorldChunkManager chunkmanager, int chunkX, int chunkZ) {
- BiomeBase[] biomes = chunkmanager.getBiomes(null, chunkX, chunkZ, 16, 16);
+ BiomeBase[] biomes = chunkmanager.getBiomes(chunkX, chunkZ, 16, 16);
float[] temps = new float[biomes.length];
for (int i = 0; i < biomes.length; i++) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java
index c0fb34b9..8032f358 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java
@@ -3,9 +3,15 @@ package org.bukkit.craftbukkit;
import org.bukkit.ChunkSnapshot;
import org.bukkit.Material;
import org.bukkit.block.Biome;
+import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import net.minecraft.server.BiomeBase;
+import net.minecraft.server.DataPaletteBlock;
+import net.minecraft.server.HeightMap;
+import net.minecraft.server.IBlockData;
/**
* Represents a static, thread-safe snapshot of chunk of blocks
@@ -14,31 +20,27 @@ import net.minecraft.server.BiomeBase;
public class CraftChunkSnapshot implements ChunkSnapshot {
private final int x, z;
private final String worldname;
- private final short[][] blockids; /* Block IDs, by section */
- private final byte[][] blockdata;
+ private final DataPaletteBlock<IBlockData>[] blockids;
private final byte[][] skylight;
private final byte[][] emitlight;
private final boolean[] empty;
- private final int[] hmap; // Height map
+ private final HeightMap hmap; // Height map
private final long captureFulltime;
private final BiomeBase[] biome;
private final double[] biomeTemp;
- private final double[] biomeRain;
- CraftChunkSnapshot(int x, int z, String wname, long wtime, short[][] sectionBlockIDs, byte[][] sectionBlockData, byte[][] sectionSkyLights, byte[][] sectionEmitLights, boolean[] sectionEmpty, int[] hmap, BiomeBase[] biome, double[] biomeTemp, double[] biomeRain) {
+ CraftChunkSnapshot(int x, int z, String wname, long wtime, DataPaletteBlock<IBlockData>[] sectionBlockIDs, byte[][] sectionSkyLights, byte[][] sectionEmitLights, boolean[] sectionEmpty, HeightMap hmap, BiomeBase[] biome, double[] biomeTemp) {
this.x = x;
this.z = z;
this.worldname = wname;
this.captureFulltime = wtime;
this.blockids = sectionBlockIDs;
- this.blockdata = sectionBlockData;
this.skylight = sectionSkyLights;
this.emitlight = sectionEmitLights;
this.empty = sectionEmpty;
this.hmap = hmap;
this.biome = biome;
this.biomeTemp = biomeTemp;
- this.biomeRain = biomeRain;
}
public int getX() {
@@ -55,16 +57,17 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
@Override
public Material getBlockType(int x, int y, int z) {
- return Material.getMaterial(getBlockTypeId(x, y, z));
+ return CraftMagicNumbers.getMaterial(blockids[y >> 4].a(x, y & 0xF, z).getBlock());
}
- public final int getBlockTypeId(int x, int y, int z) {
- return blockids[y >> 4][((y & 0xF) << 8) | (z << 4) | x];
+ @Override
+ public final BlockData getBlockData(int x, int y, int z) {
+ return CraftBlockData.fromData(blockids[y >> 4].a(x, y & 0xF, z));
}
- public final int getBlockData(int x, int y, int z) {
- int off = ((y & 0xF) << 7) | (z << 3) | (x >> 1);
- return (blockdata[y >> 4][off] >> ((x & 1) << 2)) & 0xF;
+ @Override
+ public final int getData(int x, int y, int z) {
+ return CraftMagicNumbers.toLegacyData(blockids[y >> 4].a(x, y & 0xF, z));
}
public final int getBlockSkyLight(int x, int y, int z) {
@@ -78,7 +81,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
}
public final int getHighestBlockYAt(int x, int z) {
- return hmap[z << 4 | x];
+ return hmap.a(x, z);
}
public final Biome getBiome(int x, int z) {
@@ -89,10 +92,6 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
return biomeTemp[z << 4 | x];
}
- public final double getRawBiomeRainfall(int x, int z) {
- return biomeRain[z << 4 | x];
- }
-
public final long getCaptureFullTime() {
return captureFulltime;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java b/src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java
index 67f28566..921a57f5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java
@@ -12,6 +12,7 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import net.minecraft.server.MinecraftServer;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
public class CraftCrashReport implements CrashReportCallable<Object> {
@@ -22,7 +23,8 @@ public class CraftCrashReport implements CrashReportCallable<Object> {
value.append("\n Plugins: {");
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
PluginDescriptionFile description = plugin.getDescription();
- value.append(' ').append(description.getFullName()).append(' ').append(description.getMain()).append(' ').append(Arrays.toString(description.getAuthors().toArray())).append(',');
+ boolean legacy = CraftMagicNumbers.isLegacy(description);
+ value.append(' ').append(description.getFullName()).append(legacy ? "*" : "").append(' ').append(description.getMain()).append(' ').append(Arrays.toString(description.getAuthors().toArray())).append(',');
}
value.append("}\n Warnings: ").append(Bukkit.getWarningState().name());
value.append("\n Reload Count: ").append(String.valueOf(MinecraftServer.getServer().server.reloadCount));
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftEffect.java b/src/main/java/org/bukkit/craftbukkit/CraftEffect.java
index 16721835..c6edd7a5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftEffect.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftEffect.java
@@ -1,9 +1,12 @@
package org.bukkit.craftbukkit;
+import net.minecraft.server.Block;
+import net.minecraft.server.Item;
import org.apache.commons.lang.Validate;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.potion.Potion;
public class CraftEffect {
@@ -18,7 +21,7 @@ public class CraftEffect {
break;
case RECORD_PLAY:
Validate.isTrue(((Material) data).isRecord(), "Invalid record type!");
- datavalue = ((Material) data).getId();
+ datavalue = Item.getId(CraftMagicNumbers.getItem((Material) data));
break;
case SMOKE:
switch((BlockFace) data) { // TODO: Verify (Where did these values come from...?)
@@ -56,7 +59,7 @@ public class CraftEffect {
break;
case STEP_SOUND:
Validate.isTrue(((Material) data).isBlock(), "Material is not a block!");
- datavalue = ((Material) data).getId();
+ datavalue = Block.getCombinedId(CraftMagicNumbers.getBlock((Material) data).getBlockData());
break;
default:
datavalue = 0;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
index 45217866..7b49f673 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
@@ -9,6 +9,7 @@ import java.util.UUID;
import net.minecraft.server.EntityPlayer;
import net.minecraft.server.NBTTagCompound;
+import net.minecraft.server.WhiteListEntry;
import net.minecraft.server.WorldNBTStorage;
import org.bukkit.BanList;
@@ -115,9 +116,9 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
public void setWhitelisted(boolean value) {
if (value) {
- server.getHandle().addWhitelist(profile);
+ server.getHandle().getWhitelist().add(new WhiteListEntry(profile));
} else {
- server.getHandle().removeWhitelist(profile);
+ server.getHandle().getWhitelist().remove(profile);
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftParticle.java b/src/main/java/org/bukkit/craftbukkit/CraftParticle.java
index 4128e838..291f46fe 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftParticle.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftParticle.java
@@ -1,41 +1,151 @@
package org.bukkit.craftbukkit;
-import net.minecraft.server.Block;
-import net.minecraft.server.EnumParticle;
-import net.minecraft.server.IBlockData;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.BiMap;
+import com.google.common.collect.HashBiMap;
+import java.util.HashMap;
+import java.util.Map;
+import net.minecraft.server.MinecraftKey;
+import net.minecraft.server.ParticleParam;
+import net.minecraft.server.ParticleParamBlock;
+import net.minecraft.server.ParticleParamItem;
+import net.minecraft.server.ParticleParamRedstone;
+import net.minecraft.server.ParticleType;
+import org.bukkit.Color;
import org.bukkit.Particle;
+import org.bukkit.block.data.BlockData;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
-public class CraftParticle {
+public enum CraftParticle {
- public static EnumParticle toNMS(Particle bukkit) {
- return EnumParticle.valueOf(bukkit.name());
+ EXPLOSION_NORMAL("poof"),
+ EXPLOSION_LARGE("explosion"),
+ EXPLOSION_HUGE("explosion_emitter"),
+ FIREWORKS_SPARK("firework"),
+ WATER_BUBBLE("bubble"),
+ WATER_SPLASH("splash"),
+ WATER_WAKE("fishing"),
+ SUSPENDED("underwater"),
+ SUSPENDED_DEPTH("underwater"),
+ CRIT("crit"),
+ CRIT_MAGIC("enchanted_hit"),
+ SMOKE_NORMAL("smoke"),
+ SMOKE_LARGE("large_smoke"),
+ SPELL("effect"),
+ SPELL_INSTANT("instant_effect"),
+ SPELL_MOB("entity_effect"),
+ SPELL_MOB_AMBIENT("ambient_entity_effect"),
+ SPELL_WITCH("witch"),
+ DRIP_WATER("dripping_water"),
+ DRIP_LAVA("dripping_lava"),
+ VILLAGER_ANGRY("angry_villager"),
+ VILLAGER_HAPPY("happy_villager"),
+ TOWN_AURA("mycelium"),
+ NOTE("note"),
+ PORTAL("portal"),
+ ENCHANTMENT_TABLE("enchant"),
+ FLAME("flame"),
+ LAVA("lava"),
+ CLOUD("cloud"),
+ REDSTONE("dust"),
+ SNOWBALL("item_snowball"),
+ SNOW_SHOVEL("item_snowball"),
+ SLIME("item_slime"),
+ HEART("heart"),
+ BARRIER("barrier"),
+ ITEM_CRACK("item"),
+ BLOCK_CRACK("block"),
+ BLOCK_DUST("block"),
+ WATER_DROP("rain"),
+ MOB_APPEARANCE("elder_guardian"),
+ DRAGON_BREATH("dragon_breath"),
+ END_ROD("end_rod"),
+ DAMAGE_INDICATOR("damage_indicator"),
+ SWEEP_ATTACK("sweep_attack"),
+ FALLING_DUST("falling_dust"),
+ TOTEM("totem_of_undying"),
+ SPIT("spit"),
+ SQUID_INK("squid_ink"),
+ BUBBLE_POP("bubble_pop"),
+ CURRENT_DOWN("current_down"),
+ BUBBLE_COLUMN_UP("bubble_column_up"),
+ NAUTILUS("nautilus"),
+ DOLPHIN("dolphin"),
+ // ----- Legacy Separator -----
+ LEGACY_BLOCK_CRACK("block"),
+ LEGACY_BLOCK_DUST("block"),
+ LEGACY_FALLING_DUST("falling_dust");
+ private final MinecraftKey minecraftKey;
+ private final Particle bukkit;
+ private static final BiMap<Particle, MinecraftKey> particles;
+ private static final Map<Particle, Particle> aliases;
+
+ static {
+ particles = HashBiMap.create();
+ aliases = new HashMap<>();
+
+ for (CraftParticle particle : CraftParticle.values()) {
+ if (particles.containsValue(particle.minecraftKey)) {
+ aliases.put(particle.bukkit, particles.inverse().get(particle.minecraftKey));
+ } else {
+ particles.put(particle.bukkit, particle.minecraftKey);
+ }
+ }
}
- public static Particle toBukkit(EnumParticle nms) {
- return Particle.valueOf(nms.name());
+ private CraftParticle(String minecraftKey) {
+ this.minecraftKey = new MinecraftKey(minecraftKey);
+
+ this.bukkit = Particle.valueOf(this.name());
+ Preconditions.checkState(bukkit != null, "Bukkit particle %s does not exist", this.name());
}
- public static int[] toData(Particle particle, Object obj) {
+ public static ParticleParam toNMS(Particle bukkit) {
+ return toNMS(bukkit, null);
+ }
+
+ public static <T> ParticleParam toNMS(Particle particle, T obj) {
+ Particle canonical = particle;
+ if (aliases.containsKey(particle)) {
+ canonical = aliases.get(particle);
+ }
+
+ net.minecraft.server.Particle nms = net.minecraft.server.Particle.REGISTRY.get(particles.get(canonical));
+ Preconditions.checkArgument(nms != null, "No NMS particle %s", particle);
+
if (particle.getDataType().equals(Void.class)) {
- return new int[0];
+ return (ParticleType) nms;
}
+ Preconditions.checkArgument(obj != null, "Particle %s requires data, null provided", particle);
if (particle.getDataType().equals(ItemStack.class)) {
- if (obj == null) {
- return new int[]{0, 0};
- }
ItemStack itemStack = (ItemStack) obj;
- return new int[]{itemStack.getType().getId(), itemStack.getDurability()};
+ return new ParticleParamItem((net.minecraft.server.Particle<ParticleParamItem>) nms, CraftItemStack.asNMSCopy(itemStack));
}
- if (particle.getDataType().equals(MaterialData.class)) {
- if (obj == null) {
- return new int[]{0};
- }
+ if (particle.getDataType() == MaterialData.class) {
MaterialData data = (MaterialData) obj;
- return new int[]{data.getItemTypeId() + ((int)(data.getData()) << 12)};
+ return new ParticleParamBlock((net.minecraft.server.Particle<ParticleParamBlock>) nms, CraftMagicNumbers.getBlock(data));
+ }
+ if (particle.getDataType() == BlockData.class) {
+ BlockData data = (BlockData) obj;
+ return new ParticleParamBlock((net.minecraft.server.Particle<ParticleParamBlock>) nms, ((CraftBlockData) data).getState());
+ }
+ if (particle.getDataType() == Particle.DustOptions.class) {
+ Particle.DustOptions data = (Particle.DustOptions) obj;
+ Color color = data.getColor();
+ return new ParticleParamRedstone(color.getRed(), color.getGreen(), color.getBlue(), data.getSize());
}
throw new IllegalArgumentException(particle.getDataType().toString());
}
+
+ public static Particle toBukkit(net.minecraft.server.ParticleParam nms) {
+ return toBukkit(nms.b());
+ }
+
+ public static Particle toBukkit(net.minecraft.server.Particle nms) {
+ return particles.inverse().get(nms.d());
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0eaf9dab..db82051c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -8,6 +8,7 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
@@ -17,6 +18,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
+import java.util.function.Consumer;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
@@ -52,7 +54,6 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.configuration.serialization.ConfigurationSerialization;
import org.bukkit.conversations.Conversable;
import org.bukkit.craftbukkit.boss.CraftBossBar;
-import org.bukkit.craftbukkit.command.VanillaCommandWrapper;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.generator.CraftChunkData;
import org.bukkit.craftbukkit.help.SimpleHelpMap;
@@ -122,14 +123,28 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import com.google.common.collect.MapMaker;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParser;
import com.mojang.authlib.GameProfile;
+import com.mojang.brigadier.builder.LiteralArgumentBuilder;
+import com.mojang.brigadier.tree.CommandNode;
+import com.mojang.brigadier.tree.LiteralCommandNode;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufOutputStream;
import io.netty.buffer.Unpooled;
import io.netty.handler.codec.base64.Base64;
+import java.util.HashMap;
import jline.console.ConsoleReader;
+import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
+import org.bukkit.block.data.BlockData;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+import org.bukkit.craftbukkit.command.BukkitCommandWrapper;
+import org.bukkit.craftbukkit.command.CraftCommandMap;
+import org.bukkit.craftbukkit.command.VanillaCommandWrapper;
+import org.bukkit.craftbukkit.tag.CraftBlockTag;
+import org.bukkit.craftbukkit.tag.CraftItemTag;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.event.server.TabCompleteEvent;
@@ -140,7 +155,7 @@ public final class CraftServer implements Server {
private final Logger logger = Logger.getLogger("Minecraft");
private final ServicesManager servicesManager = new SimpleServicesManager();
private final CraftScheduler scheduler = new CraftScheduler();
- private final SimpleCommandMap commandMap = new SimpleCommandMap(this);
+ private final CraftCommandMap commandMap = new CraftCommandMap(this);
private final SimpleHelpMap helpMap = new SimpleHelpMap(this);
private final StandardMessenger messenger = new StandardMessenger();
private final SimplePluginManager pluginManager = new SimplePluginManager(this, commandMap);
@@ -168,7 +183,6 @@ public final class CraftServer implements Server {
private boolean printSaveWarning;
private CraftIconCache icon;
private boolean overrideAllCommandBlockCommands = false;
- private boolean unrestrictedAdvancements;
private final List<CraftPlayer> playerView;
public int reloadCount;
@@ -245,7 +259,6 @@ public final class CraftServer implements Server {
saveCommandsConfig();
overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*");
- unrestrictedAdvancements = commandsConfiguration.getBoolean("unrestricted-advancements");
pluginManager.useTimings(configuration.getBoolean("settings.plugin-profiling"));
monsterSpawn = configuration.getInt("spawn-limits.monsters");
animalSpawn = configuration.getInt("spawn-limits.animals");
@@ -258,14 +271,6 @@ public final class CraftServer implements Server {
loadIcon();
}
- public boolean getPermissionOverride(ICommandListener listener) {
- while (listener instanceof CommandListenerWrapper) {
- listener = ((CommandListenerWrapper) listener).base;
- }
-
- return unrestrictedAdvancements && listener instanceof AdvancementRewards.AdvancementCommandListener;
- }
-
public boolean getCommandBlockOverride(String command) {
return overrideAllCommandBlockCommands || commandsConfiguration.getStringList("command-block-overrides").contains(command);
}
@@ -337,6 +342,7 @@ public final class CraftServer implements Server {
DefaultPermissions.registerCorePermissions();
CraftDefaultPermissions.registerCorePermissions();
helpMap.initializeCommands();
+ syncCommands();
}
}
@@ -345,9 +351,43 @@ public final class CraftServer implements Server {
}
private void setVanillaCommands() {
- Map<String, ICommand> commands = new CommandDispatcher(console).getCommands();
- for (ICommand cmd : commands.values()) {
- commandMap.register("minecraft", new VanillaCommandWrapper((CommandAbstract) cmd, LocaleI18n.get(cmd.getUsage(null))));
+ CommandDispatcher dispatcher = console.getCommandDispatcher();
+
+ // Build a list of all Vanilla commands and create wrappers
+ for (CommandNode<CommandListenerWrapper> cmd : dispatcher.a().getRoot().getChildren()) {
+ commandMap.register("minecraft", new VanillaCommandWrapper(dispatcher, cmd));
+ }
+ }
+
+ private void syncCommands() {
+ // Clear existing commands
+ CommandDispatcher dispatcher = console.commandDispatcher = new CommandDispatcher();
+
+ // Register all commands, vanilla ones will be using the old dispatcher references
+ for (Map.Entry<String, Command> entry : commandMap.getKnownCommands().entrySet()) {
+ String label = entry.getKey();
+ Command command = entry.getValue();
+
+ if (command instanceof VanillaCommandWrapper) {
+ LiteralCommandNode<CommandListenerWrapper> node = (LiteralCommandNode<CommandListenerWrapper>) ((VanillaCommandWrapper) command).vanillaCommand;
+ if (!node.getLiteral().equals(label)) {
+ LiteralCommandNode<CommandListenerWrapper> clone = new LiteralCommandNode(label, node.getCommand(), node.getRequirement(), node.getRedirect(), node.getRedirectModifier(), node.isFork());
+
+ for (CommandNode<CommandListenerWrapper> child : node.getChildren()) {
+ clone.addChild(child);
+ }
+ node = clone;
+ }
+
+ dispatcher.a().getRoot().addChild(node);
+ } else {
+ new BukkitCommandWrapper(this, entry.getValue()).register(dispatcher.a(), label);
+ }
+ }
+
+ // Refresh commands
+ for (EntityPlayer player : getHandle().players) {
+ dispatcher.a(player);
}
}
@@ -837,23 +877,23 @@ public final class CraftServer implements Server {
generator = getGenerator(name);
}
- Convertable converter = new WorldLoaderServer(getWorldContainer(), getHandle().getServer().dataConverterManager);
+ Convertable converter = new WorldLoaderServer(getWorldContainer().toPath(), getWorldContainer().toPath().resolveSibling("../backups"), getHandle().getServer().dataConverterManager);
if (converter.isConvertable(name)) {
getLogger().info("Converting world '" + name + "'");
converter.convert(name, new IProgressUpdate() {
private long b = System.currentTimeMillis();
- public void a(String s) {}
+ public void a(IChatBaseComponent ichatbasecomponent) {}
public void a(int i) {
if (System.currentTimeMillis() - this.b >= 1000L) {
this.b = System.currentTimeMillis();
- MinecraftServer.LOGGER.info("Converting... " + i + "%");
+ MinecraftServer.LOGGER.info("Converting... {}%", Integer.valueOf(i));
}
}
- public void c(String s) {}
+ public void c(IChatBaseComponent ichatbasecomponent) {}
});
}
@@ -870,12 +910,15 @@ public final class CraftServer implements Server {
} while(used);
boolean hardcore = false;
- IDataManager sdm = new ServerNBTManager(getWorldContainer(), name, true, getHandle().getServer().dataConverterManager);
+ IDataManager sdm = new ServerNBTManager(getWorldContainer(), name, getServer(), getHandle().getServer().dataConverterManager);
WorldData worlddata = sdm.getWorldData();
WorldSettings worldSettings = null;
if (worlddata == null) {
worldSettings = new WorldSettings(creator.seed(), EnumGamemode.getById(getDefaultGameMode().getValue()), generateStructures, hardcore, type);
- worldSettings.setGeneratorSettings(creator.generatorSettings());
+ JsonElement parsedSettings = new JsonParser().parse(creator.generatorSettings());
+ if (parsedSettings.isJsonObject()) {
+ worldSettings.setGeneratorSettings(parsedSettings.getAsJsonObject());
+ }
worlddata = new WorldData(worldSettings, name);
}
worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
@@ -888,7 +931,6 @@ public final class CraftServer implements Server {
if (worldSettings != null) {
internal.a(worldSettings);
}
- internal.scoreboard = getScoreboardManager().getMainScoreboard().getHandle();
internal.tracker = new EntityTracker(internal);
internal.addIWorldAccess(new WorldManager(console, internal));
@@ -962,7 +1004,7 @@ public final class CraftServer implements Server {
if (save) {
try {
handle.save(true, null);
- handle.saveLevel();
+ handle.close();
} catch (ExceptionWorldConflict ex) {
getLogger().log(Level.SEVERE, null, ex);
}
@@ -1075,19 +1117,12 @@ public final class CraftServer implements Server {
@Override
public void clearRecipes() {
- CraftingManager.recipes = new RegistryMaterials();
- RecipesFurnace.getInstance().recipes.clear();
- RecipesFurnace.getInstance().customRecipes.clear();
- RecipesFurnace.getInstance().customExperience.clear();
+ console.getCraftingManager().recipes.clear();
}
@Override
public void resetRecipes() {
- CraftingManager.recipes = new RegistryMaterials();
- CraftingManager.init();
- RecipesFurnace.getInstance().recipes = new RecipesFurnace().recipes;
- RecipesFurnace.getInstance().customRecipes.clear();
- RecipesFurnace.getInstance().customExperience.clear();
+ console.getCraftingManager().a(console.getResourceManager());
}
@Override
@@ -1192,7 +1227,7 @@ public final class CraftServer implements Server {
@Deprecated
public CraftMapView getMap(short id) {
PersistentCollection collection = console.worlds.get(0).worldMaps;
- WorldMap worldmap = (WorldMap) collection.get(WorldMap.class, "map_" + id);
+ WorldMap worldmap = (WorldMap) collection.get(WorldMap::new, "map_" + id);
if (worldmap == null) {
return null;
}
@@ -1203,8 +1238,8 @@ public final class CraftServer implements Server {
public CraftMapView createMap(World world) {
Validate.notNull(world, "World cannot be null");
- net.minecraft.server.ItemStack stack = new net.minecraft.server.ItemStack(Items.MAP, 1, -1);
- WorldMap worldmap = Items.FILLED_MAP.getSavedMap(stack, ((CraftWorld) world).getHandle());
+ net.minecraft.server.ItemStack stack = new net.minecraft.server.ItemStack(Items.MAP, 1);
+ WorldMap worldmap = ItemWorldMap.getSavedMap(stack, ((CraftWorld) world).getHandle());
return worldmap.mapView;
}
@@ -1522,15 +1557,15 @@ public final class CraftServer implements Server {
return warningState;
}
- public List<String> tabComplete(net.minecraft.server.ICommandListener sender, String message, BlockPosition pos, boolean forceCommand) {
- if (!(sender instanceof EntityPlayer)) {
+ public List<String> tabComplete(CommandSender sender, String message, WorldServer world, Vec3D pos, boolean forceCommand) {
+ if (!(sender instanceof Player)) {
return ImmutableList.of();
}
List<String> offers;
- Player player = ((EntityPlayer) sender).getBukkitEntity();
+ Player player = (Player) sender;
if (message.startsWith("/") || forceCommand) {
- offers = tabCompleteCommand(player, message, pos);
+ offers = tabCompleteCommand(player, message, world, pos);
} else {
offers = tabCompleteChat(player, message);
}
@@ -1541,7 +1576,7 @@ public final class CraftServer implements Server {
return tabEvent.isCancelled() ? Collections.EMPTY_LIST : tabEvent.getCompletions();
}
- public List<String> tabCompleteCommand(Player player, String message, BlockPosition pos) {
+ public List<String> tabCompleteCommand(Player player, String message, WorldServer world, Vec3D pos) {
List<String> completions = null;
try {
if (message.startsWith("/")) {
@@ -1551,7 +1586,7 @@ public final class CraftServer implements Server {
if (pos == null) {
completions = getCommandMap().tabComplete(player, message);
} else {
- completions = getCommandMap().tabComplete(player, message, new Location(player.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
+ completions = getCommandMap().tabComplete(player, message, new Location(world.getWorld(), pos.x, pos.y, pos.z));
}
} catch (CommandException ex) {
player.sendMessage(ChatColor.RED + "An internal error occurred while attempting to tab-complete this command");
@@ -1660,8 +1695,15 @@ public final class CraftServer implements Server {
@Override
public Entity getEntity(UUID uuid) {
Validate.notNull(uuid, "UUID cannot be null");
- net.minecraft.server.Entity entity = console.a(uuid); // PAIL: getEntity
- return entity == null ? null : entity.getBukkitEntity();
+
+ for (WorldServer world : getServer().worlds) {
+ net.minecraft.server.Entity entity = world.getEntity(uuid);
+ if (entity != null) {
+ return entity.getBukkitEntity();
+ }
+ }
+
+ return null;
}
@Override
@@ -1674,7 +1716,7 @@ public final class CraftServer implements Server {
@Override
public Iterator<org.bukkit.advancement.Advancement> advancementIterator() {
- return Iterators.unmodifiableIterator(Iterators.transform(console.getAdvancementData().c().iterator(), new Function<Advancement, org.bukkit.advancement.Advancement>() { // PAIL: rename
+ return Iterators.unmodifiableIterator(Iterators.transform(console.getAdvancementData().b().iterator(), new Function<Advancement, org.bukkit.advancement.Advancement>() { // PAIL: rename
@Override
public org.bukkit.advancement.Advancement apply(Advancement advancement) {
return advancement.bukkit;
@@ -1682,6 +1724,55 @@ public final class CraftServer implements Server {
}));
}
+ @Override
+ public BlockData createBlockData(org.bukkit.Material material) {
+ Validate.isTrue(material != null, "Must provide material");
+
+ return createBlockData(material, (String) null);
+ }
+
+ @Override
+ public BlockData createBlockData(org.bukkit.Material material, Consumer<BlockData> consumer) {
+ BlockData data = createBlockData(material);
+
+ if (consumer != null) {
+ consumer.accept(data);
+ }
+
+ return data;
+ }
+
+ @Override
+ public BlockData createBlockData(String data) throws IllegalArgumentException {
+ Validate.isTrue(data != null, "Must provide data");
+
+ return createBlockData(null, data);
+ }
+
+ @Override
+ public BlockData createBlockData(org.bukkit.Material material, String data) {
+ Validate.isTrue(material != null || data != null, "Must provide one of material or data");
+
+ return CraftBlockData.newData(material, data);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends Keyed> org.bukkit.Tag<T> getTag(String registry, NamespacedKey tag, Class<T> clazz) {
+ switch (registry) {
+ case org.bukkit.Tag.REGISTRY_BLOCKS:
+ Preconditions.checkArgument(clazz == org.bukkit.Material.class, "Block namespace must have material type");
+
+ return (org.bukkit.Tag<T>) new CraftBlockTag(console.getTagRegistry().a().b(CraftNamespacedKey.toMinecraft(tag)));
+ case org.bukkit.Tag.REGISTRY_ITEMS:
+ Preconditions.checkArgument(clazz == org.bukkit.Material.class, "Item namespace must have material type");
+
+ return (org.bukkit.Tag<T>) new CraftItemTag(console.getTagRegistry().b().b(CraftNamespacedKey.toMinecraft(tag)));
+ default:
+ throw new IllegalArgumentException();
+ }
+ }
+
@Deprecated
@Override
public UnsafeValues getUnsafe() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
index 8871c6f3..1181701e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
@@ -10,6 +10,12 @@ import org.bukkit.Sound;
public enum CraftSound {
AMBIENT_CAVE("ambient.cave"),
+ AMBIENT_UNDERWATER_ENTER("ambient.underwater.enter"),
+ AMBIENT_UNDERWATER_EXIT("ambient.underwater.exit"),
+ AMBIENT_UNDERWATER_LOOP("ambient.underwater.loop"),
+ AMBIENT_UNDERWATER_LOOP_ADDITIONS("ambient.underwater.loop.additions"),
+ AMBIENT_UNDERWATER_LOOP_ADDITIONS_RARE("ambient.underwater.loop.additions.rare"),
+ AMBIENT_UNDERWATER_LOOP_ADDITIONS_ULTRA_RARE("ambient.underwater.loop.additions.ultra_rare"),
BLOCK_ANVIL_BREAK("block.anvil.break"),
BLOCK_ANVIL_DESTROY("block.anvil.destroy"),
BLOCK_ANVIL_FALL("block.anvil.fall"),
@@ -18,24 +24,38 @@ public enum CraftSound {
BLOCK_ANVIL_PLACE("block.anvil.place"),
BLOCK_ANVIL_STEP("block.anvil.step"),
BLOCK_ANVIL_USE("block.anvil.use"),
+ BLOCK_BEACON_ACTIVATE("block.beacon.activate"),
+ BLOCK_BEACON_AMBIENT("block.beacon.ambient"),
+ BLOCK_BEACON_DEACTIVATE("block.beacon.deactivate"),
+ BLOCK_BEACON_POWER_SELECT("block.beacon.power_select"),
BLOCK_BREWING_STAND_BREW("block.brewing_stand.brew"),
+ BLOCK_BUBBLE_COLUMN_BUBBLE_POP("block.bubble_column.bubble_pop"),
+ BLOCK_BUBBLE_COLUMN_UPWARDS_AMBIENT("block.bubble_column.upwards_ambient"),
+ BLOCK_BUBBLE_COLUMN_UPWARDS_INSIDE("block.bubble_column.upwards_inside"),
+ BLOCK_BUBBLE_COLUMN_WHIRLPOOL_AMBIENT("block.bubble_column.whirlpool_ambient"),
+ BLOCK_BUBBLE_COLUMN_WHIRLPOOL_INSIDE("block.bubble_column.whirlpool_inside"),
BLOCK_CHEST_CLOSE("block.chest.close"),
BLOCK_CHEST_LOCKED("block.chest.locked"),
BLOCK_CHEST_OPEN("block.chest.open"),
BLOCK_CHORUS_FLOWER_DEATH("block.chorus_flower.death"),
BLOCK_CHORUS_FLOWER_GROW("block.chorus_flower.grow"),
- BLOCK_CLOTH_BREAK("block.cloth.break"),
- BLOCK_CLOTH_FALL("block.cloth.fall"),
- BLOCK_CLOTH_HIT("block.cloth.hit"),
- BLOCK_CLOTH_PLACE("block.cloth.place"),
- BLOCK_CLOTH_STEP("block.cloth.step"),
BLOCK_COMPARATOR_CLICK("block.comparator.click"),
+ BLOCK_CONDUIT_ACTIVATE("block.conduit.activate"),
+ BLOCK_CONDUIT_AMBIENT("block.conduit.ambient"),
+ BLOCK_CONDUIT_AMBIENT_SHORT("block.conduit.ambient.short"),
+ BLOCK_CONDUIT_ATTACK_TARGET("block.conduit.attack.target"),
+ BLOCK_CONDUIT_DEACTIVATE("block.conduit.deactivate"),
+ BLOCK_CORAL_BLOCK_BREAK("block.coral_block.break"),
+ BLOCK_CORAL_BLOCK_FALL("block.coral_block.fall"),
+ BLOCK_CORAL_BLOCK_HIT("block.coral_block.hit"),
+ BLOCK_CORAL_BLOCK_PLACE("block.coral_block.place"),
+ BLOCK_CORAL_BLOCK_STEP("block.coral_block.step"),
BLOCK_DISPENSER_DISPENSE("block.dispenser.dispense"),
BLOCK_DISPENSER_FAIL("block.dispenser.fail"),
BLOCK_DISPENSER_LAUNCH("block.dispenser.launch"),
BLOCK_ENCHANTMENT_TABLE_USE("block.enchantment_table.use"),
- BLOCK_ENDERCHEST_CLOSE("block.enderchest.close"),
- BLOCK_ENDERCHEST_OPEN("block.enderchest.open"),
+ BLOCK_ENDER_CHEST_CLOSE("block.ender_chest.close"),
+ BLOCK_ENDER_CHEST_OPEN("block.ender_chest.open"),
BLOCK_END_GATEWAY_SPAWN("block.end_gateway.spawn"),
BLOCK_END_PORTAL_FRAME_FILL("block.end_portal_frame.fill"),
BLOCK_END_PORTAL_SPAWN("block.end_portal.spawn"),
@@ -72,29 +92,31 @@ public enum CraftSound {
BLOCK_LAVA_EXTINGUISH("block.lava.extinguish"),
BLOCK_LAVA_POP("block.lava.pop"),
BLOCK_LEVER_CLICK("block.lever.click"),
+ BLOCK_LILY_PAD_PLACE("block.lily_pad.place"),
BLOCK_METAL_BREAK("block.metal.break"),
BLOCK_METAL_FALL("block.metal.fall"),
BLOCK_METAL_HIT("block.metal.hit"),
BLOCK_METAL_PLACE("block.metal.place"),
- BLOCK_METAL_PRESSUREPLATE_CLICK_OFF("block.metal_pressureplate.click_off"),
- BLOCK_METAL_PRESSUREPLATE_CLICK_ON("block.metal_pressureplate.click_on"),
+ BLOCK_METAL_PRESSURE_PLATE_CLICK_OFF("block.metal_pressure_plate.click_off"),
+ BLOCK_METAL_PRESSURE_PLATE_CLICK_ON("block.metal_pressure_plate.click_on"),
BLOCK_METAL_STEP("block.metal.step"),
- BLOCK_NOTE_BASEDRUM("block.note.basedrum"),
- BLOCK_NOTE_BASS("block.note.bass"),
- BLOCK_NOTE_BELL("block.note.bell"),
- BLOCK_NOTE_CHIME("block.note.chime"),
- BLOCK_NOTE_FLUTE("block.note.flute"),
- BLOCK_NOTE_GUITAR("block.note.guitar"),
- BLOCK_NOTE_HARP("block.note.harp"),
- BLOCK_NOTE_HAT("block.note.hat"),
- BLOCK_NOTE_PLING("block.note.pling"),
- BLOCK_NOTE_SNARE("block.note.snare"),
- BLOCK_NOTE_XYLOPHONE("block.note.xylophone"),
+ BLOCK_NOTE_BLOCK_BASEDRUM("block.note_block.basedrum"),
+ BLOCK_NOTE_BLOCK_BASS("block.note_block.bass"),
+ BLOCK_NOTE_BLOCK_BELL("block.note_block.bell"),
+ BLOCK_NOTE_BLOCK_CHIME("block.note_block.chime"),
+ BLOCK_NOTE_BLOCK_FLUTE("block.note_block.flute"),
+ BLOCK_NOTE_BLOCK_GUITAR("block.note_block.guitar"),
+ BLOCK_NOTE_BLOCK_HARP("block.note_block.harp"),
+ BLOCK_NOTE_BLOCK_HAT("block.note_block.hat"),
+ BLOCK_NOTE_BLOCK_PLING("block.note_block.pling"),
+ BLOCK_NOTE_BLOCK_SNARE("block.note_block.snare"),
+ BLOCK_NOTE_BLOCK_XYLOPHONE("block.note_block.xylophone"),
BLOCK_PISTON_CONTRACT("block.piston.contract"),
BLOCK_PISTON_EXTEND("block.piston.extend"),
BLOCK_PORTAL_AMBIENT("block.portal.ambient"),
BLOCK_PORTAL_TRAVEL("block.portal.travel"),
BLOCK_PORTAL_TRIGGER("block.portal.trigger"),
+ BLOCK_PUMPKIN_CARVE("block.pumpkin.carve"),
BLOCK_REDSTONE_TORCH_BURNOUT("block.redstone_torch.burnout"),
BLOCK_SAND_BREAK("block.sand.break"),
BLOCK_SAND_FALL("block.sand.fall"),
@@ -103,11 +125,11 @@ public enum CraftSound {
BLOCK_SAND_STEP("block.sand.step"),
BLOCK_SHULKER_BOX_CLOSE("block.shulker_box.close"),
BLOCK_SHULKER_BOX_OPEN("block.shulker_box.open"),
- BLOCK_SLIME_BREAK("block.slime.break"),
- BLOCK_SLIME_FALL("block.slime.fall"),
- BLOCK_SLIME_HIT("block.slime.hit"),
- BLOCK_SLIME_PLACE("block.slime.place"),
- BLOCK_SLIME_STEP("block.slime.step"),
+ BLOCK_SLIME_BLOCK_BREAK("block.slime_block.break"),
+ BLOCK_SLIME_BLOCK_FALL("block.slime_block.fall"),
+ BLOCK_SLIME_BLOCK_HIT("block.slime_block.hit"),
+ BLOCK_SLIME_BLOCK_PLACE("block.slime_block.place"),
+ BLOCK_SLIME_BLOCK_STEP("block.slime_block.step"),
BLOCK_SNOW_BREAK("block.snow.break"),
BLOCK_SNOW_FALL("block.snow.fall"),
BLOCK_SNOW_HIT("block.snow.hit"),
@@ -119,33 +141,42 @@ public enum CraftSound {
BLOCK_STONE_FALL("block.stone.fall"),
BLOCK_STONE_HIT("block.stone.hit"),
BLOCK_STONE_PLACE("block.stone.place"),
- BLOCK_STONE_PRESSUREPLATE_CLICK_OFF("block.stone_pressureplate.click_off"),
- BLOCK_STONE_PRESSUREPLATE_CLICK_ON("block.stone_pressureplate.click_on"),
+ BLOCK_STONE_PRESSURE_PLATE_CLICK_OFF("block.stone_pressure_plate.click_off"),
+ BLOCK_STONE_PRESSURE_PLATE_CLICK_ON("block.stone_pressure_plate.click_on"),
BLOCK_STONE_STEP("block.stone.step"),
BLOCK_TRIPWIRE_ATTACH("block.tripwire.attach"),
BLOCK_TRIPWIRE_CLICK_OFF("block.tripwire.click_off"),
BLOCK_TRIPWIRE_CLICK_ON("block.tripwire.click_on"),
BLOCK_TRIPWIRE_DETACH("block.tripwire.detach"),
- BLOCK_WATERLILY_PLACE("block.waterlily.place"),
BLOCK_WATER_AMBIENT("block.water.ambient"),
+ BLOCK_WET_GRASS_BREAK("block.wet_grass.break"),
+ BLOCK_WET_GRASS_FALL("block.wet_grass.fall"),
+ BLOCK_WET_GRASS_HIT("block.wet_grass.hit"),
+ BLOCK_WET_GRASS_PLACE("block.wet_grass.place"),
+ BLOCK_WET_GRASS_STEP("block.wet_grass.step"),
+ BLOCK_WOODEN_BUTTON_CLICK_OFF("block.wooden_button.click_off"),
+ BLOCK_WOODEN_BUTTON_CLICK_ON("block.wooden_button.click_on"),
BLOCK_WOODEN_DOOR_CLOSE("block.wooden_door.close"),
BLOCK_WOODEN_DOOR_OPEN("block.wooden_door.open"),
+ BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF("block.wooden_pressure_plate.click_off"),
+ BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON("block.wooden_pressure_plate.click_on"),
BLOCK_WOODEN_TRAPDOOR_CLOSE("block.wooden_trapdoor.close"),
BLOCK_WOODEN_TRAPDOOR_OPEN("block.wooden_trapdoor.open"),
BLOCK_WOOD_BREAK("block.wood.break"),
- BLOCK_WOOD_BUTTON_CLICK_OFF("block.wood_button.click_off"),
- BLOCK_WOOD_BUTTON_CLICK_ON("block.wood_button.click_on"),
BLOCK_WOOD_FALL("block.wood.fall"),
BLOCK_WOOD_HIT("block.wood.hit"),
BLOCK_WOOD_PLACE("block.wood.place"),
- BLOCK_WOOD_PRESSUREPLATE_CLICK_OFF("block.wood_pressureplate.click_off"),
- BLOCK_WOOD_PRESSUREPLATE_CLICK_ON("block.wood_pressureplate.click_on"),
BLOCK_WOOD_STEP("block.wood.step"),
+ BLOCK_WOOL_BREAK("block.wool.break"),
+ BLOCK_WOOL_FALL("block.wool.fall"),
+ BLOCK_WOOL_HIT("block.wool.hit"),
+ BLOCK_WOOL_PLACE("block.wool.place"),
+ BLOCK_WOOL_STEP("block.wool.step"),
ENCHANT_THORNS_HIT("enchant.thorns.hit"),
- ENTITY_ARMORSTAND_BREAK("entity.armorstand.break"),
- ENTITY_ARMORSTAND_FALL("entity.armorstand.fall"),
- ENTITY_ARMORSTAND_HIT("entity.armorstand.hit"),
- ENTITY_ARMORSTAND_PLACE("entity.armorstand.place"),
+ ENTITY_ARMOR_STAND_BREAK("entity.armor_stand.break"),
+ ENTITY_ARMOR_STAND_FALL("entity.armor_stand.fall"),
+ ENTITY_ARMOR_STAND_HIT("entity.armor_stand.hit"),
+ ENTITY_ARMOR_STAND_PLACE("entity.armor_stand.place"),
ENTITY_ARROW_HIT("entity.arrow.hit"),
ENTITY_ARROW_HIT_PLAYER("entity.arrow.hit_player"),
ENTITY_ARROW_SHOOT("entity.arrow.shoot"),
@@ -161,9 +192,6 @@ public enum CraftSound {
ENTITY_BLAZE_SHOOT("entity.blaze.shoot"),
ENTITY_BOAT_PADDLE_LAND("entity.boat.paddle_land"),
ENTITY_BOAT_PADDLE_WATER("entity.boat.paddle_water"),
- ENTITY_BOBBER_RETRIEVE("entity.bobber.retrieve"),
- ENTITY_BOBBER_SPLASH("entity.bobber.splash"),
- ENTITY_BOBBER_THROW("entity.bobber.throw"),
ENTITY_CAT_AMBIENT("entity.cat.ambient"),
ENTITY_CAT_DEATH("entity.cat.death"),
ENTITY_CAT_HISS("entity.cat.hiss"),
@@ -175,6 +203,10 @@ public enum CraftSound {
ENTITY_CHICKEN_EGG("entity.chicken.egg"),
ENTITY_CHICKEN_HURT("entity.chicken.hurt"),
ENTITY_CHICKEN_STEP("entity.chicken.step"),
+ ENTITY_COD_AMBIENT("entity.cod.ambient"),
+ ENTITY_COD_DEATH("entity.cod.death"),
+ ENTITY_COD_FLOP("entity.cod.flop"),
+ ENTITY_COD_HURT("entity.cod.hurt"),
ENTITY_COW_AMBIENT("entity.cow.ambient"),
ENTITY_COW_DEATH("entity.cow.death"),
ENTITY_COW_HURT("entity.cow.hurt"),
@@ -183,11 +215,31 @@ public enum CraftSound {
ENTITY_CREEPER_DEATH("entity.creeper.death"),
ENTITY_CREEPER_HURT("entity.creeper.hurt"),
ENTITY_CREEPER_PRIMED("entity.creeper.primed"),
+ ENTITY_DOLPHIN_AMBIENT("entity.dolphin.ambient"),
+ ENTITY_DOLPHIN_AMBIENT_WATER("entity.dolphin.ambient_water"),
+ ENTITY_DOLPHIN_ATTACK("entity.dolphin.attack"),
+ ENTITY_DOLPHIN_DEATH("entity.dolphin.death"),
+ ENTITY_DOLPHIN_EAT("entity.dolphin.eat"),
+ ENTITY_DOLPHIN_HURT("entity.dolphin.hurt"),
+ ENTITY_DOLPHIN_JUMP("entity.dolphin.jump"),
+ ENTITY_DOLPHIN_PLAY("entity.dolphin.play"),
+ ENTITY_DOLPHIN_SPLASH("entity.dolphin.splash"),
+ ENTITY_DOLPHIN_SWIM("entity.dolphin.swim"),
ENTITY_DONKEY_AMBIENT("entity.donkey.ambient"),
ENTITY_DONKEY_ANGRY("entity.donkey.angry"),
ENTITY_DONKEY_CHEST("entity.donkey.chest"),
ENTITY_DONKEY_DEATH("entity.donkey.death"),
ENTITY_DONKEY_HURT("entity.donkey.hurt"),
+ ENTITY_DRAGON_FIREBALL_EXPLODE("entity.dragon_fireball.explode"),
+ ENTITY_DROWNED_AMBIENT("entity.drowned.ambient"),
+ ENTITY_DROWNED_AMBIENT_WATER("entity.drowned.ambient_water"),
+ ENTITY_DROWNED_DEATH("entity.drowned.death"),
+ ENTITY_DROWNED_DEATH_WATER("entity.drowned.death_water"),
+ ENTITY_DROWNED_HURT("entity.drowned.hurt"),
+ ENTITY_DROWNED_HURT_WATER("entity.drowned.hurt_water"),
+ ENTITY_DROWNED_SHOOT("entity.drowned.shoot"),
+ ENTITY_DROWNED_STEP("entity.drowned.step"),
+ ENTITY_DROWNED_SWIM("entity.drowned.swim"),
ENTITY_EGG_THROW("entity.egg.throw"),
ENTITY_ELDER_GUARDIAN_AMBIENT("entity.elder_guardian.ambient"),
ENTITY_ELDER_GUARDIAN_AMBIENT_LAND("entity.elder_guardian.ambient_land"),
@@ -197,44 +249,47 @@ public enum CraftSound {
ENTITY_ELDER_GUARDIAN_FLOP("entity.elder_guardian.flop"),
ENTITY_ELDER_GUARDIAN_HURT("entity.elder_guardian.hurt"),
ENTITY_ELDER_GUARDIAN_HURT_LAND("entity.elder_guardian.hurt_land"),
- ENTITY_ENDERDRAGON_AMBIENT("entity.enderdragon.ambient"),
- ENTITY_ENDERDRAGON_DEATH("entity.enderdragon.death"),
- ENTITY_ENDERDRAGON_FIREBALL_EXPLODE("entity.enderdragon_fireball.explode"),
- ENTITY_ENDERDRAGON_FLAP("entity.enderdragon.flap"),
- ENTITY_ENDERDRAGON_GROWL("entity.enderdragon.growl"),
- ENTITY_ENDERDRAGON_HURT("entity.enderdragon.hurt"),
- ENTITY_ENDERDRAGON_SHOOT("entity.enderdragon.shoot"),
- ENTITY_ENDEREYE_DEATH("entity.endereye.death"),
- ENTITY_ENDEREYE_LAUNCH("entity.endereye.launch"),
- ENTITY_ENDERMEN_AMBIENT("entity.endermen.ambient"),
- ENTITY_ENDERMEN_DEATH("entity.endermen.death"),
- ENTITY_ENDERMEN_HURT("entity.endermen.hurt"),
- ENTITY_ENDERMEN_SCREAM("entity.endermen.scream"),
- ENTITY_ENDERMEN_STARE("entity.endermen.stare"),
- ENTITY_ENDERMEN_TELEPORT("entity.endermen.teleport"),
+ ENTITY_ENDERMAN_AMBIENT("entity.enderman.ambient"),
+ ENTITY_ENDERMAN_DEATH("entity.enderman.death"),
+ ENTITY_ENDERMAN_HURT("entity.enderman.hurt"),
+ ENTITY_ENDERMAN_SCREAM("entity.enderman.scream"),
+ ENTITY_ENDERMAN_STARE("entity.enderman.stare"),
+ ENTITY_ENDERMAN_TELEPORT("entity.enderman.teleport"),
ENTITY_ENDERMITE_AMBIENT("entity.endermite.ambient"),
ENTITY_ENDERMITE_DEATH("entity.endermite.death"),
ENTITY_ENDERMITE_HURT("entity.endermite.hurt"),
ENTITY_ENDERMITE_STEP("entity.endermite.step"),
- ENTITY_ENDERPEARL_THROW("entity.enderpearl.throw"),
- ENTITY_EVOCATION_FANGS_ATTACK("entity.evocation_fangs.attack"),
- ENTITY_EVOCATION_ILLAGER_AMBIENT("entity.evocation_illager.ambient"),
- ENTITY_EVOCATION_ILLAGER_CAST_SPELL("entity.evocation_illager.cast_spell"),
- ENTITY_EVOCATION_ILLAGER_DEATH("entity.evocation_illager.death"),
- ENTITY_EVOCATION_ILLAGER_HURT("entity.evocation_illager.hurt"),
- ENTITY_EVOCATION_ILLAGER_PREPARE_ATTACK("entity.evocation_illager.prepare_attack"),
- ENTITY_EVOCATION_ILLAGER_PREPARE_SUMMON("entity.evocation_illager.prepare_summon"),
- ENTITY_EVOCATION_ILLAGER_PREPARE_WOLOLO("entity.evocation_illager.prepare_wololo"),
+ ENTITY_ENDER_DRAGON_AMBIENT("entity.ender_dragon.ambient"),
+ ENTITY_ENDER_DRAGON_DEATH("entity.ender_dragon.death"),
+ ENTITY_ENDER_DRAGON_FLAP("entity.ender_dragon.flap"),
+ ENTITY_ENDER_DRAGON_GROWL("entity.ender_dragon.growl"),
+ ENTITY_ENDER_DRAGON_HURT("entity.ender_dragon.hurt"),
+ ENTITY_ENDER_DRAGON_SHOOT("entity.ender_dragon.shoot"),
+ ENTITY_ENDER_EYE_DEATH("entity.ender_eye.death"),
+ ENTITY_ENDER_EYE_LAUNCH("entity.ender_eye.launch"),
+ ENTITY_ENDER_PEARL_THROW("entity.ender_pearl.throw"),
+ ENTITY_EVOKER_AMBIENT("entity.evoker.ambient"),
+ ENTITY_EVOKER_CAST_SPELL("entity.evoker.cast_spell"),
+ ENTITY_EVOKER_DEATH("entity.evoker.death"),
+ ENTITY_EVOKER_FANGS_ATTACK("entity.evoker_fangs.attack"),
+ ENTITY_EVOKER_HURT("entity.evoker.hurt"),
+ ENTITY_EVOKER_PREPARE_ATTACK("entity.evoker.prepare_attack"),
+ ENTITY_EVOKER_PREPARE_SUMMON("entity.evoker.prepare_summon"),
+ ENTITY_EVOKER_PREPARE_WOLOLO("entity.evoker.prepare_wololo"),
ENTITY_EXPERIENCE_BOTTLE_THROW("entity.experience_bottle.throw"),
ENTITY_EXPERIENCE_ORB_PICKUP("entity.experience_orb.pickup"),
- ENTITY_FIREWORK_BLAST("entity.firework.blast"),
- ENTITY_FIREWORK_BLAST_FAR("entity.firework.blast_far"),
- ENTITY_FIREWORK_LARGE_BLAST("entity.firework.large_blast"),
- ENTITY_FIREWORK_LARGE_BLAST_FAR("entity.firework.large_blast_far"),
- ENTITY_FIREWORK_LAUNCH("entity.firework.launch"),
- ENTITY_FIREWORK_SHOOT("entity.firework.shoot"),
- ENTITY_FIREWORK_TWINKLE("entity.firework.twinkle"),
- ENTITY_FIREWORK_TWINKLE_FAR("entity.firework.twinkle_far"),
+ ENTITY_FIREWORK_ROCKET_BLAST("entity.firework_rocket.blast"),
+ ENTITY_FIREWORK_ROCKET_BLAST_FAR("entity.firework_rocket.blast_far"),
+ ENTITY_FIREWORK_ROCKET_LARGE_BLAST("entity.firework_rocket.large_blast"),
+ ENTITY_FIREWORK_ROCKET_LARGE_BLAST_FAR("entity.firework_rocket.large_blast_far"),
+ ENTITY_FIREWORK_ROCKET_LAUNCH("entity.firework_rocket.launch"),
+ ENTITY_FIREWORK_ROCKET_SHOOT("entity.firework_rocket.shoot"),
+ ENTITY_FIREWORK_ROCKET_TWINKLE("entity.firework_rocket.twinkle"),
+ ENTITY_FIREWORK_ROCKET_TWINKLE_FAR("entity.firework_rocket.twinkle_far"),
+ ENTITY_FISHING_BOBBER_RETRIEVE("entity.fishing_bobber.retrieve"),
+ ENTITY_FISHING_BOBBER_SPLASH("entity.fishing_bobber.splash"),
+ ENTITY_FISHING_BOBBER_THROW("entity.fishing_bobber.throw"),
+ ENTITY_FISH_SWIM("entity.fish.swim"),
ENTITY_GENERIC_BIG_FALL("entity.generic.big_fall"),
ENTITY_GENERIC_BURN("entity.generic.burn"),
ENTITY_GENERIC_DEATH("entity.generic.death"),
@@ -280,32 +335,33 @@ public enum CraftSound {
ENTITY_HOSTILE_SPLASH("entity.hostile.splash"),
ENTITY_HOSTILE_SWIM("entity.hostile.swim"),
ENTITY_HUSK_AMBIENT("entity.husk.ambient"),
+ ENTITY_HUSK_CONVERTED_TO_ZOMBIE("entity.husk.converted_to_zombie"),
ENTITY_HUSK_DEATH("entity.husk.death"),
ENTITY_HUSK_HURT("entity.husk.hurt"),
ENTITY_HUSK_STEP("entity.husk.step"),
- ENTITY_ILLUSION_ILLAGER_AMBIENT("entity.illusion_illager.ambient"),
- ENTITY_ILLUSION_ILLAGER_CAST_SPELL("entity.illusion_illager.cast_spell"),
- ENTITY_ILLUSION_ILLAGER_DEATH("entity.illusion_illager.death"),
- ENTITY_ILLUSION_ILLAGER_HURT("entity.illusion_illager.hurt"),
- ENTITY_ILLUSION_ILLAGER_MIRROR_MOVE("entity.illusion_illager.mirror_move"),
- ENTITY_ILLUSION_ILLAGER_PREPARE_BLINDNESS("entity.illusion_illager.prepare_blindness"),
- ENTITY_ILLUSION_ILLAGER_PREPARE_MIRROR("entity.illusion_illager.prepare_mirror"),
- ENTITY_IRONGOLEM_ATTACK("entity.irongolem.attack"),
- ENTITY_IRONGOLEM_DEATH("entity.irongolem.death"),
- ENTITY_IRONGOLEM_HURT("entity.irongolem.hurt"),
- ENTITY_IRONGOLEM_STEP("entity.irongolem.step"),
- ENTITY_ITEMFRAME_ADD_ITEM("entity.itemframe.add_item"),
- ENTITY_ITEMFRAME_BREAK("entity.itemframe.break"),
- ENTITY_ITEMFRAME_PLACE("entity.itemframe.place"),
- ENTITY_ITEMFRAME_REMOVE_ITEM("entity.itemframe.remove_item"),
- ENTITY_ITEMFRAME_ROTATE_ITEM("entity.itemframe.rotate_item"),
+ ENTITY_ILLUSIONER_AMBIENT("entity.illusioner.ambient"),
+ ENTITY_ILLUSIONER_CAST_SPELL("entity.illusioner.cast_spell"),
+ ENTITY_ILLUSIONER_DEATH("entity.illusioner.death"),
+ ENTITY_ILLUSIONER_HURT("entity.illusioner.hurt"),
+ ENTITY_ILLUSIONER_MIRROR_MOVE("entity.illusioner.mirror_move"),
+ ENTITY_ILLUSIONER_PREPARE_BLINDNESS("entity.illusioner.prepare_blindness"),
+ ENTITY_ILLUSIONER_PREPARE_MIRROR("entity.illusioner.prepare_mirror"),
+ ENTITY_IRON_GOLEM_ATTACK("entity.iron_golem.attack"),
+ ENTITY_IRON_GOLEM_DEATH("entity.iron_golem.death"),
+ ENTITY_IRON_GOLEM_HURT("entity.iron_golem.hurt"),
+ ENTITY_IRON_GOLEM_STEP("entity.iron_golem.step"),
ENTITY_ITEM_BREAK("entity.item.break"),
+ ENTITY_ITEM_FRAME_ADD_ITEM("entity.item_frame.add_item"),
+ ENTITY_ITEM_FRAME_BREAK("entity.item_frame.break"),
+ ENTITY_ITEM_FRAME_PLACE("entity.item_frame.place"),
+ ENTITY_ITEM_FRAME_REMOVE_ITEM("entity.item_frame.remove_item"),
+ ENTITY_ITEM_FRAME_ROTATE_ITEM("entity.item_frame.rotate_item"),
ENTITY_ITEM_PICKUP("entity.item.pickup"),
- ENTITY_LEASHKNOT_BREAK("entity.leashknot.break"),
- ENTITY_LEASHKNOT_PLACE("entity.leashknot.place"),
- ENTITY_LIGHTNING_IMPACT("entity.lightning.impact"),
- ENTITY_LIGHTNING_THUNDER("entity.lightning.thunder"),
- ENTITY_LINGERINGPOTION_THROW("entity.lingeringpotion.throw"),
+ ENTITY_LEASH_KNOT_BREAK("entity.leash_knot.break"),
+ ENTITY_LEASH_KNOT_PLACE("entity.leash_knot.place"),
+ ENTITY_LIGHTNING_BOLT_IMPACT("entity.lightning_bolt.impact"),
+ ENTITY_LIGHTNING_BOLT_THUNDER("entity.lightning_bolt.thunder"),
+ ENTITY_LINGERING_POTION_THROW("entity.lingering_potion.throw"),
ENTITY_LLAMA_AMBIENT("entity.llama.ambient"),
ENTITY_LLAMA_ANGRY("entity.llama.angry"),
ENTITY_LLAMA_CHEST("entity.llama.chest"),
@@ -315,10 +371,13 @@ public enum CraftSound {
ENTITY_LLAMA_SPIT("entity.llama.spit"),
ENTITY_LLAMA_STEP("entity.llama.step"),
ENTITY_LLAMA_SWAG("entity.llama.swag"),
- ENTITY_MAGMACUBE_DEATH("entity.magmacube.death"),
- ENTITY_MAGMACUBE_HURT("entity.magmacube.hurt"),
- ENTITY_MAGMACUBE_JUMP("entity.magmacube.jump"),
- ENTITY_MAGMACUBE_SQUISH("entity.magmacube.squish"),
+ ENTITY_MAGMA_CUBE_DEATH("entity.magma_cube.death"),
+ ENTITY_MAGMA_CUBE_DEATH_SMALL("entity.magma_cube.death_small"),
+ ENTITY_MAGMA_CUBE_HURT("entity.magma_cube.hurt"),
+ ENTITY_MAGMA_CUBE_HURT_SMALL("entity.magma_cube.hurt_small"),
+ ENTITY_MAGMA_CUBE_JUMP("entity.magma_cube.jump"),
+ ENTITY_MAGMA_CUBE_SQUISH("entity.magma_cube.squish"),
+ ENTITY_MAGMA_CUBE_SQUISH_SMALL("entity.magma_cube.squish_small"),
ENTITY_MINECART_INSIDE("entity.minecart.inside"),
ENTITY_MINECART_RIDING("entity.minecart.riding"),
ENTITY_MOOSHROOM_SHEAR("entity.mooshroom.shear"),
@@ -335,15 +394,17 @@ public enum CraftSound {
ENTITY_PARROT_HURT("entity.parrot.hurt"),
ENTITY_PARROT_IMITATE_BLAZE("entity.parrot.imitate.blaze"),
ENTITY_PARROT_IMITATE_CREEPER("entity.parrot.imitate.creeper"),
+ ENTITY_PARROT_IMITATE_DROWNED("entity.parrot.imitate.drowned"),
ENTITY_PARROT_IMITATE_ELDER_GUARDIAN("entity.parrot.imitate.elder_guardian"),
- ENTITY_PARROT_IMITATE_ENDERDRAGON("entity.parrot.imitate.enderdragon"),
ENTITY_PARROT_IMITATE_ENDERMAN("entity.parrot.imitate.enderman"),
ENTITY_PARROT_IMITATE_ENDERMITE("entity.parrot.imitate.endermite"),
- ENTITY_PARROT_IMITATE_EVOCATION_ILLAGER("entity.parrot.imitate.evocation_illager"),
+ ENTITY_PARROT_IMITATE_ENDER_DRAGON("entity.parrot.imitate.ender_dragon"),
+ ENTITY_PARROT_IMITATE_EVOKER("entity.parrot.imitate.evoker"),
ENTITY_PARROT_IMITATE_GHAST("entity.parrot.imitate.ghast"),
ENTITY_PARROT_IMITATE_HUSK("entity.parrot.imitate.husk"),
- ENTITY_PARROT_IMITATE_ILLUSION_ILLAGER("entity.parrot.imitate.illusion_illager"),
- ENTITY_PARROT_IMITATE_MAGMACUBE("entity.parrot.imitate.magmacube"),
+ ENTITY_PARROT_IMITATE_ILLUSIONER("entity.parrot.imitate.illusioner"),
+ ENTITY_PARROT_IMITATE_MAGMA_CUBE("entity.parrot.imitate.magma_cube"),
+ ENTITY_PARROT_IMITATE_PHANTOM("entity.parrot.imitate.phantom"),
ENTITY_PARROT_IMITATE_POLAR_BEAR("entity.parrot.imitate.polar_bear"),
ENTITY_PARROT_IMITATE_SHULKER("entity.parrot.imitate.shulker"),
ENTITY_PARROT_IMITATE_SILVERFISH("entity.parrot.imitate.silverfish"),
@@ -352,7 +413,7 @@ public enum CraftSound {
ENTITY_PARROT_IMITATE_SPIDER("entity.parrot.imitate.spider"),
ENTITY_PARROT_IMITATE_STRAY("entity.parrot.imitate.stray"),
ENTITY_PARROT_IMITATE_VEX("entity.parrot.imitate.vex"),
- ENTITY_PARROT_IMITATE_VINDICATION_ILLAGER("entity.parrot.imitate.vindication_illager"),
+ ENTITY_PARROT_IMITATE_VINDICATOR("entity.parrot.imitate.vindicator"),
ENTITY_PARROT_IMITATE_WITCH("entity.parrot.imitate.witch"),
ENTITY_PARROT_IMITATE_WITHER("entity.parrot.imitate.wither"),
ENTITY_PARROT_IMITATE_WITHER_SKELETON("entity.parrot.imitate.wither_skeleton"),
@@ -361,6 +422,12 @@ public enum CraftSound {
ENTITY_PARROT_IMITATE_ZOMBIE_PIGMAN("entity.parrot.imitate.zombie_pigman"),
ENTITY_PARROT_IMITATE_ZOMBIE_VILLAGER("entity.parrot.imitate.zombie_villager"),
ENTITY_PARROT_STEP("entity.parrot.step"),
+ ENTITY_PHANTOM_AMBIENT("entity.phantom.ambient"),
+ ENTITY_PHANTOM_BITE("entity.phantom.bite"),
+ ENTITY_PHANTOM_DEATH("entity.phantom.death"),
+ ENTITY_PHANTOM_FLAP("entity.phantom.flap"),
+ ENTITY_PHANTOM_HURT("entity.phantom.hurt"),
+ ENTITY_PHANTOM_SWOOP("entity.phantom.swoop"),
ENTITY_PIG_AMBIENT("entity.pig.ambient"),
ENTITY_PIG_DEATH("entity.pig.death"),
ENTITY_PIG_HURT("entity.pig.hurt"),
@@ -382,18 +449,30 @@ public enum CraftSound {
ENTITY_PLAYER_LEVELUP("entity.player.levelup"),
ENTITY_PLAYER_SMALL_FALL("entity.player.small_fall"),
ENTITY_PLAYER_SPLASH("entity.player.splash"),
+ ENTITY_PLAYER_SPLASH_HIGH_SPEED("entity.player.splash.high_speed"),
ENTITY_PLAYER_SWIM("entity.player.swim"),
ENTITY_POLAR_BEAR_AMBIENT("entity.polar_bear.ambient"),
- ENTITY_POLAR_BEAR_BABY_AMBIENT("entity.polar_bear.baby_ambient"),
+ ENTITY_POLAR_BEAR_AMBIENT_BABY("entity.polar_bear.ambient_baby"),
ENTITY_POLAR_BEAR_DEATH("entity.polar_bear.death"),
ENTITY_POLAR_BEAR_HURT("entity.polar_bear.hurt"),
ENTITY_POLAR_BEAR_STEP("entity.polar_bear.step"),
ENTITY_POLAR_BEAR_WARNING("entity.polar_bear.warning"),
+ ENTITY_PUFFER_FISH_AMBIENT("entity.puffer_fish.ambient"),
+ ENTITY_PUFFER_FISH_BLOW_OUT("entity.puffer_fish.blow_out"),
+ ENTITY_PUFFER_FISH_BLOW_UP("entity.puffer_fish.blow_up"),
+ ENTITY_PUFFER_FISH_DEATH("entity.puffer_fish.death"),
+ ENTITY_PUFFER_FISH_FLOP("entity.puffer_fish.flop"),
+ ENTITY_PUFFER_FISH_HURT("entity.puffer_fish.hurt"),
+ ENTITY_PUFFER_FISH_STING("entity.puffer_fish.sting"),
ENTITY_RABBIT_AMBIENT("entity.rabbit.ambient"),
ENTITY_RABBIT_ATTACK("entity.rabbit.attack"),
ENTITY_RABBIT_DEATH("entity.rabbit.death"),
ENTITY_RABBIT_HURT("entity.rabbit.hurt"),
ENTITY_RABBIT_JUMP("entity.rabbit.jump"),
+ ENTITY_SALMON_AMBIENT("entity.salmon.ambient"),
+ ENTITY_SALMON_DEATH("entity.salmon.death"),
+ ENTITY_SALMON_FLOP("entity.salmon.flop"),
+ ENTITY_SALMON_HURT("entity.salmon.hurt"),
ENTITY_SHEEP_AMBIENT("entity.sheep.ambient"),
ENTITY_SHEEP_DEATH("entity.sheep.death"),
ENTITY_SHEEP_HURT("entity.sheep.hurt"),
@@ -416,28 +495,30 @@ public enum CraftSound {
ENTITY_SKELETON_AMBIENT("entity.skeleton.ambient"),
ENTITY_SKELETON_DEATH("entity.skeleton.death"),
ENTITY_SKELETON_HORSE_AMBIENT("entity.skeleton_horse.ambient"),
+ ENTITY_SKELETON_HORSE_AMBIENT_WATER("entity.skeleton_horse.ambient_water"),
ENTITY_SKELETON_HORSE_DEATH("entity.skeleton_horse.death"),
+ ENTITY_SKELETON_HORSE_GALLOP_WATER("entity.skeleton_horse.gallop_water"),
ENTITY_SKELETON_HORSE_HURT("entity.skeleton_horse.hurt"),
+ ENTITY_SKELETON_HORSE_JUMP_WATER("entity.skeleton_horse.jump_water"),
+ ENTITY_SKELETON_HORSE_STEP_WATER("entity.skeleton_horse.step_water"),
+ ENTITY_SKELETON_HORSE_SWIM("entity.skeleton_horse.swim"),
ENTITY_SKELETON_HURT("entity.skeleton.hurt"),
ENTITY_SKELETON_SHOOT("entity.skeleton.shoot"),
ENTITY_SKELETON_STEP("entity.skeleton.step"),
ENTITY_SLIME_ATTACK("entity.slime.attack"),
ENTITY_SLIME_DEATH("entity.slime.death"),
+ ENTITY_SLIME_DEATH_SMALL("entity.slime.death_small"),
ENTITY_SLIME_HURT("entity.slime.hurt"),
+ ENTITY_SLIME_HURT_SMALL("entity.slime.hurt_small"),
ENTITY_SLIME_JUMP("entity.slime.jump"),
+ ENTITY_SLIME_JUMP_SMALL("entity.slime.jump_small"),
ENTITY_SLIME_SQUISH("entity.slime.squish"),
- ENTITY_SMALL_MAGMACUBE_DEATH("entity.small_magmacube.death"),
- ENTITY_SMALL_MAGMACUBE_HURT("entity.small_magmacube.hurt"),
- ENTITY_SMALL_MAGMACUBE_SQUISH("entity.small_magmacube.squish"),
- ENTITY_SMALL_SLIME_DEATH("entity.small_slime.death"),
- ENTITY_SMALL_SLIME_HURT("entity.small_slime.hurt"),
- ENTITY_SMALL_SLIME_JUMP("entity.small_slime.jump"),
- ENTITY_SMALL_SLIME_SQUISH("entity.small_slime.squish"),
+ ENTITY_SLIME_SQUISH_SMALL("entity.slime.squish_small"),
ENTITY_SNOWBALL_THROW("entity.snowball.throw"),
- ENTITY_SNOWMAN_AMBIENT("entity.snowman.ambient"),
- ENTITY_SNOWMAN_DEATH("entity.snowman.death"),
- ENTITY_SNOWMAN_HURT("entity.snowman.hurt"),
- ENTITY_SNOWMAN_SHOOT("entity.snowman.shoot"),
+ ENTITY_SNOW_GOLEM_AMBIENT("entity.snow_golem.ambient"),
+ ENTITY_SNOW_GOLEM_DEATH("entity.snow_golem.death"),
+ ENTITY_SNOW_GOLEM_HURT("entity.snow_golem.hurt"),
+ ENTITY_SNOW_GOLEM_SHOOT("entity.snow_golem.shoot"),
ENTITY_SPIDER_AMBIENT("entity.spider.ambient"),
ENTITY_SPIDER_DEATH("entity.spider.death"),
ENTITY_SPIDER_HURT("entity.spider.hurt"),
@@ -447,11 +528,28 @@ public enum CraftSound {
ENTITY_SQUID_AMBIENT("entity.squid.ambient"),
ENTITY_SQUID_DEATH("entity.squid.death"),
ENTITY_SQUID_HURT("entity.squid.hurt"),
+ ENTITY_SQUID_SQUIRT("entity.squid.squirt"),
ENTITY_STRAY_AMBIENT("entity.stray.ambient"),
ENTITY_STRAY_DEATH("entity.stray.death"),
ENTITY_STRAY_HURT("entity.stray.hurt"),
ENTITY_STRAY_STEP("entity.stray.step"),
ENTITY_TNT_PRIMED("entity.tnt.primed"),
+ ENTITY_TROPICAL_FISH_AMBIENT("entity.tropical_fish.ambient"),
+ ENTITY_TROPICAL_FISH_DEATH("entity.tropical_fish.death"),
+ ENTITY_TROPICAL_FISH_FLOP("entity.tropical_fish.flop"),
+ ENTITY_TROPICAL_FISH_HURT("entity.tropical_fish.hurt"),
+ ENTITY_TURTLE_AMBIENT_LAND("entity.turtle.ambient_land"),
+ ENTITY_TURTLE_DEATH("entity.turtle.death"),
+ ENTITY_TURTLE_DEATH_BABY("entity.turtle.death_baby"),
+ ENTITY_TURTLE_EGG_BREAK("entity.turtle.egg_break"),
+ ENTITY_TURTLE_EGG_CRACK("entity.turtle.egg_crack"),
+ ENTITY_TURTLE_EGG_HATCH("entity.turtle.egg_hatch"),
+ ENTITY_TURTLE_HURT("entity.turtle.hurt"),
+ ENTITY_TURTLE_HURT_BABY("entity.turtle.hurt_baby"),
+ ENTITY_TURTLE_LAY_EGG("entity.turtle.lay_egg"),
+ ENTITY_TURTLE_SHAMBLE("entity.turtle.shamble"),
+ ENTITY_TURTLE_SHAMBLE_BABY("entity.turtle.shamble_baby"),
+ ENTITY_TURTLE_SWIM("entity.turtle.swim"),
ENTITY_VEX_AMBIENT("entity.vex.ambient"),
ENTITY_VEX_CHARGE("entity.vex.charge"),
ENTITY_VEX_DEATH("entity.vex.death"),
@@ -460,11 +558,11 @@ public enum CraftSound {
ENTITY_VILLAGER_DEATH("entity.villager.death"),
ENTITY_VILLAGER_HURT("entity.villager.hurt"),
ENTITY_VILLAGER_NO("entity.villager.no"),
- ENTITY_VILLAGER_TRADING("entity.villager.trading"),
+ ENTITY_VILLAGER_TRADE("entity.villager.trade"),
ENTITY_VILLAGER_YES("entity.villager.yes"),
- ENTITY_VINDICATION_ILLAGER_AMBIENT("entity.vindication_illager.ambient"),
- ENTITY_VINDICATION_ILLAGER_DEATH("entity.vindication_illager.death"),
- ENTITY_VINDICATION_ILLAGER_HURT("entity.vindication_illager.hurt"),
+ ENTITY_VINDICATOR_AMBIENT("entity.vindicator.ambient"),
+ ENTITY_VINDICATOR_DEATH("entity.vindicator.death"),
+ ENTITY_VINDICATOR_HURT("entity.vindicator.hurt"),
ENTITY_WITCH_AMBIENT("entity.witch.ambient"),
ENTITY_WITCH_DEATH("entity.witch.death"),
ENTITY_WITCH_DRINK("entity.witch.drink"),
@@ -490,19 +588,21 @@ public enum CraftSound {
ENTITY_WOLF_STEP("entity.wolf.step"),
ENTITY_WOLF_WHINE("entity.wolf.whine"),
ENTITY_ZOMBIE_AMBIENT("entity.zombie.ambient"),
- ENTITY_ZOMBIE_ATTACK_DOOR_WOOD("entity.zombie.attack_door_wood"),
ENTITY_ZOMBIE_ATTACK_IRON_DOOR("entity.zombie.attack_iron_door"),
- ENTITY_ZOMBIE_BREAK_DOOR_WOOD("entity.zombie.break_door_wood"),
+ ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR("entity.zombie.attack_wooden_door"),
+ ENTITY_ZOMBIE_BREAK_WOODEN_DOOR("entity.zombie.break_wooden_door"),
+ ENTITY_ZOMBIE_CONVERTED_TO_DROWNED("entity.zombie.converted_to_drowned"),
ENTITY_ZOMBIE_DEATH("entity.zombie.death"),
+ ENTITY_ZOMBIE_DESTROY_EGG("entity.zombie.destroy_egg"),
ENTITY_ZOMBIE_HORSE_AMBIENT("entity.zombie_horse.ambient"),
ENTITY_ZOMBIE_HORSE_DEATH("entity.zombie_horse.death"),
ENTITY_ZOMBIE_HORSE_HURT("entity.zombie_horse.hurt"),
ENTITY_ZOMBIE_HURT("entity.zombie.hurt"),
ENTITY_ZOMBIE_INFECT("entity.zombie.infect"),
- ENTITY_ZOMBIE_PIG_AMBIENT("entity.zombie_pig.ambient"),
- ENTITY_ZOMBIE_PIG_ANGRY("entity.zombie_pig.angry"),
- ENTITY_ZOMBIE_PIG_DEATH("entity.zombie_pig.death"),
- ENTITY_ZOMBIE_PIG_HURT("entity.zombie_pig.hurt"),
+ ENTITY_ZOMBIE_PIGMAN_AMBIENT("entity.zombie_pigman.ambient"),
+ ENTITY_ZOMBIE_PIGMAN_ANGRY("entity.zombie_pigman.angry"),
+ ENTITY_ZOMBIE_PIGMAN_DEATH("entity.zombie_pigman.death"),
+ ENTITY_ZOMBIE_PIGMAN_HURT("entity.zombie_pigman.hurt"),
ENTITY_ZOMBIE_STEP("entity.zombie.step"),
ENTITY_ZOMBIE_VILLAGER_AMBIENT("entity.zombie_villager.ambient"),
ENTITY_ZOMBIE_VILLAGER_CONVERTED("entity.zombie_villager.converted"),
@@ -517,12 +617,16 @@ public enum CraftSound {
ITEM_ARMOR_EQUIP_GOLD("item.armor.equip_gold"),
ITEM_ARMOR_EQUIP_IRON("item.armor.equip_iron"),
ITEM_ARMOR_EQUIP_LEATHER("item.armor.equip_leather"),
+ ITEM_ARMOR_EQUIP_TURTLE("item.armor.equip_turtle"),
+ ITEM_AXE_STRIP("item.axe.strip"),
ITEM_BOTTLE_EMPTY("item.bottle.empty"),
ITEM_BOTTLE_FILL("item.bottle.fill"),
ITEM_BOTTLE_FILL_DRAGONBREATH("item.bottle.fill_dragonbreath"),
ITEM_BUCKET_EMPTY("item.bucket.empty"),
+ ITEM_BUCKET_EMPTY_FISH("item.bucket.empty_fish"),
ITEM_BUCKET_EMPTY_LAVA("item.bucket.empty_lava"),
ITEM_BUCKET_FILL("item.bucket.fill"),
+ ITEM_BUCKET_FILL_FISH("item.bucket.fill_fish"),
ITEM_BUCKET_FILL_LAVA("item.bucket.fill_lava"),
ITEM_CHORUS_FRUIT_TELEPORT("item.chorus_fruit.teleport"),
ITEM_ELYTRA_FLYING("item.elytra.flying"),
@@ -533,25 +637,34 @@ public enum CraftSound {
ITEM_SHIELD_BREAK("item.shield.break"),
ITEM_SHOVEL_FLATTEN("item.shovel.flatten"),
ITEM_TOTEM_USE("item.totem.use"),
+ ITEM_TRIDENT_HIT("item.trident.hit"),
+ ITEM_TRIDENT_HIT_GROUND("item.trident.hit_ground"),
+ ITEM_TRIDENT_RETURN("item.trident.return"),
+ ITEM_TRIDENT_RIPTIDE_1("item.trident.riptide_1"),
+ ITEM_TRIDENT_RIPTIDE_2("item.trident.riptide_2"),
+ ITEM_TRIDENT_RIPTIDE_3("item.trident.riptide_3"),
+ ITEM_TRIDENT_THROW("item.trident.throw"),
+ ITEM_TRIDENT_THUNDER("item.trident.thunder"),
MUSIC_CREATIVE("music.creative"),
MUSIC_CREDITS("music.credits"),
+ MUSIC_DISC_11("music_disc.11"),
+ MUSIC_DISC_13("music_disc.13"),
+ MUSIC_DISC_BLOCKS("music_disc.blocks"),
+ MUSIC_DISC_CAT("music_disc.cat"),
+ MUSIC_DISC_CHIRP("music_disc.chirp"),
+ MUSIC_DISC_FAR("music_disc.far"),
+ MUSIC_DISC_MALL("music_disc.mall"),
+ MUSIC_DISC_MELLOHI("music_disc.mellohi"),
+ MUSIC_DISC_STAL("music_disc.stal"),
+ MUSIC_DISC_STRAD("music_disc.strad"),
+ MUSIC_DISC_WAIT("music_disc.wait"),
+ MUSIC_DISC_WARD("music_disc.ward"),
MUSIC_DRAGON("music.dragon"),
MUSIC_END("music.end"),
MUSIC_GAME("music.game"),
MUSIC_MENU("music.menu"),
MUSIC_NETHER("music.nether"),
- RECORD_11("record.11"),
- RECORD_13("record.13"),
- RECORD_BLOCKS("record.blocks"),
- RECORD_CAT("record.cat"),
- RECORD_CHIRP("record.chirp"),
- RECORD_FAR("record.far"),
- RECORD_MALL("record.mall"),
- RECORD_MELLOHI("record.mellohi"),
- RECORD_STAL("record.stal"),
- RECORD_STRAD("record.strad"),
- RECORD_WAIT("record.wait"),
- RECORD_WARD("record.ward"),
+ MUSIC_UNDER_WATER("music.under_water"),
UI_BUTTON_CLICK("ui.button.click"),
UI_TOAST_CHALLENGE_COMPLETE("ui.toast.challenge_complete"),
UI_TOAST_IN("ui.toast.in"),
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftStatistic.java b/src/main/java/org/bukkit/craftbukkit/CraftStatistic.java
index 5c069586..b07b3680 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftStatistic.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftStatistic.java
@@ -1,94 +1,141 @@
package org.bukkit.craftbukkit;
-import net.minecraft.server.EntityTypes;
-import net.minecraft.server.EntityTypes.MonsterEggInfo;
import net.minecraft.server.StatisticList;
import org.bukkit.Statistic;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
-import com.google.common.base.CaseFormat;
+import com.google.common.base.Preconditions;
import com.google.common.collect.BiMap;
import com.google.common.collect.ImmutableBiMap;
import net.minecraft.server.Block;
+import net.minecraft.server.EntityTypes;
import net.minecraft.server.Item;
import net.minecraft.server.MinecraftKey;
+import net.minecraft.server.RegistryMaterials;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
-public class CraftStatistic {
- private static final BiMap<String, org.bukkit.Statistic> statistics;
+public enum CraftStatistic {
+ DAMAGE_DEALT("damage_dealt"),
+ DAMAGE_TAKEN("damage_taken"),
+ DEATHS("deaths"),
+ MOB_KILLS("mob_kills"),
+ PLAYER_KILLS("player_kills"),
+ FISH_CAUGHT("fish_caught"),
+ ANIMALS_BRED("animals_bred"),
+ LEAVE_GAME("leave_game"),
+ JUMP("jump"),
+ DROP_COUNT("drop"),
+ DROP("dropped"),
+ PICKUP("picked_up"),
+ PLAY_ONE_MINUTE("play_one_minute"),
+ WALK_ONE_CM("walk_one_cm"),
+ WALK_ON_WATER_ONE_CM("walk_on_water_one_cm"),
+ FALL_ONE_CM("fall_one_cm"),
+ SNEAK_TIME("sneak_time"),
+ CLIMB_ONE_CM("climb_one_cm"),
+ FLY_ONE_CM("fly_one_cm"),
+ WALK_UNDER_WATER_ONE_CM("walk_under_water_one_cm"),
+ MINECART_ONE_CM("minecart_one_cm"),
+ BOAT_ONE_CM("boat_one_cm"),
+ PIG_ONE_CM("pig_one_cm"),
+ HORSE_ONE_CM("horse_one_cm"),
+ SPRINT_ONE_CM("sprint_one_cm"),
+ CROUCH_ONE_CM("crouch_one_cm"),
+ AVIATE_ONE_CM("aviate_one_cm"),
+ MINE_BLOCK("mined"),
+ USE_ITEM("used"),
+ BREAK_ITEM("broken"),
+ CRAFT_ITEM("crafted"),
+ KILL_ENTITY("killed"),
+ ENTITY_KILLED_BY("killed_by"),
+ TIME_SINCE_DEATH("time_since_death"),
+ TALKED_TO_VILLAGER("talked_to_villager"),
+ TRADED_WITH_VILLAGER("traded_with_villager"),
+ CAKE_SLICES_EATEN("eat_cake_slice"),
+ CAULDRON_FILLED("fill_cauldron"),
+ CAULDRON_USED("use_cauldron"),
+ ARMOR_CLEANED("clean_armor"),
+ BANNER_CLEANED("clean_banner"),
+ BREWINGSTAND_INTERACTION("interact_with_brewingstand"),
+ BEACON_INTERACTION("interact_with_beacon"),
+ DROPPER_INSPECTED("inspect_dropper"),
+ HOPPER_INSPECTED("inspect_hopper"),
+ DISPENSER_INSPECTED("inspect_dispenser"),
+ NOTEBLOCK_PLAYED("play_noteblock"),
+ NOTEBLOCK_TUNED("tune_noteblock"),
+ FLOWER_POTTED("pot_flower"),
+ TRAPPED_CHEST_TRIGGERED("trigger_trapped_chest"),
+ ENDERCHEST_OPENED("open_enderchest"),
+ ITEM_ENCHANTED("enchant_item"),
+ RECORD_PLAYED("play_record"),
+ FURNACE_INTERACTION("interact_with_furnace"),
+ CRAFTING_TABLE_INTERACTION("interact_with_crafting_table"),
+ CHEST_OPENED("open_chest"),
+ SLEEP_IN_BED("sleep_in_bed"),
+ SHULKER_BOX_OPENED("open_shulker_box"),
+ TIME_SINCE_REST("time_since_rest"),
+ SWIM_ONE_CM("swim_one_cm");
+ private final MinecraftKey minecraftKey;
+ private final org.bukkit.Statistic bukkit;
+ private static final BiMap<MinecraftKey, org.bukkit.Statistic> statistics;
static {
- ImmutableBiMap.Builder<String, org.bukkit.Statistic> statisticBuilder = ImmutableBiMap.<String, org.bukkit.Statistic>builder();
- for (Statistic statistic : Statistic.values()) {
- if (statistic == Statistic.PLAY_ONE_TICK) {
- statisticBuilder.put("stat.playOneMinute", statistic);
- } else {
- statisticBuilder.put("stat." + CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, statistic.name()), statistic);
- }
+ ImmutableBiMap.Builder<MinecraftKey, org.bukkit.Statistic> statisticBuilder = ImmutableBiMap.builder();
+ for (CraftStatistic statistic : CraftStatistic.values()) {
+ statisticBuilder.put(statistic.minecraftKey, statistic.bukkit);
}
statistics = statisticBuilder.build();
}
- private CraftStatistic() {}
+ private CraftStatistic(String minecraftKey) {
+ this.minecraftKey = new MinecraftKey(minecraftKey);
- public static org.bukkit.Statistic getBukkitStatistic(net.minecraft.server.Statistic statistic) {
- return getBukkitStatisticByName(statistic.name);
+ this.bukkit = org.bukkit.Statistic.valueOf(this.name());
+ Preconditions.checkState(bukkit != null, "Bukkit statistic %s does not exist", this.name());
}
- public static org.bukkit.Statistic getBukkitStatisticByName(String name) {
- if (name.startsWith("stat.killEntity.")) {
- name = "stat.killEntity";
- }
- if (name.startsWith("stat.entityKilledBy.")) {
- name = "stat.entityKilledBy";
- }
- if (name.startsWith("stat.breakItem.")) {
- name = "stat.breakItem";
- }
- if (name.startsWith("stat.useItem.")) {
- name = "stat.useItem";
- }
- if (name.startsWith("stat.mineBlock.")) {
- name = "stat.mineBlock";
- }
- if (name.startsWith("stat.craftItem.")) {
- name = "stat.craftItem";
- }
- if (name.startsWith("stat.drop.")) {
- name = "stat.drop";
- }
- if (name.startsWith("stat.pickup.")) {
- name = "stat.pickup";
+ public static org.bukkit.Statistic getBukkitStatistic(net.minecraft.server.Statistic<?> statistic) {
+ RegistryMaterials statRegistry = statistic.a().a();
+ MinecraftKey nmsKey = StatisticList.REGISTRY.b(statistic.a());
+
+ if (statRegistry == StatisticList.REGISTRY_CUSTOM) {
+ nmsKey = (MinecraftKey) statistic.b();
}
- return statistics.get(name);
+
+ return statistics.get(nmsKey);
}
- public static net.minecraft.server.Statistic getNMSStatistic(org.bukkit.Statistic statistic) {
- return StatisticList.getStatistic(statistics.inverse().get(statistic));
+ public static net.minecraft.server.Statistic getNMSStatistic(org.bukkit.Statistic bukkit) {
+ Preconditions.checkArgument(bukkit.getType() == Statistic.Type.UNTYPED, "This method only accepts untyped statistics");
+
+ net.minecraft.server.Statistic<MinecraftKey> nms = StatisticList.CUSTOM.b(statistics.inverse().get(bukkit));
+ Preconditions.checkArgument(nms != null, "NMS Statistic %s does not exist", bukkit);
+
+ return nms;
}
public static net.minecraft.server.Statistic getMaterialStatistic(org.bukkit.Statistic stat, Material material) {
try {
if (stat == Statistic.MINE_BLOCK) {
- return StatisticList.a(CraftMagicNumbers.getBlock(material)); // PAIL: getMineBlockStatistic
+ return StatisticList.BLOCK_MINED.b(CraftMagicNumbers.getBlock(material));
}
if (stat == Statistic.CRAFT_ITEM) {
- return StatisticList.a(CraftMagicNumbers.getItem(material)); // PAIL: getCraftItemStatistic
+ return StatisticList.ITEM_CRAFTED.b(CraftMagicNumbers.getItem(material));
}
if (stat == Statistic.USE_ITEM) {
- return StatisticList.b(CraftMagicNumbers.getItem(material)); // PAIL: getUseItemStatistic
+ return StatisticList.ITEM_USED.b(CraftMagicNumbers.getItem(material));
}
if (stat == Statistic.BREAK_ITEM) {
- return StatisticList.c(CraftMagicNumbers.getItem(material)); // PAIL: getBreakItemStatistic
+ return StatisticList.ITEM_BROKEN.b(CraftMagicNumbers.getItem(material));
}
if (stat == Statistic.PICKUP) {
- return StatisticList.d(CraftMagicNumbers.getItem(material)); // PAIL: getPickupStatistic
+ return StatisticList.ITEM_PICKED_UP.b(CraftMagicNumbers.getItem(material));
}
if (stat == Statistic.DROP) {
- return StatisticList.e(CraftMagicNumbers.getItem(material)); // PAIL: getDropItemStatistic
+ return StatisticList.ITEM_DROPPED.b(CraftMagicNumbers.getItem(material));
}
} catch (ArrayIndexOutOfBoundsException e) {
return null;
@@ -97,39 +144,31 @@ public class CraftStatistic {
}
public static net.minecraft.server.Statistic getEntityStatistic(org.bukkit.Statistic stat, EntityType entity) {
- MonsterEggInfo monsteregginfo = (MonsterEggInfo) EntityTypes.eggInfo.get(new MinecraftKey(entity.getName()));
+ if (entity.getName() != null) {
+ EntityTypes<?> nmsEntity = EntityTypes.REGISTRY.get(new MinecraftKey(entity.getName()));
- if (monsteregginfo != null) {
if (stat == org.bukkit.Statistic.KILL_ENTITY) {
- return monsteregginfo.killEntityStatistic;
+ return net.minecraft.server.StatisticList.ENTITY_KILLED.b(nmsEntity);
}
if (stat == org.bukkit.Statistic.ENTITY_KILLED_BY) {
- return monsteregginfo.killedByEntityStatistic;
+ return net.minecraft.server.StatisticList.ENTITY_KILLED_BY.b(nmsEntity);
}
}
return null;
}
- public static EntityType getEntityTypeFromStatistic(net.minecraft.server.Statistic statistic) {
- String statisticString = statistic.name;
- return EntityType.fromName(statisticString.substring(statisticString.lastIndexOf(".") + 1));
+ public static EntityType getEntityTypeFromStatistic(net.minecraft.server.Statistic<EntityTypes<?>> statistic) {
+ MinecraftKey name = EntityTypes.getName(statistic.b());
+ return EntityType.fromName(name.getKey());
}
- public static Material getMaterialFromStatistic(net.minecraft.server.Statistic statistic) {
- String statisticString = statistic.name;
- String val = statisticString.substring(statisticString.lastIndexOf(".") + 1);
- Item item = (Item) Item.REGISTRY.get(new MinecraftKey(val));
- if (item != null) {
- return Material.getMaterial(Item.getId(item));
+ public static Material getMaterialFromStatistic(net.minecraft.server.Statistic<?> statistic) {
+ if (statistic.b() instanceof Item) {
+ return CraftMagicNumbers.getMaterial((Item) statistic.b());
}
- Block block = (Block) Block.REGISTRY.get(new MinecraftKey(val));
- if (block != null) {
- return Material.getMaterial(Block.getId(block));
- }
- try {
- return Material.getMaterial(Integer.parseInt(val));
- } catch (NumberFormatException e) {
- return null;
+ if (statistic.b() instanceof Block) {
+ return CraftMagicNumbers.getMaterial((Block) statistic.b());
}
+ return null;
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 8f6653f7..162c79e8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1,6 +1,7 @@
package org.bukkit.craftbukkit;
import com.google.common.base.Preconditions;
+import com.google.common.util.concurrent.Futures;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
@@ -31,8 +32,10 @@ import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
+import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.block.CraftBlockState;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.entity.*;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.metadata.BlockMetadataStore;
@@ -92,11 +95,7 @@ public class CraftWorld implements World {
}
public Block getBlockAt(int x, int y, int z) {
- return getChunkAt(x >> 4, z >> 4).getBlock(x & 0xF, y, z & 0xF);
- }
-
- public int getBlockTypeIdAt(int x, int y, int z) {
- return CraftMagicNumbers.getId(world.getType(new BlockPosition(x, y, z)).getBlock());
+ return CraftBlock.at(world, new BlockPosition(x, y, z));
}
public int getHighestBlockYAt(int x, int z) {
@@ -104,7 +103,7 @@ public class CraftWorld implements World {
loadChunk(x >> 4, z >> 4);
}
- return world.getHighestBlockYAt(new BlockPosition(x, 0, z)).getY();
+ return world.getHighestBlockYAt(HeightMap.Type.LIGHT_BLOCKING, new BlockPosition(x, 0, z)).getY();
}
public Location getSpawnLocation() {
@@ -219,7 +218,7 @@ public class CraftWorld implements World {
net.minecraft.server.Chunk chunk = null;
- chunk = world.getChunkProviderServer().chunkGenerator.getOrCreateChunk(x, z);
+ chunk = Futures.getUnchecked(world.getChunkProviderServer().generateChunk(x, z));
PlayerChunk playerChunk = world.getPlayerChunkMap().getChunk(x, z);
if (playerChunk != null) {
playerChunk.chunk = chunk;
@@ -229,7 +228,6 @@ public class CraftWorld implements World {
world.getChunkProviderServer().chunks.put(chunkKey, chunk);
chunk.addEntities();
- chunk.loadNearby(world.getChunkProviderServer(), world.getChunkProviderServer().chunkGenerator, true);
refreshChunk(x, z);
}
@@ -286,7 +284,6 @@ public class CraftWorld implements World {
public org.bukkit.entity.Item dropItem(Location loc, ItemStack item) {
Validate.notNull(item, "Cannot drop a Null item.");
- Validate.isTrue(item.getTypeId() != 0, "Cannot drop AIR.");
EntityItem entity = new EntityItem(world, loc.getX(), loc.getY(), loc.getZ(), CraftItemStack.asNMSCopy(item));
entity.pickupDelay = 10;
world.addEntity(entity, SpawnReason.CUSTOM);
@@ -346,6 +343,8 @@ public class CraftWorld implements World {
((EntityTippedArrow) arrow).setType(CraftPotionUtil.fromBukkit(new PotionData(PotionType.WATER, false, false)));
} else if (SpectralArrow.class.isAssignableFrom(clazz)) {
arrow = new EntitySpectralArrow(world);
+ } else if (Trident.class.isAssignableFrom(clazz)){
+ arrow = new EntityThrownTrident(world);
} else {
arrow = new EntityTippedArrow(world);
}
@@ -390,30 +389,22 @@ public class CraftWorld implements World {
gen = new WorldGenTaiga1();
break;
case JUNGLE:
- IBlockData iblockdata1 = Blocks.LOG.getBlockData().set(BlockLog1.VARIANT, BlockWood.EnumLogVariant.JUNGLE);
- IBlockData iblockdata2 = Blocks.LEAVES.getBlockData().set(BlockLeaves1.VARIANT, BlockWood.EnumLogVariant.JUNGLE).set(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false));
- gen = new WorldGenJungleTree(true, 10, 20, iblockdata1, iblockdata2); // Magic values as in BlockSapling
+ gen = new WorldGenJungleTree(true, 10, 20, Blocks.JUNGLE_LOG.getBlockData(), Blocks.JUNGLE_LEAVES.getBlockData());
break;
case SMALL_JUNGLE:
- iblockdata1 = Blocks.LOG.getBlockData().set(BlockLog1.VARIANT, BlockWood.EnumLogVariant.JUNGLE);
- iblockdata2 = Blocks.LEAVES.getBlockData().set(BlockLeaves1.VARIANT, BlockWood.EnumLogVariant.JUNGLE).set(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false));
- gen = new WorldGenTrees(true, 4 + rand.nextInt(7), iblockdata1, iblockdata2, false);
+ gen = new WorldGenTrees(true, 4 + rand.nextInt(7), Blocks.JUNGLE_LOG.getBlockData(), Blocks.JUNGLE_LEAVES.getBlockData(), false);
break;
case COCOA_TREE:
- iblockdata1 = Blocks.LOG.getBlockData().set(BlockLog1.VARIANT, BlockWood.EnumLogVariant.JUNGLE);
- iblockdata2 = Blocks.LEAVES.getBlockData().set(BlockLeaves1.VARIANT, BlockWood.EnumLogVariant.JUNGLE).set(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false));
- gen = new WorldGenTrees(true, 4 + rand.nextInt(7), iblockdata1, iblockdata2, true);
+ gen = new WorldGenJungleTree(true, 10, 20, Blocks.JUNGLE_LOG.getBlockData(), Blocks.JUNGLE_LEAVES.getBlockData());
break;
case JUNGLE_BUSH:
- iblockdata1 = Blocks.LOG.getBlockData().set(BlockLog1.VARIANT, BlockWood.EnumLogVariant.JUNGLE);
- iblockdata2 = Blocks.LEAVES.getBlockData().set(BlockLeaves1.VARIANT, BlockWood.EnumLogVariant.OAK).set(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false));
- gen = new WorldGenGroundBush(iblockdata1, iblockdata2);
+ gen = new WorldGenGroundBush(Blocks.JUNGLE_LOG.getBlockData(), Blocks.OAK_LEAVES.getBlockData());
break;
case RED_MUSHROOM:
- gen = new WorldGenHugeMushroom(Blocks.RED_MUSHROOM_BLOCK);
+ gen = new WorldGenHugeMushroomRed();
break;
case BROWN_MUSHROOM:
- gen = new WorldGenHugeMushroom(Blocks.BROWN_MUSHROOM_BLOCK);
+ gen = new WorldGenHugeMushroomBrown();
break;
case SWAMP:
gen = new WorldGenSwampTree();
@@ -431,7 +422,7 @@ public class CraftWorld implements World {
gen = new WorldGenForest(true, true);
break;
case CHORUS_PLANT:
- BlockChorusFlower.a(world, pos, rand, 8);
+ ((BlockChorusFlower) Blocks.CHORUS_FLOWER).a(world, pos, rand, 8);
return true;
case TREE:
default:
@@ -439,7 +430,7 @@ public class CraftWorld implements World {
break;
}
- return gen.generate(world, rand, pos);
+ return gen.generate(world, world.worldProvider.getChunkGenerator(), rand, pos, new WorldGenFeatureEmptyConfiguration());
}
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
@@ -455,12 +446,10 @@ public class CraftWorld implements World {
int z = blockstate.getZ();
BlockPosition position = new BlockPosition(x, y, z);
net.minecraft.server.IBlockData oldBlock = world.getType(position);
- int typeId = blockstate.getTypeId();
- int data = blockstate.getRawData();
- int flag = ((CraftBlockState)blockstate).getFlag();
- delegate.setTypeIdAndData(x, y, z, typeId, data);
+ int flag = ((CraftBlockState) blockstate).getFlag();
+ delegate.setBlockData(x, y, z, blockstate.getBlockData());
net.minecraft.server.IBlockData newBlock = world.getType(position);
- world.notifyAndUpdatePhysics(position, null, oldBlock, newBlock, flag);
+ world.notifyAndUpdatePhysics(position, null, oldBlock, newBlock, newBlock, flag);
}
world.capturedBlockStates.clear();
return true;
@@ -565,10 +554,6 @@ public class CraftWorld implements World {
return getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ());
}
- public int getBlockTypeIdAt(Location location) {
- return getBlockTypeIdAt(location.getBlockX(), location.getBlockY(), location.getBlockZ());
- }
-
public int getHighestBlockYAt(Location location) {
return getHighestBlockYAt(location.getBlockX(), location.getBlockZ());
}
@@ -603,8 +588,8 @@ public class CraftWorld implements World {
net.minecraft.server.Chunk chunk = this.world.getChunkAtWorldCoords(new BlockPosition(x, 0, z));
if (chunk != null) {
- byte[] biomevals = chunk.getBiomeIndex();
- biomevals[((z & 0xF) << 4) | (x & 0xF)] = (byte) BiomeBase.REGISTRY_ID.a(bb);
+ BiomeBase[] biomevals = chunk.getBiomeIndex();
+ biomevals[((z & 0xF) << 4) | (x & 0xF)] = bb;
chunk.markDirty(); // SPIGOT-2890
}
@@ -881,15 +866,23 @@ public class CraftWorld implements World {
Validate.notNull(material, "Material cannot be null");
Validate.isTrue(material.isBlock(), "Material must be a block");
- EntityFallingBlock entity = new EntityFallingBlock(world, location.getX(), location.getY(), location.getZ(), CraftMagicNumbers.getBlock(material).fromLegacyData(data));
+ EntityFallingBlock entity = new EntityFallingBlock(world, location.getX(), location.getY(), location.getZ(), CraftMagicNumbers.getBlock(material).getBlockData());
entity.ticksLived = 1;
world.addEntity(entity, SpawnReason.CUSTOM);
return (FallingBlock) entity.getBukkitEntity();
}
- public FallingBlock spawnFallingBlock(Location location, int blockId, byte blockData) throws IllegalArgumentException {
- return spawnFallingBlock(location, org.bukkit.Material.getMaterial(blockId), blockData);
+ @Override
+ public FallingBlock spawnFallingBlock(Location location, BlockData data) throws IllegalArgumentException {
+ Validate.notNull(location, "Location cannot be null");
+ Validate.notNull(data, "Material cannot be null");
+
+ EntityFallingBlock entity = new EntityFallingBlock(world, location.getX(), location.getY(), location.getZ(), ((CraftBlockData) data).getState());
+ entity.ticksLived = 1;
+
+ world.addEntity(entity, SpawnReason.CUSTOM);
+ return (FallingBlock) entity.getBukkitEntity();
}
@SuppressWarnings("unchecked")
@@ -923,6 +916,8 @@ public class CraftWorld implements World {
((EntityTippedArrow) entity).setType(CraftPotionUtil.fromBukkit(new PotionData(PotionType.WATER, false, false)));
} else if (SpectralArrow.class.isAssignableFrom(clazz)) {
entity = new EntitySpectralArrow(world);
+ } else if (Trident.class.isAssignableFrom(clazz)) {
+ entity = new EntityThrownTrident(world);
} else {
entity = new EntityTippedArrow(world);
}
@@ -1060,6 +1055,8 @@ public class CraftWorld implements World {
entity = new EntityZombieHusk(world);
} else if (ZombieVillager.class.isAssignableFrom(clazz)) {
entity = new EntityZombieVillager(world);
+ } else if (Drowned.class.isAssignableFrom(clazz)) {
+ entity = new EntityDrowned(world);
} else {
entity = new EntityZombie(world);
}
@@ -1111,6 +1108,22 @@ public class CraftWorld implements World {
} else if (Vindicator.class.isAssignableFrom(clazz)) {
entity = new EntityVindicator(world);
}
+ } else if (Turtle.class.isAssignableFrom(clazz)) {
+ entity = new EntityTurtle(world);
+ } else if (Phantom.class.isAssignableFrom(clazz)) {
+ entity = new EntityPhantom(world);
+ } else if (Fish.class.isAssignableFrom(clazz)) {
+ if (Cod.class.isAssignableFrom(clazz)) {
+ entity = new EntityCod(world);
+ } else if (PufferFish.class.isAssignableFrom(clazz)) {
+ entity = new EntityPufferFish(world);
+ } else if (Salmon.class.isAssignableFrom(clazz)) {
+ entity = new EntitySalmon(world);
+ } else if (TropicalFish.class.isAssignableFrom(clazz)) {
+ entity = new EntityTropicalFish(world);
+ }
+ } else if (Dolphin.class.isAssignableFrom(clazz)) {
+ entity = new EntityDolphin(world);
}
if (entity != null) {
@@ -1118,7 +1131,6 @@ public class CraftWorld implements World {
entity.setHeadRotation(yaw); // SPIGOT-3587
}
} else if (Hanging.class.isAssignableFrom(clazz)) {
- Block block = getBlockAt(location);
BlockFace face = BlockFace.SELF;
int width = 16; // 1 full block, also painting smallest size.
@@ -1135,8 +1147,8 @@ public class CraftWorld implements World {
BlockFace[] faces = new BlockFace[]{BlockFace.EAST, BlockFace.NORTH, BlockFace.WEST, BlockFace.SOUTH};
final BlockPosition pos = new BlockPosition((int) x, (int) y, (int) z);
for (BlockFace dir : faces) {
- net.minecraft.server.Block nmsBlock = CraftMagicNumbers.getBlock(block.getRelative(dir));
- if (nmsBlock.getBlockData().getMaterial().isBuildable() || BlockDiodeAbstract.isDiode(nmsBlock.getBlockData())) {
+ IBlockData nmsBlock = world.getType(pos.shift(CraftBlock.blockFaceToNotch(dir)));
+ if (nmsBlock.getMaterial().isBuildable() || BlockDiodeAbstract.isDiode(nmsBlock)) {
boolean taken = false;
AxisAlignedBB bb = EntityHanging.calculateBoundingBox(null, pos, CraftBlock.blockFaceToNotch(dir).opposite(), width, height);
List<net.minecraft.server.Entity> list = (List<net.minecraft.server.Entity>) world.getEntities(null, bb);
@@ -1207,7 +1219,7 @@ public class CraftWorld implements World {
Preconditions.checkArgument(entity != null, "Cannot spawn null entity");
if (entity instanceof EntityInsentient) {
- ((EntityInsentient) entity).prepare(getHandle().D(new BlockPosition(entity)), (GroupDataEntity) null);
+ ((EntityInsentient) entity).prepare(getHandle().getDamageScaler(new BlockPosition(entity)), (GroupDataEntity) null, null);
}
if (function != null) {
@@ -1428,12 +1440,18 @@ public class CraftWorld implements World {
double y = loc.getY();
double z = loc.getZ();
- PacketPlayOutCustomSoundEffect packet = new PacketPlayOutCustomSoundEffect(sound, SoundCategory.valueOf(category.name()), x, y, z, volume, pitch);
+ PacketPlayOutCustomSoundEffect packet = new PacketPlayOutCustomSoundEffect(new MinecraftKey(sound), SoundCategory.valueOf(category.name()), new Vec3D(x, y, z), volume, pitch);
world.getMinecraftServer().getPlayerList().sendPacketNearby(null, x, y, z, volume > 1.0F ? 16.0F * volume : 16.0D, this.world.dimension, packet);
}
public String getGameRuleValue(String rule) {
- return getHandle().getGameRules().get(rule);
+ // In method contract for some reason
+ if (rule == null) {
+ return null;
+ }
+
+ GameRules.GameRuleValue value = getHandle().getGameRules().get(rule);
+ return value != null ? value.a() : "";
}
public boolean setGameRuleValue(String rule, String value) {
@@ -1442,16 +1460,16 @@ public class CraftWorld implements World {
if (!isGameRule(rule)) return false;
- getHandle().getGameRules().set(rule, value);
+ getHandle().getGameRules().set(rule, value, getHandle().getMinecraftServer());
return true;
}
public String[] getGameRules() {
- return getHandle().getGameRules().getGameRules();
+ return GameRules.getGameRules().keySet().toArray(new String[GameRules.getGameRules().size()]);
}
public boolean isGameRule(String rule) {
- return getHandle().getGameRules().contains(rule);
+ return GameRules.getGameRules().containsKey(rule);
}
@Override
@@ -1525,14 +1543,11 @@ public class CraftWorld implements World {
}
getHandle().sendParticles(
null, // Sender
- CraftParticle.toNMS(particle), // Particle
- true, // Extended range
+ CraftParticle.toNMS(particle, data), // Particle
x, y, z, // Position
count, // Count
offsetX, offsetY, offsetZ, // Random offset
- extra, // Speed?
- CraftParticle.toData(particle, data)
-
+ extra // Speed?
);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index f4e1ca79..e8bf55e8 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -145,6 +145,12 @@ public class Main {
return;
}
+ float javaVersion = Float.parseFloat(System.getProperty("java.class.version"));
+ if (javaVersion > 55.0) {
+ System.err.println("Unsupported Java detected (" + javaVersion + "). Only up to Java 11 is supported.");
+ return;
+ }
+
try {
// This trick bypasses Maven Shade's clever rewriting of our getProperty call when using String literals
String jline_UnsupportedTerminal = new String(new char[] {'j','l','i','n','e','.','U','n','s','u','p','p','o','r','t','e','d','T','e','r','m','i','n','a','l'});
@@ -169,11 +175,11 @@ public class Main {
useConsole = false;
}
- if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
+ if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
Date buildDate = new SimpleDateFormat("yyyyMMdd-HHmm").parse(Main.class.getPackage().getImplementationVendor());
Calendar deadline = Calendar.getInstance();
- deadline.add(Calendar.DAY_OF_YEAR, -14);
+ deadline.add(Calendar.DAY_OF_YEAR, -3);
if (buildDate.before(deadline.getTime())) {
System.err.println("*** Error, this build is outdated ***");
System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/ ***");
@@ -182,6 +188,8 @@ public class Main {
}
}
+ System.err.println("*** WARNING: This is a development build. It is not meant for production server usage! Please keep backups and update frequently.");
+
System.out.println("Loading libraries, please wait...");
MinecraftServer.main(options);
} catch (Throwable t) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java
index e2c9a9b7..6672e804 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java
@@ -30,7 +30,7 @@ public class CraftBanner extends CraftBlockEntityState<TileEntityBanner> impleme
public void load(TileEntityBanner banner) {
super.load(banner);
- base = DyeColor.getByDyeData((byte) banner.color.getInvColorIndex());
+ base = DyeColor.getByWoolData((byte) banner.color.getColorIndex());
patterns = new ArrayList<Pattern>();
if (banner.patterns != null) {
@@ -90,7 +90,7 @@ public class CraftBanner extends CraftBlockEntityState<TileEntityBanner> impleme
public void applyTo(TileEntityBanner banner) {
super.applyTo(banner);
- banner.color = EnumColor.fromInvColorIndex(base.getDyeData());
+ banner.color = EnumColor.fromColorIndex(base.getWoolData());
NBTTagList newPatterns = new NBTTagList();
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
index afec900c..5b908d3b 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
@@ -10,6 +10,7 @@ import org.bukkit.Material;
import org.bukkit.block.Beacon;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.inventory.CraftInventoryBeacon;
+import org.bukkit.craftbukkit.util.CraftChatMessage;
import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.BeaconInventory;
import org.bukkit.potion.PotionEffect;
@@ -87,11 +88,11 @@ public class CraftBeacon extends CraftContainer<TileEntityBeacon> implements Bea
@Override
public String getCustomName() {
TileEntityBeacon beacon = this.getSnapshot();
- return beacon.hasCustomName() ? beacon.getName() : null;
+ return beacon.hasCustomName() ? CraftChatMessage.fromComponent(beacon.getCustomName()) : null;
}
@Override
public void setCustomName(String name) {
- this.getSnapshot().setCustomName(name);
+ this.getSnapshot().setCustomName(CraftChatMessage.fromStringOrNull(name));
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBed.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBed.java
index 27756d85..e91497d8 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBed.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBed.java
@@ -10,8 +10,6 @@ import org.bukkit.block.Block;
public class CraftBed extends CraftBlockEntityState<TileEntityBed> implements Bed {
- private DyeColor color;
-
public CraftBed(Block block) {
super(block, TileEntityBed.class);
}
@@ -21,28 +19,47 @@ public class CraftBed extends CraftBlockEntityState<TileEntityBed> implements Be
}
@Override
- public void load(TileEntityBed bed) {
- super.load(bed);
-
- color = DyeColor.getByWoolData((byte) bed.a().getColorIndex());
- }
-
- @Override
public DyeColor getColor() {
- return color;
+ switch (getType()) {
+ case BLACK_BED:
+ return DyeColor.BLACK;
+ case BLUE_BED:
+ return DyeColor.BLUE;
+ case BROWN_BED:
+ return DyeColor.BROWN;
+ case CYAN_BED:
+ return DyeColor.CYAN;
+ case GRAY_BED:
+ return DyeColor.GRAY;
+ case GREEN_BED:
+ return DyeColor.GREEN;
+ case LIGHT_BLUE_BED:
+ return DyeColor.LIGHT_BLUE;
+ case LIGHT_GRAY_BED:
+ return DyeColor.SILVER;
+ case LIME_BED:
+ return DyeColor.LIME;
+ case MAGENTA_BED:
+ return DyeColor.MAGENTA;
+ case ORANGE_BED:
+ return DyeColor.ORANGE;
+ case PINK_BED:
+ return DyeColor.PINK;
+ case PURPLE_BED:
+ return DyeColor.PURPLE;
+ case RED_BED:
+ return DyeColor.RED;
+ case WHITE_BED:
+ return DyeColor.WHITE;
+ case YELLOW_BED:
+ return DyeColor.YELLOW;
+ default:
+ throw new IllegalArgumentException("Unknown DyeColor for " + getType());
+ }
}
@Override
public void setColor(DyeColor color) {
- Preconditions.checkArgument(color != null, "color");
-
- this.color = color;
- }
-
- @Override
- public void applyTo(TileEntityBed bed) {
- super.applyTo(bed);
-
- bed.a(EnumColor.fromColorIndex(color.getWoolData()));
+ throw new UnsupportedOperationException("Must set block type to appropriate bed colour");
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 46670c34..bfed2d98 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -1,5 +1,6 @@
package org.bukkit.craftbukkit.block;
+import com.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -16,7 +17,10 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.PistonMoveReaction;
+import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.CraftChunk;
+import org.bukkit.craftbukkit.CraftWorld;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.inventory.ItemStack;
@@ -25,40 +29,44 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.util.BlockVector;
public class CraftBlock implements Block {
- private final CraftChunk chunk;
- private final int x;
- private final int y;
- private final int z;
+ private final net.minecraft.server.GeneratorAccess world;
+ private final BlockPosition position;
- public CraftBlock(CraftChunk chunk, int x, int y, int z) {
- this.x = x;
- this.y = y;
- this.z = z;
- this.chunk = chunk;
+ public CraftBlock(GeneratorAccess world, BlockPosition position) {
+ this.world = world;
+ this.position = position;
+ }
+
+ public static CraftBlock at(GeneratorAccess world, BlockPosition position) {
+ return new CraftBlock(world, position);
}
private net.minecraft.server.Block getNMSBlock() {
- return CraftMagicNumbers.getBlock(this); // TODO: UPDATE THIS
+ return getNMS().getBlock();
}
- private static net.minecraft.server.Block getNMSBlock(int type) {
- return CraftMagicNumbers.getBlock(type);
+ protected net.minecraft.server.IBlockData getNMS() {
+ return world.getType(position);
}
public World getWorld() {
- return chunk.getWorld();
+ return world.getMinecraftWorld().getWorld();
+ }
+
+ public CraftWorld getCraftWorld() {
+ return (CraftWorld) getWorld();
}
public Location getLocation() {
- return new Location(getWorld(), x, y, z);
+ return new Location(getWorld(), position.getX(), position.getY(), position.getZ());
}
public Location getLocation(Location loc) {
if (loc != null) {
loc.setWorld(getWorld());
- loc.setX(x);
- loc.setY(y);
- loc.setZ(z);
+ loc.setX(position.getX());
+ loc.setY(position.getY());
+ loc.setZ(position.getZ());
loc.setYaw(0);
loc.setPitch(0);
}
@@ -67,23 +75,23 @@ public class CraftBlock implements Block {
}
public BlockVector getVector() {
- return new BlockVector(x, y, z);
+ return new BlockVector(getX(), getY(), getZ());
}
public int getX() {
- return x;
+ return position.getX();
}
public int getY() {
- return y;
+ return position.getY();
}
public int getZ() {
- return z;
+ return position.getZ();
}
public Chunk getChunk() {
- return chunk;
+ return getWorld().getChunkAt(this);
}
public void setData(final byte data) {
@@ -99,19 +107,21 @@ public class CraftBlock implements Block {
}
private void setData(final byte data, int flag) {
- net.minecraft.server.World world = chunk.getHandle().getWorld();
- BlockPosition position = new BlockPosition(x, y, z);
- IBlockData blockData = world.getType(position);
- world.setTypeAndData(position, blockData.getBlock().fromLegacyData(data), flag);
+ world.setTypeAndData(position, CraftMagicNumbers.getBlock(getType(), data), flag);
}
private IBlockData getData0() {
- return chunk.getHandle().getBlockData(new BlockPosition(x, y, z));
+ return world.getType(position);
}
public byte getData() {
- IBlockData blockData = chunk.getHandle().getBlockData(new BlockPosition(x, y, z));
- return (byte) blockData.getBlock().toLegacyData(blockData);
+ IBlockData blockData = world.getType(position);
+ return CraftMagicNumbers.toLegacyData(blockData);
+ }
+
+ @Override
+ public BlockData getBlockData() {
+ return CraftBlockData.fromData(getData0());
}
public void setType(final Material type) {
@@ -120,34 +130,36 @@ public class CraftBlock implements Block {
@Override
public void setType(Material type, boolean applyPhysics) {
- setTypeId(type.getId(), applyPhysics);
+ setTypeAndData(type, (byte) 0, applyPhysics);
}
- public boolean setTypeId(final int type) {
- return setTypeId(type, true);
+ @Override
+ public void setBlockData(BlockData data) {
+ setBlockData(data, true);
}
- public boolean setTypeId(final int type, final boolean applyPhysics) {
- net.minecraft.server.Block block = getNMSBlock(type);
- return setTypeIdAndData(type, (byte) block.toLegacyData(block.getBlockData()), applyPhysics);
+ @Override
+ public void setBlockData(BlockData data, boolean applyPhysics) {
+ setTypeAndData(((CraftBlockData) data).getState(), applyPhysics);
}
- public boolean setTypeIdAndData(final int type, final byte data, final boolean applyPhysics) {
- IBlockData blockData = getNMSBlock(type).fromLegacyData(data);
- BlockPosition position = new BlockPosition(x, y, z);
+ public boolean setTypeAndData(final Material type, final byte data, final boolean applyPhysics) {
+ return setTypeAndData(CraftMagicNumbers.getBlock(type, data), applyPhysics);
+ }
+ public boolean setTypeAndData(final IBlockData blockData, final boolean applyPhysics) {
// SPIGOT-611: need to do this to prevent glitchiness. Easier to handle this here (like /setblock) than to fix weirdness in tile entity cleanup
- if (type != 0 && blockData.getBlock() instanceof BlockTileEntity && type != getTypeId()) {
- chunk.getHandle().getWorld().setTypeAndData(position, Blocks.AIR.getBlockData(), 0);
+ if (!blockData.isAir() && blockData.getBlock() instanceof BlockTileEntity && blockData.getBlock() != getNMSBlock()) {
+ world.setTypeAndData(position, Blocks.AIR.getBlockData(), 0);
}
if (applyPhysics) {
- return chunk.getHandle().getWorld().setTypeAndData(position, blockData, 3);
+ return world.setTypeAndData(position, blockData, 3);
} else {
- IBlockData old = chunk.getHandle().getBlockData(position);
- boolean success = chunk.getHandle().getWorld().setTypeAndData(position, blockData, 18); // NOTIFY | NO_OBSERVER
+ IBlockData old = world.getType(position);
+ boolean success = world.setTypeAndData(position, blockData, 18); // NOTIFY | NO_OBSERVER
if (success) {
- chunk.getHandle().getWorld().notify(
+ world.getMinecraftWorld().notify(
position,
old,
blockData,
@@ -159,25 +171,19 @@ public class CraftBlock implements Block {
}
public Material getType() {
- return Material.getMaterial(getTypeId());
- }
-
- @Deprecated
- @Override
- public int getTypeId() {
- return CraftMagicNumbers.getId(chunk.getHandle().getBlockData(new BlockPosition(this.x, this.y, this.z)).getBlock());
+ return CraftMagicNumbers.getMaterial(world.getType(position).getBlock());
}
public byte getLightLevel() {
- return (byte) chunk.getHandle().getWorld().getLightLevel(new BlockPosition(this.x, this.y, this.z));
+ return (byte) world.getMinecraftWorld().getLightLevel(position);
}
public byte getLightFromSky() {
- return (byte) chunk.getHandle().getWorld().getBrightness(EnumSkyBlock.SKY, new BlockPosition(this.x, this.y, this.z));
+ return (byte) world.getBrightness(EnumSkyBlock.SKY, position);
}
public byte getLightFromBlocks() {
- return (byte) chunk.getHandle().getWorld().getBrightness(EnumSkyBlock.BLOCK, new BlockPosition(this.x, this.y, this.z));
+ return (byte) world.getBrightness(EnumSkyBlock.BLOCK, position);
}
@@ -218,7 +224,7 @@ public class CraftBlock implements Block {
@Override
public String toString() {
- return "CraftBlock{" + "chunk=" + chunk + ",x=" + x + ",y=" + y + ",z=" + z + ",type=" + getType() + ",data=" + getData() + '}';
+ return "CraftBlock{pos=" + position + ",type=" + getType() + ",data=" + getData() + '}';
}
public static BlockFace notchToBlockFace(EnumDirection notch) {
@@ -265,13 +271,11 @@ public class CraftBlock implements Block {
switch (material) {
case SIGN:
- case SIGN_POST:
case WALL_SIGN:
return new CraftSign(this);
case CHEST:
case TRAPPED_CHEST:
return new CraftChest(this);
- case BURNING_FURNACE:
case FURNACE:
return new CraftFurnace(this);
case DISPENSER:
@@ -282,28 +286,65 @@ public class CraftBlock implements Block {
return new CraftEndGateway(this);
case HOPPER:
return new CraftHopper(this);
- case MOB_SPAWNER:
+ case SPAWNER:
return new CraftCreatureSpawner(this);
- case NOTE_BLOCK:
- return new CraftNoteBlock(this);
case JUKEBOX:
return new CraftJukebox(this);
case BREWING_STAND:
return new CraftBrewingStand(this);
- case SKULL:
+ case CREEPER_HEAD:
+ case CREEPER_WALL_HEAD:
+ case DRAGON_HEAD:
+ case DRAGON_WALL_HEAD:
+ case PISTON_HEAD:
+ case PLAYER_HEAD:
+ case PLAYER_WALL_HEAD:
+ case SKELETON_SKULL:
+ case SKELETON_WALL_SKULL:
+ case WITHER_SKELETON_SKULL:
+ case WITHER_SKELETON_WALL_SKULL:
+ case ZOMBIE_HEAD:
+ case ZOMBIE_WALL_HEAD:
return new CraftSkull(this);
- case COMMAND:
- case COMMAND_CHAIN:
- case COMMAND_REPEATING:
+ case COMMAND_BLOCK:
+ case CHAIN_COMMAND_BLOCK:
+ case REPEATING_COMMAND_BLOCK:
return new CraftCommandBlock(this);
case BEACON:
return new CraftBeacon(this);
- case BANNER:
- case WALL_BANNER:
- case STANDING_BANNER:
+ case BLACK_BANNER:
+ case BLACK_WALL_BANNER:
+ case BLUE_BANNER:
+ case BLUE_WALL_BANNER:
+ case BROWN_BANNER:
+ case BROWN_WALL_BANNER:
+ case CYAN_BANNER:
+ case CYAN_WALL_BANNER:
+ case GRAY_BANNER:
+ case GRAY_WALL_BANNER:
+ case GREEN_BANNER:
+ case GREEN_WALL_BANNER:
+ case LIGHT_BLUE_BANNER:
+ case LIGHT_BLUE_WALL_BANNER:
+ case LIGHT_GRAY_BANNER:
+ case LIGHT_GRAY_WALL_BANNER:
+ case LIME_BANNER:
+ case LIME_WALL_BANNER:
+ case MAGENTA_BANNER:
+ case MAGENTA_WALL_BANNER:
+ case ORANGE_BANNER:
+ case ORANGE_WALL_BANNER:
+ case PINK_BANNER:
+ case PINK_WALL_BANNER:
+ case PURPLE_BANNER:
+ case PURPLE_WALL_BANNER:
+ case RED_BANNER:
+ case RED_WALL_BANNER:
+ case WHITE_BANNER:
+ case WHITE_WALL_BANNER:
+ case YELLOW_BANNER:
+ case YELLOW_WALL_BANNER:
return new CraftBanner(this);
- case FLOWER_POT:
- return new CraftFlowerPot(this);
case STRUCTURE_BLOCK:
return new CraftStructureBlock(this);
case WHITE_SHULKER_BOX:
@@ -314,7 +355,7 @@ public class CraftBlock implements Block {
case LIME_SHULKER_BOX:
case PINK_SHULKER_BOX:
case GRAY_SHULKER_BOX:
- case SILVER_SHULKER_BOX:
+ case LIGHT_GRAY_SHULKER_BOX:
case CYAN_SHULKER_BOX:
case PURPLE_SHULKER_BOX:
case BLUE_SHULKER_BOX:
@@ -323,20 +364,35 @@ public class CraftBlock implements Block {
case RED_SHULKER_BOX:
case BLACK_SHULKER_BOX:
return new CraftShulkerBox(this);
- case ENCHANTMENT_TABLE:
+ case ENCHANTING_TABLE:
return new CraftEnchantingTable(this);
case ENDER_CHEST:
return new CraftEnderChest(this);
case DAYLIGHT_DETECTOR:
- case DAYLIGHT_DETECTOR_INVERTED:
return new CraftDaylightDetector(this);
- case REDSTONE_COMPARATOR_OFF:
- case REDSTONE_COMPARATOR_ON:
+ case COMPARATOR:
return new CraftComparator(this);
- case BED_BLOCK:
+ case BLACK_BED:
+ case BLUE_BED:
+ case BROWN_BED:
+ case CYAN_BED:
+ case GRAY_BED:
+ case GREEN_BED:
+ case LIGHT_BLUE_BED:
+ case LIGHT_GRAY_BED:
+ case LIME_BED:
+ case MAGENTA_BED:
+ case ORANGE_BED:
+ case PINK_BED:
+ case PURPLE_BED:
+ case RED_BED:
+ case WHITE_BED:
+ case YELLOW_BED:
return new CraftBed(this);
+ case CONDUIT:
+ return new CraftConduit(this);
default:
- TileEntity tileEntity = chunk.getCraftWorld().getTileEntityAt(x, y, z);
+ TileEntity tileEntity = world.getTileEntity(position);
if (tileEntity != null) {
// block with unhandled TileEntity:
return new CraftBlockEntityState<TileEntity>(this, (Class<TileEntity>) tileEntity.getClass());
@@ -348,11 +404,11 @@ public class CraftBlock implements Block {
}
public Biome getBiome() {
- return getWorld().getBiome(x, z);
+ return getWorld().getBiome(getX(), getZ());
}
public void setBiome(Biome bio) {
- getWorld().setBiome(x, z, bio);
+ getWorld().setBiome(getX(), getZ(), bio);
}
public static Biome biomeBaseToBiome(BiomeBase base) {
@@ -372,19 +428,19 @@ public class CraftBlock implements Block {
}
public double getTemperature() {
- return getWorld().getTemperature(x, z);
+ return getWorld().getTemperature(getX(), getZ());
}
public double getHumidity() {
- return getWorld().getHumidity(x, z);
+ return getWorld().getHumidity(getX(), getZ());
}
public boolean isBlockPowered() {
- return chunk.getHandle().getWorld().getBlockPower(new BlockPosition(x, y, z)) > 0;
+ return world.getMinecraftWorld().getBlockPower(position) > 0;
}
public boolean isBlockIndirectlyPowered() {
- return chunk.getHandle().getWorld().isBlockIndirectlyPowered(new BlockPosition(x, y, z));
+ return world.getMinecraftWorld().isBlockIndirectlyPowered(position);
}
@Override
@@ -393,20 +449,20 @@ public class CraftBlock implements Block {
if (!(o instanceof CraftBlock)) return false;
CraftBlock other = (CraftBlock) o;
- return this.x == other.x && this.y == other.y && this.z == other.z && this.getWorld().equals(other.getWorld());
+ return this.position.equals(other.position) && this.getWorld().equals(other.getWorld());
}
@Override
public int hashCode() {
- return this.y << 24 ^ this.x ^ this.z ^ this.getWorld().hashCode();
+ return this.position.hashCode() ^ this.getWorld().hashCode();
}
public boolean isBlockFacePowered(BlockFace face) {
- return chunk.getHandle().getWorld().isBlockFacePowered(new BlockPosition(x, y, z), blockFaceToNotch(face));
+ return world.getMinecraftWorld().isBlockFacePowered(position, blockFaceToNotch(face));
}
public boolean isBlockFaceIndirectlyPowered(BlockFace face) {
- int power = chunk.getHandle().getWorld().getBlockFacePower(new BlockPosition(x, y, z), blockFaceToNotch(face));
+ int power = world.getMinecraftWorld().getBlockFacePower(position, blockFaceToNotch(face));
Block relative = getRelative(face);
if (relative.getType() == Material.REDSTONE_WIRE) {
@@ -418,8 +474,11 @@ public class CraftBlock implements Block {
public int getBlockPower(BlockFace face) {
int power = 0;
- BlockRedstoneWire wire = Blocks.REDSTONE_WIRE;
- net.minecraft.server.World world = chunk.getHandle().getWorld();
+ BlockRedstoneWire wire = (BlockRedstoneWire) Blocks.REDSTONE_WIRE;
+ net.minecraft.server.World world = this.world.getMinecraftWorld();
+ int x = getX();
+ int y = getY();
+ int z = getZ();
if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x, y - 1, z), EnumDirection.DOWN)) power = wire.getPower(world, new BlockPosition(x, y - 1, z), power);
if ((face == BlockFace.UP || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x, y + 1, z), EnumDirection.UP)) power = wire.getPower(world, new BlockPosition(x, y + 1, z), power);
if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x + 1, y, z), EnumDirection.EAST)) power = wire.getPower(world, new BlockPosition(x + 1, y, z), power);
@@ -438,31 +497,30 @@ public class CraftBlock implements Block {
}
public boolean isLiquid() {
- return (getType() == Material.WATER) || (getType() == Material.STATIONARY_WATER) || (getType() == Material.LAVA) || (getType() == Material.STATIONARY_LAVA);
+ return (getType() == Material.WATER) || (getType() == Material.LAVA);
}
public PistonMoveReaction getPistonMoveReaction() {
- return PistonMoveReaction.getById(getNMSBlock().h(getNMSBlock().fromLegacyData(getData())).ordinal());
+ return PistonMoveReaction.getById(getNMS().getPushReaction().ordinal());
}
private boolean itemCausesDrops(ItemStack item) {
net.minecraft.server.Block block = this.getNMSBlock();
- net.minecraft.server.Item itemType = item != null ? net.minecraft.server.Item.getById(item.getTypeId()) : null;
+ net.minecraft.server.Item itemType = CraftMagicNumbers.getItem(item.getType());
return block != null && (block.getBlockData().getMaterial().isAlwaysDestroyable() || (itemType != null && itemType.canDestroySpecialBlock(block.getBlockData())));
}
public boolean breakNaturally() {
// Order matters here, need to drop before setting to air so skulls can get their data
net.minecraft.server.Block block = this.getNMSBlock();
- byte data = getData();
boolean result = false;
if (block != null && block != Blocks.AIR) {
- block.dropNaturally(chunk.getHandle().getWorld(), new BlockPosition(x, y, z), block.fromLegacyData(data), 1.0F, 0);
+ block.dropNaturally(getNMS(), world.getMinecraftWorld(), position, 1.0F, 0);
result = true;
}
- setTypeId(Material.AIR.getId());
+ setType(Material.AIR);
return result;
}
@@ -470,7 +528,7 @@ public class CraftBlock implements Block {
if (itemCausesDrops(item)) {
return breakNaturally();
} else {
- return setTypeId(Material.AIR.getId());
+ return setTypeAndData(Material.AIR, (byte) 0, true);
}
}
@@ -481,21 +539,20 @@ public class CraftBlock implements Block {
if (block != Blocks.AIR) {
IBlockData data = getData0();
// based on nms.Block.dropNaturally
- int count = block.getDropCount(0, chunk.getHandle().getWorld().random);
+ int count = block.getDropCount(data, 0, world.getMinecraftWorld(), position, world.getMinecraftWorld().random);
for (int i = 0; i < count; ++i) {
- Item item = block.getDropType(data, chunk.getHandle().getWorld().random, 0);
- if (item != Items.a) {
+ Item item = block.getDropType(data, world.getMinecraftWorld(), position, 0).getItem();
+ if (item != Items.AIR) {
// Skulls are special, their data is based on the tile entity
- if (Blocks.SKULL == block) {
- net.minecraft.server.ItemStack nmsStack = new net.minecraft.server.ItemStack(item, 1, block.getDropData(data));
- TileEntitySkull tileentityskull = (TileEntitySkull) chunk.getHandle().getWorld().getTileEntity(new BlockPosition(x, y, z));
+ if (block instanceof BlockSkullAbstract) {
+ net.minecraft.server.ItemStack nmsStack = block.a((IBlockAccess) world, position, data);
+ TileEntitySkull tileentityskull = (TileEntitySkull) world.getTileEntity(position);
- if (tileentityskull.getSkullType() == 3 && tileentityskull.getGameProfile() != null) {
- nmsStack.setTag(new NBTTagCompound());
+ if ((block == Blocks.PLAYER_HEAD || block == Blocks.PLAYER_WALL_HEAD) && tileentityskull.getGameProfile() != null) {
NBTTagCompound nbttagcompound = new NBTTagCompound();
GameProfileSerializer.serialize(nbttagcompound, tileentityskull.getGameProfile());
- nmsStack.getTag().set("SkullOwner", nbttagcompound);
+ nmsStack.getOrCreateTag().set("SkullOwner", nbttagcompound);
}
drops.add(CraftItemStack.asBukkitCopy(nmsStack));
@@ -504,10 +561,10 @@ public class CraftBlock implements Block {
int age = (Integer) data.get(BlockCocoa.AGE);
int dropAmount = (age >= 2 ? 3 : 1);
for (int j = 0; j < dropAmount; ++j) {
- drops.add(new ItemStack(Material.INK_SACK, 1, (short) 3));
+ drops.add(new ItemStack(Material.COCOA_BEANS, 1));
}
} else {
- drops.add(new ItemStack(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(item), 1, (short) block.getDropData(data)));
+ drops.add(new ItemStack(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(item), 1));
}
}
}
@@ -524,18 +581,18 @@ public class CraftBlock implements Block {
}
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
- chunk.getCraftWorld().getBlockMetadata().setMetadata(this, metadataKey, newMetadataValue);
+ getCraftWorld().getBlockMetadata().setMetadata(this, metadataKey, newMetadataValue);
}
public List<MetadataValue> getMetadata(String metadataKey) {
- return chunk.getCraftWorld().getBlockMetadata().getMetadata(this, metadataKey);
+ return getCraftWorld().getBlockMetadata().getMetadata(this, metadataKey);
}
public boolean hasMetadata(String metadataKey) {
- return chunk.getCraftWorld().getBlockMetadata().hasMetadata(this, metadataKey);
+ return getCraftWorld().getBlockMetadata().hasMetadata(this, metadataKey);
}
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
- chunk.getCraftWorld().getBlockMetadata().removeMetadata(this, metadataKey, owningPlugin);
+ getCraftWorld().getBlockMetadata().removeMetadata(this, metadataKey, owningPlugin);
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
index 8328ed00..ac9b4297 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
@@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.block;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.NBTTagCompound;
import net.minecraft.server.TileEntity;
+import net.minecraft.server.World;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.CraftWorld;
@@ -23,7 +24,7 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
this.tileEntity = tileEntityClass.cast(world.getTileEntityAt(this.getX(), this.getY(), this.getZ()));
// copy tile entity data:
- this.snapshot = this.createSnapshot(tileEntity);
+ this.snapshot = this.createSnapshot(tileEntity, world.getHandle());
this.load(snapshot);
}
@@ -34,17 +35,17 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
this.tileEntity = tileEntity;
// copy tile entity data:
- this.snapshot = this.createSnapshot(tileEntity);
+ this.snapshot = this.createSnapshot(tileEntity, null);
this.load(snapshot);
}
- private T createSnapshot(T tileEntity) {
+ private T createSnapshot(T tileEntity, World world) {
if (tileEntity == null) {
return null;
}
NBTTagCompound nbtTagCompound = tileEntity.save(new NBTTagCompound());
- T snapshot = (T) TileEntity.create(null, nbtTagCompound);
+ T snapshot = (T) TileEntity.create(nbtTagCompound, world);
return snapshot;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
index 2a1b731c..08f73c8f 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
@@ -7,8 +7,10 @@ import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.BlockState;
+import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.CraftChunk;
import org.bukkit.craftbukkit.CraftWorld;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.material.Attachable;
import org.bukkit.material.MaterialData;
@@ -16,6 +18,7 @@ import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import java.util.List;
+import net.minecraft.server.GeneratorAccess;
import net.minecraft.server.IBlockData;
public class CraftBlockState implements BlockState {
@@ -24,8 +27,7 @@ public class CraftBlockState implements BlockState {
private final int x;
private final int y;
private final int z;
- protected int type;
- protected MaterialData data;
+ protected IBlockData data;
protected int flag;
public CraftBlockState(final Block block) {
@@ -33,11 +35,9 @@ public class CraftBlockState implements BlockState {
this.x = block.getX();
this.y = block.getY();
this.z = block.getZ();
- this.type = block.getTypeId();
+ this.data = ((CraftBlock) block).getNMS();
this.chunk = (CraftChunk) block.getChunk();
this.flag = 3;
-
- createData(block.getData());
}
public CraftBlockState(final Block block, int flag) {
@@ -47,17 +47,17 @@ public class CraftBlockState implements BlockState {
public CraftBlockState(Material material) {
world = null;
- type = material.getId();
+ data = CraftMagicNumbers.getBlock(material).getBlockData();
chunk = null;
x = y = z = 0;
}
- public static CraftBlockState getBlockState(net.minecraft.server.World world, int x, int y, int z) {
- return new CraftBlockState(world.getWorld().getBlockAt(x, y, z));
+ public static CraftBlockState getBlockState(GeneratorAccess world, net.minecraft.server.BlockPosition pos) {
+ return new CraftBlockState(CraftBlock.at(world, pos));
}
- public static CraftBlockState getBlockState(net.minecraft.server.World world, int x, int y, int z, int flag) {
- return new CraftBlockState(world.getWorld().getBlockAt(x, y, z), flag);
+ public static CraftBlockState getBlockState(net.minecraft.server.World world, net.minecraft.server.BlockPosition pos, int flag) {
+ return new CraftBlockState(world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()), flag);
}
public World getWorld() {
@@ -82,14 +82,32 @@ public class CraftBlockState implements BlockState {
return chunk;
}
+ public void setData(IBlockData data) {
+ this.data = data;
+ }
+
+ public IBlockData getHandle() {
+ return this.data;
+ }
+
+ @Override
+ public BlockData getBlockData() {
+ return CraftBlockData.fromData(data);
+ }
+
+ @Override
+ public void setBlockData(BlockData data) {
+ this.data = ((CraftBlockData) data).getState();
+ }
+
public void setData(final MaterialData data) {
Material mat = getType();
if ((mat == null) || (mat.getData() == null)) {
- this.data = data;
+ this.data = CraftMagicNumbers.getBlock(data);
} else {
if ((data.getClass() == mat.getData()) || (data.getClass() == MaterialData.class)) {
- this.data = data;
+ this.data = CraftMagicNumbers.getBlock(data);
} else {
throw new IllegalArgumentException("Provided data is not of type "
+ mat.getData().getName() + ", found " + data.getClass().getName());
@@ -98,24 +116,17 @@ public class CraftBlockState implements BlockState {
}
public MaterialData getData() {
- return data;
+ return CraftMagicNumbers.getMaterial(data);
}
public void setType(final Material type) {
- setTypeId(type.getId());
- }
-
- public boolean setTypeId(final int type) {
- if (this.type != type) {
- this.type = type;
-
- createData((byte) 0);
+ if (this.getType() != type) {
+ this.data = CraftMagicNumbers.getBlock(type).getBlockData();
}
- return true;
}
public Material getType() {
- return Material.getMaterial(getTypeId());
+ return CraftMagicNumbers.getMaterial(data.getBlock());
}
public void setFlag(int flag) {
@@ -126,17 +137,13 @@ public class CraftBlockState implements BlockState {
return flag;
}
- public int getTypeId() {
- return type;
- }
-
public byte getLightLevel() {
return getBlock().getLightLevel();
}
- public Block getBlock() {
+ public CraftBlock getBlock() {
requirePlaced();
- return world.getBlockAt(x, y, z);
+ return (CraftBlock) world.getBlockAt(x, y, z);
}
public boolean update() {
@@ -151,7 +158,7 @@ public class CraftBlockState implements BlockState {
if (!isPlaced()) {
return true;
}
- Block block = getBlock();
+ CraftBlock block = getBlock();
if (block.getType() != getType()) {
if (!force) {
@@ -160,34 +167,25 @@ public class CraftBlockState implements BlockState {
}
BlockPosition pos = new BlockPosition(x, y, z);
- IBlockData newBlock = CraftMagicNumbers.getBlock(getType()).fromLegacyData(getRawData());
- block.setTypeIdAndData(getTypeId(), getRawData(), applyPhysics);
+ IBlockData newBlock = this.data;
+ block.setTypeAndData(newBlock, applyPhysics);
world.getHandle().notify(
pos,
- CraftMagicNumbers.getBlock(block).fromLegacyData(block.getData()),
+ block.getNMS(),
newBlock,
3
);
// Update levers etc
if (applyPhysics && getData() instanceof Attachable) {
- world.getHandle().applyPhysics(pos.shift(CraftBlock.blockFaceToNotch(((Attachable) getData()).getAttachedFace())), newBlock.getBlock(), false);
+ world.getHandle().applyPhysics(pos.shift(CraftBlock.blockFaceToNotch(((Attachable) getData()).getAttachedFace())), newBlock.getBlock());
}
return true;
}
- private void createData(final byte data) {
- Material mat = getType();
- if (mat == null || mat.getData() == null) {
- this.data = new MaterialData(type, data);
- } else {
- this.data = mat.getNewData(data);
- }
- }
-
public byte getRawData() {
- return data.getData();
+ return CraftMagicNumbers.toLegacyData(data);
}
public Location getLocation() {
@@ -208,7 +206,7 @@ public class CraftBlockState implements BlockState {
}
public void setRawData(byte data) {
- this.data.setData(data);
+ this.data = CraftMagicNumbers.getBlock(getType(), data);
}
@Override
@@ -232,9 +230,6 @@ public class CraftBlockState implements BlockState {
if (this.z != other.z) {
return false;
}
- if (this.type != other.type) {
- return false;
- }
if (this.data != other.data && (this.data == null || !this.data.equals(other.data))) {
return false;
}
@@ -248,7 +243,6 @@ public class CraftBlockState implements BlockState {
hash = 73 * hash + this.x;
hash = 73 * hash + this.y;
hash = 73 * hash + this.z;
- hash = 73 * hash + this.type;
hash = 73 * hash + (this.data != null ? this.data.hashCode() : 0);
return hash;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBrewingStand.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBrewingStand.java
index 9c336e64..dafaa6fb 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBrewingStand.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBrewingStand.java
@@ -5,6 +5,7 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BrewingStand;
import org.bukkit.craftbukkit.inventory.CraftInventoryBrewer;
+import org.bukkit.craftbukkit.util.CraftChatMessage;
import org.bukkit.inventory.BrewerInventory;
public class CraftBrewingStand extends CraftContainer<TileEntityBrewingStand> implements BrewingStand {
@@ -54,12 +55,12 @@ public class CraftBrewingStand extends CraftContainer<TileEntityBrewingStand> im
@Override
public String getCustomName() {
TileEntityBrewingStand brewingStand = this.getSnapshot();
- return brewingStand.hasCustomName() ? brewingStand.getName() : null;
+ return brewingStand.hasCustomName() ? CraftChatMessage.fromComponent(brewingStand.getCustomName()) : null;
}
@Override
public void setCustomName(String name) {
- this.getSnapshot().setCustomName(name);
+ this.getSnapshot().setCustomName(CraftChatMessage.fromStringOrNull(name));
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
index 85f3bb27..6a54f2a1 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
@@ -1,6 +1,10 @@
package org.bukkit.craftbukkit.block;
+import net.minecraft.server.BlockChest;
import net.minecraft.server.BlockPosition;
+import net.minecraft.server.Blocks;
+import net.minecraft.server.ITileInventory;
+import net.minecraft.server.InventoryLargeChest;
import net.minecraft.server.TileEntityChest;
import org.bukkit.Material;
@@ -48,30 +52,10 @@ public class CraftChest extends CraftLootable<TileEntityChest> implements Chest
int z = this.getZ();
CraftWorld world = (CraftWorld) this.getWorld();
- int id;
- if (world.getBlockTypeIdAt(x, y, z) == Material.CHEST.getId()) {
- id = Material.CHEST.getId();
- } else if (world.getBlockTypeIdAt(x, y, z) == Material.TRAPPED_CHEST.getId()) {
- id = Material.TRAPPED_CHEST.getId();
- } else {
- throw new IllegalStateException("CraftChest is not a chest but is instead " + world.getBlockAt(x, y, z));
- }
+ ITileInventory nms = ((BlockChest) Blocks.CHEST).getInventory(data, world.getHandle(), new BlockPosition(x, y, z), true);
- if (world.getBlockTypeIdAt(x - 1, y, z) == id) {
- CraftInventory left = new CraftInventory((TileEntityChest) world.getHandle().getTileEntity(new BlockPosition(x - 1, y, z)));
- inventory = new CraftInventoryDoubleChest(left, inventory);
- }
- if (world.getBlockTypeIdAt(x + 1, y, z) == id) {
- CraftInventory right = new CraftInventory((TileEntityChest) world.getHandle().getTileEntity(new BlockPosition(x + 1, y, z)));
- inventory = new CraftInventoryDoubleChest(inventory, right);
- }
- if (world.getBlockTypeIdAt(x, y, z - 1) == id) {
- CraftInventory left = new CraftInventory((TileEntityChest) world.getHandle().getTileEntity(new BlockPosition(x, y, z - 1)));
- inventory = new CraftInventoryDoubleChest(left, inventory);
- }
- if (world.getBlockTypeIdAt(x, y, z + 1) == id) {
- CraftInventory right = new CraftInventory((TileEntityChest) world.getHandle().getTileEntity(new BlockPosition(x, y, z + 1)));
- inventory = new CraftInventoryDoubleChest(inventory, right);
+ if (nms instanceof InventoryLargeChest) {
+ inventory = new CraftInventoryDoubleChest((InventoryLargeChest) nms);
}
return inventory;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java
index dd5b83cf..5c9bfe95 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java
@@ -4,6 +4,7 @@ import net.minecraft.server.TileEntityCommand;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.CommandBlock;
+import org.bukkit.craftbukkit.util.CraftChatMessage;
public class CraftCommandBlock extends CraftBlockEntityState<TileEntityCommand> implements CommandBlock {
@@ -23,7 +24,7 @@ public class CraftCommandBlock extends CraftBlockEntityState<TileEntityCommand>
super.load(commandBlock);
command = commandBlock.getCommandBlock().getCommand();
- name = commandBlock.getCommandBlock().getName();
+ name = CraftChatMessage.fromComponent(commandBlock.getCommandBlock().getName());
}
@Override
@@ -51,6 +52,6 @@ public class CraftCommandBlock extends CraftBlockEntityState<TileEntityCommand>
super.applyTo(commandBlock);
commandBlock.getCommandBlock().setCommand(command);
- commandBlock.getCommandBlock().setName(name);
+ commandBlock.getCommandBlock().setName(CraftChatMessage.fromStringOrNull(name));
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java b/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java
new file mode 100644
index 00000000..5116a376
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java
@@ -0,0 +1,17 @@
+package org.bukkit.craftbukkit.block;
+
+import net.minecraft.server.TileEntityConduit;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.block.Conduit;
+
+public class CraftConduit extends CraftBlockEntityState<TileEntityConduit> implements Conduit {
+
+ public CraftConduit(Block block) {
+ super(block, TileEntityConduit.class);
+ }
+
+ public CraftConduit(Material material, TileEntityConduit te) {
+ super(material, te);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
index 2ec70843..aa63b854 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
@@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block;
import com.google.common.base.Preconditions;
+import net.minecraft.server.EntityTypes;
import net.minecraft.server.MinecraftKey;
import net.minecraft.server.TileEntityMobSpawner;
import org.bukkit.Material;
@@ -31,7 +32,7 @@ public class CraftCreatureSpawner extends CraftBlockEntityState<TileEntityMobSpa
throw new IllegalArgumentException("Can't spawn EntityType " + entityType + " from mobspawners!");
}
- this.getSnapshot().getSpawner().setMobName(new MinecraftKey(entityType.getName()));
+ this.getSnapshot().getSpawner().setMobName(EntityTypes.a(entityType.getName()));
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftEnchantingTable.java b/src/main/java/org/bukkit/craftbukkit/block/CraftEnchantingTable.java
index f9239e55..3a782294 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftEnchantingTable.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftEnchantingTable.java
@@ -4,6 +4,7 @@ import net.minecraft.server.TileEntityEnchantTable;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.EnchantingTable;
+import org.bukkit.craftbukkit.util.CraftChatMessage;
public class CraftEnchantingTable extends CraftBlockEntityState<TileEntityEnchantTable> implements EnchantingTable {
@@ -18,12 +19,12 @@ public class CraftEnchantingTable extends CraftBlockEntityState<TileEntityEnchan
@Override
public String getCustomName() {
TileEntityEnchantTable enchant = this.getSnapshot();
- return enchant.hasCustomName() ? enchant.getName() : null;
+ return enchant.hasCustomName() ? CraftChatMessage.fromComponent(enchant.getCustomName()) : null;
}
@Override
public void setCustomName(String name) {
- this.getSnapshot().setCustomName(name);
+ this.getSnapshot().setCustomName(CraftChatMessage.fromStringOrNull(name));
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFlowerPot.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFlowerPot.java
deleted file mode 100644
index c9097ac8..00000000
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftFlowerPot.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.bukkit.craftbukkit.block;
-
-import net.minecraft.server.ItemStack;
-import net.minecraft.server.TileEntityFlowerPot;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.block.FlowerPot;
-import org.bukkit.craftbukkit.inventory.CraftItemStack;
-import org.bukkit.material.MaterialData;
-
-public class CraftFlowerPot extends CraftBlockEntityState<TileEntityFlowerPot> implements FlowerPot {
-
- private MaterialData contents;
-
- public CraftFlowerPot(Block block) {
- super(block, TileEntityFlowerPot.class);
- }
-
- public CraftFlowerPot(Material material, TileEntityFlowerPot te) {
- super(material, te);
- }
-
- @Override
- public void load(TileEntityFlowerPot pot) {
- super.load(pot);
-
- contents = (pot.getItem() == null) ? null : CraftItemStack.asBukkitCopy(pot.getContents()).getData();
- }
-
- @Override
- public MaterialData getContents() {
- return contents;
- }
-
- @Override
- public void setContents(MaterialData item) {
- contents = item;
- }
-
- @Override
- public void applyTo(TileEntityFlowerPot pot) {
- super.applyTo(pot);
-
- pot.setContents(contents == null ? ItemStack.a : CraftItemStack.asNMSCopy(contents.toItemStack(1)));
- }
-}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
index 047dbe2e..469dc4ff 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
@@ -5,6 +5,7 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Furnace;
import org.bukkit.craftbukkit.inventory.CraftInventoryFurnace;
+import org.bukkit.craftbukkit.util.CraftChatMessage;
import org.bukkit.inventory.FurnaceInventory;
public class CraftFurnace extends CraftContainer<TileEntityFurnace> implements Furnace {
@@ -54,12 +55,12 @@ public class CraftFurnace extends CraftContainer<TileEntityFurnace> implements F
@Override
public String getCustomName() {
TileEntityFurnace furnace = this.getSnapshot();
- return furnace.hasCustomName() ? furnace.getName() : null;
+ return furnace.hasCustomName() ? CraftChatMessage.fromComponent(furnace.getCustomName()) : null;
}
@Override
public void setCustomName(String name) {
- this.getSnapshot().setCustomName(name);
+ this.getSnapshot().setCustomName(CraftChatMessage.fromStringOrNull(name));
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftJukebox.java b/src/main/java/org/bukkit/craftbukkit/block/CraftJukebox.java
index d259cfb8..57160a94 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftJukebox.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftJukebox.java
@@ -1,11 +1,12 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.server.BlockJukeBox;
-import net.minecraft.server.BlockJukeBox.TileEntityRecordPlayer;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.Blocks;
+import net.minecraft.server.Item;
import net.minecraft.server.ItemStack;
import net.minecraft.server.TileEntity;
+import net.minecraft.server.TileEntityJukeBox;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -13,13 +14,13 @@ import org.bukkit.block.Jukebox;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
-public class CraftJukebox extends CraftBlockEntityState<TileEntityRecordPlayer> implements Jukebox {
+public class CraftJukebox extends CraftBlockEntityState<TileEntityJukeBox> implements Jukebox {
public CraftJukebox(final Block block) {
- super(block, TileEntityRecordPlayer.class);
+ super(block, TileEntityJukeBox.class);
}
- public CraftJukebox(final Material material, TileEntityRecordPlayer te) {
+ public CraftJukebox(final Material material, TileEntityJukeBox te) {
super(material, te);
}
@@ -39,7 +40,7 @@ public class CraftJukebox extends CraftBlockEntityState<TileEntityRecordPlayer>
Blocks.JUKEBOX.getBlockData()
.set(BlockJukeBox.HAS_RECORD, true), 3);
}
- world.playEffect(this.getLocation(), Effect.RECORD_PLAY, record.getId());
+ world.playEffect(this.getLocation(), Effect.RECORD_PLAY, Item.getId(CraftMagicNumbers.getItem((Material) record)));
}
return result;
@@ -77,12 +78,12 @@ public class CraftJukebox extends CraftBlockEntityState<TileEntityRecordPlayer>
public boolean eject() {
requirePlaced();
TileEntity tileEntity = this.getTileEntityFromWorld();
- if (!(tileEntity instanceof TileEntityRecordPlayer)) return false;
+ if (!(tileEntity instanceof TileEntityJukeBox)) return false;
- TileEntityRecordPlayer jukebox = (TileEntityRecordPlayer) tileEntity;
+ TileEntityJukeBox jukebox = (TileEntityJukeBox) tileEntity;
boolean result = !jukebox.getRecord().isEmpty();
CraftWorld world = (CraftWorld) this.getWorld();
- ((BlockJukeBox) Blocks.JUKEBOX).dropRecord(world.getHandle(), new BlockPosition(getX(), getY(), getZ()), null);
+ ((BlockJukeBox) Blocks.JUKEBOX).dropRecord(world.getHandle(), new BlockPosition(getX(), getY(), getZ()));
return result;
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
index e2af111d..d7677192 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
@@ -4,6 +4,7 @@ import net.minecraft.server.TileEntityLootable;
import org.bukkit.Material;
import org.bukkit.Nameable;
import org.bukkit.block.Block;
+import org.bukkit.craftbukkit.util.CraftChatMessage;
public abstract class CraftLootable<T extends TileEntityLootable> extends CraftContainer<T> implements Nameable {
@@ -18,12 +19,12 @@ public abstract class CraftLootable<T extends TileEntityLootable> extends CraftC
@Override
public String getCustomName() {
T lootable = this.getSnapshot();
- return lootable.hasCustomName() ? lootable.getName() : null;
+ return lootable.hasCustomName() ? CraftChatMessage.fromComponent(lootable.getCustomName()) : null;
}
@Override
public void setCustomName(String name) {
- this.getSnapshot().setCustomName(name);
+ this.getSnapshot().setCustomName(CraftChatMessage.fromStringOrNull(name));
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java
deleted file mode 100644
index 880831d4..00000000
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.bukkit.craftbukkit.block;
-
-import net.minecraft.server.BlockPosition;
-import net.minecraft.server.TileEntityNote;
-
-import org.bukkit.Instrument;
-import org.bukkit.Material;
-import org.bukkit.Note;
-import org.bukkit.block.Block;
-import org.bukkit.block.NoteBlock;
-import org.bukkit.craftbukkit.CraftWorld;
-import org.bukkit.craftbukkit.util.CraftMagicNumbers;
-
-public class CraftNoteBlock extends CraftBlockEntityState<TileEntityNote> implements NoteBlock {
-
- public CraftNoteBlock(final Block block) {
- super(block, TileEntityNote.class);
- }
-
- public CraftNoteBlock(final Material material, final TileEntityNote te) {
- super(material, te);
- }
-
- @Override
- public Note getNote() {
- return new Note(this.getSnapshot().note);
- }
-
- @Override
- public byte getRawNote() {
- return this.getSnapshot().note;
- }
-
- @Override
- public void setNote(Note note) {
- this.getSnapshot().note = note.getId();
- }
-
- @Override
- public void setRawNote(byte note) {
- this.getSnapshot().note = note;
- }
-
- @Override
- public boolean play() {
- Block block = getBlock();
-
- if (block.getType() == Material.NOTE_BLOCK) {
- TileEntityNote note = (TileEntityNote) this.getTileEntityFromWorld();
- CraftWorld world = (CraftWorld) this.getWorld();
- note.play(world.getHandle(), new BlockPosition(getX(), getY(), getZ()));
- return true;
- } else {
- return false;
- }
- }
-
- @Override
- public boolean play(byte instrument, byte note) {
- Block block = getBlock();
-
- if (block.getType() == Material.NOTE_BLOCK) {
- CraftWorld world = (CraftWorld) this.getWorld();
- world.getHandle().playBlockAction(new BlockPosition(getX(), getY(), getZ()), CraftMagicNumbers.getBlock(block), instrument, note);
- return true;
- } else {
- return false;
- }
- }
-
- @Override
- public boolean play(Instrument instrument, Note note) {
- Block block = getBlock();
-
- if (block.getType() == Material.NOTE_BLOCK) {
- CraftWorld world = (CraftWorld) this.getWorld();
- world.getHandle().playBlockAction(new BlockPosition(getX(), getY(), getZ()), CraftMagicNumbers.getBlock(block), instrument.getType(), note.getId());
- return true;
- } else {
- return false;
- }
- }
-}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java
index f2865688..f113da71 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java
@@ -12,13 +12,12 @@ import org.bukkit.SkullType;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Skull;
+import org.bukkit.block.data.Rotatable;
public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implements Skull {
private static final int MAX_OWNER_LENGTH = 16;
private GameProfile profile;
- private SkullType skullType;
- private byte rotation;
public CraftSkull(final Block block) {
super(block, TileEntitySkull.class);
@@ -33,26 +32,6 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
super.load(skull);
profile = skull.getGameProfile();
- skullType = getSkullType(skull.getSkullType());
- rotation = (byte) skull.rotation;
- }
-
- static SkullType getSkullType(int id) {
- switch (id) {
- default:
- case 0:
- return SkullType.SKELETON;
- case 1:
- return SkullType.WITHER;
- case 2:
- return SkullType.ZOMBIE;
- case 3:
- return SkullType.PLAYER;
- case 4:
- return SkullType.CREEPER;
- case 5:
- return SkullType.DRAGON;
- }
}
static int getSkullType(SkullType type) {
@@ -73,84 +52,6 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
}
}
- static byte getBlockFace(BlockFace rotation) {
- switch (rotation) {
- case NORTH:
- return 0;
- case NORTH_NORTH_EAST:
- return 1;
- case NORTH_EAST:
- return 2;
- case EAST_NORTH_EAST:
- return 3;
- case EAST:
- return 4;
- case EAST_SOUTH_EAST:
- return 5;
- case SOUTH_EAST:
- return 6;
- case SOUTH_SOUTH_EAST:
- return 7;
- case SOUTH:
- return 8;
- case SOUTH_SOUTH_WEST:
- return 9;
- case SOUTH_WEST:
- return 10;
- case WEST_SOUTH_WEST:
- return 11;
- case WEST:
- return 12;
- case WEST_NORTH_WEST:
- return 13;
- case NORTH_WEST:
- return 14;
- case NORTH_NORTH_WEST:
- return 15;
- default:
- throw new IllegalArgumentException("Invalid BlockFace rotation: " + rotation);
- }
- }
-
- static BlockFace getBlockFace(byte rotation) {
- switch (rotation) {
- case 0:
- return BlockFace.NORTH;
- case 1:
- return BlockFace.NORTH_NORTH_EAST;
- case 2:
- return BlockFace.NORTH_EAST;
- case 3:
- return BlockFace.EAST_NORTH_EAST;
- case 4:
- return BlockFace.EAST;
- case 5:
- return BlockFace.EAST_SOUTH_EAST;
- case 6:
- return BlockFace.SOUTH_EAST;
- case 7:
- return BlockFace.SOUTH_SOUTH_EAST;
- case 8:
- return BlockFace.SOUTH;
- case 9:
- return BlockFace.SOUTH_SOUTH_WEST;
- case 10:
- return BlockFace.SOUTH_WEST;
- case 11:
- return BlockFace.WEST_SOUTH_WEST;
- case 12:
- return BlockFace.WEST;
- case 13:
- return BlockFace.WEST_NORTH_WEST;
- case 14:
- return BlockFace.NORTH_WEST;
- case 15:
- return BlockFace.NORTH_NORTH_WEST;
- default:
- throw new AssertionError(rotation);
- }
- }
-
@Override
public boolean hasOwner() {
return profile != null;
@@ -172,10 +73,6 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
return false;
}
- if (skullType != SkullType.PLAYER) {
- skullType = SkullType.PLAYER;
- }
-
this.profile = profile;
return true;
}
@@ -199,47 +96,58 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
public void setOwningPlayer(OfflinePlayer player) {
Preconditions.checkNotNull(player, "player");
- if (skullType != SkullType.PLAYER) {
- skullType = SkullType.PLAYER;
- }
-
this.profile = new GameProfile(player.getUniqueId(), player.getName());
}
@Override
public BlockFace getRotation() {
- return getBlockFace(rotation);
+ return ((Rotatable) getBlockData()).getRotation();
}
@Override
public void setRotation(BlockFace rotation) {
- this.rotation = getBlockFace(rotation);
+ Rotatable blockData = (Rotatable) getBlockData();
+ blockData.setRotation(rotation);
+ setBlockData(blockData);
}
@Override
public SkullType getSkullType() {
- return skullType;
+ switch (getType()) {
+ case SKELETON_SKULL:
+ case SKELETON_WALL_SKULL:
+ return SkullType.SKELETON;
+ case WITHER_SKELETON_SKULL:
+ case WITHER_SKELETON_WALL_SKULL:
+ return SkullType.WITHER;
+ case ZOMBIE_HEAD:
+ case ZOMBIE_WALL_HEAD:
+ return SkullType.ZOMBIE;
+ case PLAYER_HEAD:
+ case PLAYER_WALL_HEAD:
+ return SkullType.PLAYER;
+ case CREEPER_HEAD:
+ case CREEPER_WALL_HEAD:
+ return SkullType.CREEPER;
+ case DRAGON_HEAD:
+ case DRAGON_WALL_HEAD:
+ return SkullType.DRAGON;
+ default:
+ throw new IllegalArgumentException("Unknown SkullType for " + getType());
+ }
}
@Override
public void setSkullType(SkullType skullType) {
- this.skullType = skullType;
-
- if (skullType != SkullType.PLAYER) {
- profile = null;
- }
+ throw new UnsupportedOperationException("Must change block type");
}
@Override
public void applyTo(TileEntitySkull skull) {
super.applyTo(skull);
- if (skullType == SkullType.PLAYER) {
+ if (getSkullType() == SkullType.PLAYER) {
skull.setGameProfile(profile);
- } else {
- skull.setSkullType(getSkullType(skullType));
}
-
- skull.setRotation(rotation);
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftStructureBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftStructureBlock.java
index 2fadc703..86095fbe 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftStructureBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftStructureBlock.java
@@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.block;
import com.google.common.base.Preconditions;
import net.minecraft.server.BlockPosition;
+import net.minecraft.server.BlockPropertyStructureMode;
import net.minecraft.server.EnumBlockMirror;
import net.minecraft.server.EnumBlockRotation;
import net.minecraft.server.TileEntityStructure;
@@ -30,35 +31,35 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
@Override
public String getStructureName() {
- return getSnapshot().a(); // PAIL: rename getStructureName
+ return getSnapshot().getStructureName();
}
@Override
public void setStructureName(String name) {
Preconditions.checkArgument(name != null, "Structure Name cannot be null");
- getSnapshot().a(name); // PAIL: rename setStructureName
+ getSnapshot().setStructureName(name);
}
@Override
public String getAuthor() {
- return getSnapshot().f;
+ return getSnapshot().author;
}
@Override
public void setAuthor(String author) {
Preconditions.checkArgument(author != null && !author.isEmpty(), "Author name cannot be null nor empty");
- getSnapshot().f = author; // PAIL: rename author
+ getSnapshot().author = author;
}
@Override
public void setAuthor(LivingEntity entity) {
Preconditions.checkArgument(entity != null, "Structure Block author entity cannot be null");
- getSnapshot().a(((CraftLivingEntity) entity).getHandle()); // PAIL: rename setAuthor
+ getSnapshot().setAuthor(((CraftLivingEntity) entity).getHandle());
}
@Override
public BlockVector getRelativePosition() {
- return new BlockVector(getSnapshot().h.getX(), getSnapshot().h.getY(), getSnapshot().h.getZ()); // PAIL: rename relativePosition
+ return new BlockVector(getSnapshot().relativePosition.getX(), getSnapshot().relativePosition.getY(), getSnapshot().relativePosition.getZ());
}
@Override
@@ -66,12 +67,12 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
Validate.isTrue(isBetween(vector.getBlockX(), -MAX_SIZE, MAX_SIZE), "Structure Size (X) must be between -" + MAX_SIZE + " and " + MAX_SIZE);
Validate.isTrue(isBetween(vector.getBlockY(), -MAX_SIZE, MAX_SIZE), "Structure Size (Y) must be between -" + MAX_SIZE + " and " + MAX_SIZE);
Validate.isTrue(isBetween(vector.getBlockZ(), -MAX_SIZE, MAX_SIZE), "Structure Size (Z) must be between -" + MAX_SIZE + " and " + MAX_SIZE);
- getSnapshot().h = new BlockPosition(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); // PAIL: rename relativePosition
+ getSnapshot().relativePosition = new BlockPosition(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
}
@Override
public BlockVector getStructureSize() {
- return new BlockVector(getSnapshot().i.getX(), getSnapshot().i.getY(), getSnapshot().i.getZ()); // PAIL: rename size
+ return new BlockVector(getSnapshot().size.getX(), getSnapshot().size.getY(), getSnapshot().size.getZ());
}
@Override
@@ -79,101 +80,101 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
Validate.isTrue(isBetween(vector.getBlockX(), 0, MAX_SIZE), "Structure Size (X) must be between 0 and " + MAX_SIZE);
Validate.isTrue(isBetween(vector.getBlockY(), 0, MAX_SIZE), "Structure Size (Y) must be between 0 and " + MAX_SIZE);
Validate.isTrue(isBetween(vector.getBlockZ(), 0, MAX_SIZE), "Structure Size (Z) must be between 0 and " + MAX_SIZE);
- getSnapshot().i = new BlockPosition(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); // PAIL: rename size
+ getSnapshot().size = new BlockPosition(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
}
@Override
public void setMirror(Mirror mirror) {
- getSnapshot().j = EnumBlockMirror.valueOf(mirror.name()); // PAIL: rename mirror
+ getSnapshot().mirror = EnumBlockMirror.valueOf(mirror.name());
}
@Override
public Mirror getMirror() {
- return Mirror.valueOf(getSnapshot().j.name()); // PAIL: rename mirror
+ return Mirror.valueOf(getSnapshot().mirror.name());
}
@Override
public void setRotation(StructureRotation rotation) {
- getSnapshot().k = EnumBlockRotation.valueOf(rotation.name()); // PAIL: rename rotation
+ getSnapshot().rotation = EnumBlockRotation.valueOf(rotation.name());
}
@Override
public StructureRotation getRotation() {
- return StructureRotation.valueOf(getSnapshot().k.name()); // PAIL: rename rotation
+ return StructureRotation.valueOf(getSnapshot().rotation.name());
}
@Override
public void setUsageMode(UsageMode mode) {
- getSnapshot().a(TileEntityStructure.UsageMode.valueOf(mode.name())); // PAIL: rename setUsageMode
+ getSnapshot().setUsageMode(BlockPropertyStructureMode.valueOf(mode.name()));
}
@Override
public UsageMode getUsageMode() {
- return UsageMode.valueOf(getSnapshot().k().name()); // PAIL rename getUsageMode
+ return UsageMode.valueOf(getSnapshot().getUsageMode().name());
}
@Override
public void setIgnoreEntities(boolean flag) {
- getSnapshot().m = flag; // PAIL: rename ignoreEntities
+ getSnapshot().ignoreEntities = flag;
}
@Override
public boolean isIgnoreEntities() {
- return getSnapshot().m; // PAIL: rename ignoreEntities
+ return getSnapshot().ignoreEntities;
}
@Override
public void setShowAir(boolean showAir) {
- getSnapshot().o = showAir; // PAIL rename showAir
+ getSnapshot().showAir = showAir;
}
@Override
public boolean isShowAir() {
- return getSnapshot().o; // PAIL: rename showAir
+ return getSnapshot().showAir;
}
@Override
public void setBoundingBoxVisible(boolean showBoundingBox) {
- getSnapshot().p = showBoundingBox; // PAIL: rename boundingBoxVisible
+ getSnapshot().showBoundingBox = showBoundingBox;
}
@Override
public boolean isBoundingBoxVisible() {
- return getSnapshot().p; // PAIL: rename boundingBoxVisible
+ return getSnapshot().showBoundingBox;
}
@Override
public void setIntegrity(float integrity) {
Validate.isTrue(isBetween(integrity, 0.0f, 1.0f), "Integrity must be between 0.0f and 1.0f");
- getSnapshot().q = integrity; // PAIL: rename integrity
+ getSnapshot().integrity = integrity;
}
@Override
public float getIntegrity() {
- return getSnapshot().q; // PAIL: rename integrity
+ return getSnapshot().integrity;
}
@Override
public void setSeed(long seed) {
- getSnapshot().r = seed; // PAIL: rename seed
+ getSnapshot().seed = seed;
}
@Override
public long getSeed() {
- return getSnapshot().r; // PAIL: rename seed
+ return getSnapshot().seed;
}
@Override
public void setMetadata(String metadata) {
Validate.notNull(metadata, "Structure metadata cannot be null");
if (getUsageMode() == UsageMode.DATA) {
- getSnapshot().g = metadata; // PAIL: rename metadata
+ getSnapshot().metadata = metadata;
}
}
@Override
public String getMetadata() {
- return getSnapshot().g; // PAIL: rename metadata
+ return getSnapshot().metadata;
}
private static boolean isBetween(int num, int min, int max) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftAgeable.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftAgeable.java
new file mode 100644
index 00000000..e311e66b
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftAgeable.java
@@ -0,0 +1,23 @@
+package org.bukkit.craftbukkit.block.data;
+
+import org.bukkit.block.data.Ageable;
+
+public abstract class CraftAgeable extends CraftBlockData implements Ageable {
+
+ private static final net.minecraft.server.BlockStateInteger AGE = getInteger("age");
+
+ @Override
+ public int getAge() {
+ return get(AGE);
+ }
+
+ @Override
+ public void setAge(int age) {
+ set(AGE, age);
+ }
+
+ @Override
+ public int getMaximumAge() {
+ return getMax(AGE);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftAnaloguePowerable.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftAnaloguePowerable.java
new file mode 100644
index 00000000..60a247ce
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftAnaloguePowerable.java
@@ -0,0 +1,23 @@
+package org.bukkit.craftbukkit.block.data;
+
+import org.bukkit.block.data.AnaloguePowerable;
+
+public abstract class CraftAnaloguePowerable extends CraftBlockData implements AnaloguePowerable {
+
+ private static final net.minecraft.server.BlockStateInteger POWER = getInteger("power");
+
+ @Override
+ public int getPower() {
+ return get(POWER);
+ }
+
+ @Override
+ public void setPower(int power) {
+ set(POWER, power);
+ }
+
+ @Override
+ public int getMaximumPower() {
+ return getMax(POWER);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftAttachable.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftAttachable.java
new file mode 100644
index 00000000..657cf073
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftAttachable.java
@@ -0,0 +1,18 @@
+package org.bukkit.craftbukkit.block.data;
+
+import org.bukkit.block.data.Attachable;
+
+public abstract class CraftAttachable extends CraftBlockData implements Attachable {
+
+ private static final net.minecraft.server.BlockStateBoolean ATTACHED = getBoolean("attached");
+
+ @Override
+ public boolean isAttached() {
+ return get(ATTACHED);
+ }
+
+ @Override
+ public void setAttached(boolean attached) {
+ set(ATTACHED, attached);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBisected.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBisected.java
new file mode 100644
index 00000000..969b670e
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBisected.java
@@ -0,0 +1,18 @@
+package org.bukkit.craftbukkit.block.data;
+
+import org.bukkit.block.data.Bisected;
+
+public class CraftBisected extends CraftBlockData implements Bisected {
+
+ private static final net.minecraft.server.BlockStateEnum<?> HALF = getEnum("half");
+
+ @Override
+ public Half getHalf() {
+ return get(HALF, Half.class);
+ }
+
+ @Override
+ public void setHalf(Half half) {
+ set(HALF, half);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
new file mode 100644
index 00000000..78cec61b
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
@@ -0,0 +1,356 @@
+package org.bukkit.craftbukkit.block.data;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.BiMap;
+import com.google.common.collect.HashBiMap;
+import com.google.common.collect.ImmutableSet;
+import com.mojang.brigadier.StringReader;
+import com.mojang.brigadier.exceptions.CommandSyntaxException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import net.minecraft.server.ArgumentBlock;
+import net.minecraft.server.Block;
+import net.minecraft.server.BlockStateBoolean;
+import net.minecraft.server.BlockStateEnum;
+import net.minecraft.server.BlockStateInteger;
+import net.minecraft.server.EnumDirection;
+import net.minecraft.server.IBlockData;
+import net.minecraft.server.IBlockState;
+import net.minecraft.server.INamable;
+import org.bukkit.Material;
+import org.bukkit.block.BlockFace;
+import org.bukkit.block.data.BlockData;
+import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
+
+public class CraftBlockData implements BlockData {
+
+ private IBlockData state;
+
+ protected CraftBlockData() {
+ throw new AssertionError("Template Constructor");
+ }
+
+ protected CraftBlockData(IBlockData state) {
+ this.state = state;
+ }
+
+ @Override
+ public Material getMaterial() {
+ return CraftMagicNumbers.getMaterial(state.getBlock());
+ }
+
+ public IBlockData getState() {
+ return state;
+ }
+
+ protected <B extends Enum<B>> B get(BlockStateEnum<?> nms, Class<B> bukkit) {
+ return toBukkit(state.get(nms), bukkit);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected <B extends Enum<B>> Set<B> getValues(BlockStateEnum<?> nms, Class<B> bukkit) {
+ ImmutableSet.Builder<B> values = ImmutableSet.builder();
+
+ for (Enum<?> e : nms.d()) {
+ values.add(toBukkit(e, bukkit));
+ }
+
+ return values.build();
+ }
+
+ protected <B extends Enum<B>, N extends Enum<N> & INamable> void set(BlockStateEnum<N> nms, Enum<B> bukkit) {
+ this.state = this.state.set(nms, toNMS(bukkit, nms.b()));
+ }
+
+ private static final BiMap<Enum<?>, Enum<?>> nmsToBukkit = HashBiMap.create();
+
+ @SuppressWarnings("unchecked")
+ private static <B extends Enum<B>> B toBukkit(Enum<?> nms, Class<B> bukkit) {
+ Enum<?> converted = nmsToBukkit.get(nms);
+ if (converted != null) {
+ return (B) converted;
+ }
+
+ if (nms instanceof EnumDirection) {
+ converted = CraftBlock.notchToBlockFace((EnumDirection) nms);
+ } else {
+ converted = bukkit.getEnumConstants()[nms.ordinal()];
+ }
+
+ Preconditions.checkState(converted != null, "Could not convert enum %s->%s", nms, bukkit);
+ nmsToBukkit.put(nms, converted);
+
+ return (B) converted;
+ }
+
+ @SuppressWarnings("unchecked")
+ private static <N extends Enum<N> & INamable> N toNMS(Enum<?> bukkit, Class<N> nms) {
+ Enum<?> converted = nmsToBukkit.inverse().get(bukkit);
+ if (converted != null) {
+ return (N) converted;
+ }
+
+ if (bukkit instanceof BlockFace) {
+ converted = CraftBlock.blockFaceToNotch((BlockFace) bukkit);
+ } else {
+ converted = nms.getEnumConstants()[bukkit.ordinal()];
+ }
+
+ Preconditions.checkState(converted != null, "Could not convert enum %s->%s", nms, bukkit);
+ nmsToBukkit.put(converted, bukkit);
+
+ return (N) converted;
+ }
+
+ protected <T extends Comparable<T>> T get(IBlockState<T> ibs) {
+ // Straight integer or boolean getter
+ return this.state.get(ibs);
+ }
+
+ public <T extends Comparable<T>, V extends T> void set(IBlockState<T> ibs, V v) {
+ // Straight integer or boolean setter
+ this.state = this.state.set(ibs, v);
+ }
+
+ @Override
+ public String getAsString() {
+ return state.toString();
+ }
+
+ @Override
+ public BlockData clone() {
+ try {
+ return (BlockData) super.clone();
+ } catch (CloneNotSupportedException ex) {
+ throw new AssertionError("Clone not supported", ex);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "CraftBlockData{" + state.toString() + "}";
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return obj instanceof CraftBlockData && state.equals(((CraftBlockData) obj).state);
+ }
+
+ @Override
+ public int hashCode() {
+ return state.hashCode();
+ }
+
+ protected static BlockStateBoolean getBoolean(String name) {
+ throw new AssertionError("Template Method");
+ }
+
+ protected static BlockStateBoolean getBoolean(String name, boolean optional) {
+ throw new AssertionError("Template Method");
+ }
+
+ protected static BlockStateEnum<?> getEnum(String name) {
+ throw new AssertionError("Template Method");
+ }
+
+ protected static BlockStateInteger getInteger(String name) {
+ throw new AssertionError("Template Method");
+ }
+
+ protected static BlockStateBoolean getBoolean(Class<? extends Block> block, String name) {
+ return (BlockStateBoolean) getState(block, name, false);
+ }
+
+ protected static BlockStateBoolean getBoolean(Class<? extends Block> block, String name, boolean optional) {
+ return (BlockStateBoolean) getState(block, name, optional);
+ }
+
+ protected static BlockStateEnum<?> getEnum(Class<? extends Block> block, String name) {
+ return (BlockStateEnum<?>) getState(block, name, false);
+ }
+
+ protected static BlockStateInteger getInteger(Class<? extends Block> block, String name) {
+ return (BlockStateInteger) getState(block, name, false);
+ }
+
+ private static IBlockState<?> getState(Class<? extends Block> block, String name, boolean optional) {
+ IBlockState<?> state = null;
+
+ for (Block instance : (Iterable<Block>) Block.REGISTRY) { // Eclipse fail
+ if (instance.getClass() == block) {
+ if (state == null) {
+ state = instance.getStates().a(name);
+ } else {
+ IBlockState<?> newState = instance.getStates().a(name);
+
+ Preconditions.checkState(state == newState, "State mistmatch %s,%s", state, newState);
+ }
+ }
+ }
+
+ Preconditions.checkState(optional || state != null, "Null state for %s,%s", block, name);
+
+ return state;
+ }
+
+ protected static int getMin(BlockStateInteger state) {
+ return state.min;
+ }
+
+ protected static int getMax(BlockStateInteger state) {
+ return state.max;
+ }
+
+ //
+ private static final Map<Class<? extends Block>, Class<? extends CraftBlockData>> MAP = new HashMap<>();
+
+ static {
+ register(net.minecraft.server.BlockAnvil.class, org.bukkit.craftbukkit.block.impl.CraftAnvil.class);
+ register(net.minecraft.server.BlockBanner.class, org.bukkit.craftbukkit.block.impl.CraftBanner.class);
+ register(net.minecraft.server.BlockBannerWall.class, org.bukkit.craftbukkit.block.impl.CraftBannerWall.class);
+ register(net.minecraft.server.BlockBed.class, org.bukkit.craftbukkit.block.impl.CraftBed.class);
+ register(net.minecraft.server.BlockBeetroot.class, org.bukkit.craftbukkit.block.impl.CraftBeetroot.class);
+ register(net.minecraft.server.BlockBrewingStand.class, org.bukkit.craftbukkit.block.impl.CraftBrewingStand.class);
+ register(net.minecraft.server.BlockBubbleColumn.class, org.bukkit.craftbukkit.block.impl.CraftBubbleColumn.class);
+ register(net.minecraft.server.BlockCactus.class, org.bukkit.craftbukkit.block.impl.CraftCactus.class);
+ register(net.minecraft.server.BlockCake.class, org.bukkit.craftbukkit.block.impl.CraftCake.class);
+ register(net.minecraft.server.BlockCarrots.class, org.bukkit.craftbukkit.block.impl.CraftCarrots.class);
+ register(net.minecraft.server.BlockCauldron.class, org.bukkit.craftbukkit.block.impl.CraftCauldron.class);
+ register(net.minecraft.server.BlockChest.class, org.bukkit.craftbukkit.block.impl.CraftChest.class);
+ register(net.minecraft.server.BlockChestTrapped.class, org.bukkit.craftbukkit.block.impl.CraftChestTrapped.class);
+ register(net.minecraft.server.BlockChorusFlower.class, org.bukkit.craftbukkit.block.impl.CraftChorusFlower.class);
+ register(net.minecraft.server.BlockChorusFruit.class, org.bukkit.craftbukkit.block.impl.CraftChorusFruit.class);
+ register(net.minecraft.server.BlockCobbleWall.class, org.bukkit.craftbukkit.block.impl.CraftCobbleWall.class);
+ register(net.minecraft.server.BlockCocoa.class, org.bukkit.craftbukkit.block.impl.CraftCocoa.class);
+ register(net.minecraft.server.BlockCommand.class, org.bukkit.craftbukkit.block.impl.CraftCommand.class);
+ register(net.minecraft.server.BlockCoralFan.class, org.bukkit.craftbukkit.block.impl.CraftCoralFan.class);
+ register(net.minecraft.server.BlockCrops.class, org.bukkit.craftbukkit.block.impl.CraftCrops.class);
+ register(net.minecraft.server.BlockDaylightDetector.class, org.bukkit.craftbukkit.block.impl.CraftDaylightDetector.class);
+ register(net.minecraft.server.BlockDirtSnow.class, org.bukkit.craftbukkit.block.impl.CraftDirtSnow.class);
+ register(net.minecraft.server.BlockDispenser.class, org.bukkit.craftbukkit.block.impl.CraftDispenser.class);
+ register(net.minecraft.server.BlockDoor.class, org.bukkit.craftbukkit.block.impl.CraftDoor.class);
+ register(net.minecraft.server.BlockDropper.class, org.bukkit.craftbukkit.block.impl.CraftDropper.class);
+ register(net.minecraft.server.BlockEndRod.class, org.bukkit.craftbukkit.block.impl.CraftEndRod.class);
+ register(net.minecraft.server.BlockEnderChest.class, org.bukkit.craftbukkit.block.impl.CraftEnderChest.class);
+ register(net.minecraft.server.BlockEnderPortalFrame.class, org.bukkit.craftbukkit.block.impl.CraftEnderPortalFrame.class);
+ register(net.minecraft.server.BlockFence.class, org.bukkit.craftbukkit.block.impl.CraftFence.class);
+ register(net.minecraft.server.BlockFenceGate.class, org.bukkit.craftbukkit.block.impl.CraftFenceGate.class);
+ register(net.minecraft.server.BlockFire.class, org.bukkit.craftbukkit.block.impl.CraftFire.class);
+ register(net.minecraft.server.BlockFloorSign.class, org.bukkit.craftbukkit.block.impl.CraftFloorSign.class);
+ register(net.minecraft.server.BlockFluids.class, org.bukkit.craftbukkit.block.impl.CraftFluids.class);
+ register(net.minecraft.server.BlockFurnace.class, org.bukkit.craftbukkit.block.impl.CraftFurnace.class);
+ register(net.minecraft.server.BlockGlassPane.class, org.bukkit.craftbukkit.block.impl.CraftGlassPane.class);
+ register(net.minecraft.server.BlockGlazedTerracotta.class, org.bukkit.craftbukkit.block.impl.CraftGlazedTerracotta.class);
+ register(net.minecraft.server.BlockGrass.class, org.bukkit.craftbukkit.block.impl.CraftGrass.class);
+ register(net.minecraft.server.BlockHay.class, org.bukkit.craftbukkit.block.impl.CraftHay.class);
+ register(net.minecraft.server.BlockHopper.class, org.bukkit.craftbukkit.block.impl.CraftHopper.class);
+ register(net.minecraft.server.BlockHugeMushroom.class, org.bukkit.craftbukkit.block.impl.CraftHugeMushroom.class);
+ register(net.minecraft.server.BlockIceFrost.class, org.bukkit.craftbukkit.block.impl.CraftIceFrost.class);
+ register(net.minecraft.server.BlockIronBars.class, org.bukkit.craftbukkit.block.impl.CraftIronBars.class);
+ register(net.minecraft.server.BlockJukeBox.class, org.bukkit.craftbukkit.block.impl.CraftJukeBox.class);
+ register(net.minecraft.server.BlockKelp.class, org.bukkit.craftbukkit.block.impl.CraftKelp.class);
+ register(net.minecraft.server.BlockLadder.class, org.bukkit.craftbukkit.block.impl.CraftLadder.class);
+ register(net.minecraft.server.BlockLeaves.class, org.bukkit.craftbukkit.block.impl.CraftLeaves.class);
+ register(net.minecraft.server.BlockLever.class, org.bukkit.craftbukkit.block.impl.CraftLever.class);
+ register(net.minecraft.server.BlockLogAbstract.class, org.bukkit.craftbukkit.block.impl.CraftLogAbstract.class);
+ register(net.minecraft.server.BlockMinecartDetector.class, org.bukkit.craftbukkit.block.impl.CraftMinecartDetector.class);
+ register(net.minecraft.server.BlockMinecartTrack.class, org.bukkit.craftbukkit.block.impl.CraftMinecartTrack.class);
+ register(net.minecraft.server.BlockMycel.class, org.bukkit.craftbukkit.block.impl.CraftMycel.class);
+ register(net.minecraft.server.BlockNetherWart.class, org.bukkit.craftbukkit.block.impl.CraftNetherWart.class);
+ register(net.minecraft.server.BlockNote.class, org.bukkit.craftbukkit.block.impl.CraftNote.class);
+ register(net.minecraft.server.BlockObserver.class, org.bukkit.craftbukkit.block.impl.CraftObserver.class);
+ register(net.minecraft.server.BlockPiston.class, org.bukkit.craftbukkit.block.impl.CraftPiston.class);
+ register(net.minecraft.server.BlockPistonExtension.class, org.bukkit.craftbukkit.block.impl.CraftPistonExtension.class);
+ register(net.minecraft.server.BlockPistonMoving.class, org.bukkit.craftbukkit.block.impl.CraftPistonMoving.class);
+ register(net.minecraft.server.BlockPortal.class, org.bukkit.craftbukkit.block.impl.CraftPortal.class);
+ register(net.minecraft.server.BlockPotatoes.class, org.bukkit.craftbukkit.block.impl.CraftPotatoes.class);
+ register(net.minecraft.server.BlockPoweredRail.class, org.bukkit.craftbukkit.block.impl.CraftPoweredRail.class);
+ register(net.minecraft.server.BlockPressurePlateBinary.class, org.bukkit.craftbukkit.block.impl.CraftPressurePlateBinary.class);
+ register(net.minecraft.server.BlockPressurePlateWeighted.class, org.bukkit.craftbukkit.block.impl.CraftPressurePlateWeighted.class);
+ register(net.minecraft.server.BlockPumpkinCarved.class, org.bukkit.craftbukkit.block.impl.CraftPumpkinCarved.class);
+ register(net.minecraft.server.BlockRedstoneComparator.class, org.bukkit.craftbukkit.block.impl.CraftRedstoneComparator.class);
+ register(net.minecraft.server.BlockRedstoneLamp.class, org.bukkit.craftbukkit.block.impl.CraftRedstoneLamp.class);
+ register(net.minecraft.server.BlockRedstoneOre.class, org.bukkit.craftbukkit.block.impl.CraftRedstoneOre.class);
+ register(net.minecraft.server.BlockRedstoneTorch.class, org.bukkit.craftbukkit.block.impl.CraftRedstoneTorch.class);
+ register(net.minecraft.server.BlockRedstoneTorchWall.class, org.bukkit.craftbukkit.block.impl.CraftRedstoneTorchWall.class);
+ register(net.minecraft.server.BlockRedstoneWire.class, org.bukkit.craftbukkit.block.impl.CraftRedstoneWire.class);
+ register(net.minecraft.server.BlockReed.class, org.bukkit.craftbukkit.block.impl.CraftReed.class);
+ register(net.minecraft.server.BlockRepeater.class, org.bukkit.craftbukkit.block.impl.CraftRepeater.class);
+ register(net.minecraft.server.BlockRotatable.class, org.bukkit.craftbukkit.block.impl.CraftRotatable.class);
+ register(net.minecraft.server.BlockSapling.class, org.bukkit.craftbukkit.block.impl.CraftSapling.class);
+ register(net.minecraft.server.BlockSeaPickle.class, org.bukkit.craftbukkit.block.impl.CraftSeaPickle.class);
+ register(net.minecraft.server.BlockShulkerBox.class, org.bukkit.craftbukkit.block.impl.CraftShulkerBox.class);
+ register(net.minecraft.server.BlockSkull.class, org.bukkit.craftbukkit.block.impl.CraftSkull.class);
+ register(net.minecraft.server.BlockSkullPlayer.class, org.bukkit.craftbukkit.block.impl.CraftSkullPlayer.class);
+ register(net.minecraft.server.BlockSkullPlayerWall.class, org.bukkit.craftbukkit.block.impl.CraftSkullPlayerWall.class);
+ register(net.minecraft.server.BlockSkullWall.class, org.bukkit.craftbukkit.block.impl.CraftSkullWall.class);
+ register(net.minecraft.server.BlockSnow.class, org.bukkit.craftbukkit.block.impl.CraftSnow.class);
+ register(net.minecraft.server.BlockSoil.class, org.bukkit.craftbukkit.block.impl.CraftSoil.class);
+ register(net.minecraft.server.BlockStainedGlassPane.class, org.bukkit.craftbukkit.block.impl.CraftStainedGlassPane.class);
+ register(net.minecraft.server.BlockStairs.class, org.bukkit.craftbukkit.block.impl.CraftStairs.class);
+ register(net.minecraft.server.BlockStem.class, org.bukkit.craftbukkit.block.impl.CraftStem.class);
+ register(net.minecraft.server.BlockStemAttached.class, org.bukkit.craftbukkit.block.impl.CraftStemAttached.class);
+ register(net.minecraft.server.BlockStepAbstract.class, org.bukkit.craftbukkit.block.impl.CraftStepAbstract.class);
+ register(net.minecraft.server.BlockStoneButton.class, org.bukkit.craftbukkit.block.impl.CraftStoneButton.class);
+ register(net.minecraft.server.BlockStructure.class, org.bukkit.craftbukkit.block.impl.CraftStructure.class);
+ register(net.minecraft.server.BlockTallPlantFlower.class, org.bukkit.craftbukkit.block.impl.CraftTallPlantFlower.class);
+ register(net.minecraft.server.BlockTallPlantShearable.class, org.bukkit.craftbukkit.block.impl.CraftTallPlantShearable.class);
+ register(net.minecraft.server.BlockTallSeaGrass.class, org.bukkit.craftbukkit.block.impl.CraftTallSeaGrass.class);
+ register(net.minecraft.server.BlockTorchWall.class, org.bukkit.craftbukkit.block.impl.CraftTorchWall.class);
+ register(net.minecraft.server.BlockTrapdoor.class, org.bukkit.craftbukkit.block.impl.CraftTrapdoor.class);
+ register(net.minecraft.server.BlockTripwire.class, org.bukkit.craftbukkit.block.impl.CraftTripwire.class);
+ register(net.minecraft.server.BlockTripwireHook.class, org.bukkit.craftbukkit.block.impl.CraftTripwireHook.class);
+ register(net.minecraft.server.BlockTurtleEgg.class, org.bukkit.craftbukkit.block.impl.CraftTurtleEgg.class);
+ register(net.minecraft.server.BlockVine.class, org.bukkit.craftbukkit.block.impl.CraftVine.class);
+ register(net.minecraft.server.BlockWallSign.class, org.bukkit.craftbukkit.block.impl.CraftWallSign.class);
+ register(net.minecraft.server.BlockWitherSkull.class, org.bukkit.craftbukkit.block.impl.CraftWitherSkull.class);
+ register(net.minecraft.server.BlockWitherSkullWall.class, org.bukkit.craftbukkit.block.impl.CraftWitherSkullWall.class);
+ register(net.minecraft.server.BlockWoodButton.class, org.bukkit.craftbukkit.block.impl.CraftWoodButton.class);
+ }
+
+ private static void register(Class<? extends Block> nms, Class<? extends CraftBlockData> bukkit) {
+ Preconditions.checkState(MAP.put(nms, bukkit) == null, "Duplicate mapping %s->%s", nms, bukkit);
+ }
+
+ public static CraftBlockData newData(Material material, String data) {
+ IBlockData blockData;
+ Block block = CraftMagicNumbers.getBlock(material);
+
+ // Data provided, use it
+ if (data != null) {
+ try {
+ // Material provided, force that material in
+ if (block != null) {
+ data = Block.REGISTRY.b(block) + data;
+ }
+
+ ArgumentBlock arg = new ArgumentBlock(new StringReader(data), false).a(false);
+ blockData = arg.b();
+ } catch (CommandSyntaxException ex) {
+ throw new IllegalArgumentException("Could not parse data: " + data, ex);
+ }
+ } else {
+ blockData = block.getBlockData();
+ }
+
+ return fromData(blockData);
+ }
+
+ public static CraftBlockData fromData(IBlockData data) {
+ Class<? extends CraftBlockData> craft = MAP.get(data.getBlock().getClass());
+ if (craft == null) {
+ craft = CraftBlockData.class;
+ }
+
+ CraftBlockData ret;
+ try {
+ ret = craft.getDeclaredConstructor(IBlockData.class).newInstance(data);
+ } catch (ReflectiveOperationException ex) {
+ throw new RuntimeException(ex);
+ }
+
+ return ret;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftDirectional.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftDirectional.java
new file mode 100644
index 00000000..7b3ec881
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftDirectional.java
@@ -0,0 +1,23 @@
+package org.bukkit.craftbukkit.block.data;
+
+import org.bukkit.block.data.Directional;
+
+public abstract class CraftDirectional extends CraftBlockData implements Directional {
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum("facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftLevelled.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftLevelled.java
new file mode 100644
index 00000000..3d4afa74
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftLevelled.java
@@ -0,0 +1,23 @@
+package org.bukkit.craftbukkit.block.data;
+
+import org.bukkit.block.data.Levelled;
+
+public abstract class CraftLevelled extends CraftBlockData implements Levelled {
+
+ private static final net.minecraft.server.BlockStateInteger LEVEL = getInteger("level");
+
+ @Override
+ public int getLevel() {
+ return get(LEVEL);
+ }
+
+ @Override
+ public void setLevel(int level) {
+ set(LEVEL, level);
+ }
+
+ @Override
+ public int getMaximumLevel() {
+ return getMax(LEVEL);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftLightable.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftLightable.java
new file mode 100644
index 00000000..cfe4b26e
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftLightable.java
@@ -0,0 +1,18 @@
+package org.bukkit.craftbukkit.block.data;
+
+import org.bukkit.block.data.Lightable;
+
+public abstract class CraftLightable extends CraftBlockData implements Lightable {
+
+ private static final net.minecraft.server.BlockStateBoolean LIT = getBoolean("lit");
+
+ @Override
+ public boolean isLit() {
+ return get(LIT);
+ }
+
+ @Override
+ public void setLit(boolean lit) {
+ set(LIT, lit);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftMultipleFacing.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftMultipleFacing.java
new file mode 100644
index 00000000..5d2cc2a9
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftMultipleFacing.java
@@ -0,0 +1,46 @@
+package org.bukkit.craftbukkit.block.data;
+
+import org.bukkit.block.data.MultipleFacing;
+
+public abstract class CraftMultipleFacing extends CraftBlockData implements MultipleFacing {
+
+ private static final net.minecraft.server.BlockStateBoolean[] FACES = new net.minecraft.server.BlockStateBoolean[]{
+ getBoolean("north", true), getBoolean("east", true), getBoolean("south", true), getBoolean("west", true), getBoolean("up", true), getBoolean("down", true)
+ };
+
+ @Override
+ public boolean hasFace(org.bukkit.block.BlockFace face) {
+ return get(FACES[face.ordinal()]);
+ }
+
+ @Override
+ public void setFace(org.bukkit.block.BlockFace face, boolean has) {
+ set(FACES[face.ordinal()], has);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null && get(FACES[i])) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getAllowedFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftOpenable.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftOpenable.java
new file mode 100644
index 00000000..31abd411
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftOpenable.java
@@ -0,0 +1,18 @@
+package org.bukkit.craftbukkit.block.data;
+
+import org.bukkit.block.data.Openable;
+
+public abstract class CraftOpenable extends CraftBlockData implements Openable {
+
+ private static final net.minecraft.server.BlockStateBoolean OPEN = getBoolean("open");
+
+ @Override
+ public boolean isOpen() {
+ return get(OPEN);
+ }
+
+ @Override
+ public void setOpen(boolean open) {
+ set(OPEN, open);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftOrientable.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftOrientable.java
new file mode 100644
index 00000000..72cc0aa9
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftOrientable.java
@@ -0,0 +1,23 @@
+package org.bukkit.craftbukkit.block.data;
+
+import org.bukkit.block.data.Orientable;
+
+public class CraftOrientable extends CraftBlockData implements Orientable {
+
+ private static final net.minecraft.server.BlockStateEnum<?> AXIS = getEnum("axis");
+
+ @Override
+ public org.bukkit.Axis getAxis() {
+ return get(AXIS, org.bukkit.Axis.class);
+ }
+
+ @Override
+ public void setAxis(org.bukkit.Axis axis) {
+ set(AXIS, axis);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.Axis> getAxes() {
+ return getValues(AXIS, org.bukkit.Axis.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftPowerable.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftPowerable.java
new file mode 100644
index 00000000..f932cf17
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftPowerable.java
@@ -0,0 +1,18 @@
+package org.bukkit.craftbukkit.block.data;
+
+import org.bukkit.block.data.Powerable;
+
+public abstract class CraftPowerable extends CraftBlockData implements Powerable {
+
+ private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean("powered");
+
+ @Override
+ public boolean isPowered() {
+ return get(POWERED);
+ }
+
+ @Override
+ public void setPowered(boolean powered) {
+ set(POWERED, powered);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftRail.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftRail.java
new file mode 100644
index 00000000..5ee64559
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftRail.java
@@ -0,0 +1,23 @@
+package org.bukkit.craftbukkit.block.data;
+
+import org.bukkit.block.data.Rail;
+
+public abstract class CraftRail extends CraftBlockData implements Rail {
+
+ private static final net.minecraft.server.BlockStateEnum<?> SHAPE = getEnum("shape");
+
+ @Override
+ public Shape getShape() {
+ return get(SHAPE, Shape.class);
+ }
+
+ @Override
+ public void setShape(Shape shape) {
+ set(SHAPE, shape);
+ }
+
+ @Override
+ public java.util.Set<Shape> getShapes() {
+ return getValues(SHAPE, Shape.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftRotatable.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftRotatable.java
new file mode 100644
index 00000000..78668da5
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftRotatable.java
@@ -0,0 +1,107 @@
+package org.bukkit.craftbukkit.block.data;
+
+import org.bukkit.block.data.Rotatable;
+
+public abstract class CraftRotatable extends CraftBlockData implements Rotatable {
+
+ private static final net.minecraft.server.BlockStateInteger ROTATION = getInteger("rotation");
+
+ @Override
+ public org.bukkit.block.BlockFace getRotation() {
+ int data = get(ROTATION);
+ switch (data) {
+ case 0x0:
+ return org.bukkit.block.BlockFace.SOUTH;
+ case 0x1:
+ return org.bukkit.block.BlockFace.SOUTH_SOUTH_WEST;
+ case 0x2:
+ return org.bukkit.block.BlockFace.SOUTH_WEST;
+ case 0x3:
+ return org.bukkit.block.BlockFace.WEST_SOUTH_WEST;
+ case 0x4:
+ return org.bukkit.block.BlockFace.WEST;
+ case 0x5:
+ return org.bukkit.block.BlockFace.WEST_NORTH_WEST;
+ case 0x6:
+ return org.bukkit.block.BlockFace.NORTH_WEST;
+ case 0x7:
+ return org.bukkit.block.BlockFace.NORTH_NORTH_WEST;
+ case 0x8:
+ return org.bukkit.block.BlockFace.NORTH;
+ case 0x9:
+ return org.bukkit.block.BlockFace.NORTH_NORTH_EAST;
+ case 0xA:
+ return org.bukkit.block.BlockFace.NORTH_EAST;
+ case 0xB:
+ return org.bukkit.block.BlockFace.EAST_NORTH_EAST;
+ case 0xC:
+ return org.bukkit.block.BlockFace.EAST;
+ case 0xD:
+ return org.bukkit.block.BlockFace.EAST_SOUTH_EAST;
+ case 0xE:
+ return org.bukkit.block.BlockFace.SOUTH_EAST;
+ case 0xF:
+ return org.bukkit.block.BlockFace.SOUTH_SOUTH_EAST;
+ default:
+ throw new IllegalArgumentException("Unknown rotation " + data);
+ }
+ }
+
+ @Override
+ public void setRotation(org.bukkit.block.BlockFace rotation) {
+ int val;
+ switch (rotation) {
+ case SOUTH:
+ val = 0x0;
+ break;
+ case SOUTH_SOUTH_WEST:
+ val = 0x1;
+ break;
+ case SOUTH_WEST:
+ val = 0x2;
+ break;
+ case WEST_SOUTH_WEST:
+ val = 0x3;
+ break;
+ case WEST:
+ val = 0x4;
+ break;
+ case WEST_NORTH_WEST:
+ val = 0x5;
+ break;
+ case NORTH_WEST:
+ val = 0x6;
+ break;
+ case NORTH_NORTH_WEST:
+ val = 0x7;
+ break;
+ case NORTH:
+ val = 0x8;
+ break;
+ case NORTH_NORTH_EAST:
+ val = 0x9;
+ break;
+ case NORTH_EAST:
+ val = 0xA;
+ break;
+ case EAST_NORTH_EAST:
+ val = 0xB;
+ break;
+ case EAST:
+ val = 0xC;
+ break;
+ case EAST_SOUTH_EAST:
+ val = 0xD;
+ break;
+ case SOUTH_EAST:
+ val = 0xE;
+ break;
+ case SOUTH_SOUTH_EAST:
+ val = 0xF;
+ break;
+ default:
+ throw new IllegalArgumentException("Illegal rotation " + rotation);
+ }
+ set(ROTATION, val);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftSnowable.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftSnowable.java
new file mode 100644
index 00000000..e59c3d23
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftSnowable.java
@@ -0,0 +1,18 @@
+package org.bukkit.craftbukkit.block.data;
+
+import org.bukkit.block.data.Snowable;
+
+public abstract class CraftSnowable extends CraftBlockData implements Snowable {
+
+ private static final net.minecraft.server.BlockStateBoolean SNOWY = getBoolean("snowy");
+
+ @Override
+ public boolean isSnowy() {
+ return get(SNOWY);
+ }
+
+ @Override
+ public void setSnowy(boolean snowy) {
+ set(SNOWY, snowy);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftWaterlogged.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftWaterlogged.java
new file mode 100644
index 00000000..011c9aea
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftWaterlogged.java
@@ -0,0 +1,19 @@
+package org.bukkit.craftbukkit.block.data;
+
+import org.bukkit.block.data.Waterlogged;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftWaterlogged extends CraftBlockData implements Waterlogged {
+
+ private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean("waterlogged");
+
+ @Override
+ public boolean isWaterlogged() {
+ return get(WATERLOGGED);
+ }
+
+ @Override
+ public void setWaterlogged(boolean waterlogged) {
+ set(WATERLOGGED, waterlogged);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBed.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBed.java
new file mode 100644
index 00000000..f86ed259
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBed.java
@@ -0,0 +1,25 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.Bed;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftBed extends CraftBlockData implements Bed {
+
+ private static final net.minecraft.server.BlockStateEnum<?> PART = getEnum("part");
+ private static final net.minecraft.server.BlockStateBoolean OCCUPIED = getBoolean("occupied");
+
+ @Override
+ public Part getPart() {
+ return get(PART, Part.class);
+ }
+
+ @Override
+ public void setPart(Part part) {
+ set(PART, part);
+ }
+
+ @Override
+ public boolean isOccupied() {
+ return get(OCCUPIED);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBrewingStand.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBrewingStand.java
new file mode 100644
index 00000000..9349e02f
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBrewingStand.java
@@ -0,0 +1,39 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.BrewingStand;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftBrewingStand extends CraftBlockData implements BrewingStand {
+
+ private static final net.minecraft.server.BlockStateBoolean[] HAS_BOTTLE = new net.minecraft.server.BlockStateBoolean[]{
+ getBoolean("has_bottle_0"), getBoolean("has_bottle_1"), getBoolean("has_bottle_2")
+ };
+
+ @Override
+ public boolean hasBottle(int bottle) {
+ return get(HAS_BOTTLE[bottle]);
+ }
+
+ @Override
+ public void setBottle(int bottle, boolean has) {
+ set(HAS_BOTTLE[bottle], has);
+ }
+
+ @Override
+ public java.util.Set<Integer> getBottles() {
+ com.google.common.collect.ImmutableSet.Builder<Integer> bottles = com.google.common.collect.ImmutableSet.builder();
+
+ for (int index = 0; index < getMaximumBottles(); index++) {
+ if (hasBottle(index)) {
+ bottles.add(index);
+ }
+ }
+
+ return bottles.build();
+ }
+
+ @Override
+ public int getMaximumBottles() {
+ return HAS_BOTTLE.length;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBubbleColumn.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBubbleColumn.java
new file mode 100644
index 00000000..eedb5102
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBubbleColumn.java
@@ -0,0 +1,19 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.BubbleColumn;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftBubbleColumn extends CraftBlockData implements BubbleColumn {
+
+ private static final net.minecraft.server.BlockStateBoolean DRAG = getBoolean("drag");
+
+ @Override
+ public boolean isDrag() {
+ return get(DRAG);
+ }
+
+ @Override
+ public void setDrag(boolean drag) {
+ set(DRAG, drag);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftCake.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftCake.java
new file mode 100644
index 00000000..aae60937
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftCake.java
@@ -0,0 +1,24 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.Cake;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftCake extends CraftBlockData implements Cake {
+
+ private static final net.minecraft.server.BlockStateInteger BITES = getInteger("bites");
+
+ @Override
+ public int getBites() {
+ return get(BITES);
+ }
+
+ @Override
+ public void setBites(int bites) {
+ set(BITES, bites);
+ }
+
+ @Override
+ public int getMaximumBites() {
+ return getMax(BITES);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftChest.java
new file mode 100644
index 00000000..70473ef4
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftChest.java
@@ -0,0 +1,19 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.Chest;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftChest extends CraftBlockData implements Chest {
+
+ private static final net.minecraft.server.BlockStateEnum<?> TYPE = getEnum("type");
+
+ @Override
+ public Type getType() {
+ return get(TYPE, Type.class);
+ }
+
+ @Override
+ public void setType(Type type) {
+ set(TYPE, type);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftCommandBlock.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftCommandBlock.java
new file mode 100644
index 00000000..ddb9ac5e
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftCommandBlock.java
@@ -0,0 +1,19 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.CommandBlock;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftCommandBlock extends CraftBlockData implements CommandBlock {
+
+ private static final net.minecraft.server.BlockStateBoolean CONDITIONAL = getBoolean("conditional");
+
+ @Override
+ public boolean isConditional() {
+ return get(CONDITIONAL);
+ }
+
+ @Override
+ public void setConditional(boolean conditional) {
+ set(CONDITIONAL, conditional);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftComparator.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftComparator.java
new file mode 100644
index 00000000..4f3130a5
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftComparator.java
@@ -0,0 +1,19 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.Comparator;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftComparator extends CraftBlockData implements Comparator {
+
+ private static final net.minecraft.server.BlockStateEnum<?> MODE = getEnum("mode");
+
+ @Override
+ public Mode getMode() {
+ return get(MODE, Mode.class);
+ }
+
+ @Override
+ public void setMode(Mode mode) {
+ set(MODE, mode);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftDaylightDetector.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftDaylightDetector.java
new file mode 100644
index 00000000..842fe51f
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftDaylightDetector.java
@@ -0,0 +1,19 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.DaylightDetector;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftDaylightDetector extends CraftBlockData implements DaylightDetector {
+
+ private static final net.minecraft.server.BlockStateBoolean INVERTED = getBoolean("inverted");
+
+ @Override
+ public boolean isInverted() {
+ return get(INVERTED);
+ }
+
+ @Override
+ public void setInverted(boolean inverted) {
+ set(INVERTED, inverted);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftDispenser.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftDispenser.java
new file mode 100644
index 00000000..5d43240e
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftDispenser.java
@@ -0,0 +1,19 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.Dispenser;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftDispenser extends CraftBlockData implements Dispenser {
+
+ private static final net.minecraft.server.BlockStateBoolean TRIGGERED = getBoolean("triggered");
+
+ @Override
+ public boolean isTriggered() {
+ return get(TRIGGERED);
+ }
+
+ @Override
+ public void setTriggered(boolean triggered) {
+ set(TRIGGERED, triggered);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftDoor.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftDoor.java
new file mode 100644
index 00000000..3fc75dd2
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftDoor.java
@@ -0,0 +1,19 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.Door;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftDoor extends CraftBlockData implements Door {
+
+ private static final net.minecraft.server.BlockStateEnum<?> HINGE = getEnum("hinge");
+
+ @Override
+ public Hinge getHinge() {
+ return get(HINGE, Hinge.class);
+ }
+
+ @Override
+ public void setHinge(Hinge hinge) {
+ set(HINGE, hinge);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftEndPortalFrame.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftEndPortalFrame.java
new file mode 100644
index 00000000..84cd1d03
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftEndPortalFrame.java
@@ -0,0 +1,19 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.EndPortalFrame;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftEndPortalFrame extends CraftBlockData implements EndPortalFrame {
+
+ private static final net.minecraft.server.BlockStateBoolean EYE = getBoolean("eye");
+
+ @Override
+ public boolean hasEye() {
+ return get(EYE);
+ }
+
+ @Override
+ public void setEye(boolean eye) {
+ set(EYE, eye);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftFarmland.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftFarmland.java
new file mode 100644
index 00000000..515ee588
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftFarmland.java
@@ -0,0 +1,24 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.Farmland;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftFarmland extends CraftBlockData implements Farmland {
+
+ private static final net.minecraft.server.BlockStateInteger MOISTURE = getInteger("moisture");
+
+ @Override
+ public int getMoisture() {
+ return get(MOISTURE);
+ }
+
+ @Override
+ public void setMoisture(int moisture) {
+ set(MOISTURE, moisture);
+ }
+
+ @Override
+ public int getMaximumMoisture() {
+ return getMax(MOISTURE);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftGate.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftGate.java
new file mode 100644
index 00000000..1f6ad5d9
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftGate.java
@@ -0,0 +1,19 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.Gate;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftGate extends CraftBlockData implements Gate {
+
+ private static final net.minecraft.server.BlockStateBoolean IN_WALL = getBoolean("in_wall");
+
+ @Override
+ public boolean isInWall() {
+ return get(IN_WALL);
+ }
+
+ @Override
+ public void setInWall(boolean inWall) {
+ set(IN_WALL, inWall);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftHopper.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftHopper.java
new file mode 100644
index 00000000..055629fd
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftHopper.java
@@ -0,0 +1,19 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.Hopper;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftHopper extends CraftBlockData implements Hopper {
+
+ private static final net.minecraft.server.BlockStateBoolean ENABLED = getBoolean("enabled");
+
+ @Override
+ public boolean isEnabled() {
+ return get(ENABLED);
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ set(ENABLED, enabled);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftJukebox.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftJukebox.java
new file mode 100644
index 00000000..32eab86d
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftJukebox.java
@@ -0,0 +1,14 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+import org.bukkit.block.data.type.Jukebox;
+
+public abstract class CraftJukebox extends CraftBlockData implements Jukebox {
+
+ private static final net.minecraft.server.BlockStateBoolean HAS_RECORD = getBoolean("has_record");
+
+ @Override
+ public boolean hasRecord() {
+ return get(HAS_RECORD);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftLeaves.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftLeaves.java
new file mode 100644
index 00000000..a233f555
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftLeaves.java
@@ -0,0 +1,30 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.Leaves;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public class CraftLeaves extends CraftBlockData implements Leaves {
+
+ private static final net.minecraft.server.BlockStateInteger DISTANCE = getInteger("distance");
+ private static final net.minecraft.server.BlockStateBoolean PERSISTENT = getBoolean("persistent");
+
+ @Override
+ public boolean isPersistent() {
+ return get(PERSISTENT);
+ }
+
+ @Override
+ public void setPersistent(boolean persistent) {
+ set(PERSISTENT, persistent);
+ }
+
+ @Override
+ public int getDistance() {
+ return get(DISTANCE);
+ }
+
+ @Override
+ public void setDistance(int distance) {
+ set(DISTANCE, distance);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftNoteBlock.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftNoteBlock.java
new file mode 100644
index 00000000..51814a49
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftNoteBlock.java
@@ -0,0 +1,30 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.NoteBlock;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftNoteBlock extends CraftBlockData implements NoteBlock {
+
+ private static final net.minecraft.server.BlockStateEnum<?> INSTRUMENT = getEnum("instrument");
+ private static final net.minecraft.server.BlockStateInteger NOTE = getInteger("note");
+
+ @Override
+ public org.bukkit.Instrument getInstrument() {
+ return get(INSTRUMENT, org.bukkit.Instrument.class);
+ }
+
+ @Override
+ public void setInstrument(org.bukkit.Instrument instrument) {
+ set(INSTRUMENT, instrument);
+ }
+
+ @Override
+ public org.bukkit.Note getNote() {
+ return new org.bukkit.Note(get(NOTE));
+ }
+
+ @Override
+ public void setNote(org.bukkit.Note note) {
+ set(NOTE, (int) note.getId());
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftPiston.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftPiston.java
new file mode 100644
index 00000000..8cebb751
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftPiston.java
@@ -0,0 +1,19 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.Piston;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftPiston extends CraftBlockData implements Piston {
+
+ private static final net.minecraft.server.BlockStateBoolean EXTENDED = getBoolean("extended");
+
+ @Override
+ public boolean isExtended() {
+ return get(EXTENDED);
+ }
+
+ @Override
+ public void setExtended(boolean extended) {
+ set(EXTENDED, extended);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftPistonHead.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftPistonHead.java
new file mode 100644
index 00000000..3fb24d4b
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftPistonHead.java
@@ -0,0 +1,19 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.PistonHead;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftPistonHead extends CraftBlockData implements PistonHead {
+
+ private static final net.minecraft.server.BlockStateBoolean SHORT = getBoolean("short");
+
+ @Override
+ public boolean isShort() {
+ return get(SHORT);
+ }
+
+ @Override
+ public void setShort(boolean _short) {
+ set(SHORT, _short);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftRedstoneWire.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftRedstoneWire.java
new file mode 100644
index 00000000..34923dad
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftRedstoneWire.java
@@ -0,0 +1,49 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.RedstoneWire;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftRedstoneWire extends CraftBlockData implements RedstoneWire {
+
+ private static final net.minecraft.server.BlockStateEnum<?> NORTH = getEnum("north");
+ private static final net.minecraft.server.BlockStateEnum<?> EAST = getEnum("east");
+ private static final net.minecraft.server.BlockStateEnum<?> SOUTH = getEnum("south");
+ private static final net.minecraft.server.BlockStateEnum<?> WEST = getEnum("west");
+
+ @Override
+ public Connection getFace(org.bukkit.block.BlockFace face) {
+ switch (face) {
+ case NORTH:
+ return get(NORTH, Connection.class);
+ case EAST:
+ return get(EAST, Connection.class);
+ case SOUTH:
+ return get(SOUTH, Connection.class);
+ case WEST:
+ return get(WEST, Connection.class);
+ default:
+ throw new IllegalArgumentException("Cannot have face " + face);
+ }
+ }
+
+ @Override
+ public void setFace(org.bukkit.block.BlockFace face, Connection connection) {
+ switch (face) {
+ case NORTH:
+ set(NORTH, connection);
+ case EAST:
+ set(EAST, connection);
+ case SOUTH:
+ set(SOUTH, connection);
+ case WEST:
+ set(WEST, connection);
+ default:
+ throw new IllegalArgumentException("Cannot have face " + face);
+ }
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getAllowedFaces() {
+ return com.google.common.collect.ImmutableSet.of(org.bukkit.block.BlockFace.NORTH, org.bukkit.block.BlockFace.EAST, org.bukkit.block.BlockFace.SOUTH, org.bukkit.block.BlockFace.WEST);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftRepeater.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftRepeater.java
new file mode 100644
index 00000000..482a4ed7
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftRepeater.java
@@ -0,0 +1,40 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.Repeater;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftRepeater extends CraftBlockData implements Repeater {
+
+ private static final net.minecraft.server.BlockStateInteger DELAY = getInteger("delay");
+ private static final net.minecraft.server.BlockStateBoolean LOCKED = getBoolean("locked");
+
+ @Override
+ public int getDelay() {
+ return get(DELAY);
+ }
+
+ @Override
+ public void setDelay(int delay) {
+ set(DELAY, delay);
+ }
+
+ @Override
+ public int getMinimumDelay() {
+ return getMin(DELAY);
+ }
+
+ @Override
+ public int getMaximumDelay() {
+ return getMax(DELAY);
+ }
+
+ @Override
+ public boolean isLocked() {
+ return get(LOCKED);
+ }
+
+ @Override
+ public void setLocked(boolean locked) {
+ set(LOCKED, locked);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftSapling.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftSapling.java
new file mode 100644
index 00000000..dd96acff
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftSapling.java
@@ -0,0 +1,24 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.Sapling;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftSapling extends CraftBlockData implements Sapling {
+
+ private static final net.minecraft.server.BlockStateInteger STAGE = getInteger("stage");
+
+ @Override
+ public int getStage() {
+ return get(STAGE);
+ }
+
+ @Override
+ public void setStage(int stage) {
+ set(STAGE, stage);
+ }
+
+ @Override
+ public int getMaximumStage() {
+ return getMax(STAGE);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftSeaPickle.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftSeaPickle.java
new file mode 100644
index 00000000..dc138d9c
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftSeaPickle.java
@@ -0,0 +1,29 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.SeaPickle;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftSeaPickle extends CraftBlockData implements SeaPickle {
+
+ private static final net.minecraft.server.BlockStateInteger PICKLES = getInteger("pickles");
+
+ @Override
+ public int getPickles() {
+ return get(PICKLES);
+ }
+
+ @Override
+ public void setPickles(int pickles) {
+ set(PICKLES, pickles);
+ }
+
+ @Override
+ public int getMinimumPickles() {
+ return getMin(PICKLES);
+ }
+
+ @Override
+ public int getMaximumPickles() {
+ return getMax(PICKLES);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftSlab.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftSlab.java
new file mode 100644
index 00000000..1fde489e
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftSlab.java
@@ -0,0 +1,19 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.Slab;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftSlab extends CraftBlockData implements Slab {
+
+ private static final net.minecraft.server.BlockStateEnum<?> TYPE = getEnum("type");
+
+ @Override
+ public Type getType() {
+ return get(TYPE, Type.class);
+ }
+
+ @Override
+ public void setType(Type type) {
+ set(TYPE, type);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftSnow.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftSnow.java
new file mode 100644
index 00000000..879a5d67
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftSnow.java
@@ -0,0 +1,29 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.Snow;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public class CraftSnow extends CraftBlockData implements Snow {
+
+ private static final net.minecraft.server.BlockStateInteger LAYERS = getInteger("layers");
+
+ @Override
+ public int getLayers() {
+ return get(LAYERS);
+ }
+
+ @Override
+ public void setLayers(int layers) {
+ set(LAYERS, layers);
+ }
+
+ @Override
+ public int getMinimumLayers() {
+ return getMin(LAYERS);
+ }
+
+ @Override
+ public int getMaximumLayers() {
+ return getMax(LAYERS);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftStairs.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftStairs.java
new file mode 100644
index 00000000..c6ccd382
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftStairs.java
@@ -0,0 +1,19 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.Stairs;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftStairs extends CraftBlockData implements Stairs {
+
+ private static final net.minecraft.server.BlockStateEnum<?> SHAPE = getEnum("shape");
+
+ @Override
+ public Shape getShape() {
+ return get(SHAPE, Shape.class);
+ }
+
+ @Override
+ public void setShape(Shape shape) {
+ set(SHAPE, shape);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftStructureBlock.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftStructureBlock.java
new file mode 100644
index 00000000..8b8a82bd
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftStructureBlock.java
@@ -0,0 +1,19 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.StructureBlock;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftStructureBlock extends CraftBlockData implements StructureBlock {
+
+ private static final net.minecraft.server.BlockStateEnum<?> MODE = getEnum("mode");
+
+ @Override
+ public Mode getMode() {
+ return get(MODE, Mode.class);
+ }
+
+ @Override
+ public void setMode(Mode mode) {
+ set(MODE, mode);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftSwitch.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftSwitch.java
new file mode 100644
index 00000000..2761b371
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftSwitch.java
@@ -0,0 +1,19 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.Switch;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftSwitch extends CraftBlockData implements Switch {
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACE = getEnum("face");
+
+ @Override
+ public Face getFace() {
+ return get(FACE, Face.class);
+ }
+
+ @Override
+ public void setFace(Face face) {
+ set(FACE, face);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftTechnicalPiston.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftTechnicalPiston.java
new file mode 100644
index 00000000..e42fe0d6
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftTechnicalPiston.java
@@ -0,0 +1,19 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.TechnicalPiston;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftTechnicalPiston extends CraftBlockData implements TechnicalPiston {
+
+ private static final net.minecraft.server.BlockStateEnum<?> TYPE = getEnum("type");
+
+ @Override
+ public Type getType() {
+ return get(TYPE, Type.class);
+ }
+
+ @Override
+ public void setType(Type type) {
+ set(TYPE, type);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftTripwire.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftTripwire.java
new file mode 100644
index 00000000..55bacd2e
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftTripwire.java
@@ -0,0 +1,19 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.Tripwire;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftTripwire extends CraftBlockData implements Tripwire {
+
+ private static final net.minecraft.server.BlockStateBoolean DISARMED = getBoolean("disarmed");
+
+ @Override
+ public boolean isDisarmed() {
+ return get(DISARMED);
+ }
+
+ @Override
+ public void setDisarmed(boolean disarmed) {
+ set(DISARMED, disarmed);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftTurtleEgg.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftTurtleEgg.java
new file mode 100644
index 00000000..dca37886
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftTurtleEgg.java
@@ -0,0 +1,45 @@
+package org.bukkit.craftbukkit.block.data.type;
+
+import org.bukkit.block.data.type.TurtleEgg;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+
+public abstract class CraftTurtleEgg extends CraftBlockData implements TurtleEgg {
+
+ private static final net.minecraft.server.BlockStateInteger EGGS = getInteger("eggs");
+ private static final net.minecraft.server.BlockStateInteger HATCH = getInteger("hatch");
+
+ @Override
+ public int getEggs() {
+ return get(EGGS);
+ }
+
+ @Override
+ public void setEggs(int eggs) {
+ set(EGGS, eggs);
+ }
+
+ @Override
+ public int getMinimumEggs() {
+ return getMin(EGGS);
+ }
+
+ @Override
+ public int getMaximumEggs() {
+ return getMax(EGGS);
+ }
+
+ @Override
+ public int getHatch() {
+ return get(HATCH);
+ }
+
+ @Override
+ public void setHatch(int hatch) {
+ set(HATCH, hatch);
+ }
+
+ @Override
+ public int getMaximumHatch() {
+ return getMax(HATCH);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftAnvil.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftAnvil.java
new file mode 100644
index 00000000..3010e8fe
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftAnvil.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftAnvil extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Directional {
+
+ public CraftAnvil() {
+ super();
+ }
+
+ public CraftAnvil(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockAnvil.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBanner.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBanner.java
new file mode 100644
index 00000000..d95c548b
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBanner.java
@@ -0,0 +1,118 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftBanner extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Rotatable {
+
+ public CraftBanner() {
+ super();
+ }
+
+ public CraftBanner(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftRotatable
+
+ private static final net.minecraft.server.BlockStateInteger ROTATION = getInteger(net.minecraft.server.BlockBanner.class, "rotation");
+
+ @Override
+ public org.bukkit.block.BlockFace getRotation() {
+ int data = get(ROTATION);
+ switch (data) {
+ case 0x0:
+ return org.bukkit.block.BlockFace.SOUTH;
+ case 0x1:
+ return org.bukkit.block.BlockFace.SOUTH_SOUTH_WEST;
+ case 0x2:
+ return org.bukkit.block.BlockFace.SOUTH_WEST;
+ case 0x3:
+ return org.bukkit.block.BlockFace.WEST_SOUTH_WEST;
+ case 0x4:
+ return org.bukkit.block.BlockFace.WEST;
+ case 0x5:
+ return org.bukkit.block.BlockFace.WEST_NORTH_WEST;
+ case 0x6:
+ return org.bukkit.block.BlockFace.NORTH_WEST;
+ case 0x7:
+ return org.bukkit.block.BlockFace.NORTH_NORTH_WEST;
+ case 0x8:
+ return org.bukkit.block.BlockFace.NORTH;
+ case 0x9:
+ return org.bukkit.block.BlockFace.NORTH_NORTH_EAST;
+ case 0xA:
+ return org.bukkit.block.BlockFace.NORTH_EAST;
+ case 0xB:
+ return org.bukkit.block.BlockFace.EAST_NORTH_EAST;
+ case 0xC:
+ return org.bukkit.block.BlockFace.EAST;
+ case 0xD:
+ return org.bukkit.block.BlockFace.EAST_SOUTH_EAST;
+ case 0xE:
+ return org.bukkit.block.BlockFace.SOUTH_EAST;
+ case 0xF:
+ return org.bukkit.block.BlockFace.SOUTH_SOUTH_EAST;
+ default:
+ throw new IllegalArgumentException("Unknown rotation " + data);
+ }
+ }
+
+ @Override
+ public void setRotation(org.bukkit.block.BlockFace rotation) {
+ int val;
+ switch (rotation) {
+ case SOUTH:
+ val = 0x0;
+ break;
+ case SOUTH_SOUTH_WEST:
+ val = 0x1;
+ break;
+ case SOUTH_WEST:
+ val = 0x2;
+ break;
+ case WEST_SOUTH_WEST:
+ val = 0x3;
+ break;
+ case WEST:
+ val = 0x4;
+ break;
+ case WEST_NORTH_WEST:
+ val = 0x5;
+ break;
+ case NORTH_WEST:
+ val = 0x6;
+ break;
+ case NORTH_NORTH_WEST:
+ val = 0x7;
+ break;
+ case NORTH:
+ val = 0x8;
+ break;
+ case NORTH_NORTH_EAST:
+ val = 0x9;
+ break;
+ case NORTH_EAST:
+ val = 0xA;
+ break;
+ case EAST_NORTH_EAST:
+ val = 0xB;
+ break;
+ case EAST:
+ val = 0xC;
+ break;
+ case EAST_SOUTH_EAST:
+ val = 0xD;
+ break;
+ case SOUTH_EAST:
+ val = 0xE;
+ break;
+ case SOUTH_SOUTH_EAST:
+ val = 0xF;
+ break;
+ default:
+ throw new IllegalArgumentException("Illegal rotation " + rotation);
+ }
+ set(ROTATION, val);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBannerWall.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBannerWall.java
new file mode 100644
index 00000000..48215035
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBannerWall.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftBannerWall extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Directional {
+
+ public CraftBannerWall() {
+ super();
+ }
+
+ public CraftBannerWall(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockBannerWall.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBed.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBed.java
new file mode 100644
index 00000000..c625c964
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBed.java
@@ -0,0 +1,54 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftBed extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Bed, org.bukkit.block.data.Directional {
+
+ public CraftBed() {
+ super();
+ }
+
+ public CraftBed(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftBed
+
+ private static final net.minecraft.server.BlockStateEnum<?> PART = getEnum(net.minecraft.server.BlockBed.class, "part");
+ private static final net.minecraft.server.BlockStateBoolean OCCUPIED = getBoolean(net.minecraft.server.BlockBed.class, "occupied");
+
+ @Override
+ public Part getPart() {
+ return get(PART, Part.class);
+ }
+
+ @Override
+ public void setPart(Part part) {
+ set(PART, part);
+ }
+
+ @Override
+ public boolean isOccupied() {
+ return get(OCCUPIED);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockBed.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBeetroot.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBeetroot.java
new file mode 100644
index 00000000..4e9a27f4
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBeetroot.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftBeetroot extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Ageable {
+
+ public CraftBeetroot() {
+ super();
+ }
+
+ public CraftBeetroot(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftAgeable
+
+ private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockBeetroot.class, "age");
+
+ @Override
+ public int getAge() {
+ return get(AGE);
+ }
+
+ @Override
+ public void setAge(int age) {
+ set(AGE, age);
+ }
+
+ @Override
+ public int getMaximumAge() {
+ return getMax(AGE);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBrewingStand.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBrewingStand.java
new file mode 100644
index 00000000..fe0e7dec
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBrewingStand.java
@@ -0,0 +1,49 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftBrewingStand extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.BrewingStand {
+
+ public CraftBrewingStand() {
+ super();
+ }
+
+ public CraftBrewingStand(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftBrewingStand
+
+ private static final net.minecraft.server.BlockStateBoolean[] HAS_BOTTLE = new net.minecraft.server.BlockStateBoolean[]{
+ getBoolean(net.minecraft.server.BlockBrewingStand.class, "has_bottle_0"), getBoolean(net.minecraft.server.BlockBrewingStand.class, "has_bottle_1"), getBoolean(net.minecraft.server.BlockBrewingStand.class, "has_bottle_2")
+ };
+
+ @Override
+ public boolean hasBottle(int bottle) {
+ return get(HAS_BOTTLE[bottle]);
+ }
+
+ @Override
+ public void setBottle(int bottle, boolean has) {
+ set(HAS_BOTTLE[bottle], has);
+ }
+
+ @Override
+ public java.util.Set<Integer> getBottles() {
+ com.google.common.collect.ImmutableSet.Builder<Integer> bottles = com.google.common.collect.ImmutableSet.builder();
+
+ for (int index = 0; index < getMaximumBottles(); index++) {
+ if (hasBottle(index)) {
+ bottles.add(index);
+ }
+ }
+
+ return bottles.build();
+ }
+
+ @Override
+ public int getMaximumBottles() {
+ return HAS_BOTTLE.length;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBubbleColumn.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBubbleColumn.java
new file mode 100644
index 00000000..574a5b9a
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBubbleColumn.java
@@ -0,0 +1,29 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftBubbleColumn extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.BubbleColumn {
+
+ public CraftBubbleColumn() {
+ super();
+ }
+
+ public CraftBubbleColumn(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftBubbleColumn
+
+ private static final net.minecraft.server.BlockStateBoolean DRAG = getBoolean(net.minecraft.server.BlockBubbleColumn.class, "drag");
+
+ @Override
+ public boolean isDrag() {
+ return get(DRAG);
+ }
+
+ @Override
+ public void setDrag(boolean drag) {
+ set(DRAG, drag);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCactus.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCactus.java
new file mode 100644
index 00000000..e62f4dd1
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCactus.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftCactus extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Ageable {
+
+ public CraftCactus() {
+ super();
+ }
+
+ public CraftCactus(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftAgeable
+
+ private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockCactus.class, "age");
+
+ @Override
+ public int getAge() {
+ return get(AGE);
+ }
+
+ @Override
+ public void setAge(int age) {
+ set(AGE, age);
+ }
+
+ @Override
+ public int getMaximumAge() {
+ return getMax(AGE);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCake.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCake.java
new file mode 100644
index 00000000..fee523ab
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCake.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftCake extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Cake {
+
+ public CraftCake() {
+ super();
+ }
+
+ public CraftCake(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftCake
+
+ private static final net.minecraft.server.BlockStateInteger BITES = getInteger(net.minecraft.server.BlockCake.class, "bites");
+
+ @Override
+ public int getBites() {
+ return get(BITES);
+ }
+
+ @Override
+ public void setBites(int bites) {
+ set(BITES, bites);
+ }
+
+ @Override
+ public int getMaximumBites() {
+ return getMax(BITES);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCarrots.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCarrots.java
new file mode 100644
index 00000000..9ab29636
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCarrots.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftCarrots extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Ageable {
+
+ public CraftCarrots() {
+ super();
+ }
+
+ public CraftCarrots(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftAgeable
+
+ private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockCarrots.class, "age");
+
+ @Override
+ public int getAge() {
+ return get(AGE);
+ }
+
+ @Override
+ public void setAge(int age) {
+ set(AGE, age);
+ }
+
+ @Override
+ public int getMaximumAge() {
+ return getMax(AGE);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCauldron.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCauldron.java
new file mode 100644
index 00000000..5ddeb715
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCauldron.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftCauldron extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Levelled {
+
+ public CraftCauldron() {
+ super();
+ }
+
+ public CraftCauldron(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftLevelled
+
+ private static final net.minecraft.server.BlockStateInteger LEVEL = getInteger(net.minecraft.server.BlockCauldron.class, "level");
+
+ @Override
+ public int getLevel() {
+ return get(LEVEL);
+ }
+
+ @Override
+ public void setLevel(int level) {
+ set(LEVEL, level);
+ }
+
+ @Override
+ public int getMaximumLevel() {
+ return getMax(LEVEL);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftChest.java
new file mode 100644
index 00000000..44f3a532
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftChest.java
@@ -0,0 +1,62 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftChest extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Chest, org.bukkit.block.data.Directional, org.bukkit.block.data.Waterlogged {
+
+ public CraftChest() {
+ super();
+ }
+
+ public CraftChest(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftChest
+
+ private static final net.minecraft.server.BlockStateEnum<?> TYPE = getEnum(net.minecraft.server.BlockChest.class, "type");
+
+ @Override
+ public Type getType() {
+ return get(TYPE, Type.class);
+ }
+
+ @Override
+ public void setType(Type type) {
+ set(TYPE, type);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockChest.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftWaterlogged
+
+ private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockChest.class, "waterlogged");
+
+ @Override
+ public boolean isWaterlogged() {
+ return get(WATERLOGGED);
+ }
+
+ @Override
+ public void setWaterlogged(boolean waterlogged) {
+ set(WATERLOGGED, waterlogged);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftChestTrapped.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftChestTrapped.java
new file mode 100644
index 00000000..cc8f88ba
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftChestTrapped.java
@@ -0,0 +1,62 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftChestTrapped extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Chest, org.bukkit.block.data.Directional, org.bukkit.block.data.Waterlogged {
+
+ public CraftChestTrapped() {
+ super();
+ }
+
+ public CraftChestTrapped(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftChest
+
+ private static final net.minecraft.server.BlockStateEnum<?> TYPE = getEnum(net.minecraft.server.BlockChestTrapped.class, "type");
+
+ @Override
+ public Type getType() {
+ return get(TYPE, Type.class);
+ }
+
+ @Override
+ public void setType(Type type) {
+ set(TYPE, type);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockChestTrapped.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftWaterlogged
+
+ private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockChestTrapped.class, "waterlogged");
+
+ @Override
+ public boolean isWaterlogged() {
+ return get(WATERLOGGED);
+ }
+
+ @Override
+ public void setWaterlogged(boolean waterlogged) {
+ set(WATERLOGGED, waterlogged);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftChorusFlower.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftChorusFlower.java
new file mode 100644
index 00000000..af1e85bc
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftChorusFlower.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftChorusFlower extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Ageable {
+
+ public CraftChorusFlower() {
+ super();
+ }
+
+ public CraftChorusFlower(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftAgeable
+
+ private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockChorusFlower.class, "age");
+
+ @Override
+ public int getAge() {
+ return get(AGE);
+ }
+
+ @Override
+ public void setAge(int age) {
+ set(AGE, age);
+ }
+
+ @Override
+ public int getMaximumAge() {
+ return getMax(AGE);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftChorusFruit.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftChorusFruit.java
new file mode 100644
index 00000000..27ae41a9
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftChorusFruit.java
@@ -0,0 +1,57 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftChorusFruit extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.MultipleFacing {
+
+ public CraftChorusFruit() {
+ super();
+ }
+
+ public CraftChorusFruit(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftMultipleFacing
+
+ private static final net.minecraft.server.BlockStateBoolean[] FACES = new net.minecraft.server.BlockStateBoolean[]{
+ getBoolean(net.minecraft.server.BlockChorusFruit.class, "north", true), getBoolean(net.minecraft.server.BlockChorusFruit.class, "east", true), getBoolean(net.minecraft.server.BlockChorusFruit.class, "south", true), getBoolean(net.minecraft.server.BlockChorusFruit.class, "west", true), getBoolean(net.minecraft.server.BlockChorusFruit.class, "up", true), getBoolean(net.minecraft.server.BlockChorusFruit.class, "down", true)
+ };
+
+ @Override
+ public boolean hasFace(org.bukkit.block.BlockFace face) {
+ return get(FACES[face.ordinal()]);
+ }
+
+ @Override
+ public void setFace(org.bukkit.block.BlockFace face, boolean has) {
+ set(FACES[face.ordinal()], has);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null && get(FACES[i])) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getAllowedFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCobbleWall.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCobbleWall.java
new file mode 100644
index 00000000..b1acc7c4
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCobbleWall.java
@@ -0,0 +1,71 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftCobbleWall extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Fence, org.bukkit.block.data.MultipleFacing, org.bukkit.block.data.Waterlogged {
+
+ public CraftCobbleWall() {
+ super();
+ }
+
+ public CraftCobbleWall(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftMultipleFacing
+
+ private static final net.minecraft.server.BlockStateBoolean[] FACES = new net.minecraft.server.BlockStateBoolean[]{
+ getBoolean(net.minecraft.server.BlockCobbleWall.class, "north", true), getBoolean(net.minecraft.server.BlockCobbleWall.class, "east", true), getBoolean(net.minecraft.server.BlockCobbleWall.class, "south", true), getBoolean(net.minecraft.server.BlockCobbleWall.class, "west", true), getBoolean(net.minecraft.server.BlockCobbleWall.class, "up", true), getBoolean(net.minecraft.server.BlockCobbleWall.class, "down", true)
+ };
+
+ @Override
+ public boolean hasFace(org.bukkit.block.BlockFace face) {
+ return get(FACES[face.ordinal()]);
+ }
+
+ @Override
+ public void setFace(org.bukkit.block.BlockFace face, boolean has) {
+ set(FACES[face.ordinal()], has);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null && get(FACES[i])) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getAllowedFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftWaterlogged
+
+ private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockCobbleWall.class, "waterlogged");
+
+ @Override
+ public boolean isWaterlogged() {
+ return get(WATERLOGGED);
+ }
+
+ @Override
+ public void setWaterlogged(boolean waterlogged) {
+ set(WATERLOGGED, waterlogged);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCocoa.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCocoa.java
new file mode 100644
index 00000000..79b2b52c
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCocoa.java
@@ -0,0 +1,53 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftCocoa extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Cocoa, org.bukkit.block.data.Ageable, org.bukkit.block.data.Directional {
+
+ public CraftCocoa() {
+ super();
+ }
+
+ public CraftCocoa(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftAgeable
+
+ private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockCocoa.class, "age");
+
+ @Override
+ public int getAge() {
+ return get(AGE);
+ }
+
+ @Override
+ public void setAge(int age) {
+ set(AGE, age);
+ }
+
+ @Override
+ public int getMaximumAge() {
+ return getMax(AGE);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockCocoa.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCommand.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCommand.java
new file mode 100644
index 00000000..ed1684a6
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCommand.java
@@ -0,0 +1,48 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftCommand extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.CommandBlock, org.bukkit.block.data.Directional {
+
+ public CraftCommand() {
+ super();
+ }
+
+ public CraftCommand(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftCommandBlock
+
+ private static final net.minecraft.server.BlockStateBoolean CONDITIONAL = getBoolean(net.minecraft.server.BlockCommand.class, "conditional");
+
+ @Override
+ public boolean isConditional() {
+ return get(CONDITIONAL);
+ }
+
+ @Override
+ public void setConditional(boolean conditional) {
+ set(CONDITIONAL, conditional);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockCommand.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCoralFan.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCoralFan.java
new file mode 100644
index 00000000..3385af14
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCoralFan.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftCoralFan extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Directional {
+
+ public CraftCoralFan() {
+ super();
+ }
+
+ public CraftCoralFan(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockCoralFan.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCrops.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCrops.java
new file mode 100644
index 00000000..61921a2a
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCrops.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftCrops extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Ageable {
+
+ public CraftCrops() {
+ super();
+ }
+
+ public CraftCrops(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftAgeable
+
+ private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockCrops.class, "age");
+
+ @Override
+ public int getAge() {
+ return get(AGE);
+ }
+
+ @Override
+ public void setAge(int age) {
+ set(AGE, age);
+ }
+
+ @Override
+ public int getMaximumAge() {
+ return getMax(AGE);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftDaylightDetector.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftDaylightDetector.java
new file mode 100644
index 00000000..ffed5c9a
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftDaylightDetector.java
@@ -0,0 +1,48 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftDaylightDetector extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.DaylightDetector, org.bukkit.block.data.AnaloguePowerable {
+
+ public CraftDaylightDetector() {
+ super();
+ }
+
+ public CraftDaylightDetector(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftDaylightDetector
+
+ private static final net.minecraft.server.BlockStateBoolean INVERTED = getBoolean(net.minecraft.server.BlockDaylightDetector.class, "inverted");
+
+ @Override
+ public boolean isInverted() {
+ return get(INVERTED);
+ }
+
+ @Override
+ public void setInverted(boolean inverted) {
+ set(INVERTED, inverted);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftAnaloguePowerable
+
+ private static final net.minecraft.server.BlockStateInteger POWER = getInteger(net.minecraft.server.BlockDaylightDetector.class, "power");
+
+ @Override
+ public int getPower() {
+ return get(POWER);
+ }
+
+ @Override
+ public void setPower(int power) {
+ set(POWER, power);
+ }
+
+ @Override
+ public int getMaximumPower() {
+ return getMax(POWER);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftDirtSnow.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftDirtSnow.java
new file mode 100644
index 00000000..7c3857e9
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftDirtSnow.java
@@ -0,0 +1,29 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftDirtSnow extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Snowable {
+
+ public CraftDirtSnow() {
+ super();
+ }
+
+ public CraftDirtSnow(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftSnowable
+
+ private static final net.minecraft.server.BlockStateBoolean SNOWY = getBoolean(net.minecraft.server.BlockDirtSnow.class, "snowy");
+
+ @Override
+ public boolean isSnowy() {
+ return get(SNOWY);
+ }
+
+ @Override
+ public void setSnowy(boolean snowy) {
+ set(SNOWY, snowy);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftDispenser.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftDispenser.java
new file mode 100644
index 00000000..cea8f941
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftDispenser.java
@@ -0,0 +1,48 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftDispenser extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Dispenser, org.bukkit.block.data.Directional {
+
+ public CraftDispenser() {
+ super();
+ }
+
+ public CraftDispenser(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftDispenser
+
+ private static final net.minecraft.server.BlockStateBoolean TRIGGERED = getBoolean(net.minecraft.server.BlockDispenser.class, "triggered");
+
+ @Override
+ public boolean isTriggered() {
+ return get(TRIGGERED);
+ }
+
+ @Override
+ public void setTriggered(boolean triggered) {
+ set(TRIGGERED, triggered);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockDispenser.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftDoor.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftDoor.java
new file mode 100644
index 00000000..ec8639bf
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftDoor.java
@@ -0,0 +1,90 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftDoor extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Door, org.bukkit.block.data.Bisected, org.bukkit.block.data.Directional, org.bukkit.block.data.Openable, org.bukkit.block.data.Powerable {
+
+ public CraftDoor() {
+ super();
+ }
+
+ public CraftDoor(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftDoor
+
+ private static final net.minecraft.server.BlockStateEnum<?> HINGE = getEnum(net.minecraft.server.BlockDoor.class, "hinge");
+
+ @Override
+ public Hinge getHinge() {
+ return get(HINGE, Hinge.class);
+ }
+
+ @Override
+ public void setHinge(Hinge hinge) {
+ set(HINGE, hinge);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftBisected
+
+ private static final net.minecraft.server.BlockStateEnum<?> HALF = getEnum(net.minecraft.server.BlockDoor.class, "half");
+
+ @Override
+ public Half getHalf() {
+ return get(HALF, Half.class);
+ }
+
+ @Override
+ public void setHalf(Half half) {
+ set(HALF, half);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockDoor.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftOpenable
+
+ private static final net.minecraft.server.BlockStateBoolean OPEN = getBoolean(net.minecraft.server.BlockDoor.class, "open");
+
+ @Override
+ public boolean isOpen() {
+ return get(OPEN);
+ }
+
+ @Override
+ public void setOpen(boolean open) {
+ set(OPEN, open);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftPowerable
+
+ private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockDoor.class, "powered");
+
+ @Override
+ public boolean isPowered() {
+ return get(POWERED);
+ }
+
+ @Override
+ public void setPowered(boolean powered) {
+ set(POWERED, powered);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftDropper.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftDropper.java
new file mode 100644
index 00000000..82486f1b
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftDropper.java
@@ -0,0 +1,48 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftDropper extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Dispenser, org.bukkit.block.data.Directional {
+
+ public CraftDropper() {
+ super();
+ }
+
+ public CraftDropper(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftDispenser
+
+ private static final net.minecraft.server.BlockStateBoolean TRIGGERED = getBoolean(net.minecraft.server.BlockDropper.class, "triggered");
+
+ @Override
+ public boolean isTriggered() {
+ return get(TRIGGERED);
+ }
+
+ @Override
+ public void setTriggered(boolean triggered) {
+ set(TRIGGERED, triggered);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockDropper.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftEndRod.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftEndRod.java
new file mode 100644
index 00000000..d72c9d05
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftEndRod.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftEndRod extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Directional {
+
+ public CraftEndRod() {
+ super();
+ }
+
+ public CraftEndRod(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockEndRod.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftEnderChest.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftEnderChest.java
new file mode 100644
index 00000000..2f838080
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftEnderChest.java
@@ -0,0 +1,48 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftEnderChest extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.EnderChest, org.bukkit.block.data.Directional, org.bukkit.block.data.Waterlogged {
+
+ public CraftEnderChest() {
+ super();
+ }
+
+ public CraftEnderChest(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockEnderChest.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftWaterlogged
+
+ private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockEnderChest.class, "waterlogged");
+
+ @Override
+ public boolean isWaterlogged() {
+ return get(WATERLOGGED);
+ }
+
+ @Override
+ public void setWaterlogged(boolean waterlogged) {
+ set(WATERLOGGED, waterlogged);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftEnderPortalFrame.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftEnderPortalFrame.java
new file mode 100644
index 00000000..f57cbbec
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftEnderPortalFrame.java
@@ -0,0 +1,48 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftEnderPortalFrame extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.EndPortalFrame, org.bukkit.block.data.Directional {
+
+ public CraftEnderPortalFrame() {
+ super();
+ }
+
+ public CraftEnderPortalFrame(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftEndPortalFrame
+
+ private static final net.minecraft.server.BlockStateBoolean EYE = getBoolean(net.minecraft.server.BlockEnderPortalFrame.class, "eye");
+
+ @Override
+ public boolean hasEye() {
+ return get(EYE);
+ }
+
+ @Override
+ public void setEye(boolean eye) {
+ set(EYE, eye);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockEnderPortalFrame.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftFence.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftFence.java
new file mode 100644
index 00000000..1333b997
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftFence.java
@@ -0,0 +1,71 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftFence extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Fence, org.bukkit.block.data.MultipleFacing, org.bukkit.block.data.Waterlogged {
+
+ public CraftFence() {
+ super();
+ }
+
+ public CraftFence(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftMultipleFacing
+
+ private static final net.minecraft.server.BlockStateBoolean[] FACES = new net.minecraft.server.BlockStateBoolean[]{
+ getBoolean(net.minecraft.server.BlockFence.class, "north", true), getBoolean(net.minecraft.server.BlockFence.class, "east", true), getBoolean(net.minecraft.server.BlockFence.class, "south", true), getBoolean(net.minecraft.server.BlockFence.class, "west", true), getBoolean(net.minecraft.server.BlockFence.class, "up", true), getBoolean(net.minecraft.server.BlockFence.class, "down", true)
+ };
+
+ @Override
+ public boolean hasFace(org.bukkit.block.BlockFace face) {
+ return get(FACES[face.ordinal()]);
+ }
+
+ @Override
+ public void setFace(org.bukkit.block.BlockFace face, boolean has) {
+ set(FACES[face.ordinal()], has);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null && get(FACES[i])) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getAllowedFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftWaterlogged
+
+ private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockFence.class, "waterlogged");
+
+ @Override
+ public boolean isWaterlogged() {
+ return get(WATERLOGGED);
+ }
+
+ @Override
+ public void setWaterlogged(boolean waterlogged) {
+ set(WATERLOGGED, waterlogged);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftFenceGate.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftFenceGate.java
new file mode 100644
index 00000000..4fc29445
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftFenceGate.java
@@ -0,0 +1,76 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftFenceGate extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Gate, org.bukkit.block.data.Directional, org.bukkit.block.data.Openable, org.bukkit.block.data.Powerable {
+
+ public CraftFenceGate() {
+ super();
+ }
+
+ public CraftFenceGate(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftGate
+
+ private static final net.minecraft.server.BlockStateBoolean IN_WALL = getBoolean(net.minecraft.server.BlockFenceGate.class, "in_wall");
+
+ @Override
+ public boolean isInWall() {
+ return get(IN_WALL);
+ }
+
+ @Override
+ public void setInWall(boolean inWall) {
+ set(IN_WALL, inWall);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockFenceGate.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftOpenable
+
+ private static final net.minecraft.server.BlockStateBoolean OPEN = getBoolean(net.minecraft.server.BlockFenceGate.class, "open");
+
+ @Override
+ public boolean isOpen() {
+ return get(OPEN);
+ }
+
+ @Override
+ public void setOpen(boolean open) {
+ set(OPEN, open);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftPowerable
+
+ private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockFenceGate.class, "powered");
+
+ @Override
+ public boolean isPowered() {
+ return get(POWERED);
+ }
+
+ @Override
+ public void setPowered(boolean powered) {
+ set(POWERED, powered);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftFire.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftFire.java
new file mode 100644
index 00000000..a5809355
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftFire.java
@@ -0,0 +1,76 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftFire extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Fire, org.bukkit.block.data.Ageable, org.bukkit.block.data.MultipleFacing {
+
+ public CraftFire() {
+ super();
+ }
+
+ public CraftFire(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftAgeable
+
+ private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockFire.class, "age");
+
+ @Override
+ public int getAge() {
+ return get(AGE);
+ }
+
+ @Override
+ public void setAge(int age) {
+ set(AGE, age);
+ }
+
+ @Override
+ public int getMaximumAge() {
+ return getMax(AGE);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftMultipleFacing
+
+ private static final net.minecraft.server.BlockStateBoolean[] FACES = new net.minecraft.server.BlockStateBoolean[]{
+ getBoolean(net.minecraft.server.BlockFire.class, "north", true), getBoolean(net.minecraft.server.BlockFire.class, "east", true), getBoolean(net.minecraft.server.BlockFire.class, "south", true), getBoolean(net.minecraft.server.BlockFire.class, "west", true), getBoolean(net.minecraft.server.BlockFire.class, "up", true), getBoolean(net.minecraft.server.BlockFire.class, "down", true)
+ };
+
+ @Override
+ public boolean hasFace(org.bukkit.block.BlockFace face) {
+ return get(FACES[face.ordinal()]);
+ }
+
+ @Override
+ public void setFace(org.bukkit.block.BlockFace face, boolean has) {
+ set(FACES[face.ordinal()], has);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null && get(FACES[i])) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getAllowedFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftFloorSign.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftFloorSign.java
new file mode 100644
index 00000000..aa52ec77
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftFloorSign.java
@@ -0,0 +1,132 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftFloorSign extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Sign, org.bukkit.block.data.Rotatable, org.bukkit.block.data.Waterlogged {
+
+ public CraftFloorSign() {
+ super();
+ }
+
+ public CraftFloorSign(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftRotatable
+
+ private static final net.minecraft.server.BlockStateInteger ROTATION = getInteger(net.minecraft.server.BlockFloorSign.class, "rotation");
+
+ @Override
+ public org.bukkit.block.BlockFace getRotation() {
+ int data = get(ROTATION);
+ switch (data) {
+ case 0x0:
+ return org.bukkit.block.BlockFace.SOUTH;
+ case 0x1:
+ return org.bukkit.block.BlockFace.SOUTH_SOUTH_WEST;
+ case 0x2:
+ return org.bukkit.block.BlockFace.SOUTH_WEST;
+ case 0x3:
+ return org.bukkit.block.BlockFace.WEST_SOUTH_WEST;
+ case 0x4:
+ return org.bukkit.block.BlockFace.WEST;
+ case 0x5:
+ return org.bukkit.block.BlockFace.WEST_NORTH_WEST;
+ case 0x6:
+ return org.bukkit.block.BlockFace.NORTH_WEST;
+ case 0x7:
+ return org.bukkit.block.BlockFace.NORTH_NORTH_WEST;
+ case 0x8:
+ return org.bukkit.block.BlockFace.NORTH;
+ case 0x9:
+ return org.bukkit.block.BlockFace.NORTH_NORTH_EAST;
+ case 0xA:
+ return org.bukkit.block.BlockFace.NORTH_EAST;
+ case 0xB:
+ return org.bukkit.block.BlockFace.EAST_NORTH_EAST;
+ case 0xC:
+ return org.bukkit.block.BlockFace.EAST;
+ case 0xD:
+ return org.bukkit.block.BlockFace.EAST_SOUTH_EAST;
+ case 0xE:
+ return org.bukkit.block.BlockFace.SOUTH_EAST;
+ case 0xF:
+ return org.bukkit.block.BlockFace.SOUTH_SOUTH_EAST;
+ default:
+ throw new IllegalArgumentException("Unknown rotation " + data);
+ }
+ }
+
+ @Override
+ public void setRotation(org.bukkit.block.BlockFace rotation) {
+ int val;
+ switch (rotation) {
+ case SOUTH:
+ val = 0x0;
+ break;
+ case SOUTH_SOUTH_WEST:
+ val = 0x1;
+ break;
+ case SOUTH_WEST:
+ val = 0x2;
+ break;
+ case WEST_SOUTH_WEST:
+ val = 0x3;
+ break;
+ case WEST:
+ val = 0x4;
+ break;
+ case WEST_NORTH_WEST:
+ val = 0x5;
+ break;
+ case NORTH_WEST:
+ val = 0x6;
+ break;
+ case NORTH_NORTH_WEST:
+ val = 0x7;
+ break;
+ case NORTH:
+ val = 0x8;
+ break;
+ case NORTH_NORTH_EAST:
+ val = 0x9;
+ break;
+ case NORTH_EAST:
+ val = 0xA;
+ break;
+ case EAST_NORTH_EAST:
+ val = 0xB;
+ break;
+ case EAST:
+ val = 0xC;
+ break;
+ case EAST_SOUTH_EAST:
+ val = 0xD;
+ break;
+ case SOUTH_EAST:
+ val = 0xE;
+ break;
+ case SOUTH_SOUTH_EAST:
+ val = 0xF;
+ break;
+ default:
+ throw new IllegalArgumentException("Illegal rotation " + rotation);
+ }
+ set(ROTATION, val);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftWaterlogged
+
+ private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockFloorSign.class, "waterlogged");
+
+ @Override
+ public boolean isWaterlogged() {
+ return get(WATERLOGGED);
+ }
+
+ @Override
+ public void setWaterlogged(boolean waterlogged) {
+ set(WATERLOGGED, waterlogged);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftFluids.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftFluids.java
new file mode 100644
index 00000000..21c30c7c
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftFluids.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftFluids extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Levelled {
+
+ public CraftFluids() {
+ super();
+ }
+
+ public CraftFluids(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftLevelled
+
+ private static final net.minecraft.server.BlockStateInteger LEVEL = getInteger(net.minecraft.server.BlockFluids.class, "level");
+
+ @Override
+ public int getLevel() {
+ return get(LEVEL);
+ }
+
+ @Override
+ public void setLevel(int level) {
+ set(LEVEL, level);
+ }
+
+ @Override
+ public int getMaximumLevel() {
+ return getMax(LEVEL);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftFurnace.java
new file mode 100644
index 00000000..1ca1a9c7
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftFurnace.java
@@ -0,0 +1,48 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftFurnace extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Furnace, org.bukkit.block.data.Directional, org.bukkit.block.data.Lightable {
+
+ public CraftFurnace() {
+ super();
+ }
+
+ public CraftFurnace(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockFurnace.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftLightable
+
+ private static final net.minecraft.server.BlockStateBoolean LIT = getBoolean(net.minecraft.server.BlockFurnace.class, "lit");
+
+ @Override
+ public boolean isLit() {
+ return get(LIT);
+ }
+
+ @Override
+ public void setLit(boolean lit) {
+ set(LIT, lit);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftGlassPane.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftGlassPane.java
new file mode 100644
index 00000000..4c8bfcb7
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftGlassPane.java
@@ -0,0 +1,71 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftGlassPane extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.GlassPane, org.bukkit.block.data.MultipleFacing, org.bukkit.block.data.Waterlogged {
+
+ public CraftGlassPane() {
+ super();
+ }
+
+ public CraftGlassPane(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftMultipleFacing
+
+ private static final net.minecraft.server.BlockStateBoolean[] FACES = new net.minecraft.server.BlockStateBoolean[]{
+ getBoolean(net.minecraft.server.BlockGlassPane.class, "north", true), getBoolean(net.minecraft.server.BlockGlassPane.class, "east", true), getBoolean(net.minecraft.server.BlockGlassPane.class, "south", true), getBoolean(net.minecraft.server.BlockGlassPane.class, "west", true), getBoolean(net.minecraft.server.BlockGlassPane.class, "up", true), getBoolean(net.minecraft.server.BlockGlassPane.class, "down", true)
+ };
+
+ @Override
+ public boolean hasFace(org.bukkit.block.BlockFace face) {
+ return get(FACES[face.ordinal()]);
+ }
+
+ @Override
+ public void setFace(org.bukkit.block.BlockFace face, boolean has) {
+ set(FACES[face.ordinal()], has);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null && get(FACES[i])) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getAllowedFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftWaterlogged
+
+ private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockGlassPane.class, "waterlogged");
+
+ @Override
+ public boolean isWaterlogged() {
+ return get(WATERLOGGED);
+ }
+
+ @Override
+ public void setWaterlogged(boolean waterlogged) {
+ set(WATERLOGGED, waterlogged);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftGlazedTerracotta.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftGlazedTerracotta.java
new file mode 100644
index 00000000..89cc7f95
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftGlazedTerracotta.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftGlazedTerracotta extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Directional {
+
+ public CraftGlazedTerracotta() {
+ super();
+ }
+
+ public CraftGlazedTerracotta(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockGlazedTerracotta.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftGrass.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftGrass.java
new file mode 100644
index 00000000..08fcfb0b
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftGrass.java
@@ -0,0 +1,29 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftGrass extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Snowable {
+
+ public CraftGrass() {
+ super();
+ }
+
+ public CraftGrass(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftSnowable
+
+ private static final net.minecraft.server.BlockStateBoolean SNOWY = getBoolean(net.minecraft.server.BlockGrass.class, "snowy");
+
+ @Override
+ public boolean isSnowy() {
+ return get(SNOWY);
+ }
+
+ @Override
+ public void setSnowy(boolean snowy) {
+ set(SNOWY, snowy);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftHay.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftHay.java
new file mode 100644
index 00000000..db7d61ad
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftHay.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftHay extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Orientable {
+
+ public CraftHay() {
+ super();
+ }
+
+ public CraftHay(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftOrientable
+
+ private static final net.minecraft.server.BlockStateEnum<?> AXIS = getEnum(net.minecraft.server.BlockHay.class, "axis");
+
+ @Override
+ public org.bukkit.Axis getAxis() {
+ return get(AXIS, org.bukkit.Axis.class);
+ }
+
+ @Override
+ public void setAxis(org.bukkit.Axis axis) {
+ set(AXIS, axis);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.Axis> getAxes() {
+ return getValues(AXIS, org.bukkit.Axis.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftHopper.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftHopper.java
new file mode 100644
index 00000000..f1311517
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftHopper.java
@@ -0,0 +1,48 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftHopper extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Hopper, org.bukkit.block.data.Directional {
+
+ public CraftHopper() {
+ super();
+ }
+
+ public CraftHopper(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftHopper
+
+ private static final net.minecraft.server.BlockStateBoolean ENABLED = getBoolean(net.minecraft.server.BlockHopper.class, "enabled");
+
+ @Override
+ public boolean isEnabled() {
+ return get(ENABLED);
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ set(ENABLED, enabled);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockHopper.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftHugeMushroom.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftHugeMushroom.java
new file mode 100644
index 00000000..fb6e2050
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftHugeMushroom.java
@@ -0,0 +1,57 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftHugeMushroom extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.MultipleFacing {
+
+ public CraftHugeMushroom() {
+ super();
+ }
+
+ public CraftHugeMushroom(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftMultipleFacing
+
+ private static final net.minecraft.server.BlockStateBoolean[] FACES = new net.minecraft.server.BlockStateBoolean[]{
+ getBoolean(net.minecraft.server.BlockHugeMushroom.class, "north", true), getBoolean(net.minecraft.server.BlockHugeMushroom.class, "east", true), getBoolean(net.minecraft.server.BlockHugeMushroom.class, "south", true), getBoolean(net.minecraft.server.BlockHugeMushroom.class, "west", true), getBoolean(net.minecraft.server.BlockHugeMushroom.class, "up", true), getBoolean(net.minecraft.server.BlockHugeMushroom.class, "down", true)
+ };
+
+ @Override
+ public boolean hasFace(org.bukkit.block.BlockFace face) {
+ return get(FACES[face.ordinal()]);
+ }
+
+ @Override
+ public void setFace(org.bukkit.block.BlockFace face, boolean has) {
+ set(FACES[face.ordinal()], has);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null && get(FACES[i])) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getAllowedFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftIceFrost.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftIceFrost.java
new file mode 100644
index 00000000..7b297dc2
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftIceFrost.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftIceFrost extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Ageable {
+
+ public CraftIceFrost() {
+ super();
+ }
+
+ public CraftIceFrost(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftAgeable
+
+ private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockIceFrost.class, "age");
+
+ @Override
+ public int getAge() {
+ return get(AGE);
+ }
+
+ @Override
+ public void setAge(int age) {
+ set(AGE, age);
+ }
+
+ @Override
+ public int getMaximumAge() {
+ return getMax(AGE);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftIronBars.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftIronBars.java
new file mode 100644
index 00000000..cf6da2df
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftIronBars.java
@@ -0,0 +1,71 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftIronBars extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Fence, org.bukkit.block.data.MultipleFacing, org.bukkit.block.data.Waterlogged {
+
+ public CraftIronBars() {
+ super();
+ }
+
+ public CraftIronBars(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftMultipleFacing
+
+ private static final net.minecraft.server.BlockStateBoolean[] FACES = new net.minecraft.server.BlockStateBoolean[]{
+ getBoolean(net.minecraft.server.BlockIronBars.class, "north", true), getBoolean(net.minecraft.server.BlockIronBars.class, "east", true), getBoolean(net.minecraft.server.BlockIronBars.class, "south", true), getBoolean(net.minecraft.server.BlockIronBars.class, "west", true), getBoolean(net.minecraft.server.BlockIronBars.class, "up", true), getBoolean(net.minecraft.server.BlockIronBars.class, "down", true)
+ };
+
+ @Override
+ public boolean hasFace(org.bukkit.block.BlockFace face) {
+ return get(FACES[face.ordinal()]);
+ }
+
+ @Override
+ public void setFace(org.bukkit.block.BlockFace face, boolean has) {
+ set(FACES[face.ordinal()], has);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null && get(FACES[i])) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getAllowedFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftWaterlogged
+
+ private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockIronBars.class, "waterlogged");
+
+ @Override
+ public boolean isWaterlogged() {
+ return get(WATERLOGGED);
+ }
+
+ @Override
+ public void setWaterlogged(boolean waterlogged) {
+ set(WATERLOGGED, waterlogged);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftJukeBox.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftJukeBox.java
new file mode 100644
index 00000000..b87801f3
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftJukeBox.java
@@ -0,0 +1,24 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftJukeBox extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Jukebox {
+
+ public CraftJukeBox() {
+ super();
+ }
+
+ public CraftJukeBox(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftJukebox
+
+ private static final net.minecraft.server.BlockStateBoolean HAS_RECORD = getBoolean(net.minecraft.server.BlockJukeBox.class, "has_record");
+
+ @Override
+ public boolean hasRecord() {
+ return get(HAS_RECORD);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftKelp.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftKelp.java
new file mode 100644
index 00000000..e9ba8ade
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftKelp.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftKelp extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Ageable {
+
+ public CraftKelp() {
+ super();
+ }
+
+ public CraftKelp(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftAgeable
+
+ private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockKelp.class, "age");
+
+ @Override
+ public int getAge() {
+ return get(AGE);
+ }
+
+ @Override
+ public void setAge(int age) {
+ set(AGE, age);
+ }
+
+ @Override
+ public int getMaximumAge() {
+ return getMax(AGE);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftLadder.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftLadder.java
new file mode 100644
index 00000000..2c7f396f
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftLadder.java
@@ -0,0 +1,48 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftLadder extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Ladder, org.bukkit.block.data.Directional, org.bukkit.block.data.Waterlogged {
+
+ public CraftLadder() {
+ super();
+ }
+
+ public CraftLadder(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockLadder.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftWaterlogged
+
+ private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockLadder.class, "waterlogged");
+
+ @Override
+ public boolean isWaterlogged() {
+ return get(WATERLOGGED);
+ }
+
+ @Override
+ public void setWaterlogged(boolean waterlogged) {
+ set(WATERLOGGED, waterlogged);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftLeaves.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftLeaves.java
new file mode 100644
index 00000000..2e2f091b
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftLeaves.java
@@ -0,0 +1,40 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftLeaves extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Leaves {
+
+ public CraftLeaves() {
+ super();
+ }
+
+ public CraftLeaves(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftLeaves
+
+ private static final net.minecraft.server.BlockStateInteger DISTANCE = getInteger(net.minecraft.server.BlockLeaves.class, "distance");
+ private static final net.minecraft.server.BlockStateBoolean PERSISTENT = getBoolean(net.minecraft.server.BlockLeaves.class, "persistent");
+
+ @Override
+ public boolean isPersistent() {
+ return get(PERSISTENT);
+ }
+
+ @Override
+ public void setPersistent(boolean persistent) {
+ set(PERSISTENT, persistent);
+ }
+
+ @Override
+ public int getDistance() {
+ return get(DISTANCE);
+ }
+
+ @Override
+ public void setDistance(int distance) {
+ set(DISTANCE, distance);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftLever.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftLever.java
new file mode 100644
index 00000000..a8b030f2
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftLever.java
@@ -0,0 +1,62 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftLever extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Switch, org.bukkit.block.data.Directional, org.bukkit.block.data.Powerable {
+
+ public CraftLever() {
+ super();
+ }
+
+ public CraftLever(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftSwitch
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACE = getEnum(net.minecraft.server.BlockLever.class, "face");
+
+ @Override
+ public Face getFace() {
+ return get(FACE, Face.class);
+ }
+
+ @Override
+ public void setFace(Face face) {
+ set(FACE, face);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockLever.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftPowerable
+
+ private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockLever.class, "powered");
+
+ @Override
+ public boolean isPowered() {
+ return get(POWERED);
+ }
+
+ @Override
+ public void setPowered(boolean powered) {
+ set(POWERED, powered);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftLogAbstract.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftLogAbstract.java
new file mode 100644
index 00000000..efa40490
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftLogAbstract.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftLogAbstract extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Orientable {
+
+ public CraftLogAbstract() {
+ super();
+ }
+
+ public CraftLogAbstract(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftOrientable
+
+ private static final net.minecraft.server.BlockStateEnum<?> AXIS = getEnum(net.minecraft.server.BlockLogAbstract.class, "axis");
+
+ @Override
+ public org.bukkit.Axis getAxis() {
+ return get(AXIS, org.bukkit.Axis.class);
+ }
+
+ @Override
+ public void setAxis(org.bukkit.Axis axis) {
+ set(AXIS, axis);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.Axis> getAxes() {
+ return getValues(AXIS, org.bukkit.Axis.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftMinecartDetector.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftMinecartDetector.java
new file mode 100644
index 00000000..9ad25f9f
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftMinecartDetector.java
@@ -0,0 +1,48 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftMinecartDetector extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.RedstoneRail, org.bukkit.block.data.Powerable, org.bukkit.block.data.Rail {
+
+ public CraftMinecartDetector() {
+ super();
+ }
+
+ public CraftMinecartDetector(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftPowerable
+
+ private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockMinecartDetector.class, "powered");
+
+ @Override
+ public boolean isPowered() {
+ return get(POWERED);
+ }
+
+ @Override
+ public void setPowered(boolean powered) {
+ set(POWERED, powered);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftRail
+
+ private static final net.minecraft.server.BlockStateEnum<?> SHAPE = getEnum(net.minecraft.server.BlockMinecartDetector.class, "shape");
+
+ @Override
+ public Shape getShape() {
+ return get(SHAPE, Shape.class);
+ }
+
+ @Override
+ public void setShape(Shape shape) {
+ set(SHAPE, shape);
+ }
+
+ @Override
+ public java.util.Set<Shape> getShapes() {
+ return getValues(SHAPE, Shape.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftMinecartTrack.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftMinecartTrack.java
new file mode 100644
index 00000000..127681a6
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftMinecartTrack.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftMinecartTrack extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Rail {
+
+ public CraftMinecartTrack() {
+ super();
+ }
+
+ public CraftMinecartTrack(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftRail
+
+ private static final net.minecraft.server.BlockStateEnum<?> SHAPE = getEnum(net.minecraft.server.BlockMinecartTrack.class, "shape");
+
+ @Override
+ public Shape getShape() {
+ return get(SHAPE, Shape.class);
+ }
+
+ @Override
+ public void setShape(Shape shape) {
+ set(SHAPE, shape);
+ }
+
+ @Override
+ public java.util.Set<Shape> getShapes() {
+ return getValues(SHAPE, Shape.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftMycel.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftMycel.java
new file mode 100644
index 00000000..ca9d60f3
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftMycel.java
@@ -0,0 +1,29 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftMycel extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Snowable {
+
+ public CraftMycel() {
+ super();
+ }
+
+ public CraftMycel(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftSnowable
+
+ private static final net.minecraft.server.BlockStateBoolean SNOWY = getBoolean(net.minecraft.server.BlockMycel.class, "snowy");
+
+ @Override
+ public boolean isSnowy() {
+ return get(SNOWY);
+ }
+
+ @Override
+ public void setSnowy(boolean snowy) {
+ set(SNOWY, snowy);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftNetherWart.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftNetherWart.java
new file mode 100644
index 00000000..449d0f6f
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftNetherWart.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftNetherWart extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Ageable {
+
+ public CraftNetherWart() {
+ super();
+ }
+
+ public CraftNetherWart(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftAgeable
+
+ private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockNetherWart.class, "age");
+
+ @Override
+ public int getAge() {
+ return get(AGE);
+ }
+
+ @Override
+ public void setAge(int age) {
+ set(AGE, age);
+ }
+
+ @Override
+ public int getMaximumAge() {
+ return getMax(AGE);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftNote.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftNote.java
new file mode 100644
index 00000000..03a736bd
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftNote.java
@@ -0,0 +1,54 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftNote extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.NoteBlock, org.bukkit.block.data.Powerable {
+
+ public CraftNote() {
+ super();
+ }
+
+ public CraftNote(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftNoteBlock
+
+ private static final net.minecraft.server.BlockStateEnum<?> INSTRUMENT = getEnum(net.minecraft.server.BlockNote.class, "instrument");
+ private static final net.minecraft.server.BlockStateInteger NOTE = getInteger(net.minecraft.server.BlockNote.class, "note");
+
+ @Override
+ public org.bukkit.Instrument getInstrument() {
+ return get(INSTRUMENT, org.bukkit.Instrument.class);
+ }
+
+ @Override
+ public void setInstrument(org.bukkit.Instrument instrument) {
+ set(INSTRUMENT, instrument);
+ }
+
+ @Override
+ public org.bukkit.Note getNote() {
+ return new org.bukkit.Note(get(NOTE));
+ }
+
+ @Override
+ public void setNote(org.bukkit.Note note) {
+ set(NOTE, (int) note.getId());
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftPowerable
+
+ private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockNote.class, "powered");
+
+ @Override
+ public boolean isPowered() {
+ return get(POWERED);
+ }
+
+ @Override
+ public void setPowered(boolean powered) {
+ set(POWERED, powered);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftObserver.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftObserver.java
new file mode 100644
index 00000000..ba3a4f07
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftObserver.java
@@ -0,0 +1,48 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftObserver extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Observer, org.bukkit.block.data.Directional, org.bukkit.block.data.Powerable {
+
+ public CraftObserver() {
+ super();
+ }
+
+ public CraftObserver(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockObserver.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftPowerable
+
+ private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockObserver.class, "powered");
+
+ @Override
+ public boolean isPowered() {
+ return get(POWERED);
+ }
+
+ @Override
+ public void setPowered(boolean powered) {
+ set(POWERED, powered);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPiston.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPiston.java
new file mode 100644
index 00000000..f16404f4
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPiston.java
@@ -0,0 +1,48 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftPiston extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Piston, org.bukkit.block.data.Directional {
+
+ public CraftPiston() {
+ super();
+ }
+
+ public CraftPiston(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftPiston
+
+ private static final net.minecraft.server.BlockStateBoolean EXTENDED = getBoolean(net.minecraft.server.BlockPiston.class, "extended");
+
+ @Override
+ public boolean isExtended() {
+ return get(EXTENDED);
+ }
+
+ @Override
+ public void setExtended(boolean extended) {
+ set(EXTENDED, extended);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockPiston.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPistonExtension.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPistonExtension.java
new file mode 100644
index 00000000..038e5843
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPistonExtension.java
@@ -0,0 +1,62 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftPistonExtension extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.PistonHead, org.bukkit.block.data.type.TechnicalPiston, org.bukkit.block.data.Directional {
+
+ public CraftPistonExtension() {
+ super();
+ }
+
+ public CraftPistonExtension(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftPistonHead
+
+ private static final net.minecraft.server.BlockStateBoolean SHORT = getBoolean(net.minecraft.server.BlockPistonExtension.class, "short");
+
+ @Override
+ public boolean isShort() {
+ return get(SHORT);
+ }
+
+ @Override
+ public void setShort(boolean _short) {
+ set(SHORT, _short);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftTechnicalPiston
+
+ private static final net.minecraft.server.BlockStateEnum<?> TYPE = getEnum(net.minecraft.server.BlockPistonExtension.class, "type");
+
+ @Override
+ public Type getType() {
+ return get(TYPE, Type.class);
+ }
+
+ @Override
+ public void setType(Type type) {
+ set(TYPE, type);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockPistonExtension.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPistonMoving.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPistonMoving.java
new file mode 100644
index 00000000..38b098e0
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPistonMoving.java
@@ -0,0 +1,48 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftPistonMoving extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.TechnicalPiston, org.bukkit.block.data.Directional {
+
+ public CraftPistonMoving() {
+ super();
+ }
+
+ public CraftPistonMoving(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftTechnicalPiston
+
+ private static final net.minecraft.server.BlockStateEnum<?> TYPE = getEnum(net.minecraft.server.BlockPistonMoving.class, "type");
+
+ @Override
+ public Type getType() {
+ return get(TYPE, Type.class);
+ }
+
+ @Override
+ public void setType(Type type) {
+ set(TYPE, type);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockPistonMoving.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPortal.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPortal.java
new file mode 100644
index 00000000..7701ca85
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPortal.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftPortal extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Orientable {
+
+ public CraftPortal() {
+ super();
+ }
+
+ public CraftPortal(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftOrientable
+
+ private static final net.minecraft.server.BlockStateEnum<?> AXIS = getEnum(net.minecraft.server.BlockPortal.class, "axis");
+
+ @Override
+ public org.bukkit.Axis getAxis() {
+ return get(AXIS, org.bukkit.Axis.class);
+ }
+
+ @Override
+ public void setAxis(org.bukkit.Axis axis) {
+ set(AXIS, axis);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.Axis> getAxes() {
+ return getValues(AXIS, org.bukkit.Axis.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPotatoes.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPotatoes.java
new file mode 100644
index 00000000..c09a9c78
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPotatoes.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftPotatoes extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Ageable {
+
+ public CraftPotatoes() {
+ super();
+ }
+
+ public CraftPotatoes(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftAgeable
+
+ private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockPotatoes.class, "age");
+
+ @Override
+ public int getAge() {
+ return get(AGE);
+ }
+
+ @Override
+ public void setAge(int age) {
+ set(AGE, age);
+ }
+
+ @Override
+ public int getMaximumAge() {
+ return getMax(AGE);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPoweredRail.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPoweredRail.java
new file mode 100644
index 00000000..ea904ef0
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPoweredRail.java
@@ -0,0 +1,48 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftPoweredRail extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.RedstoneRail, org.bukkit.block.data.Powerable, org.bukkit.block.data.Rail {
+
+ public CraftPoweredRail() {
+ super();
+ }
+
+ public CraftPoweredRail(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftPowerable
+
+ private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockPoweredRail.class, "powered");
+
+ @Override
+ public boolean isPowered() {
+ return get(POWERED);
+ }
+
+ @Override
+ public void setPowered(boolean powered) {
+ set(POWERED, powered);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftRail
+
+ private static final net.minecraft.server.BlockStateEnum<?> SHAPE = getEnum(net.minecraft.server.BlockPoweredRail.class, "shape");
+
+ @Override
+ public Shape getShape() {
+ return get(SHAPE, Shape.class);
+ }
+
+ @Override
+ public void setShape(Shape shape) {
+ set(SHAPE, shape);
+ }
+
+ @Override
+ public java.util.Set<Shape> getShapes() {
+ return getValues(SHAPE, Shape.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPressurePlateBinary.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPressurePlateBinary.java
new file mode 100644
index 00000000..806ad256
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPressurePlateBinary.java
@@ -0,0 +1,29 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftPressurePlateBinary extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Powerable {
+
+ public CraftPressurePlateBinary() {
+ super();
+ }
+
+ public CraftPressurePlateBinary(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftPowerable
+
+ private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockPressurePlateBinary.class, "powered");
+
+ @Override
+ public boolean isPowered() {
+ return get(POWERED);
+ }
+
+ @Override
+ public void setPowered(boolean powered) {
+ set(POWERED, powered);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPressurePlateWeighted.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPressurePlateWeighted.java
new file mode 100644
index 00000000..84050664
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPressurePlateWeighted.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftPressurePlateWeighted extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.AnaloguePowerable {
+
+ public CraftPressurePlateWeighted() {
+ super();
+ }
+
+ public CraftPressurePlateWeighted(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftAnaloguePowerable
+
+ private static final net.minecraft.server.BlockStateInteger POWER = getInteger(net.minecraft.server.BlockPressurePlateWeighted.class, "power");
+
+ @Override
+ public int getPower() {
+ return get(POWER);
+ }
+
+ @Override
+ public void setPower(int power) {
+ set(POWER, power);
+ }
+
+ @Override
+ public int getMaximumPower() {
+ return getMax(POWER);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPumpkinCarved.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPumpkinCarved.java
new file mode 100644
index 00000000..b258e744
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPumpkinCarved.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftPumpkinCarved extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Directional {
+
+ public CraftPumpkinCarved() {
+ super();
+ }
+
+ public CraftPumpkinCarved(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockPumpkinCarved.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneComparator.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneComparator.java
new file mode 100644
index 00000000..2456e307
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneComparator.java
@@ -0,0 +1,62 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftRedstoneComparator extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Comparator, org.bukkit.block.data.Directional, org.bukkit.block.data.Powerable {
+
+ public CraftRedstoneComparator() {
+ super();
+ }
+
+ public CraftRedstoneComparator(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftComparator
+
+ private static final net.minecraft.server.BlockStateEnum<?> MODE = getEnum(net.minecraft.server.BlockRedstoneComparator.class, "mode");
+
+ @Override
+ public Mode getMode() {
+ return get(MODE, Mode.class);
+ }
+
+ @Override
+ public void setMode(Mode mode) {
+ set(MODE, mode);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockRedstoneComparator.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftPowerable
+
+ private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockRedstoneComparator.class, "powered");
+
+ @Override
+ public boolean isPowered() {
+ return get(POWERED);
+ }
+
+ @Override
+ public void setPowered(boolean powered) {
+ set(POWERED, powered);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneLamp.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneLamp.java
new file mode 100644
index 00000000..7769c93c
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneLamp.java
@@ -0,0 +1,29 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftRedstoneLamp extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Lightable {
+
+ public CraftRedstoneLamp() {
+ super();
+ }
+
+ public CraftRedstoneLamp(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftLightable
+
+ private static final net.minecraft.server.BlockStateBoolean LIT = getBoolean(net.minecraft.server.BlockRedstoneLamp.class, "lit");
+
+ @Override
+ public boolean isLit() {
+ return get(LIT);
+ }
+
+ @Override
+ public void setLit(boolean lit) {
+ set(LIT, lit);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneOre.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneOre.java
new file mode 100644
index 00000000..effe08ea
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneOre.java
@@ -0,0 +1,29 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftRedstoneOre extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Lightable {
+
+ public CraftRedstoneOre() {
+ super();
+ }
+
+ public CraftRedstoneOre(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftLightable
+
+ private static final net.minecraft.server.BlockStateBoolean LIT = getBoolean(net.minecraft.server.BlockRedstoneOre.class, "lit");
+
+ @Override
+ public boolean isLit() {
+ return get(LIT);
+ }
+
+ @Override
+ public void setLit(boolean lit) {
+ set(LIT, lit);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneTorch.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneTorch.java
new file mode 100644
index 00000000..d9d14201
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneTorch.java
@@ -0,0 +1,29 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftRedstoneTorch extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Lightable {
+
+ public CraftRedstoneTorch() {
+ super();
+ }
+
+ public CraftRedstoneTorch(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftLightable
+
+ private static final net.minecraft.server.BlockStateBoolean LIT = getBoolean(net.minecraft.server.BlockRedstoneTorch.class, "lit");
+
+ @Override
+ public boolean isLit() {
+ return get(LIT);
+ }
+
+ @Override
+ public void setLit(boolean lit) {
+ set(LIT, lit);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneTorchWall.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneTorchWall.java
new file mode 100644
index 00000000..8125b400
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneTorchWall.java
@@ -0,0 +1,48 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftRedstoneTorchWall extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.RedstoneWallTorch, org.bukkit.block.data.Directional, org.bukkit.block.data.Lightable {
+
+ public CraftRedstoneTorchWall() {
+ super();
+ }
+
+ public CraftRedstoneTorchWall(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockRedstoneTorchWall.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftLightable
+
+ private static final net.minecraft.server.BlockStateBoolean LIT = getBoolean(net.minecraft.server.BlockRedstoneTorchWall.class, "lit");
+
+ @Override
+ public boolean isLit() {
+ return get(LIT);
+ }
+
+ @Override
+ public void setLit(boolean lit) {
+ set(LIT, lit);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneWire.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneWire.java
new file mode 100644
index 00000000..f5b0e84d
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRedstoneWire.java
@@ -0,0 +1,78 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftRedstoneWire extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.RedstoneWire, org.bukkit.block.data.AnaloguePowerable {
+
+ public CraftRedstoneWire() {
+ super();
+ }
+
+ public CraftRedstoneWire(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftRedstoneWire
+
+ private static final net.minecraft.server.BlockStateEnum<?> NORTH = getEnum(net.minecraft.server.BlockRedstoneWire.class, "north");
+ private static final net.minecraft.server.BlockStateEnum<?> EAST = getEnum(net.minecraft.server.BlockRedstoneWire.class, "east");
+ private static final net.minecraft.server.BlockStateEnum<?> SOUTH = getEnum(net.minecraft.server.BlockRedstoneWire.class, "south");
+ private static final net.minecraft.server.BlockStateEnum<?> WEST = getEnum(net.minecraft.server.BlockRedstoneWire.class, "west");
+
+ @Override
+ public Connection getFace(org.bukkit.block.BlockFace face) {
+ switch (face) {
+ case NORTH:
+ return get(NORTH, Connection.class);
+ case EAST:
+ return get(EAST, Connection.class);
+ case SOUTH:
+ return get(SOUTH, Connection.class);
+ case WEST:
+ return get(WEST, Connection.class);
+ default:
+ throw new IllegalArgumentException("Cannot have face " + face);
+ }
+ }
+
+ @Override
+ public void setFace(org.bukkit.block.BlockFace face, Connection connection) {
+ switch (face) {
+ case NORTH:
+ set(NORTH, connection);
+ case EAST:
+ set(EAST, connection);
+ case SOUTH:
+ set(SOUTH, connection);
+ case WEST:
+ set(WEST, connection);
+ default:
+ throw new IllegalArgumentException("Cannot have face " + face);
+ }
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getAllowedFaces() {
+ return com.google.common.collect.ImmutableSet.of(org.bukkit.block.BlockFace.NORTH, org.bukkit.block.BlockFace.EAST, org.bukkit.block.BlockFace.SOUTH, org.bukkit.block.BlockFace.WEST);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftAnaloguePowerable
+
+ private static final net.minecraft.server.BlockStateInteger POWER = getInteger(net.minecraft.server.BlockRedstoneWire.class, "power");
+
+ @Override
+ public int getPower() {
+ return get(POWER);
+ }
+
+ @Override
+ public void setPower(int power) {
+ set(POWER, power);
+ }
+
+ @Override
+ public int getMaximumPower() {
+ return getMax(POWER);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftReed.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftReed.java
new file mode 100644
index 00000000..138b8701
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftReed.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftReed extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Ageable {
+
+ public CraftReed() {
+ super();
+ }
+
+ public CraftReed(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftAgeable
+
+ private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockReed.class, "age");
+
+ @Override
+ public int getAge() {
+ return get(AGE);
+ }
+
+ @Override
+ public void setAge(int age) {
+ set(AGE, age);
+ }
+
+ @Override
+ public int getMaximumAge() {
+ return getMax(AGE);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRepeater.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRepeater.java
new file mode 100644
index 00000000..97724f68
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRepeater.java
@@ -0,0 +1,83 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftRepeater extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Repeater, org.bukkit.block.data.Directional, org.bukkit.block.data.Powerable {
+
+ public CraftRepeater() {
+ super();
+ }
+
+ public CraftRepeater(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftRepeater
+
+ private static final net.minecraft.server.BlockStateInteger DELAY = getInteger(net.minecraft.server.BlockRepeater.class, "delay");
+ private static final net.minecraft.server.BlockStateBoolean LOCKED = getBoolean(net.minecraft.server.BlockRepeater.class, "locked");
+
+ @Override
+ public int getDelay() {
+ return get(DELAY);
+ }
+
+ @Override
+ public void setDelay(int delay) {
+ set(DELAY, delay);
+ }
+
+ @Override
+ public int getMinimumDelay() {
+ return getMin(DELAY);
+ }
+
+ @Override
+ public int getMaximumDelay() {
+ return getMax(DELAY);
+ }
+
+ @Override
+ public boolean isLocked() {
+ return get(LOCKED);
+ }
+
+ @Override
+ public void setLocked(boolean locked) {
+ set(LOCKED, locked);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockRepeater.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftPowerable
+
+ private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockRepeater.class, "powered");
+
+ @Override
+ public boolean isPowered() {
+ return get(POWERED);
+ }
+
+ @Override
+ public void setPowered(boolean powered) {
+ set(POWERED, powered);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRotatable.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRotatable.java
new file mode 100644
index 00000000..c44f23e6
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftRotatable.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftRotatable extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Orientable {
+
+ public CraftRotatable() {
+ super();
+ }
+
+ public CraftRotatable(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftOrientable
+
+ private static final net.minecraft.server.BlockStateEnum<?> AXIS = getEnum(net.minecraft.server.BlockRotatable.class, "axis");
+
+ @Override
+ public org.bukkit.Axis getAxis() {
+ return get(AXIS, org.bukkit.Axis.class);
+ }
+
+ @Override
+ public void setAxis(org.bukkit.Axis axis) {
+ set(AXIS, axis);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.Axis> getAxes() {
+ return getValues(AXIS, org.bukkit.Axis.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSapling.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSapling.java
new file mode 100644
index 00000000..0654c9e7
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSapling.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftSapling extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Sapling {
+
+ public CraftSapling() {
+ super();
+ }
+
+ public CraftSapling(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftSapling
+
+ private static final net.minecraft.server.BlockStateInteger STAGE = getInteger(net.minecraft.server.BlockSapling.class, "stage");
+
+ @Override
+ public int getStage() {
+ return get(STAGE);
+ }
+
+ @Override
+ public void setStage(int stage) {
+ set(STAGE, stage);
+ }
+
+ @Override
+ public int getMaximumStage() {
+ return getMax(STAGE);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSeaPickle.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSeaPickle.java
new file mode 100644
index 00000000..a0078bd8
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSeaPickle.java
@@ -0,0 +1,53 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftSeaPickle extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.SeaPickle, org.bukkit.block.data.Waterlogged {
+
+ public CraftSeaPickle() {
+ super();
+ }
+
+ public CraftSeaPickle(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftSeaPickle
+
+ private static final net.minecraft.server.BlockStateInteger PICKLES = getInteger(net.minecraft.server.BlockSeaPickle.class, "pickles");
+
+ @Override
+ public int getPickles() {
+ return get(PICKLES);
+ }
+
+ @Override
+ public void setPickles(int pickles) {
+ set(PICKLES, pickles);
+ }
+
+ @Override
+ public int getMinimumPickles() {
+ return getMin(PICKLES);
+ }
+
+ @Override
+ public int getMaximumPickles() {
+ return getMax(PICKLES);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftWaterlogged
+
+ private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockSeaPickle.class, "waterlogged");
+
+ @Override
+ public boolean isWaterlogged() {
+ return get(WATERLOGGED);
+ }
+
+ @Override
+ public void setWaterlogged(boolean waterlogged) {
+ set(WATERLOGGED, waterlogged);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftShulkerBox.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftShulkerBox.java
new file mode 100644
index 00000000..631f5cff
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftShulkerBox.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftShulkerBox extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Directional {
+
+ public CraftShulkerBox() {
+ super();
+ }
+
+ public CraftShulkerBox(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockShulkerBox.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSkull.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSkull.java
new file mode 100644
index 00000000..5677a9f0
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSkull.java
@@ -0,0 +1,118 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftSkull extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Rotatable {
+
+ public CraftSkull() {
+ super();
+ }
+
+ public CraftSkull(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftRotatable
+
+ private static final net.minecraft.server.BlockStateInteger ROTATION = getInteger(net.minecraft.server.BlockSkull.class, "rotation");
+
+ @Override
+ public org.bukkit.block.BlockFace getRotation() {
+ int data = get(ROTATION);
+ switch (data) {
+ case 0x0:
+ return org.bukkit.block.BlockFace.SOUTH;
+ case 0x1:
+ return org.bukkit.block.BlockFace.SOUTH_SOUTH_WEST;
+ case 0x2:
+ return org.bukkit.block.BlockFace.SOUTH_WEST;
+ case 0x3:
+ return org.bukkit.block.BlockFace.WEST_SOUTH_WEST;
+ case 0x4:
+ return org.bukkit.block.BlockFace.WEST;
+ case 0x5:
+ return org.bukkit.block.BlockFace.WEST_NORTH_WEST;
+ case 0x6:
+ return org.bukkit.block.BlockFace.NORTH_WEST;
+ case 0x7:
+ return org.bukkit.block.BlockFace.NORTH_NORTH_WEST;
+ case 0x8:
+ return org.bukkit.block.BlockFace.NORTH;
+ case 0x9:
+ return org.bukkit.block.BlockFace.NORTH_NORTH_EAST;
+ case 0xA:
+ return org.bukkit.block.BlockFace.NORTH_EAST;
+ case 0xB:
+ return org.bukkit.block.BlockFace.EAST_NORTH_EAST;
+ case 0xC:
+ return org.bukkit.block.BlockFace.EAST;
+ case 0xD:
+ return org.bukkit.block.BlockFace.EAST_SOUTH_EAST;
+ case 0xE:
+ return org.bukkit.block.BlockFace.SOUTH_EAST;
+ case 0xF:
+ return org.bukkit.block.BlockFace.SOUTH_SOUTH_EAST;
+ default:
+ throw new IllegalArgumentException("Unknown rotation " + data);
+ }
+ }
+
+ @Override
+ public void setRotation(org.bukkit.block.BlockFace rotation) {
+ int val;
+ switch (rotation) {
+ case SOUTH:
+ val = 0x0;
+ break;
+ case SOUTH_SOUTH_WEST:
+ val = 0x1;
+ break;
+ case SOUTH_WEST:
+ val = 0x2;
+ break;
+ case WEST_SOUTH_WEST:
+ val = 0x3;
+ break;
+ case WEST:
+ val = 0x4;
+ break;
+ case WEST_NORTH_WEST:
+ val = 0x5;
+ break;
+ case NORTH_WEST:
+ val = 0x6;
+ break;
+ case NORTH_NORTH_WEST:
+ val = 0x7;
+ break;
+ case NORTH:
+ val = 0x8;
+ break;
+ case NORTH_NORTH_EAST:
+ val = 0x9;
+ break;
+ case NORTH_EAST:
+ val = 0xA;
+ break;
+ case EAST_NORTH_EAST:
+ val = 0xB;
+ break;
+ case EAST:
+ val = 0xC;
+ break;
+ case EAST_SOUTH_EAST:
+ val = 0xD;
+ break;
+ case SOUTH_EAST:
+ val = 0xE;
+ break;
+ case SOUTH_SOUTH_EAST:
+ val = 0xF;
+ break;
+ default:
+ throw new IllegalArgumentException("Illegal rotation " + rotation);
+ }
+ set(ROTATION, val);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSkullPlayer.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSkullPlayer.java
new file mode 100644
index 00000000..6e6e0033
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSkullPlayer.java
@@ -0,0 +1,118 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftSkullPlayer extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Rotatable {
+
+ public CraftSkullPlayer() {
+ super();
+ }
+
+ public CraftSkullPlayer(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftRotatable
+
+ private static final net.minecraft.server.BlockStateInteger ROTATION = getInteger(net.minecraft.server.BlockSkullPlayer.class, "rotation");
+
+ @Override
+ public org.bukkit.block.BlockFace getRotation() {
+ int data = get(ROTATION);
+ switch (data) {
+ case 0x0:
+ return org.bukkit.block.BlockFace.SOUTH;
+ case 0x1:
+ return org.bukkit.block.BlockFace.SOUTH_SOUTH_WEST;
+ case 0x2:
+ return org.bukkit.block.BlockFace.SOUTH_WEST;
+ case 0x3:
+ return org.bukkit.block.BlockFace.WEST_SOUTH_WEST;
+ case 0x4:
+ return org.bukkit.block.BlockFace.WEST;
+ case 0x5:
+ return org.bukkit.block.BlockFace.WEST_NORTH_WEST;
+ case 0x6:
+ return org.bukkit.block.BlockFace.NORTH_WEST;
+ case 0x7:
+ return org.bukkit.block.BlockFace.NORTH_NORTH_WEST;
+ case 0x8:
+ return org.bukkit.block.BlockFace.NORTH;
+ case 0x9:
+ return org.bukkit.block.BlockFace.NORTH_NORTH_EAST;
+ case 0xA:
+ return org.bukkit.block.BlockFace.NORTH_EAST;
+ case 0xB:
+ return org.bukkit.block.BlockFace.EAST_NORTH_EAST;
+ case 0xC:
+ return org.bukkit.block.BlockFace.EAST;
+ case 0xD:
+ return org.bukkit.block.BlockFace.EAST_SOUTH_EAST;
+ case 0xE:
+ return org.bukkit.block.BlockFace.SOUTH_EAST;
+ case 0xF:
+ return org.bukkit.block.BlockFace.SOUTH_SOUTH_EAST;
+ default:
+ throw new IllegalArgumentException("Unknown rotation " + data);
+ }
+ }
+
+ @Override
+ public void setRotation(org.bukkit.block.BlockFace rotation) {
+ int val;
+ switch (rotation) {
+ case SOUTH:
+ val = 0x0;
+ break;
+ case SOUTH_SOUTH_WEST:
+ val = 0x1;
+ break;
+ case SOUTH_WEST:
+ val = 0x2;
+ break;
+ case WEST_SOUTH_WEST:
+ val = 0x3;
+ break;
+ case WEST:
+ val = 0x4;
+ break;
+ case WEST_NORTH_WEST:
+ val = 0x5;
+ break;
+ case NORTH_WEST:
+ val = 0x6;
+ break;
+ case NORTH_NORTH_WEST:
+ val = 0x7;
+ break;
+ case NORTH:
+ val = 0x8;
+ break;
+ case NORTH_NORTH_EAST:
+ val = 0x9;
+ break;
+ case NORTH_EAST:
+ val = 0xA;
+ break;
+ case EAST_NORTH_EAST:
+ val = 0xB;
+ break;
+ case EAST:
+ val = 0xC;
+ break;
+ case EAST_SOUTH_EAST:
+ val = 0xD;
+ break;
+ case SOUTH_EAST:
+ val = 0xE;
+ break;
+ case SOUTH_SOUTH_EAST:
+ val = 0xF;
+ break;
+ default:
+ throw new IllegalArgumentException("Illegal rotation " + rotation);
+ }
+ set(ROTATION, val);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSkullPlayerWall.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSkullPlayerWall.java
new file mode 100644
index 00000000..d2b3ce93
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSkullPlayerWall.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftSkullPlayerWall extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Directional {
+
+ public CraftSkullPlayerWall() {
+ super();
+ }
+
+ public CraftSkullPlayerWall(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockSkullPlayerWall.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSkullWall.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSkullWall.java
new file mode 100644
index 00000000..020e5b71
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSkullWall.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftSkullWall extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Directional {
+
+ public CraftSkullWall() {
+ super();
+ }
+
+ public CraftSkullWall(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockSkullWall.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSnow.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSnow.java
new file mode 100644
index 00000000..d4f0bfa8
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSnow.java
@@ -0,0 +1,39 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftSnow extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Snow {
+
+ public CraftSnow() {
+ super();
+ }
+
+ public CraftSnow(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftSnow
+
+ private static final net.minecraft.server.BlockStateInteger LAYERS = getInteger(net.minecraft.server.BlockSnow.class, "layers");
+
+ @Override
+ public int getLayers() {
+ return get(LAYERS);
+ }
+
+ @Override
+ public void setLayers(int layers) {
+ set(LAYERS, layers);
+ }
+
+ @Override
+ public int getMinimumLayers() {
+ return getMin(LAYERS);
+ }
+
+ @Override
+ public int getMaximumLayers() {
+ return getMax(LAYERS);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSoil.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSoil.java
new file mode 100644
index 00000000..09cfa467
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftSoil.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftSoil extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Farmland {
+
+ public CraftSoil() {
+ super();
+ }
+
+ public CraftSoil(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftFarmland
+
+ private static final net.minecraft.server.BlockStateInteger MOISTURE = getInteger(net.minecraft.server.BlockSoil.class, "moisture");
+
+ @Override
+ public int getMoisture() {
+ return get(MOISTURE);
+ }
+
+ @Override
+ public void setMoisture(int moisture) {
+ set(MOISTURE, moisture);
+ }
+
+ @Override
+ public int getMaximumMoisture() {
+ return getMax(MOISTURE);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStainedGlassPane.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStainedGlassPane.java
new file mode 100644
index 00000000..0eb5c660
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStainedGlassPane.java
@@ -0,0 +1,71 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftStainedGlassPane extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.GlassPane, org.bukkit.block.data.MultipleFacing, org.bukkit.block.data.Waterlogged {
+
+ public CraftStainedGlassPane() {
+ super();
+ }
+
+ public CraftStainedGlassPane(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftMultipleFacing
+
+ private static final net.minecraft.server.BlockStateBoolean[] FACES = new net.minecraft.server.BlockStateBoolean[]{
+ getBoolean(net.minecraft.server.BlockStainedGlassPane.class, "north", true), getBoolean(net.minecraft.server.BlockStainedGlassPane.class, "east", true), getBoolean(net.minecraft.server.BlockStainedGlassPane.class, "south", true), getBoolean(net.minecraft.server.BlockStainedGlassPane.class, "west", true), getBoolean(net.minecraft.server.BlockStainedGlassPane.class, "up", true), getBoolean(net.minecraft.server.BlockStainedGlassPane.class, "down", true)
+ };
+
+ @Override
+ public boolean hasFace(org.bukkit.block.BlockFace face) {
+ return get(FACES[face.ordinal()]);
+ }
+
+ @Override
+ public void setFace(org.bukkit.block.BlockFace face, boolean has) {
+ set(FACES[face.ordinal()], has);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null && get(FACES[i])) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getAllowedFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftWaterlogged
+
+ private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockStainedGlassPane.class, "waterlogged");
+
+ @Override
+ public boolean isWaterlogged() {
+ return get(WATERLOGGED);
+ }
+
+ @Override
+ public void setWaterlogged(boolean waterlogged) {
+ set(WATERLOGGED, waterlogged);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStairs.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStairs.java
new file mode 100644
index 00000000..804a90f2
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStairs.java
@@ -0,0 +1,76 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftStairs extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Stairs, org.bukkit.block.data.Bisected, org.bukkit.block.data.Directional, org.bukkit.block.data.Waterlogged {
+
+ public CraftStairs() {
+ super();
+ }
+
+ public CraftStairs(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftStairs
+
+ private static final net.minecraft.server.BlockStateEnum<?> SHAPE = getEnum(net.minecraft.server.BlockStairs.class, "shape");
+
+ @Override
+ public Shape getShape() {
+ return get(SHAPE, Shape.class);
+ }
+
+ @Override
+ public void setShape(Shape shape) {
+ set(SHAPE, shape);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftBisected
+
+ private static final net.minecraft.server.BlockStateEnum<?> HALF = getEnum(net.minecraft.server.BlockStairs.class, "half");
+
+ @Override
+ public Half getHalf() {
+ return get(HALF, Half.class);
+ }
+
+ @Override
+ public void setHalf(Half half) {
+ set(HALF, half);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockStairs.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftWaterlogged
+
+ private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockStairs.class, "waterlogged");
+
+ @Override
+ public boolean isWaterlogged() {
+ return get(WATERLOGGED);
+ }
+
+ @Override
+ public void setWaterlogged(boolean waterlogged) {
+ set(WATERLOGGED, waterlogged);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStem.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStem.java
new file mode 100644
index 00000000..2a91e958
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStem.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftStem extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Ageable {
+
+ public CraftStem() {
+ super();
+ }
+
+ public CraftStem(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftAgeable
+
+ private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockStem.class, "age");
+
+ @Override
+ public int getAge() {
+ return get(AGE);
+ }
+
+ @Override
+ public void setAge(int age) {
+ set(AGE, age);
+ }
+
+ @Override
+ public int getMaximumAge() {
+ return getMax(AGE);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStemAttached.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStemAttached.java
new file mode 100644
index 00000000..c6d9223d
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStemAttached.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftStemAttached extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Directional {
+
+ public CraftStemAttached() {
+ super();
+ }
+
+ public CraftStemAttached(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockStemAttached.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStepAbstract.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStepAbstract.java
new file mode 100644
index 00000000..922d41b1
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStepAbstract.java
@@ -0,0 +1,43 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftStepAbstract extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Slab, org.bukkit.block.data.Waterlogged {
+
+ public CraftStepAbstract() {
+ super();
+ }
+
+ public CraftStepAbstract(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftSlab
+
+ private static final net.minecraft.server.BlockStateEnum<?> TYPE = getEnum(net.minecraft.server.BlockStepAbstract.class, "type");
+
+ @Override
+ public Type getType() {
+ return get(TYPE, Type.class);
+ }
+
+ @Override
+ public void setType(Type type) {
+ set(TYPE, type);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftWaterlogged
+
+ private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockStepAbstract.class, "waterlogged");
+
+ @Override
+ public boolean isWaterlogged() {
+ return get(WATERLOGGED);
+ }
+
+ @Override
+ public void setWaterlogged(boolean waterlogged) {
+ set(WATERLOGGED, waterlogged);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStoneButton.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStoneButton.java
new file mode 100644
index 00000000..84097d5e
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStoneButton.java
@@ -0,0 +1,62 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftStoneButton extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Switch, org.bukkit.block.data.Directional, org.bukkit.block.data.Powerable {
+
+ public CraftStoneButton() {
+ super();
+ }
+
+ public CraftStoneButton(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftSwitch
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACE = getEnum(net.minecraft.server.BlockStoneButton.class, "face");
+
+ @Override
+ public Face getFace() {
+ return get(FACE, Face.class);
+ }
+
+ @Override
+ public void setFace(Face face) {
+ set(FACE, face);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockStoneButton.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftPowerable
+
+ private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockStoneButton.class, "powered");
+
+ @Override
+ public boolean isPowered() {
+ return get(POWERED);
+ }
+
+ @Override
+ public void setPowered(boolean powered) {
+ set(POWERED, powered);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStructure.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStructure.java
new file mode 100644
index 00000000..f2435d34
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftStructure.java
@@ -0,0 +1,29 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftStructure extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.StructureBlock {
+
+ public CraftStructure() {
+ super();
+ }
+
+ public CraftStructure(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftStructureBlock
+
+ private static final net.minecraft.server.BlockStateEnum<?> MODE = getEnum(net.minecraft.server.BlockStructure.class, "mode");
+
+ @Override
+ public Mode getMode() {
+ return get(MODE, Mode.class);
+ }
+
+ @Override
+ public void setMode(Mode mode) {
+ set(MODE, mode);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTallPlantFlower.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTallPlantFlower.java
new file mode 100644
index 00000000..3ae8201c
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTallPlantFlower.java
@@ -0,0 +1,29 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftTallPlantFlower extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Bisected {
+
+ public CraftTallPlantFlower() {
+ super();
+ }
+
+ public CraftTallPlantFlower(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftBisected
+
+ private static final net.minecraft.server.BlockStateEnum<?> HALF = getEnum(net.minecraft.server.BlockTallPlantFlower.class, "half");
+
+ @Override
+ public Half getHalf() {
+ return get(HALF, Half.class);
+ }
+
+ @Override
+ public void setHalf(Half half) {
+ set(HALF, half);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTallPlantShearable.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTallPlantShearable.java
new file mode 100644
index 00000000..c98414b3
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTallPlantShearable.java
@@ -0,0 +1,29 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftTallPlantShearable extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Bisected {
+
+ public CraftTallPlantShearable() {
+ super();
+ }
+
+ public CraftTallPlantShearable(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftBisected
+
+ private static final net.minecraft.server.BlockStateEnum<?> HALF = getEnum(net.minecraft.server.BlockTallPlantShearable.class, "half");
+
+ @Override
+ public Half getHalf() {
+ return get(HALF, Half.class);
+ }
+
+ @Override
+ public void setHalf(Half half) {
+ set(HALF, half);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTallSeaGrass.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTallSeaGrass.java
new file mode 100644
index 00000000..d51e3ec4
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTallSeaGrass.java
@@ -0,0 +1,29 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftTallSeaGrass extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Bisected {
+
+ public CraftTallSeaGrass() {
+ super();
+ }
+
+ public CraftTallSeaGrass(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftBisected
+
+ private static final net.minecraft.server.BlockStateEnum<?> HALF = getEnum(net.minecraft.server.BlockTallSeaGrass.class, "half");
+
+ @Override
+ public Half getHalf() {
+ return get(HALF, Half.class);
+ }
+
+ @Override
+ public void setHalf(Half half) {
+ set(HALF, half);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTorchWall.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTorchWall.java
new file mode 100644
index 00000000..d98f21aa
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTorchWall.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftTorchWall extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Directional {
+
+ public CraftTorchWall() {
+ super();
+ }
+
+ public CraftTorchWall(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockTorchWall.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTrapdoor.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTrapdoor.java
new file mode 100644
index 00000000..2ec18b29
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTrapdoor.java
@@ -0,0 +1,90 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftTrapdoor extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.TrapDoor, org.bukkit.block.data.Bisected, org.bukkit.block.data.Directional, org.bukkit.block.data.Openable, org.bukkit.block.data.Powerable, org.bukkit.block.data.Waterlogged {
+
+ public CraftTrapdoor() {
+ super();
+ }
+
+ public CraftTrapdoor(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftBisected
+
+ private static final net.minecraft.server.BlockStateEnum<?> HALF = getEnum(net.minecraft.server.BlockTrapdoor.class, "half");
+
+ @Override
+ public Half getHalf() {
+ return get(HALF, Half.class);
+ }
+
+ @Override
+ public void setHalf(Half half) {
+ set(HALF, half);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockTrapdoor.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftOpenable
+
+ private static final net.minecraft.server.BlockStateBoolean OPEN = getBoolean(net.minecraft.server.BlockTrapdoor.class, "open");
+
+ @Override
+ public boolean isOpen() {
+ return get(OPEN);
+ }
+
+ @Override
+ public void setOpen(boolean open) {
+ set(OPEN, open);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftPowerable
+
+ private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockTrapdoor.class, "powered");
+
+ @Override
+ public boolean isPowered() {
+ return get(POWERED);
+ }
+
+ @Override
+ public void setPowered(boolean powered) {
+ set(POWERED, powered);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftWaterlogged
+
+ private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockTrapdoor.class, "waterlogged");
+
+ @Override
+ public boolean isWaterlogged() {
+ return get(WATERLOGGED);
+ }
+
+ @Override
+ public void setWaterlogged(boolean waterlogged) {
+ set(WATERLOGGED, waterlogged);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTripwire.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTripwire.java
new file mode 100644
index 00000000..e39e79c4
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTripwire.java
@@ -0,0 +1,99 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftTripwire extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Tripwire, org.bukkit.block.data.Attachable, org.bukkit.block.data.MultipleFacing, org.bukkit.block.data.Powerable {
+
+ public CraftTripwire() {
+ super();
+ }
+
+ public CraftTripwire(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftTripwire
+
+ private static final net.minecraft.server.BlockStateBoolean DISARMED = getBoolean(net.minecraft.server.BlockTripwire.class, "disarmed");
+
+ @Override
+ public boolean isDisarmed() {
+ return get(DISARMED);
+ }
+
+ @Override
+ public void setDisarmed(boolean disarmed) {
+ set(DISARMED, disarmed);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftAttachable
+
+ private static final net.minecraft.server.BlockStateBoolean ATTACHED = getBoolean(net.minecraft.server.BlockTripwire.class, "attached");
+
+ @Override
+ public boolean isAttached() {
+ return get(ATTACHED);
+ }
+
+ @Override
+ public void setAttached(boolean attached) {
+ set(ATTACHED, attached);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftMultipleFacing
+
+ private static final net.minecraft.server.BlockStateBoolean[] FACES = new net.minecraft.server.BlockStateBoolean[]{
+ getBoolean(net.minecraft.server.BlockTripwire.class, "north", true), getBoolean(net.minecraft.server.BlockTripwire.class, "east", true), getBoolean(net.minecraft.server.BlockTripwire.class, "south", true), getBoolean(net.minecraft.server.BlockTripwire.class, "west", true), getBoolean(net.minecraft.server.BlockTripwire.class, "up", true), getBoolean(net.minecraft.server.BlockTripwire.class, "down", true)
+ };
+
+ @Override
+ public boolean hasFace(org.bukkit.block.BlockFace face) {
+ return get(FACES[face.ordinal()]);
+ }
+
+ @Override
+ public void setFace(org.bukkit.block.BlockFace face, boolean has) {
+ set(FACES[face.ordinal()], has);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null && get(FACES[i])) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getAllowedFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftPowerable
+
+ private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockTripwire.class, "powered");
+
+ @Override
+ public boolean isPowered() {
+ return get(POWERED);
+ }
+
+ @Override
+ public void setPowered(boolean powered) {
+ set(POWERED, powered);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTripwireHook.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTripwireHook.java
new file mode 100644
index 00000000..bd7b43ad
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTripwireHook.java
@@ -0,0 +1,62 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftTripwireHook extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.TripwireHook, org.bukkit.block.data.Attachable, org.bukkit.block.data.Directional, org.bukkit.block.data.Powerable {
+
+ public CraftTripwireHook() {
+ super();
+ }
+
+ public CraftTripwireHook(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftAttachable
+
+ private static final net.minecraft.server.BlockStateBoolean ATTACHED = getBoolean(net.minecraft.server.BlockTripwireHook.class, "attached");
+
+ @Override
+ public boolean isAttached() {
+ return get(ATTACHED);
+ }
+
+ @Override
+ public void setAttached(boolean attached) {
+ set(ATTACHED, attached);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockTripwireHook.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftPowerable
+
+ private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockTripwireHook.class, "powered");
+
+ @Override
+ public boolean isPowered() {
+ return get(POWERED);
+ }
+
+ @Override
+ public void setPowered(boolean powered) {
+ set(POWERED, powered);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTurtleEgg.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTurtleEgg.java
new file mode 100644
index 00000000..64812ad1
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftTurtleEgg.java
@@ -0,0 +1,55 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftTurtleEgg extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.TurtleEgg {
+
+ public CraftTurtleEgg() {
+ super();
+ }
+
+ public CraftTurtleEgg(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftTurtleEgg
+
+ private static final net.minecraft.server.BlockStateInteger EGGS = getInteger(net.minecraft.server.BlockTurtleEgg.class, "eggs");
+ private static final net.minecraft.server.BlockStateInteger HATCH = getInteger(net.minecraft.server.BlockTurtleEgg.class, "hatch");
+
+ @Override
+ public int getEggs() {
+ return get(EGGS);
+ }
+
+ @Override
+ public void setEggs(int eggs) {
+ set(EGGS, eggs);
+ }
+
+ @Override
+ public int getMinimumEggs() {
+ return getMin(EGGS);
+ }
+
+ @Override
+ public int getMaximumEggs() {
+ return getMax(EGGS);
+ }
+
+ @Override
+ public int getHatch() {
+ return get(HATCH);
+ }
+
+ @Override
+ public void setHatch(int hatch) {
+ set(HATCH, hatch);
+ }
+
+ @Override
+ public int getMaximumHatch() {
+ return getMax(HATCH);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftVine.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftVine.java
new file mode 100644
index 00000000..90e025ce
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftVine.java
@@ -0,0 +1,57 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftVine extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.MultipleFacing {
+
+ public CraftVine() {
+ super();
+ }
+
+ public CraftVine(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftMultipleFacing
+
+ private static final net.minecraft.server.BlockStateBoolean[] FACES = new net.minecraft.server.BlockStateBoolean[]{
+ getBoolean(net.minecraft.server.BlockVine.class, "north", true), getBoolean(net.minecraft.server.BlockVine.class, "east", true), getBoolean(net.minecraft.server.BlockVine.class, "south", true), getBoolean(net.minecraft.server.BlockVine.class, "west", true), getBoolean(net.minecraft.server.BlockVine.class, "up", true), getBoolean(net.minecraft.server.BlockVine.class, "down", true)
+ };
+
+ @Override
+ public boolean hasFace(org.bukkit.block.BlockFace face) {
+ return get(FACES[face.ordinal()]);
+ }
+
+ @Override
+ public void setFace(org.bukkit.block.BlockFace face, boolean has) {
+ set(FACES[face.ordinal()], has);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null && get(FACES[i])) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getAllowedFaces() {
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
+
+ for (int i = 0; i < FACES.length; i++) {
+ if (FACES[i] != null) {
+ faces.add(org.bukkit.block.BlockFace.values()[i]);
+ }
+ }
+
+ return faces.build();
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftWallSign.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftWallSign.java
new file mode 100644
index 00000000..ffa7e3c4
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftWallSign.java
@@ -0,0 +1,48 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftWallSign extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.WallSign, org.bukkit.block.data.Directional, org.bukkit.block.data.Waterlogged {
+
+ public CraftWallSign() {
+ super();
+ }
+
+ public CraftWallSign(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockWallSign.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftWaterlogged
+
+ private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockWallSign.class, "waterlogged");
+
+ @Override
+ public boolean isWaterlogged() {
+ return get(WATERLOGGED);
+ }
+
+ @Override
+ public void setWaterlogged(boolean waterlogged) {
+ set(WATERLOGGED, waterlogged);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftWitherSkull.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftWitherSkull.java
new file mode 100644
index 00000000..0aec1dbe
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftWitherSkull.java
@@ -0,0 +1,118 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftWitherSkull extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Rotatable {
+
+ public CraftWitherSkull() {
+ super();
+ }
+
+ public CraftWitherSkull(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftRotatable
+
+ private static final net.minecraft.server.BlockStateInteger ROTATION = getInteger(net.minecraft.server.BlockWitherSkull.class, "rotation");
+
+ @Override
+ public org.bukkit.block.BlockFace getRotation() {
+ int data = get(ROTATION);
+ switch (data) {
+ case 0x0:
+ return org.bukkit.block.BlockFace.SOUTH;
+ case 0x1:
+ return org.bukkit.block.BlockFace.SOUTH_SOUTH_WEST;
+ case 0x2:
+ return org.bukkit.block.BlockFace.SOUTH_WEST;
+ case 0x3:
+ return org.bukkit.block.BlockFace.WEST_SOUTH_WEST;
+ case 0x4:
+ return org.bukkit.block.BlockFace.WEST;
+ case 0x5:
+ return org.bukkit.block.BlockFace.WEST_NORTH_WEST;
+ case 0x6:
+ return org.bukkit.block.BlockFace.NORTH_WEST;
+ case 0x7:
+ return org.bukkit.block.BlockFace.NORTH_NORTH_WEST;
+ case 0x8:
+ return org.bukkit.block.BlockFace.NORTH;
+ case 0x9:
+ return org.bukkit.block.BlockFace.NORTH_NORTH_EAST;
+ case 0xA:
+ return org.bukkit.block.BlockFace.NORTH_EAST;
+ case 0xB:
+ return org.bukkit.block.BlockFace.EAST_NORTH_EAST;
+ case 0xC:
+ return org.bukkit.block.BlockFace.EAST;
+ case 0xD:
+ return org.bukkit.block.BlockFace.EAST_SOUTH_EAST;
+ case 0xE:
+ return org.bukkit.block.BlockFace.SOUTH_EAST;
+ case 0xF:
+ return org.bukkit.block.BlockFace.SOUTH_SOUTH_EAST;
+ default:
+ throw new IllegalArgumentException("Unknown rotation " + data);
+ }
+ }
+
+ @Override
+ public void setRotation(org.bukkit.block.BlockFace rotation) {
+ int val;
+ switch (rotation) {
+ case SOUTH:
+ val = 0x0;
+ break;
+ case SOUTH_SOUTH_WEST:
+ val = 0x1;
+ break;
+ case SOUTH_WEST:
+ val = 0x2;
+ break;
+ case WEST_SOUTH_WEST:
+ val = 0x3;
+ break;
+ case WEST:
+ val = 0x4;
+ break;
+ case WEST_NORTH_WEST:
+ val = 0x5;
+ break;
+ case NORTH_WEST:
+ val = 0x6;
+ break;
+ case NORTH_NORTH_WEST:
+ val = 0x7;
+ break;
+ case NORTH:
+ val = 0x8;
+ break;
+ case NORTH_NORTH_EAST:
+ val = 0x9;
+ break;
+ case NORTH_EAST:
+ val = 0xA;
+ break;
+ case EAST_NORTH_EAST:
+ val = 0xB;
+ break;
+ case EAST:
+ val = 0xC;
+ break;
+ case EAST_SOUTH_EAST:
+ val = 0xD;
+ break;
+ case SOUTH_EAST:
+ val = 0xE;
+ break;
+ case SOUTH_SOUTH_EAST:
+ val = 0xF;
+ break;
+ default:
+ throw new IllegalArgumentException("Illegal rotation " + rotation);
+ }
+ set(ROTATION, val);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftWitherSkullWall.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftWitherSkullWall.java
new file mode 100644
index 00000000..fa9597da
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftWitherSkullWall.java
@@ -0,0 +1,34 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftWitherSkullWall extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Directional {
+
+ public CraftWitherSkullWall() {
+ super();
+ }
+
+ public CraftWitherSkullWall(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockWitherSkullWall.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftWoodButton.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftWoodButton.java
new file mode 100644
index 00000000..79971417
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftWoodButton.java
@@ -0,0 +1,62 @@
+/**
+ * Automatically generated file, changes will be lost.
+ */
+package org.bukkit.craftbukkit.block.impl;
+
+public final class CraftWoodButton extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Switch, org.bukkit.block.data.Directional, org.bukkit.block.data.Powerable {
+
+ public CraftWoodButton() {
+ super();
+ }
+
+ public CraftWoodButton(net.minecraft.server.IBlockData state) {
+ super(state);
+ }
+
+ // org.bukkit.craftbukkit.block.data.type.CraftSwitch
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACE = getEnum(net.minecraft.server.BlockWoodButton.class, "face");
+
+ @Override
+ public Face getFace() {
+ return get(FACE, Face.class);
+ }
+
+ @Override
+ public void setFace(Face face) {
+ set(FACE, face);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftDirectional
+
+ private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockWoodButton.class, "facing");
+
+ @Override
+ public org.bukkit.block.BlockFace getFacing() {
+ return get(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ @Override
+ public void setFacing(org.bukkit.block.BlockFace facing) {
+ set(FACING, facing);
+ }
+
+ @Override
+ public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
+ return getValues(FACING, org.bukkit.block.BlockFace.class);
+ }
+
+ // org.bukkit.craftbukkit.block.data.CraftPowerable
+
+ private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockWoodButton.class, "powered");
+
+ @Override
+ public boolean isPowered() {
+ return get(POWERED);
+ }
+
+ @Override
+ public void setPowered(boolean powered) {
+ set(POWERED, powered);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/boss/CraftBossBar.java b/src/main/java/org/bukkit/craftbukkit/boss/CraftBossBar.java
index 9696fe5d..d9e54331 100644
--- a/src/main/java/org/bukkit/craftbukkit/boss/CraftBossBar.java
+++ b/src/main/java/org/bukkit/craftbukkit/boss/CraftBossBar.java
@@ -68,7 +68,7 @@ public class CraftBossBar implements BossBar {
@Override
public String getTitle() {
- return CraftChatMessage.fromComponent(handle.e());
+ return CraftChatMessage.fromComponent(handle.title);
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
index f1c1dc49..413dd35f 100644
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
@@ -18,7 +18,7 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
public Chunk callStage1(QueuedChunk queuedChunk) throws RuntimeException {
try {
ChunkRegionLoader loader = queuedChunk.loader;
- Object[] data = loader.loadChunk(queuedChunk.world, queuedChunk.x, queuedChunk.z);
+ Object[] data = loader.loadChunk(queuedChunk.world, queuedChunk.x, queuedChunk.z, (chunk) -> {});
if (data != null) {
queuedChunk.compound = (NBTTagCompound) data[1];
@@ -35,20 +35,14 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
public void callStage2(QueuedChunk queuedChunk, Chunk chunk) throws RuntimeException {
if (chunk == null) {
// If the chunk loading failed just do it synchronously (may generate)
- queuedChunk.provider.originalGetChunkAt(queuedChunk.x, queuedChunk.z);
+ // queuedChunk.provider.originalGetChunkAt(queuedChunk.x, queuedChunk.z);
return;
}
- queuedChunk.loader.loadEntities(chunk, queuedChunk.compound.getCompound("Level"), queuedChunk.world);
+ queuedChunk.loader.loadEntities(queuedChunk.compound.getCompound("Level"), chunk);
chunk.setLastSaved(queuedChunk.provider.world.getTime());
queuedChunk.provider.chunks.put(ChunkCoordIntPair.a(queuedChunk.x, queuedChunk.z), chunk);
chunk.addEntities();
-
- if (queuedChunk.provider.chunkGenerator != null) {
- queuedChunk.provider.chunkGenerator.recreateStructures(chunk, queuedChunk.x, queuedChunk.z);
- }
-
- chunk.loadNearby(queuedChunk.provider, queuedChunk.provider.chunkGenerator, false);
}
public void callStage3(QueuedChunk queuedChunk, Chunk chunk, Runnable runnable) throws RuntimeException {
diff --git a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
new file mode 100644
index 00000000..d69855ed
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
@@ -0,0 +1,56 @@
+package org.bukkit.craftbukkit.command;
+
+import com.mojang.brigadier.CommandDispatcher;
+import com.mojang.brigadier.arguments.StringArgumentType;
+import com.mojang.brigadier.builder.LiteralArgumentBuilder;
+import com.mojang.brigadier.builder.RequiredArgumentBuilder;
+import com.mojang.brigadier.context.CommandContext;
+import com.mojang.brigadier.exceptions.CommandSyntaxException;
+import com.mojang.brigadier.suggestion.SuggestionProvider;
+import com.mojang.brigadier.suggestion.Suggestions;
+import com.mojang.brigadier.suggestion.SuggestionsBuilder;
+import com.mojang.brigadier.tree.LiteralCommandNode;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Predicate;
+import net.minecraft.server.CommandListenerWrapper;
+import org.bukkit.command.Command;
+import org.bukkit.craftbukkit.CraftServer;
+
+public class BukkitCommandWrapper implements com.mojang.brigadier.Command<CommandListenerWrapper>, Predicate<CommandListenerWrapper>, SuggestionProvider<CommandListenerWrapper> {
+
+ private final CraftServer server;
+ private final Command command;
+
+ public BukkitCommandWrapper(CraftServer server, Command command) {
+ this.server = server;
+ this.command = command;
+ }
+
+ public LiteralCommandNode<CommandListenerWrapper> register(CommandDispatcher<CommandListenerWrapper> dispatcher, String label) {
+ return dispatcher.register(
+ LiteralArgumentBuilder.<CommandListenerWrapper>literal(label).requires(this).executes(this)
+ .then(RequiredArgumentBuilder.<CommandListenerWrapper, String>argument("args", StringArgumentType.greedyString()).suggests(this).executes(this))
+ );
+ }
+
+ @Override
+ public boolean test(CommandListenerWrapper wrapper) {
+ return command.testPermissionSilent(wrapper.getBukkitSender());
+ }
+
+ @Override
+ public int run(CommandContext<CommandListenerWrapper> context) throws CommandSyntaxException {
+ return server.dispatchCommand(context.getSource().getBukkitSender(), context.getInput()) ? 1 : 0;
+ }
+
+ @Override
+ public CompletableFuture<Suggestions> getSuggestions(CommandContext<CommandListenerWrapper> context, SuggestionsBuilder builder) throws CommandSyntaxException {
+ List<String> results = server.tabComplete(context.getSource().getBukkitSender(), builder.getInput(), context.getSource().getWorld(), context.getSource().getPosition(), true);
+ for (String s : results) {
+ builder.suggest(s);
+ }
+
+ return builder.buildFuture();
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java
index 251ea5e0..3ad7dfdb 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java
@@ -1,7 +1,10 @@
package org.bukkit.craftbukkit.command;
+import net.minecraft.server.CommandBlockListenerAbstract;
+import net.minecraft.server.CommandListenerWrapper;
import net.minecraft.server.ICommandListener;
import net.minecraft.server.IChatBaseComponent;
+import net.minecraft.server.Vec3D;
import org.bukkit.block.Block;
import org.bukkit.command.BlockCommandSender;
@@ -11,20 +14,21 @@ import org.bukkit.craftbukkit.util.CraftChatMessage;
* Represents input from a command block
*/
public class CraftBlockCommandSender extends ServerCommandSender implements BlockCommandSender {
- private final ICommandListener block;
+ private final CommandListenerWrapper block;
- public CraftBlockCommandSender(ICommandListener commandBlockListenerAbstract) {
+ public CraftBlockCommandSender(CommandListenerWrapper commandBlockListenerAbstract) {
super();
this.block = commandBlockListenerAbstract;
}
public Block getBlock() {
- return block.getWorld().getWorld().getBlockAt(block.getChunkCoordinates().getX(), block.getChunkCoordinates().getY(), block.getChunkCoordinates().getZ());
+ Vec3D pos = block.getPosition();
+ return block.getWorld().getWorld().getBlockAt((int) pos.x, (int) pos.y, (int) pos.z);
}
public void sendMessage(String message) {
for (IChatBaseComponent component : CraftChatMessage.fromString(message)) {
- block.sendMessage(component);
+ block.base.sendMessage(component);
}
}
@@ -46,7 +50,7 @@ public class CraftBlockCommandSender extends ServerCommandSender implements Bloc
throw new UnsupportedOperationException("Cannot change operator status of a block");
}
- public ICommandListener getTileEntity() {
+ public CommandListenerWrapper getWrapper() {
return block;
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftCommandMap.java b/src/main/java/org/bukkit/craftbukkit/command/CraftCommandMap.java
new file mode 100644
index 00000000..2fd69c0f
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/command/CraftCommandMap.java
@@ -0,0 +1,17 @@
+package org.bukkit.craftbukkit.command;
+
+import java.util.Map;
+import org.bukkit.Server;
+import org.bukkit.command.Command;
+import org.bukkit.command.SimpleCommandMap;
+
+public class CraftCommandMap extends SimpleCommandMap {
+
+ public CraftCommandMap(Server server) {
+ super(server);
+ }
+
+ public Map<String, Command> getKnownCommands() {
+ return knownCommands;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftFunctionCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftFunctionCommandSender.java
deleted file mode 100644
index 6bb69bb4..00000000
--- a/src/main/java/org/bukkit/craftbukkit/command/CraftFunctionCommandSender.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.bukkit.craftbukkit.command;
-
-import net.minecraft.server.IChatBaseComponent;
-import net.minecraft.server.ICommandListener;
-import org.bukkit.craftbukkit.util.CraftChatMessage;
-
-public class CraftFunctionCommandSender extends ServerCommandSender {
-
- private final ICommandListener handle;
-
- public CraftFunctionCommandSender(ICommandListener handle) {
- this.handle = handle;
- }
-
- @Override
- public void sendMessage(String message) {
- for (IChatBaseComponent component : CraftChatMessage.fromString(message)) {
- handle.sendMessage(component);
- }
- }
-
- @Override
- public void sendMessage(String[] messages) {
- for (String message : messages) {
- sendMessage(message);
- }
- }
-
- @Override
- public String getName() {
- return handle.getName();
- }
-
- @Override
- public boolean isOp() {
- return true;
- }
-
- @Override
- public void setOp(boolean value) {
- throw new UnsupportedOperationException("Cannot change operator status of server function sender");
- }
-
- public ICommandListener getHandle() {
- return handle;
- }
-}
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ProxiedNativeCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/ProxiedNativeCommandSender.java
index 9acd92c3..07c34cb2 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/ProxiedNativeCommandSender.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/ProxiedNativeCommandSender.java
@@ -2,7 +2,7 @@
package org.bukkit.craftbukkit.command;
import java.util.Set;
-import net.minecraft.server.ICommandListener;
+import net.minecraft.server.CommandListenerWrapper;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -14,17 +14,17 @@ import org.bukkit.plugin.Plugin;
public class ProxiedNativeCommandSender implements ProxiedCommandSender {
- private final ICommandListener orig;
+ private final CommandListenerWrapper orig;
private final CommandSender caller;
private final CommandSender callee;
- public ProxiedNativeCommandSender(ICommandListener orig, CommandSender caller, CommandSender callee) {
+ public ProxiedNativeCommandSender(CommandListenerWrapper orig, CommandSender caller, CommandSender callee) {
this.orig = orig;
this.caller = caller;
this.callee = callee;
}
- public ICommandListener getHandle() {
+ public CommandListenerWrapper getHandle() {
return orig;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
index 6247bbda..5de49fe0 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
@@ -1,12 +1,18 @@
package org.bukkit.craftbukkit.command;
-import java.util.Iterator;
+import com.google.common.base.Joiner;
+import com.mojang.brigadier.ParseResults;
+import com.mojang.brigadier.suggestion.Suggestion;
+import com.mojang.brigadier.tree.CommandNode;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
-
-import net.minecraft.server.*;
-
+import net.minecraft.server.CommandDispatcher;
+import net.minecraft.server.CommandListenerWrapper;
+import net.minecraft.server.DedicatedServer;
+import net.minecraft.server.EntityMinecartCommandBlock;
+import net.minecraft.server.MinecraftServer;
import org.apache.commons.lang.Validate;
-import org.apache.logging.log4j.Level;
import org.bukkit.Location;
import org.bukkit.command.BlockCommandSender;
import org.bukkit.command.CommandSender;
@@ -21,27 +27,23 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.minecart.CommandMinecart;
public final class VanillaCommandWrapper extends BukkitCommand {
- protected final CommandAbstract vanillaCommand;
- public VanillaCommandWrapper(CommandAbstract vanillaCommand, String usage) {
- super(vanillaCommand.getCommand(), "A Mojang provided command.", usage, vanillaCommand.getAliases());
+ private final CommandDispatcher dispatcher;
+ public final CommandNode<CommandListenerWrapper> vanillaCommand;
+
+ public VanillaCommandWrapper(CommandDispatcher dispatcher, CommandNode<CommandListenerWrapper> vanillaCommand) {
+ super(vanillaCommand.getName(), "A Mojang provided command.", vanillaCommand.getUsageText(), Collections.EMPTY_LIST);
+ this.dispatcher = dispatcher;
this.vanillaCommand = vanillaCommand;
- this.setPermission("minecraft.command." + vanillaCommand.getCommand());
+ this.setPermission(getPermission(vanillaCommand));
}
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
if (!testPermission(sender)) return true;
- ICommandListener icommandlistener = getListener(sender);
- try {
- dispatchVanillaCommand(sender, icommandlistener, args);
- } catch (CommandException commandexception) {
- // Taken from CommandHandler
- ChatMessage chatmessage = new ChatMessage(commandexception.getMessage(), commandexception.getArgs());
- chatmessage.getChatModifier().setColor(EnumChatFormat.RED);
- icommandlistener.sendMessage(chatmessage);
- }
+ CommandListenerWrapper icommandlistener = getListener(sender);
+ dispatcher.a(icommandlistener, toDispatcher(args));
return true;
}
@@ -50,135 +52,46 @@ public final class VanillaCommandWrapper extends BukkitCommand {
Validate.notNull(sender, "Sender cannot be null");
Validate.notNull(args, "Arguments cannot be null");
Validate.notNull(alias, "Alias cannot be null");
- return (List<String>) vanillaCommand.tabComplete(MinecraftServer.getServer(), getListener(sender), args, (location) == null ? null : new BlockPosition(location.getX(), location.getY(), location.getZ()));
- }
-
- public static CommandSender lastSender = null; // Nasty :(
-
- public final int dispatchVanillaCommand(CommandSender bSender, ICommandListener icommandlistener, String[] as) throws CommandException {
- // Copied from net.minecraft.server.CommandHandler
- int i = getPlayerListSize(as);
- int j = 0;
- // Some commands use the worldserver variable but we leave it full of null values,
- // so we must temporarily populate it with the world of the commandsender
- WorldServer[] prev = MinecraftServer.getServer().worldServer;
- MinecraftServer server = MinecraftServer.getServer();
- server.worldServer = new WorldServer[server.worlds.size()];
- server.worldServer[0] = (WorldServer) icommandlistener.getWorld();
- int bpos = 0;
- for (int pos = 1; pos < server.worldServer.length; pos++) {
- WorldServer world = server.worlds.get(bpos++);
- if (server.worldServer[0] == world) {
- pos--;
- continue;
- }
- server.worldServer[pos] = world;
- }
- try {
- if (vanillaCommand.canUse(server, icommandlistener)) {
- if (i > -1) {
- List<Entity> list = ((List<Entity>)PlayerSelector.getPlayers(icommandlistener, as[i], Entity.class));
- String s2 = as[i];
+ CommandListenerWrapper icommandlistener = getListener(sender);
+ ParseResults<CommandListenerWrapper> parsed = dispatcher.a().parse(toDispatcher(args), icommandlistener);
- icommandlistener.a(CommandObjectiveExecutor.EnumCommandResult.AFFECTED_ENTITIES, list.size());
- Iterator<Entity> iterator = list.iterator();
+ List<String> results = new ArrayList<>();
+ dispatcher.a().getCompletionSuggestions(parsed).thenAccept((suggestions) -> {
+ suggestions.getList().forEach((s) -> results.add(s.getText()));
+ });
- while (iterator.hasNext()) {
- Entity entity = iterator.next();
-
- CommandSender oldSender = lastSender;
- lastSender = bSender;
- try {
- as[i] = entity.getUniqueID().toString();
- vanillaCommand.execute(server, icommandlistener, as);
- j++;
- } catch (ExceptionUsage exceptionusage) {
- ChatMessage chatmessage = new ChatMessage("commands.generic.usage", new Object[] { new ChatMessage(exceptionusage.getMessage(), exceptionusage.getArgs())});
- chatmessage.getChatModifier().setColor(EnumChatFormat.RED);
- icommandlistener.sendMessage(chatmessage);
- } catch (CommandException commandexception) {
- CommandAbstract.a(icommandlistener, vanillaCommand, 0, commandexception.getMessage(), commandexception.getArgs());
- } finally {
- lastSender = oldSender;
- }
- }
- as[i] = s2;
- } else {
- icommandlistener.a(CommandObjectiveExecutor.EnumCommandResult.AFFECTED_ENTITIES, 1);
- vanillaCommand.execute(server, icommandlistener, as);
- j++;
- }
- } else {
- ChatMessage chatmessage = new ChatMessage("commands.generic.permission", new Object[0]);
- chatmessage.getChatModifier().setColor(EnumChatFormat.RED);
- icommandlistener.sendMessage(chatmessage);
- }
- } catch (ExceptionUsage exceptionusage) {
- ChatMessage chatmessage1 = new ChatMessage("commands.generic.usage", new Object[] { new ChatMessage(exceptionusage.getMessage(), exceptionusage.getArgs()) });
- chatmessage1.getChatModifier().setColor(EnumChatFormat.RED);
- icommandlistener.sendMessage(chatmessage1);
- } catch (CommandException commandexception) {
- CommandAbstract.a(icommandlistener, vanillaCommand, 0, commandexception.getMessage(), commandexception.getArgs());
- } catch (Throwable throwable) {
- ChatMessage chatmessage3 = new ChatMessage("commands.generic.exception", new Object[0]);
- chatmessage3.getChatModifier().setColor(EnumChatFormat.RED);
- icommandlistener.sendMessage(chatmessage3);
- if (icommandlistener.f() instanceof EntityMinecartCommandBlock) {
- MinecraftServer.LOGGER.log(Level.WARN, String.format("MinecartCommandBlock at (%d,%d,%d) failed to handle command", icommandlistener.getChunkCoordinates().getX(), icommandlistener.getChunkCoordinates().getY(), icommandlistener.getChunkCoordinates().getZ()), throwable);
- } else if(icommandlistener instanceof CommandBlockListenerAbstract) {
- CommandBlockListenerAbstract listener = (CommandBlockListenerAbstract) icommandlistener;
- MinecraftServer.LOGGER.log(Level.WARN, String.format("CommandBlock at (%d,%d,%d) failed to handle command", listener.getChunkCoordinates().getX(), listener.getChunkCoordinates().getY(), listener.getChunkCoordinates().getZ()), throwable);
- } else {
- MinecraftServer.LOGGER.log(Level.WARN, String.format("Unknown CommandBlock failed to handle command"), throwable);
- }
- } finally {
- icommandlistener.a(CommandObjectiveExecutor.EnumCommandResult.SUCCESS_COUNT, j);
- MinecraftServer.getServer().worldServer = prev;
- }
- return j;
+ return results;
}
- private ICommandListener getListener(CommandSender sender) {
+ private CommandListenerWrapper getListener(CommandSender sender) {
if (sender instanceof Player) {
- return ((CraftPlayer) sender).getHandle();
+ return ((CraftPlayer) sender).getHandle().getCommandListener();
}
if (sender instanceof BlockCommandSender) {
- return ((CraftBlockCommandSender) sender).getTileEntity();
+ return ((CraftBlockCommandSender) sender).getWrapper();
}
if (sender instanceof CommandMinecart) {
- return ((EntityMinecartCommandBlock) ((CraftMinecartCommand) sender).getHandle()).getCommandBlock();
+ return ((EntityMinecartCommandBlock) ((CraftMinecartCommand) sender).getHandle()).getCommandBlock().getWrapper();
}
if (sender instanceof RemoteConsoleCommandSender) {
- return ((DedicatedServer)MinecraftServer.getServer()).remoteControlCommandListener;
+ return ((DedicatedServer) MinecraftServer.getServer()).remoteControlCommandListener.f();
}
if (sender instanceof ConsoleCommandSender) {
- return ((CraftServer) sender.getServer()).getServer();
+ return ((CraftServer) sender.getServer()).getServer().getServerCommandListener();
}
if (sender instanceof ProxiedCommandSender) {
return ((ProxiedNativeCommandSender) sender).getHandle();
}
- if (sender instanceof CraftFunctionCommandSender) {
- return ((CraftFunctionCommandSender) sender).getHandle();
- }
+
throw new IllegalArgumentException("Cannot make " + sender + " a vanilla command listener");
}
- private int getPlayerListSize(String as[]) throws CommandException {
- for (int i = 0; i < as.length; i++) {
- if (vanillaCommand.isListStart(as, i) && PlayerSelector.isList(as[i])) {
- return i;
- }
- }
- return -1;
+ public static String getPermission(CommandNode<CommandListenerWrapper> vanillaCommand) {
+ return "minecraft.command." + ((vanillaCommand.getRedirect() == null) ? vanillaCommand.getName() : vanillaCommand.getRedirect().getName());
}
- public static String[] dropFirstArgument(String as[]) {
- String as1[] = new String[as.length - 1];
- for (int i = 1; i < as.length; i++) {
- as1[i - 1] = as[i];
- }
-
- return as1;
+ private String toDispatcher(String[] args) {
+ return getName() + ((args.length > 0) ? " " + Joiner.on(' ').join(args) : "");
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
index f98e3e9a..4ce44495 100644
--- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
+++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
@@ -1,6 +1,9 @@
package org.bukkit.craftbukkit.enchantments;
+import net.minecraft.server.EnchantmentBinding;
+import net.minecraft.server.EnchantmentVanishing;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.enchantments.EnchantmentTarget;
import org.bukkit.enchantments.EnchantmentWrapper;
@@ -10,7 +13,7 @@ public class CraftEnchantment extends Enchantment {
private final net.minecraft.server.Enchantment target;
public CraftEnchantment(net.minecraft.server.Enchantment target) {
- super(net.minecraft.server.Enchantment.getId(target));
+ super(CraftNamespacedKey.fromMinecraft(net.minecraft.server.Enchantment.enchantments.b(target)));
this.target = target;
}
@@ -51,6 +54,8 @@ public class CraftEnchantment extends Enchantment {
return EnchantmentTarget.BREAKABLE;
case WEARABLE:
return EnchantmentTarget.WEARABLE;
+ case TRIDENT:
+ return EnchantmentTarget.TRIDENT;
default:
return null;
}
@@ -63,7 +68,7 @@ public class CraftEnchantment extends Enchantment {
@Override
public boolean isCursed() {
- return target.isCursed();
+ return target instanceof EnchantmentBinding || target instanceof EnchantmentVanishing;
}
@Override
@@ -73,7 +78,8 @@ public class CraftEnchantment extends Enchantment {
@Override
public String getName() {
- switch (getId()) {
+ // PAIL: migration paths
+ switch (net.minecraft.server.Enchantment.enchantments.a(target)) {
case 0:
return "PROTECTION_ENVIRONMENTAL";
case 1:
@@ -96,46 +102,54 @@ public class CraftEnchantment extends Enchantment {
return "FROST_WALKER";
case 10:
return "BINDING_CURSE";
- case 16:
+ case 11:
return "DAMAGE_ALL";
- case 17:
+ case 12:
return "DAMAGE_UNDEAD";
- case 18:
+ case 13:
return "DAMAGE_ARTHROPODS";
- case 19:
+ case 14:
return "KNOCKBACK";
- case 20:
+ case 15:
return "FIRE_ASPECT";
- case 21:
+ case 16:
return "LOOT_BONUS_MOBS";
- case 22:
+ case 17:
return "SWEEPING_EDGE";
- case 32:
+ case 18:
return "DIG_SPEED";
- case 33:
+ case 19:
return "SILK_TOUCH";
- case 34:
+ case 20:
return "DURABILITY";
- case 35:
+ case 21:
return "LOOT_BONUS_BLOCKS";
- case 48:
+ case 22:
return "ARROW_DAMAGE";
- case 49:
+ case 23:
return "ARROW_KNOCKBACK";
- case 50:
+ case 24:
return "ARROW_FIRE";
- case 51:
+ case 25:
return "ARROW_INFINITE";
- case 61:
+ case 26:
return "LUCK";
- case 62:
+ case 27:
return "LURE";
- case 70:
+ case 28:
+ return "LOYALTY";
+ case 29:
+ return "IMPALING";
+ case 30:
+ return "RIPTIDE";
+ case 31:
+ return "CHANNELING";
+ case 32:
return "MENDING";
- case 71:
+ case 33:
return "VANISHING_CURSE";
default:
- return "UNKNOWN_ENCHANT_" + getId();
+ return "UNKNOWN_ENCHANT_" + getName();
}
}
@@ -160,7 +174,7 @@ public class CraftEnchantment extends Enchantment {
return false;
}
CraftEnchantment ench = (CraftEnchantment) other;
- return !target.c(ench.target);
+ return !target.b(ench.target);
}
public net.minecraft.server.Enchantment getHandle() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
index 99425767..e47080db 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
@@ -59,7 +59,7 @@ public class CraftArrow extends AbstractProjectile implements Arrow {
}
EntityArrow handle = getHandle();
- return getWorld().getBlockAt(handle.h, handle.at, handle.au); // PAIL: rename tileX, tileY, tileZ
+ return getWorld().getBlockAt(handle.tileX, handle.tileY, handle.tileZ);
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java
new file mode 100644
index 00000000..9cda680c
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java
@@ -0,0 +1,28 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.EntityCod;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.Cod;
+import org.bukkit.entity.EntityType;
+
+public class CraftCod extends CraftFish implements Cod {
+
+ public CraftCod(CraftServer server, EntityCod entity) {
+ super(server, entity);
+ }
+
+ @Override
+ public EntityCod getHandle() {
+ return (EntityCod) super.getHandle();
+ }
+
+ @Override
+ public String toString() {
+ return "CraftCod";
+ }
+
+ @Override
+ public EntityType getType() {
+ return EntityType.COD;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java
new file mode 100644
index 00000000..7a838f38
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java
@@ -0,0 +1,28 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.EntityDolphin;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.Dolphin;
+import org.bukkit.entity.EntityType;
+
+public class CraftDolphin extends CraftCreature implements Dolphin {
+
+ public CraftDolphin(CraftServer server, EntityDolphin entity) {
+ super(server, entity);
+ }
+
+ @Override
+ public EntityDolphin getHandle() {
+ return (EntityDolphin) super.getHandle();
+ }
+
+ @Override
+ public String toString() {
+ return "CraftDolphin";
+ }
+
+ @Override
+ public EntityType getType() {
+ return EntityType.DOLPHIN;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java
new file mode 100644
index 00000000..6e41dfd9
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java
@@ -0,0 +1,28 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.EntityDrowned;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.Drowned;
+import org.bukkit.entity.EntityType;
+
+public class CraftDrowned extends CraftZombie implements Drowned {
+
+ public CraftDrowned(CraftServer server, EntityDrowned entity) {
+ super(server, entity);
+ }
+
+ @Override
+ public EntityDrowned getHandle() {
+ return (EntityDrowned) entity;
+ }
+
+ @Override
+ public String toString() {
+ return "CraftDrowned";
+ }
+
+ @Override
+ public EntityType getType() {
+ return EntityType.DROWNED;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java
index aaa624ae..d771fdc6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java
@@ -30,7 +30,7 @@ public class CraftEnderSignal extends CraftEntity implements EnderSignal {
@Override
public Location getTargetLocation() {
- return new Location(getWorld(), getHandle().a, getHandle().b, getHandle().c, getHandle().yaw, getHandle().pitch); // PAIL rename targetX, targetY, targetZ
+ return new Location(getWorld(), getHandle().targetX, getHandle().targetY, getHandle().targetZ, getHandle().yaw, getHandle().pitch);
}
@Override
@@ -41,21 +41,21 @@ public class CraftEnderSignal extends CraftEntity implements EnderSignal {
@Override
public boolean getDropItem() {
- return getHandle().e; // PAIL rename getDropItem
+ return getHandle().shouldDropItem;
}
@Override
public void setDropItem(boolean shouldDropItem) {
- getHandle().e = shouldDropItem; // PAIL rename getDropItem
+ getHandle().shouldDropItem = shouldDropItem;
}
@Override
public int getDespawnTimer() {
- return getHandle().d; // PAIL rename despawnTimer
+ return getHandle().despawnTimer;
}
@Override
public void setDespawnTimer(int time) {
- getHandle().d = time; // PAIL rename despawnTimer
+ getHandle().despawnTimer = time;
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
index f602c231..5998530a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
@@ -3,8 +3,9 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityEnderman;
import net.minecraft.server.IBlockData;
-import org.bukkit.Material;
+import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.entity.Enderman;
import org.bukkit.entity.EntityType;
@@ -17,11 +18,22 @@ public class CraftEnderman extends CraftMonster implements Enderman {
public MaterialData getCarriedMaterial() {
IBlockData blockData = getHandle().getCarried();
- return (blockData == null) ? Material.AIR.getNewData((byte) 0) : CraftMagicNumbers.getMaterial(blockData.getBlock()).getNewData((byte) blockData.getBlock().toLegacyData(blockData));
+ return CraftMagicNumbers.getMaterial(blockData);
+ }
+
+ @Override
+ public BlockData getCarriedBlock() {
+ IBlockData blockData = getHandle().getCarried();
+ return CraftBlockData.fromData(blockData);
}
public void setCarriedMaterial(MaterialData data) {
- getHandle().setCarried(CraftMagicNumbers.getBlock(data.getItemTypeId()).fromLegacyData(data.getData()));
+ getHandle().setCarried(CraftMagicNumbers.getBlock(data));
+ }
+
+ @Override
+ public void setCarriedBlock(BlockData blockData) {
+ getHandle().setCarried(((CraftBlockData) blockData).getState());
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 961cf24c..f0a52de5 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -16,6 +16,7 @@ import org.bukkit.World;
import org.bukkit.block.PistonMoveReaction;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
+import org.bukkit.craftbukkit.util.CraftChatMessage;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.metadata.MetadataValue;
@@ -52,6 +53,14 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
// Water Animals
else if (entity instanceof EntityWaterAnimal) {
if (entity instanceof EntitySquid) { return new CraftSquid(server, (EntitySquid) entity); }
+ else if (entity instanceof EntityFish) {
+ if (entity instanceof EntityCod) { return new CraftCod(server, (EntityCod) entity); }
+ else if (entity instanceof EntityPufferFish) { return new CraftPufferFish(server, (EntityPufferFish) entity); }
+ else if (entity instanceof EntitySalmon) { return new CraftSalmon(server, (EntitySalmon) entity); }
+ else if (entity instanceof EntityTropicalFish) { return new CraftTropicalFish(server, (EntityTropicalFish) entity); }
+ else { return new CraftFish(server, (EntityFish) entity); }
+ }
+ else if (entity instanceof EntityDolphin) { return new CraftDolphin(server, (EntityDolphin) entity); }
else { return new CraftWaterMob(server, (EntityWaterAnimal) entity); }
}
else if (entity instanceof EntityCreature) {
@@ -80,6 +89,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
else if (entity instanceof EntityRabbit) { return new CraftRabbit(server, (EntityRabbit) entity); }
else if (entity instanceof EntityPolarBear) { return new CraftPolarBear(server, (EntityPolarBear) entity); }
+ else if (entity instanceof EntityTurtle) { return new CraftTurtle(server, (EntityTurtle) entity); }
else { return new CraftAnimals(server, (EntityAnimal) entity); }
}
// Monsters
@@ -88,6 +98,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
if (entity instanceof EntityPigZombie) { return new CraftPigZombie(server, (EntityPigZombie) entity); }
else if (entity instanceof EntityZombieHusk) { return new CraftHusk(server, (EntityZombieHusk) entity); }
else if (entity instanceof EntityZombieVillager) { return new CraftVillagerZombie(server, (EntityZombieVillager) entity); }
+ else if (entity instanceof EntityDrowned) { return new CraftDrowned(server, (EntityDrowned) entity); }
else { return new CraftZombie(server, (EntityZombie) entity); }
}
else if (entity instanceof EntityCreeper) { return new CraftCreeper(server, (EntityCreeper) entity); }
@@ -140,6 +151,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
// Flying
else if (entity instanceof EntityFlying) {
if (entity instanceof EntityGhast) { return new CraftGhast(server, (EntityGhast) entity); }
+ else if (entity instanceof EntityPhantom) { return new CraftPhantom(server, (EntityPhantom) entity); }
else { return new CraftFlying(server, (EntityFlying) entity); }
}
else if (entity instanceof EntityEnderDragon) {
@@ -164,7 +176,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
else { return new CraftArrow(server, (EntityArrow) entity); }
}
else if (entity instanceof EntitySpectralArrow) { return new CraftSpectralArrow(server, (EntitySpectralArrow) entity); }
- else if (entity instanceof EntityArrow) { return new CraftArrow(server, (EntityArrow) entity); }
+ else if (entity instanceof EntityArrow) {
+ if (entity instanceof EntityThrownTrident) { return new CraftTrident(server, (EntityThrownTrident) entity); }
+ else { return new CraftArrow(server, (EntityArrow) entity); }
+ }
else if (entity instanceof EntityBoat) { return new CraftBoat(server, (EntityBoat) entity); }
else if (entity instanceof EntityProjectile) {
if (entity instanceof EntityEgg) { return new CraftEgg(server, (EntityEgg) entity); }
@@ -186,7 +201,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
else if (entity instanceof EntityEnderSignal) { return new CraftEnderSignal(server, (EntityEnderSignal) entity); }
else if (entity instanceof EntityEnderCrystal) { return new CraftEnderCrystal(server, (EntityEnderCrystal) entity); }
- else if (entity instanceof EntityFishingHook) { return new CraftFish(server, (EntityFishingHook) entity); }
+ else if (entity instanceof EntityFishingHook) { return new CraftFishHook(server, (EntityFishingHook) entity); }
else if (entity instanceof EntityItem) { return new CraftItem(server, (EntityItem) entity); }
else if (entity instanceof EntityWeather) {
if (entity instanceof EntityLightning) { return new CraftLightningStrike(server, (EntityLightning) entity); }
@@ -507,7 +522,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return null;
}
- return getHandle().bJ().getBukkitEntity(); // PAIL: rename getVehicle() -> getRootVehicle(), bJ() -> getVehicle()
+ return getHandle().getVehicle().getBukkitEntity();
}
@Override
@@ -516,18 +531,23 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
name = "";
}
- getHandle().setCustomName(name);
+ // sane limit for name length
+ if (name.length() > 256) {
+ name = name.substring(0, 256);
+ }
+
+ getHandle().setCustomName(CraftChatMessage.fromStringOrNull(name));
}
@Override
public String getCustomName() {
- String name = getHandle().getCustomName();
+ IChatBaseComponent name = getHandle().getCustomName();
- if (name == null || name.length() == 0) {
+ if (name == null) {
return null;
}
- return name;
+ return CraftChatMessage.fromComponent(name);
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java
index b0a7f639..b4322dff 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java
@@ -3,7 +3,9 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityFallingBlock;
import org.bukkit.Material;
+import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.FallingBlock;
@@ -29,15 +31,11 @@ public class CraftFallingBlock extends CraftEntity implements FallingBlock {
}
public Material getMaterial() {
- return Material.getMaterial(getBlockId());
+ return CraftMagicNumbers.getMaterial(getHandle().getBlock()).getItemType();
}
- public int getBlockId() {
- return CraftMagicNumbers.getId(getHandle().getBlock().getBlock());
- }
-
- public byte getBlockData() {
- return (byte) getHandle().getBlock().getBlock().toLegacyData(getHandle().getBlock());
+ public BlockData getBlockData() {
+ return CraftBlockData.fromData(getHandle().getBlock());
}
public boolean getDropItem() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
index 99746b3c..7b3b2068 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
@@ -24,15 +24,15 @@ public class CraftFirework extends CraftEntity implements Firework {
ItemStack item = getHandle().getDataWatcher().get(EntityFireworks.FIREWORK_ITEM);
if (item.isEmpty()) {
- item = new ItemStack(Items.FIREWORKS);
+ item = new ItemStack(Items.FIREWORK_ROCKET);
getHandle().getDataWatcher().set(EntityFireworks.FIREWORK_ITEM, item);
}
this.item = CraftItemStack.asCraftMirror(item);
// Ensure the item is a firework...
- if (this.item.getType() != Material.FIREWORK) {
- this.item.setType(Material.FIREWORK);
+ if (this.item.getType() != Material.FIREWORK_ROCKET) {
+ this.item.setType(Material.FIREWORK_ROCKET);
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java
index d555597d..aaa6bed3 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java
@@ -1,65 +1,22 @@
package org.bukkit.craftbukkit.entity;
-import net.minecraft.server.BlockPosition;
-import net.minecraft.server.EntityFishingHook;
-import net.minecraft.server.EntityHuman;
-import net.minecraft.server.MathHelper;
-
-import org.apache.commons.lang.Validate;
+import net.minecraft.server.EntityFish;
import org.bukkit.craftbukkit.CraftServer;
-import org.bukkit.entity.EntityType;
import org.bukkit.entity.Fish;
-import org.bukkit.projectiles.ProjectileSource;
-public class CraftFish extends AbstractProjectile implements Fish {
- private double biteChance = -1;
+public class CraftFish extends CraftCreature implements Fish {
- public CraftFish(CraftServer server, EntityFishingHook entity) {
+ public CraftFish(CraftServer server, EntityFish entity) {
super(server, entity);
}
- public ProjectileSource getShooter() {
- if (getHandle().owner != null) {
- return getHandle().owner.getBukkitEntity();
- }
-
- return null;
- }
-
- public void setShooter(ProjectileSource shooter) {
- if (shooter instanceof CraftHumanEntity) {
- getHandle().owner = (EntityHuman) ((CraftHumanEntity) shooter).entity;
- }
- }
-
@Override
- public EntityFishingHook getHandle() {
- return (EntityFishingHook) entity;
+ public EntityFish getHandle() {
+ return (EntityFish) entity;
}
@Override
public String toString() {
return "CraftFish";
}
-
- public EntityType getType() {
- return EntityType.FISHING_HOOK;
- }
-
- public double getBiteChance() {
- EntityFishingHook hook = getHandle();
-
- if (this.biteChance == -1) {
- if (hook.world.isRainingAt(new BlockPosition(MathHelper.floor(hook.locX), MathHelper.floor(hook.locY) + 1, MathHelper.floor(hook.locZ)))) {
- return 1/300.0;
- }
- return 1/500.0;
- }
- return this.biteChance;
- }
-
- public void setBiteChance(double chance) {
- Validate.isTrue(chance >= 0 && chance <= 1, "The bite chance must be between 0 and 1.");
- this.biteChance = chance;
- }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
new file mode 100644
index 00000000..8392b16b
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
@@ -0,0 +1,65 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.BlockPosition;
+import net.minecraft.server.EntityFishingHook;
+import net.minecraft.server.EntityHuman;
+import net.minecraft.server.MathHelper;
+
+import org.apache.commons.lang.Validate;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.FishHook;
+import org.bukkit.projectiles.ProjectileSource;
+
+public class CraftFishHook extends AbstractProjectile implements FishHook {
+ private double biteChance = -1;
+
+ public CraftFishHook(CraftServer server, EntityFishingHook entity) {
+ super(server, entity);
+ }
+
+ public ProjectileSource getShooter() {
+ if (getHandle().owner != null) {
+ return getHandle().owner.getBukkitEntity();
+ }
+
+ return null;
+ }
+
+ public void setShooter(ProjectileSource shooter) {
+ if (shooter instanceof CraftHumanEntity) {
+ getHandle().owner = (EntityHuman) ((CraftHumanEntity) shooter).entity;
+ }
+ }
+
+ @Override
+ public EntityFishingHook getHandle() {
+ return (EntityFishingHook) entity;
+ }
+
+ @Override
+ public String toString() {
+ return "CraftFishingHook";
+ }
+
+ public EntityType getType() {
+ return EntityType.FISHING_HOOK;
+ }
+
+ public double getBiteChance() {
+ EntityFishingHook hook = getHandle();
+
+ if (this.biteChance == -1) {
+ if (hook.world.isRainingAt(new BlockPosition(MathHelper.floor(hook.locX), MathHelper.floor(hook.locY) + 1, MathHelper.floor(hook.locZ)))) {
+ return 1/300.0;
+ }
+ return 1/500.0;
+ }
+ return this.biteChance;
+ }
+
+ public void setBiteChance(double chance) {
+ Validate.isTrue(chance >= 0 && chance <= 1, "The bite chance must be between 0 and 1.");
+ this.biteChance = chance;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index a54548f0..269bbd8e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -48,10 +48,6 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
enderChest = new CraftInventory(entity.getEnderChest());
}
- public String getName() {
- return getHandle().getName();
- }
-
public PlayerInventory getInventory() {
return inventory;
}
@@ -295,7 +291,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
public InventoryView openWorkbench(Location location, boolean force) {
if (!force) {
Block block = location.getBlock();
- if (block.getType() != Material.WORKBENCH) {
+ if (block.getType() != Material.CRAFTING_TABLE) {
return null;
}
}
@@ -312,7 +308,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
public InventoryView openEnchanting(Location location, boolean force) {
if (!force) {
Block block = location.getBlock();
- if (block.getType() != Material.ENCHANTMENT_TABLE) {
+ if (block.getType() != Material.ENCHANTING_TABLE) {
return null;
}
}
@@ -325,7 +321,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
TileEntity container = getHandle().world.getTileEntity(pos);
if (container == null && force) {
container = new TileEntityEnchantTable();
- container.a(getHandle().world);
+ container.setWorld(getHandle().world);
container.setPosition(pos);
}
getHandle().openTileEntity((ITileEntityContainer) container);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index bf4428e1..0b12ed81 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -27,6 +27,7 @@ import net.minecraft.server.EntitySnowball;
import net.minecraft.server.EntityThrownExpBottle;
import net.minecraft.server.EntityTippedArrow;
import net.minecraft.server.EntitySpectralArrow;
+import net.minecraft.server.EntityThrownTrident;
import net.minecraft.server.EntityWither;
import net.minecraft.server.EntityWitherSkull;
import net.minecraft.server.GenericAttributes;
@@ -65,6 +66,7 @@ import org.bukkit.entity.SpectralArrow;
import org.bukkit.entity.ThrownExpBottle;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.entity.TippedArrow;
+import org.bukkit.entity.Trident;
import org.bukkit.entity.WitherSkull;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.inventory.EntityEquipment;
@@ -318,6 +320,8 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
((EntityTippedArrow) launch).setType(CraftPotionUtil.fromBukkit(new PotionData(PotionType.WATER, false, false)));
} else if (SpectralArrow.class.isAssignableFrom(projectile)) {
launch = new EntitySpectralArrow(world, getHandle());
+ } else if (Trident.class.isAssignableFrom(projectile)) {
+ launch = new EntityThrownTrident(world, getHandle(), net.minecraft.server.ItemStack.a);
} else {
launch = new EntityTippedArrow(world, getHandle());
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
index 48599877..7d319812 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
@@ -4,7 +4,9 @@ import net.minecraft.server.Blocks;
import net.minecraft.server.EntityMinecartAbstract;
import net.minecraft.server.IBlockData;
+import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.entity.Minecart;
import org.bukkit.material.MaterialData;
@@ -64,7 +66,19 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart {
public void setDisplayBlock(MaterialData material) {
if(material != null) {
- IBlockData block = CraftMagicNumbers.getBlock(material.getItemTypeId()).fromLegacyData(material.getData());
+ IBlockData block = CraftMagicNumbers.getBlock(material);
+ this.getHandle().setDisplayBlock(block);
+ } else {
+ // Set block to air (default) and set the flag to not have a display block.
+ this.getHandle().setDisplayBlock(Blocks.AIR.getBlockData());
+ this.getHandle().a(false);
+ }
+ }
+
+ @Override
+ public void setDisplayBlockData(BlockData blockData) {
+ if (blockData != null) {
+ IBlockData block = ((CraftBlockData) blockData).getState();
this.getHandle().setDisplayBlock(block);
} else {
// Set block to air (default) and set the flag to not have a display block.
@@ -75,7 +89,13 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart {
public MaterialData getDisplayBlock() {
IBlockData blockData = getHandle().getDisplayBlock();
- return CraftMagicNumbers.getMaterial(blockData.getBlock()).getNewData((byte) blockData.getBlock().toLegacyData(blockData));
+ return CraftMagicNumbers.getMaterial(blockData);
+ }
+
+ @Override
+ public BlockData getDisplayBlockData() {
+ IBlockData blockData = getHandle().getDisplayBlock();
+ return CraftBlockData.fromData(blockData);
}
public void setDisplayBlockOffset(int offset) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java
index 58f3cf78..b178acd4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java
@@ -7,6 +7,7 @@ import net.minecraft.server.EntityMinecartCommandBlock;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.craftbukkit.util.CraftChatMessage;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.minecart.CommandMinecart;
import org.bukkit.permissions.PermissibleBase;
@@ -40,7 +41,7 @@ public class CraftMinecartCommand extends CraftMinecart implements CommandMineca
@Override
public void setName(String name) {
- getHandle().getCommandBlock().setName(name != null ? name : "@");
+ getHandle().getCommandBlock().setName(CraftChatMessage.fromStringOrNull(name));
}
@Override
@@ -63,7 +64,7 @@ public class CraftMinecartCommand extends CraftMinecart implements CommandMineca
@Override
public String getName() {
- return getHandle().getCommandBlock().getName();
+ return CraftChatMessage.fromComponent(getHandle().getCommandBlock().getName());
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java
index 3e9448a9..9c29a56d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java
@@ -1,7 +1,7 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityPainting;
-import net.minecraft.server.EntityPainting.EnumArt;
+import net.minecraft.server.Paintings;
import net.minecraft.server.WorldServer;
import org.bukkit.Art;
@@ -19,7 +19,7 @@ public class CraftPainting extends CraftHanging implements Painting {
}
public Art getArt() {
- EnumArt art = getHandle().art;
+ Paintings art = getHandle().art;
return CraftArt.NotchToBukkit(art);
}
@@ -29,7 +29,7 @@ public class CraftPainting extends CraftHanging implements Painting {
public boolean setArt(Art art, boolean force) {
EntityPainting painting = this.getHandle();
- EnumArt oldArt = painting.art;
+ Paintings oldArt = painting.art;
painting.art = CraftArt.BukkitToNotch(art);
painting.setDirection(painting.direction);
if (!force && !painting.survives()) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
new file mode 100644
index 00000000..9f9ee923
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
@@ -0,0 +1,38 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.EntityPhantom;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Phantom;
+
+public class CraftPhantom extends CraftFlying implements Phantom {
+
+ public CraftPhantom(CraftServer server, EntityPhantom entity) {
+ super(server, entity);
+ }
+
+ @Override
+ public EntityPhantom getHandle() {
+ return (EntityPhantom) super.getHandle();
+ }
+
+ @Override
+ public int getSize() {
+ return getHandle().getSize();
+ }
+
+ @Override
+ public void setSize(int sz) {
+ getHandle().setSize(sz);
+ }
+
+ @Override
+ public String toString() {
+ return "CraftPhantom";
+ }
+
+ @Override
+ public EntityType getType() {
+ return EntityType.PHANTOM;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 4c44a198..042287e4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -24,8 +24,46 @@ import java.util.WeakHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
-import net.minecraft.server.*;
-import net.minecraft.server.PacketPlayOutTitle.EnumTitleAction;
+import net.minecraft.server.AdvancementDataPlayer;
+import net.minecraft.server.AdvancementProgress;
+import net.minecraft.server.AttributeInstance;
+import net.minecraft.server.AttributeMapServer;
+import net.minecraft.server.AttributeModifiable;
+import net.minecraft.server.AttributeRanged;
+import net.minecraft.server.BlockPosition;
+import net.minecraft.server.Container;
+import net.minecraft.server.Entity;
+import net.minecraft.server.EntityHuman;
+import net.minecraft.server.EntityLiving;
+import net.minecraft.server.EntityPlayer;
+import net.minecraft.server.EntityTracker;
+import net.minecraft.server.EntityTrackerEntry;
+import net.minecraft.server.EnumChatFormat;
+import net.minecraft.server.EnumGamemode;
+import net.minecraft.server.IChatBaseComponent;
+import net.minecraft.server.MapIcon;
+import net.minecraft.server.MinecraftKey;
+import net.minecraft.server.NBTTagCompound;
+import net.minecraft.server.PacketDataSerializer;
+import net.minecraft.server.PacketPlayOutBlockChange;
+import net.minecraft.server.PacketPlayOutChat;
+import net.minecraft.server.PacketPlayOutCustomPayload;
+import net.minecraft.server.PacketPlayOutCustomSoundEffect;
+import net.minecraft.server.PacketPlayOutMap;
+import net.minecraft.server.PacketPlayOutNamedSoundEffect;
+import net.minecraft.server.PacketPlayOutPlayerInfo;
+import net.minecraft.server.PacketPlayOutSpawnPosition;
+import net.minecraft.server.PacketPlayOutStopSound;
+import net.minecraft.server.PacketPlayOutTitle;
+import net.minecraft.server.PacketPlayOutUpdateAttributes;
+import net.minecraft.server.PacketPlayOutUpdateHealth;
+import net.minecraft.server.PacketPlayOutWorldEvent;
+import net.minecraft.server.PacketPlayOutWorldParticles;
+import net.minecraft.server.PlayerConnection;
+import net.minecraft.server.TileEntitySign;
+import net.minecraft.server.Vec3D;
+import net.minecraft.server.WhiteListEntry;
+import net.minecraft.server.WorldServer;
import org.apache.commons.lang.Validate;
import org.apache.commons.lang.NotImplementedException;
@@ -36,12 +74,14 @@ import org.bukkit.Statistic;
import org.bukkit.Material;
import org.bukkit.Statistic.Type;
import org.bukkit.World;
+import org.bukkit.block.data.BlockData;
import org.bukkit.configuration.serialization.DelegateDeserialization;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
import org.bukkit.conversations.ManuallyAbandonedConversationCanceller;
import org.bukkit.craftbukkit.CraftParticle;
import org.bukkit.craftbukkit.block.CraftSign;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.conversations.ConversationTracker;
import org.bukkit.craftbukkit.CraftEffect;
import org.bukkit.craftbukkit.CraftOfflinePlayer;
@@ -58,7 +98,6 @@ import org.bukkit.craftbukkit.util.CraftChatMessage;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
-import org.bukkit.event.player.PlayerGameModeChangeEvent;
import org.bukkit.event.player.PlayerRegisterChannelEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerUnregisterChannelEvent;
@@ -66,7 +105,6 @@ import org.bukkit.inventory.InventoryView.Property;
import org.bukkit.map.MapCursor;
import org.bukkit.map.MapView;
import org.bukkit.metadata.MetadataValue;
-import org.bukkit.plugin.IllegalPluginAccessException;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.messaging.StandardMessenger;
import org.bukkit.scoreboard.Scoreboard;
@@ -182,7 +220,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (name == null) {
name = getName();
}
- getHandle().listName = name.equals(getName()) ? null : CraftChatMessage.fromString(name)[0];
+ getHandle().listName = name.equals(getName()) ? null : CraftChatMessage.fromStringOrNull(name);
for (EntityPlayer player : (List<EntityPlayer>)server.getHandle().players) {
if (player.getBukkitEntity().canSee(this)) {
player.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_DISPLAY_NAME, getHandle()));
@@ -347,7 +385,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void playSound(Location loc, String sound, org.bukkit.SoundCategory category, float volume, float pitch) {
if (loc == null || sound == null || category == null || getHandle().playerConnection == null) return;
- PacketPlayOutCustomSoundEffect packet = new PacketPlayOutCustomSoundEffect(sound, net.minecraft.server.SoundCategory.valueOf(category.name()), loc.getX(), loc.getY(), loc.getZ(), volume, pitch);
+ PacketPlayOutCustomSoundEffect packet = new PacketPlayOutCustomSoundEffect(new MinecraftKey(sound), net.minecraft.server.SoundCategory.valueOf(category.name()), new Vec3D(loc.getX(), loc.getY(), loc.getZ()), volume, pitch);
getHandle().playerConnection.sendPacket(packet);
}
@@ -369,11 +407,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void stopSound(String sound, org.bukkit.SoundCategory category) {
if (getHandle().playerConnection == null) return;
- PacketDataSerializer packetdataserializer = new PacketDataSerializer(Unpooled.buffer());
- packetdataserializer.a(category == null ? "" : net.minecraft.server.SoundCategory.valueOf(category.name()).a());
- packetdataserializer.a(sound);
- getHandle().playerConnection.sendPacket(new PacketPlayOutCustomPayload("MC|StopSound", packetdataserializer));
+ getHandle().playerConnection.sendPacket(new PacketPlayOutStopSound(new MinecraftKey(sound), category == null ? net.minecraft.server.SoundCategory.MASTER : net.minecraft.server.SoundCategory.valueOf(category.name())));
}
@Override
@@ -399,16 +434,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void sendBlockChange(Location loc, Material material, byte data) {
- sendBlockChange(loc, material.getId(), data);
+ if (getHandle().playerConnection == null) return;
+
+ PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange(((CraftWorld) loc.getWorld()).getHandle(), new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
+
+ packet.block = CraftMagicNumbers.getBlock(material, data);
+ getHandle().playerConnection.sendPacket(packet);
}
@Override
- public void sendBlockChange(Location loc, int material, byte data) {
+ public void sendBlockChange(Location loc, BlockData block) {
if (getHandle().playerConnection == null) return;
PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange(((CraftWorld) loc.getWorld()).getHandle(), new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
- packet.block = CraftMagicNumbers.getBlock(material).fromLegacyData(data);
+ packet.block = ((CraftBlockData) block).getState();
getHandle().playerConnection.sendPacket(packet);
}
@@ -477,7 +517,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
Collection<MapIcon> icons = new ArrayList<MapIcon>();
for (MapCursor cursor : data.cursors) {
if (cursor.isVisible()) {
- icons.add(new MapIcon(MapIcon.Type.a(cursor.getRawType()), cursor.getX(), cursor.getY(), cursor.getDirection()));
+ icons.add(new MapIcon(MapIcon.Type.a(cursor.getRawType()), cursor.getX(), cursor.getY(), cursor.getDirection(), CraftChatMessage.fromStringOrNull(cursor.getCaption())));
}
}
@@ -783,9 +823,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void setWhitelisted(boolean value) {
if (value) {
- server.getHandle().addWhitelist(getProfile());
+ server.getHandle().getWhitelist().add(new WhiteListEntry(getProfile()));
} else {
- server.getHandle().removeWhitelist(getProfile());
+ server.getHandle().getWhitelist().remove(getProfile());
}
}
@@ -1129,7 +1169,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (getHandle().playerConnection == null) return;
if (channels.contains(channel)) {
- PacketPlayOutCustomPayload packet = new PacketPlayOutCustomPayload(channel, new PacketDataSerializer(Unpooled.wrappedBuffer(message)));
+ channel = StandardMessenger.validateAndCorrectChannel(channel);
+ PacketPlayOutCustomPayload packet = new PacketPlayOutCustomPayload(new MinecraftKey(channel), new PacketDataSerializer(Unpooled.wrappedBuffer(message)));
getHandle().playerConnection.sendPacket(packet);
}
}
@@ -1156,12 +1197,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void addChannel(String channel) {
+ channel = StandardMessenger.validateAndCorrectChannel(channel);
if (channels.add(channel)) {
server.getPluginManager().callEvent(new PlayerRegisterChannelEvent(this, channel));
}
}
public void removeChannel(String channel) {
+ channel = StandardMessenger.validateAndCorrectChannel(channel);
if (channels.remove(channel)) {
server.getPluginManager().callEvent(new PlayerUnregisterChannelEvent(this, channel));
}
@@ -1188,7 +1231,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
}
- getHandle().playerConnection.sendPacket(new PacketPlayOutCustomPayload("REGISTER", new PacketDataSerializer(Unpooled.wrappedBuffer(stream.toByteArray()))));
+ getHandle().playerConnection.sendPacket(new PacketPlayOutCustomPayload(new MinecraftKey("register"), new PacketDataSerializer(Unpooled.wrappedBuffer(stream.toByteArray()))));
}
}
@@ -1290,7 +1333,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public float getFlySpeed() {
- return getHandle().abilities.flySpeed * 2f;
+ return (float) getHandle().abilities.flySpeed * 2f;
}
@Override
@@ -1436,19 +1479,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
getHandle().playerConnection.sendPacket(times);
if (title != null) {
- PacketPlayOutTitle packetTitle = new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(title)[0]);
+ PacketPlayOutTitle packetTitle = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TITLE, CraftChatMessage.fromStringOrNull(title));
getHandle().playerConnection.sendPacket(packetTitle);
}
if (subtitle != null) {
- PacketPlayOutTitle packetSubtitle = new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(subtitle)[0]);
+ PacketPlayOutTitle packetSubtitle = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.SUBTITLE, CraftChatMessage.fromStringOrNull(subtitle));
getHandle().playerConnection.sendPacket(packetSubtitle);
}
}
@Override
public void resetTitle() {
- PacketPlayOutTitle packetReset = new PacketPlayOutTitle(EnumTitleAction.RESET, null);
+ PacketPlayOutTitle packetReset = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.RESET, null);
getHandle().playerConnection.sendPacket(packetReset);
}
@@ -1512,7 +1555,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (data != null && !particle.getDataType().isInstance(data)) {
throw new IllegalArgumentException("data should be " + particle.getDataType() + " got " + data.getClass());
}
- PacketPlayOutWorldParticles packetplayoutworldparticles = new PacketPlayOutWorldParticles(CraftParticle.toNMS(particle), true, (float) x, (float) y, (float) z, (float) offsetX, (float) offsetY, (float) offsetZ, (float) extra, count, CraftParticle.toData(particle, data));
+ PacketPlayOutWorldParticles packetplayoutworldparticles = new PacketPlayOutWorldParticles(CraftParticle.toNMS(particle, data), true, (float) x, (float) y, (float) z, (float) offsetX, (float) offsetY, (float) offsetZ, (float) extra, count);
getHandle().playerConnection.sendPacket(packetplayoutworldparticles);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java
index 6cf74ce8..335acc24 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java
@@ -19,12 +19,10 @@ public abstract class CraftProjectile extends AbstractProjectile implements Proj
public void setShooter(ProjectileSource shooter) {
if (shooter instanceof CraftLivingEntity) {
getHandle().shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
- if (shooter instanceof CraftHumanEntity) {
- getHandle().shooterName = ((CraftHumanEntity) shooter).getName();
- }
+ getHandle().shooterId = ((CraftLivingEntity) shooter).getUniqueId();
} else {
getHandle().shooter = null;
- getHandle().shooterName = null;
+ getHandle().shooterId = null;
}
getHandle().projectileSource = shooter;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPufferFish.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPufferFish.java
new file mode 100644
index 00000000..2701de75
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPufferFish.java
@@ -0,0 +1,38 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.EntityPufferFish;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.PufferFish;
+import org.bukkit.entity.EntityType;
+
+public class CraftPufferFish extends CraftFish implements PufferFish {
+
+ public CraftPufferFish(CraftServer server, EntityPufferFish entity) {
+ super(server, entity);
+ }
+
+ @Override
+ public EntityPufferFish getHandle() {
+ return (EntityPufferFish) super.getHandle();
+ }
+
+ @Override
+ public int getPuffState() {
+ return getHandle().getPuffState();
+ }
+
+ @Override
+ public void setPuffState(int state) {
+ getHandle().setPuffState(state);
+ }
+
+ @Override
+ public String toString() {
+ return "CraftPufferFish";
+ }
+
+ @Override
+ public EntityType getType() {
+ return EntityType.PUFFERFISH;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java
new file mode 100644
index 00000000..4d91f576
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java
@@ -0,0 +1,28 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.EntitySalmon;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.Salmon;
+import org.bukkit.entity.EntityType;
+
+public class CraftSalmon extends CraftFish implements Salmon {
+
+ public CraftSalmon(CraftServer server, EntitySalmon entity) {
+ super(server, entity);
+ }
+
+ @Override
+ public EntitySalmon getHandle() {
+ return (EntitySalmon) super.getHandle();
+ }
+
+ @Override
+ public String toString() {
+ return "CraftSalmon";
+ }
+
+ @Override
+ public EntityType getType() {
+ return EntityType.SALMON;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
new file mode 100644
index 00000000..0518e6c6
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
@@ -0,0 +1,28 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.EntityThrownTrident;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Trident;
+
+public class CraftTrident extends CraftArrow implements Trident {
+
+ public CraftTrident(CraftServer server, EntityThrownTrident entity) {
+ super(server, entity);
+ }
+
+ @Override
+ public EntityThrownTrident getHandle() {
+ return (EntityThrownTrident) super.getHandle();
+ }
+
+ @Override
+ public String toString() {
+ return "CraftTrident";
+ }
+
+ @Override
+ public EntityType getType() {
+ return EntityType.TRIDENT;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java
new file mode 100644
index 00000000..42d1d4de
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java
@@ -0,0 +1,111 @@
+package org.bukkit.craftbukkit.entity;
+
+import java.util.HashMap;
+import java.util.Map;
+import net.minecraft.server.EntityTropicalFish;
+import org.bukkit.DyeColor;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.TropicalFish;
+
+public class CraftTropicalFish extends CraftFish implements TropicalFish {
+
+ public CraftTropicalFish(CraftServer server, EntityTropicalFish entity) {
+ super(server, entity);
+ }
+
+ @Override
+ public EntityTropicalFish getHandle() {
+ return (EntityTropicalFish) entity;
+ }
+
+ @Override
+ public String toString() {
+ return "CraftTropicalFish";
+ }
+
+ @Override
+ public DyeColor getPatternColor() {
+ return getPatternColor(getHandle().getVariant());
+ }
+
+ @Override
+ public void setPatternColor(DyeColor color) {
+ getHandle().setVariant(getData(color, getBodyColor(), getPattern()));
+ }
+
+ @Override
+ public DyeColor getBodyColor() {
+ return getBodyColor(getHandle().getVariant());
+ }
+
+ @Override
+ public void setBodyColor(DyeColor color) {
+ getHandle().setVariant(getData(getPatternColor(), color, getPattern()));
+ }
+
+ @Override
+ public Pattern getPattern() {
+ return getPattern(getHandle().getVariant());
+ }
+
+ @Override
+ public void setPattern(Pattern pattern) {
+ getHandle().setVariant(getData(getPatternColor(), getBodyColor(), pattern));
+ }
+
+ public static enum CraftPattern {
+ KOB(0, false),
+ SUNSTREAK(1, false),
+ SNOOPER(2, false),
+ DASHER(3, false),
+ BRINELY(4, false),
+ SPOTTY(5, false),
+ FLOPPER(0, true),
+ STRIPEY(1, true),
+ GLITTER(2, true),
+ BLOCKFISH(3, true),
+ BETTY(4, true),
+ CLAYFISH(5, true);
+
+ private final int variant;
+ private final boolean large;
+
+ //
+ private static final Map<Integer, Pattern> BY_DATA = new HashMap<>();
+
+ static {
+ for (CraftPattern type : values()) {
+ BY_DATA.put(type.getDataValue(), Pattern.values()[type.ordinal()]);
+ }
+ }
+
+ public static Pattern fromData(int data) {
+ return BY_DATA.get(data);
+ }
+
+ private CraftPattern(int variant, boolean large) {
+ this.variant = variant;
+ this.large = large;
+ }
+
+ public int getDataValue() {
+ return variant << 8 | ((large) ? 1 : 0);
+ }
+ }
+
+ public static int getData(DyeColor patternColor, DyeColor bodyColor, Pattern type) {
+ return patternColor.getWoolData() << 24 | bodyColor.getWoolData() << 16 | CraftPattern.values()[type.ordinal()].getDataValue();
+ }
+
+ public static DyeColor getPatternColor(int data) {
+ return DyeColor.getByWoolData((byte) ((data >> 24) & 0xFF));
+ }
+
+ public static DyeColor getBodyColor(int data) {
+ return DyeColor.getByWoolData((byte) ((data >> 16) & 0xFF));
+ }
+
+ public static Pattern getPattern(int data) {
+ return CraftPattern.fromData(data & 0xFFFF);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java
new file mode 100644
index 00000000..123a2c75
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java
@@ -0,0 +1,28 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.EntityTurtle;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Turtle;
+
+public class CraftTurtle extends CraftAnimals implements Turtle {
+
+ public CraftTurtle(CraftServer server, EntityTurtle entity) {
+ super(server, entity);
+ }
+
+ @Override
+ public EntityTurtle getHandle() {
+ return (EntityTurtle) super.getHandle();
+ }
+
+ @Override
+ public String toString() {
+ return "CraftTurtle";
+ }
+
+ @Override
+ public EntityType getType() {
+ return EntityType.TURTLE;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
index 503bd066..a6ee01ca 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
@@ -51,7 +51,7 @@ public class CraftVillager extends CraftAgeable implements Villager, InventoryHo
@Override
public Career getCareer() {
- return getCareer(getProfession(), getHandle().bK);
+ return getCareer(getProfession(), getHandle().careerId);
}
@Override
@@ -62,15 +62,15 @@ public class CraftVillager extends CraftAgeable implements Villager, InventoryHo
@Override
public void setCareer(Career career, boolean resetTrades) {
if (career == null) {
- getHandle().bK = 0; // reset career
+ getHandle().careerId = 0; // reset career
} else {
Validate.isTrue(career.getProfession() == getProfession(), "Career assignment mismatch. Found (" + getProfession() + ") Required (" + career.getProfession() + ")");
- getHandle().bK = getCareerID(career);
+ getHandle().careerId = getCareerID(career);
}
if (resetTrades) {
getHandle().trades = null;
- getHandle().dx();
+ getHandle().populateTrades();
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index c4bc628b..527af08c 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -361,21 +361,24 @@ public class CraftEventFactory {
/**
* BlockFadeEvent
*/
- public static BlockFadeEvent callBlockFadeEvent(Block block, net.minecraft.server.Block type) {
- BlockState state = block.getState();
- state.setTypeId(net.minecraft.server.Block.getId(type));
+ public static BlockFadeEvent callBlockFadeEvent(GeneratorAccess world, BlockPosition pos, IBlockData newBlock) {
+ CraftBlockState state = CraftBlockState.getBlockState(world, pos);
+ state.setData(newBlock);
- BlockFadeEvent event = new BlockFadeEvent(block, state);
+ BlockFadeEvent event = new BlockFadeEvent(state.getBlock(), state);
Bukkit.getPluginManager().callEvent(event);
return event;
}
- public static boolean handleBlockSpreadEvent(Block block, Block source, net.minecraft.server.Block type, int data) {
- BlockState state = block.getState();
- state.setTypeId(net.minecraft.server.Block.getId(type));
- state.setRawData((byte) data);
+ public static boolean handleBlockSpreadEvent(World world, BlockPosition source, BlockPosition target, IBlockData block) {
+ return handleBlockSpreadEvent(world, source, target, block, 2);
+ }
+
+ public static boolean handleBlockSpreadEvent(World world, BlockPosition source, BlockPosition target, IBlockData block, int flag) {
+ CraftBlockState state = CraftBlockState.getBlockState(world, target, flag);
+ state.setData(block);
- BlockSpreadEvent event = new BlockSpreadEvent(block, source, state);
+ BlockSpreadEvent event = new BlockSpreadEvent(world.getWorld().getBlockAt(target.getX(), target.getY(), target.getZ()), world.getWorld().getBlockAt(source.getX(), source.getY(), source.getZ()), state);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
@@ -558,6 +561,8 @@ public class CraftEventFactory {
cause = DamageCause.FLY_INTO_WALL;
} else if (source == DamageSource.CRAMMING) {
cause = DamageCause.CRAMMING;
+ } else if (source == DamageSource.DRYOUT) {
+ cause = DamageCause.DRYOUT;
} else if (source == DamageSource.GENERIC) {
cause = DamageCause.CUSTOM;
}
@@ -656,11 +661,14 @@ public class CraftEventFactory {
return event;
}
- public static boolean handleBlockGrowEvent(World world, int x, int y, int z, net.minecraft.server.Block type, int data) {
- Block block = world.getWorld().getBlockAt(x, y, z);
+ public static boolean handleBlockGrowEvent(World world, BlockPosition pos, IBlockData block) {
+ return handleBlockGrowEvent(world, pos, block, 3);
+ }
+
+ public static boolean handleBlockGrowEvent(World world, BlockPosition pos, IBlockData newData, int flag) {
+ Block block = world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
CraftBlockState state = (CraftBlockState) block.getState();
- state.setTypeId(net.minecraft.server.Block.getId(type));
- state.setRawData((byte) data);
+ state.setData(newData);
BlockGrowEvent event = new BlockGrowEvent(block, state);
Bukkit.getPluginManager().callEvent(event);
@@ -690,33 +698,17 @@ public class CraftEventFactory {
return event;
}
- public static EntityChangeBlockEvent callEntityChangeBlockEvent(org.bukkit.entity.Entity entity, Block block, Material material) {
- return callEntityChangeBlockEvent(entity, block, material, 0);
- }
-
- public static EntityChangeBlockEvent callEntityChangeBlockEvent(Entity entity, Block block, Material material) {
- return callEntityChangeBlockEvent(entity.getBukkitEntity(), block, material, 0);
- }
-
- public static EntityChangeBlockEvent callEntityChangeBlockEvent(Entity entity, Block block, Material material, boolean cancelled) {
- return callEntityChangeBlockEvent(entity.getBukkitEntity(), block, material, 0, cancelled);
+ public static EntityChangeBlockEvent callEntityChangeBlockEvent(Entity entity, BlockPosition position, IBlockData newBlock) {
+ return callEntityChangeBlockEvent(entity, position, newBlock, false);
}
- public static EntityChangeBlockEvent callEntityChangeBlockEvent(Entity entity, BlockPosition position, net.minecraft.server.Block type, int data) {
+ public static EntityChangeBlockEvent callEntityChangeBlockEvent(Entity entity, BlockPosition position, IBlockData newBlock, boolean cancelled) {
Block block = entity.world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
- Material material = CraftMagicNumbers.getMaterial(type);
-
- return callEntityChangeBlockEvent(entity.getBukkitEntity(), block, material, data);
- }
+ Material material = CraftMagicNumbers.getMaterial(newBlock).getItemType();
- public static EntityChangeBlockEvent callEntityChangeBlockEvent(org.bukkit.entity.Entity entity, Block block, Material material, int data) {
- return callEntityChangeBlockEvent(entity, block, material, data, false);
- }
-
- public static EntityChangeBlockEvent callEntityChangeBlockEvent(org.bukkit.entity.Entity entity, Block block, Material material, int data, boolean cancelled) {
- EntityChangeBlockEvent event = new EntityChangeBlockEvent(entity, block, material, (byte) data);
+ EntityChangeBlockEvent event = new EntityChangeBlockEvent(entity.getBukkitEntity(), block, material, (byte) 0);
event.setCancelled(cancelled);
- entity.getServer().getPluginManager().callEvent(event);
+ event.getEntity().getServer().getPluginManager().callEvent(event);
return event;
}
@@ -773,8 +765,8 @@ public class CraftEventFactory {
return container;
}
- public static ItemStack callPreCraftEvent(InventoryCrafting matrix, ItemStack result, InventoryView lastCraftView, boolean isRepair) {
- CraftInventoryCrafting inventory = new CraftInventoryCrafting(matrix, matrix.resultInventory);
+ public static ItemStack callPreCraftEvent(IInventory matrix, IInventory resultInventory, ItemStack result, InventoryView lastCraftView, boolean isRepair) {
+ CraftInventoryCrafting inventory = new CraftInventoryCrafting(matrix, resultInventory);
inventory.setResult(CraftItemStack.asCraftMirror(result));
PrepareItemCraftEvent event = new PrepareItemCraftEvent(inventory, lastCraftView, isRepair);
@@ -811,14 +803,14 @@ public class CraftEventFactory {
return event;
}
- public static BlockRedstoneEvent callRedstoneChange(World world, int x, int y, int z, int oldCurrent, int newCurrent) {
- BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(x, y, z), oldCurrent, newCurrent);
+ public static BlockRedstoneEvent callRedstoneChange(World world, BlockPosition pos, int oldCurrent, int newCurrent) {
+ BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()), oldCurrent, newCurrent);
world.getServer().getPluginManager().callEvent(event);
return event;
}
- public static NotePlayEvent callNotePlayEvent(World world, int x, int y, int z, byte instrument, byte note) {
- NotePlayEvent event = new NotePlayEvent(world.getWorld().getBlockAt(x, y, z), org.bukkit.Instrument.getByType(instrument), new org.bukkit.Note(note));
+ public static NotePlayEvent callNotePlayEvent(World world, BlockPosition pos, BlockPropertyInstrument instrument, int note) {
+ NotePlayEvent event = new NotePlayEvent(world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()), org.bukkit.Instrument.getByType((byte) instrument.ordinal()), new org.bukkit.Note(note));
world.getServer().getPluginManager().callEvent(event);
return event;
}
@@ -829,13 +821,12 @@ public class CraftEventFactory {
Bukkit.getPluginManager().callEvent(event);
}
- public static BlockIgniteEvent callBlockIgniteEvent(World world, int x, int y, int z, int igniterX, int igniterY, int igniterZ) {
+ public static BlockIgniteEvent callBlockIgniteEvent(World world, BlockPosition block, BlockPosition source) {
org.bukkit.World bukkitWorld = world.getWorld();
- Block igniter = bukkitWorld.getBlockAt(igniterX, igniterY, igniterZ);
+ Block igniter = bukkitWorld.getBlockAt(source.getX(), source.getY(), source.getZ());
IgniteCause cause;
switch (igniter.getType()) {
case LAVA:
- case STATIONARY_LAVA:
cause = IgniteCause.LAVA;
break;
case DISPENSER:
@@ -846,12 +837,12 @@ public class CraftEventFactory {
cause = IgniteCause.SPREAD;
}
- BlockIgniteEvent event = new BlockIgniteEvent(bukkitWorld.getBlockAt(x, y, z), cause, igniter);
+ BlockIgniteEvent event = new BlockIgniteEvent(bukkitWorld.getBlockAt(block.getX(), block.getY(), block.getZ()), cause, igniter);
world.getServer().getPluginManager().callEvent(event);
return event;
}
- public static BlockIgniteEvent callBlockIgniteEvent(World world, int x, int y, int z, Entity igniter) {
+ public static BlockIgniteEvent callBlockIgniteEvent(World world, BlockPosition pos, Entity igniter) {
org.bukkit.World bukkitWorld = world.getWorld();
org.bukkit.entity.Entity bukkitIgniter = igniter.getBukkitEntity();
IgniteCause cause;
@@ -870,7 +861,7 @@ public class CraftEventFactory {
cause = IgniteCause.FLINT_AND_STEEL;
}
- BlockIgniteEvent event = new BlockIgniteEvent(bukkitWorld.getBlockAt(x, y, z), cause, bukkitIgniter);
+ BlockIgniteEvent event = new BlockIgniteEvent(bukkitWorld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()), cause, bukkitIgniter);
world.getServer().getPluginManager().callEvent(event);
return event;
}
@@ -884,8 +875,8 @@ public class CraftEventFactory {
return event;
}
- public static BlockIgniteEvent callBlockIgniteEvent(World world, int x, int y, int z, IgniteCause cause, Entity igniter) {
- BlockIgniteEvent event = new BlockIgniteEvent(world.getWorld().getBlockAt(x, y, z), cause, igniter.getBukkitEntity());
+ public static BlockIgniteEvent callBlockIgniteEvent(World world, BlockPosition pos, IgniteCause cause, Entity igniter) {
+ BlockIgniteEvent event = new BlockIgniteEvent(world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()), cause, igniter.getBukkitEntity());
world.getServer().getPluginManager().callEvent(event);
return event;
}
@@ -932,7 +923,7 @@ public class CraftEventFactory {
c.setChatModifier(modi);
if (c instanceof ChatMessage) {
ChatMessage cm = (ChatMessage) c;
- Object[] oo = cm.j();
+ Object[] oo = cm.i();
for (int i = 0; i < oo.length; i++) {
Object o = oo[i];
if (o instanceof IChatBaseComponent) {
@@ -961,7 +952,7 @@ public class CraftEventFactory {
return event;
}
- public static Cancellable handleStatisticsIncrease(EntityHuman entityHuman, net.minecraft.server.Statistic statistic, int current, int incrementation) {
+ public static Cancellable handleStatisticsIncrease(EntityHuman entityHuman, net.minecraft.server.Statistic<?> statistic, int current, int incrementation) {
Player player = ((EntityPlayer) entityHuman).getBukkitEntity();
Event event;
if (true) {
@@ -974,12 +965,13 @@ public class CraftEventFactory {
case FALL_ONE_CM:
case BOAT_ONE_CM:
case CLIMB_ONE_CM:
- case DIVE_ONE_CM:
+ case WALK_ON_WATER_ONE_CM:
+ case WALK_UNDER_WATER_ONE_CM:
case FLY_ONE_CM:
case HORSE_ONE_CM:
case MINECART_ONE_CM:
case PIG_ONE_CM:
- case PLAY_ONE_TICK:
+ case PLAY_ONE_MINUTE:
case SWIM_ONE_CM:
case WALK_ONE_CM:
case SPRINT_ONE_CM:
@@ -993,7 +985,7 @@ public class CraftEventFactory {
if (stat.getType() == Type.UNTYPED) {
event = new PlayerStatisticIncrementEvent(player, stat, current, current + incrementation);
} else if (stat.getType() == Type.ENTITY) {
- EntityType entityType = CraftStatistic.getEntityTypeFromStatistic(statistic);
+ EntityType entityType = CraftStatistic.getEntityTypeFromStatistic((net.minecraft.server.Statistic<EntityTypes<?>>) statistic);
event = new PlayerStatisticIncrementEvent(player, stat, current, current + incrementation, entityType);
} else {
Material material = CraftStatistic.getMaterialFromStatistic(statistic);
@@ -1045,17 +1037,28 @@ public class CraftEventFactory {
return event;
}
- public static BlockPhysicsEvent callBlockPhysicsEvent(World world, BlockPosition blockposition) {
- org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
- BlockPhysicsEvent event = new BlockPhysicsEvent(block, block.getTypeId());
- world.getServer().getPluginManager().callEvent(event);
+ public static BlockPhysicsEvent callBlockPhysicsEvent(GeneratorAccess world, BlockPosition blockposition) {
+ org.bukkit.block.Block block = CraftBlock.at(world, blockposition);
+ BlockPhysicsEvent event = new BlockPhysicsEvent(block, block.getBlockData());
+ world.getMinecraftWorld().getMinecraftServer().server.getPluginManager().callEvent(event);
return event;
}
+ public static boolean handleBlockFormEvent(World world, BlockPosition pos, IBlockData block) {
+ return handleBlockFormEvent(world, pos, block, 3);
+ }
+
public static boolean handleBlockFormEvent(World world, BlockPosition pos, IBlockData block, @Nullable Entity entity) {
- BlockState blockState = world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()).getState();
- blockState.setType(CraftMagicNumbers.getMaterial(block.getBlock()));
- blockState.setRawData((byte) block.getBlock().toLegacyData(block));
+ return handleBlockFormEvent(world, pos, block, 3, entity);
+ }
+
+ public static boolean handleBlockFormEvent(World world, BlockPosition pos, IBlockData block, int flag) {
+ return handleBlockFormEvent(world, pos, block, flag, null);
+ }
+
+ public static boolean handleBlockFormEvent(World world, BlockPosition pos, IBlockData block, int flag, @Nullable Entity entity) {
+ CraftBlockState blockState = CraftBlockState.getBlockState(world, pos, flag);
+ blockState.setData(block);
BlockFormEvent event = (entity == null) ? new BlockFormEvent(blockState.getBlock(), blockState) : new EntityBlockFormEvent(entity.getBukkitEntity(), blockState.getBlock(), blockState);
world.getServer().getPluginManager().callEvent(event);
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
index 01264a7e..a0fda929 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
@@ -1,12 +1,13 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
package org.bukkit.craftbukkit.generator;
-import java.util.Arrays;
+import net.minecraft.server.Blocks;
+import net.minecraft.server.ChunkSection;
+import net.minecraft.server.IBlockData;
import org.bukkit.Material;
import org.bukkit.World;
+import org.bukkit.block.data.BlockData;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.material.MaterialData;
@@ -15,7 +16,7 @@ import org.bukkit.material.MaterialData;
*/
public final class CraftChunkData implements ChunkGenerator.ChunkData {
private final int maxHeight;
- private final char[][] sections;
+ private final ChunkSection[] sections;
public CraftChunkData(World world) {
this(world.getMaxHeight());
@@ -26,8 +27,7 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData {
throw new IllegalArgumentException("World height exceeded max chunk height");
}
this.maxHeight = maxHeight;
- // Minecraft hardcodes this to 16 chunk sections.
- sections = new char[16][];
+ sections = new ChunkSection[maxHeight >> 4];
}
@Override
@@ -37,41 +37,50 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData {
@Override
public void setBlock(int x, int y, int z, Material material) {
- setBlock(x, y, z, material.getId());
+ setBlock(x, y, z, CraftMagicNumbers.getBlock(material, (byte) 0));
}
@Override
public void setBlock(int x, int y, int z, MaterialData material) {
- setBlock(x, y, z, material.getItemTypeId(), material.getData());
+ setBlock(x, y, z, CraftMagicNumbers.getBlock(material));
+ }
+
+ @Override
+ public void setBlock(int x, int y, int z, BlockData blockData) {
+ setBlock(x, y, z, ((CraftBlockData) blockData).getState());
}
@Override
public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, Material material) {
- setRegion(xMin, yMin, zMin, xMax, yMax, zMax, material.getId());
+ setRegion(xMin, yMin, zMin, xMax, yMax, zMax, CraftMagicNumbers.getBlock(material, (byte) 0));
}
@Override
public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, MaterialData material) {
- setRegion(xMin, yMin, zMin, xMax, yMax, zMax, material.getItemTypeId(), material.getData());
+ setRegion(xMin, yMin, zMin, xMax, yMax, zMax, CraftMagicNumbers.getBlock(material));
+ }
+
+ @Override
+ public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, BlockData blockData) {
+ setRegion(xMin, yMin, zMin, xMax, yMax, zMax, ((CraftBlockData) blockData).getState());
}
@Override
public Material getType(int x, int y, int z) {
- return Material.getMaterial(getTypeId(x, y, z));
+ return getTypeAndData(x, y, z).getItemType();
}
@Override
public MaterialData getTypeAndData(int x, int y, int z) {
- return getType(x, y, z).getNewData(getData(x, y, z));
+ return CraftMagicNumbers.getMaterial(getTypeId(x, y, z));
}
@Override
- public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, int blockId) {
- setRegion(xMin, yMin, zMin, xMax, yMax, zMax, blockId, (byte) 0);
+ public BlockData getBlockData(int x, int y, int z) {
+ return CraftBlockData.fromData(getTypeId(x, y, z));
}
- @Override
- public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, int blockId, int data) {
+ public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, IBlockData type) {
// Clamp to sane values.
if (xMin > 0xf || yMin >= maxHeight || zMin > 0xf) {
return;
@@ -97,103 +106,51 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData {
if (xMin >= xMax || yMin >= yMax || zMin >= zMax) {
return;
}
- char typeChar = (char) ((blockId << 4) | data);
- if (xMin == 0 && xMax == 0x10) {
- if (zMin == 0 && zMax == 0x10) {
- for (int y = yMin & 0xf0; y < yMax; y += 0x10) {
- char[] section = getChunkSection(y, true);
- if (y <= yMin) {
- if (y + 0x10 > yMax) {
- // First and last chunk section
- Arrays.fill(section, (yMin & 0xf) << 8, (yMax & 0xf) << 8, typeChar);
- } else {
- // First chunk section
- Arrays.fill(section, (yMin & 0xf) << 8, 0x1000, typeChar);
- }
- } else if (y + 0x10 > yMax) {
- // Last chunk section
- Arrays.fill(section, 0, (yMax & 0xf) << 8, typeChar);
- } else {
- // Full chunk section
- Arrays.fill(section, 0, 0x1000, typeChar);
- }
- }
- } else {
- for (int y = yMin; y < yMax; y++) {
- char[] section = getChunkSection(y, true);
- int offsetBase = (y & 0xf) << 8;
- int min = offsetBase | (zMin << 4);
- // Need to add zMax as it can be 16, which overlaps the y coordinate bits
- int max = offsetBase + (zMax << 4);
- Arrays.fill(section, min, max, typeChar);
- }
- }
- } else {
- for (int y = yMin; y < yMax; y++) {
- char[] section = getChunkSection(y, true);
- int offsetBase = (y & 0xf) << 8;
+ for (int y = yMin; y < yMax; y++) {
+ ChunkSection section = getChunkSection(y, true);
+ int offsetBase = y & 0xf;
+ for (int x = xMin; x < xMax; x++) {
for (int z = zMin; z < zMax; z++) {
- int offset = offsetBase | (z << 4);
- // Need to add xMax as it can be 16, which overlaps the z coordinate bits
- Arrays.fill(section, offset | xMin, offset + xMax, typeChar);
+ section.setType(x, offsetBase, z, type);
}
}
}
}
- @Override
- public void setBlock(int x, int y, int z, int blockId) {
- setBlock(x, y, z, blockId, (byte) 0);
- }
-
- @Override
- public void setBlock(int x, int y, int z, int blockId, byte data) {
- setBlock(x, y, z, (char) (blockId << 4 | data));
- }
-
- @Override
- public int getTypeId(int x, int y, int z) {
+ public IBlockData getTypeId(int x, int y, int z) {
if (x != (x & 0xf) || y < 0 || y >= maxHeight || z != (z & 0xf)) {
- return 0;
+ return Blocks.AIR.getBlockData();
}
- char[] section = getChunkSection(y, false);
+ ChunkSection section = getChunkSection(y, false);
if (section == null) {
- return 0;
+ return Blocks.AIR.getBlockData();
} else {
- return section[(y & 0xf) << 8 | z << 4 | x] >> 4;
+ return section.getType(x, y & 0xf, z);
}
}
@Override
public byte getData(int x, int y, int z) {
- if (x != (x & 0xf) || y < 0 || y >= maxHeight || z != (z & 0xf)) {
- return (byte) 0;
- }
- char[] section = getChunkSection(y, false);
- if (section == null) {
- return (byte) 0;
- } else {
- return (byte) (section[(y & 0xf) << 8 | z << 4 | x] & 0xf);
- }
+ return CraftMagicNumbers.toLegacyData(getTypeId(x, y, z));
}
- private void setBlock(int x, int y, int z, char type) {
+ private void setBlock(int x, int y, int z, IBlockData type) {
if (x != (x & 0xf) || y < 0 || y >= maxHeight || z != (z & 0xf)) {
return;
}
- char[] section = getChunkSection(y, true);
- section[(y & 0xf) << 8 | z << 4 | x] = type;
+ ChunkSection section = getChunkSection(y, true);
+ section.setType(x, y & 0xf, z, type);
}
- private char[] getChunkSection(int y, boolean create) {
- char[] section = sections[y >> 4];
+ private ChunkSection getChunkSection(int y, boolean create) {
+ ChunkSection section = sections[y >> 4];
if (create && section == null) {
- sections[y >> 4] = section = new char[0x1000];
+ sections[y >> 4] = section = new ChunkSection(y, create);
}
return section;
}
- char[][] getRawChunkData() {
+ ChunkSection[] getRawChunkData() {
return sections;
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
index 9942f0c7..4280be5a 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
@@ -1,6 +1,11 @@
package org.bukkit.craftbukkit.generator;
+import com.google.common.collect.Maps;
+import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
+import it.unimi.dsi.fastutil.longs.Long2ObjectMaps;
+import it.unimi.dsi.fastutil.longs.LongSet;
import java.util.List;
+import java.util.Map;
import java.util.Random;
import net.minecraft.server.*;
@@ -10,11 +15,14 @@ import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.craftbukkit.block.CraftBlock;
-public class CustomChunkGenerator extends InternalChunkGenerator {
+public class CustomChunkGenerator extends InternalChunkGenerator<GeneratorSettingsDefault> {
private final ChunkGenerator generator;
private final WorldServer world;
+ private final long seed;
private final Random random;
+ private final WorldChunkManager chunkManager;
private final WorldGenStronghold strongholdGen = new WorldGenStronghold();
+ private final GeneratorSettingsDefault settings = new GeneratorSettingsDefault();
private static class CustomBiomeGrid implements BiomeGrid {
BiomeBase[] biome;
@@ -26,215 +34,145 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
@Override
public void setBiome(int x, int z, Biome bio) {
- biome[(z << 4) | x] = CraftBlock.biomeToBiomeBase(bio);
+ biome[(z << 4) | x] = CraftBlock.biomeToBiomeBase(bio);
}
}
public CustomChunkGenerator(World world, long seed, ChunkGenerator generator) {
this.world = (WorldServer) world;
this.generator = generator;
+ this.seed = seed;
this.random = new Random(seed);
+ this.chunkManager = world.worldProvider.getChunkGenerator().getWorldChunkManager();
}
@Override
- public Chunk getOrCreateChunk(int x, int z) {
+ public void createChunk(IChunkAccess ichunkaccess) {
+ int x = ichunkaccess.getPos().x;
+ int z = ichunkaccess.getPos().z;
random.setSeed((long) x * 341873128712L + (long) z * 132897987541L);
- Chunk chunk;
-
// Get default biome data for chunk
CustomBiomeGrid biomegrid = new CustomBiomeGrid();
- biomegrid.biome = new BiomeBase[256];
- world.getWorldChunkManager().getBiomeBlock(biomegrid.biome, x << 4, z << 4, 16, 16);
+ biomegrid.biome = chunkManager.getBiomeBlock(x << 4, z << 4, 16, 16);
- // Try ChunkData method (1.8+)
CraftChunkData data = (CraftChunkData) generator.generateChunkData(this.world.getWorld(), random, x, z, biomegrid);
- if (data != null) {
- char[][] sections = data.getRawChunkData();
- chunk = new Chunk(this.world, x, z);
-
- ChunkSection[] csect = chunk.getSections();
- int scnt = Math.min(csect.length, sections.length);
-
- // Loop through returned sections
- for (int sec = 0; sec < scnt; sec++) {
- if(sections[sec] == null) {
- continue;
- }
- char[] section = sections[sec];
- char emptyTest = 0;
- for (int i = 0; i < 4096; i++) {
- // Filter invalid block id & data values.
- if (Block.REGISTRY_ID.fromId(section[i]) == null) {
- section[i] = 0;
- }
- emptyTest |= section[i];
- }
- // Build chunk section
- if (emptyTest != 0) {
- csect[sec] = new ChunkSection(sec << 4, true, section);
- }
- }
- }
- else {
- // Try extended block method (1.2+)
- short[][] xbtypes = generator.generateExtBlockSections(this.world.getWorld(), this.random, x, z, biomegrid);
- if (xbtypes != null) {
- chunk = new Chunk(this.world, x, z);
-
- ChunkSection[] csect = chunk.getSections();
- int scnt = Math.min(csect.length, xbtypes.length);
-
- // Loop through returned sections
- for (int sec = 0; sec < scnt; sec++) {
- if (xbtypes[sec] == null) {
- continue;
- }
- char[] secBlkID = new char[4096]; // Allocate blk ID bytes
- short[] bdata = xbtypes[sec];
- for (int i = 0; i < bdata.length; i++) {
- Block b = Block.getById(bdata[i]);
- secBlkID[i] = (char) Block.REGISTRY_ID.getId(b.getBlockData());
- }
- // Build chunk section
- csect[sec] = new ChunkSection(sec << 4, true, secBlkID);
- }
- }
- else { // Else check for byte-per-block section data
- byte[][] btypes = generator.generateBlockSections(this.world.getWorld(), this.random, x, z, biomegrid);
-
- if (btypes != null) {
- chunk = new Chunk(this.world, x, z);
-
- ChunkSection[] csect = chunk.getSections();
- int scnt = Math.min(csect.length, btypes.length);
-
- for (int sec = 0; sec < scnt; sec++) {
- if (btypes[sec] == null) {
- continue;
- }
-
- char[] secBlkID = new char[4096]; // Allocate block ID bytes
- for (int i = 0; i < secBlkID.length; i++) {
- Block b = Block.getById(btypes[sec][i] & 0xFF);
- secBlkID[i] = (char) Block.REGISTRY_ID.getId(b.getBlockData());
- }
- csect[sec] = new ChunkSection(sec << 4, true, secBlkID);
- }
- }
- else { // Else, fall back to pre 1.2 method
- @SuppressWarnings("deprecation")
- byte[] types = generator.generate(this.world.getWorld(), this.random, x, z);
- int ydim = types.length / 256;
- int scnt = ydim / 16;
-
- chunk = new Chunk(this.world, x, z); // Create empty chunk
-
- ChunkSection[] csect = chunk.getSections();
-
- scnt = Math.min(scnt, csect.length);
- // Loop through sections
- for (int sec = 0; sec < scnt; sec++) {
- char[] csbytes = null; // Add sections when needed
-
- for (int cy = 0; cy < 16; cy++) {
- int cyoff = cy | (sec << 4);
-
- for (int cx = 0; cx < 16; cx++) {
- int cxyoff = (cx * ydim * 16) + cyoff;
-
- for (int cz = 0; cz < 16; cz++) {
- byte blk = types[cxyoff + (cz * ydim)];
-
- if (blk != 0) { // If non-empty
- if (csbytes == null) { // If no section yet, get one
- csbytes = new char[16*16*16];
- }
-
- Block b = Block.getById(blk & 0xFF);
- csbytes[(cy << 8) | (cz << 4) | cx] = (char) Block.REGISTRY_ID.getId(b.getBlockData());
- }
- }
- }
- }
- // If section built, finish prepping its state
- if (csbytes != null) {
- ChunkSection cs = csect[sec] = new ChunkSection(sec << 4, true, csbytes);
- cs.recalcBlockCounts();
- }
- }
- }
+ ChunkSection[] sections = data.getRawChunkData();
+
+ ChunkSection[] csect = ichunkaccess.getSections();
+ int scnt = Math.min(csect.length, sections.length);
+
+ // Loop through returned sections
+ for (int sec = 0; sec < scnt; sec++) {
+ if (sections[sec] == null) {
+ continue;
}
+ ChunkSection section = sections[sec];
+
+ csect[sec] = section;
}
+
// Set biome grid
- byte[] biomeIndex = chunk.getBiomeIndex();
- for (int i = 0; i < biomeIndex.length; i++) {
- biomeIndex[i] = (byte) (BiomeBase.REGISTRY_ID.a(biomegrid.biome[i]) & 0xFF); // PAIL : rename
- }
- // Initialize lighting
- chunk.initLighting();
+ ichunkaccess.a(biomegrid.biome);
+ }
- return chunk;
+ @Override
+ public ChunkData generateChunkData(org.bukkit.World world, Random random, int x, int z, BiomeGrid biome) {
+ return generator.generateChunkData(world, random, x, z, biome);
}
@Override
- public boolean a(Chunk chunk, int i, int i1) {
- return false;
+ public boolean canSpawn(org.bukkit.World world, int x, int z) {
+ return generator.canSpawn(world, x, z);
}
- @SuppressWarnings("deprecation")
@Override
- public byte[] generate(org.bukkit.World world, Random random, int x, int z) {
- return generator.generate(world, random, x, z);
+ public List<BlockPopulator> getDefaultPopulators(org.bukkit.World world) {
+ return generator.getDefaultPopulators(world);
}
@Override
- public byte[][] generateBlockSections(org.bukkit.World world, Random random, int x, int z, BiomeGrid biomes) {
- return generator.generateBlockSections(world, random, x, z, biomes);
+ public List<BiomeBase.BiomeMeta> getMobsFor(EnumCreatureType type, BlockPosition position) {
+ BiomeBase biomebase = world.getBiome(position);
+
+ return biomebase == null ? null : biomebase.getMobs(type);
}
@Override
- public short[][] generateExtBlockSections(org.bukkit.World world, Random random, int x, int z, BiomeGrid biomes) {
- return generator.generateExtBlockSections(world, random, x, z, biomes);
+ public void addFeatures(RegionLimitedWorldAccess regionlimitedworldaccess, WorldGenStage.Features worldgenstage_features) {
}
- public Chunk getChunkAt(int x, int z) {
- return getOrCreateChunk(x, z);
+ @Override
+ public void addDecorations(RegionLimitedWorldAccess regionlimitedworldaccess) {
}
@Override
- public boolean canSpawn(org.bukkit.World world, int x, int z) {
- return generator.canSpawn(world, x, z);
+ public void addMobs(RegionLimitedWorldAccess regionlimitedworldaccess) {
}
@Override
- public List<BlockPopulator> getDefaultPopulators(org.bukkit.World world) {
- return generator.getDefaultPopulators(world);
+ public BlockPosition findNearestMapFeature(World world, String type, BlockPosition position, int i) {
+ return "Stronghold".equals(type) && this.strongholdGen != null ? this.strongholdGen.getNearestGeneratedFeature(world, this, position, i) : null;
}
@Override
- public List<BiomeBase.BiomeMeta> getMobsFor(EnumCreatureType type, BlockPosition position) {
- BiomeBase biomebase = world.getBiome(position);
+ public GeneratorSettingsDefault getSettings() {
+ return settings;
+ }
- return biomebase == null ? null : biomebase.getMobs(type);
+ @Override
+ public int a(World world, boolean flag, boolean flag1) {
+ return 0;
+ }
+
+ @Override
+ public boolean canSpawnStructure(BiomeBase biomebase, StructureGenerator<? extends WorldGenFeatureConfiguration> structuregenerator) {
+ return biomebase.a(structuregenerator);
+ }
+
+ @Override
+ public WorldGenFeatureConfiguration getFeatureConfiguration(BiomeBase biomebase, StructureGenerator<? extends WorldGenFeatureConfiguration> structuregenerator) {
+ return biomebase.b(structuregenerator);
}
+ // Taken from ChunkGeneratorAbstract
+ private final Map<StructureGenerator<? extends WorldGenFeatureConfiguration>, Long2ObjectMap<StructureStart>> structureStartCache = Maps.newHashMap();
+
@Override
- public boolean a(World world, String type, BlockPosition position) {
- return "Stronghold".equals(type) && this.strongholdGen != null ? this.strongholdGen.b(position) : false;
+ public Long2ObjectMap<StructureStart> getStructureStartCache(StructureGenerator<? extends WorldGenFeatureConfiguration> structuregenerator) {
+ return (Long2ObjectMap) this.structureStartCache.computeIfAbsent(structuregenerator, (s) -> {
+ return Long2ObjectMaps.synchronize(new ExpiringMap(8192, 10000));
+ });
}
+ // Taken from ChunkGeneratorAbstract
+ private final Map<StructureGenerator<? extends WorldGenFeatureConfiguration>, Long2ObjectMap<LongSet>> structureCache = Maps.newHashMap();
+
@Override
- public BlockPosition findNearestMapFeature(World world, String type, BlockPosition position, boolean flag) {
- return "Stronghold".equals(type) && this.strongholdGen != null ? this.strongholdGen.getNearestGeneratedFeature(world, position, flag) : null;
+ public Long2ObjectMap<LongSet> getStructureCache(StructureGenerator<? extends WorldGenFeatureConfiguration> structuregenerator) {
+ return (Long2ObjectMap) this.structureCache.computeIfAbsent(structuregenerator, (s) -> {
+ return Long2ObjectMaps.synchronize(new ExpiringMap(8192, 10000));
+ });
}
@Override
- public void recreateStructures(int i, int j) {}
+ public WorldChunkManager getWorldChunkManager() {
+ return chunkManager;
+ }
+
+ @Override
+ public long getSeed() {
+ return seed;
+ }
+
+ @Override
+ public int getSpawnHeight() {
+ return world.getSeaLevel() + 1;
+ }
@Override
- public void recreateStructures(Chunk chunk, int i, int j) {
- strongholdGen.a(this.world, i, j, (ChunkSnapshot) null);
+ public int e() {
+ return world.getHeight();
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/InternalChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/InternalChunkGenerator.java
index d2e71b87..b0710cd8 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/InternalChunkGenerator.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/InternalChunkGenerator.java
@@ -1,8 +1,8 @@
package org.bukkit.craftbukkit.generator;
-import net.minecraft.server.IChunkProvider;
+import net.minecraft.server.GeneratorSettings;
import org.bukkit.generator.ChunkGenerator;
// Do not implement functions to this class, add to NormalChunkGenerator
-public abstract class InternalChunkGenerator extends ChunkGenerator implements net.minecraft.server.ChunkGenerator {
+public abstract class InternalChunkGenerator<C extends GeneratorSettings> extends ChunkGenerator implements net.minecraft.server.ChunkGenerator<C> {
}
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java
index be07fb8e..4356d2bf 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java
@@ -1,29 +1,30 @@
package org.bukkit.craftbukkit.generator;
+import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
+import it.unimi.dsi.fastutil.longs.LongSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.server.*;
-import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.generator.BlockPopulator;
-public class NormalChunkGenerator extends InternalChunkGenerator {
- private final ChunkGenerator generator;
+public class NormalChunkGenerator<C extends GeneratorSettings> extends InternalChunkGenerator<C> {
+ private final ChunkGenerator<?> generator;
public NormalChunkGenerator(World world, long seed) {
generator = world.worldProvider.getChunkGenerator();
}
@Override
- public byte[] generate(org.bukkit.World world, Random random, int x, int z) {
+ public ChunkData generateChunkData(org.bukkit.World world, Random random, int x, int z, BiomeGrid biome) {
throw new UnsupportedOperationException("Not supported.");
}
@Override
public boolean canSpawn(org.bukkit.World world, int x, int z) {
- return ((CraftWorld) world).getHandle().worldProvider.canSpawn(x, z);
+ return true; // PAIL
}
@Override
@@ -32,37 +33,82 @@ public class NormalChunkGenerator extends InternalChunkGenerator {
}
@Override
- public Chunk getOrCreateChunk(int i, int i1) {
- return generator.getOrCreateChunk(i, i1);
+ public List<BiomeBase.BiomeMeta> getMobsFor(EnumCreatureType enumCreatureType, BlockPosition blockPosition) {
+ return generator.getMobsFor(enumCreatureType, blockPosition);
}
@Override
- public void recreateStructures(int i, int i1) {
- generator.recreateStructures(i, i1);
+ public BlockPosition findNearestMapFeature(World world, String s, BlockPosition blockPosition, int i) {
+ return generator.findNearestMapFeature(world, s, blockPosition, i);
}
@Override
- public boolean a(Chunk chunk, int i, int i1) {
- return generator.a(chunk, i, i1);
+ public void createChunk(IChunkAccess ichunkaccess) {
+ generator.createChunk(ichunkaccess);
}
@Override
- public List<BiomeBase.BiomeMeta> getMobsFor(EnumCreatureType enumCreatureType, BlockPosition blockPosition) {
- return generator.getMobsFor(enumCreatureType, blockPosition);
+ public void addFeatures(RegionLimitedWorldAccess regionlimitedworldaccess, WorldGenStage.Features worldgenstage_features) {
+ generator.addFeatures(regionlimitedworldaccess, worldgenstage_features);
+ }
+
+ @Override
+ public void addDecorations(RegionLimitedWorldAccess regionlimitedworldaccess) {
+ generator.addDecorations(regionlimitedworldaccess);
+ }
+
+ @Override
+ public void addMobs(RegionLimitedWorldAccess regionlimitedworldaccess) {
+ generator.addMobs(regionlimitedworldaccess);
+ }
+
+ @Override
+ public C getSettings() {
+ return (C) generator.getSettings();
+ }
+
+ @Override
+ public int a(World world, boolean flag, boolean flag1) {
+ return generator.a(world, flag, flag1);
+ }
+
+ @Override
+ public boolean canSpawnStructure(BiomeBase biomebase, StructureGenerator<? extends WorldGenFeatureConfiguration> structuregenerator) {
+ return generator.canSpawnStructure(biomebase, structuregenerator);
+ }
+
+ @Override
+ public WorldGenFeatureConfiguration getFeatureConfiguration(BiomeBase biomebase, StructureGenerator<? extends WorldGenFeatureConfiguration> structuregenerator) {
+ return generator.getFeatureConfiguration(biomebase, structuregenerator);
+ }
+
+ @Override
+ public Long2ObjectMap<StructureStart> getStructureStartCache(StructureGenerator<? extends WorldGenFeatureConfiguration> structuregenerator) {
+ return generator.getStructureStartCache(structuregenerator);
+ }
+
+ @Override
+ public Long2ObjectMap<LongSet> getStructureCache(StructureGenerator<? extends WorldGenFeatureConfiguration> structuregenerator) {
+ return generator.getStructureCache(structuregenerator);
+ }
+
+ @Override
+ public WorldChunkManager getWorldChunkManager() {
+ return generator.getWorldChunkManager();
}
@Override
- public BlockPosition findNearestMapFeature(World world, String s, BlockPosition blockPosition, boolean flag) {
- return generator.findNearestMapFeature(world, s, blockPosition, flag);
+ public long getSeed() {
+ return generator.getSeed();
}
@Override
- public void recreateStructures(Chunk chunk, int i, int i1) {
- generator.recreateStructures(chunk, i, i1);
+ public int getSpawnHeight() {
+ return generator.getSpawnHeight();
}
@Override
- public boolean a(World world, String string, BlockPosition bp) {
- return generator.a(world, string, bp);
+ public int e() {
+ return generator.e(); // PAIL: Gen depth
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftFurnaceRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftFurnaceRecipe.java
index ef3b8045..b513f8d2 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftFurnaceRecipe.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftFurnaceRecipe.java
@@ -1,26 +1,31 @@
package org.bukkit.craftbukkit.inventory;
-import net.minecraft.server.RecipesFurnace;
+import java.util.stream.Stream;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.RecipeItemStack;
+import org.bukkit.NamespacedKey;
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.inventory.FurnaceRecipe;
import org.bukkit.inventory.ItemStack;
public class CraftFurnaceRecipe extends FurnaceRecipe implements CraftRecipe {
- public CraftFurnaceRecipe(ItemStack result, ItemStack source) {
- super(result, source.getType(), source.getDurability());
+ public CraftFurnaceRecipe(NamespacedKey key, ItemStack result, ItemStack source, float experience, int cookingTime) {
+ super(key, result, source.getType(), source.getDurability(), experience, cookingTime);
}
public static CraftFurnaceRecipe fromBukkitRecipe(FurnaceRecipe recipe) {
if (recipe instanceof CraftFurnaceRecipe) {
return (CraftFurnaceRecipe) recipe;
}
- return new CraftFurnaceRecipe(recipe.getResult(), recipe.getInput());
+ return new CraftFurnaceRecipe(recipe.getKey(), recipe.getResult(), recipe.getInput(), recipe.getExperience(), recipe.getCookingTime());
}
@Override
public void addToCraftingManager() {
ItemStack result = this.getResult();
- ItemStack input = this.getInput();
- RecipesFurnace.getInstance().registerRecipe(CraftItemStack.asNMSCopy(input), CraftItemStack.asNMSCopy(result), getExperience());
+ RecipeItemStack input = new RecipeItemStack(Stream.of(new RecipeItemStack.StackProvider(CraftItemStack.asNMSCopy(this.getInput()))));
+
+ MinecraftServer.getServer().getCraftingManager().a(new net.minecraft.server.FurnaceRecipe(CraftNamespacedKey.toMinecraft(this.getKey()), "", input, CraftItemStack.asNMSCopy(result), getExperience(), getCookingTime()));
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
index 4866d1ae..94afb704 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
@@ -25,6 +25,7 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.Material;
+import org.bukkit.craftbukkit.util.CraftChatMessage;
public class CraftInventory implements Inventory {
protected final IInventory inventory;
@@ -42,7 +43,7 @@ public class CraftInventory implements Inventory {
}
public String getName() {
- return getInventory().getName();
+ return CraftChatMessage.fromComponent(getInventory().getDisplayName());
}
public ItemStack getItem(int index) {
@@ -96,20 +97,16 @@ public class CraftInventory implements Inventory {
getInventory().setItem(index, CraftItemStack.asNMSCopy(item));
}
- public boolean contains(int materialId) {
+ public boolean contains(Material material) {
+ Validate.notNull(material, "Material cannot be null");
for (ItemStack item : getStorageContents()) {
- if (item != null && item.getTypeId() == materialId) {
+ if (item != null && item.getType() == material) {
return true;
}
}
return false;
}
- public boolean contains(Material material) {
- Validate.notNull(material, "Material cannot be null");
- return contains(material.getId());
- }
-
public boolean contains(ItemStack item) {
if (item == null) {
return false;
@@ -122,12 +119,13 @@ public class CraftInventory implements Inventory {
return false;
}
- public boolean contains(int materialId, int amount) {
+ public boolean contains(Material material, int amount) {
+ Validate.notNull(material, "Material cannot be null");
if (amount <= 0) {
return true;
}
for (ItemStack item : getStorageContents()) {
- if (item != null && item.getTypeId() == materialId) {
+ if (item != null && item.getType()== material) {
if ((amount -= item.getAmount()) <= 0) {
return true;
}
@@ -136,11 +134,6 @@ public class CraftInventory implements Inventory {
return false;
}
- public boolean contains(Material material, int amount) {
- Validate.notNull(material, "Material cannot be null");
- return contains(material.getId(), amount);
- }
-
public boolean contains(ItemStack item, int amount) {
if (item == null) {
return false;
@@ -171,24 +164,20 @@ public class CraftInventory implements Inventory {
return false;
}
- public HashMap<Integer, ItemStack> all(int materialId) {
+ public HashMap<Integer, ItemStack> all(Material material) {
+ Validate.notNull(material, "Material cannot be null");
HashMap<Integer, ItemStack> slots = new HashMap<Integer, ItemStack>();
ItemStack[] inventory = getStorageContents();
for (int i = 0; i < inventory.length; i++) {
ItemStack item = inventory[i];
- if (item != null && item.getTypeId() == materialId) {
+ if (item != null && item.getType()== material) {
slots.put(i, item);
}
}
return slots;
}
- public HashMap<Integer, ItemStack> all(Material material) {
- Validate.notNull(material, "Material cannot be null");
- return all(material.getId());
- }
-
public HashMap<Integer, ItemStack> all(ItemStack item) {
HashMap<Integer, ItemStack> slots = new HashMap<Integer, ItemStack>();
if (item != null) {
@@ -202,22 +191,18 @@ public class CraftInventory implements Inventory {
return slots;
}
- public int first(int materialId) {
- ItemStack[] inventory = getStorageContents();
+ public int first(Material material) {
+ Validate.notNull(material, "Material cannot be null");
+ ItemStack[] inventory = getStorageContents();
for (int i = 0; i < inventory.length; i++) {
ItemStack item = inventory[i];
- if (item != null && item.getTypeId() == materialId) {
+ if (item != null && item.getType()== material) {
return i;
}
}
return -1;
}
- public int first(Material material) {
- Validate.notNull(material, "Material cannot be null");
- return first(material.getId());
- }
-
public int first(ItemStack item) {
return first(item, true);
}
@@ -247,22 +232,18 @@ public class CraftInventory implements Inventory {
return -1;
}
- public int firstPartial(int materialId) {
+ public int firstPartial(Material material) {
+ Validate.notNull(material, "Material cannot be null");
ItemStack[] inventory = getStorageContents();
for (int i = 0; i < inventory.length; i++) {
ItemStack item = inventory[i];
- if (item != null && item.getTypeId() == materialId && item.getAmount() < item.getMaxStackSize()) {
+ if (item != null && item.getType()== material && item.getAmount() < item.getMaxStackSize()) {
return i;
}
}
return -1;
}
- public int firstPartial(Material material) {
- Validate.notNull(material, "Material cannot be null");
- return firstPartial(material.getId());
- }
-
private int firstPartial(ItemStack item) {
ItemStack[] inventory = getStorageContents();
ItemStack filteredItem = CraftItemStack.asCraftCopy(item);
@@ -390,20 +371,16 @@ public class CraftInventory implements Inventory {
return getInventory().getMaxStackSize();
}
- public void remove(int materialId) {
+ public void remove(Material material) {
+ Validate.notNull(material, "Material cannot be null");
ItemStack[] items = getStorageContents();
for (int i = 0; i < items.length; i++) {
- if (items[i] != null && items[i].getTypeId() == materialId) {
+ if (items[i] != null && items[i].getType()== material) {
clear(i);
}
}
}
- public void remove(Material material) {
- Validate.notNull(material, "Material cannot be null");
- remove(material.getId());
- }
-
public void remove(ItemStack item) {
ItemStack[] items = getStorageContents();
for (int i = 0; i < items.length; i++) {
@@ -439,7 +416,7 @@ public class CraftInventory implements Inventory {
}
public String getTitle() {
- return inventory.getName();
+ return getName();
}
public InventoryType getType() {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCrafting.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCrafting.java
index 0f0dd199..3a375e77 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCrafting.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCrafting.java
@@ -5,7 +5,6 @@ import java.util.List;
import net.minecraft.server.IRecipe;
import net.minecraft.server.IInventory;
-import net.minecraft.server.InventoryCrafting;
import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.ItemStack;
@@ -14,7 +13,7 @@ import org.bukkit.inventory.Recipe;
public class CraftInventoryCrafting extends CraftInventory implements CraftingInventory {
private final IInventory resultInventory;
- public CraftInventoryCrafting(InventoryCrafting inventory, IInventory resultInventory) {
+ public CraftInventoryCrafting(IInventory inventory, IInventory resultInventory) {
super(inventory);
this.resultInventory = resultInventory;
}
@@ -116,7 +115,7 @@ public class CraftInventoryCrafting extends CraftInventory implements CraftingIn
}
public Recipe getRecipe() {
- IRecipe recipe = ((InventoryCrafting)getInventory()).currentRecipe;
+ IRecipe recipe = getInventory().getCurrentRecipe();
return recipe == null ? null : recipe.toBukkitRecipe();
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
index a1a0ab7d..2212e09c 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
@@ -17,6 +17,7 @@ import net.minecraft.server.EntityHuman;
import net.minecraft.server.IInventory;
import net.minecraft.server.ItemStack;
import net.minecraft.server.NonNullList;
+import org.bukkit.craftbukkit.util.CraftChatMessage;
public class CraftInventoryCustom extends CraftInventory {
public CraftInventoryCustom(InventoryHolder owner, InventoryType type) {
@@ -39,7 +40,7 @@ public class CraftInventoryCustom extends CraftInventory {
private final NonNullList<ItemStack> items;
private int maxStack = MAX_STACK;
private final List<HumanEntity> viewers;
- private final String title;
+ private final IChatBaseComponent title;
private InventoryType type;
private final InventoryHolder owner;
@@ -60,7 +61,7 @@ public class CraftInventoryCustom extends CraftInventory {
public MinecraftInventory(InventoryHolder owner, int size, String title) {
Validate.notNull(title, "Title cannot be null");
this.items = NonNullList.a(size, ItemStack.a);
- this.title = title;
+ this.title = CraftChatMessage.fromStringOrNull(title);
this.viewers = new ArrayList<HumanEntity>();
this.owner = owner;
this.type = InventoryType.CHEST;
@@ -182,7 +183,12 @@ public class CraftInventoryCustom extends CraftInventory {
}
@Override
- public String getName() {
+ public IChatBaseComponent getDisplayName() {
+ return title;
+ }
+
+ @Override
+ public IChatBaseComponent getCustomName() {
return title;
}
@@ -193,7 +199,7 @@ public class CraftInventoryCustom extends CraftInventory {
@Override
public IChatBaseComponent getScoreboardDisplayName() {
- return new ChatComponentText(title);
+ return title;
}
@Override
@@ -202,7 +208,7 @@ public class CraftInventoryCustom extends CraftInventory {
}
@Override
- public boolean x_() {
+ public boolean P_() {
Iterator iterator = this.items.iterator();
ItemStack itemstack;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryDoubleChest.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryDoubleChest.java
index f028b339..799f8ea5 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryDoubleChest.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryDoubleChest.java
@@ -1,5 +1,6 @@
package org.bukkit.craftbukkit.inventory;
+import net.minecraft.server.ChatMessage;
import net.minecraft.server.ITileInventory;
import org.bukkit.block.DoubleChest;
import org.bukkit.inventory.DoubleChestInventory;
@@ -14,7 +15,7 @@ public class CraftInventoryDoubleChest extends CraftInventory implements DoubleC
private final CraftInventory right;
public CraftInventoryDoubleChest(CraftInventory left, CraftInventory right) {
- super(new InventoryLargeChest("Large chest", (ITileInventory) left.getInventory(), (ITileInventory) right.getInventory()));
+ super(new InventoryLargeChest(new ChatMessage("container.chestDouble"), (ITileInventory) left.getInventory(), (ITileInventory) right.getInventory()));
this.left = left;
this.right = right;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
index 67c54899..6cbe0695 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
@@ -184,23 +184,6 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i
setSlots(items, getInventory().items.size() + getInventory().armor.size(), getInventory().extraSlots.size());
}
- public int clear(int id, int data) {
- int count = 0;
- ItemStack[] items = getContents();
-
- for (int i = 0; i < items.length; i++) {
- ItemStack item = items[i];
- if (item == null) continue;
- if (id > -1 && item.getTypeId() != id) continue;
- if (data > -1 && item.getData().getData() != data) continue;
-
- count += item.getAmount();
- setItem(i, null);
- }
-
- return count;
- }
-
@Override
public HumanEntity getHolder() {
return (HumanEntity) inventory.getOwner();
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index 49ebad22..e305d663 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -6,6 +6,7 @@ import org.apache.commons.lang.Validate;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.configuration.serialization.ConfigurationSerialization;
+import org.bukkit.craftbukkit.util.CraftLegacy;
import org.bukkit.inventory.ItemFactory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
@@ -47,6 +48,7 @@ public final class CraftItemFactory implements ItemFactory {
}
public boolean isApplicable(ItemMeta meta, Material type) {
+ type = CraftLegacy.fromLegacy(type); // This may be called from legacy item stacks, try to get the right material
if (type == null || meta == null) {
return false;
}
@@ -63,14 +65,27 @@ public final class CraftItemFactory implements ItemFactory {
}
private ItemMeta getItemMeta(Material material, CraftMetaItem meta) {
+ material = CraftLegacy.fromLegacy(material); // This may be called from legacy item stacks, try to get the right material
switch (material) {
case AIR:
return null;
case WRITTEN_BOOK:
return meta instanceof CraftMetaBookSigned ? meta : new CraftMetaBookSigned(meta);
- case BOOK_AND_QUILL:
+ case WRITABLE_BOOK:
return meta != null && meta.getClass().equals(CraftMetaBook.class) ? meta : new CraftMetaBook(meta);
- case SKULL_ITEM:
+ case CREEPER_HEAD:
+ case CREEPER_WALL_HEAD:
+ case DRAGON_HEAD:
+ case DRAGON_WALL_HEAD:
+ case PISTON_HEAD:
+ case PLAYER_HEAD:
+ case PLAYER_WALL_HEAD:
+ case SKELETON_SKULL:
+ case SKELETON_WALL_SKULL:
+ case WITHER_SKELETON_SKULL:
+ case WITHER_SKELETON_WALL_SKULL:
+ case ZOMBIE_HEAD:
+ case ZOMBIE_WALL_HEAD:
return meta instanceof CraftMetaSkull ? meta : new CraftMetaSkull(meta);
case LEATHER_HELMET:
case LEATHER_CHESTPLATE:
@@ -82,17 +97,90 @@ public final class CraftItemFactory implements ItemFactory {
case LINGERING_POTION:
case TIPPED_ARROW:
return meta instanceof CraftMetaPotion ? meta : new CraftMetaPotion(meta);
- case MAP:
+ case FILLED_MAP:
return meta instanceof CraftMetaMap ? meta : new CraftMetaMap(meta);
- case FIREWORK:
+ case FIREWORK_ROCKET:
return meta instanceof CraftMetaFirework ? meta : new CraftMetaFirework(meta);
- case FIREWORK_CHARGE:
+ case FIREWORK_STAR:
return meta instanceof CraftMetaCharge ? meta : new CraftMetaCharge(meta);
case ENCHANTED_BOOK:
return meta instanceof CraftMetaEnchantedBook ? meta : new CraftMetaEnchantedBook(meta);
- case BANNER:
+ case BLACK_BANNER:
+ case BLACK_WALL_BANNER:
+ case BLUE_BANNER:
+ case BLUE_WALL_BANNER:
+ case BROWN_BANNER:
+ case BROWN_WALL_BANNER:
+ case CYAN_BANNER:
+ case CYAN_WALL_BANNER:
+ case GRAY_BANNER:
+ case GRAY_WALL_BANNER:
+ case GREEN_BANNER:
+ case GREEN_WALL_BANNER:
+ case LIGHT_BLUE_BANNER:
+ case LIGHT_BLUE_WALL_BANNER:
+ case LIGHT_GRAY_BANNER:
+ case LIGHT_GRAY_WALL_BANNER:
+ case LIME_BANNER:
+ case LIME_WALL_BANNER:
+ case MAGENTA_BANNER:
+ case MAGENTA_WALL_BANNER:
+ case ORANGE_BANNER:
+ case ORANGE_WALL_BANNER:
+ case PINK_BANNER:
+ case PINK_WALL_BANNER:
+ case PURPLE_BANNER:
+ case PURPLE_WALL_BANNER:
+ case RED_BANNER:
+ case RED_WALL_BANNER:
+ case WHITE_BANNER:
+ case WHITE_WALL_BANNER:
+ case YELLOW_BANNER:
+ case YELLOW_WALL_BANNER:
return meta instanceof CraftMetaBanner ? meta : new CraftMetaBanner(meta);
- case MONSTER_EGG:
+ case BAT_SPAWN_EGG:
+ case BLAZE_SPAWN_EGG:
+ case CAVE_SPIDER_SPAWN_EGG:
+ case CHICKEN_SPAWN_EGG:
+ case COW_SPAWN_EGG:
+ case CREEPER_SPAWN_EGG:
+ case DONKEY_SPAWN_EGG:
+ case ELDER_GUARDIAN_SPAWN_EGG:
+ case ENDERMAN_SPAWN_EGG:
+ case ENDERMITE_SPAWN_EGG:
+ case EVOKER_SPAWN_EGG:
+ case GHAST_SPAWN_EGG:
+ case GUARDIAN_SPAWN_EGG:
+ case HORSE_SPAWN_EGG:
+ case HUSK_SPAWN_EGG:
+ case LLAMA_SPAWN_EGG:
+ case MAGMA_CUBE_SPAWN_EGG:
+ case MOOSHROOM_SPAWN_EGG:
+ case MULE_SPAWN_EGG:
+ case OCELOT_SPAWN_EGG:
+ case PARROT_SPAWN_EGG:
+ case PIG_SPAWN_EGG:
+ case POLAR_BEAR_SPAWN_EGG:
+ case RABBIT_SPAWN_EGG:
+ case SHEEP_SPAWN_EGG:
+ case SHULKER_SPAWN_EGG:
+ case SILVERFISH_SPAWN_EGG:
+ case SKELETON_HORSE_SPAWN_EGG:
+ case SKELETON_SPAWN_EGG:
+ case SLIME_SPAWN_EGG:
+ case SPIDER_SPAWN_EGG:
+ case SQUID_SPAWN_EGG:
+ case STRAY_SPAWN_EGG:
+ case VEX_SPAWN_EGG:
+ case VILLAGER_SPAWN_EGG:
+ case VINDICATOR_SPAWN_EGG:
+ case WITCH_SPAWN_EGG:
+ case WITHER_SKELETON_SPAWN_EGG:
+ case WOLF_SPAWN_EGG:
+ case ZOMBIE_HORSE_SPAWN_EGG:
+ case ZOMBIE_PIGMAN_SPAWN_EGG:
+ case ZOMBIE_SPAWN_EGG:
+ case ZOMBIE_VILLAGER_SPAWN_EGG:
return meta instanceof CraftMetaSpawnEgg ? meta : new CraftMetaSpawnEgg(meta);
case KNOWLEDGE_BOOK:
return meta instanceof CraftMetaKnowledgeBook ? meta : new CraftMetaKnowledgeBook(meta);
@@ -103,19 +191,17 @@ public final class CraftItemFactory implements ItemFactory {
case DISPENSER:
case DROPPER:
case SIGN:
- case MOB_SPAWNER:
+ case SPAWNER:
case NOTE_BLOCK:
- case BREWING_STAND_ITEM:
- case ENCHANTMENT_TABLE:
- case COMMAND:
- case COMMAND_REPEATING:
- case COMMAND_CHAIN:
+ case BREWING_STAND:
+ case ENCHANTING_TABLE:
+ case COMMAND_BLOCK:
+ case REPEATING_COMMAND_BLOCK:
+ case CHAIN_COMMAND_BLOCK:
case BEACON:
case DAYLIGHT_DETECTOR:
- case DAYLIGHT_DETECTOR_INVERTED:
case HOPPER:
- case REDSTONE_COMPARATOR:
- case FLOWER_POT_ITEM:
+ case COMPARATOR:
case SHIELD:
case STRUCTURE_BLOCK:
case WHITE_SHULKER_BOX:
@@ -126,7 +212,7 @@ public final class CraftItemFactory implements ItemFactory {
case LIME_SHULKER_BOX:
case PINK_SHULKER_BOX:
case GRAY_SHULKER_BOX:
- case SILVER_SHULKER_BOX:
+ case LIGHT_GRAY_SHULKER_BOX:
case CYAN_SHULKER_BOX:
case PURPLE_SHULKER_BOX:
case BLUE_SHULKER_BOX:
@@ -136,6 +222,8 @@ public final class CraftItemFactory implements ItemFactory {
case BLACK_SHULKER_BOX:
case ENDER_CHEST:
return new CraftMetaBlockState(meta, material);
+ case TROPICAL_FISH_BUCKET:
+ return meta instanceof CraftMetaTropicalFishBucket ? meta : new CraftMetaTropicalFishBucket(meta);
default:
return new CraftMetaItem(meta);
}
@@ -194,4 +282,9 @@ public final class CraftItemFactory implements ItemFactory {
public Color getDefaultLeatherColor() {
return DEFAULT_LEATHER_COLOR;
}
+
+ @Override
+ public Material updateMaterial(ItemMeta meta, Material material) throws IllegalArgumentException {
+ return ((CraftMetaItem) meta).updateMaterial(material);
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index fb1dc542..4c4f0455 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -18,9 +18,11 @@ import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
+import org.bukkit.material.MaterialData;
import com.google.common.collect.ImmutableMap;
import org.bukkit.craftbukkit.enchantments.CraftEnchantment;
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
@DelegateDeserialization(ItemStack.class)
public final class CraftItemStack extends ItemStack {
@@ -30,17 +32,17 @@ public final class CraftItemStack extends ItemStack {
CraftItemStack stack = (CraftItemStack) original;
return stack.handle == null ? net.minecraft.server.ItemStack.a : stack.handle.cloneItemStack();
}
- if (original == null || original.getTypeId() <= 0) {
+ if (original == null || original.getType() == Material.AIR) {
return net.minecraft.server.ItemStack.a;
}
- Item item = CraftMagicNumbers.getItem(original.getType());
+ Item item = CraftMagicNumbers.getItem(original.getType(), original.getDurability());
if (item == null) {
return net.minecraft.server.ItemStack.a;
}
- net.minecraft.server.ItemStack stack = new net.minecraft.server.ItemStack(item, original.getAmount(), original.getDurability(), false);
+ net.minecraft.server.ItemStack stack = new net.minecraft.server.ItemStack(item, original.getAmount());
if (original.hasItemMeta()) {
setItemMeta(stack, original.getItemMeta());
} else {
@@ -63,7 +65,7 @@ public final class CraftItemStack extends ItemStack {
if (original.isEmpty()) {
return new ItemStack(Material.AIR);
}
- ItemStack stack = new ItemStack(CraftMagicNumbers.getMaterial(original.getItem()), original.getCount(), (short) original.getData());
+ ItemStack stack = new ItemStack(CraftMagicNumbers.getMaterial(original.getItem()), original.getCount());
if (hasItemMeta(original)) {
stack.setItemMeta(getItemMeta(original));
}
@@ -100,7 +102,7 @@ public final class CraftItemStack extends ItemStack {
}
private CraftItemStack(ItemStack item) {
- this(item.getTypeId(), item.getAmount(), item.getDurability(), item.hasItemMeta() ? item.getItemMeta() : null);
+ this(item.getType(), item.getAmount(), item.getDurability(), item.hasItemMeta() ? item.getItemMeta() : null);
}
private CraftItemStack(Material type, int amount, short durability, ItemMeta itemMeta) {
@@ -110,26 +112,26 @@ public final class CraftItemStack extends ItemStack {
setItemMeta(itemMeta);
}
- private CraftItemStack(int typeId, int amount, short durability, ItemMeta itemMeta) {
- this(Material.getMaterial(typeId), amount, durability, itemMeta);
-
+ @Override
+ public MaterialData getData() {
+ return handle != null ? CraftMagicNumbers.getMaterialData(handle.getItem()) : super.getData();
}
@Override
- public int getTypeId() {
- return handle != null ? CraftMagicNumbers.getId(handle.getItem()) : 0;
+ public Material getType() {
+ return handle != null ? CraftMagicNumbers.getMaterial(handle.getItem()) : Material.AIR;
}
@Override
- public void setTypeId(int type) {
- if (getTypeId() == type) {
+ public void setType(Material type) {
+ if (getType() == type) {
return;
- } else if (type == 0) {
+ } else if (type == Material.AIR) {
handle = null;
} else if (CraftMagicNumbers.getItem(type) == null) { // :(
handle = null;
} else if (handle == null) {
- handle = new net.minecraft.server.ItemStack(CraftMagicNumbers.getItem(type), 1, 0);
+ handle = new net.minecraft.server.ItemStack(CraftMagicNumbers.getItem(type), 1);
} else {
handle.setItem(CraftMagicNumbers.getItem(type));
if (hasItemMeta()) {
@@ -161,14 +163,14 @@ public final class CraftItemStack extends ItemStack {
public void setDurability(final short durability) {
// Ignore damage if item is null
if (handle != null) {
- handle.setData(durability);
+ handle.setDamage(durability);
}
}
@Override
public short getDurability() {
if (handle != null) {
- return (short) handle.getData();
+ return (short) handle.getDamage();
} else {
return -1;
}
@@ -195,14 +197,14 @@ public final class CraftItemStack extends ItemStack {
for (int i = 0; i < size; i++) {
NBTTagCompound tag = (NBTTagCompound) list.get(i);
- short id = tag.getShort(ENCHANTMENTS_ID.NBT);
- if (id == ench.getId()) {
+ String id = tag.getString(ENCHANTMENTS_ID.NBT);
+ if (id.equals(ench.getKey().toString())) {
tag.setShort(ENCHANTMENTS_LVL.NBT, (short) level);
return;
}
}
NBTTagCompound tag = new NBTTagCompound();
- tag.setShort(ENCHANTMENTS_ID.NBT, (short) ench.getId());
+ tag.setString(ENCHANTMENTS_ID.NBT, ench.getKey().toString());
tag.setShort(ENCHANTMENTS_LVL.NBT, (short) level);
list.add(tag);
}
@@ -247,8 +249,8 @@ public final class CraftItemStack extends ItemStack {
for (int i = 0; i < size; i++) {
NBTTagCompound enchantment = (NBTTagCompound) list.get(i);
- int id = 0xffff & enchantment.getShort(ENCHANTMENTS_ID.NBT);
- if (id == ench.getId()) {
+ String id = enchantment.getString(ENCHANTMENTS_ID.NBT);
+ if (id.equals(ench.getKey().toString())) {
index = i;
level = 0xffff & enchantment.getShort(ENCHANTMENTS_LVL.NBT);
break;
@@ -293,10 +295,10 @@ public final class CraftItemStack extends ItemStack {
ImmutableMap.Builder<Enchantment, Integer> result = ImmutableMap.builder();
for (int i = 0; i < list.size(); i++) {
- int id = 0xffff & ((NBTTagCompound) list.get(i)).getShort(ENCHANTMENTS_ID.NBT);
+ String id = ((NBTTagCompound) list.get(i)).getString(ENCHANTMENTS_ID.NBT);
int level = 0xffff & ((NBTTagCompound) list.get(i)).getShort(ENCHANTMENTS_LVL.NBT);
- result.put(Enchantment.getById(id), level);
+ result.put(Enchantment.getByKey(CraftNamespacedKey.fromString(id)), level);
}
return result.build();
@@ -327,9 +329,21 @@ public final class CraftItemStack extends ItemStack {
switch (getType(item)) {
case WRITTEN_BOOK:
return new CraftMetaBookSigned(item.getTag());
- case BOOK_AND_QUILL:
+ case WRITABLE_BOOK:
return new CraftMetaBook(item.getTag());
- case SKULL_ITEM:
+ case CREEPER_HEAD:
+ case CREEPER_WALL_HEAD:
+ case DRAGON_HEAD:
+ case DRAGON_WALL_HEAD:
+ case PISTON_HEAD:
+ case PLAYER_HEAD:
+ case PLAYER_WALL_HEAD:
+ case SKELETON_SKULL:
+ case SKELETON_WALL_SKULL:
+ case WITHER_SKELETON_SKULL:
+ case WITHER_SKELETON_WALL_SKULL:
+ case ZOMBIE_HEAD:
+ case ZOMBIE_WALL_HEAD:
return new CraftMetaSkull(item.getTag());
case LEATHER_HELMET:
case LEATHER_CHESTPLATE:
@@ -341,17 +355,90 @@ public final class CraftItemStack extends ItemStack {
case LINGERING_POTION:
case TIPPED_ARROW:
return new CraftMetaPotion(item.getTag());
- case MAP:
+ case FILLED_MAP:
return new CraftMetaMap(item.getTag());
- case FIREWORK:
+ case FIREWORK_ROCKET:
return new CraftMetaFirework(item.getTag());
- case FIREWORK_CHARGE:
+ case FIREWORK_STAR:
return new CraftMetaCharge(item.getTag());
case ENCHANTED_BOOK:
return new CraftMetaEnchantedBook(item.getTag());
- case BANNER:
+ case BLACK_BANNER:
+ case BLACK_WALL_BANNER:
+ case BLUE_BANNER:
+ case BLUE_WALL_BANNER:
+ case BROWN_BANNER:
+ case BROWN_WALL_BANNER:
+ case CYAN_BANNER:
+ case CYAN_WALL_BANNER:
+ case GRAY_BANNER:
+ case GRAY_WALL_BANNER:
+ case GREEN_BANNER:
+ case GREEN_WALL_BANNER:
+ case LIGHT_BLUE_BANNER:
+ case LIGHT_BLUE_WALL_BANNER:
+ case LIGHT_GRAY_BANNER:
+ case LIGHT_GRAY_WALL_BANNER:
+ case LIME_BANNER:
+ case LIME_WALL_BANNER:
+ case MAGENTA_BANNER:
+ case MAGENTA_WALL_BANNER:
+ case ORANGE_BANNER:
+ case ORANGE_WALL_BANNER:
+ case PINK_BANNER:
+ case PINK_WALL_BANNER:
+ case PURPLE_BANNER:
+ case PURPLE_WALL_BANNER:
+ case RED_BANNER:
+ case RED_WALL_BANNER:
+ case WHITE_BANNER:
+ case WHITE_WALL_BANNER:
+ case YELLOW_BANNER:
+ case YELLOW_WALL_BANNER:
return new CraftMetaBanner(item.getTag());
- case MONSTER_EGG:
+ case BAT_SPAWN_EGG:
+ case BLAZE_SPAWN_EGG:
+ case CAVE_SPIDER_SPAWN_EGG:
+ case CHICKEN_SPAWN_EGG:
+ case COW_SPAWN_EGG:
+ case CREEPER_SPAWN_EGG:
+ case DONKEY_SPAWN_EGG:
+ case ELDER_GUARDIAN_SPAWN_EGG:
+ case ENDERMAN_SPAWN_EGG:
+ case ENDERMITE_SPAWN_EGG:
+ case EVOKER_SPAWN_EGG:
+ case GHAST_SPAWN_EGG:
+ case GUARDIAN_SPAWN_EGG:
+ case HORSE_SPAWN_EGG:
+ case HUSK_SPAWN_EGG:
+ case LLAMA_SPAWN_EGG:
+ case MAGMA_CUBE_SPAWN_EGG:
+ case MOOSHROOM_SPAWN_EGG:
+ case MULE_SPAWN_EGG:
+ case OCELOT_SPAWN_EGG:
+ case PARROT_SPAWN_EGG:
+ case PIG_SPAWN_EGG:
+ case POLAR_BEAR_SPAWN_EGG:
+ case RABBIT_SPAWN_EGG:
+ case SHEEP_SPAWN_EGG:
+ case SHULKER_SPAWN_EGG:
+ case SILVERFISH_SPAWN_EGG:
+ case SKELETON_HORSE_SPAWN_EGG:
+ case SKELETON_SPAWN_EGG:
+ case SLIME_SPAWN_EGG:
+ case SPIDER_SPAWN_EGG:
+ case SQUID_SPAWN_EGG:
+ case STRAY_SPAWN_EGG:
+ case VEX_SPAWN_EGG:
+ case VILLAGER_SPAWN_EGG:
+ case VINDICATOR_SPAWN_EGG:
+ case WITCH_SPAWN_EGG:
+ case WITHER_SKELETON_SPAWN_EGG:
+ case WOLF_SPAWN_EGG:
+ case ZOMBIE_HORSE_SPAWN_EGG:
+ case ZOMBIE_PIGMAN_SPAWN_EGG:
+ case ZOMBIE_SPAWN_EGG:
+ case ZOMBIE_VILLAGER_SPAWN_EGG:
return new CraftMetaSpawnEgg(item.getTag());
case KNOWLEDGE_BOOK:
return new CraftMetaKnowledgeBook(item.getTag());
@@ -362,19 +449,17 @@ public final class CraftItemStack extends ItemStack {
case DISPENSER:
case DROPPER:
case SIGN:
- case MOB_SPAWNER:
+ case SPAWNER:
case NOTE_BLOCK:
- case BREWING_STAND_ITEM:
- case ENCHANTMENT_TABLE:
- case COMMAND:
- case COMMAND_REPEATING:
- case COMMAND_CHAIN:
+ case BREWING_STAND:
+ case ENCHANTING_TABLE:
+ case COMMAND_BLOCK:
+ case REPEATING_COMMAND_BLOCK:
+ case CHAIN_COMMAND_BLOCK:
case BEACON:
case DAYLIGHT_DETECTOR:
- case DAYLIGHT_DETECTOR_INVERTED:
case HOPPER:
- case REDSTONE_COMPARATOR:
- case FLOWER_POT_ITEM:
+ case COMPARATOR:
case SHIELD:
case STRUCTURE_BLOCK:
case WHITE_SHULKER_BOX:
@@ -385,7 +470,7 @@ public final class CraftItemStack extends ItemStack {
case LIME_SHULKER_BOX:
case PINK_SHULKER_BOX:
case GRAY_SHULKER_BOX:
- case SILVER_SHULKER_BOX:
+ case LIGHT_GRAY_SHULKER_BOX:
case CYAN_SHULKER_BOX:
case PURPLE_SHULKER_BOX:
case BLUE_SHULKER_BOX:
@@ -395,14 +480,15 @@ public final class CraftItemStack extends ItemStack {
case BLACK_SHULKER_BOX:
case ENDER_CHEST:
return new CraftMetaBlockState(item.getTag(), CraftMagicNumbers.getMaterial(item.getItem()));
+ case TROPICAL_FISH_BUCKET:
+ return new CraftMetaTropicalFishBucket(item.getTag());
default:
return new CraftMetaItem(item.getTag());
}
}
static Material getType(net.minecraft.server.ItemStack item) {
- Material material = Material.getMaterial(item == null ? 0 : CraftMagicNumbers.getId(item.getItem()));
- return material == null ? Material.AIR : material;
+ return item == null ? Material.AIR : CraftMagicNumbers.getMaterial(item.getItem());
}
@Override
@@ -425,6 +511,12 @@ public final class CraftItemStack extends ItemStack {
itemMeta = CraftItemFactory.instance().asMetaFor(itemMeta, getType(item));
if (itemMeta == null) return true;
+ Item oldItem = item.getItem();
+ Item newItem = CraftMagicNumbers.getItem(CraftItemFactory.instance().updateMaterial(itemMeta, CraftMagicNumbers.getMaterial(oldItem)));
+ if (oldItem != newItem) {
+ item.setItem(newItem);
+ }
+
NBTTagCompound tag = new NBTTagCompound();
item.setTag(tag);
@@ -453,7 +545,7 @@ public final class CraftItemStack extends ItemStack {
if (handle == null || that.handle == null) {
return false;
}
- if (!(that.getTypeId() == getTypeId() && getDurability() == that.getDurability())) {
+ if (!(that.getType() == getType() && getDurability() == that.getDurability())) {
return false;
}
return hasItemMeta() ? that.hasItemMeta() && handle.getTag().equals(that.handle.getTag()) : !that.hasItemMeta();
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java
index 527e7ba9..bc898d69 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java
@@ -62,12 +62,12 @@ public class CraftMerchantCustom extends CraftMerchant {
}
@Override
- public World u_() {
+ public World getWorld() {
return null;
}
@Override
- public BlockPosition v_() {
+ public BlockPosition getPosition() {
return null;
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java
index 7b356789..4d1cc88a 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java
@@ -52,7 +52,7 @@ public class CraftMetaBanner extends CraftMetaItem implements BannerMeta {
if (entityTag.hasKey(PATTERNS.NBT)) {
NBTTagList patterns = entityTag.getList(PATTERNS.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND);
for (int i = 0; i < Math.min(patterns.size(), 20); i++) {
- NBTTagCompound p = patterns.get(i);
+ NBTTagCompound p = patterns.getCompound(i);
this.patterns.add(new Pattern(DyeColor.getByDyeData((byte) p.getInt(COLOR.NBT)), PatternType.getByIdentifier(p.getString(PATTERN.NBT))));
}
}
@@ -198,7 +198,43 @@ public class CraftMetaBanner extends CraftMetaItem implements BannerMeta {
@Override
boolean applicableTo(Material type) {
- return type == Material.BANNER;
+ switch (type) {
+ case BLACK_BANNER:
+ case BLACK_WALL_BANNER:
+ case BLUE_BANNER:
+ case BLUE_WALL_BANNER:
+ case BROWN_BANNER:
+ case BROWN_WALL_BANNER:
+ case CYAN_BANNER:
+ case CYAN_WALL_BANNER:
+ case GRAY_BANNER:
+ case GRAY_WALL_BANNER:
+ case GREEN_BANNER:
+ case GREEN_WALL_BANNER:
+ case LIGHT_BLUE_BANNER:
+ case LIGHT_BLUE_WALL_BANNER:
+ case LIGHT_GRAY_BANNER:
+ case LIGHT_GRAY_WALL_BANNER:
+ case LIME_BANNER:
+ case LIME_WALL_BANNER:
+ case MAGENTA_BANNER:
+ case MAGENTA_WALL_BANNER:
+ case ORANGE_BANNER:
+ case ORANGE_WALL_BANNER:
+ case PINK_BANNER:
+ case PINK_WALL_BANNER:
+ case PURPLE_BANNER:
+ case PURPLE_WALL_BANNER:
+ case RED_BANNER:
+ case RED_WALL_BANNER:
+ case WHITE_BANNER:
+ case WHITE_WALL_BANNER:
+ case YELLOW_BANNER:
+ case YELLOW_WALL_BANNER:
+ return true;
+ default:
+ return false;
+ }
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
index 3bd9ee47..2e44d133 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
@@ -18,12 +18,11 @@ import net.minecraft.server.TileEntityDropper;
import net.minecraft.server.TileEntityEnchantTable;
import net.minecraft.server.TileEntityEndGateway;
import net.minecraft.server.TileEntityEnderChest;
-import net.minecraft.server.TileEntityFlowerPot;
import net.minecraft.server.TileEntityFurnace;
import net.minecraft.server.TileEntityHopper;
+import net.minecraft.server.TileEntityJukeBox;
import net.minecraft.server.TileEntityLightDetector;
import net.minecraft.server.TileEntityMobSpawner;
-import net.minecraft.server.TileEntityNote;
import net.minecraft.server.TileEntityShulkerBox;
import net.minecraft.server.TileEntitySign;
import net.minecraft.server.TileEntitySkull;
@@ -46,11 +45,9 @@ import org.bukkit.craftbukkit.block.CraftDropper;
import org.bukkit.craftbukkit.block.CraftEnchantingTable;
import org.bukkit.craftbukkit.block.CraftEndGateway;
import org.bukkit.craftbukkit.block.CraftEnderChest;
-import org.bukkit.craftbukkit.block.CraftFlowerPot;
import org.bukkit.craftbukkit.block.CraftFurnace;
import org.bukkit.craftbukkit.block.CraftHopper;
import org.bukkit.craftbukkit.block.CraftJukebox;
-import org.bukkit.craftbukkit.block.CraftNoteBlock;
import org.bukkit.craftbukkit.block.CraftShulkerBox;
import org.bukkit.craftbukkit.block.CraftSign;
import org.bukkit.craftbukkit.block.CraftSkull;
@@ -176,19 +173,17 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
case DISPENSER:
case DROPPER:
case SIGN:
- case MOB_SPAWNER:
+ case SPAWNER:
case NOTE_BLOCK:
- case BREWING_STAND_ITEM:
- case ENCHANTMENT_TABLE:
- case COMMAND:
- case COMMAND_REPEATING:
- case COMMAND_CHAIN:
+ case BREWING_STAND:
+ case ENCHANTING_TABLE:
+ case COMMAND_BLOCK:
+ case REPEATING_COMMAND_BLOCK:
+ case CHAIN_COMMAND_BLOCK:
case BEACON:
case DAYLIGHT_DETECTOR:
- case DAYLIGHT_DETECTOR_INVERTED:
case HOPPER:
- case REDSTONE_COMPARATOR:
- case FLOWER_POT_ITEM:
+ case COMPARATOR:
case SHIELD:
case STRUCTURE_BLOCK:
case WHITE_SHULKER_BOX:
@@ -199,7 +194,7 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
case LIME_SHULKER_BOX:
case PINK_SHULKER_BOX:
case GRAY_SHULKER_BOX:
- case SILVER_SHULKER_BOX:
+ case LIGHT_GRAY_SHULKER_BOX:
case CYAN_SHULKER_BOX:
case PURPLE_SHULKER_BOX:
case BLUE_SHULKER_BOX:
@@ -217,7 +212,7 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
public CraftMetaBlockState clone() {
CraftMetaBlockState meta = (CraftMetaBlockState) super.clone();
if (blockEntityTag != null) {
- meta.blockEntityTag = blockEntityTag.g();
+ meta.blockEntityTag = blockEntityTag.clone();
}
return meta;
}
@@ -242,7 +237,7 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
case LIME_SHULKER_BOX:
case PINK_SHULKER_BOX:
case GRAY_SHULKER_BOX:
- case SILVER_SHULKER_BOX:
+ case LIGHT_GRAY_SHULKER_BOX:
case CYAN_SHULKER_BOX:
case PURPLE_SHULKER_BOX:
case BLUE_SHULKER_BOX:
@@ -254,11 +249,10 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
break;
}
}
- TileEntity te = (blockEntityTag == null) ? null : TileEntity.create(null, blockEntityTag);
+ TileEntity te = (blockEntityTag == null) ? null : TileEntity.create(blockEntityTag);
switch (material) {
case SIGN:
- case SIGN_POST:
case WALL_SIGN:
if (te == null) {
te = new TileEntitySign();
@@ -270,7 +264,6 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
te = new TileEntityChest();
}
return new CraftChest(material, (TileEntityChest) te);
- case BURNING_FURNACE:
case FURNACE:
if (te == null) {
te = new TileEntityFurnace();
@@ -296,34 +289,41 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
te = new TileEntityHopper();
}
return new CraftHopper(material, (TileEntityHopper) te);
- case MOB_SPAWNER:
+ case SPAWNER:
if (te == null) {
te = new TileEntityMobSpawner();
}
return new CraftCreatureSpawner(material, (TileEntityMobSpawner) te);
- case NOTE_BLOCK:
- if (te == null) {
- te = new TileEntityNote();
- }
- return new CraftNoteBlock(material, (TileEntityNote) te);
case JUKEBOX:
if (te == null) {
- te = new BlockJukeBox.TileEntityRecordPlayer();
+ te = new TileEntityJukeBox();
}
- return new CraftJukebox(material, (BlockJukeBox.TileEntityRecordPlayer) te);
- case BREWING_STAND_ITEM:
+ return new CraftJukebox(material, (TileEntityJukeBox) te);
+ case BREWING_STAND:
if (te == null) {
te = new TileEntityBrewingStand();
}
return new CraftBrewingStand(material, (TileEntityBrewingStand) te);
- case SKULL:
+ case CREEPER_HEAD:
+ case CREEPER_WALL_HEAD:
+ case DRAGON_HEAD:
+ case DRAGON_WALL_HEAD:
+ case PISTON_HEAD:
+ case PLAYER_HEAD:
+ case PLAYER_WALL_HEAD:
+ case SKELETON_SKULL:
+ case SKELETON_WALL_SKULL:
+ case WITHER_SKELETON_SKULL:
+ case WITHER_SKELETON_WALL_SKULL:
+ case ZOMBIE_HEAD:
+ case ZOMBIE_WALL_HEAD:
if (te == null) {
te = new TileEntitySkull();
}
return new CraftSkull(material, (TileEntitySkull) te);
- case COMMAND:
- case COMMAND_REPEATING:
- case COMMAND_CHAIN:
+ case COMMAND_BLOCK:
+ case REPEATING_COMMAND_BLOCK:
+ case CHAIN_COMMAND_BLOCK:
if (te == null) {
te = new TileEntityCommand();
}
@@ -334,18 +334,42 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
}
return new CraftBeacon(material, (TileEntityBeacon) te);
case SHIELD:
- case BANNER:
- case WALL_BANNER:
- case STANDING_BANNER:
+ case BLACK_BANNER:
+ case BLACK_WALL_BANNER:
+ case BLUE_BANNER:
+ case BLUE_WALL_BANNER:
+ case BROWN_BANNER:
+ case BROWN_WALL_BANNER:
+ case CYAN_BANNER:
+ case CYAN_WALL_BANNER:
+ case GRAY_BANNER:
+ case GRAY_WALL_BANNER:
+ case GREEN_BANNER:
+ case GREEN_WALL_BANNER:
+ case LIGHT_BLUE_BANNER:
+ case LIGHT_BLUE_WALL_BANNER:
+ case LIGHT_GRAY_BANNER:
+ case LIGHT_GRAY_WALL_BANNER:
+ case LIME_BANNER:
+ case LIME_WALL_BANNER:
+ case MAGENTA_BANNER:
+ case MAGENTA_WALL_BANNER:
+ case ORANGE_BANNER:
+ case ORANGE_WALL_BANNER:
+ case PINK_BANNER:
+ case PINK_WALL_BANNER:
+ case PURPLE_BANNER:
+ case PURPLE_WALL_BANNER:
+ case RED_BANNER:
+ case RED_WALL_BANNER:
+ case WHITE_BANNER:
+ case WHITE_WALL_BANNER:
+ case YELLOW_BANNER:
+ case YELLOW_WALL_BANNER:
if (te == null) {
te = new TileEntityBanner();
}
return new CraftBanner(material, (TileEntityBanner) te);
- case FLOWER_POT_ITEM:
- if (te == null) {
- te = new TileEntityFlowerPot();
- }
- return new CraftFlowerPot(material, (TileEntityFlowerPot) te);
case STRUCTURE_BLOCK:
if (te == null) {
te = new TileEntityStructure();
@@ -359,7 +383,7 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
case LIME_SHULKER_BOX:
case PINK_SHULKER_BOX:
case GRAY_SHULKER_BOX:
- case SILVER_SHULKER_BOX:
+ case LIGHT_GRAY_SHULKER_BOX:
case CYAN_SHULKER_BOX:
case PURPLE_SHULKER_BOX:
case BLUE_SHULKER_BOX:
@@ -371,7 +395,7 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
te = new TileEntityShulkerBox();
}
return new CraftShulkerBox(material, (TileEntityShulkerBox) te);
- case ENCHANTMENT_TABLE:
+ case ENCHANTING_TABLE:
if (te == null) {
te = new TileEntityEnchantTable();
}
@@ -382,17 +406,15 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
}
return new CraftEnderChest(material, (TileEntityEnderChest) te);
case DAYLIGHT_DETECTOR:
- case DAYLIGHT_DETECTOR_INVERTED:
if (te == null){
te = new TileEntityLightDetector();
}
return new CraftDaylightDetector(material, (TileEntityLightDetector) te);
- case REDSTONE_COMPARATOR:
+ case COMPARATOR:
if (te == null){
te = new TileEntityComparator();
}
return new CraftComparator(material, (TileEntityComparator) te);
- case PISTON_BASE:
default:
throw new IllegalStateException("Missing blockState for " + material);
}
@@ -405,7 +427,6 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
boolean valid;
switch (material) {
case SIGN:
- case SIGN_POST:
case WALL_SIGN:
valid = blockState instanceof CraftSign;
break;
@@ -413,7 +434,6 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
case TRAPPED_CHEST:
valid = blockState instanceof CraftChest;
break;
- case BURNING_FURNACE:
case FURNACE:
valid = blockState instanceof CraftFurnace;
break;
@@ -429,38 +449,73 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
case HOPPER:
valid = blockState instanceof CraftHopper;
break;
- case MOB_SPAWNER:
+ case SPAWNER:
valid = blockState instanceof CraftCreatureSpawner;
break;
- case NOTE_BLOCK:
- valid = blockState instanceof CraftNoteBlock;
- break;
case JUKEBOX:
valid = blockState instanceof CraftJukebox;
break;
- case BREWING_STAND_ITEM:
+ case BREWING_STAND:
valid = blockState instanceof CraftBrewingStand;
break;
- case SKULL:
+ case CREEPER_HEAD:
+ case CREEPER_WALL_HEAD:
+ case DRAGON_HEAD:
+ case DRAGON_WALL_HEAD:
+ case PISTON_HEAD:
+ case PLAYER_HEAD:
+ case PLAYER_WALL_HEAD:
+ case SKELETON_SKULL:
+ case SKELETON_WALL_SKULL:
+ case WITHER_SKELETON_SKULL:
+ case WITHER_SKELETON_WALL_SKULL:
+ case ZOMBIE_HEAD:
+ case ZOMBIE_WALL_HEAD:
valid = blockState instanceof CraftSkull;
break;
- case COMMAND:
- case COMMAND_REPEATING:
- case COMMAND_CHAIN:
+ case COMMAND_BLOCK:
+ case REPEATING_COMMAND_BLOCK:
+ case CHAIN_COMMAND_BLOCK:
valid = blockState instanceof CraftCommandBlock;
break;
case BEACON:
valid = blockState instanceof CraftBeacon;
break;
case SHIELD:
- case BANNER:
- case WALL_BANNER:
- case STANDING_BANNER:
+ case BLACK_BANNER:
+ case BLACK_WALL_BANNER:
+ case BLUE_BANNER:
+ case BLUE_WALL_BANNER:
+ case BROWN_BANNER:
+ case BROWN_WALL_BANNER:
+ case CYAN_BANNER:
+ case CYAN_WALL_BANNER:
+ case GRAY_BANNER:
+ case GRAY_WALL_BANNER:
+ case GREEN_BANNER:
+ case GREEN_WALL_BANNER:
+ case LIGHT_BLUE_BANNER:
+ case LIGHT_BLUE_WALL_BANNER:
+ case LIGHT_GRAY_BANNER:
+ case LIGHT_GRAY_WALL_BANNER:
+ case LIME_BANNER:
+ case LIME_WALL_BANNER:
+ case MAGENTA_BANNER:
+ case MAGENTA_WALL_BANNER:
+ case ORANGE_BANNER:
+ case ORANGE_WALL_BANNER:
+ case PINK_BANNER:
+ case PINK_WALL_BANNER:
+ case PURPLE_BANNER:
+ case PURPLE_WALL_BANNER:
+ case RED_BANNER:
+ case RED_WALL_BANNER:
+ case WHITE_BANNER:
+ case WHITE_WALL_BANNER:
+ case YELLOW_BANNER:
+ case YELLOW_WALL_BANNER:
valid = blockState instanceof CraftBanner;
break;
- case FLOWER_POT_ITEM:
- valid = blockState instanceof CraftFlowerPot;
- break;
case STRUCTURE_BLOCK:
valid = blockState instanceof CraftStructureBlock;
break;
@@ -472,7 +527,7 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
case LIME_SHULKER_BOX:
case PINK_SHULKER_BOX:
case GRAY_SHULKER_BOX:
- case SILVER_SHULKER_BOX:
+ case LIGHT_GRAY_SHULKER_BOX:
case CYAN_SHULKER_BOX:
case PURPLE_SHULKER_BOX:
case BLUE_SHULKER_BOX:
@@ -482,17 +537,16 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
case BLACK_SHULKER_BOX:
valid = blockState instanceof CraftShulkerBox;
break;
- case ENCHANTMENT_TABLE:
+ case ENCHANTING_TABLE:
valid = blockState instanceof CraftEnchantingTable;
break;
case ENDER_CHEST:
valid = blockState instanceof CraftEnderChest;
break;
case DAYLIGHT_DETECTOR:
- case DAYLIGHT_DETECTOR_INVERTED:
valid = blockState instanceof CraftDaylightDetector;
break;
- case REDSTONE_COMPARATOR:
+ case COMPARATOR:
valid = blockState instanceof CraftComparator;
break;
default:
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
index 9c9ef295..c8654c68 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
@@ -158,7 +158,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
boolean applicableTo(Material type) {
switch (type) {
case WRITTEN_BOOK:
- case BOOK_AND_QUILL:
+ case WRITABLE_BOOK:
return true;
default:
return false;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java
index bffbe901..5050b609 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java
@@ -96,7 +96,7 @@ class CraftMetaBookSigned extends CraftMetaBook implements BookMeta {
boolean applicableTo(Material type) {
switch (type) {
case WRITTEN_BOOK:
- case BOOK_AND_QUILL:
+ case WRITABLE_BOOK:
return true;
default:
return false;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCharge.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCharge.java
index 6c6fde73..267581ec 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCharge.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCharge.java
@@ -67,7 +67,7 @@ class CraftMetaCharge extends CraftMetaItem implements FireworkEffectMeta {
@Override
boolean applicableTo(Material type) {
switch (type) {
- case FIREWORK_CHARGE:
+ case FIREWORK_STAR:
return true;
default:
return false;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
index 682c2287..b82e2fdf 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
@@ -253,7 +253,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta {
@Override
boolean applicableTo(Material type) {
switch(type) {
- case FIREWORK:
+ case FIREWORK_ROCKET:
return true;
default:
return false;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 8d82c4dc..dfd6e66b 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -13,6 +13,7 @@ import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
+import net.minecraft.server.IChatBaseComponent;
import net.minecraft.server.NBTBase;
import net.minecraft.server.NBTTagCompound;
import net.minecraft.server.NBTTagList;
@@ -25,9 +26,12 @@ import org.bukkit.configuration.serialization.DelegateDeserialization;
import org.bukkit.configuration.serialization.SerializableAs;
import org.bukkit.craftbukkit.Overridden;
import org.bukkit.craftbukkit.inventory.CraftMetaItem.ItemMetaKey.Specific;
+import org.bukkit.craftbukkit.util.CraftChatMessage;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemFlag;
+import org.bukkit.inventory.meta.Damageable;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.Repairable;
@@ -70,7 +74,7 @@ import org.apache.commons.codec.binary.Base64;
* <li> SerializableMeta.Deserializers deserializer()
*/
@DelegateDeserialization(CraftMetaItem.SerializableMeta.class)
-class CraftMetaItem implements ItemMeta, Repairable {
+class CraftMetaItem implements ItemMeta, Damageable, Repairable {
static class ItemMetaKey {
@@ -120,6 +124,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
.put(CraftMetaFirework.class, "FIREWORK")
.put(CraftMetaCharge.class, "FIREWORK_EFFECT")
.put(CraftMetaKnowledgeBook.class, "KNOWLEDGE_BOOK")
+ .put(CraftMetaTropicalFishBucket.class, "TROPICAL_FISH_BUCKET")
.put(CraftMetaItem.class, "UNSPECIFIC")
.build();
@@ -192,7 +197,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
@Specific(Specific.To.NBT)
static final ItemMetaKey DISPLAY = new ItemMetaKey("display");
static final ItemMetaKey LORE = new ItemMetaKey("Lore", "lore");
- static final ItemMetaKey ENCHANTMENTS = new ItemMetaKey("ench", "enchants");
+ static final ItemMetaKey ENCHANTMENTS = new ItemMetaKey("Enchantments", "enchants");
@Specific(Specific.To.NBT)
static final ItemMetaKey ENCHANTMENTS_ID = new ItemMetaKey("id");
@Specific(Specific.To.NBT)
@@ -216,14 +221,17 @@ class CraftMetaItem implements ItemMeta, Repairable {
static final ItemMetaKey HIDEFLAGS = new ItemMetaKey("HideFlags", "ItemFlags");
@Specific(Specific.To.NBT)
static final ItemMetaKey UNBREAKABLE = new ItemMetaKey("Unbreakable");
+ @Specific(Specific.To.NBT)
+ static final ItemMetaKey DAMAGE = new ItemMetaKey("Damage");
- private String displayName;
- private String locName;
+ private IChatBaseComponent displayName;
+ private IChatBaseComponent locName;
private List<String> lore;
private Map<Enchantment, Integer> enchantments;
private int repairCost;
private int hideFlag;
private boolean unbreakable;
+ private int damage;
private static final Set<String> HANDLED_TAGS = Sets.newHashSet();
@@ -249,6 +257,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
this.repairCost = meta.repairCost;
this.hideFlag = meta.hideFlag;
this.unbreakable = meta.unbreakable;
+ this.damage = meta.damage;
this.unhandledTags.putAll(meta.unhandledTags);
this.internalTag = meta.internalTag;
@@ -262,11 +271,11 @@ class CraftMetaItem implements ItemMeta, Repairable {
NBTTagCompound display = tag.getCompound(DISPLAY.NBT);
if (display.hasKey(NAME.NBT)) {
- displayName = display.getString(NAME.NBT);
+ displayName = IChatBaseComponent.ChatSerializer.a(display.getString(NAME.NBT));
}
if (display.hasKey(LOCNAME.NBT)) {
- locName = display.getString(LOCNAME.NBT);
+ locName = IChatBaseComponent.ChatSerializer.a(display.getString(LOCNAME.NBT));
}
if (display.hasKey(LORE.NBT)) {
@@ -292,6 +301,9 @@ class CraftMetaItem implements ItemMeta, Repairable {
if (tag.hasKey(UNBREAKABLE.NBT)) {
unbreakable = tag.getBoolean(UNBREAKABLE.NBT);
}
+ if (tag.hasKey(DAMAGE.NBT)) {
+ damage = tag.getInt(DAMAGE.NBT);
+ }
if (tag.get(ATTRIBUTES.NBT) instanceof NBTTagList) {
NBTTagList save = null;
@@ -339,7 +351,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
unhandledTags.put(ATTRIBUTES.NBT, save);
}
- Set<String> keys = tag.c();
+ Set<String> keys = tag.getKeys();
for (String key : keys) {
if (!getHandledTags().contains(key)) {
unhandledTags.put(key, tag.get(key));
@@ -356,10 +368,10 @@ class CraftMetaItem implements ItemMeta, Repairable {
Map<Enchantment, Integer> enchantments = new HashMap<Enchantment, Integer>(ench.size());
for (int i = 0; i < ench.size(); i++) {
- int id = 0xffff & ((NBTTagCompound) ench.get(i)).getShort(ENCHANTMENTS_ID.NBT);
+ String id = ((NBTTagCompound) ench.get(i)).getString(ENCHANTMENTS_ID.NBT);
int level = 0xffff & ((NBTTagCompound) ench.get(i)).getShort(ENCHANTMENTS_LVL.NBT);
- Enchantment enchant = Enchantment.getById(id);
+ Enchantment enchant = Enchantment.getByKey(CraftNamespacedKey.fromString(id));
if (enchant != null) {
enchantments.put(enchant, level);
}
@@ -402,13 +414,18 @@ class CraftMetaItem implements ItemMeta, Repairable {
setUnbreakable(unbreakable);
}
+ Integer damage = SerializableMeta.getObject(Integer.class, map, DAMAGE.BUKKIT, true);
+ if (damage != null) {
+ setDamage(damage);
+ }
+
String internal = SerializableMeta.getString(map, "internal", true);
if (internal != null) {
ByteArrayInputStream buf = new ByteArrayInputStream(Base64.decodeBase64(internal));
try {
internalTag = NBTCompressedStreamTools.a(buf);
deserializeInternal(internalTag);
- Set<String> keys = internalTag.c();
+ Set<String> keys = internalTag.getKeys();
for (String key : keys) {
if (!getHandledTags().contains(key)) {
unhandledTags.put(key, internalTag.get(key));
@@ -449,10 +466,10 @@ class CraftMetaItem implements ItemMeta, Repairable {
@Overridden
void applyToItem(NBTTagCompound itemTag) {
if (hasDisplayName()) {
- setDisplayTag(itemTag, NAME.NBT, new NBTTagString(displayName));
+ setDisplayTag(itemTag, NAME.NBT, new NBTTagString(CraftChatMessage.toJSON(displayName)));
}
if (hasLocalizedName()){
- setDisplayTag(itemTag, LOCNAME.NBT, new NBTTagString(locName));
+ setDisplayTag(itemTag, LOCNAME.NBT, new NBTTagString(CraftChatMessage.toJSON(locName)));
}
if (hasLore()) {
@@ -473,6 +490,10 @@ class CraftMetaItem implements ItemMeta, Repairable {
itemTag.setBoolean(UNBREAKABLE.NBT, unbreakable);
}
+ if (hasDamage()) {
+ itemTag.setInt(DAMAGE.NBT, damage);
+ }
+
for (Map.Entry<String, NBTBase> e : unhandledTags.entrySet()) {
itemTag.set(e.getKey(), e.getValue());
}
@@ -501,7 +522,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
for (Map.Entry<Enchantment, Integer> entry : enchantments.entrySet()) {
NBTTagCompound subtag = new NBTTagCompound();
- subtag.setShort(ENCHANTMENTS_ID.NBT, (short) entry.getKey().getId());
+ subtag.setString(ENCHANTMENTS_ID.NBT, entry.getKey().getKey().toString());
subtag.setShort(ENCHANTMENTS_LVL.NBT, entry.getValue().shortValue());
list.add(subtag);
@@ -527,34 +548,34 @@ class CraftMetaItem implements ItemMeta, Repairable {
@Overridden
boolean isEmpty() {
- return !(hasDisplayName() || hasLocalizedName() || hasEnchants() || hasLore() || hasRepairCost() || !unhandledTags.isEmpty() || hideFlag != 0 || isUnbreakable());
+ return !(hasDisplayName() || hasLocalizedName() || hasEnchants() || hasLore() || hasRepairCost() || !unhandledTags.isEmpty() || hideFlag != 0 || isUnbreakable() || hasDamage());
}
public String getDisplayName() {
- return displayName;
+ return CraftChatMessage.fromComponent(displayName);
}
public final void setDisplayName(String name) {
- this.displayName = name;
+ this.displayName = CraftChatMessage.fromStringOrNull(name);
}
public boolean hasDisplayName() {
- return !Strings.isNullOrEmpty(displayName);
+ return displayName != null;
}
@Override
public String getLocalizedName() {
- return locName;
+ return CraftChatMessage.fromComponent(locName);
}
@Override
public void setLocalizedName(String name) {
- this.locName = name;
+ this.locName = CraftChatMessage.fromStringOrNull(name);
}
@Override
public boolean hasLocalizedName() {
- return !Strings.isNullOrEmpty(locName);
+ return locName != null;
}
public boolean hasLore() {
@@ -682,6 +703,21 @@ class CraftMetaItem implements ItemMeta, Repairable {
}
@Override
+ public boolean hasDamage() {
+ return damage > 0;
+ }
+
+ @Override
+ public int getDamage() {
+ return damage;
+ }
+
+ @Override
+ public void setDamage(int damage) {
+ this.damage = damage;
+ }
+
+ @Override
public final boolean equals(Object object) {
if (object == null) {
return false;
@@ -709,7 +745,8 @@ class CraftMetaItem implements ItemMeta, Repairable {
&& (this.hasRepairCost() ? that.hasRepairCost() && this.repairCost == that.repairCost : !that.hasRepairCost())
&& (this.unhandledTags.equals(that.unhandledTags))
&& (this.hideFlag == that.hideFlag)
- && (this.isUnbreakable() == that.isUnbreakable());
+ && (this.isUnbreakable() == that.isUnbreakable())
+ && (this.hasDamage() ? that.hasDamage() && this.damage == that.damage : !that.hasDamage());
}
/**
@@ -738,6 +775,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
hash = 61 * hash + unhandledTags.hashCode();
hash = 61 * hash + hideFlag;
hash = 61 * hash + (isUnbreakable() ? 1231 : 1237);
+ hash = 61 * hash + (hasDamage() ? this.damage : 0);
return hash;
}
@@ -754,6 +792,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
}
clone.hideFlag = this.hideFlag;
clone.unbreakable = this.unbreakable;
+ clone.damage = this.damage;
return clone;
} catch (CloneNotSupportedException e) {
throw new Error(e);
@@ -770,10 +809,10 @@ class CraftMetaItem implements ItemMeta, Repairable {
@Overridden
ImmutableMap.Builder<String, Object> serialize(ImmutableMap.Builder<String, Object> builder) {
if (hasDisplayName()) {
- builder.put(NAME.BUKKIT, displayName);
+ builder.put(NAME.BUKKIT, CraftChatMessage.fromComponent(displayName));
}
if (hasLocalizedName()) {
- builder.put(LOCNAME.BUKKIT, locName);
+ builder.put(LOCNAME.BUKKIT, CraftChatMessage.fromComponent(locName));
}
if (hasLore()) {
@@ -798,6 +837,10 @@ class CraftMetaItem implements ItemMeta, Repairable {
builder.put(UNBREAKABLE.BUKKIT, unbreakable);
}
+ if (hasDamage()) {
+ builder.put(DAMAGE.BUKKIT, damage);
+ }
+
final Map<String, NBTBase> internalTags = new HashMap<String, NBTBase>(unhandledTags);
serializeInternal(internalTags);
if (!internalTags.isEmpty()) {
@@ -820,6 +863,10 @@ class CraftMetaItem implements ItemMeta, Repairable {
void serializeInternal(final Map<String, NBTBase> unhandledTags) {
}
+ Material updateMaterial(Material material) {
+ return material;
+ }
+
static void serializeEnchantments(Map<Enchantment, Integer> enchantments, ImmutableMap.Builder<String, Object> builder, ItemMetaKey key) {
if (enchantments == null || enchantments.isEmpty()) {
return;
@@ -885,6 +932,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
ENCHANTMENTS.NBT,
HIDEFLAGS.NBT,
UNBREAKABLE.NBT,
+ DAMAGE.NBT,
CraftMetaMap.MAP_SCALING.NBT,
CraftMetaPotion.POTION_EFFECTS.NBT,
CraftMetaPotion.DEFAULT_POTION.NBT,
@@ -901,7 +949,8 @@ class CraftMetaItem implements ItemMeta, Repairable {
CraftMetaEnchantedBook.STORED_ENCHANTMENTS.NBT,
CraftMetaCharge.EXPLOSION.NBT,
CraftMetaBlockState.BLOCK_ENTITY_TAG.NBT,
- CraftMetaKnowledgeBook.BOOK_RECIPES.NBT
+ CraftMetaKnowledgeBook.BOOK_RECIPES.NBT,
+ CraftMetaTropicalFishBucket.VARIANT.NBT
));
}
return HANDLED_TAGS;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java
index de695e4e..d35c5b03 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java
@@ -99,7 +99,7 @@ class CraftMetaMap extends CraftMetaItem implements MapMeta {
@Override
boolean applicableTo(Material type) {
switch (type) {
- case MAP:
+ case FILLED_MAP:
return true;
default:
return false;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
index 4fec1676..6a58ab56 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
@@ -69,7 +69,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
customEffects = new ArrayList<PotionEffect>(length);
for (int i = 0; i < length; i++) {
- NBTTagCompound effect = list.get(i);
+ NBTTagCompound effect = list.getCompound(i);
PotionEffectType type = PotionEffectType.getById(effect.getByte(ID.NBT));
int amp = effect.getByte(AMPLIFIER.NBT);
int duration = effect.getInt(DURATION.NBT);
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
index 8c5d3eff..e3951103 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
@@ -96,8 +96,20 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
@Override
boolean applicableTo(Material type) {
- switch(type) {
- case SKULL_ITEM:
+ switch (type) {
+ case CREEPER_HEAD:
+ case CREEPER_WALL_HEAD:
+ case DRAGON_HEAD:
+ case DRAGON_WALL_HEAD:
+ case PISTON_HEAD:
+ case PLAYER_HEAD:
+ case PLAYER_WALL_HEAD:
+ case SKELETON_SKULL:
+ case SKELETON_WALL_SKULL:
+ case WITHER_SKELETON_SKULL:
+ case WITHER_SKELETON_WALL_SKULL:
+ case ZOMBIE_HEAD:
+ case ZOMBIE_WALL_HEAD:
return true;
default:
return false;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java
index 70616a2f..892cc10a 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java
@@ -1,17 +1,21 @@
package org.bukkit.craftbukkit.inventory;
-import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap.Builder;
+import com.mojang.datafixers.Dynamic;
import java.util.Map;
import net.minecraft.server.DataConverterTypes;
+import net.minecraft.server.DynamicOpsNBT;
import net.minecraft.server.MinecraftKey;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.NBTBase;
import net.minecraft.server.NBTTagCompound;
import org.bukkit.Material;
import org.bukkit.configuration.serialization.DelegateDeserialization;
+import org.bukkit.craftbukkit.util.CraftLegacy;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.meta.SpawnEggMeta;
+import org.bukkit.material.MaterialData;
@DelegateDeserialization(CraftMetaItem.SerializableMeta.class)
public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
@@ -32,6 +36,8 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
CraftMetaSpawnEgg egg = (CraftMetaSpawnEgg) meta;
this.spawnedType = egg.spawnedType;
+
+ updateMaterial(null); // Trigger type population
}
CraftMetaSpawnEgg(NBTTagCompound tag) {
@@ -39,10 +45,6 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
if (tag.hasKey(ENTITY_TAG.NBT)) {
entityTag = tag.getCompound(ENTITY_TAG.NBT);
-
- if (entityTag.hasKey(ENTITY_ID.NBT)) {
- this.spawnedType = EntityType.fromName(new MinecraftKey(entityTag.getString(ENTITY_ID.NBT)).getKey());
- }
}
}
@@ -50,7 +52,9 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
super(map);
String entityType = SerializableMeta.getString(map, ENTITY_ID.BUKKIT, true);
- setSpawnedType(EntityType.fromName(entityType));
+ if (entityType != null) {
+ this.spawnedType = EntityType.fromName(entityType);
+ }
}
@Override
@@ -59,7 +63,7 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
if (tag.hasKey(ENTITY_TAG.NBT)) {
entityTag = tag.getCompound(ENTITY_TAG.NBT);
- MinecraftServer.getServer().dataConverterManager.a(DataConverterTypes.ENTITY, entityTag); // PAIL: convert
+ MinecraftServer.getServer().dataConverterManager.update(DataConverterTypes.ENTITY, new Dynamic(DynamicOpsNBT.a, entityTag), -1, CraftMagicNumbers.DATA_VERSION);
if (entityTag.hasKey(ENTITY_ID.NBT)) {
this.spawnedType = EntityType.fromName(new MinecraftKey(entityTag.getString(ENTITY_ID.NBT)).getKey());
@@ -82,10 +86,6 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
entityTag = new NBTTagCompound();
}
- if (hasSpawnedType()) {
- entityTag.setString(ENTITY_ID.NBT, new MinecraftKey(spawnedType.getName()).toString());
- }
-
if (entityTag != null) {
tag.set(ENTITY_TAG.NBT, entityTag);
}
@@ -94,7 +94,49 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
@Override
boolean applicableTo(Material type) {
switch (type) {
- case MONSTER_EGG:
+ case BAT_SPAWN_EGG:
+ case BLAZE_SPAWN_EGG:
+ case CAVE_SPIDER_SPAWN_EGG:
+ case CHICKEN_SPAWN_EGG:
+ case COW_SPAWN_EGG:
+ case CREEPER_SPAWN_EGG:
+ case DONKEY_SPAWN_EGG:
+ case ELDER_GUARDIAN_SPAWN_EGG:
+ case ENDERMAN_SPAWN_EGG:
+ case ENDERMITE_SPAWN_EGG:
+ case EVOKER_SPAWN_EGG:
+ case GHAST_SPAWN_EGG:
+ case GUARDIAN_SPAWN_EGG:
+ case HORSE_SPAWN_EGG:
+ case HUSK_SPAWN_EGG:
+ case LLAMA_SPAWN_EGG:
+ case MAGMA_CUBE_SPAWN_EGG:
+ case MOOSHROOM_SPAWN_EGG:
+ case MULE_SPAWN_EGG:
+ case OCELOT_SPAWN_EGG:
+ case PARROT_SPAWN_EGG:
+ case PIG_SPAWN_EGG:
+ case POLAR_BEAR_SPAWN_EGG:
+ case RABBIT_SPAWN_EGG:
+ case SHEEP_SPAWN_EGG:
+ case SHULKER_SPAWN_EGG:
+ case SILVERFISH_SPAWN_EGG:
+ case SKELETON_HORSE_SPAWN_EGG:
+ case SKELETON_SPAWN_EGG:
+ case SLIME_SPAWN_EGG:
+ case SPIDER_SPAWN_EGG:
+ case SQUID_SPAWN_EGG:
+ case STRAY_SPAWN_EGG:
+ case VEX_SPAWN_EGG:
+ case VILLAGER_SPAWN_EGG:
+ case VINDICATOR_SPAWN_EGG:
+ case WITCH_SPAWN_EGG:
+ case WITHER_SKELETON_SPAWN_EGG:
+ case WOLF_SPAWN_EGG:
+ case ZOMBIE_HORSE_SPAWN_EGG:
+ case ZOMBIE_PIGMAN_SPAWN_EGG:
+ case ZOMBIE_SPAWN_EGG:
+ case ZOMBIE_VILLAGER_SPAWN_EGG:
return true;
default:
return false;
@@ -116,14 +158,12 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
@Override
public EntityType getSpawnedType() {
- return spawnedType;
+ throw new UnsupportedOperationException("Must check item type to get spawned type");
}
@Override
public void setSpawnedType(EntityType type) {
- Preconditions.checkArgument(type == null || type.getName() != null, "Spawn egg type must have name (%s)", type);
-
- this.spawnedType = type;
+ throw new UnsupportedOperationException("Must change item type to set spawned type");
}
@Override
@@ -164,10 +204,6 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
Builder<String, Object> serialize(Builder<String, Object> builder) {
super.serialize(builder);
- if (hasSpawnedType()) {
- builder.put(ENTITY_ID.BUKKIT, spawnedType.getName());
- }
-
return builder;
}
@@ -177,9 +213,23 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
clone.spawnedType = spawnedType;
if (entityTag != null) {
- clone.entityTag = entityTag.g();
+ clone.entityTag = entityTag.clone();
}
return clone;
}
+
+ @Override
+ final Material updateMaterial(Material material) {
+ if (spawnedType == null) {
+ spawnedType = EntityType.fromId(getDamage());
+ setDamage(0);
+ }
+
+ if (spawnedType != null) {
+ return CraftLegacy.fromLegacy(new MaterialData(Material.LEGACY_MONSTER_EGG, (byte) spawnedType.getTypeId()));
+ }
+
+ return super.updateMaterial(material);
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaTropicalFishBucket.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaTropicalFishBucket.java
new file mode 100644
index 00000000..f27df320
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaTropicalFishBucket.java
@@ -0,0 +1,168 @@
+package org.bukkit.craftbukkit.inventory;
+
+import java.util.Map;
+
+import net.minecraft.server.NBTTagCompound;
+import org.bukkit.Material;
+import org.bukkit.configuration.serialization.DelegateDeserialization;
+import org.bukkit.craftbukkit.inventory.CraftMetaItem.SerializableMeta;
+
+import com.google.common.collect.ImmutableMap;
+import org.bukkit.DyeColor;
+import org.bukkit.craftbukkit.entity.CraftTropicalFish;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
+import org.bukkit.entity.TropicalFish;
+import org.bukkit.inventory.meta.TropicalFishBucketMeta;
+
+@DelegateDeserialization(SerializableMeta.class)
+class CraftMetaTropicalFishBucket extends CraftMetaItem implements TropicalFishBucketMeta {
+ static final ItemMetaKey VARIANT = new ItemMetaKey("BucketVariantTag", "fish-variant");
+
+ private Integer variant;
+
+ CraftMetaTropicalFishBucket(CraftMetaItem meta) {
+ super(meta);
+
+ if (!(meta instanceof CraftMetaTropicalFishBucket)) {
+ return;
+ }
+
+ CraftMetaTropicalFishBucket bucket = (CraftMetaTropicalFishBucket) meta;
+ this.variant = bucket.variant;
+ }
+
+ CraftMetaTropicalFishBucket(NBTTagCompound tag) {
+ super(tag);
+
+ if (tag.hasKeyOfType(VARIANT.NBT, CraftMagicNumbers.NBT.TAG_INT)) {
+ this.variant = tag.getInt(VARIANT.NBT);
+ }
+ }
+
+ CraftMetaTropicalFishBucket(Map<String, Object> map) {
+ super(map);
+
+ Integer variant = SerializableMeta.getObject(Integer.class, map, VARIANT.BUKKIT, true);
+ if (variant != null) {
+ this.variant = variant;
+ }
+ }
+
+ @Override
+ void applyToItem(NBTTagCompound tag) {
+ super.applyToItem(tag);
+
+ if (hasVariant()) {
+ tag.setInt(VARIANT.NBT, variant);
+ }
+ }
+
+ @Override
+ boolean applicableTo(Material type) {
+ switch (type) {
+ case TROPICAL_FISH_BUCKET:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ @Override
+ boolean isEmpty() {
+ return super.isEmpty() && isBucketEmpty();
+ }
+
+ boolean isBucketEmpty() {
+ return !(hasVariant());
+ }
+
+ @Override
+ public DyeColor getPatternColor() {
+ return CraftTropicalFish.getPatternColor(variant);
+ }
+
+ @Override
+ public void setPatternColor(DyeColor color) {
+ if (variant == null) {
+ variant = 0;
+ }
+ variant = CraftTropicalFish.getData(color, getPatternColor(), getPattern());
+ }
+
+ @Override
+ public DyeColor getBodyColor() {
+ return CraftTropicalFish.getBodyColor(variant);
+ }
+
+ @Override
+ public void setBodyColor(DyeColor color) {
+ if (variant == null) {
+ variant = 0;
+ }
+ variant = CraftTropicalFish.getData(getPatternColor(), color, getPattern());
+ }
+
+ @Override
+ public TropicalFish.Pattern getPattern() {
+ return CraftTropicalFish.getPattern(variant);
+ }
+
+ @Override
+ public void setPattern(TropicalFish.Pattern pattern) {
+ if (variant == null) {
+ variant = 0;
+ }
+ variant = CraftTropicalFish.getData(getPatternColor(), getBodyColor(), pattern);
+ }
+
+ @Override
+ public boolean hasVariant() {
+ return variant != null;
+ }
+
+ @Override
+ boolean equalsCommon(CraftMetaItem meta) {
+ if (!super.equalsCommon(meta)) {
+ return false;
+ }
+ if (meta instanceof CraftMetaTropicalFishBucket) {
+ CraftMetaTropicalFishBucket that = (CraftMetaTropicalFishBucket) meta;
+
+ return (hasVariant() ? that.hasVariant() && this.variant.equals(that.variant) : !that.hasVariant());
+ }
+ return true;
+ }
+
+ @Override
+ boolean notUncommon(CraftMetaItem meta) {
+ return super.notUncommon(meta) && (meta instanceof CraftMetaTropicalFishBucket || isBucketEmpty());
+ }
+
+ @Override
+ int applyHash() {
+ final int original;
+ int hash = original = super.applyHash();
+
+ if (hasVariant()) {
+ hash = 61 * hash + variant;
+ }
+
+ return original != hash ? CraftMetaTropicalFishBucket.class.hashCode() ^ hash : hash;
+ }
+
+
+ public CraftMetaTropicalFishBucket clone() {
+ return (CraftMetaTropicalFishBucket) super.clone();
+ }
+
+ @Override
+ ImmutableMap.Builder<String, Object> serialize(ImmutableMap.Builder<String, Object> builder) {
+ super.serialize(builder);
+
+ if (hasVariant()) {
+ builder.put(VARIANT.BUKKIT, variant);
+ }
+
+ return builder;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java
index 44df9301..efd0e76a 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java
@@ -1,8 +1,9 @@
package org.bukkit.craftbukkit.inventory;
import java.util.Map;
+import java.util.stream.Stream;
-import net.minecraft.server.CraftingManager;
+import net.minecraft.server.MinecraftServer;
import net.minecraft.server.NonNullList;
import net.minecraft.server.RecipeItemStack;
import net.minecraft.server.ShapedRecipes;
@@ -21,7 +22,7 @@ public class CraftShapedRecipe extends ShapedRecipe implements CraftRecipe {
}
public CraftShapedRecipe(ItemStack result, ShapedRecipes recipe) {
- this(CraftNamespacedKey.fromMinecraft(recipe.key), result);
+ this(CraftNamespacedKey.fromMinecraft(recipe.getKey()), result);
this.recipe = recipe;
}
@@ -51,10 +52,10 @@ public class CraftShapedRecipe extends ShapedRecipe implements CraftRecipe {
for (int i = 0; i < shape.length; i++) {
String row = shape[i];
for (int j = 0; j < row.length(); j++) {
- data.set(i * width + j, RecipeItemStack.a(new net.minecraft.server.ItemStack[]{CraftItemStack.asNMSCopy(ingred.get(row.charAt(j)))}));
+ data.set(i * width + j, new RecipeItemStack(Stream.of(new RecipeItemStack.StackProvider(CraftItemStack.asNMSCopy(ingred.get(row.charAt(j)))))));
}
}
- CraftingManager.a(CraftNamespacedKey.toMinecraft(this.getKey()), new ShapedRecipes("", width, shape.length, data, CraftItemStack.asNMSCopy(this.getResult())));
+ MinecraftServer.getServer().getCraftingManager().a(new ShapedRecipes(CraftNamespacedKey.toMinecraft(this.getKey()), "", width, shape.length, data, CraftItemStack.asNMSCopy(this.getResult())));
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java
index 211898c5..dbbcb679 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java
@@ -1,8 +1,9 @@
package org.bukkit.craftbukkit.inventory;
import java.util.List;
+import java.util.stream.Stream;
-import net.minecraft.server.CraftingManager;
+import net.minecraft.server.MinecraftServer;
import net.minecraft.server.NonNullList;
import net.minecraft.server.RecipeItemStack;
import net.minecraft.server.ShapelessRecipes;
@@ -21,7 +22,7 @@ public class CraftShapelessRecipe extends ShapelessRecipe implements CraftRecipe
}
public CraftShapelessRecipe(ItemStack result, ShapelessRecipes recipe) {
- this(CraftNamespacedKey.fromMinecraft(recipe.key), result);
+ this(CraftNamespacedKey.fromMinecraft(recipe.getKey()), result);
this.recipe = recipe;
}
@@ -40,9 +41,9 @@ public class CraftShapelessRecipe extends ShapelessRecipe implements CraftRecipe
List<ItemStack> ingred = this.getIngredientList();
NonNullList<RecipeItemStack> data = NonNullList.a(ingred.size(), RecipeItemStack.a);
for (int i = 0; i < ingred.size(); i++) {
- data.set(i, RecipeItemStack.a(new net.minecraft.server.ItemStack[]{CraftItemStack.asNMSCopy(ingred.get(i))}));
+ data.set(i, new RecipeItemStack(Stream.of(new RecipeItemStack.StackProvider(CraftItemStack.asNMSCopy(ingred.get(i))))));
}
- CraftingManager.a(CraftNamespacedKey.toMinecraft(this.getKey()), new ShapelessRecipes("", CraftItemStack.asNMSCopy(this.getResult()), data));
+ MinecraftServer.getServer().getCraftingManager().a(new ShapelessRecipes(CraftNamespacedKey.toMinecraft(this.getKey()), "", CraftItemStack.asNMSCopy(this.getResult()), data));
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/InventoryWrapper.java b/src/main/java/org/bukkit/craftbukkit/inventory/InventoryWrapper.java
index 6cbcc9d3..9c5ec924 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/InventoryWrapper.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/InventoryWrapper.java
@@ -160,18 +160,23 @@ public class InventoryWrapper implements IInventory {
}
@Override
- public String getName() {
- return inventory.getName();
+ public IChatBaseComponent getDisplayName() {
+ return CraftChatMessage.fromStringOrNull(inventory.getName());
+ }
+
+ @Override
+ public IChatBaseComponent getCustomName() {
+ return getDisplayName();
}
@Override
public boolean hasCustomName() {
- return getName() != null;
+ return inventory.getName() != null;
}
@Override
public IChatBaseComponent getScoreboardDisplayName() {
- return CraftChatMessage.fromString(getName())[0];
+ return getDisplayName();
}
@Override
@@ -180,7 +185,7 @@ public class InventoryWrapper implements IInventory {
}
@Override
- public boolean x_() {
+ public boolean P_() {
return Iterables.any(inventory, Predicates.notNull());
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java b/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java
index f03f8baa..165225e7 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java
@@ -4,50 +4,25 @@ import java.util.Iterator;
import org.bukkit.inventory.Recipe;
-import net.minecraft.server.CraftingManager;
import net.minecraft.server.IRecipe;
-import net.minecraft.server.RecipesFurnace;
+import net.minecraft.server.MinecraftServer;
public class RecipeIterator implements Iterator<Recipe> {
private final Iterator<IRecipe> recipes;
- private final Iterator<net.minecraft.server.ItemStack> smeltingCustom;
- private final Iterator<net.minecraft.server.ItemStack> smeltingVanilla;
- private Iterator<?> removeFrom = null;
public RecipeIterator() {
- this.recipes = CraftingManager.recipes.iterator();
- this.smeltingCustom = RecipesFurnace.getInstance().customRecipes.keySet().iterator();
- this.smeltingVanilla = RecipesFurnace.getInstance().recipes.keySet().iterator();
+ this.recipes = MinecraftServer.getServer().getCraftingManager().recipes.values().iterator();
}
public boolean hasNext() {
- return recipes.hasNext() || smeltingCustom.hasNext() || smeltingVanilla.hasNext();
+ return recipes.hasNext();
}
public Recipe next() {
- if (recipes.hasNext()) {
- removeFrom = recipes;
- return recipes.next().toBukkitRecipe();
- } else {
- net.minecraft.server.ItemStack item;
- if (smeltingCustom.hasNext()) {
- removeFrom = smeltingCustom;
- item = smeltingCustom.next();
- } else {
- removeFrom = smeltingVanilla;
- item = smeltingVanilla.next();
- }
-
- CraftItemStack stack = CraftItemStack.asCraftMirror(RecipesFurnace.getInstance().getResult(item));
-
- return new CraftFurnaceRecipe(stack, CraftItemStack.asCraftMirror(item));
- }
+ return recipes.next().toBukkitRecipe();
}
public void remove() {
- if (removeFrom == null) {
- throw new IllegalStateException();
- }
- removeFrom.remove();
+ recipes.remove();
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java
index a55915a4..0a3eb3b5 100644
--- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java
+++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java
@@ -42,7 +42,7 @@ public class CraftMapRenderer extends MapRenderer {
}
MapIcon decoration = (MapIcon) worldMap.decorations.get(key);
- cursors.addCursor(decoration.getX(), decoration.getY(), (byte) (decoration.getRotation() & 15), decoration.getType());
+ cursors.addCursor(decoration.getX(), decoration.getY(), (byte) (decoration.getRotation() & 15), decoration.b().a());
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java
index b951bfda..4d5eb2c1 100644
--- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java
+++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java
@@ -29,7 +29,7 @@ public final class CraftMapView implements MapView {
}
public short getId() {
- String text = worldMap.id;
+ String text = worldMap.getId();
if (text.startsWith("map_")) {
try {
return Short.parseShort(text.substring("map_".length()));
diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java
index b06fddf7..09f44ed6 100644
--- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java
+++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java
@@ -79,6 +79,10 @@ public class CraftPotionEffectType extends PotionEffectType {
return "LUCK";
case 27:
return "UNLUCK";
+ case 28:
+ return "SLOW_FALLING";
+ case 29:
+ return "CONDUIT_POWER";
default:
return "UNKNOWN_EFFECT_TYPE_" + getId();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
index 8483cd85..2392b457 100644
--- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
+++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
@@ -34,6 +34,8 @@ public class CraftPotionUtil {
.put(PotionType.STRENGTH, "strength")
.put(PotionType.WEAKNESS, "weakness")
.put(PotionType.LUCK, "luck")
+ .put(PotionType.TURTLE_MASTER, "turtle_master")
+ .put(PotionType.SLOW_FALLING, "slow_falling")
.build();
private static final BiMap<PotionType, String> upgradeable = ImmutableBiMap.<PotionType, String>builder()
.put(PotionType.JUMP, "strong_leaping")
@@ -43,6 +45,8 @@ public class CraftPotionUtil {
.put(PotionType.POISON, "strong_poison")
.put(PotionType.REGEN, "strong_regeneration")
.put(PotionType.STRENGTH, "strong_strength")
+ .put(PotionType.SLOWNESS, "strong_slowness")
+ .put(PotionType.TURTLE_MASTER, "strong_turtle_master")
.build();
private static final BiMap<PotionType, String> extendable = ImmutableBiMap.<PotionType, String>builder()
.put(PotionType.NIGHT_VISION, "long_night_vision")
@@ -56,6 +60,8 @@ public class CraftPotionUtil {
.put(PotionType.REGEN, "long_regeneration")
.put(PotionType.STRENGTH, "long_strength")
.put(PotionType.WEAKNESS, "long_weakness")
+ .put(PotionType.TURTLE_MASTER, "long_turtle_master")
+ .put(PotionType.SLOW_FALLING, "long_slow_falling")
.build();
public static String fromBukkit(PotionData data) {
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java
index 239ceca0..822600fe 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java
@@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.scoreboard;
import net.minecraft.server.Scoreboard;
import net.minecraft.server.ScoreboardObjective;
+import net.minecraft.server.ScoreboardServer;
import org.apache.commons.lang.Validate;
import org.bukkit.OfflinePlayer;
@@ -40,7 +41,8 @@ final class CraftObjective extends CraftScoreboardComponent implements Objective
Validate.isTrue(displayName.length() <= 32, "Display name '" + displayName + "' is longer than the limit of 32 characters");
CraftScoreboard scoreboard = checkState();
- objective.setDisplayName(displayName);
+ objective.displayName = displayName;
+ ((ScoreboardServer) scoreboard.board).handleObjectiveChanged(objective);
}
public String getCriteria() throws IllegalStateException {
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
index 00b30f8c..573b9cd1 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
@@ -24,14 +24,22 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard {
this.board = board;
}
+ @Override
public CraftObjective registerNewObjective(String name, String criteria) throws IllegalArgumentException {
+ return registerNewObjective(name, criteria, name);
+ }
+
+ @Override
+ public CraftObjective registerNewObjective(String name, String criteria, String displayName) throws IllegalArgumentException {
Validate.notNull(name, "Objective name cannot be null");
Validate.notNull(criteria, "Criteria cannot be null");
+ Validate.notNull(displayName, "Display name cannot be null");
Validate.isTrue(name.length() <= 16, "The name '" + name + "' is longer than the limit of 16 characters");
+ Validate.isTrue(displayName.length() <= 32, "The display name '" + displayName + "' is longer than the limit of 32 characters");
Validate.isTrue(board.getObjective(name) == null, "An objective of name '" + name + "' already exists");
CraftCriteria craftCriteria = CraftCriteria.getFromBukkit(criteria);
- ScoreboardObjective objective = board.registerObjective(name, craftCriteria.criteria);
+ ScoreboardObjective objective = board.registerObjective(name, craftCriteria.criteria, displayName);
return new CraftObjective(this, objective);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
index 69fcb108..cac87d30 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
@@ -7,6 +7,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.function.Consumer;
import net.minecraft.server.EntityPlayer;
import net.minecraft.server.IScoreboardCriteria;
@@ -99,13 +100,10 @@ public final class CraftScoreboardManager implements ScoreboardManager {
}
// CraftBukkit method
- public Collection<ScoreboardScore> getScoreboardScores(IScoreboardCriteria criteria, String name, Collection<ScoreboardScore> collection) {
+ public void getScoreboardScores(IScoreboardCriteria criteria, String name, Consumer<ScoreboardScore> consumer) {
for (CraftScoreboard scoreboard : scoreboards) {
Scoreboard board = scoreboard.board;
- for (ScoreboardObjective objective : (Iterable<ScoreboardObjective>) board.getObjectivesForCriteria(criteria)) {
- collection.add(board.getPlayerScoreForObjective(name, objective));
- }
+ board.getObjectivesForCriteria(criteria, name, (score) -> consumer.accept(score));
}
- return collection;
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
index 18616fc8..17865e65 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
@@ -160,7 +160,7 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
Validate.notNull(entry, "Entry cannot be null");
CraftScoreboard scoreboard = checkState();
- scoreboard.board.addPlayerToTeam(entry, team.getName());
+ scoreboard.board.addPlayerToTeam(entry, team);
}
public boolean removePlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException {
diff --git a/src/main/java/org/bukkit/craftbukkit/tag/CraftBlockTag.java b/src/main/java/org/bukkit/craftbukkit/tag/CraftBlockTag.java
new file mode 100644
index 00000000..4b3ac51a
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/tag/CraftBlockTag.java
@@ -0,0 +1,28 @@
+package org.bukkit.craftbukkit.tag;
+
+import java.util.Collections;
+import java.util.Set;
+import java.util.stream.Collectors;
+import net.minecraft.server.Block;
+import org.bukkit.Material;
+import org.bukkit.Tag;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
+
+public class CraftBlockTag implements Tag<Material> {
+
+ private final net.minecraft.server.Tag<Block> handle;
+
+ public CraftBlockTag(net.minecraft.server.Tag<Block> handle) {
+ this.handle = handle;
+ }
+
+ @Override
+ public boolean isTagged(Material item) {
+ return handle.isTagged(CraftMagicNumbers.getBlock(item));
+ }
+
+ @Override
+ public Set<Material> getValues() {
+ return Collections.unmodifiableSet(handle.a().stream().map((block) -> CraftMagicNumbers.getMaterial(block)).collect(Collectors.toSet()));
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/tag/CraftItemTag.java b/src/main/java/org/bukkit/craftbukkit/tag/CraftItemTag.java
new file mode 100644
index 00000000..b6b90e3e
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/tag/CraftItemTag.java
@@ -0,0 +1,28 @@
+package org.bukkit.craftbukkit.tag;
+
+import java.util.Collections;
+import java.util.Set;
+import java.util.stream.Collectors;
+import net.minecraft.server.Item;
+import org.bukkit.Material;
+import org.bukkit.Tag;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
+
+public class CraftItemTag implements Tag<Material> {
+
+ private final net.minecraft.server.Tag<Item> handle;
+
+ public CraftItemTag(net.minecraft.server.Tag<Item> handle) {
+ this.handle = handle;
+ }
+
+ @Override
+ public boolean isTagged(Material item) {
+ return handle.isTagged(CraftMagicNumbers.getItem(item));
+ }
+
+ @Override
+ public Set<Material> getValues() {
+ return Collections.unmodifiableSet(handle.a().stream().map((item) -> CraftMagicNumbers.getMaterial(item)).collect(Collectors.toSet()));
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java b/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java
index 2dbedd2d..3db85a3b 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java
@@ -3,50 +3,35 @@ package org.bukkit.craftbukkit.util;
import java.util.ArrayList;
import java.util.List;
-import net.minecraft.server.Block;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.IBlockData;
+import net.minecraft.server.World;
-import org.bukkit.World;
import org.bukkit.block.BlockState;
+import org.bukkit.craftbukkit.block.CraftBlockState;
public class BlockStateListPopulator {
private final World world;
- private final List<BlockState> list;
+ private final List<CraftBlockState> list;
public BlockStateListPopulator(World world) {
- this(world, new ArrayList<BlockState>());
+ this(world, new ArrayList<CraftBlockState>());
}
- public BlockStateListPopulator(World world, List<BlockState> list) {
+ public BlockStateListPopulator(World world, List<CraftBlockState> list) {
this.world = world;
this.list = list;
}
- public void setTypeAndData(int x, int y, int z, Block block, int data, int light) {
- BlockState state = world.getBlockAt(x, y, z).getState();
- state.setTypeId(Block.getId(block));
- state.setRawData((byte) data);
+ public void setTypeUpdate(BlockPosition position, IBlockData data) {
+ CraftBlockState state = CraftBlockState.getBlockState(world, position);
+ state.setData(data);
list.add(state);
}
- public void setTypeId(int x, int y, int z, int type) {
- BlockState state = world.getBlockAt(x, y, z).getState();
- state.setTypeId(type);
- list.add(state);
- }
-
- public void setTypeUpdate(int x, int y, int z, Block block) {
- this.setType(x, y, z, block);
- }
-
- public void setTypeUpdate(BlockPosition position, IBlockData data) {
- setTypeAndData(position.getX(), position.getY(), position.getZ(), data.getBlock(), data.getBlock().toLegacyData(data), 0);
-
- }
- public void setType(int x, int y, int z, Block block) {
- BlockState state = world.getBlockAt(x, y, z).getState();
- state.setTypeId(Block.getId(block));
+ public void setTypeAndData(BlockPosition position, IBlockData data, int flag) {
+ CraftBlockState state = CraftBlockState.getBlockState(world, position, flag);
+ state.setData(data);
list.add(state);
}
@@ -56,7 +41,7 @@ public class BlockStateListPopulator {
}
}
- public List<BlockState> getList() {
+ public List<CraftBlockState> getList() {
return list;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
new file mode 100644
index 00000000..aefba149
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -0,0 +1,268 @@
+package org.bukkit.craftbukkit.util;
+
+import com.google.common.io.ByteStreams;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.JarOutputStream;
+import java.util.zip.ZipEntry;
+import joptsimple.OptionParser;
+import joptsimple.OptionSet;
+import joptsimple.OptionSpec;
+import org.bukkit.Material;
+import org.bukkit.plugin.AuthorNagException;
+import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.Type;
+
+/**
+ * This file is imported from Commodore.
+ *
+ * @author md_5
+ */
+public class Commodore
+{
+
+ private static final Set<String> EVIL = new HashSet<>( Arrays.asList(
+ "org/bukkit/World (III)I getBlockTypeIdAt",
+ "org/bukkit/World (Lorg/bukkit/Location;)I getBlockTypeIdAt",
+ "org/bukkit/block/Block ()I getTypeId",
+ "org/bukkit/block/Block (I)Z setTypeId",
+ "org/bukkit/block/Block (IZ)Z setTypeId",
+ "org/bukkit/block/Block (IBZ)Z setTypeIdAndData",
+ "org/bukkit/inventory/ItemStack ()I getTypeId",
+ "org/bukkit/inventory/ItemStack (I)V setTypeId"
+ ) );
+
+ public static void main(String[] args)
+ {
+ OptionParser parser = new OptionParser();
+ OptionSpec<File> inputFlag = parser.acceptsAll( Arrays.asList( "i", "input" ) ).withRequiredArg().ofType( File.class ).required();
+ OptionSpec<File> outputFlag = parser.acceptsAll( Arrays.asList( "o", "output" ) ).withRequiredArg().ofType( File.class ).required();
+
+ OptionSet options = parser.parse( args );
+
+ File input = options.valueOf( inputFlag );
+ File output = options.valueOf( outputFlag );
+
+ if ( input.isDirectory() )
+ {
+ if ( !output.isDirectory() )
+ {
+ System.err.println( "If input directory specified, output directory required too" );
+ return;
+ }
+
+ for ( File in : input.listFiles() )
+ {
+ if ( in.getName().endsWith( ".jar" ) )
+ {
+ convert( in, new File( output, in.getName() ) );
+ }
+ }
+ } else
+ {
+ convert( input, output );
+ }
+ }
+
+ private static void convert(File in, File out)
+ {
+ System.out.println( "Attempting to convert " + in + " to " + out );
+
+ try
+ {
+ try ( JarFile inJar = new JarFile( in, false ) )
+ {
+ JarEntry entry = inJar.getJarEntry( ".commodore" );
+ if ( entry != null )
+ {
+ return;
+ }
+
+ try ( JarOutputStream outJar = new JarOutputStream( new FileOutputStream( out ) ) )
+ {
+ for ( Enumeration<JarEntry> entries = inJar.entries(); entries.hasMoreElements(); )
+ {
+ entry = entries.nextElement();
+
+ try ( InputStream is = inJar.getInputStream( entry ) )
+ {
+ byte[] b = ByteStreams.toByteArray( is );
+
+ if ( entry.getName().endsWith( ".class" ) )
+ {
+ b = convert( b, false );
+ entry = new JarEntry( entry.getName() );
+ }
+
+ outJar.putNextEntry( entry );
+ outJar.write( b );
+ }
+ }
+
+ outJar.putNextEntry( new ZipEntry( ".commodore" ) );
+ }
+ }
+ } catch ( Exception ex )
+ {
+ System.err.println( "Fatal error trying to convert " + in );
+ ex.printStackTrace();
+ }
+ }
+
+ public static byte[] convert(byte[] b, final boolean modern)
+ {
+ ClassReader cr = new ClassReader( b );
+ ClassWriter cw = new ClassWriter( cr, 0 );
+
+ cr.accept( new ClassVisitor( Opcodes.ASM6, cw )
+ {
+ @Override
+ public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions)
+ {
+ return new MethodVisitor( api, super.visitMethod( access, name, desc, signature, exceptions ) )
+ {
+
+ @Override
+ public void visitFieldInsn(int opcode, String owner, String name, String desc)
+ {
+ if ( modern )
+ {
+ super.visitFieldInsn( opcode, owner, name, desc );
+ return;
+ }
+
+ if ( owner.equals( "org/bukkit/Material" ) )
+ {
+ try
+ {
+ Material.valueOf( "LEGACY_" + name );
+ } catch ( IllegalArgumentException ex )
+ {
+ throw new AuthorNagException( "No legacy enum constant for " + name + ". Did you forget to define api-version: 1.13 in your plugin.yml?" );
+ }
+
+ super.visitFieldInsn( opcode, owner, "LEGACY_" + name, desc );
+ return;
+ }
+
+ if ( owner.equals( "org/bukkit/Art" ) )
+ {
+ switch ( name )
+ {
+ case "BURNINGSKULL":
+ super.visitFieldInsn( opcode, owner, "BURNING_SKULL", desc );
+ return;
+ case "DONKEYKONG":
+ super.visitFieldInsn( opcode, owner, "DONKEY_KONG", desc );
+ return;
+ }
+ }
+
+ if ( owner.equals( "org/bukkit/Particle" ) )
+ {
+ switch ( name )
+ {
+ case "BLOCK_CRACK":
+ case "BLOCK_DUST":
+ case "FALLING_DUST":
+ super.visitFieldInsn( opcode, owner, "LEGACY_" + name, desc );
+ return;
+ }
+ }
+
+ super.visitFieldInsn( opcode, owner, name, desc );
+ }
+
+ @Override
+ public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf)
+ {
+ if ( modern )
+ {
+ if ( owner.equals( "org/bukkit/Material" ) )
+ {
+ switch ( name )
+ {
+ case "values":
+ super.visitMethodInsn( opcode, "org/bukkit/craftbukkit/util/CraftLegacy", "modern_" + name, desc, itf );
+ return;
+ }
+ }
+
+ super.visitMethodInsn( opcode, owner, name, desc, itf );
+ return;
+ }
+
+ if ( owner.equals( "org/bukkit/ChunkSnapshot" ) && name.equals( "getBlockData" ) && desc.equals( "(III)I" ) )
+ {
+ super.visitMethodInsn( opcode, owner, "getData", desc, itf );
+ return;
+ }
+
+ Type retType = Type.getReturnType( desc );
+
+ if ( EVIL.contains( owner + " " + desc + " " + name )
+ || ( owner.startsWith( "org/bukkit/block/" ) && ( desc + " " + name ).equals( "()I getTypeId" ) )
+ || ( owner.startsWith( "org/bukkit/block/" ) && ( desc + " " + name ).equals( "(I)Z setTypeId" ) ) )
+ {
+ Type[] args = Type.getArgumentTypes( desc );
+ Type[] newArgs = new Type[ args.length + 1 ];
+ newArgs[0] = Type.getObjectType( owner );
+ System.arraycopy( args, 0, newArgs, 1, args.length );
+
+ super.visitMethodInsn( Opcodes.INVOKESTATIC, "org/bukkit/craftbukkit/util/CraftEvil", name, Type.getMethodDescriptor( retType, newArgs ), false );
+ return;
+ }
+
+ if ( owner.equals( "org/bukkit/Material" ) )
+ {
+ if ( name.equals( "getMaterial" ) && desc.equals( "(I)Lorg/bukkit/Material;" ) )
+ {
+ super.visitMethodInsn( opcode, "org/bukkit/craftbukkit/util/CraftEvil", name, desc, itf );
+ return;
+ }
+
+ switch ( name )
+ {
+ case "values":
+ case "valueOf":
+ case "getMaterial":
+ case "matchMaterial":
+ super.visitMethodInsn( opcode, "org/bukkit/craftbukkit/util/CraftLegacy", name, desc, itf );
+ return;
+ case "ordinal":
+ super.visitMethodInsn( Opcodes.INVOKESTATIC, "org/bukkit/craftbukkit/util/CraftLegacy", "ordinal", "(Lorg/bukkit/Material;)I", false );
+ return;
+ case "name":
+ case "toString":
+ super.visitMethodInsn( Opcodes.INVOKESTATIC, "org/bukkit/craftbukkit/util/CraftLegacy", name, "(Lorg/bukkit/Material;)Ljava/lang/String;", false );
+ return;
+ }
+ }
+
+ if ( retType.getSort() == Type.OBJECT && retType.getInternalName().equals( "org/bukkit/Material" ) && owner.startsWith( "org/bukkit" ) )
+ {
+ super.visitMethodInsn( opcode, owner, name, desc, itf );
+ super.visitMethodInsn( Opcodes.INVOKESTATIC, "org/bukkit/craftbukkit/util/CraftLegacy", "toLegacy", "(Lorg/bukkit/Material;)Lorg/bukkit/Material;", false );
+ return;
+ }
+
+ super.visitMethodInsn( opcode, owner, name, desc, itf );
+ }
+ };
+ }
+ }, 0 );
+
+ return cw.toByteArray();
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
index dbbed1be..da2d070e 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
@@ -138,22 +138,30 @@ public final class CraftChatMessage {
}
}
+ public static IChatBaseComponent fromStringOrNull(String message) {
+ return (message == null) ? null : fromString(message)[0];
+ }
+
public static IChatBaseComponent[] fromString(String message) {
return fromString(message, false);
}
-
+
public static IChatBaseComponent[] fromString(String message, boolean keepNewlines) {
return new StringMessage(message, keepNewlines).getOutput();
}
-
+
public static String fromComponent(IChatBaseComponent component) {
return fromComponent(component, EnumChatFormat.BLACK);
}
+ public static String toJSON(IChatBaseComponent component) {
+ return IChatBaseComponent.ChatSerializer.a(component);
+ }
+
public static String fromComponent(IChatBaseComponent component, EnumChatFormat defaultColor) {
if (component == null) return "";
StringBuilder out = new StringBuilder();
-
+
for (IChatBaseComponent c : (Iterable<IChatBaseComponent>) component) {
ChatModifier modi = c.getChatModifier();
out.append(modi.getColor() == null ? defaultColor : modi.getColor());
@@ -185,7 +193,7 @@ public final class CraftChatMessage {
private static IChatBaseComponent fixComponent(IChatBaseComponent component, Matcher matcher) {
if (component instanceof ChatComponentText) {
ChatComponentText text = ((ChatComponentText) component);
- String msg = text.g();
+ String msg = text.f();
if (matcher.reset(msg).find()) {
matcher.reset();
@@ -236,7 +244,7 @@ public final class CraftChatMessage {
}
if (component instanceof ChatMessage) {
- Object[] subs = ((ChatMessage) component).j();
+ Object[] subs = ((ChatMessage) component).i();
for (int i = 0; i < subs.length; i++) {
Object comp = subs[i];
if (comp instanceof IChatBaseComponent) {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftEvil.java b/src/main/java/org/bukkit/craftbukkit/util/CraftEvil.java
new file mode 100644
index 00000000..14fef6f4
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftEvil.java
@@ -0,0 +1,80 @@
+package org.bukkit.craftbukkit.util;
+
+import com.google.common.base.Preconditions;
+import it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap;
+import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.World;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockState;
+import org.bukkit.inventory.ItemStack;
+
+/**
+ * @deprecated do not use for any reason
+ */
+@Deprecated
+public class CraftEvil {
+
+ private static final Int2ObjectMap<Material> byId = new Int2ObjectLinkedOpenHashMap<>();
+
+ static {
+ for (Material material : Material.values()) {
+ Preconditions.checkState(!byId.containsKey(material.getId()), "Duplicate material ID for", material);
+ byId.put(material.getId(), material);
+ }
+ }
+
+ public static int getBlockTypeIdAt(World world, int x, int y, int z) {
+ return getId(world.getBlockAt(x, y, z).getType());
+ }
+
+ public static int getBlockTypeIdAt(World world, Location location) {
+ return getId(world.getBlockAt(location).getType());
+ }
+
+ public static int getTypeId(Block block) {
+ return getId(block.getType());
+ }
+
+ public static boolean setTypeId(Block block, int type) {
+ block.setType(getMaterial(type));
+ return true;
+ }
+
+ public static boolean setTypeId(Block block, int type, boolean applyPhysics) {
+ block.setType(getMaterial(type), applyPhysics);
+ return true;
+ }
+
+ public static boolean setTypeIdAndData(Block block, int type, byte data, boolean applyPhysics) {
+ block.setType(getMaterial(type), applyPhysics);
+ block.setData(data);
+ return true;
+ }
+
+ public static int getTypeId(BlockState state) {
+ return getId(state.getType());
+ }
+
+ public static boolean setTypeId(BlockState state, int type) {
+ state.setType(getMaterial(type));
+ return true;
+ }
+
+ public static int getTypeId(ItemStack stack) {
+ return getId(stack.getType());
+ }
+
+ public static void setTypeId(ItemStack stack, int type) {
+ stack.setType(getMaterial(type));
+ }
+
+ public static Material getMaterial(int id) {
+ return byId.get(id);
+ }
+
+ public static int getId(Material material) {
+ return CraftLegacy.toLegacy(material).getId();
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftLegacy.java b/src/main/java/org/bukkit/craftbukkit/util/CraftLegacy.java
new file mode 100644
index 00000000..5965e82c
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftLegacy.java
@@ -0,0 +1,366 @@
+package org.bukkit.craftbukkit.util;
+
+import com.google.common.base.Preconditions;
+import com.mojang.datafixers.Dynamic;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import net.minecraft.server.Block;
+import net.minecraft.server.BlockStateList;
+import net.minecraft.server.Blocks;
+import net.minecraft.server.DataConverterFlattenData;
+import net.minecraft.server.DataConverterMaterialId;
+import net.minecraft.server.DataConverterRegistry;
+import net.minecraft.server.DataConverterTypes;
+import net.minecraft.server.DispenserRegistry;
+import net.minecraft.server.DynamicOpsNBT;
+import net.minecraft.server.IBlockData;
+import net.minecraft.server.IBlockState;
+import net.minecraft.server.Item;
+import net.minecraft.server.MinecraftKey;
+import net.minecraft.server.NBTBase;
+import net.minecraft.server.NBTTagCompound;
+import org.bukkit.Material;
+import org.bukkit.entity.EntityType;
+import org.bukkit.material.MaterialData;
+
+/**
+ * This class may seem unnecessarily slow and complicated/repetitive however it
+ * is able to handle a lot more edge cases and invertible transformations (many
+ * of which are not immediately obvious) than any other alternative. If you do
+ * make changes to this class please make sure to contribute them back
+ * https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse so
+ * that all may benefit.
+ *
+ * @deprecated legacy use only
+ */
+@Deprecated
+public class CraftLegacy {
+
+ private static final Map<EntityType, Material> SPAWN_EGGS = new HashMap<>();
+ private static final Set<String> whitelistedStates = new HashSet<>(Arrays.asList("explode", "check_decay", "decayable"));
+ private static final Map<MaterialData, Item> materialToItem = new HashMap<>();
+ private static final Map<Item, MaterialData> itemToMaterial = new HashMap<>();
+ private static final Map<MaterialData, IBlockData> materialToData = new HashMap<>();
+ private static final Map<IBlockData, MaterialData> dataToMaterial = new HashMap<>();
+ private static final Map<MaterialData, Block> materialToBlock = new HashMap<>();
+ private static final Map<Block, MaterialData> blockToMaterial = new HashMap<>();
+
+ public static Material toLegacy(Material material) {
+ if (material == null || material.isLegacy()) {
+ return material;
+ }
+
+ return toLegacyData(material).getItemType();
+ }
+
+ public static MaterialData toLegacyData(Material material) {
+ Preconditions.checkArgument(!material.isLegacy(), "toLegacy on legacy Material");
+ MaterialData mappedData;
+
+ if (material.isBlock()) {
+ Block block = CraftMagicNumbers.getBlock(material);
+ IBlockData blockData = block.getBlockData();
+
+ // Try exact match first
+ mappedData = dataToMaterial.get(blockData);
+ // Fallback to any block
+ if (mappedData == null) {
+ mappedData = blockToMaterial.get(block);
+ // Fallback to matching item
+ if (mappedData == null) {
+ mappedData = itemToMaterial.get(block.getItem());
+ }
+ }
+ } else {
+ Item item = CraftMagicNumbers.getItem(material);
+ mappedData = itemToMaterial.get(item);
+ }
+
+ return (mappedData == null) ? new MaterialData(Material.LEGACY_AIR) : mappedData;
+ }
+
+ public static IBlockData fromLegacyData(Material material, Block block, byte data) {
+ Preconditions.checkArgument(material.isLegacy(), "fromLegacyData on modern Material");
+
+ MaterialData materialData = new MaterialData(material, data);
+
+ // Try exact match first
+ IBlockData converted = materialToData.get(materialData);
+ if (converted != null) {
+ return converted;
+ }
+
+ // Fallback to any block
+ Block convertedBlock = materialToBlock.get(materialData);
+ if (convertedBlock != null) {
+ return convertedBlock.getBlockData();
+ }
+
+ // Return existing block
+ return block.getBlockData();
+ }
+
+ public static Item fromLegacyData(Material material, Item item, short data) {
+ Preconditions.checkArgument(material.isLegacy(), "fromLegacyData on modern Material. Did you forget to define api-version: 1.13 in your plugin.yml?");
+
+ MaterialData materialData = new MaterialData(material, (byte) data);
+
+ if (material.isBlock()) {
+ // Try exact match first
+ IBlockData converted = materialToData.get(materialData);
+ if (converted != null) {
+ return converted.getBlock().getItem();
+ }
+
+ // Fallback to any block
+ Block convertedBlock = materialToBlock.get(materialData);
+ if (convertedBlock != null) {
+ return convertedBlock.getItem();
+ }
+ }
+
+ // Fallback to matching item
+ Item convertedItem = materialToItem.get(materialData);
+ if (convertedItem != null) {
+ return convertedItem;
+ }
+
+ // Return existing item
+ return item;
+ }
+
+ public static byte toLegacyData(IBlockData blockData) {
+ MaterialData mappedData;
+
+ // Try exact match first
+ mappedData = dataToMaterial.get(blockData);
+ // Fallback to any block
+ if (mappedData == null) {
+ mappedData = blockToMaterial.get(blockData.getBlock());
+ }
+
+ return (mappedData == null) ? 0 : mappedData.getData();
+ }
+
+ public static Material fromLegacy(Material material) {
+ return fromLegacy(new MaterialData(material));
+ }
+
+ public static Material fromLegacy(MaterialData materialData) {
+ Material material = materialData.getItemType();
+ if (material == null || !material.isLegacy()) {
+ return material;
+ }
+
+ Material mappedData = null;
+
+ if (material.isBlock()) {
+ // Try exact match first
+ IBlockData iblock = materialToData.get(materialData);
+ if (iblock != null) {
+ mappedData = CraftMagicNumbers.getMaterial(iblock.getBlock());
+ }
+
+ // Fallback to any block
+ if (mappedData == null) {
+ Block block = materialToBlock.get(materialData);
+ if (block != null) {
+ mappedData = CraftMagicNumbers.getMaterial(block);
+ }
+ }
+ }
+
+ // Fallback to matching item
+ if (mappedData == null) {
+ Item item = materialToItem.get(materialData);
+ if (item != null) {
+ mappedData = CraftMagicNumbers.getMaterial(item);
+ }
+ }
+
+ return (mappedData == null) ? Material.AIR : mappedData;
+ }
+
+ public static Material[] values() {
+ Material[] values = Material.values();
+ return Arrays.copyOfRange(values, Material.LEGACY_AIR.ordinal(), values.length);
+ }
+
+ public static Material valueOf(String name) {
+ return (name.startsWith(Material.LEGACY_PREFIX)) ? Material.valueOf(name) : Material.valueOf(Material.LEGACY_PREFIX + name);
+ }
+
+ public static Material getMaterial(String name) {
+ return (name.startsWith(Material.LEGACY_PREFIX)) ? Material.getMaterial(name) : Material.getMaterial(Material.LEGACY_PREFIX + name);
+ }
+
+ public static Material matchMaterial(String name) {
+ return (name.startsWith(Material.LEGACY_PREFIX)) ? Material.matchMaterial(name) : Material.matchMaterial(Material.LEGACY_PREFIX + name);
+ }
+
+ public static int ordinal(Material material) {
+ Preconditions.checkArgument(material.isLegacy(), "ordinal on modern Material");
+
+ return material.ordinal() - Material.LEGACY_AIR.ordinal();
+ }
+
+ public static String name(Material material) {
+ return material.name().substring(Material.LEGACY_PREFIX.length());
+ }
+
+ public static String toString(Material material) {
+ return name(material);
+ }
+
+ public static Material[] modern_values() {
+ Material[] values = Material.values();
+ return Arrays.copyOfRange(values, 0, Material.LEGACY_AIR.ordinal());
+ }
+
+ static {
+ SPAWN_EGGS.put(EntityType.BAT, Material.BAT_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.BLAZE, Material.BLAZE_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.CAVE_SPIDER, Material.CAVE_SPIDER_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.CHICKEN, Material.CHICKEN_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.COW, Material.COW_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.CREEPER, Material.CREEPER_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.ENDERMAN, Material.ENDERMAN_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.ENDERMITE, Material.ENDERMITE_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.GHAST, Material.GHAST_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.GUARDIAN, Material.GUARDIAN_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.HORSE, Material.HORSE_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.MAGMA_CUBE, Material.MAGMA_CUBE_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.MUSHROOM_COW, Material.MOOSHROOM_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.OCELOT, Material.OCELOT_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.PIG, Material.PIG_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.RABBIT, Material.RABBIT_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.SHEEP, Material.SHEEP_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.SHULKER, Material.SHULKER_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.SILVERFISH, Material.SILVERFISH_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.SKELETON, Material.SKELETON_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.SLIME, Material.SLIME_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.SPIDER, Material.SPIDER_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.SQUID, Material.SQUID_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.VILLAGER, Material.VILLAGER_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.WITCH, Material.WITCH_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.WOLF, Material.WOLF_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.PIG_ZOMBIE, Material.ZOMBIE_PIGMAN_SPAWN_EGG);
+ SPAWN_EGGS.put(EntityType.ZOMBIE, Material.ZOMBIE_SPAWN_EGG);
+
+ DispenserRegistry.c();
+
+ for (Material material : Material.values()) {
+ if (!material.isLegacy()) {
+ continue;
+ }
+
+ // Handle blocks
+ if (material.isBlock()) {
+ for (byte data = 0; data < 16; data++) {
+ MaterialData matData = new MaterialData(material, data);
+ Dynamic blockTag = DataConverterFlattenData.b(material.getId() << 4 | data);
+ // TODO: better skull conversion, chests
+ if (blockTag.getString("Name").contains("%%FILTER_ME%%")) {
+ continue;
+ }
+
+ String name = blockTag.getString("Name");
+ // TODO: need to fix
+ if (name.equals("minecraft:portal")) {
+ name = "minecraft:nether_portal";
+ }
+
+ Block block = Block.REGISTRY.get(new MinecraftKey(name));
+ IBlockData blockData = block.getBlockData();
+ BlockStateList states = block.getStates();
+
+ Optional<Dynamic> propMap = blockTag.get("Properties");
+ if (propMap.isPresent()) {
+ NBTTagCompound properties = (NBTTagCompound) propMap.get().getValue();
+ for (String dataKey : properties.getKeys()) {
+ IBlockState state = states.a(dataKey);
+
+ if (state == null) {
+ if (whitelistedStates.contains(dataKey)) {
+ continue;
+ }
+ throw new IllegalStateException("No state for " + dataKey);
+ }
+
+ Preconditions.checkState(!properties.getString(dataKey).isEmpty(), "Empty data string");
+ Optional opt = state.b(properties.getString(dataKey));
+
+ blockData = blockData.set(state, (Comparable) opt.get());
+ }
+ }
+
+ if (block == Blocks.AIR) {
+ continue;
+ }
+
+ materialToData.put(matData, blockData);
+ if (!dataToMaterial.containsKey(blockData)) {
+ dataToMaterial.put(blockData, matData);
+ }
+
+ materialToBlock.put(matData, block);
+ if (!blockToMaterial.containsKey(block)) {
+ blockToMaterial.put(block, matData);
+ }
+ }
+ }
+
+ // Handle items (and second fallback for blocks)
+ int maxData = material.getMaxDurability() == 0 ? 16 : 1;
+ // Manually do oldold spawn eggs
+ if (material == Material.LEGACY_MONSTER_EGG) {
+ maxData = 121; // Vilager + 1
+ }
+
+ for (byte data = 0; data < maxData; data++) {
+ // Manually skip invalid oldold spawn
+ if (material == Material.LEGACY_MONSTER_EGG /*&& data != 0 && EntityType.fromId(data) == null*/) { // Mojang broke 18w19b
+ continue;
+ }
+ // Skip non item stacks for now (18w19b)
+ if (DataConverterMaterialId.a(material.getId()) == null) {
+ continue;
+ }
+
+ MaterialData matData = new MaterialData(material, data);
+
+ NBTTagCompound stack = new NBTTagCompound();
+ stack.setInt("id", material.getId());
+ stack.setShort("Damage", data);
+
+ Dynamic<NBTBase> converted = DataConverterRegistry.a().update(DataConverterTypes.ITEM_STACK, new Dynamic<NBTBase>(DynamicOpsNBT.a, stack), -1, CraftMagicNumbers.DATA_VERSION);
+
+ String newId = converted.getString("id");
+ // Recover spawn eggs with invalid data
+ if (newId.equals("minecraft:spawn_egg")) {
+ newId = "minecraft:pig_spawn_egg";
+ }
+
+ // Preconditions.checkState(newId.contains("minecraft:"), "Unknown new material for " + matData);
+ Item newMaterial = Item.REGISTRY.get(new MinecraftKey(newId));
+
+ materialToItem.put(matData, newMaterial);
+ if (!itemToMaterial.containsKey(newMaterial)) {
+ itemToMaterial.put(newMaterial, matData);
+ }
+ }
+
+ for (Map.Entry<EntityType, Material> entry : SPAWN_EGGS.entrySet()) {
+ MaterialData matData = new MaterialData(Material.LEGACY_MONSTER_EGG, (byte) entry.getKey().getTypeId());
+ Item newMaterial = CraftMagicNumbers.getItem(entry.getValue());
+
+ materialToItem.put(matData, newMaterial);
+ itemToMaterial.put(newMaterial, matData);
+ }
+ }
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index a1be7ec4..fbdfdc47 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -1,43 +1,41 @@
package org.bukkit.craftbukkit.util;
import com.google.common.base.Charsets;
-import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.io.Files;
+import com.mojang.brigadier.exceptions.CommandSyntaxException;
import java.io.File;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
+import java.util.Locale;
+import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
-import net.minecraft.server.AdvancementDataWorld;
+import net.minecraft.server.AdvancementDataWorld;
import net.minecraft.server.Block;
-import net.minecraft.server.Blocks;
import net.minecraft.server.ChatDeserializer;
+import net.minecraft.server.IBlockData;
import net.minecraft.server.Item;
import net.minecraft.server.MinecraftKey;
import net.minecraft.server.MinecraftServer;
-import net.minecraft.server.MojangsonParseException;
import net.minecraft.server.MojangsonParser;
import net.minecraft.server.NBTTagCompound;
-import net.minecraft.server.StatisticList;
-import org.bukkit.Achievement;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
-import org.bukkit.Statistic;
import org.bukkit.UnsafeValues;
import org.bukkit.advancement.Advancement;
-import org.bukkit.craftbukkit.CraftStatistic;
+import org.bukkit.block.data.BlockData;
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack;
-import org.bukkit.util.StringUtil;
+import org.bukkit.material.MaterialData;
+import org.bukkit.plugin.PluginAwareness;
+import org.bukkit.plugin.PluginDescriptionFile;
+import org.bukkit.plugin.UnknownDependencyException;
@SuppressWarnings("deprecation")
public final class CraftMagicNumbers implements UnsafeValues {
@@ -45,81 +43,106 @@ public final class CraftMagicNumbers implements UnsafeValues {
private CraftMagicNumbers() {}
- public static Block getBlock(org.bukkit.block.Block block) {
- return getBlock(block.getType());
+ public static IBlockData getBlock(MaterialData material) {
+ return getBlock(material.getItemType(), material.getData());
}
- @Deprecated
- // A bad method for bad magic.
- public static Block getBlock(int id) {
- return getBlock(Material.getMaterial(id));
+ public static IBlockData getBlock(Material material, byte data) {
+ return CraftLegacy.fromLegacyData(CraftLegacy.toLegacy(material), getBlock(material), data);
}
- @Deprecated
- // A bad method for bad magic.
- public static int getId(Block block) {
- return Block.getId(block);
+ public static MaterialData getMaterial(IBlockData data) {
+ return CraftLegacy.toLegacy(getMaterial(data.getBlock())).getNewData(toLegacyData(data));
}
- public static Material getMaterial(Block block) {
- return Material.getMaterial(Block.getId(block));
+ public static Item getItem(Material material, short data) {
+ if (material.isLegacy()) {
+ return CraftLegacy.fromLegacyData(CraftLegacy.toLegacy(material), getItem(material), data);
+ }
+
+ return getItem(material);
}
- public static Item getItem(Material material) {
- // TODO: Don't use ID
- Item item = Item.getById(material.getId());
- return item;
+ public static MaterialData getMaterialData(Item item) {
+ return CraftLegacy.toLegacyData(getMaterial(item));
}
- @Deprecated
- // A bad method for bad magic.
- public static Item getItem(int id) {
- return Item.getById(id);
+ // ========================================================================
+ private static final Map<Block, Material> BLOCK_MATERIAL = new HashMap<>();
+ private static final Map<Item, Material> ITEM_MATERIAL = new HashMap<>();
+ private static final Map<Material, Item> MATERIAL_ITEM = new HashMap<>();
+ private static final Map<Material, Block> MATERIAL_BLOCK = new HashMap<>();
+
+ static {
+ for (Block block : (Iterable<Block>) Block.REGISTRY) { // Eclipse fail
+ BLOCK_MATERIAL.put(block, Material.getMaterial(Block.REGISTRY.b(block).getKey().toUpperCase(Locale.ROOT)));
+ }
+
+ for (Item item : (Iterable<Item>) Item.REGISTRY) { // Eclipse fail
+ ITEM_MATERIAL.put(item, Material.getMaterial(Item.REGISTRY.b(item).getKey().toUpperCase(Locale.ROOT)));
+ }
+
+ for (Material material : Material.values()) {
+ MinecraftKey key = key(material);
+ MATERIAL_ITEM.put(material, Item.REGISTRY.get(key));
+ MATERIAL_BLOCK.put(material, Block.REGISTRY.get(key));
+ }
}
- @Deprecated
- // A bad method for bad magic.
- public static int getId(Item item) {
- return Item.getId(item);
+ public static Material getMaterial(Block block) {
+ return BLOCK_MATERIAL.get(block);
}
public static Material getMaterial(Item item) {
- // TODO: Don't use ID
- Material material = Material.getMaterial(Item.getId(item));
-
- if (material == null) {
- return Material.AIR;
- }
+ return ITEM_MATERIAL.getOrDefault(item, Material.AIR);
+ }
- return material;
+ public static Item getItem(Material material) {
+ return MATERIAL_ITEM.get(material);
}
public static Block getBlock(Material material) {
- if (material == null) {
- return null;
- }
- // TODO: Don't use ID
- Block block = Block.getById(material.getId());
+ return MATERIAL_BLOCK.get(material);
+ }
- if (block == null) {
- return Blocks.AIR;
+ public static MinecraftKey key(Material mat) {
+ if (mat.isLegacy()) {
+ mat = CraftLegacy.fromLegacy(mat);
}
- return block;
+ return CraftNamespacedKey.toMinecraft(mat.getKey());
+ }
+ // ========================================================================
+
+ public static byte toLegacyData(IBlockData data) {
+ return CraftLegacy.toLegacyData(data);
}
@Override
- public Material getMaterialFromInternalName(String name) {
- return getMaterial((Item) Item.REGISTRY.get(new MinecraftKey(name)));
+ public Material toLegacy(Material material) {
+ return CraftLegacy.toLegacy(material);
}
@Override
- public List<String> tabCompleteInternalMaterialName(String token, List<String> completions) {
- ArrayList<String> results = Lists.newArrayList();
- for (MinecraftKey key : (Set<MinecraftKey>)Item.REGISTRY.keySet()) {
- results.add(key.toString());
- }
- return StringUtil.copyPartialMatches(token, results, completions);
+ public Material fromLegacy(Material material) {
+ return CraftLegacy.fromLegacy(material);
+ }
+
+ @Override
+ public Material fromLegacy(MaterialData material) {
+ return CraftLegacy.fromLegacy(material);
+ }
+
+ @Override
+ public BlockData fromLegacy(Material material, byte data) {
+ return CraftBlockData.fromData(getBlock(material, data));
+ }
+
+ public static final int DATA_VERSION = 1513;
+
+ @Override
+ public int getDataVersion() {
+ return DATA_VERSION;
}
@Override
@@ -128,7 +151,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
try {
nmsStack.setTag((NBTTagCompound) MojangsonParser.parse(arguments));
- } catch (MojangsonParseException ex) {
+ } catch (CommandSyntaxException ex) {
Logger.getLogger(CraftMagicNumbers.class.getName()).log(Level.SEVERE, null, ex);
}
@@ -138,29 +161,6 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
@Override
- public Statistic getStatisticFromInternalName(String name) {
- return CraftStatistic.getBukkitStatisticByName(name);
- }
-
- @Override
- public Achievement getAchievementFromInternalName(String name) {
- throw new UnsupportedOperationException("Not supported in this Minecraft version.");
- }
-
- @Override
- public List<String> tabCompleteInternalStatisticOrAchievementName(String token, List<String> completions) {
- List<String> matches = new ArrayList<String>();
- Iterator iterator = StatisticList.stats.iterator();
- while (iterator.hasNext()) {
- String statistic = ((net.minecraft.server.Statistic) iterator.next()).name;
- if (statistic.startsWith(token)) {
- matches.add(statistic);
- }
- }
- return matches;
- }
-
- @Override
public Advancement loadAdvancement(NamespacedKey key, String advancement) {
if (Bukkit.getAdvancement(key) != null) {
throw new IllegalArgumentException("Advancement " + key + " already exists.");
@@ -172,7 +172,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
Advancement bukkit = Bukkit.getAdvancement(key);
if (bukkit != null) {
- File file = new File(MinecraftServer.getServer().getAdvancementData().folder, key.getNamespace() + File.separator + key.getKey() + ".json");
+ File file = new File(MinecraftServer.getServer().bukkitDataPackFolder, "data" + File.separator + key.getNamespace() + File.separator + "advancements" + File.separator + key.getKey() + ".json");
file.getParentFile().mkdirs();
try {
@@ -192,10 +192,34 @@ public final class CraftMagicNumbers implements UnsafeValues {
@Override
public boolean removeAdvancement(NamespacedKey key) {
- File file = new File(MinecraftServer.getServer().getAdvancementData().folder, key.getNamespace() + File.separator + key.getKey() + ".json");
+ File file = new File(MinecraftServer.getServer().bukkitDataPackFolder, "data" + File.separator + key.getNamespace() + File.separator + "advancements" + File.separator + key.getKey() + ".json");
return file.delete();
}
+ @Override
+ public void checkSupported(PluginDescriptionFile pdf) {
+ if (pdf.getAPIVersion() != null) {
+ if (!pdf.getAPIVersion().equals("1.13")) {
+ throw new UnknownDependencyException("Unsupported API version " + pdf.getAPIVersion());
+ }
+ }
+ }
+
+ public static boolean isLegacy(PluginDescriptionFile pdf) {
+ return pdf.getAPIVersion() == null;
+ }
+
+ @Override
+ public byte[] processClass(PluginDescriptionFile pdf, byte[] clazz) {
+ try {
+ clazz = Commodore.convert(clazz, !isLegacy(pdf));
+ } catch (Exception ex) {
+ Bukkit.getLogger().log(Level.SEVERE, "Fatal error trying to convert " + pdf.getFullName(), ex);
+ }
+
+ return clazz;
+ }
+
/**
* This helper class represents the different NBT Tags.
* <p>
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
new file mode 100644
index 00000000..1833ee72
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
@@ -0,0 +1,254 @@
+package org.bukkit.craftbukkit.util;
+
+import java.util.List;
+import java.util.Random;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import net.minecraft.server.AxisAlignedBB;
+import net.minecraft.server.BiomeBase;
+import net.minecraft.server.Block;
+import net.minecraft.server.BlockPosition;
+import net.minecraft.server.DifficultyDamageScaler;
+import net.minecraft.server.Entity;
+import net.minecraft.server.EntityHuman;
+import net.minecraft.server.EnumDirection;
+import net.minecraft.server.EnumSkyBlock;
+import net.minecraft.server.Fluid;
+import net.minecraft.server.FluidType;
+import net.minecraft.server.GeneratorAccess;
+import net.minecraft.server.HeightMap;
+import net.minecraft.server.IBlockData;
+import net.minecraft.server.IChunkAccess;
+import net.minecraft.server.IChunkProvider;
+import net.minecraft.server.IDataManager;
+import net.minecraft.server.ParticleParam;
+import net.minecraft.server.PersistentBase;
+import net.minecraft.server.PersistentCollection;
+import net.minecraft.server.SoundCategory;
+import net.minecraft.server.SoundEffect;
+import net.minecraft.server.TickList;
+import net.minecraft.server.TileEntity;
+import net.minecraft.server.VoxelShape;
+import net.minecraft.server.World;
+import net.minecraft.server.WorldBorder;
+import net.minecraft.server.WorldData;
+import net.minecraft.server.WorldProvider;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+
+public class DummyGeneratorAccess implements GeneratorAccess {
+
+ public static final GeneratorAccess INSTANCE = new DummyGeneratorAccess();
+
+ private DummyGeneratorAccess() {
+ }
+
+ @Override
+ public long getSeed() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public TickList<Block> I() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public TickList<FluidType> H() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public IChunkAccess c(int i, int i1) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public World getMinecraftWorld() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public WorldData getWorldData() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public DifficultyDamageScaler getDamageScaler(BlockPosition bp) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public <T extends PersistentBase> T a(Function<String, T> fnctn, String string) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public PersistentCollection s_() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void a(String string, PersistentBase pb) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public IChunkProvider getChunkProvider() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public IDataManager getDataManager() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Random m() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void update(BlockPosition bp, Block block) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public BlockPosition getSpawn() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void a(EntityHuman eh, BlockPosition bp, SoundEffect se, SoundCategory sc, float f, float f1) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void addParticle(ParticleParam pp, double d, double d1, double d2, double d3, double d4, double d5) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean isEmpty(BlockPosition bp) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public BiomeBase getBiome(BlockPosition bp) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public int getBrightness(EnumSkyBlock esb, BlockPosition bp) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public int getLightLevel(BlockPosition bp, int i) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean isChunkLoaded(int i, int i1, boolean bln) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean e(BlockPosition bp) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public int a(HeightMap.Type type, int i, int i1) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public EntityHuman a(double d, double d1, double d2, double d3, Predicate<Entity> prdct) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public int c() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public WorldBorder getWorldBorder() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean a(Entity entity, VoxelShape vs) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public List<Entity> getEntities(Entity entity, AxisAlignedBB aabb) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public int a(BlockPosition bp, EnumDirection ed) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean e() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public int getSeaLevel() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public WorldProvider o() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public TileEntity getTileEntity(BlockPosition bp) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public IBlockData getType(BlockPosition bp) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Fluid b(BlockPosition bp) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) {
+ return false;
+ }
+
+ @Override
+ public boolean addEntity(Entity entity) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean addEntity(Entity entity, CreatureSpawnEvent.SpawnReason reason) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean setAir(BlockPosition blockposition) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void a(EnumSkyBlock enumskyblock, BlockPosition blockposition, int i) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean setAir(BlockPosition blockposition, boolean flag) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/StructureGrowDelegate.java b/src/main/java/org/bukkit/craftbukkit/util/StructureGrowDelegate.java
deleted file mode 100644
index f9cc7d6f..00000000
--- a/src/main/java/org/bukkit/craftbukkit/util/StructureGrowDelegate.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.bukkit.craftbukkit.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.minecraft.server.Block;
-import net.minecraft.server.Blocks;
-import net.minecraft.server.World;
-
-import org.bukkit.BlockChangeDelegate;
-import org.bukkit.block.BlockState;
-import org.bukkit.craftbukkit.CraftWorld;
-import org.bukkit.material.MaterialData;
-
-public class StructureGrowDelegate implements BlockChangeDelegate {
- private final CraftWorld world;
- private final List<BlockState> blocks = new ArrayList<BlockState>();
-
- public StructureGrowDelegate(World world) {
- this.world = world.getWorld();
- }
-
- public boolean setRawTypeId(int x, int y, int z, int type) {
- return setRawTypeIdAndData(x, y, z, type, 0);
- }
-
- public boolean setRawTypeIdAndData(int x, int y, int z, int type, int data) {
- BlockState state = world.getBlockAt(x, y, z).getState();
- state.setTypeId(type);
- state.setData(new MaterialData(type, (byte) data));
- blocks.add(state);
- return true;
- }
-
- public boolean setTypeId(int x, int y, int z, int typeId) {
- return setRawTypeId(x, y, z, typeId);
- }
-
- public boolean setTypeIdAndData(int x, int y, int z, int typeId, int data) {
- return setRawTypeIdAndData(x, y, z, typeId, data);
- }
-
- public int getTypeId(int x, int y, int z) {
- for (BlockState state : blocks) {
- if (state.getX() == x && state.getY() == y && state.getZ() == z) {
- return state.getTypeId();
- }
- }
-
- return world.getBlockTypeIdAt(x, y, z);
- }
-
- public int getHeight() {
- return world.getMaxHeight();
- }
-
- public List<BlockState> getBlocks() {
- return blocks;
- }
-
- public boolean isEmpty(int x, int y, int z) {
- for (BlockState state : blocks) {
- if (state.getX() == x && state.getY() == y && state.getZ() == z) {
- return Block.getById(state.getTypeId()) == Blocks.AIR;
- }
- }
-
- return world.getBlockAt(x, y, z).isEmpty();
- }
-}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
index 39ef2ef9..c928c2b6 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
@@ -15,7 +15,7 @@ public final class CommandPermissions {
DefaultPermissions.registerPermission(PREFIX + "kill", "Allows the user to commit suicide", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "me", "Allows the user to perform a chat action", PermissionDefault.TRUE, commands);
- DefaultPermissions.registerPermission(PREFIX + "tell", "Allows the user to privately message another player", PermissionDefault.TRUE, commands);
+ DefaultPermissions.registerPermission(PREFIX + "msg", "Allows the user to privately message another player", PermissionDefault.TRUE, commands);
DefaultPermissions.registerPermission(PREFIX + "say", "Allows the user to talk as the console", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "give", "Allows the user to give items to players", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "teleport", "Allows the user to teleport players", PermissionDefault.OP, commands);