Upgrade back to 1.19.4

Increment API version
+ LibAC
- Lightmans Currency
- Parchment (Temporary)
This commit is contained in:
Aria 2023-04-21 03:44:40 -07:00
parent 00ea4681d8
commit c6ff1afbdc
16 changed files with 99 additions and 32 deletions

View file

@ -32,7 +32,9 @@ minecraft {
//
// Use non-default mappings at your own risk. They may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'parchment', version: "${parchment_version}-${mc_version}"
// mappings channel: 'parchment', version: "${parchment_version}-${mc_version}"
mappings channel: 'official', version: "${mc_version}"
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default.
@ -139,11 +141,13 @@ dependencies {
// Examples using mod jars from ./libs
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
//compileOnly ("net.luckperms:api:${luckperms_api_version}")
//runtimeOnly fg.deobf("curse.maven:luckperms-431733:3828099")
//runtimeOnly fg.deobf("curse.maven:luckperms-431733:4443551")
//implementation fg.deobf("blank:LuckPerms:Forge-5.4.12")
provided "dev.zontreck:LibAC:1.1.1"
implementation "dev.zontreck:LibAC:1.1.1"
provided "dev.zontreck:LibAC:${libac}"
implementation "dev.zontreck:LibAC:${libac}"
minecraftLibrary "dev.zontreck:LibAC:${libac}"
// For more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
@ -168,6 +172,7 @@ jar {
}
}
compileJava.finalizedBy('devJar')
// Example configuration to allow publishing using the maven-publish plugin
// This is the preferred method to reobfuscate your jar file

View file

@ -3,8 +3,10 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
mc_version=1.18.2
forge_version=40.2.1
myversion=1.0.6.0420232221
parchment_version=2022.11.06
mc_version=1.19.4
forge_version=45.0.46
myversion=1.0.7.0421230342
parchment_version=2023.03.12
luckperms_api_version=5.4
libac=1.1.3

View file

@ -7,6 +7,8 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import dev.zontreck.ariaslib.events.EventBus;
import dev.zontreck.libzontreck.currency.CurrencyHelper;
import org.slf4j.Logger;
import com.mojang.logging.LogUtils;
@ -72,6 +74,7 @@ public class LibZontreck {
MinecraftForge.EVENT_BUS.register(this);
MinecraftForge.EVENT_BUS.register(new ForgeEventHandlers());
MinecraftForge.EVENT_BUS.register(new Commands());
EventBus.BUS.register(CurrencyHelper.class);
}
private void setup(final FMLCommonSetupEvent event)

View file

@ -1,7 +1,7 @@
package dev.zontreck.libzontreck.chat;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.HoverEvent.Action;
import net.minecraft.world.item.ItemStack;
@ -17,7 +17,7 @@ public class HoverTip {
*/
public static HoverEvent get(String text)
{
return new HoverEvent(Action.SHOW_TEXT, new TextComponent(text));
return new HoverEvent(Action.SHOW_TEXT, Component.literal(text));
}
/**

View file

@ -13,7 +13,7 @@ import net.minecraft.world.item.ItemStack;
public class GetHead {
public static void register(CommandDispatcher<CommandSourceStack> dispatch)
{
dispatch.register(Commands.literal("aria_debug_get_head").executes(c-> getHead(c.getSource(), c.getSource().getEntity().getName().getContents())).then(Commands.argument("name", StringArgumentType.string()).executes(c -> getHead(c.getSource(), StringArgumentType.getString(c, "name")))));
dispatch.register(Commands.literal("aria_debug_get_head").executes(c-> getHead(c.getSource(), c.getSource().getEntity().getName().getString())).then(Commands.argument("name", StringArgumentType.string()).executes(c -> getHead(c.getSource(), StringArgumentType.getString(c, "name")))));
}

View file

@ -0,0 +1,14 @@
package dev.zontreck.libzontreck.currency;
import dev.zontreck.ariaslib.events.annotations.Subscribe;
import dev.zontreck.libzontreck.currency.events.CurrencyBalanceCheckEvent;
import java.util.List;
public class CurrencyHelper {
@Subscribe
public static void onCurrencyBalanceCheck(CurrencyBalanceCheckEvent ev)
{
}
}

View file

@ -0,0 +1,20 @@
package dev.zontreck.libzontreck.currency.events;
import dev.zontreck.ariaslib.events.Event;
import net.minecraft.world.entity.player.Player;
public class CurrencyBalanceCheckEvent extends Event
{
public final Player player;
public String balance;
public CurrencyBalanceCheckEvent(Player player)
{
this.player=player;
}
@Override
public boolean isCancellable() {
return false;
}
}

View file

@ -1,13 +1,17 @@
package dev.zontreck.libzontreck.events;
import dev.zontreck.ariaslib.events.Event;
import dev.zontreck.ariaslib.events.EventBus;
import dev.zontreck.ariaslib.util.DelayedExecutorService;
import dev.zontreck.libzontreck.LibZontreck;
import dev.zontreck.libzontreck.currency.events.CurrencyBalanceCheckEvent;
import dev.zontreck.libzontreck.memory.PlayerContainer;
import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@ -16,7 +20,7 @@ import net.minecraftforge.fml.common.Mod;
public class ForgeEventHandlers {
@SubscribeEvent
public void onPlayerTick(LivingUpdateEvent ev)
public void onPlayerTick(LivingEvent.LivingTickEvent ev)
{
if(ev.getEntity().level.isClientSide)return;
@ -40,11 +44,19 @@ public class ForgeEventHandlers {
{
if(ev.getEntity().level.isClientSide)return;
ServerPlayer player = (ServerPlayer)ev.getPlayer();
ServerPlayer player = (ServerPlayer)ev.getEntity();
Profile prof = Profile.factory(player);
ServerLevel level = player.getLevel();
MinecraftForge.EVENT_BUS.post(new ProfileLoadedEvent(prof, player, level));
DelayedExecutorService.getInstance().schedule(new Runnable() {
@Override
public void run() {
CurrencyBalanceCheckEvent event= new CurrencyBalanceCheckEvent(ev.getEntity());
EventBus.BUS.post(event);
}
}, 10);
}
@SubscribeEvent

View file

@ -49,7 +49,7 @@ public class S2CPlaySoundPacket implements IPacket
ctx.enqueueWork(()->{
// We are on the client now, enqueue the sound!
SoundEvent ev = new SoundEvent(sound);
SoundEvent ev = SoundEvent.createFixedRangeEvent(sound, 2.0f);
// Play sound for player!
Minecraft.getInstance().player.playSound(ev, 1, BinUtil.getARandomInstance().nextFloat(0, 1));
});

View file

@ -7,7 +7,7 @@ import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
public class ModMenuTypes {
public static DeferredRegister<MenuType<?>> REGISTER = DeferredRegister.create(ForgeRegistries.CONTAINERS, LibZontreck.MOD_ID);
public static DeferredRegister<MenuType<?>> REGISTER = DeferredRegister.create(ForgeRegistries.MENU_TYPES, LibZontreck.MOD_ID);
public static void register(IEventBus bus)
{

View file

@ -5,7 +5,6 @@ import java.util.UUID;
import dev.zontreck.libzontreck.LibZontreck;
import dev.zontreck.libzontreck.chat.ChatColor;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player;
@ -78,9 +77,9 @@ public class ChatHelpers {
* @param inputs Entries to replace with in input
* @return
*/
public static TextComponent macro(String input, String... inputs)
public static Component macro(String input, String... inputs)
{
return new TextComponent(macroize(input,inputs));
return Component.literal(macroize(input,inputs));
}
/**
* Returns the output with colors applied, and chat entries replaced using [number] as the format

View file

@ -2,6 +2,7 @@ package dev.zontreck.libzontreck.util;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import net.minecraft.core.Registry;
@ -11,25 +12,30 @@ import net.minecraft.nbt.Tag;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraftforge.registries.ForgeRegistries;
public class ItemUtils {
public static Map<Enchantment, Integer> getEnchantments(ItemStack stack)
{
ListTag enchants = stack.getEnchantmentTags();
Map<Enchantment, Integer> enchantments = new HashMap<>();
//ListTag enchants = stack.getEnchantmentTags();
Map<Enchantment, Integer> enchantments = EnchantmentHelper.getEnchantments(stack);
return enchantments;
/*Map<Enchantment, Integer> enchantments = new HashMap<>();
Iterator<Tag> enchantsIterator = enchants.iterator();
while(enchantsIterator.hasNext())
{
CompoundTag theTag = (CompoundTag)enchantsIterator.next();
Enchantment ench = Registry.ENCHANTMENT.getOptional(EnchantmentHelper.getEnchantmentId(theTag)).get();
Enchantment enchant = EnchantmentHelper.
Enchantment ench = .getOptional(EnchantmentHelper.getEnchantmentId(theTag)).get();
Integer level = EnchantmentHelper.getEnchantmentLevel(theTag);
enchantments.put(ench, level);
}
return enchantments;
return enchantments;*/
}
public static Integer getEnchantmentLevel(Enchantment ench, ItemStack stack)

View file

@ -4,7 +4,7 @@ import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.lore.LoreContainer;
import dev.zontreck.libzontreck.lore.LoreEntry;
import dev.zontreck.libzontreck.util.heads.HeadCache.HeadCacheItem;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
public class CreditsEntry {
@ -27,7 +27,7 @@ public class CreditsEntry {
public ItemStack compile()
{
ItemStack stack = player.getAsItem();
stack.setHoverName(new TextComponent(name));
stack.setHoverName(Component.literal(name));
LoreContainer contain = new LoreContainer(stack);
LoreEntry entry = new LoreEntry();
entry.text = ChatColor.doColors("!Dark_Purple!Role: "+role);

View file

@ -12,7 +12,7 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtIo;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.PlayerHeadItem;
@ -66,7 +66,7 @@ public class HeadCache
skullOwner.put("Properties", properties);
head.addTagElement(PlayerHeadItem.TAG_SKULL_OWNER, skullOwner);
TextComponent headname = ChatHelpers.macro("[0]'s Head", name);
Component headname = ChatHelpers.macro("[0]'s Head", name);
head.setHoverName(headname);
return head;

View file

@ -5,6 +5,7 @@ import java.util.List;
import dev.zontreck.libzontreck.exceptions.InvalidDeserialization;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Vec3i;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.phys.Vec3;
@ -21,9 +22,14 @@ public class Vector3
return new Vec3(x, y, z);
}
public Vec3i asMinecraftVec3i()
{
return new Vec3i((int) Math.round(x), (int) Math.round(y), (int) Math.round(z));
}
public BlockPos asBlockPos()
{
return new BlockPos(asMinecraftVector());
return new BlockPos(asMinecraftVec3i());
}
public Vector3()

View file

@ -6,7 +6,7 @@
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[40,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
loaderVersion="[45,)" #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.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
license="GPLv3"
@ -52,7 +52,7 @@ This mod provides common code to all of zontreck's mods.
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="[40,)" #mandatory
versionRange="[45,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
@ -62,6 +62,6 @@ This mod provides common code to all of zontreck's mods.
modId="minecraft"
mandatory=true
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="[1.18.2,1.19)"
versionRange="[1.19.4,1.20)"
ordering="NONE"
side="BOTH"