Skip to content

Commit a8d195b

Browse files
committed
Add the last missing models
1 parent 5fc05da commit a8d195b

21 files changed

Lines changed: 729 additions & 38 deletions

src/Hebbinkpro/PocketMap/PocketMap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class PocketMap extends PluginBase implements Listener
5656
public const RESOURCE_PACK_NAME = "v1.21.50";
5757
public const TEXTURE_SIZE = 16;
5858

59+
/** @var string[] TODO these are entity textures */
5960
public const IGNORED_TEXTURES = [
6061
"piston_arm_collision",
6162
"sticky_piston_arm_collision",
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/*
3+
* _____ _ _ __ __
4+
* | __ \ | | | | | \/ |
5+
* | |__) |__ ___| | _____| |_| \ / | __ _ _ __
6+
* | ___/ _ \ / __| |/ / _ \ __| |\/| |/ _` | '_ \
7+
* | | | (_) | (__| < __/ |_| | | | (_| | |_) |
8+
* |_| \___/ \___|_|\_\___|\__|_| |_|\__,_| .__/
9+
* | |
10+
* |_|
11+
*
12+
* Copyright (c) 2025 Hebbinkpro
13+
*
14+
* This program is free software: you can redistribute it and/or modify
15+
* it under the terms of the GNU General Public License as published by
16+
* the Free Software Foundation, either version 3 of the License, or
17+
* (at your option) any later version.
18+
*/
19+
20+
namespace Hebbinkpro\PocketMap\textures\model;
21+
22+
use Hebbinkpro\PocketMap\textures\model\flat\FlatBlockModel;
23+
use pocketmine\block\AmethystCluster;
24+
use pocketmine\block\Block;
25+
use pocketmine\math\Facing;
26+
use pocketmine\world\format\Chunk;
27+
28+
class AmethystClusterModel extends AnyFacingModel
29+
{
30+
31+
/**
32+
* @inheritDoc
33+
*/
34+
public function getGeometry(Block $block, Chunk $chunk): ?array
35+
{
36+
if (!$block instanceof AmethystCluster) return null;
37+
38+
39+
return match ($block->getFacing()) {
40+
Facing::UP, Facing::DOWN => FlatBlockModel::cross(),
41+
default => self::getDefaultGeometry()
42+
};
43+
}
44+
}

src/Hebbinkpro/PocketMap/textures/model/BlockModel.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ public function getModelTexture(Block $block, Chunk $chunk, GdImage $texture): ?
4242
if ($modelTexture === false) return null;
4343

4444
// when there is no valid geometry, the default geometry should be used.
45-
$geo = $this->getGeometry($block, $chunk);
46-
if ($geo === null) $geo = self::getDefaultGeometry();
45+
$geo = $this->getGeometry($block, $chunk) ?? self::getDefaultGeometry();
4746

4847
foreach ($geo as $parts) {
4948
// new system

src/Hebbinkpro/PocketMap/textures/model/BlockModels.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
use Hebbinkpro\PocketMap\textures\model\flat\BrewingStandModel;
2323
use Hebbinkpro\PocketMap\textures\model\flat\CropsModel;
24+
use Hebbinkpro\PocketMap\textures\model\flat\FireModel;
2425
use Hebbinkpro\PocketMap\textures\model\flat\FlatCrossModel;
2526
use Hebbinkpro\PocketMap\textures\model\flat\FlatHorizontalFacingModel;
2627
use Hebbinkpro\PocketMap\textures\model\flat\ItemFrameModel;
@@ -40,6 +41,7 @@
4041
use pocketmine\block\Fence;
4142
use pocketmine\block\FenceGate;
4243
use pocketmine\block\FloorBanner;
44+
use pocketmine\block\FloorCoralFan;
4345
use pocketmine\block\FloorSign;
4446
use pocketmine\block\Flowable;
4547
use pocketmine\block\Flower;
@@ -99,12 +101,12 @@ private function registerAll(): void
99101
$this->register(VanillaBlocks::LAVA(), new FullBlockModel());
100102
$this->register(VanillaBlocks::BIG_DRIPLEAF_STEM(), new FlatCrossModel());
101103
$this->register(VanillaBlocks::BREWING_STAND(), new FlatCrossModel());
102-
$this->register(VanillaBlocks::AMETHYST_CLUSTER(), new FlatCrossModel());
104+
$this->register(VanillaBlocks::AMETHYST_CLUSTER(), new AmethystClusterModel());
103105
$this->register(VanillaBlocks::PITCHER_CROP(), new FullBlockModel());
104106
$this->register(VanillaBlocks::END_ROD(), new EndRodModel());
105-
$this->register(VanillaBlocks::CHEST(), new FullBlockModel()); // TODO double chests
106-
$this->register(VanillaBlocks::TRAPPED_CHEST(), new FullBlockModel());
107-
$this->register(VanillaBlocks::ENDER_CHEST(), new FullBlockModel());
107+
$this->register(VanillaBlocks::CHEST(), new FullBlockModel()); // TODO use the entity textures
108+
$this->register(VanillaBlocks::TRAPPED_CHEST(), new FullBlockModel()); // TODO use the entity textures
109+
$this->register(VanillaBlocks::ENDER_CHEST(), new FullBlockModel()); // TODO use the entity textures
108110
$this->register(VanillaBlocks::CAKE(), new FullBlockModel());
109111
$this->register(VanillaBlocks::CAKE_WITH_CANDLE(), new FullBlockModel());
110112
$this->register(VanillaBlocks::CAKE_WITH_DYED_CANDLE(), new FullBlockModel());
@@ -123,7 +125,6 @@ private function registerAll(): void
123125
$this->register(VanillaBlocks::REDSTONE_WIRE(), new FullBlockModel());
124126
$this->register(VanillaBlocks::REDSTONE(), new FullBlockModel());
125127
$this->register(VanillaBlocks::TRIPWIRE(), new FullBlockModel());
126-
$this->register(VanillaBlocks::MOB_HEAD(), new FullBlockModel());
127128
$this->register(VanillaBlocks::LADDER(), new FlatHorizontalFacingModel());
128129
$this->register(VanillaBlocks::SNOW_LAYER(), new FullBlockModel());
129130
$this->register(VanillaBlocks::BAMBOO(), new BambooModel());
@@ -134,22 +135,20 @@ private function registerAll(): void
134135
$this->register(VanillaBlocks::DRAGON_EGG(), new CenteredBlockModel(14));
135136
$this->register(VanillaBlocks::NETHER_WART(), new CropsModel());
136137
$this->register(VanillaBlocks::SWEET_BERRY_BUSH(), new FlatCrossModel());
137-
// TODO (Soul) Fire
138-
// TODO (Soul) Lantern
139-
// TODO Lectern
140-
// TODO Nether portal
141-
// TODO Redstone
142-
// TODO Sea Lantern
143-
// TODO Mob Head
144-
// TODO Tripwire
138+
$this->register(VanillaBlocks::FIRE(), new FireModel());
139+
$this->register(VanillaBlocks::SOUL_FIRE(), new FireModel());
140+
$this->register(VanillaBlocks::LANTERN(), new LanternModel());
141+
$this->register(VanillaBlocks::SOUL_LANTERN(), new LanternModel());
142+
$this->register(VanillaBlocks::LECTERN(), new LecternModel());
143+
$this->register(VanillaBlocks::NETHER_PORTAL(), new NetherPortalModel());
144+
$this->register(VanillaBlocks::REDSTONE_WIRE(), new RedstoneModel());
145+
$this->register(VanillaBlocks::MOB_HEAD(), new CenteredBlockModel(8)); // TODO use the entity textures
146+
$this->register(VanillaBlocks::TRIPWIRE(), new NoModel());
145147
// TODO Tripwire Hook
146-
// TODO Floor Coral Fan
147-
// TODO Sculk
148-
// TODO Chain
149-
// TODO Small Dripleaf
150-
// TODO Big Dripleaf
151-
// TODO Spore Blossom
152-
// TODO Chorus Flower
148+
$this->register(VanillaBlocks::CHAIN(), new ChainModel());
149+
$this->register(VanillaBlocks::SMALL_DRIPLEAF(), new SmallDripleafModel());
150+
$this->register(VanillaBlocks::SPORE_BLOSSOM(), new NoModel()); // should be place on the underside of a block
151+
$this->register(VanillaBlocks::CHORUS_FLOWER(), new ChorusFlowerModel());
153152

154153
// register block types
155154
$this->registerClass(Fence::class, new FenceModel());
@@ -175,6 +174,7 @@ private function registerAll(): void
175174
$this->registerClass(Campfire::class, new CampfireModel());
176175
$this->registerClass(Stem::class, new StemModel()); // should be defined before Crops
177176
$this->registerClass(Crops::class, new CropsModel());
177+
$this->registerClass(FloorCoralFan::class, new FloorCoralFanModel());
178178

179179
// register traits
180180
$this->registerTrait(HorizontalFacingTrait::class, new HorizontalFacingModel());
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
/*
3+
* _____ _ _ __ __
4+
* | __ \ | | | | | \/ |
5+
* | |__) |__ ___| | _____| |_| \ / | __ _ _ __
6+
* | ___/ _ \ / __| |/ / _ \ __| |\/| |/ _` | '_ \
7+
* | | | (_) | (__| < __/ |_| | | | (_| | |_) |
8+
* |_| \___/ \___|_|\_\___|\__|_| |_|\__,_| .__/
9+
* | |
10+
* |_|
11+
*
12+
* Copyright (c) 2025 Hebbinkpro
13+
*
14+
* This program is free software: you can redistribute it and/or modify
15+
* it under the terms of the GNU General Public License as published by
16+
* the Free Software Foundation, either version 3 of the License, or
17+
* (at your option) any later version.
18+
*/
19+
20+
namespace Hebbinkpro\PocketMap\textures\model;
21+
22+
use Hebbinkpro\PocketMap\textures\model\flat\FlatBlockModel;
23+
use Hebbinkpro\PocketMap\textures\model\geometry\FlatModelGeometry;
24+
use Hebbinkpro\PocketMap\textures\model\geometry\ModelGeometry;
25+
use Hebbinkpro\PocketMap\textures\model\geometry\TexturePosition;
26+
use pocketmine\block\Block;
27+
use pocketmine\block\Chain;
28+
use pocketmine\math\Axis;
29+
use pocketmine\world\format\Chunk;
30+
31+
class ChainModel extends PillarRotationModel
32+
{
33+
34+
/**
35+
* @inheritDoc
36+
*/
37+
public function getGeometry(Block $block, Chunk $chunk): ?array
38+
{
39+
if (!$block instanceof Chain) return null;
40+
41+
$axis = $block->getAxis();
42+
43+
// use offset and use the geo of 3 pixels
44+
if ($axis === Axis::Y) return FlatBlockModel::cross(6, new FlatModelGeometry(0, 3));
45+
46+
// I hate chains, there width is 3 pixels
47+
return [
48+
new ModelGeometry(
49+
TexturePosition::zero(),
50+
new TexturePosition(3, 16),
51+
new TexturePosition(7, 0),
52+
new TexturePosition(2, 16)
53+
)
54+
];
55+
}
56+
57+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
/*
3+
* _____ _ _ __ __
4+
* | __ \ | | | | | \/ |
5+
* | |__) |__ ___| | _____| |_| \ / | __ _ _ __
6+
* | ___/ _ \ / __| |/ / _ \ __| |\/| |/ _` | '_ \
7+
* | | | (_) | (__| < __/ |_| | | | (_| | |_) |
8+
* |_| \___/ \___|_|\_\___|\__|_| |_|\__,_| .__/
9+
* | |
10+
* |_|
11+
*
12+
* Copyright (c) 2025 Hebbinkpro
13+
*
14+
* This program is free software: you can redistribute it and/or modify
15+
* it under the terms of the GNU General Public License as published by
16+
* the Free Software Foundation, either version 3 of the License, or
17+
* (at your option) any later version.
18+
*/
19+
20+
namespace Hebbinkpro\PocketMap\textures\model;
21+
22+
use Hebbinkpro\PocketMap\textures\model\geometry\ModelGeometry;
23+
use Hebbinkpro\PocketMap\textures\model\geometry\TexturePosition;
24+
use pocketmine\block\Block;
25+
use pocketmine\world\format\Chunk;
26+
27+
class ChorusFlowerModel extends BlockModel
28+
{
29+
30+
/**
31+
* @inheritDoc
32+
*/
33+
public function getGeometry(Block $block, Chunk $chunk): ?array
34+
{
35+
$center =
36+
$side = new ModelGeometry(
37+
srcStart: new TexturePosition(2, 0),
38+
srcSize: new TexturePosition(12, 2)
39+
);
40+
41+
return [
42+
ModelGeometry::fromCenter(12),
43+
new ModelGeometry(
44+
srcStart: new TexturePosition(2, 0),
45+
srcSize: new TexturePosition(12, 2)
46+
),
47+
new ModelGeometry(
48+
srcStart: new TexturePosition(2, 14),
49+
srcSize: new TexturePosition(12, 2)
50+
),
51+
new ModelGeometry(
52+
srcStart: new TexturePosition(0, 2),
53+
srcSize: new TexturePosition(2, 12)
54+
),
55+
new ModelGeometry(
56+
srcStart: new TexturePosition(14, 2),
57+
srcSize: new TexturePosition(2, 12)
58+
)
59+
];
60+
}
61+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/*
3+
* _____ _ _ __ __
4+
* | __ \ | | | | | \/ |
5+
* | |__) |__ ___| | _____| |_| \ / | __ _ _ __
6+
* | ___/ _ \ / __| |/ / _ \ __| |\/| |/ _` | '_ \
7+
* | | | (_) | (__| < __/ |_| | | | (_| | |_) |
8+
* |_| \___/ \___|_|\_\___|\__|_| |_|\__,_| .__/
9+
* | |
10+
* |_|
11+
*
12+
* Copyright (c) 2025 Hebbinkpro
13+
*
14+
* This program is free software: you can redistribute it and/or modify
15+
* it under the terms of the GNU General Public License as published by
16+
* the Free Software Foundation, either version 3 of the License, or
17+
* (at your option) any later version.
18+
*/
19+
20+
namespace Hebbinkpro\PocketMap\textures\model;
21+
22+
use Hebbinkpro\PocketMap\textures\model\geometry\ModelGeometry;
23+
use Hebbinkpro\PocketMap\textures\model\geometry\TexturePosition;
24+
use pocketmine\block\Block;
25+
use pocketmine\world\format\Chunk;
26+
27+
class FloorCoralFanModel extends BlockModel
28+
{
29+
30+
/**
31+
* @inheritDoc
32+
*/
33+
public function getGeometry(Block $block, Chunk $chunk): ?array
34+
{
35+
$geo = new ModelGeometry(
36+
dstStart: TexturePosition::zero(),
37+
dstSize: new TexturePosition(16, 8)
38+
);
39+
40+
return [
41+
$geo,
42+
$geo->set(rotation: 90),
43+
$geo->set(rotation: 180),
44+
$geo->set(rotation: 270),
45+
];
46+
}
47+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/*
3+
* _____ _ _ __ __
4+
* | __ \ | | | | | \/ |
5+
* | |__) |__ ___| | _____| |_| \ / | __ _ _ __
6+
* | ___/ _ \ / __| |/ / _ \ __| |\/| |/ _` | '_ \
7+
* | | | (_) | (__| < __/ |_| | | | (_| | |_) |
8+
* |_| \___/ \___|_|\_\___|\__|_| |_|\__,_| .__/
9+
* | |
10+
* |_|
11+
*
12+
* Copyright (c) 2025 Hebbinkpro
13+
*
14+
* This program is free software: you can redistribute it and/or modify
15+
* it under the terms of the GNU General Public License as published by
16+
* the Free Software Foundation, either version 3 of the License, or
17+
* (at your option) any later version.
18+
*/
19+
20+
namespace Hebbinkpro\PocketMap\textures\model;
21+
22+
use Hebbinkpro\PocketMap\textures\model\geometry\ModelGeometry;
23+
use Hebbinkpro\PocketMap\textures\model\geometry\TexturePosition;
24+
use pocketmine\block\Block;
25+
use pocketmine\world\format\Chunk;
26+
27+
class LanternModel extends BlockModel
28+
{
29+
30+
/**
31+
* @inheritDoc
32+
*/
33+
public function getGeometry(Block $block, Chunk $chunk): ?array
34+
{
35+
// the chain on top is ignored since it only covers 2 pixels
36+
return [
37+
new ModelGeometry(
38+
new TexturePosition(0, 9),
39+
TexturePosition::xy(6),
40+
TexturePosition::xy(5)
41+
)
42+
];
43+
}
44+
}

0 commit comments

Comments
 (0)