Начинающий
- Статус
- Оффлайн
- Регистрация
- 10 Июл 2025
- Сообщения
- 22
- Реакции
- 0
- Выберите загрузчик игры
- Vanilla
- Прочие моды
Максимально рофельная функция написанная чатом лгбт, дикпиком, геймини и чо там обычно для пастинга используют
Создаём CsgoHand.java
Потом идём в FirstPersonRenderer.java и ищём метод renderItemInFirstPerson и заменяем на этот:
ss:
вроде всё
UPD перед одобрением: забыл ассеты
Создаём CsgoHand.java
CsgoHand.java:
package expensive.modules.impl.render;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import expensive.modules.api.Category;
import expensive.modules.api.Function;
import expensive.modules.api.FunctionRegister;
import expensive.modules.api.impl.ModeSetting;
import expensive.modules.api.impl.SliderSetting;
import lombok.Getter;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Vector3f;
import org.lwjgl.opengl.GL11;
@FunctionRegister(name = "CsgoHand", type = Category.Render)
public class CsgoHand extends Function {
@Getter
private static CsgoHand instance;
public final ModeSetting mode = new ModeSetting("Вид", "CSGO", "CSGO", "CSS");
public final SliderSetting scale = new SliderSetting("Размер", 1.5f, 0.1f, 3.0f, 0.05f);
public final SliderSetting x = new SliderSetting("X", 0f, -2.0f, 2.0f, 0.05f);
public final SliderSetting y = new SliderSetting("Y", 0.1f, -2.0f, 2.0f, 0.05f);
public final SliderSetting swingForce = new SliderSetting("Сила удара", 0.15f, 0f, 2.0f, 0.05f);
public CsgoHand() {
instance = this;
addSettings(mode, scale, x, y, swingForce);
}
private ResourceLocation getTexture() {
String current = mode.get();
switch (current) {
case "CSS": return new ResourceLocation("expensive/images/csshand.png");
default: return new ResourceLocation("expensive/images/csgohand.png");
}
}
public void render(MatrixStack matrixStack, float swingProgress) {
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.disableLighting();
RenderSystem.disableDepthTest();
RenderSystem.disableCull();
RenderSystem.disableAlphaTest();
RenderSystem.enableTexture();
RenderSystem.color4f(1f, 1f, 1f, 1f);
mc.getTextureManager().bindTexture(getTexture());
matrixStack.push();
float animation = MathHelper.sin(MathHelper.sqrt(swingProgress) * (float) Math.PI);
float yAnim = animation * -swingForce.get();
matrixStack.translate(x.get(), y.get() + yAnim, -0.6f);
float s = scale.get();
matrixStack.scale(s, s, s);
matrixStack.rotate(Vector3f.ZP.rotationDegrees(180));
matrixStack.rotate(Vector3f.YP.rotationDegrees(180));
Matrix4f matrix = matrixStack.getLast().getMatrix();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
float size = 0.5f;
buffer.pos(matrix, -size, size, 0).tex(0, 1).endVertex();
buffer.pos(matrix, size, size, 0).tex(1, 1).endVertex();
buffer.pos(matrix, size, -size, 0).tex(1, 0).endVertex();
buffer.pos(matrix, -size, -size, 0).tex(0, 0).endVertex();
tessellator.draw();
matrixStack.pop();
RenderSystem.enableLighting();
RenderSystem.enableDepthTest();
RenderSystem.enableCull();
RenderSystem.enableAlphaTest();
}
}
Потом идём в FirstPersonRenderer.java и ищём метод renderItemInFirstPerson и заменяем на этот:
renderItemInFirstPerson:
private void renderItemInFirstPerson(AbstractClientPlayerEntity player, float partialTicks, float pitch, Hand handIn, float swingProgress, ItemStack stack, float equippedProgress, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn) {
if (!Config.isShaders() || !Shaders.isSkipRenderHand(handIn)) {
boolean flag = handIn == Hand.MAIN_HAND;
HandSide handside = flag ? player.getPrimaryHand() : player.getPrimaryHand().opposite();
boolean csgo = CsgoHand.getInstance() != null && CsgoHand.getInstance().isState();
if (csgo) {
if (flag) {
CsgoHand.getInstance().render(matrixStackIn, swingProgress);
}
matrixStackIn.push();
matrixStackIn.translate(0, -50.0, 0);
}
matrixStackIn.push();
if (stack.isEmpty()) {
if (flag && !player.isInvisible()) {
this.renderArmFirstPerson(matrixStackIn, bufferIn, combinedLightIn, equippedProgress, swingProgress, handside);
}
} else if (stack.getItem() instanceof FilledMapItem) {
if (flag && this.itemStackOffHand.isEmpty()) {
this.renderMapFirstPerson(matrixStackIn, bufferIn, combinedLightIn, pitch, equippedProgress, swingProgress);
} else {
this.renderMapFirstPersonSide(matrixStackIn, bufferIn, combinedLightIn, equippedProgress, handside, swingProgress, stack);
}
} else if (stack.getItem() instanceof CrossbowItem) {
boolean flag1 = CrossbowItem.isCharged(stack);
boolean flag2 = handside == HandSide.RIGHT;
int i = flag2 ? 1 : -1;
if (player.isHandActive() && player.getItemInUseCount() > 0 && player.getActiveHand() == handIn) {
this.transformSideFirstPerson(matrixStackIn, handside, equippedProgress);
matrixStackIn.translate((double) ((float) i * -0.4785682F), (double) -0.094387F, (double) 0.05731531F);
matrixStackIn.rotate(Vector3f.XP.rotationDegrees(-11.935F));
matrixStackIn.rotate(Vector3f.YP.rotationDegrees((float) i * 65.3F));
matrixStackIn.rotate(Vector3f.ZP.rotationDegrees((float) i * -9.785F));
float f9 = (float) stack.getUseDuration() - ((float) this.mc.player.getItemInUseCount() - partialTicks + 1.0F);
float f12 = f9 / (float) CrossbowItem.getChargeTime(stack);
if (f12 > 1.0F) {
f12 = 1.0F;
}
if (f12 > 0.1F) {
float f15 = MathHelper.sin((f9 - 0.1F) * 1.3F);
float f3 = f12 - 0.1F;
float f4 = f15 * f3;
matrixStackIn.translate((double) (f4 * 0.0F), (double) (f4 * 0.004F), (double) (f4 * 0.0F));
}
matrixStackIn.translate((double) (f12 * 0.0F), (double) (f12 * 0.0F), (double) (f12 * 0.04F));
matrixStackIn.scale(1.0F, 1.0F, 1.0F + f12 * 0.2F);
matrixStackIn.rotate(Vector3f.YN.rotationDegrees((float) i * 45.0F));
} else {
float f = -0.4F * MathHelper.sin(MathHelper.sqrt(swingProgress) * (float) Math.PI);
float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt(swingProgress) * ((float) Math.PI * 2F));
float f2 = -0.2F * MathHelper.sin(swingProgress * (float) Math.PI);
matrixStackIn.translate((double) ((float) i * f), (double) f1, (double) f2);
this.transformSideFirstPerson(matrixStackIn, handside, equippedProgress);
this.transformFirstPerson(matrixStackIn, handside, swingProgress);
if (flag1 && swingProgress < 0.001F) {
matrixStackIn.translate((double) ((float) i * -0.641864F), 0.0D, 0.0D);
matrixStackIn.rotate(Vector3f.YP.rotationDegrees((float) i * 10.0F));
}
}
this.renderItemSide(player, stack, flag2 ? ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND : ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, !flag2, matrixStackIn, bufferIn, combinedLightIn);
} else {
FunctionRegistry functionRegistry = Expensive.getInstance().getFunctionRegistry();
ViewModel viewModel = functionRegistry.getViewModel();
boolean flag3 = handside == HandSide.RIGHT;
if (viewModel.isState()) {
if (flag3) {
matrixStackIn.translate(viewModel.right_x.get(),
viewModel.right_y.get(), viewModel.right_z.get());
} else {
matrixStackIn.translate(viewModel.left_x.get(),
viewModel.left_y.get(), viewModel.left_z.get());
}
}
if (player.isHandActive() && player.getItemInUseCount() > 0 && player.getActiveHand() == handIn) {
int k = flag3 ? 1 : -1;
switch (stack.getUseAction()) {
case NONE:
this.transformSideFirstPerson(matrixStackIn, handside, equippedProgress);
break;
case EAT:
case DRINK:
this.transformEatFirstPerson(matrixStackIn, partialTicks, handside, stack);
this.transformSideFirstPerson(matrixStackIn, handside, equippedProgress);
break;
case BLOCK:
this.transformSideFirstPerson(matrixStackIn, handside, equippedProgress);
break;
case BOW:
this.transformSideFirstPerson(matrixStackIn, handside, equippedProgress);
matrixStackIn.translate((double) ((float) k * -0.2785682F), (double) 0.18344387F, (double) 0.15731531F);
matrixStackIn.rotate(Vector3f.XP.rotationDegrees(-13.935F));
matrixStackIn.rotate(Vector3f.YP.rotationDegrees((float) k * 35.3F));
matrixStackIn.rotate(Vector3f.ZP.rotationDegrees((float) k * -9.785F));
float f8 = (float) stack.getUseDuration() - ((float) this.mc.player.getItemInUseCount() - partialTicks + 1.0F);
float f11 = f8 / 20.0F;
f11 = (f11 * f11 + f11 * 2.0F) / 3.0F;
if (f11 > 1.0F) {
f11 = 1.0F;
}
if (f11 > 0.1F) {
float f14 = MathHelper.sin((f8 - 0.1F) * 1.3F);
float f17 = f11 - 0.1F;
float f19 = f14 * f17;
matrixStackIn.translate((double) (f19 * 0.0F), (double) (f19 * 0.004F), (double) (f19 * 0.0F));
}
matrixStackIn.translate((double) (f11 * 0.0F), (double) (f11 * 0.0F), (double) (f11 * 0.04F));
matrixStackIn.scale(1.0F, 1.0F, 1.0F + f11 * 0.2F);
matrixStackIn.rotate(Vector3f.YN.rotationDegrees((float) k * 45.0F));
break;
case SPEAR:
this.transformSideFirstPerson(matrixStackIn, handside, equippedProgress);
matrixStackIn.translate((double) ((float) k * -0.5F), (double) 0.7F, (double) 0.1F);
matrixStackIn.rotate(Vector3f.XP.rotationDegrees(-55.0F));
matrixStackIn.rotate(Vector3f.YP.rotationDegrees((float) k * 35.3F));
matrixStackIn.rotate(Vector3f.ZP.rotationDegrees((float) k * -9.785F));
float f13 = (float) stack.getUseDuration() - ((float) this.mc.player.getItemInUseCount() - partialTicks + 1.0F);
float f16 = f13 / 10.0F;
if (f16 > 1.0F) {
f16 = 1.0F;
}
if (f16 > 0.1F) {
float f18 = MathHelper.sin((f13 - 0.1F) * 1.3F);
float f20 = f16 - 0.1F;
float f5 = f18 * f20;
matrixStackIn.translate((double) (f5 * 0.0F), (double) (f5 * 0.004F), (double) (f5 * 0.0F));
}
matrixStackIn.translate(0.0D, 0.0D, (double) (f16 * 0.2F));
matrixStackIn.scale(1.0F, 1.0F, 1.0F + f16 * 0.2F);
matrixStackIn.rotate(Vector3f.YN.rotationDegrees((float) k * 45.0F));
}
} else if (player.isSpinAttacking()) {
this.transformSideFirstPerson(matrixStackIn, handside, equippedProgress);
int j = flag3 ? 1 : -1;
matrixStackIn.translate((double) ((float) j * -0.4F), (double) 0.8F, (double) 0.3F);
matrixStackIn.rotate(Vector3f.YP.rotationDegrees((float) j * 65.0F));
matrixStackIn.rotate(Vector3f.ZP.rotationDegrees((float) j * -85.0F));
} else {
SwingAnimation swingAnimation = functionRegistry.getSwingAnimation();
float f6 = -0.4F * MathHelper.sin(MathHelper.sqrt(swingProgress) * (float) Math.PI);
float f7 = 0.2F * MathHelper.sin(MathHelper.sqrt(swingProgress) * ((float) Math.PI * 2F));
float f10 = -0.2F * MathHelper.sin(swingProgress * (float) Math.PI);
int l = flag3 ? 1 : -1;
if (!swingAnimation.isState())
matrixStackIn.translate((double) ((float) l * f6), (double) f7, (double) f10);
this.transformSideFirstPerson(matrixStackIn, handside, equippedProgress);
if (swingAnimation.isState() && handside == HandSide.RIGHT) {
swingAnimation.animationProcess(matrixStackIn, swingProgress, () -> {
this.transformFirstPerson(matrixStackIn, handside, swingProgress);
});
} else {
this.transformFirstPerson(matrixStackIn, handside, swingProgress);
}
}
this.renderItemSide(player, stack, flag3 ? ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND : ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, !flag3, matrixStackIn, bufferIn, combinedLightIn);
}
matrixStackIn.pop();
if (csgo) {
matrixStackIn.pop();
}
}
}
ss:
вроде всё
UPD перед одобрением: забыл ассеты
Вложения
Последнее редактирование: