ElTotisPro50
Members-
Posts
266 -
Joined
-
Last visited
-
Days Won
1
Everything posted by ElTotisPro50
-
this is exactly the code from lucraft core, @SubscribeEvent public static void onRenderWorld(RenderWorldLastEvent e) { if (Minecraft.getMinecraft().player == null) return; EntityPlayer player = Minecraft.getMinecraft().player; for (AbilityHeatVision ab : Ability.getAbilitiesFromClass(Ability.getAbilities(player), AbilityHeatVision.class)) { if (ab != null && ab.isUnlocked() && ab.isEnabled() && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0) { double distance = player.getPositionVector().add(0, player.getEyeHeight(), 0).distanceTo(Minecraft.getMinecraft().objectMouseOver.hitVec); LCRenderHelper.setupRenderLightning(); GlStateManager.translate(0, player.getEyeHeight(), 0); GlStateManager.rotate(-player.rotationYaw, 0, 1, 0); GlStateManager.rotate(player.rotationPitch, 1, 0, 0); { Vec3d start = new Vec3d(0.1F, 0, 0); Vec3d end = start.add(0, 0, distance); LCRenderHelper.drawGlowingLine(start, end, 0.5F, ab.getDataManager().get(COLOR)); } { Vec3d start = new Vec3d(-0.1F, 0, 0); Vec3d end = start.add(0, 0, distance); LCRenderHelper.drawGlowingLine(start, end, 0.5F, ab.getDataManager().get(COLOR)); } LCRenderHelper.finishRenderLightning(); return; } } } @SubscribeEvent public static void onRenderWorld(RenderWorldLastEvent e) { if (Minecraft.getMinecraft().player == null) return; EntityPlayer player = Minecraft.getMinecraft().player; double distance = player.getPositionVector().add(0, player.getEyeHeight(),0).distanceTo(Minecraft.getMinecraft().objectMouseOver.hitVec); TotisRenderHelper.setupRenderLightning(); GlStateManager.translate(0, player.getEyeHeight(), 0); GlStateManager.rotate(-player.rotationYaw, 0, 1, 0); GlStateManager.rotate(player.rotationPitch, 1, 0, 0); { Vec3d start = new Vec3d(0.1F, 0, 0); Vec3d end = start.add(0, 0, distance); TotisRenderHelper.drawGlowingLine(start, end, 0.5F, ab.getDataManager().get(COLOR)); } { Vec3d start = new Vec3d(-0.1F, 0, 0); Vec3d end = start.add(0, 0, distance); LCRenderHelper.drawGlowingLine(start, end, 0.5F, ab.getDataManager().get(COLOR)); } TotisRenderHelper.finishRenderLightning(); return; } } } then why mine is not working correctly
-
but in lucraft core thats exactly how the creator made it
-
in the class ModEvents in the event called onRenderWorld i have to delete these 3? GlStateManager.translatef(0, player.getEyeHeight(), 0); GlStateManager.rotatef(-player.rotationYaw, 0, 1, 0); GlStateManager.rotatef(player.rotationPitch, 1, 0, 0); GlStateManager.translatef(0, player.getEyeHeight(), 0); GlStateManager.rotatef(-player.rotationYaw, 0, 1, 0); GlStateManager.rotatef(player.rotationPitch, 1, 0, 0);
-
so i checked the source code of lucraft core and there is a power called heat vision and i tried to copy the code for draw a glowing line, it worked but is not working 100% correctly(this is how it "works" but bad: https://imgur.com/a/Xl55iBZ), this is the code with all the clases i created ModEvents class(here i detect if i press my key)[PD: in lucraft core there is a thing from Minecraft called bipedHead.postRender but in 1.16 they removed it and i cant find a replace so i used bipedHead.rotationPointY = event.getScale(); because is the most similar] @SubscribeEvent public static void onRenderWorld(RenderWorldLastEvent event) { if(Minecraft.getInstance().player == null) return; PlayerEntity player = Minecraft.getInstance().player; if(ModKeys.gKey.isKeyDown()) { double distance = player.getPositionVec().add(0,player.getEyeHeight(),0).distanceTo(Minecraft.getInstance().objectMouseOver.getHitVec()); TotisRenderHelper.setupRenderLightning(); GlStateManager.translatef(0, player.getEyeHeight(), 0); GlStateManager.rotatef(-player.rotationYaw, 0, 1, 0); GlStateManager.rotatef(player.rotationPitch, 1, 0, 0); { Vector3d start = new Vector3d(0.1F, 0, 0); Vector3d end = start.add(0, 0, distance); TotisRenderHelper.drawGlowingLine(start,end,0.5F, Color.RED); } { Vector3d start = new Vector3d(-0.1F, 0, 0); Vector3d end = start.add(0,0, distance); TotisRenderHelper.drawGlowingLine(start,end,0.5F, Color.RED); } TotisRenderHelper.finishRenderLightning(); return; } } @SubscribeEvent public static void onRenderLayer(RenderTotisLayerEvent event) { if(Minecraft.getInstance().player == null) return; PlayerEntity player = Minecraft.getInstance().player; if(ModKeys.gKey.isKeyDown()) { double distance = player.getPositionVec().add(0,player.getEyeHeight(),0).distanceTo(Minecraft.getInstance().objectMouseOver.getHitVec()); TotisRenderHelper.setupRenderLightning(); event.getPlayerRenderer().getEntityModel().bipedHead.rotationPointY = event.getScale(); { Vector3d start = new Vector3d(0.1F, -4F * 1, 0); Vector3d end = start.add(0, -4F * 5, -distance); TotisRenderHelper.drawGlowingLine(start,end,0.5F, Color.RED); } { Vector3d start = new Vector3d(-0.1F, -4F * 1, 0); Vector3d end = start.add(0, -4F * 5, -distance); TotisRenderHelper.drawGlowingLine(start,end,0.5F, Color.RED); } TotisRenderHelper.finishRenderLightning(); return; } } TotisRenderHelper class(in lucraft core source code is called LCRenderHelper) @Mod.EventBusSubscriber(modid = TotisMod.MOD_ID) public class TotisRenderHelper { public static Minecraft mc = Minecraft.getInstance(); public static float renderTick; public static void drawGlowingLine(Vector3d start, Vector3d end, float thickness, Color color) { drawGlowingLine(start, end, thickness, color,1F); } public static void setupRenderLightning() { GlStateManager.pushMatrix(); GlStateManager.disableTexture(); GlStateManager.disableLighting(); GlStateManager.disableCull(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_DST_ALPHA); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.003921569F);; } public static void finishRenderLightning() { GlStateManager.enableLighting(); GlStateManager.enableTexture(); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); GlStateManager.disableBlend(); GlStateManager.popMatrix(); } public static void drawGlowingLine(Vector3d start, Vector3d end, float thickness, Color color, float alpha) { if(start == null || end == null) return; Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bb = tessellator.getBuffer(); int smoothFactor = Minecraft.getInstance().gameSettings.ambientOcclusionStatus.ordinal(); int layers = 10 + smoothFactor * 20; GlStateManager.pushMatrix(); start = start.scale(-1D); end = end.scale(-1D); GlStateManager.translated(-start.x,-start.y,-start.z); start = end.subtract(start); end = end.subtract(end); { double x = end.x - start.x; double y = end.y - start.y; double z = end.z - start.z; double diff = MathHelper.sqrt(x * x + z * z); float yaw = (float) (Math.atan2(z, x) * 180.0D / 3.141592653589793D) - 90.0F; float pitch = (float) -(Math.atan2(y, diff) * 180.0D / 3.141592653589793D); GlStateManager.rotatef(-yaw, 0.0F, 1.0F, 0.0F); GlStateManager.rotatef(pitch, 1.0F, 0.0F, 0.0F); } for (int layer = 0; layer <= layers; ++layer) { if(layer < layers) { GlStateManager.color4f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 1.0F / layers / 2); GlStateManager.depthMask(false); } else { GlStateManager.color4f(1.0F, 1.0F, 1.0F, alpha); GlStateManager.depthMask(true); } double size = thickness + (layer < layers ? layer * (1.25D / layers) : 0.0D); double d = (layer < layers ? 1.0D - layer * (1.0D / layers) : 0.0D) * 0.1D; double width = 0.0625D * size; double height = 0.0625D * size; double length = start.distanceTo(end) + d; bb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); bb.pos(-width, height, length).endVertex(); bb.pos(width, height, length).endVertex(); bb.pos(width, height, -d).endVertex(); bb.pos(-width, height, -d).endVertex(); bb.pos(width, -height, -d).endVertex(); bb.pos(width, -height, length).endVertex(); bb.pos(-width, -height, length).endVertex(); bb.pos(-width, -height, -d).endVertex(); bb.pos(-width, -height, -d).endVertex(); bb.pos(-width, -height, length).endVertex(); bb.pos(-width, height, length).endVertex(); bb.pos(-width, height, -d).endVertex(); bb.pos(width, height, length).endVertex(); bb.pos(width, -height, length).endVertex(); bb.pos(width, -height, -d).endVertex(); bb.pos(width, height, -d).endVertex(); bb.pos(width, -height, length).endVertex(); bb.pos(width, height, length).endVertex(); bb.pos(-width, height, length).endVertex(); bb.pos(-width, -height, length).endVertex(); bb.pos(width, -height, -d).endVertex(); bb.pos(width, height, -d).endVertex(); bb.pos(-width, height, -d).endVertex(); bb.pos(-width, -height, -d).endVertex(); tessellator.draw(); } GlStateManager.popMatrix(); } } RenderTotisLayerEvent class public class RenderTotisLayerEvent extends Event { private PlayerEntity player; private PlayerRenderer PlayerRenderer; private float limbSwing; private float limbSwingAmount; private float partialTicks; private float ageInTicks; private float netHeadYaw; private float headPitch; private float scale; private MatrixStack stack; private IRenderTypeBuffer buffers; public RenderTotisLayerEvent(PlayerEntity player, PlayerRenderer PlayerRenderer, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale, MatrixStack stack, IRenderTypeBuffer buffers) { this.player = player; this.PlayerRenderer = PlayerRenderer; this.limbSwing = limbSwing; this.limbSwingAmount = limbSwingAmount; this.partialTicks = partialTicks; this.ageInTicks = ageInTicks; this.netHeadYaw = netHeadYaw; this.headPitch = headPitch; this.scale = scale; this.stack = stack; this.buffers = buffers; } public PlayerEntity getPlayer() { return player; } public PlayerRenderer getPlayerRenderer() { return PlayerRenderer; } public MatrixStack getMatrixStack() { return stack; } public IRenderTypeBuffer getBuffers() { return buffers; } public float getLimbSwing() { return limbSwing; } public float getLimbSwingAmount() { return limbSwingAmount; } public float getPartialTicks() { return partialTicks; } public float getAgeInTicks() { return ageInTicks; } public float getNetHeadYaw() { return netHeadYaw; } public float getHeadPitch() { return headPitch; } public float getScale() { return scale; } }
-
(1.16.5 MCP) open java GUI from minecraft
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
some mods like XRAY mod use java GUIS in minecraft, so really i cant open guis? -
i know is a bit dump but cant i open for example JOptionPanel from a item right click? @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { String name = JOptionPane.showInputDialog("Enter the desired name: "); return super.onItemRightClick(worldIn, playerIn, handIn); }
-
so once i created my tileentity with its screen and container i made a block that opens it @Override public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { if(!worldIn.isRemote()) { TileEntity tileEntity = worldIn.getTileEntity(pos); if(!player.isCrouching()) { if(tileEntity instanceof MyTileEntity) { INamedContainerProvider containerProvider = createContainerProvider(worldIn, pos); NetworkHooks.openGui(((ServerPlayerEntity)player), containerProvider, tileEntity.getPos()); } else { throw new IllegalStateException("The Container provider is missing!"); } } } return ActionResultType.SUCCESS; } private INamedContainerProvider createContainerProvider(World worldIn, BlockPos pos) { return new INamedContainerProvider() { @Override public ITextComponent getDisplayName() { return new TranslationTextComponent("screen.totismod.my_tile_screen"); } @Nullable @Override public Container createMenu(int i, PlayerInventory playerInventory, PlayerEntity playerEntity) { return new MyContainer(i, worldIn, pos, playerInventory, playerEntity); } }; } @Nullable @Override public TileEntity createTileEntity(BlockState state, IBlockReader world) { return ModTileEntities.MY_TILE.get().create(); } @Override public boolean hasTileEntity(BlockState state) { return true; } so how do i convert this for when i right click my item it opens the same gui i made this but is not working: @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { TileEntity tileEntity = worldIn.getTileEntity(playerIn.getPosition()); if(!worldIn.isRemote) { INamedContainerProvider containerProvider = createContainerProvider(worldIn, playerIn.getPosition()); NetworkHooks.openGui(((ServerPlayerEntity)playerIn),containerProvider,tileEntity.getPos()); } return super.onItemRightClick(worldIn, playerIn, handIn); } private INamedContainerProvider createContainerProvider(World worldIn, BlockPos pos) { return new INamedContainerProvider() { @Override public ITextComponent getDisplayName() { return new TranslationTextComponent("screen.totismod.washing_machine"); } @Nullable @Override public Container createMenu(int i, PlayerInventory playerInventory, PlayerEntity playerEntity) { return new WashingContainer(i, worldIn, pos, playerInventory, playerEntity); } }; }
-
(1.16.5 MPC Mappings)g et the name of my item
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
ok i used ITextComponent test = stack.getTextComponent(); and im using System.out.print, im not putting it in a command or in player.sendStatusMessage, and is still printing random things about the item TranslatableComponent{key='chat.square_brackets', args=[TextComponent{text='', siblings=[TranslatableComponent{key='item.totismod.ruby', args=[], siblings=[], style=Style{ color=null, bold=null, italic=null, underlined=null, strikethrough=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null, font=minecraft:default}}], style=Style{ color=null, bold=null, italic=null, underlined=null, strikethrough=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null, font=minecraft:default}}], siblings=[], style=Style{ color=white, bold=null, italic=null, underlined=null, strikethrough=null, obfuscated=null, clickEvent=null, hoverEvent=HoverEvent{action=<action show_item>, value='net.minecraft.util.text.event.HoverEvent$ItemHover@83a89074'}, insertion=null, font=minecraft:default}} -
(1.16.5 MPC Mappings)g et the name of my item
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
@diesieben07 and @Luis_ST, luis i want to make this ITextComponent test = stack.getTextComponent(); Commands command = new Commands(Commands.EnvironmentType.ALL); command.handleCommand(playerIn.getCommandSource(),"kill @e[name=" + test + "]"); diesieben, im not calling .toString or converting to string but is the same is printing item.ruby.item and things like hoverover,obfuscated etc (i know commands in code are not too good for this but i dont care what i care is how to get the name of my item(even if i change it with a anvil)) -
(1.16.5 MPC Mappings)g et the name of my item
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
so @diesieben07your idea didnt work, ITextComponent test = stack.getTextComponent(); String test2 = test.toString(); playerIn.sendStatusMessage(new StringTextComponent(test2),false); and @Luis_ST your idea didnt work either(if i use item.getDisplayName() i cant call .getName after it, i tried to use directly ItemStack but .getName doesnt exist in ItemStack) Item item = stack.getItem(); String test = item.getName().toString(); playerIn.sendStatusMessage(new StringTextComponent(test),false); String test = item.getDisplayName().getName();//cant call .getName -
so i made this code for my item and i thought that it was going to print "Ruby that is the name i used in lang" but is not doing it, public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { CommandSource source = playerIn.getCommandSource(); BlockPos pos = playerIn.getPosition(); ItemStack stack = playerIn.getHeldItemMainhand(); float number = 10 ^ 5; if(!worldIn.isRemote) { String ene2 = stack.getItem().getDisplayName(stack); System.out.println(ene2); } return new ActionResult<ItemStack>(ActionResultType.SUCCESS,stack); } Is printing: item.totismod.rubyTranslatableComponent{key='item.totismod.ruby', args=[], siblings=[], style=Style{ color=null, bold=null, italic=null, underlined=null, strikethrough=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null, font=minecraft:default}} and i want to get the name of the current item tha is Ruby, even if i change its name with a anvil the name that the string changes to to the new name
-
Hi, it worked, so i used my command to make a gui with a textfield and a button and get the variable of the textfield and kill all the entities with that name, so i could imagine a way to kill so i wanted the /kill @e[name=textfield.getText()], but is not working(if i use something like sendStatusMessage to the player it works and the command is working but not in here) public class ResearcherScreen extends ContainerScreen<ResearcherContainer> { private final ResourceLocation GUI = new ResourceLocation(TotisMod.MOD_ID, "textures/gui/researcher_gui.png"); public static TextFieldWidget nameField; public ResearcherScreen(ResearcherContainer screenContainer, PlayerInventory inv, ITextComponent titleIn) { super(screenContainer, inv, titleIn); } @Override public void tick() { super.tick(); this.nameField.tick(); } @Override public void init(Minecraft minecraft, int width, int height) { super.init(minecraft, width, height); this.minecraft.keyboardListener.enableRepeatEvents(true); buttons.clear(); this.addButton(new Button(66,60,103,20,new StringTextComponent("hola"),this::actionPerformed)); this.nameField = new TextFieldWidget(this.font, 62,24,103,12,new StringTextComponent("hola")); this.nameField.setCanLoseFocus(false); this.nameField.setTextColor(-1); this.nameField.setDisabledTextColour(-1); this.nameField.setEnableBackgroundDrawing(false); this.nameField.setMaxStringLength(35); this.children.add(this.nameField); this.setFocusedDefault(this.nameField); } @Override public void onClose() { super.onClose(); this.minecraft.keyboardListener.enableRepeatEvents(false); } public boolean keyPressed(int keyCode, int scanCode, int modifiers) { if (keyCode == 256) { this.minecraft.player.closeScreen(); } return !this.nameField.keyPressed(keyCode, scanCode, modifiers) && !this.nameField.canWrite() ? super.keyPressed(keyCode, scanCode, modifiers) : true; } //HERE IS THE PROBLEM public void actionPerformed(Button button) { PlayerEntity player = Minecraft.getInstance().player; World world = Minecraft.getInstance().player.world; String pl1 = this.nameField.getText(); if(!world.isRemote) { Commands command = new Commands(Commands.EnvironmentType.ALL); command.handleCommand(player.getCommandSource(),"kill @e[name=" + pl1 + "]"); String el = "" + command.handleCommand(player.getCommandSource(),"kill @e[name=" + pl1 + "]"); System.out.print(el); } } private void drawItemStack(ItemStack stack, int x, int y, float scale) { GL11.glPushMatrix(); GL11.glScalef(scale, scale, scale); GlStateManager.translatef(0, 0, 32.0F); this.itemRenderer.zLevel = 200.0F; net.minecraft.client.gui.FontRenderer font = null; if (!stack.isEmpty()) font = stack.getItem().getFontRenderer(stack); if (font == null) font = font; this.itemRenderer.renderItemAndEffectIntoGUI(stack, x, y); this.itemRenderer.renderItemOverlayIntoGUI(font, stack, x, y, null); this.itemRenderer.zLevel = 0.0F; GL11.glPopMatrix(); } @Override public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { this.renderBackground(matrixStack); super.render(matrixStack, mouseX, mouseY, partialTicks); this.nameField.render(matrixStack, mouseX, mouseY, partialTicks); drawItemStack(new ItemStack(Items.APPLE),60,60,50f); this.renderHoveredTooltip(matrixStack, mouseX, mouseY); } @Override protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int x, int y) { RenderSystem.color4f(1f, 1f, 1f, 1f); this.minecraft.getTextureManager().bindTexture(GUI); int i = this.guiLeft; int j = this.guiTop; this.blit(matrixStack, i, j, 0, 0, this.xSize, this.ySize); drawItemStack(new ItemStack(Items.APPLE),60,60,50f); } } is not doing anything or giving errors, is not printing anything either
-
there is no a performCommand(i used Commands class as you said), im in 1.16.5;
-
killing entities was a example dude, why you dont want me to execute a commandm is like if you tell me why i use kill command in game for deleting entities when i have lava...
-
Decompile java classes without field_ and func_
ElTotisPro50 replied to ElTotisPro50's topic in ForgeGradle
so no site where i can translate them to readable? -
Decompile java classes without field_ and func_
ElTotisPro50 replied to ElTotisPro50's topic in ForgeGradle
is there a internet page where i can find what func_ and field_ means one by one, like a translation for them?, literally thats the only thing i need -
Decompile java classes without field_ and func_
ElTotisPro50 replied to ElTotisPro50's topic in ForgeGradle
i dont want the source code of my project or minecraft or forge, i want to deobfuscate a separated .class file of other mod for example: InventedMod InventedBlock.class inventedBlockContainer.class ETC -
well just tell me how, i need to execute a command
-
i meant that how can i execute a command(just tell me exactly how to do it im not asking help for you to create my mod please)
-
i have an item and if i right click i want to execute a command(from the code) for example /kill @a, i thinked this was going to work but nope, with !world.isRemote is not doing anything and without !world.isRemote minecraft crashes @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { ItemStack stack = playerIn.getHeldItemMainhand(); if(!worldIn.isRemote)//do nothing { Minecraft.getInstance().player.getServer().getCommandManager().handleCommand(playerIn.getCommandSource(),"/kill @e"); } //crashes Minecraft.getInstance().player.getServer().getCommandManager().handleCommand(playerIn.getCommandSource(),"/kill @e"); return blahblahblah; }
-
Decompile java classes without field_ and func_
ElTotisPro50 replied to ElTotisPro50's topic in ForgeGradle
im in minecraft 1.16.5 and using Intellij Idea Community, do you mean i can open a .class file(that is not mine) in mi IDLE?(if i can, how) -
Decompile java classes without field_ and func_
ElTotisPro50 replied to ElTotisPro50's topic in ForgeGradle
sorry for misundersanding, i mean deobfuscate(which means to make readable the func and field things) a .class file -
Decompile java classes without field_ and func_
ElTotisPro50 replied to ElTotisPro50's topic in ForgeGradle
well im creating a mod with some similar features to other mods, and i want to read the code(im not copying the mod and reupload it i promise) because i like testing with modding and minecraft and with other mods -
so i installed java decompiler gui but because minecraft has custom fields and things is showing them and func_ and field_ are not readable, i watched a tutorial but is too old(is using bearded octo nemesis but i cant download it), is there another way to deobfuscate the func_numbers and field_numbers?
-
well then tell me, as i can see with my eyes is asking for Entity, im passing Entity Incompatible types. Found: 'java.util.stream.Stream<net.minecraft.entity.Entity>', required: 'net.minecraft.entity.Entity' How is founding java,util.stream.Stream, im importing import net.minecraft.entity.Entity; maybe is a dumb error but i have no clue of why is this(im finishing java but this error is related to minecraft i think)