From 4787a68a08ffeb4844c1963dd3a863a9ad1f6b52 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 21 May 2020 19:20:37 -0400 Subject: [PATCH] Cleanup --- core/src/mindustry/content/Blocks.java | 4 +++- core/src/mindustry/editor/MapEditorDialog.java | 2 +- core/src/mindustry/net/ArcNetProvider.java | 9 +++------ core/src/mindustry/world/Block.java | 2 ++ gradle/wrapper/gradle-wrapper.properties | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 3dc304304e..df399d2b0e 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -118,7 +118,9 @@ public class Blocks implements ContentList{ public void drawBase(Tile tile){} }; - cliff = new Cliff("cliff"); + cliff = new Cliff("cliff"){{ + inEditor = false; + }}; //Registers build blocks //no reference is needed here since they can be looked up by name later diff --git a/core/src/mindustry/editor/MapEditorDialog.java b/core/src/mindustry/editor/MapEditorDialog.java index 23199d17f1..051e32f24f 100644 --- a/core/src/mindustry/editor/MapEditorDialog.java +++ b/core/src/mindustry/editor/MapEditorDialog.java @@ -684,7 +684,7 @@ public class MapEditorDialog extends Dialog implements Disposable{ for(Block block : blocksOut){ TextureRegion region = block.icon(Cicon.medium); - if(!Core.atlas.isFound(region)) continue; + if(!Core.atlas.isFound(region) || !block.inEditor) continue; ImageButton button = new ImageButton(Tex.whiteui, Styles.clearTogglei); button.getStyle().imageUp = new TextureRegionDrawable(region); diff --git a/core/src/mindustry/net/ArcNetProvider.java b/core/src/mindustry/net/ArcNetProvider.java index 67a106f9d7..400f99f772 100644 --- a/core/src/mindustry/net/ArcNetProvider.java +++ b/core/src/mindustry/net/ArcNetProvider.java @@ -339,7 +339,6 @@ public class ArcNetProvider implements NetProvider{ @SuppressWarnings("unchecked") public static class PacketSerializer implements NetSerializer{ - static Cons2 writer = Packet::write; @Override public Object read(ByteBuffer byteBuffer){ @@ -359,13 +358,11 @@ public class ArcNetProvider implements NetProvider{ byteBuffer.put((byte)-2); //code for framework message writeFramework(byteBuffer, (FrameworkMessage)o); }else{ - if(!(o instanceof Packet)) - throw new RuntimeException("All sent objects must implement be Packets! Class: " + o.getClass()); + if(!(o instanceof Packet)) throw new RuntimeException("All sent objects must implement be Packets! Class: " + o.getClass()); byte id = Registrator.getID(o.getClass()); - if(id == -1) - throw new RuntimeException("Unregistered class: " + o.getClass()); + if(id == -1) throw new RuntimeException("Unregistered class: " + o.getClass()); byteBuffer.put(id); - writer.get((Packet)o, byteBuffer); + ((Packet)o).write(byteBuffer); } } diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 4ad376ed3c..fa66d88e62 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -56,6 +56,8 @@ public class Block extends UnlockableContent{ public final BlockBars bars = new BlockBars(); public final Consumers consumes = new Consumers(); + /** whether this block is visible in the editor */ + public boolean inEditor = true; /** the last configuration value applied to this block. */ public @Nullable Object lastConfig; /** whether to save the last config and apply it to newly placed blocks */ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4c5803d13c..a4f0001d20 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists