Skip to content

Commit d9074da

Browse files
Eric BurnsEric Burns
Eric Burns
authored and
Eric Burns
committed
Updates to support Artemis-ODB-2.0.0-RC1
1 parent 111eb6b commit d9074da

File tree

4 files changed

+46
-8
lines changed

4 files changed

+46
-8
lines changed

contrib-core/src/main/java/net/mostlyoriginal/api/plugin/extendedcomponentmapper/M.java

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,22 @@ public A get(Entity e) throws ArrayIndexOutOfBoundsException {
169169
return mapper.get(e);
170170
}
171171

172+
@Deprecated
172173
public A getSafe(Entity e, boolean forceNewInstance) {
173-
return mapper.getSafe(e, forceNewInstance);
174+
A component = mapper.getSafe(e);
175+
176+
if(component == null && forceNewInstance) {
177+
component = mapper.create(e);
178+
}
179+
180+
return component;
174181
}
175182

176183
public A get(int entityId) throws ArrayIndexOutOfBoundsException {
177184
return mapper.get(entityId);
178185
}
179186

187+
@Deprecated
180188
public A getSafe(int entityId) {
181189
return mapper.getSafe(entityId);
182190
}
@@ -185,6 +193,7 @@ public boolean has(Entity e) throws ArrayIndexOutOfBoundsException {
185193
return mapper.has(e);
186194
}
187195

196+
@Deprecated
188197
public A getSafe(Entity e) {
189198
return mapper.getSafe(e);
190199
}
@@ -198,14 +207,33 @@ public static <T extends Component> M<T> getFor(Class<T> type, World world) {
198207
}
199208

200209
public A get(Entity e, boolean forceNewInstance) throws ArrayIndexOutOfBoundsException {
201-
return mapper.get(e, forceNewInstance);
210+
A component = mapper.get(e);
211+
212+
if(component == null && forceNewInstance) {
213+
component = mapper.create(e);
214+
}
215+
216+
return component;
202217
}
203218

204219
public A get(int entityId, boolean forceNewInstance) throws ArrayIndexOutOfBoundsException {
205-
return mapper.get(entityId, forceNewInstance);
220+
A component = mapper.get(entityId);
221+
222+
if(component == null && forceNewInstance) {
223+
component = mapper.create(entityId);
224+
}
225+
226+
return component;
206227
}
207228

229+
@Deprecated
208230
public A getSafe(int entityId, boolean forceNewInstance) {
209-
return mapper.getSafe(entityId, forceNewInstance);
231+
A component = mapper.getSafe(entityId);
232+
233+
if(component == null && forceNewInstance) {
234+
component = mapper.create(entityId);
235+
}
236+
237+
return component;
210238
}
211239
}

contrib-core/src/main/java/net/mostlyoriginal/api/system/core/PassiveSystem.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,17 @@
1212
public class PassiveSystem extends BaseSystem {
1313

1414
public PassiveSystem() {
15-
setEnabled(false);
15+
1616
}
1717

1818
@Override
1919
protected void processSystem() {
2020
// do nothing!
2121
}
22+
23+
@Override
24+
protected boolean checkProcessing() {
25+
setEnabled(false);
26+
return false;
27+
}
2228
}

contrib-core/src/main/java/net/mostlyoriginal/api/system/delegate/DeferredEntityProcessingSystem.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ public DeferredEntityProcessingSystem(Aspect.Builder aspect, EntityProcessPrinci
3939
super(aspect);
4040
this.aspect = aspect;
4141
this.principal = principal;
42-
setEnabled(false);
42+
}
43+
44+
@Override
45+
protected void initialize() {
46+
super.initialize();
47+
48+
setEnabled(false);
4349
}
4450

4551
/**

contrib-plugin-operations/src/main/java/net/mostlyoriginal/api/operation/OperationFactory.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package net.mostlyoriginal.api.operation;
22

33
import com.artemis.Component;
4-
import com.artemis.PackedComponent;
54
import com.artemis.PooledComponent;
65
import com.badlogic.gdx.math.Interpolation;
76
import com.badlogic.gdx.utils.reflect.ClassReflection;
@@ -218,7 +217,6 @@ public static LegacyAddOperation add(Component component)
218217
{
219218
Preconditions.checkNotNull(component);
220219
Preconditions.checkArgument(!ClassReflection.isAssignableFrom(PooledComponent.class, component.getClass()), "Does not support Pooled components.");
221-
Preconditions.checkArgument(!ClassReflection.isAssignableFrom(PackedComponent.class, component.getClass()), "Does not support Packed components.");
222220
final LegacyAddOperation operation = Operation.prepare(LegacyAddOperation.class);
223221
operation.component = component;
224222
return operation;

0 commit comments

Comments
 (0)