Skip to content

Commit

Permalink
Universal Graves 1.1.3:
Browse files Browse the repository at this point in the history
- Fixed errors with Origins mod
- You can now disable breaking of empty graves
  • Loading branch information
Patbox committed Oct 17, 2021
1 parent 7a41102 commit 26a4bb8
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 5 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ dependencies {
modImplementation include("eu.pb4:sgui:1.0.0-rc4+1.17.1")
modImplementation include("eu.pb4:hologram-api:0.2.1+1.17.1")
modImplementation include("eu.pb4:placeholder-api:1.1.1+1.17.1")
modImplementation include("eu.pb4:polymer:0.1.6+1.17.1")
modImplementation include("fr.catcore:server-translations-api:1.4.5+1.17")
modImplementation include("eu.pb4:polymer:0.1.8+1.17.1")
modImplementation include("fr.catcore:server-translations-api:1.4.6+1.17")
modImplementation include("me.lucko:fabric-permissions-api:0.1-SNAPSHOT")

modCompileOnly "dev.emi:trinkets:3.0.4"
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.11.6

# Mod Properties
mod_version = 1.1.2+1.17.1
mod_version = 1.1.3+1.17.1
maven_group = eu.pb4
archives_base_name = graves

Expand Down
1 change: 1 addition & 0 deletions src/main/java/eu/pb4/graves/config/data/ConfigData.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class ConfigData extends VersionedConfigData implements Cloneable {
public boolean isProtected = true;
public int protectionTime = 300;
public int breakingTime = 900;
public boolean breakEmptyGraves = true;

public String xpStorageType = GravesXPCalculation.VANILLA.name;
public double xpPercentTypeValue = 100;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/eu/pb4/graves/grave/GraveBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
if (blockEntity instanceof GraveBlockEntity grave && grave.info.canTakeFrom(player)) {
if (grave.info.itemCount > 0) {
new GraveGui((ServerPlayerEntity) player, grave).open();
} else {
} else if (ConfigManager.getConfig().configData.breakEmptyGraves) {
world.setBlockState(pos, grave.replacedBlockState, Block.NOTIFY_ALL);
} else {
grave.clearGrave();
}
return ActionResult.SUCCESS;
}
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/eu/pb4/graves/grave/GraveBlockEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,16 @@ public boolean canInsert(int slot, ItemStack stack, @Nullable Direction dir) {
public boolean canExtract(int slot, ItemStack stack, Direction dir) {
return false;
}

public void clearGrave() {
if (this.info.xp != 0) {
ExperienceOrbEntity.spawn((ServerWorld) this.world, Vec3d.ofCenter(this.getPos()), this.info.xp);
this.info.xp = 0;
}
if (this.info.itemCount != 0) {
ItemScatterer.spawn(this.world, this.pos, this);
this.info.itemCount = 0;
}
GraveManager.INSTANCE.remove(this.info);
}
}
7 changes: 6 additions & 1 deletion src/main/java/eu/pb4/graves/grave/GraveGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ public void onTick() {
public void onClose() {
if (this.grave.isEmpty() && !this.grave.isRemoved()) {
assert this.grave.getWorld() != null;
this.grave.getWorld().setBlockState(this.grave.getPos(), this.grave.replacedBlockState, Block.NOTIFY_ALL);

if (ConfigManager.getConfig().configData.breakEmptyGraves) {
this.grave.getWorld().setBlockState(this.grave.getPos(), this.grave.replacedBlockState, Block.NOTIFY_ALL);
} else {
this.grave.clearGrave();
}
} else {
this.grave.updateItemCount();
}
Expand Down

0 comments on commit 26a4bb8

Please sign in to comment.