Résolu Anti-Xray = Xray ?
-
Bonjour, j’ai un anti textures packs xray :
package com.adamitemod.mod.proxy; import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; public class GuiIllegalResourcePack extends GuiScreen { public void initGui() { this.buttonList.clear(); this.buttonList.add(new GuiButton(0, this.width / 2 - 50, this.height - 20, 100, 20, I18n.format("gui.back", new Object[0]))); } protected void actionPerformed(GuiButton guibutton) { if (guibutton.id == 0) { this.mc.displayGuiScreen(new GuiMainMenu()); } } public void drawScreen(int mouseX, int mouseY, float partialRenderTick) { drawDefaultBackground(); List <string>strings = this.fontRendererObj.listFormattedStringToWidth(I18n.format("Les textures packs Xray ne sont pas autorisee", new Object[0]), this.width - 80); for (int i = 0; i < strings.size(); i++) { drawCenteredString(this.fontRendererObj, (String)strings.get(i), this.width / 2, this.height / 2 - 50 + i * 11, 16777215); } super.drawScreen(mouseX, mouseY, partialRenderTick); } }
package com.adamitemod.mod.proxy; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.common.gameevent.TickEvent.Phase; import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.io.IOException; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.texture.ITextureObject; import net.minecraft.client.renderer.texture.SimpleTexture; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureUtil; import net.minecraft.util.ResourceLocation; @SideOnly(Side.CLIENT) public class ClientEventHandlerAntiXray { private Minecraft mc; private int cheatTimer; private int timer = 1; public ClientEventHandlerAntiXray(Minecraft mc) { this.mc = mc; } @SubscribeEvent public void onRenderTick(TickEvent.RenderTickEvent event) { if (event.phase == TickEvent.Phase.START) { checkTexture(); } } private void checkTexture() { if (this.cheatTimer <= 0) { if ((hasIllegalTexture()) && (this.mc.theWorld != null)) { this.mc.theWorld.sendQuittingDisconnectingPacket(); this.mc.loadWorld((WorldClient)null); this.mc.displayGuiScreen(new GuiIllegalResourcePack()); } this.cheatTimer = (this.timer * 20); } else { this.cheatTimer -= 1; } } public static boolean hasIllegalTexture() { ResourceLocation r = new ResourceLocation("minecraft:textures/blocks/stone.png"); ITextureObject textureObject = Minecraft.getMinecraft().getTextureManager().getTexture(r); if (textureObject == null) { textureObject = new SimpleTexture(r); Minecraft.getMinecraft().getTextureManager().loadTexture(r, textureObject); } int id = textureObject.getGlTextureId(); try { int[] textureData = TextureUtil.readImageData(Minecraft.getMinecraft().getResourceManager(), r); for (int color : textureData) { int alpha = color >> 24 & 0xFF; if (alpha != 255) { return true; } } } catch (IOException e) { e.printStackTrace(); } return false; } }
le truc c’est que l’ont peux toujours xray en mettant un contour de n’import quelle couleurs et de laisser le millieu des blocks transparent . . .
comment patcher sa ?</string>
-
Ton code vérifies tous les pixel du bloc, donc ça devrait prendre en compte même les bords.
En passant ton titre n’a pas de sens.
-
bah j’arrive quand meme a mettre un xray . . .
-
Fais du debug pour voir d’où vient le problème