Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement new Wrapper Events #241

Merged
merged 1 commit into from
Feb 12, 2017
Merged

Implement new Wrapper Events #241

merged 1 commit into from
Feb 12, 2017

Conversation

ExE-Boss
Copy link
Member

@ExE-Boss ExE-Boss commented Jan 9, 2017

Needed for wrappers to add wrapper-specific Components to backward wrappers.
For 1.9+: Needed for wrappers to add wrapper-specific Forge Capabilities (Forge’s equivalent of NOVA Components) to forward wrappers (eg. NOVA-Team/NOVA-Energy#4).


Split off from #235

@ExE-Boss ExE-Boss added minecraft 1.7 Affects Minecraft 1.7.x wrappers minecraft 1.8 Affects Minecraft 1.8.x wrappers labels Jan 9, 2017
@ExE-Boss ExE-Boss self-assigned this Jan 9, 2017
@RX14 RX14 added the in progress Pull requests that are not yet ready to be merged and issues that are being worked on. label Jan 9, 2017
@ExE-Boss ExE-Boss mentioned this pull request Jan 9, 2017
9 tasks
@ExE-Boss ExE-Boss requested a review from RX14 January 9, 2017 22:43
@codecov-io
Copy link

codecov-io commented Jan 18, 2017

Codecov Report

Merging #241 into master will decrease coverage by -0.16%.
The diff coverage is 0%.

@@             Coverage Diff             @@
##             master    #241      +/-   ##
===========================================
- Coverage     13.65%   13.5%   -0.16%     
  Complexity      652     652              
===========================================
  Files           395     395              
  Lines         11387   11516     +129     
  Branches       1246    1246              
===========================================
  Hits           1555    1555              
- Misses         9734    9863     +129     
  Partials         98      98
Impacted Files Coverage Δ Complexity Δ
.../forge/v18/wrapper/block/forward/FWTileLoader.java 0% <ø> (ø) 0 <ø> (ø)
...apper/mc/forge/v18/wrapper/item/BWItemFactory.java 0% <ø> (ø) 0 <ø> (ø)
...apper/mc/forge/v18/wrapper/item/ItemConverter.java 0% <ø> (ø) 0 <ø> (ø)
...mc/forge/v18/wrapper/entity/backward/BWEntity.java 0% <ø> (ø) 0 <ø> (ø)
...r/mc/forge/v17/wrapper/entity/EntityConverter.java 0% <ø> (ø) 0 <ø> (ø)
.../forge/v17/wrapper/entity/backward/BWEntityFX.java 0% <ø> (ø) 0 <ø> (ø)
...r/mc/forge/v18/wrapper/entity/EntityConverter.java 0% <ø> (ø) 0 <ø> (ø)
.../mc/forge/v17/wrapper/entity/forward/FWEntity.java 0% <ø> (ø) 0 <ø> (ø)
...apper/mc/forge/v17/wrapper/item/ItemConverter.java 0% <ø> (ø) 0 <ø> (ø)
...er/mc/forge/v17/wrapper/block/forward/FWBlock.java 0% <ø> (ø) 0 <ø> (ø)
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4d86319...478c075. Read the comment docs.

@ExE-Boss ExE-Boss requested a review from calclavia January 27, 2017 22:43
@ExE-Boss ExE-Boss added ready This is ready to be worked on and removed in progress Pull requests that are not yet ready to be merged and issues that are being worked on. labels Feb 2, 2017
@@ -64,6 +66,10 @@ public void damage(double amount, DamageType type) {
living.faceDisplacement = () -> Vector3D.PLUS_J.scalarMultiply(entity.getEyeHeight());
}
}
if (entity != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would entity being null break the rest of the code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was done because of BWEntityFX, but I have a better fix for that now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line wouldn’t have prevented a NPE anyway, as that would have been thrown already

FWTile tile = (block instanceof Updater) ? updaterInjector.inject(block, new Class[] { String.class }, new Object[] { blockID }) : injector.inject(block, new Class[] {
String.class }, new Object[] { blockID });
FWTile tile = (block instanceof Updater) ? updaterInjector.inject(block, new Class[] { String.class }, new Object[] { blockID }) :
injector.inject(block, new Class[] { String.class }, new Object[] { blockID });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ternary expression is pretty long, why not do this:

ComponentInjector<FWTile> injector = (block instanceof Updater) ? updaterInjector : injector;
injector.inject(block, new Class[] { String.class }, new Object[] { blockID });

@@ -64,6 +66,10 @@ public void damage(double amount, DamageType type) {
living.faceDisplacement = () -> Vector3D.PLUS_J.scalarMultiply(entity.getEyeHeight());
}
}
if (entity != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

@ExE-Boss ExE-Boss requested a review from RX14 February 12, 2017 17:57
@RX14 RX14 merged commit aaccb91 into master Feb 12, 2017
@ExE-Boss ExE-Boss deleted the wrapper-events-2 branch February 12, 2017 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minecraft 1.7 Affects Minecraft 1.7.x wrappers minecraft 1.8 Affects Minecraft 1.8.x wrappers ready This is ready to be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants