diff --git a/examples/config/cyclic.toml b/examples/config/cyclic.toml index d05d35945..4eedae6c9 100644 --- a/examples/config/cyclic.toml +++ b/examples/config/cyclic.toml @@ -77,15 +77,6 @@ # Allows the dimensional Transfer Nodes to cross dimensions (no chunk loading is done, you have to do that on your own); This affects blocks cyclic:wireless_energy, cyclic:wireless_item, cyclic:wireless_fluid, cyclic:wireless_transmitter; If you change it to false it will only work if the target is in the same dimension. wireless_transfer_dimensional = true - #Ender shelf settings - [cyclic.blocks.ender_shelf] - #Controller Max distance to search (using manhattan distance) - #Range: 1 ~ 256 - controller_distance = 64 - #Each shelf has five rows. Set the number of books stored per row here - #Range: 1 ~ 64 - books_per_row = 64 - #Ender Anchor settings [cyclic.blocks.eye_teleport] #Maximum distance to activate @@ -101,6 +92,45 @@ #Range: 1 ~ 20 frequency = 5 + #Ender shelf settings + [cyclic.blocks.sound] + #Sound Recorder - how far out does it listen to record sounds + #Range: 1 ~ 64 + radius = 8 + + #battery settings + [cyclic.blocks.battery] + #RF/t charging rate for the battery item slot + #Range: 1 ~ 6400000 + charge = 8000 + + #fisher settings + [cyclic.blocks.fisher] + #Chance to Fish from nearby water. Smaller values is slower fish + #Range: 1.0E-5 ~ 0.999 + chance = 0.1 + #Radius to Fish from nearby water + #Range: 1 ~ 32 + radius = 12 + + #Ender shelf settings + [cyclic.blocks.ender_shelf] + #Controller Max distance to search (using manhattan distance) + #Range: 1 ~ 256 + controller_distance = 64 + #Each shelf has five rows. Set the number of books stored per row here + #Range: 1 ~ 64 + books_per_row = 64 + + #terra_preta settings + [cyclic.blocks.terra_preta] + #ticks between growth cycles + #Range: 1 ~ 10000 + timer = 100 + #growth height above the soil + #Range: 2 ~ 32 + height = 8 + #Uncrafter settings [cyclic.blocks.uncrafter] #False will mean you cannot uncraft damaged repairable items. When searching for a recipe, does it ignore all NBT values (such as enchantments, RepairCost, Damage, etc). For example, if false it will not uncraft damaged or enchanted items @@ -113,12 +143,6 @@ #RECIPE IDS HERE. Block these recipe ids from being reversed, but do not block all recipes for this output item ignore_recipes = ["botania:cobweb", "minecraft:magma_cream", "minecraft:beacon", "minecraft:stick_from_bamboo_item", "minecraft:netherite_ingot_from_netherite_block", "mysticalagriculture:essence*", "mysticalagriculture:farmland_till", "refinedstorage:coloring_recipes*", "forcecraft:transmutation*"] - #Ender shelf settings - [cyclic.blocks.sound] - #Sound Recorder - how far out does it listen to record sounds - #Range: 1 ~ 64 - radius = 8 - #Ender Trigger settings [cyclic.blocks.eye_redstone] #Maximum distance to activate @@ -128,12 +152,6 @@ #Range: 1 ~ 20 frequency = 5 - #battery settings - [cyclic.blocks.battery] - #RF/t charging rate for the battery item slot - #Range: 1 ~ 6400000 - charge = 8000 - #Sprinkler settings [cyclic.blocks.sprinkler] #Tick rate. 20 will fire one block per second @@ -146,21 +164,21 @@ #Range: 0 ~ 1000 water = 5 + #terra_glass settings + [cyclic.blocks.terra_glass] + #ticks between growth cycles + #Range: 1 ~ 10000 + timer = 100 + #growth height below the glass + #Range: 0 ~ 32 + height = 8 + #experience_pylon settings [cyclic.blocks.experience_pylon] #Radius to pickup xp orbs #Range: 1 ~ 64 radius = 16 - #fisher settings - [cyclic.blocks.fisher] - #Chance to Fish from nearby water. Smaller values is slower fish - #Range: 1.0E-5 ~ 0.999 - chance = 0.1 - #Radius to Fish from nearby water - #Range: 1 ~ 32 - radius = 12 - #soundproofing settings [cyclic.blocks.soundproofing] #Radius of sound proofing (distance from each block that it will listen) @@ -172,7 +190,7 @@ ##################################################################################### [cyclic.logging] #Unblock info logs; very spammy; can be useful for testing certain issues - info = false + info = true ##################################################################################### #Fluid cost for various machines diff --git a/src/main/java/com/lothrazar/cyclic/block/apple/AppleCropBlock.java b/src/main/java/com/lothrazar/cyclic/block/apple/AppleCropBlock.java index 909460cfd..6c6c8b381 100644 --- a/src/main/java/com/lothrazar/cyclic/block/apple/AppleCropBlock.java +++ b/src/main/java/com/lothrazar/cyclic/block/apple/AppleCropBlock.java @@ -78,7 +78,7 @@ public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos public void randomTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) { int age = state.get(AGE); if (age < MAX_AGE && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(worldIn, pos, state, worldIn.rand.nextInt(5) == 0)) { - worldIn.setBlockState(pos, state.with(AGE, Integer.valueOf(age + 1)), 2); + this.grow(worldIn, random, pos, state); ForgeHooks.onCropsGrowPost(worldIn, pos, state); } } diff --git a/src/main/java/com/lothrazar/cyclic/block/sprinkler/TileSprinkler.java b/src/main/java/com/lothrazar/cyclic/block/sprinkler/TileSprinkler.java index 28d4383d5..88d524661 100644 --- a/src/main/java/com/lothrazar/cyclic/block/sprinkler/TileSprinkler.java +++ b/src/main/java/com/lothrazar/cyclic/block/sprinkler/TileSprinkler.java @@ -2,8 +2,8 @@ import com.lothrazar.cyclic.base.FluidTankBase; import com.lothrazar.cyclic.base.TileEntityBase; -import com.lothrazar.cyclic.block.terrasoil.TileTerraPreta; import com.lothrazar.cyclic.registry.TileRegistry; +import com.lothrazar.cyclic.util.GrowthUtil; import com.lothrazar.cyclic.util.UtilFluid; import com.lothrazar.cyclic.util.UtilParticle; import com.lothrazar.cyclic.util.UtilShape; @@ -56,14 +56,14 @@ public void tick() { if (shapeIndex >= shape.size()) { shapeIndex = 0; } - if (world.isRemote && TileTerraPreta.isValidGrow(world, shape.get(shapeIndex))) { + if (world.isRemote && GrowthUtil.isValidGrow(world, shape.get(shapeIndex))) { UtilParticle.spawnParticle(world, ParticleTypes.FALLING_WATER, shape.get(shapeIndex), 9); } - if (TileTerraPreta.grow(world, shape.get(shapeIndex), 1)) { + if (GrowthUtil.tryGrow(world, shape.get(shapeIndex), 1)) { //it worked so pay tank.drain(WATERCOST.get(), FluidAction.EXECUTE); //run it again since sprinkler costs fluid and therefore should double what the glass and soil do - TileTerraPreta.grow(world, shape.get(shapeIndex), 1); + GrowthUtil.tryGrow(world, shape.get(shapeIndex), 1); } } diff --git a/src/main/java/com/lothrazar/cyclic/block/terraglass/TileTerraGlass.java b/src/main/java/com/lothrazar/cyclic/block/terraglass/TileTerraGlass.java index 83e29882a..479fc179a 100644 --- a/src/main/java/com/lothrazar/cyclic/block/terraglass/TileTerraGlass.java +++ b/src/main/java/com/lothrazar/cyclic/block/terraglass/TileTerraGlass.java @@ -2,20 +2,21 @@ import com.lothrazar.cyclic.base.BlockBase; import com.lothrazar.cyclic.base.TileEntityBase; -import com.lothrazar.cyclic.block.terrasoil.TileTerraPreta; import com.lothrazar.cyclic.registry.TileRegistry; +import com.lothrazar.cyclic.util.GrowthUtil; import net.minecraft.block.BlockState; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeConfigSpec.IntValue; public class TileTerraGlass extends TileEntityBase implements ITickableTileEntity { - private static final int TIMER_FULL = TileTerraPreta.TIMER_FULL / 2; - private static final int DISTANCE = TileTerraPreta.HEIGHT / 2; + public static IntValue TIMER_FULL; + public static IntValue HEIGHT; public TileTerraGlass() { - super(TileRegistry.TERRAGLASS.get()); + super(TileRegistry.TERRA_GLASS.get()); } @Override @@ -28,7 +29,7 @@ public void tick() { if (timer > 0) { return; } - timer = TIMER_FULL; + timer = TIMER_FULL.get(); boolean lit = this.getBlockState().get(BlockBase.LIT); boolean newLit = canBlockSeeSky(world, pos); if (lit != newLit) { @@ -38,9 +39,9 @@ public void tick() { if (!newLit) { return; } - for (int h = 0; h < DISTANCE; h++) { + for (int h = 0; h < HEIGHT.get(); h++) { BlockPos current = pos.down(h); - TileTerraPreta.grow(world, current, 0.25); + GrowthUtil.tryGrow(world, current, 0.25); } } @@ -48,8 +49,6 @@ private boolean canBlockSeeSky(World world, BlockPos pos) { if (world.canSeeSky(pos)) { return true; } - // world.isOutsideBuildHeight(pos) - // else { for (BlockPos blockpos1 = pos.up(); blockpos1.getY() < 256; blockpos1 = blockpos1.up()) { if (World.isYOutOfBounds(blockpos1.getY())) { continue; @@ -61,7 +60,6 @@ private boolean canBlockSeeSky(World world, BlockPos pos) { } } return true; - // } } @Override diff --git a/src/main/java/com/lothrazar/cyclic/block/terrasoil/TileTerraPreta.java b/src/main/java/com/lothrazar/cyclic/block/terrasoil/TileTerraPreta.java index 40b6c102c..65556b030 100644 --- a/src/main/java/com/lothrazar/cyclic/block/terrasoil/TileTerraPreta.java +++ b/src/main/java/com/lothrazar/cyclic/block/terrasoil/TileTerraPreta.java @@ -2,19 +2,17 @@ import com.lothrazar.cyclic.base.TileEntityBase; import com.lothrazar.cyclic.registry.TileRegistry; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.IGrowable; -import net.minecraft.tags.BlockTags; +import com.lothrazar.cyclic.util.GrowthUtil; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; +import net.minecraftforge.common.ForgeConfigSpec.IntValue; public class TileTerraPreta extends TileEntityBase implements ITickableTileEntity { - public static final int TIMER_FULL = 100; - public static final int HEIGHT = 16; + public static final double ODDS_DEFAULT = 0.5; + //see: [cyclic.blocks.terra_preta] + public static IntValue TIMER_FULL; + public static IntValue HEIGHT; public TileTerraPreta() { super(TileRegistry.terra_preta); @@ -27,48 +25,13 @@ public void tick() { if (timer > 0) { return; } - timer = TIMER_FULL; - for (int h = 0; h < HEIGHT; h++) { + timer = TIMER_FULL.get(); + for (int h = 0; h < HEIGHT.get(); h++) { BlockPos current = this.getPos().up(h); - grow(world, current, 0.5); + GrowthUtil.tryGrow(world, current, ODDS_DEFAULT); } } - @SuppressWarnings("deprecation") - public static boolean grow(World world, BlockPos current, double d) { - if (!isValidGrow(world, current)) { - return false; - } - BlockState bState = world.getBlockState(current); - Block block = bState.getBlock(); - if (world instanceof ServerWorld) { - try { - ServerWorld sw = (ServerWorld) world; - if (d >= 1 || world.rand.nextDouble() < d) { - block.randomTick(bState, sw, current, world.rand); - block.randomTick(bState, sw, current, world.rand); - block.randomTick(bState, sw, current, world.rand); - } - } - catch (Exception e) { - return false; - } - } - return true; - } - - public static boolean isValidGrow(World world, BlockPos current) { - BlockState bState = world.getBlockState(current); - if (bState.getBlock() instanceof IGrowable) { - IGrowable crop = ((IGrowable) bState.getBlock()); - if (!crop.canGrow(world, current, bState, world.isRemote) || !crop.canUseBonemeal(world, world.rand, current, bState)) { - return false; //cant grow, or cant bonemeal. no - } - } - //check tags - return bState.isIn(BlockTags.CROPS) || bState.isIn(BlockTags.SAPLINGS); - } - @Override public void setField(int field, int value) {} diff --git a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java index 383426d41..e934fa347 100644 --- a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java @@ -30,6 +30,8 @@ import com.lothrazar.cyclic.block.solidifier.TileSolidifier; import com.lothrazar.cyclic.block.soundrecord.BlockSoundRecorder; import com.lothrazar.cyclic.block.sprinkler.TileSprinkler; +import com.lothrazar.cyclic.block.terraglass.TileTerraGlass; +import com.lothrazar.cyclic.block.terrasoil.TileTerraPreta; import com.lothrazar.cyclic.block.uncrafter.TileUncraft; import com.lothrazar.cyclic.block.user.TileUser; import com.lothrazar.cyclic.enchant.EnchantAutoSmelt; @@ -232,7 +234,7 @@ private static void initConfig() { it -> it instanceof String); EnchantBeheading.PERCENTDROP = CFG.comment("Initial level drop rate. So level I of enchant gives this % drop chance").defineInRange("beheadingDrop", 20, 1, 100); EnchantBeheading.PERCENTPERLEVEL = CFG.comment("Enchant level increase drop rate. % = beheadingDrop + (level-1)*beheadingPerLevel").defineInRange("beheadingPerLevel", 25, 1, 100); - EnchantGrowth.RADIUSFACTOR = CFG.comment("Radius per level. size around player to perform growth logic").defineInRange("growthRadius", 2, 1, 16); + EnchantGrowth.RADIUSFACTOR = CFG.comment("Radius per level. size around player to perform growth logic").defineInRange("growthRadius", 6, 1, 16); CFG.pop(); //enchantment CFG.comment(WALL, " Worldgen settings ", WALL) .push("worldgen"); @@ -410,6 +412,14 @@ private static void initConfig() { TileSprinkler.WATERCOST = CFG.comment("Water consumption").defineInRange("water", 5, 0, 1000); TileSprinkler.TIMER_FULL = CFG.comment("Tick rate. 20 will fire one block per second").defineInRange("ticks", 20, 1, 20); CFG.pop(); // sprinkler + CFG.comment("terra_preta settings").push("terra_preta"); + TileTerraPreta.TIMER_FULL = CFG.comment("ticks between growth cycles").defineInRange("timer", 100, 1, 10000); + TileTerraPreta.HEIGHT = CFG.comment("growth height above the soil").defineInRange("height", 8, 2, 32); + CFG.pop(); // terra_preta + CFG.comment("terra_glass settings").push("terra_glass"); + TileTerraGlass.TIMER_FULL = CFG.comment("ticks between growth cycles").defineInRange("timer", 100, 1, 10000); + TileTerraGlass.HEIGHT = CFG.comment("growth height below the glass").defineInRange("height", 8, 0, 32); + CFG.pop(); // terra_preta CFG.comment("Ender Anchor settings").push("eye_teleport"); TileEyeTp.RANGE = CFG.comment("Maximum distance to activate").defineInRange("range", 128, 2, 256); TileEyeTp.HUNGER = CFG.comment("Hunger cost on teleport").defineInRange("hunger", 1, 0, 20); diff --git a/src/main/java/com/lothrazar/cyclic/enchant/EnchantGrowth.java b/src/main/java/com/lothrazar/cyclic/enchant/EnchantGrowth.java index a3869210e..1845a9fe3 100644 --- a/src/main/java/com/lothrazar/cyclic/enchant/EnchantGrowth.java +++ b/src/main/java/com/lothrazar/cyclic/enchant/EnchantGrowth.java @@ -24,18 +24,15 @@ package com.lothrazar.cyclic.enchant; import com.lothrazar.cyclic.base.EnchantBase; -import com.lothrazar.cyclic.util.HarvestUtil; +import com.lothrazar.cyclic.util.GrowthUtil; import com.lothrazar.cyclic.util.UtilItemStack; import com.lothrazar.cyclic.util.UtilShape; import java.util.Collections; import java.util.List; -import net.minecraft.block.BlockState; -import net.minecraft.block.IGrowable; import net.minecraft.enchantment.EnchantmentType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.EquipmentSlotType; -import net.minecraft.state.IntegerProperty; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; @@ -46,7 +43,8 @@ public class EnchantGrowth extends EnchantBase { - private static final double ODDS_ROTATE = 0.04; + public static final int HEIGHT = 2; + public static final double ODDS = 0.04; public EnchantGrowth(Rarity rarityIn, EnchantmentType typeIn, EquipmentSlotType... slots) { super(rarityIn, typeIn, slots); @@ -79,61 +77,23 @@ public void onEntityUpdate(LivingUpdateEvent event) { //Ticking int level = getCurrentLevelTool(entity.getHeldItem(Hand.MAIN_HAND)); if (level > 0 && !entity.world.isRemote) { - if (entity.world.rand.nextDouble() > ODDS_ROTATE / level) { + if (entity.world.rand.nextDouble() > ODDS * level) { return; //slow the dice down } final int growthLimit = level * 2 + (entity.world.isRaining() ? 4 : 1); //faster when raining too int grown = 0; List shape = UtilShape.squareHorizontalFull(entity.getPosition().down(), level * RADIUSFACTOR.get()); - shape = UtilShape.repeatShapeByHeight(shape, 2); + shape = UtilShape.repeatShapeByHeight(shape, HEIGHT); Collections.shuffle(shape); for (int i = 0; i < shape.size(); i++) { if (grown >= growthLimit) { break; } - //do one - BlockPos pos = shape.get(i); - BlockState target = entity.world.getBlockState(pos); - if (target.getBlock() instanceof IGrowable) { - IGrowable igrowable = (IGrowable) target.getBlock(); - if (!igrowable.canGrow(entity.world, pos, target, entity.world.isRemote)) { - continue; // not allowed to grow - } - } - IntegerProperty propAge = HarvestUtil.getAgeProp(target); - if (propAge == null) { - continue; - } - int maxAge = Collections.max(propAge.getAllowedValues()); - Integer currentAge = target.get(propAge); - if (currentAge < maxAge) { - if (entity.world.setBlockState(pos, - target.with(propAge, currentAge + 1))) { - grown++; - } - } + GrowthUtil.tryGrow(entity.world, shape.get(i), ODDS * 10); } if (grown > 0) { UtilItemStack.damageItem(entity, entity.getHeldItem(Hand.MAIN_HAND)); } - // works but hits grass flowers and makes a mess - // for (int i = 0; i < shape.size(); i++) { - // if (grown >= growthLimit) { - // break; - // } - // //do one - // BlockPos pos = shape.get(i); - // BlockState blockstate = entity.world.getBlockState(pos); - // if (blockstate.getBlock() instanceof IGrowable) { - // IGrowable igrowable = (IGrowable) blockstate.getBlock(); - // if (igrowable.canGrow(worldIn, pos, blockstate, worldIn.isRemote) - // && igrowable.canUseBonemeal(worldIn, worldIn.rand, pos, blockstate)) { - // igrowable.grow((ServerWorld) worldIn, worldIn.rand, pos, blockstate); - // grown++; - // worldIn.markBlockRangeForRenderUpdate(pos, blockstate, worldIn.getBlockState(pos)); - // } - // } - // } } } } diff --git a/src/main/java/com/lothrazar/cyclic/registry/TileRegistry.java b/src/main/java/com/lothrazar/cyclic/registry/TileRegistry.java index 6508539c5..c569dcd02 100644 --- a/src/main/java/com/lothrazar/cyclic/registry/TileRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/registry/TileRegistry.java @@ -100,7 +100,7 @@ public class TileRegistry { public static final RegistryObject> ROTATOR = TILES.register("rotator", () -> TileEntityType.Builder.create(() -> new TileRotator(), BlockRegistry.ROTATOR.get()).build(null)); public static final RegistryObject> DETECTORMOON = TILES.register("detector_moon", () -> TileEntityType.Builder.create(() -> new TileMoon(), BlockRegistry.DETECTORMOON.get()).build(null)); public static final RegistryObject> DETECTORWEATHER = TILES.register("detector_weather", () -> TileEntityType.Builder.create(() -> new TileWeather(), BlockRegistry.DETECTORWEATHER.get()).build(null)); - public static final RegistryObject> TERRAGLASS = TILES.register("terra_glass", () -> TileEntityType.Builder.create(() -> new TileTerraGlass(), BlockRegistry.TERRAGLASS.get()).build(null)); + public static final RegistryObject> TERRA_GLASS = TILES.register("terra_glass", () -> TileEntityType.Builder.create(() -> new TileTerraGlass(), BlockRegistry.TERRAGLASS.get()).build(null)); public static final RegistryObject> SPRINKLER = TILES.register("sprinkler", () -> TileEntityType.Builder.create(() -> new TileSprinkler(), BlockRegistry.SPRINKLER.get()).build(null)); public static final RegistryObject> ENDER_ITEM_SHELF = TILES.register("ender_item_shelf", () -> TileEntityType.Builder.create(() -> new TileItemShelf(), BlockRegistry.ENDER_ITEM_SHELF.get()).build(null)); public static final RegistryObject> WIRELESS_ENERGY = TILES.register("wireless_energy", () -> TileEntityType.Builder.create(() -> new TileWirelessEnergy(), BlockRegistry.WIRELESS_ENERGY.get()).build(null)); diff --git a/src/main/java/com/lothrazar/cyclic/util/GrowthUtil.java b/src/main/java/com/lothrazar/cyclic/util/GrowthUtil.java new file mode 100644 index 000000000..397466819 --- /dev/null +++ b/src/main/java/com/lothrazar/cyclic/util/GrowthUtil.java @@ -0,0 +1,73 @@ +package com.lothrazar.cyclic.util; + +import com.lothrazar.cyclic.ModCyclic; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.IGrowable; +import net.minecraft.tags.BlockTags; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.server.ServerWorld; + +public class GrowthUtil { + + public static boolean isValidGrow(World world, BlockPos current) { + if (world.isAirBlock(current)) { + return false; + } + BlockState bState = world.getBlockState(current); + if (!bState.isIn(BlockTags.CROPS) && !bState.isIn(BlockTags.SAPLINGS)) { + ModCyclic.LOGGER.info("terra-grow can only grow minecraft:crops | minecraft:saplings : " + bState.getBlock()); + return false; + } + if (bState.getBlock() instanceof IGrowable) { + IGrowable crop = ((IGrowable) bState.getBlock()); + if (!crop.canGrow(world, current, bState, world.isRemote)) { + ModCyclic.LOGGER.info("terra-grow crop cannot grow right now " + bState.getBlock()); + return false; //cant grow, or cant bonemeal. no + } + if (!crop.canUseBonemeal(world, world.rand, current, bState)) { + ModCyclic.LOGGER.info("terra-grow canUseBonemeal is false " + bState.getBlock()); + return false; //cant grow, or cant bonemeal. no + } + } + return true; + } + + /** + * grow if valid + */ + public static boolean tryGrow(World world, BlockPos current, double d) { + if (!isValidGrow(world, current)) { + return false; + } + if (d >= 1 || world.rand.nextDouble() < d) { + BlockState bState = world.getBlockState(current); + Block block = bState.getBlock(); + if (world instanceof ServerWorld) { + try { + grow(world, current, bState, block); + } + catch (Exception e) { + return false; + } + } + } + return true; + } + + @SuppressWarnings("deprecation") + private static void grow(World world, BlockPos current, BlockState bState, Block block) { + ServerWorld sw = (ServerWorld) world; + if (bState.getBlock() instanceof IGrowable) { + IGrowable crop = ((IGrowable) bState.getBlock()); + crop.grow(sw, world.rand, current, bState); + } + else { // saplings, etc + block.randomTick(bState, sw, current, world.rand); + block.randomTick(bState, sw, current, world.rand); + block.randomTick(bState, sw, current, world.rand); + } + ModCyclic.LOGGER.info("terra-grow Successful growth" + block); + } +} diff --git a/src/main/resources/data/minecraft/tags/blocks/crops.json.disabled b/src/main/resources/data/minecraft/tags/blocks/crops.json.disabled new file mode 100644 index 000000000..709b67d13 --- /dev/null +++ b/src/main/resources/data/minecraft/tags/blocks/crops.json.disabled @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "#mysticalagriculture:crops" + ] +} \ No newline at end of file diff --git a/update.json b/update.json index 3d4510005..9bebd5c71 100644 --- a/update.json +++ b/update.json @@ -79,6 +79,6 @@ ,"1.5.20":"#2102 wooden and golden hopper deposit logic fixed, now matches 1.18.2+ versions. #2085 Hopper reach area & pickup logic now uses vanilla-hopper area size. JEED compatibility added for some potion effects. Port Fishing Net and Mending Fishingrods compatibility from 1.12.2 #2067. Ender Apple now sends a message if nothing is found (void/flatworlds/etc). Growth enchant now skips IGrowable blocks that return false for 'canGrow();'. Many new config options added for: growth enchant, beheading enchant, battery, sprinkler, experience_pylon, fisher, scythes, and others in cyclic.toml" ,"1.5.21":"#1933 Sack of Holding chest placement override added, with new config to revert back to legacy behavior if desired (overrideChestSingle). #2168 fix bug where ender shelf sometimes would not save contents when mined after exiting reloading world when client data desyncs. Added a percentage config and ignorelist config for cyclic:disarm enchantment (disarmPercentPerLevel, disarmIngoredMobs), resolves it dropping your copied weapon from alexsmobs:mimicube #2249. Fix #1878 layered and/or logic for multiple wireless transmitters on the same node " ,"1.5.22":"Fix #2351 advanced crafting stick not opening. " - ,"1.5.23":"New gloomIgnored config Gloom enchant (cyclic:curse) to ignore and not use these effects #2217 #2325. New config 'Fix Soundproofing block not muting Mekanism sounds #2389 (for example Precision Sawmill and others - you may need four or more soundproofing blocks for the desired effect). New config [cyclic.blocks.soundproofing] radius = 6 to control the area. Fix item cable routing #2245 #2230. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] zenscript support for generator_fluid and generator_item; #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+ " + ,"1.5.23":"Growth enchantment now uses the same logic as Sprinkler & Terra Soil (only minecraft:crops or minecraft::saplings can grow, respect IGrowable::canUseBonemeal). New gloomIgnored config Gloom enchant (cyclic:curse) to ignore and not use these effects #2217 #2325. New config 'Fix Soundproofing block not muting Mekanism sounds #2389 (for example Precision Sawmill and others - you may need four or more soundproofing blocks for the desired effect). New config [cyclic.blocks.soundproofing] radius = 6 to control the area. Fix item cable routing #2245 #2230. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] zenscript support for generator_fluid and generator_item; #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+ " } }