Jump to content

SecondAmendment

Members
  • Posts

    81
  • Joined

  • Last visited

Posts posted by SecondAmendment

  1. Well, it works doesnt it? I always say "If it aint broke dont fix it" unless there is a more efficient way of doing it. Code can sometimes be tedious but every time you think you are having a rough time, think of the people who had to map out google maps. That took ages.

  2. The end position returns coords that are way off. and not the position of the entity the player is looking at based on the block position. In fact it doesnt detect the EntityHit at all.

  3. Is there a way I can get a severside raytrace of a player's line of sight to another entityHit? I know that objectMouseOver() is clientside only so, I dont know what to substitute for that.

     

    here's a solution I tried using the following that I found on another forum, however it doesnt work.

    Vec3d look = player.getLookVec();[/p]
    float f = 200.0F; // distance factor[/p]
    Vec3d start = new Vec3(player.posX, player.posY + player.getEyeHeight(), player.posZ);
    Entity entityhit = player.worldObj.rayTraceBlocks(startpos, endpos, false, true, true).entityHit;

     

  4. I was wondering if there was a way that I could ovvsride a server mod that I made with an optional client side mod that I made to interact with it.

     

    In other words I made a serverside only version of my mod as well as a common (server and client) sidd version for my client. I want to make it so that any player can join despite not having the mod installed which I was able to do with @Mod but now my problem is I was people with the client and only with the client to be able to oveeride soms of the serverside suff.

     

    For example: Client types /dirt on a block he looks at using a forge mod. Server then turns the block into dirt. However other people without the mod could still see the resulting change due to the fact that a dirt block is part of minecraft and requires no sidemods for that change to be observer.

     

    I hope what I am trying to do makes sense.

  5. weird, cant think of why that is. Is it because my mod relies on a dependency and there is a red exclamation mark on my project folder? Because the mod it relies on or expands upon, is in there and the client does load it up. I see it in the debug.

  6. package com.vivabenfica4ps3.gmail.commands;
    
    import net.minecraft.client.Minecraft;
    import net.minecraft.command.CommandBase;
    import net.minecraft.command.CommandException;
    import net.minecraft.command.ICommandSender;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.server.MinecraftServer;
    import net.minecraft.util.text.ITextComponent;
    import net.minecraft.util.text.TextComponentString;
    
    public class PMCommands extends CommandBase{
    
    	@Override
    	public int getRequiredPermissionLevel() {
            return 0;
        }
    	
    	@Override
        public boolean checkPermission(MinecraftServer server, ICommandSender sender)
        {
            return sender.canCommandSenderUseCommand(this.getRequiredPermissionLevel(), this.getCommandName());
        }
    	
    	@Override
    	public String getCommandName() {
    		return "pkgive";
    	}
    
    	@Override
    	public String getCommandUsage(ICommandSender sender) {
    		return "commands.pkgive.usage";
    	}
    
    	@Override
    	public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    		System.out.println("True");
    		Minecraft.getMinecraft().thePlayer.addChatMessage(new TextComponentString("true"));
    		Minecraft.getMinecraft().thePlayer.addChatMessage(new TextComponentString(args.toString()));
    	    if (args[0].equalsIgnoreCase(("pkgive"))) {
    			ItemStack item = new ItemStack(Item.getByNameOrId("pixelmon:" + args[1]));
    			Minecraft.getMinecraft().thePlayer.inventory.addItemStackToInventory(item);
    	    }
    	}
    }

     

     

    Exactly what im typing in (even if what is written in execute has an issue. It would still printout true to the player and the console.):

    http://prntscr.com/eodu1n

  7. So what could be causing it to still not work? could it be the permissions? Is the name of my command supposed to be written somewhere else other than in the command's class itself?

     

    Im typing in /<Command Name>  <Argument>

  8.  

    package com.vivabenfica4ps3.gmail.commands;
    
    import net.minecraft.client.Minecraft;
    import net.minecraft.command.CommandBase;
    import net.minecraft.command.CommandException;
    import net.minecraft.command.ICommandSender;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.server.MinecraftServer;
    import net.minecraft.util.text.ITextComponent;
    import net.minecraft.util.text.TextComponentString;
    
    public class PMCommands extends CommandBase{
    
    	@Override
    	public int getRequiredPermissionLevel() {
            return 0;
        }
    	
    	@Override
        public boolean checkPermission(MinecraftServer server, ICommandSender sender)
        {
            return sender.canCommandSenderUseCommand(this.getRequiredPermissionLevel(), this.getCommandName());
        }
    	
    	@Override
    	public String getCommandName() {
    		return null;
    	}
    
    	@Override
    	public String getCommandUsage(ICommandSender sender) {
    		return null;
    	}
    
    	@Override
    	public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    		System.out.println("True");
    		Minecraft.getMinecraft().thePlayer.addChatMessage(new TextComponentString("true"));
    		Minecraft.getMinecraft().thePlayer.addChatMessage(new TextComponentString(args.toString()));
    	}
    
    }

     

  9. Ive searched and searched, but I just cant figure out why my clientside command isnt getting registered. I have my main class and my command class. My command class extends CommandBase and implements all methods of the abstract class. Those methods being getRequiredPermissionLevel(), checkPermission(), getCommandName(), getCommandUsage(), and of course the main on I care about execute(). However my command isnt getting registered at all and I know this because i just added a simple output to the log saying "True" if a command gets executed by the player, however nothing shows up.

    This is my Main class (well at least the part that counts):
     

    	@EventHandler
    	public void preInit(FMLPreInitializationEvent event)
    	{
    		FMLCommonHandler.instance().bus().register(this);
    		MinecraftForge.EVENT_BUS.register(this);
    		ClientCommandHandler.instance.registerCommand(new PMCommands());
    	}
    
    	@EventHandler
    	public void init(FMLInitializationEvent event)
    	{
    			
    	}
    
    	@EventHandler
    	public void postInit(FMLPostInitializationEvent event)
    	{
    
    	}

     

     

    My question is am I registering the command correctly through the ClientCommandHandler?

×
×
  • Create New...

Important Information

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