diff --git a/checkstyle.xml b/.eclipse/checkstyle.xml similarity index 100% rename from checkstyle.xml rename to .eclipse/checkstyle.xml diff --git a/build.gradle b/build.gradle index 80b4e845db..9471d6a19f 100644 --- a/build.gradle +++ b/build.gradle @@ -71,6 +71,8 @@ dependencies { // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-common:${jei_version}") runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}") + + // optional compat: many items useable in curios slots implementation fg.deobf("top.theillusivec4.curios:curios-forge:${mc_version}-${curios_version}") @@ -79,13 +81,19 @@ dependencies { runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:${mc_version}-${patchouli_version}-FORGE") - // mods that have optional/soft integration - // runtimeOnly fg.deobf("curse.maven:liquid-blocks-301999:3873025") - // runtimeOnly fg.deobf("curse.maven:just-enough-effect-descriptions-jeed-532286:3944903") - // runtimeOnly fg.deobf("curse.maven:plain-grinder-452000:3653027") - // runtimeOnly fg.deobf("curse.maven:crafttweaker-239197:4657532") - // runtimeOnly fg.deobf("curse.maven:farmers-delight-398521:3834150") + implementation fg.deobf("com.blamejared.crafttweaker:CraftTweaker-forge-${mc_version}:${crafttweaker_version}") + +//doesnt exist in 1.19.4 specifically + // compileOnly fg.deobf("vazkii.botania:Botania:${mc_version}-${botania_version}-FORGE:api") + // runtimeOnly fg.deobf("vazkii.botania:Botania:${mc_version}-${botania_version}-FORGE") + + // optional compat: guidebook + // compileOnly fg.deobf("vazkii.patchouli:Patchouli:${mc_version}-${patchouli_version}:api") + // runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:${mc_version}-${patchouli_version}") + + + } @@ -93,9 +101,7 @@ dependencies { repositories { // If you have mod jar dependencies in ./libs, you can declare them as a repository like so: - flatDir { - dir 'libs' - } + // flatDir { dir 'libs' } maven { // TOP name 'tterrag maven' url "https://maven.tterrag.com/" @@ -104,10 +110,11 @@ repositories { name = "mappings" url 'https://dogforce-games.com/maven' } - maven { url = "https://maven.theillusivec4.top/" } + maven { url 'https://dvs1.progwml6.com/files/maven/' } - maven { url 'https://maven.blamejared.com' } - maven { url = "https://modmaven.dev" } + maven { url 'https://maven.theillusivec4.top/' } + maven { url 'https://maven.blamejared.com' } + maven { url 'https://modmaven.dev' } // maven { url 'https://www.cursemaven.com' } } // Example for how to get properties into the manifest for reading by the runtime.. @@ -166,7 +173,6 @@ task signJar(type: SignJar, dependsOn: jar) { } - task cleanJar { delete 'build/libs' } 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 96% rename from cyclic.toml rename to examples/config/cyclic.toml index 68fa1ff16b..8dd8af938d 100644 --- a/cyclic.toml +++ b/examples/config/cyclic.toml @@ -156,6 +156,8 @@ enabled = true [cyclic.enchantment.curse] + #Set list of effects for Gloom enchant (cyclic:curse) to ignore and not use these + ignored = ["minecraft:bad_omen", "minecraft:nausea", "botania:clear"] #(Gloom) Set false to stop enchantment from working enabled = true @@ -208,6 +210,8 @@ # Block specific configs ##################################################################################### [cyclic.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 #If true, then all potions marked as harmful/negative will be used in addition to the 'anti_beacon.potion_list' for cures and immunities (used by both sponge and artemisbeacon). harmful_potions = true @@ -370,15 +374,25 @@ #Range: 0 ~ 1000 water = 5 + #terra_glass settings + [cyclic.blocks.terra_glass] + #ticks between growth cycles + #Range: 1 ~ 10000 + timer = 100 + #growth height below the glass + #Range: 0 ~ 32 + height = 8 + #experience_pylon settings [cyclic.blocks.experience_pylon] #Radius to pickup xp orbs #Range: 1 ~ 64 radius = 16 + #soundproofing settings [cyclic.blocks.soundproofing] - #Radius to find and muffle sounds. - #Range: 1 ~ 128 + #Radius of sound proofing (distance from each block that it will listen) + #Range: 1 ~ 16 radius = 6 [cyclic.blocks.cables] @@ -427,6 +441,7 @@ #Range: 0 ~ 64000 energy_cost = 10 + #Ender shelf settings [cyclic.blocks.ender_shelf] #Controller Max distance to search (using manhattan distance) #Range: 1 ~ 256 @@ -459,12 +474,15 @@ fluid_cost = 100 [cyclic.blocks.terra_preta] - #Growth interval in ticks (100 would be every 5 seconds). Also affects terra glass + #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.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 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 997a648058..3b867c6967 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,17 +5,24 @@ org.gradle.daemon=false # org.gradle.java.home=C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot # as needed run/server.properties : online-mode=false -curse_id=239286 -mod_version=1.10.2 +mod_version=1.10.3-SNAPSHOT + mc_version=1.19.4 forge_version=45.1.0 + # optional dependencies jei_version=13.1.0.11 curios_version=5.1.5.3 patchouli_version=79.1 + +# botania_version=440 +crafttweaker_version=12.0.2 +# https://www.curseforge.com/minecraft/mc-mods/crafttweaker/files/5210437 +#https://www.curseforge.com/minecraft/mc-mods/botania/files/4557912 + # for eclipse.ini if needed #-vm #C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\javaw.exe 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 4f5c8c0816..deb2c7b5a1 100644 --- a/src/main/java/com/lothrazar/cyclic/block/BlockCyclic.java +++ b/src/main/java/com/lothrazar/cyclic/block/BlockCyclic.java @@ -97,7 +97,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 c1ae3fe97f..2ec0b7e902 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; @@ -98,7 +99,8 @@ protected Player getLookingPlayer(int maxRange, boolean mustCrouch) { return null; } - public void tryDumpFakePlayerInvo(WeakReference fp, ItemStackHandler out, boolean onGround) { + // TODO: this could use a refactor + public void tryDumpFakePlayerInvo(WeakReference fp, ItemStackHandler out, boolean dropItemsOnGround) { if (out == null) { return; } @@ -109,23 +111,20 @@ public void tryDumpFakePlayerInvo(WeakReference fp, ItemStackHandler if (fpItem.isEmpty()) { continue; } - ModCyclic.LOGGER.info("NONEMPTY itemstack found what do we do"); if (fpItem == fp.get().getMainHandItem()) { - ModCyclic.LOGGER.info("aha continue main hand item dont doump it"); continue; } for (int j = 0; j < out.getSlots(); j++) { - ModCyclic.LOGGER.info(fpItem + "insert itit here" + j); fpItem = out.insertItem(j, fpItem, false); } - if (onGround) { + if (dropItemsOnGround) { toDrop.add(fpItem); } else { fp.get().getInventory().items.set(i, fpItem); } } - if (onGround) { + if (dropItemsOnGround) { ItemStackUtil.drop(this.level, this.worldPosition.above(), toDrop); } } @@ -281,20 +280,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); @@ -345,29 +347,46 @@ 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(ForgeCapabilities.ITEM_HANDLER, themFacingMe).orElse(null); + // IItemHandler handlerOutput = tileTarget.getCapability(ForgeCapabilities.ITEM_HANDLER, themFacingMe).orElse(null); + final IItemHandler handlerOutput = tileTarget.getCapability(ForgeCapabilities.ITEM_HANDLER, 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 @@ -384,49 +403,86 @@ 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(ForgeCapabilities.ENERGY, myFacingDir).orElse(null); - if (handlerHere == null || handlerHere.getEnergyStored() == 0) { + Direction myFacingDir = loc.getSide(); + final IEnergyStorage handlerHere = this.getCapability(ForgeCapabilities.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(ForgeCapabilities.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(ForgeCapabilities.ENERGY, themFacingMe).orElse(null); + final IEnergyStorage handlerOutput = tileTarget.getCapability(ForgeCapabilities.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; } @Override 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 0c88ee89de..66b2bd83df 100644 --- a/src/main/java/com/lothrazar/cyclic/block/apple/AppleCropBlock.java +++ b/src/main/java/com/lothrazar/cyclic/block/apple/AppleCropBlock.java @@ -72,6 +72,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 304ec89bb0..345efab285 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 c5cc07b4e0..009be4da5d 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.getLevel(), event.getPos(), event.getEntity(), 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 bc968f59ce..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(ForgeCapabilities.ITEM_HANDLER).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 9710b53b27..16062668b8 100644 --- a/src/main/java/com/lothrazar/cyclic/block/soundmuff/SoundmufflerBlock.java +++ b/src/main/java/com/lothrazar/cyclic/block/soundmuff/SoundmufflerBlock.java @@ -3,24 +3,22 @@ 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; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.event.sound.PlaySoundEvent; -import net.minecraftforge.common.ForgeConfigSpec.IntValue; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.SubscribeEvent; public class SoundmufflerBlock extends BlockCyclic { private static final int VOL_REDUCE_PER_BLOCK = 2; - public static IntValue RADIUS; // 6 public SoundmufflerBlock(Properties properties) { super(properties.strength(1F).sound(SoundType.SCAFFOLDING)); @@ -31,31 +29,33 @@ 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((int) sound.getX(), (int) sound.getY(), (int) sound.getZ()), this, - RADIUS.get(), + ConfigRegistry.SOUND_RADIUS.get(), isPowered); 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); + } + + @OnlyIn(Dist.CLIENT) + 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/soundrecord/BlockSoundRecorder.java b/src/main/java/com/lothrazar/cyclic/block/soundrecord/BlockSoundRecorder.java index 6d4bbe7655..30d94c5746 100644 --- a/src/main/java/com/lothrazar/cyclic/block/soundrecord/BlockSoundRecorder.java +++ b/src/main/java/com/lothrazar/cyclic/block/soundrecord/BlockSoundRecorder.java @@ -2,6 +2,7 @@ import java.util.List; import com.lothrazar.cyclic.block.BlockCyclic; +import com.lothrazar.cyclic.config.ConfigRegistry; import com.lothrazar.cyclic.net.PacketRecordSound; import com.lothrazar.cyclic.registry.MenuTypeRegistry; import com.lothrazar.cyclic.registry.PacketRegistry; @@ -17,14 +18,11 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.event.sound.PlaySoundEvent; -import net.minecraftforge.common.ForgeConfigSpec.IntValue; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.SubscribeEvent; public class BlockSoundRecorder extends BlockCyclic { - public static IntValue RADIUS; - public BlockSoundRecorder(Properties properties) { super(properties.strength(1F).sound(SoundType.SCAFFOLDING)); MinecraftForge.EVENT_BUS.register(this); @@ -50,8 +48,8 @@ public void onPlaySound(PlaySoundEvent event) { } //long term/repeating/music final boolean isPowered = false; // if im NOT powered, im running List blocks = BlockstatesUtil.findBlocks(clientWorld, - new BlockPos((int) event.getSound().getX(), (int) event.getSound().getY(), (int) event.getSound().getZ()), - this, RADIUS.get(), isPowered); + new BlockPos((int) event.getSound().getX(), (int) event.getSound().getY(), (int) event.getSound().getZ()), this, + ConfigRegistry.RECORDER_RADIUS.get(), isPowered); for (BlockPos nearby : blocks) { String sid = event.getSound().getLocation().toString(); PacketRegistry.INSTANCE.sendToServer(new PacketRecordSound(sid, nearby)); diff --git a/src/main/java/com/lothrazar/cyclic/block/spikes/TileDiamondSpikes.java b/src/main/java/com/lothrazar/cyclic/block/spikes/TileDiamondSpikes.java index e1b4a83741..fb58ee974b 100644 --- a/src/main/java/com/lothrazar/cyclic/block/spikes/TileDiamondSpikes.java +++ b/src/main/java/com/lothrazar/cyclic/block/spikes/TileDiamondSpikes.java @@ -22,6 +22,7 @@ public class TileDiamondSpikes extends TileBlockEntityCyclic { WeakReference fakePlayer; + final static boolean dropItemsOnGround = true; public TileDiamondSpikes(BlockPos pos, BlockState state) { super(TileRegistry.SPIKES_DIAMOND.get(), pos, state); @@ -63,7 +64,7 @@ public void tick() { fakePlayer.get().setItemInHand(InteractionHand.MAIN_HAND, sword); } if (level.random.nextDouble() < 0.001F) { - tryDumpFakePlayerInvo(fakePlayer, null, true); + tryDumpFakePlayerInvo(fakePlayer, null, dropItemsOnGround); } } } 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 a20eb72305..8b53f63050 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 71c2222b67..fbb89a359d 100644 --- a/src/main/java/com/lothrazar/cyclic/block/terraglass/BlockTerraGlass.java +++ b/src/main/java/com/lothrazar/cyclic/block/terraglass/BlockTerraGlass.java @@ -58,7 +58,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/user/TileUser.java b/src/main/java/com/lothrazar/cyclic/block/user/TileUser.java index 33eb652b22..50b0fdc1ab 100644 --- a/src/main/java/com/lothrazar/cyclic/block/user/TileUser.java +++ b/src/main/java/com/lothrazar/cyclic/block/user/TileUser.java @@ -127,17 +127,16 @@ public void tick() { catch (Exception e) { ModCyclic.LOGGER.error("User action item error", e); } - tryDumpFakePlayerInvo(fakePlayer, this.outputSlots, false); + final boolean dropItemsOnGround = false; + tryDumpFakePlayerInvo(fakePlayer, this.outputSlots, dropItemsOnGround); } private void depositOutputMainhand() { var usedItem = fakePlayer.get().getItemInHand(InteractionHand.MAIN_HAND); for (int slotId = 0; slotId < outputSlots.getSlots(); slotId++) { if (!usedItem.isEmpty()) { - // usedItem = outputSlots.insertItem(slotId, usedItem.copy(), false); if (outputSlots.insertItem(slotId, usedItem.copy(), true).isEmpty()) { usedItem = outputSlots.insertItem(slotId, usedItem.copy(), false); - // userSlots.setStackInSlot(0, usedItem); TileBlockEntityCyclic.tryEquipItem(usedItem, fakePlayer, InteractionHand.MAIN_HAND); } } 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 c642940d02..95edfc56f2 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.BlockRegistry; @@ -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 5bc97234c9..788e29c914 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.BlockRegistry; @@ -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 0815c6f607..bfd6f57278 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.BlockRegistry; @@ -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 66b052bc82..d4dea8f90a 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..c1847140eb 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); // 1.19.4 only doesnt have a port + } } - 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..d6848a7500 --- /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), "", (int) 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..e55f043e45 --- /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(), (int) 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 b49f34d1ed..f592c08968 100644 --- a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java @@ -41,11 +41,10 @@ import com.lothrazar.cyclic.block.packager.TilePackager; import com.lothrazar.cyclic.block.peatfarm.TilePeatFarm; import com.lothrazar.cyclic.block.shapebuilder.TileStructure; -import com.lothrazar.cyclic.block.soundmuff.SoundmufflerBlock; -import com.lothrazar.cyclic.block.soundrecord.BlockSoundRecorder; 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 +97,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 { @@ -117,10 +117,14 @@ 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; + public static IntValue RECORDER_RADIUS; static { buildDefaults(); initConfig(); @@ -255,8 +259,11 @@ private static void initConfig() { AutoSmeltEnchant.CFG = CFG.comment("Set false to stop enchantment from working").define(AutoSmeltEnchant.ID + ".enabled", true); BeekeeperEnchant.CFG = CFG.comment("Set false to stop enchantment from working").define(BeekeeperEnchant.ID + ".enabled", true); BeheadingEnchant.CFG = CFG.comment("Set false to stop enchantment from working").define(BeheadingEnchant.ID + ".enabled", true); - 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); + GLOOM_IGNORE_LIST = CFG.comment("Set list of effects for Gloom enchant (cyclic:curse) to ignore and not use these") + .defineList(GloomCurseEnchant.ID + ".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.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); GloomCurseEnchant.CFG = CFG.comment("(Gloom) Set false to stop enchantment from working").define(GloomCurseEnchant.ID + ".enabled", true); @@ -307,7 +314,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"); @@ -393,11 +400,13 @@ 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. ") - .defineInRange("soundproofing.radius", 6, 1, 128); + 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); TileAntiBeacon.HARMFUL_POTIONS = CFG.comment("If true, then all potions marked as harmful/negative will be used in addition to the 'anti_beacon.potion_list' for cures and immunities (used by both sponge and artemisbeacon).") .define("harmful_potions", true); TileAntiBeacon.RADIUS = CFG.comment("Radius to protect players and entities from potion effects being applied (used by both sponge and artemisbeacon). ") @@ -464,25 +473,33 @@ 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"); - BlockSoundRecorder.RADIUS = CFG.comment("Sound Recorder - how far out does it listen to record sounds").defineInRange("radius", 8, 1, 64); + RECORDER_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"); + CFG.comment("Ender shelf settings").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); @@ -592,6 +609,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 dccce8a7e2..183fa171a2 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 d775dd9dd4..566cf8d0d9 100644 --- a/src/main/java/com/lothrazar/cyclic/enchant/GloomCurseEnchant.java +++ b/src/main/java/com/lothrazar/cyclic/enchant/GloomCurseEnchant.java @@ -2,8 +2,12 @@ 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.resources.ResourceLocation; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.Entity; @@ -14,6 +18,7 @@ import net.minecraft.world.item.enchantment.EnchantmentCategory; import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.registries.ForgeRegistries; public class GloomCurseEnchant extends EnchantmentCyclic { @@ -91,6 +96,11 @@ public void doPostHurt(LivingEntity user, Entity attacker, int level) { continue; //should be impossible, but i had a random NPE crash log } + ResourceLocation effectKey = ForgeRegistries.MOB_EFFECTS.getKey(effect); + if (StringParseUtil.isInList(ConfigRegistry.getGloomIgnoreList(), effectKey)) { + ModCyclic.LOGGER.info("Gloom(curse) effect cannot apply " + effectKey); + 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 6fc6fa08d4..61ebb16cc0 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(LivingTickEvent 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/ClientInputEvents.java b/src/main/java/com/lothrazar/cyclic/event/ClientInputEvents.java index f380aecbb1..af57bc3a55 100644 --- a/src/main/java/com/lothrazar/cyclic/event/ClientInputEvents.java +++ b/src/main/java/com/lothrazar/cyclic/event/ClientInputEvents.java @@ -58,18 +58,11 @@ public void onScreenRender(ScreenEvent.Render.Pre event) { Minecraft mc = Minecraft.getInstance(); Screen screen = mc.screen; if (screen instanceof AbstractContainerScreen gui && !(screen instanceof CreativeModeInventoryScreen)) { - // if (gui.getSlotUnderMouse() != null) { - // Slot slotHit = gui.getSlotUnderMouse(); - // ItemStack stackTarget = slotHit.getItem(); ItemStack maybeFood = mc.player.containerMenu.getCarried(); List boxes = ItemBaseCyclic.findAmmos(mc.player, ItemRegistry.LUNCHBOX.get()); - // if (held.isEdible()) { for (ItemStack box : boxes) { ItemLunchbox.setHoldingEdible(box, maybeFood.isEdible()); - // if (maybeFood.isEdible()) - //.println(maybeFood + "DrawScreenEvent set edible " + box.getTag()); } - // } } } diff --git a/src/main/java/com/lothrazar/cyclic/event/EventRender.java b/src/main/java/com/lothrazar/cyclic/event/EventRender.java index 33ffe34696..ec07d81ee6 100644 --- a/src/main/java/com/lothrazar/cyclic/event/EventRender.java +++ b/src/main/java/com/lothrazar/cyclic/event/EventRender.java @@ -51,7 +51,6 @@ public class EventRender { @SubscribeEvent - // public void overlay(RenderGameOverlayEvent.Post event) { public static void onCustomizeDebugText(CustomizeGuiOverlayEvent.DebugText event) { //Build scepter feature : render selected blockstate in cross hair Player player = Minecraft.getInstance().player; @@ -76,10 +75,6 @@ public static void onCustomizeDebugText(CustomizeGuiOverlayEvent.DebugText event } int height = mc.getWindow().getGuiScaledHeight(); CyclicFile datFile = PlayerDataEvents.getOrCreate(player); - // if (datFile.flyTicks > 0) { - // int sec = datFile.flyTicks / 20; - // drawString(event.getPoseStack(), "flight " + sec, 10, height - 30); - // } if (datFile.spectatorTicks > 0) { int sec = datFile.spectatorTicks / 20; drawString(event.getPoseStack(), "noClip " + sec, 10, height - 10); @@ -136,7 +131,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 1d2f2c73d9..94f67faf0c 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(LivingTickEvent event) { if (event.getEntity() 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/crafting/CraftingBagContainer.java b/src/main/java/com/lothrazar/cyclic/item/crafting/CraftingBagContainer.java index 5a1bb76036..6248f357a9 100644 --- a/src/main/java/com/lothrazar/cyclic/item/crafting/CraftingBagContainer.java +++ b/src/main/java/com/lothrazar/cyclic/item/crafting/CraftingBagContainer.java @@ -29,7 +29,7 @@ public class CraftingBagContainer extends ContainerBase implements IContainerCra private final ResultContainer craftResult = new ResultContainer(); // public int slot = -1; - public ItemStack bag; + public ItemStack bag = ItemStack.EMPTY; public CraftingBagContainer(int id, Inventory playerInventory, Player player, int slot) { super(MenuTypeRegistry.CRAFTING_BAG.get(), id); @@ -42,9 +42,8 @@ public CraftingBagContainer(int id, Inventory playerInventory, Player player, in this.addSlot(new ResultSlot(playerInventory.player, this.craftMatrix, this.craftResult, 0, 124, 35)); if (slot > -1) { this.bag = playerInventory.getItem(slot); - ModCyclic.LOGGER.info("bag " + bag); } - if (bag.isEmpty()) { + if (bag == null || bag.isEmpty()) { this.bag = super.findBag(ItemRegistry.CRAFTING_BAG.get()); } //grid 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 5e2e5dfe1f..9ae505259e 100644 --- a/src/main/java/com/lothrazar/cyclic/item/equipment/GlowingHelmetItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/equipment/GlowingHelmetItem.java @@ -99,8 +99,7 @@ private static boolean isOnStatic(ItemStack held) { public static void onEntityUpdate(LivingTickEvent event) { //reduce check to only once per second instead of per tick if (event.getEntity().level.getGameTime() % 20 == 0 && - event.getEntity() != null) { //some of the items need an off switch - Player player = (Player) event.getEntity(); + event.getEntity() instanceof Player player) { //some of the items need an off switch 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 c764f4e5ae..be4d0a05a5 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.MutableComponent; 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 700d7c8d97..77e6b896a6 100644 --- a/src/main/java/com/lothrazar/cyclic/item/food/EdibleFlightItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/food/EdibleFlightItem.java @@ -20,7 +20,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 84fa30b61b..fbfec187f0 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/item/lunchbox/ItemLunchbox.java b/src/main/java/com/lothrazar/cyclic/item/lunchbox/ItemLunchbox.java index c933c13320..f3f6469264 100644 --- a/src/main/java/com/lothrazar/cyclic/item/lunchbox/ItemLunchbox.java +++ b/src/main/java/com/lothrazar/cyclic/item/lunchbox/ItemLunchbox.java @@ -46,6 +46,7 @@ public class ItemLunchbox extends ItemBaseCyclic { + private static final String HOLDING = "holding"; public static final int SLOTS = 7; public ItemLunchbox(Properties prop) { @@ -171,11 +172,11 @@ public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag nbt) { } public static void setHoldingEdible(ItemStack box, boolean edible) { - box.getOrCreateTag().putBoolean("holding", edible); + box.getOrCreateTag().putBoolean(HOLDING, edible); } public static int getColour(ItemStack stack) { - if (stack.hasTag() && stack.getTag().getBoolean("holding")) { + if (stack.hasTag() && stack.getTag().getBoolean(HOLDING)) { // green? return 0x00AAAAFF; return 0x000000FF; // 0xFFFF0011; } diff --git a/src/main/java/com/lothrazar/cyclic/registry/TileRegistry.java b/src/main/java/com/lothrazar/cyclic/registry/TileRegistry.java index e071bc0d91..ef382048b3 100644 --- a/src/main/java/com/lothrazar/cyclic/registry/TileRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/registry/TileRegistry.java @@ -103,7 +103,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 fc213b30c5..05a44f2d79 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 dcb8500ed4..d1ce32ea31 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 @@ -2,11 +2,19 @@ "credit": "Made with Blockbench @INooBTooMuch https://github.com/Lothrazar/Cyclic/issues/2182", "parent": "block/block", "textures": { +<<<<<<< HEAD "holder": "cyclic:block/machine/water_candle_holder", "2": "cyclic:block/machine/water_candle", "centerwater": "cyclic:block/water_fake", "sides": "cyclic:block/machine/water_candle_sides", "flame": "cyclic:block/machine/gold" +======= + "holder": "cyclic:blocks/machine/water_candle_holder", + "2": "cyclic:blocks/machine/water_candle", + "centerwater": "cyclic:blocks/water_fake", + "sides": "cyclic:blocks/machine/water_candle_sides", + "flame": "cyclic:blocks/machine/gold" +>>>>>>> trunk/1.19.2 }, "elements": [ { 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 adbc2fe833..6d3c71c61c 100644 --- a/update.json +++ b/update.json @@ -2,13 +2,14 @@ "homepage": "https://www.curseforge.com/minecraft/mc-mods/cyclic", "promos": { - "1.16.5-latest": "1.5.21", + "1.16.5-latest": "1.5.22", "1.18.2-latest": "1.7.17", "1.19.2-latest":"1.8.2", "1.19.3-latest":"1.9.0", "1.19.4-latest":"1.10.2", "1.20-latest":"1.12.1" + }, "1.16.5": { "0.6.1": "Ported ", @@ -75,8 +76,24 @@ ,"1.5.9":"Fix Battery energy tooltip not updating when charged in an item slot. Added charging slot to Battery. Fix sleeping mat bug when used in nether. Fix Fluid cables visual disconnection when placing. " ,"1.5.10":"Machines that use fluid ingredients now accept fluid tags such as 'forge:experience' in place of fluid ID; updated some existing recipes on Solidifier and Evap Generator to match (old recipe JSONs still all compatible/valid). Fixed battery energy item stack capability provider. Refreshed texture of Air charm. Vision helmet compat with curios head slot. Revert GPS card fixes to v1.5.6. One recipe added to cyclic:generator_fluid for tag forge:biomass. Default config value updated for disable_pickup on the Sack of Holding. Add compat for Beheading enchant with the 7 Tinkers Construct mob heads (config heads are still checked last. no changes if tinkers not installed). " ,"1.5.11":"Fix a bugged interaction with Settings data card and Filter data card #1970 . Torch Charm now tries to avoid placing on non-solid blocks such as top side of a bottom Slab where the torch breaks right away. " - ,"1.5.12":"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) " + ,"1.5.13":"Added support for using the left hand on Item User. #1994 by 'metalshark' Fixes issue #1992. " + ,"1.5.14":"Fix #2016 regarding settings data card. Fix Crash when trying to push Cyclic item cables with create piston. 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 " + ,"1.5.15":"Fluids cyclic:honey, xpjuice, and biomass are now swim-able. Fix harvesting Battery and Tank. Fix scythe of foraging not harvesting some 2-tall flower bushes. Fix cannot shift-click from Packager. Added client text config 'FluidContents'. Reusable Ender Eye now works with YUNGS better strongholds (structure ID 'betterstrongholds:stronghold'). Fix Item Transfer Node missing loot table. Fix ender shelf event conflict with supplementaries:book_pile. Empty Ender Shelf now drops item stack with no datatag. Hoppers can now insert into Composter. Fix wooden hopper sometimes not picking up items on top of it. Fluid Cable and Fluid Hopper can now extract water from a full Water Cauldron. Cyan Flower can now go into Compost. Fix harvest scythe desync on servers. Fix #2057 doorbell on leaf blocks. fix #2054 dodge concurrent exceptions when present so isabesnt is overkill. Fix #2056 remove event blocking bonemeal and podzol. Fix #2041 Inaccessible Enchantments, update enchant rarity levels to match mc1.18.2+ settings. Tunnel added to Shape Builder #1911. Fix #2061 Block Reach enchant by using Attribute Modifiers (mod compatibility). " + ,"1.5.16":" Fix Workbench deletes items inside when mined #2121" + ,"1.5.17":" Fix Workbench deletes items inside when mined #2121. Fix Fluid cable crashing game #2118 fluid pipe server crash #2090 using ConcurrentHashMap for smp issues (ConcurrentModificationException)." + ,"1.5.18":"Added 'Always On / Requires Redstone' button to the Redstone Clock so it can be controlled (feature ported from mc 1.12.2 & 1.18.2)" + ,"1.5.19":"Backports from mc1.18.2: right-click the Crafting Stick anywhere in your inventory screen, even while not holding it, to open it. Fix logs about 'unused frames'. Fixed logs about ' Unknown recipe category: cyclic:'. Fix Combustion Generator consumes Empty Bucket #2146. Fix #2171 Rich Soil acting translucent and blocksounds. #2138 /cyclic commands can run in functions and command blocks" + ,"1.5.20":"#2102 wooden and golden hopper deposit logic fixed, now matches 1.18.2+ versions. #2085 Hopper reach area & pickup logic now uses vanilla-hopper area size. JEED compatibility added for some potion effects. Port Fishing Net and Mending Fishingrods compatibility from 1.12.2 #2067. Ender Apple now sends a message if nothing is found (void/flatworlds/etc). Growth enchant now skips IGrowable blocks that return false for 'canGrow();'. Many new config options added for: growth enchant, beheading enchant, battery, sprinkler, experience_pylon, fisher, scythes, and others in cyclic.toml" + ,"1.5.21":"#1933 Sack of Holding chest placement override added, with new config to revert back to legacy behavior if desired (overrideChestSingle). #2168 fix bug where ender shelf sometimes would not save contents when mined after exiting reloading world when client data desyncs. Added a percentage config and ignorelist config for cyclic:disarm enchantment (disarmPercentPerLevel, disarmIngoredMobs), resolves it dropping your copied weapon from alexsmobs:mimicube #2249. Fix #1878 layered and/or logic for multiple wireless transmitters on the same node " + ,"1.5.22":"Fix #2351 advanced crafting stick not opening. " + + + + + ,"1.5.23":"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": { @@ -116,8 +133,9 @@ ,"1.7.14":"Fix cyclic:auto_smelt enchant #2148 (NOTE: also check cyclic.toml and make sure enabled = true under auto_smelt header ). Fix Solar Generator #2154 #2155 . Ore prospector item has new config prospector.height . Prospector now tells player the count of ores detected; Fix #2159 laser beam rendering. Fix #2152, and chorus flight is now compatible with flight potion. Add feature #1913 Wireless redstone transmitter can now attempt to reach across dimensions (example nether to overworld, only if chunk is already loaded by something else). #2134 Add cyclic:gem_obsidian recipe that consumes Chorus Fruit, for consistency with 1.16.5 versions . Add inventory screen to Clay Battery and Solar Generator. Fix potion names. Fix #2132 wither rose duplicate crusher recipes. Add more default values to uncrafter ignore_list and ignore_recipe recipe ids (this means for newly generated default config files, the uncrafter will let you reverse dyes to other dyes but not dyes to flowers). Added 3 new to solidifier that use biomass fluid (moss_block, tallgrass). " ,"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":"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) " + }, @@ -139,6 +157,7 @@ ,"1.8.2":"(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.8.3":"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) " }, @@ -152,5 +171,7 @@ ,"1.10.2":"Fix buttons rendering a second version when hovering for a tooltip. (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.10.3":"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) " + } }