Anti Xray Mod
-
Bonjour, bonsoir, je voudrai que dans mon mod 1.7.10 , il détecte les pack Xray, je l’ai fait sauf que sa n’a pas l’air de marcher.
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.
Je cherche une explication et le réglés pour enfin dormir en paix :beaming_face_with_smiling_eyes:class ClientEventHandlerAntiXray :
package fr.nemaria.mods.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; } }
class ClientProxy :
package fr.nemaria.mods.proxy; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.text.ParseException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import fr.nemaria.mods.Nemaria; import fr.nemaria.mods.Neat.HealthBarRenderer; import fr.nemaria.mods.Neat.NeatConfig; import fr.nemaria.mods.block.ModBlock; import fr.nemaria.mods.block.future.entity.EntityArmourStand; import fr.nemaria.mods.block.future.entity.EntityPlacedEndCrystal; import fr.nemaria.mods.block.future.entity.EntityRabbit; import fr.nemaria.mods.block.future.entity.TileEntityEndRod; import fr.nemaria.mods.block.future.model.ArmourStandRenderer; import fr.nemaria.mods.block.future.model.BlockChorusFlowerRender; import fr.nemaria.mods.block.future.model.BlockChorusPlantRender; import fr.nemaria.mods.block.future.model.PlacedEndCrystalRenderer; import fr.nemaria.mods.block.future.model.RabbitRenderer; import fr.nemaria.mods.block.future.model.TileEntityEndRodRenderer; import fr.nemaria.mods.commands.CommandHideBoss; import fr.nemaria.mods.cps.ClickCounterRenderer; import fr.nemaria.mods.cps.ClickListener; import fr.nemaria.mods.cps.CommandSettings; import fr.nemaria.mods.event.EventHandlers; import fr.nemaria.mods.items.ModItems; import fr.nemaria.mods.items.ecplosif.entity.EntityDynamite; import fr.nemaria.mods.items.ecplosif.entity.EntityGrenade; import fr.nemaria.mods.items.ecplosif.render.RenderDynamite; import fr.nemaria.mods.menu.GuiNemaria; import fr.nemaria.mods.overlay.OverlayMessage; import fr.nemaria.mods.overlay.OverlayMessageBoss; import fr.nemaria.mods.overlay.OverleyChestFinder; import fr.nemaria.mods.particules.ParticlesHandler; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.settings.KeyBinding; import net.minecraft.command.ICommand; import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.common.MinecraftForge; public class ClientProxy extends CommonProxy { public void registerOverlay() { MinecraftForge.EVENT_BUS.register(new OverleyChestFinder()); MinecraftForge.EVENT_BUS.register(new OverlayMessage()); MinecraftForge.EVENT_BUS.register(new OverlayMessageBoss()); } public void registerClientCommand() { ClientCommandHandler.instance.registerCommand(new CommandHideBoss()); } private void registerEvents() { MinecraftForge.EVENT_BUS.register(new EventHandlers()); FMLCommonHandler.instance().bus().register(new EventHandlers()); FMLCommonHandler.instance().bus().register(new ClientEventHandlerAntiXray(Minecraft.getMinecraft())); } public void registerBlockRender() { } public void registerRenderThings() { RenderingRegistry.registerEntityRenderingHandler(EntityGrenade.class, (Render)new RenderSnowball(ModItems.Grenade)); RenderingRegistry.registerEntityRenderingHandler(EntityDynamite.class, (Render)new RenderSnowball(ModItems.Dynamite)); } }