mirror of
https://github.com/GTNewHorizons/Avaritia.git
synced 2026-11-21 04:32:29 +00:00
Just Put Some Gears On It
https: //github.com/SpitefulFox/Avaritia/commit/108ec86714fa6d2f1b1e230f6ecf5b332252e900 Co-Authored-By: SpitefulFox <[email protected]>
This commit is contained in:
1 parent
460b62f32e
commit
7cefe28ba1
6 files changed
+129
-5
No files matched your search
@@ -0,0 +1,117 @@
|
||||
package fox.spiteful.avaritia.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.tile.TileEntityDireCrafting;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockAutoDireCrafting extends BlockContainer {
|
||||
private static IIcon top, sides, bottom;
|
||||
private Random randy = new Random();
|
||||
|
||||
public BlockAutoDireCrafting(){
|
||||
super(Material.iron);
|
||||
setStepSound(Block.soundTypeGlass);
|
||||
setHardness(50.0F);
|
||||
setResistance(2000.0F);
|
||||
setBlockName("auto_dire_crafting");
|
||||
setHarvestLevel("pickaxe", 3);
|
||||
setCreativeTab(Avaritia.tab);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
top = iconRegister.registerIcon("avaritia:dire_crafting_top");
|
||||
sides = iconRegister.registerIcon("avaritia:dire_crafting_side");
|
||||
bottom = iconRegister.registerIcon("avaritia:block_crystal_matrix");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int metadata)
|
||||
{
|
||||
if (side == 0)
|
||||
return bottom;
|
||||
if (side == 1)
|
||||
return top;
|
||||
return sides;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.openGui(Avaritia.instance, 1, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileEntityDireCrafting();
|
||||
}
|
||||
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int wut)
|
||||
{
|
||||
TileEntityDireCrafting craft = (TileEntityDireCrafting)world.getTileEntity(x, y, z);
|
||||
|
||||
if (craft != null)
|
||||
{
|
||||
for(int i = 1;i < 82;i++) {
|
||||
ItemStack itemstack = craft.getStackInSlot(i);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = this.randy.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.randy.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.randy.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (itemstack.stackSize > 0) {
|
||||
int j1 = this.randy.nextInt(21) + 10;
|
||||
|
||||
if (j1 > itemstack.stackSize) {
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(world, (double) ((float) x + f), (double) ((float) y + f1), (double) ((float) z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound()) {
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (double) ((float) this.randy.nextGaussian() * f3);
|
||||
entityitem.motionY = (double) ((float) this.randy.nextGaussian() * f3 + 0.2F);
|
||||
entityitem.motionZ = (double) ((float) this.randy.nextGaussian() * f3);
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
|
||||
world.func_147453_f(x, y, z, block);
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, wut);
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ public class LudicrousBlocks {
|
||||
*/
|
||||
public static Block resource_block;
|
||||
public static Block dire_crafting;
|
||||
public static Block auto_dire_crafting;
|
||||
public static Block neutron_collector;
|
||||
public static Block compressor;
|
||||
|
||||
@@ -30,6 +31,7 @@ public class LudicrousBlocks {
|
||||
double_craft = GameRegistry.registerBlock(new BlockDoubleCraft(), "Double_Craft");
|
||||
triple_craft = GameRegistry.registerBlock(new BlockTripleCraft(), "Triple_Craft");
|
||||
dire_crafting = GameRegistry.registerBlock(new BlockDireCrafting(), "Dire_Crafting");
|
||||
auto_dire_crafting =GameRegistry.registerBlock(new BlockAutoDireCrafting(), "Auto_Dire_Crafting");
|
||||
GameRegistry.registerTileEntity(TileEntityDireCrafting.class, "Avaritia_Dire_Craft");
|
||||
|
||||
if(Config.craftingOnly)
|
||||
|
||||
@@ -51,6 +51,7 @@ public class Grinder {
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousItems.resource, 9, 6), "C", 'C', new ItemStack(LudicrousBlocks.resource_block, 1, 1));
|
||||
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousItems.resource, 13, 8), "CIC", "ICI", "CIC", 'C', new ItemStack(Blocks.coal_block, 1), 'I', new ItemStack(LudicrousItems.resource, 1, 1));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousItems.resource, 1, 9), " I ", "ISI", " I ", 'I', new ItemStack(LudicrousItems.resource, 1, 4), 'S', new ItemStack(Items.stick));
|
||||
|
||||
ExtremeCraftingManager.getInstance().addRecipe(new ItemStack(LudicrousBlocks.neutron_collector, 1),
|
||||
"IIQQQQQII",
|
||||
|
||||
@@ -24,7 +24,8 @@ import java.util.List;
|
||||
public class ItemResource extends Item implements IHaloRenderItem {
|
||||
|
||||
private static final String[] types = new String[]{"diamond_lattice", "crystal_matrix_ingot", "neutron_pile",
|
||||
"neutron_nugget", "neutronium_ingot", "infinity_catalyst", "infinity_ingot", "record_fragment", "starfuel"};
|
||||
"neutron_nugget", "neutronium_ingot", "infinity_catalyst", "infinity_ingot", "record_fragment", "starfuel",
|
||||
"neutronium_gear"};
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon[] icons;
|
||||
@@ -56,7 +57,7 @@ public class ItemResource extends Item implements IHaloRenderItem {
|
||||
public void addInformation(ItemStack item, EntityPlayer player, List tooltip, boolean wut) {
|
||||
|
||||
int meta = item.getItemDamage();
|
||||
if (meta != 0 && meta != 8) {
|
||||
if (meta != 0 && meta < 8) {
|
||||
tooltip.add(EnumChatFormatting.DARK_GRAY +""+ EnumChatFormatting.ITALIC + StatCollector.translateToLocal("tooltip."+types[meta]+".desc"));
|
||||
}
|
||||
}
|
||||
@@ -92,6 +93,7 @@ public class ItemResource extends Item implements IHaloRenderItem {
|
||||
case 1:
|
||||
case 4:
|
||||
case 8:
|
||||
case 9:
|
||||
return EnumRarity.rare;
|
||||
case 5:
|
||||
return EnumRarity.epic;
|
||||
@@ -106,14 +108,14 @@ public class ItemResource extends Item implements IHaloRenderItem {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean drawHalo(ItemStack stack) {
|
||||
int meta = stack.getItemDamage();
|
||||
return (meta >= 2 && meta <= 6) || meta == 8;
|
||||
return (meta >= 2 && meta <= 6) || meta >= 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getHaloTexture(ItemStack stack) {
|
||||
int meta = stack.getItemDamage();
|
||||
if (meta == 2 || meta == 3 || meta == 4) {
|
||||
if (meta == 2 || meta == 3 || meta == 4 || meta == 9) {
|
||||
return halo[1];
|
||||
}
|
||||
return halo[0];
|
||||
@@ -148,7 +150,7 @@ public class ItemResource extends Item implements IHaloRenderItem {
|
||||
if (meta == 3) {
|
||||
return 0x4DFFFFFF;
|
||||
}
|
||||
if (meta == 4) {
|
||||
if (meta == 4 || meta == 9) {
|
||||
return 0x99FFFFFF;
|
||||
}
|
||||
return 0xFF000000;
|
||||
|
||||
Reference in new issue
Block a user