Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
275288447f | |||
55acbd4868 |
18 changed files with 79 additions and 180 deletions
|
@ -3,7 +3,7 @@ plugins {
|
||||||
id 'idea'
|
id 'idea'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
id 'java-library'
|
id 'java-library'
|
||||||
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
|
id 'net.minecraftforge.gradle' version '5.1.+'
|
||||||
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
|
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ minecraft {
|
||||||
// This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game.
|
// This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game.
|
||||||
// It is REQUIRED to be set to true for this template to function.
|
// It is REQUIRED to be set to true for this template to function.
|
||||||
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||||
copyIdeResources = true
|
//copyIdeResources = true
|
||||||
|
|
||||||
// When true, this property will add the folder name of all declared run configurations to generated IDE run configurations.
|
// When true, this property will add the folder name of all declared run configurations to generated IDE run configurations.
|
||||||
// The folder name can be set on a run configuration using the "folderName" property.
|
// The folder name can be set on a run configuration using the "folderName" property.
|
||||||
|
@ -187,7 +187,7 @@ dependencies {
|
||||||
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
|
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
|
||||||
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
|
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
|
||||||
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||||
tasks.named('processResources', ProcessResources).configure {
|
/*tasks.named('processResources', ProcessResources).configure {
|
||||||
var replaceProperties = [
|
var replaceProperties = [
|
||||||
minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range,
|
minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range,
|
||||||
forge_version : forge_version, forge_version_range: forge_version_range,
|
forge_version : forge_version, forge_version_range: forge_version_range,
|
||||||
|
@ -200,7 +200,7 @@ tasks.named('processResources', ProcessResources).configure {
|
||||||
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
|
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
|
||||||
expand replaceProperties + [project: project]
|
expand replaceProperties + [project: project]
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// Example for how to get properties into the manifest for reading at runtime.
|
// Example for how to get properties into the manifest for reading at runtime.
|
||||||
tasks.named('jar', Jar).configure {
|
tasks.named('jar', Jar).configure {
|
||||||
|
|
|
@ -4,25 +4,25 @@ org.gradle.jvmargs=-Xmx3G
|
||||||
org.gradle.daemon=false
|
org.gradle.daemon=false
|
||||||
|
|
||||||
|
|
||||||
parchment_version=2023.09.03
|
parchment_version=2022.11.06
|
||||||
# luckperms_api_version=5.4
|
# luckperms_api_version=5.4
|
||||||
|
|
||||||
libac=1.4.46
|
libac=1.4.19
|
||||||
eventsbus=1.0.45
|
eventsbus=1.0.31
|
||||||
## Environment Properties
|
## Environment Properties
|
||||||
|
|
||||||
# The Minecraft version must agree with the Forge version to get a valid artifact
|
# The Minecraft version must agree with the Forge version to get a valid artifact
|
||||||
minecraft_version=1.20.1
|
minecraft_version=1.18.2
|
||||||
# The Minecraft version range can use any release version of Minecraft as bounds.
|
# The Minecraft version range can use any release version of Minecraft as bounds.
|
||||||
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
|
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
|
||||||
# as they do not follow standard versioning conventions.
|
# as they do not follow standard versioning conventions.
|
||||||
minecraft_version_range=[1.20.1,1.21)
|
minecraft_version_range=[1.18.2,1.19)
|
||||||
# The Forge version must agree with the Minecraft version to get a valid artifact
|
# The Forge version must agree with the Minecraft version to get a valid artifact
|
||||||
forge_version=47.2.0
|
forge_version=40.2.17
|
||||||
# The Forge version range can use any version of Forge as bounds or match the loader version range
|
# The Forge version range can use any version of Forge as bounds or match the loader version range
|
||||||
forge_version_range=[47,)
|
forge_version_range=[40,)
|
||||||
# The loader version range can only use the major version of Forge/FML as bounds
|
# The loader version range can only use the major version of Forge/FML as bounds
|
||||||
loader_version_range=[47,)
|
loader_version_range=[40,)
|
||||||
# The mapping channel to use for mappings.
|
# The mapping channel to use for mappings.
|
||||||
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
|
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
|
||||||
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
|
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
|
||||||
|
@ -40,7 +40,7 @@ loader_version_range=[47,)
|
||||||
mapping_channel=parchment
|
mapping_channel=parchment
|
||||||
# The mapping version to query from the mapping channel.
|
# The mapping version to query from the mapping channel.
|
||||||
# This must match the format required by the mapping channel.
|
# This must match the format required by the mapping channel.
|
||||||
mapping_version=2023.09.03-1.20.1
|
mapping_version=2022.11.06-1.18.2
|
||||||
|
|
||||||
|
|
||||||
## Mod Properties
|
## Mod Properties
|
||||||
|
@ -53,7 +53,7 @@ mod_name=Zontreck Library Mod
|
||||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||||
mod_license=GPLv3
|
mod_license=GPLv3
|
||||||
# The mod version. See https://semver.org/
|
# The mod version. See https://semver.org/
|
||||||
mod_version=1.10.021324.2257
|
mod_version=1.10.012124.1709
|
||||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||||
# This should match the base package used for the mod sources.
|
# This should match the base package used for the mod sources.
|
||||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
@ -4,7 +4,3 @@ pluginManagement {
|
||||||
maven { url = "https://maven.zontreck.com/repository/internal" }
|
maven { url = "https://maven.zontreck.com/repository/internal" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
|
||||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,95 +0,0 @@
|
||||||
package dev.zontreck.libzontreck.blocks;
|
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.core.Direction;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.util.RandomSource;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
import net.minecraft.world.level.BlockGetter;
|
|
||||||
import net.minecraft.world.level.Level;
|
|
||||||
import net.minecraft.world.level.biome.Biome;
|
|
||||||
import net.minecraft.world.level.block.Block;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Code partially taken from HT's TreeChop
|
|
||||||
* <p>
|
|
||||||
* <a href="https://github.com/hammertater/treechop/blob/main/shared/src/main/java/ht/treechop/common/block/BlockImitator.java">Source Material</a>
|
|
||||||
*/
|
|
||||||
public abstract class BlockImitation extends Block
|
|
||||||
{
|
|
||||||
public BlockImitation(Properties pProperties) {
|
|
||||||
super(pProperties);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public abstract BlockState getImitatedBlockState(BlockGetter level, BlockPos pos);
|
|
||||||
|
|
||||||
public abstract void updateImitation(BlockState newState, BlockGetter level, BlockPos pos);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void animateTick(BlockState blockState, Level level, BlockPos pos, RandomSource random) {
|
|
||||||
BlockState imitatedBlockState = getImitatedBlockState(level, pos);
|
|
||||||
imitatedBlockState.getBlock().animateTick(imitatedBlockState, level, pos, random);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void stepOn(Level level, BlockPos pos, BlockState blockState, Entity entity) {
|
|
||||||
BlockState imitatedBlockState = getImitatedBlockState(level, pos);
|
|
||||||
imitatedBlockState.getBlock().stepOn(level, pos, imitatedBlockState, entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fallOn(Level level, BlockState blockState, BlockPos pos, Entity entity, float speed) {
|
|
||||||
BlockState imitatedBlockState = getImitatedBlockState(level, pos);
|
|
||||||
imitatedBlockState.getBlock().fallOn(level, imitatedBlockState, pos, entity, speed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getCloneItemStack(BlockGetter level, BlockPos pos, BlockState blockState) {
|
|
||||||
BlockState imitatedBlockState = getImitatedBlockState(level, pos);
|
|
||||||
return imitatedBlockState.getBlock().getCloneItemStack(level, pos, imitatedBlockState);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handlePrecipitation(BlockState blockState, Level level, BlockPos pos, Biome.Precipitation precipitation) {
|
|
||||||
BlockState imitatedBlockState = getImitatedBlockState(level, pos);
|
|
||||||
imitatedBlockState.getBlock().handlePrecipitation(imitatedBlockState, level, pos, precipitation);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getLightBlock(BlockState blockState, BlockGetter level, BlockPos pos) {
|
|
||||||
return super.getLightBlock(blockState, level, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getShadeBrightness(BlockState blockState, BlockGetter level, BlockPos pos) {
|
|
||||||
return super.getShadeBrightness(blockState, level, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getAnalogOutputSignal(BlockState blockState, Level level, BlockPos pos) {
|
|
||||||
return getImitatedBlockState(level, pos).getAnalogOutputSignal(level, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void randomTick(BlockState blockState, ServerLevel level, BlockPos pos, RandomSource random) {
|
|
||||||
getImitatedBlockState(level, pos).randomTick(level, pos, random);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void tick(BlockState blockState, ServerLevel level, BlockPos pos, RandomSource random) {
|
|
||||||
getImitatedBlockState(level, pos).tick(level, pos, random);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSignal(BlockState blockState, BlockGetter level, BlockPos pos, Direction direction) {
|
|
||||||
return getImitatedBlockState(level, pos).getSignal(level, pos, direction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getDirectSignal(BlockState blockState, BlockGetter level, BlockPos pos, Direction direction) {
|
|
||||||
return getImitatedBlockState(level, pos).getDirectSignal(level, pos, direction);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -199,7 +199,7 @@ public class ChestGUI
|
||||||
{
|
{
|
||||||
updateUtilityButtons();
|
updateUtilityButtons();
|
||||||
MinecraftForge.EVENT_BUS.post(new OpenGUIEvent(id, player, this));
|
MinecraftForge.EVENT_BUS.post(new OpenGUIEvent(id, player, this));
|
||||||
NetworkHooks.openScreen(ServerUtilities.getPlayerByID(player.toString()), new SimpleMenuProvider(ChestGUIMenu.getServerMenu(this), ChatHelpers.macro((MenuTitle != "") ? MenuTitle : "No Title")));
|
NetworkHooks.openGui(ServerUtilities.getPlayerByID(player.toString()), new SimpleMenuProvider(ChestGUIMenu.getServerMenu(this), ChatHelpers.macro(((MenuTitle != "") ? MenuTitle : "No Title"))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import dev.zontreck.libzontreck.chat.ChatColor;
|
||||||
import dev.zontreck.libzontreck.currency.events.TransactionHistoryFlushEvent;
|
import dev.zontreck.libzontreck.currency.events.TransactionHistoryFlushEvent;
|
||||||
import dev.zontreck.libzontreck.profiles.Profile;
|
import dev.zontreck.libzontreck.profiles.Profile;
|
||||||
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
|
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
|
||||||
import net.minecraft.core.UUIDUtil;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
import net.minecraft.nbt.NbtUtils;
|
import net.minecraft.nbt.NbtUtils;
|
||||||
|
|
|
@ -23,9 +23,9 @@ import net.minecraftforge.fml.common.Mod;
|
||||||
public class ForgeEventHandlers {
|
public class ForgeEventHandlers {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onPlayerTick(LivingEvent.LivingTickEvent ev)
|
public void onPlayerTick(LivingEvent.LivingUpdateEvent ev)
|
||||||
{
|
{
|
||||||
if(ev.getEntity().level().isClientSide) return;
|
if(ServerUtilities.isClient()) return;
|
||||||
|
|
||||||
if(ev.getEntity() instanceof ServerPlayer player)
|
if(ev.getEntity() instanceof ServerPlayer player)
|
||||||
{
|
{
|
||||||
|
@ -44,11 +44,11 @@ public class ForgeEventHandlers {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onPlayerJoin(final PlayerEvent.PlayerLoggedInEvent ev)
|
public void onPlayerJoin(final PlayerEvent.PlayerLoggedInEvent ev)
|
||||||
{
|
{
|
||||||
if(ev.getEntity().level().isClientSide)return;
|
if(ServerUtilities.isClient())return;
|
||||||
|
|
||||||
ServerPlayer player = (ServerPlayer)ev.getEntity();
|
ServerPlayer player = (ServerPlayer)ev.getEntity();
|
||||||
Profile prof = Profile.factory(player);
|
Profile prof = Profile.factory(player);
|
||||||
ServerLevel level = player.serverLevel();
|
ServerLevel level = player.getLevel();
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.post(new ProfileLoadedEvent(prof, player, level));
|
MinecraftForge.EVENT_BUS.post(new ProfileLoadedEvent(prof, player, level));
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ public class ForgeEventHandlers {
|
||||||
public void onLeave(final PlayerEvent.PlayerLoggedOutEvent ev)
|
public void onLeave(final PlayerEvent.PlayerLoggedOutEvent ev)
|
||||||
{
|
{
|
||||||
LibZontreck.LIBZONTRECK_SERVER_AVAILABLE=false; // Yes do this even on the client!
|
LibZontreck.LIBZONTRECK_SERVER_AVAILABLE=false; // Yes do this even on the client!
|
||||||
if(ev.getEntity().level().isClientSide)return;
|
if(ServerUtilities.isClient()) return;
|
||||||
// Get player profile, send disconnect alert, then commit profile and remove it from memory
|
// Get player profile, send disconnect alert, then commit profile and remove it from memory
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package dev.zontreck.libzontreck.menus;
|
package dev.zontreck.libzontreck.menus;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import dev.zontreck.libzontreck.LibZontreck;
|
import dev.zontreck.libzontreck.LibZontreck;
|
||||||
import dev.zontreck.libzontreck.chestgui.ChestGUI;
|
import dev.zontreck.libzontreck.chestgui.ChestGUI;
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
|
||||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||||
import net.minecraft.client.renderer.GameRenderer;
|
import net.minecraft.client.renderer.GameRenderer;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
@ -35,7 +35,7 @@ public class ChestGUIScreen extends AbstractContainerScreen<ChestGUIMenu> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) {
|
public void render(PoseStack pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) {
|
||||||
this.renderBackground(pGuiGraphics);
|
this.renderBackground(pGuiGraphics);
|
||||||
super.render(pGuiGraphics, pMouseX, pMouseY, pPartialTick);
|
super.render(pGuiGraphics, pMouseX, pMouseY, pPartialTick);
|
||||||
this.renderTooltip(pGuiGraphics, pMouseX, pMouseY);
|
this.renderTooltip(pGuiGraphics, pMouseX, pMouseY);
|
||||||
|
@ -50,17 +50,18 @@ public class ChestGUIScreen extends AbstractContainerScreen<ChestGUIMenu> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderBg(GuiGraphics guiGraphics, float v, int i, int i1) {
|
protected void renderBg(PoseStack guiGraphics, float v, int i, int i1) {
|
||||||
renderBackground(guiGraphics);
|
renderBackground(guiGraphics);
|
||||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||||
RenderSystem.setShaderColor(1,1,1,1);
|
RenderSystem.setShaderColor(1,1,1,1);
|
||||||
RenderSystem.setShaderTexture(0, TEXTURE);
|
RenderSystem.setShaderTexture(0, TEXTURE);
|
||||||
|
|
||||||
guiGraphics.blit(TEXTURE, this.leftPos, this.topPos, 0, 0, imageWidth, imageHeight);
|
blit(guiGraphics, this.leftPos, this.topPos, 0, 0, imageWidth, imageHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderLabels(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY) {
|
protected void renderLabels(PoseStack pGuiGraphics, int pMouseX, int pMouseY) {
|
||||||
pGuiGraphics.drawString(this.font, this.title, this.titleLabelX, this.titleLabelY, 4210752, false);
|
|
||||||
|
drawString(pGuiGraphics, this.font, this.title, this.titleLabelX, this.titleLabelY, 4210752);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,20 +50,20 @@ public class ModMessages {
|
||||||
net.messageBuilder(S2CPlaySoundPacket.class, PACKET_ID.getAndIncrement(), NetworkDirection.PLAY_TO_CLIENT)
|
net.messageBuilder(S2CPlaySoundPacket.class, PACKET_ID.getAndIncrement(), NetworkDirection.PLAY_TO_CLIENT)
|
||||||
.decoder(S2CPlaySoundPacket::new)
|
.decoder(S2CPlaySoundPacket::new)
|
||||||
.encoder(S2CPlaySoundPacket::toBytes)
|
.encoder(S2CPlaySoundPacket::toBytes)
|
||||||
.consumerMainThread(S2CPlaySoundPacket::handle)
|
.consumer(S2CPlaySoundPacket::handle)
|
||||||
.add();
|
.add();
|
||||||
|
|
||||||
net.messageBuilder(S2CCloseChestGUI.class, PACKET_ID.getAndIncrement(), NetworkDirection.PLAY_TO_CLIENT)
|
net.messageBuilder(S2CCloseChestGUI.class, PACKET_ID.getAndIncrement(), NetworkDirection.PLAY_TO_CLIENT)
|
||||||
.decoder(S2CCloseChestGUI::new)
|
.decoder(S2CCloseChestGUI::new)
|
||||||
.encoder(S2CCloseChestGUI::toBytes)
|
.encoder(S2CCloseChestGUI::toBytes)
|
||||||
.consumerMainThread(S2CCloseChestGUI::handle)
|
.consumer(S2CCloseChestGUI::handle)
|
||||||
.add();
|
.add();
|
||||||
|
|
||||||
net.messageBuilder(S2CServerAvailable.class, PACKET_ID.getAndIncrement(),
|
net.messageBuilder(S2CServerAvailable.class, PACKET_ID.getAndIncrement(),
|
||||||
NetworkDirection.PLAY_TO_CLIENT)
|
NetworkDirection.PLAY_TO_CLIENT)
|
||||||
.decoder(S2CServerAvailable::new)
|
.decoder(S2CServerAvailable::new)
|
||||||
.encoder(S2CServerAvailable::toBytes)
|
.encoder(S2CServerAvailable::toBytes)
|
||||||
.consumerMainThread(S2CServerAvailable::handle)
|
.consumer(S2CServerAvailable::handle)
|
||||||
.add();
|
.add();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,8 @@ public class S2CPlaySoundPacket implements IPacket
|
||||||
|
|
||||||
ctx.enqueueWork(()->{
|
ctx.enqueueWork(()->{
|
||||||
// We are on the client now, enqueue the sound!
|
// We are on the client now, enqueue the sound!
|
||||||
SoundEvent ev = SoundEvent.createFixedRangeEvent(sound, 2.0f);
|
SoundEvent ev = new SoundEvent(sound);
|
||||||
|
|
||||||
// Play sound for player!
|
// Play sound for player!
|
||||||
Minecraft.getInstance().player.playSound(ev, 1, BinUtil.getARandomInstance().nextFloat(0, 1));
|
Minecraft.getInstance().player.playSound(ev, 1, BinUtil.getARandomInstance().nextFloat(0, 1));
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraftforge.registries.RegistryObject;
|
||||||
|
|
||||||
public class ModMenuTypes
|
public class ModMenuTypes
|
||||||
{
|
{
|
||||||
public static DeferredRegister<MenuType<?>> REGISTRY = DeferredRegister.create(ForgeRegistries.MENU_TYPES, LibZontreck.MOD_ID);
|
public static DeferredRegister<MenuType<?>> REGISTRY = DeferredRegister.create(ForgeRegistries.CONTAINERS, LibZontreck.MOD_ID);
|
||||||
|
|
||||||
public static RegistryObject<MenuType<ChestGUIMenu>> CHEST_GUI_MENU = registerMenuType(ChestGUIMenu::new, "chestgui");
|
public static RegistryObject<MenuType<ChestGUIMenu>> CHEST_GUI_MENU = registerMenuType(ChestGUIMenu::new, "chestgui");
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ public class ChatHelpers {
|
||||||
*/
|
*/
|
||||||
public static MutableComponent macro(String input, String... inputs)
|
public static MutableComponent macro(String input, String... inputs)
|
||||||
{
|
{
|
||||||
return Component.literal(macroize(input,inputs));
|
return new TextComponent(macroize(input,inputs));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns the output with colors applied, and chat entries replaced using [number] as the format
|
* Returns the output with colors applied, and chat entries replaced using [number] as the format
|
||||||
|
|
|
@ -3,6 +3,7 @@ package dev.zontreck.libzontreck.util;
|
||||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
import dev.zontreck.ariaslib.util.FileIO;
|
import dev.zontreck.ariaslib.util.FileIO;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.nbt.NbtIo;
|
||||||
import net.minecraft.nbt.NbtUtils;
|
import net.minecraft.nbt.NbtUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class ServerUtilities
|
||||||
channel.messageBuilder(type, ModMessages.id(), packet.getDirection())
|
channel.messageBuilder(type, ModMessages.id(), packet.getDirection())
|
||||||
.decoder(decoder)
|
.decoder(decoder)
|
||||||
.encoder(X::toBytes)
|
.encoder(X::toBytes)
|
||||||
.consumerMainThread(X::handle)
|
.consumer(X::handle)
|
||||||
.add();
|
.add();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class WorldPosition {
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorldPosition(ServerPlayer player) {
|
public WorldPosition(ServerPlayer player) {
|
||||||
this(new Vector3(player.position()), player.serverLevel());
|
this(new Vector3(player.position()), player.getLevel());
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorldPosition(Vector3 pos, ServerLevel lvl) {
|
public WorldPosition(Vector3 pos, ServerLevel lvl) {
|
||||||
|
|
|
@ -6,30 +6,32 @@
|
||||||
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
|
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
|
||||||
modLoader="javafml" #mandatory
|
modLoader="javafml" #mandatory
|
||||||
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
|
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
|
||||||
loaderVersion="${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
loaderVersion="[40,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||||
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
|
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
|
||||||
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
||||||
license="${mod_license}"
|
license="GPLv2"
|
||||||
# A URL to refer people to when problems occur with this mod
|
# A URL to refer people to when problems occur with this mod
|
||||||
issueTrackerURL="https://github.com/zontreck/LibZontreckMod/issues" #optional
|
issueTrackerURL="https://github.com/zontreck/LibZontreckMod/issues/" #optional
|
||||||
# A list of mods - how many allowed here is determined by the individual mod loader
|
# A list of mods - how many allowed here is determined by the individual mod loader
|
||||||
[[mods]] #mandatory
|
[[mods]] #mandatory
|
||||||
# The modid of the mod
|
# The modid of the mod
|
||||||
modId="${mod_id}" #mandatory
|
modId="libzontreck" #mandatory
|
||||||
# The version number of the mod
|
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
|
||||||
version="${mod_version}" #mandatory
|
# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata
|
||||||
|
# see the associated build.gradle script for how to populate this completely automatically during a build
|
||||||
|
version="${file.jarVersion}" #mandatory
|
||||||
# A display name for the mod
|
# A display name for the mod
|
||||||
displayName="${mod_name}" #mandatory
|
displayName="LibZontreck" #mandatory
|
||||||
# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/
|
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
|
||||||
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
|
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
|
||||||
# A URL for the "homepage" for this mod, displayed in the mod UI
|
# A URL for the "homepage" for this mod, displayed in the mod UI
|
||||||
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
|
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
|
||||||
# A file name (in the root of the mod JAR) containing a logo for display
|
# A file name (in the root of the mod JAR) containing a logo for display
|
||||||
#logoFile="examplemod.png" #optional
|
#logoFile="examplemod.png" #optional
|
||||||
# A text field displayed in the mod UI
|
# A text field displayed in the mod UI
|
||||||
#credits="" #optional
|
credits="Zontreck" #optional
|
||||||
# A text field displayed in the mod UI
|
# A text field displayed in the mod UI
|
||||||
authors="${mod_authors}" #optional
|
authors="zontreck" #optional
|
||||||
# Display Test controls the display for your mod in the server connection screen
|
# Display Test controls the display for your mod in the server connection screen
|
||||||
# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod.
|
# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod.
|
||||||
# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod.
|
# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod.
|
||||||
|
@ -39,32 +41,26 @@ authors="${mod_authors}" #optional
|
||||||
#displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional)
|
#displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional)
|
||||||
|
|
||||||
# The description text for the mod (multi line!) (#mandatory)
|
# The description text for the mod (multi line!) (#mandatory)
|
||||||
description='''${mod_description}'''
|
description='''
|
||||||
|
This is a library mod for common code for all zontreck's mods.
|
||||||
|
'''
|
||||||
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
|
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
|
||||||
[[dependencies.${mod_id}]] #optional
|
[[dependencies.libzontreck]] #optional
|
||||||
# the modid of the dependency
|
# the modid of the dependency
|
||||||
modId="forge" #mandatory
|
modId="forge" #mandatory
|
||||||
# Does this dependency have to exist - if not, ordering below must be specified
|
# Does this dependency have to exist - if not, ordering below must be specified
|
||||||
mandatory=true #mandatory
|
mandatory=true #mandatory
|
||||||
# The version range of the dependency
|
# The version range of the dependency
|
||||||
versionRange="${forge_version_range}" #mandatory
|
versionRange="[40,)" #mandatory
|
||||||
# An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory
|
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
|
||||||
# BEFORE - This mod is loaded BEFORE the dependency
|
|
||||||
# AFTER - This mod is loaded AFTER the dependency
|
|
||||||
ordering="NONE"
|
ordering="NONE"
|
||||||
# Side this dependency is applied on - BOTH, CLIENT, or SERVER
|
# Side this dependency is applied on - BOTH, CLIENT or SERVER
|
||||||
side="BOTH"
|
side="BOTH"
|
||||||
# Here's another dependency
|
# Here's another dependency
|
||||||
[[dependencies.${mod_id}]]
|
[[dependencies.libzontreck]]
|
||||||
modId="minecraft"
|
modId="minecraft"
|
||||||
mandatory=true
|
mandatory=true
|
||||||
# This version range declares a minimum of the current minecraft version up to but not including the next major version
|
# This version range declares a minimum of the current minecraft version up to but not including the next major version
|
||||||
versionRange="${minecraft_version_range}"
|
versionRange="[1.18.2,1.19)"
|
||||||
ordering="NONE"
|
ordering="NONE"
|
||||||
side="BOTH"
|
side="BOTH"
|
||||||
|
|
||||||
# Features are specific properties of the game environment, that you may want to declare you require. This example declares
|
|
||||||
# that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't
|
|
||||||
# stop your mod loading on the server for example.
|
|
||||||
#[features.${mod_id}]
|
|
||||||
#openGLVersion="[3.2,)"
|
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"pack": {
|
"pack": {
|
||||||
"description": {
|
"description": "LibZontreck resources",
|
||||||
"text": "${mod_id} resources"
|
"pack_format": 9,
|
||||||
},
|
"forge:resource_pack_format": 8,
|
||||||
"pack_format": 15
|
"forge:data_pack_format": 9
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in a new issue