Allow hidden blocks to be revealed by plugins (#4017)
* Add revealedBlocks rule (1/2) * Use revealedBlocks rule (2/2)
This commit is contained in:
committed by
GitHub
parent
9f5183b36f
commit
056afa572e
@@ -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. */
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user