Merge pull request #111 from Silent-Client/TEST2

Test2
This commit is contained in:
kirillsaint 2024-05-10 12:16:37 +06:00 committed by GitHub
commit d0ec399fe6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 96 additions and 30 deletions

View File

@ -374,6 +374,17 @@ public class Client {
Client.logger.info("STARTING > config-manager-post-init"); Client.logger.info("STARTING > config-manager-post-init");
configManager.postInit(); configManager.postInit();
if(!globalSettings.isResourcePacksFetched()) {
Client.logger.info("STARTING > resource-packs-fetching");
if(Minecraft.getMinecraft().getResourcePackRepository().getDirResourcepacks() != null && Minecraft.getMinecraft().getResourcePackRepository().getDirResourcepacks().listFiles() != null) {
for (File file : Minecraft.getMinecraft().getResourcePackRepository().getDirResourcepacks().listFiles()) {
globalSettings.addToUsedResourcePacks(file.getName());
}
globalSettings.setResourcePacksFetched(true);
globalSettings.save();
}
}
if(!globalSettings.isDisplayedTutorial()) { if(!globalSettings.isDisplayedTutorial()) {
Minecraft.getMinecraft().displayGuiScreen(new UserTutorial()); Minecraft.getMinecraft().displayGuiScreen(new UserTutorial());
} }

View File

@ -26,6 +26,7 @@ import java.awt.*;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -170,6 +171,12 @@ public class SilentResourcePacksGui extends SilentScreen {
{ {
this.mc.fontRendererObj.drawStringWithShadow(list.get(l), x + 5 + 31 + 3, itemY + 3 + 12 + 10 * l, 8421504); this.mc.fontRendererObj.drawStringWithShadow(list.get(l), x + 5 + 31 + 3, itemY + 3 + 12 + 10 * l, 8421504);
} }
if(!Client.getInstance().getGlobalSettings().getUsedResourcePacks().contains(entry.getResourcePackName())) {
RenderUtil.drawRoundedRect(x + 187 - 23, itemY + 35 - 12, 23, 10, 8, new Color(255, 255, 255).getRGB());
ColorUtils.setColor(new Color(0, 0, 0).getRGB());
Client.getInstance().getSilentFontRenderer().drawCenteredString("NEW", (int) x + 187 - 23 + (23 / 2), (int) (itemY + 35 - 12 + 10 - 9), 8, SilentFontRenderer.FontType.HEADER);
ColorUtils.resetColor();
}
} }
itemY += 37; itemY += 37;
} }
@ -256,6 +263,12 @@ public class SilentResourcePacksGui extends SilentScreen {
{ {
this.mc.fontRendererObj.drawStringWithShadow(list.get(l), x + 5 + 31 + 3, itemY + 3 + 12 + 10 * l, 8421504); this.mc.fontRendererObj.drawStringWithShadow(list.get(l), x + 5 + 31 + 3, itemY + 3 + 12 + 10 * l, 8421504);
} }
if(!Client.getInstance().getGlobalSettings().getUsedResourcePacks().contains(entry.getResourcePackName())) {
RenderUtil.drawRoundedRect(x + 187 - 23, itemY + 35 - 12, 23, 10, 8, new Color(255, 255, 255).getRGB());
ColorUtils.setColor(new Color(0, 0, 0).getRGB());
Client.getInstance().getSilentFontRenderer().drawCenteredString("NEW", (int) x + 187 - 23 + (23 / 2), (int) (itemY + 35 - 12 + 10 - 9), 8, SilentFontRenderer.FontType.HEADER);
ColorUtils.resetColor();
}
} }
itemY += 37; itemY += 37;
packIndex++; packIndex++;
@ -329,7 +342,7 @@ public class SilentResourcePacksGui extends SilentScreen {
for (ResourcePackRepository.Entry resourcepackrepository$entry : list) for (ResourcePackRepository.Entry resourcepackrepository$entry : list)
{ {
this.mc.gameSettings.resourcePacks.add(resourcepackrepository$entry.getResourcePackName()); this.mc.gameSettings.resourcePacks.add(resourcepackrepository$entry.getResourcePackName());
Client.getInstance().getGlobalSettings().addToUsedResourcePacks(resourcepackrepository$entry.getResourcePackName());
if (resourcepackrepository$entry.func_183027_f() != 1) if (resourcepackrepository$entry.func_183027_f() != 1)
{ {
this.mc.gameSettings.incompatibleResourcePacks.add(resourcepackrepository$entry.getResourcePackName()); this.mc.gameSettings.incompatibleResourcePacks.add(resourcepackrepository$entry.getResourcePackName());
@ -341,6 +354,7 @@ public class SilentResourcePacksGui extends SilentScreen {
this.initGui(); this.initGui();
this.scrollHelper2.resetScroll(); this.scrollHelper2.resetScroll();
this.scrollHelper.resetScroll(); this.scrollHelper.resetScroll();
Client.getInstance().getGlobalSettings().save();
} }
} }
@ -428,7 +442,19 @@ public class SilentResourcePacksGui extends SilentScreen {
this.selectedResourcePacks.clear(); this.selectedResourcePacks.clear();
} }
ResourcePackRepository.Entry randomPack = this.availableResourcePacks.get(random.nextInt(this.availableResourcePacks.size())); ArrayList<ResourcePackRepository.Entry> newPacks = new ArrayList<>();
for(ResourcePackRepository.Entry entry : this.availableResourcePacks) {
if(!Client.getInstance().getGlobalSettings().getUsedResourcePacks().contains(entry.getResourcePackName())) {
newPacks.add(entry);
}
}
ResourcePackRepository.Entry randomPack;
if(!newPacks.isEmpty()) {
randomPack = newPacks.get(random.nextInt(newPacks.size()));
} else {
randomPack = this.availableResourcePacks.get(random.nextInt(this.availableResourcePacks.size()));
}
if(randomPack != null) { if(randomPack != null) {
this.selectedResourcePacks.add(0, randomPack); this.selectedResourcePacks.add(0, randomPack);

View File

@ -55,12 +55,12 @@ public abstract class PlayerRendererMixin extends RendererLivingEntity<AbstractC
return; return;
} }
if(Minecraft.getMinecraft().thePlayer.getPositionVector().squareDistanceTo(abstractClientPlayer.getPositionVector()) < Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Level Of Detail Distance").getValInt()*Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Level Of Detail Distance").getValInt()) { if(Minecraft.getMinecraft().thePlayer.getPositionVector().squareDistanceTo(abstractClientPlayer.getPositionVector()) < Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Level Of Detail Distance").getValInt()*Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Level Of Detail Distance").getValInt()) {
playerModel.bipedHeadwear.isHidden = playerModel.bipedHeadwear.isHidden || Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "3D Hat").getValBoolean(); playerModel.bipedHeadwear.isHidden = playerModel.bipedHeadwear.isHidden || Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Head").getValBoolean();
playerModel.bipedBodyWear.isHidden = playerModel.bipedBodyWear.isHidden || Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "3D Jacket").getValBoolean(); playerModel.bipedBodyWear.isHidden = playerModel.bipedBodyWear.isHidden || Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Body").getValBoolean();
playerModel.bipedLeftArmwear.isHidden = playerModel.bipedLeftArmwear.isHidden || Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "3D Left Sleeve").getValBoolean(); playerModel.bipedLeftArmwear.isHidden = playerModel.bipedLeftArmwear.isHidden || Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Left Arm").getValBoolean();
playerModel.bipedRightArmwear.isHidden = playerModel.bipedRightArmwear.isHidden || Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "3D Right Sleeve").getValBoolean(); playerModel.bipedRightArmwear.isHidden = playerModel.bipedRightArmwear.isHidden || Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Right Arm").getValBoolean();
playerModel.bipedLeftLegwear.isHidden = playerModel.bipedLeftLegwear.isHidden || Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "3D Left Pants").getValBoolean(); playerModel.bipedLeftLegwear.isHidden = playerModel.bipedLeftLegwear.isHidden || Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Left Leg").getValBoolean();
playerModel.bipedRightLegwear.isHidden = playerModel.bipedRightLegwear.isHidden || Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "3D Right Pants").getValBoolean(); playerModel.bipedRightLegwear.isHidden = playerModel.bipedRightLegwear.isHidden || Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Right Leg").getValBoolean();
} else { } else {
// not correct, but the correct way doesn't work cause 1.8 or whatever // not correct, but the correct way doesn't work cause 1.8 or whatever
if(!abstractClientPlayer.isSpectator()) { if(!abstractClientPlayer.isSpectator()) {

View File

@ -12,23 +12,19 @@ public class SkinsMod extends Mod {
public void setup() { public void setup() {
super.setup(); super.setup();
setNewMod(true); setNewMod(true);
this.addBooleanSetting("3D Hat", this, true);
this.addBooleanSetting("3D Jacket", this, true); this.addBooleanSetting("Fast Render", this, true);
this.addBooleanSetting("3D Left Sleeve", this, true); this.addSliderSetting("Level Of Detail Distance", this, 14, 5, 40, true);
this.addBooleanSetting("3D Right Sleeve", this, true);
this.addBooleanSetting("3D Left Pants", this, true); this.addBooleanSetting("Head", this, true);
this.addBooleanSetting("3D Right Pants", this, true); this.addBooleanSetting("Body", this, true);
this.addBooleanSetting("Left Arm", this, true);
this.addBooleanSetting("Right Arm", this, true);
this.addBooleanSetting("Left Leg", this, true);
this.addBooleanSetting("Right Leg", this, true);
this.addSliderSetting("Voxel Size", this, 1.15F, 1F, 1.4F, false); this.addSliderSetting("Voxel Size", this, 1.15F, 1F, 1.4F, false);
this.addSliderSetting("Head Voxel Size", this, 1.18F, 1F, 1.25F, false); this.addSliderSetting("Head Voxel Size", this, 1.18F, 1F, 1.25F, false);
this.addSliderSetting("Body Voxel Width Size", this, 1.05F, 1F, 1.4F, false); this.addSliderSetting("Body Voxel Width Size", this, 1.05F, 1F, 1.4F, false);
this.addBooleanSetting("3D Skulls", this, true);
this.addBooleanSetting("3D Skull Items", this, true);
this.addSliderSetting("Skull Voxel Size", this, 1.1F, 1F, 1.2F, false);
this.addSliderSetting("Level Of Detail Distance", this, 14, 5, 40, true);
this.addBooleanSetting("Fast Render", this, true);
} }
} }

View File

@ -29,11 +29,11 @@ public class BodyLayerFeatureRenderer
RenderPlayer playerRenderer) { RenderPlayer playerRenderer) {
this.playerRenderer = playerRenderer; this.playerRenderer = playerRenderer;
thinArms = ((PlayerEntityModelAccessor)playerRenderer).client$hasThinArms(); thinArms = ((PlayerEntityModelAccessor)playerRenderer).client$hasThinArms();
bodyLayers.add(new Layer(0, false, EnumPlayerModelParts.LEFT_PANTS_LEG, Shape.LEGS, () -> playerRenderer.getMainModel().bipedLeftLeg, () -> Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "3D Left Pants").getValBoolean())); bodyLayers.add(new Layer(0, false, EnumPlayerModelParts.LEFT_PANTS_LEG, Shape.LEGS, () -> playerRenderer.getMainModel().bipedLeftLeg, () -> Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Left Leg").getValBoolean()));
bodyLayers.add(new Layer(1, false, EnumPlayerModelParts.RIGHT_PANTS_LEG, Shape.LEGS, () -> playerRenderer.getMainModel().bipedRightLeg, () -> Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "3D Right Pants").getValBoolean())); bodyLayers.add(new Layer(1, false, EnumPlayerModelParts.RIGHT_PANTS_LEG, Shape.LEGS, () -> playerRenderer.getMainModel().bipedRightLeg, () -> Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Right Leg").getValBoolean()));
bodyLayers.add(new Layer(2, false, EnumPlayerModelParts.LEFT_SLEEVE, thinArms ? Shape.ARMS_SLIM : Shape.ARMS, () -> playerRenderer.getMainModel().bipedLeftArm, () -> Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "3D Left Sleeve").getValBoolean())); bodyLayers.add(new Layer(2, false, EnumPlayerModelParts.LEFT_SLEEVE, thinArms ? Shape.ARMS_SLIM : Shape.ARMS, () -> playerRenderer.getMainModel().bipedLeftArm, () -> Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Left Arm").getValBoolean()));
bodyLayers.add(new Layer(3, true, EnumPlayerModelParts.RIGHT_SLEEVE, thinArms ? Shape.ARMS_SLIM : Shape.ARMS, () -> playerRenderer.getMainModel().bipedRightArm, () -> Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "3D Right Sleeve").getValBoolean())); bodyLayers.add(new Layer(3, true, EnumPlayerModelParts.RIGHT_SLEEVE, thinArms ? Shape.ARMS_SLIM : Shape.ARMS, () -> playerRenderer.getMainModel().bipedRightArm, () -> Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Right Arm").getValBoolean()));
bodyLayers.add(new Layer(4, false, EnumPlayerModelParts.JACKET, Shape.BODY, () -> playerRenderer.getMainModel().bipedBody, () -> Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "3D Jacket").getValBoolean())); bodyLayers.add(new Layer(4, false, EnumPlayerModelParts.JACKET, Shape.BODY, () -> playerRenderer.getMainModel().bipedBody, () -> Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Body").getValBoolean()));
} }
@Override @Override

View File

@ -32,7 +32,7 @@ public class HeadLayerFeatureRenderer implements LayerRenderer<AbstractClientPla
@Override @Override
public void doRenderLayer(AbstractClientPlayer player, float paramFloat1, float paramFloat2, float paramFloat3, public void doRenderLayer(AbstractClientPlayer player, float paramFloat1, float paramFloat2, float paramFloat3,
float deltaTick, float paramFloat5, float paramFloat6, float paramFloat7) { float deltaTick, float paramFloat5, float paramFloat6, float paramFloat7) {
if (!player.hasSkin() || player.isInvisible() || !Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "3D Hat").getValBoolean()) { if (!player.hasSkin() || player.isInvisible() || !Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Head").getValBoolean()) {
return; return;
} }
if(mc.thePlayer.getPositionVector().squareDistanceTo(player.getPositionVector()) > Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Level Of Detail Distance").getValInt()*Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Level Of Detail Distance").getValInt())return; if(mc.thePlayer.getPositionVector().squareDistanceTo(player.getPositionVector()) > Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Level Of Detail Distance").getValInt()*Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Level Of Detail Distance").getValInt())return;

View File

@ -13,6 +13,7 @@ public class RawInputHandler {
public static Mouse mouse; public static Mouse mouse;
public static int dx = 0; public static int dx = 0;
public static int dy = 0; public static int dy = 0;
public static Thread inputThread;
public static void init() { public static void init() {
controllers = ControllerEnvironment.getDefaultEnvironment().getControllers(); controllers = ControllerEnvironment.getDefaultEnvironment().getControllers();
@ -44,9 +45,11 @@ public class RawInputHandler {
Minecraft.getMinecraft().mouseHelper = new MouseHelper(); Minecraft.getMinecraft().mouseHelper = new MouseHelper();
Minecraft.getMinecraft().mouseHelper.grabMouseCursor(); Minecraft.getMinecraft().mouseHelper.grabMouseCursor();
Minecraft.getMinecraft().mouseHelper.ungrabMouseCursor(); Minecraft.getMinecraft().mouseHelper.ungrabMouseCursor();
inputThread.interrupt();
} else { } else {
Client.logger.info("[SC]: Enabling Raw Mouse Input"); Client.logger.info("[SC]: Enabling Raw Mouse Input");
Minecraft.getMinecraft().mouseHelper = new RawMouseHelper(); Minecraft.getMinecraft().mouseHelper = new RawMouseHelper();
startThread();
Minecraft.getMinecraft().mouseHelper.grabMouseCursor(); Minecraft.getMinecraft().mouseHelper.grabMouseCursor();
Minecraft.getMinecraft().mouseHelper.ungrabMouseCursor(); Minecraft.getMinecraft().mouseHelper.ungrabMouseCursor();
} }
@ -59,8 +62,13 @@ public class RawInputHandler {
} }
public static void startThread() { public static void startThread() {
Thread inputThread = new Thread(() -> { inputThread = new Thread(() -> {
while(true){ while(true){
if (Thread.currentThread().isInterrupted()) {
break;
}
// reload();
// rescan();
if (mouse != null && Minecraft.getMinecraft().currentScreen == null) { if (mouse != null && Minecraft.getMinecraft().currentScreen == null) {
mouse.poll(); mouse.poll();
dx += (int)mouse.getX().getPollData(); dx += (int)mouse.getX().getPollData();
@ -74,7 +82,7 @@ public class RawInputHandler {
try { try {
Thread.sleep(1); Thread.sleep(1);
} catch(InterruptedException e) { } catch(InterruptedException e) {
e.printStackTrace(); Client.logger.catching(e);
} }
} }
}); });

View File

@ -15,6 +15,8 @@ public class GlobalSettings {
public boolean packsPanoramaEnabled; public boolean packsPanoramaEnabled;
public ArrayList<FeaturedServers.FeaturedServerInfo> savedFeaturedServers; public ArrayList<FeaturedServers.FeaturedServerInfo> savedFeaturedServers;
public ArrayList<GlobalSettings.CustomColor> latestColors; public ArrayList<GlobalSettings.CustomColor> latestColors;
public boolean resourcePacksFetched;
public ArrayList<String> usedResourcePacks;
public GlobalSettings() { public GlobalSettings() {
@ -24,6 +26,8 @@ public class GlobalSettings {
this.packsPanoramaEnabled = true; this.packsPanoramaEnabled = true;
this.savedFeaturedServers = new ArrayList<>(); this.savedFeaturedServers = new ArrayList<>();
this.latestColors = new ArrayList<>(); this.latestColors = new ArrayList<>();
this.resourcePacksFetched = false;
this.usedResourcePacks = new ArrayList<>();
} }
public String getConfig() { public String getConfig() {
@ -107,6 +111,27 @@ public class GlobalSettings {
latestColors.add(0, new CustomColor(color)); latestColors.add(0, new CustomColor(color));
} }
public boolean isResourcePacksFetched() {
return resourcePacksFetched;
}
public void setResourcePacksFetched(boolean resourcePacksFetched) {
this.resourcePacksFetched = resourcePacksFetched;
}
public ArrayList<String> getUsedResourcePacks() {
if(usedResourcePacks == null) {
this.usedResourcePacks = new ArrayList<>();
}
return usedResourcePacks;
}
public void addToUsedResourcePacks(String pack) {
if(!this.usedResourcePacks.contains(pack)) {
this.usedResourcePacks.add(pack);
}
}
public void save() { public void save() {
try { try {
FileOutputStream outputStream = new FileOutputStream(Client.getInstance().getGlobalSettingsFile()); FileOutputStream outputStream = new FileOutputStream(Client.getInstance().getGlobalSettingsFile());