Mod bugfixes
This commit is contained in:
@@ -6,6 +6,7 @@ import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import arc.util.io.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.units.*;
|
||||
@@ -183,5 +184,25 @@ public class Duct extends Block implements Autotiler{
|
||||
next = front();
|
||||
nextc = next instanceof DuctBuild d ? d : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte version(){
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Writes write){
|
||||
super.write(write);
|
||||
write.b(recDir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(Reads read, byte revision){
|
||||
super.read(read, revision);
|
||||
if(revision >= 1){
|
||||
recDir = read.b();
|
||||
}
|
||||
current = items.first();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class DuctRouter extends Block{
|
||||
if(current == null) return null;
|
||||
|
||||
for(int i = -1; i <= 1; i++){
|
||||
Building other = nearby(Mathf.mod(rotation + i + cdump, 4));
|
||||
Building other = nearby(Mathf.mod(rotation + (((i + cdump + 1) % 3) - 1), 4));
|
||||
if(other != null && other.team == team && other.acceptItem(this, current)){
|
||||
return other;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package mindustry.world.meta;
|
||||
|
||||
import arc.struct.*;
|
||||
import mindustry.*;
|
||||
|
||||
public class Attribute{
|
||||
public static Attribute[] all = {};
|
||||
public static ObjectMap<String, Attribute> map = new ObjectMap<>();
|
||||
|
||||
public static final Attribute
|
||||
/** Heat content. Used for thermal generator yield. */
|
||||
@@ -36,6 +38,11 @@ public class Attribute{
|
||||
return name;
|
||||
}
|
||||
|
||||
/** Never returns null, may throw an exception if not found. */
|
||||
public static Attribute get(String name){
|
||||
return map.getThrow(name, () -> new IllegalArgumentException("Unknown Attribute type: " + name));
|
||||
}
|
||||
|
||||
/** Automatically registers this attribute for use. Do not call after mod init. */
|
||||
public static Attribute add(String name){
|
||||
Attribute a = new Attribute(all.length, name);
|
||||
@@ -43,6 +50,7 @@ public class Attribute{
|
||||
all = new Attribute[all.length + 1];
|
||||
System.arraycopy(prev, 0, all, 0, a.id);
|
||||
all[a.id] = a;
|
||||
map.put(name, a);
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user