Skip to content

Commit 148dcde

Browse files
committed
Resolve clash master branch. Solving things twice! Oops.
2 parents e95cca4 + 6edce7f commit 148dcde

File tree

3 files changed

+57
-8
lines changed

3 files changed

+57
-8
lines changed

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

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

172+
@Deprecated
173+
public A getSafe(Entity e, boolean forceNewInstance) {
174+
A component = mapper.getSafe(e);
175+
176+
if(component == null && forceNewInstance) {
177+
component = mapper.create(e);
178+
}
179+
180+
return component;
181+
}
182+
172183
public A get(int entityId) throws ArrayIndexOutOfBoundsException {
173184
return mapper.get(entityId);
174185
}
@@ -199,4 +210,35 @@ public boolean has(int entityId) {
199210
public static <T extends Component> M<T> getFor(Class<T> type, World world) {
200211
return world.getSystem(ExtendedComponentMapperManager.class).getFor(type);
201212
}
213+
214+
public A get(Entity e, boolean forceNewInstance) throws ArrayIndexOutOfBoundsException {
215+
A component = mapper.get(e);
216+
217+
if(component == null && forceNewInstance) {
218+
component = mapper.create(e);
219+
}
220+
221+
return component;
222+
}
223+
224+
public A get(int entityId, boolean forceNewInstance) throws ArrayIndexOutOfBoundsException {
225+
A component = mapper.get(entityId);
226+
227+
if(component == null && forceNewInstance) {
228+
component = mapper.create(entityId);
229+
}
230+
231+
return component;
232+
}
233+
234+
@Deprecated
235+
public A getSafe(int entityId, boolean forceNewInstance) {
236+
A component = mapper.getSafe(entityId);
237+
238+
if(component == null && forceNewInstance) {
239+
component = mapper.create(entityId);
240+
}
241+
242+
return component;
243+
}
202244
}

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@
1111
*/
1212
public class PassiveSystem extends BaseSystem {
1313

14-
@Override
15-
protected void initialize() {
16-
setEnabled(false);
14+
public PassiveSystem() {
15+
1716
}
1817

1918
@Override
2019
protected void processSystem() {
2120
// do nothing!
2221
}
22+
23+
@Override
24+
protected boolean checkProcessing() {
25+
setEnabled(false);
26+
return false;
27+
}
2328
}

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ public abstract class DeferredEntityProcessingSystem extends BaseEntitySystem {
2828
private final Aspect.Builder aspect;
2929
private final EntityProcessPrincipal principal;
3030

31-
@Override
32-
protected void initialize() {
33-
setEnabled(false);
34-
}
35-
3631
/**
3732
* Creates an entity system that uses the specified aspect as a matcher
3833
* against entities.
@@ -45,6 +40,13 @@ public DeferredEntityProcessingSystem(Aspect.Builder aspect, EntityProcessPrinci
4540
this.aspect = aspect;
4641
this.principal = principal;
4742
}
43+
44+
@Override
45+
protected void initialize() {
46+
super.initialize();
47+
48+
setEnabled(false);
49+
}
4850

4951
/**
5052
* Process a entity this system is interested in.

0 commit comments

Comments
 (0)