|
18 | 18 | import de.geolykt.starloader.api.NamespacedKey; |
19 | 19 | import de.geolykt.starloader.api.empire.ActiveEmpire; |
20 | 20 | import de.geolykt.starloader.api.empire.Star; |
| 21 | +import de.geolykt.starloader.api.event.EventManager; |
21 | 22 | import de.geolykt.starloader.api.event.TickCallback; |
| 23 | +import de.geolykt.starloader.api.event.star.StarOwnershipTakeoverEvent; |
22 | 24 | import snoddasmannen.galimulator.Religion; |
23 | 25 |
|
24 | 26 | @Mixin(snoddasmannen.galimulator.Star.class) |
@@ -249,19 +251,14 @@ public void syncCoordinates() { |
249 | 251 | y = q.y; |
250 | 252 | } |
251 | 253 |
|
252 | | -/* FIXME Spongepowered's Mixins finds it very funny to not want to apply this mixin, |
253 | | - sadly I cannot do this otherwise (i. e. using @Overwrite instead of @Inject) since otherwise |
254 | | - I'd have a very angry snoddasmannen, and if I use some improper ASM hacks I'd have a very angry |
255 | | - userbase that is wondering why their classes load 10 times longer than they should be loading, |
256 | | - additionally I do not know the consequences of that action as improper ASM hacks do not stack well with Mixins.*/ |
257 | | -// @Inject(method = "b", at = @At("HEAD"), cancellable = true) |
258 | | -// public void takeover(Empire empire, CallbackInfo info) { |
259 | | -// StarOwnershipTakeoverEvent event = new StarOwnershipTakeoverEvent(this, getAssignedEmpire(), (ActiveEmpire) empire); |
260 | | -// EventManager.handleEvent(event); |
261 | | -// if (event.isCancelled()) { |
262 | | -// info.cancel(); |
263 | | -// } |
264 | | -// } |
| 254 | + @Inject(method = "b(Lsnoddasmannen/galimulator/Empire;)V", at = @At("HEAD"), cancellable = true) |
| 255 | + public void takeover(snoddasmannen.galimulator.Empire empire, CallbackInfo info) { |
| 256 | + StarOwnershipTakeoverEvent event = new StarOwnershipTakeoverEvent(this, getAssignedEmpire(), (ActiveEmpire) empire); |
| 257 | + EventManager.handleEvent(event); |
| 258 | + if (event.isCancelled()) { |
| 259 | + info.cancel(); |
| 260 | + } |
| 261 | + } |
265 | 262 |
|
266 | 263 | @Inject(method = "e", at = @At("HEAD")) |
267 | 264 | public void tick(CallbackInfo info) { |
|
0 commit comments