github.com/df-mc/dragonfly@v0.9.13/server/block/register.go (about)

     1  package block
     2  
     3  import (
     4  	"github.com/df-mc/dragonfly/server/item"
     5  	"github.com/df-mc/dragonfly/server/world"
     6  )
     7  
     8  //go:generate go run ../../cmd/blockhash -o hash.go .
     9  
    10  // init registers all blocks implemented by Dragonfly.
    11  func init() {
    12  	world.RegisterBlock(Air{})
    13  	world.RegisterBlock(Amethyst{})
    14  	world.RegisterBlock(AncientDebris{})
    15  	world.RegisterBlock(Andesite{Polished: true})
    16  	world.RegisterBlock(Andesite{})
    17  	world.RegisterBlock(Barrier{})
    18  	world.RegisterBlock(Beacon{})
    19  	world.RegisterBlock(Bedrock{InfiniteBurning: true})
    20  	world.RegisterBlock(Bedrock{})
    21  	world.RegisterBlock(BlueIce{})
    22  	world.RegisterBlock(Bookshelf{})
    23  	world.RegisterBlock(Bricks{})
    24  	world.RegisterBlock(Calcite{})
    25  	world.RegisterBlock(Clay{})
    26  	world.RegisterBlock(Coal{})
    27  	world.RegisterBlock(Cobblestone{Mossy: true})
    28  	world.RegisterBlock(Cobblestone{})
    29  	world.RegisterBlock(CraftingTable{})
    30  	world.RegisterBlock(DeadBush{})
    31  	world.RegisterBlock(DeepslateBricks{Cracked: true})
    32  	world.RegisterBlock(DeepslateBricks{})
    33  	world.RegisterBlock(DeepslateTiles{Cracked: true})
    34  	world.RegisterBlock(DeepslateTiles{})
    35  	world.RegisterBlock(Diamond{})
    36  	world.RegisterBlock(Diorite{Polished: true})
    37  	world.RegisterBlock(Diorite{})
    38  	world.RegisterBlock(DirtPath{})
    39  	world.RegisterBlock(Dirt{Coarse: true})
    40  	world.RegisterBlock(Dirt{})
    41  	world.RegisterBlock(DragonEgg{})
    42  	world.RegisterBlock(DriedKelp{})
    43  	world.RegisterBlock(Dripstone{})
    44  	world.RegisterBlock(Emerald{})
    45  	world.RegisterBlock(EnchantingTable{})
    46  	world.RegisterBlock(EndBricks{})
    47  	world.RegisterBlock(EndStone{})
    48  	world.RegisterBlock(FletchingTable{})
    49  	world.RegisterBlock(GlassPane{})
    50  	world.RegisterBlock(Glass{})
    51  	world.RegisterBlock(Glowstone{})
    52  	world.RegisterBlock(Gold{})
    53  	world.RegisterBlock(Granite{Polished: true})
    54  	world.RegisterBlock(Granite{})
    55  	world.RegisterBlock(Grass{})
    56  	world.RegisterBlock(Gravel{})
    57  	world.RegisterBlock(Honeycomb{})
    58  	world.RegisterBlock(InvisibleBedrock{})
    59  	world.RegisterBlock(IronBars{})
    60  	world.RegisterBlock(Iron{})
    61  	world.RegisterBlock(Jukebox{})
    62  	world.RegisterBlock(Lapis{})
    63  	world.RegisterBlock(Melon{})
    64  	world.RegisterBlock(MossCarpet{})
    65  	world.RegisterBlock(MudBricks{})
    66  	world.RegisterBlock(Mud{})
    67  	world.RegisterBlock(NetherBrickFence{})
    68  	world.RegisterBlock(NetherGoldOre{})
    69  	world.RegisterBlock(NetherQuartzOre{})
    70  	world.RegisterBlock(NetherSprouts{})
    71  	world.RegisterBlock(NetherWartBlock{Warped: true})
    72  	world.RegisterBlock(NetherWartBlock{})
    73  	world.RegisterBlock(Netherite{})
    74  	world.RegisterBlock(Netherrack{})
    75  	world.RegisterBlock(Note{})
    76  	world.RegisterBlock(Obsidian{Crying: true})
    77  	world.RegisterBlock(Obsidian{})
    78  	world.RegisterBlock(PackedIce{})
    79  	world.RegisterBlock(PackedMud{})
    80  	world.RegisterBlock(Podzol{})
    81  	world.RegisterBlock(PolishedBlackstoneBrick{Cracked: true})
    82  	world.RegisterBlock(PolishedBlackstoneBrick{})
    83  	world.RegisterBlock(QuartzBricks{})
    84  	world.RegisterBlock(RawCopper{})
    85  	world.RegisterBlock(RawGold{})
    86  	world.RegisterBlock(RawIron{})
    87  	world.RegisterBlock(ReinforcedDeepslate{})
    88  	world.RegisterBlock(Sand{Red: true})
    89  	world.RegisterBlock(Sand{})
    90  	world.RegisterBlock(SeaLantern{})
    91  	world.RegisterBlock(Shroomlight{})
    92  	world.RegisterBlock(SmithingTable{})
    93  	world.RegisterBlock(Snow{})
    94  	world.RegisterBlock(SoulSand{})
    95  	world.RegisterBlock(SoulSoil{})
    96  	world.RegisterBlock(Sponge{Wet: true})
    97  	world.RegisterBlock(Sponge{})
    98  	world.RegisterBlock(SporeBlossom{})
    99  	world.RegisterBlock(Stone{Smooth: true})
   100  	world.RegisterBlock(Stone{})
   101  	world.RegisterBlock(TNT{})
   102  	world.RegisterBlock(Terracotta{})
   103  	world.RegisterBlock(Tuff{})
   104  
   105  	for _, ore := range OreTypes() {
   106  		world.RegisterBlock(CoalOre{Type: ore})
   107  		world.RegisterBlock(CopperOre{Type: ore})
   108  		world.RegisterBlock(DiamondOre{Type: ore})
   109  		world.RegisterBlock(EmeraldOre{Type: ore})
   110  		world.RegisterBlock(GoldOre{Type: ore})
   111  		world.RegisterBlock(IronOre{Type: ore})
   112  		world.RegisterBlock(LapisOre{Type: ore})
   113  	}
   114  
   115  	registerAll(allAnvils())
   116  	registerAll(allBanners())
   117  	registerAll(allBarrels())
   118  	registerAll(allBasalt())
   119  	registerAll(allBeetroot())
   120  	registerAll(allBlackstone())
   121  	registerAll(allBlastFurnaces())
   122  	registerAll(allBoneBlock())
   123  	registerAll(allCactus())
   124  	registerAll(allCake())
   125  	registerAll(allCarpet())
   126  	registerAll(allCarrots())
   127  	registerAll(allChains())
   128  	registerAll(allChests())
   129  	registerAll(allCocoaBeans())
   130  	registerAll(allComposters())
   131  	registerAll(allConcrete())
   132  	registerAll(allConcretePowder())
   133  	registerAll(allCoral())
   134  	registerAll(allCoralBlocks())
   135  	registerAll(allDeepslate())
   136  	registerAll(allDoors())
   137  	registerAll(allDoubleFlowers())
   138  	registerAll(allDoubleTallGrass())
   139  	registerAll(allEnderChests())
   140  	registerAll(allFarmland())
   141  	registerAll(allFence())
   142  	registerAll(allFenceGates())
   143  	registerAll(allFire())
   144  	registerAll(allFlowers())
   145  	registerAll(allFroglight())
   146  	registerAll(allFurnaces())
   147  	registerAll(allGlazedTerracotta())
   148  	registerAll(allGrindstones())
   149  	registerAll(allHayBales())
   150  	registerAll(allItemFrames())
   151  	registerAll(allKelp())
   152  	registerAll(allLadders())
   153  	registerAll(allLanterns())
   154  	registerAll(allLava())
   155  	registerAll(allLeaves())
   156  	registerAll(allLecterns())
   157  	registerAll(allLight())
   158  	registerAll(allLitPumpkins())
   159  	registerAll(allLogs())
   160  	registerAll(allLooms())
   161  	registerAll(allMelonStems())
   162  	registerAll(allMuddyMangroveRoots())
   163  	registerAll(allNetherBricks())
   164  	registerAll(allNetherWart())
   165  	registerAll(allPlanks())
   166  	registerAll(allPotato())
   167  	registerAll(allPrismarine())
   168  	registerAll(allPumpkinStems())
   169  	registerAll(allPumpkins())
   170  	registerAll(allPurpurs())
   171  	registerAll(allQuartz())
   172  	registerAll(allSandstones())
   173  	registerAll(allSeaPickles())
   174  	registerAll(allSigns())
   175  	registerAll(allSkulls())
   176  	registerAll(allSlabs())
   177  	registerAll(allSmokers())
   178  	registerAll(allStainedGlass())
   179  	registerAll(allStainedGlassPane())
   180  	registerAll(allStainedTerracotta())
   181  	registerAll(allStairs())
   182  	registerAll(allStoneBricks())
   183  	registerAll(allStonecutters())
   184  	registerAll(allSugarCane())
   185  	registerAll(allTallGrass())
   186  	registerAll(allTorches())
   187  	registerAll(allTrapdoors())
   188  	registerAll(allWalls())
   189  	registerAll(allWater())
   190  	registerAll(allWheat())
   191  	registerAll(allWood())
   192  	registerAll(allWool())
   193  	registerAll(allDecoratedPots())
   194  }
   195  
   196  func init() {
   197  	world.RegisterItem(Air{})
   198  	world.RegisterItem(Amethyst{})
   199  	world.RegisterItem(AncientDebris{})
   200  	world.RegisterItem(Andesite{Polished: true})
   201  	world.RegisterItem(Andesite{})
   202  	world.RegisterItem(Barrel{})
   203  	world.RegisterItem(Barrier{})
   204  	world.RegisterItem(Basalt{Polished: true})
   205  	world.RegisterItem(Basalt{})
   206  	world.RegisterItem(Beacon{})
   207  	world.RegisterItem(Bedrock{})
   208  	world.RegisterItem(BeetrootSeeds{})
   209  	world.RegisterItem(BlastFurnace{})
   210  	world.RegisterItem(BlueIce{})
   211  	world.RegisterItem(Bone{})
   212  	world.RegisterItem(Bookshelf{})
   213  	world.RegisterItem(Bricks{})
   214  	world.RegisterItem(Cactus{})
   215  	world.RegisterItem(Cake{})
   216  	world.RegisterItem(Calcite{})
   217  	world.RegisterItem(Carrot{})
   218  	world.RegisterItem(Chain{})
   219  	world.RegisterItem(Chest{})
   220  	world.RegisterItem(ChiseledQuartz{})
   221  	world.RegisterItem(Clay{})
   222  	world.RegisterItem(Coal{})
   223  	world.RegisterItem(Cobblestone{Mossy: true})
   224  	world.RegisterItem(Cobblestone{})
   225  	world.RegisterItem(CocoaBean{})
   226  	world.RegisterItem(Composter{})
   227  	world.RegisterItem(CraftingTable{})
   228  	world.RegisterItem(DeadBush{})
   229  	world.RegisterItem(DeepslateBricks{Cracked: true})
   230  	world.RegisterItem(DeepslateBricks{})
   231  	world.RegisterItem(DeepslateTiles{Cracked: true})
   232  	world.RegisterItem(DeepslateTiles{})
   233  	world.RegisterItem(Diamond{})
   234  	world.RegisterItem(Diorite{Polished: true})
   235  	world.RegisterItem(Diorite{})
   236  	world.RegisterItem(DirtPath{})
   237  	world.RegisterItem(Dirt{Coarse: true})
   238  	world.RegisterItem(Dirt{})
   239  	world.RegisterItem(DragonEgg{})
   240  	world.RegisterItem(DriedKelp{})
   241  	world.RegisterItem(Dripstone{})
   242  	world.RegisterItem(Emerald{})
   243  	world.RegisterItem(EnchantingTable{})
   244  	world.RegisterItem(EndBricks{})
   245  	world.RegisterItem(EndStone{})
   246  	world.RegisterItem(EnderChest{})
   247  	world.RegisterItem(Farmland{})
   248  	world.RegisterItem(Furnace{})
   249  	world.RegisterItem(GlassPane{})
   250  	world.RegisterItem(Glass{})
   251  	world.RegisterItem(Glowstone{})
   252  	world.RegisterItem(Gold{})
   253  	world.RegisterItem(Granite{Polished: true})
   254  	world.RegisterItem(Granite{})
   255  	world.RegisterItem(Grass{})
   256  	world.RegisterItem(Gravel{})
   257  	world.RegisterItem(Grindstone{})
   258  	world.RegisterItem(HayBale{})
   259  	world.RegisterItem(Honeycomb{})
   260  	world.RegisterItem(InvisibleBedrock{})
   261  	world.RegisterItem(IronBars{})
   262  	world.RegisterItem(Iron{})
   263  	world.RegisterItem(ItemFrame{Glowing: true})
   264  	world.RegisterItem(ItemFrame{})
   265  	world.RegisterItem(Jukebox{})
   266  	world.RegisterItem(Kelp{})
   267  	world.RegisterItem(Ladder{})
   268  	world.RegisterItem(Lapis{})
   269  	world.RegisterItem(Lectern{})
   270  	world.RegisterItem(LitPumpkin{})
   271  	world.RegisterItem(Loom{})
   272  	world.RegisterItem(MelonSeeds{})
   273  	world.RegisterItem(Melon{})
   274  	world.RegisterItem(MossCarpet{})
   275  	world.RegisterItem(MudBricks{})
   276  	world.RegisterItem(MuddyMangroveRoots{})
   277  	world.RegisterItem(Mud{})
   278  	world.RegisterItem(NetherBrickFence{})
   279  	world.RegisterItem(NetherGoldOre{})
   280  	world.RegisterItem(NetherQuartzOre{})
   281  	world.RegisterItem(NetherSprouts{})
   282  	world.RegisterItem(NetherWartBlock{Warped: true})
   283  	world.RegisterItem(NetherWartBlock{})
   284  	world.RegisterItem(NetherWart{})
   285  	world.RegisterItem(Netherite{})
   286  	world.RegisterItem(Netherrack{})
   287  	world.RegisterItem(Note{Pitch: 24})
   288  	world.RegisterItem(Obsidian{Crying: true})
   289  	world.RegisterItem(Obsidian{})
   290  	world.RegisterItem(PackedIce{})
   291  	world.RegisterItem(PackedMud{})
   292  	world.RegisterItem(Podzol{})
   293  	world.RegisterItem(PolishedBlackstoneBrick{Cracked: true})
   294  	world.RegisterItem(PolishedBlackstoneBrick{})
   295  	world.RegisterItem(Potato{})
   296  	world.RegisterItem(PumpkinSeeds{})
   297  	world.RegisterItem(Pumpkin{Carved: true})
   298  	world.RegisterItem(Pumpkin{})
   299  	world.RegisterItem(PurpurPillar{})
   300  	world.RegisterItem(Purpur{})
   301  	world.RegisterItem(QuartzBricks{})
   302  	world.RegisterItem(QuartzPillar{})
   303  	world.RegisterItem(Quartz{Smooth: true})
   304  	world.RegisterItem(Quartz{})
   305  	world.RegisterItem(RawCopper{})
   306  	world.RegisterItem(RawGold{})
   307  	world.RegisterItem(RawIron{})
   308  	world.RegisterItem(ReinforcedDeepslate{})
   309  	world.RegisterItem(Sand{Red: true})
   310  	world.RegisterItem(Sand{})
   311  	world.RegisterItem(SeaLantern{})
   312  	world.RegisterItem(SeaPickle{})
   313  	world.RegisterItem(Shroomlight{})
   314  	world.RegisterItem(SmithingTable{})
   315  	world.RegisterItem(Smoker{})
   316  	world.RegisterItem(Snow{})
   317  	world.RegisterItem(SoulSand{})
   318  	world.RegisterItem(SoulSoil{})
   319  	world.RegisterItem(Sponge{Wet: true})
   320  	world.RegisterItem(Sponge{})
   321  	world.RegisterItem(SporeBlossom{})
   322  	world.RegisterItem(Stonecutter{})
   323  	world.RegisterItem(Stone{Smooth: true})
   324  	world.RegisterItem(Stone{})
   325  	world.RegisterItem(SugarCane{})
   326  	world.RegisterItem(TNT{})
   327  	world.RegisterItem(Terracotta{})
   328  	world.RegisterItem(Tuff{})
   329  	world.RegisterItem(WheatSeeds{})
   330  	world.RegisterItem(DecoratedPot{})
   331  	world.RegisterItem(item.Bucket{Content: item.LiquidBucketContent(Lava{})})
   332  	world.RegisterItem(item.Bucket{Content: item.LiquidBucketContent(Water{})})
   333  	world.RegisterItem(item.Bucket{Content: item.MilkBucketContent()})
   334  
   335  	for _, b := range allLight() {
   336  		world.RegisterItem(b.(world.Item))
   337  	}
   338  	for _, c := range allCoral() {
   339  		world.RegisterItem(c.(world.Item))
   340  	}
   341  	for _, c := range allCoralBlocks() {
   342  		world.RegisterItem(c.(world.Item))
   343  	}
   344  	for _, t := range SandstoneTypes() {
   345  		world.RegisterItem(Sandstone{Type: t, Red: true})
   346  		world.RegisterItem(Sandstone{Type: t})
   347  	}
   348  	for _, s := range allStoneBricks() {
   349  		world.RegisterItem(s.(world.Item))
   350  	}
   351  	for _, t := range AnvilTypes() {
   352  		world.RegisterItem(Anvil{Type: t})
   353  	}
   354  	for _, c := range item.Colours() {
   355  		world.RegisterItem(Banner{Colour: c})
   356  		world.RegisterItem(Carpet{Colour: c})
   357  		world.RegisterItem(ConcretePowder{Colour: c})
   358  		world.RegisterItem(Concrete{Colour: c})
   359  		world.RegisterItem(GlazedTerracotta{Colour: c})
   360  		world.RegisterItem(StainedGlassPane{Colour: c})
   361  		world.RegisterItem(StainedGlass{Colour: c})
   362  		world.RegisterItem(StainedTerracotta{Colour: c})
   363  		world.RegisterItem(Wool{Colour: c})
   364  	}
   365  	for _, w := range WoodTypes() {
   366  		if w != WarpedWood() && w != CrimsonWood() {
   367  			world.RegisterItem(Leaves{Wood: w, Persistent: true})
   368  		}
   369  		world.RegisterItem(Log{Wood: w, Stripped: true})
   370  		world.RegisterItem(Log{Wood: w})
   371  		world.RegisterItem(Planks{Wood: w})
   372  		world.RegisterItem(Sign{Wood: w})
   373  		world.RegisterItem(WoodDoor{Wood: w})
   374  		world.RegisterItem(WoodFenceGate{Wood: w})
   375  		world.RegisterItem(WoodFence{Wood: w})
   376  		world.RegisterItem(WoodTrapdoor{Wood: w})
   377  		world.RegisterItem(Wood{Wood: w, Stripped: true})
   378  		world.RegisterItem(Wood{Wood: w})
   379  	}
   380  	for _, ore := range OreTypes() {
   381  		world.RegisterItem(CoalOre{Type: ore})
   382  		world.RegisterItem(CopperOre{Type: ore})
   383  		world.RegisterItem(DiamondOre{Type: ore})
   384  		world.RegisterItem(EmeraldOre{Type: ore})
   385  		world.RegisterItem(GoldOre{Type: ore})
   386  		world.RegisterItem(IronOre{Type: ore})
   387  		world.RegisterItem(LapisOre{Type: ore})
   388  	}
   389  	for _, f := range FireTypes() {
   390  		world.RegisterItem(Lantern{Type: f})
   391  		world.RegisterItem(Torch{Type: f})
   392  	}
   393  	for _, f := range FlowerTypes() {
   394  		world.RegisterItem(Flower{Type: f})
   395  	}
   396  	for _, f := range DoubleFlowerTypes() {
   397  		world.RegisterItem(DoubleFlower{Type: f})
   398  	}
   399  	for _, g := range TallGrassTypes() {
   400  		world.RegisterItem(TallGrass{Type: g})
   401  	}
   402  	for _, g := range DoubleTallGrassTypes() {
   403  		world.RegisterItem(DoubleTallGrass{Type: g})
   404  	}
   405  	for _, p := range PrismarineTypes() {
   406  		world.RegisterItem(Prismarine{Type: p})
   407  	}
   408  	for _, t := range NetherBricksTypes() {
   409  		world.RegisterItem(NetherBricks{Type: t})
   410  	}
   411  	for _, t := range FroglightTypes() {
   412  		world.RegisterItem(Froglight{Type: t})
   413  	}
   414  	for _, s := range SkullTypes() {
   415  		world.RegisterItem(Skull{Type: s})
   416  	}
   417  	for _, t := range SlabBlocks() {
   418  		world.RegisterItem(Slab{Block: t})
   419  	}
   420  	for _, t := range WallBlocks() {
   421  		world.RegisterItem(Wall{Block: t})
   422  	}
   423  	for _, s := range StairsBlocks() {
   424  		world.RegisterItem(Stairs{Block: s})
   425  	}
   426  	for _, t := range BlackstoneTypes() {
   427  		world.RegisterItem(Blackstone{Type: t})
   428  	}
   429  	for _, t := range DeepslateTypes() {
   430  		world.RegisterItem(Deepslate{Type: t})
   431  	}
   432  }
   433  
   434  func registerAll(blocks []world.Block) {
   435  	for _, b := range blocks {
   436  		world.RegisterBlock(b)
   437  	}
   438  }