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

make waypoints render when buildtool open #1004

Merged
merged 12 commits into from
May 17, 2017

Conversation

Raycoms
Copy link
Contributor

@Raycoms Raycoms commented May 16, 2017

Closes #646
Closes #888
Closes #985

Changes proposed in this pull request:

  • Render waypoints when holding the buildTool with waypoints
  • Render diamond blocks around the colony diameter when buildTool open with huts
  • Fix builder duping bug with doors
  • Optimize imports
  • Add some more doc.
  • Fix again the ratio of guards influencing the happiness
  • Fix a bug with the gathering
    Review please


/**
* The overall happiness of the colony.
*/
private double overallHappiness = 5;

Choose a reason for hiding this comment

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

MAJOR Assign this magic number 5 to a well-named constant, and use the constant instead. rule

Copy link
Contributor Author

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.

Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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

@marvin-bitterlich
Copy link
Member

Looking good! Needs some sonar issues and testing on a multiplayer server

/**
* List of all BlockPos in the colony border.
*/
public static final List<BlockPos> colonyBorder = new ArrayList<>();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also I don't agree.

Copy link
Member

Choose a reason for hiding this comment

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

why public members in an utils class?

Copy link
Member

Choose a reason for hiding this comment

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

return something like this in methods or so...

/**
* I need that to calculate the circle, if someone knows a better library tell me.
*/
import static sun.awt.geom.Curve.next;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If someone knows an alternative.

Copy link
Contributor

Choose a reason for hiding this comment

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

What are you doing with it?

Copy link
Member

Choose a reason for hiding this comment

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

@Raycoms

Classes in the sun.* or com.sun.* packages are considered implementation details, and are not part of the Java API.

They can cause problems when moving to new versions of Java because there is no backwards compatibility guarantee. Similarly, they can cause problems when moving to a different Java vendor, such as OpenJDK.

Such classes are almost always wrapped by Java API classes that should be used instead.


