Update to 1.20

This commit is contained in:
zontreck 2023-12-16 13:05:03 -07:00
parent 575e97d05c
commit 4d0205715b
19 changed files with 82 additions and 63 deletions

View file

@ -153,8 +153,7 @@ dependencies {
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
compileOnly fg.deobf("dev.zontreck:LibZontreck:${minecraft_version}-${libzontreck}")
runtimeOnly fg.deobf("dev.zontreck:LibZontreck:${minecraft_version}-${libzontreck}")
implementation fg.deobf("dev.zontreck:LibZontreckMod:${libzontreck}")
//implementation fg.deobf('software.bernie.geckolib:geckolib-forge-1.20:3.0.57')
//238222 4712868

View file

@ -3,7 +3,7 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
libzontreck=1.0.8.1119230646
libzontreck=1.9.121423.1700
## Environment Properties
@ -49,7 +49,7 @@ mod_name=OTEMod
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=GPLv3
# The mod version. See https://semver.org/
mod_version=1.3.8.1119231708
mod_version=1.4.121623.1259
# 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.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html

View file

@ -11,6 +11,8 @@ import java.util.Map;
import java.util.Set;
import com.mojang.logging.LogUtils;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.vectors.Vector3;
import dev.zontreck.otemod.integrations.KeyBindings;
import net.minecraft.client.gui.screens.MenuScreens;
import net.minecraft.client.renderer.entity.EntityRenderers;
@ -31,12 +33,9 @@ import net.minecraftforge.event.entity.item.ItemExpireEvent;
import net.minecraftforge.event.server.ServerStartedEvent;
import net.minecraftforge.event.server.ServerStoppingEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import software.bernie.geckolib3.GeckoLib;
import org.slf4j.Logger;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.vectors.Vector3;
import dev.zontreck.otemod.blocks.ModBlocks;
import dev.zontreck.otemod.blocks.entity.ModEntities;
import dev.zontreck.otemod.chat.ChatServerOverride;
@ -242,7 +241,7 @@ public class OTEMod
//ItemBlockRenderTypes.setRenderLayer(ModBlocks.AURORA_DOOR.get(), RenderType.translucent());
EntityRenderers.register(ModEntityTypes.POSSUM.get(), PossumRenderer::new);
//EntityRenderers.register(ModEntityTypes.POSSUM.get(), PossumRenderer::new);
}
}

View file

@ -8,6 +8,7 @@ import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.implementation.Messages;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.server.level.ServerPlayer;
@ -52,7 +53,7 @@ public class ChatColorCommand {
p.commit();
LibZontreck.PROFILES.put(play.getStringUUID(), p);
source.sendSuccess(ChatHelpers.macro(OTEMod.OTEPrefix + " "+ChatColor.DARK_PURPLE + "Your chat color has been updated"), false);
ChatHelpers.broadcastTo(play, ChatHelpers.macro(Messages.CHAT_COLOR_UPDATED), source.getServer());
return 0;
}

View file

