Skip to content

Commit

Permalink
fix the tfc spam and added bop handler
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticdrew committed Mar 14, 2024
1 parent b226e66 commit 39cc225
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 11 deletions.
8 changes: 1 addition & 7 deletions doc/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,5 @@ <h1>JourneyMap ${version} for Minecraft ${mcversion}</h1>

<p>New in ${version}</p>
<ul>
<li>Fixed: scrollwheel calculation for lwjgl3</li>
<li>Fixed: unbound key errors</li>
<li>Fixed: Windows data path tokens if they are invalid</li>
<li>Fixed: Update checker urls</li>
<li>Fixed: Zip resource extraction.</li>
<li>Fixed: Player and World dimension id miss match prevents mapping.</li>
<li>Updated: back ported the 1.12.2 version of the webmap.</li>
<li>Fixed: bop plants showing up as wrong color.</li>
</ul>
87 changes: 87 additions & 0 deletions src/main/java/journeymap/client/model/mod/BiomesOPlenty.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* JourneyMap Mod <journeymap.info> for Minecraft
* Copyright (c) 2011-2018 Techbrew Interactive, LLC <techbrew.net>. 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<String> 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<String> 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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public ModBlockDelegate()
new VanillaBlockHandler(),
new CarpentersBlocks.CommonHandler(),
new TerraFirmaCraft.TfcBlockHandler(),
new Miscellaneous.CommonHandler());
new Miscellaneous.CommonHandler(),
new BiomesOPlenty());
}

/**
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ else if (name.contains("leaves"))
{
blockMD.addFlags(NoTopo, Foliage);
}
return true;
}

return true;
return false;
}

@Override
Expand Down

0 comments on commit 39cc225

Please sign in to comment.