Merge pull request #4 from GotoLink/master

GotoLink takeover!
This commit is contained in:
oitsjustjose 2013-10-23 14:46:20 -07:00
commit 5afce2c817
368 changed files with 8121 additions and 14948 deletions

220
.gitignore vendored Normal file
View file

@ -0,0 +1,220 @@
#################
## Eclipse
#################
*.pydevproject
.project
.metadata
common/bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# PDT-specific
.buildpath
#################
## Visual Studio
#################
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
*.ncrunch*
.*crunch*.local.xml
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.Publish.xml
*.pubxml
# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/
# Windows Azure Build Output
csx
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
App_Data/*.mdf
App_Data/*.ldf
#############
## Windows detritus
#############
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Mac crap
.DS_Store
#############
## Python
#############
*.py[co]
# Packages
*.egg
*.egg-info
dist/
build/
eggs/
parts/
var/
sdist/
develop-eggs/
.installed.cfg
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
#Translations
*.mo
#Mr Developer
.mr.developer.cfg
/mcp/*
/eclipse/*
/api/*
/releases/*

View file

@ -1,14 +1,15 @@
package MysticOres.Blocks; package mysticores.blocks;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import mysticores.MysticOres;
import mysticores.items.Items;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
@ -16,223 +17,226 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import MysticOres.MysticOres;
import MysticOres.Items.Items;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
public class BlockBase extends Block public class BlockBase extends Block {
{
Icon[] textures; Icon[] textures;
public BlockBase(int ID) public BlockBase(int ID) {
{
super(ID, Material.rock); super(ID, Material.rock);
setCreativeTab(MysticOres.MysticOresTab); setCreativeTab(MysticOres.MysticOresTab);
} }
@Override
public int damageDropped(int j) {
switch (j) {
case 1:
return 8;
case 2:
return 4;
case 4:
return 5;
case 5:
return 7;
case 7:
return 10;
case 8:
case 9:
case 10:
return 0;
case 11:
return 6;
case 12:
return 11;
default:
return j;
}
}
@Override @Override
public float getBlockHardness(World world, int x, int y, int z) public float getBlockHardness(World world, int x, int y, int z) {
{
int meta = world.getBlockMetadata(x, y, z); int meta = world.getBlockMetadata(x, y, z);
if(meta == 12) if (meta == 12)
return 4.5f; return 4.5f;
else else
return 3.0f; return 3.0f;
} }
@Override @Override
public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) {
double explosionZ)
{
int meta = world.getBlockMetadata(x, y, z); int meta = world.getBlockMetadata(x, y, z);
if(meta == 12) if (meta == 12)
return 2000.0f; return 2000.0f;
else else
return 2.0f; return 2.0f;
} }
@Override @Override
public int getLightValue(IBlockAccess world, int x, int y, int z) @SideOnly(Side.CLIENT)
{ public Icon getIcon(int side, int meta) {
return textures[meta];
}
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z); int meta = world.getBlockMetadata(x, y, z);
if(meta == 2 || meta == 3) if (meta == 2 || meta == 3)
return 7; return 7;
else else
return 0; return 0;
} }
@Override @Override
@SideOnly(Side.CLIENT) public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
public void registerIcons(IconRegister register)
{
textures = new Icon[16];
for(int i=0;i<ItemBase.BLOCK_NAMES.length;i++)
{
textures[i] = register.registerIcon("MysticMods:" + ItemBase.BLOCK_NAMES[i]);
}
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIcon(int side, int meta)
{
return textures[meta];
}
@Override
public int idDropped(int par1, Random random, int par3)
{
switch(par1)
{
case 1:return Items.Resource.itemID;
case 2:return Items.Resource.itemID;
case 4:return Items.Resource.itemID;
case 5:return Items.Resource.itemID;
case 7:return Items.Resource.itemID;
case 8:return this.BlackSoulstoneDrops(par1, random, par3);
case 9:return this.BlueSoulstoneDrops(par1, random, par3);
case 10:return this.RedSoulstoneDrops(par1, random, par3);
case 11:return Items.Resource.itemID;
case 12:return Items.Resource.itemID;
default:return blockID;
}
}
@Override
public int damageDropped(int j)
{
switch(j)
{
case 1:return 8;
case 2:return 4;
case 4:return 5;
case 5:return 7;
case 7:return 10;
case 8:return 0;
case 9:return 0;
case 10:return 0;
case 11:return 6;
case 12:return 11;
default:return j;
}
}
@Override
public int quantityDropped(int meta, int fortune, Random random)
{
switch(meta)
{
case 2:return random.nextInt(5) + 1;
case 7:return random.nextInt(3) + 1;
case 8:return random.nextInt(4) + 1;
case 9:return random.nextInt(4) + 1;
case 10:return random.nextInt(4) + 1;
case 12:return random.nextInt(5) + 1;
default:return 1;
}
}
@Override
protected boolean canSilkHarvest()
{
return true;
}
@Override
public int idPicked(World world, int x, int y, int z)
{
return this.blockID;
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z); int meta = world.getBlockMetadata(x, y, z);
return new ItemStack(this, 1, meta); return new ItemStack(this, 1, meta);
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(int i, CreativeTabs tab, List list) public void getSubBlocks(int i, CreativeTabs tab, List list) {
{ for (int meta = 0; meta < ItemBase.BLOCK_NAMES.length; meta++) {
for(int meta = 0;meta<ItemBase.BLOCK_NAMES.length; meta ++)
{
list.add(new ItemStack(i, 1, meta)); list.add(new ItemStack(i, 1, meta));
} }
} }
@Override
public int idDropped(int par1, Random random, int par3) {
switch (par1) {
case 1:
case 2:
case 4:
case 5:
case 7:
case 11:
case 12:
return Items.Resource.itemID;
case 8:
return this.BlackSoulstoneDrops(par1, random, par3);
case 9:
return this.BlueSoulstoneDrops(par1, random, par3);
case 10:
return this.RedSoulstoneDrops(par1, random, par3);
default:
return blockID;
}
}
@Override
public int idPicked(World world, int x, int y, int z) {
return this.blockID;
}
@Override
public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side) {
int meta = world.getBlockMetadata(x, y, z);
if (meta == 12)
return false;
else
return true;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public int quantityDropped(int meta, int fortune, Random random) {
switch (meta) {
case 2:
return random.nextInt(5) + 1;
case 7:
return random.nextInt(3) + 1;
case 8:
return random.nextInt(4) + 1;
case 9:
return random.nextInt(4) + 1;
case 10:
return random.nextInt(4) + 1;
case 12:
return random.nextInt(5) + 1;
default:
return 1;
}
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int par) public void registerIcons(IconRegister register) {
{ textures = new Icon[16];
for (int i = 0; i < ItemBase.BLOCK_NAMES.length; i++) {
textures[i] = register.registerIcon("MysticMods:" + ItemBase.BLOCK_NAMES[i]);
}
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int par) {
int meta = world.getBlockMetadata(x, y, z); int meta = world.getBlockMetadata(x, y, z);
int blockID = world.getBlockId(x, y, z); int blockID = world.getBlockId(x, y, z);
if(meta == 12 && blockID == this.blockID) if (meta == 12 && blockID == this.blockID)
return false; return false;
else else
return true; return true;
} }
@Override @Override
public boolean renderAsNormalBlock() protected boolean canSilkHarvest() {
{
return false;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side)
{
int meta = world.getBlockMetadata(x, y, z);
if(meta == 12)
return false;
else
return true; return true;
} }
public static int BlackSoulstoneDrops(int par1, Random random, int par3) public static int BlackSoulstoneDrops(int par1, Random random, int par3) {
{
int rand = random.nextInt(2); int rand = random.nextInt(2);
switch(rand) switch (rand) {
{ case 0:
case 0:return Item.coal.itemID; return Item.coal.itemID;
case 1:return Item.gunpowder.itemID; case 1:
default:return Item.sugar.itemID; return Item.gunpowder.itemID;
default:
return Item.sugar.itemID;
} }
} }
public static int RedSoulstoneDrops(int par1, Random random, int par3) public static int BlueSoulstoneDrops(int par1, Random random, int par3) {
{
int rand = random.nextInt(4);
switch(rand)
{
case 0:return Item.glowstone.itemID;
case 1:return Item.gunpowder.itemID;
case 2:return Item.redstone.itemID;
case 3:return Block.obsidian.blockID;
default:return Item.blazePowder.itemID;
}
}
public static int BlueSoulstoneDrops(int par1, Random random, int par3)
{
int rand = random.nextInt(5); int rand = random.nextInt(5);
switch(rand) switch (rand) {
{ case 0:
case 0:return Item.diamond.itemID; return Item.diamond.itemID;
case 1:return Block.obsidian.blockID; case 1:
case 2:return Item.gunpowder.itemID; return Block.obsidian.blockID;
case 3:return Item.glowstone.itemID; case 2:
case 4:return Item.blazeRod.itemID; return Item.gunpowder.itemID;
case 5:return Item.emerald.itemID; case 3:
default:return Item.emerald.itemID; return Item.glowstone.itemID;
case 4:
return Item.blazeRod.itemID;
case 5:
return Item.emerald.itemID;
default:
return Item.emerald.itemID;
}
}
public static int RedSoulstoneDrops(int par1, Random random, int par3) {
int rand = random.nextInt(4);
switch (rand) {
case 0:
return Item.glowstone.itemID;
case 1:
return Item.gunpowder.itemID;
case 2:
return Item.redstone.itemID;
case 3:
return Block.obsidian.blockID;
default:
return Item.blazePowder.itemID;
} }
} }
} }

View file

@ -1,19 +1,16 @@
package MysticOres.Blocks; package mysticores.blocks;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import MysticOres.Lib.BlockID;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
public class BlockHandler { public class BlockHandler {
public static Block BlockBase; public static Block BlockBase;
public static int BASEID = 540;
public static void Initialize() public static void initialize() {
{ BlockBase = new BlockBase(BASEID).setStepSound(Block.soundStoneFootstep);
BlockBase = new BlockBase(BlockID.BASEID).setStepSound(Block.soundStoneFootstep);
GameRegistry.registerBlock(BlockBase, ItemBase.class, "Base Blocks"); GameRegistry.registerBlock(BlockBase, ItemBase.class, "Base Blocks");
setBlockHarvestLevels(); setBlockHarvestLevels();
} }
@ -31,5 +28,4 @@ public class BlockHandler {
MinecraftForge.setBlockHarvestLevel(BlockBase, 10, "pickaxe", 2); MinecraftForge.setBlockHarvestLevel(BlockBase, 10, "pickaxe", 2);
MinecraftForge.setBlockHarvestLevel(BlockBase, 11, "pickaxe", 2); MinecraftForge.setBlockHarvestLevel(BlockBase, 11, "pickaxe", 2);
} }
} }

View file

@ -1,45 +1,36 @@
package MysticOres.Blocks; package mysticores.blocks;
import java.util.List;
import MysticOres.MysticOres;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemBase extends ItemBlock public class ItemBase extends ItemBlock {
{ public static String[] BLOCK_NAMES = new String[] { "Adamantine Ore", "Amethyst Ore", "Iridium Ore", "Mithril Ore", "Tourmaline Ore", "Topaz Ore", "Verdite Ore", "Bloodstone", "Black Soulstone",
public static String[] BLOCK_NAMES = new String[] {"Adamantine Ore", "Amethyst Ore", "Iridium Ore", "Mithril Ore", "Tourmaline Ore", "Topaz Ore", "Verdite Ore", "Bloodstone", "Black Soulstone", "Blue Soulstone", "Red Soulstone", "Agate Ore", "Tempered Glass" };
"Blue Soulstone", "Red Soulstone", "Agate Ore", "Tempered Glass"};
public ItemBase(int par1) public ItemBase(int par1) {
{
super(par1); super(par1);
setMaxDamage(0); setMaxDamage(0);
setHasSubtypes(true); setHasSubtypes(true);
} }
@Override @Override
public String getUnlocalizedName(ItemStack itemStack) @SideOnly(Side.CLIENT)
{ public Icon getIconFromDamage(int par1) {
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, BLOCK_NAMES.length); return BlockHandler.BlockBase.getIcon(2, par1);
return BLOCK_NAMES[meta];
} }
@Override @Override
public int getMetadata(int par1) public int getMetadata(int par1) {
{
return par1; return par1;
} }
@SideOnly(Side.CLIENT) @Override
public Icon getIconFromDamage(int par1) public String getUnlocalizedName(ItemStack itemStack) {
{ int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, BLOCK_NAMES.length);
return BlockHandler.BlockBase.getIcon(2, par1); return BLOCK_NAMES[meta];
} }
} }

View file

@ -1,4 +1,4 @@
package MysticOres.Items; package mysticores.items;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.EnumToolMaterial;

View file

@ -1,15 +0,0 @@
package MysticOres.Items;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.IFuelHandler;
public class IridiumFuelHandler implements IFuelHandler
{
public int getBurnTime(ItemStack fuel)
{
if(fuel.getItemDamage() == 4)
return 12800;
else
return 0;
}
}

View file

@ -1,20 +1,18 @@
package MysticOres.Items; package mysticores.items;
import mysticores.MysticOres;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemAxe;
import MysticOres.MysticOres;
public class ItemAxes extends ItemAxe public class ItemAxes extends ItemAxe {
{ public ItemAxes(int par1, EnumToolMaterial par2EnumToolMaterial) {
public ItemAxes(int par1, EnumToolMaterial par2EnumToolMaterial)
{
super(par1, par2EnumToolMaterial); super(par1, par2EnumToolMaterial);
setCreativeTab(MysticOres.MysticOresTab); setCreativeTab(MysticOres.MysticOresTab);
} }
@Override @Override
public void registerIcons(IconRegister iconRegister) public void registerIcons(IconRegister iconRegister) {
{
itemIcon = iconRegister.registerIcon("MysticMods" + ":" + this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1)); itemIcon = iconRegister.registerIcon("MysticMods" + ":" + this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1));
} }
} }

View file

@ -1,30 +1,18 @@
package MysticOres.Items; package mysticores.items;
import MysticOres.MysticOres; import mysticores.MysticOres;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.entity.player.UseHoeEvent;
public class ItemHoes extends ItemHoe public class ItemHoes extends ItemHoe {
{ public ItemHoes(int par1, EnumToolMaterial par2EnumToolMaterial) {
public ItemHoes(int par1, EnumToolMaterial par2EnumToolMaterial)
{
super(par1, par2EnumToolMaterial); super(par1, par2EnumToolMaterial);
this.setCreativeTab(MysticOres.MysticOresTab); this.setCreativeTab(MysticOres.MysticOresTab);
} }
@Override @Override
public void registerIcons(IconRegister iconRegister) public void registerIcons(IconRegister iconRegister) {
{
itemIcon = iconRegister.registerIcon("MysticMods" + ":" + this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1)); itemIcon = iconRegister.registerIcon("MysticMods" + ":" + this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1));
} }
} }

View file

@ -1,28 +1,18 @@
package MysticOres.Items; package mysticores.items;
import MysticOres.MysticOres; import mysticores.MysticOres;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
public class ItemPickaxes extends ItemPickaxe public class ItemPickaxes extends ItemPickaxe {
{ public ItemPickaxes(int par1, EnumToolMaterial par2EnumToolMaterial) {
public ItemPickaxes(int par1, EnumToolMaterial par2EnumToolMaterial)
{
super(par1, par2EnumToolMaterial); super(par1, par2EnumToolMaterial);
this.setCreativeTab(MysticOres.MysticOresTab); this.setCreativeTab(MysticOres.MysticOresTab);
} }
@Override @Override
public void registerIcons(IconRegister iconRegister) public void registerIcons(IconRegister iconRegister) {
{
itemIcon = iconRegister.registerIcon("MysticMods" + ":" + this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1)); itemIcon = iconRegister.registerIcon("MysticMods" + ":" + this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1));
} }
} }

View file

@ -1,66 +1,53 @@
package MysticOres.Items; package mysticores.items;
import java.util.List; import java.util.List;
import mysticores.MysticOres;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import MysticOres.MysticOres;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
public class ItemResource extends Item public class ItemResource extends Item {
{
private Icon[] icons; private Icon[] icons;
private static final String[] RESOURCE_TYPES = new String[] { "Verdite Ingot", "Mithril Ingot", "Adamantine Ingot", "Iridium Ingot", "Iridium Nugget", "Tourmaline Gem", "Agate Gem", "Topaz Gem",
"Amethyst Gem", "Mystic Powder", "Bloodstone Shard", "Glass Shard", "Obsidian Shard", "Obsidian Rod" };
private static final String[] RESOURCE_TYPES = new String[] {"Verdite Ingot", "Mithril Ingot", "Adamantine Ingot", "Iridium Ingot", "Iridium Nugget", "Tourmaline Gem", "Agate Gem", "Topaz Gem", public ItemResource(int id) {
"Amethyst Gem", "Mystic Powder", "Bloodstone Shard", "Glass Shard", "Obsidian Shard", "Obsidian Rod"};
public ItemResource(int id)
{
super(id); super(id);
this.setHasSubtypes(true); this.setHasSubtypes(true);
this.setCreativeTab(MysticOres.MysticOresTab); this.setCreativeTab(MysticOres.MysticOresTab);
} }
@Override @Override
public String getUnlocalizedName(ItemStack itemStack) @SideOnly(Side.CLIENT)
{ public Icon getIconFromDamage(int meta) {
int j = MathHelper.clamp_int(meta, 0, RESOURCE_TYPES.length);
return icons[j];
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int var4 = 0; var4 < RESOURCE_TYPES.length; var4++)
par3List.add(new ItemStack(par1, 1, var4));
}
@Override
public String getUnlocalizedName(ItemStack itemStack) {
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, RESOURCE_TYPES.length); int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, RESOURCE_TYPES.length);
return RESOURCE_TYPES[meta]; return RESOURCE_TYPES[meta];
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) public void registerIcons(IconRegister iconRegister) {
{
icons = new Icon[RESOURCE_TYPES.length]; icons = new Icon[RESOURCE_TYPES.length];
for (int i = 0; i < RESOURCE_TYPES.length; ++i) for (int i = 0; i < RESOURCE_TYPES.length; ++i)
icons[i] = iconRegister.registerIcon("MysticMods:" + RESOURCE_TYPES[i]); icons[i] = iconRegister.registerIcon("MysticMods:" + RESOURCE_TYPES[i]);
} }
@Override
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int meta)
{
int j = MathHelper.clamp_int(meta, 0, RESOURCE_TYPES.length);
return icons[j];
}
@SideOnly(Side.CLIENT)
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int var4 = 0; var4 < RESOURCE_TYPES.length; var4++)
par3List.add(new ItemStack(par1, 1, var4));
}
} }

View file

@ -1,32 +1,31 @@
package MysticOres.Items; package mysticores.items;
import MysticOres.MysticOres; import mysticores.MysticOres;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.src.*;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemSatchel extends Item public class ItemSatchel extends Item {
{ public ItemSatchel(int par1) {
public ItemSatchel(int par1)
{
super(par1); super(par1);
setCreativeTab(MysticOres.MysticOresTab); setCreativeTab(MysticOres.MysticOresTab);
maxStackSize = 1; maxStackSize = 1;
} }
@Override @Override
public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer player) @SideOnly(Side.CLIENT)
{ public boolean hasEffect(ItemStack par1ItemStack) {
if(!player.isSneaking()) return true;
{ }
@Override
public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer player) {
if (!player.isSneaking()) {
IInventory inv; IInventory inv;
inv = player.getInventoryEnderChest(); inv = player.getInventoryEnderChest();
player.displayGUIChest(inv); player.displayGUIChest(inv);
@ -34,15 +33,8 @@ public class ItemSatchel extends Item
return is; return is;
} }
@SideOnly(Side.CLIENT)
public boolean hasEffect(ItemStack par1ItemStack)
{
return true;
}
@Override @Override
public void registerIcons(IconRegister iconRegister) public void registerIcons(IconRegister iconRegister) {
{
itemIcon = iconRegister.registerIcon("MysticMods" + ":" + this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1)); itemIcon = iconRegister.registerIcon("MysticMods" + ":" + this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1));
} }
} }

View file

@ -1,28 +1,18 @@
package MysticOres.Items; package mysticores.items;
import MysticOres.MysticOres; import mysticores.MysticOres;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
public class ItemShovels extends ItemSpade public class ItemShovels extends ItemSpade {
{ public ItemShovels(int par1, EnumToolMaterial par2EnumToolMaterial) {
public ItemShovels(int par1, EnumToolMaterial par2EnumToolMaterial)
{
super(par1, par2EnumToolMaterial); super(par1, par2EnumToolMaterial);
this.setCreativeTab(MysticOres.MysticOresTab); this.setCreativeTab(MysticOres.MysticOresTab);
} }
@Override @Override
public void registerIcons(IconRegister iconRegister) public void registerIcons(IconRegister iconRegister) {
{
itemIcon = iconRegister.registerIcon("MysticMods" + ":" + this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1)); itemIcon = iconRegister.registerIcon("MysticMods" + ":" + this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1));
} }
} }

View file

@ -1,21 +1,18 @@
package MysticOres.Items; package mysticores.items;
import mysticores.MysticOres;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemSword; import net.minecraft.item.ItemSword;
import MysticOres.MysticOres;
public class ItemSwords extends ItemSword public class ItemSwords extends ItemSword {
{ public ItemSwords(int par1, EnumToolMaterial par2EnumToolMaterial) {
public ItemSwords(int par1, EnumToolMaterial par2EnumToolMaterial)
{
super(par1, par2EnumToolMaterial); super(par1, par2EnumToolMaterial);
setCreativeTab(MysticOres.MysticOresTab); setCreativeTab(MysticOres.MysticOresTab);
} }
@Override @Override
public void registerIcons(IconRegister iconRegister) public void registerIcons(IconRegister iconRegister) {
{
itemIcon = iconRegister.registerIcon("MysticMods" + ":" + this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1)); itemIcon = iconRegister.registerIcon("MysticMods" + ":" + this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1));
} }
} }

View file

@ -1,11 +1,9 @@
package MysticOres.Items; package mysticores.items;
import mysticores.lib.ItemID;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import MysticOres.Lib.ItemID;
import MysticOres.Util.ConfigurationManager;
public class Items public class Items {
{
public static Item VerditeSword; public static Item VerditeSword;
public static Item VerditePickaxe; public static Item VerditePickaxe;
public static Item VerditeShovel; public static Item VerditeShovel;
@ -36,14 +34,11 @@ public class Items
public static Item ObsidianShovel; public static Item ObsidianShovel;
public static Item ObsidianAxe; public static Item ObsidianAxe;
public static Item ObsidianHoe; public static Item ObsidianHoe;
public static Item Resource; public static Item Resource;
public static Item Satchel; public static Item Satchel;
public static void Initialize() public static void initialize() {
{
Resource = new ItemResource(ItemID.RESOURCES); Resource = new ItemResource(ItemID.RESOURCES);
VerditeSword = new ItemSwords(ItemID.VERDITESWORD, EnumTools.verditeToolMaterial).setUnlocalizedName("VerditeSword"); VerditeSword = new ItemSwords(ItemID.VERDITESWORD, EnumTools.verditeToolMaterial).setUnlocalizedName("VerditeSword");
VerditePickaxe = new ItemPickaxes(ItemID.VERDITEPICKAXE, EnumTools.verditeToolMaterial).setUnlocalizedName("VerditePickaxe"); VerditePickaxe = new ItemPickaxes(ItemID.VERDITEPICKAXE, EnumTools.verditeToolMaterial).setUnlocalizedName("VerditePickaxe");
VerditeShovel = new ItemShovels(ItemID.VERDITESHOVEL, EnumTools.verditeToolMaterial).setUnlocalizedName("VerditeShovel"); VerditeShovel = new ItemShovels(ItemID.VERDITESHOVEL, EnumTools.verditeToolMaterial).setUnlocalizedName("VerditeShovel");

View file

@ -1,8 +0,0 @@
package MysticOres.Lib;
public class BlockID
{
public static int BASEID;
public static int BASEID_DEFAULT = 540;
}

View file

@ -1,71 +1,36 @@
package MysticOres.Lib; package mysticores.lib;
public class ItemID
{
public static int VERDITESWORD;
public static int VERDITEPICKAXE;
public static int VERDITESHOVEL;
public static int VERDITEAXE;
public static int VERDITEHOE;
public static int MITHRILSWORD;
public static int MITHRILPICKAXE;
public static int MITHRILSHOVEL;
public static int MITHRILAXE;
public static int MITHRILHOE;
public static int ADAMANTINESWORD;
public static int ADAMANTINEPICKAXE;
public static int ADAMANTINESHOVEL;
public static int ADAMANTINEAXE;
public static int ADAMANTINEHOE;
public static int IRIDIUMSWORD;
public static int IRIDIUMPICKAXE;
public static int IRIDIUMSHOVEL;
public static int IRIDIUMAXE;
public static int IRIDIUMHOE;
public static int OBSIDIANSWORD;
public static int OBSIDIANPICKAXE;
public static int OBSIDIANSHOVEL;
public static int OBSIDIANAXE;
public static int OBSIDIANHOE;
public static int BLOODSTONESWORD;
public static int BLOODSTONEPICKAXE;
public static int BLOODSTONESHOVEL;
public static int BLOODSTONEAXE;
public static int BLOODSTONEHOE;
public static int SATCHEL;
public static int RESOURCES;
public static int VERDITESWORD_DEFAULT = 7050;
public static int VERDITEPICKAXE_DEFAULT = 7051;
public static int VERDITESHOVEL_DEFAULT = 7052;
public static int VERDITEAXE_DEFAULT = 7053;
public static int VERDITEHOE_DEFAULT = 7054;
public static int MITHRILSWORD_DEFAULT = 7055;
public static int MITHRILPICKAXE_DEFAULT = 7056;
public static int MITHRILSHOVEL_DEFAULT = 7057;
public static int MITHRILAXE_DEFAULT = 7058;
public static int MITHRILHOE_DEFAULT = 7059;
public static int ADAMANTINESWORD_DEFAULT = 7060;
public static int ADAMANTINEPICKAXE_DEFAULT = 7061;
public static int ADAMANTINESHOVEL_DEFAULT = 7062;
public static int ADAMANTINEAXE_DEFAULT = 7063;
public static int ADAMANTINEHOE_DEFAULT = 7064;
public static int IRIDIUMSWORD_DEFAULT = 7065;
public static int IRIDIUMPICKAXE_DEFAULT = 7066;
public static int IRIDIUMSHOVEL_DEFAULT = 7067;
public static int IRIDIUMAXE_DEFAULT = 7068;
public static int IRIDIUMHOE_DEFAULT = 7069;
public static int OBSIDIANSWORD_DEFAULT = 7070;
public static int OBSIDIANPICKAXE_DEFAULT = 7071;
public static int OBSIDIANSHOVEL_DEFAULT = 7072;
public static int OBSIDIANAXE_DEFAULT = 7073;
public static int OBSIDIANHOE_DEFAULT = 7074;
public static int BLOODSTONESWORD_DEFAULT = 7075;
public static int BLOODSTONEPICKAXE_DEFAULT = 7076;
public static int BLOODSTONESHOVEL_DEFAULT = 7077;
public static int BLOODSTONEAXE_DEFAULT = 7078;
public static int BLOODSTONEHOE_DEFAULT = 7079;
public static int SATCHEL_DEFAULT = 7080;
public static int RESOURCES_DEFAULT = 7081;
public class ItemID {
public static int VERDITESWORD = 7050;
public static int VERDITEPICKAXE = 7051;
public static int VERDITESHOVEL = 7052;
public static int VERDITEAXE = 7053;
public static int VERDITEHOE = 7054;
public static int MITHRILSWORD = 7055;
public static int MITHRILPICKAXE = 7056;
public static int MITHRILSHOVEL = 7057;
public static int MITHRILAXE = 7058;
public static int MITHRILHOE = 7059;
public static int ADAMANTINESWORD = 7060;
public static int ADAMANTINEPICKAXE = 7061;
public static int ADAMANTINESHOVEL = 7062;
public static int ADAMANTINEAXE = 7063;
public static int ADAMANTINEHOE = 7064;
public static int IRIDIUMSWORD = 7065;
public static int IRIDIUMPICKAXE = 7066;
public static int IRIDIUMSHOVEL = 7067;
public static int IRIDIUMAXE = 7068;
public static int IRIDIUMHOE = 7069;
public static int OBSIDIANSWORD = 7070;
public static int OBSIDIANPICKAXE = 7071;
public static int OBSIDIANSHOVEL = 7072;
public static int OBSIDIANAXE = 7073;
public static int OBSIDIANHOE = 7074;
public static int BLOODSTONESWORD = 7075;
public static int BLOODSTONEPICKAXE = 7076;
public static int BLOODSTONESHOVEL = 7077;
public static int BLOODSTONEAXE = 7078;
public static int BLOODSTONEHOE = 7079;
public static int SATCHEL = 7080;
public static int RESOURCES = 7081;
} }

View file

@ -1,30 +1,16 @@
package MysticOres.Lib; package mysticores.lib;
public class Rarity public class Rarity {
{ public static int VERDITE = 10;
public static int VERDITE; public static int MITHRIL = 3;
public static int MITHRIL; public static int ADAMANTINE = 2;
public static int ADAMANTINE; public static int IRIDIUM = 2;
public static int IRIDIUM; public static int AGATE = 3;
public static int AGATE; public static int AMETHYST = 3;
public static int AMETHYST; public static int TOPAZ = 3;
public static int TOPAZ; public static int TOURMALINE = 3;
public static int TOURMALINE; public static int BLOODSTONE = 2;
public static int BLOODSTONE; public static int REDSOULSTONE = 3;
public static int REDSOULSTONE; public static int BLUESOULSTONE = 2;
public static int BLUESOULSTONE; public static int BLACKSOULSTONE = 3;
public static int BLACKSOULSTONE;
public static int VERDITE_DEFAULT = 10;
public static int MITHRIL_DEFAULT = 3;
public static int ADAMANTINE_DEFAULT = 2;
public static int IRIDIUM_DEFAULT = 2;
public static int AGATE_DEFAULT = 3;
public static int AMETHYST_DEFAULT = 3;
public static int TOPAZ_DEFAULT = 3;
public static int TOURMALINE_DEFAULT = 3;
public static int BLOODSTONE_DEFAULT = 2;
public static int REDSOULSTONE_DEFAULT = 3;
public static int BLUESOULSTONE_DEFAULT = 2;
public static int BLACKSOULSTONE_DEFAULT = 3;
} }

View file

@ -1,5 +0,0 @@
package MysticOres.Lib;
public class Strings {
}

View file

@ -1,17 +1,16 @@
package MysticOres; package mysticores;
import java.io.File;
import mysticores.blocks.BlockHandler;
import mysticores.items.Items;
import mysticores.util.ConfigurationManager;
import mysticores.util.Localizations;
import mysticores.util.OreDictManager;
import mysticores.util.RecipeManager;
import mysticores.util.TabMysticOres;
import mysticores.worldgen.GeneratorManager;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import MysticOres.Blocks.BlockHandler; import net.minecraft.item.ItemStack;
import MysticOres.Items.IridiumFuelHandler; import cpw.mods.fml.common.IFuelHandler;
import MysticOres.Items.Items;
import MysticOres.Util.ConfigurationManager;
import MysticOres.Util.Localizations;
import MysticOres.Util.OreDictManager;
import MysticOres.Util.RecipeManager;
import MysticOres.Util.TabMysticOres;
import MysticOres.Worldgen.GeneratorManager;
import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.Instance;
@ -19,29 +18,30 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
@Mod(modid = "Mystic Ores", name = "Mystic Ores", version = "0.1") @Mod(modid = "MysticOres", name = "Mystic Ores", version = "0.1")
@NetworkMod(clientSideRequired = true, serverSideRequired = false) @NetworkMod(clientSideRequired = true)
public class MysticOres implements IFuelHandler {
public class MysticOres @Instance("MysticOres")
{
@Instance("Mystic Ores")
public static MysticOres instance; public static MysticOres instance;
public static final CreativeTabs MysticOresTab = new TabMysticOres("MysticOresTab");
public static CreativeTabs MysticOresTab = new TabMysticOres(CreativeTabs.getNextID(), "MysticOresTab"); @Override
public int getBurnTime(ItemStack fuel) {
if (fuel.getItem().itemID == Items.Resource.itemID && fuel.getItemDamage() == 4)
return 12800;
else
return 0;
}
@EventHandler @EventHandler
public void preInit(FMLPreInitializationEvent event) public void preInit(FMLPreInitializationEvent event) {
{ ConfigurationManager.initialize(event.getSuggestedConfigurationFile());
ConfigurationManager.initialize(new File(event.getModConfigurationDirectory(), "Mystic Mods/Mystic Ores.cfg")); BlockHandler.initialize();
ConfigurationManager.save(); Items.initialize();
OreDictManager.initialize();
BlockHandler.Initialize(); RecipeManager.initialize();
Items.Initialize(); GeneratorManager.initialize();
RecipeManager.Initialize(); Localizations.initialize();
OreDictManager.Initialize(); GameRegistry.registerFuelHandler(this);
GeneratorManager.Initialize();
Localizations.Initialize();
GameRegistry.registerFuelHandler(new IridiumFuelHandler());
} }
} }

View file

@ -1,72 +1,59 @@
package MysticOres.Util; package mysticores.util;
import java.io.File; import java.io.File;
import mysticores.blocks.BlockHandler;
import mysticores.lib.ItemID;
import mysticores.lib.Rarity;
import net.minecraftforge.common.Configuration; import net.minecraftforge.common.Configuration;
import MysticOres.Lib.BlockID;
import MysticOres.Lib.ItemID;
import MysticOres.Lib.Rarity;
public class ConfigurationManager public class ConfigurationManager {
{ public static void initialize(File file) {
public static Configuration config; Configuration config = new Configuration(file);
ItemID.RESOURCES = config.getItem("Resource Items", ItemID.RESOURCES).getInt();
public static void initialize(File file) ItemID.VERDITESWORD = config.getItem("Tools", "Verdite Sword", ItemID.VERDITESWORD).getInt();
{ ItemID.VERDITEPICKAXE = config.getItem("Tools", "Verdite Pickaxe", ItemID.VERDITEPICKAXE).getInt();
config = new Configuration(file); ItemID.VERDITESHOVEL = config.getItem("Tools", "Verdite Shovel", ItemID.VERDITESHOVEL).getInt();
ItemID.VERDITEAXE = config.getItem("Tools", "Verdite Axe", ItemID.VERDITEAXE).getInt();
ItemID.RESOURCES = config.getItem("Resource Items", ItemID.RESOURCES_DEFAULT).getInt(); ItemID.VERDITEHOE = config.getItem("Tools", "Verdite Hoe", ItemID.VERDITEHOE).getInt();
ItemID.VERDITESWORD = config.getItem("Tools", "Verdite Sword", ItemID.VERDITESWORD_DEFAULT).getInt(); ItemID.MITHRILSWORD = config.getItem("Tools", "Mithril Sword", ItemID.MITHRILSWORD).getInt();
ItemID.VERDITEPICKAXE = config.getItem("Tools", "Verdite Pickaxe", ItemID.VERDITEPICKAXE_DEFAULT).getInt(); ItemID.MITHRILPICKAXE = config.getItem("Tools", "Mithril Pickaxe", ItemID.MITHRILPICKAXE).getInt();
ItemID.VERDITESHOVEL = config.getItem("Tools", "Verdite Shovel", ItemID.VERDITESHOVEL_DEFAULT).getInt(); ItemID.MITHRILSHOVEL = config.getItem("Tools", "Mithril Shovel", ItemID.MITHRILSHOVEL).getInt();
ItemID.VERDITEAXE = config.getItem("Tools", "Verdite Axe", ItemID.VERDITEAXE_DEFAULT).getInt(); ItemID.MITHRILAXE = config.getItem("Tools", "Mithril Axe", ItemID.MITHRILAXE).getInt();
ItemID.VERDITEHOE = config.getItem("Tools", "Verdite Hoe", ItemID.VERDITEHOE_DEFAULT).getInt(); ItemID.MITHRILHOE = config.getItem("Tools", "Mithril Hoe", ItemID.MITHRILHOE).getInt();
ItemID.MITHRILSWORD = config.getItem("Tools", "Mithril Sword", ItemID.MITHRILSWORD_DEFAULT).getInt(); ItemID.ADAMANTINESWORD = config.getItem("Tools", "Adamantine Sword", ItemID.ADAMANTINESWORD).getInt();
ItemID.MITHRILPICKAXE = config.getItem("Tools", "Mithril Pickaxe", ItemID.MITHRILPICKAXE_DEFAULT).getInt(); ItemID.ADAMANTINEPICKAXE = config.getItem("Tools", "Adamantine Pickaxe", ItemID.ADAMANTINEPICKAXE).getInt();
ItemID.MITHRILSHOVEL = config.getItem("Tools", "Mithril Shovel", ItemID.MITHRILSHOVEL_DEFAULT).getInt(); ItemID.ADAMANTINESHOVEL = config.getItem("Tools", "Adamantine Shovel", ItemID.ADAMANTINESHOVEL).getInt();
ItemID.MITHRILAXE = config.getItem("Tools", "Mithril Axe", ItemID.MITHRILAXE_DEFAULT).getInt(); ItemID.ADAMANTINEAXE = config.getItem("Tools", "Adamantine Axe", ItemID.ADAMANTINEAXE).getInt();
ItemID.MITHRILHOE = config.getItem("Tools", "Mithril Hoe", ItemID.MITHRILHOE_DEFAULT).getInt(); ItemID.ADAMANTINEHOE = config.getItem("Tools", "Adamantine Hoe", ItemID.ADAMANTINEHOE).getInt();
ItemID.ADAMANTINESWORD = config.getItem("Tools", "Adamantine Sword", ItemID.ADAMANTINESWORD_DEFAULT).getInt(); ItemID.IRIDIUMSWORD = config.getItem("Tools", "Iridium Sword", ItemID.IRIDIUMSWORD).getInt();
ItemID.ADAMANTINEPICKAXE = config.getItem("Tools", "Adamantine Pickaxe", ItemID.ADAMANTINEPICKAXE_DEFAULT).getInt(); ItemID.IRIDIUMPICKAXE = config.getItem("Tools", "Iridium Pickaxe", ItemID.IRIDIUMPICKAXE).getInt();
ItemID.ADAMANTINESHOVEL = config.getItem("Tools", "Adamantine Shovel", ItemID.ADAMANTINESHOVEL_DEFAULT).getInt(); ItemID.IRIDIUMSHOVEL = config.getItem("Tools", "Iridium Shovel", ItemID.IRIDIUMSHOVEL).getInt();
ItemID.ADAMANTINEAXE = config.getItem("Tools", "Adamantine Axe", ItemID.ADAMANTINEAXE_DEFAULT).getInt(); ItemID.IRIDIUMAXE = config.getItem("Tools", "Iridium Axe", ItemID.IRIDIUMAXE).getInt();
ItemID.ADAMANTINEHOE = config.getItem("Tools", "Adamantine Hoe", ItemID.ADAMANTINEHOE_DEFAULT).getInt(); ItemID.IRIDIUMHOE = config.getItem("Tools", "Iridium Hoe", ItemID.IRIDIUMHOE).getInt();
ItemID.IRIDIUMSWORD = config.getItem("Tools", "Iridium Sword", ItemID.IRIDIUMSWORD_DEFAULT).getInt(); ItemID.BLOODSTONESWORD = config.getItem("Tools", "Bloodstone Sword", ItemID.BLOODSTONESWORD).getInt();
ItemID.IRIDIUMPICKAXE = config.getItem("Tools", "Iridium Pickaxe", ItemID.IRIDIUMPICKAXE_DEFAULT).getInt(); ItemID.BLOODSTONEPICKAXE = config.getItem("Tools", "Bloodstone Pickaxe", ItemID.BLOODSTONEPICKAXE).getInt();
ItemID.IRIDIUMSHOVEL = config.getItem("Tools", "Iridium Shovel", ItemID.IRIDIUMSHOVEL_DEFAULT).getInt(); ItemID.BLOODSTONESHOVEL = config.getItem("Tools", "Bloodstone Shovel", ItemID.BLOODSTONESHOVEL).getInt();
ItemID.IRIDIUMAXE = config.getItem("Tools", "Iridium Axe", ItemID.IRIDIUMAXE_DEFAULT).getInt(); ItemID.BLOODSTONEAXE = config.getItem("Tools", "Bloodstone Axe", ItemID.BLOODSTONEAXE).getInt();
ItemID.IRIDIUMHOE = config.getItem("Tools", "Iridium Hoe", ItemID.IRIDIUMHOE_DEFAULT).getInt(); ItemID.BLOODSTONEHOE = config.getItem("Tools", "Bloodstone Hoe", ItemID.BLOODSTONEHOE).getInt();
ItemID.BLOODSTONESWORD = config.getItem("Tools", "Bloodstone Sword", ItemID.BLOODSTONESWORD_DEFAULT).getInt(); ItemID.OBSIDIANSWORD = config.getItem("Tools", "Obsidian Sword", ItemID.OBSIDIANSWORD).getInt();
ItemID.BLOODSTONEPICKAXE = config.getItem("Tools", "Bloodstone Pickaxe", ItemID.BLOODSTONEPICKAXE_DEFAULT).getInt(); ItemID.OBSIDIANPICKAXE = config.getItem("Tools", "Obsidian Pickaxe", ItemID.OBSIDIANPICKAXE).getInt();
ItemID.BLOODSTONESHOVEL = config.getItem("Tools", "Bloodstone Shovel", ItemID.BLOODSTONESHOVEL_DEFAULT).getInt(); ItemID.OBSIDIANSHOVEL = config.getItem("Tools", "Obsidian Shovel", ItemID.OBSIDIANSHOVEL).getInt();
ItemID.BLOODSTONEAXE = config.getItem("Tools", "Bloodstone Axe", ItemID.BLOODSTONEAXE_DEFAULT).getInt(); ItemID.OBSIDIANAXE = config.getItem("Tools", "Obsidian Axe", ItemID.OBSIDIANAXE).getInt();
ItemID.BLOODSTONEHOE = config.getItem("Tools", "Bloodstone Hoe", ItemID.BLOODSTONEHOE_DEFAULT).getInt(); ItemID.OBSIDIANHOE = config.getItem("Tools", "Obsidian Hoe", ItemID.OBSIDIANHOE).getInt();
ItemID.OBSIDIANSWORD = config.getItem("Tools", "Obsidian Sword", ItemID.OBSIDIANSWORD_DEFAULT).getInt(); ItemID.SATCHEL = config.getItem("Satchel ID", ItemID.SATCHEL).getInt();
ItemID.OBSIDIANPICKAXE = config.getItem("Tools", "Obsidian Pickaxe", ItemID.OBSIDIANPICKAXE_DEFAULT).getInt(); BlockHandler.BASEID = config.getBlock("Base Block ID", BlockHandler.BASEID).getInt();
ItemID.OBSIDIANSHOVEL = config.getItem("Tools", "Obsidian Shovel", ItemID.OBSIDIANSHOVEL_DEFAULT).getInt(); Rarity.VERDITE = config.get("Ore Rarity", "Verdite Ore", Rarity.VERDITE).getInt();
ItemID.OBSIDIANAXE = config.getItem("Tools", "Obsidian Axe", ItemID.OBSIDIANAXE_DEFAULT).getInt(); Rarity.MITHRIL = config.get("Ore Rarity", "Mithril Ore", Rarity.MITHRIL).getInt();
ItemID.OBSIDIANHOE = config.getItem("Tools", "Obsidian Hoe", ItemID.OBSIDIANHOE_DEFAULT).getInt(); Rarity.ADAMANTINE = config.get("Ore Rarity", "Adamantine Ore", Rarity.ADAMANTINE).getInt();
ItemID.SATCHEL = config.getItem("Satchel ID", ItemID.SATCHEL_DEFAULT).getInt(); Rarity.IRIDIUM = config.get("Ore Rarity", "Iridium Ore", Rarity.IRIDIUM).getInt();
Rarity.AGATE = config.get("Ore Rarity", "Agate Ore", Rarity.AGATE).getInt();
BlockID.BASEID = config.getBlock("Base Block ID", BlockID.BASEID_DEFAULT).getInt(); Rarity.AMETHYST = config.get("Ore Rarity", "Amethyst Ore", Rarity.AMETHYST).getInt();
Rarity.TOPAZ = config.get("Ore Rarity", "Topaz Ore", Rarity.TOPAZ).getInt();
Rarity.VERDITE = config.get("Ore Rarity", "Verdite Ore", Rarity.VERDITE_DEFAULT).getInt(); Rarity.BLOODSTONE = config.get("Nether Ore Rarity", "Bloodstone", Rarity.BLOODSTONE).getInt();
Rarity.MITHRIL = config.get("Ore Rarity", "Mithril Ore", Rarity.MITHRIL_DEFAULT).getInt(); Rarity.REDSOULSTONE = config.get("Nether Ore Rarity", "Red Soulstone", Rarity.REDSOULSTONE).getInt();
Rarity.ADAMANTINE = config.get("Ore Rarity", "Adamantine Ore", Rarity.ADAMANTINE_DEFAULT).getInt(); Rarity.BLACKSOULSTONE = config.get("Nether Ore Rarity", "Black Soulstone", Rarity.BLACKSOULSTONE).getInt();
Rarity.IRIDIUM = config.get("Ore Rarity", "Iridium Ore", Rarity.IRIDIUM_DEFAULT).getInt(); Rarity.BLUESOULSTONE = config.get("Nether Ore Rarity", "Blue Soulstone", Rarity.BLUESOULSTONE).getInt();
Rarity.AGATE = config.get("Ore Rarity", "Agate Ore", Rarity.AGATE_DEFAULT).getInt();
Rarity.AMETHYST = config.get("Ore Rarity", "Amethyst Ore", Rarity.AMETHYST_DEFAULT).getInt();
Rarity.TOPAZ = config.get("Ore Rarity", "Topaz Ore", Rarity.TOPAZ_DEFAULT).getInt();
Rarity.BLOODSTONE = config.get("Nether Ore Rarity", "Bloodstone", Rarity.BLOODSTONE_DEFAULT).getInt();
Rarity.REDSOULSTONE = config.get("Nether Ore Rarity", "Red Soulstone", Rarity.REDSOULSTONE_DEFAULT).getInt();
Rarity.BLACKSOULSTONE = config.get("Nether Ore Rarity", "Black Soulstone", Rarity.BLACKSOULSTONE_DEFAULT).getInt();
Rarity.BLUESOULSTONE = config.get("Nether Ore Rarity", "Blue Soulstone", Rarity.BLUESOULSTONE_DEFAULT).getInt();
config.save();
}
public static void save()
{
config.save(); config.save();
} }
} }

View file

@ -1,4 +1,4 @@
package MysticOres.Util; package mysticores.util;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -11,9 +11,10 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipException; import java.util.zip.ZipException;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
import MysticOres.MysticOres; import mysticores.MysticOres;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.common.registry.LanguageRegistry;
/* /*
* *
* All credits go to copygirl (or copy....boy) for this one * All credits go to copygirl (or copy....boy) for this one
@ -21,17 +22,14 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
* repository, many thanks friend c: * repository, many thanks friend c:
* *
*/ */
public class Localizations {
private Localizations() {
}
public class Localizations public static void initialize() {
{
private Localizations(){}
public static void Initialize()
{
File source = Loader.instance().getReversedModObjectList().get(MysticOres.instance).getSource(); File source = Loader.instance().getReversedModObjectList().get(MysticOres.instance).getSource();
Pattern pattern = Pattern.compile(".*(assets/" + "mysticmods/lang/(.+)\\.(.+))"); Pattern pattern = Pattern.compile(".*(assets/" + "mysticmods/lang/(.+)\\.(.+))");
for(String file : getResources(source, pattern)) for (String file : getResources(source, pattern)) {
{
Matcher matcher = pattern.matcher(file); Matcher matcher = pattern.matcher(file);
matcher.find(); matcher.find();
String resource = "/" + matcher.group(1); String resource = "/" + matcher.group(1);
@ -41,72 +39,57 @@ public class Localizations
} }
} }
private static Collection<String> getResources(File file, Pattern pattern) private static Collection<String> getResources(File file, Pattern pattern) {
{
ArrayList<String> retval = new ArrayList<String>(); ArrayList<String> retval = new ArrayList<String>();
if(file.isDirectory()) if (file.isDirectory())
retval.addAll(getResourcesFromDirectory(file, pattern)); retval.addAll(getResourcesFromDirectory(file, pattern));
else retval.addAll(getResourcesFromJarFile(file, pattern)); else
retval.addAll(getResourcesFromJarFile(file, pattern));
return retval; return retval;
} }
private static Collection<String> getResourcesFromJarFile(File file, Pattern pattern) private static Collection<String> getResourcesFromDirectory(File directory, Pattern pattern) {
{
ArrayList<String> retval = new ArrayList<String>();
ZipFile Zip;
try
{
Zip = new ZipFile(file);
}
catch (ZipException Ex)
{
throw new Error(Ex);
}
catch(IOException Ex)
{
throw new Error(Ex);
}
Enumeration<? extends ZipEntry> entries = Zip.entries();
while (entries.hasMoreElements())
{
ZipEntry ZipE = entries.nextElement();
String FileName = ZipE.getName();
boolean accept = pattern.matcher(FileName).matches();
if(accept)
retval.add(FileName);
}
try
{
Zip.close();
}
catch(IOException Ex)
{
throw new Error(Ex);
}
return retval;
}
private static Collection<String> getResourcesFromDirectory(File directory, Pattern pattern)
{
ArrayList<String> retval = new ArrayList<String>(); ArrayList<String> retval = new ArrayList<String>();
File[] FileList = directory.listFiles(); File[] FileList = directory.listFiles();
for (File file : FileList) for (File file : FileList) {
{ if (file.isDirectory()) {
if (file.isDirectory())
{
retval.addAll(getResourcesFromDirectory(file, pattern)); retval.addAll(getResourcesFromDirectory(file, pattern));
} } else
else try try {
{
String fileName = file.getCanonicalPath().replace('\\', '/'); String fileName = file.getCanonicalPath().replace('\\', '/');
boolean accept = pattern.matcher(fileName).matches(); boolean accept = pattern.matcher(fileName).matches();
if (accept) retval.add(fileName); if (accept)
} retval.add(fileName);
catch(final IOException e) } catch (final IOException e) {
{
throw new Error(e); throw new Error(e);
} }
} }
return retval; return retval;
} }
private static Collection<String> getResourcesFromJarFile(File file, Pattern pattern) {
ArrayList<String> retval = new ArrayList<String>();
ZipFile Zip;
try {
Zip = new ZipFile(file);
} catch (ZipException Ex) {
throw new Error(Ex);
} catch (IOException Ex) {
throw new Error(Ex);
}
Enumeration<? extends ZipEntry> entries = Zip.entries();
while (entries.hasMoreElements()) {
ZipEntry ZipE = entries.nextElement();
String FileName = ZipE.getName();
boolean accept = pattern.matcher(FileName).matches();
if (accept)
retval.add(FileName);
}
try {
Zip.close();
} catch (IOException Ex) {
throw new Error(Ex);
}
return retval;
}
} }

View file

@ -1,34 +1,22 @@
package MysticOres.Util; package mysticores.util;
import MysticOres.Blocks.BlockHandler; import mysticores.blocks.BlockHandler;
import MysticOres.Items.Items; import mysticores.items.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
public class OreDictManager public class OreDictManager {
{ public static final String[] INGOTS = { "ingotVerdite", "ingotMithril", "ingotAdamantine", "ingotIridium", "fuelIridium", "gemTourmaline", "gemAgate", "gemTopaz", "gemAmethyst", "dustMystic",
public static void Initialize() " shardBloodstone", "shardGlass", "shardObsidian", "rodObsidian" };
{ public static final String[] ORES = { "oreAdamantine", "oreAmethyst", "oreIridium", "oreMithril", "oreSapphire", "oreTopaz", "oreVerdite", "oreBloodstone", "oreBlackSoulstone",
OreDictionary.registerOre("ingotAdamantine", new ItemStack(Items.Resource, 1, 2)); "oreBlueSoulstone", "oreRedSoulstone", "oreAgate" };
OreDictionary.registerOre("ingotMithril", new ItemStack(Items.Resource, 1, 1));
OreDictionary.registerOre("ingotVerdite", new ItemStack(Items.Resource, 1, 0));
OreDictionary.registerOre("ingotIridium", new ItemStack(Items.Resource, 1, 3));
OreDictionary.registerOre("fuelIridium", new ItemStack(Items.Resource, 1, 4));
OreDictionary.registerOre("gemTourmaline", new ItemStack(Items.Resource, 1, 5));
OreDictionary.registerOre("gemTopaz", new ItemStack(Items.Resource, 1, 7));
OreDictionary.registerOre("gemAmethyst", new ItemStack(Items.Resource, 1, 8));
OreDictionary.registerOre("gemAgate", new ItemStack(Items.Resource, 1, 6));
OreDictionary.registerOre("oreAdamantine", new ItemStack(BlockHandler.BlockBase, 1, 0)); public static void initialize() {
OreDictionary.registerOre("oreAmethyst", new ItemStack(BlockHandler.BlockBase, 1, 1)); for (int i = 0; i < INGOTS.length; i++) {
OreDictionary.registerOre("oreIridium", new ItemStack(BlockHandler.BlockBase, 1, 2)); OreDictionary.registerOre(INGOTS[i], new ItemStack(Items.Resource, 1, i));
OreDictionary.registerOre("oreMithril", new ItemStack(BlockHandler.BlockBase, 1, 3)); }
OreDictionary.registerOre("oreSapphire", new ItemStack(BlockHandler.BlockBase, 1, 4)); for (int i = 0; i < ORES.length; i++) {
OreDictionary.registerOre("oreTopaz", new ItemStack(BlockHandler.BlockBase, 1, 5)); OreDictionary.registerOre(ORES[i], new ItemStack(BlockHandler.BlockBase, 1, i));
OreDictionary.registerOre("oreVerdite", new ItemStack(BlockHandler.BlockBase, 1, 6)); }
OreDictionary.registerOre("oreBloodstone", new ItemStack(BlockHandler.BlockBase, 1, 7));
OreDictionary.registerOre("oreBlackSoulstone", new ItemStack(BlockHandler.BlockBase, 1, 8));
OreDictionary.registerOre("oreBlueSoulstone", new ItemStack(BlockHandler.BlockBase, 1, 9));
OreDictionary.registerOre("oreRedSoulstone", new ItemStack(BlockHandler.BlockBase, 1, 10));
} }
} }

View file

@ -1,209 +1,110 @@
package MysticOres.Util; package mysticores.util;
import mysticores.blocks.BlockHandler;
import mysticores.items.Items;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapedOreRecipe;
import MysticOres.Blocks.BlockHandler; import net.minecraftforge.oredict.ShapelessOreRecipe;
import MysticOres.Items.Items;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
public class RecipeManager public class RecipeManager {
{ public static void initialize() {
public static void Initialize() recipes();
{ toolRecipes();
Recipes(); powderRecipes();
ToolRecipes(); smelting();
PowderRecipes();
Smelting();
} }
private static void Recipes() private static void powderRecipes() {
{ GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Block.oreGold, 2), OreDictManager.INGOTS[9], "oreGold"));
GameRegistry.addRecipe(new ItemStack(Block.glass, 1), new Object [] { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Block.oreIron, 2), OreDictManager.INGOTS[9], "oreIron"));
"##", "##", '#', new ItemStack(Items.Resource, 1, 11) GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Items.Resource, 2, 10), OreDictManager.INGOTS[9], OreDictManager.INGOTS[10]));
}); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Item.gunpowder, 2), OreDictManager.INGOTS[9], Item.gunpowder));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Items.Resource, 2, 4), OreDictManager.INGOTS[9], OreDictManager.INGOTS[4]));
GameRegistry.addRecipe(new ItemStack(Block.obsidian, 1), new Object[] { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Block.oreCoal, 2), OreDictManager.INGOTS[9], Block.oreCoal));
"##", "##", '#', new ItemStack(Items.Resource, 1, 12) GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Block.oreIron, 3), OreDictManager.INGOTS[9], "oreIron"));
}); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Block.oreGold, 3), OreDictManager.INGOTS[9], "oreGold"));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Block.oreRedstone, 2), OreDictManager.INGOTS[9], "oreRedstone"));
GameRegistry.addRecipe(new ItemStack(BlockHandler.BlockBase, 8, 7), new Object[] { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Block.oreLapis, 2), OreDictManager.INGOTS[9], "oreLapis"));
"XXX", "XOX", "XXX", Character.valueOf('X'), Block.dirt, Character.valueOf('O'), new ItemStack(Items.Resource, 1, 6) GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Block.oreDiamond, 2), OreDictManager.INGOTS[9], "oreDiamond"));
}); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Item.sugar, 18), OreDictManager.INGOTS[9], Item.sugar));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Item.redstone, 12), OreDictManager.INGOTS[9], Item.redstone));
GameRegistry.addRecipe(new ItemStack(BlockHandler.BlockBase, 16, 7), new Object[] { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Item.glowstone, 6), OreDictManager.INGOTS[9], Item.glowstone));
"XXX", "XOX", "XXX", Character.valueOf('X'), new ItemStack(BlockHandler.BlockBase, 1, 3), Character.valueOf('O'), new ItemStack(Items.Resource, 1, 6) GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Item.gunpowder, 3), OreDictManager.INGOTS[9], Item.gunpowder));
});
GameRegistry.addRecipe(new ItemStack(BlockHandler.BlockBase, 8, 3), new Object[] {
"XXX", "XOX", "XXX", Character.valueOf('X'), Block.dirt, Character.valueOf('O'), new ItemStack(Items.Resource, 1, 8)
});
GameRegistry.addRecipe(new ItemStack(BlockHandler.BlockBase, 8, 12), new Object[] {
"###", "#D#", "###", '#', new ItemStack(Items.Resource, 1, 11), 'D', new ItemStack(Items.Resource, 1, 12)
});
GameRegistry.addRecipe(new ItemStack(BlockHandler.BlockBase, 1, 7), new Object[] {
"##", "##", '#', new ItemStack(Items.Resource, 1, 10)
});
GameRegistry.addShapelessRecipe(new ItemStack(BlockHandler.BlockBase, 2, 7), new Object[] {
new ItemStack(Items.Resource, 1, 9), new ItemStack(BlockHandler.BlockBase, 1, 7)
});
GameRegistry.addShapelessRecipe(new ItemStack(BlockHandler.BlockBase, 2, 3), new Object[] {
new ItemStack(Items.Resource, 1, 9), new ItemStack(BlockHandler.BlockBase, 1, 3)
});
GameRegistry.addShapelessRecipe(new ItemStack(BlockHandler.BlockBase, 2, 0), new Object[] {
new ItemStack(Items.Resource, 1, 9), new ItemStack(BlockHandler.BlockBase, 1, 0)
});
GameRegistry.addRecipe(new ItemStack(Items.Resource, 2, 13), new Object[] {
"#", "#", '#', new ItemStack(Items.Resource, 1, 12)
});
GameRegistry.addRecipe(new ItemStack(Items.Resource, 1, 3), new Object[] {
"###", "#O#", "###", '#', new ItemStack(Items.Resource, 1, 4), 'O', new ItemStack(Items.Resource, 1, 2)
});
GameRegistry.addShapelessRecipe(new ItemStack(Items.Resource, 4, 11), new Object[] {
Block.glass
});
GameRegistry.addShapelessRecipe(new ItemStack(Items.Resource, 4, 12), new Object[] {
Block.obsidian
});
GameRegistry.addShapelessRecipe(new ItemStack(Items.Resource, 8, 9), new Object[] {
new ItemStack(Items.Resource, 1, 5), new ItemStack(Items.Resource, 1, 7), new ItemStack(Items.Resource, 1, 8), new ItemStack(Items.Resource, 1, 6)
});
} }
private static void ToolRecipes() private static void recipes() {
{ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Block.glass, 1), "##", "##", '#', OreDictManager.INGOTS[11]));
ToolRecipes.SwordRecipe(Items.VerditeSword, new ItemStack(Items.Resource, 1, 0)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Block.obsidian, 1), "##", "##", '#', OreDictManager.INGOTS[12]));
ToolRecipes.PickaxeRecipe(Items.VerditePickaxe, new ItemStack(Items.Resource, 1, 0)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockHandler.BlockBase, 8, 7), "XXX", "XOX", "XXX", Character.valueOf('X'), Block.dirt, Character.valueOf('O'),
ToolRecipes.ShovelRecipe(Items.VerditeShovel, new ItemStack(Items.Resource, 1, 0)); OreDictManager.INGOTS[6]));
ToolRecipes.AxeRecipe(Items.VerditeAxe, new ItemStack(Items.Resource, 1, 0)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockHandler.BlockBase, 16, 7), "XXX", "XOX", "XXX", Character.valueOf('X'), OreDictManager.ORES[3], Character.valueOf('O'),
ToolRecipes.HoeRecipe(Items.VerditeHoe, new ItemStack(Items.Resource, 1, 0)); OreDictManager.INGOTS[6]));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockHandler.BlockBase, 8, 3), "XXX", "XOX", "XXX", Character.valueOf('X'), Block.dirt, Character.valueOf('O'),
OreDictManager.INGOTS[8]));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockHandler.BlockBase, 8, 12), "###", "#D#", "###", '#', OreDictManager.INGOTS[11], 'D', OreDictManager.INGOTS[12]));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockHandler.BlockBase, 1, 7), "##", "##", '#', OreDictManager.INGOTS[10]));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(BlockHandler.BlockBase, 2, 7), OreDictManager.INGOTS[9], OreDictManager.ORES[7]));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(BlockHandler.BlockBase, 2, 3), OreDictManager.INGOTS[9], OreDictManager.ORES[3]));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(BlockHandler.BlockBase, 2, 0), OreDictManager.INGOTS[9], OreDictManager.ORES[0]));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.Resource, 2, 13), "#", "#", '#', OreDictManager.INGOTS[12]));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.Resource, 1, 3), "###", "#O#", "###", '#', OreDictManager.INGOTS[4], 'O', OreDictManager.INGOTS[2]));
GameRegistry.addShapelessRecipe(new ItemStack(Items.Resource, 4, 11), Block.glass);
GameRegistry.addShapelessRecipe(new ItemStack(Items.Resource, 4, 12), Block.obsidian);
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Items.Resource, 8, 9), OreDictManager.INGOTS[5], OreDictManager.INGOTS[7], OreDictManager.INGOTS[8], OreDictManager.INGOTS[6]));
}
ToolRecipes.SwordRecipe(Items.MithrilSword, new ItemStack(Items.Resource, 1, 1)); private static void smelting() {
ToolRecipes.PickaxeRecipe(Items.MithrilPickaxe, new ItemStack(Items.Resource, 1, 1)); FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 6, new ItemStack(Items.Resource, 1, 0), 0.4F);
ToolRecipes.ShovelRecipe(Items.MithrilShovel, new ItemStack(Items.Resource, 1, 1)); FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 3, new ItemStack(Items.Resource, 1, 1), 0.7F);
ToolRecipes.AxeRecipe(Items.MithrilAxe, new ItemStack(Items.Resource, 1, 1)); FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 0, new ItemStack(Items.Resource, 1, 2), 0.9F);
ToolRecipes.HoeRecipe(Items.MithrilHoe, new ItemStack(Items.Resource, 1, 1)); FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 2, new ItemStack(Items.Resource, 1, 4), 0.4F);
FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 4, new ItemStack(Items.Resource, 1, 5), 0.4F);
ToolRecipes.AdvancedSwordRecipe(Items.AdamantineSword, new ItemStack(Items.Resource, 1, 2)); FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 11, new ItemStack(Items.Resource, 1, 6), 0.4F);
ToolRecipes.AdvancedPickaxeRecipe(Items.AdamantinePickaxe, new ItemStack(Items.Resource, 1, 2)); FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 5, new ItemStack(Items.Resource, 1, 7), 0.4F);
ToolRecipes.AdvancedShovelRecipe(Items.AdamantineShovel, new ItemStack(Items.Resource, 1, 2)); FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 1, new ItemStack(Items.Resource, 1, 8), 0.4F);
ToolRecipes.AdvancedAxeRecipe(Items.AdamantineAxe, new ItemStack(Items.Resource, 1, 2)); FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 7, new ItemStack(Items.Resource, 1, 10), 0.4F);
ToolRecipes.AdvancedHoeRecipe(Items.AdamantineHoe, new ItemStack(Items.Resource, 1, 2)); }
ToolRecipes.AdvancedSwordRecipe(Items.IridiumSword, new ItemStack(Items.Resource, 1, 3));
ToolRecipes.AdvancedPickaxeRecipe(Items.IridiumPickaxe, new ItemStack(Items.Resource, 1, 3));
ToolRecipes.AdvancedShovelRecipe(Items.IridiumShovel, new ItemStack(Items.Resource, 1, 3));
ToolRecipes.AdvancedAxeRecipe(Items.IridiumAxe, new ItemStack(Items.Resource, 1, 3));
ToolRecipes.AdvancedHoeRecipe(Items.IridiumHoe, new ItemStack(Items.Resource, 1, 3));
ToolRecipes.AdvancedSwordRecipe(Items.IridiumSword, new ItemStack(Items.Resource, 1, 3));
ToolRecipes.AdvancedPickaxeRecipe(Items.IridiumPickaxe, new ItemStack(Items.Resource, 1, 3));
ToolRecipes.AdvancedShovelRecipe(Items.IridiumShovel, new ItemStack(Items.Resource, 1, 3));
ToolRecipes.AdvancedAxeRecipe(Items.IridiumAxe, new ItemStack(Items.Resource, 1, 3));
ToolRecipes.AdvancedHoeRecipe(Items.IridiumHoe, new ItemStack(Items.Resource, 1, 3));
private static void toolRecipes() {
ToolRecipes.SwordRecipe(Items.VerditeSword, OreDictManager.INGOTS[0]);
ToolRecipes.PickaxeRecipe(Items.VerditePickaxe, OreDictManager.INGOTS[0]);
ToolRecipes.ShovelRecipe(Items.VerditeShovel, OreDictManager.INGOTS[0]);
ToolRecipes.AxeRecipe(Items.VerditeAxe, OreDictManager.INGOTS[0]);
ToolRecipes.HoeRecipe(Items.VerditeHoe, OreDictManager.INGOTS[0]);
ToolRecipes.SwordRecipe(Items.MithrilSword, OreDictManager.INGOTS[1]);
ToolRecipes.PickaxeRecipe(Items.MithrilPickaxe, OreDictManager.INGOTS[1]);
ToolRecipes.ShovelRecipe(Items.MithrilShovel, OreDictManager.INGOTS[1]);
ToolRecipes.AxeRecipe(Items.MithrilAxe, OreDictManager.INGOTS[1]);
ToolRecipes.HoeRecipe(Items.MithrilHoe, OreDictManager.INGOTS[1]);
ToolRecipes.AdvancedSwordRecipe(Items.AdamantineSword, OreDictManager.INGOTS[2]);
ToolRecipes.AdvancedPickaxeRecipe(Items.AdamantinePickaxe, OreDictManager.INGOTS[2]);
ToolRecipes.AdvancedShovelRecipe(Items.AdamantineShovel, OreDictManager.INGOTS[2]);
ToolRecipes.AdvancedAxeRecipe(Items.AdamantineAxe, OreDictManager.INGOTS[2]);
ToolRecipes.AdvancedHoeRecipe(Items.AdamantineHoe, OreDictManager.INGOTS[2]);
ToolRecipes.AdvancedSwordRecipe(Items.IridiumSword, OreDictManager.INGOTS[3]);
ToolRecipes.AdvancedPickaxeRecipe(Items.IridiumPickaxe, OreDictManager.INGOTS[3]);
ToolRecipes.AdvancedShovelRecipe(Items.IridiumShovel, OreDictManager.INGOTS[3]);
ToolRecipes.AdvancedAxeRecipe(Items.IridiumAxe, OreDictManager.INGOTS[3]);
ToolRecipes.AdvancedHoeRecipe(Items.IridiumHoe, OreDictManager.INGOTS[3]);
ToolRecipes.AdvancedSwordRecipe(Items.IridiumSword, OreDictManager.INGOTS[3]);
ToolRecipes.AdvancedPickaxeRecipe(Items.IridiumPickaxe, OreDictManager.INGOTS[3]);
ToolRecipes.AdvancedShovelRecipe(Items.IridiumShovel, OreDictManager.INGOTS[3]);
ToolRecipes.AdvancedAxeRecipe(Items.IridiumAxe, OreDictManager.INGOTS[3]);
ToolRecipes.AdvancedHoeRecipe(Items.IridiumHoe, OreDictManager.INGOTS[3]);
ToolRecipes.AdvancedSwordRecipe(Items.ObsidianSword, new ItemStack(Block.obsidian)); ToolRecipes.AdvancedSwordRecipe(Items.ObsidianSword, new ItemStack(Block.obsidian));
ToolRecipes.AdvancedPickaxeRecipe(Items.ObsidianPickaxe, new ItemStack(Block.obsidian)); ToolRecipes.AdvancedPickaxeRecipe(Items.ObsidianPickaxe, new ItemStack(Block.obsidian));
ToolRecipes.AdvancedShovelRecipe(Items.ObsidianShovel, new ItemStack(Block.obsidian)); ToolRecipes.AdvancedShovelRecipe(Items.ObsidianShovel, new ItemStack(Block.obsidian));
ToolRecipes.AdvancedAxeRecipe(Items.ObsidianAxe, new ItemStack(Block.obsidian)); ToolRecipes.AdvancedAxeRecipe(Items.ObsidianAxe, new ItemStack(Block.obsidian));
ToolRecipes.AdvancedHoeRecipe(Items.ObsidianHoe, new ItemStack(Block.obsidian)); ToolRecipes.AdvancedHoeRecipe(Items.ObsidianHoe, new ItemStack(Block.obsidian));
ToolRecipes.AdvancedSwordRecipe(Items.BloodstoneSword, OreDictManager.ORES[7]);
ToolRecipes.AdvancedSwordRecipe(Items.BloodstoneSword, new ItemStack(BlockHandler.BlockBase, 1, 7)); ToolRecipes.AdvancedPickaxeRecipe(Items.BloodstonePickaxe, OreDictManager.ORES[7]);
ToolRecipes.AdvancedPickaxeRecipe(Items.BloodstonePickaxe, new ItemStack(BlockHandler.BlockBase, 1, 7)); ToolRecipes.AdvancedShovelRecipe(Items.BloodstoneShovel, OreDictManager.ORES[7]);
ToolRecipes.AdvancedShovelRecipe(Items.BloodstoneShovel, new ItemStack(BlockHandler.BlockBase, 1, 7)); ToolRecipes.AdvancedAxeRecipe(Items.BloodstoneAxe, OreDictManager.ORES[7]);
ToolRecipes.AdvancedAxeRecipe(Items.BloodstoneAxe, new ItemStack(BlockHandler.BlockBase, 1, 7)); ToolRecipes.AdvancedHoeRecipe(Items.BloodstoneHoe, OreDictManager.ORES[7]);
ToolRecipes.AdvancedHoeRecipe(Items.BloodstoneHoe, new ItemStack(BlockHandler.BlockBase, 1, 7)); GameRegistry.addRecipe(new ItemStack(Items.Satchel, 1), "#$#", "$%$", "#$#", '#', Item.silk, '$', OreDictManager.INGOTS[9], '%', Block.enderChest);
GameRegistry.addRecipe(new ItemStack(Items.Satchel, 1), new Object[] {
"#$#", "$%$", "#$#", '#', Item.silk, '$', new ItemStack(Items.Resource, 1, 9), '%', Block.enderChest
});
}
private static void PowderRecipes()
{
GameRegistry.addShapelessRecipe(new ItemStack(Block.oreGold, 2), new Object[] {
new ItemStack(Items.Resource, 1, 9), Block.oreGold
});
GameRegistry.addShapelessRecipe(new ItemStack(Block.oreIron, 2), new Object[] {
new ItemStack(Items.Resource, 1, 9), Block.oreIron
});
GameRegistry.addShapelessRecipe(new ItemStack(Items.Resource, 2, 10), new Object[] {
new ItemStack(Items.Resource, 1, 9), new ItemStack(Items.Resource, 1, 10)
});
GameRegistry.addShapelessRecipe(new ItemStack(Item.gunpowder, 2), new Object[] {
new ItemStack(Items.Resource, 1, 9), Item.gunpowder
});
GameRegistry.addShapelessRecipe(new ItemStack(Items.Resource, 2, 4), new Object[] {
new ItemStack(Items.Resource, 1, 9), new ItemStack(Items.Resource, 1, 4)
});
GameRegistry.addShapelessRecipe(new ItemStack(Block.oreCoal, 2), new Object[] {
new ItemStack(Items.Resource, 1, 9), Block.oreCoal
});
GameRegistry.addShapelessRecipe(new ItemStack(Block.oreIron, 3), new Object[] {
new ItemStack(Items.Resource, 1, 9), Block.oreIron
});
GameRegistry.addShapelessRecipe(new ItemStack(Block.oreGold, 3), new Object[] {
new ItemStack(Items.Resource, 1, 9), Block.oreGold
});
GameRegistry.addShapelessRecipe(new ItemStack(Block.oreRedstone, 2), new Object[] {
new ItemStack(Items.Resource, 1, 9), Block.oreRedstone
});
GameRegistry.addShapelessRecipe(new ItemStack(Block.oreLapis, 2), new Object[] {
new ItemStack(Items.Resource, 1, 9), Block.oreLapis
});
GameRegistry.addShapelessRecipe(new ItemStack(Block.oreDiamond, 2), new Object[] {
new ItemStack(Items.Resource, 1, 9), Block.oreDiamond
});
GameRegistry.addShapelessRecipe(new ItemStack(Item.sugar, 18), new Object[] {
new ItemStack(Items.Resource, 1, 9), Item.sugar
});
GameRegistry.addShapelessRecipe(new ItemStack(Item.redstone, 12), new Object[] {
new ItemStack(Items.Resource, 1, 9), Item.redstone
});
GameRegistry.addShapelessRecipe(new ItemStack(Item.glowstone, 6), new Object[] {
new ItemStack(Items.Resource, 1, 9), Item.glowstone
});
GameRegistry.addShapelessRecipe(new ItemStack(Item.gunpowder, 3), new Object[] {
new ItemStack(Items.Resource, 1, 9), Item.gunpowder
});
}
private static void Smelting()
{
FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 0, new ItemStack(Items.Resource, 1, 2), 0.9F);
FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 3, new ItemStack(Items.Resource, 1, 1), 0.7F);
FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 6, new ItemStack(Items.Resource, 1, 0), 0.4F);
FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 1, new ItemStack(Items.Resource, 1, 8), 0.4F);
FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 2, new ItemStack(Items.Resource, 1, 4), 0.4F);
FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 4, new ItemStack(Items.Resource, 1, 5), 0.4F);
FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 5, new ItemStack(Items.Resource, 1, 7), 0.4F);
FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 7, new ItemStack(Items.Resource, 1, 10), 0.4F);
FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 11, new ItemStack(Items.Resource, 1, 6), 0.4F);
} }
} }

View file

@ -1,20 +1,16 @@
package MysticOres.Util; package mysticores.util;
import MysticOres.Blocks.BlockHandler; import mysticores.blocks.BlockHandler;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class TabMysticOres extends CreativeTabs public class TabMysticOres extends CreativeTabs {
{ public TabMysticOres(String par2Str) {
public TabMysticOres(int par1, String par2Str) super(par2Str);
{
super(par1, par2Str);
} }
@Override @Override
public ItemStack getIconItemStack() public ItemStack getIconItemStack() {
{
return new ItemStack(BlockHandler.BlockBase, 1, 7); return new ItemStack(BlockHandler.BlockBase, 1, 7);
} }
} }

View file

@ -1,90 +1,52 @@
package MysticOres.Util; package mysticores.util;
import MysticOres.Items.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapedOreRecipe;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
public class ToolRecipes public class ToolRecipes {
{ public static void AdvancedAxeRecipe(Item output, Object input) {
public static void SwordRecipe(Item output, ItemStack input) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output), "## ", "#S ", " S ", 'S', OreDictManager.INGOTS[13], '#', input));
{ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output), "## ", "S# ", "S ", 'S', OreDictManager.INGOTS[13], '#', input));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output, 1),
"#", "#", "S", 'S', "stickWood", '#', input));
} }
public static void PickaxeRecipe(Item output, ItemStack input) public static void AdvancedHoeRecipe(Item output, Object input) {
{ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output), "## ", " S ", " S ", 'S', OreDictManager.INGOTS[13], '#', input));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output, 1), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output), "## ", "S ", "S ", 'S', OreDictManager.INGOTS[13], '#', input));
"###", " S ", " S ", 'S', "stickWood", '#', input));
} }
public static void ShovelRecipe(Item output, ItemStack input) public static void AdvancedPickaxeRecipe(Item output, Object input) {
{ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output), "###", " S ", " S ", 'S', OreDictManager.INGOTS[13], '#', input));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output, 1),
"#", "S", "S", 'S', "stickWood", '#', input));
} }
public static void AxeRecipe(Item output, ItemStack input) public static void AdvancedShovelRecipe(Item output, Object input) {
{ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output), "#", "S", "S", 'S', OreDictManager.INGOTS[13], '#', input));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output, 1),
"## ", "#S ", " S ", 'S', "stickWood", '#', input));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output, 1),
"## ", "S# ", "S ", 'S', "stickWood", '#', input));
} }
public static void HoeRecipe(Item output, ItemStack input) public static void AdvancedSwordRecipe(Item output, Object input) {
{ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output), "#", "#", "S", 'S', OreDictManager.INGOTS[13], '#', input));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output, 1),
"## ", " S ", " S ", 'S', "stickWood", '#', input));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output, 1),
"## ", "S ", "S ", 'S', "stickWood", '#', input));
} }
public static void AxeRecipe(Item output, Object input) {
public static void AdvancedSwordRecipe(Item output, ItemStack input) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output), "## ", "#S ", " S ", 'S', "stickWood", '#', input));
{ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output), "## ", "S# ", "S ", 'S', "stickWood", '#', input));
GameRegistry.addRecipe(new ItemStack(output, 1), new Object[] {
"#", "#", "S", 'S', new ItemStack(Items.Resource, 1, 13), '#', input
});
} }
public static void AdvancedPickaxeRecipe(Item output, ItemStack input) public static void HoeRecipe(Item output, Object input) {
{ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output), "## ", " S ", " S ", 'S', "stickWood", '#', input));
GameRegistry.addRecipe(new ItemStack(output, 1), new Object[] { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output), "## ", "S ", "S ", 'S', "stickWood", '#', input));
"###", " S ", " S ", 'S', new ItemStack(Items.Resource, 1, 13), '#', input
});
} }
public static void AdvancedShovelRecipe(Item output, ItemStack input) public static void PickaxeRecipe(Item output, Object input) {
{ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output), "###", " S ", " S ", 'S', "stickWood", '#', input));
GameRegistry.addRecipe(new ItemStack(output, 1), new Object[] {
"#", "S", "S", 'S', new ItemStack(Items.Resource, 1, 13), '#', input
});
} }
public static void AdvancedAxeRecipe(Item output, ItemStack input) public static void ShovelRecipe(Item output, Object input) {
{ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output), "#", "S", "S", 'S', "stickWood", '#', input));
GameRegistry.addRecipe(new ItemStack(output, 1), new Object[] {
"## ", "#S ", " S ", 'S', new ItemStack(Items.Resource, 1, 13), '#', input
});
GameRegistry.addRecipe(new ItemStack(output, 1), new Object[] {
"## ", "S# ", "S ", 'S', new ItemStack(Items.Resource, 1, 13), '#', input
});
} }
public static void AdvancedHoeRecipe(Item output, ItemStack input) public static void SwordRecipe(Item output, Object input) {
{ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(output), "#", "#", "S", 'S', "stickWood", '#', input));
GameRegistry.addRecipe(new ItemStack(output, 1), new Object[] {
"## ", " S ", " S ", 'S', new ItemStack(Items.Resource, 1, 13), '#', input
});
GameRegistry.addRecipe(new ItemStack(output, 1), new Object[] {
"## ", "S ", "S ", 'S', new ItemStack(Items.Resource, 1, 13), '#', input
});
} }
} }

View file

@ -1,21 +1,12 @@
package MysticOres.Worldgen; package mysticores.worldgen;
import MysticOres.Blocks.BlockHandler; import mysticores.blocks.BlockHandler;
import MysticOres.Lib.Rarity; import mysticores.lib.Rarity;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
public class GeneratorManager public class GeneratorManager {
{ public static void initialize() {
public static void Initialize() GameRegistry.registerWorldGenerator(new WorldGenOres());
{
GameRegistry.registerWorldGenerator(new WorldGenVerdite());
GameRegistry.registerWorldGenerator(new WorldGenTopaz());
GameRegistry.registerWorldGenerator(new WorldGenTourmaline());
GameRegistry.registerWorldGenerator(new WorldGenMithril());
GameRegistry.registerWorldGenerator(new WorldGenIridium());
GameRegistry.registerWorldGenerator(new WorldGenAmethyst());
GameRegistry.registerWorldGenerator(new WorldGenAdamantine());
GameRegistry.registerWorldGenerator(new WorldGenAgate());
GameRegistry.registerWorldGenerator(new NetherGenMineable(BlockHandler.BlockBase.blockID, 7, Rarity.BLOODSTONE + 1)); GameRegistry.registerWorldGenerator(new NetherGenMineable(BlockHandler.BlockBase.blockID, 7, Rarity.BLOODSTONE + 1));
GameRegistry.registerWorldGenerator(new NetherGenMineable(BlockHandler.BlockBase.blockID, 8, Rarity.BLACKSOULSTONE + 1)); GameRegistry.registerWorldGenerator(new NetherGenMineable(BlockHandler.BlockBase.blockID, 8, Rarity.BLACKSOULSTONE + 1));
GameRegistry.registerWorldGenerator(new NetherGenMineable(BlockHandler.BlockBase.blockID, 9, Rarity.BLUESOULSTONE + 1)); GameRegistry.registerWorldGenerator(new NetherGenMineable(BlockHandler.BlockBase.blockID, 9, Rarity.BLUESOULSTONE + 1));

View file

@ -1,4 +1,4 @@
package MysticOres.Worldgen; package mysticores.worldgen;
import java.util.Random; import java.util.Random;
@ -7,70 +7,53 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
public class NetherGenHelper extends WorldGenerator public class NetherGenHelper extends WorldGenerator {
{
private int minableBlockId; private int minableBlockId;
private int minableBlockMeta = 0; private int minableBlockMeta = 0;
private int numberOfBlocks; private int numberOfBlocks;
public NetherGenHelper(int par1, int par2) public NetherGenHelper(int par1, int par2) {
{
this.minableBlockId = par1; this.minableBlockId = par1;
this.numberOfBlocks = par2; this.numberOfBlocks = par2;
} }
public NetherGenHelper(int id, int meta, int number) public NetherGenHelper(int id, int meta, int number) {
{
this(id, number); this(id, number);
minableBlockMeta = meta; minableBlockMeta = meta;
} }
@Override @Override
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) {
{
float var6 = par2Random.nextFloat() * (float) Math.PI; float var6 = par2Random.nextFloat() * (float) Math.PI;
double var7 = (double) ((float) (par3 + 8) + MathHelper.sin(var6) * (float) this.numberOfBlocks / 8.0F); double var7 = par3 + 8 + MathHelper.sin(var6) * this.numberOfBlocks / 8.0F;
double var9 = (double) ((float) (par3 + 8) - MathHelper.sin(var6) * (float) this.numberOfBlocks / 8.0F); double var9 = par3 + 8 - MathHelper.sin(var6) * this.numberOfBlocks / 8.0F;
double var11 = (double) ((float) (par5 + 8) + MathHelper.cos(var6) * (float) this.numberOfBlocks / 8.0F); double var11 = par5 + 8 + MathHelper.cos(var6) * this.numberOfBlocks / 8.0F;
double var13 = (double) ((float) (par5 + 8) - MathHelper.cos(var6) * (float) this.numberOfBlocks / 8.0F); double var13 = par5 + 8 - MathHelper.cos(var6) * this.numberOfBlocks / 8.0F;
double var15 = (double) (par4 + par2Random.nextInt(3) - 2); double var15 = par4 + par2Random.nextInt(3) - 2;
double var17 = (double) (par4 + par2Random.nextInt(3) - 2); double var17 = par4 + par2Random.nextInt(3) - 2;
for (int nBlockNumberTry = 0; nBlockNumberTry <= this.numberOfBlocks; ++nBlockNumberTry) {
for (int nBlockNumberTry = 0; nBlockNumberTry <= this.numberOfBlocks; ++nBlockNumberTry) double var20 = var7 + (var9 - var7) * nBlockNumberTry / this.numberOfBlocks;
{ double var22 = var15 + (var17 - var15) * nBlockNumberTry / this.numberOfBlocks;
double var20 = var7 + (var9 - var7) * (double) nBlockNumberTry / (double) this.numberOfBlocks; double var24 = var11 + (var13 - var11) * nBlockNumberTry / this.numberOfBlocks;
double var22 = var15 + (var17 - var15) * (double) nBlockNumberTry / (double) this.numberOfBlocks; double var26 = par2Random.nextDouble() * this.numberOfBlocks / 16.0D;
double var24 = var11 + (var13 - var11) * (double) nBlockNumberTry / (double) this.numberOfBlocks; double var28 = (MathHelper.sin(nBlockNumberTry * (float) Math.PI / this.numberOfBlocks) + 1.0F) * var26 + 1.0D;
double var26 = par2Random.nextDouble() * (double) this.numberOfBlocks / 16.0D; double var30 = (MathHelper.sin(nBlockNumberTry * (float) Math.PI / this.numberOfBlocks) + 1.0F) * var26 + 1.0D;
double var28 = (double) (MathHelper.sin((float) nBlockNumberTry * (float) Math.PI / (float) this.numberOfBlocks) + 1.0F) * var26 + 1.0D;
double var30 = (double) (MathHelper.sin((float) nBlockNumberTry * (float) Math.PI / (float) this.numberOfBlocks) + 1.0F) * var26 + 1.0D;
int var32 = MathHelper.floor_double(var20 - var28 / 2.0D); int var32 = MathHelper.floor_double(var20 - var28 / 2.0D);
int var33 = MathHelper.floor_double(var22 - var30 / 2.0D); int var33 = MathHelper.floor_double(var22 - var30 / 2.0D);
int var34 = MathHelper.floor_double(var24 - var28 / 2.0D); int var34 = MathHelper.floor_double(var24 - var28 / 2.0D);
int var35 = MathHelper.floor_double(var20 + var28 / 2.0D); int var35 = MathHelper.floor_double(var20 + var28 / 2.0D);
int var36 = MathHelper.floor_double(var22 + var30 / 2.0D); int var36 = MathHelper.floor_double(var22 + var30 / 2.0D);
int var37 = MathHelper.floor_double(var24 + var28 / 2.0D); int var37 = MathHelper.floor_double(var24 + var28 / 2.0D);
for (int var38 = var32; var38 <= var35; ++var38) {
for (int var38 = var32; var38 <= var35; ++var38) double var39 = (var38 + 0.5D - var20) / (var28 / 2.0D);
{ if (var39 * var39 < 1.0D) {
double var39 = ((double) var38 + 0.5D - var20) / (var28 / 2.0D); for (int var41 = var33; var41 <= var36; ++var41) {
double var42 = (var41 + 0.5D - var22) / (var30 / 2.0D);
if (var39 * var39 < 1.0D) if (var39 * var39 + var42 * var42 < 1.0D) {
{ for (int var44 = var34; var44 <= var37; ++var44) {
for (int var41 = var33; var41 <= var36; ++var41) double var45 = (var44 + 0.5D - var24) / (var28 / 2.0D);
{
double var42 = ((double) var41 + 0.5D - var22) / (var30 / 2.0D);
if (var39 * var39 + var42 * var42 < 1.0D)
{
for (int var44 = var34; var44 <= var37; ++var44)
{
double var45 = ((double) var44 + 0.5D - var24) / (var28 / 2.0D);
int blocktoreplace = par1World.getBlockId(var38, var41, var44); int blocktoreplace = par1World.getBlockId(var38, var41, var44);
if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && blocktoreplace == Block.netherrack.blockID) if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && blocktoreplace == Block.netherrack.blockID) {
{
par1World.setBlock(var38, var41, var44, this.minableBlockId, minableBlockMeta, 3); par1World.setBlock(var38, var41, var44, this.minableBlockId, minableBlockMeta, 3);
} }
} }
@ -79,7 +62,6 @@ public class NetherGenHelper extends WorldGenerator
} }
} }
} }
return true; return true;
} }
} }

View file

@ -1,49 +1,35 @@
package MysticOres.Worldgen; package mysticores.worldgen;
import java.util.Random; import java.util.Random;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenerator;
import cpw.mods.fml.common.IWorldGenerator; import cpw.mods.fml.common.IWorldGenerator;
public class NetherGenMineable implements IWorldGenerator public class NetherGenMineable implements IWorldGenerator {
{ private WorldGenerator helper;
private int minableBlockId; public NetherGenMineable(int blockId, int numBlocks) {
private int minableBlockMeta = 0; helper = new NetherGenHelper(blockId, numBlocks);
private int numberOfBlocks;
public NetherGenMineable(int blockId, int numBlocks)
{
this.minableBlockId = blockId;
this.numberOfBlocks = numBlocks;
} }
public NetherGenMineable(int blockId, int meta, int numBlocks) public NetherGenMineable(int blockId, int meta, int numBlocks) {
{ helper = new NetherGenHelper(blockId, meta, numBlocks);
this(blockId, numBlocks);
minableBlockMeta = meta;
} }
@Override @Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
{
if (world.provider.isHellWorld) if (world.provider.isHellWorld)
generateNether(world, random, chunkX * 16, chunkZ * 16); generateNether(world, random, chunkX * 16, chunkZ * 16);
} }
private void generateNether(World world, Random random, int i, int j) private void generateNether(World world, Random random, int i, int j) {
{ for (int j1 = 0; j1 < 50; j1++) {
for (int j1 = 0; j1 < 50; j1++)
{
int Xcoordinate = i + random.nextInt(16); int Xcoordinate = i + random.nextInt(16);
int Zcoordinate = j + random.nextInt(16); int Zcoordinate = j + random.nextInt(16);
int Ycoordinate = random.nextInt(256); int Ycoordinate = random.nextInt(256);
new NetherGenHelper(minableBlockId, minableBlockMeta, numberOfBlocks).generate(world, random, Xcoordinate, Ycoordinate, Zcoordinate); helper.generate(world, random, Xcoordinate, Ycoordinate, Zcoordinate);
} }
} }
} }

View file

@ -1,31 +0,0 @@
package MysticOres.Worldgen;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import MysticOres.Blocks.BlockHandler;
import MysticOres.Lib.Rarity;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldGenAdamantine implements IWorldGenerator {
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch (world.provider.dimensionId)
{
case 0: generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ) {
for (int i = 0; i < Rarity.ADAMANTINE; i++)
{
int Xcoord = blockX + random.nextInt(8);
int Ycoord = random.nextInt(16);
int Zcoord = blockZ + random.nextInt(8);
(new WorldGenMinable(BlockHandler.BlockBase.blockID, 0, 3)).generate(world, random, Xcoord, Ycoord, Zcoord);
}
}
}

View file

@ -1,32 +0,0 @@
package MysticOres.Worldgen;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import MysticOres.Blocks.BlockHandler;
import MysticOres.Lib.Rarity;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldGenAgate implements IWorldGenerator
{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){
switch (world.provider.dimensionId)
{
case 0: generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ) {
for (int i = 0; i < Rarity.AGATE; i++)
{
int Xcoord = blockX + random.nextInt(32);
int Ycoord = random.nextInt(60);
int Zcoord = blockZ + random.nextInt(32);
(new WorldGenMinable(BlockHandler.BlockBase.blockID, 11, 4, Block.stone.blockID)).generate(world, random, Xcoord, Ycoord, Zcoord);
}
}
}

View file

@ -1,33 +0,0 @@
package MysticOres.Worldgen;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import MysticOres.Blocks.BlockHandler;
import MysticOres.Lib.Rarity;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldGenAmethyst implements IWorldGenerator {
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch (world.provider.dimensionId)
{
case 0: generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ)
{
for (int i = 0; i < Rarity.AMETHYST; i++)
{
int Xcoord = blockX + random.nextInt(24);
int Ycoord = random.nextInt(60);
int Zcoord = blockZ + random.nextInt(24);
(new WorldGenMinable(BlockHandler.BlockBase.blockID, 1, 4, Block.stone.blockID)).generate(world, random, Xcoord, Ycoord, Zcoord);
}
}
}

View file

@ -1,33 +0,0 @@
package MysticOres.Worldgen;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import MysticOres.Blocks.BlockHandler;
import MysticOres.Lib.Rarity;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldGenIridium implements IWorldGenerator {
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch (world.provider.dimensionId)
{
case 0: generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ)
{
for (int i = 0; i < Rarity.IRIDIUM; i++)
{
int Xcoord = blockX + random.nextInt(16);
int Ycoord = random.nextInt(12);
int Zcoord = blockZ + random.nextInt(16);
(new WorldGenMinable(BlockHandler.BlockBase.blockID, 2, 6, Block.stone.blockID)).generate(world, random, Xcoord, Ycoord, Zcoord);
}
}
}

View file

@ -1,32 +0,0 @@
package MysticOres.Worldgen;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import MysticOres.Blocks.BlockHandler;
import MysticOres.Lib.Rarity;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldGenMithril implements IWorldGenerator {
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch (world.provider.dimensionId)
{
case 0: generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ) {
for (int i = 0; i < Rarity.MITHRIL; i++)
{
int Xcoord = blockX + random.nextInt(16);
int Ycoord = random.nextInt(64);
int Zcoord = blockZ + random.nextInt(16);
(new WorldGenMinable(BlockHandler.BlockBase.blockID, 3, 6, Block.stone.blockID)).generate(world, random, Xcoord, Ycoord, Zcoord);
}
}
}

View file

@ -1,32 +0,0 @@
package MysticOres.Worldgen;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import MysticOres.Blocks.BlockHandler;
import MysticOres.Lib.Rarity;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldGenTopaz implements IWorldGenerator {
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch (world.provider.dimensionId)
{
case 0: generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ) {
for (int i = 0; i < Rarity.TOPAZ; i++)
{
int Xcoord = blockX + random.nextInt(16);
int Ycoord = random.nextInt(60);
int Zcoord = blockZ + random.nextInt(16);
(new WorldGenMinable(BlockHandler.BlockBase.blockID, 5, 4, Block.stone.blockID)).generate(world, random, Xcoord, Ycoord, Zcoord);
}
}
}

View file

@ -1,30 +0,0 @@
package MysticOres.Worldgen;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import MysticOres.Blocks.BlockHandler;
import MysticOres.Lib.Rarity;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldGenTourmaline implements IWorldGenerator {
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){
switch (world.provider.dimensionId)
{
case 0: generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ) {
for (int i = 0; i < Rarity.TOURMALINE; i++){
int Xcoord = blockX + random.nextInt(32);
int Ycoord = random.nextInt(60);
int Zcoord = blockZ + random.nextInt(32);
(new WorldGenMinable(BlockHandler.BlockBase.blockID, 4, 4, Block.stone.blockID)).generate(world, random, Xcoord, Ycoord, Zcoord);
}
}
}

View file

@ -1,33 +0,0 @@
package MysticOres.Worldgen;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import MysticOres.Blocks.BlockHandler;
import MysticOres.Lib.Rarity;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldGenVerdite implements IWorldGenerator {
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch (world.provider.dimensionId)
{
case 0: generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ)
{
for (int i = 0; i < Rarity.VERDITE; i++)
{
int Xcoord = blockX + random.nextInt(16);
int Ycoord = random.nextInt(20) + 80;
int Zcoord = blockZ + random.nextInt(16);
(new WorldGenMinable(BlockHandler.BlockBase.blockID, 6, 9, Block.stone.blockID)).generate(world, random, Xcoord, Ycoord, Zcoord);
}
}
}

View file

@ -1,25 +1,37 @@
package MysticRuins; package mysticruins;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.List;
import net.minecraftforge.common.Configuration; import net.minecraftforge.common.Configuration;
public class Config public class Config {
{
public static Configuration config; public static Configuration config;
public static int RuinRarity; public static int RuinRarity;
public static int DunRarity; public static int DunRarity;
public static List<Integer> ruinAllowId = new ArrayList();
public static List<Integer> dungeonAllowId = new ArrayList();
public static void initialize(File file) public static void initialize(File file) {
{
config = new Configuration(file); config = new Configuration(file);
config.load();
RuinRarity = config.get("General", "Ruin Rarity", 2).getInt(); RuinRarity = config.get("General", "Ruin Rarity", 2).getInt();
DunRarity = config.get("General", "Mystic Dungeon Rarity", 1).getInt(); DunRarity = config.get("General", "Mystic Dungeon Rarity", 1).getInt();
config.save(); String[] ID = config.get("General", "Ruin allowed dimension id", "0,").getString().split(",");
for (String txt : ID) {
try {
ruinAllowId.add(Integer.parseInt(txt.trim()));
} catch (NumberFormatException e) {
}
}
ID = config.get("General", "Dungeon allowed dimension id", "0,").getString().split(",");
for (String txt : ID) {
try {
dungeonAllowId.add(Integer.parseInt(txt.trim()));
} catch (NumberFormatException e) {
}
} }
public static void save()
{
config.save(); config.save();
} }
} }

View file

@ -1,41 +1,15 @@
package MysticRuins; package mysticruins;
import java.io.File;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.DungeonHooks;
import net.minecraftforge.common.EnumHelper;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = "Mystic Ruins", name = "Mystic Ruins", version = "0.1") @Mod(modid = "MysticRuins", name = "Mystic Ruins", version = "0.1")
@NetworkMod(clientSideRequired = false, serverSideRequired = false) public class MysticRuins {
public class MysticRuins
{
@EventHandler @EventHandler
public void preInit(FMLPreInitializationEvent event) public void preInit(FMLPreInitializationEvent event) {
{ Config.initialize(event.getSuggestedConfigurationFile());
Config.initialize(new File(event.getModConfigurationDirectory(), "Mystic Mods/Mystic Ruins.cfg")); GameRegistry.registerWorldGenerator(new WorldGenMystic());
Config.save();
GameRegistry.registerWorldGenerator(new WorldGenRuin());
GameRegistry.registerWorldGenerator(new WorldGenRuin$1());
GameRegistry.registerWorldGenerator(new WorldGenMysticDungeon());
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -1,43 +1,32 @@
package MysticRuins; package mysticruins;
import java.util.Random; import java.util.Random;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.tileentity.TileEntityMobSpawner; import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.common.DungeonHooks;
public class StructureRuin$1 extends WorldGenerator public class StructureRuin$1 extends WorldGenerator {
{ public StructureRuin$1() {
public StructureRuin$1()
{
} }
public boolean generate(World world, Random random, int i, int j, int k) @Override
{ public boolean generate(World world, Random random, int i, int j, int k) {
int l = random.nextInt(100); int l = random.nextInt(100);
if(l >= 10) if (l >= 10) {
{
return false; return false;
} }
for(int i1 = 0; i1 < 1; i1++) for (int i1 = 0; i1 < 1; i1++) {
{
int j1 = (i + random.nextInt(8)) - random.nextInt(8); int j1 = (i + random.nextInt(8)) - random.nextInt(8);
int k1 = (j + random.nextInt(4)) - random.nextInt(4); int k1 = (j + random.nextInt(4)) - random.nextInt(4);
int l1 = (k + random.nextInt(8)) - random.nextInt(8); int l1 = (k + random.nextInt(8)) - random.nextInt(8);
if(!world.isAirBlock(j1, k1, l1) || world.getBlockId(j1, k1 - 1, l1) != Block.grass.blockID || !Block.pumpkin.canPlaceBlockAt(world, j1, k1, l1)) if (!world.isAirBlock(j1, k1, l1) || world.getBlockId(j1, k1 - 1, l1) != Block.grass.blockID || !Block.pumpkin.canPlaceBlockAt(world, j1, k1, l1)) {
{
continue; continue;
} }
int i2 = random.nextInt(3) + 1; int i2 = random.nextInt(3) + 1;
if(i2 == 1) if (i2 == 1) {
{
int j2 = random.nextInt(8) + 5; int j2 = random.nextInt(8) + 5;
int i3 = random.nextInt(8) + 5; int i3 = random.nextInt(8) + 5;
int l3 = random.nextInt(8) + 5; int l3 = random.nextInt(8) + 5;
@ -48,11 +37,9 @@ public class StructureRuin$1 extends WorldGenerator
boolean flag = false; boolean flag = false;
int k7 = random.nextInt(100); int k7 = random.nextInt(100);
int j8 = random.nextInt(100); int j8 = random.nextInt(100);
if(j8 <= 20) if (j8 <= 20) {
{
j5 = 0; j5 = 0;
} else } else {
{
j5 = random.nextInt(4) + 5; j5 = random.nextInt(4) + 5;
} }
world.setBlock(j1, k1 - j5, l1, Block.stoneBrick.blockID); world.setBlock(j1, k1 - j5, l1, Block.stoneBrick.blockID);
@ -68,60 +55,21 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1, k1 - j5, l1 + 3, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1, k1 - j5, l1 + 3, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1, (k1 - j5) + 1, l1 + 3, Block.stoneBrick.blockID); world.setBlock(j1, (k1 - j5) + 1, l1 + 3, Block.stoneBrick.blockID);
world.setBlock(j1, (k1 - j5) + 2, l1 + 3, Block.stoneBrick.blockID); world.setBlock(j1, (k1 - j5) + 2, l1 + 3, Block.stoneBrick.blockID);
world.setBlock(j1, k1 - j5 - k4, l1 + 2, Block.chest.blockID);
TileEntityChest tileentitychest = (TileEntityChest) world.getBlockTileEntity(j1, k1 - j5 - k4, l1 + 2);
Random rand = new Random();
for(int slot = 0; slot < tileentitychest.getSizeInventory(); slot++)
{
int num = rand.nextInt(32);
if(num == 1)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.pickaxeIron, 1, 0));
}
if(num == 2)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.axeIron, 1, 0));
}
if(num == 3)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.swordIron, 1, 0));
}
if(num == 4)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.shovelIron, 1, 0));
}
if(num == 5)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.ingotGold, 1, 0));
}
if(num == 6)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.ingotIron, 1, 0));
}
}
world.setBlock(j1, k1 - j5 - k4 - 1, l1 + 2, Block.dirt.blockID); world.setBlock(j1, k1 - j5 - k4 - 1, l1 + 2, Block.dirt.blockID);
world.setBlock(j1, k1 - j5 - k4, l1 + 2, Block.chest.blockID);
ChestFiller.fillWithValuables(world.getBlockTileEntity(j1, k1 - j5 - k4, l1 + 2));
l6 = 1; l6 = 1;
i6 = 0; i6 = 0;
flag = false; flag = false;
do do {
{ if (world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 4) || world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 5) || world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 6)
if(world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 4) || world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 5) || world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 6) || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 4) == Block.waterStill.blockID || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 5) == Block.waterStill.blockID || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 6) == Block.waterStill.blockID) || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 4) == Block.waterStill.blockID || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 5) == Block.waterStill.blockID
{ || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 6) == Block.waterStill.blockID) {
i6++; i6++;
} else } else {
{
flag = true; flag = true;
} }
} while(!flag && l6++ < 12); } while (!flag && l6++ < 12);
world.setBlock(j1 + l3, k1 - j5 - i6, l1 + l3 + 4, Block.stoneBrick.blockID); world.setBlock(j1 + l3, k1 - j5 - i6, l1 + l3 + 4, Block.stoneBrick.blockID);
world.setBlock(j1 + l3, ((k1 - j5) + 1) - i6, l1 + l3 + 4, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + l3, ((k1 - j5) + 1) - i6, l1 + l3 + 4, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1 + l3 + 1, k1 - j5 - i6, l1 + l3 + 4, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + l3 + 1, k1 - j5 - i6, l1 + l3 + 4, Block.stoneBrick.blockID, 1, 2);
@ -138,33 +86,26 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1 + l3, ((k1 - j5) + 1) - i6, l1 + l3 + 7, Block.stoneBrick.blockID); world.setBlock(j1 + l3, ((k1 - j5) + 1) - i6, l1 + l3 + 7, Block.stoneBrick.blockID);
world.setBlock(j1 + l3, ((k1 - j5) + 2) - i6, l1 + l3 + 7, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + l3, ((k1 - j5) + 2) - i6, l1 + l3 + 7, Block.stoneBrick.blockID, 1, 2);
k7 = random.nextInt(100); k7 = random.nextInt(100);
if(k7 <= 30) if (k7 <= 30) {
{
world.setBlock(j1 + l3, k1 - j5 - i6 - k4, l1 + l3 + 5, Block.mobSpawner.blockID); world.setBlock(j1 + l3, k1 - j5 - i6 - k4, l1 + l3 + 5, Block.mobSpawner.blockID);
TileEntityMobSpawner spawner = (TileEntityMobSpawner) world.getBlockTileEntity(j1 + l3, k1 - j5 - i6 - k4, l1 + l3 + 5); TileEntityMobSpawner spawner = (TileEntityMobSpawner) world.getBlockTileEntity(j1 + l3, k1 - j5 - i6 - k4, l1 + l3 + 5);
if(spawner != null) if (spawner != null) {
{ spawner.getSpawnerLogic().setMobID(DungeonHooks.getRandomDungeonMob(random));
spawner.getSpawnerLogic().setMobID("Zombie");
} }
world.setBlock(j1 + l3, k1 - j5 - i6 - k4 - 1, l1 + l3 + 5, Block.dirt.blockID); world.setBlock(j1 + l3, k1 - j5 - i6 - k4 - 1, l1 + l3 + 5, Block.dirt.blockID);
} }
l6 = 1; l6 = 1;
i6 = 0; i6 = 0;
flag = false; flag = false;
do do {
{ if (world.isAirBlock(j1 - i3, k1 - j5 - l6, l1 - 4) || world.isAirBlock(j1 - i3, k1 - j5 - l6, l1 - 5) || world.isAirBlock(j1 - i3 - 1, k1 - j5 - l6, l1 - 5)
if(world.isAirBlock(j1 - i3, k1 - j5 - l6, l1 - 4) || world.isAirBlock(j1 - i3, k1 - j5 - l6, l1 - 5) || world.isAirBlock(j1 - i3 - 1, k1 - j5 - l6, l1 - 5) || world.getBlockId(j1 - i3, k1 - j5 - l6, l1 - 4) == Block.waterStill.blockID || world.getBlockId(j1 - i3, k1 - j5 - l6, l1 - 5) == Block.waterStill.blockID || world.getBlockId(j1 - i3 - 1, k1 - j5 - l6, l1 - 5) == Block.waterStill.blockID) || world.getBlockId(j1 - i3, k1 - j5 - l6, l1 - 4) == Block.waterStill.blockID || world.getBlockId(j1 - i3, k1 - j5 - l6, l1 - 5) == Block.waterStill.blockID
{ || world.getBlockId(j1 - i3 - 1, k1 - j5 - l6, l1 - 5) == Block.waterStill.blockID) {
i6++; i6++;
} else } else {
{
flag = true; flag = true;
} }
} while(!flag && l6++ < 12); } while (!flag && l6++ < 12);
world.setBlock(j1 - i3, k1 - j5 - i6, l1 - 4, Block.stoneBrick.blockID); world.setBlock(j1 - i3, k1 - j5 - i6, l1 - 4, Block.stoneBrick.blockID);
world.setBlock(j1 - i3, ((k1 - j5) + 1) - i6, l1 - 4, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 - i3, ((k1 - j5) + 1) - i6, l1 - 4, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1 - i3, k1 - j5 - i6, l1 - 5, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 - i3, k1 - j5 - i6, l1 - 5, Block.stoneBrick.blockID, 1, 2);
@ -173,14 +114,12 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1 - i3 - 1, ((k1 - j5) + 2) - i6, l1 - 5, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 - i3 - 1, ((k1 - j5) + 2) - i6, l1 - 5, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1 - i3 - 2, k1 - j5 - i6, l1 - 5, Block.stoneBrick.blockID); world.setBlock(j1 - i3 - 2, k1 - j5 - i6, l1 - 5, Block.stoneBrick.blockID);
k7 = random.nextInt(100); k7 = random.nextInt(100);
if(k7 <= 60) if (k7 <= 60) {
{
world.setBlock(j1 - i3 - 1, k1 - j5 - i6 - k4, l1 - 5, Block.dirt.blockID); world.setBlock(j1 - i3 - 1, k1 - j5 - i6 - k4, l1 - 5, Block.dirt.blockID);
world.setBlock(j1 - i3 - 1, k1 - j5 - i6 - k4 - 1, l1 - 5, Block.dirt.blockID); world.setBlock(j1 - i3 - 1, k1 - j5 - i6 - k4 - 1, l1 - 5, Block.dirt.blockID);
} }
} }
if(i2 == 2) if (i2 == 2) {
{
int k2 = random.nextInt(8) + 5; int k2 = random.nextInt(8) + 5;
int j3 = random.nextInt(8) + 5; int j3 = random.nextInt(8) + 5;
int i4 = random.nextInt(8) + 5; int i4 = random.nextInt(8) + 5;
@ -191,11 +130,9 @@ public class StructureRuin$1 extends WorldGenerator
boolean flag1 = false; boolean flag1 = false;
int l7 = random.nextInt(100); int l7 = random.nextInt(100);
int k8 = random.nextInt(100); int k8 = random.nextInt(100);
if(k8 <= 20) if (k8 <= 20) {
{
k5 = 0; k5 = 0;
} else } else {
{
k5 = random.nextInt(4) + 5; k5 = random.nextInt(4) + 5;
} }
world.setBlock(j1, k1 - k5, l1, Block.stoneBrick.blockID); world.setBlock(j1, k1 - k5, l1, Block.stoneBrick.blockID);
@ -214,16 +151,15 @@ public class StructureRuin$1 extends WorldGenerator
i7 = 1; i7 = 1;
j6 = 0; j6 = 0;
flag1 = false; flag1 = false;
do do {
{ if (world.isAirBlock(j1 - k2, k1 - k5 - i7, l1 - 4) || world.isAirBlock(j1 - k2, k1 - k5 - i7, l1 - 5) || world.isAirBlock(j1 - k2 - 1, k1 - k5 - i7, l1 - 5)
if(world.isAirBlock(j1 - k2, k1 - k5 - i7, l1 - 4) || world.isAirBlock(j1 - k2, k1 - k5 - i7, l1 - 5) || world.isAirBlock(j1 - k2 - 1, k1 - k5 - i7, l1 - 5) || world.getBlockId(j1 - k2, k1 - k5 - i7, l1 - 4) == Block.waterStill.blockID || world.getBlockId(j1 - k2, k1 - k5 - i7, l1 - 5) == Block.waterStill.blockID || world.getBlockId(j1 - k2 - 1, k1 - k5 - i7, l1 - 5) == Block.waterStill.blockID) || world.getBlockId(j1 - k2, k1 - k5 - i7, l1 - 4) == Block.waterStill.blockID || world.getBlockId(j1 - k2, k1 - k5 - i7, l1 - 5) == Block.waterStill.blockID
{ || world.getBlockId(j1 - k2 - 1, k1 - k5 - i7, l1 - 5) == Block.waterStill.blockID) {
j6++; j6++;
} else } else {
{
flag1 = true; flag1 = true;
} }
} while(!flag1 && i7++ < 12); } while (!flag1 && i7++ < 12);
world.setBlock(j1 - k2, k1 - k5 - j6, l1 - 3, Block.stoneBrick.blockID); world.setBlock(j1 - k2, k1 - k5 - j6, l1 - 3, Block.stoneBrick.blockID);
world.setBlock(j1 - k2, k1 - k5 - j6, l1 - 4, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 - k2, k1 - k5 - j6, l1 - 4, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1 - k2, ((k1 - k5) + 1) - j6, l1 - 4, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 - k2, ((k1 - k5) + 1) - j6, l1 - 4, Block.stoneBrick.blockID, 1, 2);
@ -238,24 +174,22 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1 - k2 - 1, ((k1 - k5) + 2) - j6, l1 - 5, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 - k2 - 1, ((k1 - k5) + 2) - j6, l1 - 5, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1 - k2 - 2, k1 - k5 - j6, l1 - 5, Block.stoneBrick.blockID); world.setBlock(j1 - k2 - 2, k1 - k5 - j6, l1 - 5, Block.stoneBrick.blockID);
l7 = random.nextInt(100); l7 = random.nextInt(100);
if(l7 <= 30) if (l7 <= 30) {
{
world.setBlock(j1 - k2 - 1, k1 - k5 - j6 - l4, l1 - 5, Block.dirt.blockID); world.setBlock(j1 - k2 - 1, k1 - k5 - j6 - l4, l1 - 5, Block.dirt.blockID);
world.setBlock(j1 - k2 - 1, k1 - k5 - j6 - l4 - 1, l1 - 5, Block.dirt.blockID); world.setBlock(j1 - k2 - 1, k1 - k5 - j6 - l4 - 1, l1 - 5, Block.dirt.blockID);
} }
i7 = 1; i7 = 1;
j6 = 0; j6 = 0;
flag1 = false; flag1 = false;
do do {
{ if (world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 4) || world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 6) || world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 8)
if(world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 4) || world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 6) || world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 8) || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 4) == Block.waterStill.blockID || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 6) == Block.waterStill.blockID || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 8) == Block.waterStill.blockID) || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 4) == Block.waterStill.blockID || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 6) == Block.waterStill.blockID
{ || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 8) == Block.waterStill.blockID) {
j6++; j6++;
} else } else {
{
flag1 = true; flag1 = true;
} }
} while(!flag1 && i7++ < 12); } while (!flag1 && i7++ < 12);
world.setBlock(j1 + i4, k1 - k5 - j6, l1 + 4, Block.stoneBrick.blockID); world.setBlock(j1 + i4, k1 - k5 - j6, l1 + 4, Block.stoneBrick.blockID);
world.setBlock(j1 + i4, ((k1 - k5) + 1) - j6, l1 + 4, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + i4, ((k1 - k5) + 1) - j6, l1 + 4, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1 + i4 + 1, k1 - k5 - j6, l1 + 4, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + i4 + 1, k1 - k5 - j6, l1 + 4, Block.stoneBrick.blockID, 1, 2);
@ -275,24 +209,22 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1 + i4, ((k1 - k5) + 1) - j6, l1 + 8, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + i4, ((k1 - k5) + 1) - j6, l1 + 8, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1 + i4, k1 - k5 - j6, l1 + 9, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + i4, k1 - k5 - j6, l1 + 9, Block.stoneBrick.blockID, 1, 2);
l7 = random.nextInt(100); l7 = random.nextInt(100);
if(l7 <= 60) if (l7 <= 60) {
{
world.setBlock(j1 + i4, k1 - k5 - j6 - l4, l1 + 7, Block.dirt.blockID); world.setBlock(j1 + i4, k1 - k5 - j6 - l4, l1 + 7, Block.dirt.blockID);
world.setBlock(j1 + i4, k1 - k5 - j6 - l4 - 1, l1 + 7, Block.dirt.blockID); world.setBlock(j1 + i4, k1 - k5 - j6 - l4 - 1, l1 + 7, Block.dirt.blockID);
} }
i7 = 1; i7 = 1;
j6 = 0; j6 = 0;
flag1 = false; flag1 = false;
do do {
{ if (world.isAirBlock(j1 - j3, k1 - k5 - i7, l1 + i4) || world.isAirBlock(j1 - j3, k1 - k5 - i7, (l1 + i4) - 2) || world.isAirBlock((j1 - j3) + 1, k1 - k5 - i7, l1 + i4)
if(world.isAirBlock(j1 - j3, k1 - k5 - i7, l1 + i4) || world.isAirBlock(j1 - j3, k1 - k5 - i7, (l1 + i4) - 2) || world.isAirBlock((j1 - j3) + 1, k1 - k5 - i7, l1 + i4) || world.getBlockId(j1 - j3, k1 - k5 - i7, l1 + i4) == Block.waterStill.blockID || world.getBlockId(j1 - j3, k1 - k5 - i7, (l1 + i4) - 2) == Block.waterStill.blockID || world.getBlockId((j1 - j3) + 1, k1 - k5 - i7, l1 + i4) == Block.waterStill.blockID) || world.getBlockId(j1 - j3, k1 - k5 - i7, l1 + i4) == Block.waterStill.blockID || world.getBlockId(j1 - j3, k1 - k5 - i7, (l1 + i4) - 2) == Block.waterStill.blockID
{ || world.getBlockId((j1 - j3) + 1, k1 - k5 - i7, l1 + i4) == Block.waterStill.blockID) {
j6++; j6++;
} else } else {
{
flag1 = true; flag1 = true;
} }
} while(!flag1 && i7++ < 12); } while (!flag1 && i7++ < 12);
world.setBlock((j1 - j3) + 1, k1 - k5 - j6, l1 + i4, Block.stoneBrick.blockID); world.setBlock((j1 - j3) + 1, k1 - k5 - j6, l1 + i4, Block.stoneBrick.blockID);
world.setBlock((j1 - j3) + 1, ((k1 - k5) + 1) - j6, l1 + i4, Block.stoneBrick.blockID, 1, 2); world.setBlock((j1 - j3) + 1, ((k1 - k5) + 1) - j6, l1 + i4, Block.stoneBrick.blockID, 1, 2);
world.setBlock((j1 - j3) + 1, ((k1 - k5) + 2) - j6, l1 + i4, Block.stoneBrick.blockID, 1, 2); world.setBlock((j1 - j3) + 1, ((k1 - k5) + 2) - j6, l1 + i4, Block.stoneBrick.blockID, 1, 2);
@ -311,24 +243,22 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1 - j3, ((k1 - k5) + 2) - j6, (l1 + i4) - 3, Block.stoneBrick.blockID); world.setBlock(j1 - j3, ((k1 - k5) + 2) - j6, (l1 + i4) - 3, Block.stoneBrick.blockID);
world.setBlock(j1 - j3, ((k1 - k5) + 3) - j6, (l1 + i4) - 3, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 - j3, ((k1 - k5) + 3) - j6, (l1 + i4) - 3, Block.stoneBrick.blockID, 1, 2);
l7 = random.nextInt(100); l7 = random.nextInt(100);
if(l7 <= 30) if (l7 <= 30) {
{
world.setBlock(j1 - j3, k1 - k5 - j6 - l4, (l1 + i4) - 2, Block.dirt.blockID); world.setBlock(j1 - j3, k1 - k5 - j6 - l4, (l1 + i4) - 2, Block.dirt.blockID);
world.setBlock(j1 - j3, k1 - k5 - j6 - l4 - 1, (l1 + i4) - 2, Block.dirt.blockID); world.setBlock(j1 - j3, k1 - k5 - j6 - l4 - 1, (l1 + i4) - 2, Block.dirt.blockID);
} }
i7 = 1; i7 = 1;
j6 = 0; j6 = 0;
flag1 = false; flag1 = false;
do do {
{ if (world.isAirBlock(j1 + j3 + 4, k1 - k5 - i7, l1 - 6) || world.isAirBlock(j1 + j3 + 4, k1 - k5 - i7, l1 - 7) || world.isAirBlock(j1 + j3 + 5, k1 - k5 - i7, l1 - 7)
if(world.isAirBlock(j1 + j3 + 4, k1 - k5 - i7, l1 - 6) || world.isAirBlock(j1 + j3 + 4, k1 - k5 - i7, l1 - 7) || world.isAirBlock(j1 + j3 + 5, k1 - k5 - i7, l1 - 7) || world.getBlockId(j1 + j3 + 4, k1 - k5 - i7, l1 - 6) == Block.waterStill.blockID || world.getBlockId(j1 + j3 + 4, k1 - k5 - i7, l1 - 7) == Block.waterStill.blockID || world.getBlockId(j1 + j3 + 5, k1 - k5 - i7, l1 - 7) == Block.waterStill.blockID) || world.getBlockId(j1 + j3 + 4, k1 - k5 - i7, l1 - 6) == Block.waterStill.blockID || world.getBlockId(j1 + j3 + 4, k1 - k5 - i7, l1 - 7) == Block.waterStill.blockID
{ || world.getBlockId(j1 + j3 + 5, k1 - k5 - i7, l1 - 7) == Block.waterStill.blockID) {
j6++; j6++;
} else } else {
{
flag1 = true; flag1 = true;
} }
} while(!flag1 && i7++ < 12); } while (!flag1 && i7++ < 12);
world.setBlock(j1 + j3 + 4, k1 - k5 - j6, l1 - 6, Block.stoneBrick.blockID); world.setBlock(j1 + j3 + 4, k1 - k5 - j6, l1 - 6, Block.stoneBrick.blockID);
world.setBlock(j1 + j3 + 4, ((k1 - k5) + 1) - j6, l1 - 6, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + j3 + 4, ((k1 - k5) + 1) - j6, l1 - 6, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1 + j3 + 4, ((k1 - k5) + 2) - j6, l1 - 6, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + j3 + 4, ((k1 - k5) + 2) - j6, l1 - 6, Block.stoneBrick.blockID, 1, 2);
@ -339,14 +269,12 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1 + j3 + 5, ((k1 - k5) + 2) - j6, l1 - 7, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + j3 + 5, ((k1 - k5) + 2) - j6, l1 - 7, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1 + j3 + 6, k1 - k5 - j6, l1 - 7, Block.stoneBrick.blockID); world.setBlock(j1 + j3 + 6, k1 - k5 - j6, l1 - 7, Block.stoneBrick.blockID);
l7 = random.nextInt(100); l7 = random.nextInt(100);
if(l7 <= 30) if (l7 <= 30) {
{
world.setBlock(j1 + j3 + 4, k1 - k5 - j6 - l4, l1 - 7, Block.dirt.blockID); world.setBlock(j1 + j3 + 4, k1 - k5 - j6 - l4, l1 - 7, Block.dirt.blockID);
world.setBlock(j1 + j3 + 4, k1 - k5 - j6 - l4 - 1, l1 - 7, Block.dirt.blockID); world.setBlock(j1 + j3 + 4, k1 - k5 - j6 - l4 - 1, l1 - 7, Block.dirt.blockID);
} }
} }
if(i2 != 3) if (i2 != 3) {
{
continue; continue;
} }
int l2 = random.nextInt(8) + 5; int l2 = random.nextInt(8) + 5;
@ -359,11 +287,9 @@ public class StructureRuin$1 extends WorldGenerator
boolean flag2 = false; boolean flag2 = false;
int i8 = random.nextInt(100); int i8 = random.nextInt(100);
int l8 = random.nextInt(100); int l8 = random.nextInt(100);
if(l8 <= 20) if (l8 <= 20) {
{
l5 = 0; l5 = 0;
} else } else {
{
l5 = random.nextInt(4) + 5; l5 = random.nextInt(4) + 5;
} }
world.setBlock(j1, k1 - l5, l1, Block.stoneBrick.blockID); world.setBlock(j1, k1 - l5, l1, Block.stoneBrick.blockID);
@ -380,22 +306,21 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1, (k1 - l5) + 2, l1 + 1, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1, (k1 - l5) + 2, l1 + 1, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1, k1 - l5, l1 + 2, Block.stoneBrick.blockID); world.setBlock(j1, k1 - l5, l1 + 2, Block.stoneBrick.blockID);
world.setBlock(j1, (k1 - l5) + 1, l1 + 2, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1, (k1 - l5) + 1, l1 + 2, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1, k1 - l5 - i5, l1 + 1, Block.dirt.blockID); world.setBlock(j1, k1 - l5 - i5, l1 + 1, Block.dirt.blockID);
world.setBlock(j1, k1 - l5 - i5 - 1, l1 + 1, Block.dirt.blockID); world.setBlock(j1, k1 - l5 - i5 - 1, l1 + 1, Block.dirt.blockID);
j7 = 1; j7 = 1;
k6 = 0; k6 = 0;
flag2 = false; flag2 = false;
do do {
{ if (world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 2) || world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 3) || world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 4)
if(world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 2) || world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 3) || world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 4) || world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 2) == Block.waterStill.blockID || world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 3) == Block.waterStill.blockID || world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 4) == Block.waterStill.blockID) || world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 2) == Block.waterStill.blockID
{ || world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 3) == Block.waterStill.blockID
|| world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 4) == Block.waterStill.blockID) {
k6++; k6++;
} else } else {
{
flag2 = true; flag2 = true;
} }
} while(!flag2 && j7++ < 12); } while (!flag2 && j7++ < 12);
world.setBlock(j1 + k3 + l2, k1 - l5 - k6, l1 + j4, Block.stoneBrick.blockID); world.setBlock(j1 + k3 + l2, k1 - l5 - k6, l1 + j4, Block.stoneBrick.blockID);
world.setBlock(j1 + k3 + l2, ((k1 - l5) + 1) - k6, l1 + j4, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + k3 + l2, ((k1 - l5) + 1) - k6, l1 + j4, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1 + k3 + l2 + 1, k1 - l5 - k6, l1 + j4, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + k3 + l2 + 1, k1 - l5 - k6, l1 + j4, Block.stoneBrick.blockID, 1, 2);
@ -413,24 +338,22 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1 + k3 + l2, k1 - l5 - k6, l1 + j4 + 4, Block.stoneBrick.blockID); world.setBlock(j1 + k3 + l2, k1 - l5 - k6, l1 + j4 + 4, Block.stoneBrick.blockID);
world.setBlock(j1 + k3 + l2, k1 - l5 - k6, l1 + j4 + 6, Block.stoneBrick.blockID); world.setBlock(j1 + k3 + l2, k1 - l5 - k6, l1 + j4 + 6, Block.stoneBrick.blockID);
i8 = random.nextInt(100); i8 = random.nextInt(100);
if(i8 <= 30) if (i8 <= 30) {
{
world.setBlock(j1 + k3 + l2, k1 - l5 - k6 - i5, l1 + j4 + 1, Block.dirt.blockID); world.setBlock(j1 + k3 + l2, k1 - l5 - k6 - i5, l1 + j4 + 1, Block.dirt.blockID);
world.setBlock(j1 + k3 + l2, k1 - l5 - k6 - i5 - 1, l1 + j4 + 1, Block.dirt.blockID); world.setBlock(j1 + k3 + l2, k1 - l5 - k6 - i5 - 1, l1 + j4 + 1, Block.dirt.blockID);
} }
j7 = 1; j7 = 1;
k6 = 0; k6 = 0;
flag2 = false; flag2 = false;
do do {
{ if (world.isAirBlock(j1 - k3, k1 - l5 - j7, l1 - l2 - 2) || world.isAirBlock(j1 - k3, k1 - l5 - j7, l1 - l2 - 4) || world.isAirBlock(j1 - k3 - 2, k1 - l5 - j7, l1 - l2 - 6)
if(world.isAirBlock(j1 - k3, k1 - l5 - j7, l1 - l2 - 2) || world.isAirBlock(j1 - k3, k1 - l5 - j7, l1 - l2 - 4) || world.isAirBlock(j1 - k3 - 2, k1 - l5 - j7, l1 - l2 - 6) || world.getBlockId(j1 - k3, k1 - l5 - j7, l1 - l2 - 2) == Block.waterStill.blockID || world.getBlockId(j1 - k3, k1 - l5 - j7, l1 - l2 - 4) == Block.waterStill.blockID || world.getBlockId(j1 - k3 - 2, k1 - l5 - j7, l1 - l2 - 6) == Block.waterStill.blockID) || world.getBlockId(j1 - k3, k1 - l5 - j7, l1 - l2 - 2) == Block.waterStill.blockID || world.getBlockId(j1 - k3, k1 - l5 - j7, l1 - l2 - 4) == Block.waterStill.blockID
{ || world.getBlockId(j1 - k3 - 2, k1 - l5 - j7, l1 - l2 - 6) == Block.waterStill.blockID) {
k6++; k6++;
} else } else {
{
flag2 = true; flag2 = true;
} }
} while(!flag2 && j7++ < 12); } while (!flag2 && j7++ < 12);
world.setBlock(j1 - k3, k1 - l5 - k6, l1 - l2 - 1, Block.stoneBrick.blockID); world.setBlock(j1 - k3, k1 - l5 - k6, l1 - l2 - 1, Block.stoneBrick.blockID);
world.setBlock(j1 - k3, (k1 - l5 - k6) + 1, l1 - l2 - 1, Block.stoneBrick.blockID); world.setBlock(j1 - k3, (k1 - l5 - k6) + 1, l1 - l2 - 1, Block.stoneBrick.blockID);
world.setBlock(j1 - k3, (k1 - l5 - k6) + 2, l1 - l2 - 1, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 - k3, (k1 - l5 - k6) + 2, l1 - l2 - 1, Block.stoneBrick.blockID, 1, 2);
@ -444,24 +367,22 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1 - k3 - 2, ((k1 - l5) + 1) - k6, l1 - l2 - 6, Block.stoneBrick.blockID); world.setBlock(j1 - k3 - 2, ((k1 - l5) + 1) - k6, l1 - l2 - 6, Block.stoneBrick.blockID);
world.setBlock(j1 - k3 - 3, k1 - l5 - k6, l1 - l2 - 6, Block.stoneBrick.blockID); world.setBlock(j1 - k3 - 3, k1 - l5 - k6, l1 - l2 - 6, Block.stoneBrick.blockID);
i8 = random.nextInt(100); i8 = random.nextInt(100);
if(i8 <= 60) if (i8 <= 60) {
{
world.setBlock(j1 - k3 - 1, k1 - l5 - k6 - i5, l1 - l2 - 6, Block.dirt.blockID); world.setBlock(j1 - k3 - 1, k1 - l5 - k6 - i5, l1 - l2 - 6, Block.dirt.blockID);
world.setBlock(j1 - k3 - 1, k1 - l5 - k6 - i5 - 1, l1 - l2 - 6, Block.dirt.blockID); world.setBlock(j1 - k3 - 1, k1 - l5 - k6 - i5 - 1, l1 - l2 - 6, Block.dirt.blockID);
} }
j7 = 1; j7 = 1;
k6 = 0; k6 = 0;
flag2 = false; flag2 = false;
do do {
{ if (world.isAirBlock(j1 + l2, k1 - l5 - j7, l1 + j4) || world.isAirBlock(j1 + l2 + 2, k1 - l5 - j7, l1 + j4) || world.isAirBlock(j1 + l2 + 4, k1 - l5 - j7, l1 + j4)
if(world.isAirBlock(j1 + l2, k1 - l5 - j7, l1 + j4) || world.isAirBlock(j1 + l2 + 2, k1 - l5 - j7, l1 + j4) || world.isAirBlock(j1 + l2 + 4, k1 - l5 - j7, l1 + j4) || world.getBlockId(j1 + l2, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID || world.getBlockId(j1 + l2 + 2, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID || world.getBlockId(j1 + l2 + 4, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID) || world.getBlockId(j1 + l2, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID || world.getBlockId(j1 + l2 + 2, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID
{ || world.getBlockId(j1 + l2 + 4, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID) {
k6++; k6++;
} else } else {
{
flag2 = true; flag2 = true;
} }
} while(!flag2 && j7++ < 12); } while (!flag2 && j7++ < 12);
world.setBlock(j1 + l2, k1 - l5 - k6, l1 + j4, Block.stoneBrick.blockID); world.setBlock(j1 + l2, k1 - l5 - k6, l1 + j4, Block.stoneBrick.blockID);
world.setBlock(j1 + l2 + 1, k1 - l5 - k6, l1 + j4, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + l2 + 1, k1 - l5 - k6, l1 + j4, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1 + l2 + 1, ((k1 - l5) + 1) - k6, l1 + j4, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + l2 + 1, ((k1 - l5) + 1) - k6, l1 + j4, Block.stoneBrick.blockID, 1, 2);
@ -475,24 +396,22 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1 + l2 + 4, ((k1 - l5) + 1) - k6, l1 + j4, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + l2 + 4, ((k1 - l5) + 1) - k6, l1 + j4, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1 + l2 + 5, k1 - l5 - k6, l1 + j4, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + l2 + 5, k1 - l5 - k6, l1 + j4, Block.stoneBrick.blockID, 1, 2);
i8 = random.nextInt(100); i8 = random.nextInt(100);
if(i8 <= 30) if (i8 <= 30) {
{
world.setBlock(j1 + l2 + 2, k1 - l5 - k6 - i5, l1 + j4, Block.dirt.blockID); world.setBlock(j1 + l2 + 2, k1 - l5 - k6 - i5, l1 + j4, Block.dirt.blockID);
world.setBlock(j1 + l2 + 2, k1 - l5 - k6 - i5 - 1, l1 + j4, Block.dirt.blockID); world.setBlock(j1 + l2 + 2, k1 - l5 - k6 - i5 - 1, l1 + j4, Block.dirt.blockID);
} }
j7 = 1; j7 = 1;
k6 = 0; k6 = 0;
flag2 = false; flag2 = false;
do do {
{ if (world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 1) || world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 3) || world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 4)
if(world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 1) || world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 3) || world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 4) || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 1) == Block.waterStill.blockID || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 3) == Block.waterStill.blockID || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 4) == Block.waterStill.blockID) || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 1) == Block.waterStill.blockID || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 3) == Block.waterStill.blockID
{ || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 4) == Block.waterStill.blockID) {
k6++; k6++;
} else } else {
{
flag2 = true; flag2 = true;
} }
} while(!flag2 && j7++ < 12); } while (!flag2 && j7++ < 12);
world.setBlock(j1 - 3, k1 - l5 - k6, l1 + k3, Block.stoneBrick.blockID); world.setBlock(j1 - 3, k1 - l5 - k6, l1 + k3, Block.stoneBrick.blockID);
world.setBlock(j1 - 3, ((k1 - l5) + 1) - k6, l1 + k3, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 - 3, ((k1 - l5) + 1) - k6, l1 + k3, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1 - 3, ((k1 - l5) + 2) - k6, l1 + k3 + 1, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 - 3, ((k1 - l5) + 2) - k6, l1 + k3 + 1, Block.stoneBrick.blockID, 1, 2);
@ -505,49 +424,12 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1 - 3, ((k1 - l5) + 1) - k6, l1 + k3 + 4, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 - 3, ((k1 - l5) + 1) - k6, l1 + k3 + 4, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1 - 3, k1 - l5 - k6, l1 + k3 + 5, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 - 3, k1 - l5 - k6, l1 + k3 + 5, Block.stoneBrick.blockID, 1, 2);
i8 = random.nextInt(100); i8 = random.nextInt(100);
if(i8 <= 30) if (i8 <= 30) {
{
world.setBlock(j1 - 3, k1 - l5 - k6 - i5, l1 + k3 + 3, Block.chest.blockID);
TileEntityChest chest = (TileEntityChest) world.getBlockTileEntity(j1 - 3, k1 - l5 - k6 - i5, l1 + k3 + 3);
Random rand = new Random();
for(int slot = 0; slot < chest.getSizeInventory(); slot++)
{
int num = rand.nextInt(16);
if(num == 1)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.enderPearl, 4, 0));
}
if(num == 2)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.diamond, 1, 0));
}
if(num == 3)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.emerald, 1, 0));
}
if(num == 4)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.appleGold, 1, 0));
}
if(num == 5)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.ingotGold, 1, 0));
}
if(num == 6)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.ingotIron, 1, 0));
}
}
world.setBlock(j1 - 3, k1 - l5 - k6 - i5 - 1, l1 + k3 + 3, Block.dirt.blockID); world.setBlock(j1 - 3, k1 - l5 - k6 - i5 - 1, l1 + k3 + 3, Block.dirt.blockID);
world.setBlock(j1 - 3, k1 - l5 - k6 - i5, l1 + k3 + 3, Block.chest.blockID);
ChestFiller.fillWithRares(world.getBlockTileEntity(j1 - 3, k1 - l5 - k6 - i5, l1 + k3 + 3));
} }
} }
return true; return true;
} }
} }

View file

@ -1,43 +1,32 @@
package MysticRuins; package mysticruins;
import java.util.Random; import java.util.Random;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.tileentity.TileEntityMobSpawner; import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.common.DungeonHooks;
public class StructureRuin extends WorldGenerator public class StructureRuin extends WorldGenerator {
{ public StructureRuin() {
public StructureRuin()
{
} }
public boolean generate(World world, Random random, int i, int j, int k) @Override
{ public boolean generate(World world, Random random, int i, int j, int k) {
int l = random.nextInt(100); int l = random.nextInt(100);
if(l >= 10) if (l >= 10) {
{
return false; return false;
} }
for(int i1 = 0; i1 < 1; i1++) for (int i1 = 0; i1 < 1; i1++) {
{
int j1 = (i + random.nextInt(8)) - random.nextInt(8); int j1 = (i + random.nextInt(8)) - random.nextInt(8);
int k1 = (j + random.nextInt(4)) - random.nextInt(4); int k1 = (j + random.nextInt(4)) - random.nextInt(4);
int l1 = (k + random.nextInt(8)) - random.nextInt(8); int l1 = (k + random.nextInt(8)) - random.nextInt(8);
if(!world.isAirBlock(j1, k1, l1) || world.getBlockId(j1, k1 - 1, l1) != Block.grass.blockID || !Block.pumpkin.canPlaceBlockAt(world, j1, k1, l1)) if (!world.isAirBlock(j1, k1, l1) || world.getBlockId(j1, k1 - 1, l1) != Block.grass.blockID || !Block.pumpkin.canPlaceBlockAt(world, j1, k1, l1)) {
{
continue; continue;
} }
int i2 = random.nextInt(3) + 1; int i2 = random.nextInt(3) + 1;
if(i2 == 1) if (i2 == 1) {
{
int j2 = random.nextInt(8) + 5; int j2 = random.nextInt(8) + 5;
int i3 = random.nextInt(8) + 5; int i3 = random.nextInt(8) + 5;
int l3 = random.nextInt(8) + 5; int l3 = random.nextInt(8) + 5;
@ -48,11 +37,9 @@ public class StructureRuin extends WorldGenerator
boolean flag = false; boolean flag = false;
int k7 = random.nextInt(100); int k7 = random.nextInt(100);
int j8 = random.nextInt(100); int j8 = random.nextInt(100);
if(j8 <= 20) if (j8 <= 20) {
{
j5 = 0; j5 = 0;
} else } else {
{
j5 = random.nextInt(4) + 5; j5 = random.nextInt(4) + 5;
} }
world.setBlock(j1, k1 - j5, l1, Block.cobblestone.blockID); world.setBlock(j1, k1 - j5, l1, Block.cobblestone.blockID);
@ -68,60 +55,21 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1, k1 - j5, l1 + 3, Block.cobblestoneMossy.blockID); world.setBlock(j1, k1 - j5, l1 + 3, Block.cobblestoneMossy.blockID);
world.setBlock(j1, (k1 - j5) + 1, l1 + 3, Block.cobblestone.blockID); world.setBlock(j1, (k1 - j5) + 1, l1 + 3, Block.cobblestone.blockID);
world.setBlock(j1, (k1 - j5) + 2, l1 + 3, Block.cobblestone.blockID); world.setBlock(j1, (k1 - j5) + 2, l1 + 3, Block.cobblestone.blockID);
world.setBlock(j1, k1 - j5 - k4, l1 + 2, Block.chest.blockID);
TileEntityChest tileentitychest = (TileEntityChest) world.getBlockTileEntity(j1, k1 - j5 - k4, l1 + 2);
Random rand = new Random();
for(int slot = 0; slot < tileentitychest.getSizeInventory(); slot++)
{
int num = rand.nextInt(32);
if(num == 1)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.pickaxeIron, 1, 0));
}
if(num == 2)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.axeIron, 1, 0));
}
if(num == 3)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.swordIron, 1, 0));
}
if(num == 4)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.shovelIron, 1, 0));
}
if(num == 5)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.ingotGold, 1, 0));
}
if(num == 6)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.ingotIron, 1, 0));
}
}
world.setBlock(j1, k1 - j5 - k4 - 1, l1 + 2, Block.dirt.blockID); world.setBlock(j1, k1 - j5 - k4 - 1, l1 + 2, Block.dirt.blockID);
world.setBlock(j1, k1 - j5 - k4, l1 + 2, Block.chest.blockID);
ChestFiller.fillWithValuables(world.getBlockTileEntity(j1, k1 - j5 - k4, l1 + 2));
l6 = 1; l6 = 1;
i6 = 0; i6 = 0;
flag = false; flag = false;
do do {
{ if (world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 4) || world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 5) || world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 6)
if(world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 4) || world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 5) || world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 6) || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 4) == Block.waterStill.blockID || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 5) == Block.waterStill.blockID || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 6) == Block.waterStill.blockID) || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 4) == Block.waterStill.blockID || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 5) == Block.waterStill.blockID
{ || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 6) == Block.waterStill.blockID) {
i6++; i6++;
} else } else {
{
flag = true; flag = true;
} }
} while(!flag && l6++ < 12); } while (!flag && l6++ < 12);
world.setBlock(j1 + l3, k1 - j5 - i6, l1 + l3 + 4, Block.cobblestone.blockID); world.setBlock(j1 + l3, k1 - j5 - i6, l1 + l3 + 4, Block.cobblestone.blockID);
world.setBlock(j1 + l3, ((k1 - j5) + 1) - i6, l1 + l3 + 4, Block.cobblestoneMossy.blockID); world.setBlock(j1 + l3, ((k1 - j5) + 1) - i6, l1 + l3 + 4, Block.cobblestoneMossy.blockID);
world.setBlock(j1 + l3 + 1, k1 - j5 - i6, l1 + l3 + 4, Block.cobblestoneMossy.blockID); world.setBlock(j1 + l3 + 1, k1 - j5 - i6, l1 + l3 + 4, Block.cobblestoneMossy.blockID);
@ -138,33 +86,26 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1 + l3, ((k1 - j5) + 1) - i6, l1 + l3 + 7, Block.cobblestone.blockID); world.setBlock(j1 + l3, ((k1 - j5) + 1) - i6, l1 + l3 + 7, Block.cobblestone.blockID);
world.setBlock(j1 + l3, ((k1 - j5) + 2) - i6, l1 + l3 + 7, Block.cobblestoneMossy.blockID); world.setBlock(j1 + l3, ((k1 - j5) + 2) - i6, l1 + l3 + 7, Block.cobblestoneMossy.blockID);
k7 = random.nextInt(100); k7 = random.nextInt(100);
if(k7 <= 30) if (k7 <= 30) {
{
world.setBlock(j1 + l3, k1 - j5 - i6 - k4, l1 + l3 + 5, Block.mobSpawner.blockID); world.setBlock(j1 + l3, k1 - j5 - i6 - k4, l1 + l3 + 5, Block.mobSpawner.blockID);
TileEntityMobSpawner spawner = (TileEntityMobSpawner) world.getBlockTileEntity(j1 + l3, k1 - j5 - i6 - k4, l1 + l3 + 5); TileEntityMobSpawner spawner = (TileEntityMobSpawner) world.getBlockTileEntity(j1 + l3, k1 - j5 - i6 - k4, l1 + l3 + 5);
if(spawner != null) if (spawner != null) {
{ spawner.getSpawnerLogic().setMobID(DungeonHooks.getRandomDungeonMob(random));
spawner.getSpawnerLogic().setMobID("Zombie");
} }
world.setBlock(j1 + l3, k1 - j5 - i6 - k4 - 1, l1 + l3 + 5, Block.dirt.blockID); world.setBlock(j1 + l3, k1 - j5 - i6 - k4 - 1, l1 + l3 + 5, Block.dirt.blockID);
} }
l6 = 1; l6 = 1;
i6 = 0; i6 = 0;
flag = false; flag = false;
do do {
{ if (world.isAirBlock(j1 - i3, k1 - j5 - l6, l1 - 4) || world.isAirBlock(j1 - i3, k1 - j5 - l6, l1 - 5) || world.isAirBlock(j1 - i3 - 1, k1 - j5 - l6, l1 - 5)
if(world.isAirBlock(j1 - i3, k1 - j5 - l6, l1 - 4) || world.isAirBlock(j1 - i3, k1 - j5 - l6, l1 - 5) || world.isAirBlock(j1 - i3 - 1, k1 - j5 - l6, l1 - 5) || world.getBlockId(j1 - i3, k1 - j5 - l6, l1 - 4) == Block.waterStill.blockID || world.getBlockId(j1 - i3, k1 - j5 - l6, l1 - 5) == Block.waterStill.blockID || world.getBlockId(j1 - i3 - 1, k1 - j5 - l6, l1 - 5) == Block.waterStill.blockID) || world.getBlockId(j1 - i3, k1 - j5 - l6, l1 - 4) == Block.waterStill.blockID || world.getBlockId(j1 - i3, k1 - j5 - l6, l1 - 5) == Block.waterStill.blockID
{ || world.getBlockId(j1 - i3 - 1, k1 - j5 - l6, l1 - 5) == Block.waterStill.blockID) {
i6++; i6++;
} else } else {
{
flag = true; flag = true;
} }
} while(!flag && l6++ < 12); } while (!flag && l6++ < 12);
world.setBlock(j1 - i3, k1 - j5 - i6, l1 - 4, Block.cobblestone.blockID); world.setBlock(j1 - i3, k1 - j5 - i6, l1 - 4, Block.cobblestone.blockID);
world.setBlock(j1 - i3, ((k1 - j5) + 1) - i6, l1 - 4, Block.cobblestoneMossy.blockID); world.setBlock(j1 - i3, ((k1 - j5) + 1) - i6, l1 - 4, Block.cobblestoneMossy.blockID);
world.setBlock(j1 - i3, k1 - j5 - i6, l1 - 5, Block.cobblestoneMossy.blockID); world.setBlock(j1 - i3, k1 - j5 - i6, l1 - 5, Block.cobblestoneMossy.blockID);
@ -173,14 +114,11 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1 - i3 - 1, ((k1 - j5) + 2) - i6, l1 - 5, Block.cobblestoneMossy.blockID); world.setBlock(j1 - i3 - 1, ((k1 - j5) + 2) - i6, l1 - 5, Block.cobblestoneMossy.blockID);
world.setBlock(j1 - i3 - 2, k1 - j5 - i6, l1 - 5, Block.cobblestone.blockID); world.setBlock(j1 - i3 - 2, k1 - j5 - i6, l1 - 5, Block.cobblestone.blockID);
k7 = random.nextInt(100); k7 = random.nextInt(100);
if(k7 <= 60) if (k7 <= 60) {
{
world.setBlock(j1 - i3 - 1, k1 - j5 - i6 - k4, l1 - 5, Block.dirt.blockID); world.setBlock(j1 - i3 - 1, k1 - j5 - i6 - k4, l1 - 5, Block.dirt.blockID);
world.setBlock(j1 - i3 - 1, k1 - j5 - i6 - k4 - 1, l1 - 5, Block.dirt.blockID); world.setBlock(j1 - i3 - 1, k1 - j5 - i6 - k4 - 1, l1 - 5, Block.dirt.blockID);
} }
} } else if (i2 == 2) {
if(i2 == 2)
{
int k2 = random.nextInt(8) + 5; int k2 = random.nextInt(8) + 5;
int j3 = random.nextInt(8) + 5; int j3 = random.nextInt(8) + 5;
int i4 = random.nextInt(8) + 5; int i4 = random.nextInt(8) + 5;
@ -191,11 +129,9 @@ public class StructureRuin extends WorldGenerator
boolean flag1 = false; boolean flag1 = false;
int l7 = random.nextInt(100); int l7 = random.nextInt(100);
int k8 = random.nextInt(100); int k8 = random.nextInt(100);
if(k8 <= 20) if (k8 <= 20) {
{
k5 = 0; k5 = 0;
} else } else {
{
k5 = random.nextInt(4) + 5; k5 = random.nextInt(4) + 5;
} }
world.setBlock(j1, k1 - k5, l1, Block.cobblestone.blockID); world.setBlock(j1, k1 - k5, l1, Block.cobblestone.blockID);
@ -214,16 +150,15 @@ public class StructureRuin extends WorldGenerator
i7 = 1; i7 = 1;
j6 = 0; j6 = 0;
flag1 = false; flag1 = false;
do do {
{ if (world.isAirBlock(j1 - k2, k1 - k5 - i7, l1 - 4) || world.isAirBlock(j1 - k2, k1 - k5 - i7, l1 - 5) || world.isAirBlock(j1 - k2 - 1, k1 - k5 - i7, l1 - 5)
if(world.isAirBlock(j1 - k2, k1 - k5 - i7, l1 - 4) || world.isAirBlock(j1 - k2, k1 - k5 - i7, l1 - 5) || world.isAirBlock(j1 - k2 - 1, k1 - k5 - i7, l1 - 5) || world.getBlockId(j1 - k2, k1 - k5 - i7, l1 - 4) == Block.waterStill.blockID || world.getBlockId(j1 - k2, k1 - k5 - i7, l1 - 5) == Block.waterStill.blockID || world.getBlockId(j1 - k2 - 1, k1 - k5 - i7, l1 - 5) == Block.waterStill.blockID) || world.getBlockId(j1 - k2, k1 - k5 - i7, l1 - 4) == Block.waterStill.blockID || world.getBlockId(j1 - k2, k1 - k5 - i7, l1 - 5) == Block.waterStill.blockID
{ || world.getBlockId(j1 - k2 - 1, k1 - k5 - i7, l1 - 5) == Block.waterStill.blockID) {
j6++; j6++;
} else } else {
{
flag1 = true; flag1 = true;
} }
} while(!flag1 && i7++ < 12); } while (!flag1 && i7++ < 12);
world.setBlock(j1 - k2, k1 - k5 - j6, l1 - 3, Block.cobblestone.blockID); world.setBlock(j1 - k2, k1 - k5 - j6, l1 - 3, Block.cobblestone.blockID);
world.setBlock(j1 - k2, k1 - k5 - j6, l1 - 4, Block.cobblestoneMossy.blockID); world.setBlock(j1 - k2, k1 - k5 - j6, l1 - 4, Block.cobblestoneMossy.blockID);
world.setBlock(j1 - k2, ((k1 - k5) + 1) - j6, l1 - 4, Block.cobblestoneMossy.blockID); world.setBlock(j1 - k2, ((k1 - k5) + 1) - j6, l1 - 4, Block.cobblestoneMossy.blockID);
@ -238,24 +173,22 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1 - k2 - 1, ((k1 - k5) + 2) - j6, l1 - 5, Block.cobblestoneMossy.blockID); world.setBlock(j1 - k2 - 1, ((k1 - k5) + 2) - j6, l1 - 5, Block.cobblestoneMossy.blockID);
world.setBlock(j1 - k2 - 2, k1 - k5 - j6, l1 - 5, Block.cobblestone.blockID); world.setBlock(j1 - k2 - 2, k1 - k5 - j6, l1 - 5, Block.cobblestone.blockID);
l7 = random.nextInt(100); l7 = random.nextInt(100);
if(l7 <= 30) if (l7 <= 30) {
{
world.setBlock(j1 - k2 - 1, k1 - k5 - j6 - l4, l1 - 5, Block.dirt.blockID); world.setBlock(j1 - k2 - 1, k1 - k5 - j6 - l4, l1 - 5, Block.dirt.blockID);
world.setBlock(j1 - k2 - 1, k1 - k5 - j6 - l4 - 1, l1 - 5, Block.dirt.blockID); world.setBlock(j1 - k2 - 1, k1 - k5 - j6 - l4 - 1, l1 - 5, Block.dirt.blockID);
} }
i7 = 1; i7 = 1;
j6 = 0; j6 = 0;
flag1 = false; flag1 = false;
do do {
{ if (world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 4) || world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 6) || world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 8)
if(world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 4) || world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 6) || world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 8) || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 4) == Block.waterStill.blockID || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 6) == Block.waterStill.blockID || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 8) == Block.waterStill.blockID) || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 4) == Block.waterStill.blockID || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 6) == Block.waterStill.blockID
{ || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 8) == Block.waterStill.blockID) {
j6++; j6++;
} else } else {
{
flag1 = true; flag1 = true;
} }
} while(!flag1 && i7++ < 12); } while (!flag1 && i7++ < 12);
world.setBlock(j1 + i4, k1 - k5 - j6, l1 + 4, Block.cobblestone.blockID); world.setBlock(j1 + i4, k1 - k5 - j6, l1 + 4, Block.cobblestone.blockID);
world.setBlock(j1 + i4, ((k1 - k5) + 1) - j6, l1 + 4, Block.cobblestoneMossy.blockID); world.setBlock(j1 + i4, ((k1 - k5) + 1) - j6, l1 + 4, Block.cobblestoneMossy.blockID);
world.setBlock(j1 + i4 + 1, k1 - k5 - j6, l1 + 4, Block.cobblestoneMossy.blockID); world.setBlock(j1 + i4 + 1, k1 - k5 - j6, l1 + 4, Block.cobblestoneMossy.blockID);
@ -275,24 +208,22 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1 + i4, ((k1 - k5) + 1) - j6, l1 + 8, Block.cobblestoneMossy.blockID); world.setBlock(j1 + i4, ((k1 - k5) + 1) - j6, l1 + 8, Block.cobblestoneMossy.blockID);
world.setBlock(j1 + i4, k1 - k5 - j6, l1 + 9, Block.cobblestoneMossy.blockID); world.setBlock(j1 + i4, k1 - k5 - j6, l1 + 9, Block.cobblestoneMossy.blockID);
l7 = random.nextInt(100); l7 = random.nextInt(100);
if(l7 <= 60) if (l7 <= 60) {
{
world.setBlock(j1 + i4, k1 - k5 - j6 - l4, l1 + 7, Block.dirt.blockID); world.setBlock(j1 + i4, k1 - k5 - j6 - l4, l1 + 7, Block.dirt.blockID);
world.setBlock(j1 + i4, k1 - k5 - j6 - l4 - 1, l1 + 7, Block.dirt.blockID); world.setBlock(j1 + i4, k1 - k5 - j6 - l4 - 1, l1 + 7, Block.dirt.blockID);
} }
i7 = 1; i7 = 1;
j6 = 0; j6 = 0;
flag1 = false; flag1 = false;
do do {
{ if (world.isAirBlock(j1 - j3, k1 - k5 - i7, l1 + i4) || world.isAirBlock(j1 - j3, k1 - k5 - i7, (l1 + i4) - 2) || world.isAirBlock((j1 - j3) + 1, k1 - k5 - i7, l1 + i4)
if(world.isAirBlock(j1 - j3, k1 - k5 - i7, l1 + i4) || world.isAirBlock(j1 - j3, k1 - k5 - i7, (l1 + i4) - 2) || world.isAirBlock((j1 - j3) + 1, k1 - k5 - i7, l1 + i4) || world.getBlockId(j1 - j3, k1 - k5 - i7, l1 + i4) == Block.waterStill.blockID || world.getBlockId(j1 - j3, k1 - k5 - i7, (l1 + i4) - 2) == Block.waterStill.blockID || world.getBlockId((j1 - j3) + 1, k1 - k5 - i7, l1 + i4) == Block.waterStill.blockID) || world.getBlockId(j1 - j3, k1 - k5 - i7, l1 + i4) == Block.waterStill.blockID || world.getBlockId(j1 - j3, k1 - k5 - i7, (l1 + i4) - 2) == Block.waterStill.blockID
{ || world.getBlockId((j1 - j3) + 1, k1 - k5 - i7, l1 + i4) == Block.waterStill.blockID) {
j6++; j6++;
} else } else {
{
flag1 = true; flag1 = true;
} }
} while(!flag1 && i7++ < 12); } while (!flag1 && i7++ < 12);
world.setBlock((j1 - j3) + 1, k1 - k5 - j6, l1 + i4, Block.cobblestone.blockID); world.setBlock((j1 - j3) + 1, k1 - k5 - j6, l1 + i4, Block.cobblestone.blockID);
world.setBlock((j1 - j3) + 1, ((k1 - k5) + 1) - j6, l1 + i4, Block.cobblestoneMossy.blockID); world.setBlock((j1 - j3) + 1, ((k1 - k5) + 1) - j6, l1 + i4, Block.cobblestoneMossy.blockID);
world.setBlock((j1 - j3) + 1, ((k1 - k5) + 2) - j6, l1 + i4, Block.cobblestoneMossy.blockID); world.setBlock((j1 - j3) + 1, ((k1 - k5) + 2) - j6, l1 + i4, Block.cobblestoneMossy.blockID);
@ -311,24 +242,22 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1 - j3, ((k1 - k5) + 2) - j6, (l1 + i4) - 3, Block.cobblestone.blockID); world.setBlock(j1 - j3, ((k1 - k5) + 2) - j6, (l1 + i4) - 3, Block.cobblestone.blockID);
world.setBlock(j1 - j3, ((k1 - k5) + 3) - j6, (l1 + i4) - 3, Block.cobblestoneMossy.blockID); world.setBlock(j1 - j3, ((k1 - k5) + 3) - j6, (l1 + i4) - 3, Block.cobblestoneMossy.blockID);
l7 = random.nextInt(100); l7 = random.nextInt(100);
if(l7 <= 30) if (l7 <= 30) {
{
world.setBlock(j1 - j3, k1 - k5 - j6 - l4, (l1 + i4) - 2, Block.dirt.blockID); world.setBlock(j1 - j3, k1 - k5 - j6 - l4, (l1 + i4) - 2, Block.dirt.blockID);
world.setBlock(j1 - j3, k1 - k5 - j6 - l4 - 1, (l1 + i4) - 2, Block.dirt.blockID); world.setBlock(j1 - j3, k1 - k5 - j6 - l4 - 1, (l1 + i4) - 2, Block.dirt.blockID);
} }
i7 = 1; i7 = 1;
j6 = 0; j6 = 0;
flag1 = false; flag1 = false;
do do {
{ if (world.isAirBlock(j1 + j3 + 4, k1 - k5 - i7, l1 - 6) || world.isAirBlock(j1 + j3 + 4, k1 - k5 - i7, l1 - 7) || world.isAirBlock(j1 + j3 + 5, k1 - k5 - i7, l1 - 7)
if(world.isAirBlock(j1 + j3 + 4, k1 - k5 - i7, l1 - 6) || world.isAirBlock(j1 + j3 + 4, k1 - k5 - i7, l1 - 7) || world.isAirBlock(j1 + j3 + 5, k1 - k5 - i7, l1 - 7) || world.getBlockId(j1 + j3 + 4, k1 - k5 - i7, l1 - 6) == Block.waterStill.blockID || world.getBlockId(j1 + j3 + 4, k1 - k5 - i7, l1 - 7) == Block.waterStill.blockID || world.getBlockId(j1 + j3 + 5, k1 - k5 - i7, l1 - 7) == Block.waterStill.blockID) || world.getBlockId(j1 + j3 + 4, k1 - k5 - i7, l1 - 6) == Block.waterStill.blockID || world.getBlockId(j1 + j3 + 4, k1 - k5 - i7, l1 - 7) == Block.waterStill.blockID
{ || world.getBlockId(j1 + j3 + 5, k1 - k5 - i7, l1 - 7) == Block.waterStill.blockID) {
j6++; j6++;
} else } else {
{
flag1 = true; flag1 = true;
} }
} while(!flag1 && i7++ < 12); } while (!flag1 && i7++ < 12);
world.setBlock(j1 + j3 + 4, k1 - k5 - j6, l1 - 6, Block.cobblestone.blockID); world.setBlock(j1 + j3 + 4, k1 - k5 - j6, l1 - 6, Block.cobblestone.blockID);
world.setBlock(j1 + j3 + 4, ((k1 - k5) + 1) - j6, l1 - 6, Block.cobblestoneMossy.blockID); world.setBlock(j1 + j3 + 4, ((k1 - k5) + 1) - j6, l1 - 6, Block.cobblestoneMossy.blockID);
world.setBlock(j1 + j3 + 4, ((k1 - k5) + 2) - j6, l1 - 6, Block.cobblestoneMossy.blockID); world.setBlock(j1 + j3 + 4, ((k1 - k5) + 2) - j6, l1 - 6, Block.cobblestoneMossy.blockID);
@ -339,14 +268,12 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1 + j3 + 5, ((k1 - k5) + 2) - j6, l1 - 7, Block.cobblestoneMossy.blockID); world.setBlock(j1 + j3 + 5, ((k1 - k5) + 2) - j6, l1 - 7, Block.cobblestoneMossy.blockID);
world.setBlock(j1 + j3 + 6, k1 - k5 - j6, l1 - 7, Block.cobblestone.blockID); world.setBlock(j1 + j3 + 6, k1 - k5 - j6, l1 - 7, Block.cobblestone.blockID);
l7 = random.nextInt(100); l7 = random.nextInt(100);
if(l7 <= 30) if (l7 <= 30) {
{
world.setBlock(j1 + j3 + 4, k1 - k5 - j6 - l4, l1 - 7, Block.dirt.blockID); world.setBlock(j1 + j3 + 4, k1 - k5 - j6 - l4, l1 - 7, Block.dirt.blockID);
world.setBlock(j1 + j3 + 4, k1 - k5 - j6 - l4 - 1, l1 - 7, Block.dirt.blockID); world.setBlock(j1 + j3 + 4, k1 - k5 - j6 - l4 - 1, l1 - 7, Block.dirt.blockID);
} }
} }
if(i2 != 3) if (i2 != 3) {
{
continue; continue;
} }
int l2 = random.nextInt(8) + 5; int l2 = random.nextInt(8) + 5;
@ -359,11 +286,9 @@ public class StructureRuin extends WorldGenerator
boolean flag2 = false; boolean flag2 = false;
int i8 = random.nextInt(100); int i8 = random.nextInt(100);
int l8 = random.nextInt(100); int l8 = random.nextInt(100);
if(l8 <= 20) if (l8 <= 20) {
{
l5 = 0; l5 = 0;
} else } else {
{
l5 = random.nextInt(4) + 5; l5 = random.nextInt(4) + 5;
} }
world.setBlock(j1, k1 - l5, l1, Block.cobblestone.blockID); world.setBlock(j1, k1 - l5, l1, Block.cobblestone.blockID);
@ -380,22 +305,21 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1, (k1 - l5) + 2, l1 + 1, Block.cobblestoneMossy.blockID); world.setBlock(j1, (k1 - l5) + 2, l1 + 1, Block.cobblestoneMossy.blockID);
world.setBlock(j1, k1 - l5, l1 + 2, Block.cobblestone.blockID); world.setBlock(j1, k1 - l5, l1 + 2, Block.cobblestone.blockID);
world.setBlock(j1, (k1 - l5) + 1, l1 + 2, Block.cobblestoneMossy.blockID); world.setBlock(j1, (k1 - l5) + 1, l1 + 2, Block.cobblestoneMossy.blockID);
world.setBlock(j1, k1 - l5 - i5, l1 + 1, Block.dirt.blockID); world.setBlock(j1, k1 - l5 - i5, l1 + 1, Block.dirt.blockID);
world.setBlock(j1, k1 - l5 - i5 - 1, l1 + 1, Block.dirt.blockID); world.setBlock(j1, k1 - l5 - i5 - 1, l1 + 1, Block.dirt.blockID);
j7 = 1; j7 = 1;
k6 = 0; k6 = 0;
flag2 = false; flag2 = false;
do do {
{ if (world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 2) || world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 3) || world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 4)
if(world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 2) || world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 3) || world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 4) || world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 2) == Block.waterStill.blockID || world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 3) == Block.waterStill.blockID || world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 4) == Block.waterStill.blockID) || world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 2) == Block.waterStill.blockID
{ || world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 3) == Block.waterStill.blockID
|| world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 4) == Block.waterStill.blockID) {
k6++; k6++;
} else } else {
{
flag2 = true; flag2 = true;
} }
} while(!flag2 && j7++ < 12); } while (!flag2 && j7++ < 12);
world.setBlock(j1 + k3 + l2, k1 - l5 - k6, l1 + j4, Block.cobblestone.blockID); world.setBlock(j1 + k3 + l2, k1 - l5 - k6, l1 + j4, Block.cobblestone.blockID);
world.setBlock(j1 + k3 + l2, ((k1 - l5) + 1) - k6, l1 + j4, Block.cobblestoneMossy.blockID); world.setBlock(j1 + k3 + l2, ((k1 - l5) + 1) - k6, l1 + j4, Block.cobblestoneMossy.blockID);
world.setBlock(j1 + k3 + l2 + 1, k1 - l5 - k6, l1 + j4, Block.cobblestoneMossy.blockID); world.setBlock(j1 + k3 + l2 + 1, k1 - l5 - k6, l1 + j4, Block.cobblestoneMossy.blockID);
@ -413,24 +337,22 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1 + k3 + l2, k1 - l5 - k6, l1 + j4 + 4, Block.cobblestone.blockID); world.setBlock(j1 + k3 + l2, k1 - l5 - k6, l1 + j4 + 4, Block.cobblestone.blockID);
world.setBlock(j1 + k3 + l2, k1 - l5 - k6, l1 + j4 + 6, Block.cobblestone.blockID); world.setBlock(j1 + k3 + l2, k1 - l5 - k6, l1 + j4 + 6, Block.cobblestone.blockID);
i8 = random.nextInt(100); i8 = random.nextInt(100);
if(i8 <= 30) if (i8 <= 30) {
{
world.setBlock(j1 + k3 + l2, k1 - l5 - k6 - i5, l1 + j4 + 1, Block.dirt.blockID); world.setBlock(j1 + k3 + l2, k1 - l5 - k6 - i5, l1 + j4 + 1, Block.dirt.blockID);
world.setBlock(j1 + k3 + l2, k1 - l5 - k6 - i5 - 1, l1 + j4 + 1, Block.dirt.blockID); world.setBlock(j1 + k3 + l2, k1 - l5 - k6 - i5 - 1, l1 + j4 + 1, Block.dirt.blockID);
} }
j7 = 1; j7 = 1;
k6 = 0; k6 = 0;
flag2 = false; flag2 = false;
do do {
{ if (world.isAirBlock(j1 - k3, k1 - l5 - j7, l1 - l2 - 2) || world.isAirBlock(j1 - k3, k1 - l5 - j7, l1 - l2 - 4) || world.isAirBlock(j1 - k3 - 2, k1 - l5 - j7, l1 - l2 - 6)
if(world.isAirBlock(j1 - k3, k1 - l5 - j7, l1 - l2 - 2) || world.isAirBlock(j1 - k3, k1 - l5 - j7, l1 - l2 - 4) || world.isAirBlock(j1 - k3 - 2, k1 - l5 - j7, l1 - l2 - 6) || world.getBlockId(j1 - k3, k1 - l5 - j7, l1 - l2 - 2) == Block.waterStill.blockID || world.getBlockId(j1 - k3, k1 - l5 - j7, l1 - l2 - 4) == Block.waterStill.blockID || world.getBlockId(j1 - k3 - 2, k1 - l5 - j7, l1 - l2 - 6) == Block.waterStill.blockID) || world.getBlockId(j1 - k3, k1 - l5 - j7, l1 - l2 - 2) == Block.waterStill.blockID || world.getBlockId(j1 - k3, k1 - l5 - j7, l1 - l2 - 4) == Block.waterStill.blockID
{ || world.getBlockId(j1 - k3 - 2, k1 - l5 - j7, l1 - l2 - 6) == Block.waterStill.blockID) {
k6++; k6++;
} else } else {
{
flag2 = true; flag2 = true;
} }
} while(!flag2 && j7++ < 12); } while (!flag2 && j7++ < 12);
world.setBlock(j1 - k3, k1 - l5 - k6, l1 - l2 - 1, Block.cobblestone.blockID); world.setBlock(j1 - k3, k1 - l5 - k6, l1 - l2 - 1, Block.cobblestone.blockID);
world.setBlock(j1 - k3, (k1 - l5 - k6) + 1, l1 - l2 - 1, Block.cobblestone.blockID); world.setBlock(j1 - k3, (k1 - l5 - k6) + 1, l1 - l2 - 1, Block.cobblestone.blockID);
world.setBlock(j1 - k3, (k1 - l5 - k6) + 2, l1 - l2 - 1, Block.cobblestoneMossy.blockID); world.setBlock(j1 - k3, (k1 - l5 - k6) + 2, l1 - l2 - 1, Block.cobblestoneMossy.blockID);
@ -444,24 +366,22 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1 - k3 - 2, ((k1 - l5) + 1) - k6, l1 - l2 - 6, Block.cobblestone.blockID); world.setBlock(j1 - k3 - 2, ((k1 - l5) + 1) - k6, l1 - l2 - 6, Block.cobblestone.blockID);
world.setBlock(j1 - k3 - 3, k1 - l5 - k6, l1 - l2 - 6, Block.cobblestone.blockID); world.setBlock(j1 - k3 - 3, k1 - l5 - k6, l1 - l2 - 6, Block.cobblestone.blockID);
i8 = random.nextInt(100); i8 = random.nextInt(100);
if(i8 <= 60) if (i8 <= 60) {
{
world.setBlock(j1 - k3 - 1, k1 - l5 - k6 - i5, l1 - l2 - 6, Block.dirt.blockID); world.setBlock(j1 - k3 - 1, k1 - l5 - k6 - i5, l1 - l2 - 6, Block.dirt.blockID);
world.setBlock(j1 - k3 - 1, k1 - l5 - k6 - i5 - 1, l1 - l2 - 6, Block.dirt.blockID); world.setBlock(j1 - k3 - 1, k1 - l5 - k6 - i5 - 1, l1 - l2 - 6, Block.dirt.blockID);
} }
j7 = 1; j7 = 1;
k6 = 0; k6 = 0;
flag2 = false; flag2 = false;
do do {
{ if (world.isAirBlock(j1 + l2, k1 - l5 - j7, l1 + j4) || world.isAirBlock(j1 + l2 + 2, k1 - l5 - j7, l1 + j4) || world.isAirBlock(j1 + l2 + 4, k1 - l5 - j7, l1 + j4)
if(world.isAirBlock(j1 + l2, k1 - l5 - j7, l1 + j4) || world.isAirBlock(j1 + l2 + 2, k1 - l5 - j7, l1 + j4) || world.isAirBlock(j1 + l2 + 4, k1 - l5 - j7, l1 + j4) || world.getBlockId(j1 + l2, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID || world.getBlockId(j1 + l2 + 2, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID || world.getBlockId(j1 + l2 + 4, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID) || world.getBlockId(j1 + l2, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID || world.getBlockId(j1 + l2 + 2, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID
{ || world.getBlockId(j1 + l2 + 4, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID) {
k6++; k6++;
} else } else {
{
flag2 = true; flag2 = true;
} }
} while(!flag2 && j7++ < 12); } while (!flag2 && j7++ < 12);
world.setBlock(j1 + l2, k1 - l5 - k6, l1 + j4, Block.cobblestone.blockID); world.setBlock(j1 + l2, k1 - l5 - k6, l1 + j4, Block.cobblestone.blockID);
world.setBlock(j1 + l2 + 1, k1 - l5 - k6, l1 + j4, Block.cobblestoneMossy.blockID); world.setBlock(j1 + l2 + 1, k1 - l5 - k6, l1 + j4, Block.cobblestoneMossy.blockID);
world.setBlock(j1 + l2 + 1, ((k1 - l5) + 1) - k6, l1 + j4, Block.cobblestoneMossy.blockID); world.setBlock(j1 + l2 + 1, ((k1 - l5) + 1) - k6, l1 + j4, Block.cobblestoneMossy.blockID);
@ -475,24 +395,22 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1 + l2 + 4, ((k1 - l5) + 1) - k6, l1 + j4, Block.cobblestoneMossy.blockID); world.setBlock(j1 + l2 + 4, ((k1 - l5) + 1) - k6, l1 + j4, Block.cobblestoneMossy.blockID);
world.setBlock(j1 + l2 + 5, k1 - l5 - k6, l1 + j4, Block.cobblestoneMossy.blockID); world.setBlock(j1 + l2 + 5, k1 - l5 - k6, l1 + j4, Block.cobblestoneMossy.blockID);
i8 = random.nextInt(100); i8 = random.nextInt(100);
if(i8 <= 30) if (i8 <= 30) {
{
world.setBlock(j1 + l2 + 2, k1 - l5 - k6 - i5, l1 + j4, Block.dirt.blockID); world.setBlock(j1 + l2 + 2, k1 - l5 - k6 - i5, l1 + j4, Block.dirt.blockID);
world.setBlock(j1 + l2 + 2, k1 - l5 - k6 - i5 - 1, l1 + j4, Block.dirt.blockID); world.setBlock(j1 + l2 + 2, k1 - l5 - k6 - i5 - 1, l1 + j4, Block.dirt.blockID);
} }
j7 = 1; j7 = 1;
k6 = 0; k6 = 0;
flag2 = false; flag2 = false;
do do {
{ if (world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 1) || world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 3) || world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 4)
if(world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 1) || world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 3) || world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 4) || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 1) == Block.waterStill.blockID || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 3) == Block.waterStill.blockID || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 4) == Block.waterStill.blockID) || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 1) == Block.waterStill.blockID || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 3) == Block.waterStill.blockID
{ || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 4) == Block.waterStill.blockID) {
k6++; k6++;
} else } else {
{
flag2 = true; flag2 = true;
} }
} while(!flag2 && j7++ < 12); } while (!flag2 && j7++ < 12);
world.setBlock(j1 - 3, k1 - l5 - k6, l1 + k3, Block.cobblestone.blockID); world.setBlock(j1 - 3, k1 - l5 - k6, l1 + k3, Block.cobblestone.blockID);
world.setBlock(j1 - 3, ((k1 - l5) + 1) - k6, l1 + k3, Block.cobblestoneMossy.blockID); world.setBlock(j1 - 3, ((k1 - l5) + 1) - k6, l1 + k3, Block.cobblestoneMossy.blockID);
world.setBlock(j1 - 3, ((k1 - l5) + 2) - k6, l1 + k3 + 1, Block.cobblestoneMossy.blockID); world.setBlock(j1 - 3, ((k1 - l5) + 2) - k6, l1 + k3 + 1, Block.cobblestoneMossy.blockID);
@ -505,49 +423,12 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1 - 3, ((k1 - l5) + 1) - k6, l1 + k3 + 4, Block.cobblestoneMossy.blockID); world.setBlock(j1 - 3, ((k1 - l5) + 1) - k6, l1 + k3 + 4, Block.cobblestoneMossy.blockID);
world.setBlock(j1 - 3, k1 - l5 - k6, l1 + k3 + 5, Block.cobblestoneMossy.blockID); world.setBlock(j1 - 3, k1 - l5 - k6, l1 + k3 + 5, Block.cobblestoneMossy.blockID);
i8 = random.nextInt(100); i8 = random.nextInt(100);
if(i8 <= 30) if (i8 <= 30) {
{
world.setBlock(j1 - 3, k1 - l5 - k6 - i5, l1 + k3 + 3, Block.chest.blockID);
TileEntityChest chest = (TileEntityChest) world.getBlockTileEntity(j1 - 3, k1 - l5 - k6 - i5, l1 + k3 + 3);
Random rand = new Random();
for(int slot = 0; slot < chest.getSizeInventory(); slot++)
{
int num = rand.nextInt(16);
if(num == 1)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.enderPearl, 4, 0));
}
if(num == 2)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.diamond, 1, 0));
}
if(num == 3)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.emerald, 1, 0));
}
if(num == 4)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.appleGold, 1, 0));
}
if(num == 5)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.ingotGold, 1, 0));
}
if(num == 6)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.ingotIron, 1, 0));
}
}
world.setBlock(j1 - 3, k1 - l5 - k6 - i5 - 1, l1 + k3 + 3, Block.dirt.blockID); world.setBlock(j1 - 3, k1 - l5 - k6 - i5 - 1, l1 + k3 + 3, Block.dirt.blockID);
world.setBlock(j1 - 3, k1 - l5 - k6 - i5, l1 + k3 + 3, Block.chest.blockID);
ChestFiller.fillWithRares(world.getBlockTileEntity(j1 - 3, k1 - l5 - k6 - i5, l1 + k3 + 3));
} }
} }
return true; return true;
} }
} }

View file

@ -1,31 +0,0 @@
package MysticRuins;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldGenMysticDungeon implements IWorldGenerator
{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch (world.provider.dimensionId)
{
case 0: generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ)
{
for (int i = 0; i < Config.DunRarity; i++)
{
int Xcoord1 = blockX + random.nextInt(16) + 8;
int Ycoord1 = random.nextInt(9) + 28;
int Zcoord1 = blockZ + random.nextInt(16) + 8;
(new StructureMysticDungeon()).generate(world, random, Xcoord1, Ycoord1, Zcoord1);
}
}
}

View file

@ -1,31 +0,0 @@
package MysticRuins;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldGenRuin$1 implements IWorldGenerator
{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch (world.provider.dimensionId)
{
case 0: generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ)
{
for (int i = 0; i < Config.RuinRarity; i++)
{
int Xcoord1 = blockX + random.nextInt(16) + 8;
int Ycoord1 = random.nextInt(11) + 60;
int Zcoord1 = blockZ + random.nextInt(16) + 8;
(new StructureRuin$1()).generate(world, random, Xcoord1, Ycoord1, Zcoord1);
}
}
}

View file

@ -1,31 +0,0 @@
package MysticRuins;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldGenRuin implements IWorldGenerator
{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch (world.provider.dimensionId)
{
case 0: generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ)
{
for (int i = 0; i < Config.RuinRarity; i++)
{
int Xcoord1 = blockX + random.nextInt(16) + 8;
int Ycoord1 = random.nextInt(11) + 60;
int Zcoord1 = blockZ + random.nextInt(16) + 8;
(new StructureRuin()).generate(world, random, Xcoord1, Ycoord1, Zcoord1);
}
}
}

View file

@ -1,91 +1,27 @@
package MysticStones.Blocks; package mysticstones.blocks;
import java.util.List;
import java.util.Random;
import MysticStones.MysticStones;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
public class BlockPlanks extends Block { public class BlockPlanks extends BlockMulti {
Icon[] textures;
public BlockPlanks(int ID) { public BlockPlanks(int ID) {
super(ID, Material.wood); super(ID, Material.wood);
setHardness(2.5F); setHardness(2.5F);
setResistance(10F); setResistance(10F);
setCreativeTab(MysticStones.MysticStonesTab);
setUnlocalizedName("BlockMysticPlanks"); setUnlocalizedName("BlockMysticPlanks");
setStepSound(Block.soundWoodFootstep); setStepSound(Block.soundWoodFootstep);
} }
@Override
public int damageDropped(int j)
{
return j;
}
public ItemStack getPickBlock(MovingObjectPosition target,World world, int x, int y, int z)
{
int id = idPicked(world, x, y, z);
if (id == 0)
{
return null;
}
Item item = Item.itemsList[id];
if (item == null)
{
return null;
}
return new ItemStack(id, 1, getDamageValue(world, x, y, z));
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) public void registerIcons(IconRegister iconRegister) {
{ textures = new Icon[ItemPlanks.PLANK_TYPE.length];
textures = new Icon[16]; for (int i = 0; i < textures.length; i++) {
for (int i = 0; i < 7; i++)
{
textures[i] = iconRegister.registerIcon("MysticMods" + ":" + ItemPlanks.PLANK_TYPE[i]); textures[i] = iconRegister.registerIcon("MysticMods" + ":" + ItemPlanks.PLANK_TYPE[i]);
} }
} }
@Override
public Icon getIcon(int side, int meta)
{
return textures[meta];
}
public void getSubBlocks(int i,CreativeTabs tab, List list)
{
list.add(new ItemStack(i,1,0));
list.add(new ItemStack(i,1,1));
list.add(new ItemStack(i,1,2));
list.add(new ItemStack(i,1,3));
list.add(new ItemStack(i,1,4));
list.add(new ItemStack(i,1,5));
list.add(new ItemStack(i,1,6));
}
} }

View file

@ -1,89 +1,33 @@
package MysticStones.Blocks; package mysticstones.blocks;
import java.util.List;
import java.util.Random;
import MysticStones.MysticStones;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
public class BlockReinforced extends Block { public class BlockReinforced extends BlockMulti {
Icon[] textures;
public BlockReinforced(int ID) { public BlockReinforced(int ID) {
super(ID, Material.iron); super(ID, Material.iron);
setHardness(4F); setHardness(4F);
setResistance(2000F); setResistance(2000F);
setCreativeTab(MysticStones.MysticStonesTab);
setUnlocalizedName("BlockMysticReinforcedBrick"); setUnlocalizedName("BlockMysticReinforcedBrick");
setStepSound(Block.soundMetalFootstep); setStepSound(Block.soundMetalFootstep);
} }
@Override @Override
public int damageDropped(int j) public boolean isBeaconBase(World worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) {
{ return true;
return j;
}
public boolean isBeaconBase(World worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ)
{
return (true);
}
public ItemStack getPickBlock(MovingObjectPosition target,World world, int x, int y, int z)
{
int id = idPicked(world, x, y, z);
if (id == 0)
{
return null;
}
Item item = Item.itemsList[id];
if (item == null)
{
return null;
}
return new ItemStack(id, 1, getDamageValue(world, x, y, z));
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) public void registerIcons(IconRegister iconRegister) {
{ textures = new Icon[ItemReinforced.BRICK_TYPE.length];
textures = new Icon[16]; for (int i = 0; i < textures.length; i++) {
for (int i = 0; i < 8; i++)
{
textures[i] = iconRegister.registerIcon("MysticMods" + ":" + ItemReinforced.BRICK_TYPE[i] + " Bricks"); textures[i] = iconRegister.registerIcon("MysticMods" + ":" + ItemReinforced.BRICK_TYPE[i] + " Bricks");
} }
} }
@Override
public Icon getIcon(int side, int meta)
{
return textures[meta];
}
public void getSubBlocks(int i,CreativeTabs tab, List list)
{
for(int k=0;k<8;k++)
{
list.add(new ItemStack(i,1,k));
}
}
} }

View file

@ -1,87 +1,27 @@
package MysticStones.Blocks; package mysticstones.blocks;
import java.util.List;
import java.util.Random;
import MysticStones.MysticStones;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
public class BlockStoneBricks extends Block { public class BlockStoneBricks extends BlockMulti {
Icon[] textures;
public BlockStoneBricks(int ID) { public BlockStoneBricks(int ID) {
super(ID, Material.rock); super(ID, Material.rock);
setHardness(2F); setHardness(2F);
setResistance(5F); setResistance(5F);
setCreativeTab(MysticStones.MysticStonesTab);
setUnlocalizedName("BlockMysticStoneBricks"); setUnlocalizedName("BlockMysticStoneBricks");
setStepSound(Block.soundStoneFootstep); setStepSound(Block.soundStoneFootstep);
} }
@Override
public int damageDropped(int j)
{
return j;
}
public ItemStack getPickBlock(MovingObjectPosition target,World world, int x, int y, int z)
{
int id = idPicked(world, x, y, z);
if (id == 0)
{
return null;
}
Item item = Item.itemsList[id];
if (item == null)
{
return null;
}
return new ItemStack(id, 1, getDamageValue(world, x, y, z));
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) public void registerIcons(IconRegister iconRegister) {
{ textures = new Icon[ItemStoneBricks.STONEBRICK_TYPES.length];
textures = new Icon[16]; for (int i = 0; i < textures.length; i++) {
for (int i = 0; i < 7; i++)
{
textures[i] = iconRegister.registerIcon("MysticMods" + ":" + ItemStoneBricks.STONEBRICK_TYPES[i]); textures[i] = iconRegister.registerIcon("MysticMods" + ":" + ItemStoneBricks.STONEBRICK_TYPES[i]);
} }
} }
@Override
public Icon getIcon(int side, int meta)
{
return textures[meta];
}
public void getSubBlocks(int i,CreativeTabs tab, List list)
{
list.add(new ItemStack(i,1,0));
list.add(new ItemStack(i,1,1));
list.add(new ItemStack(i,1,2));
list.add(new ItemStack(i,1,3));
list.add(new ItemStack(i,1,4));
list.add(new ItemStack(i,1,5));
list.add(new ItemStack(i,1,6));
}
} }

View file

@ -1,96 +1,62 @@
package MysticStones.Blocks; package mysticstones.blocks;
import java.util.List;
import java.util.Random;
import MysticStones.MysticStones;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
public class BlockStones extends Block { public class BlockStones extends BlockMulti {
Icon[] textures;
public BlockStones(int ID) { public BlockStones(int ID) {
super(ID, Material.rock); super(ID, Material.rock);
setHardness(1F); setHardness(1F);
setResistance(5F); setResistance(5F);
setCreativeTab(MysticStones.MysticStonesTab);
setUnlocalizedName("BlockMysticStones"); setUnlocalizedName("BlockMysticStones");
setStepSound(Block.soundStoneFootstep); setStepSound(Block.soundStoneFootstep);
} }
@Override @Override
public int damageDropped(int j) public int damageDropped(int j) {
{ switch (j) {
switch(j) case 0:
{ return 1;
case 0:return 1; case 2:
case 2:return 3; return 3;
case 4:return 5; case 4:
case 6:return 7; return 5;
case 8:return 9; case 6:
case 10:return 11; return 7;
case 12:return 13; case 8:
default:return j; return 9;
case 10:
return 11;
case 12:
return 13;
default:
return j;
} }
} }
protected boolean canSilkHarvest() @Override
{ public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
return true; return new ItemStack(this, 1, world.getBlockMetadata(x, y, z));
}
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
return new ItemStack(this, 1, meta);
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) public void registerIcons(IconRegister iconRegister) {
{ textures = new Icon[ItemStones.STONE_TYPES.length];
textures = new Icon[16]; for (int i = 0; i < textures.length; i++) {
for (int i = 0; i < 14; i++)
{
textures[i] = iconRegister.registerIcon("MysticMods" + ":" + ItemStones.STONE_TYPES[i]); textures[i] = iconRegister.registerIcon("MysticMods" + ":" + ItemStones.STONE_TYPES[i]);
} }
} }
@Override @Override
public Icon getIcon(int side, int meta) protected boolean canSilkHarvest() {
{ return true;
return textures[meta];
}
public void getSubBlocks(int i,CreativeTabs tab, List list)
{
list.add(new ItemStack(i,1,0));
list.add(new ItemStack(i,1,1));
list.add(new ItemStack(i,1,2));
list.add(new ItemStack(i,1,3));
list.add(new ItemStack(i,1,4));
list.add(new ItemStack(i,1,5));
list.add(new ItemStack(i,1,6));
list.add(new ItemStack(i,1,7));
list.add(new ItemStack(i,1,8));
list.add(new ItemStack(i,1,9));
list.add(new ItemStack(i,1,10));
list.add(new ItemStack(i,1,11));
list.add(new ItemStack(i,1,12));
list.add(new ItemStack(i,1,13));
} }
} }

View file

@ -1,40 +1,11 @@
package MysticStones.Blocks; package mysticstones.blocks;
import java.util.List; import mysticstones.MysticStones;
import MysticStones.MysticStones; public class ItemPlanks extends ItemBlockMulti {
import cpw.mods.fml.relauncher.Side; public static final String[] PLANK_TYPE = new String[] { "Purple Planks", "Green Planks", "Black Planks", "Orange Planks", "Red Planks", "Blue Planks", "Yellow Planks" };
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
public class ItemPlanks extends ItemBlock {
public static String[] PLANK_TYPE = new String[] {"Purple Planks", "Green Planks", "Black Planks", "Orange Planks", "Red Planks", "Blue Planks", "Yellow Planks"};
public ItemPlanks(int par1) { public ItemPlanks(int par1) {
super(par1); super(par1, MysticStones.Planks, PLANK_TYPE);
setMaxDamage(0);
setHasSubtypes(true);
} }
@Override
public String getUnlocalizedName(ItemStack itemStack) {
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, PLANK_TYPE.length);
return PLANK_TYPE[meta];
}
public int getMetadata(int par1)
{
return par1;
}
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int par1)
{
return MysticStones.Planks.getIcon(2, par1);
}
} }

View file

@ -1,52 +1,26 @@
package MysticStones.Blocks; package mysticstones.blocks;
import java.util.List; import java.util.List;
import MysticStones.MysticStones; import mysticstones.MysticStones;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
public class ItemReinforced extends ItemBlock { public class ItemReinforced extends ItemBlockMulti {
public static final String[] BRICK_TYPE = new String[] { "Mithril Bricks", "Verdite Bricks", "Iridium Bricks", "Adamantine Bricks", "Tourmaline Bricks", "Topaz Bricks", "Amethyst Bricks",
public static String[] BRICK_TYPE = new String[] {"Mithril", "Verdite", "Iridium", "Adamantine", "Tourmaline", "Topaz", "Amethyst", "Agate"}; "Agate Bricks" };
public ItemReinforced(int par1) { public ItemReinforced(int par1) {
super(par1); super(par1, MysticStones.ReinforcedBricks, BRICK_TYPE);
setMaxDamage(0);
setHasSubtypes(true);
} }
@Override @Override
public String getUnlocalizedName(ItemStack itemStack) {
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, BRICK_TYPE.length);
return BRICK_TYPE[meta] + " Bricks";
}
public int getMetadata(int par1)
{
return par1;
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
{ if (par4) {
if(par2EntityPlayer.isSneaking() == true)
{
par3List.add("Works As A Beacon Block Too!"); par3List.add("Works As A Beacon Block Too!");
} }
} }
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int par1)
{
return MysticStones.ReinforcedBricks.getIcon(2, par1);
}
} }

View file

@ -1,40 +1,12 @@
package MysticStones.Blocks; package mysticstones.blocks;
import java.util.List; import mysticstones.MysticStones;
import MysticStones.MysticStones; public class ItemStoneBricks extends ItemBlockMulti {
import cpw.mods.fml.relauncher.Side; public static final String[] STONEBRICK_TYPES = new String[] { "Anorthosite Bricks", "Limestone Bricks", "Marble Bricks", "Migmatite Bricks", "Orthogneiss Bricks", "Slate Bricks",
import cpw.mods.fml.relauncher.SideOnly; "Travertine Bricks" };
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
public class ItemStoneBricks extends ItemBlock {
public static String[] STONEBRICK_TYPES = new String[] {"Anorthosite Bricks", "Limestone Bricks", "Marble Bricks", "Migmatite Bricks", "Orthogneiss Bricks", "Slate Bricks", "Travertine Bricks"};
public ItemStoneBricks(int par1) { public ItemStoneBricks(int par1) {
super(par1); super(par1, MysticStones.StoneBricks, STONEBRICK_TYPES);
setMaxDamage(0);
setHasSubtypes(true);
}
@Override
public String getUnlocalizedName(ItemStack itemStack) {
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, STONEBRICK_TYPES.length);
return STONEBRICK_TYPES[meta];
}
public int getMetadata(int par1)
{
return par1;
}
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int par1)
{
return MysticStones.StoneBricks.getIcon(2, par1);
} }
} }

View file

@ -1,42 +1,12 @@
package MysticStones.Blocks; package mysticstones.blocks;
import java.util.List; import mysticstones.MysticStones;
import MysticStones.MysticStones; public class ItemStones extends ItemBlockMulti {
import cpw.mods.fml.relauncher.Side; public static final String[] STONE_TYPES = new String[] { "Smooth Anorthosite", "Anorthosite", "Smooth Limestone", "Limestone", "Smooth Marble", "Marble", "Smooth Migmatite", "Migmatite",
import cpw.mods.fml.relauncher.SideOnly; "Smooth Orthogneiss", "Orthogneiss", "Smooth Slate", "Slate", "Smooth Travertine", "Travertine" };
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
public class ItemStones extends ItemBlock {
public static String[] STONE_TYPES = new String[] {"Smooth Anorthosite", "Anorthosite", "Smooth Limestone", "Limestone", "Smooth Marble", "Marble", "Smooth Migmatite", "Migmatite",
"Smooth Orthogneiss", "Orthogneiss", "Smooth Slate", "Slate", "Smooth Travertine", "Travertine"};
public ItemStones(int par1) { public ItemStones(int par1) {
super(par1); super(par1, MysticStones.Stones, STONE_TYPES);
setMaxDamage(0);
setHasSubtypes(true);
} }
@Override
public String getUnlocalizedName(ItemStack itemStack) {
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, STONE_TYPES.length);
return STONE_TYPES[meta];
}
@Override
public int getMetadata(int par1)
{
return par1;
}
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int par1)
{
return MysticStones.Stones.getIcon(2, par1);
}
} }

View file

@ -1,96 +1,51 @@
package MysticStones; package mysticstones;
import java.io.File; import mysticstones.blocks.BlockPlanks;
import java.util.Random; import mysticstones.blocks.BlockReinforced;
import mysticstones.blocks.BlockStoneBricks;
import MysticStones.Blocks.BlockPlanks; import mysticstones.blocks.BlockStones;
import MysticStones.Blocks.BlockReinforced; import mysticstones.blocks.ItemPlanks;
import MysticStones.Blocks.BlockStoneBricks; import mysticstones.blocks.ItemReinforced;
import MysticStones.Blocks.BlockStones; import mysticstones.blocks.ItemStoneBricks;
import MysticStones.Blocks.ItemPlanks; import mysticstones.blocks.ItemStones;
import MysticStones.Blocks.ItemReinforced; import mysticstones.util.Config;
import MysticStones.Blocks.ItemStoneBricks; import mysticstones.util.Localizations;
import MysticStones.Blocks.ItemStones; import mysticstones.util.RecipeHandler;
import MysticStones.Util.Config; import mysticstones.util.TabMysticStones;
import MysticStones.Util.Localizations; import mysticstones.worldgen.WorldGeneratorStones;
import MysticStones.Util.RecipeHandler;
import MysticStones.Util.TabMysticStones;
import MysticStones.Worldgen.WorldgenSmoothAnorthosite;
import MysticStones.Worldgen.WorldgenSmoothLimestone;
import MysticStones.Worldgen.WorldgenSmoothMarble;
import MysticStones.Worldgen.WorldgenSmoothMigmatite;
import MysticStones.Worldgen.WorldgenSmoothOrthogneiss;
import MysticStones.Worldgen.WorldgenSmoothSlate;
import MysticStones.Worldgen.WorldgenSmoothTravertine;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.DungeonHooks;
import net.minecraftforge.common.EnumHelper;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = "Mystic Stones", name = "Mystic Stones", version = "0.1") @Mod(modid = "Mystic Stones", name = "Mystic Stones", version = "0.1")
@NetworkMod(clientSideRequired = true, serverSideRequired = false) @NetworkMod(clientSideRequired = true)
public class MysticStones {
public class MysticStones
{
@Instance("Mystic Stones") @Instance("Mystic Stones")
public static MysticStones instance; public static MysticStones instance;
public static Block Planks, Stones, StoneBricks, ReinforcedBricks;
public static Block Planks; public static final CreativeTabs MysticStonesTab = new TabMysticStones("MysticStonesTab");
public static Block Stones;
public static Block StoneBricks;
public static Block ReinforcedBricks;
public static CreativeTabs MysticStonesTab = new TabMysticStones(CreativeTabs.getNextID(), "MysticStonesTab");
private Configuration config;
@EventHandler @EventHandler
public void preInit(FMLPreInitializationEvent event) public void preInit(FMLPreInitializationEvent event) {
{ Config.initialize(event.getSuggestedConfigurationFile());
Config.initialize(new File(event.getModConfigurationDirectory(), "Mystic Mods/Mystic Stones.cfg"));
Config.save();
Planks = new BlockPlanks(Config.PlanksID); Planks = new BlockPlanks(Config.PlanksID);
Stones = new BlockStones(Config.StonesID); Stones = new BlockStones(Config.StonesID);
StoneBricks = new BlockStoneBricks(Config.StoneBricksID); StoneBricks = new BlockStoneBricks(Config.StoneBricksID);
ReinforcedBricks = new BlockReinforced(Config.ReinforcedBricksID); ReinforcedBricks = new BlockReinforced(Config.ReinforcedBricksID);
GameRegistry.registerBlock(Planks, ItemPlanks.class, "Planks"); GameRegistry.registerBlock(Planks, ItemPlanks.class, "Planks");
GameRegistry.registerBlock(Stones, ItemStones.class, "Stones"); GameRegistry.registerBlock(Stones, ItemStones.class, "Stones");
GameRegistry.registerBlock(StoneBricks, ItemStoneBricks.class, "StoneBricks"); GameRegistry.registerBlock(StoneBricks, ItemStoneBricks.class, "StoneBricks");
GameRegistry.registerBlock(ReinforcedBricks, ItemReinforced.class, "Reinforcedbricks"); GameRegistry.registerBlock(ReinforcedBricks, ItemReinforced.class, "Reinforcedbricks");
Localizations.Initialize(); Localizations.Initialize();
RecipeHandler.CraftPlanks(); RecipeHandler.CraftPlanks();
RecipeHandler.CraftStoneBricks(); RecipeHandler.CraftStoneBricks();
RecipeHandler.CraftElse();
RecipeHandler.CraftReinforced(); RecipeHandler.CraftReinforced();
RecipeHandler.CraftElse();
GameRegistry.registerWorldGenerator(new WorldgenSmoothAnorthosite()); GameRegistry.registerWorldGenerator(new WorldGeneratorStones());
GameRegistry.registerWorldGenerator(new WorldgenSmoothLimestone());
GameRegistry.registerWorldGenerator(new WorldgenSmoothMarble());
GameRegistry.registerWorldGenerator(new WorldgenSmoothMigmatite());
GameRegistry.registerWorldGenerator(new WorldgenSmoothOrthogneiss());
GameRegistry.registerWorldGenerator(new WorldgenSmoothSlate());
GameRegistry.registerWorldGenerator(new WorldgenSmoothTravertine());
} }
} }

View file

@ -1,35 +1,33 @@
package MysticStones.Util; package mysticstones.util;
import java.util.List;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import net.minecraftforge.common.Configuration; import net.minecraftforge.common.Configuration;
public class Config public class Config {
{
public static Configuration config;
public static int PlanksID; public static int PlanksID;
public static int StonesID; public static int StonesID;
public static int StoneBricksID; public static int StoneBricksID;
public static int ReinforcedBricksID; public static int ReinforcedBricksID;
public static int Rare;
public static List<Integer> allowed = new ArrayList();
public static boolean Rare; public static void initialize(File file) {
Configuration config = new Configuration(file);
public static void initialize(File file) config.load();
{
config = new Configuration(file);
PlanksID = config.getBlock("Plank IDs", 509).getInt(); PlanksID = config.getBlock("Plank IDs", 509).getInt();
StonesID = config.getBlock("Stone IDs", 510).getInt(); StonesID = config.getBlock("Stone IDs", 510).getInt();
StoneBricksID = config.getBlock("Stone Brick IDs", 511).getInt(); StoneBricksID = config.getBlock("Stone Brick IDs", 511).getInt();
ReinforcedBricksID = config.getBlock("Reinforced Brick IDs", 512).getInt(); ReinforcedBricksID = config.getBlock("Reinforced Brick IDs", 512).getInt();
Rare = config.get("General", "Increase the Rarity of Stones?", false).getBoolean(Rare); Rare = config.get("Generation", "Rarity of Stones", 3).getInt();
for (String id : config.get("Generation", "Allowed Dimension ID", "0,").getString().split(",")) {
config.save(); try {
allowed.add(Integer.parseInt(id.trim()));
} catch (NumberFormatException e) {
}
} }
public static void save()
{
config.save(); config.save();
} }
} }

View file

@ -1,4 +1,4 @@
package MysticStones.Util; package mysticstones.util;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -10,10 +10,11 @@ import java.util.regex.Pattern;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipException; import java.util.zip.ZipException;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
import MysticStones.MysticStones;
import mysticstones.MysticStones;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.common.registry.LanguageRegistry;
/* /*
* *
* All credits go to copygirl (or copy....boy) for this one * All credits go to copygirl (or copy....boy) for this one
@ -21,17 +22,14 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
* repository, many thanks friend c: * repository, many thanks friend c:
* *
*/ */
public class Localizations {
private Localizations() {
}
public class Localizations public static void Initialize() {
{
private Localizations(){}
public static void Initialize()
{
File source = Loader.instance().getReversedModObjectList().get(MysticStones.instance).getSource(); File source = Loader.instance().getReversedModObjectList().get(MysticStones.instance).getSource();
Pattern pattern = Pattern.compile(".*(assets/" + "mysticmods/lang/(.+)\\.(.+))"); Pattern pattern = Pattern.compile(".*(assets/" + "mysticmods/lang/(.+)\\.(.+))");
for(String file : getResources(source, pattern)) for (String file : getResources(source, pattern)) {
{
Matcher matcher = pattern.matcher(file); Matcher matcher = pattern.matcher(file);
matcher.find(); matcher.find();
String resource = "/" + matcher.group(1); String resource = "/" + matcher.group(1);
@ -41,72 +39,57 @@ public class Localizations
} }
} }
private static Collection<String> getResources(File file, Pattern pattern) private static Collection<String> getResources(File file, Pattern pattern) {
{
ArrayList<String> retval = new ArrayList<String>(); ArrayList<String> retval = new ArrayList<String>();
if(file.isDirectory()) if (file.isDirectory())
retval.addAll(getResourcesFromDirectory(file, pattern)); retval.addAll(getResourcesFromDirectory(file, pattern));
else retval.addAll(getResourcesFromJarFile(file, pattern)); else
retval.addAll(getResourcesFromJarFile(file, pattern));
return retval; return retval;
} }
private static Collection<String> getResourcesFromJarFile(File file, Pattern pattern) private static Collection<String> getResourcesFromDirectory(File directory, Pattern pattern) {
{
ArrayList<String> retval = new ArrayList<String>();
ZipFile Zip;
try
{
Zip = new ZipFile(file);
}
catch (ZipException Ex)
{
throw new Error(Ex);
}
catch(IOException Ex)
{
throw new Error(Ex);
}
Enumeration<? extends ZipEntry> entries = Zip.entries();
while (entries.hasMoreElements())
{
ZipEntry ZipE = entries.nextElement();
String FileName = ZipE.getName();
boolean accept = pattern.matcher(FileName).matches();
if(accept)
retval.add(FileName);
}
try
{
Zip.close();
}
catch(IOException Ex)
{
throw new Error(Ex);
}
return retval;
}
private static Collection<String> getResourcesFromDirectory(File directory, Pattern pattern)
{
ArrayList<String> retval = new ArrayList<String>(); ArrayList<String> retval = new ArrayList<String>();
File[] FileList = directory.listFiles(); File[] FileList = directory.listFiles();
for (File file : FileList) for (File file : FileList) {
{ if (file.isDirectory()) {
if (file.isDirectory())
{
retval.addAll(getResourcesFromDirectory(file, pattern)); retval.addAll(getResourcesFromDirectory(file, pattern));
} } else
else try try {
{
String fileName = file.getCanonicalPath().replace('\\', '/'); String fileName = file.getCanonicalPath().replace('\\', '/');
boolean accept = pattern.matcher(fileName).matches(); boolean accept = pattern.matcher(fileName).matches();
if (accept) retval.add(fileName); if (accept)
} retval.add(fileName);
catch(final IOException e) } catch (final IOException e) {
{
throw new Error(e); throw new Error(e);
} }
} }
return retval; return retval;
} }
private static Collection<String> getResourcesFromJarFile(File file, Pattern pattern) {
ArrayList<String> retval = new ArrayList<String>();
ZipFile Zip;
try {
Zip = new ZipFile(file);
} catch (ZipException Ex) {
throw new Error(Ex);
} catch (IOException Ex) {
throw new Error(Ex);
}
Enumeration<? extends ZipEntry> entries = Zip.entries();
while (entries.hasMoreElements()) {
ZipEntry ZipE = entries.nextElement();
String FileName = ZipE.getName();
boolean accept = pattern.matcher(FileName).matches();
if (accept)
retval.add(FileName);
}
try {
Zip.close();
} catch (IOException Ex) {
throw new Error(Ex);
}
return retval;
}
} }

View file

@ -1,9 +1,7 @@
package MysticStones.Util; package mysticstones.util;
import MysticStones.MysticStones; import mysticstones.MysticStones;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapedOreRecipe;
@ -11,170 +9,40 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
public class RecipeHandler public class RecipeHandler {
{ public static final String[] MATERIALS = { "ingotMithril", "ingotVerdite", "ingotIridium", "ingotAdamantine", "gemTourmaline", "gemTopaz", "gemAmethyst", "gemAgate" };
public static void CraftPlanks() public static final String[] STONES = { "anorthositeSmooth", "Anorthosite", "limestoneSmooth", "limestone", "marbleSmooth", "marble", "migmatiteSmooth", "migmatite", "orthogneissSmooth",
{ "orthogneiss", "slateSmooth", "slate", "travertineSmooth", "travertine" };
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(MysticStones.Planks, 1, 0),
new Object[]{"plankWood", new ItemStack(MysticStones.Stones, 1, 0)}));
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(MysticStones.Planks, 1, 0),
new Object[]{"plankWood", new ItemStack(MysticStones.Stones, 1, 1)}));
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(MysticStones.Planks, 1, 1),
new Object[]{"plankWood", new ItemStack(MysticStones.Stones, 1, 2)}));
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(MysticStones.Planks, 1, 1),
new Object[]{"plankWood", new ItemStack(MysticStones.Stones, 1, 3)}));
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(MysticStones.Planks, 1, 2),
new Object[]{"plankWood", new ItemStack(MysticStones.Stones, 1, 4)}));
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(MysticStones.Planks, 1, 2),
new Object[]{"plankWood", new ItemStack(MysticStones.Stones, 1, 5)}));
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(MysticStones.Planks, 1, 3),
new Object[]{"plankWood", new ItemStack(MysticStones.Stones, 1, 6)}));
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(MysticStones.Planks, 1, 3),
new Object[]{"plankWood", new ItemStack(MysticStones.Stones, 1, 7)}));
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(MysticStones.Planks, 1, 4),
new Object[]{"plankWood", new ItemStack(MysticStones.Stones, 1, 8)}));
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(MysticStones.Planks, 1, 4),
new Object[]{"plankWood", new ItemStack(MysticStones.Stones, 1, 9)}));
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(MysticStones.Planks, 1, 5),
new Object[]{"plankWood", new ItemStack(MysticStones.Stones, 1, 10)}));
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(MysticStones.Planks, 1, 5),
new Object[]{"plankWood", new ItemStack(MysticStones.Stones, 1, 11)}));
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(MysticStones.Planks, 1, 6),
new Object[]{"plankWood", new ItemStack(MysticStones.Stones, 1, 12)}));
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(MysticStones.Planks, 1, 6),
new Object[]{"plankWood", new ItemStack(MysticStones.Stones, 1, 13)}));
}
public static void CraftReinforced()
{
if(Loader.isModLoaded("MysticOres"))
{
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MysticStones.ReinforcedBricks, 1, 0), new Object[] {
"X#X", "###", "X#X", Character.valueOf('#'), "ingotMithril", Character.valueOf('X'), Block.stone}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MysticStones.ReinforcedBricks, 1, 1), new Object[] {
"X#X", "###", "X#X", Character.valueOf('#'), "ingotVerdite", Character.valueOf('X'), Block.stone}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MysticStones.ReinforcedBricks, 1, 2), new Object[] {
"X#X", "###", "X#X", Character.valueOf('#'), "ingotIridium", Character.valueOf('X'), Block.stone}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MysticStones.ReinforcedBricks, 1, 3), new Object[] {
"X#X", "###", "X#X", Character.valueOf('#'), "ingotAdamantine", Character.valueOf('X'), Block.stone}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MysticStones.ReinforcedBricks, 1, 4), new Object[] {
"X#X", "###", "X#X", Character.valueOf('#'), "gemTourmaline", Character.valueOf('X'), Block.stone}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MysticStones.ReinforcedBricks, 1, 5), new Object[] {
"X#X", "###", "X#X", Character.valueOf('#'), "gemTopaz", Character.valueOf('X'), Block.stone}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MysticStones.ReinforcedBricks, 1, 6), new Object[] {
"X#X", "###", "X#X", Character.valueOf('#'), "gemAmethyst", Character.valueOf('X'), Block.stone}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MysticStones.ReinforcedBricks, 1, 7), new Object[] {
"X#X", "###", "X#X", Character.valueOf('#'), "gemAgate", Character.valueOf('X'), Block.stone}));
}
}
public static void CraftStoneBricks()
{
GameRegistry.addRecipe(new ItemStack(MysticStones.StoneBricks, 4, 0), new Object[] {
"##", "##", '#', new ItemStack(MysticStones.Stones, 1, 0)
});
GameRegistry.addRecipe(new ItemStack(MysticStones.StoneBricks, 4, 1), new Object[] {
"##", "##", '#', new ItemStack(MysticStones.Stones, 1, 2)
});
GameRegistry.addRecipe(new ItemStack(MysticStones.StoneBricks, 4, 2), new Object[] {
"##", "##", '#', new ItemStack(MysticStones.Stones, 1, 4)
});
GameRegistry.addRecipe(new ItemStack(MysticStones.StoneBricks, 4, 3), new Object[] {
"##", "##", '#', new ItemStack(MysticStones.Stones, 1, 6)
});
GameRegistry.addRecipe(new ItemStack(MysticStones.StoneBricks, 4, 4), new Object[] {
"##", "##", '#', new ItemStack(MysticStones.Stones, 1, 8)
});
GameRegistry.addRecipe(new ItemStack(MysticStones.StoneBricks, 4, 5), new Object[] {
"##", "##", '#', new ItemStack(MysticStones.Stones, 1, 10)
});
GameRegistry.addRecipe(new ItemStack(MysticStones.StoneBricks, 4, 6), new Object[] {
"##", "##", '#', new ItemStack(MysticStones.Stones, 1, 12)
});
}
public static void CraftElse()
{
if(Loader.isModLoaded("Mystic Ores") == true)
{
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MysticStones.ReinforcedBricks, 1, 0),
true, new Object[]{"#$#", "$$$", "#$#", '$', "ingotMithril", '#', Block.stone}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MysticStones.ReinforcedBricks, 1, 1),
true, new Object[]{"#$#", "$$$", "#$#", '$', "ingotVerdite", '#', Block.stone}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MysticStones.ReinforcedBricks, 1, 2),
true, new Object[]{"#$#", "$$$", "#$#", '$', "ingotIridium", '#', Block.stone}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MysticStones.ReinforcedBricks, 1, 3),
true, new Object[]{"#$#", "$$$", "#$#", '$', "ingotAdamantine", '#', Block.stone}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MysticStones.ReinforcedBricks, 1, 4),
true, new Object[]{"#$#", "$$$", "#$#", '$', "gemTourmaline", '#', Block.stone}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MysticStones.ReinforcedBricks, 1, 5),
true, new Object[]{"#$#", "$$$", "#$#", '$', "gemTopaz", '#', Block.stone}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MysticStones.ReinforcedBricks, 1, 6),
true, new Object[]{"#$#", "$$$", "#$#", '$', "gemAmethyst", '#', Block.stone}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MysticStones.ReinforcedBricks, 1, 7),
true, new Object[]{"#$#", "$$$", "#$#", '$', "gemAgate", '#', Block.stone}));
}
public static void CraftElse() {
//smelting //smelting
FurnaceRecipes.smelting().addSmelting(MysticStones.Stones.blockID, 1, new ItemStack(MysticStones.Stones, 1, 0), 0.1F); for (int i = 1; i < 14; i += 2) {
FurnaceRecipes.smelting().addSmelting(MysticStones.Stones.blockID, 3, new ItemStack(MysticStones.Stones, 1, 2), 0.1F); FurnaceRecipes.smelting().addSmelting(MysticStones.Stones.blockID, i, new ItemStack(MysticStones.Stones, 1, i - 1), 0.1F);
FurnaceRecipes.smelting().addSmelting(MysticStones.Stones.blockID, 5, new ItemStack(MysticStones.Stones, 1, 4), 0.1F); }
FurnaceRecipes.smelting().addSmelting(MysticStones.Stones.blockID, 7, new ItemStack(MysticStones.Stones, 1, 6), 0.1F);
FurnaceRecipes.smelting().addSmelting(MysticStones.Stones.blockID, 9, new ItemStack(MysticStones.Stones, 1, 8), 0.1F);
FurnaceRecipes.smelting().addSmelting(MysticStones.Stones.blockID, 11, new ItemStack(MysticStones.Stones, 1, 10), 0.1F);
FurnaceRecipes.smelting().addSmelting(MysticStones.Stones.blockID, 13, new ItemStack(MysticStones.Stones, 1, 12), 0.1F);
for (int i=0;i<7;i++)
{
OreDictionary.registerOre("plankWood", new ItemStack(MysticStones.Planks, 1, i));
} }
public static void CraftPlanks() {
for (int i = 0; i < 7; i++) {
ItemStack stack = new ItemStack(MysticStones.Planks, 1, i);
OreDictionary.registerOre("plankWood", stack);
OreDictionary.registerOre(STONES[2 * i], new ItemStack(MysticStones.Stones, 1, 2 * i));
OreDictionary.registerOre(STONES[2 * i + 1], new ItemStack(MysticStones.Stones, 1, 2 * i + 1));
GameRegistry.addRecipe(new ShapelessOreRecipe(stack, "plankWood", STONES[2 * i]));
GameRegistry.addRecipe(new ShapelessOreRecipe(stack, "plankWood", STONES[2 * i + 1]));
}
}
public static void CraftReinforced() {
if (Loader.isModLoaded("MysticOres")) {
for (int i = 0; i < MATERIALS.length; i++) {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(MysticStones.ReinforcedBricks, 1, i), true, "#$#", "$$$", "#$#", '$', MATERIALS[i], '#', "stone"));
}
}
}
public static void CraftStoneBricks() {
for (int i = 0; i < 7; i++) {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(MysticStones.StoneBricks, 4, i), "##", "##", '#', STONES[2 * i]));
}
} }
} }

View file

@ -1,20 +1,16 @@
package MysticStones.Util; package mysticstones.util;
import MysticStones.MysticStones; import mysticstones.MysticStones;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class TabMysticStones extends CreativeTabs { public class TabMysticStones extends CreativeTabs {
public TabMysticStones(String par2Str) {
public TabMysticStones(int par1, String par2Str) { super(par2Str);
super(par1, par2Str);
// TODO Auto-generated constructor stub
} }
@Override @Override
public ItemStack getIconItemStack() { public ItemStack getIconItemStack() {
return new ItemStack(MysticStones.ReinforcedBricks, 1, 4); return new ItemStack(MysticStones.ReinforcedBricks, 1, 4);
} }
} }

View file

@ -1,33 +0,0 @@
package MysticStones.Worldgen;
import java.util.Random;
import MysticStones.MysticStones;
import MysticStones.Util.Config;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldgenSmoothAnorthosite implements IWorldGenerator
{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch(world.provider.dimensionId)
{
case 0:generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ)
{
for(int i=0; Config.Rare ? i<2 : i<3; i++)
{
int Xcoord = blockX + random.nextInt(16);
int Ycoord = random.nextInt(40) + 20;
int Zcoord = blockZ + random.nextInt(16);
new WorldGenMinable(MysticStones.Stones.blockID, 0, 24, Block.stone.blockID).generate(world, random, Xcoord, Ycoord, Zcoord);
}
}
}

View file

@ -1,33 +0,0 @@
package MysticStones.Worldgen;
import java.util.Random;
import MysticStones.MysticStones;
import MysticStones.Util.Config;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldgenSmoothLimestone implements IWorldGenerator
{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch(world.provider.dimensionId)
{
case 0:generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ)
{
for(int i=0; Config.Rare ? i<2 : i<3; i++)
{
int Xcoord = blockX + random.nextInt(16);
int Ycoord = random.nextInt(40) + 20;
int Zcoord = blockZ + random.nextInt(16);
new WorldGenMinable(MysticStones.Stones.blockID, 2, 48, Block.stone.blockID).generate(world, random, Xcoord, Ycoord, Zcoord);
}
}
}

View file

@ -1,33 +0,0 @@
package MysticStones.Worldgen;
import java.util.Random;
import MysticStones.MysticStones;
import MysticStones.Util.Config;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldgenSmoothMarble implements IWorldGenerator
{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch(world.provider.dimensionId)
{
case 0:generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random ,int blockX, int blockZ)
{
for(int i=0; Config.Rare ? i<2 : i<3; i++)
{
int Xcoord = blockX + random.nextInt(16);
int Ycoord = random.nextInt(40) + 20;
int Zcoord = blockZ + random.nextInt(16);
new WorldGenMinable(MysticStones.Stones.blockID, 4, 24, Block.stone.blockID).generate(world, random, Xcoord, Ycoord, Zcoord);
}
}
}

View file

@ -1,33 +0,0 @@
package MysticStones.Worldgen;
import java.util.Random;
import MysticStones.MysticStones;
import MysticStones.Util.Config;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldgenSmoothMigmatite implements IWorldGenerator
{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch(world.provider.dimensionId)
{
case 0:generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ)
{
for(int i=0; Config.Rare ? i<2 : i<3; i++)
{
int Xcoord = blockX + random.nextInt(16);
int Ycoord = random.nextInt(40) + 20;
int Zcoord = blockZ + random.nextInt(16);
new WorldGenMinable(MysticStones.Stones.blockID, 6, 48, Block.stone.blockID).generate(world, random, Xcoord, Ycoord, Zcoord);
}
}
}

View file

@ -1,33 +0,0 @@
package MysticStones.Worldgen;
import java.util.Random;
import MysticStones.MysticStones;
import MysticStones.Util.Config;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldgenSmoothOrthogneiss implements IWorldGenerator
{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch(world.provider.dimensionId)
{
case 0:generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ)
{
for(int i=0; Config.Rare ? i<3 : i<2; i++)
{
int Xcoord = blockX + random.nextInt(16);
int Ycoord = random.nextInt(40) + 20;
int Zcoord = blockZ + random.nextInt(16);
new WorldGenMinable(MysticStones.Stones.blockID, 8, 48, Block.stone.blockID).generate(world, random, Xcoord, Ycoord, Zcoord);
}
}
}

View file

@ -1,33 +0,0 @@
package MysticStones.Worldgen;
import java.util.Random;
import MysticStones.MysticStones;
import MysticStones.Util.Config;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldgenSmoothSlate implements IWorldGenerator
{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch(world.provider.dimensionId)
{
case 0:generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ)
{
for(int i=0; Config.Rare ? i<2 : i<3; i++)
{
int Xcoord = blockX + random.nextInt(16);
int Ycoord = random.nextInt(40) + 20;
int Zcoord = blockZ + random.nextInt(16);
new WorldGenMinable(MysticStones.Stones.blockID, 10, 24, Block.stone.blockID).generate(world, random, Xcoord, Ycoord, Zcoord);
}
}
}

View file

@ -1,33 +0,0 @@
package MysticStones.Worldgen;
import java.util.Random;
import MysticStones.MysticStones;
import MysticStones.Util.Config;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldgenSmoothTravertine implements IWorldGenerator
{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch(world.provider.dimensionId)
{
case 0:generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ)
{
for(int i=0; Config.Rare ? i<2 : i<3; i++)
{
int Xcoord = blockX + random.nextInt(16);
int Ycoord = random.nextInt(40) + 20;
int Zcoord = blockZ + random.nextInt(16);
new WorldGenMinable(MysticStones.Stones.blockID, 12, 24, Block.stone.blockID).generate(world, random, Xcoord, Ycoord, Zcoord);
}
}
}

View file

@ -1,4 +1,4 @@
package MysticWorld.Biome; package mysticworld.biome;
import java.util.Random; import java.util.Random;

View file

@ -1,4 +1,4 @@
package MysticWorld.Biome; package mysticworld.biome;
import java.util.Random; import java.util.Random;

View file

@ -1,4 +1,4 @@
package MysticWorld.Biome; package mysticworld.biome;
import java.util.Random; import java.util.Random;
import net.minecraft.block.Block; import net.minecraft.block.Block;

View file

@ -1,4 +1,4 @@
package MysticWorld.Biome; package mysticworld.biome;
import java.util.Random; import java.util.Random;

View file

@ -1,4 +1,4 @@
package MysticWorld.Biome; package mysticworld.biome;
import java.util.Random; import java.util.Random;

View file

@ -1,64 +1,57 @@
package MysticWorld.Biome; package mysticworld.biome;
import cpw.mods.fml.common.registry.GameRegistry; import mysticworld.lib.Booleans;
import MysticWorld.Lib.*;
import MysticOres.Blocks.BlockHandler;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.world.biome.BiomeDecorator;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeManager; import net.minecraftforge.common.BiomeManager;
import cpw.mods.fml.common.registry.GameRegistry;
public class BiomeHandler public class BiomeHandler {
{
public static BiomeGenBase Mountain; public static BiomeGenBase Mountain;
public static BiomeGenBase Tundra; public static BiomeGenBase Tundra;
public static BiomeGenBase Steppe; public static BiomeGenBase Steppe;
public static BiomeGenBase Glacier; public static BiomeGenBase Glacier;
public static BiomeGenBase Jungle; public static BiomeGenBase Jungle;
public static void init() public static void init() {
{
initializeBiomes(); initializeBiomes();
registerBiomes(); registerBiomes();
} }
public static void initializeBiomes() public static void initializeBiomes() {
{ Mountain = new BiomeGenMountain(23, Block.stone.blockID, Block.stone.blockID).setColor(9286496).setBiomeName("Mountain").setEnableSnow().setTemperatureRainfall(0.05F, 0.8F)
Mountain = new BiomeGenMountain(23, Block.stone.blockID, Block.stone.blockID).setColor(9286496).setBiomeName("Mountain").setEnableSnow().setTemperatureRainfall(0.05F, 0.8F).setMinMaxHeight(0.5F, 1.0F); .setMinMaxHeight(0.5F, 1.0F);
Tundra = new BiomeGenTundra(24, 0, 0, 0, 0, Block.blockSnow.blockID, Block.blockSnow.blockID).setColor(9286496).setBiomeName("Tundra").setEnableSnow().setTemperatureRainfall(0.05F, 0.8F).setMinMaxHeight(0.8F, 0.4F); Tundra = new BiomeGenTundra(24, 0, 0, 0, 0, Block.blockSnow.blockID, Block.blockSnow.blockID).setColor(9286496).setBiomeName("Tundra").setEnableSnow().setTemperatureRainfall(0.05F, 0.8F)
.setMinMaxHeight(0.8F, 0.4F);
Steppe = new BiomeGenBasic(25, 0, 2, 2, 3, Block.grass.blockID, Block.dirt.blockID).setColor(5470985).setBiomeName("Steppe").setMinMaxHeight(0.1F, 0.1F); Steppe = new BiomeGenBasic(25, 0, 2, 2, 3, Block.grass.blockID, Block.dirt.blockID).setColor(5470985).setBiomeName("Steppe").setMinMaxHeight(0.1F, 0.1F);
Glacier = new BiomeGenGlacier(26, 0, 0, 0, 0, Block.ice.blockID, Block.ice.blockID).setColor(9474208).setBiomeName("Glacier").setEnableSnow().setTemperatureRainfall(0.05F, 0.8F).setMinMaxHeight(0.5F, 0.7F); Glacier = new BiomeGenGlacier(26, 0, 0, 0, 0, Block.ice.blockID, Block.ice.blockID).setColor(9474208).setBiomeName("Glacier").setEnableSnow().setTemperatureRainfall(0.05F, 0.8F)
Jungle = new BiomeGenJungle(27).setColor(5470985).setBiomeName("Jungle").func_76733_a(5470985).setTemperatureRainfall(1.2F, 0.9F).setMinMaxHeight(0.2F, 0.4F);; .setMinMaxHeight(0.5F, 0.7F);
Jungle = new BiomeGenJungle(27).setColor(5470985).setBiomeName("Jungle").func_76733_a(5470985).setTemperatureRainfall(1.2F, 0.9F).setMinMaxHeight(0.2F, 0.4F);
;
} }
public static void registerBiomes() public static void registerBiomes() {
{ if (Booleans.ENABLE_JUNGLE_REWRITE) {
if(Booleans.ENABLE_JUNGLE_REWRITE)
{
GameRegistry.removeBiome(BiomeGenBase.jungle); GameRegistry.removeBiome(BiomeGenBase.jungle);
GameRegistry.removeBiome(BiomeGenBase.jungleHills); GameRegistry.removeBiome(BiomeGenBase.jungleHills);
GameRegistry.addBiome(Jungle); GameRegistry.addBiome(Jungle);
BiomeManager.addSpawnBiome(Jungle); BiomeManager.addSpawnBiome(Jungle);
BiomeManager.addStrongholdBiome(Jungle); BiomeManager.addStrongholdBiome(Jungle);
} }
if(Booleans.ENABLE_GLACIER_GEN) if (Booleans.ENABLE_GLACIER_GEN) {
{
GameRegistry.addBiome(Glacier); GameRegistry.addBiome(Glacier);
BiomeManager.addStrongholdBiome(Glacier); BiomeManager.addStrongholdBiome(Glacier);
} }
if(Booleans.ENABLE_MOUNTAIN_GEN) if (Booleans.ENABLE_MOUNTAIN_GEN) {
{
GameRegistry.addBiome(Mountain); GameRegistry.addBiome(Mountain);
BiomeManager.addSpawnBiome(Mountain); BiomeManager.addSpawnBiome(Mountain);
BiomeManager.addStrongholdBiome(Mountain); BiomeManager.addStrongholdBiome(Mountain);
} }
if(Booleans.ENABLE_TUNDRA_GEN) if (Booleans.ENABLE_TUNDRA_GEN) {
{
GameRegistry.addBiome(Tundra); GameRegistry.addBiome(Tundra);
BiomeManager.addStrongholdBiome(Tundra); BiomeManager.addStrongholdBiome(Tundra);
} }
if(Booleans.ENABLE_STEPPE_GEN) if (Booleans.ENABLE_STEPPE_GEN) {
{
GameRegistry.addBiome(Steppe); GameRegistry.addBiome(Steppe);
BiomeManager.addSpawnBiome(Steppe); BiomeManager.addSpawnBiome(Steppe);
BiomeManager.addVillageBiome(Steppe, true); BiomeManager.addVillageBiome(Steppe, true);

View file

@ -1,27 +1,17 @@
package MysticWorld.Blocks; package mysticworld.blocks;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import cpw.mods.fml.relauncher.Side; import mysticworld.MysticWorld;
import cpw.mods.fml.relauncher.SideOnly; import mysticworld.items.ItemHandler;
import MysticWorld.MysticWorld;
import MysticWorld.Items.ItemHandler$1;
import MysticWorld.Lib.BlockIds;
import MysticWorld.Lib.Strings;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityPotion;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.ColorizerGrass; import net.minecraft.world.ColorizerGrass;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
@ -29,10 +19,10 @@ import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.IShearable; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockBush extends Block implements IPlantable{
public class BlockBush extends Block implements IPlantable {
Icon[] textures; Icon[] textures;
public BlockBush(int id) { public BlockBush(int id) {
@ -45,152 +35,136 @@ public class BlockBush extends Block implements IPlantable{
} }
@Override @Override
@SideOnly(Side.CLIENT) public boolean canBlockStay(World par1World, int par2, int par3, int par4) {
public void registerIcons(IconRegister iconRegister) Block soil = blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
{ return (par1World.getFullBlockLightValue(par2, par3, par4) >= 8 || par1World.canBlockSeeTheSky(par2, par3, par4))
textures = new Icon[16]; && (soil != null && soil.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this));
for (int i = 0; i < 12; i++)
{
textures[i] = iconRegister.registerIcon("MysticMods" + ":" + ItemBush.BUSH_TYPES[i]);
}
} }
//Plant Specific Stuff //Plant Specific Stuff
@Override
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) {
{
return super.canPlaceBlockAt(par1World, par2, par3, par4) && canBlockStay(par1World, par2, par3, par4); return super.canPlaceBlockAt(par1World, par2, par3, par4) && canBlockStay(par1World, par2, par3, par4);
} }
protected boolean canThisPlantGrowOnThisBlockID(int par1)
{
return par1 == Block.grass.blockID || par1 == Block.dirt.blockID;
}
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
{
super.onNeighborBlockChange(par1World, par2, par3, par4, par5);
this.checkBushChange(par1World, par2, par3, par4);
}
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
this.checkBushChange(par1World, par2, par3, par4);
}
protected final void checkBushChange(World par1World, int par2, int par3, int par4)
{
if (!this.canBlockStay(par1World, par2, par3, par4))
{
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlockToAir(par2, par3, par4);
}
}
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
{
Block soil = blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
return (par1World.getFullBlockLightValue(par2, par3, par4) >= 8 || par1World.canBlockSeeTheSky(par2, par3, par4)) &&
(soil != null && soil.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this));
}
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{
super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
}
public boolean renderAsNormalBlock()
{
return false;
}
@Override @Override
public EnumPlantType getPlantType(World world, int x, int y, int z)
{
return EnumPlantType.Plains;
}
@Override
public int getPlantID(World world, int x, int y, int z)
{
return 0;
}
@Override
public int getPlantMetadata(World world, int x, int y, int z)
{
return 0;
}
//Sprite Inits
@Override
public Icon getIcon(int side, int meta)
{
return textures[meta];
}
public boolean isOpaqueCube()
{
return false;
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public int getBlockColor() public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
{ int l = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
return l == -1 ? 16777215 : par1IBlockAccess.getBiomeGenForCoords(par2, par4).getBiomeGrassColor();
}
@Override
public int damageDropped(int j) {
return j;
}
@Override
@SideOnly(Side.CLIENT)
public int getBlockColor() {
double d0 = 0.5D; double d0 = 0.5D;
double d1 = 1.0D; double d1 = 1.0D;
return ColorizerGrass.getGrassColor(d0, d1); return ColorizerGrass.getGrassColor(d0, d1);
} }
@SideOnly(Side.CLIENT)
public int getRenderColor(int par1)
{
return par1 == -1 ? 16777215 : ColorizerFoliage.getFoliageColorBasic();
}
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
int l = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
return l == -1 ? 16777215 : par1IBlockAccess.getBiomeGenForCoords(par2, par4).getBiomeGrassColor();
}
//Meta Inits
public int quantityDroppedWithBonus(int par1, Random par2Random)
{
return 1 + par2Random.nextInt(par1 * 2 + 1);
}
public int idDropped(int par1, Random par2Random, int par3)
{
return ItemHandler$1.bushFruit.itemID;
}
@Override @Override
public int damageDropped(int j) public int getDamageValue(World par1World, int par2, int par3, int par4) {
{
return j;
}
public int idPicked(World par1World, int par2, int par3, int par4)
{
return blockID;
}
public int getDamageValue(World par1World, int par2, int par3, int par4)
{
return par1World.getBlockMetadata(par2, par3, par4); return par1World.getBlockMetadata(par2, par3, par4);
} }
public void getSubBlocks(int i,CreativeTabs tab, List list) //Sprite Inits
{ @Override
for(int j=0;j<12;j++) public Icon getIcon(int side, int meta) {
{ return textures[meta];
list.add(new ItemStack(i,1,j)); }
@Override
public int getPlantID(World world, int x, int y, int z) {
return 0;
}
@Override
public int getPlantMetadata(World world, int x, int y, int z) {
return 0;
}
@Override
public EnumPlantType getPlantType(World world, int x, int y, int z) {
return EnumPlantType.Plains;
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderColor(int par1) {
return par1 == -1 ? 16777215 : ColorizerFoliage.getFoliageColorBasic();
}
@Override
public void getSubBlocks(int i, CreativeTabs tab, List list) {
for (int j = 0; j < 12; j++) {
list.add(new ItemStack(i, 1, j));
} }
} }
@Override
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
}
@Override
public int idDropped(int par1, Random par2Random, int par3) {
return ItemHandler.bushFruit.itemID;
}
@Override
public int idPicked(World par1World, int par2, int par3, int par4) {
return blockID;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) {
super.onNeighborBlockChange(par1World, par2, par3, par4, par5);
this.checkBushChange(par1World, par2, par3, par4);
}
//Meta Inits
@Override
public int quantityDroppedWithBonus(int par1, Random par2Random) {
return 1 + par2Random.nextInt(par1 * 2 + 1);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) {
textures = new Icon[16];
for (int i = 0; i < 12; i++) {
textures[i] = iconRegister.registerIcon("MysticMods" + ":" + ItemBush.BUSH_TYPES[i]);
}
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
this.checkBushChange(par1World, par2, par3, par4);
}
protected boolean canThisPlantGrowOnThisBlockID(int par1) {
return par1 == Block.grass.blockID || par1 == Block.dirt.blockID;
}
protected final void checkBushChange(World par1World, int par2, int par3, int par4) {
if (!this.canBlockStay(par1World, par2, par3, par4)) {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlockToAir(par2, par3, par4);
}
}
} }

View file

@ -1,25 +1,14 @@
package MysticWorld.Blocks; package mysticworld.blocks;
import MysticWorld.Lib.BlockIds; import mysticworld.lib.BlockIds;
import MysticWorld.Lib.Booleans; import mysticworld.lib.Strings;
import MysticWorld.Lib.Strings;
import MysticWorld.WorldGen.StonesGen;
import MysticWorld.WorldGen.WorldGenBushes;
import MysticWorld.WorldGen.WorldGenStones;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs; import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraftforge.common.MinecraftForge;
public class BlockHandler { public class BlockHandler {
public static Block oreImbuedStone; public static Block oreImbuedStone;
public static Block bush; public static Block bush;
public static Block lightCube; public static Block lightCube;
public static Block pillarPlatform; public static Block pillarPlatform;
public static Block pillar; public static Block pillar;
public static Block pillarInsert; public static Block pillarInsert;
@ -28,11 +17,9 @@ public class BlockHandler {
oreImbuedStone = new BlockImbuedStone(BlockIds.ORE_STONE_1).setUnlocalizedName(Strings.IMBUED_STONE_NAME); oreImbuedStone = new BlockImbuedStone(BlockIds.ORE_STONE_1).setUnlocalizedName(Strings.IMBUED_STONE_NAME);
bush = new BlockBush(BlockIds.BUSH).setUnlocalizedName(Strings.BUSH_NAME); bush = new BlockBush(BlockIds.BUSH).setUnlocalizedName(Strings.BUSH_NAME);
lightCube = new BlockLightCube(BlockIds.LIGHT_CUBE).setUnlocalizedName(Strings.LIGHT_CUBE_NAME); lightCube = new BlockLightCube(BlockIds.LIGHT_CUBE).setUnlocalizedName(Strings.LIGHT_CUBE_NAME);
pillarPlatform = new BlockPlatform(BlockIds.PLATFORM).setUnlocalizedName(Strings.PLATFORM_NAME); pillarPlatform = new BlockPlatform(BlockIds.PLATFORM).setUnlocalizedName(Strings.PLATFORM_NAME);
pillar = new BlockPillar(BlockIds.PILLAR).setUnlocalizedName(Strings.PILLAR_NAME); pillar = new BlockPillar(BlockIds.PILLAR).setUnlocalizedName(Strings.PILLAR_NAME);
pillarInsert = new BlockPillarInsert(BlockIds.PILLAR_INSERT).setUnlocalizedName(Strings.PILLAR_INSERT_NAME); pillarInsert = new BlockPillarInsert(BlockIds.PILLAR_INSERT).setUnlocalizedName(Strings.PILLAR_INSERT_NAME);
registerBlocks(); registerBlocks();
setBlockHarvestLevels(); setBlockHarvestLevels();
} }
@ -41,7 +28,6 @@ public class BlockHandler {
GameRegistry.registerBlock(oreImbuedStone, ItemImbuedStone.class, Strings.IMBUED_STONE_NAME); GameRegistry.registerBlock(oreImbuedStone, ItemImbuedStone.class, Strings.IMBUED_STONE_NAME);
GameRegistry.registerBlock(bush, ItemBush.class, Strings.BUSH_NAME); GameRegistry.registerBlock(bush, ItemBush.class, Strings.BUSH_NAME);
GameRegistry.registerBlock(lightCube, Strings.LIGHT_CUBE_NAME); GameRegistry.registerBlock(lightCube, Strings.LIGHT_CUBE_NAME);
GameRegistry.registerBlock(pillarPlatform, Strings.PLATFORM_NAME); GameRegistry.registerBlock(pillarPlatform, Strings.PLATFORM_NAME);
GameRegistry.registerBlock(pillar, Strings.PILLAR_NAME); GameRegistry.registerBlock(pillar, Strings.PILLAR_NAME);
GameRegistry.registerBlock(pillarInsert, Strings.PILLAR_INSERT_NAME); GameRegistry.registerBlock(pillarInsert, Strings.PILLAR_INSERT_NAME);

View file

@ -1,32 +1,22 @@
package MysticWorld.Blocks; package mysticworld.blocks;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import mysticworld.MysticWorld;
import mysticworld.items.ItemHandler;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockBreakable;
import net.minecraft.block.BlockFence; import net.minecraft.block.BlockFence;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import MysticWorld.MysticWorld;
import MysticWorld.Items.ItemHandler$1;
public class BlockImbuedStone extends Block { public class BlockImbuedStone extends Block {
Icon[] textures; Icon[] textures;
public BlockImbuedStone(int ID) { public BlockImbuedStone(int ID) {
@ -39,95 +29,84 @@ public class BlockImbuedStone extends Block {
} }
@Override @Override
@SideOnly(Side.CLIENT) public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) {
public void registerIcons(IconRegister iconRegister)
{
textures = new Icon[16];
for (int i = 0; i < 5; i++)
{
textures[i] = iconRegister.registerIcon("MysticMods" + ":" + ItemImbuedStone.IMBUED_STONE_TYPE[i] + " Imbued Stone");
}
}
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
return par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4); return par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4);
} }
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) @Override
{ public int damageDropped(int j) {
boolean flag = false; return j;
if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !BlockFence.isIdAFence(par1World.getBlockId(par2, par3 - 1, par4)))
{
flag = true;
} }
if (flag) @Override
{ public int getDamageValue(World par1World, int par2, int par3, int par4) {
return par1World.getBlockMetadata(par2, par3, par4);
}
@Override
public Icon getIcon(int side, int meta) {
return textures[meta];
}
@Override
public void getSubBlocks(int i, CreativeTabs tab, List list) {
for (int j = 0; j < 5; j++) {
list.add(new ItemStack(i, 1, j));
}
}
@Override
public int idDropped(int par1, Random par2Random, int par3) {
return ItemHandler.imbuedShard.itemID;
}
@Override
public int idPicked(World par1World, int par2, int par3, int par4) {
return blockID;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int meta) {
this.dropXpOnBlockBreak(world, x, y, z, xpDropAmount(meta));
}
@Override
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) {
boolean flag = false;
if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !BlockFence.isIdAFence(par1World.getBlockId(par2, par3 - 1, par4))) {
flag = true;
}
if (flag) {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlockToAir(par2, par3, par4); par1World.setBlockToAir(par2, par3, par4);
} }
} }
@Override @Override
public Icon getIcon(int side, int meta) @SideOnly(Side.CLIENT)
{ public void registerIcons(IconRegister iconRegister) {
return textures[meta]; textures = new Icon[16];
for (int i = 0; i < 5; i++) {
textures[i] = iconRegister.registerIcon("MysticMods" + ":" + ItemImbuedStone.IMBUED_STONE_TYPE[i] + " Imbued Stone");
} }
public int idDropped(int par1, Random par2Random, int par3)
{
return ItemHandler$1.imbuedShard.itemID;
} }
@Override @Override
public int damageDropped(int j) public boolean renderAsNormalBlock() {
{ return false;
return j;
} }
public int xpDropAmount(int j) public int xpDropAmount(int j) {
{
return 5; return 5;
} }
public boolean renderAsNormalBlock() @Override
{ protected boolean canSilkHarvest() {
return false;
}
public boolean isOpaqueCube()
{
return false;
}
protected boolean canSilkHarvest()
{
return true; return true;
} }
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int meta)
{
this.dropXpOnBlockBreak(world, x, y, z, xpDropAmount(meta));
}
public int idPicked(World par1World, int par2, int par3, int par4)
{
return blockID;
}
public int getDamageValue(World par1World, int par2, int par3, int par4)
{
return par1World.getBlockMetadata(par2, par3, par4);
}
public void getSubBlocks(int i,CreativeTabs tab, List list)
{
for(int j=0;j<5;j++)
{
list.add(new ItemStack(i,1,j));
}
}
} }

View file

@ -1,20 +1,16 @@
package MysticWorld.Blocks; package mysticworld.blocks;
import java.util.Random; import java.util.Random;
import cpw.mods.fml.relauncher.Side; import mysticworld.MysticWorld;
import cpw.mods.fml.relauncher.SideOnly;
import MysticWorld.MysticWorld;
import MysticWorld.Items.ItemHandler$1;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.util.Icon;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockLightCube extends Block { public class BlockLightCube extends Block {
public BlockLightCube(int id) { public BlockLightCube(int id) {
super(id, Material.circuits); super(id, Material.circuits);
setBlockBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.75F, 0.75F); setBlockBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.75F, 0.75F);
@ -23,40 +19,34 @@ public class BlockLightCube extends Block {
} }
@Override @Override
public boolean renderAsNormalBlock() public int idDropped(int par1, Random par2Random, int par3) {
{
return false;
}
@Override
protected boolean canSilkHarvest()
{
return true;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public int idDropped(int par1, Random par2Random, int par3)
{
return 0; return 0;
} }
@Override @Override
public void randomDisplayTick(World world, int x, int y, int z, Random random) public boolean isOpaqueCube() {
{ return false;
MysticWorld.proxy.lightCubeFX(world, (double)x + random.nextDouble(), (double)y + 0.75D, (double)z + random.nextDouble(), 0.0D, 0.0D, 0.0D, 1.0F); }
MysticWorld.proxy.lightCubeFX(world, (double)x + random.nextDouble(), (double)y + 0.75D, (double)z + random.nextDouble(), 0.0D, 0.0D, 0.0D, 1.0F);
@Override
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
MysticWorld.proxy.lightCubeFX(world, x + random.nextDouble(), y + 0.75D, z + random.nextDouble(), 0.0D, 0.0D, 0.0D, 1.0F);
MysticWorld.proxy.lightCubeFX(world, x + random.nextDouble(), y + 0.75D, z + random.nextDouble(), 0.0D, 0.0D, 0.0D, 1.0F);
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) public void registerIcons(IconRegister iconRegister) {
{
this.blockIcon = iconRegister.registerIcon("MysticMods" + ":" + "lightCube"); this.blockIcon = iconRegister.registerIcon("MysticMods" + ":" + "lightCube");
} }
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
protected boolean canSilkHarvest() {
return true;
}
} }

View file

@ -1,14 +1,13 @@
package MysticWorld.Blocks; package mysticworld.blocks;
import cpw.mods.fml.relauncher.Side; import mysticworld.MysticWorld;
import cpw.mods.fml.relauncher.SideOnly;
import MysticWorld.MysticWorld;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockPillar extends Block { public class BlockPillar extends Block {
public BlockPillar(int id) { public BlockPillar(int id) {
super(id, Material.rock); super(id, Material.rock);
setBlockUnbreakable(); setBlockUnbreakable();
@ -17,21 +16,19 @@ public class BlockPillar extends Block {
setBlockBounds(0.15F, 0.0F, 0.15F, 0.85F, 1.0F, 0.85F); setBlockBounds(0.15F, 0.0F, 0.15F, 0.85F, 1.0F, 0.85F);
} }
public boolean renderAsNormalBlock() @Override
{ public boolean isOpaqueCube() {
return false;
}
public boolean isOpaqueCube()
{
return false; return false;
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) public void registerIcons(IconRegister iconRegister) {
{
this.blockIcon = iconRegister.registerIcon("MysticMods" + ":" + "Pillar"); this.blockIcon = iconRegister.registerIcon("MysticMods" + ":" + "Pillar");
} }
@Override
public boolean renderAsNormalBlock() {
return false;
}
} }

View file

@ -1,21 +1,19 @@
package MysticWorld.Blocks; package mysticworld.blocks;
import MysticWorld.MysticWorld; import mysticworld.MysticWorld;
import MysticWorld.Lib.RenderIds; import mysticworld.tiles.TileEntityPillarInsert;
import MysticWorld.TileEntity.TileEntityPillarInsert;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockPillarInsert extends BlockContainer { public class BlockPillarInsert extends BlockContainer {
public static int RENDER_PILLAR_INSERT;
public BlockPillarInsert(int id) public BlockPillarInsert(int id) {
{
super(id, Material.rock); super(id, Material.rock);
this.setBlockUnbreakable(); this.setBlockUnbreakable();
this.setResistance(6000000.0F); this.setResistance(6000000.0F);
@ -23,53 +21,43 @@ public class BlockPillarInsert extends BlockContainer {
setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 1.0F, 0.875F); setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 1.0F, 0.875F);
} }
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
{
if (world.isRemote)
{
if (Item.enderPearl.itemID == entityPlayer.inventory.getCurrentItem().itemID)
{
TileEntity te = world.getBlockTileEntity(x, y, z);
}
}
return false;
}
@Override
public boolean shouldSideBeRendered(IBlockAccess blockAccess, int x, int y, int z, int i)
{
return false;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public int getRenderType()
{
return RenderIds.RENDER_PILLAR_INSERT;
}
@Override
public int getRenderBlockPass(){
return 1;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override @Override
public TileEntity createNewTileEntity(World world) { public TileEntity createNewTileEntity(World world) {
return new TileEntityPillarInsert(); return new TileEntityPillarInsert();
} }
} @Override
public int getRenderBlockPass() {
return 1;
}
@Override
public int getRenderType() {
return RENDER_PILLAR_INSERT;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) {
if (!world.isRemote) {
if (Item.enderPearl.itemID == entityPlayer.inventory.getCurrentItem().itemID) {
TileEntity te = world.getBlockTileEntity(x, y, z);
}
}
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean shouldSideBeRendered(IBlockAccess blockAccess, int x, int y, int z, int i) {
return false;
}
}

View file

@ -1,18 +1,14 @@
package MysticWorld.Blocks; package mysticworld.blocks;
import java.util.Random; import java.util.Random;
import MysticWorld.MysticWorld; import mysticworld.MysticWorld;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockPillarPlatform extends Block { public class BlockPillarPlatform extends Block {
public BlockPillarPlatform(int id) { public BlockPillarPlatform(int id) {
super(id, Material.rock); super(id, Material.rock);
this.setBlockUnbreakable(); this.setBlockUnbreakable();
@ -22,63 +18,52 @@ public class BlockPillarPlatform extends Block {
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.15F, 1.0F); setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.15F, 1.0F);
} }
public boolean renderAsNormalBlock() @Override
{ public boolean isOpaqueCube() {
return false; return false;
} }
public boolean isOpaqueCube() @Override
{ public void onEntityWalking(World world, int x, int y, int z, Entity entity) {
return false; if (this.isTowersNearby(world, x, y, z)) {
}
public int tickRate(World par1World)
{
return 30;
}
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
{
double posX = (double)x;
double posY = (double)y;
double posZ = (double)z;
if (this.isTowersNearby(world, x, y, z))
{
MysticWorld.proxy.fireFX(world, posX + rand.nextDouble(), posY + 0.20, posZ + rand.nextDouble(), 1.0F);
}
}
public void updateTick(World world, int x, int y, int z, Random random)
{
if (this.isTowersNearby(world, x, y, z))
{
}
}
public void onEntityWalking(World world, int x, int y, int z, Entity entity)
{
if (this.isTowersNearby(world, x, y, z))
{
super.onEntityWalking(world, x, y, z, entity); super.onEntityWalking(world, x, y, z, entity);
} }
} }
private boolean isTowersNearby(World world, int x, int y, int z) @Override
{ public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
int block = BlockHandler.pillar.blockID; double posX = x;
double posY = y;
if (world.getBlockId(x - 2, y, z - 2) == block && world.getBlockId(x - 2, y, z + 2) == block && world.getBlockId(x + 2, y, z + 2) == block && world.getBlockId(x + 2, y, z - 2) == block double posZ = z;
&& world.getBlockId(x - 2, y + 1, z - 2) == block && world.getBlockId(x - 2, y + 1, z + 2) == block && world.getBlockId(x + 2, y + 1, z + 2) == block && world.getBlockId(x + 2, y + 1, z - 2) == block if (this.isTowersNearby(world, x, y, z)) {
&& world.getBlockId(x - 2, y + 2, z - 2) == block && world.getBlockId(x - 2, y + 2, z + 2) == block && world.getBlockId(x + 2, y + 2, z + 2) == block && world.getBlockId(x + 2, y + 2, z - 2) == block) MysticWorld.proxy.fireFX(world, posX + rand.nextDouble(), posY + 0.20, posZ + rand.nextDouble(), 1.0F);
{ }
return true;
} }
@Override
public boolean renderAsNormalBlock() {
return false; return false;
} }
@Override
public int tickRate(World par1World) {
return 30;
}
@Override
public void updateTick(World world, int x, int y, int z, Random random) {
if (this.isTowersNearby(world, x, y, z)) {
}
}
private boolean isTowersNearby(World world, int x, int y, int z) {
int block = BlockHandler.pillar.blockID;
if (world.getBlockId(x - 2, y, z - 2) == block && world.getBlockId(x - 2, y, z + 2) == block && world.getBlockId(x + 2, y, z + 2) == block && world.getBlockId(x + 2, y, z - 2) == block
&& world.getBlockId(x - 2, y + 1, z - 2) == block && world.getBlockId(x - 2, y + 1, z + 2) == block && world.getBlockId(x + 2, y + 1, z + 2) == block
&& world.getBlockId(x + 2, y + 1, z - 2) == block && world.getBlockId(x - 2, y + 2, z - 2) == block && world.getBlockId(x - 2, y + 2, z + 2) == block
&& world.getBlockId(x + 2, y + 2, z + 2) == block && world.getBlockId(x + 2, y + 2, z - 2) == block) {
return true;
}
return false;
}
} }

View file

@ -1,11 +1,10 @@
package MysticWorld.Blocks; package mysticworld.blocks;
import MysticWorld.MysticWorld; import mysticworld.MysticWorld;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
public class BlockPillarTower extends Block { public class BlockPillarTower extends Block {
public BlockPillarTower(int id) { public BlockPillarTower(int id) {
super(id, Material.rock); super(id, Material.rock);
setBlockUnbreakable(); setBlockUnbreakable();
@ -14,14 +13,13 @@ public class BlockPillarTower extends Block {
setBlockBounds(0.15F, 0.0F, 0.15F, 0.85F, 1.0F, 0.85F); setBlockBounds(0.15F, 0.0F, 0.15F, 0.85F, 1.0F, 0.85F);
} }
public boolean renderAsNormalBlock() @Override
{ public boolean isOpaqueCube() {
return false; return false;
} }
public boolean isOpaqueCube() @Override
{ public boolean renderAsNormalBlock() {
return false; return false;
} }
} }

View file

@ -1,23 +1,17 @@
package MysticWorld.Blocks; package mysticworld.blocks;
import java.util.Random; import java.util.Random;
import cpw.mods.fml.relauncher.Side; import mysticworld.MysticWorld;
import cpw.mods.fml.relauncher.SideOnly;
import MysticWorld.MysticWorld;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockPlatform extends Block { public class BlockPlatform extends Block {
public BlockPlatform(int id) { public BlockPlatform(int id) {
super(id, Material.rock); super(id, Material.rock);
this.setBlockUnbreakable(); this.setBlockUnbreakable();
@ -28,77 +22,61 @@ public class BlockPlatform extends Block {
} }
@Override @Override
public boolean renderAsNormalBlock() public boolean isOpaqueCube() {
{
return false; return false;
} }
@Override @Override
public boolean isOpaqueCube() public void onEntityWalking(World world, int x, int y, int z, Entity entity) {
{
return false;
}
@Override
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
{
int block = BlockHandler.pillar.blockID;
double posX = (double)x;
double posY = (double)y;
double posZ = (double)z;
if (this.isTowersNearby(world, x, y, z))
{
MysticWorld.proxy.fireFX(world, posX + rand.nextDouble(), posY + 0.20, posZ + rand.nextDouble(), 1.0F);
if (rand.nextInt(3) == 0)
{
world.spawnParticle("enchantmenttable", (double)x + 0.5D, (double)y + 1.0D, (double)z + 0.5D, (double)((float)(x - 2 - x) + rand.nextFloat()) - 0.5D, (double)((float)(y + 2 - y) - rand.nextFloat() - 1.0F), (double)((float)(z - 2 - z) + rand.nextFloat()) - 0.5D);
world.spawnParticle("enchantmenttable", (double)x + 0.5D, (double)y + 1.0D, (double)z + 0.5D, (double)((float)(x - 2 - x) + rand.nextFloat()) - 0.5D, (double)((float)(y + 2 - y) - rand.nextFloat() - 1.0F), (double)((float)(z + 2 - z) + rand.nextFloat()) - 0.5D);
world.spawnParticle("enchantmenttable", (double)x + 0.5D, (double)y + 1.0D, (double)z + 0.5D, (double)((float)(x + 2 - x) + rand.nextFloat()) - 0.5D, (double)((float)(y + 2 - y) - rand.nextFloat() - 1.0F), (double)((float)(z + 2 - z) + rand.nextFloat()) - 0.5D);
world.spawnParticle("enchantmenttable", (double)x + 0.5D, (double)y + 1.0D, (double)z + 0.5D, (double)((float)(x + 2 - x) + rand.nextFloat()) - 0.5D, (double)((float)(y + 2 - y) - rand.nextFloat() - 1.0F), (double)((float)(z - 2 - z) + rand.nextFloat()) - 0.5D);
}
}
}
@Override
public void updateTick(World world, int x, int y, int z, Random random)
{
}
@Override
public int tickRate(World par1World)
{
return 30;
}
@Override
public void onEntityWalking(World world, int x, int y, int z, Entity entity)
{
super.onEntityWalking(world, x, y, z, entity); super.onEntityWalking(world, x, y, z, entity);
} }
private boolean isTowersNearby(World world, int x, int y, int z) @Override
{ public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
int pillar = BlockHandler.pillar.blockID; int block = BlockHandler.pillar.blockID;
int insert = BlockHandler.pillarInsert.blockID; double posX = x;
double posY = y;
if (world.getBlockId(x - 2, y, z - 2) == pillar && world.getBlockId(x - 2, y, z + 2) == pillar && world.getBlockId(x + 2, y, z + 2) == pillar && world.getBlockId(x + 2, y, z - 2) == pillar double posZ = z;
&& world.getBlockId(x - 2, y + 1, z - 2) == insert && world.getBlockId(x - 2, y + 1, z + 2) == insert && world.getBlockId(x + 2, y + 1, z + 2) == insert && world.getBlockId(x + 2, y + 1, z - 2) == insert if (this.isTowersNearby(world, x, y, z)) {
&& world.getBlockId(x - 2, y + 2, z - 2) == pillar && world.getBlockId(x - 2, y + 2, z + 2) == pillar && world.getBlockId(x + 2, y + 2, z + 2) == pillar && world.getBlockId(x + 2, y + 2, z - 2) == pillar) MysticWorld.proxy.fireFX(world, posX + rand.nextDouble(), posY + 0.20, posZ + rand.nextDouble(), 1.0F);
{ if (rand.nextInt(3) == 0) {
return true; world.spawnParticle("enchantmenttable", x + 0.5D, y + 1.0D, z + 0.5D, x - 2 - x + rand.nextFloat() - 0.5D, y + 2 - y - rand.nextFloat() - 1.0F, z - 2 - z + rand.nextFloat() - 0.5D);
world.spawnParticle("enchantmenttable", x + 0.5D, y + 1.0D, z + 0.5D, x - 2 - x + rand.nextFloat() - 0.5D, y + 2 - y - rand.nextFloat() - 1.0F, z + 2 - z + rand.nextFloat() - 0.5D);
world.spawnParticle("enchantmenttable", x + 0.5D, y + 1.0D, z + 0.5D, x + 2 - x + rand.nextFloat() - 0.5D, y + 2 - y - rand.nextFloat() - 1.0F, z + 2 - z + rand.nextFloat() - 0.5D);
world.spawnParticle("enchantmenttable", x + 0.5D, y + 1.0D, z + 0.5D, x + 2 - x + rand.nextFloat() - 0.5D, y + 2 - y - rand.nextFloat() - 1.0F, z - 2 - z + rand.nextFloat() - 0.5D);
}
} }
return false;
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) public void registerIcons(IconRegister iconRegister) {
{
this.blockIcon = iconRegister.registerIcon("MysticMods" + ":" + "Platform"); this.blockIcon = iconRegister.registerIcon("MysticMods" + ":" + "Platform");
} }
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public int tickRate(World par1World) {
return 30;
}
@Override
public void updateTick(World world, int x, int y, int z, Random random) {
}
private boolean isTowersNearby(World world, int x, int y, int z) {
int pillar = BlockHandler.pillar.blockID;
int insert = BlockHandler.pillarInsert.blockID;
if (world.getBlockId(x - 2, y, z - 2) == pillar && world.getBlockId(x - 2, y, z + 2) == pillar && world.getBlockId(x + 2, y, z + 2) == pillar && world.getBlockId(x + 2, y, z - 2) == pillar
&& world.getBlockId(x - 2, y + 1, z - 2) == insert && world.getBlockId(x - 2, y + 1, z + 2) == insert && world.getBlockId(x + 2, y + 1, z + 2) == insert
&& world.getBlockId(x + 2, y + 1, z - 2) == insert && world.getBlockId(x - 2, y + 2, z - 2) == pillar && world.getBlockId(x - 2, y + 2, z + 2) == pillar
&& world.getBlockId(x + 2, y + 2, z + 2) == pillar && world.getBlockId(x + 2, y + 2, z - 2) == pillar) {
return true;
}
return false;
}
} }

View file

@ -1,23 +1,17 @@
package MysticWorld.Blocks; package mysticworld.blocks;
import java.util.List;
import MysticWorld.Lib.Strings;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mysticworld.lib.Strings;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemBush extends ItemBlock { public class ItemBush extends ItemBlock {
public static String[] BUSH_TYPES = new String[] { Strings.BUSH_NAME, Strings.POISON_BUSH_NAME, Strings.WEAKNESS_BUSH_NAME, Strings.SLOWNESS_BUSH_NAME, Strings.HARMING_BUSH_NAME,
public static String[] BUSH_TYPES = new String[] {Strings.BUSH_NAME, Strings.POISON_BUSH_NAME, Strings.WEAKNESS_BUSH_NAME, Strings.SLOWNESS_BUSH_NAME, Strings.WITHER_BUSH_NAME, Strings.HEALTH_BUSH_NAME, Strings.SPEED_BUSH_NAME, Strings.FIRE_RESISTANCE_BUSH_NAME, Strings.REGEN_BUSH_NAME, Strings.NIGHT_VISION_BUSH_NAME,
Strings.HARMING_BUSH_NAME, Strings.WITHER_BUSH_NAME, Strings.HEALTH_BUSH_NAME, Strings.SPEED_BUSH_NAME, Strings.FIRE_RESISTANCE_BUSH_NAME, Strings.INVISIBILITY_BUSH_NAME };
Strings.REGEN_BUSH_NAME, Strings.NIGHT_VISION_BUSH_NAME, Strings.INVISIBILITY_BUSH_NAME};
public ItemBush(int par1) { public ItemBush(int par1) {
super(par1); super(par1);
@ -25,22 +19,20 @@ public class ItemBush extends ItemBlock {
setHasSubtypes(true); setHasSubtypes(true);
} }
@Override
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int par1) {
return BlockHandler.bush.getIcon(2, par1);
}
@Override
public int getMetadata(int par1) {
return par1;
}
@Override @Override
public String getUnlocalizedName(ItemStack itemStack) { public String getUnlocalizedName(ItemStack itemStack) {
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, BUSH_TYPES.length); int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, BUSH_TYPES.length);
return BUSH_TYPES[meta]; return BUSH_TYPES[meta];
} }
public int getMetadata(int par1)
{
return par1;
}
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int par1)
{
return BlockHandler.bush.getIcon(2, par1);
}
} }

View file

@ -1,4 +1,4 @@
package MysticWorld.Blocks; package mysticworld.blocks;
import java.util.List; import java.util.List;

View file

@ -1,121 +1,104 @@
package MysticWorld.Client; package mysticworld.client;
import net.minecraft.src.ModLoader; import mysticworld.blocks.BlockHandler;
import mysticworld.blocks.BlockPillarInsert;
import mysticworld.client.fx.LightCubeFX;
import mysticworld.client.fx.PowerAirFX;
import mysticworld.client.fx.PowerEarthFX;
import mysticworld.client.fx.PowerEnergyFX;
import mysticworld.client.fx.PowerFireFX;
import mysticworld.client.fx.PowerWaterFX;
import mysticworld.entity.EntityChargeAir;
import mysticworld.entity.EntityChargeEarth;
import mysticworld.entity.EntityChargeEnergy;
import mysticworld.entity.EntityChargeFire;
import mysticworld.entity.EntityChargeWater;
import mysticworld.items.ItemHandler;
import mysticworld.renderer.BlockPillarInsertRenderer;
import mysticworld.renderer.ItemOrbAirRenderer;
import mysticworld.renderer.ItemOrbEarthRenderer;
import mysticworld.renderer.ItemOrbEnergyRenderer;
import mysticworld.renderer.ItemOrbFireRenderer;
import mysticworld.renderer.ItemOrbWaterRenderer;
import mysticworld.renderer.ItemStaffAirRenderer;
import mysticworld.renderer.ItemStaffEarthRenderer;
import mysticworld.renderer.ItemStaffEnergyRenderer;
import mysticworld.renderer.ItemStaffFireRenderer;
import mysticworld.renderer.ItemStaffWaterRenderer;
import mysticworld.renderer.RenderStaffPower;
import mysticworld.renderer.TileEntityPillarInsertRenderer;
import mysticworld.tiles.TileEntityPillarInsert;
import mysticworld.util.CommonProxy;
import net.minecraft.client.Minecraft;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.client.MinecraftForgeClient;
import MysticWorld.Blocks.BlockHandler;
import MysticWorld.Client.FX.LightCubeFX;
import MysticWorld.Client.FX.PowerAirFX;
import MysticWorld.Client.FX.PowerEarthFX;
import MysticWorld.Client.FX.PowerEnergyFX;
import MysticWorld.Client.FX.PowerFireFX;
import MysticWorld.Client.FX.PowerWaterFX;
import MysticWorld.Entity.EntityChargeAir;
import MysticWorld.Entity.EntityChargeEarth;
import MysticWorld.Entity.EntityChargeEnergy;
import MysticWorld.Entity.EntityChargeFire;
import MysticWorld.Entity.EntityChargeWater;
import MysticWorld.Items.ItemHandler$1;
import MysticWorld.Lib.RenderIds;
import MysticWorld.Renderer.BlockPillarInsertRenderer;
import MysticWorld.Renderer.ItemOrbAirRenderer;
import MysticWorld.Renderer.ItemOrbEarthRenderer;
import MysticWorld.Renderer.ItemOrbEnergyRenderer;
import MysticWorld.Renderer.ItemOrbFireRenderer;
import MysticWorld.Renderer.ItemOrbWaterRenderer;
import MysticWorld.Renderer.ItemStaffAirRenderer;
import MysticWorld.Renderer.ItemStaffEarthRenderer;
import MysticWorld.Renderer.ItemStaffEnergyRenderer;
import MysticWorld.Renderer.ItemStaffFireRenderer;
import MysticWorld.Renderer.ItemStaffWaterRenderer;
import MysticWorld.Renderer.RenderStaffPower;
import MysticWorld.Renderer.TileEntityPillarInsertRenderer;
import MysticWorld.TileEntity.TileEntityPillarInsert;
import MysticWorld.Util.CommonProxy;
import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.client.registry.RenderingRegistry;
public class ClientProxy extends CommonProxy { public class ClientProxy extends CommonProxy {
public final Minecraft mc = Minecraft.getMinecraft();
@Override @Override
public void registerRenderIDs() public int addArmor(String armor) {
{
RenderIds.RENDER_PILLAR_INSERT = RenderingRegistry.getNextAvailableRenderId();
}
@Override
public void registerRenders()
{
MinecraftForgeClient.registerItemRenderer(BlockHandler.pillarInsert.blockID, new BlockPillarInsertRenderer());
MinecraftForgeClient.registerItemRenderer(ItemHandler$1.fireStaff.itemID, new ItemStaffFireRenderer());
MinecraftForgeClient.registerItemRenderer(ItemHandler$1.earthStaff.itemID, new ItemStaffEarthRenderer());
MinecraftForgeClient.registerItemRenderer(ItemHandler$1.airStaff.itemID, new ItemStaffAirRenderer());
MinecraftForgeClient.registerItemRenderer(ItemHandler$1.energyStaff.itemID, new ItemStaffEnergyRenderer());
MinecraftForgeClient.registerItemRenderer(ItemHandler$1.waterStaff.itemID, new ItemStaffWaterRenderer());
MinecraftForgeClient.registerItemRenderer(ItemHandler$1.fireOrb.itemID, new ItemOrbFireRenderer());
MinecraftForgeClient.registerItemRenderer(ItemHandler$1.earthOrb.itemID, new ItemOrbEarthRenderer());
MinecraftForgeClient.registerItemRenderer(ItemHandler$1.airOrb.itemID, new ItemOrbAirRenderer());
MinecraftForgeClient.registerItemRenderer(ItemHandler$1.energyOrb.itemID, new ItemOrbEnergyRenderer());
MinecraftForgeClient.registerItemRenderer(ItemHandler$1.waterOrb.itemID, new ItemOrbWaterRenderer());
RenderingRegistry.registerEntityRenderingHandler(EntityChargeFire.class, new RenderStaffPower(0));
RenderingRegistry.registerEntityRenderingHandler(EntityChargeWater.class, new RenderStaffPower(1));
RenderingRegistry.registerEntityRenderingHandler(EntityChargeEarth.class, new RenderStaffPower(2));
RenderingRegistry.registerEntityRenderingHandler(EntityChargeAir.class, new RenderStaffPower(3));
RenderingRegistry.registerEntityRenderingHandler(EntityChargeEnergy.class, new RenderStaffPower(4));
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPillarInsert.class, new TileEntityPillarInsertRenderer());
}
@Override
public int addArmor(String armor)
{
return RenderingRegistry.addNewArmourRendererPrefix(armor); return RenderingRegistry.addNewArmourRendererPrefix(armor);
} }
//particles //particles
@Override @Override
public void airFeetFX(World worldObj, double x, double y, double z, float scale, int age) public void airFeetFX(World worldObj, double x, double y, double z, float scale, int age) {
{
PowerAirFX airFX = new PowerAirFX(worldObj, x, y, z, scale, age); PowerAirFX airFX = new PowerAirFX(worldObj, x, y, z, scale, age);
ModLoader.getMinecraftInstance().effectRenderer.addEffect(airFX); mc.effectRenderer.addEffect(airFX);
} }
@Override @Override
public void earthFX(World worldObj, double x, double y, double z, float scale) public void earthFX(World worldObj, double x, double y, double z, float scale) {
{
PowerEarthFX earthFX = new PowerEarthFX(worldObj, x, y, z, scale); PowerEarthFX earthFX = new PowerEarthFX(worldObj, x, y, z, scale);
ModLoader.getMinecraftInstance().effectRenderer.addEffect(earthFX); mc.effectRenderer.addEffect(earthFX);
} }
@Override @Override
public void energyFX(World worldObj, double x, double y, double z, float scale) public void energyFX(World worldObj, double x, double y, double z, float scale) {
{
PowerEnergyFX energyFX = new PowerEnergyFX(worldObj, x, y, z, scale); PowerEnergyFX energyFX = new PowerEnergyFX(worldObj, x, y, z, scale);
ModLoader.getMinecraftInstance().effectRenderer.addEffect(energyFX); mc.effectRenderer.addEffect(energyFX);
} }
@Override @Override
public void fireFX(World worldObj, double x, double y, double z, float scale) public void fireFX(World worldObj, double x, double y, double z, float scale) {
{
PowerFireFX fireFX = new PowerFireFX(worldObj, x, y, z, scale); PowerFireFX fireFX = new PowerFireFX(worldObj, x, y, z, scale);
ModLoader.getMinecraftInstance().effectRenderer.addEffect(fireFX); mc.effectRenderer.addEffect(fireFX);
} }
@Override @Override
public void waterFX(World worldObj, double x, double y, double z, float scale) public void lightCubeFX(World worldObj, double x, double y, double z, double motionX, double motionY, double motionZ, float scale) {
{
PowerWaterFX waterFX = new PowerWaterFX(worldObj, x, y, z, scale);
ModLoader.getMinecraftInstance().effectRenderer.addEffect(waterFX);
}
@Override
public void lightCubeFX(World worldObj, double x, double y, double z, double motionX, double motionY, double motionZ, float scale)
{
LightCubeFX lightCubeFX = new LightCubeFX(worldObj, x, y, z, motionX, motionY, motionZ, scale); LightCubeFX lightCubeFX = new LightCubeFX(worldObj, x, y, z, motionX, motionY, motionZ, scale);
ModLoader.getMinecraftInstance().effectRenderer.addEffect(lightCubeFX); mc.effectRenderer.addEffect(lightCubeFX);
} }
@Override
public void registerRenders() {
BlockPillarInsert.RENDER_PILLAR_INSERT = RenderingRegistry.getNextAvailableRenderId();
MinecraftForgeClient.registerItemRenderer(BlockHandler.pillarInsert.blockID, new BlockPillarInsertRenderer());
MinecraftForgeClient.registerItemRenderer(ItemHandler.fireStaff.itemID, new ItemStaffFireRenderer());
MinecraftForgeClient.registerItemRenderer(ItemHandler.earthStaff.itemID, new ItemStaffEarthRenderer());
MinecraftForgeClient.registerItemRenderer(ItemHandler.airStaff.itemID, new ItemStaffAirRenderer());
MinecraftForgeClient.registerItemRenderer(ItemHandler.energyStaff.itemID, new ItemStaffEnergyRenderer());
MinecraftForgeClient.registerItemRenderer(ItemHandler.waterStaff.itemID, new ItemStaffWaterRenderer());
MinecraftForgeClient.registerItemRenderer(ItemHandler.fireOrb.itemID, new ItemOrbFireRenderer());
MinecraftForgeClient.registerItemRenderer(ItemHandler.earthOrb.itemID, new ItemOrbEarthRenderer());
MinecraftForgeClient.registerItemRenderer(ItemHandler.airOrb.itemID, new ItemOrbAirRenderer());
MinecraftForgeClient.registerItemRenderer(ItemHandler.energyOrb.itemID, new ItemOrbEnergyRenderer());
MinecraftForgeClient.registerItemRenderer(ItemHandler.waterOrb.itemID, new ItemOrbWaterRenderer());
RenderingRegistry.registerEntityRenderingHandler(EntityChargeFire.class, new RenderStaffPower(0));
RenderingRegistry.registerEntityRenderingHandler(EntityChargeWater.class, new RenderStaffPower(1));
RenderingRegistry.registerEntityRenderingHandler(EntityChargeEarth.class, new RenderStaffPower(2));
RenderingRegistry.registerEntityRenderingHandler(EntityChargeAir.class, new RenderStaffPower(3));
RenderingRegistry.registerEntityRenderingHandler(EntityChargeEnergy.class, new RenderStaffPower(4));
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPillarInsert.class, new TileEntityPillarInsertRenderer());
}
@Override
public void waterFX(World worldObj, double x, double y, double z, float scale) {
PowerWaterFX waterFX = new PowerWaterFX(worldObj, x, y, z, scale);
mc.effectRenderer.addEffect(waterFX);
}
} }

View file

@ -1,21 +1,20 @@
package MysticWorld.Client.FX; package mysticworld.client.fx;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.particle.EntityFX; import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
public class LightCubeFX extends EntityFX { import org.lwjgl.opengl.GL11;
public LightCubeFX(World world, double x, double y, double z) import cpw.mods.fml.client.FMLClientHandler;
{
public class LightCubeFX extends EntityFX {
public LightCubeFX(World world, double x, double y, double z) {
super(world, x, y, z); super(world, x, y, z);
} }
public LightCubeFX(World world, double x, double y, double z, double motionX, double motionY, double motionZ, float scale){ public LightCubeFX(World world, double x, double y, double z, double motionX, double motionY, double motionZ, float scale) {
super(world, x, y, z); super(world, x, y, z);
this.motionX *= 0.10000000149011612D; this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D; this.motionY *= 0.10000000149011612D;
@ -31,72 +30,54 @@ public class LightCubeFX extends EntityFX {
this.particleMaxAge = rand.nextInt(25); this.particleMaxAge = rand.nextInt(25);
} }
public void onUpdate() @Override
{ public void onUpdate() {
this.prevPosX = this.posX; this.prevPosX = this.posX;
this.prevPosY = this.posY; this.prevPosY = this.posY;
this.prevPosZ = this.posZ; this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge) {
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead(); this.setDead();
} }
this.motionY += 0.004D; this.motionY += 0.004D;
this.moveEntity(this.motionX, this.motionY, this.motionZ); this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevPosY) {
if (this.posY == this.prevPosY)
{
this.motionX *= 1.1D; this.motionX *= 1.1D;
this.motionZ *= 1.1D; this.motionZ *= 1.1D;
} }
this.motionX *= 0.9599999785423279D; this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D; this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D; this.motionZ *= 0.9599999785423279D;
if (this.onGround) {
if (this.onGround)
{
this.motionX *= 0.699999988079071D; this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D; this.motionZ *= 0.699999988079071D;
} }
} }
public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7) @Override
{ public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7) {
tessellator.draw(); tessellator.draw();
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glDepthMask(false); GL11.glDepthMask(false);
GL11.glEnable(3042); GL11.glEnable(3042);
GL11.glBlendFunc(770, 1); GL11.glBlendFunc(770, 1);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("MysticMods:textures" + "/misc/lightCubeFX.png"));
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation("MysticMods:textures" + "/misc/lightCubeFX.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
float scale = 0.1F * this.particleScale; float scale = 0.1F * this.particleScale;
float xPos = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) par2 - interpPosX); float xPos = (float) (this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX);
float yPos = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) par2 - interpPosY); float yPos = (float) (this.prevPosY + (this.posY - this.prevPosY) * par2 - interpPosY);
float zPos = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 - interpPosZ); float zPos = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * par2 - interpPosZ);
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
tessellator.setBrightness(240); tessellator.setBrightness(240);
tessellator.setColorOpaque_F(this.particleRed, this.particleGreen, this.particleBlue); tessellator.setColorOpaque_F(this.particleRed, this.particleGreen, this.particleBlue);
tessellator.addVertexWithUV(xPos - par3 * scale - par6 * scale, yPos - par4 * scale, zPos - par5 * scale - par7 * scale, 0D, 1D);
tessellator.addVertexWithUV((double) (xPos - par3 * scale - par6 * scale), (double) (yPos - par4 * scale), (double) (zPos - par5 * scale - par7 * scale), 0D, 1D); tessellator.addVertexWithUV(xPos - par3 * scale + par6 * scale, yPos + par4 * scale, zPos - par5 * scale + par7 * scale, 1D, 1D);
tessellator.addVertexWithUV((double) (xPos - par3 * scale + par6 * scale), (double) (yPos + par4 * scale), (double) (zPos - par5 * scale + par7 * scale), 1D, 1D); tessellator.addVertexWithUV(xPos + par3 * scale + par6 * scale, yPos + par4 * scale, zPos + par5 * scale + par7 * scale, 1D, 0D);
tessellator.addVertexWithUV((double) (xPos + par3 * scale + par6 * scale), (double) (yPos + par4 * scale), (double) (zPos + par5 * scale + par7 * scale), 1D, 0D); tessellator.addVertexWithUV(xPos + par3 * scale - par6 * scale, yPos - par4 * scale, zPos + par5 * scale - par7 * scale, 0D, 0D);
tessellator.addVertexWithUV((double) (xPos + par3 * scale - par6 * scale), (double) (yPos - par4 * scale), (double) (zPos + par5 * scale - par7 * scale), 0D, 0D);
tessellator.draw(); tessellator.draw();
GL11.glDisable(3042); GL11.glDisable(3042);
GL11.glDepthMask(true); GL11.glDepthMask(true);
GL11.glPopMatrix(); GL11.glPopMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("minecraft:textures" + "/particle/particles.png"));
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation("minecraft:textures" + "/particle/particles.png"));
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
} }
} }

View file

@ -1,24 +1,36 @@
package MysticWorld.Client.FX; package mysticworld.client.fx;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.particle.EntityFX; public class PowerAirFX extends EntityFX {
import net.minecraft.client.renderer.Tessellator; public PowerAirFX(World world, double x, double y, double z) {
import net.minecraft.src.ModLoader;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class PowerAirFX extends EntityFX
{
public PowerAirFX(World world, double x, double y, double z)
{
super(world, x, y, z); super(world, x, y, z);
} }
public PowerAirFX(World world, double x, double y, double z, float scale, int age){ public PowerAirFX(World world, double x, double y, double z, double motionX, double motionY, double motionZ, float rotPitch, float rotYaw) {
super(world, x, y, z);
this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
this.motionY = (-MathHelper.sin((this.rotationPitch) / 180.0F * (float) Math.PI));
this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
this.particleRed = 1.0F;
this.particleGreen = 1.0F;
this.particleBlue = 1.0F;
this.particleScale = 1.0F;
this.noClip = true;
this.particleMaxAge = 120;
this.rotationPitch = rotPitch;
this.rotationYaw = rotYaw;
}
public PowerAirFX(World world, double x, double y, double z, float scale, int age) {
super(world, x, y, z); super(world, x, y, z);
this.motionX += motionX; this.motionX += motionX;
this.motionY += motionY; this.motionY += motionY;
@ -34,93 +46,58 @@ public class PowerAirFX extends EntityFX
this.particleMaxAge = age; this.particleMaxAge = age;
} }
public PowerAirFX(World world, double x, double y, double z, double motionX, double motionY, double motionZ, float rotPitch, float rotYaw){ @Override
super(world, x, y, z); public void onUpdate() {
this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
this.motionY = (double)(-MathHelper.sin((this.rotationPitch) / 180.0F * (float)Math.PI));
this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
this.particleRed = 1.0F;
this.particleGreen = 1.0F;
this.particleBlue = 1.0F;
this.particleScale = 1.0F;
this.noClip = true;
this.particleMaxAge = 120;
this.rotationPitch = rotPitch;
this.rotationYaw = rotYaw;
}
public void onUpdate()
{
this.prevPosX = this.posX; this.prevPosX = this.posX;
this.prevPosY = this.posY; this.prevPosY = this.posY;
this.prevPosZ = this.posZ; this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge) {
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead(); this.setDead();
} }
this.motionY += 0.004D; this.motionY += 0.004D;
this.moveEntity(this.motionX, this.motionY, this.motionZ); this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevPosY) {
if (this.posY == this.prevPosY)
{
this.motionX *= 1.1D; this.motionX *= 1.1D;
this.motionZ *= 1.1D; this.motionZ *= 1.1D;
} }
this.motionX *= 0.9599999785423279D; this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D; this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D; this.motionZ *= 0.9599999785423279D;
if (this.onGround) {
if (this.onGround)
{
this.motionX *= 0.699999988079071D; this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D; this.motionZ *= 0.699999988079071D;
} }
this.posX += this.motionX; this.posX += this.motionX;
this.posY += this.motionY; this.posY += this.motionY;
this.posZ += this.motionZ; this.posZ += this.motionZ;
this.setPosition(this.posX, this.posY, this.posZ); this.setPosition(this.posX, this.posY, this.posZ);
} }
public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7) @Override
{ public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7) {
tessellator.draw(); tessellator.draw();
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glDepthMask(false); GL11.glDepthMask(false);
GL11.glEnable(3042); GL11.glEnable(3042);
GL11.glBlendFunc(770, 1); GL11.glBlendFunc(770, 1);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("MysticMods:textures" + "/misc/airFX.png"));
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation("MysticMods:textures" + "/misc/airFX.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
float scale = 0.1F * this.particleScale; float scale = 0.1F * this.particleScale;
float xPos = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) par2 - interpPosX); float xPos = (float) (this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX);
float yPos = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) par2 - interpPosY); float yPos = (float) (this.prevPosY + (this.posY - this.prevPosY) * par2 - interpPosY);
float zPos = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 - interpPosZ); float zPos = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * par2 - interpPosZ);
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
tessellator.setBrightness(240); tessellator.setBrightness(240);
tessellator.setColorOpaque_F(this.particleRed, this.particleGreen, this.particleBlue); tessellator.setColorOpaque_F(this.particleRed, this.particleGreen, this.particleBlue);
tessellator.addVertexWithUV(xPos - par3 * scale - par6 * scale, yPos - par4 * scale, zPos - par5 * scale - par7 * scale, 0D, 1D);
tessellator.addVertexWithUV((double) (xPos - par3 * scale - par6 * scale), (double) (yPos - par4 * scale), (double) (zPos - par5 * scale - par7 * scale), 0D, 1D); tessellator.addVertexWithUV(xPos - par3 * scale + par6 * scale, yPos + par4 * scale, zPos - par5 * scale + par7 * scale, 1D, 1D);
tessellator.addVertexWithUV((double) (xPos - par3 * scale + par6 * scale), (double) (yPos + par4 * scale), (double) (zPos - par5 * scale + par7 * scale), 1D, 1D); tessellator.addVertexWithUV(xPos + par3 * scale + par6 * scale, yPos + par4 * scale, zPos + par5 * scale + par7 * scale, 1D, 0D);
tessellator.addVertexWithUV((double) (xPos + par3 * scale + par6 * scale), (double) (yPos + par4 * scale), (double) (zPos + par5 * scale + par7 * scale), 1D, 0D); tessellator.addVertexWithUV(xPos + par3 * scale - par6 * scale, yPos - par4 * scale, zPos + par5 * scale - par7 * scale, 0D, 0D);
tessellator.addVertexWithUV((double) (xPos + par3 * scale - par6 * scale), (double) (yPos - par4 * scale), (double) (zPos + par5 * scale - par7 * scale), 0D, 0D);
tessellator.draw(); tessellator.draw();
GL11.glDisable(3042); GL11.glDisable(3042);
GL11.glDepthMask(true); GL11.glDepthMask(true);
GL11.glPopMatrix(); GL11.glPopMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("minecraft:textures" + "/particle/particles.png"));
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation("minecraft:textures" + "/particle/particles.png"));
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
} }
} }

View file

@ -1,23 +1,20 @@
package MysticWorld.Client.FX; package mysticworld.client.fx;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.particle.EntityFX; public class PowerEarthFX extends EntityFX {
import net.minecraft.client.renderer.Tessellator; public PowerEarthFX(World world, double x, double y, double z) {
import net.minecraft.src.ModLoader;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class PowerEarthFX extends EntityFX
{
public PowerEarthFX(World world, double x, double y, double z)
{
super(world, x, y, z); super(world, x, y, z);
} }
public PowerEarthFX(World world, double x, double y, double z, float scale){ public PowerEarthFX(World world, double x, double y, double z, float scale) {
super(world, x, y, z); super(world, x, y, z);
this.motionX *= 0.019999999552965164D; this.motionX *= 0.019999999552965164D;
this.motionY *= 0.019999999552965164D; this.motionY *= 0.019999999552965164D;
@ -33,72 +30,54 @@ public class PowerEarthFX extends EntityFX
this.particleMaxAge = 15; this.particleMaxAge = 15;
} }
public void onUpdate() @Override
{ public void onUpdate() {
this.prevPosX = this.posX; this.prevPosX = this.posX;
this.prevPosY = this.posY; this.prevPosY = this.posY;
this.prevPosZ = this.posZ; this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge) {
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead(); this.setDead();
} }
this.motionY += 0.004D; this.motionY += 0.004D;
this.moveEntity(this.motionX, this.motionY, this.motionZ); this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevPosY) {
if (this.posY == this.prevPosY)
{
this.motionX *= 1.1D; this.motionX *= 1.1D;
this.motionZ *= 1.1D; this.motionZ *= 1.1D;
} }
this.motionX *= 0.9599999785423279D; this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D; this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D; this.motionZ *= 0.9599999785423279D;
if (this.onGround) {
if (this.onGround)
{
this.motionX *= 0.699999988079071D; this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D; this.motionZ *= 0.699999988079071D;
} }
} }
public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7) @Override
{ public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7) {
tessellator.draw(); tessellator.draw();
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glDepthMask(false); GL11.glDepthMask(false);
GL11.glEnable(3042); GL11.glEnable(3042);
GL11.glBlendFunc(770, 1); GL11.glBlendFunc(770, 1);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("MysticMods:textures" + "/misc/earthFX.png"));
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation("MysticMods:textures" + "/misc/earthFX.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
float scale = 0.1F * this.particleScale; float scale = 0.1F * this.particleScale;
float xPos = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) par2 - interpPosX); float xPos = (float) (this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX);
float yPos = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) par2 - interpPosY); float yPos = (float) (this.prevPosY + (this.posY - this.prevPosY) * par2 - interpPosY);
float zPos = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 - interpPosZ); float zPos = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * par2 - interpPosZ);
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
tessellator.setBrightness(240); tessellator.setBrightness(240);
tessellator.setColorOpaque_F(this.particleRed, this.particleGreen, this.particleBlue); tessellator.setColorOpaque_F(this.particleRed, this.particleGreen, this.particleBlue);
tessellator.addVertexWithUV(xPos - par3 * scale - par6 * scale, yPos - par4 * scale, zPos - par5 * scale - par7 * scale, 0D, 1D);
tessellator.addVertexWithUV((double) (xPos - par3 * scale - par6 * scale), (double) (yPos - par4 * scale), (double) (zPos - par5 * scale - par7 * scale), 0D, 1D); tessellator.addVertexWithUV(xPos - par3 * scale + par6 * scale, yPos + par4 * scale, zPos - par5 * scale + par7 * scale, 1D, 1D);
tessellator.addVertexWithUV((double) (xPos - par3 * scale + par6 * scale), (double) (yPos + par4 * scale), (double) (zPos - par5 * scale + par7 * scale), 1D, 1D); tessellator.addVertexWithUV(xPos + par3 * scale + par6 * scale, yPos + par4 * scale, zPos + par5 * scale + par7 * scale, 1D, 0D);
tessellator.addVertexWithUV((double) (xPos + par3 * scale + par6 * scale), (double) (yPos + par4 * scale), (double) (zPos + par5 * scale + par7 * scale), 1D, 0D); tessellator.addVertexWithUV(xPos + par3 * scale - par6 * scale, yPos - par4 * scale, zPos + par5 * scale - par7 * scale, 0D, 0D);
tessellator.addVertexWithUV((double) (xPos + par3 * scale - par6 * scale), (double) (yPos - par4 * scale), (double) (zPos + par5 * scale - par7 * scale), 0D, 0D);
tessellator.draw(); tessellator.draw();
GL11.glDisable(3042); GL11.glDisable(3042);
GL11.glDepthMask(true); GL11.glDepthMask(true);
GL11.glPopMatrix(); GL11.glPopMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("minecraft:textures" + "/particle/particles.png"));
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation("minecraft:textures" + "/particle/particles.png"));
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
} }
} }

View file

@ -1,23 +1,20 @@
package MysticWorld.Client.FX; package mysticworld.client.fx;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.particle.EntityFX; public class PowerEnergyFX extends EntityFX {
import net.minecraft.client.renderer.Tessellator; public PowerEnergyFX(World world, double x, double y, double z) {
import net.minecraft.src.ModLoader;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class PowerEnergyFX extends EntityFX
{
public PowerEnergyFX(World world, double x, double y, double z)
{
super(world, x, y, z); super(world, x, y, z);
} }
public PowerEnergyFX(World world, double x, double y, double z, float scale){ public PowerEnergyFX(World world, double x, double y, double z, float scale) {
super(world, x, y, z); super(world, x, y, z);
this.motionX *= 0.019999999552965164D; this.motionX *= 0.019999999552965164D;
this.motionY *= 0.019999999552965164D; this.motionY *= 0.019999999552965164D;
@ -33,72 +30,54 @@ public class PowerEnergyFX extends EntityFX
this.particleMaxAge = 15; this.particleMaxAge = 15;
} }
public void onUpdate() @Override
{ public void onUpdate() {
this.prevPosX = this.posX; this.prevPosX = this.posX;
this.prevPosY = this.posY; this.prevPosY = this.posY;
this.prevPosZ = this.posZ; this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge) {
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead(); this.setDead();
} }
this.motionY += 0.004D; this.motionY += 0.004D;
this.moveEntity(this.motionX, this.motionY, this.motionZ); this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevPosY) {
if (this.posY == this.prevPosY)
{
this.motionX *= 1.1D; this.motionX *= 1.1D;
this.motionZ *= 1.1D; this.motionZ *= 1.1D;
} }
this.motionX *= 0.9599999785423279D; this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D; this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D; this.motionZ *= 0.9599999785423279D;
if (this.onGround) {
if (this.onGround)
{
this.motionX *= 0.699999988079071D; this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D; this.motionZ *= 0.699999988079071D;
} }
} }
public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7) @Override
{ public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7) {
tessellator.draw(); tessellator.draw();
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glDepthMask(false); GL11.glDepthMask(false);
GL11.glEnable(3042); GL11.glEnable(3042);
GL11.glBlendFunc(770, 1); GL11.glBlendFunc(770, 1);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("MysticMods:textures" + "/misc/energyFX.png"));
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation("MysticMods:textures" + "/misc/energyFX.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
float scale = 0.1F * this.particleScale; float scale = 0.1F * this.particleScale;
float xPos = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) par2 - interpPosX); float xPos = (float) (this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX);
float yPos = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) par2 - interpPosY); float yPos = (float) (this.prevPosY + (this.posY - this.prevPosY) * par2 - interpPosY);
float zPos = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 - interpPosZ); float zPos = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * par2 - interpPosZ);
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
tessellator.setBrightness(240); tessellator.setBrightness(240);
tessellator.setColorOpaque_F(this.particleRed, this.particleGreen, this.particleBlue); tessellator.setColorOpaque_F(this.particleRed, this.particleGreen, this.particleBlue);
tessellator.addVertexWithUV(xPos - par3 * scale - par6 * scale, yPos - par4 * scale, zPos - par5 * scale - par7 * scale, 0D, 1D);
tessellator.addVertexWithUV((double) (xPos - par3 * scale - par6 * scale), (double) (yPos - par4 * scale), (double) (zPos - par5 * scale - par7 * scale), 0D, 1D); tessellator.addVertexWithUV(xPos - par3 * scale + par6 * scale, yPos + par4 * scale, zPos - par5 * scale + par7 * scale, 1D, 1D);
tessellator.addVertexWithUV((double) (xPos - par3 * scale + par6 * scale), (double) (yPos + par4 * scale), (double) (zPos - par5 * scale + par7 * scale), 1D, 1D); tessellator.addVertexWithUV(xPos + par3 * scale + par6 * scale, yPos + par4 * scale, zPos + par5 * scale + par7 * scale, 1D, 0D);
tessellator.addVertexWithUV((double) (xPos + par3 * scale + par6 * scale), (double) (yPos + par4 * scale), (double) (zPos + par5 * scale + par7 * scale), 1D, 0D); tessellator.addVertexWithUV(xPos + par3 * scale - par6 * scale, yPos - par4 * scale, zPos + par5 * scale - par7 * scale, 0D, 0D);
tessellator.addVertexWithUV((double) (xPos + par3 * scale - par6 * scale), (double) (yPos - par4 * scale), (double) (zPos + par5 * scale - par7 * scale), 0D, 0D);
tessellator.draw(); tessellator.draw();
GL11.glDisable(3042); GL11.glDisable(3042);
GL11.glDepthMask(true); GL11.glDepthMask(true);
GL11.glPopMatrix(); GL11.glPopMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("minecraft:textures" + "/particle/particles.png"));
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation("minecraft:textures" + "/particle/particles.png"));
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
} }
} }

View file

@ -1,23 +1,20 @@
package MysticWorld.Client.FX; package mysticworld.client.fx;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.particle.EntityFX; public class PowerFireFX extends EntityFX {
import net.minecraft.client.renderer.Tessellator; public PowerFireFX(World world, double x, double y, double z) {
import net.minecraft.src.ModLoader;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class PowerFireFX extends EntityFX
{
public PowerFireFX(World world, double x, double y, double z)
{
super(world, x, y, z); super(world, x, y, z);
} }
public PowerFireFX(World world, double x, double y, double z, float scale){ public PowerFireFX(World world, double x, double y, double z, float scale) {
super(world, x, y, z); super(world, x, y, z);
this.motionX *= 0.019999999552965164D; this.motionX *= 0.019999999552965164D;
this.motionY *= 0.019999999552965164D; this.motionY *= 0.019999999552965164D;
@ -33,73 +30,54 @@ public class PowerFireFX extends EntityFX
this.particleMaxAge = 15; this.particleMaxAge = 15;
} }
public void onUpdate() @Override
{ public void onUpdate() {
this.prevPosX = this.posX; this.prevPosX = this.posX;
this.prevPosY = this.posY; this.prevPosY = this.posY;
this.prevPosZ = this.posZ; this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge) {
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead(); this.setDead();
} }
this.motionY += 0.004D; this.motionY += 0.004D;
this.moveEntity(this.motionX, this.motionY, this.motionZ); this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevPosY) {
if (this.posY == this.prevPosY)
{
this.motionX *= 1.1D; this.motionX *= 1.1D;
this.motionZ *= 1.1D; this.motionZ *= 1.1D;
} }
this.motionX *= 0.9599999785423279D; this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D; this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D; this.motionZ *= 0.9599999785423279D;
if (this.onGround) {
if (this.onGround)
{
this.motionX *= 0.699999988079071D; this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D; this.motionZ *= 0.699999988079071D;
} }
} }
public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7) @Override
{ public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7) {
tessellator.draw(); tessellator.draw();
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glDepthMask(false); GL11.glDepthMask(false);
GL11.glEnable(3042); GL11.glEnable(3042);
GL11.glBlendFunc(770, 1); GL11.glBlendFunc(770, 1);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("MysticMods:textures" + "/misc/fireFX.png"));
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation("MysticMods:textures" + "/misc/fireFX.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
float scale = 0.1F * this.particleScale; float scale = 0.1F * this.particleScale;
float xPos = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) par2 - interpPosX); float xPos = (float) (this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX);
float yPos = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) par2 - interpPosY); float yPos = (float) (this.prevPosY + (this.posY - this.prevPosY) * par2 - interpPosY);
float zPos = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 - interpPosZ); float zPos = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * par2 - interpPosZ);
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
tessellator.setBrightness(240); tessellator.setBrightness(240);
tessellator.setColorOpaque_F(this.particleRed, this.particleGreen, this.particleBlue); tessellator.setColorOpaque_F(this.particleRed, this.particleGreen, this.particleBlue);
tessellator.addVertexWithUV(xPos - par3 * scale - par6 * scale, yPos - par4 * scale, zPos - par5 * scale - par7 * scale, 0D, 1D);
tessellator.addVertexWithUV((double) (xPos - par3 * scale - par6 * scale), (double) (yPos - par4 * scale), (double) (zPos - par5 * scale - par7 * scale), 0D, 1D); tessellator.addVertexWithUV(xPos - par3 * scale + par6 * scale, yPos + par4 * scale, zPos - par5 * scale + par7 * scale, 1D, 1D);
tessellator.addVertexWithUV((double) (xPos - par3 * scale + par6 * scale), (double) (yPos + par4 * scale), (double) (zPos - par5 * scale + par7 * scale), 1D, 1D); tessellator.addVertexWithUV(xPos + par3 * scale + par6 * scale, yPos + par4 * scale, zPos + par5 * scale + par7 * scale, 1D, 0D);
tessellator.addVertexWithUV((double) (xPos + par3 * scale + par6 * scale), (double) (yPos + par4 * scale), (double) (zPos + par5 * scale + par7 * scale), 1D, 0D); tessellator.addVertexWithUV(xPos + par3 * scale - par6 * scale, yPos - par4 * scale, zPos + par5 * scale - par7 * scale, 0D, 0D);
tessellator.addVertexWithUV((double) (xPos + par3 * scale - par6 * scale), (double) (yPos - par4 * scale), (double) (zPos + par5 * scale - par7 * scale), 0D, 0D);
tessellator.draw(); tessellator.draw();
GL11.glDisable(3042); GL11.glDisable(3042);
GL11.glDepthMask(true); GL11.glDepthMask(true);
GL11.glPopMatrix(); GL11.glPopMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("minecraft:textures" + "/particle/particles.png"));
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation("minecraft:textures" + "/particle/particles.png"));
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
} }
} }

View file

@ -1,23 +1,20 @@
package MysticWorld.Client.FX; package mysticworld.client.fx;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.particle.EntityFX; public class PowerWaterFX extends EntityFX {
import net.minecraft.client.renderer.Tessellator; public PowerWaterFX(World world, double x, double y, double z) {
import net.minecraft.src.ModLoader;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class PowerWaterFX extends EntityFX
{
public PowerWaterFX(World world, double x, double y, double z)
{
super(world, x, y, z); super(world, x, y, z);
} }
public PowerWaterFX(World world, double x, double y, double z, float scale){ public PowerWaterFX(World world, double x, double y, double z, float scale) {
super(world, x, y, z); super(world, x, y, z);
this.motionX *= 0.019999999552965164D; this.motionX *= 0.019999999552965164D;
this.motionY *= 0.019999999552965164D; this.motionY *= 0.019999999552965164D;
@ -33,72 +30,54 @@ public class PowerWaterFX extends EntityFX
this.particleMaxAge = 15; this.particleMaxAge = 15;
} }
public void onUpdate() @Override
{ public void onUpdate() {
this.prevPosX = this.posX; this.prevPosX = this.posX;
this.prevPosY = this.posY; this.prevPosY = this.posY;
this.prevPosZ = this.posZ; this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge) {
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead(); this.setDead();
} }
this.motionY += 0.004D; this.motionY += 0.004D;
this.moveEntity(this.motionX, this.motionY, this.motionZ); this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevPosY) {
if (this.posY == this.prevPosY)
{
this.motionX *= 1.1D; this.motionX *= 1.1D;
this.motionZ *= 1.1D; this.motionZ *= 1.1D;
} }
this.motionX *= 0.9599999785423279D; this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D; this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D; this.motionZ *= 0.9599999785423279D;
if (this.onGround) {
if (this.onGround)
{
this.motionX *= 0.699999988079071D; this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D; this.motionZ *= 0.699999988079071D;
} }
} }
public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7) @Override
{ public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7) {
tessellator.draw(); tessellator.draw();
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glDepthMask(false); GL11.glDepthMask(false);
GL11.glEnable(3042); GL11.glEnable(3042);
GL11.glBlendFunc(770, 1); GL11.glBlendFunc(770, 1);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("MysticMods:textures" + "/misc/waterFX.png"));
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation("MysticMods:textures" + "/misc/waterFX.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
float scale = 0.1F * this.particleScale; float scale = 0.1F * this.particleScale;
float xPos = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) par2 - interpPosX); float xPos = (float) (this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX);
float yPos = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) par2 - interpPosY); float yPos = (float) (this.prevPosY + (this.posY - this.prevPosY) * par2 - interpPosY);
float zPos = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 - interpPosZ); float zPos = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * par2 - interpPosZ);
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
tessellator.setBrightness(240); tessellator.setBrightness(240);
tessellator.setColorOpaque_F(this.particleRed, this.particleGreen, this.particleBlue); tessellator.setColorOpaque_F(this.particleRed, this.particleGreen, this.particleBlue);
tessellator.addVertexWithUV(xPos - par3 * scale - par6 * scale, yPos - par4 * scale, zPos - par5 * scale - par7 * scale, 0D, 1D);
tessellator.addVertexWithUV((double) (xPos - par3 * scale - par6 * scale), (double) (yPos - par4 * scale), (double) (zPos - par5 * scale - par7 * scale), 0D, 1D); tessellator.addVertexWithUV(xPos - par3 * scale + par6 * scale, yPos + par4 * scale, zPos - par5 * scale + par7 * scale, 1D, 1D);
tessellator.addVertexWithUV((double) (xPos - par3 * scale + par6 * scale), (double) (yPos + par4 * scale), (double) (zPos - par5 * scale + par7 * scale), 1D, 1D); tessellator.addVertexWithUV(xPos + par3 * scale + par6 * scale, yPos + par4 * scale, zPos + par5 * scale + par7 * scale, 1D, 0D);
tessellator.addVertexWithUV((double) (xPos + par3 * scale + par6 * scale), (double) (yPos + par4 * scale), (double) (zPos + par5 * scale + par7 * scale), 1D, 0D); tessellator.addVertexWithUV(xPos + par3 * scale - par6 * scale, yPos - par4 * scale, zPos + par5 * scale - par7 * scale, 0D, 0D);
tessellator.addVertexWithUV((double) (xPos + par3 * scale - par6 * scale), (double) (yPos - par4 * scale), (double) (zPos + par5 * scale - par7 * scale), 0D, 0D);
tessellator.draw(); tessellator.draw();
GL11.glDisable(3042); GL11.glDisable(3042);
GL11.glDepthMask(true); GL11.glDepthMask(true);
GL11.glPopMatrix(); GL11.glPopMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("minecraft:textures" + "/particle/particles.png"));
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation("minecraft:textures" + "/particle/particles.png"));
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
} }
} }

View file

@ -1,186 +1,153 @@
package MysticWorld.Entity; package mysticworld.entity;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import cpw.mods.fml.relauncher.Side; import mysticworld.MysticWorld;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityFireball;
import net.minecraft.entity.projectile.EntitySmallFireball;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.item.Item;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.FakePlayerFactory; import cpw.mods.fml.relauncher.Side;
import net.minecraftforge.common.ForgeHooks; import cpw.mods.fml.relauncher.SideOnly;
import MysticWorld.MysticWorld;
public class EntityChargeAir extends Entity { public class EntityChargeAir extends Entity {
public EntityPlayer shootingEntity; public EntityPlayer shootingEntity;
private boolean inGround = false; private boolean inGround = false;
private int xTile = -1; private int xTile = -1;
private int yTile = -1; private int yTile = -1;
private int zTile = -1; private int zTile = -1;
private int inTile = 0; private int inTile = 0;
private int ticksAlive; private int ticksAlive;
private int ticksInAir = 0; private int ticksInAir = 0;
private float particleScale = 1.0f; private float particleScale = 1.0f;
private double powerHeight = 0.75D; private double powerHeight = 0.75D;
public EntityChargeAir(World par1World) public EntityChargeAir(World par1World) {
{
super(par1World); super(par1World);
} }
public EntityChargeAir(World par1World, EntityPlayer par2EntityPlayer, float pScale, double pHeight) public EntityChargeAir(World par1World, EntityPlayer par2EntityPlayer, float pScale, double pHeight) {
{
super(par1World); super(par1World);
this.setSize(0.25F, 0.25F); this.setSize(0.25F, 0.25F);
this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + (double)par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch); this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch);
this.setPosition(this.posX, this.posY, this.posZ); this.setPosition(this.posX, this.posY, this.posZ);
this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
this.motionY = (double)(-MathHelper.sin((this.rotationPitch) / 180.0F * (float)Math.PI)); this.motionY = (-MathHelper.sin((this.rotationPitch) / 180.0F * (float) Math.PI));
this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
this.shootingEntity = par2EntityPlayer; this.shootingEntity = par2EntityPlayer;
this.particleScale = pScale; this.particleScale = pScale;
this.powerHeight = pHeight; this.powerHeight = pHeight;
} }
public void onUpdate() @Override
{ public boolean canBeCollidedWith() {
if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int)this.posX, (int)this.posY, (int)this.posZ))) return true;
{
this.setDead();
} }
else
{
super.onUpdate();
@Override
public float getBrightness(float par1) {
return 1.0F;
}
@Override
@SideOnly(Side.CLIENT)
public int getBrightnessForRender(float par1) {
return 15728880;
}
@Override
public float getCollisionBorderSize() {
return 1.0F;
}
@Override
@SideOnly(Side.CLIENT)
public float getShadowSize() {
return 0.0F;
}
@Override
public void onUpdate() {
if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int) this.posX, (int) this.posY, (int) this.posZ))) {
this.setDead();
} else {
super.onUpdate();
Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks_do_do(vec3, vec31, true, true); MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks_do_do(vec3, vec31, true, true);
vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (movingobjectposition != null) {
if (movingobjectposition != null)
{
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
} }
Entity entity = null; Entity entity = null;
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
double d0 = 0.0D; double d0 = 0.0D;
for (int j = 0; j < list.size(); ++j) {
for (int j = 0; j < list.size(); ++j) Entity entity1 = (Entity) list.get(j);
{ if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25)) {
Entity entity1 = (Entity)list.get(j);
if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25))
{
float f = 0.3F; float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.expand((double)f, (double)f, (double)f); AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31);
if (movingobjectposition1 != null) {
if (movingobjectposition1 != null)
{
double d1 = vec3.distanceTo(movingobjectposition1.hitVec); double d1 = vec3.distanceTo(movingobjectposition1.hitVec);
if (d1 < d0 || d0 == 0.0D) {
if (d1 < d0 || d0 == 0.0D)
{
entity = entity1; entity = entity1;
d0 = d1; d0 = d1;
} }
} }
} }
} }
if (entity != null) {
if (entity != null)
{
movingobjectposition = new MovingObjectPosition(entity); movingobjectposition = new MovingObjectPosition(entity);
} }
if (movingobjectposition != null) {
if (movingobjectposition != null)
{
this.onImpact(movingobjectposition); this.onImpact(movingobjectposition);
} }
this.posX += this.motionX; this.posX += this.motionX;
this.posY += this.motionY; this.posY += this.motionY;
this.posZ += this.motionZ; this.posZ += this.motionZ;
float f2 = this.getMotionFactor(); float f2 = this.getMotionFactor();
if (this.isInWater()) {
if (this.isInWater()) for (int k = 0; k < 4; ++k) {
{
for (int k = 0; k < 4; ++k)
{
float f3 = 0.25F; float f3 = 0.25F;
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3, this.motionX, this.motionY, this.motionZ); this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f3, this.posY - this.motionY * f3, this.posZ - this.motionZ * f3, this.motionX, this.motionY, this.motionZ);
} }
f2 = 0.8F; f2 = 0.8F;
} }
MysticWorld.proxy.airFeetFX(this.worldObj, this.posX + (rand.nextDouble() / 2), this.posY + 0.5D, this.posZ + (rand.nextDouble() / 2), particleScale, 15);
MysticWorld.proxy.airFeetFX(this.worldObj, this.posX + (rand.nextDouble()/2), this.posY + 0.5D, this.posZ + (rand.nextDouble()/2), particleScale, 15); MysticWorld.proxy.airFeetFX(this.worldObj, this.posX + (rand.nextDouble() / 2), this.posY + 0.5D, this.posZ + (rand.nextDouble() / 2), particleScale, 15);
MysticWorld.proxy.airFeetFX(this.worldObj, this.posX + (rand.nextDouble()/2), this.posY + 0.5D, this.posZ + (rand.nextDouble()/2), particleScale, 15);
this.setPosition(this.posX, this.posY, this.posZ); this.setPosition(this.posX, this.posY, this.posZ);
} }
} }
protected float getMotionFactor() @Override
{ protected void entityInit() {
}
protected float getMotionFactor() {
return 0.95F; return 0.95F;
} }
protected void onImpact(MovingObjectPosition par1MovingObjectPosition) protected void onImpact(MovingObjectPosition par1MovingObjectPosition) {
{
Random rand = new Random(); Random rand = new Random();
if (!this.worldObj.isRemote) {
if (!this.worldObj.isRemote)
{
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
if (par1MovingObjectPosition.entityHit != null) {
if (par1MovingObjectPosition.entityHit != null)
{
double f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); double f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
if (f3 > 0.0F) {
if (f3 > 0.0F) par1MovingObjectPosition.entityHit.addVelocity(this.motionX * 2 * 0.6000000238418579D / f3, 1.0D + powerHeight, this.motionZ * 2 * 0.6000000238418579D / f3);
{
par1MovingObjectPosition.entityHit.addVelocity(this.motionX * (double)2 * 0.6000000238418579D / (double)f3, 1.0D + powerHeight, this.motionZ * (double)2 * 0.6000000238418579D / (double)f3);
} }
} } else {
else
{
int i = par1MovingObjectPosition.blockX; int i = par1MovingObjectPosition.blockX;
int j = par1MovingObjectPosition.blockY; int j = par1MovingObjectPosition.blockY;
int k = par1MovingObjectPosition.blockZ; int k = par1MovingObjectPosition.blockZ;
switch (par1MovingObjectPosition.sideHit) {
switch (par1MovingObjectPosition.sideHit)
{
case 0: case 0:
--j; --j;
break; break;
@ -200,15 +167,10 @@ public class EntityChargeAir extends Entity {
++i; ++i;
} }
} }
this.setDead(); this.setDead();
} }
} }
@Override
protected void entityInit() {
}
@Override @Override
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
} }
@ -216,31 +178,4 @@ public class EntityChargeAir extends Entity {
@Override @Override
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
} }
public boolean canBeCollidedWith()
{
return true;
}
public float getCollisionBorderSize()
{
return 1.0F;
}
@SideOnly(Side.CLIENT)
public float getShadowSize()
{
return 0.0F;
}
public float getBrightness(float par1)
{
return 1.0F;
}
@SideOnly(Side.CLIENT)
public int getBrightnessForRender(float par1)
{
return 15728880;
}
} }

View file

@ -1,27 +1,16 @@
package MysticWorld.Entity; package mysticworld.entity;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import MysticWorld.MysticWorld; import mysticworld.MysticWorld;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.boss.EntityDragon; import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither; import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityFireball;
import net.minecraft.entity.projectile.EntitySmallFireball;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
@ -30,11 +19,10 @@ import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.FakePlayerFactory; import cpw.mods.fml.relauncher.Side;
import net.minecraftforge.common.ForgeHooks; import cpw.mods.fml.relauncher.SideOnly;
public class EntityChargeEarth extends Entity { public class EntityChargeEarth extends Entity {
public EntityPlayer shootingEntity; public EntityPlayer shootingEntity;
public EntityPlayer entityPlayer; public EntityPlayer entityPlayer;
public EntityDragon entityDragon; public EntityDragon entityDragon;
@ -47,127 +35,120 @@ public class EntityChargeEarth extends Entity {
private int ticksAlive; private int ticksAlive;
private int ticksInAir = 0; private int ticksInAir = 0;
public EntityChargeEarth(World par1World) public EntityChargeEarth(World par1World) {
{
super(par1World); super(par1World);
} }
public EntityChargeEarth(World par1World, EntityPlayer par2EntityPlayer) public EntityChargeEarth(World par1World, EntityPlayer par2EntityPlayer) {
{
super(par1World); super(par1World);
this.setSize(0.25F, 0.25F); this.setSize(0.25F, 0.25F);
this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + (double)par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch); this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch);
this.setPosition(this.posX, this.posY, this.posZ); this.setPosition(this.posX, this.posY, this.posZ);
this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
this.motionY = (double)(-MathHelper.sin((this.rotationPitch) / 180.0F * (float)Math.PI)); this.motionY = (-MathHelper.sin((this.rotationPitch) / 180.0F * (float) Math.PI));
this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
this.shootingEntity = par2EntityPlayer; this.shootingEntity = par2EntityPlayer;
} }
public void onUpdate() @Override
{ public boolean canBeCollidedWith() {
if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int)this.posX, (int)this.posY, (int)this.posZ))) return true;
{
this.setDead();
} }
else
{
super.onUpdate();
@Override
public float getBrightness(float par1) {
return 1.0F;
}
@Override
@SideOnly(Side.CLIENT)
public int getBrightnessForRender(float par1) {
return 15728880;
}
@Override
public float getCollisionBorderSize() {
return 1.0F;
}
@Override
@SideOnly(Side.CLIENT)
public float getShadowSize() {
return 0.0F;
}
@Override
public void onUpdate() {
if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int) this.posX, (int) this.posY, (int) this.posZ))) {
this.setDead();
} else {
super.onUpdate();
Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks_do_do(vec3, vec31, true, true); MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks_do_do(vec3, vec31, true, true);
vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (movingobjectposition != null) {
if (movingobjectposition != null)
{
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
} }
Entity entity = null; Entity entity = null;
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
double d0 = 0.0D; double d0 = 0.0D;
for (int j = 0; j < list.size(); ++j) {
for (int j = 0; j < list.size(); ++j) Entity entity1 = (Entity) list.get(j);
{ if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25)) {
Entity entity1 = (Entity)list.get(j);
if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25))
{
float f = 0.3F; float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.expand((double)f, (double)f, (double)f); AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31);
if (movingobjectposition1 != null) {
if (movingobjectposition1 != null)
{
double d1 = vec3.distanceTo(movingobjectposition1.hitVec); double d1 = vec3.distanceTo(movingobjectposition1.hitVec);
if (d1 < d0 || d0 == 0.0D) {
if (d1 < d0 || d0 == 0.0D)
{
entity = entity1; entity = entity1;
d0 = d1; d0 = d1;
} }
} }
} }
} }
if (entity != null) {
if (entity != null)
{
movingobjectposition = new MovingObjectPosition(entity); movingobjectposition = new MovingObjectPosition(entity);
} }
if (movingobjectposition != null) {
if (movingobjectposition != null)
{
this.onImpact(movingobjectposition); this.onImpact(movingobjectposition);
} }
this.posX += this.motionX; this.posX += this.motionX;
this.posY += this.motionY; this.posY += this.motionY;
this.posZ += this.motionZ; this.posZ += this.motionZ;
float f2 = this.getMotionFactor(); float f2 = this.getMotionFactor();
if (this.isInWater()) {
if (this.isInWater()) for (int k = 0; k < 4; ++k) {
{
for (int k = 0; k < 4; ++k)
{
float f3 = 0.25F; float f3 = 0.25F;
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3, this.motionX, this.motionY, this.motionZ); this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f3, this.posY - this.motionY * f3, this.posZ - this.motionZ * f3, this.motionX, this.motionY, this.motionZ);
} }
f2 = 0.8F; f2 = 0.8F;
} }
MysticWorld.proxy.earthFX(this.worldObj, this.posX + (rand.nextDouble() / 2), this.posY + 0.5D, this.posZ + (rand.nextDouble() / 2), 1.0F);
MysticWorld.proxy.earthFX(this.worldObj, this.posX + (rand.nextDouble()/2), this.posY + 0.5D, this.posZ + (rand.nextDouble()/2), 1.0F);
this.setPosition(this.posX, this.posY, this.posZ); this.setPosition(this.posX, this.posY, this.posZ);
} }
} }
protected float getMotionFactor() @Override
{ protected void entityInit() {
}
protected float getMotionFactor() {
return 0.95F; return 0.95F;
} }
protected void onImpact(MovingObjectPosition par1MovingObjectPosition) protected void onImpact(MovingObjectPosition par1MovingObjectPosition) {
{
Random rand = new Random(); Random rand = new Random();
if (!this.worldObj.isRemote) {
if (!this.worldObj.isRemote)
{
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
if (par1MovingObjectPosition.entityHit != null) {
if (par1MovingObjectPosition.entityHit != null)
{
double f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); double f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
if (f3 > 0.0F) {
if (f3 > 0.0F) par1MovingObjectPosition.entityHit.addVelocity(this.motionX * 1 * 0.6000000238418579D / f3, 0.1D, this.motionZ * 1 * 0.6000000238418579D / f3);
{
par1MovingObjectPosition.entityHit.addVelocity(this.motionX * (double)1 * 0.6000000238418579D / (double)f3, 0.1D, this.motionZ * (double)1 * 0.6000000238418579D / (double)f3);
} }
par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.magic, 20); par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.magic, 20);
this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Item.seeds, rand.nextInt(4)))); this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Item.seeds, rand.nextInt(4))));
this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Block.mushroomBrown, rand.nextInt(2)))); this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Block.mushroomBrown, rand.nextInt(2))));
this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Item.appleRed, rand.nextInt(2)))); this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Item.appleRed, rand.nextInt(2))));
@ -177,15 +158,11 @@ public class EntityChargeEarth extends Entity {
this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Block.sapling, rand.nextInt(2), 2))); this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Block.sapling, rand.nextInt(2), 2)));
this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Block.sapling, rand.nextInt(2), 3))); this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Block.sapling, rand.nextInt(2), 3)));
this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Item.melonSeeds, rand.nextInt(3)))); this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Item.melonSeeds, rand.nextInt(3))));
} } else {
else
{
int i = par1MovingObjectPosition.blockX; int i = par1MovingObjectPosition.blockX;
int j = par1MovingObjectPosition.blockY; int j = par1MovingObjectPosition.blockY;
int k = par1MovingObjectPosition.blockZ; int k = par1MovingObjectPosition.blockZ;
switch (par1MovingObjectPosition.sideHit) {
switch (par1MovingObjectPosition.sideHit)
{
case 0: case 0:
--j; --j;
break; break;
@ -205,15 +182,10 @@ public class EntityChargeEarth extends Entity {
++i; ++i;
} }
} }
this.setDead(); this.setDead();
} }
} }
@Override
protected void entityInit() {
}
@Override @Override
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
} }
@ -221,31 +193,4 @@ public class EntityChargeEarth extends Entity {
@Override @Override
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
} }
public boolean canBeCollidedWith()
{
return true;
}
public float getCollisionBorderSize()
{
return 1.0F;
}
@SideOnly(Side.CLIENT)
public float getShadowSize()
{
return 0.0F;
}
public float getBrightness(float par1)
{
return 1.0F;
}
@SideOnly(Side.CLIENT)
public int getBrightnessForRender(float par1)
{
return 15728880;
}
} }

View file

@ -1,33 +1,21 @@
package MysticWorld.Entity; package mysticworld.entity;
import java.util.List; import java.util.List;
import MysticWorld.MysticWorld; import mysticworld.MysticWorld;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityFireball;
import net.minecraft.entity.projectile.EntitySmallFireball;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EntityChargeEnergy extends Entity { public class EntityChargeEnergy extends Entity {
public EntityPlayer shootingEntity; public EntityPlayer shootingEntity;
private boolean inGround = false; private boolean inGround = false;
private int xTile = -1; private int xTile = -1;
@ -37,133 +25,124 @@ public class EntityChargeEnergy extends Entity {
private int ticksAlive; private int ticksAlive;
private int ticksInAir = 0; private int ticksInAir = 0;
public EntityChargeEnergy(World par1World) public EntityChargeEnergy(World par1World) {
{
super(par1World); super(par1World);
} }
public EntityChargeEnergy(World par1World, EntityPlayer par2EntityPlayer) public EntityChargeEnergy(World par1World, EntityPlayer par2EntityPlayer) {
{
super(par1World); super(par1World);
this.setSize(0.25F, 0.25F); this.setSize(0.25F, 0.25F);
this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + (double)par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch); this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch);
this.setPosition(this.posX, this.posY, this.posZ); this.setPosition(this.posX, this.posY, this.posZ);
this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
this.motionY = (double)(-MathHelper.sin((this.rotationPitch) / 180.0F * (float)Math.PI)); this.motionY = (-MathHelper.sin((this.rotationPitch) / 180.0F * (float) Math.PI));
this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
this.shootingEntity = par2EntityPlayer; this.shootingEntity = par2EntityPlayer;
} }
public void onUpdate() @Override
{ public boolean canBeCollidedWith() {
if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int)this.posX, (int)this.posY, (int)this.posZ))) return true;
{
this.setDead();
} }
else
{
super.onUpdate();
@Override
public float getBrightness(float par1) {
return 1.0F;
}
@Override
@SideOnly(Side.CLIENT)
public int getBrightnessForRender(float par1) {
return 15728880;
}
@Override
public float getCollisionBorderSize() {
return 1.0F;
}
@Override
@SideOnly(Side.CLIENT)
public float getShadowSize() {
return 0.0F;
}
@Override
public void onUpdate() {
if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int) this.posX, (int) this.posY, (int) this.posZ))) {
this.setDead();
} else {
super.onUpdate();
Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks_do_do(vec3, vec31, true, true); MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks_do_do(vec3, vec31, true, true);
vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (movingobjectposition != null) {
if (movingobjectposition != null)
{
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
} }
Entity entity = null; Entity entity = null;
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
double d0 = 0.0D; double d0 = 0.0D;
for (int j = 0; j < list.size(); ++j) {
for (int j = 0; j < list.size(); ++j) Entity entity1 = (Entity) list.get(j);
{ if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25)) {
Entity entity1 = (Entity)list.get(j);
if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25))
{
float f = 0.3F; float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.expand((double)f, (double)f, (double)f); AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31);
if (movingobjectposition1 != null) {
if (movingobjectposition1 != null)
{
double d1 = vec3.distanceTo(movingobjectposition1.hitVec); double d1 = vec3.distanceTo(movingobjectposition1.hitVec);
if (d1 < d0 || d0 == 0.0D) {
if (d1 < d0 || d0 == 0.0D)
{
entity = entity1; entity = entity1;
d0 = d1; d0 = d1;
} }
} }
} }
} }
if (entity != null) {
if (entity != null)
{
movingobjectposition = new MovingObjectPosition(entity); movingobjectposition = new MovingObjectPosition(entity);
} }
if (movingobjectposition != null) {
if (movingobjectposition != null)
{
this.onImpact(movingobjectposition); this.onImpact(movingobjectposition);
} }
this.posX += this.motionX; this.posX += this.motionX;
this.posY += this.motionY; this.posY += this.motionY;
this.posZ += this.motionZ; this.posZ += this.motionZ;
float f2 = this.getMotionFactor(); float f2 = this.getMotionFactor();
if (this.isInWater()) {
if (this.isInWater()) for (int k = 0; k < 4; ++k) {
{
for (int k = 0; k < 4; ++k)
{
float f3 = 0.25F; float f3 = 0.25F;
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3, this.motionX, this.motionY, this.motionZ); this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f3, this.posY - this.motionY * f3, this.posZ - this.motionZ * f3, this.motionX, this.motionY, this.motionZ);
} }
f2 = 0.8F; f2 = 0.8F;
} }
MysticWorld.proxy.energyFX(this.worldObj, this.posX + (rand.nextDouble() / 2), this.posY + 0.5D, this.posZ + (rand.nextDouble() / 2), 1.0F);
MysticWorld.proxy.energyFX(this.worldObj, this.posX + (rand.nextDouble()/2), this.posY + 0.5D, this.posZ + (rand.nextDouble()/2), 1.0F);
this.setPosition(this.posX, this.posY, this.posZ); this.setPosition(this.posX, this.posY, this.posZ);
} }
} }
protected float getMotionFactor() @Override
{ protected void entityInit() {
}
protected float getMotionFactor() {
return 0.95F; return 0.95F;
} }
protected void onImpact(MovingObjectPosition par1MovingObjectPosition) protected void onImpact(MovingObjectPosition par1MovingObjectPosition) {
{
int i = par1MovingObjectPosition.blockX; int i = par1MovingObjectPosition.blockX;
int j = par1MovingObjectPosition.blockY; int j = par1MovingObjectPosition.blockY;
int k = par1MovingObjectPosition.blockZ; int k = par1MovingObjectPosition.blockZ;
if (!this.worldObj.isRemote) {
if (!this.worldObj.isRemote) if (par1MovingObjectPosition.entityHit != null) {
{
if (par1MovingObjectPosition.entityHit != null)
{
double f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); double f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
if (f3 > 0.0F) {
if (f3 > 0.0F) par1MovingObjectPosition.entityHit.addVelocity(this.motionX * 1 * 0.6000000238418579D / f3, 0.1D, this.motionZ * 1 * 0.6000000238418579D / f3);
{
par1MovingObjectPosition.entityHit.addVelocity(this.motionX * (double)1 * 0.6000000238418579D / (double)f3, 0.1D, this.motionZ * (double)1 * 0.6000000238418579D / (double)f3);
} }
worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, par1MovingObjectPosition.entityHit.posX, par1MovingObjectPosition.entityHit.posY, par1MovingObjectPosition.entityHit.posZ)); worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, par1MovingObjectPosition.entityHit.posX, par1MovingObjectPosition.entityHit.posY, par1MovingObjectPosition.entityHit.posZ));
} } else {
else
{
worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, i, j, k)); worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, i, j, k));
switch (par1MovingObjectPosition.sideHit) {
switch (par1MovingObjectPosition.sideHit)
{
case 0: case 0:
--j; --j;
break; break;
@ -183,15 +162,10 @@ public class EntityChargeEnergy extends Entity {
++i; ++i;
} }
} }
this.setDead(); this.setDead();
} }
} }
@Override
protected void entityInit() {
}
@Override @Override
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
} }
@ -199,32 +173,4 @@ public class EntityChargeEnergy extends Entity {
@Override @Override
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
} }
public boolean canBeCollidedWith()
{
return true;
}
public float getCollisionBorderSize()
{
return 1.0F;
}
@SideOnly(Side.CLIENT)
public float getShadowSize()
{
return 0.0F;
}
public float getBrightness(float par1)
{
return 1.0F;
}
@SideOnly(Side.CLIENT)
public int getBrightnessForRender(float par1)
{
return 15728880;
}
} }

View file

@ -1,22 +1,11 @@
package MysticWorld.Entity; package mysticworld.entity;
import java.util.List; import java.util.List;
import MysticWorld.MysticWorld; import mysticworld.MysticWorld;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityFireball;
import net.minecraft.entity.projectile.EntitySmallFireball;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
@ -24,9 +13,10 @@ import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EntityChargeFire extends Entity { public class EntityChargeFire extends Entity {
public EntityPlayer shootingEntity; public EntityPlayer shootingEntity;
private boolean inGround = false; private boolean inGround = false;
private int xTile = -1; private int xTile = -1;
@ -36,137 +26,127 @@ public class EntityChargeFire extends Entity {
private int ticksAlive; private int ticksAlive;
private int ticksInAir = 0; private int ticksInAir = 0;
public EntityChargeFire(World par1World) public EntityChargeFire(World par1World) {
{
super(par1World); super(par1World);
} }
public EntityChargeFire(World par1World, EntityPlayer par2EntityPlayer) public EntityChargeFire(World par1World, EntityPlayer par2EntityPlayer) {
{
super(par1World); super(par1World);
this.setSize(0.25F, 0.25F); this.setSize(0.25F, 0.25F);
this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + (double)par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch); this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch);
this.setPosition(this.posX, this.posY, this.posZ); this.setPosition(this.posX, this.posY, this.posZ);
this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
this.motionY = (double)(-MathHelper.sin((this.rotationPitch) / 180.0F * (float)Math.PI)); this.motionY = (-MathHelper.sin((this.rotationPitch) / 180.0F * (float) Math.PI));
this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
this.shootingEntity = par2EntityPlayer; this.shootingEntity = par2EntityPlayer;
} }
public void onUpdate() @Override
{ public boolean canBeCollidedWith() {
if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int)this.posX, (int)this.posY, (int)this.posZ))) return true;
{
this.setDead();
} }
else
{
super.onUpdate();
@Override
public float getBrightness(float par1) {
return 1.0F;
}
@Override
@SideOnly(Side.CLIENT)
public int getBrightnessForRender(float par1) {
return 15728880;
}
@Override
public float getCollisionBorderSize() {
return 1.0F;
}
@Override
@SideOnly(Side.CLIENT)
public float getShadowSize() {
return 0.0F;
}
@Override
public void onUpdate() {
if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int) this.posX, (int) this.posY, (int) this.posZ))) {
this.setDead();
} else {
super.onUpdate();
Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks_do_do(vec3, vec31, true, true); MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks_do_do(vec3, vec31, true, true);
vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (movingobjectposition != null) {
if (movingobjectposition != null)
{
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
} }
Entity entity = null; Entity entity = null;
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
double d0 = 0.0D; double d0 = 0.0D;
for (int j = 0; j < list.size(); ++j) {
for (int j = 0; j < list.size(); ++j) Entity entity1 = (Entity) list.get(j);
{ if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25)) {
Entity entity1 = (Entity)list.get(j);
if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25))
{
float f = 0.3F; float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.expand((double)f, (double)f, (double)f); AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31);
if (movingobjectposition1 != null) {
if (movingobjectposition1 != null)
{
double d1 = vec3.distanceTo(movingobjectposition1.hitVec); double d1 = vec3.distanceTo(movingobjectposition1.hitVec);
if (d1 < d0 || d0 == 0.0D) {
if (d1 < d0 || d0 == 0.0D)
{
entity = entity1; entity = entity1;
d0 = d1; d0 = d1;
} }
} }
} }
} }
if (entity != null) {
if (entity != null)
{
movingobjectposition = new MovingObjectPosition(entity); movingobjectposition = new MovingObjectPosition(entity);
} }
if (movingobjectposition != null) {
if (movingobjectposition != null)
{
this.onImpact(movingobjectposition); this.onImpact(movingobjectposition);
} }
this.posX += this.motionX; this.posX += this.motionX;
this.posY += this.motionY; this.posY += this.motionY;
this.posZ += this.motionZ; this.posZ += this.motionZ;
float f2 = this.getMotionFactor(); float f2 = this.getMotionFactor();
if (this.isInWater()) {
if (this.isInWater()) for (int k = 0; k < 4; ++k) {
{
for (int k = 0; k < 4; ++k)
{
float f3 = 0.25F; float f3 = 0.25F;
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3, this.motionX, this.motionY, this.motionZ); this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f3, this.posY - this.motionY * f3, this.posZ - this.motionZ * f3, this.motionX, this.motionY, this.motionZ);
} }
f2 = 0.8F; f2 = 0.8F;
} }
MysticWorld.proxy.fireFX(this.worldObj, this.posX + (rand.nextDouble() / 2), this.posY + 0.5D, this.posZ + (rand.nextDouble() / 2), 1.0F);
MysticWorld.proxy.fireFX(this.worldObj, this.posX + (rand.nextDouble()/2), this.posY + 0.5D, this.posZ + (rand.nextDouble()/2), 1.0F);
this.setPosition(this.posX, this.posY, this.posZ); this.setPosition(this.posX, this.posY, this.posZ);
} }
} }
protected float getMotionFactor() @Override
{ protected void entityInit() {
}
protected float getMotionFactor() {
return 0.95F; return 0.95F;
} }
protected void onImpact(MovingObjectPosition par1MovingObjectPosition) protected void onImpact(MovingObjectPosition par1MovingObjectPosition) {
{ if (!this.worldObj.isRemote) {
if (!this.worldObj.isRemote)
{
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
if (par1MovingObjectPosition.entityHit != null) {
if (par1MovingObjectPosition.entityHit != null)
{
double f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); double f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
if (f3 > 0.0F) {
if (f3 > 0.0F) par1MovingObjectPosition.entityHit.addVelocity(this.motionX * 1 * 0.6000000238418579D / f3, 0.1D, this.motionZ * 1 * 0.6000000238418579D / f3);
{
par1MovingObjectPosition.entityHit.addVelocity(this.motionX * (double)1 * 0.6000000238418579D / (double)f3, 0.1D, this.motionZ * (double)1 * 0.6000000238418579D / (double)f3);
} }
if (!par1MovingObjectPosition.entityHit.isImmuneToFire()) {
if (!par1MovingObjectPosition.entityHit.isImmuneToFire())
{
par1MovingObjectPosition.entityHit.setFire(5); par1MovingObjectPosition.entityHit.setFire(5);
par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.magic, 7); par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.magic, 7);
} }
} } else {
else
{
int i = par1MovingObjectPosition.blockX; int i = par1MovingObjectPosition.blockX;
int j = par1MovingObjectPosition.blockY; int j = par1MovingObjectPosition.blockY;
int k = par1MovingObjectPosition.blockZ; int k = par1MovingObjectPosition.blockZ;
switch (par1MovingObjectPosition.sideHit) {
switch (par1MovingObjectPosition.sideHit)
{
case 0: case 0:
--j; --j;
break; break;
@ -185,22 +165,14 @@ public class EntityChargeFire extends Entity {
case 5: case 5:
++i; ++i;
} }
if (this.worldObj.isAirBlock(i, j, k)) {
if (this.worldObj.isAirBlock(i, j, k))
{
this.worldObj.setBlock(i, j, k, Block.fire.blockID); this.worldObj.setBlock(i, j, k, Block.fire.blockID);
} }
} }
this.setDead(); this.setDead();
} }
} }
@Override
protected void entityInit() {
}
@Override @Override
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
} }
@ -208,32 +180,4 @@ public class EntityChargeFire extends Entity {
@Override @Override
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
} }
public boolean canBeCollidedWith()
{
return true;
}
public float getCollisionBorderSize()
{
return 1.0F;
}
@SideOnly(Side.CLIENT)
public float getShadowSize()
{
return 0.0F;
}
public float getBrightness(float par1)
{
return 1.0F;
}
@SideOnly(Side.CLIENT)
public int getBrightnessForRender(float par1)
{
return 15728880;
}
} }

View file

@ -1,22 +1,10 @@
package MysticWorld.Entity; package mysticworld.entity;
import java.util.List; import java.util.List;
import MysticWorld.MysticWorld; import mysticworld.MysticWorld;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityFireball;
import net.minecraft.entity.projectile.EntitySmallFireball;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
@ -24,9 +12,10 @@ import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EntityChargeWater extends Entity { public class EntityChargeWater extends Entity {
public EntityPlayer shootingEntity; public EntityPlayer shootingEntity;
private boolean inGround = false; private boolean inGround = false;
private int xTile = -1; private int xTile = -1;
@ -36,141 +25,129 @@ public class EntityChargeWater extends Entity {
private int ticksAlive; private int ticksAlive;
private int ticksInAir = 0; private int ticksInAir = 0;
public EntityChargeWater(World par1World) public EntityChargeWater(World par1World) {
{
super(par1World); super(par1World);
} }
public EntityChargeWater(World par1World, EntityPlayer par2EntityPlayer) public EntityChargeWater(World par1World, EntityPlayer par2EntityPlayer) {
{
super(par1World); super(par1World);
this.setSize(0.25F, 0.25F); this.setSize(0.25F, 0.25F);
this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + (double)par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch); this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch);
this.setPosition(this.posX, this.posY, this.posZ); this.setPosition(this.posX, this.posY, this.posZ);
this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
this.motionY = (double)(-MathHelper.sin((this.rotationPitch) / 180.0F * (float)Math.PI)); this.motionY = (-MathHelper.sin((this.rotationPitch) / 180.0F * (float) Math.PI));
this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
this.shootingEntity = par2EntityPlayer; this.shootingEntity = par2EntityPlayer;
} }
public void onUpdate() @Override
{ public boolean canBeCollidedWith() {
if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int)this.posX, (int)this.posY, (int)this.posZ))) return true;
{
this.setDead();
} }
else
{
super.onUpdate();
@Override
public float getBrightness(float par1) {
return 1.0F;
}
@Override
@SideOnly(Side.CLIENT)
public int getBrightnessForRender(float par1) {
return 15728880;
}
@Override
public float getCollisionBorderSize() {
return 1.0F;
}
@Override
@SideOnly(Side.CLIENT)
public float getShadowSize() {
return 0.0F;
}
@Override
public void onUpdate() {
if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int) this.posX, (int) this.posY, (int) this.posZ))) {
this.setDead();
} else {
super.onUpdate();
Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks_do_do(vec3, vec31, true, true); MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks_do_do(vec3, vec31, true, true);
vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (movingobjectposition != null) {
if (movingobjectposition != null)
{
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
} }
Entity entity = null; Entity entity = null;
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
double d0 = 0.0D; double d0 = 0.0D;
for (int j = 0; j < list.size(); ++j) {
for (int j = 0; j < list.size(); ++j) Entity entity1 = (Entity) list.get(j);
{ if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25)) {
Entity entity1 = (Entity)list.get(j);
if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25))
{
float f = 0.3F; float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.expand((double)f, (double)f, (double)f); AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31);
if (movingobjectposition1 != null) {
if (movingobjectposition1 != null)
{
double d1 = vec3.distanceTo(movingobjectposition1.hitVec); double d1 = vec3.distanceTo(movingobjectposition1.hitVec);
if (d1 < d0 || d0 == 0.0D) {
if (d1 < d0 || d0 == 0.0D)
{
entity = entity1; entity = entity1;
d0 = d1; d0 = d1;
} }
} }
} }
} }
if (entity != null) {
if (entity != null)
{
movingobjectposition = new MovingObjectPosition(entity); movingobjectposition = new MovingObjectPosition(entity);
} }
if (movingobjectposition != null) {
if (movingobjectposition != null)
{
this.onImpact(movingobjectposition); this.onImpact(movingobjectposition);
} }
this.posX += this.motionX; this.posX += this.motionX;
this.posY += this.motionY; this.posY += this.motionY;
this.posZ += this.motionZ; this.posZ += this.motionZ;
float f2 = this.getMotionFactor(); float f2 = this.getMotionFactor();
if (this.isInWater()) {
if (this.isInWater()) for (int k = 0; k < 4; ++k) {
{
for (int k = 0; k < 4; ++k)
{
float f3 = 0.25F; float f3 = 0.25F;
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3, this.motionX, this.motionY, this.motionZ); this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f3, this.posY - this.motionY * f3, this.posZ - this.motionZ * f3, this.motionX, this.motionY, this.motionZ);
} }
f2 = 0.8F; f2 = 0.8F;
} }
MysticWorld.proxy.waterFX(this.worldObj, this.posX + (rand.nextDouble() / 2), this.posY + 0.5D, this.posZ + (rand.nextDouble() / 2), 1.0F);
MysticWorld.proxy.waterFX(this.worldObj, this.posX + (rand.nextDouble()/2), this.posY + 0.5D, this.posZ + (rand.nextDouble()/2), 1.0F);
this.setPosition(this.posX, this.posY, this.posZ); this.setPosition(this.posX, this.posY, this.posZ);
} }
} }
protected float getMotionFactor() @Override
{ protected void entityInit() {
}
protected float getMotionFactor() {
return 0.95F; return 0.95F;
} }
protected void onImpact(MovingObjectPosition par1MovingObjectPosition) protected void onImpact(MovingObjectPosition par1MovingObjectPosition) {
{ if (!this.worldObj.isRemote) {
if (!this.worldObj.isRemote)
{
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
if (par1MovingObjectPosition.entityHit != null) {
if (par1MovingObjectPosition.entityHit != null)
{
double f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); double f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
if (f3 > 0.0F) {
if (f3 > 0.0F) par1MovingObjectPosition.entityHit.addVelocity(this.motionX * 1 * 0.6000000238418579D / f3, 0.1D, this.motionZ * 1 * 0.6000000238418579D / f3);
{
par1MovingObjectPosition.entityHit.addVelocity(this.motionX * (double)1 * 0.6000000238418579D / (double)f3, 0.1D, this.motionZ * (double)1 * 0.6000000238418579D / (double)f3);
} }
if (par1MovingObjectPosition.entityHit.isImmuneToFire()) {
if (par1MovingObjectPosition.entityHit.isImmuneToFire())
{
par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.magic, 20); par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.magic, 20);
} }
if (par1MovingObjectPosition.entityHit.isBurning()) {
if (par1MovingObjectPosition.entityHit.isBurning())
{
par1MovingObjectPosition.entityHit.extinguish(); par1MovingObjectPosition.entityHit.extinguish();
} }
} } else {
else
{
int i = par1MovingObjectPosition.blockX; int i = par1MovingObjectPosition.blockX;
int j = par1MovingObjectPosition.blockY; int j = par1MovingObjectPosition.blockY;
int k = par1MovingObjectPosition.blockZ; int k = par1MovingObjectPosition.blockZ;
switch (par1MovingObjectPosition.sideHit) {
switch (par1MovingObjectPosition.sideHit)
{
case 0: case 0:
--j; --j;
break; break;
@ -190,15 +167,10 @@ public class EntityChargeWater extends Entity {
++i; ++i;
} }
} }
this.setDead(); this.setDead();
} }
} }
@Override
protected void entityInit() {
}
@Override @Override
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
} }
@ -206,33 +178,4 @@ public class EntityChargeWater extends Entity {
@Override @Override
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
} }
public boolean canBeCollidedWith()
{
return true;
}
public float getCollisionBorderSize()
{
return 1.0F;
}
@SideOnly(Side.CLIENT)
public float getShadowSize()
{
return 0.0F;
}
public float getBrightness(float par1)
{
return 1.0F;
}
@SideOnly(Side.CLIENT)
public int getBrightnessForRender(float par1)
{
return 15728880;
}
} }

View file

@ -1,20 +1,16 @@
package MysticWorld.Entity; package mysticworld.entity;
import net.minecraft.entity.EnumCreatureType; import mysticworld.MysticWorld;
import net.minecraft.world.biome.BiomeGenBase; import mysticworld.lib.EntityIds;
import net.minecraftforge.common.BiomeDictionary; import mysticworld.lib.Strings;
import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.EntityRegistry;
import MysticWorld.MysticWorld;
import MysticWorld.Lib.EntityIds;
import MysticWorld.Lib.Strings;
public class EntityHandler { public class EntityHandler {
public static void init() {
public static void init(){
registerEntities(); registerEntities();
} }
public static void registerEntities(){ public static void registerEntities() {
EntityRegistry.registerModEntity(EntityChargeAir.class, Strings.ENTITY_AIR_CHARGE_NAME, EntityIds.ENTITY_AIR_CHARGE, MysticWorld.instance, 80, 3, false); EntityRegistry.registerModEntity(EntityChargeAir.class, Strings.ENTITY_AIR_CHARGE_NAME, EntityIds.ENTITY_AIR_CHARGE, MysticWorld.instance, 80, 3, false);
EntityRegistry.registerModEntity(EntityChargeFire.class, Strings.ENTITY_FIREBALL_NAME, EntityIds.ENTITY_FIREBALL, MysticWorld.instance, 80, 3, false); EntityRegistry.registerModEntity(EntityChargeFire.class, Strings.ENTITY_FIREBALL_NAME, EntityIds.ENTITY_FIREBALL, MysticWorld.instance, 80, 3, false);
EntityRegistry.registerModEntity(EntityChargeEarth.class, Strings.ENTITY_EARTH_CHARGE_NAME, EntityIds.ENTITY_EARTH_CHARGE, MysticWorld.instance, 80, 3, false); EntityRegistry.registerModEntity(EntityChargeEarth.class, Strings.ENTITY_EARTH_CHARGE_NAME, EntityIds.ENTITY_EARTH_CHARGE, MysticWorld.instance, 80, 3, false);

View file

@ -1,4 +1,4 @@
package MysticWorld.Items; package mysticworld.items;
import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.EnumArmorMaterial;
import net.minecraftforge.common.EnumHelper; import net.minecraftforge.common.EnumHelper;

View file

@ -1,23 +1,20 @@
package MysticWorld.Items; package mysticworld.items;
import MysticWorld.MysticWorld; import mysticworld.MysticWorld;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class ItemArmorAdamantine extends ItemArmor public class ItemArmorAdamantine extends ItemArmor {
{
int ArmorType; int ArmorType;
String ArmorFile_1; String ArmorFile_1;
String ArmorFile_2; String ArmorFile_2;
public ItemArmorAdamantine(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) { public ItemArmorAdamantine(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) {
super(par1, par2EnumArmorMaterial,par3,par4); super(par1, par2EnumArmorMaterial, par3, par4);
this.ArmorType=par4; this.ArmorType = par4;
this.setMaxDamage(3000); this.setMaxDamage(3000);
this.setCreativeTab(MysticWorld.MysticWorldTab); this.setCreativeTab(MysticWorld.MysticWorldTab);
this.ArmorFile_1 = "/MysticMods/textures/armor/adamantine_1.png"; this.ArmorFile_1 = "/MysticMods/textures/armor/adamantine_1.png";
@ -25,9 +22,14 @@ public class ItemArmorAdamantine extends ItemArmor
} }
@Override @Override
public void registerIcons(IconRegister iconRegister) public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) {
{ int suffix = this.armorType == 2 ? 2 : 1;
switch (ArmorType){ return "MysticMods:textures" + "/models/armor/Adamantine_layer_" + suffix + ".png";
}
@Override
public void registerIcons(IconRegister iconRegister) {
switch (ArmorType) {
case 0: case 0:
itemIcon = iconRegister.registerIcon("MysticMods:AdamantineArmor_0"); itemIcon = iconRegister.registerIcon("MysticMods:AdamantineArmor_0");
break; break;
@ -42,11 +44,4 @@ public class ItemArmorAdamantine extends ItemArmor
break; break;
} }
} }
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)
{
int suffix = this.armorType == 2 ? 2 : 1;
return "MysticMods:textures" + "/models/armor/Adamantine_layer_" + suffix + ".png";
}
} }

View file

@ -1,8 +1,7 @@
package MysticWorld.Items; package mysticworld.items;
import MysticWorld.MysticWorld; import mysticworld.MysticWorld;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.EnumArmorMaterial;
@ -12,17 +11,14 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World; import net.minecraft.world.World;
public class ItemArmorIridium extends ItemArmor public class ItemArmorIridium extends ItemArmor {
{
int ArmorType; int ArmorType;
String ArmorFile_1; String ArmorFile_1;
String ArmorFile_2; String ArmorFile_2;
public ItemArmorIridium(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) { public ItemArmorIridium(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) {
super(par1, par2EnumArmorMaterial, par3, par4);
super(par1, par2EnumArmorMaterial,par3,par4); this.ArmorType = par4;
this.ArmorType=par4;
this.setMaxDamage(4000); this.setMaxDamage(4000);
this.setCreativeTab(MysticWorld.MysticWorldTab); this.setCreativeTab(MysticWorld.MysticWorldTab);
this.ArmorFile_1 = "/assets/MysticMods/textures/armor/iridium_1.png"; this.ArmorFile_1 = "/assets/MysticMods/textures/armor/iridium_1.png";
@ -30,9 +26,45 @@ public class ItemArmorIridium extends ItemArmor
} }
@Override @Override
public void registerIcons(IconRegister iconRegister) public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) {
{ int suffix = this.armorType == 2 ? 2 : 1;
switch (ArmorType){ return "MysticMods:textures" + "/models/armor/Iridium_layer_" + suffix + ".png";
}
@Override
public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack) {
ItemStack helmet = player.getCurrentItemOrArmor(4);
ItemStack plate = player.getCurrentItemOrArmor(3);
ItemStack legs = player.getCurrentItemOrArmor(2);
ItemStack boots = player.getCurrentItemOrArmor(1);
if (helmet != null) {
if (helmet.itemID == ItemHandler.iridiumHelmet.itemID) {
player.addPotionEffect((new PotionEffect(Potion.nightVision.getId(), 200, 0)));
}
}
if (plate != null) {
if (plate.itemID == ItemHandler.iridiumChestplate.itemID) {
player.addPotionEffect((new PotionEffect(Potion.regeneration.getId(), 200, 0)));
}
}
if (legs != null) {
if (legs.itemID == ItemHandler.iridiumLeggings.itemID) {
player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 200, 2)));
player.addVelocity(0.0005, 0, 0.0005);
player.stepHeight = 1.001F;
}
}
if (boots != null) {
if (boots.itemID == ItemHandler.iridiumBoots.itemID) {
player.fallDistance = 0.0F;
player.addPotionEffect((new PotionEffect(Potion.jump.getId(), 200, 2)));
}
}
}
@Override
public void registerIcons(IconRegister iconRegister) {
switch (ArmorType) {
case 0: case 0:
itemIcon = iconRegister.registerIcon("MysticMods:IridiumArmor_0"); itemIcon = iconRegister.registerIcon("MysticMods:IridiumArmor_0");
break; break;
@ -47,54 +79,4 @@ public class ItemArmorIridium extends ItemArmor
break; break;
} }
} }
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)
{
int suffix = this.armorType == 2 ? 2 : 1;
return "MysticMods:textures" + "/models/armor/Iridium_layer_" + suffix + ".png";
}
@Override
public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack)
{
ItemStack helmet = player.getCurrentItemOrArmor(4);
ItemStack plate = player.getCurrentItemOrArmor(3);
ItemStack legs = player.getCurrentItemOrArmor(2);
ItemStack boots = player.getCurrentItemOrArmor(1);
if (helmet != null)
{
if(helmet.itemID == ItemHandler$1.iridiumHelmet.itemID)
{
player.addPotionEffect((new PotionEffect(Potion.nightVision.getId(), 200, 0)));
}
}
if (plate != null)
{
if(plate.itemID == ItemHandler$1.iridiumChestplate.itemID)
{
player.addPotionEffect((new PotionEffect(Potion.regeneration.getId(), 200, 0)));
}
}
if (legs != null)
{
if(legs.itemID == ItemHandler$1.iridiumLeggings.itemID)
{
player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 200, 2)));
player.addVelocity(0.0005, 0, 0.0005);
player.stepHeight = 1.001F;
}
}
if (boots != null)
{
if(boots.itemID == ItemHandler$1.iridiumBoots.itemID)
{
player.fallDistance = 0.0F;
player.addPotionEffect((new PotionEffect(Potion.jump.getId(), 200, 2)));
}
}
}
} }

View file

@ -1,24 +1,20 @@
package MysticWorld.Items; package mysticworld.items;
import MysticWorld.MysticWorld; import mysticworld.MysticWorld;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class ItemArmorMithril extends ItemArmor public class ItemArmorMithril extends ItemArmor {
{
int ArmorType; int ArmorType;
String ArmorFile_1; String ArmorFile_1;
String ArmorFile_2; String ArmorFile_2;
public ItemArmorMithril(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) { public ItemArmorMithril(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) {
super(par1, par2EnumArmorMaterial, par3, par4);
super(par1, par2EnumArmorMaterial,par3,par4); this.ArmorType = par4;
this.ArmorType=par4;
this.setMaxDamage(500); this.setMaxDamage(500);
this.setCreativeTab(MysticWorld.MysticWorldTab); this.setCreativeTab(MysticWorld.MysticWorldTab);
this.ArmorFile_1 = "/assets/MysticMods/textures/armor/mithril_1.png"; this.ArmorFile_1 = "/assets/MysticMods/textures/armor/mithril_1.png";
@ -26,9 +22,14 @@ public class ItemArmorMithril extends ItemArmor
} }
@Override @Override
public void registerIcons(IconRegister iconRegister) public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) {
{ int suffix = this.armorType == 2 ? 2 : 1;
switch (ArmorType){ return "MysticMods:textures" + "/models/armor/Mithril_layer_" + suffix + ".png";
}
@Override
public void registerIcons(IconRegister iconRegister) {
switch (ArmorType) {
case 0: case 0:
itemIcon = iconRegister.registerIcon("MysticMods:MithrilArmor_0"); itemIcon = iconRegister.registerIcon("MysticMods:MithrilArmor_0");
break; break;
@ -43,11 +44,4 @@ public class ItemArmorMithril extends ItemArmor
break; break;
} }
} }
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)
{
int suffix = this.armorType == 2 ? 2 : 1;
return "MysticMods:textures" + "/models/armor/Mithril_layer_" + suffix + ".png";
}
} }

View file

@ -1,24 +1,20 @@
package MysticWorld.Items; package mysticworld.items;
import MysticWorld.MysticWorld; import mysticworld.MysticWorld;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class ItemArmorVerdite extends ItemArmor public class ItemArmorVerdite extends ItemArmor {
{
int ArmorType; int ArmorType;
String ArmorFile_1; String ArmorFile_1;
String ArmorFile_2; String ArmorFile_2;
public ItemArmorVerdite(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) { public ItemArmorVerdite(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) {
super(par1, par2EnumArmorMaterial, par3, par4);
super(par1, par2EnumArmorMaterial,par3,par4); this.ArmorType = par4;
this.ArmorType=par4;
this.setMaxDamage(262); this.setMaxDamage(262);
this.setCreativeTab(MysticWorld.MysticWorldTab); this.setCreativeTab(MysticWorld.MysticWorldTab);
this.ArmorFile_1 = "/assets/MysticMods/textures/armor/verdite_1.png"; this.ArmorFile_1 = "/assets/MysticMods/textures/armor/verdite_1.png";
@ -26,9 +22,14 @@ public class ItemArmorVerdite extends ItemArmor
} }
@Override @Override
public void registerIcons(IconRegister iconRegister) public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) {
{ int suffix = this.armorType == 2 ? 2 : 1;
switch (ArmorType){ return "MysticMods:textures" + "/models/armor/Verdite_layer_" + suffix + ".png";
}
@Override
public void registerIcons(IconRegister iconRegister) {
switch (ArmorType) {
case 0: case 0:
itemIcon = iconRegister.registerIcon("MysticMods:VerditeArmor_0"); itemIcon = iconRegister.registerIcon("MysticMods:VerditeArmor_0");
break; break;
@ -43,11 +44,4 @@ public class ItemArmorVerdite extends ItemArmor
break; break;
} }
} }
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)
{
int suffix = this.armorType == 2 ? 2 : 1;
return "MysticMods:textures" + "/models/armor/Verdite_layer_" + suffix + ".png";
}
} }

View file

@ -1,16 +1,11 @@
package MysticWorld.Items; package mysticworld.items;
import java.util.List; import java.util.List;
import MysticWorld.MysticWorld; import mysticworld.MysticWorld;
import MysticWorld.Lib.Strings;
import MysticWorld.Util.Reference;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood; import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion; import net.minecraft.potion.Potion;
@ -18,16 +13,15 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemBushFruit extends ItemFood { public class ItemBushFruit extends ItemFood {
private Icon[] icons; private Icon[] icons;
private static final String[] FRUIT_TYPES = new String[] { "Mundane", "Poison", "Weakness", "Slowness", "Harming", "Wither", "Health", "Speed", "FireResistance", "Regen", "NightVision",
"Invisibility" };
private static final String[] FRUIT_TYPES = new String[] {"Mundane", "Poison", "Weakness", "Slowness", "Harming", "Wither", "Health", "Speed", "FireResistance", "Regen", "NightVision", "Invisibility"}; public ItemBushFruit(int id, int health) {
public ItemBushFruit(int id, int health)
{
super(id, health, 0.6F, false); super(id, health, 0.6F, false);
this.setHasSubtypes(true); this.setHasSubtypes(true);
this.setCreativeTab(MysticWorld.MysticWorldTab); this.setCreativeTab(MysticWorld.MysticWorldTab);
@ -36,97 +30,122 @@ public class ItemBushFruit extends ItemFood {
setUnlocalizedName("bushFruit"); setUnlocalizedName("bushFruit");
} }
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer player) @Override
{ @SideOnly(Side.CLIENT)
if ((player.canEat(true)) && (player.getFoodStats().getSaturationLevel() < 20.0F)) public Icon getIconFromDamage(int meta) {
{ int j = MathHelper.clamp_int(meta, 0, FRUIT_TYPES.length);
player.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack)); return icons[j];
} }
@Override
public int getMaxItemUseDuration(ItemStack itemstack) {
return 24;
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int var4 = 0; var4 < FRUIT_TYPES.length; var4++) {
par3List.add(new ItemStack(par1, 1, var4));
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer player) {
if ((player.canEat(true)) && (player.getFoodStats().getSaturationLevel() < 20.0F)) {
player.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack));
}
return par1ItemStack; return par1ItemStack;
} }
protected void onFoodEaten(ItemStack itemstack, World world, EntityPlayer player) @Override
{ @SideOnly(Side.CLIENT)
if (!world.isRemote) public void registerIcons(IconRegister iconRegister) {
{ icons = new Icon[FRUIT_TYPES.length];
for (int i = 0; i < FRUIT_TYPES.length; ++i) {
icons[i] = iconRegister.registerIcon("MysticMods:Fruit" + FRUIT_TYPES[i]);
}
}
@Override
protected void onFoodEaten(ItemStack itemstack, World world, EntityPlayer player) {
if (!world.isRemote) {
int duration = 0; int duration = 0;
PotionEffect potion; PotionEffect potion;
switch(itemstack.getItemDamage()) switch (itemstack.getItemDamage()) {
{ case 1:
case 1:potion = player.getActivePotionEffect(Potion.poison); potion = player.getActivePotionEffect(Potion.poison);
if(potion != null) if (potion != null) {
{
duration = potion.duration; duration = potion.duration;
} }
player.addPotionEffect(new PotionEffect(Potion.poison.id, duration + 160, 0)); player.addPotionEffect(new PotionEffect(Potion.poison.id, duration + 160, 0));
break; break;
case 2:potion = player.getActivePotionEffect(Potion.weakness); case 2:
if(potion != null) potion = player.getActivePotionEffect(Potion.weakness);
{ if (potion != null) {
duration = potion.duration; duration = potion.duration;
} }
player.addPotionEffect(new PotionEffect(Potion.weakness.id, duration + 160, 0)); player.addPotionEffect(new PotionEffect(Potion.weakness.id, duration + 160, 0));
break; break;
case 3:potion = player.getActivePotionEffect(Potion.moveSlowdown); case 3:
if(potion != null) potion = player.getActivePotionEffect(Potion.moveSlowdown);
{ if (potion != null) {
duration = potion.duration; duration = potion.duration;
} }
player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, duration + 160, 0)); player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, duration + 160, 0));
break; break;
case 4:potion = player.getActivePotionEffect(Potion.harm); case 4:
if(potion != null) potion = player.getActivePotionEffect(Potion.harm);
{ if (potion != null) {
duration = potion.duration; duration = potion.duration;
} }
player.addPotionEffect(new PotionEffect(Potion.harm.id, duration + 1, 0)); player.addPotionEffect(new PotionEffect(Potion.harm.id, duration + 1, 0));
break; break;
case 5:potion = player.getActivePotionEffect(Potion.wither); case 5:
if(potion != null) potion = player.getActivePotionEffect(Potion.wither);
{ if (potion != null) {
duration = potion.duration; duration = potion.duration;
} }
player.addPotionEffect(new PotionEffect(Potion.wither.id, duration + 160, 0)); player.addPotionEffect(new PotionEffect(Potion.wither.id, duration + 160, 0));
break; break;
case 6:potion = player.getActivePotionEffect(Potion.heal); case 6:
if(potion != null) potion = player.getActivePotionEffect(Potion.heal);
{ if (potion != null) {
duration = potion.duration; duration = potion.duration;
} }
player.addPotionEffect(new PotionEffect(Potion.heal.id, duration + 1, 0)); player.addPotionEffect(new PotionEffect(Potion.heal.id, duration + 1, 0));
break; break;
case 7:potion = player.getActivePotionEffect(Potion.moveSpeed); case 7:
if(potion != null) potion = player.getActivePotionEffect(Potion.moveSpeed);
{ if (potion != null) {
duration = potion.duration; duration = potion.duration;
} }
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, duration + 160, 0)); player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, duration + 160, 0));
break; break;
case 8:potion = player.getActivePotionEffect(Potion.fireResistance); case 8:
if(potion != null) potion = player.getActivePotionEffect(Potion.fireResistance);
{ if (potion != null) {
duration = potion.duration; duration = potion.duration;
} }
player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, duration + 160, 0)); player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, duration + 160, 0));
break; break;
case 9:potion = player.getActivePotionEffect(Potion.regeneration); case 9:
if(potion != null) potion = player.getActivePotionEffect(Potion.regeneration);
{ if (potion != null) {
duration = potion.duration; duration = potion.duration;
} }
player.addPotionEffect(new PotionEffect(Potion.regeneration.id, duration + 160, 0)); player.addPotionEffect(new PotionEffect(Potion.regeneration.id, duration + 160, 0));
break; break;
case 10:potion = player.getActivePotionEffect(Potion.nightVision); case 10:
if(potion != null) potion = player.getActivePotionEffect(Potion.nightVision);
{ if (potion != null) {
duration = potion.duration; duration = potion.duration;
} }
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, duration + 160, 0)); player.addPotionEffect(new PotionEffect(Potion.nightVision.id, duration + 160, 0));
break; break;
case 11:potion = player.getActivePotionEffect(Potion.invisibility); case 11:
if(potion != null) potion = player.getActivePotionEffect(Potion.invisibility);
{ if (potion != null) {
duration = potion.duration; duration = potion.duration;
} }
player.addPotionEffect(new PotionEffect(Potion.invisibility.id, duration + 160, 0)); player.addPotionEffect(new PotionEffect(Potion.invisibility.id, duration + 160, 0));
@ -134,38 +153,4 @@ public class ItemBushFruit extends ItemFood {
} }
} }
} }
public int getMaxItemUseDuration(ItemStack itemstack)
{
return 24;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
icons = new Icon[FRUIT_TYPES.length];
for (int i = 0; i < FRUIT_TYPES.length; ++i) {
icons[i] = iconRegister.registerIcon("MysticMods:Fruit" + FRUIT_TYPES[i]);
}
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int meta) {
int j = MathHelper.clamp_int(meta, 0, FRUIT_TYPES.length);
return icons[j];
}
@SideOnly(Side.CLIENT)
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int var4 = 0; var4 < FRUIT_TYPES.length; var4++)
{
par3List.add(new ItemStack(par1, 1, var4));
}
}
} }

Some files were not shown because too many files have changed in this diff Show more