diff --git a/build.gradle b/build.gradle index 2029f2c5bd..858660b82e 100644 --- a/build.gradle +++ b/build.gradle @@ -80,11 +80,23 @@ dependencies { // optional compat: many items useable in curios slots implementation fg.deobf("top.theillusivec4.curios:curios-forge:${mc_version}-${curios_version}") + implementation fg.deobf("com.blamejared.crafttweaker:CraftTweaker-forge-${mc_version}:${crafttweaker_version}") + + + compileOnly fg.deobf("vazkii.botania:Botania:${mc_version}-${botania_version}:api") + runtimeOnly fg.deobf("vazkii.botania:Botania:${mc_version}-${botania_version}") + // optional compat: guidebook compileOnly fg.deobf("vazkii.patchouli:Patchouli:${mc_version}-${patchouli_version}:api") runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:${mc_version}-${patchouli_version}") + + + implementation fg.deobf("curse.maven:yungs-api-421850:4428184") + implementation fg.deobf("curse.maven:yungs-better-strongholds-465575:3778231") + implementation fg.deobf("curse.maven:mekanism-268560:3875976") + // implementation fg.deobf("curse.maven:absent-by-design-305840:3686851") @@ -108,7 +120,7 @@ repositories { maven { url 'https://maven.theillusivec4.top/' } maven { url 'https://maven.blamejared.com' } maven { url 'https://modmaven.dev' } - //maven { url 'https://www.cursemaven.com' } + maven { url 'https://www.cursemaven.com' } } // Example for how to get properties into the manifest for reading by the runtime.. jar { diff --git a/cyclic-client.toml b/examples/config/cyclic-client.toml similarity index 100% rename from cyclic-client.toml rename to examples/config/cyclic-client.toml diff --git a/cyclic.toml b/examples/config/cyclic.toml similarity index 80% rename from cyclic.toml rename to examples/config/cyclic.toml index 2f11624f72..c3eef42d53 100644 --- a/cyclic.toml +++ b/examples/config/cyclic.toml @@ -155,6 +155,10 @@ #Set false to disable enchantment enabled = true + [cyclic.enchantment.gloom] + #Set list of effects for Gloom enchant (cyclic:curse) to ignore and not use these + ignored = ["minecraft:bad_omen", "minecraft:nausea", "botania:clear"] + [cyclic.enchantment.curse] #(Gloom) Set false to disable enchantment enabled = true @@ -227,21 +231,6 @@ #Range: 1 ~ 512 height = 8 - #Ender Anchor settings - [cyclic.blocks.eye_teleport] - #Maximum distance to activate - #Range: 2 ~ 256 - range = 128 - #Exp cost on teleport - #Range: 0 ~ 500 - exp = 0 - #Hunger cost on teleport - #Range: 0 ~ 20 - hunger = 1 - #Tick delay between checks, faster checks can consume server resources (1 means check every tick; 20 means only check once per second) - #Range: 1 ~ 20 - frequency = 5 - [cyclic.blocks.disenchanter] #Power per use disenchanter #Range: 0 ~ 64000 @@ -277,15 +266,121 @@ energy_cost_xdim = 8000 [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 + ##################################################################################### + # Block specific configs + ##################################################################################### + [cyclic.blocks.sound.blocks] + # 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 Anchor settings + [cyclic.blocks.sound.blocks.eye_teleport] + #Maximum distance to activate + #Range: 2 ~ 256 + range = 128 + #Exp cost on teleport + #Range: 0 ~ 500 + exp = 0 + #Hunger cost on teleport + #Range: 0 ~ 20 + hunger = 1 + #Tick delay between checks, faster checks can consume server resources (1 means check every tick; 20 means only check once per second) + #Range: 1 ~ 20 + frequency = 5 + + #Ender shelf settings + [cyclic.blocks.sound.blocks.sound] + #Sound Recorder - how far out does it listen to record sounds + #Range: 1 ~ 64 + radius = 8 + + #battery settings + [cyclic.blocks.sound.blocks.battery] + #RF/t charging rate for the battery item slot + #Range: 1 ~ 6400000 + charge = 8000 + + #fisher settings + [cyclic.blocks.sound.blocks.fisher] + #Chance to Fish from nearby water. Smaller values is slower fish + #Range: 1.0E-6 ~ 0.999 + chance = 0.06 + #Radius to Fish from nearby water + #Range: 1 ~ 32 + radius = 12 + + [cyclic.blocks.sound.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 ~ 1024 + books_per_row = 256 + + [cyclic.blocks.sound.blocks.terra_preta] + #Growth interval in ticks (100 would be every 5 seconds). + #Range: 1 ~ 64000 + growth_interval = 100 + #Chance that the crop will grow after the interval + #Range: 0.0 ~ 1.0 + growth_chance = 0.5 + #growth height above the soil + #Range: 2 ~ 32 + height = 8 + + [cyclic.blocks.sound.blocks.uncrafter] + #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 + nbt_ignored = false + #Ticks used for each uncraft + #Range: 1 ~ 9999 + ticks = 60 + #ITEM IDS HERE. Block ALL recipes that output this item, no matter which recipe they use + ignore_list = ["minecraft:elytra", "minecraft:tipped_arrow", "minecraft:magma_block", "minecraft:stick", "spectrite:spectrite_arrow", "spectrite:spectrite_arrow_special", "techreborn:uumatter", "projecte:*"] + #RECIPE IDS HERE. Block these recipe ids from being reversed, but do not block all recipes for this output item + ignore_recipes = ["minecraft:white_dye_from_lily_of_the_valley", "minecraft:orange_dye_from_orange_tulip", "minecraft:magenta_dye_from_allium", "minecraft:magenta_dye_from_lilac", "minecraft:light_blue_dye_from_blue_orchid", "minecraft:yellow_dye_from_sunflower", "minecraft:yellow_dye_from_dandelion", "minecraft:pink_dye_from_peony", "minecraft:pink_dye_from_pink_tulip", "minecraft:light_gray_dye_from_oxeye_daisy", "minecraft:light_gray_dye_from_azure_bluet", "minecraft:light_gray_dye_from_white_tulip", "minecraft:blue_dye_from_cornflower", "minecraft:red_dye_from_poppy", "minecraft:red_dye_from_rose_bush", "minecraft:red_dye_from_tulip", "minecraft:black_dye_from_wither_rose", "minecraft:blue_dye", "minecraft:black_dye", "minecraft:brown_dye", "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*", "cyclic:flower_purple_tulip", "cyclic:flower_absalon_tulip", "cyclic:flower_cyan", "cyclic:flower_lime_carnation", "cyclic:fireball", "cyclic:shapeless/spark"] + + #Ender Trigger settings + [cyclic.blocks.sound.blocks.eye_redstone] + #Maximum distance to activate + #Range: 2 ~ 256 + range = 32 + #Tick delay between checks, faster checks can consume server resources (1 means check every tick; 20 means only check once per second) + #Range: 1 ~ 20 + frequency = 5 + + #Sprinkler settings + [cyclic.blocks.sound.blocks.sprinkler] + #Tick rate. 20 will fire one block per second + #Range: 1 ~ 20 + ticks = 20 + #Radius + #Range: 1 ~ 32 + radius = 4 + #Water consumption + #Range: 0 ~ 1000 + water = 5 + + #terra_glass settings + [cyclic.blocks.sound.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.sound.blocks.experience_pylon] + #Radius to pickup xp orbs + #Range: 1 ~ 64 + radius = 16 + + #soundproofing settings + [cyclic.blocks.sound.blocks.soundproofing] + #Radius of sound proofing (distance from each block that it will listen) + #Range: 1 ~ 16 + radius = 6 [cyclic.blocks.generator_fuel] #RF energy per tick generated while burning furnace fuel in this machine. Burn time in ticks is the same as furnace values, so 1 coal = 1600 ticks @@ -302,15 +397,6 @@ #Range: 0 ~ 64000 energy_cost = 10 - #fisher settings - [cyclic.blocks.fisher] - #Chance to Fish from nearby water. Smaller values is slower fish - #Range: 1.0E-6 ~ 0.999 - chance = 0.06 - #Radius to Fish from nearby water - #Range: 1 ~ 32 - radius = 12 - [cyclic.blocks.harvester] #Power per use harvester #Range: 0 ~ 64000 @@ -336,15 +422,6 @@ #Range: 0 ~ 16000 fluid_cost = 25 - #Ender Trigger settings - [cyclic.blocks.eye_redstone] - #Maximum distance to activate - #Range: 2 ~ 256 - range = 32 - #Tick delay between checks, faster checks can consume server resources (1 means check every tick; 20 means only check once per second) - #Range: 1 ~ 20 - frequency = 5 - [cyclic.blocks.peat] #Chance that Peat Bog converts to Peat when wet (is multiplied by the number of surrounding water blocks) #Range: 0.0010000000474974513 ~ 1.0 @@ -358,24 +435,6 @@ #Range: 0 ~ 512 height = 4 - #Sprinkler settings - [cyclic.blocks.sprinkler] - #Tick rate. 20 will fire one block per second - #Range: 1 ~ 20 - ticks = 20 - #Radius - #Range: 1 ~ 32 - radius = 4 - #Water consumption - #Range: 0 ~ 1000 - water = 5 - - #experience_pylon settings - [cyclic.blocks.experience_pylon] - #Radius to pickup xp orbs - #Range: 1 ~ 64 - radius = 16 - [cyclic.blocks.soundproofing] #Radius to find and muffle sounds. #Range: 1 ~ 128 @@ -427,14 +486,6 @@ #Range: 0 ~ 64000 energy_cost = 10 - [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 ~ 1024 - books_per_row = 256 - [cyclic.blocks.uncraft] #Power per use uncraft #Range: 0 ~ 64000 @@ -458,25 +509,6 @@ #Range: 1 ~ 64000 fluid_cost = 100 - [cyclic.blocks.terra_preta] - #Growth interval in ticks (100 would be every 5 seconds). Also affects terra glass - #Range: 1 ~ 64000 - growth_interval = 100 - #Chance that the crop will grow after the interval - #Range: 0.0 ~ 1.0 - growth_chance = 0.5 - - [cyclic.blocks.uncrafter] - #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 - nbt_ignored = false - #Ticks used for each uncraft - #Range: 1 ~ 9999 - ticks = 60 - #ITEM IDS HERE. Block ALL recipes that output this item, no matter which recipe they use - ignore_list = ["minecraft:elytra", "minecraft:tipped_arrow", "minecraft:magma_block", "minecraft:stick", "spectrite:spectrite_arrow", "spectrite:spectrite_arrow_special", "techreborn:uumatter", "projecte:*"] - #RECIPE IDS HERE. Block these recipe ids from being reversed, but do not block all recipes for this output item - ignore_recipes = ["minecraft:white_dye_from_lily_of_the_valley", "minecraft:orange_dye_from_orange_tulip", "minecraft:magenta_dye_from_allium", "minecraft:magenta_dye_from_lilac", "minecraft:light_blue_dye_from_blue_orchid", "minecraft:yellow_dye_from_sunflower", "minecraft:yellow_dye_from_dandelion", "minecraft:pink_dye_from_peony", "minecraft:pink_dye_from_pink_tulip", "minecraft:light_gray_dye_from_oxeye_daisy", "minecraft:light_gray_dye_from_azure_bluet", "minecraft:light_gray_dye_from_white_tulip", "minecraft:blue_dye_from_cornflower", "minecraft:red_dye_from_poppy", "minecraft:red_dye_from_rose_bush", "minecraft:red_dye_from_tulip", "minecraft:black_dye_from_wither_rose", "minecraft:blue_dye", "minecraft:black_dye", "minecraft:brown_dye", "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*", "cyclic:flower_purple_tulip", "cyclic:flower_absalon_tulip", "cyclic:flower_cyan", "cyclic:flower_lime_carnation", "cyclic:fireball", "cyclic:shapeless/spark"] - [cyclic.blocks.anti_beacon] #List of extra effects to clear. supports wildcard such as 'cyclic:*'. (This list is is used even if harmful_potions=false or true both) potion_list = ["minecraft:poison", "minecraft:*_poison", "minecraft:wither", "cyclic:gravity", "minecraft:weakness", "minecraft:slowness"] diff --git a/examples/datapacks/cyclic_diable_emerald_stuff.zip b/examples/datapacks/cyclic_diable_emerald_stuff.zip new file mode 100644 index 0000000000..26c520b705 Binary files /dev/null and b/examples/datapacks/cyclic_diable_emerald_stuff.zip differ diff --git a/examples/scripts/crusher.zs b/examples/scripts/crusher.zs new file mode 100644 index 0000000000..f7b65941cd --- /dev/null +++ b/examples/scripts/crusher.zs @@ -0,0 +1,15 @@ +// https://docs.blamejared.com/ +// https://www.curseforge.com/minecraft/mc-mods/crafttweaker +// use /ct dump fluids to see all fluid IDs + +var crusher = ; + +crusher.removeRecipe("cyclic:crusher/nylium_w"); +crusher.removeRecipe("cyclic:crusher/end_crystal", "cyclic:crusher/netherrack"); + +// ID, input, output, RF per tick, ticks, bonus, percentage of bonus +crusher.addRecipe("castlevania", ,*2, 500, 3, *2, 50); + + +// no bonus, same as last number zero +crusher.addRecipe("castlevania2", ,*2, 500, 300); diff --git a/examples/scripts/durability.zs b/examples/scripts/durability.zs new file mode 100644 index 0000000000..4c5258d034 --- /dev/null +++ b/examples/scripts/durability.zs @@ -0,0 +1,10 @@ + + +// change max damage aka durability aka number of tool uses like this + +val glove = ; +glove.maxDamage = 64; + + +val wand = ; +wand.maxDamage = 16; diff --git a/examples/scripts/generator_fluid.zs b/examples/scripts/generator_fluid.zs new file mode 100644 index 0000000000..dbdeb34f2f --- /dev/null +++ b/examples/scripts/generator_fluid.zs @@ -0,0 +1,14 @@ +// https://docs.blamejared.com/ +// https://www.curseforge.com/minecraft/mc-mods/crafttweaker +// use /ct dump fluids to see all fluid IDs + +var generator = ; + +generator.removeRecipe("cyclic:generator/generate_xp"); +generator.removeRecipe("cyclic:generator/generate_lava"); + + + +generator.addRecipe("zoldo", *250, 5, 10); + +generator.addRecipe("lava_tag", "minecraft:lava", 1000, 200, 500); diff --git a/examples/scripts/generator_item.zs b/examples/scripts/generator_item.zs new file mode 100644 index 0000000000..33c62da670 --- /dev/null +++ b/examples/scripts/generator_item.zs @@ -0,0 +1,12 @@ +// https://docs.blamejared.com/ +// https://www.curseforge.com/minecraft/mc-mods/crafttweaker +// use /ct dump fluids to see all fluid IDs + +var generator = ; + +// recipe IDS, not item ids +generator.removeRecipe("cyclic:generator/generate_redstone"); +generator.removeRecipe("cyclic:generator/generate_star"); + +// ID, input, output, RF per tick, ticks, bonus, percentage of bonus +generator.addRecipe("zelda", , 500, 120); diff --git a/examples/scripts/melter.zs b/examples/scripts/melter.zs new file mode 100644 index 0000000000..ebe083a721 --- /dev/null +++ b/examples/scripts/melter.zs @@ -0,0 +1,10 @@ +// https://docs.blamejared.com/ +// https://www.curseforge.com/minecraft/mc-mods/crafttweaker +// use /ct dump fluids to see all fluid IDs + +var melter = ; + +melter.removeRecipe("cyclic:melter/melter_snowwater"); +melter.removeRecipe("cyclic:melter/melter_expflesh", "cyclic:melter/melter_expblaze"); + +melter.addRecipe("spruce_wayne", [,], *75, 500, 3); \ No newline at end of file diff --git a/examples/scripts/remove_by_modid.zs b/examples/scripts/remove_by_modid.zs new file mode 100644 index 0000000000..9954e0cad6 --- /dev/null +++ b/examples/scripts/remove_by_modid.zs @@ -0,0 +1,2 @@ + +craftingTable.removeByModid("cyclic"); diff --git a/examples/scripts/solidifier.zs b/examples/scripts/solidifier.zs new file mode 100644 index 0000000000..25b68efc85 --- /dev/null +++ b/examples/scripts/solidifier.zs @@ -0,0 +1,21 @@ +// https://docs.blamejared.com/ +// https://www.curseforge.com/minecraft/mc-mods/crafttweaker +// use /ct dump fluids to see all fluid IDs + +var solidifier = ; + +solidifier.removeRecipe("cyclic:solidifier/candle_blue"); +solidifier.removeRecipe("cyclic:solidifier/candle_red", "cyclic:solidifier/candle_yellow"); + +// this one is the exact fluid ID, not using tags +solidifier.addRecipe("megaman1", [,,], *100, , 200, 8); + +// next: string-tag format using strings instead of a fluid +// run /ct dump tag +// to see all registered fluid tags + +solidifier.addRecipe("megaman2", [,,], "forge:wax", 100, , 300, 100); + +solidifier.addRecipe("megaman3", [,,], "minecraft:lava", 100, , 300, 100); + +solidifier.addRecipe("megaman4", [,,], "", 5000, , 300, 100); \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 4c98931264..823617b4cb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,6 +17,8 @@ forge_version=40.2.17 jei_version=10.2.1.1005 patchouli_version=71.1 curios_version=5.0.7.1 +botania_version=435 +crafttweaker_version=9.1.211 # for eclipse.ini if needed #-vm diff --git a/scripts/clean_config.sh b/scripts/clean_config.sh new file mode 100644 index 0000000000..fb8a1e434f --- /dev/null +++ b/scripts/clean_config.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +rm run/config/cyclic.toml +rm run/config/cyclic-client.toml + +echo "configs reset" diff --git a/scripts/example_config.sh b/scripts/example_config.sh new file mode 100644 index 0000000000..23ecdd889e --- /dev/null +++ b/scripts/example_config.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +cp run/config/cyclic.toml examples/config/cyclic.toml +cp run/config/cyclic-client.toml examples/config/cyclic-client.toml diff --git a/src/main/java/com/lothrazar/cyclic/block/BlockCyclic.java b/src/main/java/com/lothrazar/cyclic/block/BlockCyclic.java index 78151f8a1f..ae45014cbf 100644 --- a/src/main/java/com/lothrazar/cyclic/block/BlockCyclic.java +++ b/src/main/java/com/lothrazar/cyclic/block/BlockCyclic.java @@ -100,7 +100,7 @@ public BlockState rotate(BlockState state, LevelAccessor world, BlockPos pos, Ro @SuppressWarnings("deprecation") @Override public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { - if (hasFluidInteract) { + if (hasFluidInteract && player.getItemInHand(hand).isEmpty()) { if (!world.isClientSide) { BlockEntity tankHere = world.getBlockEntity(pos); if (tankHere != null) { diff --git a/src/main/java/com/lothrazar/cyclic/block/TileBlockEntityCyclic.java b/src/main/java/com/lothrazar/cyclic/block/TileBlockEntityCyclic.java index 2c46877534..3913ddb683 100644 --- a/src/main/java/com/lothrazar/cyclic/block/TileBlockEntityCyclic.java +++ b/src/main/java/com/lothrazar/cyclic/block/TileBlockEntityCyclic.java @@ -12,6 +12,7 @@ import com.lothrazar.cyclic.block.breaker.BlockBreaker; import com.lothrazar.cyclic.block.cable.energy.TileCableEnergy; import com.lothrazar.cyclic.capabilities.block.CustomEnergyStorage; +import com.lothrazar.cyclic.data.BlockPosDim; import com.lothrazar.cyclic.item.datacard.filter.FilterCardItem; import com.lothrazar.cyclic.net.PacketEnergySync; import com.lothrazar.cyclic.registry.PacketRegistry; @@ -282,20 +283,23 @@ public boolean requiresRedstone() { return this.needsRedstone == 1; } - public void moveFluids(Direction myFacingDir, BlockPos posTarget, int toFlow, IFluidHandler tank) { - // posTarget = pos.offset(myFacingDir); - if (tank == null || tank.getFluidInTank(0).getAmount() <= 0) { + protected void moveFluidsDimensional(BlockPosDim loc, int toFlow, IFluidHandler tank) { + Direction myFacingDir = loc.getSide(); + final Direction themFacingMe = myFacingDir.getOpposite(); + // moveFluidsInternal is just util tryFillPositionFromTank + FluidHelpers.tryFillPositionFromTank(loc.getServerLevel(level.getServer()), loc.getPos(), themFacingMe, tank, toFlow); + } + + protected void moveFluids(Direction myFacingDir, BlockPos posTarget, int toFlow, IFluidHandler tank) { + if (tank == null || tank.getFluidInTank(0).isEmpty()) { return; } - Direction themFacingMe = myFacingDir.getOpposite(); + final Direction themFacingMe = myFacingDir.getOpposite(); FluidHelpers.tryFillPositionFromTank(level, posTarget, themFacingMe, tank, toFlow); } public void tryExtract(IItemHandler myself, Direction extractSide, int qty, ItemStackHandler nullableFilter) { - if (extractSide == null) { - return; - } - if (extractSide == null || !myself.getStackInSlot(0).isEmpty()) { + if (myself == null || extractSide == null || !myself.getStackInSlot(0).isEmpty()) { return; } BlockPos posTarget = worldPosition.relative(extractSide); @@ -346,29 +350,45 @@ public boolean moveItemToCompost(Direction exportToSide, ItemStackHandler invent } return false; } + // + // + // public boolean moveItems(Direction myFacingDir, int max, IItemHandler handlerHere) { - return moveItems(myFacingDir, worldPosition.relative(myFacingDir), max, handlerHere, 0); + return moveItems(myFacingDir, this.worldPosition.relative(myFacingDir), max, handlerHere, 0); + } + + public boolean moveItemsDimensional(BlockPosDim loc, int max, IItemHandler handlerHere, int theslot) { + Direction myFacingDir = loc.getSide(); + final Direction themFacingMe = myFacingDir.getOpposite(); + ServerLevel serverWorld = loc.getServerLevel(level.getServer()); + return moveItemsInternal(max, handlerHere, theslot, themFacingMe, serverWorld.getBlockEntity(loc.getPos())); } public boolean moveItems(Direction myFacingDir, BlockPos posTarget, int max, IItemHandler handlerHere, int theslot) { - if (this.level.isClientSide()) { + if (max <= 0 || this.level.isClientSide()) { return false; } - if (handlerHere == null) { + //first get the original ItemStack as creating new ones is expensive + final Direction themFacingMe = myFacingDir.getOpposite(); + final BlockEntity tileTarget = level.getBlockEntity(posTarget); + return moveItemsInternal(max, handlerHere, theslot, themFacingMe, tileTarget); + } + + private static boolean moveItemsInternal(int max, IItemHandler handlerHere, int theslot, final Direction themFacingMe, final BlockEntity tileTarget) { + if (max <= 0 || tileTarget == null || handlerHere == null) { return false; } - Direction themFacingMe = myFacingDir.getOpposite(); - BlockEntity tileTarget = level.getBlockEntity(posTarget); - if (tileTarget == null) { + final ItemStack originalItemStack = handlerHere.getStackInSlot(theslot); + if (originalItemStack.isEmpty()) { return false; } - IItemHandler handlerOutput = tileTarget.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, themFacingMe).orElse(null); + final IItemHandler handlerOutput = tileTarget.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, themFacingMe).orElse(null); if (handlerOutput == null) { return false; } //first simulate - ItemStack drain = handlerHere.extractItem(theslot, max, true); // handlerHere.getStackInSlot(theslot).copy(); + ItemStack drain = handlerHere.extractItem(theslot, max, true); int sizeStarted = drain.getCount(); if (!drain.isEmpty()) { //now push it into output, but find out what was ACTUALLY taken @@ -385,50 +405,130 @@ public boolean moveItems(Direction myFacingDir, BlockPos posTarget, int max, IIt } return sizeAfter > 0; } + // + // + // + // + // + // protected boolean moveEnergy(Direction myFacingDir, int quantity) { - return moveEnergy(myFacingDir, worldPosition.relative(myFacingDir), quantity); + return moveEnergy(myFacingDir, this.worldPosition.relative(myFacingDir), quantity); } - protected boolean moveEnergy(Direction myFacingDir, BlockPos posTarget, int quantity) { + protected boolean moveEnergyDimensional(final BlockPosDim loc, final int quantity) { + //validation pre-move + if (quantity <= 0) { + return false; + } if (this.level.isClientSide) { - return false; //important to not desync cables + return false; //important to not desync cables } - IEnergyStorage handlerHere = this.getCapability(CapabilityEnergy.ENERGY, myFacingDir).orElse(null); - if (handlerHere == null || handlerHere.getEnergyStored() == 0) { + Direction myFacingDir = loc.getSide(); + final IEnergyStorage handlerHere = this.getCapability(CapabilityEnergy.ENERGY, myFacingDir).orElse(null); + ServerLevel serverWorld = loc.getServerLevel(level.getServer()); + final BlockEntity tileTarget = serverWorld.getBlockEntity(loc.getPos()); + final Direction themFacingMe = myFacingDir.getOpposite(); + return moveEnergyInternal(quantity, handlerHere, themFacingMe, tileTarget); + } + + //assums posTarget is in the same dimension as this.world + protected boolean moveEnergy(final Direction myFacingDir, final BlockPos posTarget, final int quantity) { + //validation pre-move + if (quantity <= 0) { return false; } - if (myFacingDir == null) { - myFacingDir = Direction.UP; + if (this.level.isClientSide) { + return false; //important to not desync cables + } + final IEnergyStorage handlerHere = this.getCapability(CapabilityEnergy.ENERGY, myFacingDir).orElse(null); + final Direction themFacingMe = myFacingDir.getOpposite(); + final BlockEntity tileTarget = level.getBlockEntity(posTarget); + return moveEnergyInternal(quantity, handlerHere, themFacingMe, tileTarget); + } + + private static boolean moveEnergyInternal(final int quantity, final IEnergyStorage handlerHere, final Direction themFacingMe, final BlockEntity tileTarget) { + if (handlerHere == null) { + return false; } - Direction themFacingMe = myFacingDir.getOpposite(); - BlockEntity tileTarget = level.getBlockEntity(posTarget); if (tileTarget == null) { return false; } - IEnergyStorage handlerOutput = tileTarget.getCapability(CapabilityEnergy.ENERGY, themFacingMe).orElse(null); + final IEnergyStorage handlerOutput = tileTarget.getCapability(CapabilityEnergy.ENERGY, themFacingMe).orElse(null); if (handlerOutput == null) { return false; } - if (handlerHere != null && handlerOutput != null - && handlerHere.canExtract() && handlerOutput.canReceive()) { - //first simulate - int drain = handlerHere.extractEnergy(quantity, true); - if (drain > 0) { - //now push it into output, but find out what was ACTUALLY taken - int filled = handlerOutput.receiveEnergy(drain, false); - //now actually drain that much from here - handlerHere.extractEnergy(filled, false); - if (filled > 0 && tileTarget instanceof TileCableEnergy) { - // not so compatible with other fluid systems. itl do i guess - TileCableEnergy cable = (TileCableEnergy) tileTarget; - cable.updateIncomingEnergyFace(themFacingMe); - } - return filled > 0; - } + final int capacity = handlerOutput.getMaxEnergyStored() - handlerOutput.getEnergyStored(); + if (capacity <= 0) { + return false; } - return false; + //validation is done + //next, simulate + final int drain = handlerHere.extractEnergy(Math.min(quantity, capacity), true); + if (drain <= 0) { + return false; + } + //now push it into output, but find out what was ACTUALLY taken + final int filled = handlerOutput.receiveEnergy(drain, false); + if (filled <= 0) { + return false; + } + //now actually drain that much from here + final int drained = handlerHere.extractEnergy(filled, false); + //sanity check + if (drained != filled) { + ModCyclic.LOGGER.error("Imbalance moving energy, extracted " + drained + " received " + filled); + } + if (tileTarget instanceof TileCableEnergy) { + // not so compatible with other fluid systems. it will do i guess + TileCableEnergy cable = (TileCableEnergy) tileTarget; + cable.updateIncomingEnergyFace(themFacingMe); + } + return true; } + // protected boolean moveEnergy(Direction myFacingDir, int quantity) { + // return moveEnergy(myFacingDir, worldPosition.relative(myFacingDir), quantity); + // } + // + // protected boolean moveEnergy(Direction myFacingDir, BlockPos posTarget, int quantity) { + // if (this.level.isClientSide) { + // return false; //important to not desync cables + // } + // IEnergyStorage handlerHere = this.getCapability(CapabilityEnergy.ENERGY, myFacingDir).orElse(null); + // if (handlerHere == null || handlerHere.getEnergyStored() == 0) { + // return false; + // } + // if (myFacingDir == null) { + // myFacingDir = Direction.UP; + // } + // Direction themFacingMe = myFacingDir.getOpposite(); + // BlockEntity tileTarget = level.getBlockEntity(posTarget); + // if (tileTarget == null) { + // return false; + // } + // IEnergyStorage handlerOutput = tileTarget.getCapability(CapabilityEnergy.ENERGY, themFacingMe).orElse(null); + // if (handlerOutput == null) { + // return false; + // } + // if (handlerHere != null && handlerOutput != null + // && handlerHere.canExtract() && handlerOutput.canReceive()) { + // //first simulate + // int drain = handlerHere.extractEnergy(quantity, true); + // if (drain > 0) { + // //now push it into output, but find out what was ACTUALLY taken + // int filled = handlerOutput.receiveEnergy(drain, false); + // //now actually drain that much from here + // handlerHere.extractEnergy(filled, false); + // if (filled > 0 && tileTarget instanceof TileCableEnergy) { + // // not so compatible with other fluid systems. itl do i guess + // TileCableEnergy cable = (TileCableEnergy) tileTarget; + // cable.updateIncomingEnergyFace(themFacingMe); + // } + // return filled > 0; + // } + // } + // return false; + // } @Override public void load(CompoundTag tag) { 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 1e769a1558..82b6c28bc8 100644 --- a/src/main/java/com/lothrazar/cyclic/block/apple/AppleCropBlock.java +++ b/src/main/java/com/lothrazar/cyclic/block/apple/AppleCropBlock.java @@ -79,6 +79,7 @@ public void randomTick(BlockState state, ServerLevel worldIn, BlockPos pos, Rand int age = state.getValue(AGE); if (age < MAX_AGE && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(worldIn, pos, state, worldIn.random.nextInt(5) == 0)) { worldIn.setBlock(pos, state.setValue(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/breaker/TileBreaker.java b/src/main/java/com/lothrazar/cyclic/block/breaker/TileBreaker.java index b239ceee69..223212e3a1 100644 --- a/src/main/java/com/lothrazar/cyclic/block/breaker/TileBreaker.java +++ b/src/main/java/com/lothrazar/cyclic/block/breaker/TileBreaker.java @@ -12,6 +12,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; public class TileBreaker extends TileBlockEntityCyclic implements MenuProvider { @@ -43,13 +44,31 @@ public void tick() { if (level.isClientSide) { return; } - BlockPos target = worldPosition.relative(this.getCurrentFacing()); - BlockState state = level.getBlockState(target); - if (!state.isAir() && - state.getDestroySpeed(level, target) >= 0) { + BlockPos target = this.worldPosition.relative(this.getCurrentFacing()); // offset -> relative + if (this.isValid(target)) { this.level.destroyBlock(target, true); } - //else unbreakable + } + + /** + * Avoid mining source liquid blocks and unbreakable + */ + private boolean isValid(BlockPos target) { + BlockState state = level.getBlockState(target); + if (state.isAir()) { + return false; + } + if (state.getDestroySpeed(level, target) < 0) { //getBlockHardness -> getDestroySpeed + return false; + } + if (state.getFluidState() != null && state.getFluidState().isEmpty() == false) { + //am i a solid waterlogged state block? + if (state.hasProperty(BlockStateProperties.WATERLOGGED) == false) { + //pure liquid. but this will make canHarvestBlock go true + return false; + } + } + return true; } @Override diff --git a/src/main/java/com/lothrazar/cyclic/block/cable/CableBase.java b/src/main/java/com/lothrazar/cyclic/block/cable/CableBase.java index 8789066d84..395b98e640 100644 --- a/src/main/java/com/lothrazar/cyclic/block/cable/CableBase.java +++ b/src/main/java/com/lothrazar/cyclic/block/cable/CableBase.java @@ -161,26 +161,7 @@ public InteractionResult use(BlockState state, Level world, BlockPos pos, Player } public static void crouchClick(RightClickBlock event, BlockState state) { - // Direction sideToToggle = event.getFace(); // no rotateFromWrench(state, event.getWorld(), event.getPos(), event.getPlayer(), event.getHitVec()); - // EnumProperty prop = CableBase.FACING_TO_PROPERTY_MAP.get(sideToToggle); - // if (state.hasProperty(prop)) { - // EnumConnectType status = state.getValue(prop); - // BlockState newState = state; - // switch (status) { - // case BLOCKED: - // newState = state.setValue(prop, EnumConnectType.NONE); - // break; - // case NONE: // no connection - // case INVENTORY: // inventory connection or - // case CABLE: // extract - // // extract to blocked - // newState = state.setValue(prop, EnumConnectType.BLOCKED); - // break; - // } - // event.getWorld().setBlock(event.getPos(), newState, 3); - // // newState.updateShape(sideToToggle, world.getBlockState(pos.relative(sideToToggle)), world, pos, pos.relative(sideToToggle)); - // } } private static void rotateFromWrench(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { @@ -228,7 +209,7 @@ else if (hitZ > 1 - hitLimit) { break; } } - else { + else { // non-crouching flow switch (status) { case BLOCKED: newState = state.setValue(prop, EnumConnectType.NONE); @@ -247,7 +228,6 @@ else if (hitZ > 1 - hitLimit) { } } // - // if (world.getBlockState(pos).getBlock() instanceof CableBase && world.setBlockAndUpdate(pos, newState)) { if (updatePost) { newState.updateShape(sideToToggle, world.getBlockState(pos.relative(sideToToggle)), world, pos, pos.relative(sideToToggle)); @@ -275,10 +255,4 @@ public static boolean isCableBlocked(BlockState blockState, Direction side) { && blockState.hasProperty(property) && blockState.getValue(property).isUnBlocked() == false; } - // protected void updateConnection(final IWorld world, final BlockPos blockPos, final Direction side, final EnumConnectType connectType) { - // final TileEntity tileEntity = world.getTileEntity(blockPos); - // if (tileEntity instanceof TileCableBase) { - // ((TileCableBase) tileEntity).updateConnection(side, connectType); - // } - // } } diff --git a/src/main/java/com/lothrazar/cyclic/block/cable/item/ContainerCableItem.java b/src/main/java/com/lothrazar/cyclic/block/cable/item/ContainerCableItem.java index 64df0da78e..c68b26f7d5 100644 --- a/src/main/java/com/lothrazar/cyclic/block/cable/item/ContainerCableItem.java +++ b/src/main/java/com/lothrazar/cyclic/block/cable/item/ContainerCableItem.java @@ -19,9 +19,8 @@ public ContainerCableItem(int windowId, Level world, BlockPos pos, Inventory pla tile = (TileCableItem) world.getBlockEntity(pos); this.playerEntity = player; this.playerInventory = playerInventory; - // tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).ifPresent(h -> { this.endInv = tile.filter.getSlots(); - //dont show 0 thats the actual thing in the slot + //dont show 0 thats the actual thing in the slot addSlot(new SlotItemHandler(tile.filter, 0, 80, 29) { @Override @@ -29,7 +28,7 @@ public void setChanged() { tile.setChanged(); } }); - // }); + addSlot(new SlotItemHandler(tile.filter, 0, 80, 29)); layoutPlayerInventorySlots(8, 84); this.trackEnergy(tile); } diff --git a/src/main/java/com/lothrazar/cyclic/block/cable/item/ScreenCableItem.java b/src/main/java/com/lothrazar/cyclic/block/cable/item/ScreenCableItem.java index d336ae47e2..d3891d9e43 100644 --- a/src/main/java/com/lothrazar/cyclic/block/cable/item/ScreenCableItem.java +++ b/src/main/java/com/lothrazar/cyclic/block/cable/item/ScreenCableItem.java @@ -10,39 +10,11 @@ public class ScreenCableItem extends ScreenBase { public ScreenCableItem(ContainerCableItem screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - // fluid = new FluidBar(this, TileFluidCollect.CAPACITY); - // energy = new EnergyBar(this, TileFluidCollect.MAX); } @Override public void init() { super.init(); - // energy.guiLeft = fluid.guiLeft = guiLeft; - // energy.guiTop = fluid.guiTop = guiTop; - // energy.visible = TileFluidCollect.POWERCONF.get() > 0; - // int x, y; - // x = guiLeft + 8; - // y = guiTop + 8; - // btnRedstone = addButton(new ButtonMachineRedstone(x, y, TileFluidCollect.Fields.REDSTONE.ordinal(), container.tile.getPos())); - // btnRender = addButton(new ButtonMachineRedstone(x, y + 20, TileFluidCollect.Fields.RENDER.ordinal(), - // container.tile.getPos(), TextureEnum.RENDER_HIDE, TextureEnum.RENDER_SHOW, "gui.cyclic.render")); - // // - // // - // int w = 96; - // int h = 20; - // x = guiLeft + 32; - // y += h + 1; - // int f = TileFluidCollect.Fields.HEIGHT.ordinal(); - // GuiSliderInteger height = this.addButton(new GuiSliderInteger(x, y, w, h, f, container.tile.getPos(), - // 0, TileFluidCollect.MAX_HEIGHT, container.tile.getField(f))); - // height.setTooltip("buildertype.height.tooltip"); - // y += h + 1; - // // - // // - // f = TileFluidCollect.Fields.SIZE.ordinal(); - // GuiSliderInteger size = this.addButton(new GuiSliderInteger(x, y, w, h, f, container.tile.getPos(), - // 0, TileMiner.MAX_SIZE, container.tile.getField(f))); - // size.setTooltip("buildertype.size.tooltip"); } @Override diff --git a/src/main/java/com/lothrazar/cyclic/block/soundmuff/SoundmufflerBlock.java b/src/main/java/com/lothrazar/cyclic/block/soundmuff/SoundmufflerBlock.java index 7855c02cd1..9bc262470a 100644 --- a/src/main/java/com/lothrazar/cyclic/block/soundmuff/SoundmufflerBlock.java +++ b/src/main/java/com/lothrazar/cyclic/block/soundmuff/SoundmufflerBlock.java @@ -3,11 +3,11 @@ import java.util.List; import com.lothrazar.cyclic.ModCyclic; import com.lothrazar.cyclic.block.BlockCyclic; +import com.lothrazar.cyclic.config.ConfigRegistry; import com.lothrazar.cyclic.util.BlockstatesUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.resources.sounds.SoundInstance; -import net.minecraft.client.resources.sounds.TickableSoundInstance; import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.SoundType; import net.minecraftforge.api.distmarker.Dist; @@ -31,13 +31,10 @@ public SoundmufflerBlock(Properties properties) { @SubscribeEvent public void onPlaySound(PlaySoundEvent event) { ClientLevel clientWorld = Minecraft.getInstance().level; - if (event.getSound() == null || event.getSound() instanceof TickableSoundInstance || clientWorld == null) { + if (event.getSound() == null || clientWorld == null) { return; - } //long term/repeating/music + } SoundInstance sound = event.getSound(); - // if (tile.isPowered()) { - // return; // redstone power = not running - // } final boolean isPowered = false; // if im NOT powered, im running List blocks = BlockstatesUtil.findBlocks(clientWorld, new BlockPos(sound.getX(), sound.getY(), sound.getZ()), this, RADIUS.get(), @@ -45,17 +42,21 @@ public void onPlaySound(PlaySoundEvent event) { if (blocks == null || blocks.size() == 0) { return; } + float reduce = VOL_REDUCE_PER_BLOCK; + float radius = ConfigRegistry.SOUND_RADIUS.get(); + //the number of nearby blocks informs how much we muffle the sound by + //at 6 blocks, it caps off the reduction + float volume = (float) (Math.min(reduce / radius, 1.0) / blocks.size()); + rebuildSoundWithVolume(event, sound, volume); + } + + private static void rebuildSoundWithVolume(PlaySoundEvent event, SoundInstance sound, float newVolume) { try { //WARNING": DO NOT USE getVolume anywhere here it just crashes - //we do use it inside the sound class, but the engine callss tat later on, and our factor is tacked in + //we do use it inside the sound class, but the engine calls that later on, and our factor is tacked in SoundVolumeControlled newSound = new SoundVolumeControlled(sound); - //the number of nearby blocks informs how much we muffle the sound by - final float pct = VOL_REDUCE_PER_BLOCK / 6F; - //at 6 blocks, it caps off the reduction - final float newVolume = (float) (Math.min(pct, 1.0) / blocks.size()); newSound.setVolume(newVolume); event.setSound(newSound); - ModCyclic.LOGGER.info("sound muffled; size= " + blocks.size()); } catch (Exception e) { ModCyclic.LOGGER.error("Error trying to detect volume of sound " + sound, e); 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 e7f3c9e7c8..236c6d83a5 100644 --- a/src/main/java/com/lothrazar/cyclic/block/sprinkler/TileSprinkler.java +++ b/src/main/java/com/lothrazar/cyclic/block/sprinkler/TileSprinkler.java @@ -2,16 +2,17 @@ import java.util.List; import com.lothrazar.cyclic.block.TileBlockEntityCyclic; -import com.lothrazar.cyclic.block.terrasoil.TileTerraPreta; import com.lothrazar.cyclic.capabilities.block.FluidTankBase; import com.lothrazar.cyclic.registry.TileRegistry; import com.lothrazar.cyclic.util.FluidHelpers; +import com.lothrazar.cyclic.util.GrowthUtil; import com.lothrazar.cyclic.util.ParticleUtil; import com.lothrazar.cyclic.util.ShapeUtil; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntity; @@ -63,14 +64,16 @@ public void tick() { if (shapeIndex >= shape.size()) { shapeIndex = 0; } - if (level.isClientSide && TileTerraPreta.isValidGrow(level, shape.get(shapeIndex))) { + if (level.isClientSide && GrowthUtil.isValidGrow(level, shape.get(shapeIndex))) { ParticleUtil.spawnParticle(level, ParticleTypes.FALLING_WATER, shape.get(shapeIndex), 9); } - if (TileTerraPreta.grow(level, shape.get(shapeIndex), 1)) { - //it worked, so double drain - 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(level, shape.get(shapeIndex), 1); + if (level instanceof ServerLevel sl) { + if (GrowthUtil.tryGrow(sl, 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 + GrowthUtil.tryGrow(sl, shape.get(shapeIndex), 1); + } } } diff --git a/src/main/java/com/lothrazar/cyclic/block/terraglass/BlockTerraGlass.java b/src/main/java/com/lothrazar/cyclic/block/terraglass/BlockTerraGlass.java index 09c0e960aa..a1f29481c3 100644 --- a/src/main/java/com/lothrazar/cyclic/block/terraglass/BlockTerraGlass.java +++ b/src/main/java/com/lothrazar/cyclic/block/terraglass/BlockTerraGlass.java @@ -65,7 +65,7 @@ public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return createTickerHelper(type, TileRegistry.TERRAGLASS.get(), world.isClientSide ? TileTerraGlass::clientTick : TileTerraGlass::serverTick); + return createTickerHelper(type, TileRegistry.TERRA_GLASS.get(), world.isClientSide ? TileTerraGlass::clientTick : TileTerraGlass::serverTick); } @Override 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 6e6e1ee213..5bbb7cd4fe 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,22 @@ import com.lothrazar.cyclic.block.BlockCyclic; import com.lothrazar.cyclic.block.TileBlockEntityCyclic; -import com.lothrazar.cyclic.block.terrasoil.TileTerraPreta; import com.lothrazar.cyclic.registry.TileRegistry; +import com.lothrazar.cyclic.util.GrowthUtil; import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.common.ForgeConfigSpec.IntValue; public class TileTerraGlass extends TileBlockEntityCyclic { - private static final int TIMER_FULL = TileTerraPreta.TIMER_FULL.get() / 2; - private static final int DISTANCE = TileTerraPreta.HEIGHT / 2; + public static IntValue TIMER_FULL; + public static IntValue HEIGHT; public TileTerraGlass(BlockPos pos, BlockState state) { - super(TileRegistry.TERRAGLASS.get(), pos, state); + super(TileRegistry.TERRA_GLASS.get(), pos, state); } public static void serverTick(Level level, BlockPos blockPos, BlockState blockState, TileTerraGlass e) { @@ -35,7 +37,7 @@ public void tick() { if (timer > 0) { return; } - timer = TIMER_FULL; + timer = TIMER_FULL.get(); boolean lit = this.getBlockState().getValue(BlockCyclic.LIT); boolean newLit = canBlockSeeSky(level, worldPosition); if (lit != newLit) { @@ -45,9 +47,11 @@ public void tick() { if (!newLit) { return; } - for (int h = 0; h < DISTANCE; h++) { - BlockPos current = worldPosition.below(h); - TileTerraPreta.grow(level, current, 0.25); + if (level instanceof ServerLevel sl) { + for (int h = 0; h < HEIGHT.get(); h++) { + BlockPos current = worldPosition.below(h); + GrowthUtil.tryGrow(sl, current, 0.25); + } } } @@ -55,8 +59,6 @@ private boolean canBlockSeeSky(Level world, BlockPos pos) { if (world.canSeeSky(pos)) { return true; } - // world.isOutsideBuildHeight(pos) - // else { for (BlockPos blockpos1 = pos.above(); blockpos1.getY() < 256; blockpos1 = blockpos1.above()) { if (level.isOutsideBuildHeight(blockpos1.getY())) { continue; @@ -68,7 +70,6 @@ private boolean canBlockSeeSky(Level 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 7084d2cc82..3bc0974780 100644 --- a/src/main/java/com/lothrazar/cyclic/block/terrasoil/TileTerraPreta.java +++ b/src/main/java/com/lothrazar/cyclic/block/terrasoil/TileTerraPreta.java @@ -16,8 +16,9 @@ public class TileTerraPreta extends TileBlockEntityCyclic { public static IntValue TIMER_FULL; - public static final int HEIGHT = 16; + public static IntValue HEIGHT; public static DoubleValue CHANCE; + // public static final double ODDS_DEFAULT = 0.5; public TileTerraPreta(BlockPos pos, BlockState state) { super(TileRegistry.TERRA_PRETA.get(), pos, state); @@ -38,7 +39,7 @@ public void tick() { return; } timer = TIMER_FULL.get(); - for (int h = 0; h < HEIGHT; h++) { + for (int h = 0; h < HEIGHT.get(); h++) { BlockPos current = this.getBlockPos().above(h); grow(level, current, CHANCE.get()); } diff --git a/src/main/java/com/lothrazar/cyclic/block/uncrafter/ScreenUncraft.java b/src/main/java/com/lothrazar/cyclic/block/uncrafter/ScreenUncraft.java index 668cfadbc2..cc36d96340 100644 --- a/src/main/java/com/lothrazar/cyclic/block/uncrafter/ScreenUncraft.java +++ b/src/main/java/com/lothrazar/cyclic/block/uncrafter/ScreenUncraft.java @@ -55,24 +55,6 @@ protected void renderLabels(PoseStack ms, int mouseX, int mouseY) { ModCyclic.MODID + ".gui.uncrafter." + menu.tile.getStatus().name().toLowerCase()); int center = (this.getXSize() - this.font.width(name)) / 2; drawString(ms, name, center + 37, 24); - //======= - // UncraftStatusEnum status = container.tile.getStatus(); - // if (status != UncraftStatusEnum.EMPTY && status != UncraftStatusEnum.MATCH) { - // minecraft.getTextureManager().bindTexture(TextureRegistry.WIDGETS); - // blit(ms, 125, 15, 228, 452, 24, 24, 512, 512); - // } - // } - // - // @Override - // protected void renderHoveredTooltip(MatrixStack matrixStack, int x, int y) { - // super.renderHoveredTooltip(matrixStack, x, y); - // if (this.isPointInRegion(125, 15, 24, 24, x, y)) { - // UncraftStatusEnum status = container.tile.getStatus(); - // if (status != UncraftStatusEnum.EMPTY && status != UncraftStatusEnum.MATCH) { - // TranslationTextComponent comp = new TranslationTextComponent(ModCyclic.MODID + ".gui.uncrafter." + container.tile.getStatus().name().toLowerCase()); - // GuiUtils.drawHoveringText(matrixStack, Arrays.asList(comp), x, y, this.width, this.height, 0xFFFFFF, font); - // } - //>>>>>>> 54f4445a2d7902cf4ef454efe328c9667ca5b652 } } diff --git a/src/main/java/com/lothrazar/cyclic/block/wireless/energy/TileWirelessEnergy.java b/src/main/java/com/lothrazar/cyclic/block/wireless/energy/TileWirelessEnergy.java index 9a8625d335..75d2946075 100644 --- a/src/main/java/com/lothrazar/cyclic/block/wireless/energy/TileWirelessEnergy.java +++ b/src/main/java/com/lothrazar/cyclic/block/wireless/energy/TileWirelessEnergy.java @@ -4,6 +4,7 @@ import java.util.Set; import com.lothrazar.cyclic.block.TileBlockEntityCyclic; import com.lothrazar.cyclic.capabilities.block.CustomEnergyStorage; +import com.lothrazar.cyclic.config.ConfigRegistry; import com.lothrazar.cyclic.data.BlockPosDim; import com.lothrazar.cyclic.item.datacard.LocationGpsCard; import com.lothrazar.cyclic.registry.TileRegistry; @@ -114,17 +115,19 @@ public void tick() { Set used = new HashSet<>(); for (int slot = 0; slot < gpsSlots.getSlots(); slot++) { BlockPosDim loc = getTargetInSlot(slot); - if (used.contains(loc)) { + if (loc == null || used.contains(loc)) { continue; } - if (loc != null && LevelWorldUtil.dimensionIsEqual(loc, level)) { - if (moveEnergy(loc.getSide(), loc.getPos(), transferRate)) { - used.add(loc); - moved = true; - } + if (LevelWorldUtil.dimensionIsEqual(loc, level)) { + // assume position is in the same level/dimension/world + moved = moveEnergy(loc.getSide(), loc.getPos(), transferRate); } + else if (ConfigRegistry.TRANSFER_NODES_DIMENSIONAL.get()) { + //allows config to disable this cross dimension feature for modpack balance purposes + moved = moveEnergyDimensional(loc, transferRate); + } + this.setLitProperty(moved); } - this.setLitProperty(moved); } BlockPosDim getTargetInSlot(int s) { diff --git a/src/main/java/com/lothrazar/cyclic/block/wireless/fluid/TileWirelessFluid.java b/src/main/java/com/lothrazar/cyclic/block/wireless/fluid/TileWirelessFluid.java index 9bc7cba75e..9b350c2cfa 100644 --- a/src/main/java/com/lothrazar/cyclic/block/wireless/fluid/TileWirelessFluid.java +++ b/src/main/java/com/lothrazar/cyclic/block/wireless/fluid/TileWirelessFluid.java @@ -2,6 +2,7 @@ import com.lothrazar.cyclic.block.TileBlockEntityCyclic; import com.lothrazar.cyclic.capabilities.block.FluidTankBase; +import com.lothrazar.cyclic.config.ConfigRegistry; import com.lothrazar.cyclic.data.BlockPosDim; import com.lothrazar.cyclic.item.datacard.LocationGpsCard; import com.lothrazar.cyclic.registry.TileRegistry; @@ -129,8 +130,13 @@ public void tick() { boolean moved = false; //run the transfer. one slot only BlockPosDim loc = getTargetInSlot(0); - if (loc != null && LevelWorldUtil.dimensionIsEqual(loc, level)) { - this.moveFluids(loc.getSide(), loc.getPos(), this.transferRate, tank); + if (loc != null) { + if (LevelWorldUtil.dimensionIsEqual(loc, level)) { + this.moveFluids(loc.getSide(), loc.getPos(), this.transferRate, tank); + } + else if (ConfigRegistry.TRANSFER_NODES_DIMENSIONAL.get()) { + this.moveFluidsDimensional(loc, this.transferRate, tank); + } } this.setLitProperty(moved); } diff --git a/src/main/java/com/lothrazar/cyclic/block/wireless/item/TileWirelessItem.java b/src/main/java/com/lothrazar/cyclic/block/wireless/item/TileWirelessItem.java index 59ad0bcfb4..77dafb692d 100644 --- a/src/main/java/com/lothrazar/cyclic/block/wireless/item/TileWirelessItem.java +++ b/src/main/java/com/lothrazar/cyclic/block/wireless/item/TileWirelessItem.java @@ -1,6 +1,7 @@ package com.lothrazar.cyclic.block.wireless.item; import com.lothrazar.cyclic.block.TileBlockEntityCyclic; +import com.lothrazar.cyclic.config.ConfigRegistry; import com.lothrazar.cyclic.data.BlockPosDim; import com.lothrazar.cyclic.item.datacard.LocationGpsCard; import com.lothrazar.cyclic.registry.TileRegistry; @@ -113,8 +114,13 @@ public void tick() { boolean moved = false; //run the transfer. one slot only BlockPosDim loc = getTargetInSlot(); - if (loc != null && LevelWorldUtil.dimensionIsEqual(loc, level)) { - moved = moveItems(Direction.UP, loc.getPos(), this.transferRate, this.inventory, 0); + if (loc != null) { + if (LevelWorldUtil.dimensionIsEqual(loc, level)) { + moved = moveItems(loc.getSide(), loc.getPos(), this.transferRate, this.inventory, 0); + } + else if (ConfigRegistry.TRANSFER_NODES_DIMENSIONAL.get()) { + moved = moveItemsDimensional(loc, this.transferRate, this.inventory, 0); + } } this.setLitProperty(moved); } diff --git a/src/main/java/com/lothrazar/cyclic/block/wireless/redstone/TileWirelessTransmit.java b/src/main/java/com/lothrazar/cyclic/block/wireless/redstone/TileWirelessTransmit.java index 6c7f488b0d..4b46208b84 100644 --- a/src/main/java/com/lothrazar/cyclic/block/wireless/redstone/TileWirelessTransmit.java +++ b/src/main/java/com/lothrazar/cyclic/block/wireless/redstone/TileWirelessTransmit.java @@ -96,14 +96,17 @@ private void toggleTarget(BlockPosDim dimPos) { if (serverLevel.getBlockEntity(targetPos) instanceof TileWirelessRec receiver) { //am I powered? if (isPowered) { + ModCyclic.LOGGER.info(" POWER UP target" + dimPos); receiver.putPowerSender(this.id); } else { + ModCyclic.LOGGER.info(" turn off target" + dimPos); receiver.removePowerSender(this.id); } } if (level.isLoaded(worldPosition) && level.getBlockState(worldPosition).getBlock() == this.getBlockState().getBlock()) { level.setBlockAndUpdate(worldPosition, level.getBlockState(worldPosition).setValue(BlockStateProperties.POWERED, isPowered)); + // world.setBlockState(pos, world.getBlockState(pos).with(BlockStateProperties.POWERED, isPowered)); } } diff --git a/src/main/java/com/lothrazar/cyclic/compat/CompatConstants.java b/src/main/java/com/lothrazar/cyclic/compat/CompatConstants.java index d2ff8fdde3..94876f901a 100644 --- a/src/main/java/com/lothrazar/cyclic/compat/CompatConstants.java +++ b/src/main/java/com/lothrazar/cyclic/compat/CompatConstants.java @@ -1,4 +1,5 @@ package com.lothrazar.cyclic.compat; + public class CompatConstants { public static final String RESYNTH_GROWTH_STAGE = "growth_stage"; @@ -6,4 +7,6 @@ public class CompatConstants { public static final String CRAFTTWEAKER = "crafttweaker"; public static final String CURIOS = "curios"; public static final String TCONSTRUCT = "tconstruct"; + public static final String RS_MODID = "repurposed_structures"; + public static final String YUSTRONG_MODID = "betterstrongholds"; } diff --git a/src/main/java/com/lothrazar/cyclic/compat/botania/BotaniaWrapper.java b/src/main/java/com/lothrazar/cyclic/compat/botania/BotaniaWrapper.java index ab2ed11cd7..59a8226788 100644 --- a/src/main/java/com/lothrazar/cyclic/compat/botania/BotaniaWrapper.java +++ b/src/main/java/com/lothrazar/cyclic/compat/botania/BotaniaWrapper.java @@ -1,18 +1,23 @@ package com.lothrazar.cyclic.compat.botania; import net.minecraft.world.entity.LivingEntity; -//import vazkii.botania.api.BotaniaAPI; +import net.minecraftforge.fml.ModList; public class BotaniaWrapper { + /** + * If the botania mod is loaded, use the botania-api to check for hasSolegnoliaAround(entity); otherwise return false + * + * @param entity + * @return true if botania has found a solegnolia around the entity + */ public static boolean hasSolegnoliaAround(LivingEntity entity) { try { - // return ModList.get().isLoaded("botania") && BotaniaAPI.instance().hasSolegnoliaAround(entity); + if (ModList.get().isLoaded("botania")) { + return vazkii.botania.api.BotaniaAPI.instance().hasSolegnoliaAround(entity); + } } - catch (Exception e) { - //ive never seen an exception here yet, just being safe - } - //either botania does not exist or an error was thrown + catch (Exception e) {} return false; } } diff --git a/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/CrusherZen.java b/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/CrusherZen.java new file mode 100644 index 0000000000..242d4e851f --- /dev/null +++ b/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/CrusherZen.java @@ -0,0 +1,52 @@ +package com.lothrazar.cyclic.compat.crafttweaker; + +import java.util.Arrays; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.openzen.zencode.java.ZenCodeType; +import com.blamejared.crafttweaker.api.CraftTweakerAPI; +import com.blamejared.crafttweaker.api.action.recipe.ActionAddRecipe; +import com.blamejared.crafttweaker.api.annotation.ZenRegister; +import com.blamejared.crafttweaker.api.ingredient.IIngredient; +import com.blamejared.crafttweaker.api.item.IItemStack; +import com.blamejared.crafttweaker.api.recipe.manager.base.IRecipeManager; +import com.lothrazar.cyclic.block.crusher.RecipeCrusher; +import com.lothrazar.cyclic.compat.CompatConstants; +import com.lothrazar.cyclic.recipe.ingredient.EnergyIngredient; +import com.lothrazar.cyclic.recipe.ingredient.RandomizedOutputIngredient; +import com.lothrazar.cyclic.registry.CyclicRecipeType; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.RecipeType; + +@ZenRegister +@ZenCodeType.Name("mods.cyclic.crusher") +public class CrusherZen implements IRecipeManager { + + private final Logger logger = LogManager.getLogger(); + + @Override + public RecipeType getRecipeType() { + return CyclicRecipeType.CRUSHER.get(); + } + + @ZenCodeType.Method + public void addRecipe(String name, IIngredient input, IItemStack output, int rfPertick, int ticks) { + addRecipe(name, input, output, rfPertick, ticks, null, 0); + } + + @ZenCodeType.Method + public void addRecipe(String name, IIngredient input, IItemStack output, int rfPertick, int ticks, IItemStack bonus, int percentage) { + name = fixRecipeName(name); + RecipeCrusher m = new RecipeCrusher(new ResourceLocation(CompatConstants.CRAFTTWEAKER, name), input.asVanillaIngredient(), new EnergyIngredient(rfPertick, ticks), output.getInternal(), + new RandomizedOutputIngredient(percentage, (bonus == null) ? ItemStack.EMPTY : bonus.getInternal())); + CraftTweakerAPI.apply(new ActionAddRecipe(this, m, "")); + logger.debug("Recipe loaded " + m.getId().toString()); + } + + @ZenCodeType.Method + public void removeRecipe(String... names) { + removeByName(names); + logger.debug("Recipe removed " + Arrays.toString(names)); + } +} diff --git a/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/EnergyFluidZen.java b/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/EnergyFluidZen.java new file mode 100644 index 0000000000..15a82d4923 --- /dev/null +++ b/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/EnergyFluidZen.java @@ -0,0 +1,56 @@ +package com.lothrazar.cyclic.compat.crafttweaker; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.openzen.zencode.java.ZenCodeType; +import com.blamejared.crafttweaker.api.CraftTweakerAPI; +import com.blamejared.crafttweaker.api.action.recipe.ActionAddRecipe; +import com.blamejared.crafttweaker.api.annotation.ZenRegister; +import com.blamejared.crafttweaker.api.fluid.IFluidStack; +import com.blamejared.crafttweaker.api.recipe.manager.base.IRecipeManager; +import com.lothrazar.cyclic.block.generatorfluid.RecipeGeneratorFluid; +import com.lothrazar.cyclic.compat.CompatConstants; +import com.lothrazar.cyclic.recipe.ingredient.EnergyIngredient; +import com.lothrazar.cyclic.recipe.ingredient.FluidTagIngredient; +import com.lothrazar.cyclic.registry.CyclicRecipeType; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraftforge.fluids.FluidStack; + +@ZenRegister +@ZenCodeType.Name("mods.cyclic.generator_fluid") +public class EnergyFluidZen implements IRecipeManager { + + private final Logger logger = LogManager.getLogger(); + + @Override + public RecipeType getRecipeType() { + return CyclicRecipeType.GENERATOR_FLUID.get(); + } + + @ZenCodeType.Method + public void addRecipe(String name, IFluidStack fluid, int rfPertick, int ticks) { + name = fixRecipeName(name); + RecipeGeneratorFluid m = new RecipeGeneratorFluid(new ResourceLocation(CompatConstants.CRAFTTWEAKER, name), + new FluidTagIngredient(new FluidStack(fluid.getFluid(), 1), "", fluid.getAmount()), + new EnergyIngredient(rfPertick, ticks)); + CraftTweakerAPI.apply(new ActionAddRecipe(this, m, "")); + logger.debug("Recipe loaded " + m.getId().toString()); + } + + @ZenCodeType.Method + public void addRecipe(String name, String fluidTag, int amount, int rfPertick, int ticks) { + name = fixRecipeName(name); + RecipeGeneratorFluid m = new RecipeGeneratorFluid(new ResourceLocation(CompatConstants.CRAFTTWEAKER, name), + new FluidTagIngredient(null, fluidTag, amount), + new EnergyIngredient(rfPertick, ticks)); + CraftTweakerAPI.apply(new ActionAddRecipe(this, m, "")); + logger.debug("Recipe (tag %s) loaded " + m.getId().toString(), fluidTag); + } + + @ZenCodeType.Method + public void removeRecipe(String... names) { + removeByName(names); + logger.debug("Recipe removed " + names); + } +} diff --git a/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/EnergyItemZen.java b/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/EnergyItemZen.java new file mode 100644 index 0000000000..761d94651d --- /dev/null +++ b/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/EnergyItemZen.java @@ -0,0 +1,42 @@ +package com.lothrazar.cyclic.compat.crafttweaker; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.openzen.zencode.java.ZenCodeType; +import com.blamejared.crafttweaker.api.CraftTweakerAPI; +import com.blamejared.crafttweaker.api.action.recipe.ActionAddRecipe; +import com.blamejared.crafttweaker.api.annotation.ZenRegister; +import com.blamejared.crafttweaker.api.ingredient.IIngredient; +import com.blamejared.crafttweaker.api.recipe.manager.base.IRecipeManager; +import com.lothrazar.cyclic.block.generatoritem.RecipeGeneratorItem; +import com.lothrazar.cyclic.compat.CompatConstants; +import com.lothrazar.cyclic.recipe.ingredient.EnergyIngredient; +import com.lothrazar.cyclic.registry.CyclicRecipeType; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.RecipeType; + +@ZenRegister +@ZenCodeType.Name("mods.cyclic.generator_item") +public class EnergyItemZen implements IRecipeManager { + + private final Logger logger = LogManager.getLogger(); + + @Override + public RecipeType getRecipeType() { + return CyclicRecipeType.GENERATOR_ITEM.get(); + } + + @ZenCodeType.Method + public void addRecipe(String name, IIngredient input, int rfPertick, int ticks) { + name = fixRecipeName(name); + RecipeGeneratorItem m = new RecipeGeneratorItem(new ResourceLocation(CompatConstants.CRAFTTWEAKER, name), input.asVanillaIngredient(), new EnergyIngredient(rfPertick, ticks)); + CraftTweakerAPI.apply(new ActionAddRecipe(this, m, "")); + logger.debug("Recipe loaded " + m.getId().toString()); + } + + @ZenCodeType.Method + public void removeRecipe(String... names) { + removeByName(names); + logger.debug("Recipe removed " + names); + } +} diff --git a/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/MelterManager.java b/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/MelterManager.java deleted file mode 100644 index d1b8f06cec..0000000000 --- a/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/MelterManager.java +++ /dev/null @@ -1,44 +0,0 @@ -//package com.lothrazar.cyclic.compat.crafttweaker; -// -//import com.blamejared.crafttweaker.api.CraftTweakerAPI; -//import com.blamejared.crafttweaker.api.annotations.ZenRegister; -//import com.blamejared.crafttweaker.api.fluid.IFluidStack; -//import com.blamejared.crafttweaker.api.item.IIngredient; -//import com.blamejared.crafttweaker.api.managers.IRecipeManager; -//import com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe; -//import com.lothrazar.cyclic.ModCyclic; -//import com.lothrazar.cyclic.block.melter.RecipeMelter; -//import com.lothrazar.cyclic.compat.CompatConstants; -//import com.lothrazar.cyclic.recipe.CyclicRecipeType; -//import net.minecraft.world.item.crafting.RecipeType; -//import net.minecraft.resources.ResourceLocation; -//import net.minecraftforge.fluids.FluidStack; -//import org.openzen.zencode.java.ZenCodeType; -// -//@SuppressWarnings("rawtypes") -//@ZenRegister -//@ZenCodeType.Name("mods.cyclic.melter") -//public class MelterManager implements IRecipeManager { -// -// @Override -// public RecipeType getRecipeType() { -// return CyclicRecipeType.MELTER; -// } -// -// @ZenCodeType.Method -// public void addRecipe(String name, IIngredient inputFirst, IIngredient inputSecond, IFluidStack fluidStack) { -// name = fixRecipeName(name); -// RecipeMelter m = new RecipeMelter(new ResourceLocation(CompatConstants.CRAFTTWEAKER, name), -// inputFirst.asVanillaIngredient(), -// inputSecond.asVanillaIngredient(), -// new FluidStack(fluidStack.getFluid(), fluidStack.getAmount())); -// CraftTweakerAPI.apply(new ActionAddRecipe(this, m, "")); -// ModCyclic.LOGGER.info("CRAFT TWEAKER: Recipe loaded " + m.getId().toString()); -// } -// -// @ZenCodeType.Method -// public void removeRecipe(String name) { -// removeByName(name); -// ModCyclic.LOGGER.info("CRAFT TWEAKER: Recipe removed " + name); -// } -//} diff --git a/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/MelterZen.java b/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/MelterZen.java new file mode 100644 index 0000000000..c71b22d6a3 --- /dev/null +++ b/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/MelterZen.java @@ -0,0 +1,52 @@ +package com.lothrazar.cyclic.compat.crafttweaker; + +import java.util.Arrays; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.openzen.zencode.java.ZenCodeType; +import com.blamejared.crafttweaker.api.CraftTweakerAPI; +import com.blamejared.crafttweaker.api.action.recipe.ActionAddRecipe; +import com.blamejared.crafttweaker.api.annotation.ZenRegister; +import com.blamejared.crafttweaker.api.fluid.IFluidStack; +import com.blamejared.crafttweaker.api.ingredient.IIngredient; +import com.blamejared.crafttweaker.api.recipe.manager.base.IRecipeManager; +import com.lothrazar.cyclic.block.melter.RecipeMelter; +import com.lothrazar.cyclic.compat.CompatConstants; +import com.lothrazar.cyclic.recipe.ingredient.EnergyIngredient; +import com.lothrazar.cyclic.registry.CyclicRecipeType; +import net.minecraft.core.NonNullList; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraftforge.fluids.FluidStack; + +@ZenRegister +@ZenCodeType.Name("mods.cyclic.melter") +public class MelterZen implements IRecipeManager { + + private final Logger logger = LogManager.getLogger(); + + @Override + public RecipeType getRecipeType() { + return CyclicRecipeType.MELTER.get(); + } + + @ZenCodeType.Method + public void addRecipe(String name, IIngredient[] input, IFluidStack fluidStack, int rfPertick, int ticks) { + name = fixRecipeName(name); + NonNullList list = NonNullList.withSize(input.length, Ingredient.EMPTY); + for (int i = 0; i < input.length; i++) { + list.set(i, input[i].asVanillaIngredient()); + } + RecipeMelter m = new RecipeMelter(new ResourceLocation(CompatConstants.CRAFTTWEAKER, name), list, + new FluidStack(fluidStack.getFluid(), fluidStack.getAmount()), new EnergyIngredient(rfPertick, ticks)); + CraftTweakerAPI.apply(new ActionAddRecipe(this, m, "")); + logger.debug("Recipe loaded " + m.getId().toString()); + } + + @ZenCodeType.Method + public void removeRecipe(String... names) { + removeByName(names); + logger.debug("Recipe removed " + Arrays.toString(names)); + } +} diff --git a/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/SolidManager.java b/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/SolidManager.java deleted file mode 100644 index 0174c6db92..0000000000 --- a/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/SolidManager.java +++ /dev/null @@ -1,106 +0,0 @@ -//<<<<<<< HEAD -////package com.lothrazar.cyclic.compat.crafttweaker; -//// -////import com.blamejared.crafttweaker.api.CraftTweakerAPI; -////import com.blamejared.crafttweaker.api.annotations.ZenRegister; -////import com.blamejared.crafttweaker.api.fluid.IFluidStack; -////import com.blamejared.crafttweaker.api.item.IIngredient; -////import com.blamejared.crafttweaker.api.item.IItemStack; -////import com.blamejared.crafttweaker.api.managers.IRecipeManager; -////import com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe; -////import com.lothrazar.cyclic.ModCyclic; -////import com.lothrazar.cyclic.block.solidifier.RecipeSolidifier; -////import com.lothrazar.cyclic.compat.CompatConstants; -////import com.lothrazar.cyclic.recipe.CyclicRecipeType; -////import net.minecraft.world.item.crafting.RecipeType; -////import net.minecraft.resources.ResourceLocation; -////import net.minecraftforge.fluids.FluidStack; -////import org.openzen.zencode.java.ZenCodeType; -//// -////@SuppressWarnings("rawtypes") -////@ZenRegister -////@ZenCodeType.Name("mods.cyclic.solidifier") -////public class SolidManager implements IRecipeManager { -//// -//// @Override -//// public RecipeType getRecipeType() { -//// return CyclicRecipeType.SOLID; -//// } -//// -//// @ZenCodeType.Method -//// public void addRecipe(String name, IIngredient inputFirst, IIngredient inputSecond, IIngredient inputThird, -//// IFluidStack f, IItemStack output) { -//// name = fixRecipeName(name); -//// if (output.getInternal().isEmpty()) { -//// throw new IllegalArgumentException("Output cannot be empty!"); -//// } -//// RecipeSolidifier m = new RecipeSolidifier(new ResourceLocation(CompatConstants.CRAFTTWEAKER, name), -//// inputFirst.asVanillaIngredient(), -//// inputSecond.asVanillaIngredient(), -//// inputThird.asVanillaIngredient(), -//// new FluidStack(f.getFluid(), f.getAmount()), -//// output.getInternal()); -//// CraftTweakerAPI.apply(new ActionAddRecipe(this, m, "")); -//// ModCyclic.LOGGER.info("CRAFT TWEAKER: Recipe loaded " + m.getId().toString()); -//// } -//// -//// @ZenCodeType.Method -//// public void removeRecipe(String name) { -//// removeByName(name); -//// ModCyclic.LOGGER.info("CRAFT TWEAKER: Recipe removed " + name); -//// } -////} -//======= -//package com.lothrazar.cyclic.compat.crafttweaker; -// -//import com.blamejared.crafttweaker.api.CraftTweakerAPI; -//import com.blamejared.crafttweaker.api.annotations.ZenRegister; -//import com.blamejared.crafttweaker.api.fluid.IFluidStack; -//import com.blamejared.crafttweaker.api.item.IIngredient; -//import com.blamejared.crafttweaker.api.item.IItemStack; -//import com.blamejared.crafttweaker.api.managers.IRecipeManager; -//import com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe; -//import com.lothrazar.cyclic.ModCyclic; -//import com.lothrazar.cyclic.block.solidifier.RecipeSolidifier; -//import com.lothrazar.cyclic.compat.CompatConstants; -//import com.lothrazar.cyclic.recipe.CyclicRecipeType; -//import com.lothrazar.cyclic.recipe.FluidTagIngredient; -//import net.minecraft.item.crafting.IRecipeType; -//import net.minecraft.util.ResourceLocation; -//import net.minecraftforge.fluids.FluidStack; -//import org.openzen.zencode.java.ZenCodeType; -// -//@SuppressWarnings("rawtypes") -//@ZenRegister -//@ZenCodeType.Name("mods.cyclic.solidifier") -//public class SolidManager implements IRecipeManager { -// -// @Override -// public IRecipeType getRecipeType() { -// return CyclicRecipeType.SOLID; -// } -// -// @ZenCodeType.Method -// public void addRecipe(String name, IIngredient inputFirst, IIngredient inputSecond, IIngredient inputThird, -// IFluidStack f, IItemStack output) { -// name = fixRecipeName(name); -// if (output.getInternal().isEmpty()) { -// throw new IllegalArgumentException("Output cannot be empty!"); -// } -// RecipeSolidifier m = new RecipeSolidifier(new ResourceLocation(CompatConstants.CRAFTTWEAKER, name), -// inputFirst.asVanillaIngredient(), -// inputSecond.asVanillaIngredient(), -// inputThird.asVanillaIngredient(), -// new FluidTagIngredient(new FluidStack(f.getFluid(), f.getAmount()), "", f.getAmount()), -// output.getInternal()); -// CraftTweakerAPI.apply(new ActionAddRecipe(this, m, "")); -// ModCyclic.LOGGER.info("CRAFT TWEAKER: Recipe loaded " + m.getId().toString()); -// } -// -// @ZenCodeType.Method -// public void removeRecipe(String name) { -// removeByName(name); -// ModCyclic.LOGGER.info("CRAFT TWEAKER: Recipe removed " + name); -// } -//} -//>>>>>>> 9f4791a4f5c1dbc36e417a790d13312fb60c6528 diff --git a/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/SolidifierZen.java b/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/SolidifierZen.java new file mode 100644 index 0000000000..73d3e2bd20 --- /dev/null +++ b/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/SolidifierZen.java @@ -0,0 +1,82 @@ +package com.lothrazar.cyclic.compat.crafttweaker; + +import java.util.Arrays; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.openzen.zencode.java.ZenCodeType; +import com.blamejared.crafttweaker.api.CraftTweakerAPI; +import com.blamejared.crafttweaker.api.action.recipe.ActionAddRecipe; +import com.blamejared.crafttweaker.api.annotation.ZenRegister; +import com.blamejared.crafttweaker.api.fluid.IFluidStack; +import com.blamejared.crafttweaker.api.ingredient.IIngredient; +import com.blamejared.crafttweaker.api.item.IItemStack; +import com.blamejared.crafttweaker.api.recipe.manager.base.IRecipeManager; +import com.lothrazar.cyclic.block.solidifier.RecipeSolidifier; +import com.lothrazar.cyclic.compat.CompatConstants; +import com.lothrazar.cyclic.recipe.ingredient.EnergyIngredient; +import com.lothrazar.cyclic.recipe.ingredient.FluidTagIngredient; +import com.lothrazar.cyclic.registry.CyclicRecipeType; +import net.minecraft.core.NonNullList; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraftforge.fluids.FluidStack; + +@ZenRegister +@ZenCodeType.Name("mods.cyclic.solidifier") +public class SolidifierZen implements IRecipeManager { + + private final Logger logger = LogManager.getLogger(); + + @Override + public RecipeType getRecipeType() { + return CyclicRecipeType.SOLID.get(); + } + + @ZenCodeType.Method + public void addRecipe(String name, IIngredient[] input, IFluidStack fluid, IItemStack output, int rfPertick, int ticks) { + name = fixRecipeName(name); + if (output.isEmpty()) { + throw new IllegalArgumentException("Output cannot be empty!"); + } + NonNullList list = NonNullList.withSize(input.length, Ingredient.EMPTY); + for (int i = 0; i < input.length; i++) { + list.set(i, input[i].asVanillaIngredient()); + } + RecipeSolidifier recipe = new RecipeSolidifier(new ResourceLocation(CompatConstants.CRAFTTWEAKER, name), + list, + new FluidTagIngredient(new FluidStack(fluid.getFluid(), 1), "", (int) fluid.getAmount()), + output.getInternal(), + new EnergyIngredient(rfPertick, ticks)); + CraftTweakerAPI.apply(new ActionAddRecipe(this, recipe, "")); + logger.debug("Recipe loaded " + recipe.getId().toString()); + } + + @ZenCodeType.Method + public void addRecipe(String name, IIngredient[] input, String fluidTag, int fluidQuantity, IItemStack output, int rfPertick, int ticks) { + name = fixRecipeName(name); + if (output.isEmpty()) { + throw new IllegalArgumentException("Output cannot be empty!"); + } + NonNullList list = NonNullList.withSize(input.length, Ingredient.EMPTY); + for (int i = 0; i < input.length; i++) { + list.set(i, input[i].asVanillaIngredient()); + } + //because CT doesnt have a fluid tag ingredient type really and it could come in foramt + //but the FluidTagIngredient just uses teh raw string, parse it out + fluidTag = fluidTag.replace("<", "").replace(">", "").replace("fluid:", ""); + RecipeSolidifier recipe = new RecipeSolidifier(new ResourceLocation(CompatConstants.CRAFTTWEAKER, name), + list, + new FluidTagIngredient(null, fluidTag, fluidQuantity), // TAG of fluid instead of actual fluid. + output.getInternal(), + new EnergyIngredient(rfPertick, ticks)); + CraftTweakerAPI.apply(new ActionAddRecipe(this, recipe, "")); + logger.debug("Recipe (tag %s) loaded " + recipe.getId().toString(), fluidTag); + } + + @ZenCodeType.Method + public void removeRecipe(String... names) { + removeByName(names); + logger.debug("Recipe removed " + Arrays.toString(names)); + } +} \ No newline at end of file diff --git a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java index a8843dcfca..9b81423b47 100644 --- a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java @@ -46,6 +46,7 @@ import com.lothrazar.cyclic.block.spawntriggers.BlockAltarNoTraders; import com.lothrazar.cyclic.block.spawntriggers.CandlePeaceBlock; 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.tp.BlockTeleport; import com.lothrazar.cyclic.block.uncrafter.TileUncraft; @@ -98,6 +99,7 @@ import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; import net.minecraftforge.common.ForgeConfigSpec.ConfigValue; +import net.minecraftforge.common.ForgeConfigSpec.IntValue; import net.minecraftforge.fml.loading.FMLPaths; public class ConfigRegistry { @@ -105,7 +107,7 @@ public class ConfigRegistry { private static final ForgeConfigSpec.Builder CFG = new ForgeConfigSpec.Builder(); private static final ForgeConfigSpec.Builder CFGC = new ForgeConfigSpec.Builder(); private static ForgeConfigSpec COMMON_CONFIG; - private static ForgeConfigSpec CLIENT_CONFIG; + private static ForgeConfigSpec CLIENT_CONFIG;//<<<<<< BEHEADING = new ArrayList<>(); private static final List IGNORE_LIST_UNCRAFTER = new ArrayList<>(); @@ -117,10 +119,13 @@ public class ConfigRegistry { private static ConfigValue> BEHEADING_SKINS; private static ConfigValue> MBALL_IGNORE_LIST; private static ConfigValue> DISARM_IGNORE_LIST; + public static ConfigValue> GLOOM_IGNORE_LIST; private static final String WALL = "####################################################################################"; public static BooleanValue OVERRIDE_TRANSPORTER_SINGLETON; public static BooleanValue GENERATE_FLOWERS; public static BooleanValue CYAN_PODZOL_LEGACY; + public static BooleanValue TRANSFER_NODES_DIMENSIONAL; + public static IntValue SOUND_RADIUS; static { buildDefaults(); initConfig(); @@ -258,10 +263,11 @@ private static void initConfig() { AutoSmeltEnchant.CFG = CFG.comment("Set false to disable enchantment").define(AutoSmeltEnchant.ID + ".enabled", true); BeekeeperEnchant.CFG = CFG.comment("Set false to disable enchantment").define(BeekeeperEnchant.ID + ".enabled", true); BeheadingEnchant.CFG = CFG.comment("Set false to disable enchantment").define(BeheadingEnchant.ID + ".enabled", true); + GLOOM_IGNORE_LIST = CFG.comment("Set list of effects for Gloom enchant (cyclic:curse) to ignore and not use these") + .defineList("gloom.ignored", Arrays.asList("minecraft:bad_omen", "minecraft:nausea", "botania:clear"), + it -> it instanceof String); BEHEADING_SKINS = CFG.comment("Beheading enchant add player skin head drop, add any mob id and any skin") .defineList(BeheadingEnchant.ID + ".EntityMHF", BEHEADING, it -> it instanceof String); - // BeheadingEnchant.PERCENTDROP = CFG.comment("Initial level drop rate. So level I of enchant gives this % drop chance").defineInRange("beheadingDrop", 20, 1, 100); - // BeheadingEnchant.PERCENTPERLEVEL = CFG.comment("Enchant level increase drop rate. % = beheadingDrop + (level-1)*beheadingPerLevel").defineInRange("beheadingPerLevel", 25, 1, 100); BeheadingEnchant.PERCDROP = CFG.comment("Base perecentage chance to drop a head on kill").defineInRange(BeheadingEnchant.ID + ".percent", 20, 1, 99); BeheadingEnchant.PERCPERLEVEL = CFG.comment("Percentage increase per level of enchant. Formula [percent + (level - 1) * per_level] ").defineInRange(BeheadingEnchant.ID + ".per_level", 25, 1, 99); GrowthEnchant.RADIUSFACTOR = CFG.comment("Radius per level. size around player to perform growth logic").defineInRange("growth.radius", 2, 1, 16); @@ -285,7 +291,6 @@ private static void initConfig() { TravellerEnchant.CFG = CFG.comment("Set false to disable enchantment").define(TravellerEnchant.ID + ".enabled", true); VenomEnchant.CFG = CFG.comment("Set false to disable enchantment").define(VenomEnchant.ID + ".enabled", true); XpEnchant.CFG = CFG.comment("Set false to disable enchantment").define(XpEnchant.ID + ".enabled", true); - // DisarmEnchant.CFG = CFG.comment("Set false to disable enchantment").define(EnchantDisarm.ID, true); DisarmEnchant.PERCENTPERLEVEL = CFG.comment("Enchant level drop rate. % = drop + (level-1)*drop").defineInRange(DisarmEnchant.ID + ".percentPerLevel", 15, 1, 100); DISARM_IGNORE_LIST = CFG.comment("Mobs in this list cannot be disarmed and have their weapon stolen by the disarm enchantment") .defineList(DisarmEnchant.ID + ".ingoredMobs", DISARM_IGNORE, @@ -311,7 +316,7 @@ private static void initConfig() { CFG.comment(WALL, " Logging related configs", WALL) .push("logging"); CyclicLogger.LOGINFO = CFG.comment("Unblock info logs; very spammy; can be useful for testing certain issues").define("info", false); - CFG.pop(); //logging + CFG.pop(); //logging CFG.comment(WALL, " Item specific configs", WALL).push("items"); // CFG.comment(WALL, " scythe_brush settings. note radius is halved while player is sneaking", WALL).push("scythe_brush"); @@ -397,7 +402,7 @@ private static void initConfig() { HeartToxicItem.HEARTXPMINUS = CFG.comment("Experience given when eating a poisoned heart").defineInRange("experience", 500, 0, 99999); HeartItem.MAX = CFG.comment("Maximum number of hearts that can be attained (including initial 10)").defineInRange("maximum", 100, 1, 200); CFG.pop(); //heart - CFG.pop(); //items + CFG.pop(); //items CFG.comment(WALL, " Block specific configs", WALL).push("blocks"); //////////////////////////////////////////////////////////////////////////////////// blocks //buffer size for cables SoundmufflerBlock.RADIUS = CFG.comment("Radius to find and muffle sounds. ") @@ -468,25 +473,41 @@ private static void initConfig() { TileDisenchant.FLUIDCOST = CFG.comment("Cost of (or payment for if negative) per enchanted book generated").defineInRange("fluid_cost", 100, -1000, 16000); TileDisenchant.POWERCONF = CFG.comment("Power per use disenchanter").defineInRange("energy_cost", 2500, 0, 64000); CFG.pop(); - CFG.push("terra_preta"); - TileTerraPreta.TIMER_FULL = CFG.comment("Growth interval in ticks (100 would be every 5 seconds). Also affects terra glass").defineInRange("growth_interval", 100, 1, 64000); - TileTerraPreta.CHANCE = CFG.comment("Chance that the crop will grow after the interval").defineInRange("growth_chance", 0.5, 0, 1); - CFG.pop(); CFG.push("anvil_void"); TileAnvilVoid.FLUIDPAY = CFG.comment("Payment per void action, if not zero").defineInRange("fluid_cost", 25, 0, 16000); CFG.pop(); CFG.push("sound"); + CFG.comment(WALL, " Block specific configs", WALL) + .push("blocks"); + TRANSFER_NODES_DIMENSIONAL = CFG.comment(" 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.") + .define("wireless_transfer_dimensional", true); + CFG.comment("Ender shelf settings").push("sound"); BlockSoundRecorder.RADIUS = CFG.comment("Sound Recorder - how far out does it listen to record sounds").defineInRange("radius", 8, 1, 64); CFG.pop(); CFG.push("ender_shelf"); EnderShelfItemHandler.BOOKS_PER_ROW = CFG.comment("Each shelf has five rows. Set the number of books stored per row here").defineInRange("books_per_row", 256, 1, 1024); EnderShelfHelper.MAX_DIST = CFG.comment("Controller Max distance to search (using manhattan distance)").defineInRange("controller_distance", 64, 1, 256); CFG.pop(); // ender_shelf*6 + CFG.comment("soundproofing settings").push("soundproofing"); //soundproofing + SOUND_RADIUS = CFG.comment("Radius of sound proofing (distance from each block that it will listen)").defineInRange("radius", 6, 1, 16); + CFG.pop(); //soundproofing CFG.comment("Sprinkler settings").push("sprinkler"); TileSprinkler.RADIUS = CFG.comment("Radius").defineInRange("radius", 4, 1, 32); 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.push("terra_preta"); + TileTerraPreta.TIMER_FULL = CFG.comment("Growth interval in ticks (100 would be every 5 seconds). ").defineInRange("growth_interval", 100, 1, 64000); + TileTerraPreta.CHANCE = CFG.comment("Chance that the crop will grow after the interval").defineInRange("growth_chance", 0.5, 0, 1); + 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); @@ -596,6 +617,11 @@ public static List getDisarmIgnoreList() { return (List) DISARM_IGNORE_LIST.get(); } + @SuppressWarnings("unchecked") + public static List getGloomIgnoreList() { + return (List) GLOOM_IGNORE_LIST.get(); + } + public static Map getMappedBeheading() { Map mappedBeheading = new HashMap(); for (String s : BEHEADING_SKINS.get()) { diff --git a/src/main/java/com/lothrazar/cyclic/data/BlockPosDim.java b/src/main/java/com/lothrazar/cyclic/data/BlockPosDim.java index 7c3ada86a9..99e082435c 100644 --- a/src/main/java/com/lothrazar/cyclic/data/BlockPosDim.java +++ b/src/main/java/com/lothrazar/cyclic/data/BlockPosDim.java @@ -6,6 +6,7 @@ import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; +import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; @@ -79,7 +80,11 @@ public ServerLevel getTargetLevel(Level world) { if (world == null || world.getServer() == null || dimension == null) { return null; } - return world.getServer().getLevel(LevelWorldUtil.stringToDimension(getDimension())); + return getServerLevel(world.getServer()); + } + + public ServerLevel getServerLevel(MinecraftServer server) { + return server.getLevel(LevelWorldUtil.stringToDimension(this.getDimension())); } public double getZ() { diff --git a/src/main/java/com/lothrazar/cyclic/data/DataTags.java b/src/main/java/com/lothrazar/cyclic/data/DataTags.java index c653747806..4d41755779 100644 --- a/src/main/java/com/lothrazar/cyclic/data/DataTags.java +++ b/src/main/java/com/lothrazar/cyclic/data/DataTags.java @@ -35,6 +35,7 @@ public class DataTags { public static final TagKey IMUSHROOMS = ItemTags.create(new ResourceLocation("forge:mushrooms")); public static final TagKey IVINES = ItemTags.create(new ResourceLocation("forge:vines")); public static final TagKey ICACTUS = ItemTags.create(new ResourceLocation("forge:cactus")); + public static final TagKey EXCAVATE_IGNORED = BlockTags.create(new ResourceLocation("cyclic:ignored/excavate")); public static void setup() { // do not delete:! this makes the mod get classloaded so the wrapper tags correctly get added to the registry early, before recipe testing diff --git a/src/main/java/com/lothrazar/cyclic/enchant/ExcavationEnchant.java b/src/main/java/com/lothrazar/cyclic/enchant/ExcavationEnchant.java index 794fb398e1..8d41ccf1fa 100644 --- a/src/main/java/com/lothrazar/cyclic/enchant/ExcavationEnchant.java +++ b/src/main/java/com/lothrazar/cyclic/enchant/ExcavationEnchant.java @@ -28,6 +28,8 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import com.lothrazar.cyclic.ModCyclic; +import com.lothrazar.cyclic.data.DataTags; import com.lothrazar.cyclic.registry.EnchantRegistry; import com.lothrazar.cyclic.util.ItemStackUtil; import net.minecraft.core.BlockPos; @@ -46,6 +48,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; +import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.Tags; import net.minecraftforge.event.ForgeEventFactory; @@ -57,6 +60,7 @@ public class ExcavationEnchant extends EnchantmentCyclic { public static final String ID = "excavate"; public static BooleanValue CFG; + public static boolean effectiveToolRequired = true; // non-config lets hardcode this actually public ExcavationEnchant(Rarity rarityIn, EnchantmentCategory typeIn, EquipmentSlot... slots) { super(rarityIn, typeIn, slots); @@ -126,7 +130,14 @@ public void onBreakEvent(BreakEvent event) { if (level <= 0) { return; } - //if (ForgeHooks.canHarvestBlock(eventState, player, world, pos)) { + if (effectiveToolRequired && !ForgeHooks.isCorrectToolForDrops(eventState, player)) { + ModCyclic.LOGGER.info("excavate trigger cancelled; tool not effective"); + return; + } + if (eventState.is(DataTags.EXCAVATE_IGNORED)) { + ModCyclic.LOGGER.info("excavate trigger cancelled; see blocktag " + DataTags.EXCAVATE_IGNORED.toString()); + return; + } if (ForgeEventFactory.doPlayerHarvestCheck(player, eventState, true)) { int harvested = this.harvestSurrounding((Level) world, player, pos, block, 1, level, player.swingingArm); if (harvested > 0) { diff --git a/src/main/java/com/lothrazar/cyclic/enchant/GloomCurseEnchant.java b/src/main/java/com/lothrazar/cyclic/enchant/GloomCurseEnchant.java index 25379e0353..1f4e782247 100644 --- a/src/main/java/com/lothrazar/cyclic/enchant/GloomCurseEnchant.java +++ b/src/main/java/com/lothrazar/cyclic/enchant/GloomCurseEnchant.java @@ -2,8 +2,11 @@ import java.util.Collections; import java.util.List; +import com.lothrazar.cyclic.ModCyclic; +import com.lothrazar.cyclic.config.ConfigRegistry; import com.lothrazar.cyclic.util.EnchantUtil; import com.lothrazar.cyclic.util.FakePlayerUtil; +import com.lothrazar.cyclic.util.StringParseUtil; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.Entity; @@ -91,6 +94,10 @@ public void doPostHurt(LivingEntity user, Entity attacker, int level) { continue; //should be impossible, but i had a random NPE crash log } + if (StringParseUtil.isInList(ConfigRegistry.getGloomIgnoreList(), effect.getRegistryName())) { + ModCyclic.LOGGER.info("Gloom(curse) effect cannot apply " + effect.getRegistryName()); + continue; + } if (appliedEffects < MIN_EFFECTS || BASE_APPLY_CHANCE > user.level.random.nextDouble()) { //the OR means, if we are under minimum, always go thru diff --git a/src/main/java/com/lothrazar/cyclic/enchant/GrowthEnchant.java b/src/main/java/com/lothrazar/cyclic/enchant/GrowthEnchant.java index 07c4a0d653..c220124682 100644 --- a/src/main/java/com/lothrazar/cyclic/enchant/GrowthEnchant.java +++ b/src/main/java/com/lothrazar/cyclic/enchant/GrowthEnchant.java @@ -25,10 +25,11 @@ import java.util.Collections; import java.util.List; -import com.lothrazar.cyclic.util.HarvestUtil; +import com.lothrazar.cyclic.util.GrowthUtil; import com.lothrazar.cyclic.util.ItemStackUtil; import com.lothrazar.cyclic.util.ShapeUtil; import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; @@ -36,9 +37,6 @@ import net.minecraft.world.item.HoeItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.enchantment.EnchantmentCategory; -import net.minecraft.world.level.block.CropBlock; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; import net.minecraftforge.common.ForgeConfigSpec.IntValue; import net.minecraftforge.common.MinecraftForge; @@ -47,7 +45,8 @@ public class GrowthEnchant extends EnchantmentCyclic { - public static final double ODDS_ROTATE = 0.04; + public static final int HEIGHT = 2; + public static final double ODDS = 0.04; public static final String ID = "growth"; public static BooleanValue CFG; public static IntValue RADIUSFACTOR; @@ -106,39 +105,20 @@ public void onEntityUpdate(LivingUpdateEvent event) { } //Ticking int level = getCurrentLevelTool(entity.getItemInHand(InteractionHand.MAIN_HAND)); - if (level > 0 && !entity.level.isClientSide) { - if (entity.level.random.nextDouble() > ODDS_ROTATE / level) { + if (level > 0 && entity.level instanceof ServerLevel sw) { + if (entity.level.random.nextDouble() > ODDS / level) { return; //slow the dice down } final int growthLimit = level * 2 + (entity.level.isRaining() ? 4 : 1); //faster when raining too int grown = 0; List shape = ShapeUtil.squareHorizontalFull(entity.blockPosition().below(), level + RADIUSFACTOR.get()); - shape = ShapeUtil.repeatShapeByHeight(shape, 2); + shape = ShapeUtil.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.level.getBlockState(pos); - if (target.getBlock() instanceof CropBlock igrowable) { // IGrowable gone, dont use BonemealableBlock - igrowable.growCrops(entity.level, pos, target); - grown++; // allow mods to override growCrops() for custom behavior - } - else { //still use same old age logic as always unchanged - IntegerProperty propAge = HarvestUtil.getAgeProp(target); - if (propAge == null) { - continue; - } - int maxAge = Collections.max(propAge.getPossibleValues()); - Integer currentAge = target.getValue(propAge); - if (currentAge < maxAge) { - if (entity.level.setBlockAndUpdate(pos, target.setValue(propAge, currentAge + 1))) { - grown++; - } - } - } + GrowthUtil.tryGrow(sw, shape.get(i), ODDS * 10); } if (grown > 0) { ItemStackUtil.damageItem(entity, entity.getItemInHand(InteractionHand.MAIN_HAND)); diff --git a/src/main/java/com/lothrazar/cyclic/event/EventRender.java b/src/main/java/com/lothrazar/cyclic/event/EventRender.java index d98754a3ba..f403065a45 100644 --- a/src/main/java/com/lothrazar/cyclic/event/EventRender.java +++ b/src/main/java/com/lothrazar/cyclic/event/EventRender.java @@ -113,6 +113,7 @@ public static void drawStack(ItemStack stack) { mc.getItemRenderer().renderAndDecorateItem(stack, width / 2, height / 2); } + ///////////////////// asdfasdf TODO REFACTOR THIS @SubscribeEvent public void onRenderWorldLast(RenderLevelLastEvent event) { Minecraft mc = Minecraft.getInstance(); @@ -151,7 +152,14 @@ public void onRenderWorldLast(RenderLevelLastEvent event) { } List coords = RandomizerItem.getPlaces(lookingAt.getBlockPos(), lookingAt.getDirection()); for (BlockPos e : coords) { - renderCubes.put(e, RandomizerItem.canMove(world.getBlockState(e), world, e) ? ClientConfigCyclic.getColor(stack) : Color.RED); + // renderCubes.put(e, RandomizerItem.canMove(world.getBlockState(e), world, e) ? ClientConfigCyclic.getColor(stack) : Color.RED); + BlockState stHere = world.getBlockState(e); + if (!RandomizerItem.canMove(stHere, world, e) && !stHere.isAir()) { + renderCubes.put(e, ClientConfigCyclic.getColor(stack)); + } + else if (!stHere.isAir()) { + RenderUtils.createBox(event.getPoseStack(), e); // see: RenderBlockUtils and event.getPoseStack() + } } } stack = OreProspector.getIfHeld(player); diff --git a/src/main/java/com/lothrazar/cyclic/event/PlayerAbilityEvents.java b/src/main/java/com/lothrazar/cyclic/event/PlayerAbilityEvents.java index b82ffbc96a..909f0b5739 100644 --- a/src/main/java/com/lothrazar/cyclic/event/PlayerAbilityEvents.java +++ b/src/main/java/com/lothrazar/cyclic/event/PlayerAbilityEvents.java @@ -15,7 +15,6 @@ public void onEntityUpdate(LivingUpdateEvent event) { if (event.getEntityLiving() instanceof Player player) { FireballItem.tickHoldingFireball(player); CyclicFile datFile = PlayerDataEvents.getOrCreate(player); - // tickFlying(player, datFile); tickSpec(player, datFile); } } @@ -33,19 +32,4 @@ else if (datFile.spectatorTicks <= DISABLE_OFFSET) { } datFile.spectatorTicks--; } - // private void tickFlying(Player player, CyclicFile datFile) { - // if (datFile.flyTicks <= 0) { - // datFile.flyTicks = 0; - // return; - // } - // if (datFile.flyTicks > DISABLE_OFFSET) { - // player.getAbilities().mayfly = true; - // } - // else if (datFile.flyTicks <= DISABLE_OFFSET) { - // player.getAbilities().mayfly = false; - // player.getAbilities().flying = false; - // player.fallDistance = 0.0F; - // } - // datFile.flyTicks--; - // } } diff --git a/src/main/java/com/lothrazar/cyclic/item/ender/EnderEyeReuseItem.java b/src/main/java/com/lothrazar/cyclic/item/ender/EnderEyeReuseItem.java index f4c355d236..7d59561de2 100644 --- a/src/main/java/com/lothrazar/cyclic/item/ender/EnderEyeReuseItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/ender/EnderEyeReuseItem.java @@ -32,7 +32,9 @@ public InteractionResultHolder use(Level worldIn, Player player, Inte ItemStack stack = player.getItemInHand(hand); if (!worldIn.isClientSide && worldIn instanceof ServerLevel) { ServerLevel sw = (ServerLevel) worldIn; - BlockPos closestBlockPos = sw.findNearestMapFeature(STRONGHOLD, player.blockPosition(), MAX_RANGE, false); + BlockPos closestBlockPos = null; + //modded strongholds, as long as they are tagged as a stronghold, will alos be found ie yungs, betterstrongholds, etc + closestBlockPos = sw.findNearestMapFeature(STRONGHOLD, player.blockPosition(), MAX_RANGE, false); if (closestBlockPos != null) { double posX = player.getX(); double posY = player.getY(); diff --git a/src/main/java/com/lothrazar/cyclic/item/equipment/GlowingHelmetItem.java b/src/main/java/com/lothrazar/cyclic/item/equipment/GlowingHelmetItem.java index 798b118fe4..9aedc1b0bc 100644 --- a/src/main/java/com/lothrazar/cyclic/item/equipment/GlowingHelmetItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/equipment/GlowingHelmetItem.java @@ -98,15 +98,9 @@ private static boolean isOnStatic(ItemStack held) { //from ItemEvents- curios slot public static void onEntityUpdate(LivingEvent.LivingUpdateEvent event) { //reduce check to only once per second instead of per tick - //<<<<<<< HEAD if (event.getEntity().level.getGameTime() % 20 == 0 && event.getEntityLiving() != null) { //some of the items need an off switch Player player = (Player) event.getEntityLiving(); - //======= - // if (event.getEntity().world.getGameTime() % 20 == 0 && - // event.getEntityLiving() instanceof PlayerEntity) { //some of the items need an off switch - // PlayerEntity player = (PlayerEntity) event.getEntityLiving(); - //>>>>>>> 9f4791a4f5c1dbc36e417a790d13312fb60c6528 checkIfHelmOff(player); // get helm ItemStack helm = CharmUtil.getCurio(player, ItemRegistry.GLOWING_HELMET.get()); diff --git a/src/main/java/com/lothrazar/cyclic/item/food/AppleBuffs.java b/src/main/java/com/lothrazar/cyclic/item/food/AppleBuffs.java index 58f10cc640..f7555c7cf6 100644 --- a/src/main/java/com/lothrazar/cyclic/item/food/AppleBuffs.java +++ b/src/main/java/com/lothrazar/cyclic/item/food/AppleBuffs.java @@ -9,7 +9,6 @@ import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; @@ -40,10 +39,6 @@ public void appendHoverText(ItemStack stack, Level worldIn, List tool @Override public ItemStack finishUsingItem(ItemStack stack, Level worldIn, LivingEntity entityLiving) { - if (entityLiving instanceof Player) { - // TOOD - ((Player) entityLiving).getCooldowns().addCooldown(this, 30); - } return super.finishUsingItem(stack, worldIn, entityLiving); } } diff --git a/src/main/java/com/lothrazar/cyclic/item/food/EdibleFlightItem.java b/src/main/java/com/lothrazar/cyclic/item/food/EdibleFlightItem.java index 81721781a9..f636773814 100644 --- a/src/main/java/com/lothrazar/cyclic/item/food/EdibleFlightItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/food/EdibleFlightItem.java @@ -21,7 +21,7 @@ public class EdibleFlightItem extends AppleBuffs { public static IntValue TICKS; public EdibleFlightItem(Properties properties) { - super(properties.rarity(Rarity.RARE).food(new FoodProperties.Builder().nutrition(3).saturationMod(0).alwaysEat().build())); + super(properties.rarity(Rarity.RARE).food(new FoodProperties.Builder().nutrition(1).saturationMod(0).alwaysEat().build())); } @Override diff --git a/src/main/java/com/lothrazar/cyclic/item/food/EdibleSpecItem.java b/src/main/java/com/lothrazar/cyclic/item/food/EdibleSpecItem.java index b5c9a085b5..815f63eaea 100644 --- a/src/main/java/com/lothrazar/cyclic/item/food/EdibleSpecItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/food/EdibleSpecItem.java @@ -17,7 +17,7 @@ public class EdibleSpecItem extends ItemBaseCyclic { public static IntValue TICKS; public EdibleSpecItem(Properties properties) { - super(properties.rarity(Rarity.EPIC).food(new FoodProperties.Builder().nutrition(3).saturationMod(0).alwaysEat().build())); + super(properties.rarity(Rarity.EPIC).food(new FoodProperties.Builder().nutrition(1).saturationMod(0).alwaysEat().build())); } @Override diff --git a/src/main/java/com/lothrazar/cyclic/registry/TileRegistry.java b/src/main/java/com/lothrazar/cyclic/registry/TileRegistry.java index 4f605d5207..51bdf21cf3 100644 --- a/src/main/java/com/lothrazar/cyclic/registry/TileRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/registry/TileRegistry.java @@ -105,7 +105,7 @@ public class TileRegistry { public static final RegistryObject> ROTATOR = TILES.register("rotator", () -> BlockEntityType.Builder.of(TileRotator::new, BlockRegistry.ROTATOR.get()).build(null)); public static final RegistryObject> DETECTORMOON = TILES.register("detector_moon", () -> BlockEntityType.Builder.of(TileMoon::new, BlockRegistry.DETECTORMOON.get()).build(null)); public static final RegistryObject> DETECTORWEATHER = TILES.register("detector_weather", () -> BlockEntityType.Builder.of(TileWeather::new, BlockRegistry.DETECTORWEATHER.get()).build(null)); - public static final RegistryObject> TERRAGLASS = TILES.register("terra_glass", () -> BlockEntityType.Builder.of(TileTerraGlass::new, BlockRegistry.TERRAGLASS.get()).build(null)); + public static final RegistryObject> TERRA_GLASS = TILES.register("terra_glass", () -> BlockEntityType.Builder.of(TileTerraGlass::new, BlockRegistry.TERRAGLASS.get()).build(null)); public static final RegistryObject> SPRINKLER = TILES.register("sprinkler", () -> BlockEntityType.Builder.of(TileSprinkler::new, BlockRegistry.SPRINKLER.get()).build(null)); public static final RegistryObject> ENDER_ITEM_SHELF = TILES.register("ender_item_shelf", () -> BlockEntityType.Builder.of(TileItemShelf::new, BlockRegistry.ENDER_ITEM_SHELF.get()).build(null)); public static final RegistryObject> WIRELESS_ENERGY = TILES.register("wireless_energy", () -> BlockEntityType.Builder.of(TileWirelessEnergy::new, 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 0000000000..3b58ad36dc --- /dev/null +++ b/src/main/java/com/lothrazar/cyclic/util/GrowthUtil.java @@ -0,0 +1,71 @@ +package com.lothrazar.cyclic.util; + +import com.lothrazar.cyclic.ModCyclic; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.tags.BlockTags; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.BonemealableBlock; +import net.minecraft.world.level.block.state.BlockState; + +public class GrowthUtil { + + public static boolean isValidGrow(Level world, BlockPos current) { + if (world.isEmptyBlock(current)) { // isAir + return false; + } + BlockState bState = world.getBlockState(current); + if (!bState.is(BlockTags.CROPS) && !bState.is(BlockTags.SAPLINGS)) { + ModCyclic.LOGGER.info("terra-grow can only grow minecraft:crops | minecraft:saplings : " + bState.getBlock()); + return false; + } + if (bState.getBlock() instanceof BonemealableBlock crop) { + // BonemealableBlock crop = ((BonemealableBlock) bState.getBlock()); + // if (!crop.isValidBonemealTarget(world, current, bState, world.isClientSide)) { // canCrow + // ModCyclic.LOGGER.info("terra-grow crop cannot grow right now " + bState.getBlock()); + // return false; //cant grow, or cant bonemeal. no + // } + if (!crop.isValidBonemealTarget(world, current, bState, world.isClientSide)) {//canUseBonemeal // canGrow + 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(ServerLevel world, BlockPos current, double d) { + if (!isValidGrow(world, current)) { + return false; + } + if (d >= 1 || world.random.nextDouble() < d) { + BlockState bState = world.getBlockState(current); + Block block = bState.getBlock(); + if (world instanceof ServerLevel) { + try { + grow(world, current, bState, block); + } + catch (Exception e) { + return false; + } + } + } + return true; + } + + @SuppressWarnings("deprecation") + private static void grow(ServerLevel world, BlockPos current, BlockState bState, Block block) { + if (bState.getBlock() instanceof BonemealableBlock crop) { + crop.performBonemeal(world, world.random, current, bState); // .grow() + } + else { // saplings, etc + block.randomTick(bState, world, current, world.random); + block.randomTick(bState, world, current, world.random); + block.randomTick(bState, world, current, world.random); + } + ModCyclic.LOGGER.info("terra-grow Successful growth" + block); + } +} diff --git a/src/main/resources/assets/cyclic/lang/en_us.json b/src/main/resources/assets/cyclic/lang/en_us.json index 6ee4170bdd..ae78447e8d 100644 --- a/src/main/resources/assets/cyclic/lang/en_us.json +++ b/src/main/resources/assets/cyclic/lang/en_us.json @@ -1358,7 +1358,6 @@ "potion.butter.oops": "Butterfingers! Dropped something when you moved.", - "effect.cyclic.flight": "Flight", "effect.cyclic.flight.description": "Players can fly using this effect", "item.minecraft.potion.effect.cyclic_flight": "Potion of Flight", @@ -1366,7 +1365,9 @@ "item.minecraft.lingering_potion.effect.cyclic_flight": "Lingering Potion of Flight", "item.minecraft.tipped_arrow.effect.cyclic_flight": "Arrow of Flight", - + "item.cyclic.tile_transporter_empty.guide": "Right click on any machine or container with the Sack of Holding to pick it up. Right click on any block with a filled Sack of Holding to place the machine again.", + + "effect.cyclic.butter": "Butterfingers", "effect.cyclic.butter.description": "Chance to drop items while moving or attacking", "item.minecraft.potion.effect.cyclic_butter": "Potion of Butterfingers", diff --git a/src/main/resources/assets/cyclic/models/block/my_water_candle_lit.json b/src/main/resources/assets/cyclic/models/block/my_water_candle_lit.json index 7fa7007ea4..9595d9a366 100644 --- a/src/main/resources/assets/cyclic/models/block/my_water_candle_lit.json +++ b/src/main/resources/assets/cyclic/models/block/my_water_candle_lit.json @@ -4,7 +4,7 @@ "textures": { "holder": "cyclic:blocks/machine/water_candle_holder", "2": "cyclic:blocks/machine/water_candle", - "centerwater": "cyclic:blocks/water_fake", + "centerwater": "cyclic:blocks/water_fake", "sides": "cyclic:blocks/machine/water_candle_sides", "flame": "cyclic:blocks/machine/gold" }, diff --git a/src/main/resources/data/cyclic/recipes/charm_knockback_resistance.json b/src/main/resources/data/cyclic/recipes/charm_knockback_resistance.json index 5f1bdcdf85..a0e8ef07f9 100644 --- a/src/main/resources/data/cyclic/recipes/charm_knockback_resistance.json +++ b/src/main/resources/data/cyclic/recipes/charm_knockback_resistance.json @@ -7,7 +7,7 @@ ], "key": { "g": { - "item": "minecraft:diamond" + "item": "minecraft:gold_ingot" }, "f": { "item": "minecraft:amethyst_shard" diff --git a/src/main/resources/data/cyclic/recipes/charm_longfall.json b/src/main/resources/data/cyclic/recipes/charm_longfall.json index d858f2c851..53f49060e4 100644 --- a/src/main/resources/data/cyclic/recipes/charm_longfall.json +++ b/src/main/resources/data/cyclic/recipes/charm_longfall.json @@ -16,7 +16,7 @@ "tag": "forge:feathers" }, "a": { - "item": "minecraft:diamond_boots" + "item": "cyclic:gem_amber" } }, "result": { diff --git a/src/main/resources/data/cyclic/recipes/magic_net.json b/src/main/resources/data/cyclic/recipes/magic_net.json index 69060d2a91..c646171ef6 100644 --- a/src/main/resources/data/cyclic/recipes/magic_net.json +++ b/src/main/resources/data/cyclic/recipes/magic_net.json @@ -7,20 +7,20 @@ ], "key": { "i": { - "item": "minecraft:amethyst_shard" + "tag": "forge:ingots/gold" }, "l": { - "tag": "minecraft:coral_blocks" + "tag": "forge:vines" }, "a": { "tag": "forge:dyes/cyan" }, "q": { - "item": "minecraft:snowball" + "item": "minecraft:ice" } }, "result": { "item": "cyclic:magic_net", - "count": 8 + "count": 4 } } \ No newline at end of file diff --git a/src/main/resources/data/cyclic/recipes/randomize_scepter.json b/src/main/resources/data/cyclic/recipes/randomize_scepter.json index 1680baac26..6b131236e3 100644 --- a/src/main/resources/data/cyclic/recipes/randomize_scepter.json +++ b/src/main/resources/data/cyclic/recipes/randomize_scepter.json @@ -10,7 +10,7 @@ "tag": "forge:dyes/purple" }, "i": { - "item": "minecraft:iron_ingot" + "tag": "forge:ingots/iron" }, "g": { "item": "minecraft:redstone" diff --git a/src/main/resources/data/cyclic/recipes/solidifier/solidifier_apple.json b/src/main/resources/data/cyclic/recipes/solidifier/solidifier_apple.json index 14b17e8076..b08c5419d6 100644 --- a/src/main/resources/data/cyclic/recipes/solidifier/solidifier_apple.json +++ b/src/main/resources/data/cyclic/recipes/solidifier/solidifier_apple.json @@ -17,7 +17,7 @@ }, "mix": { "tag": "forge:honey", - "count": 300 + "count": 3000 }, "result": { "item": "cyclic:apple_honey", diff --git a/src/main/resources/data/cyclic/recipes/solidifier/solidifier_apple0.json b/src/main/resources/data/cyclic/recipes/solidifier/solidifier_apple0.json index 7ea2df9de2..77b11d6b2b 100644 --- a/src/main/resources/data/cyclic/recipes/solidifier/solidifier_apple0.json +++ b/src/main/resources/data/cyclic/recipes/solidifier/solidifier_apple0.json @@ -7,7 +7,7 @@ ], "mix": { "tag": "forge:honey", - "count": 100 + "count": 1000 }, "energy": { "rfpertick": 100, diff --git a/src/main/resources/data/cyclic/tags/blocks/ignored/excavate.json b/src/main/resources/data/cyclic/tags/blocks/ignored/excavate.json new file mode 100644 index 0000000000..cf52e968c1 --- /dev/null +++ b/src/main/resources/data/cyclic/tags/blocks/ignored/excavate.json @@ -0,0 +1,9 @@ +{ + "replace": false, + "values": [ + "#minecraft:shulker_boxes", + {"required":false, "id": "cyclic:crate"}, + {"required":false, "id": "minecraft:chest"}, + {"required":false, "id": "minecraft:command_block"} + ] +} \ No newline at end of file diff --git a/update.json b/update.json index fa7c8cc205..bcaf4c7699 100644 --- a/update.json +++ b/update.json @@ -84,6 +84,13 @@ ,"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":"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+ " + + + }, "1.18.2": { "1.6.0": "Ported Cyclic[1.16.5]-1.5.8 to Minecraft [1.17.1] & forge-37.0.85+. Altered a few crafting recipes to use new items. Removed Peat Generator (Use Peat items in Material Generator). Removed 5 Mason blocks, replaced with Compressed Cobblestone, Flint Block. Added Peace Candle, Translocation Platform, Stone Mattock, Crushing Macerator, and Lava Sponge. Added Copper Tools and Amethyst Tools, Copper Lantern, Copper Chain, Copper Bars, Gold Chain, Gold Bars, Gold Lantern (Art by @shynieke). Added Copper Nuggets and Netherite Nuggets. Added Netherite Lanterns, chains, and bars. Added 3 Pressure Plates: Copper Netherite and Obsidian. ", @@ -123,7 +130,9 @@ ,"1.7.15":"Life Leech no longer refills hunger (#2241). Merged Typo: double 'consume' (#2275)@Pifanjr. Update Simplified Chinese Transaction (#2277)@UraraChiya. " ,"1.7.16":"Fix #2243 User output buffer (milk and other tranforming outputs from entity interactions). fix #2236 recipe conflict for moss block in solidifier_moss_block.json. fix #2247 Charm Talisman Missing lava protection. Fix #2259: crates and other heavy blocks that keep their contents now drop motionless to avoid bouncing away for small base situations. #2261 Smooth glass can be reverse-smelted back into plain glass. Fix items that use RF not charging items on servers #2274 #2169. fix #2272 #2260 typos. Fix #2268 material generator recipe. update candle models from #2182. Fix Smooth Glass looks incorrect underwater #2263. Fix Tempered dark glass does not cull against itself #2262 " ,"1.7.17":"This update ports some features that had previously been exlusive to the mc 1.16.5-1.15.12 thru 1.16.5-1.15.21; all are listed below. New configs: [cyclic.enchantment.disarm] now has 'ignoredMobs' and 'percentPerLevel', [cyclic.items.tile_transporter] now has 'overrideChestSingle', read on or see cyclic.yml for more details. PR #1976 by metalshark :Item, Energy, and Fluid Cables now have Increased performance (compile time optimisations, reduction in cyclomatic complexity and removal of redundant checks). PR #1994 by 'metalshark' Fixes issue #1992. Merge pull request #2013 from metalshark : Add caching of packager recipes and move static methods out of main class for scaling. Merge pull request #2011 from metalshark : Invalidate capabilities when declaring them. #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. Now all git branches can be merged from mc-1.16.5 downstream to mc-1.20.1 and future updates as well. " - ,"1.7.18":"" + ,"1.7.18":"Re-added crafttweaker support. Re-added botania-api Solegnolia support. Growth enchantment now uses the same logic as Sprinkler & Terra Soil (only minecraft:crops or minecraft::saplings can grow, respect IGrowable::canUseBonemeal). New gloom ignored 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. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. 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 some recipe changes to match mc1.20.1+ (port of 1.16.5-1.5.23) " + + } }