-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ClientStellarStatusNetworkingEvents Add TemplatedText And LocatedText Add StellarStatusState Add CustomBadge, BadgeRegistrable And ModMenuIntegration Add CustomLilyPadBlock Add Experimental BlockDisplayExtensions
- Loading branch information
1 parent
89a6554
commit cbda407
Showing
39 changed files
with
564 additions
and
225 deletions.
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
11 changes: 0 additions & 11 deletions
11
src/main/java/com/mmodding/mmodding_lib/ducks/ClientStellarStatusDuckInterface.java
This file was deleted.
Oops, something went wrong.
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
11 changes: 0 additions & 11 deletions
11
src/main/java/com/mmodding/mmodding_lib/ducks/ServerStellarStatusDuckInterface.java
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
src/main/java/com/mmodding/mmodding_lib/ducks/StellarStatusDuckInterface.java
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
src/main/java/com/mmodding/mmodding_lib/ducks/WorldDuckInterface.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,21 @@ | ||
package com.mmodding.mmodding_lib.ducks; | ||
|
||
import com.mmodding.mmodding_lib.library.stellar.StellarStatus; | ||
import com.mmodding.mmodding_lib.persistentstates.StellarStatusState; | ||
import net.minecraft.nbt.NbtCompound; | ||
import net.minecraft.util.Identifier; | ||
|
||
import java.util.Map; | ||
|
||
public interface WorldDuckInterface { | ||
|
||
StellarStatus mmodding_lib$getStellarStatus(Identifier identifier); | ||
|
||
Map<Identifier, StellarStatus> mmodding_lib$getAllStellarStatus(); | ||
|
||
void mmodding_lib$putStellarStatus(Identifier identifier, StellarStatus status); | ||
|
||
StellarStatusState mmodding_lib$createStellarStatusState(); | ||
|
||
StellarStatusState mmodding_lib$stellarStatusStateFromNbt(NbtCompound nbt); | ||
} |
12 changes: 12 additions & 0 deletions
12
...com/mmodding/mmodding_lib/library/blockentities/display/BlockEntityDisplayExtensions.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,12 @@ | ||
package com.mmodding.mmodding_lib.library.blockentities.display; | ||
|
||
import com.mmodding.mmodding_lib.library.texts.LocatedText; | ||
import org.jetbrains.annotations.ApiStatus; | ||
|
||
import java.util.List; | ||
|
||
@ApiStatus.Experimental | ||
public interface BlockEntityDisplayExtensions { | ||
|
||
List<LocatedText> getDisplayedTexts(); | ||
} |
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
48 changes: 48 additions & 0 deletions
48
src/main/java/com/mmodding/mmodding_lib/library/blocks/CustomLilyPadBlock.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,48 @@ | ||
package com.mmodding.mmodding_lib.library.blocks; | ||
|
||
import net.minecraft.block.LilyPadBlock; | ||
import net.minecraft.item.BlockItem; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemGroup; | ||
import org.quiltmc.qsl.item.setting.api.QuiltItemSettings; | ||
|
||
import java.util.concurrent.atomic.AtomicBoolean; | ||
|
||
public class CustomLilyPadBlock extends LilyPadBlock implements BlockRegistrable, BlockWithItem { | ||
|
||
private final AtomicBoolean registered = new AtomicBoolean(false); | ||
|
||
private BlockItem item = null; | ||
|
||
public CustomLilyPadBlock(Settings settings) { | ||
this(settings, false); | ||
} | ||
|
||
public CustomLilyPadBlock(Settings settings, boolean hasItem) { | ||
this(settings, hasItem, (ItemGroup) null); | ||
} | ||
|
||
public CustomLilyPadBlock(Settings settings, boolean hasItem, ItemGroup itemGroup) { | ||
this(settings, hasItem, itemGroup != null ? new QuiltItemSettings().group(itemGroup) : new QuiltItemSettings()); | ||
} | ||
|
||
public CustomLilyPadBlock(Settings settings, boolean hasItem, Item.Settings itemSettings) { | ||
super(settings); | ||
if (hasItem) this.item = new BlockItem(this, itemSettings); | ||
} | ||
|
||
@Override | ||
public BlockItem getItem() { | ||
return this.item; | ||
} | ||
|
||
@Override | ||
public boolean isNotRegistered() { | ||
return !this.registered.get(); | ||
} | ||
|
||
@Override | ||
public void setRegistered() { | ||
this.registered.set(true); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/mmodding/mmodding_lib/library/client/render/HudRendering.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,13 @@ | ||
package com.mmodding.mmodding_lib.library.client.render; | ||
|
||
import com.mmodding.mmodding_lib.library.utils.Colors; | ||
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.text.Text; | ||
|
||
public class HudRendering { | ||
|
||
public static void renderTextOnHud(Text text, int x, int y, Colors.RGB color) { | ||
HudRenderCallback.EVENT.register((matrices, ticks) -> MinecraftClient.getInstance().textRenderer.draw(matrices, text, x, y, color.toDecimal())); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ry/client/render/RenderLayerElements.java → ...ent/render/layer/RenderLayerElements.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
2 changes: 1 addition & 1 deletion
2
.../client/render/RenderLayerOperations.java → ...t/render/layer/RenderLayerOperations.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
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
2 changes: 1 addition & 1 deletion
2
src/main/java/com/mmodding/mmodding_lib/library/fluids/FluidRegistrable.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
2 changes: 1 addition & 1 deletion
2
src/main/java/com/mmodding/mmodding_lib/library/glint/client/GlintPack.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
14 changes: 14 additions & 0 deletions
14
src/main/java/com/mmodding/mmodding_lib/library/integrations/modmenu/BadgeRegistrable.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,14 @@ | ||
package com.mmodding.mmodding_lib.library.integrations.modmenu; | ||
|
||
import com.mmodding.mmodding_lib.library.utils.Registrable; | ||
import net.minecraft.util.Identifier; | ||
|
||
public interface BadgeRegistrable extends Registrable { | ||
|
||
default void register(Identifier identifier) { | ||
if (this instanceof CustomBadge item && this.isNotRegistered()) { | ||
ModMenuIntegration.CUSTOM_BADGES_REGISTRY.put(identifier, item); | ||
this.setRegistered(); | ||
} | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
src/main/java/com/mmodding/mmodding_lib/library/integrations/modmenu/CustomBadge.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,64 @@ | ||
package com.mmodding.mmodding_lib.library.integrations.modmenu; | ||
|
||
import com.mmodding.mmodding_lib.library.utils.BiList; | ||
import com.mmodding.mmodding_lib.library.utils.Colors; | ||
import org.quiltmc.loader.api.QuiltLoader; | ||
import org.quiltmc.loader.api.entrypoint.EntrypointContainer; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.concurrent.atomic.AtomicBoolean; | ||
import java.util.function.Supplier; | ||
|
||
public class CustomBadge implements BadgeRegistrable { | ||
|
||
private final AtomicBoolean registered = new AtomicBoolean(false); | ||
|
||
private final BiList<String, Class<?>> entrypointInfo; | ||
private final Provider provider; | ||
private final Supplier<Colors.RGB> outlineColor; | ||
private final Supplier<Colors.RGB> fillColor; | ||
|
||
public CustomBadge(BiList<String, Class<?>> entrypointInfo, Provider provider, Colors.RGB outlineColor, Colors.RGB fillColor) { | ||
this(entrypointInfo, provider, () -> outlineColor, () -> fillColor); | ||
} | ||
|
||
public CustomBadge(BiList<String, Class<?>> entrypointInfo, Provider provider, Supplier<Colors.RGB> outlineColor, Supplier<Colors.RGB> fillColor) { | ||
this.entrypointInfo = entrypointInfo; | ||
this.provider = provider; | ||
this.outlineColor = outlineColor; | ||
this.fillColor = fillColor; | ||
} | ||
|
||
public List<String> getMods() { | ||
List<String> mods = new ArrayList<>(); | ||
this.entrypointInfo.forEach( | ||
(entrypointKey, entrypointClass) -> mods.addAll(this.provider.getMods(QuiltLoader.getEntrypointContainers(entrypointKey, entrypointClass))) | ||
); | ||
return mods; | ||
} | ||
|
||
public Colors.RGB getOutlineColor() { | ||
return this.outlineColor.get(); | ||
} | ||
|
||
public Colors.RGB getFillColor() { | ||
return this.fillColor.get(); | ||
} | ||
|
||
@Override | ||
public boolean isNotRegistered() { | ||
return !this.registered.get(); | ||
} | ||
|
||
@Override | ||
public void setRegistered() { | ||
this.registered.set(true); | ||
} | ||
|
||
@FunctionalInterface | ||
public interface Provider { | ||
|
||
List<String> getMods(List<? extends EntrypointContainer<?>> entrypointContainers); | ||
} | ||
} |
Oops, something went wrong.