mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-29 22:28:34 +01:00
Compare commits
No commits in common. "4c29b7a3808c71110e5ca5fe2b7baa538ab53fc1" and "945f71ae3029b99c11ac85bc927fdcaeb33e0c42" have entirely different histories.
4c29b7a380
...
945f71ae30
4 changed files with 17 additions and 26 deletions
|
@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
|
|||
apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
version = '37.5'
|
||||
version = '37.4'
|
||||
group = 'de.ellpeck.naturesaura' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = 'NaturesAura'
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
|
|||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
var drops = super.getDrops(state, builder);
|
||||
|
||||
var tile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY);
|
||||
var tile = builder.getParameter(LootContextParams.BLOCK_ENTITY);
|
||||
if (tile instanceof BlockEntityImpl) {
|
||||
for (var stack : drops) {
|
||||
if (stack.getItem() != this.asItem())
|
||||
|
|
|
@ -105,8 +105,8 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICustomBlockS
|
|||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
var tile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY);
|
||||
if (tile instanceof BlockEntityEndFlower f && f.isDrainMode)
|
||||
var tile = builder.getParameter(LootContextParams.BLOCK_ENTITY);
|
||||
if (tile instanceof BlockEntityEndFlower && ((BlockEntityEndFlower) tile).isDrainMode)
|
||||
return NonNullList.create();
|
||||
return super.getDrops(state, builder);
|
||||
}
|
||||
|
|
|
@ -8,12 +8,9 @@ import de.ellpeck.naturesaura.blocks.tiles.BlockEntityOakGenerator;
|
|||
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
||||
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.data.worldgen.features.TreeFeatures;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.SaplingBlock;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -37,13 +34,21 @@ public class BlockOakGenerator extends BlockContainerImpl implements IVisualizab
|
|||
if (level instanceof Level && !level.isClientSide() && IAuraType.forLevel((Level) level).isSimilar(NaturesAuraAPI.TYPE_OVERWORLD)
|
||||
&& level.getBlockState(pos).getBlock() instanceof SaplingBlock) {
|
||||
Helper.getBlockEntitiesInArea(level, pos, 10, tile -> {
|
||||
if (!(tile instanceof BlockEntityOakGenerator oak))
|
||||
if (!(tile instanceof BlockEntityOakGenerator))
|
||||
return false;
|
||||
var replacement = BlockOakGenerator.getReplacement(event.getFeature());
|
||||
if (replacement != null) {
|
||||
oak.scheduledBigTrees.add(pos);
|
||||
event.setFeature(replacement);
|
||||
|
||||
var rand = event.getRandomSource();
|
||||
if (rand.nextInt(10) == 0)
|
||||
((BlockEntityOakGenerator) tile).scheduledBigTrees.add(pos);
|
||||
|
||||
long seed;
|
||||
do {
|
||||
seed = rand.nextLong();
|
||||
rand.setSeed(seed);
|
||||
}
|
||||
while (rand.nextInt(10) == 0);
|
||||
rand.setSeed(seed);
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
@ -68,18 +73,4 @@ public class BlockOakGenerator extends BlockContainerImpl implements IVisualizab
|
|||
generator.modLoc("block/" + this.getBaseName() + "_bottom"),
|
||||
generator.modLoc("block/" + this.getBaseName() + "_top")));
|
||||
}
|
||||
|
||||
private static Holder<? extends ConfiguredFeature<?, ?>> getReplacement(Holder<? extends ConfiguredFeature<?, ?>> feature) {
|
||||
if (feature == TreeFeatures.FANCY_OAK || feature == TreeFeatures.FANCY_OAK_BEES) {
|
||||
return TreeFeatures.OAK;
|
||||
} else if (feature == TreeFeatures.FANCY_OAK_BEES_002) {
|
||||
return TreeFeatures.OAK_BEES_002;
|
||||
} else if (feature == TreeFeatures.FANCY_OAK_BEES_0002) {
|
||||
return TreeFeatures.OAK_BEES_0002;
|
||||
} else if (feature == TreeFeatures.FANCY_OAK_BEES_005) {
|
||||
return TreeFeatures.OAK_BEES_005;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue