no workk
This commit is contained in:
parent
2c5fa4083a
commit
20faa00b5e
File diff suppressed because it is too large
Load Diff
59907
javascript/classes.js
59907
javascript/classes.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -32,7 +32,6 @@ import dev.resent.module.impl.misc.FPSOptions;
|
||||||
import dev.resent.module.impl.misc.Fullbright;
|
import dev.resent.module.impl.misc.Fullbright;
|
||||||
import dev.resent.module.impl.misc.HUD;
|
import dev.resent.module.impl.misc.HUD;
|
||||||
import dev.resent.module.impl.misc.ParticleMultiplier;
|
import dev.resent.module.impl.misc.ParticleMultiplier;
|
||||||
import dev.resent.module.impl.misc.ReachCircle;
|
|
||||||
import dev.resent.module.impl.misc.Scoreboard;
|
import dev.resent.module.impl.misc.Scoreboard;
|
||||||
import dev.resent.module.impl.misc.Sprint;
|
import dev.resent.module.impl.misc.Sprint;
|
||||||
import dev.resent.module.impl.setting.Animations;
|
import dev.resent.module.impl.setting.Animations;
|
||||||
|
@ -83,10 +82,12 @@ public class ModManager {
|
||||||
public static AdminSpawner adminSpawner =new AdminSpawner();
|
public static AdminSpawner adminSpawner =new AdminSpawner();
|
||||||
public static ParticleMultiplier particleMultiplier = new ParticleMultiplier();
|
public static ParticleMultiplier particleMultiplier = new ParticleMultiplier();
|
||||||
public static Hand hand;
|
public static Hand hand;
|
||||||
|
//public static Crosshair crosshair = new Crosshair();
|
||||||
|
|
||||||
public ModManager() {
|
public ModManager() {
|
||||||
|
|
||||||
//Hud
|
//Hud
|
||||||
|
//register(crosshair = new Crosshair());
|
||||||
register(hand = new Hand());
|
register(hand = new Hand());
|
||||||
register(adminSpawner);
|
register(adminSpawner);
|
||||||
register(adminRay);
|
register(adminRay);
|
||||||
|
|
21
src/main/java/dev/resent/module/impl/misc/Crosshair.java
Normal file
21
src/main/java/dev/resent/module/impl/misc/Crosshair.java
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
package dev.resent.module.impl.misc;
|
||||||
|
|
||||||
|
import dev.resent.annotation.Module;
|
||||||
|
import dev.resent.module.base.Mod;
|
||||||
|
import dev.resent.module.base.Mod.Category;
|
||||||
|
import dev.resent.module.base.setting.CustomRectSettingDraw;
|
||||||
|
import dev.resent.visual.crosshair.CrosshairUi;
|
||||||
|
|
||||||
|
@Module(name = "Crosshair", category = Category.MISC, hasSetting = true)
|
||||||
|
public class Crosshair extends Mod{
|
||||||
|
public CustomRectSettingDraw open = new CustomRectSettingDraw("Choose crosshair", "Select which crosshair you want to use"){
|
||||||
|
@Override
|
||||||
|
public void onPress(){
|
||||||
|
mc.displayGuiScreen(new CrosshairUi());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public Crosshair(){
|
||||||
|
addSetting(open);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package dev.resent.visual.crosshair;
|
||||||
|
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.opengl.ImageData;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||||
|
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class CrosshairManager {
|
||||||
|
|
||||||
|
public static ResourceLocation crosshairLocation;
|
||||||
|
|
||||||
|
public static void displayChooser(){
|
||||||
|
EagRuntime.displayFileChooser("image/png", "png");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResourceLocation getCrosshairLocation(){
|
||||||
|
return crosshairLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void free(){
|
||||||
|
Minecraft.getMinecraft().getTextureManager().deleteTexture(crosshairLocation);
|
||||||
|
crosshairLocation = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void write(byte[] texture) {
|
||||||
|
EagRuntime.setStorage("crosshair", texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] read(){
|
||||||
|
if(EagRuntime.getStorage("crosshair") != null){
|
||||||
|
return EagRuntime.getStorage("crosshair");
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void forceLoad(byte[] texture){
|
||||||
|
try{
|
||||||
|
ImageData loadedCrosshair = ImageData.loadImageFile(texture);
|
||||||
|
if(loadedCrosshair != null){
|
||||||
|
CrosshairManager.crosshairLocation = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("uploadedcrosshair", new DynamicTexture(loadedCrosshair));
|
||||||
|
Minecraft.getMinecraft().displayGuiScreen(null);
|
||||||
|
//Minecraft.getMinecraft().getTextureManager().bindTexture(CrosshairManager.crosshairLocation);
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
System.out.println(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean shouldRender(AbstractClientPlayer player){
|
||||||
|
if(player == Minecraft.getMinecraft().thePlayer){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
55
src/main/java/dev/resent/visual/crosshair/CrosshairUi.java
Normal file
55
src/main/java/dev/resent/visual/crosshair/CrosshairUi.java
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
package dev.resent.visual.crosshair;
|
||||||
|
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.Keyboard;
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.internal.FileChooserResult;
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.opengl.ImageData;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||||
|
|
||||||
|
public class CrosshairUi extends GuiScreen {
|
||||||
|
|
||||||
|
public void initGui() {
|
||||||
|
buttonList.add(new GuiButton(200, width / 2 - 100, height / 6 + 128, "Close"));
|
||||||
|
buttonList.add(new GuiButton(1, width / 2 - 100, height / 6 + 150, "Choose crosshair"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onGuiClosed() {
|
||||||
|
Keyboard.enableRepeatEvents(false);
|
||||||
|
mc.gameSettings.saveOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawScreen(int mx, int my, float par3) {
|
||||||
|
super.drawScreen(mx, my, par3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateScreen(){
|
||||||
|
if (EagRuntime.fileChooserHasResult()) {
|
||||||
|
CrosshairManager.free();
|
||||||
|
FileChooserResult result = EagRuntime.getFileChooserResult();
|
||||||
|
if (result != null) {
|
||||||
|
ImageData loadedCrosshair = ImageData.loadImageFile(result.fileData);
|
||||||
|
if(loadedCrosshair != null){
|
||||||
|
for(int i = 0; 1 > i; i++){
|
||||||
|
CrosshairManager.write(result.fileData);
|
||||||
|
}
|
||||||
|
CrosshairManager.crosshairLocation = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("uploadedcrosshair", new DynamicTexture(loadedCrosshair));
|
||||||
|
Minecraft.getMinecraft().displayGuiScreen(null);
|
||||||
|
//Minecraft.getMinecraft().getTextureManager().bindTexture(CrosshairManager.crosshairLocation);
|
||||||
|
} else {
|
||||||
|
EagRuntime.showPopup("The selected file '" + result.fileName + "' is not an image file!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||||
|
if (par1GuiButton.id == 200) {
|
||||||
|
mc.displayGuiScreen(null);
|
||||||
|
}else if(par1GuiButton.id == 1){
|
||||||
|
CrosshairManager.displayChooser();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,6 +16,7 @@ import com.google.common.collect.Lists;
|
||||||
import dev.resent.client.Resent;
|
import dev.resent.client.Resent;
|
||||||
import dev.resent.module.base.RenderMod;
|
import dev.resent.module.base.RenderMod;
|
||||||
import dev.resent.util.misc.W;
|
import dev.resent.util.misc.W;
|
||||||
|
import dev.resent.visual.crosshair.CrosshairManager;
|
||||||
import dev.resent.visual.ui.animation.SimpleAnimation;
|
import dev.resent.visual.ui.animation.SimpleAnimation;
|
||||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
||||||
import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
|
import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
|
||||||
|
@ -316,7 +317,13 @@ public class GuiIngame extends Gui {
|
||||||
public void renderGameOverlayCrosshairs(int scaledResWidth, int scaledResHeight) {
|
public void renderGameOverlayCrosshairs(int scaledResWidth, int scaledResHeight) {
|
||||||
if (this.showCrosshair()) {
|
if (this.showCrosshair()) {
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
this.mc.getTextureManager().bindTexture(icons);
|
|
||||||
|
if(CrosshairManager.crosshairLocation == null){
|
||||||
|
if(CrosshairManager.read() != null)
|
||||||
|
CrosshairManager.forceLoad(CrosshairManager.read());
|
||||||
|
this.mc.getTextureManager().bindTexture(icons);
|
||||||
|
}
|
||||||
|
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
GlStateManager.tryBlendFuncSeparate(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR, 1, 0);
|
GlStateManager.tryBlendFuncSeparate(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR, 1, 0);
|
||||||
GlStateManager.enableAlpha();
|
GlStateManager.enableAlpha();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user