open container flag changes. fix #14
This commit is contained in:
parent
bf69a0a1dd
commit
806ea3fbae
@ -1,3 +1,9 @@
|
||||
Flan 1.1.5
|
||||
======================
|
||||
- Make tile entitys always at least be in the open container flag.
|
||||
Making them always be protected. This can be turned off to only include inventory type tile entities.
|
||||
#14
|
||||
|
||||
Flan 1.1.4
|
||||
======================
|
||||
- Directly check player class for item usage. So fake players get ignored.
|
||||
|
@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx2G
|
||||
loader_version=0.9.1+build.205
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.1.4
|
||||
mod_version = 1.1.5
|
||||
maven_group = com.flemmli97.flan
|
||||
archives_base_name = flan
|
||||
|
||||
|
@ -29,6 +29,7 @@ public class Config {
|
||||
public int ticksForNextBlock = 1200;
|
||||
public int minClaimsize = 100;
|
||||
public int defaultClaimDepth = 10;
|
||||
public boolean lenientBlockEntityCheck;
|
||||
|
||||
public String[] blacklistedWorlds = new String[0];
|
||||
public boolean worldWhitelist;
|
||||
@ -70,6 +71,8 @@ public class Config {
|
||||
this.minClaimsize = ConfigHandler.fromJson(obj, "minClaimsize", this.minClaimsize);
|
||||
this.defaultClaimDepth = ConfigHandler.fromJson(obj, "defaultClaimDepth", this.defaultClaimDepth);
|
||||
JsonArray arr = ConfigHandler.arryFromJson(obj, "blacklistedWorlds");
|
||||
this.lenientBlockEntityCheck = ConfigHandler.fromJson(obj, "lenientBlockEntityCheck", this.lenientBlockEntityCheck);
|
||||
|
||||
this.blacklistedWorlds = new String[arr.size()];
|
||||
for (int i = 0; i < arr.size(); i++)
|
||||
this.blacklistedWorlds[i] = arr.get(i).getAsString();
|
||||
@ -111,6 +114,7 @@ public class Config {
|
||||
obj.addProperty("ticksForNextBlock", this.ticksForNextBlock);
|
||||
obj.addProperty("minClaimsize", this.minClaimsize);
|
||||
obj.addProperty("defaultClaimDepth", this.defaultClaimDepth);
|
||||
obj.addProperty("lenientBlockEntityCheck", this.lenientBlockEntityCheck);
|
||||
JsonArray arr = new JsonArray();
|
||||
obj.add("blacklistedWorlds", arr);
|
||||
obj.addProperty("worldWhitelist", this.worldWhitelist);
|
||||
|
@ -10,6 +10,7 @@ import com.flemmli97.flan.player.EnumDisplayType;
|
||||
import com.flemmli97.flan.player.PlayerClaimData;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.DoorBlock;
|
||||
import net.minecraft.block.InventoryProvider;
|
||||
import net.minecraft.block.LecternBlock;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.LecternBlockEntity;
|
||||
@ -67,22 +68,6 @@ public class BlockInteractEvents {
|
||||
boolean cancelBlockInteract = player.shouldCancelInteraction() && emptyHand;
|
||||
if (!cancelBlockInteract) {
|
||||
BlockState state = world.getBlockState(hitResult.getBlockPos());
|
||||
BlockEntity blockEntity = world.getBlockEntity(hitResult.getBlockPos());
|
||||
if (blockEntity != null) {
|
||||
if (blockEntity instanceof Inventory) {
|
||||
if (claim.canInteract(player, EnumPermission.OPENCONTAINER, hitResult.getBlockPos(), true))
|
||||
return ActionResult.PASS;
|
||||
PlayerClaimData.get(player).addDisplayClaim(claim, EnumDisplayType.MAIN, player.getBlockPos().getY());
|
||||
return ActionResult.FAIL;
|
||||
}
|
||||
if (blockEntity instanceof LecternBlockEntity) {
|
||||
if (claim.canInteract(player, EnumPermission.LECTERNTAKE, hitResult.getBlockPos(), false))
|
||||
return ActionResult.PASS;
|
||||
if (state.get(LecternBlock.HAS_BOOK))
|
||||
LockedLecternScreenHandler.create(player, (LecternBlockEntity) blockEntity);
|
||||
return ActionResult.FAIL;
|
||||
}
|
||||
}
|
||||
EnumPermission perm = BlockToPermissionMap.getFromBlock(state.getBlock());
|
||||
//Pressureplate handled elsewhere
|
||||
if (perm != null && perm != EnumPermission.PRESSUREPLATE) {
|
||||
@ -101,6 +86,22 @@ public class BlockInteractEvents {
|
||||
PlayerClaimData.get(player).addDisplayClaim(claim, EnumDisplayType.MAIN, player.getBlockPos().getY());
|
||||
return ActionResult.FAIL;
|
||||
}
|
||||
BlockEntity blockEntity = world.getBlockEntity(hitResult.getBlockPos());
|
||||
if (blockEntity != null) {
|
||||
if (blockEntity instanceof LecternBlockEntity) {
|
||||
if (claim.canInteract(player, EnumPermission.LECTERNTAKE, hitResult.getBlockPos(), false))
|
||||
return ActionResult.PASS;
|
||||
if (state.get(LecternBlock.HAS_BOOK))
|
||||
LockedLecternScreenHandler.create(player, (LecternBlockEntity) blockEntity);
|
||||
return ActionResult.FAIL;
|
||||
}
|
||||
if (!ConfigHandler.config.lenientBlockEntityCheck || blockEntity instanceof Inventory || blockEntity instanceof InventoryProvider) {
|
||||
if (claim.canInteract(player, EnumPermission.OPENCONTAINER, hitResult.getBlockPos(), true))
|
||||
return ActionResult.PASS;
|
||||
PlayerClaimData.get(player).addDisplayClaim(claim, EnumDisplayType.MAIN, player.getBlockPos().getY());
|
||||
return ActionResult.FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ActionResult.PASS;
|
||||
|
Loading…
x
Reference in New Issue
Block a user