for ( int degrees = 0; degrees < WHOLE_CIRCLE; degrees += 1 )
{
double rads = next( degrees );
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you using next here:
Simple math tells you that 360 Degrees is = 2 PI Rad
So to get the radians you would do: degrees / 180 * Math.Pi

Copy link
Member

@marvin-bitterlich marvin-bitterlich left a comment

Choose a reason for hiding this comment

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

this needs fixing, we will not create random singletons in utils code, that is dept we don't want…

@@ -0,0 +1,137 @@
package com.minecolonies.coremod.util.constants;
Copy link
Member

Choose a reason for hiding this comment

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

wrong package

/**
* List of all BlockPos in the colony border.
*/
public static final List<BlockPos> colonyBorder = new ArrayList<>();
Copy link
Member

Choose a reason for hiding this comment

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

why public members in an utils class?

/**
* List of all BlockPos in the colony border.
*/
public static final List<BlockPos> colonyBorder = new ArrayList<>();
Copy link
Member

Choose a reason for hiding this comment

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

return something like this in methods or so...

@MinecoloniesSonar
Copy link

SonarQube analysis reported 102 issues

  • MAJOR 46 major
  • MINOR 40 minor
  • INFO 16 info

Watch the comments in this conversation to review them.

Top 10 extra issues

Note: The following issues were found on lines that were not modified in the pull request. Because these issues can't be reported as line comments, they are summarized here:

  1. MAJOR Colony.java: This file has 1.237 lines, which is greater than 1.000 authorized. Split it into smaller files. rule
  2. MAJOR Colony.java#L43: Split this class into smaller and more specialized ones to reduce its dependencies on other classes from 43 to the maximum authorized 30 or less. rule
  3. MAJOR Colony.java#L43: class "Colony" has 83 methods, which is greater than the 35 authorized. Split it into smaller classes. rule
  4. MAJOR Colony.java#L641: Reduce the number of returns of this method 11, down to the maximum allowed 6. rule
  5. MAJOR Colony.java#L1163: Assign this magic number 20 to a well-named constant, and use the constant instead. rule
  6. MAJOR Colony.java#L1164: Assign this magic number 60 to a well-named constant, and use the constant instead. rule
  7. MAJOR Colony.java#L1277: Assign this magic number 16 to a well-named constant, and use the constant instead. rule
  8. MAJOR Colony.java#L1279: Assign this magic number 16 to a well-named constant, and use the constant instead. rule
  9. MAJOR Colony.java#L1281: Assign this magic number 128 to a well-named constant, and use the constant instead. rule
  10. MAJOR Colony.java#L1402: Assign this magic number 0.5D to a well-named constant, and use the constant instead. rule

@marvin-bitterlich
Copy link
Member

marvin-bitterlich commented May 17, 2017

:shipit:

Approved with PullApprove

@marvin-bitterlich marvin-bitterlich merged commit 05430e4 into version/1.10 May 17, 2017
marvin-bitterlich added a commit that referenced this pull request May 25, 2017
* Patch in the CurseForge upload module. (#881)

I forgot to add the module when I Marvins pr.

* Feature/happiness n hunger (#880)

* Fix exceptions with blockFire

Also fix problem with coarse dirt and podzol

* Improve flint&Steel handling

And fix coarse dirt for good

* Fix the requesting of the flint and steel and fishing rod if used

* sonar fixes and more

* improve grass handling

* fix small bug

* some more sonar fixes

* Removing dependencies of Abstract class to siblings

* Fix up javadoc

* First part saturation and colony happiness

* Handle food gathering

* Some adaptions for the dman

* Adapt class check to predicate

* Refactor building code

* add missing handlers

* Improve saturation handling

* fix grasspath issue

* improve handling part 1

* fix general handler

* part 2

* fix placement handler bug

* only get certain amount

* fix bug

* Remove surpress

* suppress for now

* Update Colony.java

* Request saturation correctly

* Add requesting, fix builder bugs

* Fix logik error

* small adaptions

* Also citizens without home can talk

* Improve counter attack of guards and update the colony

* fix error with stuck dman

* fix delivery

* avoid friendly fire for counter attack

* Higher food necessity at higher building level

* Add comments and let dman take extra food with him if saturation low

* fix nullpointer exception

* Patch in the CurseForge upload module.

I forgot to add the module when I Marvins pr.

* -If the tree is a slime tree is now stored in NBT (#882)

* Feature/happiness n hunger (#887)

* Fix exceptions with blockFire

Also fix problem with coarse dirt and podzol

* Improve flint&Steel handling

And fix coarse dirt for good

* Fix the requesting of the flint and steel and fishing rod if used

* sonar fixes and more

* improve grass handling

* fix small bug

* some more sonar fixes

* Removing dependencies of Abstract class to siblings

* Fix up javadoc

* First part saturation and colony happiness

* Handle food gathering

* Some adaptions for the dman

* Adapt class check to predicate

* Refactor building code

* add missing handlers

* Improve saturation handling

* fix grasspath issue

* improve handling part 1

* fix general handler

* part 2

* fix placement handler bug

* only get certain amount

* fix bug

* Remove surpress

* suppress for now

* Update Colony.java

* Request saturation correctly

* Add requesting, fix builder bugs

* Fix logik error

* small adaptions

* Also citizens without home can talk

* Improve counter attack of guards and update the colony

* fix error with stuck dman

* fix delivery

* avoid friendly fire for counter attack

* Higher food necessity at higher building level

* Add comments and let dman take extra food with him if saturation low

* fix nullpointer exception

* Patch in the CurseForge upload module.

I forgot to add the module when I Marvins pr.

* Feature/buildtool server side nbt develop (#879)

* Feature/buildtool server side nbt (#777)

* Add a persistent UUID to the server, saved in minecolomies.dat
Send the UUID to the client when the player log in.
The UUID will be use to create a directory on the client to store data specific to a server

* request as schematic from the client and send the schematic back by the server

* Allow to override huts and decorations by nbt file in a directory

* Add custom decoration (from local player)
Cache file using the md5 hash as a file name inside cache directory
When the player want to use custom, he will need to send the schematic unless the cache/<md5 hash> already exists

Schematic can be send to the server only if enabled in the configuration (disable by default), no schematic management is done yet, no limitation on the number of schamatic send, unused one are still there.

* Remember the last structure build, so we can quicky build it again, usefull for walls
Store the name instead of index as they may change

* Allow to rename/delete custom schematic

Conflicts:
	src/main/java/com/minecolonies/coremod/MineColonies.java
	src/main/java/com/minecolonies/coremod/client/gui/WindowBuildTool.java
	src/main/java/com/minecolonies/coremod/colony/Structures.java
	src/main/java/com/minecolonies/coremod/colony/buildings/AbstractBuilding.java
	src/main/java/com/minecolonies/coremod/colony/workorders/WorkOrderBuild.java
	src/main/java/com/minecolonies/coremod/entity/ai/basic/AbstractEntityAIStructure.java
	src/main/java/com/minecolonies/coremod/network/messages/BuildToolPlaceMessage.java
	src/main/java/com/minecolonies/coremod/network/messages/SaveScanMessage.java
	src/main/java/com/minecolonies/coremod/util/ClientStructureWrapper.java

* javadoc

* Update build.properties

* Adding Changelog generation. (#896)

Signed-off-by: OrionOnline <oriondevelopment@outlook.com>

* 1.10-Rewrite handleKeepX to be identical than release/1.11 (#931)

* Rewrite handleKeepX to be identical that release/1.11

* fix package info

* Hotfix for the DMan (#940)

* Hotfix for the DMan not behaving properly cause it is not getting reported about the insertion result

* Fixing a type in the iteration for the extraction slots of the DMan

* Feature/limit warehouse (#948)

* should fix the no tinkers crashes

* should fix trange crash

* Fix fisherman

* limit warehouse

* Feature/better builder lj positioning (#952)

* fix lumberjack position finding and fix builder position finding

* Fix sonar issues

* bump version

* Fix/no tarzan (#974)

* fix lumberjack position finding and fix builder position finding

* Fix sonar issues

* Fix Tarzan climbing the trees

Uhm I meant the lumberjack

* remove unimplemented huts (#973)

* bump version

* Hotfix/low stats (#976)

* fix lumberjack position finding and fix builder position finding

* Fix sonar issues

* Fix Tarzan climbing the trees

Uhm I meant the lumberjack

* fix bug where citizen start all up with 1

* Average Housing on Happiness Calculation (#981)

Fixes: #978

* 1.10 d-man delivery fix (#986)

* 1.11 d-man delivery fix (#980)

* Fix forceTransferStack return value
Fix some java doc

* Fix javadoc

* Fix happiness calculation about housing

* Transfer for real instead of simulating

* remove some warnings

Conflicts:
	src/main/java/com/minecolonies/coremod/colony/Colony.java
	src/main/java/com/minecolonies/coremod/util/InventoryUtils.java

* sonar

* Fix/builder duping 10 (#988)

* fix lumberjack position finding and fix builder position finding

* Fix sonar issues

* Fix Tarzan climbing the trees

Uhm I meant the lumberjack

* fix bug where citizen start all up with 1

* Fix problem with builder requesting double

* don't request solid placeholder if world is solid

* make citizen only tp if employed

* recalculate after reload

* balance happiness depending on guards

* Fix/colony crash10 (#998)

* Stop crashing with other world events

* add new creativetab design to 1.10

* Sonar/warnings (#992) (#995)

* Sonar/warnings (#992)

* Fix Blockers

* first draft for translation constants

* fix formatting

* fix some constants and other issues

* formatting

* fix some ternaries

* sonar fixes

* add suppress

* add doc files

* reorder

* wtf java

* last fixes

* remove unused

* Update InventoryCitizen.java

* Update WindowHireWorker.java

* Update WindowHireWorker.java

* Feature/builder pickup (#999)

* Make builder pickup items after building

* sonar fix cast to double

* remove unused import

* Add female dman sounds + functionality for hostile and saturation (#990)

* Add female dman sounds + functionality for hostile and saturation

* be happy sonar

* fix nullpointer exception

* increase chance

* fix small bug

* remove import

* Update EntityAICitizenAvoidEntity.java

* Fix dman sound surpress template

* stage

* Might look better like this.

* add package info

* Fix problematic behavior

* imports

* Feature/builder pickup (#1002)

* Make builder pickup items after building

* sonar fix cast to double

* remove unused import

* remove double guard code 1.10

* unused import

* Update doc

* Feature/1.10 better chat (#994) (#1007)

* Feature/1.10 better chat (#994)

* Suppress some warning

* Add worker name to the message when chest is full

* remove warnings

* Builder say when then start/end a job

* Shorter chat version for colony owner

* D-man only say that the chest if full when ihe cannot swap
D-man say whose chest is full

* Change dman saying

* Compare itemstack properly

* Different message when pick axe requested level is greater than hut level

* D-man hold the item he will deliver or the item he did gather
Fix javadoc

* EntityCitizen does not know about BuildingFarmer now

* remove most of the Jobs from EnityCitizen

* dman hold the correct item

Conflicts:
	src/main/java/com/minecolonies/coremod/colony/buildings/BuildingFarmer.java
	src/main/java/com/minecolonies/coremod/colony/jobs/AbstractJob.java
	src/main/java/com/minecolonies/coremod/entity/EntityCitizen.java
	src/main/java/com/minecolonies/coremod/entity/ai/citizen/builder/EntityAIStructureBuilder.java
	src/main/resources/assets/minecolonies/lang/en_US.lang

* add some package info

* package info

* make waypoints render when buildtool open (#1004)

* make waypoints render when buildtool open

* Fix javadoc

* javadoc

* Add colony border rendering as well

* fix sonar issues

* fix door duping of builder

* Make marvin happy, add package info.

* fix up buggy behavior

* fix annotations and sonar issues

* fix it up

* Refactor/1.11 workorders (#1012) (#1013)

* Suppress some warning

* Add worker name to the message when chest is full

* Fix warnings for PlacementHandlers

* Builder say when then start a job

* WorkOrderBuildHut extends WorkOrderBuildDecoration
instead of
WorkOrderBuildDecoration extends WorkOrderBuild

* revert WorkOrderBuildHut class to WorkOrderBuild

* Work Manager does not need to know about Construction tape and WorkOrderBuildDecoration

* JobBuilder class does not need to know about WorkOrderBuild

* remove duplicated code

* add package info

* Sonar suppress

Conflicts:
	src/main/java/com/minecolonies/coremod/colony/WorkManager.java
	src/main/java/com/minecolonies/coremod/entity/ai/citizen/builder/ConstructionTapeHelper.java

* bug #1014 fix crash when a colony does not have any owner (#1015)

* fix crash when a colony does not have any owner

* remove logging

* Bugfix/#758 concurrency issue (#1025) (#1029)

* Centralize the copying of the needed items list, and make it explicitly clear a copy is happening

* Remove duplicated methods, and unnecessary casts

* Change CopyOnWriteArrayList to ConcurrentLinkedQueue for current warehouse tasks.

The list is being modified often, and being treated like a queue. The ConcurrentLinkedQueue should be a better data structure for the situation and be more performant.

* Check if citizen is jobless before triggering job death achievement (#1038)

* Dismount before teleporting, and add check for invalid line width (#1036)

* Feature/1.10 efficient dman (#1044)

* Feature/1.10 efficient dman (#1017)

* gather from the chest which have just been delivered

* Deliver mor ethan one stack at a time depending of the deliveryman hut's level

* * in BuildingBuilder override neededForWorker instead of using the custom requiresResourceForBuilding method
* Add container to building event when the builder did not have to build it

* register block in AbstractBuilding instead of adding container only, so that extending class could register any type of block, not only chests

* remove checkInWareHouseForFood method in favour of polymorphisme

* remove duplicated code

* javadoc

* language constant

* revert back some changes

Conflicts:
	src/main/java/com/minecolonies/coremod/colony/buildings/AbstractBuilding.java
	src/main/java/com/minecolonies/coremod/colony/buildings/BuildingBuilder.java
	src/main/java/com/minecolonies/coremod/entity/ai/citizen/deliveryman/EntityAIWorkDeliveryman.java

* Citizen hut need food
@Raycoms Raycoms deleted the feature/waypoint-goggles branch September 25, 2017 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants