-
Notifications
You must be signed in to change notification settings - Fork 12
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
Added some features #9
base: master
Are you sure you want to change the base?
Conversation
gabidut
commented
Dec 23, 2023
- DashboardNeedle
- For RPMs and speed
- Better speed-display
- Gear
- Speed
- Speed limit
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.
Merci pour ta pull-request, par contre il y a plusieurs trucs à modifier avant que ça soit intégré au BasicsAddon.
src/main/java/fr/dynamx/addons/basics/common/infos/DashboardNeedleInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/fr/dynamx/addons/basics/common/infos/DashboardNeedleInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/fr/dynamx/addons/basics/common/infos/DashboardNeedleInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/fr/dynamx/addons/basics/common/infos/DashboardNeedleInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/fr/dynamx/addons/basics/common/infos/DashboardNeedleInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/fr/dynamx/addons/basics/common/infos/DashboardTextInfos.java
Outdated
Show resolved
Hide resolved
src/main/java/fr/dynamx/addons/basics/common/infos/DashboardNeedleInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/fr/dynamx/addons/basics/common/infos/DashboardTextInfos.java
Outdated
Show resolved
Hide resolved
src/main/java/fr/dynamx/addons/basics/common/infos/SpeedDisplayInfos.java
Outdated
Show resolved
Hide resolved
src/main/java/fr/dynamx/addons/basics/common/infos/SpeedDisplayInfos.java
Outdated
Show resolved
Hide resolved
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.
Bonne feature mais quelques soucis de code 👍
The `DetailToShow` can be one of the following: | ||
- GEAR | ||
- SPEED | ||
- SPEEDLIMITOR |
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.
SPEED_LIMITER*
- SPEED | ||
- SPEEDLIMITOR | ||
|
||
It will display the current gear, speed or speedlimitor value at the position. |
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.
speed limiter aussi du coup
|
||
It will display the current gear, speed or speedlimitor value at the position. | ||
|
||
The `CarStartedReact` can be `True` or `False` and will enable or disable the display when the car is started. |
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.
ça veut pas dire grand chose "CarStartedReact"
public int getNeedleMaxTurn() { | ||
return needleMaxTurn; | ||
} | ||
|
||
public int getDashboardMaxValue() { | ||
return dashboardMaxValue; | ||
} | ||
|
||
public EnumDashboardNeedleType getNeedleType() { | ||
return needleType; | ||
} | ||
|
||
public Vector3f getRotation() { | ||
return rotation; | ||
} | ||
|
||
public String getNodeDependingOnName() { | ||
return this.nodeDependingOnName; | ||
} | ||
|
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.
Lombok
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.
Précision : il est pas configuré sur l'env du BasicsAddon, donc on l'ajoutera surement nous-mêmes
if (entityRenderContext.getModel().containsObjectOrNode(DashboardNeedleInfo.this.getObjectName()) && entity.getModuleByType(CarEngineModule.class) != null && DashboardNeedleInfo.this.getPosition() != null) { | ||
GlStateManager.pushMatrix(); | ||
Vector3f pos = DashboardNeedleInfo.this.getPosition(); | ||
GL11.glTranslatef(pos.x, pos.y, pos.z); |
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.
GlStateManager au lei de GL11
TextUtils.makeGLRotation(getRotation()); | ||
switch (DashboardNeedleInfo.this.getNeedleType()) { | ||
case RPM: | ||
int rpms = Math.round(entity.getModuleByType(CarEngineModule.class).getEngineProperty(VehicleEntityProperties.EnumEngineProperties.REVS) * 10000); |
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.
Tu peux faire une variable interne de entity.getModuleByType(CarEngineModule.class) et l'utiliser plusieurs fois au lieu de rappeler chaque fois
protected boolean carStartedReact; | ||
|
||
@PackFileProperty(configNames = "Color", description = "common.color", required = false) | ||
protected int[] color = new int[]{10, 10, 10}; |
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.
Utilise un Vector3f please
public Vector3f getRotation() { | ||
return rotation; | ||
} | ||
|
||
public int[] getColor() { | ||
return color; | ||
} | ||
|
||
public boolean isCarStartedReact() { | ||
return carStartedReact; | ||
} | ||
|
||
public String getFont() { | ||
return font; | ||
} | ||
|
||
public EnumDashboardTextType getDetailToShow() { | ||
return detailToShow; | ||
} |
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.
lombok
public void render(@Nullable T entity, EntityRenderContext entityRenderContext, A packInfo) { | ||
if (entity == null) return; | ||
if (DashboardTextInfos.this.getRotation() != null) { | ||
if (entity.getModuleByType(CarEngineModule.class).getPhysicsHandler().getEngine().isStarted() && DashboardTextInfos.this.isCarStartedReact()) { |
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.
Meme chose pour entity.getModuleByType(CarEngineModule.class)
break; | ||
case SPEEDLIMITOR: | ||
int tempvalue = Math.round(entity.getModuleByType(CarEngineModule.class).getSpeedLimit()); | ||
if (tempvalue != 0 & tempvalue < 10000000) value = String.valueOf(tempvalue); |
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.
tu peux utiliser une condition ternaire et peut être utiliser Integer.MAX_VALUE au lieu de 100000