Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
supermassimo committed Jun 24, 2021
1 parent 984280c commit a6cafa1
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 46 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ dependencies {

// Compile Dynamic Trees, of course.
//implementation fg.deobf("com.ferreusveritas.dynamictrees:DynamicTrees-${config.mc_version}:${config.dynamic_trees_version}")
implementation fg.deobf("blank:DynamicTrees-1.16.5:0.10.0-Beta16.2")
implementation fg.deobf("blank:DynamicTrees-1.16.5:0.10.0-Beta17")
// Compile Dynamic Trees Plus
runtimeOnly fg.deobf("com.ferreusveritas.dynamictreesplus:DynamicTreesPlus-${config.mc_version}:${config.dynamic_trees_plus_version}")

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mod_name=DynamicTreesBOP
mod_version=2.0.2
mod_version=2.0.4
package_group=therealeststu.dtbop

mc_version=1.16.5
Expand Down
25 changes: 11 additions & 14 deletions src/main/java/therealeststu/dtbop/DynamicTreesBOP.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package therealeststu.dtbop;

import com.ferreusveritas.dynamictrees.DynamicTrees;
import com.ferreusveritas.dynamictrees.api.registry.RegistryHandler;
import com.ferreusveritas.dynamictrees.data.provider.DTBlockTagsProvider;
import com.ferreusveritas.dynamictrees.data.provider.DTItemTagsProvider;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.data.BlockTagsProvider;
import net.minecraft.data.ItemTagsProvider;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.common.Mod;
Expand All @@ -24,7 +27,7 @@ public class DynamicTreesBOP
public DynamicTreesBOP() {
final IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
modEventBus.addListener(this::commonSetup);
modEventBus.addListener(this::clientSetup);
// modEventBus.addListener(this::clientSetup);
modEventBus.addListener(this::gatherData);

MinecraftForge.EVENT_BUS.register(this);
Expand All @@ -35,21 +38,15 @@ public DynamicTreesBOP() {
private void commonSetup(final FMLCommonSetupEvent event) {
}

private void clientSetup(final FMLClientSetupEvent event) {
final BlockColors blockColors = Minecraft.getInstance().getBlockColors();

blockColors.register((state, world, pos, tintIndex) -> DTBOPRegistries.largeRootyWater.colorMultiplier(blockColors, state, world, pos, tintIndex), DTBOPRegistries.largeRootyWater);
}
// @OnlyIn(Dist.CLIENT)
// private void clientSetup(final FMLClientSetupEvent event) {
// final BlockColors blockColors = Minecraft.getInstance().getBlockColors();
//
// blockColors.register((state, world, pos, tintIndex) -> DTBOPRegistries.largeRootyWater.colorMultiplier(blockColors, state, world, pos, tintIndex), DTBOPRegistries.largeRootyWater);
// }

public void gatherData(final GatherDataEvent event) {
gatherTagGenerators(MOD_ID, event);
}
public static void gatherTagGenerators(final String modId, final GatherDataEvent event) {
final BlockTagsProvider blockTagsProvider = new DTBlockTagsProvider(event.getGenerator(), modId, event.getExistingFileHelper());
final ItemTagsProvider itemTagsProvider = new DTItemTagsProvider(event.getGenerator(), MOD_ID, blockTagsProvider, event.getExistingFileHelper());

event.getGenerator().addProvider(blockTagsProvider);
event.getGenerator().addProvider(itemTagsProvider);
DynamicTrees.gatherTagGenerators(MOD_ID, event);
}

}
50 changes: 25 additions & 25 deletions src/main/java/therealeststu/dtbop/trees/CypressSpecies.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ public boolean isAcceptableSoilForWorldgen(IWorld world, BlockPos pos, BlockStat
return isAcceptableSoil;
}

@Override
public boolean placeRootyDirtBlock(IWorld world, BlockPos rootPos, int fertility) {
if (this.isWater(world.getBlockState(rootPos)))
return world.setBlock(rootPos, (DTBOPRegistries.largeRootyWater.defaultBlockState().setValue(RootyBlock.FERTILITY, fertility)).setValue(RootyBlock.IS_VARIANT, this.doesRequireTileEntity(world, rootPos)), 3);
else
return super.placeRootyDirtBlock(world, rootPos, fertility);
}

@Override
public BlockPos preGeneration(IWorld world, BlockPos rootPosition, int radius, Direction facing, SafeChunkBounds safeBounds, JoCode joCode) {
BlockPos root = rootPosition;
Expand All @@ -81,22 +73,30 @@ public BlockPos preGeneration(IWorld world, BlockPos rootPosition, int radius, D
return super.preGeneration(world, root, radius, facing, safeBounds, joCode);
}

@Override
public boolean postGrow(World world, BlockPos rootPos, BlockPos treePos, int fertility, boolean natural) {
if (world.getBlockState(rootPos).getBlock() == RootyBlockHelper.getRootyBlock(Blocks.WATER)){
if (TreeHelper.isBranch(world.getBlockState(rootPos.above()))){
int radius = TreeHelper.getRadius(world, rootPos.above());
if (radius >= 8){
TileEntity rootTE = world.getBlockEntity(rootPos);
world.setBlockAndUpdate(rootPos, DTBOPRegistries.largeRootyWater.defaultBlockState()
.setValue(RootyBlock.FERTILITY, fertility)
.setValue(RootyBlock.IS_VARIANT, world.getBlockState(rootPos).getValue(RootyBlock.IS_VARIANT)));
if (rootTE != null)
world.setBlockEntity(rootPos, rootTE);
}
}
}
return super.postGrow(world, rootPos, treePos, fertility, natural);
}
// @Override
// public boolean placeRootyDirtBlock(IWorld world, BlockPos rootPos, int fertility) {
// if (this.isWater(world.getBlockState(rootPos)))
// return world.setBlock(rootPos, (DTBOPRegistries.largeRootyWater.defaultBlockState().setValue(RootyBlock.FERTILITY, fertility)).setValue(RootyBlock.IS_VARIANT, this.doesRequireTileEntity(world, rootPos)), 3);
// else
// return super.placeRootyDirtBlock(world, rootPos, fertility);
// }

// @Override
// public boolean postGrow(World world, BlockPos rootPos, BlockPos treePos, int fertility, boolean natural) {
// if (world.getBlockState(rootPos).getBlock() == RootyBlockHelper.getRootyBlock(Blocks.WATER)){
// if (TreeHelper.isBranch(world.getBlockState(rootPos.above()))){
// int radius = TreeHelper.getRadius(world, rootPos.above());
// if (radius >= 8){
// TileEntity rootTE = world.getBlockEntity(rootPos);
// world.setBlockAndUpdate(rootPos, DTBOPRegistries.largeRootyWater.defaultBlockState()
// .setValue(RootyBlock.FERTILITY, fertility)
// .setValue(RootyBlock.IS_VARIANT, world.getBlockState(rootPos).getValue(RootyBlock.IS_VARIANT)));
// if (rootTE != null)
// world.setBlockEntity(rootPos, rootTE);
// }
// }
// }
// return super.postGrow(world, rootPos, treePos, fertility, natural);
// }

}
13 changes: 10 additions & 3 deletions src/main/resources/trees/dtbop/world_gen/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,16 @@
{
"select": { "name": "biomesoplenty:rainbow_hills" },
"apply": {
"species" : "dtbop:rainbow_birch",
"density": 1.0,
"chance": 0.9
"species" : {
"random" : {
"dtbop:rainbow_birch" : 6,
"dtbop:fir" : 3,
"dtbop:oak_bush" : 1
}
},
"density": 0.5,
"chance": 0.8,
"forestness" : 1.0
}
},
{
Expand Down
7 changes: 5 additions & 2 deletions version_info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"homepage": "https://www.curseforge.com/minecraft/mc-mods/dtbop/files",
"1.16.2": {
"1.16.5-2.0.4": "Bug Fixes:\n- Fixed rainbow hills having no fir trees",
"1.16.5-2.0.3": "Bug Fixes:\n- Fixed crash on servers",
"1.16.5-2.0.2": "Enhancements:\n- Adjusted default densities for woodland and seasonal forest biomes\n- Added short jungle tree in rainforest biomes\nBug Fixes:\n- Fixed rainbow hills having no trees at all\n- Fixed default weights and trees for snowy coniferous forest and snowy maple forest",
"1.16.5-2.0.1": "Bug Fixes:\n- Fixed model loading and tag warnings",
"1.16.5-2.0.0": "New Features:\n+ Updated to work with Minecraft 1.16.5\n- Updated to include the trees and biomes that Biomes o' Plenty has in 1.16.5"
},
Expand All @@ -10,8 +13,8 @@
"1.12.2-1.4.4": "New Features:\n-Mangrove world generation\n-Improvements to mangrove and rooty water block model"
},
"promos": {
"1.16.5-latest": "1.16.5-2.0.1",
"1.16.5-recommended": "1.16.5-2.0.1",
"1.16.5-latest": "1.16.5-2.0.4",
"1.16.5-recommended": "1.16.5-2.0.4",
"1.12.2-latest": "1.12.2-1.5.1",
"1.12.2-recommended": "1.12.2-1.5.1"
}
Expand Down

0 comments on commit a6cafa1

Please sign in to comment.