mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Leaf-eating Generator done
This commit is contained in:
parent
ec4b79ffd8
commit
5182ac8b92
6 changed files with 61 additions and 20 deletions
|
@ -1,4 +1,4 @@
|
|||
// 1.20.4 2024-03-11T02:13:51.6169998 Recipes
|
||||
// 1.20.4 2024-03-11T22:16:44.4386235 Recipes
|
||||
4d3128b37a7153882a9324cda49b5069207561c5 data/actuallyadditions/recipes/atomic_reconstructor.json
|
||||
b0367f5012651764931e8b8fd0c5bcca4e8614c0 data/actuallyadditions/recipes/battery_box.json
|
||||
7e05cd54092b998dfdbd2221235dd52576ec79eb data/actuallyadditions/recipes/black_quartz_block.json
|
||||
|
@ -49,6 +49,7 @@ ff81da8a0f6632779414c0512100696a11771814 data/actuallyadditions/recipes/hopping_
|
|||
4acb117a6727554073a78ed81bcd2b0b1af53bec data/actuallyadditions/recipes/laser_relay_item_advanced.json
|
||||
2c37821d291542d4821842501e07bfad38181553 data/actuallyadditions/recipes/lava_factory_casing.json
|
||||
76f9eb2b859198eec4c50d992c3715633d5109a8 data/actuallyadditions/recipes/lava_factory_controller.json
|
||||
1e3936f80be1540cd3d6ed570c1ed6381227db7d data/actuallyadditions/recipes/leaf_generator.json
|
||||
73696fd4e851f440a9850485fc9ad03fc63442a9 data/actuallyadditions/recipes/oil_generator.json
|
||||
8c78ebb9351b98ffe368391a391b90385c0b8b7f data/actuallyadditions/recipes/placer.json
|
||||
184acfb5fd3799b3fbe35150c67b6530581f8bf1 data/actuallyadditions/recipes/powered_furnace.json
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "misc",
|
||||
"key": {
|
||||
"A": {
|
||||
"item": "actuallyadditions:advanced_coil"
|
||||
},
|
||||
"C": {
|
||||
"item": "actuallyadditions:enori_crystal"
|
||||
},
|
||||
"E": {
|
||||
"item": "actuallyadditions:empowered_restonia_crystal_block"
|
||||
},
|
||||
"I": {
|
||||
"item": "actuallyadditions:iron_casing"
|
||||
},
|
||||
"L": {
|
||||
"tag": "minecraft:leaves"
|
||||
}
|
||||
},
|
||||
"pattern": [
|
||||
"CIC",
|
||||
"ELE",
|
||||
"CAC"
|
||||
],
|
||||
"result": {
|
||||
"item": "actuallyadditions:leaf_generator"
|
||||
}
|
||||
}
|
|
@ -399,6 +399,16 @@ public class BlockRecipeGenerator extends RecipeProvider {
|
|||
.define('A', ActuallyItems.ADVANCED_COIL.get())
|
||||
.define('I', ActuallyBlocks.IRON_CASING.get())
|
||||
.save(recipeOutput);
|
||||
|
||||
// Leaf-eating Generator
|
||||
Recipe.shaped(ActuallyBlocks.LEAF_GENERATOR.getItem())
|
||||
.pattern("CIC", "ELE", "CAC")
|
||||
.define('C', ActuallyItems.ENORI_CRYSTAL.get())
|
||||
.define('I', ActuallyBlocks.IRON_CASING.get())
|
||||
.define('E', ActuallyBlocks.EMPOWERED_RESTONIA_CRYSTAL.get())
|
||||
.define('L', ItemTags.LEAVES)
|
||||
.define('A', ActuallyItems.ADVANCED_COIL.get())
|
||||
.save(recipeOutput);
|
||||
}
|
||||
|
||||
public static class Recipe {
|
||||
|
|
|
@ -42,6 +42,9 @@ public class CommonConfig {
|
|||
public static ModConfigSpec.IntValue OIL_GENERATOR_TRANSFER;
|
||||
public static ModConfigSpec.IntValue MINER_LENS_ENERGY;
|
||||
public static ModConfigSpec.BooleanValue LASER_RELAY_LOSS;
|
||||
public static ModConfigSpec.IntValue LEAF_GENERATOR_COOLDOWN;
|
||||
public static ModConfigSpec.IntValue LEAF_GENERATOR_CF_PER_LEAF;
|
||||
public static ModConfigSpec.IntValue LEAF_GENERATOR_AREA;
|
||||
|
||||
public static void build() {
|
||||
BUILDER.comment("Machine Settings").push("machineSettings");
|
||||
|
@ -51,6 +54,9 @@ public class CommonConfig {
|
|||
OIL_GENERATOR_TRANSFER = BUILDER.comment("The amount of power the oil generator can transfer per tick.").defineInRange("oilGeneratorTransfer", 500, 100, Integer.MAX_VALUE);
|
||||
MINER_LENS_ENERGY = BUILDER.comment("The energy use of the Atomic Reconstructor's Mining Lens.").defineInRange("minerLensEnergy", 60000, 1, Integer.MAX_VALUE);
|
||||
LASER_RELAY_LOSS = BUILDER.comment("If Energy Laser Relays should have energy loss.").define("laserRelayLoss", true);
|
||||
LEAF_GENERATOR_COOLDOWN = BUILDER.comment("The cooldown between two generation cycles of the Leaf Generator, in ticks").defineInRange("leafGeneratorCooldown", 5, 1, Integer.MAX_VALUE);
|
||||
LEAF_GENERATOR_CF_PER_LEAF = BUILDER.comment("The Leaf Generator's Energy Production in CF/Leaf").defineInRange("leafGeneratorCPPerLeaf", 300, 1, Integer.MAX_VALUE);
|
||||
LEAF_GENERATOR_AREA = BUILDER.comment("The size of the Leaf Generator's harvesting area. Default is 7x7x7, must be an odd number.").defineInRange("leafGeneratorArea", 7, 1, Integer.MAX_VALUE);
|
||||
|
||||
BUILDER.pop();
|
||||
}
|
||||
|
|
|
@ -11,11 +11,12 @@
|
|||
package de.ellpeck.actuallyadditions.mod.tile;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
||||
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
@ -24,9 +25,9 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.neoforged.neoforge.energy.IEnergyStorage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TileEntityLeafGenerator extends TileEntityBase implements ISharingEnergyProvider, IEnergyDisplay {
|
||||
|
||||
|
@ -62,25 +63,19 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE
|
|||
|
||||
if (!tile.isRedstonePowered) {
|
||||
|
||||
if (tile.nextUseCounter >= ConfigIntValues.LEAF_GENERATOR_COOLDOWN.getValue()) {
|
||||
if (tile.nextUseCounter >= CommonConfig.Machines.LEAF_GENERATOR_COOLDOWN.get()) {
|
||||
tile.nextUseCounter = 0;
|
||||
|
||||
int energyProduced = ConfigIntValues.LEAF_GENERATOR_CF_PER_LEAF.getValue();
|
||||
int energyProduced = CommonConfig.Machines.LEAF_GENERATOR_CF_PER_LEAF.get();
|
||||
if (energyProduced > 0 && energyProduced <= tile.storage.getMaxEnergyStored() - tile.storage.getEnergyStored()) {
|
||||
List<BlockPos> breakPositions = new ArrayList<>();
|
||||
|
||||
int range = ConfigIntValues.LEAF_GENERATOR_AREA.getValue();
|
||||
for (int reachX = -range; reachX < range + 1; reachX++) {
|
||||
for (int reachZ = -range; reachZ < range + 1; reachZ++) {
|
||||
for (int reachY = -range; reachY < range + 1; reachY++) {
|
||||
BlockPos offsetPos = pos.offset(reachX, reachY, reachZ);
|
||||
Block block = level.getBlockState(offsetPos).getBlock();
|
||||
if (block instanceof LeavesBlock) { // TODO: [port] validate tile is a good way of checking if something is a leaf
|
||||
breakPositions.add(offsetPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int range = CommonConfig.Machines.LEAF_GENERATOR_AREA.get();
|
||||
List<BlockPos> breakPositions = BlockPos.betweenClosedStream(
|
||||
pos.offset(-range, -range, -range),
|
||||
pos.offset(range, range, range)).map(BlockPos::immutable).collect(Collectors.toList());
|
||||
breakPositions.removeIf(blockPos -> {
|
||||
BlockState offsetState = level.getBlockState(blockPos);
|
||||
return !(offsetState.getBlock() instanceof LeavesBlock || offsetState.is(BlockTags.LEAVES));
|
||||
});
|
||||
|
||||
if (!breakPositions.isEmpty()) {
|
||||
Collections.shuffle(breakPositions);
|
||||
|
|
|
@ -170,7 +170,7 @@
|
|||
"block.actuallyadditions.flax": "Flax Plant",
|
||||
"block.actuallyadditions.coffee_machine": "Coffee Maker",
|
||||
"block.actuallyadditions.xp_solidifier": "Experience Solidifier",
|
||||
"block.actuallyadditions.leaf_generator": "Leaf-Eating Generator (wip)",
|
||||
"block.actuallyadditions.leaf_generator": "Leaf-Eating Generator",
|
||||
"block.actuallyadditions.long_range_breaker": "Long-Range Breaker (wip)",
|
||||
"block.actuallyadditions.ranged_collector": "Ranged Collector",
|
||||
"block.actuallyadditions.laser_relay": "Energy Laser Relay (wip)",
|
||||
|
|
Loading…
Reference in a new issue