Merge pull request #21 from Adubbz/master
Another Bunch of Misc Changes
This commit is contained in:
commit
4ca25024db
4 changed files with 87 additions and 31 deletions
|
@ -31,6 +31,14 @@ public class BlockDesertSprouts extends Block
|
||||||
{
|
{
|
||||||
this(par1, Material.plants);
|
this(par1, Material.plants);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the ID of the items to drop on destruction.
|
||||||
|
*/
|
||||||
|
public int idDropped(int par1, Random par2Random, int par3)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
|
* Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
|
||||||
|
|
|
@ -26,6 +26,14 @@ public class BlockDuneGrass extends Block
|
||||||
{
|
{
|
||||||
this(par1, Material.plants);
|
this(par1, Material.plants);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the ID of the items to drop on destruction.
|
||||||
|
*/
|
||||||
|
public int idDropped(int par1, Random par2Random, int par3)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
|
|
|
@ -1,16 +1,25 @@
|
||||||
package tdwp_ftw.biomesop.blocks;
|
package tdwp_ftw.biomesop.blocks;
|
||||||
|
|
||||||
|
import static net.minecraftforge.common.ForgeDirection.UP;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
|
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockFlower;
|
||||||
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.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemHoe;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Icon;
|
import net.minecraft.util.Icon;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.EnumPlantType;
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
import net.minecraftforge.common.IPlantable;
|
||||||
|
|
||||||
public class BlockOriginGrass extends Block
|
public class BlockOriginGrass extends Block
|
||||||
{
|
{
|
||||||
|
@ -61,6 +70,42 @@ public class BlockOriginGrass extends Block
|
||||||
return var6 != Material.snow && var6 != Material.craftedSnow ? 33 : 33;
|
return var6 != Material.snow && var6 != Material.craftedSnow ? 33 : 33;
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canSustainPlant(World world, int x, int y, int z, ForgeDirection direction, IPlantable plant)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called upon block activation (right click on the block.)
|
||||||
|
*/
|
||||||
|
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
|
||||||
|
{
|
||||||
|
if (par5EntityPlayer.getCurrentEquippedItem() != null)
|
||||||
|
{
|
||||||
|
if (par5EntityPlayer.getCurrentEquippedItem().getDisplayName().toLowerCase().contains(" hoe"))
|
||||||
|
{
|
||||||
|
Block block = Block.tilledField;
|
||||||
|
|
||||||
|
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
|
||||||
|
|
||||||
|
if (!world.isRemote)
|
||||||
|
{
|
||||||
|
world.setBlock(par2, par3, par4, block.blockID);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ticks the block if it's been scheduled
|
* Ticks the block if it's been scheduled
|
||||||
|
|
|
@ -71,38 +71,33 @@ public class mod_BiomesOPlenty
|
||||||
{
|
{
|
||||||
|
|
||||||
String[] soundFiles = { "bopdisc.ogg", "bopdiscmud.ogg"};
|
String[] soundFiles = { "bopdisc.ogg", "bopdiscmud.ogg"};
|
||||||
|
|
||||||
for (String soundFile : soundFiles)
|
|
||||||
try
|
|
||||||
{
|
|
||||||
File file = new File("resources/mod/streaming/" + soundFile);
|
|
||||||
if (!file.exists()) {
|
|
||||||
System.out.println("[BoP] " + soundFile + " doesn't exist, creating...");
|
|
||||||
file.getParentFile().mkdirs();
|
|
||||||
file.createNewFile();
|
|
||||||
InputStream istream = getClass().getResourceAsStream("/mods/BiomesOPlenty/audio/" + soundFile);
|
|
||||||
OutputStream out = new FileOutputStream(file);
|
|
||||||
byte[] buf = new byte[1024];
|
|
||||||
int size = 0;
|
|
||||||
int len;
|
|
||||||
while ((len = istream.read(buf)) > 0) {
|
|
||||||
out.write(buf, 0, len);
|
|
||||||
size += len;
|
|
||||||
}
|
|
||||||
out.close();
|
|
||||||
istream.close();
|
|
||||||
if (size == 0) file.delete();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new RuntimeException("Unknown Error, file does not exist");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
for (String soundFile : soundFiles) try
|
||||||
catch (Exception e)
|
{
|
||||||
{
|
File file = new File("resources/mod/streaming/" + soundFile);
|
||||||
FMLCommonHandler.instance().getFMLLogger().log(Level.WARNING, "[BoP] Failed to load sound file: " + soundFile);
|
if (!file.exists()) {
|
||||||
e.printStackTrace();
|
System.out.println("[BoP] " + soundFile + " doesn't exist, creating...");
|
||||||
}
|
file.getParentFile().mkdirs();
|
||||||
|
file.createNewFile();
|
||||||
|
InputStream istream = getClass().getResourceAsStream("/mods/BiomesOPlenty/audio/" + soundFile);
|
||||||
|
OutputStream out = new FileOutputStream(file);
|
||||||
|
byte[] buf = new byte[1024];
|
||||||
|
int size = 0;
|
||||||
|
int len;
|
||||||
|
while ((len = istream.read(buf)) > 0) {
|
||||||
|
out.write(buf, 0, len);
|
||||||
|
size += len;
|
||||||
|
}
|
||||||
|
out.close();
|
||||||
|
istream.close();
|
||||||
|
if (size == 0) file.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
FMLCommonHandler.instance().getFMLLogger().log(Level.WARNING, "[BoP] Failed to load sound file: " + soundFile);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
config = new Configuration(event.getSuggestedConfigurationFile());
|
config = new Configuration(event.getSuggestedConfigurationFile());
|
||||||
config.load();
|
config.load();
|
||||||
|
|
Loading…
Reference in a new issue