Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
added rock breaker block entity
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Sep 29, 2024
1 parent 1bc3c95 commit 9738939
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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<BlockEntityRockBreaker> {
public BlockEntityRockBreaker(Machine<?> type, BlockPos pos, BlockState state) {
super(type, pos, state);
this.recipeHandler.set(() -> new MachineRecipeHandler<BlockEntityRockBreaker>(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);
}
}
2 changes: 1 addition & 1 deletion common/src/main/java/muramasa/gregtech/data/Machines.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 9738939

Please sign in to comment.