Jump to content

ElTotisPro50

Members
  • Posts

    266
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by ElTotisPro50

  1. I got this from a superheroes mod, but i dont know what i have to use public class LayerRendererSpeedsterHeroes implements LayerRenderer<EntityPlayer> { public RenderLivingBase<?> renderer; public static Minecraft mc = Minecraft.getMinecraft(); public LayerRendererSpeedsterHeroes(RenderLivingBase<?> renderer) { this.renderer = renderer; } @Override public void doRenderLayer(EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { ItemStack tachyon = ItemStack.EMPTY; if (!player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty() && player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).getItem() instanceof IUpgradableArmor && (LucraftCoreUtil.hasArmorThisUpgrade(player.getItemStackFromSlot(EntityEquipmentSlot.CHEST), SHItems.tachyonPrototype) || LucraftCoreUtil.hasArmorThisUpgrade(player.getItemStackFromSlot(EntityEquipmentSlot.CHEST), SHItems.tachyonDevice))) tachyon = SpeedsterHeroesUtil.getTachyonDeviceFromArmor(player.getItemStackFromSlot(EntityEquipmentSlot.CHEST)); else if (!player.getCapability(LucraftCore.EXTENDED_INVENTORY, null).getInventory().getStackInSlot(ExtendedPlayerInventory.SLOT_MANTLE).isEmpty() && player.getCapability(LucraftCore.EXTENDED_INVENTORY, null).getInventory().getStackInSlot(ExtendedPlayerInventory.SLOT_MANTLE).getItem() instanceof ItemTachyonDevice) tachyon = player.getCapability(LucraftCore.EXTENDED_INVENTORY, null).getInventory().getStackInSlot(ExtendedPlayerInventory.SLOT_MANTLE); if (!tachyon.isEmpty()) { TachyonDeviceType tachyonType = ((ItemTachyonDevice) tachyon.getItem()).getTachyonDeviceType(); if(tachyonType.getModel() == null) return; GlStateManager.pushMatrix(); if (player.isSneaking()) { GlStateManager.translate(0, 0.18F, 0); // GlStateManager.rotate(30, 1, 0, 0); } ((ModelBiped) renderer.getMainModel()).bipedBody.postRender(0.0625F); tachyonType.doModelTranslations(player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale); Minecraft.getMinecraft().renderEngine.bindTexture(tachyonType.getTexture()); tachyonType.getModel().render(null, 0, 0, 0, 0, 0, 0.0625F); SpeedforcePlayerHandler data = SuperpowerHandler.getSpecificSuperpowerPlayerHandler(player, SpeedforcePlayerHandler.class); if (data != null && data.isInSpeed && SpeedsterHeroesUtil.getSpeedLevelList(player).get(data.speedLevel - 1) instanceof SpeedLevelBarTachyonDevice) { Tessellator tes = Tessellator.getInstance(); VertexBuffer buf = tes.getBuffer(); GL11.glDisable(3553); GL11.glDisable(2896); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.blendFunc(770, 1); if (tachyonType == TachyonDeviceType.PROTOTYPE) { GlStateManager.translate(0, 0, -0.1F); LCRenderHelper.setLightmapTextureCoords(240, 240); buf.begin(GL11.GL_POLYGON, DefaultVertexFormats.POSITION_COLOR); float alpha = ((MathHelper.sin((mc.player.ticksExisted + partialTicks) / 10F) + 1) / 4F) + 0.2F; buf.pos(-0.5F, 0F, 0).color(1, 0.5F, 0, alpha).endVertex(); buf.pos(-0.5F, -0.25F, 0).color(0, 0, 0, 0).endVertex(); buf.pos(-0.25F, -0.45F, 0).color(0, 0, 0, 0).endVertex(); buf.pos(0F, -0.45F, 0).color(0, 0, 0, 0).endVertex(); buf.pos(0.25F, -0.45F, 0).color(0, 0, 0, 0).endVertex(); buf.pos(0.5F, -0.25F, 0).color(0, 0, 0, 0).endVertex(); buf.pos(0.5F, 0F, 0).color(1, 0.5F, 0, alpha).endVertex(); buf.pos(0.5F, 0.25F, 0).color(0, 0, 0, 0).endVertex(); buf.pos(0.25F, 0.45F, 0).color(0, 0, 0, 0).endVertex(); buf.pos(-0.25F, 0.45F, 0).color(0, 0, 0, 0).endVertex(); buf.pos(-0.5F, 0.25F, 0).color(0, 0, 0, 0).endVertex(); tes.draw(); LCRenderHelper.restoreLightmapTextureCoords(); } else if (tachyonType == TachyonDeviceType.DEVICE) { // GlStateManager.translate(0, 0, -0.1F); LCRenderHelper.setLightmapTextureCoords(240, 240); buf.begin(GL11.GL_POLYGON, DefaultVertexFormats.POSITION_COLOR); float alpha = ((MathHelper.sin((mc.player.ticksExisted + partialTicks) / 10F) + 1) / 6F) + 0.2F; buf.pos(-0.7F, 0F, 0).color(0.047F, 0.71F, 1, alpha).endVertex(); buf.pos(-0.6F, -0.25F, 0).color(0, 0, 0, 0).endVertex(); buf.pos(-0.35F, -0.6F, 0).color(0, 0, 0, 0).endVertex(); buf.pos(0F, -0.65F, 0).color(0, 0, 0, 0).endVertex(); buf.pos(0.35F, -0.6F, 0).color(0, 0, 0, 0).endVertex(); buf.pos(0.6F, -0.25F, 0).color(0, 0, 0, 0).endVertex(); buf.pos(0.7F, 0F, 0).color(0, 0, 0, 0).endVertex(); buf.pos(0.6F, 0.25F, 0).color(0, 0, 0, 0).endVertex(); buf.pos(0.35F, 0.6F, 0).color(0, 0, 0, 0).endVertex(); buf.pos(-0F, 0.65F, 0).color(0, 0, 0, 0).endVertex(); buf.pos(-0.35F, 0.6F, 0).color(0, 0, 0, 0).endVertex(); buf.pos(-0.6F, 0.25F, 0).color(0, 0, 0, 0).endVertex(); tes.draw(); LCRenderHelper.restoreLightmapTextureCoords(); } GL11.glEnable(2896); GL11.glEnable(3553); GlStateManager.disableBlend(); } GlStateManager.popMatrix(); } if (player == mc.player) return; if (!SuperpowerHandler.hasSuperpower(mc.player) || SuperpowerHandler.getSuperpower(mc.player) != SpeedsterHeroes.speedforce) return; AbilitySpeedforceVision speedforceVision = Ability.getAbilityFromClass(Ability.getCurrentPlayerAbilities(mc.player), AbilitySpeedforceVision.class); if (speedforceVision == null || !speedforceVision.isUnlocked() || !speedforceVision.isEnabled()) return; if (!SuperpowerHandler.hasSuperpower(player) || SuperpowerHandler.getSuperpower(player) != SpeedsterHeroes.speedforce) return; SpeedforcePlayerHandler data1 = SuperpowerHandler.getSpecificSuperpowerPlayerHandler(player, SpeedforcePlayerHandler.class); SpeedforcePlayerHandler data2 = SuperpowerHandler.getSpecificSuperpowerPlayerHandler(mc.player, SpeedforcePlayerHandler.class); if (!data1.isInSpeed || !data2.isInSpeed) return; GlStateManager.pushMatrix(); GlStateManager.disableLighting(); GlStateManager.disableTexture2D(); GlStateManager.disableDepth(); GlStateManager.enableBlend(); GlStateManager.color(1.0F, 0.0F, 0.0F, 0.5F); GlStateManager.blendFunc(770, 771); this.renderer.getMainModel().render(player, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); GlStateManager.blendFunc(771, 770); GlStateManager.disableBlend(); GlStateManager.enableDepth(); GlStateManager.enableTexture2D(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); } @Override public boolean shouldCombineTextures() { return false; } }
  2. what i just told/wrote you, what i do with render.addLayer, and where do i put my flickering effect
  3. i made this but then?: Map<String, PlayerRenderer> skinMap = Minecraft.getInstance().getRenderManager().getSkinMap(); PlayerRenderer render; render = skinMap.get("default"); render.addLayer(); //need something
  4. i dont know how to use the solution u gave me(dont hit me please haha), cant i solution it with RenderPlaterEvent.Post?
  5. and the problem for flickering?(the chest duplicate)
  6. yea but how i draw the eyes :b, and also i "solutioned" the flickering effect by rendering the body, but it duplicates the body ( https://imgur.com/a/9gBxXqR @SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Post event) { PlayerEntity player = event.getPlayer(); PlayerModel<AbstractClientPlayerEntity> model = event.getRenderer().getEntityModel(); ModelRenderer themodel = model.bipedBody;; for(int i = 0; i < 10; i++) { GlStateManager.pushMatrix(); GlStateManager.translatef((rand.nextFloat() - 0.5f) / 15,0,(rand.nextFloat() - 0.5f) / 15); GlStateManager.color4f(1,1,1,0.3F); GlStateManager.enableBlend(); Minecraft.getInstance().getRenderManager().textureManager.bindTexture(((AbstractClientPlayerEntity)player).getLocationSkin()); themodel.render( event.getMatrixStack(), event.getBuffers().getBuffer(RenderType.getEntitySolid(((AbstractClientPlayerEntity)player).getLocationSkin())), Minecraft.getInstance().getRenderManager().getPackedLight(player, 1f), OverlayTexture.NO_OVERLAY); GlStateManager.disableBlend(); GlStateManager.popMatrix(); } } )
  7. how can i render effects, overlays, etc in the player model; for example draw eyes(is a texture) in the player face or make some effects with GLStateManager.translate,color,etc i know that i have to use RenderPlayerEvent Pre and Post, but i tried to do a random effect(flickering the player skin) but is FLICKERING THE ENTIRE GAME AND IM INVISIBLE, i wrote that the flick is not too much but still, even the mobs are invisible, the gui flicks a bit, that happens if i put pushMatrix() in .Pre and popMatrix in .Post @SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Pre event) { PlayerEntity player = event.getPlayer(); GlStateManager.pushMatrix(); } @SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Post event) { PlayerEntity player = event.getPlayer(); PlayerModel<AbstractClientPlayerEntity> model = event.getRenderer().getEntityModel(); for(int i = 0; i < 10; i++) { GlStateManager.translatef((rand.nextFloat() - 0.5f) / 15,0,(rand.nextFloat() - 0.5f) / 15); GlStateManager.color4f(1,1,1,0.3F); GlStateManager.enableBlend(); Minecraft.getInstance().getRenderManager().textureManager.bindTexture(((AbstractClientPlayerEntity)player).getLocationSkin()); GlStateManager.disableBlend(); GlStateManager.popMatrix(); } } but if i put pushmatrix in .Post is not working @SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Pre event) { PlayerEntity player = event.getPlayer(); } @SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Post event) { PlayerEntity player = event.getPlayer(); PlayerModel<AbstractClientPlayerEntity> model = event.getRenderer().getEntityModel(); for(int i = 0; i < 10; i++) { GlStateManager.pushMatrix(); GlStateManager.translatef((rand.nextFloat() - 0.5f) / 15,0,(rand.nextFloat() - 0.5f) / 15); GlStateManager.color4f(1,1,1,0.3F); GlStateManager.enableBlend(); Minecraft.getInstance().getRenderManager().textureManager.bindTexture(((AbstractClientPlayerEntity)player).getLocationSkin()); GlStateManager.disableBlend(); GlStateManager.popMatrix(); } }
  8. so i made a particle but when i enter in the world it crashes (yes i did register the ModParticles class in Main class) lightning_particle.json file { "textures": [ "modid:lightning_particle" ] } ModParticles class: public class ModParticles { public static final DeferredRegister<ParticleType<?>> PARTICLES = DeferredRegister.create(ForgeRegistries.PARTICLE_TYPES, Main.MOD_ID); public static final RegistryObject<BasicParticleType> LIGHTNING_PARTICLE = PARTICLES.register("lightning_particle", () -> new BasicParticleType(true)); } LightningParticle class: @OnlyIn(Dist.CLIENT) public class LightningParticle extends SpriteTexturedParticle { protected LightningParticle(ClientWorld world, double xCoord, double yCoord, double zCoord, double motionX, double motionY, double motionZ) { super(world, xCoord, yCoord, zCoord, motionX, motionY, motionZ); float f = this.rand.nextFloat() * 1.0f; this.particleRed = f; this.particleGreen = f; this.particleBlue = f; this.setSize(0.1F,0.1F); this.particleScale *= this.rand.nextFloat() * 1.1F; this.motionX *= (double) 0.02f; this.motionY *= (double) 0.02f; this.motionZ *= (double) 0.02f; this.maxAge = (int)(20.0D / (Math.random() * 1.0D)); } @Override public IParticleRenderType getRenderType() { return IParticleRenderType.PARTICLE_SHEET_OPAQUE; } @Override public void tick() { this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; if(this.maxAge-- <= 0) { this.setExpired(); } else { this.move(this.motionX, this.motionY, this.motionZ); } } @OnlyIn(Dist.CLIENT) public static class Factory implements IParticleFactory<BasicParticleType> { private final IAnimatedSprite sprite; public Factory(IAnimatedSprite sprite) { this.sprite = sprite; } @Override public Particle makeParticle(BasicParticleType typeIn, ClientWorld worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { LightningParticle myParticle = new LightningParticle(worldIn,x,y,z,xSpeed,ySpeed,zSpeed); myParticle.setColor(1.0f,1.0f,1.0f); myParticle.selectSpriteRandomly(sprite); return myParticle; } } } ParticleEvent class: @Mod.EventBusSubscriber(modid = Main.MOD_ID) public class ParticleEvent { @SubscribeEvent(priority = EventPriority.LOWEST) public static void registerParticles(ParticleFactoryRegisterEvent event) { Minecraft.getInstance().particles.registerFactory(ModParticles.LIGHTNING_PARTICLE.get(), LightningParticle.Factory::new); } }
  9. SO I WAS RIGHT ALL THE TIME, but thats what i did (except adding sendPlayerAbilities() but it didnt work either) @SubscribeEvent public static void test(LivingEvent.LivingUpdateEvent event) { if(Minecraft.getInstance().player == null) //for not having the null pointer exception error return; PlayerEntity player = Minecraft.getInstance().player; player.noClip = true; player.sendPlayerAbilities(); }
  10. if using packets are not neccesary because im not using keybinds and is not working what i have to do?
  11. (luis told me that it should work) so?, what i have to do?
  12. i did it and it still not working if(event.phase == TickEvent.Phase.END) { if(event.side.isServer()) { player.noClip = true; player.sendPlayerAbilities(); } }
  13. SubscribeEvent public static void tickEvent(TickEvent.PlayerTickEvent event) { PlayerEntity player = event.player; World world = player.world; if(event.phase == TickEvent.Phase.END) { if(event.side.isServer()) //i used isClient() too and it didnt work either { player.sendPlayerAbilities(); player.noClip = true; } } im not using anymore keybind and it still DOESNT WORK, you said i need the package for keybinds but if im not using keybinds why is not working?
  14. You said that i use this: https://imgur.com/a/RpGsSLy , but you are making your "packet" different : https://imgur.com/a/M9M5sH4 , i dont understand why i need this or WHAT I HAVE TO PUT IN ANYWHERE ON THE PACKET CLASS just explain me what i have to do with the packages
  15. please write the code for sending the package i dont even understand what is that for or where do i apply it
  16. do i REALLY REALLY REALLY need to send the package to the server? i never saw a tutorial or something about sending packages and in the page you wrote it sends a message
  17. @SubscribeEvent public static void tickEvent(TickEvent.PlayerTickEvent event) { PlayerEntity player = event.player; World world = player.world; if(event.phase == TickEvent.Phase.END) { if(event.side.isServer() && ModKeys.mykey.isKeyDown()) { //This player.noClip = true; player.sendPlayerAbilities(); //Non of them work(in the code i dont duplicate them im just showing that i used the 2 combinations) //Or this player.sendPlayerAbilities(); player.noClip = true; } } }
  18. writing noclip and then sendPlayerAbilities didnt work either
  19. nope, not throwing errors or crashing it just doesnt to anything (i wrote sendPlayerAbilities() before noclip because i guess is like that) and also my key is working correctly the problem is not my key if(event.phase == TickEvent.Phase.END) { f(event.side.isServer() && ModKeys.mykey.isKeyDown()) { player.sendPlayerAbilities(); player.noClip = true; } }
  20. there is no player#onUpdateAbilities and what do you mean with tick event phase and logical side? like this? if(event.phase == TickEvent.Phase.END) { if(event.side.isServer() && ModKeys.abilityTransformKey.isKeyDown()) { player.noClip = true; } }
  21. nope it didnt work (i did it in server side and in tickevent @SubscribeEvent public static void tickEvent(TickEvent.PlayerTickEvent event) { PlayerEntity player = event.player; World world = player.world; if(!world.isRemote && ModKeys.mykey.isKeyDown()) { player.noClip = true; } )
  22. no, im not getting the player from Minecraft class, but i did in some other events i made, why is it bad?
  23. https://forums.minecraftforge.net/topic/75228-1143-no-clip-through-blocks/ it says that it only works in LivingUpdateEvent but is like this? if(Minecraft.getInstance().player == null) //This is because it crashes the game of an null error return; if(!world.isRemote) { PlayerEntity player = Minecraft.getInstance().player; if(ModKeys.mykey.isKeyDown()) { player.noClip = true; } }
  24. i made an event and when i press a key it it supposed to put true noclip (im using a LivingUpdateEvent because mojang programmed it like that), but is not working, this is an example: when you have hacks and enter in a server, if you activate noclip usually it doesnt work because the server has an anticheat, and instead of letting you go through the block it sends you a bit back VIDEO[when the screen shakes a little bit is because i activated the noclip]( https://imgur.com/a/LATKmV4 ) @SubscribeEvent public static void testevent(LivingEvent.LivingUpdateEvent event) { if(Minecraft.getInstance().player == null) //This is because it crashes the game of an null error return; PlayerEntity player = Minecraft.getInstance().player; if(ModKeys.mykey.isKeyDown()) { player.noClip = true; } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.