Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

ShetiPhian

Members
  • Posts

    198
  • Joined

  • Last visited

Posts posted by ShetiPhian

  1. Well to be more precise its not infinite, but you can put a lot of similar blocks into one id.

     

    Your extended meta is an integer this provides a very large meta range (-2,147,483,648 to 2,147,483,647)

    as most will never need that many you can reduce the save size by switching to short (-32,768 to 32,767) or a byte (-128 to 127)

     

    and if used in combination with the normal base meta you can times that by 16

     

    You will run into a few limitations though

    Not all functions are location aware.

    In most cases they are at least meta aware, but sometimes they are not (this is rare though)

    So best to keep similar blocks in one id and very similar ones in the same base meta

     

    Damage value of the item is limited to an integer (I think positive only too)

    So you can not have each extended meta have it own item, but you could have a stair like object using 8 extended metas and uses 1 item damage value.

  2. Pulled this from my code, use/edit freely

     

    /**
     * If [4] is -1 , there was no block within reach.
     * @return [0]= BlockId, [1]= BlockX, [2]= BlockY, [3]= BlockZ, [4]= SideHit, [5]= BlockMeta
     */
    public static int[] getBlockInfront(World theWorld, EntityPlayer thePlayer, double reach)
    {
    	int[] blockInfo = { 0, 0, 0, 0, -1, 0 };
    
    	MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer(theWorld, thePlayer, true, reach);
    	if (movingobjectposition != null) {
    		if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) {
    			blockInfo[1] = movingobjectposition.blockX;
    			blockInfo[2] = movingobjectposition.blockY;
    			blockInfo[3] = movingobjectposition.blockZ;
    			blockInfo[4] = movingobjectposition.sideHit;
    			blockInfo[5] = theWorld.getBlockMetadata(blockInfo[1], blockInfo[2], blockInfo[3]);
    			blockInfo[0] = theWorld.getBlockId(blockInfo[1], blockInfo[2], blockInfo[3]);
    		}
    	}
    	return blockInfo;
    }
    
    private static MovingObjectPosition getMovingObjectPositionFromPlayer(World world, EntityPlayer entityplayer, boolean flag, double reach)
    {
    	float f = 1.0F;
    	float playerPitch = entityplayer.prevRotationPitch + (entityplayer.rotationPitch - entityplayer.prevRotationPitch) * f;
    	float playerYaw = entityplayer.prevRotationYaw + (entityplayer.rotationYaw - entityplayer.prevRotationYaw) * f;
    	double playerPosX = entityplayer.prevPosX + (entityplayer.posX - entityplayer.prevPosX) * f;
    	double playerPosY = (entityplayer.prevPosY + (entityplayer.posY - entityplayer.prevPosY) * f + 1.6200000000000001D) - entityplayer.yOffset;
    	double playerPosZ = entityplayer.prevPosZ + (entityplayer.posZ - entityplayer.prevPosZ) * f;
    	Vec3 vecPlayer = Vec3.createVectorHelper(playerPosX, playerPosY, playerPosZ);
    	float cosYaw = MathHelper.cos(-playerYaw * 0.01745329F - 3.141593F);
    	float sinYaw = MathHelper.sin(-playerYaw * 0.01745329F - 3.141593F);
    	float cosPitch = -MathHelper.cos(-playerPitch * 0.01745329F);
    	float sinPitch = MathHelper.sin(-playerPitch * 0.01745329F);
    	float pointX = sinYaw * cosPitch;
    	float pointY = sinPitch;
    	float pointZ = cosYaw * cosPitch;
    	Vec3 vecPoint = vecPlayer.addVector(pointX * reach, pointY * reach, pointZ * reach);
    	MovingObjectPosition movingobjectposition = world.rayTraceBlocks_do_do(vecPlayer, vecPoint, flag, !flag);
    	return movingobjectposition;
    }
    

  3. Figured this should be cleaned up just in case someone needs the info  ;)

     

    KeeganDeathman was using:

    public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5player)

     

    While this use to work the parameters have changed in 1.6 and is now viewed as a new method in KeeganDeathman's code, one which Minecraft never calls.

     

    As diesieben07 pointed out, every time you override an existing method mark it with @Override .

    With an @Override Elicpse will inform you the old method doesn't exist, this is a big hint to you to find the replacement and fix your code.

     

    in this case onBlockActivated changed from

    onBlockActivated(World, int, int, int, EntityPlayer)

    to

    onBlockActivated(World, int, int, int, EntityPlayer, int, float, float, float)

  4. @Override
    public void getSubBlocks(int id, CreativeTabs tab, List list)
    {
        list.add(new ItemStack(this, 1, 0));
        list.add(new ItemStack(this, 1, 4));
        list.add(new ItemStack(this, 1, );
        list.add(new ItemStack(this, 1, 12));
    }
    

     

     

    You already have a tile entity, you can do everything without touching meta.

     

    you could store the rotation in the tileentity and use the metas for 16 atms  (limits you to 16 atms)

    or put the atm in the tile entity and use meta 0-3 for rotation (limit is based on variable type, go ahead an fill an int ;) )

    or put both type and rotation in the tile freeing up the meta for other stuff.

     

    RedPower has its microblocks in one id due to heave tileentity usage.

  5. That would work for any forge added files, but it wont generate the needed patch files for altered Minecraft classes.

     

    Unfortunately I don't seem to be able to setup an environment also.

    Not sure if things are not yet set up, things have changed, I'm just having bad luck, or just out right forgot how :)

     

    I was sure it was as simple as

    - download forge from github (MinecraftForge-master.zip)

    - extract to a folder

    - download fml from github (FML-master.zip)

    - put files in /forge/fml/

    - run /forge/setup.py

     

    but that isn't providing the usual results

    /forge/mcp/src_base doesn't exist, nor does /forge/mcp/src_work

    and /forge/eclipse-workspace-dev.zip is never extracted to /forge/eclipse

     

    I thought about manually setting it up but ran into a snag

    while src_work is easy, its the same we use to create mods

    src_base is another thing, its a decompile with merged client and server, fml patches, but no forge patches.

     

    update_patches.py compares src_work and src_base, if you set up the folders wrong the patch files will be an unusable mess.

  6. Give this a go.

     

    @Override
    public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack itemStack)
    {
        int blockSet = world.getBlockMetadata(x, y, z) / 4;
        int direction = MathHelper.floor_double((entityliving.rotationYaw * 4F) / 360F + 0.5D) & 3;
        int newMeta = (blockSet * 4) + direction;
        world.setBlockMetadataWithNotify(x, y, z, newMeta, 0);
    }
    

     

     

    @Override
    public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
    {
        int rotation = 180;
        switch(te.getBlockMetadata() % 4) {
            case 0:
                rotation = 0;
                break;
            case 3:
                rotation = 90;
                break;
            case 2:
                rotation = 180;
                break;
            case 1:
                rotation = 270;
                break;
        }
    
        String texture = "textures/entities/atm.png";
        switch(te.getBlockMetadata() / 4) {
            case 0:
                texture = "blockset1";
                break;
            case 1:
                texture = "blockset2";
                break;
            case 2:
                texture = "blockset3";
                break;
            case 3:
                texture = "blockset4";
                break;
        }
    
        Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("flenixcities", texture));
    
        // rest of your renderer
    }
    

     

  7. Are you after a setup like this?

     

    meta 0 = block 1 north

    meta 1 = block 1 south

    meta 2 = block 1 east

    meta 3 = block 1 west

     

    meta 4 = block 2 north

    meta 5 = block 2 south

    meta 6 = block 2 east

    meta 7 = block 2 west

     

    meta 8 = block 3 north

    meta 9 = block 3 south

    meta 10 = block 3 east

    meta 11 = block 3 west

     

    meta 12 = block 4 north

    meta 13 = block 4 south

    meta 14 = block 4 east

    meta 15 = block 4 west

  8. public class RenderWhateverTile extends TileEntitySpecialRenderer
    {
        ModelWhatever model = new ModelWhatever();
    
        @Override
        public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick)
        {
            if (!(tileEntity instanceof WhateverTileEntity)) {
                return;
            }
            WhateverTileEntity tile = (WhateverTileEntity)tileEntity;
            // your rendering stuff here
        }
    }
    

     

    in your client proxy

    ClientRegistry.bindTileEntitySpecialRenderer(WhateverTileEntity.class, new RenderWhateverTile());
    

  9. models and rendering is client only  ;)

    those classes are fine with net.minecraft.client imports because a server will not load them.

     

    the model is called from the renderer and the renderer is called by the renderhandler and thats only called on the client.

  10. I'm not getting the error you had,

    I did make a few adjustments though.

     

    - Undid your changes to ItemEatWeirdly &  ItemEatWeirdlySeed :)

    - changed your package from Brenden to brenden.eatweirdly  (it should be all lowercase and include your modname, you mods would use brenden.modname)

    - removed the space from your modId

    - added an instance variable

    - removed the unfinished items

     

    I'll pastebin the classes to shorten this post:

     

    Potionitems: http://pastebin.com/30KekFJw

    ItemEatWeirdly: http://pastebin.com/ugV9J0xF

    ItemEatWeirdlySeed: http://pastebin.com/maeu0qKs

     

    Either copy the "RAW Paste Data" or download and rename them

     

    Now for adding new items:

     

    I grabbed this from the Item.class

    since it is an item you wanted to use I'll use it as an example

    public static Item ghastTear = (new Item(114)).setUnlocalizedName("ghastTear").setPotionEffect(PotionHelper.ghastTearEffect).setCreativeTab(CreativeTabs.tabBrewing).func_111206_d("ghast_tear");
    

     

    we'll start with the id

    replaceId = Item.ghastTear.itemID;
    

     

    now because we are replacing the original you need to overwrite it in the item list with your item

    so your line will start with:

    Item.itemsList[replaceId] =
    

     

    in this case the item is not a seed so you create a new ItemEatWeirdly

    you'll need to give it the replaceId-256 (subtract 256 because it gets added automaticly and your id would be different if you didn't)

    the value of the food (how much hunger it refills), in this case 1 because thats what you picked

    the food saturation (how long before you become hungry again), in this case 0.3F

    will a wolf will eat the food, in this case true

    the text you want to appear in the tooltip (each quote is a new line), "line1", "line2" will give two lines

     

    lest put that together

    new ItemEatWeirdly(replaceId - 256, 1, 0.3F, true, "line1", "line2")
    

     

    you could stop there, but there would be no texture or name, no effect when eaten and cant be used in potion brewing.

     

    the name string is from .setUnlocalizedName("ghastTear") and the texture string is from .func_111206_d("ghast_tear")

    so your setNameAndIcon would look like

    .setNameAndIcon("ghastTear", "ghast_tear")
    

     

    setBrewEffect is a renamed setPotionEffect(String) so just copy the infromation over

    .setBrewEffect(PotionHelper.ghastTearEffect)
    

     

    setEatEffect is the effect eating the item has on the player, in this case you picked regeneration

    .setEatEffect(Potion.regeneration.id, 6, 0, 1.0F);
    

     

     

    lets put all of that togeter

    replaceId = Item.ghastTear.itemID;
    Item.itemsList[replaceId] = new ItemEatWeirdly(replaceId - 256, 1, 0.3F, true, "line1", "line2").setNameAndIcon("ghastTear", "ghast_tear").setBrewEffect(PotionHelper.ghastTearEffect).setEatEffect(Potion.regeneration.id, 6, 0, 1.0F);
    

     

     

    By default the items appear on the brewing tab, to change this just add .setCreativeTab() with the tab you want inside.

    setBrewEffect and setEatEffect can be left off if you dont need them.

  11. Let me drop everything into my eclipse,

     

     

    As a side note you'll need to change these to the new format too.

    Item.speckledMelon

    Item.sugar

    Item.magmaCream

    Item.slimeBall

    Item.lightStoneDust

    Item.ghastTear

    Item.goldenCarrot

    Item.fermentedSpiderEye

    Item.gunpowder

  12. But blocks should be registered in preInt :)

     

    Mod.EventHandler Javadoc [Reformatted for forums]

    These suggestions are mostly just suggestions on what to do in each event.

    • FMLPreInitializationEvent: Run before anything else. Read your config, create blocks, items, etc, and register them with the GameRegistry
    • FMLInitializationEvent: Do your mod setup. Build whatever data structures you care about. Register recipes, send FMLInterModComms messages to other mods.
    • FMLPostInitializationEvent: Handle interaction with other mods, complete your setup based on this.

     

    The old bug prevented you from registering them anywhere else by not loading the textures at all if you did.

     

     

    This bug however is nothing but log spam.

    Textures are found, loaded, and used But the logs report them missing.

     

    You can ignore it as its wrong but hopefully its fixed when 1.6 builds become recommended.

    I am on 771 and the changelog for 773 might be referring to what is causing this.

     

    EDIT:

    nope 773 wasn't referring to this as it still exists in build 775

     

    still around in 776, I wonder if it has anything to do with

    [WARNING] <modname> is missing a pack.mcmeta file, things may not work well

  13. You forgot the @ line before preInit  ;)

     

    @EventHandler  // this is for 1.6 if your on 1.5 use @PreInit
    public void preInit(FMLPreInitializationEvent event)
    

     

    Also don't need the private void func_111206_d(String icon) {} in the new classes.

    What I meant was you can get the texture name by looking at Items.class at the end of each line when the items are registered you'll see .func_111206_d(" something here ");

    The " something here " is the string you need :)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.