diff --git a/doc/changelog.html b/doc/changelog.html index 45af542..c50a294 100644 --- a/doc/changelog.html +++ b/doc/changelog.html @@ -23,11 +23,5 @@

JourneyMap ${version} for Minecraft ${mcversion}

New in ${version}

diff --git a/src/main/java/journeymap/client/model/mod/BiomesOPlenty.java b/src/main/java/journeymap/client/model/mod/BiomesOPlenty.java new file mode 100644 index 0000000..52232cd --- /dev/null +++ b/src/main/java/journeymap/client/model/mod/BiomesOPlenty.java @@ -0,0 +1,87 @@ +/* + * JourneyMap Mod for Minecraft + * Copyright (c) 2011-2018 Techbrew Interactive, LLC . All Rights Reserved. + */ + +package journeymap.client.model.mod; + +import journeymap.client.cartography.RGB; +import journeymap.client.model.BlockMD; +import journeymap.client.model.ChunkMD; +import journeymap.client.model.mod.vanilla.VanillaColorHandler; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import static journeymap.client.model.BlockMD.Flag.Crop; +import static journeymap.client.model.BlockMD.Flag.Plant; + +/** + * Special handling required to flag BoP plants and crops. + */ +public class BiomesOPlenty implements ModBlockDelegate.IModBlockHandler +{ + private List plants = Arrays.asList("duckweed", "shortgrass", "mediumgrass", "flaxbottom", "bush", "sprout", "flaxtop", "poisonivy", "berrybush", "shrub", "wheatgrass", "dampgrass", "koru", "cloverpatch", "leafpile", "deadleafpile", "spectralmoss", "smolderinggrass", "origingrass3", "longgrass", "loamy", "sandy", "silty", "flower", "mushroom", "sapling", "plant", "ivy", "waterlily", "moss", "deadgrass", "desertgrass", "desertsprouts", "dunegrass", "spectralfern", "thorn", "wildrice", "cattail", "rivercane", "cattailtop", "cattailbottom", "wildcarrot", "cactus", "witherwart", "reed", "root"); + private List crops = Collections.singletonList("turnip"); + private BoPGrassColorHandler handler = new BoPGrassColorHandler(); + + public BiomesOPlenty() + { + } + + @Override + public boolean initialize(BlockMD blockMD) + { + + boolean initialized = false; + if (blockMD.getUid().modId.equalsIgnoreCase("BiomesOPlenty")) + { + String name = blockMD.getUid().name.toLowerCase(); +// if (name.contains("grass")) +// { +// initialized = true; +// blockMD.addFlags(Grass); +// blockMD.setModBlockHandler(this); +// blockMD.setTextureSide(2); +// } + + for (String plant : plants) + { + if (name.contains(plant)) + { + blockMD.addFlags(Plant); + initialized = true; + break; + } + } + + for (String crop : crops) + { + if (name.contains(crop)) + { + blockMD.addFlags(Crop); + initialized = true; + break; + } + } + } + return initialized; + } + + @Override + public BlockMD handleBlock(ChunkMD chunkMD, BlockMD blockMD, int localX, int y, int localZ) + { + return blockMD; + } + + public static class BoPGrassColorHandler extends VanillaColorHandler + { + @Override + protected Integer loadTextureColor(BlockMD blockMD, int globalX, int y, int globalZ) + { + System.out.println("Loading Tex Color: " + blockMD); + return RGB.RED_RGB; + } + } +} diff --git a/src/main/java/journeymap/client/model/mod/ModBlockDelegate.java b/src/main/java/journeymap/client/model/mod/ModBlockDelegate.java index e5a5f78..a435b6e 100644 --- a/src/main/java/journeymap/client/model/mod/ModBlockDelegate.java +++ b/src/main/java/journeymap/client/model/mod/ModBlockDelegate.java @@ -33,7 +33,8 @@ public ModBlockDelegate() new VanillaBlockHandler(), new CarpentersBlocks.CommonHandler(), new TerraFirmaCraft.TfcBlockHandler(), - new Miscellaneous.CommonHandler()); + new Miscellaneous.CommonHandler(), + new BiomesOPlenty()); } /** @@ -129,8 +130,8 @@ public interface IModBlockHandler */ public interface IModBlockColorHandler { - public Integer getBlockColor(ChunkMD chunkMD, BlockMD blockMD, int globalX, int y, int globalZ); + Integer getBlockColor(ChunkMD chunkMD, BlockMD blockMD, int globalX, int y, int globalZ); - public Integer getTextureColor(BlockMD blockMD); + Integer getTextureColor(BlockMD blockMD); } } diff --git a/src/main/java/journeymap/client/model/mod/TerraFirmaCraft.java b/src/main/java/journeymap/client/model/mod/TerraFirmaCraft.java index e8b1de8..81625dc 100644 --- a/src/main/java/journeymap/client/model/mod/TerraFirmaCraft.java +++ b/src/main/java/journeymap/client/model/mod/TerraFirmaCraft.java @@ -60,9 +60,10 @@ else if (name.contains("leaves")) { blockMD.addFlags(NoTopo, Foliage); } + return true; } - return true; + return false; } @Override