Tinkertools Github

ToolMaterials
/* This first part adds Seared Stone as a material. Toolparts and tool graphics are created automatically by color */
NBTTagCompound tag = new NBTTagCompound();
tag.setInteger('Id', 50); // Unique material ID. Reseved IDs: 0-40 Tinker, 41-45 Iguana Tinker Tweaks, 100-200 ExtraTiC
tag.setString('Name', 'Seared Stone'); // Unique material name
tag.setInteger('HarvestLevel', 3); // diamond level
tag.setInteger('Durability', 100);
tag.setInteger('MiningSpeed', 100);
tag.setInteger('Attack', 0); // optional
tag.setFloat('HandleModifier', 0.1f);
tag.setInteger('Reinforced', 0); // optional
tag.setFloat('Stonebound', 0); // optional, cannot be used if jagged
//tag.setFloat('Jagged', 0); // optional, cannot be used if stonebound
tag.setString('Style', EnumChatFormatting.RED.toString()); // optional, color of the material text
tag.setInteger('Color', 255 << 24 | 45 << 16 | 45 << 8 | 40); // argb
/* SINCE 1.8.2 - bow and arrow stats
* for bow and arrow stats, best compare to other materials to find good values
*/
// additional stats for bows
tag.setInteger('Bow_DrawSpeed', 100); // the higher the longer it takes to draw the bow
tag.setFloat('Bow_ProjectileSpeed', 1.0f); // the higher the faster the projectile goes
// additional stats for arrows
tag.setFloat('Projectile_Mass', 2.0f);
tag.setFloat('Projectile_Fragility', 0.9f); // This is a multiplier to the shafts break-chance
FMLInterModComms.sendMessage('TConstruct', 'addMaterial', tag);
/* SINCE 1.8.3 - material mappings
* This maps an item to a material so it can be used for repairing etc. */
tag = new NBTTagCompound();
tag.setInteger('MaterialId', 50);
tag.setInteger('Value', 2); // 1 material ever 2 value. See PartMapping IMC
item = new NBTTagCompound();
(new ItemStack(TinkerTools.materials, 1, 2)).writeToNBT(item); // seared brick item
tag.setTag('Item', item);
FMLInterModComms.sendMessage('TConstruct', 'addMaterialItem', tag);
/* This part adds mappigs, so that you can convert items to toolparts in the Part Builder.
Stone Parts are used as the baseline for what exists */
tag = new NBTTagCompound();
tag.setInteger('MaterialId', 50); // output material id
NBTTagCompound item = new NBTTagCompound();
(new ItemStack(TinkerSmeltery.smeltery, 1, 2)).writeToNBT(item); // seared brick block
tag.setTag('Item', item);
item = new NBTTagCompound();
(new ItemStack(TinkerTools.materials, 1, 2)).writeToNBT(item); // seared brick item
tag.setTag('Shard', item);
// 1 value = 1 shard. So 1 blocks like stone usually have value 2.
// Seared Brick is the shard, the block consists of 4 bricks, therefore value 4
tag.setInteger('Value', 4);
FMLInterModComms.sendMessage('TConstruct', 'addPartBuilderMaterial', tag);
/* This part adds Smeltery casting. Give it a liquid, and which material to output. BAM toolpart casting.
Iron parts are used as the baseline for what exists.
Note that the Liquid has to exist. */
tag = new NBTTagCompound();
// liquid to use
tag.setString('FluidName', TinkerSmeltery.moltenStoneFluid.getName());
// or this way, it's equal
(new FluidStack(TinkerSmeltery.moltenStoneFluid, 1)).writeToNBT(tag); // this also works, amount doesn't matter
tag.setInteger('MaterialId', 50); // output material id
FMLInterModComms.sendMessage('TConstruct', 'addPartCastingMaterial', tag);
// Smeltery stuff since 1.7.1
/* This part adds Smeltery melting. Give it an item, a block to render in the smeltery, the temperature required and the liquid to produce.
For reference: Iron has temperature 600, Stone has 800, Water has 20.
Melting duration is directly related to temperature required. */
tag = new NBTTagCompound();
// the item
item = new NBTTagCompound();
(new ItemStack(TinkerTools.materials, 1, 2)).writeToNBT(item); // seared brick item
tag.setTag('Item', item);
// the block to render
item = new NBTTagCompound();
(new ItemStack(TinkerSmeltery.smeltery, 1, 4)).writeToNBT(item); // seared stone block
tag.setTag('Block', item);
// liquid to produce. This time the amount DOES matter!
(new FluidStack(TinkerSmeltery.moltenStoneFluid, TConstruct.ingotLiquidValue/4)).writeToNBT(tag); // this also works
// the temperature required
tag.setInteger('Temperature', 850);
FMLInterModComms.sendMessage('TConstruct', 'addSmelteryMelting', tag);
/* This part adds Smeltery fuel. Give it a fuel, how hot it is and how long it lasts.
The temperature determines WHAT it can melt (e.g. stone needs at least temperature 800) and how FAST it melts
The duration depends on how long one 'portion' of fuel lasts.
For reference: Lava has a temperature of 1300 and a duration of 80
The duration has to be divided through 20 to get the seconds.
One 'portion' is 15mb. */
tag = new NBTTagCompound();
// fuel liquid. Amount doesn't matter if you use the fluidstack variant
tag.setString('FluidName', FluidRegistry.WATER.getName());
// water is totally OP
tag.setInteger('Temperature', 9001);
// but also used up very quickly
tag.setInteger('Duration', 1); // this means 15 mb last 1 tick. Therefore 1 second of use drains 15*20 = 300mb water
FMLInterModComms.sendMessage('TConstruct', 'addSmelteryFuel', tag);
/* SINCE 1.8.3
This allows you to register your custom IEnergyContainerItems as a valid item for adding the Redstone Flux Modifier to your tool
you can add any item you like, just make sure that the item implements IEnergyContainerItem interface from the cofh/api/energy api */
ItemStack battery = new ItemStack(ModItems.battery);
FMLInterModComms.sendMessage('TConstruct', 'addFluxBattery', battery);

commented Sep 27, 2015

does this work with minetweaker, or do i need to make a new mod for adding new materials?

Oct 17, 2019  How to Download. If you need additional technical support for transferring the software to your computer, further help is available on a detailed information page. Sep 29, 2019  Dismiss Join GitHub today. GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

commented Aug 30, 2016

im working on a modpack and need more tool materials

commented Aug 30, 2016

how do insert this code into the game?

commented Oct 7, 2016

@BatTheArcher Shameless self-advertising https://github.com/HxCKDMS/HxCTiC
=0 * Flutters away *

commented Oct 8, 2016

I used this method for my own material, but with NEI and in the inventory, everything is called material.[My material], instead of just [My material]
so for example, my main material is called ekulium, and all the tinker's stuff is called material.ekulium, like material.ekulium Pickaxe
any ideas on this? or is it just part of TConstruct's IMC handling?

commented May 19, 2018

This doesn't seem to work anymore.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
Download the bundle spatie-laravel-tinker-tools_-_2017-05-22_18-31-52.bundle and run:
Use short class names in an Artisan tinker session

When using Artisan's Tinker command it can be quite bothersome having to type the fully qualified classname to do something simple.

phpAppModelsNewsItem::first();

This package contains a class that, when fully installed let's you use the short class names:

phpNewsItem::first();

Installation

First install the package via composer:

bashcomposer require spatie/laravel-tinker-tools

Next, create a file named .psysh.php in the root of your Laravel app with this content:

```php

SpatieTinkerToolsShortClassNames::register();```

Finally, dump the optimized version of the autoloader so autoload_classmap.php gets created.

bashcomposer dump-autoload -o

Usage

Tinker tools github tool

Open up a tinker session with:

bashphp artisan tinker

Inside that tinker session you can now use short class names:

phpNewsItem::first();

A peek behind the curtains

When you use a class that hasn't been loaded in yet, PHP will call the registered autoloader functions. Such autoloader functions are responsible for loading up the requested class. In a typical project Composer will register an autoloader function that can include the file where the class is stored in.

Composer has a few ways to locate the right files. In most cases it will convert the fully qualified class name to a path. For example, when using a class AppModelsNewsItem Composer will load the file in app/Models/NewsItem.php. It's a bit more complicated behind the scenes but that's the gist of it. To make the process of finding a class fast, Composer caches all the fully qualified classnames and their paths in the generated autoload_classmap.php, which can be found in vendor/composer.

Now, to make this package work, SpatieTinkerToolsShortClassNames will read Composer's autoload_classmap.php and convert the fully qualified class names to short class names. The result is a collection that's being kept in the $classes property

Our class will also register an autoloader. When you use NewsItem in your code. PHP will first call Composer's autoloader. But of course that autoloader can't find the class. So the autoloader from this package comes next. Our autoloader will use the aforementioned $classes collection to find to fully qualified class name. It will then use class_alias to alias NewsItem to AppModelsNewsItem.

What happens if there are multiple classes with same name?

Now you might wonder what'll happen it there are more classes with the same name in different namespaces? E.g. AppModelsNewsItem, VendorPackageNameNewsItem. Well, autoload_classmap.php is sorted alphabetically on the fully qualified namespace. So AppModelsNewsItem will be used and not VendorPackageNameNewsItem.

Because App starts with an 'A' there's a high chance that, in case of a collision, a class inside your application will get picked. Currently there are no ways to alter this. I'd accept PRs that make this behaviour customizable.

Need more tinker magic?

Tinker Tools Github Tool

There are a lot of other options that can be set in tinker.config.php. Learn all the options by reading the official psysh configuration documentation.

Postcardware

You're free to use this package (it's MIT-licensed), but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Samberstraat 69D, 2060 Antwerp, Belgium.

We publish all received postcards on our company website.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

bash$ composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email freek@spatie.be instead of using the issue tracker.

Credits

We got the idea for ShortClassnames by reading the 'Tailoring Tinker with custom config'`section of Caleb Porzio's excellent blogpost 'Supercharge Your Laravel Tinker Workflow'

About Spatie

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.

License

The MIT License (MIT). Please see License File for more information.

Tinker Tools Github Download


Source: https://github.com/spatie/laravel-tinker-tools

Tinker Tools Github Tutorial


Tinker Tools Github Free

Uploader: spatie

Github Tinkertools

Upload date: 2017-05-22