This commit is contained in:
Anuken
2020-05-21 19:20:37 -04:00
parent 55effc54bb
commit 4787a68a08
5 changed files with 10 additions and 9 deletions

View File

@@ -118,7 +118,9 @@ public class Blocks implements ContentList{
public void drawBase(Tile tile){} public void drawBase(Tile tile){}
}; };
cliff = new Cliff("cliff"); cliff = new Cliff("cliff"){{
inEditor = false;
}};
//Registers build blocks //Registers build blocks
//no reference is needed here since they can be looked up by name later //no reference is needed here since they can be looked up by name later

View File

@@ -684,7 +684,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
for(Block block : blocksOut){ for(Block block : blocksOut){
TextureRegion region = block.icon(Cicon.medium); 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); ImageButton button = new ImageButton(Tex.whiteui, Styles.clearTogglei);
button.getStyle().imageUp = new TextureRegionDrawable(region); button.getStyle().imageUp = new TextureRegionDrawable(region);

View File

@@ -339,7 +339,6 @@ public class ArcNetProvider implements NetProvider{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static class PacketSerializer implements NetSerializer{ public static class PacketSerializer implements NetSerializer{
static Cons2<Packet, ByteBuffer> writer = Packet::write;
@Override @Override
public Object read(ByteBuffer byteBuffer){ public Object read(ByteBuffer byteBuffer){
@@ -359,13 +358,11 @@ public class ArcNetProvider implements NetProvider{
byteBuffer.put((byte)-2); //code for framework message byteBuffer.put((byte)-2); //code for framework message
writeFramework(byteBuffer, (FrameworkMessage)o); writeFramework(byteBuffer, (FrameworkMessage)o);
}else{ }else{
if(!(o instanceof Packet)) if(!(o instanceof Packet)) throw new RuntimeException("All sent objects must implement be Packets! Class: " + o.getClass());
throw new RuntimeException("All sent objects must implement be Packets! Class: " + o.getClass());
byte id = Registrator.getID(o.getClass()); byte id = Registrator.getID(o.getClass());
if(id == -1) if(id == -1) throw new RuntimeException("Unregistered class: " + o.getClass());
throw new RuntimeException("Unregistered class: " + o.getClass());
byteBuffer.put(id); byteBuffer.put(id);
writer.get((Packet)o, byteBuffer); ((Packet)o).write(byteBuffer);
} }
} }

View File

@@ -56,6 +56,8 @@ public class Block extends UnlockableContent{
public final BlockBars bars = new BlockBars(); public final BlockBars bars = new BlockBars();
public final Consumers consumes = new Consumers(); 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. */ /** the last configuration value applied to this block. */
public @Nullable Object lastConfig; public @Nullable Object lastConfig;
/** whether to save the last config and apply it to newly placed blocks */ /** whether to save the last config and apply it to newly placed blocks */

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists