Jump to content

jordsta95

Members
  • Posts

    169
  • Joined

  • Last visited

Posts posted by jordsta95

  1. Simple question, how do you create a blockstate based on a registry name. 

     

    What I essentially want to do is to be able to pass regName as a parameter, and have said block be created above the current block.

    BlockPos pos = getPos();
    String regName = "minecraft:stone";
    world.setBlockState(new BlockPos(pos.getX(), (pos.getY() + 1), pos.getZ()), regName);

    However, I understand that the second parameter is an instance of IBlockState, but I'm a little lost as to how I can create this using the registry name of a block, which I can then pass in as the variable.

     

    Thanks,
    Jordan

  2. Load from outside the jar, in the mymod folder.

    And the reason for that is because I have a few items which are there for modpack developers which can be fully customized, apart from the textures (at the minute) and it would be great if they could just replace those textures/add their own in there (so either replace texture.png with the image they want, or put image.png in the folder, and put that filename in the config file to replace the default)

  3. Hey there,

    Someone has asked me to make a small thing for them, which seems easy enough to do, when I get home. I was just wondering if it would be following to do something like this (without having any coding stuff infront of me to be able to check the spelling, etc.)

     

    public void onNeighborBlockChange(World world, int posX, int posY, int posZ, Block neighbourBlock){
    if(world.getBlock(posX, posY+1, posZ) == Blocks.stone){
    setBlock(posX, posY+1, posZ, world.getBlock(poxX, posY-1, posZ));
    }
    }
    

     

    Just in case this is wrong, what I am looking for is:

    If a play places stone on top of this block, it will replace the stone, with the block that is below it (essentially copying the block)

  4. The potion will be a custom potion I add, yes.

     

    And I already have the code:

      List<EntityPlayer> list = SpellHelper.getPlayersInRange(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 15, 15);
    //                for (EntityPlayer player : list)
    //                {
    //                    PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration);
    //                    if (regenEffect != null && regenEffect.getAmplifier() > 0)
    //                    {
    //                    	if(AlchemicalWizardry.causeHungerChatMessage && !player.isPotionActive(Potion.hunger.id))
    //                    	{
    //                        	player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.altar.hunger")));
    //                    	}
    //                        player.addPotionEffect(new PotionEffect(Potion.hunger.id, 40, regenEffect.getAmplifier() * 2 - 2));
    //                    }
    //                }
    

    (Ignore that it is commented out)

    That is what (used to be) there, and I want to replicate what I am doing, but instead of causing hunger it will fill the altar, slowly.

     

    I already know how I will do this bit though. I just need to know how to "inject" my bit of code into the class file for the Blood Altar (which is a tile entity).

     

    i.e. Blood Altar's tile entity file, which is where this code goes, will load with my bit of code added in.

  5. Alright, so this is in the client proxy:

     

    @Override

        public void postInit(FMLPostInitializationEvent event){

            super.postInit(event);

          Main.versionChecker = new CheckVersion();

          Thread versionCheckThread = new Thread(Main.versionChecker, "Version Check");

          versionCheckThread.start();

        }

     

     

        @SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)

    public void onEvent(PlayerTickEvent event1)

    {

     

        if (!Main.haveWarnedVersionOutOfDate && event1.player.worldObj.isRemote

              && !Main.versionChecker.isLatestVersion())

        {

            ClickEvent versionCheckChatClickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL,

                  "http://jabelarminecraft.blogspot.com");

            ChatStyle clickableChatStyle = new ChatStyle().setChatClickEvent(versionCheckChatClickEvent);

            ChatComponentText versionWarningChatComponent =

                  new ChatComponentText("Your Magic Beans Mod is not latest version!  Click here to update.");

            versionWarningChatComponent.setChatStyle(clickableChatStyle);

            event1.player.addChatMessage(versionWarningChatComponent);

            Main.haveWarnedVersionOutOfDate = true;

        }

    }

     

    However, it still doesn't notify (it gets the version number "4" from the URL, and I have the version number set to 3, to test.) So it should notify now, but it doesn't :/

  6. Okay, you're not using the proxies properly. Here's what you need to do.

     

    Create methods for the pre-init, init and post-init in the common proxy. So your common proxy should look like this:

     

     

    public class CommonProxy {

       

        public void preInit(FMLPreInitializationEvent event){

            //Config

            config = new Configuration(event.getSuggestedConfigurationFile());

            logger = event.getModLog();

            MinecraftForge.EVENT_BUS.register(this);

            ConfigFile.INSTANCE.syncConfig();

        }

       

        public void init(FMLInitializationEvent event){

            //Recipes

            recipeRegist.Register();

        }

       

        public void postInit(FMLPostInitializationEvent event){

            //Thaumcraft Shit

            if(Loader.isModLoaded("Thaumcraft")){

                thaumRegist.Register(event);

            }

        }

    }

     

     

    Then in your Main class, you should just call the proxy method for each of these events, like this:

     

     

        @EventHandler

        public void preInit(FMLPreInitializationEvent event){

            proxy.preInit(event);

        }

       

        @EventHandler

        public void init(FMLInitializationEvent event){

            proxy.init(event);

        }

       

        @EventHandler

        public void postInit(FMLPostInitializationEvent event){

            proxy.postInit(event);

        }

     

     

     

    Then your client proxy should @Override any of these methods where you need to do something additional on client side by calling super method then do anything special for client side, like this:

     

     

    public class ClientProxy extends CommonProxy {

       

        @Override

        public void postInit(FMLPostInitializationEvent event){

            super.postInit(event);

        Main.versionChecker = new CheckVersion();

        Thread versionCheckThread = new Thread(Main.versionChecker, "Version Check");

        versionCheckThread.start();

        }

    }

     

     

     

    Note also that you should only have the @EventHandler annotation on the methods in the Main class. Then those methods simply call the methods in the proxy. Make sense?

     

    It is important to get a good understanding of this in order to do effective modding.

     

    I did as you said here, everything still works as it did before... and that includes the update checker not working... It prints to the Log, but not in game

  7. The only log stuff I get that contains anything to do with versions and my mod is:

     

     

    [17:46:50] [Client thread/TRACE] [arcanearteries/arcanearteries]: Sending event FMLConstructionEvent to mod arcanearteries

    [17:46:50] [Client thread/TRACE] [FML/arcanearteries]: Mod arcanearteries is using network checker : Accepting version 3

    [17:46:50] [Client thread/TRACE] [FML/arcanearteries]: Testing mod arcanearteries to verify it accepts its own version in a remote connection

    [17:46:50] [Client thread/TRACE] [FML/arcanearteries]: The mod arcanearteries accepts its own version (3)

    [17:46:50] [Client thread/DEBUG] [FML/arcanearteries]: Attempting to inject @SidedProxy classes into arcanearteries

     

     

     

    And that is obviously not it.

     

    So, I added:

    public void run(){

    System.out.println("Client Proxy Loaded");

    }

    To the client proxy, just as a test. But it doesn't print anything... So I would assume it is that, however, I don't know what it wouldn't get called.

     

    As I have the same proxy calling thing as I have seen in dozens of other places:

    @SidedProxy(clientSide = Reference.CLIENT_PROXY, serverSide = Reference.COMMON_PROXY)

    public static CommonProxy proxy;

    with the correct folder structure in Reference for them:

    public static final String CLIENT_PROXY = "com.aa.mod.proxies.ClientProxy";

    public static final String COMMON_PROXY = "com.aa.mod.proxies.CommonProxy";

     

    I have never had to use the client proxy before, so I never knew about this not working. But I don't get why it doesn't work.

  8. Here's the only things I have in the main class that talk about proxies:

    @Mod(modid = Reference.MODID, version = Reference.VERSION)
    public class Main {
    
    @SidedProxy(clientSide = Reference.CLIENT_PROXY, serverSide = Reference.COMMON_PROXY)
    public static CommonProxy proxy;
    
    public static Configuration config;
    public static Logger logger;
    @Mod.Instance(Reference.MODID)
    public static Main instance;
    
    public static CheckVersion versionChecker;
    public static boolean haveWarnedVersionOutOfDate = false;
    

     

    As for it not working...

    No console message, no message when you log in; not working As for getting the version number, I can only assume it finds that, as that seemed pretty simple.

     

     

    And RealMcrafter, I tried it in the Init, not PostInit, just to see if that was the issue. I tried it there, and it didn't work.

  9. Is the Init method in ClientProxy called?

     

    Is that not what the "public static CheckVersion versionChecker;" does?

    As I said, I followed the example I linked to the tee, and it never mentioned anything about calling the Init, or anything.

     

    I will admit, that tutorial was pretty crap at explaining what everything does and how it works, which is why I came here. Because it doesn't work, and there is no troubleshooting, or reasons why it may not work.

  10. Hey there, I had a look at Botania and COFHcore's version checker, and didn't really understand it, but then I found this http://jabelarminecraft.blogspot.co.uk/p/minecraft-forge-1721710-making-mod.html

     

    However, I followed that tutorial, and I still can't get it to work. Any ideas why?

     

    Here's the code:

     

    version checker class:

     

     

    package com.aa.mod.updateChecker;
    
    import java.io.IOException;
    import java.io.InputStream;
    import java.net.MalformedURLException;
    import java.net.URL;
    
    import org.apache.commons.io.IOUtils;
    
    import com.aa.mod.Reference;
    
    public class CheckVersion implements Runnable
    {
        private static boolean isLatestVersion = false;
        private static String latestVersion = "";
    
        @Override
        public void run() 
        {
            InputStream in = null;
            try 
            {
                in = new URL("https://raw.githubusercontent.com/jordsta95/ArcaneArteries/master/aaversion.txt").openStream();
            } 
            catch 
            (MalformedURLException e) 
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } 
            catch (IOException e) 
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
    
            try 
            {
                latestVersion = IOUtils.readLines(in).get(0);
            } 
            catch (IOException e) 
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } 
            finally 
            {
                IOUtils.closeQuietly(in);
            }
            System.out.println("Latest version of Arcane Arteries is = "+latestVersion);
            isLatestVersion = Reference.VERSION.equals(latestVersion);
        }
        
        public boolean isLatestVersion()
        {
         return isLatestVersion;
        }
        
        public String getLatestVersion()
        {
         return latestVersion;
        }
    }
    

     

     

     

    Here's the client proxy

     

     

    package com.aa.mod.proxies;
    
    import net.minecraft.event.ClickEvent;
    import net.minecraft.util.ChatComponentText;
    import net.minecraft.util.ChatStyle;
    
    import com.aa.mod.Main;
    import com.aa.mod.updateChecker.CheckVersion;
    import com.aa.mod.updateChecker.VersionChecker;
    
    import cpw.mods.fml.common.Mod.EventHandler;
    import cpw.mods.fml.common.event.FMLInitializationEvent;
    import cpw.mods.fml.common.event.FMLPostInitializationEvent;
    import cpw.mods.fml.common.eventhandler.EventPriority;
    import cpw.mods.fml.common.eventhandler.SubscribeEvent;
    import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
    
    
    public class ClientProxy extends CommonProxy {
    
        @EventHandler
        public void Init(FMLInitializationEvent event){
    
        	
    
        	Main.versionChecker = new CheckVersion();
        	Thread versionCheckThread = new Thread(Main.versionChecker, "Version Check");
        	versionCheckThread.start();
        	
        	
        	
        }
    
    
    
    }
    

     

     

     

    And the 2 lines in the main file are:

    public static CheckVersion versionChecker;
    public static boolean haveWarnedVersionOutOfDate = false;
    

     

     

    I've never even thought about this before, and I learn most of what I do through tutorials (even if they are outdated, as long as it is similar, I can understand it) but that's the only tutorial I could find on version checkers, and I don't know what I am doing wrong.

     

    Thanks

    -Jordan

     

     

  11. I can't really find much documentation on Configs, especially strings...

     

    To put simply, I want to have it so that a user will set the information of the item.

     

    When I do something like a boolean, I do it like so:

    public static boolean disableUberium;
    public static boolean disabled = false;
    
    	final String UBERIUM = Main.config.CATEGORY_GENERAL + Main.config.CATEGORY_SPLITTER + "Materials";
    	Main.config.addCustomCategoryComment(UBERIUM, "Disable materials here");
    	this.disableUberium = Main.config.get(UBERIUM, "I don't like being OP", disabled).getBoolean(disabled);
    	if(Main.config.hasChanged()){
    		Main.config.save();
    	}
    

     

    So if I was to do a string how would I do it?

    I thought it would be like this, but then I get lost:

     

    public static String description;
    	final String DESC = Main.config.CATEGORY_GENERAL + Main.config.CATEGORY_SPLITTER + "Materials";
    	this.description = Main.config.get(DESC, "default text").getString();
    	if(Main.config.hasChanged()){
    		Main.config.save();
    	}
    

    But it doesn't seem to work, any ideas?

    (default text is what the description of the item would be)

  12. Thats not deprecated, those are missing, you need to call existing methods.

    I would understand that if it didn't not work when the lines:

            altarEntity.sacrificialDaggerCall(amount, false);

            altarEntity.startCycle();

     

    were removed from:

        public void findAndFillAltar(World world, EntityPlayer player, int amount)

        {

            int posX = (int) Math.round(player.posX - 0.5f);

            int posY = (int) player.posY;

            int posZ = (int) Math.round(player.posZ - 0.5f);

            IBloodAltar altarEntity = getAltar(world, posX, posY, posZ);

     

            if (altarEntity == null)

            {

                return;

            }

     

            altarEntity.sacrificialDaggerCall(amount, false);

            altarEntity.startCycle();

        }

     

    But seeing as when those 2 lines get removed I can compile, but the item doesn't fill the altar, it makes me wonder

  13. Hey there, I am getting this message when failing to compile: http://puu.sh/i2PEH.png

     

    Only issue is, those lines of code are needed, and do do things... How can I stop Forge from saying it is deprecated? Everything works as it should in the dev environment. I can delete those lines of code and the mod loads... however, it doesn't do what it should (fill the Blood Altar)

  14. What I have right now is:

     public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float px, float py, float pz)
        {
            if (world.getBlock(x, y + 1, z) == Blocks.air)
            {
                  world.setBlock(x, y + 1, z, Blocks.water);
                  
                  
                  return true;
            }
            return false;
        }
    

    But I want it so if a player clicks on the top of the block it will spawn at y +1 water,

    if they click on the bottom, y -1 cobblestone

    etc. (as an example)

     

    Any ideas how to get the face of block clicked on?

  15. Hey there, I am wondering how one would go about doing something like this, for example something like

    if(player == username"jordsta95"){

    GameRegistry.addRecipe(new ItemStack(blockRegist.blankGlass, 9), new Object[]{

                    "GGG", "GGG", "GGG", 'G', new ItemStack(Blocks.dirt)

            });

    } else

    GameRegistry.addRecipe(new ItemStack(blockRegist.blankGlass, 9), new Object[]{

                    "GGG", "GGG", "GGG", 'G', new ItemStack(Blocks.glass)

            });

    }

     

    Obviously not that recipe, but I am thinking of a sort of troll for some friends

  16. Does your mod get loaded after the Thaumcraft mod loaded?

    You should make your mod loaded after Thaumcraft if you want to add the recipe on the preInit.

    How would I do that, other than calling the jar zName or change thaumcraft to aThaumcraft?

  17. Just a quick quick Question have you registered the recipes and all the BS?

    @EventHandler
       public void preInit(FMLInitializationEvent event){
    	log.info("Mod Load pre run started");
                    //name of you recipes class  . whatever your Init funtion for recipes is called ();
        	        Recipes.initShaplessRecipes();
    }

    Here's the full class file, where everything but that one recipe works:

    http://pastebin.com/mupfHBNk

    The Thaumcraft recipe starts at line 122

     

    Sorry for the code being very ugly

  18. Hey there, I am having an issue with crafting... yeah, very nooblike.

    I have always avoided crafting with armours/tools, because they have always been awkward (when I have tried to do them), but I don't see why this doesn't work:

     

        if(Loader.isModLoaded("Thaumcraft")){

            Item goggles = (Item) Item.itemRegistry.getObject("Thaumcraft:ItemGoggles");

            GameRegistry.addShapelessRecipe(new ItemStack(itemRegist.visViewerS),

            new ItemStack(itemRegist.superHelmet), new ItemStack(goggles)

            );

            }

           

     

    To be honest, I don't know what the thaumcraft thing actually does, I am not going to lie, I copied it from a different mod which does the exact same crafting recipe I am trying to do, and it works there.

    However, when I try to combine the Goggles of Revealing (Thaumcraft:ItemGoggles) and superHelmet it doesn't allow me to craft the visViewerS

     

     

     

    The code I copied:

     

     

    Item goggles = (Item) Item.itemRegistry.getObject("Thaumcraft:ItemGoggles");

    GameRegistry.addShapelessRecipe(new ItemStack(ModItems.manasteelHelmRevealing), new ItemStack(ModItems.manasteelHelm), new ItemStack(goggles));

     

     

×
×
  • Create New...

Important Information

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