Skip to content

Commit

Permalink
1.19.4 ready
Browse files Browse the repository at this point in the history
  • Loading branch information
samolego committed Mar 26, 2023
1 parent 3e28b72 commit 5df37a2
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 64 deletions.
31 changes: 7 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,10 @@ version = project.mod_version
group = project.maven_group

repositories {
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
maven {
url 'https://jitpack.io'
}
maven {
url 'https://masa.dy.fi/maven'
}
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://maven.nucleoid.xyz' }
maven { url 'https://jitpack.io' }
maven { url 'https://masa.dy.fi/maven' }
}

def ENV = System.getenv()
Expand All @@ -42,28 +37,16 @@ dependencies {

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
// Make a collection of all api modules we wish to use
Set<String> apiModules = [
"fabric-api-base",
"fabric-command-api-v2",
"fabric-lifecycle-events-v1",
"fabric-networking-api-v1",
"fabric-registry-sync-v0"
]

// Add each module as a dependency
apiModules.forEach {
modImplementation(fabricApi.module(it, project.fabric_version))
}

// Config2Brigadier
modImplementation(include("com.github.samolego.Config2Brigadier:config2brigadier-fabric:${project.c2b_lib_version}"))

// LuckPerms
modImplementation(include('me.lucko:fabric-permissions-api:0.1-SNAPSHOT'))
modCompileOnly('com.github.samolego.Taterzens:taterzens-fabric:1.11.4-beta')
modImplementation(include('me.lucko:fabric-permissions-api:0.2-SNAPSHOT'))

// Carpet
modCompileOnly("com.github.gnembon:fabric-carpet:${project.carpet_core_version}")
modCompileOnly('com.github.samolego.Taterzens:taterzens-fabric:1.11.4-beta3')
}

processResources {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ loader_version=0.14.17
fabric_version=0.76.0+1.19.4
quilt_mappings=1
# Mod Properties
mod_version=2.0.2
mod_version=2.1.0
maven_group=org.samo_lego
archives_base_name=fabrictailor
# Dependencies
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/samo_lego/fabrictailor/FabricTailor.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void onInitialize() {
CarpetFunctions.init();
}

ServerPlayConnectionEvents.JOIN.register(NetworkHandler::onJoin);
ServerPlayConnectionEvents.INIT.register(NetworkHandler::onInit);
ServerPlayNetworking.registerGlobalReceiver(FABRICTAILOR_VANILLA_CHANGE, NetworkHandler::changeVanillaSkinPacket);
ServerPlayNetworking.registerGlobalReceiver(FABRICTAILOR_HD_CHANGE, NetworkHandler::changeHDSkinPacket);
ServerPlayNetworking.registerGlobalReceiver(FABRICTAILOR_DEFAULT_SKIN, NetworkHandler::defaultSkinPacket);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void onInitializeClient() {
});