@ -8,6 +8,7 @@ import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.implementation.Messages;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.server.level.ServerPlayer;
@ -52,7 +53,8 @@ public class NameColorCommand {
p.commit();
LibZontreck.PROFILES.put(play.getStringUUID(), p);
source.sendSuccess(ChatHelpers.macro(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your name color has been updated"), false);
ChatHelpers.broadcastTo(play, ChatHelpers.macro(Messages.NAME_COLOR_UPDATED), source.getServer());
return 0;
}

View file

@ -8,6 +8,7 @@ import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.implementation.Messages;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.server.level.ServerPlayer;
@ -48,7 +49,8 @@ public class NickCommand {
p.commit();
LibZontreck.PROFILES.put(play.getStringUUID(), p);
source.sendSuccess(ChatHelpers.macro(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your nickname has been updated"), false);
ChatHelpers.broadcastTo(play, ChatHelpers.macro(Messages.NICK_UPDATED), source.getServer());
return 0;
}

View file

@ -8,6 +8,7 @@ import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.implementation.Messages;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.server.level.ServerPlayer;
@ -53,7 +54,7 @@ public class PrefixColorCommand {
p.commit();
LibZontreck.PROFILES.put(play.getStringUUID(), p);
source.sendSuccess(ChatHelpers.macro(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your prefix color has been updated"), false);
ChatHelpers.broadcastTo(play, ChatHelpers.macro(Messages.PREFIX_COLOR_UPDATED), source.getServer());
return 0;
}

View file

@ -8,6 +8,7 @@ import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.implementation.Messages;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.server.level.ServerPlayer;
@ -48,7 +49,7 @@ public class PrefixCommand {
p.commit();
LibZontreck.PROFILES.put(play.getStringUUID(), p);
source.sendSuccess(ChatHelpers.macro(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your prefix has been updated"), false);
ChatHelpers.broadcastTo(play, ChatHelpers.macro(Messages.PREFIX_UPDATED), source.getServer());
return 0;
}

View file

@ -17,7 +17,7 @@ public class ModEntityTypes {
//public static void register(IEventBus bus){
// ENTITIES.register(bus);
//}
public static void register(IEventBus bus){
//ENTITIES.register(bus);
}
}

View file

@ -15,7 +15,7 @@ public class ModEventBusEvents {
@SubscribeEvent
public static void onMobAttributeCreation(EntityAttributeCreationEvent ev)
{
ev.put((EntityType<? extends LivingEntity>) ModEntityTypes.POSSUM.get(), PossumEntity.createAttributes());
//ev.put((EntityType<? extends LivingEntity>) ModEntityTypes.POSSUM.get(), PossumEntity.createAttributes());
OTEMod.LOGGER.info("/!\\ REGISTERING ATTRIBUTES /!\\");
}
}

View file

@ -2,8 +2,20 @@ package dev.zontreck.otemod.implementation;
public class Messages {
public static final String OTE_PREFIX;
public static final String PREFIX_UPDATED;
public static final String PREFIX_COLOR_UPDATED;
public static final String NICK_UPDATED;
public static final String NAME_COLOR_UPDATED;
public static final String CHAT_COLOR_UPDATED;
static{
OTE_PREFIX = "!Dark_Gray![!Dark_Purple!OTE!Dark_Gray!] ";
PREFIX_UPDATED = OTE_PREFIX + " !Dark_Purple!Your prefix has been updated";
PREFIX_COLOR_UPDATED = OTE_PREFIX + "!Dark_Purple! Your prefix color has been updated";
NICK_UPDATED = OTE_PREFIX + "!Dark_Purple! Your nickname has been updated";
NAME_COLOR_UPDATED = OTE_PREFIX + "!Dark_Purple! Your name color has been updated";
CHAT_COLOR_UPDATED = OTE_PREFIX + "!Dark_Purple! Your chat color has been updated";
}
}

View file

@ -1,6 +1,8 @@
package dev.zontreck.otemod.implementation.energy.screenrenderer;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.Rect2i;
import net.minecraft.network.chat.Component;
import net.minecraftforge.energy.IEnergyStorage;
@ -35,14 +37,10 @@ public class EnergyInfoArea extends InfoArea {
}
@Override
public void draw(PoseStack transform) {
public void draw(GuiGraphics transform) {
final int height = area.getHeight();
int stored = (int)(height*(energy.getEnergyStored()/(float)energy.getMaxEnergyStored()));
fillGradient(
area.getX(), area.getY()+(height-stored),
area.getX() + area.getWidth(), area.getY() +area.getHeight(),
0xffb51500, 0xff600b00
);
transform.fillGradient(area.getX(), area.getY() + (height + stored), area.getX() + area.getWidth(), area.getY() + area.getHeight(), 0xff0000, 0xff550000);
}
}

View file

@ -2,7 +2,8 @@ package dev.zontreck.otemod.implementation.energy.screenrenderer;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.gui.GuiComponent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.Rect2i;
/*
@ -12,13 +13,13 @@ import net.minecraft.client.renderer.Rect2i;
* This code is licensed under "Blu's License of Common Sense"
* Details can be found in the license file in the root folder of this project
*/
public abstract class InfoArea extends GuiComponent {
public abstract class InfoArea {
protected final Rect2i area;
protected InfoArea(Rect2i area) {
this.area = area;
}
public abstract void draw(PoseStack transform);
public abstract void draw(GuiGraphics transform);
}

View file

@ -17,7 +17,7 @@ public final class ModMenuTypes
{
public static final DeferredRegister<MenuType<?>> CONTAINERS = DeferredRegister.create(ForgeRegistries.MENU_TYPES, OTEMod.MOD_ID);
public static final RegistryObject <MenuType <VaultMenu>> VAULT = CONTAINERS.register("vault", ()-> new MenuType<>(VaultMenu::new));
public static final RegistryObject<MenuType<VaultMenu>> VAULT = registerMenuType(VaultMenu::new, "vault");
public static final RegistryObject<MenuType<ItemScrubberMenu>> SCRUBBER = registerMenuType(ItemScrubberMenu::new, "item_scrubber_menu");
public static final RegistryObject<MenuType<MagicalScrubberMenu>> MAGIC_SCRUBBER = registerMenuType(MagicalScrubberMenu::new, "magical_scrubber_menu");

View file

@ -8,6 +8,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.implementation.MouseHelpers;
import dev.zontreck.otemod.implementation.energy.screenrenderer.EnergyInfoArea;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.network.chat.Component;
@ -46,22 +47,22 @@ public class ItemScrubberScreen extends AbstractContainerScreen<ItemScrubberMenu
}
@Override
protected void renderBg(PoseStack poseStack, float partialTick, int mouseX, int mouseY) {
protected void renderBg(GuiGraphics poseStack, float partialTick, int mouseX, int mouseY) {
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.setShaderTexture(0, TEXTURE);
blit(poseStack, this.leftPos, this.topPos, 0,0, imageWidth, imageHeight);
poseStack.blit(TEXTURE, this.leftPos, this.topPos, 0,0, imageWidth, imageHeight);
renderUncraftingProgress(poseStack);
EIA.draw(poseStack);
}
@Override
protected void renderLabels(PoseStack stack, int mouseX, int mouseY)
protected void renderLabels(GuiGraphics stack, int mouseX, int mouseY)
{
this.font.draw(stack, this.title.getString(), 63, 12, 0xFFFFFF);
stack.drawString(font, this.title.getString(), 63, 12, 0xFFFFFF);
int x = (width - imageWidth )/2;
int y = (height - imageHeight)/2;
@ -69,22 +70,22 @@ public class ItemScrubberScreen extends AbstractContainerScreen<ItemScrubberMenu
//this.font.draw(stack, this.playerInventoryTitle.getString(), this.leftPos + 17, this.topPos + 123, 0xFFFFFF);
}
private void renderEnergy(PoseStack stack, int mouseX, int mouseY, int x, int y) {
private void renderEnergy(GuiGraphics stack, int mouseX, int mouseY, int x, int y) {
if(isMouseAbove(mouseX, mouseY, x, y, 188, 69, 7, 72)){
renderTooltip(stack, EIA.getTooltips(), Optional.empty(), mouseX-x, mouseY-y);
stack.renderTooltip(font, EIA.getTooltips(), Optional.empty(), mouseX-x, mouseY-y);
}
}
private void renderUncraftingProgress(PoseStack stack)
private void renderUncraftingProgress(GuiGraphics stack)
{
if(menu.isCrafting())
{
blit(stack, leftPos+42, topPos+45, 1, 168, menu.getScaledProgress(),6);
stack.blit(TEXTURE, leftPos+42, topPos+45, 1, 168, menu.getScaledProgress(),6);
}
}
@Override
public void render(PoseStack stack, int mouseX, int mouseY, float delta)
public void render(GuiGraphics stack, int mouseX, int mouseY, float delta)
{
renderBackground(stack);
super.render(stack, mouseX, mouseY, delta);

View file

@ -8,6 +8,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.implementation.MouseHelpers;
import dev.zontreck.otemod.implementation.energy.screenrenderer.EnergyInfoArea;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.network.chat.Component;
@ -16,20 +17,11 @@ import net.minecraft.world.entity.player.Inventory;
public class MagicalScrubberScreen extends AbstractContainerScreen<MagicalScrubberMenu>
{
private static final ResourceLocation TEXTURE = new ResourceLocation(OTEMod.MOD_ID, "textures/gui/item_scrubber_gui.png");
private EnergyInfoArea EIA;
public MagicalScrubberScreen(MagicalScrubberMenu p_97741_, Inventory p_97742_, Component p_97743_) {
super(p_97741_, p_97742_, p_97743_);
this.topPos=0;
this.leftPos=0;
this.imageWidth = 208;
this.imageHeight = 165;
}
@Override
protected void init()
@ -45,46 +37,56 @@ public class MagicalScrubberScreen extends AbstractContainerScreen<MagicalScrubb
EIA = new EnergyInfoArea(x+188, y+69, menu.entity.getEnergyStorage(), 7, 72);
}
public MagicalScrubberScreen(MagicalScrubberMenu pMenu, Inventory pPlayerInventory, Component pTitle) {
super(pMenu, pPlayerInventory, pTitle);
this.topPos=0;
this.leftPos=0;
this.imageWidth = 208;
this.imageHeight = 165;
}
@Override
protected void renderBg(PoseStack poseStack, float partialTick, int mouseX, int mouseY) {
protected void renderBg(GuiGraphics poseStack, float partialTick, int mouseX, int mouseY) {
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.setShaderTexture(0, TEXTURE);
blit(poseStack, this.leftPos, this.topPos, 0,0, imageWidth, imageHeight);
poseStack.blit(TEXTURE, this.leftPos, this.topPos, 0, 0, imageWidth, imageHeight);
renderUncraftingProgress(poseStack);
EIA.draw(poseStack);
}
@Override
protected void renderLabels(PoseStack stack, int mouseX, int mouseY)
protected void renderLabels(GuiGraphics stack, int mouseX, int mouseY)
{
this.font.draw(stack, this.title.getString(), 63, 12, 0xFFFFFF);
stack.drawString(font, title.getString(), 63, 12, 0xFFFFFF);
int x = (width - imageWidth )/2;
int y = (height - imageHeight)/2;
renderEnergy(stack, mouseX, mouseY, x, y);
//this.font.draw(stack, this.playerInventoryTitle.getString(), this.leftPos + 17, this.topPos + 123, 0xFFFFFF);
}
private void renderEnergy(PoseStack stack, int mouseX, int mouseY, int x, int y) {
private void renderEnergy(GuiGraphics stack, int mouseX, int mouseY, int x, int y) {
if(isMouseAbove(mouseX, mouseY, x, y, 188, 69, 7, 72)){
renderTooltip(stack, EIA.getTooltips(), Optional.empty(), mouseX-x, mouseY-y);
stack.renderTooltip(font, EIA.getTooltips(), Optional.empty(), mouseX-x, mouseY-y);
}
}
private void renderUncraftingProgress(PoseStack stack)
private void renderUncraftingProgress(GuiGraphics stack)
{
if(menu.isCrafting())
{
blit(stack, leftPos+42, topPos+45, 1, 168, menu.getScaledProgress(),6);
stack.blit(TEXTURE, leftPos+42, topPos+45, 1, 168, menu.getScaledProgress(), 6);
}
}
@Override
public void render(PoseStack stack, int mouseX, int mouseY, float delta)
public void render(GuiGraphics stack, int mouseX, int mouseY, float delta)
{
renderBackground(stack);
super.render(stack, mouseX, mouseY, delta);
@ -95,5 +97,4 @@ public class MagicalScrubberScreen extends AbstractContainerScreen<MagicalScrubb
{
return MouseHelpers.isMouseOver(mouseX, mouseY, x+offsetX, y+offsetY, width, height);
}
}

View file

@ -5,6 +5,7 @@ import java.util.UUID;
import dev.zontreck.otemod.implementation.inits.ModMenuTypes;
import net.minecraft.core.BlockPos;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
@ -23,9 +24,9 @@ public class VaultMenu extends AbstractContainerMenu
public final Player thePlayer;
public final int VAULT_NUMBER;
public VaultMenu (int id, Inventory player)
public VaultMenu (int id, Inventory player, FriendlyByteBuf buf)
{
this(id, player, new ItemStackHandler(54), BlockPos.ZERO, player.player, 0);
this(id, player, new ItemStackHandler(54), player.player.getOnPos(), player.player, 0);
}
public VaultMenu (int id, Inventory player, IItemHandler slots, BlockPos pos, Player play, int vaultNum)

View file

@ -55,7 +55,7 @@ public class ModItems {
public static final RegistryObject<Item> VAULT_RAW_ORE = ITEMS.register("raw_vault_steel_ore", () -> new Item(new Item.Properties().stacksTo(64)));
public static final RegistryObject<Item> POSSUM_SPAWN_EGG = ITEMS.register("possum_spawn_egg", () -> new ForgeSpawnEggItem(ModEntityTypes.POSSUM, 0x938686, 0xc68787, new Item.Properties()));
//public static final RegistryObject<Item> POSSUM_SPAWN_EGG = ITEMS.register("possum_spawn_egg", () -> new ForgeSpawnEggItem(ModEntityTypes.POSSUM, 0x938686, 0xc68787, new Item.Properties()));

View file

@ -66,7 +66,7 @@ description='''${mod_description}'''
[[dependencies.${mod_id}]]
modId="libzontreck"
mandatory=true
versionRange="1.20.1-1,"
versionRange="[1.9,1.10)"
ordering="NONE"
side="BOTH"