diff --git a/common/src/main/java/muramasa/gregtech/blockentity/single/BlockEntityRockBreaker.java b/common/src/main/java/muramasa/gregtech/blockentity/single/BlockEntityRockBreaker.java new file mode 100644 index 000000000..9c3ec63ea --- /dev/null +++ b/common/src/main/java/muramasa/gregtech/blockentity/single/BlockEntityRockBreaker.java @@ -0,0 +1,38 @@ +package muramasa.gregtech.blockentity.single; + +import muramasa.antimatter.blockentity.BlockEntityMachine; +import muramasa.antimatter.capability.machine.MachineRecipeHandler; +import muramasa.antimatter.machine.types.Machine; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.Fluids; +import org.jetbrains.annotations.Nullable; + +public class BlockEntityRockBreaker extends BlockEntityMachine { + public BlockEntityRockBreaker(Machine type, BlockPos pos, BlockState state) { + super(type, pos, state); + this.recipeHandler.set(() -> new MachineRecipeHandler(this){ + @Override + protected boolean canRecipeContinue() { + return super.canRecipeContinue() && this.hasWaterAndLava(); + } + + public boolean hasWaterAndLava() { + boolean water = false; + boolean lava = false; + for(Direction direction : Direction.Plane.HORIZONTAL) { + if (this.tile.level.isWaterAt(this.tile.getBlockPos().relative(direction))) water = true; + if (this.tile.level.getFluidState(this.tile.getBlockPos().relative(direction)).getType() == Fluids.LAVA) lava = true; + } + return water && lava; + } + }); + } + + @Override + public void onBlockUpdate(BlockPos neighbor) { + super.onBlockUpdate(neighbor); + this.recipeHandler.ifPresent(MachineRecipeHandler::checkRecipe); + } +} \ No newline at end of file diff --git a/common/src/main/java/muramasa/gregtech/data/Machines.java b/common/src/main/java/muramasa/gregtech/data/Machines.java index 9d989f25c..efc13f6a6 100644 --- a/common/src/main/java/muramasa/gregtech/data/Machines.java +++ b/common/src/main/java/muramasa/gregtech/data/Machines.java @@ -132,7 +132,7 @@ public class Machines { }); public static BasicMachine RECYCLER = new BasicMachine(GTIRef.ID, "recycler").setMap(RecipeMaps.RECYCLER).addFlags(GUI, ITEM, FLUID); public static BasicMachine REPLICATOR = new BasicMachine(GTIRef.ID, "replicator").setTiers(Tier.getStandardWithIV()).setMap(RecipeMaps.REPLICATOR).addFlags(GUI, ITEM, FLUID); - public static BasicMachine ROCK_BREAKER = new BasicMachine(GTIRef.ID, "rock_breaker").setMap(RecipeMaps.ROCK_BREAKER).addFlags(GUI, ITEM); + public static BasicMachine ROCK_BREAKER = new BasicMachine(GTIRef.ID, "rock_breaker").setMap(RecipeMaps.ROCK_BREAKER).addFlags(GUI, ITEM).setTile(BlockEntityRockBreaker::new); public static BasicMachine SCANNER = new BasicMachine(GTIRef.ID, "scanner").setTiers(Tier.getStandardWithIV()).setMap(RecipeMaps.SCANNER).addFlags(GUI, ITEM, FLUID).setTile(BlockEntityScanner::new).setSound(GregTechSounds.MAGNETIZER, 0.6f); public static BasicMachine SEISMIC_PROSPECTOR = new BasicMachine(GTIRef.ID, "seismic_prospector").setTiers(LV, EV).setTile(BlockEntitySeismicProspector::new).setOutputCover(ICover.emptyFactory); public static BasicMachine SIFTER = new BasicMachine(GTIRef.ID, "sifter").setMap(RecipeMaps.SIFTER).addFlags(GUI, ITEM); diff --git a/gradle.properties b/gradle.properties index c6548821d..89c0057db 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx5G org.gradle.daemon=false org.gradle.parallel=true -mod_version=0.2.1-pre59 +mod_version=0.2.1-pre60 archive_base_name=gti modid=gregtech @@ -15,7 +15,7 @@ fabric_api_version=0.76.0+1.18.2 fabric_transfer_api_version=1.6.+ fabric_loader_version=0.14.6 -gt_core_version=0.1.1-pre39 +gt_core_version=0.1.1-pre39.1 terraform_version=3.1.4 jei_version=10.2.1.1004 crafttweaker_version=9.1.207