ClientPlayNetworking.registerGlobalReceiver(SkinPackets.FT_HELLO, (client, handler, buf, responseSender) -> {
TAILORED_SERVER = false; // todo
TAILORED_SERVER = true;
ALLOW_DEFAULT_SKIN = buf.readBoolean();
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import net.minecraft.ChatFormatting;
import net.minecraft.Util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiComponent;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.Checkbox;
import net.minecraft.client.gui.components.EditBox;
Expand Down Expand Up @@ -301,36 +300,10 @@ public void render(PoseStack matrixStack, int mouseX, int mouseY, float delta) {
} else {
// Drawing Player
// Luckily vanilla code is available

float mousex = (float) width / 2 - 75 - mouseX;
float mousey = ((float) height / 2 - mouseY);
var player = minecraft.player;

/*float f = (float)Math.atan(mousex / 40.0f);
float g = (float)Math.atan(mousey / 40.0f);
float h = player.yBodyRot;
float i = player.getYRot();
float j = player.getXRot();
float k = player.yHeadRotO;
float l = player.yHeadRot;
player.yBodyRot = f * 20.0f;
player.setYRot(f * 40.0f);
player.setXRot(-g * 20.0f);
player.yHeadRot = player.getYRot();
player.yHeadRotO = player.getYRot();*/


float l = (float)Math.atan(mousey / 40.0f);
final var quaternionf = new Quaternionf().rotateZ((float)Math.PI);
final var quaternionf2 = new Quaternionf().rotateX(l * 20.0f * ((float)Math.PI / 180));
InventoryScreen.renderEntityInInventory(matrixStack, startX + 50, startY + 120, 50, quaternionf, quaternionf2, player);

/*player.yBodyRot = h;
player.setYRot(i);
player.setXRot(j);
player.yHeadRotO = k;
player.yHeadRot = l;*/

InventoryScreen.renderEntityInInventoryFollowsMouse(matrixStack, startX + 51, startY + 120, 50, mousex, mousey, this.minecraft.player);
}
}

Expand All @@ -355,7 +328,7 @@ private void drawTabs(PoseStack matrixStack, int startX, int startY, int mouseX,
this.selectedTab = tab;
} else if (selectedTab == tab) {
// Rendering "selected" tab
this.blit(matrixStack, startX + 224 - i * 27, startY - 28, i == 0 ? 56 : 28, 32, 28, 32);
blit(matrixStack, startX + 224 - i * 27, startY - 28, i == 0 ? 56 : 28, 32, 28, 32);

// Showing or hiding additional buttons
this.skinModelCheckbox.visible = tab.hasSkinModels();
Expand All @@ -364,7 +337,7 @@ private void drawTabs(PoseStack matrixStack, int startX, int startY, int mouseX,
}
else {
// rendering other tabs
this.blit(matrixStack, startX + 224 - i * 27, startY - 28, i == 0 ? 56 : 28, 0, 28, i == 0 ? 31 : 29);
blit(matrixStack, startX + 224 - i * 27, startY - 28, i == 0 ? 56 : 28, 0, 28, i == 0 ? 31 : 29);
}
}
// Rendering title
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public Optional<Pair<ResourceLocation, FriendlyByteBuf>> getSkinChangePacket(Loc
if (!config.allowedTextureDomains.contains(tld)) {
// Redirect to duckduckgo
// e.g. convert https://image.com/image.png to https://external-content.duckduckgo.com/iu/?u=https://image.com/image.png
url = "https://external-content.duckduckgo.com/iu/?u=" + url;
url = "https://external-content.duckduckgo.com/iu/?u=" + skinUrl;
}

skinData = this.getExtendedProperty(player, MinecraftProfileTexture.Type.SKIN, url, metadata);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class TailorConfig implements IBrigadierConfigurator {
@SerializedName("custom_skin_server")
public String customSkinServer = "";

@SerializedName("allowed_texture_domains")
@SerializedName("texture_allowed_domains")
public Set<String> allowedTextureDomains = new HashSet<>(Set.of(
"minecraft.net",
"mojang.com",
Expand All @@ -59,7 +59,8 @@ public class TailorConfig implements IBrigadierConfigurator {
"planetminecraft.com",
"googleusercontent.com",
"nocookie.net",
"discord.com"
"discord.com",
"duckduckgo.com"
));

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

public class NetworkHandler {

public static void onJoin(ServerGamePacketListenerImpl listener, PacketSender _sender, MinecraftServer _server) {
public static void onInit(ServerGamePacketListenerImpl listener, MinecraftServer _server) {
var player = listener.getPlayer();
if (ServerPlayNetworking.canSend(listener, SkinPackets.FT_HELLO)) {
ServerPlayNetworking.send(player, SkinPackets.FT_HELLO, createHelloPacket(player.hasPermissions(2)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.context.CommandContext;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.minecraft.commands.CommandSourceStack;
import org.samo_lego.fabrictailor.command.SkinCommand;
import org.samo_lego.fabrictailor.util.SkinFetcher;
Expand All @@ -14,7 +14,7 @@ public class TailorTest implements ModInitializer {
@Override
public void onInitialize() {
// Add command for "/hdskin"
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> {
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
this.hdSkinCmd(dispatcher);
this.capeCmd(dispatcher);
this.serversideSkinCmd(dispatcher);
Expand Down

0 comments on commit 5df37a2

Please sign in to comment.