Skip to content

Commit

Permalink
Gravestone Fix (#18)
Browse files Browse the repository at this point in the history
* Update Buildscript & deps

* Protect Graves against Hungry Nodes

Hungry Nodes no longer destroy graves.

Graves also take longer to dig up if you are not the owner.

* Apply Spotless

* Graves *feel* more secure

Graves are quicker to dig for owners.
As for grave robbers, it takes half as long as mining obsidian to access graves.

Shovels won't discriminate and will open all graves instantly as usual
  • Loading branch information
DrParadox7 committed Nov 25, 2023
1 parent cf2c1c1 commit e3fc2a3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
dependencies {
api('com.github.GTNewHorizons:OpenModsLib:0.10.6:dev')


compileOnly('openperipheral:OpenPeripheralCore-API:3.4.1')
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.4.5-GTNH:dev')
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.4.12-GTNH:dev')
compileOnly('curse.maven:computercraft-67504:2269339')
}
16 changes: 15 additions & 1 deletion src/main/java/openblocks/common/block/BlockGrave.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package openblocks.common.block;

import java.util.Objects;
import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

import org.apache.logging.log4j.Level;

import openblocks.Config;
import openblocks.common.tileentity.TileEntityGrave;
import openmods.Log;
import openmods.block.BlockRotationMode;

Expand All @@ -23,7 +26,7 @@ public BlockGrave() {
setRotationMode(BlockRotationMode.FOUR_DIRECTIONS);
setBlockBounds(0, 0, 0, 1f, 0.2f, 1f);
setResistance(2000.0F);
setHardness(6.0F);
setHardness(25.0F);
setRenderMode(RenderMode.TESR_ONLY);
}

Expand Down Expand Up @@ -82,4 +85,15 @@ public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explos
world.provider.dimensionId);
}

@Override
public float getPlayerRelativeBlockHardness(EntityPlayer player, World world, int x, int y, int z) {
TileEntity tile = getTileEntity(world, x, y, z);

if (tile instanceof TileEntityGrave) {
TileEntityGrave graveStone = (TileEntityGrave) tile;
if (Objects.equals(graveStone.getUsername(), player.getDisplayName())) return 2.0F;
}

return super.getPlayerRelativeBlockHardness(player, world, x, y, z);
}
}

0 comments on commit e3fc2a3

Please sign in to comment.