PlutoComponent cleanup
This commit is contained in:
parent
27f4882fcc
commit
6ba1dfa2cb
|
@ -1,3 +1,7 @@
|
|||
## 22.3.0.0-alpha.1
|
||||
* `[PlutoComponent]` Removing components using a token should have the same semantics as removing individual components
|
||||
* `[PlutoComponent]` Made the addition and removal of components hookable before mount events are fired
|
||||
|
||||
## 22.3.0.0-alpha.0
|
||||
* `[SDK]` **Combined `PlutoFramebuffer`, `PlutoMesher`, `PlutoShader` and `PlutoTexture`
|
||||
into `PlutoRender`**
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.plutoengine
|
||||
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
import org.gradle.api.JavaVersion
|
||||
|
||||
object Versions {
|
||||
|
@ -28,7 +27,7 @@ object Versions {
|
|||
|
||||
const val isPrerelease = true
|
||||
const val prereleaseName = "alpha"
|
||||
const val prerealeaseUpdate = 0
|
||||
const val prerealeaseUpdate = 1
|
||||
|
||||
val versionFull =
|
||||
if (isPrerelease)
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.apache.commons.collections4.MultiValuedMap;
|
|||
import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;
|
||||
import org.apache.commons.collections4.multimap.HashSetValuedHashMap;
|
||||
import org.apache.commons.lang3.ClassUtils;
|
||||
import org.jetbrains.annotations.MustBeInvokedByOverriders;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -74,6 +75,14 @@ public class ComponentManager<R extends AbstractComponent<R>>
|
|||
this.components.put(token, component);
|
||||
this.tokens.put(component, token);
|
||||
|
||||
this.onComponentAdded(component);
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
protected void onComponentAdded(R component)
|
||||
{
|
||||
try
|
||||
{
|
||||
component.initialize(this);
|
||||
|
@ -82,8 +91,6 @@ public class ComponentManager<R extends AbstractComponent<R>>
|
|||
{
|
||||
throw new RuntimeException("An exception has occured while mounting the component", e);
|
||||
}
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
public Class<R> getComponentBase()
|
||||
|
@ -130,6 +137,12 @@ public class ComponentManager<R extends AbstractComponent<R>>
|
|||
|
||||
classes.forEach(clazz -> this.implementationProviders.removeMapping(clazz, component));
|
||||
|
||||
this.onComponentRemoved(component);
|
||||
}
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
protected void onComponentRemoved(R component)
|
||||
{
|
||||
try
|
||||
{
|
||||
component.destroy(this);
|
||||
|
@ -151,14 +164,7 @@ public class ComponentManager<R extends AbstractComponent<R>>
|
|||
|
||||
classes.forEach(clazz -> this.implementationProviders.removeMapping(clazz, component));
|
||||
|
||||
try
|
||||
{
|
||||
component.onUnmount();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException("An exception has occured whiile unmounting the component", e);
|
||||
}
|
||||
this.onComponentRemoved(component);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ public class Game
|
|||
|
||||
var scoreFont = new TextStyleOptions(24)
|
||||
.setPaint(LiPaint.solidColor(Color.WHITE));
|
||||
ImmediateFontRenderer.drawString(5.0f, 5.0f, ("S %010.0f").formatted(this.entityPlayer.getScore()), SRCloneMod.srCloneFont, scoreFont);
|
||||
ImmediateFontRenderer.drawString(5.0f, 5.0f, "S %010.0f".formatted(this.entityPlayer.getScore()), SRCloneMod.srCloneFont, scoreFont);
|
||||
|
||||
if (this.deathScreenAnimation > 1.0f)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue