diff --git a/.gitignore b/.gitignore index e9f029335a..10f2675900 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ steam_appid.txt /android/assets/mindustry-maps/ /android/assets/mindustry-saves/ /core/assets/gifexport/ +#/annotations/src/main/resources/META-INF/services /core/assets/version.properties /core/assets/locales /ios/src/mindustry/gen/ diff --git a/annotations/src/main/resources/META-INF/services/javax.annotation.processing.Processor b/annotations/src/main/resources/META-INF/services/javax.annotation.processing.Processor deleted file mode 100644 index 8bae50dbf8..0000000000 --- a/annotations/src/main/resources/META-INF/services/javax.annotation.processing.Processor +++ /dev/null @@ -1,5 +0,0 @@ -mindustry.annotations.remote.RemoteMethodAnnotationProcessor -mindustry.annotations.impl.StructAnnotationProcessor -mindustry.annotations.impl.SerializeAnnotationProcessor -mindustry.annotations.impl.AssetsAnnotationProcessor -mindustry.annotations.impl.CallSuperAnnotationProcessor diff --git a/core/src/mindustry/world/blocks/distribution/Conveyor.java b/core/src/mindustry/world/blocks/distribution/Conveyor.java index ea81cdbb48..0b47e3815c 100644 --- a/core/src/mindustry/world/blocks/distribution/Conveyor.java +++ b/core/src/mindustry/world/blocks/distribution/Conveyor.java @@ -312,7 +312,7 @@ public class Conveyor extends Block implements Autotiler{ public boolean acceptItem(Item item, Tile tile, Tile source){ int direction = source == null ? 0 : Math.abs(source.relativeTo(tile.x, tile.y) - tile.rotation()); float minitem = tile.ent().minitem; - return (((direction == 0) && minitem > itemSpace) || + return (((direction == 0) && minitem >= itemSpace) || ((direction % 2 == 1) && minitem > 0.52f)) && (source == null || !(source.block().rotate && (source.rotation() + 2) % 4 == tile.rotation())); } diff --git a/tests/src/test/java/ApplicationTests.java b/tests/src/test/java/ApplicationTests.java index 722bf246d0..d145b931f5 100644 --- a/tests/src/test/java/ApplicationTests.java +++ b/tests/src/test/java/ApplicationTests.java @@ -1,25 +1,23 @@ -import arc.ApplicationCore; -import arc.Core; -import arc.backend.headless.HeadlessApplication; +import arc.*; +import arc.backend.headless.*; +import arc.math.geom.*; import arc.struct.*; -import arc.math.geom.Point2; -import arc.util.Log; -import arc.util.Time; -import mindustry.Vars; +import arc.util.*; +import mindustry.*; import mindustry.content.*; -import mindustry.core.GameState.State; import mindustry.core.*; -import mindustry.entities.traits.BuilderTrait.BuildRequest; -import mindustry.entities.type.BaseUnit; +import mindustry.core.GameState.*; +import mindustry.ctype.*; +import mindustry.entities.traits.BuilderTrait.*; +import mindustry.entities.type.*; import mindustry.entities.type.base.*; -import mindustry.game.Team; -import mindustry.io.SaveIO; -import mindustry.maps.Map; -import mindustry.net.*; -import mindustry.ctype.ContentType; -import mindustry.type.Item; +import mindustry.game.*; +import mindustry.io.*; +import mindustry.maps.*; +import mindustry.net.Net; +import mindustry.type.*; import mindustry.world.*; -import mindustry.world.blocks.BlockPart; +import mindustry.world.blocks.*; import org.junit.jupiter.api.*; import static mindustry.Vars.*; @@ -216,6 +214,49 @@ public class ApplicationTests{ assertTrue(state.teams.playerCores().size > 0); } + @Test + void conveyorBench(){ + int[] items = {0}; + + world.loadMap(testMap); + state.set(State.playing); + int length = 10; + world.tile(0, 0).setBlock(Blocks.itemSource); + world.tile(0, 0).configureAny(Items.copper.id); + + Array entities = Array.with(world.tile(0, 0).entity); + + for(int i = 0; i < length; i++){ + world.tile(i + 1, 0).setBlock(Blocks.conveyor); + world.tile(i + 1, 0).rotation(0); + entities.add(world.tile(i + 1, 0).entity); + } + + world.tile(length + 1, 0).setBlock(new Block("___"){ + @Override + public void handleItem(Item item, Tile tile, Tile source){ + items[0] ++; + } + + @Override + public boolean acceptItem(Item item, Tile tile, Tile source){ + return true; + } + }); + + //warmup + for(int i = 0; i < 100000; i++){ + entities.each(TileEntity::update); + } + + Time.mark(); + for(int i = 0; i < 200000; i++){ + entities.each(TileEntity::update); + } + Log.info(Time.elapsed() + "ms to process " + items[0] + " items"); + assertTrue(items[0] > 0); + } + @Test void load77Save(){ resetWorld();