-
-
Notifications
You must be signed in to change notification settings - Fork 335
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
make waypoints render when buildtool open #1004
Merged
Merged
Changes from 3 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
884f604
make waypoints render when buildtool open
Raycoms 3f53e40
Fix javadoc
Raycoms ff9a271
javadoc
Raycoms 3350bcc
Merge branch 'version/1.10' into feature/waypoint-goggles
marvin-bitterlich 1a01273
Add colony border rendering as well
Raycoms 30f2186
fix sonar issues
Raycoms d801407
fix door duping of builder
Raycoms fcc3bfe
Make marvin happy, add package info.
Raycoms bfbcbaa
fix up buggy behavior
Raycoms af8cbe0
Merge branch 'version/1.10' into feature/waypoint-goggles
marvin-bitterlich 275938b
fix annotations and sonar issues
Raycoms 35e5cd7
fix it up
Raycoms File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/main/java/com/minecolonies/coremod/util/constants/RenderUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.minecolonies.coremod.util.constants; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wrong package |
||
|
||
import com.minecolonies.blockout.Render; | ||
import com.minecolonies.coremod.colony.ColonyManager; | ||
import com.minecolonies.coremod.colony.ColonyView; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.multiplayer.WorldClient; | ||
import net.minecraft.entity.item.EntityEnderCrystal; | ||
import net.minecraft.util.math.BlockPos; | ||
|
||
import java.util.Set; | ||
|
||
/** | ||
* Used for some rendering purpose like waypoint rendering. | ||
*/ | ||
public final class RenderUtils | ||
{ | ||
/** | ||
* Half point offset to get in the middle of a block. | ||
*/ | ||
private static final double HALF_BLOCK_OFFSET = 0.5; | ||
|
||
/** | ||
* Offset where the waypoint rendering marks to. | ||
*/ | ||
private static final int FIX_POINT_OFFSET = 10; | ||
|
||
/** | ||
* Private constructor to hide the explicit one. | ||
*/ | ||
private RenderUtils() | ||
{ | ||
/** | ||
* Intentionally left empty. | ||
*/ | ||
} | ||
|
||
/** | ||
* Render all waypoints. | ||
* @param position the position of the build tool click. | ||
* @param clientWorld the world. | ||
* @param partialTicks the partial ticks | ||
*/ | ||
public static void renderWayPoints(final BlockPos position, final WorldClient clientWorld, final float partialTicks) | ||
{ | ||
final ColonyView colonyView = ColonyManager.getClosestColonyView(clientWorld, position); | ||
|
||
if(colonyView == null) | ||
{ | ||
return; | ||
} | ||
|
||
final Set<BlockPos> waypoints = colonyView.getWayPoints(); | ||
for (final BlockPos pos : waypoints) | ||
{ | ||
final EntityEnderCrystal crystal = new EntityEnderCrystal(clientWorld); | ||
crystal.setPosition(pos.getX() + HALF_BLOCK_OFFSET, pos.getY(), pos.getZ() + HALF_BLOCK_OFFSET); | ||
crystal.setBeamTarget(pos.up(FIX_POINT_OFFSET)); | ||
crystal.setShowBottom(false); | ||
crystal.innerRotation = 0; | ||
|
||
Minecraft.getMinecraft().getRenderManager().renderEntityStatic(crystal, 0.0F, true); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assign this magic number 5 to a well-named constant, and use the constant instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to call other classes or create just another constant for this.
I feel like it is okay this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having an INITIAL_HAPPYNESS is not bad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have that around at some places but its not on the client and I think it would be bad style if we'd call not client classes from client classes.
But then I'd have to recreate the same thing again here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best would be to make a util.constrants class with these game changing constants and use that instead of all the 5 literals. Would be good to start with that