Skip to content

Commit 54bfb42

Browse files
committed
Add support for sweet berry bush, cornflower, lily of the valley, wither rose and bamboo saplings.
1 parent 2ceb3fb commit 54bfb42

File tree

4 files changed

+57
-8
lines changed

4 files changed

+57
-8
lines changed

chunky/src/java/se/llbit/chunky/block/BlockSpec.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,11 @@ private Block blockFromTag(String name) {
320320
case "oxeye_daisy":
321321
return new SpriteBlock(name, Texture.oxeyeDaisy);
322322
case "cornflower":
323-
return new UnknownBlock(name);
323+
return new SpriteBlock(name, Texture.cornflower);
324324
case "lily_of_the_valley":
325-
return new UnknownBlock(name);
325+
return new SpriteBlock(name, Texture.lilyOfTheValley);
326326
case "wither_rose":
327-
return new UnknownBlock(name);
327+
return new SpriteBlock(name, Texture.witherRose);
328328
case "brown_mushroom":
329329
return new SpriteBlock(name, Texture.brownMushroom);
330330
case "red_mushroom":
@@ -1250,8 +1250,7 @@ private Block blockFromTag(String name) {
12501250
// TODO
12511251
return new UnknownBlock(name);
12521252
case "bamboo_sapling":
1253-
// TODO
1254-
return new UnknownBlock(name);
1253+
return new SpriteBlock(name, Texture.bambooSapling);
12551254
case "cake": {
12561255
int bites = stringToInt(tag.get("Properties").get("bites"), 0);
12571256
return new Cake(bites);
@@ -1497,9 +1496,10 @@ private Block blockFromTag(String name) {
14971496
case "lantern":
14981497
// TODO
14991498
return new UnknownBlock(name);
1500-
case "sweet_berry_bush":
1501-
// TODO
1502-
return new UnknownBlock(name);
1499+
case "sweet_berry_bush": {
1500+
int age = stringToInt(tag.get("Properties").get("age"), 3);
1501+
return new SweetBerryBush(age);
1502+
}
15031503
case "campfire":
15041504
// TODO
15051505
return new UnknownBlock(name);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package se.llbit.chunky.block;
2+
3+
import se.llbit.chunky.resources.Texture;
4+
5+
public class SweetBerryBush extends SpriteBlock {
6+
public SweetBerryBush(int age) {
7+
super("sweet_berry_bush", getTextureByAge(age));
8+
}
9+
10+
protected static Texture getTextureByAge(int age) {
11+
switch (age) {
12+
case 0:
13+
return Texture.sweetBerryBushStage0;
14+
case 1:
15+
return Texture.sweetBerryBushStage1;
16+
case 2:
17+
return Texture.sweetBerryBushStage2;
18+
case 3:
19+
default:
20+
return Texture.sweetBerryBushStage3;
21+
}
22+
}
23+
}

chunky/src/java/se/llbit/chunky/resources/Texture.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,14 @@ public class Texture {
749749
public static final Texture smokerBottom = new Texture();
750750
public static final Texture smokerFrontOn = new Texture();
751751
public static final Texture smokerFront = new Texture();
752+
public static final Texture sweetBerryBushStage0 = new Texture();
753+
public static final Texture sweetBerryBushStage1 = new Texture();
754+
public static final Texture sweetBerryBushStage2 = new Texture();
755+
public static final Texture sweetBerryBushStage3 = new Texture();
756+
public static final Texture cornflower = new Texture();
757+
public static final Texture lilyOfTheValley = new Texture();
758+
public static final Texture witherRose = new Texture();
759+
public static final Texture bambooSapling = new Texture();
752760

753761
/** Banner base texture. */
754762
public static final Texture bannerBase = new Texture();

chunky/src/java/se/llbit/chunky/resources/TexturePackLoader.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3314,6 +3314,24 @@ public class TexturePackLoader {
33143314
new SimpleTexture("assets/minecraft/textures/block/smoker_front_on",
33153315
Texture.smokerFrontOn));
33163316

3317+
addSimpleTexture("assets/minecraft/textures/block/sweet_berry_bush_stage0", Texture.sweetBerryBushStage0);
3318+
addSimpleTexture("assets/minecraft/textures/block/sweet_berry_bush_stage1", Texture.sweetBerryBushStage1);
3319+
addSimpleTexture("assets/minecraft/textures/block/sweet_berry_bush_stage2", Texture.sweetBerryBushStage2);
3320+
addSimpleTexture("assets/minecraft/textures/block/sweet_berry_bush_stage3", Texture.sweetBerryBushStage3);
3321+
3322+
addSimpleTexture("assets/minecraft/textures/block/cornflower", Texture.cornflower);
3323+
addSimpleTexture("assets/minecraft/textures/block/lily_of_the_valley", Texture.lilyOfTheValley);
3324+
addSimpleTexture("assets/minecraft/textures/block/wither_rose", Texture.witherRose);
3325+
addSimpleTexture("assets/minecraft/textures/block/bamboo_stage0", Texture.bambooSapling);
3326+
}
3327+
3328+
private static void addSimpleTexture(String file, Texture texture) {
3329+
String[] path = file.split("/");
3330+
addSimpleTexture(path[path.length - 1], file, texture);
3331+
}
3332+
3333+
private static void addSimpleTexture(String name, String file, Texture texture) {
3334+
allTextures.put(name, new SimpleTexture(file, texture));
33173335
}
33183336

33193337
private static String[] texturePacks = { };

0 commit comments

Comments
 (0)