Allow hidden blocks to be revealed by plugins (#4017)

* Add revealedBlocks rule

(1/2)

* Use revealedBlocks rule

(2/2)
This commit is contained in:
Patrick 'Quezler' Mounier
2020-12-17 18:37:47 +01:00
committed by GitHub
parent 9f5183b36f
commit 056afa572e
2 changed files with 4 additions and 2 deletions

View File

@@ -80,6 +80,8 @@ public class Rules{
public Seq<WeatherEntry> weather = new Seq<>(1);
/** Blocks that cannot be placed. */
public ObjectSet<Block> bannedBlocks = new ObjectSet<>();
/** Reveals blocks normally hidden by build visibility */
public ObjectSet<Block> revealedBlocks = new ObjectSet<>();
/** Unlocked content names. Only used in multiplayer when the campaign is enabled. */
public ObjectSet<String> researched = new ObjectSet<>();
/** Whether ambient lighting is enabled. */

View File

@@ -522,7 +522,7 @@ public class Block extends UnlockableContent{
}
public boolean isVisible(){
return buildVisibility.visible() && !isHidden();
return (buildVisibility.visible() || state.rules.revealedBlocks.contains(this)) && !isHidden();
}
public boolean isPlaceable(){
@@ -718,7 +718,7 @@ public class Block extends UnlockableContent{
@Override
public boolean isHidden(){
return !buildVisibility.visible();
return !buildVisibility.visible() && !state.rules.revealedBlocks.contains(this);
}
@Override