mirror of
https://github.com/GTNewHorizons/Tainted-Magic.git
synced 2026-11-21 20:42:22 +00:00
Cleanup & reformat
This commit is contained in:
1 parent
f479b19255
commit
38e0cefaa2
76 files changed
+2371
-2766
No files matched your search
@@ -17,34 +17,34 @@ import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumcraft.client.fx.particles.FXSparkle;
|
||||
import thaumcraft.common.config.Config;
|
||||
|
||||
public class BlockLumos extends Block implements ITileEntityProvider
|
||||
{
|
||||
public BlockLumos ()
|
||||
{
|
||||
public class BlockLumos extends Block implements ITileEntityProvider {
|
||||
|
||||
public BlockLumos () {
|
||||
super(Config.airyMaterial);
|
||||
this.setStepSound(new Block.SoundType("stone", -1, -1));
|
||||
this.setBlockName("BlockLumos");
|
||||
this.setTickRandomly(false);
|
||||
this.setLightLevel(1.0F);
|
||||
this.setBlockTextureName("thaumcraft:blank");
|
||||
setStepSound(new Block.SoundType("stone", -1, -1));
|
||||
setBlockName("BlockLumos");
|
||||
setTickRandomly(false);
|
||||
setLightLevel(1.0F);
|
||||
setBlockTextureName("thaumcraft:blank");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockDestroyedByPlayer (World world, int x, int y, int z, int meta)
|
||||
{
|
||||
public void onBlockDestroyedByPlayer (final World world, final int x, final int y, final int z, final int meta) {
|
||||
super.onBlockDestroyedByPlayer(world, x, y, z, meta);
|
||||
|
||||
world.playSound(x, y, z, "thaumcraft:ice", 0.3F, 1.1F + world.rand.nextFloat() * 0.1F, true);
|
||||
|
||||
for (int i = 0; i < 9; i++)
|
||||
if (world.isRemote) spawnBreakParticles(world, x, y, z);
|
||||
for (int i = 0; i < 9; i++) {
|
||||
if (world.isRemote) {
|
||||
spawnBreakParticles(world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
void spawnBreakParticles (World world, double x, double y, double z)
|
||||
{
|
||||
FXSparkle fx = new FXSparkle(world, x + world.rand.nextFloat(), y + world.rand.nextFloat(), z + world.rand.nextFloat(),
|
||||
1.75F, 6, 3 + world.rand.nextInt(3));
|
||||
void spawnBreakParticles (final World world, final double x, final double y, final double z) {
|
||||
final FXSparkle fx = new FXSparkle(world, x + world.rand.nextFloat(), y + world.rand.nextFloat(),
|
||||
z + world.rand.nextFloat(), 1.75F, 6, 3 + world.rand.nextInt(3));
|
||||
fx.motionX += world.rand.nextGaussian() * 0.1D;
|
||||
fx.motionY += world.rand.nextGaussian() * 0.1D;
|
||||
fx.motionZ += world.rand.nextGaussian() * 0.1D;
|
||||
@@ -53,75 +53,68 @@ public class BlockLumos extends Block implements ITileEntityProvider
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 0) setBlockBounds(0.3F, 0.3F, 0.3F, 0.7F, 0.7F, 0.7F);
|
||||
else setBlockBounds(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F);
|
||||
public void setBlockBoundsBasedOnState (final IBlockAccess world, final int x, final int y, final int z) {
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 0) {
|
||||
setBlockBounds(0.3F, 0.3F, 0.3F, 0.7F, 0.7F, 0.7F);
|
||||
}
|
||||
else {
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
|
||||
{
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool (final World world, final int x, final int y, final int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
public int getRenderType () {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid (IBlockAccess world, int x, int y, int z, ForgeDirection side)
|
||||
{
|
||||
public boolean isSideSolid (final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockNormalCube ()
|
||||
{
|
||||
public boolean isBlockNormalCube () {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube () {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public boolean isReplaceable (final IBlockAccess world, final int x, final int y, final int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeReplacedByLeaves (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public boolean canBeReplacedByLeaves (final IBlockAccess world, final int x, final int y, final int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
@Override
|
||||
public boolean renderAsNormalBlock () {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped (int a, Random random, int b)
|
||||
{
|
||||
public Item getItemDropped (final int a, final Random random, final int b) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItem (World world, int x, int y, int z)
|
||||
{
|
||||
public Item getItem (final World world, final int x, final int y, final int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World world, int m)
|
||||
{
|
||||
public TileEntity createNewTileEntity (final World world, final int m) {
|
||||
return new TileLumos();
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,6 @@ import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
@@ -23,61 +22,51 @@ import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.registry.BlockRegistry;
|
||||
import taintedmagic.common.registry.ItemRegistry;
|
||||
|
||||
public class BlockNightshadeBush extends BlockBush
|
||||
{
|
||||
public BlockNightshadeBush ()
|
||||
{
|
||||
public class BlockNightshadeBush extends BlockBush {
|
||||
|
||||
public BlockNightshadeBush () {
|
||||
super(Material.plants);
|
||||
this.setBlockName("BlockNightshadeBush");
|
||||
this.setBlockTextureName("taintedmagic:BlockNightshadeBush");
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setStepSound(soundTypeGrass);
|
||||
setBlockName("BlockNightshadeBush");
|
||||
setBlockTextureName("taintedmagic:BlockNightshadeBush");
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setStepSound(soundTypeGrass);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
public Item getItemDropped (int a, Random random, int b)
|
||||
{
|
||||
@Override
|
||||
public Item getItemDropped (final int a, final Random random, final int b) {
|
||||
return ItemRegistry.ItemNightshadeBerries;
|
||||
}
|
||||
|
||||
public int quantityDropped (Random random)
|
||||
{
|
||||
@Override
|
||||
public int quantityDropped (final Random random) {
|
||||
return 1 + random.nextInt(3);
|
||||
}
|
||||
|
||||
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock (final World world, final int x, final int y, final int z, final Entity entity) {
|
||||
super.onEntityCollidedWithBlock(world, x, y, z, entity);
|
||||
|
||||
if (entity instanceof EntityLivingBase)
|
||||
{
|
||||
if (entity instanceof EntityLivingBase) {
|
||||
entity.attackEntityFrom(new DamageSource("nightshade"), 1.0F);
|
||||
try
|
||||
{
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.poison.id, 140, 0));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.poison.id, 140, 0));
|
||||
}
|
||||
}
|
||||
|
||||
public int getFlammability (IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
{
|
||||
@Override
|
||||
public int getFlammability (final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getFireSpreadSpeed (IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
{
|
||||
@Override
|
||||
public int getFireSpreadSpeed (final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBreak (BlockEvent.HarvestDropsEvent event)
|
||||
{
|
||||
public void onBreak (final BlockEvent.HarvestDropsEvent event) {
|
||||
if (event.harvester != null && event.harvester.getHeldItem() != null
|
||||
&& event.harvester.getHeldItem().getItem() instanceof ItemShears)
|
||||
{
|
||||
&& event.harvester.getHeldItem().getItem() instanceof ItemShears) {
|
||||
event.drops.clear();
|
||||
event.drops.add(new ItemStack(BlockRegistry.BlockNightshadeBush, 1, 0));
|
||||
}
|
||||
|
||||
@@ -21,284 +21,238 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.registry.BlockRegistry;
|
||||
|
||||
public class BlockWarpwoodLeaves extends Block implements IShearable
|
||||
{
|
||||
int[] adjacentTreeBlocks;
|
||||
public class BlockWarpwoodLeaves extends Block implements IShearable {
|
||||
|
||||
private int[] adjacentTreeBlocks;
|
||||
private IIcon opaqueIcon;
|
||||
private IIcon transparentIcon;
|
||||
|
||||
public BlockWarpwoodLeaves ()
|
||||
{
|
||||
public BlockWarpwoodLeaves () {
|
||||
super(Material.leaves);
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setLightOpacity(0);
|
||||
this.setHardness(0.1F);
|
||||
this.setStepSound(soundTypeGrass);
|
||||
this.setBlockName("BlockWarpwoodLeaves");
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setLightOpacity(0);
|
||||
setHardness(0.1F);
|
||||
setStepSound(soundTypeGrass);
|
||||
setBlockName("BlockWarpwoodLeaves");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public boolean shouldSideBeRendered (IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
public boolean shouldSideBeRendered (final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
return !Blocks.leaves.isOpaqueCube() || super.shouldSideBeRendered(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube () {
|
||||
return Blocks.leaves.isOpaqueCube();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon (final int side, final int meta) {
|
||||
return !Blocks.leaves.isOpaqueCube() ? transparentIcon : opaqueIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister ir)
|
||||
{
|
||||
public void registerBlockIcons (final IIconRegister ir) {
|
||||
opaqueIcon = ir.registerIcon("taintedmagic:BlockWarpwoodLeaves_opaque");
|
||||
transparentIcon = ir.registerIcon("taintedmagic:BlockWarpwoodLeaves_transparent");
|
||||
}
|
||||
|
||||
public void breakBlock (World world, int x, int y, int z, Block block, int i)
|
||||
{
|
||||
byte var7 = 1;
|
||||
int var8 = var7 + 1;
|
||||
@Override
|
||||
public void breakBlock (final World world, final int x, final int y, final int z, final Block block, final int meta) {
|
||||
final byte dist = 1;
|
||||
final int off = dist + 1;
|
||||
|
||||
if (world.checkChunksExist(x - var8, y - var8, z - var8, x + var8, y + var8, z + var8))
|
||||
{
|
||||
for (int var9 = -var7; var9 <= var7; var9++)
|
||||
{
|
||||
for (int var10 = -var7; var10 <= var7; var10++)
|
||||
{
|
||||
for (int var11 = -var7; var11 <= var7; var11++)
|
||||
{
|
||||
Block var12 = world.getBlock(x + var9, y + var10, z + var11);
|
||||
if (world.checkChunksExist(x - off, y - off, z - off, x + off, y + off, z + off)) {
|
||||
for (int i = -dist; i <= dist; i++) {
|
||||
for (int j = -dist; j <= dist; j++) {
|
||||
for (int k = -dist; k <= dist; k++) {
|
||||
final Block b = world.getBlock(x + i, y + j, z + k);
|
||||
|
||||
if (var12 == Blocks.air) continue;
|
||||
var12.beginLeavesDecay(world, x + var9, y + var10, z + var11);
|
||||
if (b == Blocks.air) {
|
||||
continue;
|
||||
}
|
||||
b.beginLeavesDecay(world, x + i, y + j, z + k);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateTick (World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
int var6 = world.getBlockMetadata(x, y, z);
|
||||
@Override
|
||||
public void updateTick (final World world, final int x, final int y, final int z, final Random random) {
|
||||
if (!world.isRemote) {
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if ( ( (var6 & 0x8) != 0) && ( (var6 & 0x4) == 0))
|
||||
{
|
||||
byte var7 = 4;
|
||||
int var8 = var7 + 1;
|
||||
byte var9 = 32;
|
||||
int var10 = var9 * var9;
|
||||
int var11 = var9 / 2;
|
||||
if ( (meta & 0x8) != 0 && (meta & 0x4) == 0) {
|
||||
final byte pos = 4;
|
||||
final int off = pos + 1;
|
||||
final byte dist = 32;
|
||||
final int dist2 = dist * dist;
|
||||
final int half = dist / 2;
|
||||
|
||||
if (this.adjacentTreeBlocks == null)
|
||||
{
|
||||
this.adjacentTreeBlocks = new int[var9 * var9 * var9];
|
||||
if (adjacentTreeBlocks == null) {
|
||||
adjacentTreeBlocks = new int[dist * dist * dist];
|
||||
}
|
||||
|
||||
if (world.checkChunksExist(x - var8, y - var8, z - var8, x + var8, y + var8, z + var8))
|
||||
{
|
||||
for (int var12 = -var7; var12 <= var7; var12++)
|
||||
{
|
||||
for (int var13 = -var7; var13 <= var7; var13++)
|
||||
{
|
||||
for (int var14 = -var7; var14 <= var7; var14++)
|
||||
{
|
||||
Block block = world.getBlock(x + var12, y + var13, z + var14);
|
||||
if (world.checkChunksExist(x - off, y - off, z - off, x + off, y + off, z + off)) {
|
||||
for (int i = -pos; i <= pos; i++) {
|
||||
for (int j = -pos; j <= pos; j++) {
|
||||
for (int k = -pos; k <= pos; k++) {
|
||||
final Block block = world.getBlock(x + i, y + j, z + k);
|
||||
|
||||
if ( (block != null) && (block.canSustainLeaves(world, x + var12, y + var13, z + var14)))
|
||||
{
|
||||
this.adjacentTreeBlocks[ ( (var12 + var11) * var10 + (var13 + var11) * var9 + var14
|
||||
+ var11)] = 0;
|
||||
if (block != null && block.canSustainLeaves(world, x + i, y + j, z + k)) {
|
||||
adjacentTreeBlocks[ (i + half) * dist2 + (j + half) * dist + k + half] = 0;
|
||||
}
|
||||
else if ( (block != null) && (block.isLeaves(world, x + var12, y + var13, z + var14)))
|
||||
{
|
||||
this.adjacentTreeBlocks[ ( (var12 + var11) * var10 + (var13 + var11) * var9 + var14
|
||||
+ var11)] = -2;
|
||||
else if (block != null && block.isLeaves(world, x + i, y + j, z + k)) {
|
||||
adjacentTreeBlocks[ (i + half) * dist2 + (j + half) * dist + k + half] = -2;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.adjacentTreeBlocks[ ( (var12 + var11) * var10 + (var13 + var11) * var9 + var14
|
||||
+ var11)] = -1;
|
||||
else {
|
||||
adjacentTreeBlocks[ (i + half) * dist2 + (j + half) * dist + k + half] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int var15 = 0;
|
||||
for (int var12 = 1; var12 <= 4; var12++)
|
||||
{
|
||||
for (int var13 = -var7; var13 <= var7; var13++)
|
||||
{
|
||||
for (int var14 = -var7; var14 <= var7; var14++)
|
||||
{
|
||||
for (var15 = -var7; var15 <= var7; var15++)
|
||||
{
|
||||
if (this.adjacentTreeBlocks[ ( (var13 + var11) * var10 + (var14 + var11) * var9 + var15
|
||||
+ var11)] != var12 - 1)
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
for (int j = -pos; j <= pos; j++) {
|
||||
for (int k = -pos; k <= pos; k++) {
|
||||
for (int l = -pos; l <= pos; l++) {
|
||||
if (adjacentTreeBlocks[ (j + half) * dist2 + (k + half) * dist + l + half] != i - 1) {
|
||||
continue;
|
||||
if (this.adjacentTreeBlocks[ ( (var13 + var11 - 1) * var10 + (var14 + var11) * var9 + var15
|
||||
+ var11)] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[ ( (var13 + var11 - 1) * var10 + (var14 + var11) * var9 + var15
|
||||
+ var11)] = var12;
|
||||
}
|
||||
if (adjacentTreeBlocks[ (j + half - 1) * dist2 + (k + half) * dist + l + half] == -2) {
|
||||
adjacentTreeBlocks[ (j + half - 1) * dist2 + (k + half) * dist + l + half] = i;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[ ( (var13 + var11 + 1) * var10 + (var14 + var11) * var9 + var15
|
||||
+ var11)] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[ ( (var13 + var11 + 1) * var10 + (var14 + var11) * var9 + var15
|
||||
+ var11)] = var12;
|
||||
if (adjacentTreeBlocks[ (j + half + 1) * dist2 + (k + half) * dist + l + half] == -2) {
|
||||
adjacentTreeBlocks[ (j + half + 1) * dist2 + (k + half) * dist + l + half] = i;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[ ( (var13 + var11) * var10 + (var14 + var11 - 1) * var9 + var15
|
||||
+ var11)] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[ ( (var13 + var11) * var10 + (var14 + var11 - 1) * var9 + var15
|
||||
+ var11)] = var12;
|
||||
if (adjacentTreeBlocks[ (j + half) * dist2 + (k + half - 1) * dist + l + half] == -2) {
|
||||
adjacentTreeBlocks[ (j + half) * dist2 + (k + half - 1) * dist + l + half] = i;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[ ( (var13 + var11) * var10 + (var14 + var11 + 1) * var9 + var15
|
||||
+ var11)] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[ ( (var13 + var11) * var10 + (var14 + var11 + 1) * var9 + var15
|
||||
+ var11)] = var12;
|
||||
if (adjacentTreeBlocks[ (j + half) * dist2 + (k + half + 1) * dist + l + half] == -2) {
|
||||
adjacentTreeBlocks[ (j + half) * dist2 + (k + half + 1) * dist + l + half] = i;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[ ( (var13 + var11) * var10 + (var14 + var11) * var9
|
||||
+ (var15 + var11 - 1))] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[ ( (var13 + var11) * var10 + (var14 + var11) * var9
|
||||
+ (var15 + var11 - 1))] = var12;
|
||||
if (adjacentTreeBlocks[ (j + half) * dist2 + (k + half) * dist + l + half - 1] == -2) {
|
||||
adjacentTreeBlocks[ (j + half) * dist2 + (k + half) * dist + l + half - 1] = i;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[ ( (var13 + var11) * var10 + (var14 + var11) * var9 + var15
|
||||
+ var11 + 1)] != -2)
|
||||
if (adjacentTreeBlocks[ (j + half) * dist2 + (k + half) * dist + l + half + 1] != -2) {
|
||||
continue;
|
||||
this.adjacentTreeBlocks[ ( (var13 + var11) * var10 + (var14 + var11) * var9 + var15 + var11
|
||||
+ 1)] = var12;
|
||||
}
|
||||
adjacentTreeBlocks[ (j + half) * dist2 + (k + half) * dist + l + half + 1] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int var12 = this.adjacentTreeBlocks[ (var11 * var10 + var11 * var9 + var11)];
|
||||
final int adj = adjacentTreeBlocks[half * dist2 + half * dist + half];
|
||||
|
||||
if (var12 >= 0)
|
||||
{
|
||||
world.setBlock(x, y, z, this, var6 & 0xFFFFFFF7, 3);
|
||||
if (adj >= 0) {
|
||||
world.setBlock(x, y, z, this, meta & 0xFFFFFFF7, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
removeLeaves(world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeLeaves (World world, int x, int y, int z)
|
||||
{
|
||||
private void removeLeaves (final World world, final int x, final int y, final int z) {
|
||||
dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
public void dropBlockAsItemWithChance (World world, int x, int y, int z, int m, float f, int i)
|
||||
{
|
||||
if ( (!world.isRemote) && ( (m & 0x8) != 0) && ( (m & 0x4) == 0))
|
||||
{
|
||||
if ( ( (m & 0x1) == 0) && (world.rand.nextInt(50) == 0))
|
||||
{
|
||||
@Override
|
||||
public void dropBlockAsItemWithChance (final World world, final int x, final int y, final int z, final int m, final float f,
|
||||
final int i) {
|
||||
if (!world.isRemote && (m & 0x8) != 0 && (m & 0x4) == 0) {
|
||||
if ( (m & 0x1) == 0 && world.rand.nextInt(50) == 0) {
|
||||
dropBlockAsItem(world, x, y, z, new ItemStack(BlockRegistry.BlockWarpwoodSapling));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void harvestBlock (World world, EntityPlayer player, int x, int y, int z, int i)
|
||||
{
|
||||
@Override
|
||||
public void harvestBlock (final World world, final EntityPlayer player, final int x, final int y, final int z,
|
||||
final int i) {
|
||||
super.harvestBlock(world, player, x, y, z, i);
|
||||
}
|
||||
|
||||
public int damageDropped (int i)
|
||||
{
|
||||
@Override
|
||||
public int damageDropped (final int i) {
|
||||
return i & 0x1;
|
||||
}
|
||||
|
||||
public int quantityDropped (Random random)
|
||||
{
|
||||
@Override
|
||||
public int quantityDropped (final Random random) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Item getItemDropped (int i, Random random, int i2)
|
||||
{
|
||||
@Override
|
||||
public Item getItemDropped (final int i, final Random random, final int i2) {
|
||||
return Item.getItemById(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeaves (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public boolean isLeaves (final IBlockAccess world, final int x, final int y, final int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void beginLeavesDecay (World world, int x, int y, int z)
|
||||
{
|
||||
@Override
|
||||
public void beginLeavesDecay (final World world, final int x, final int y, final int z) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) | 0x8, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public int getBlockColor ()
|
||||
{
|
||||
public int getBlockColor () {
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
public ItemStack getPickBlock (MovingObjectPosition mop, World world, int x, int y, int z)
|
||||
{
|
||||
int m = world.getBlockMetadata(x, y, z);
|
||||
@Override
|
||||
public ItemStack getPickBlock (final MovingObjectPosition mop, final World world, final int x, final int y, final int z) {
|
||||
final int m = world.getBlockMetadata(x, y, z);
|
||||
return new ItemStack(this, 1, m & 0x1);
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderColor (int m)
|
||||
{
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public int colorMultiplier (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public int getRenderColor (final int m) {
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShearable (ItemStack stack, IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
@SideOnly (Side.CLIENT)
|
||||
public int colorMultiplier (final IBlockAccess world, final int x, final int y, final int z) {
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShearable (final ItemStack stack, final IBlockAccess world, final int x, final int y, final int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ArrayList<ItemStack> onSheared (ItemStack stack, IBlockAccess world, int x, int y, int z, int fortune)
|
||||
{
|
||||
ArrayList ret = new ArrayList();
|
||||
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 0x3));
|
||||
return ret;
|
||||
@Override
|
||||
public ArrayList<ItemStack> onSheared (final ItemStack stack, final IBlockAccess world, final int x, final int y,
|
||||
final int z, final int fortune) {
|
||||
final ArrayList drops = new ArrayList();
|
||||
drops.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 0x3));
|
||||
return drops;
|
||||
}
|
||||
|
||||
public int getFlammability (IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
{
|
||||
@Override
|
||||
public int getFlammability (final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getFireSpreadSpeed (IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
{
|
||||
@Override
|
||||
public int getFireSpreadSpeed (final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -18,73 +18,77 @@ import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumcraft.client.fx.particles.FXWisp;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
|
||||
public class BlockWarpwoodLog extends BlockRotatedPillar
|
||||
{
|
||||
IIcon top, side, knot;
|
||||
public class BlockWarpwoodLog extends BlockRotatedPillar {
|
||||
|
||||
public BlockWarpwoodLog ()
|
||||
{
|
||||
private IIcon top;
|
||||
private IIcon side;
|
||||
private IIcon knot;
|
||||
|
||||
public BlockWarpwoodLog () {
|
||||
super(Material.wood);
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setHardness(2.5F);
|
||||
this.setStepSound(soundTypeWood);
|
||||
this.setBlockName("BlockWarpwoodLog");
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setHardness(2.5F);
|
||||
setStepSound(soundTypeWood);
|
||||
setBlockName("BlockWarpwoodLog");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
protected IIcon getTopIcon (int meta)
|
||||
{
|
||||
protected IIcon getTopIcon (final int meta) {
|
||||
return top;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
protected IIcon getSideIcon (int meta)
|
||||
{
|
||||
protected IIcon getSideIcon (final int meta) {
|
||||
return meta == 2 ? knot : side;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister ir)
|
||||
{
|
||||
public void registerBlockIcons (final IIconRegister ir) {
|
||||
side = ir.registerIcon("taintedmagic:BlockWarpwoodLog_side");
|
||||
top = ir.registerIcon("taintedmagic:BlockWarpwoodLog_top");
|
||||
knot = ir.registerIcon("taintedmagic:BlockWarpwoodLog_knot");
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBlockHardness (World world, int x, int y, int z)
|
||||
{
|
||||
if (world.getBlockMetadata(x, y, z) == 2) return 25.0F;
|
||||
public float getBlockHardness (final World world, final int x, final int y, final int z) {
|
||||
if (world.getBlockMetadata(x, y, z) == 2)
|
||||
return 25.0F;
|
||||
return super.getBlockHardness(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops (World world, int x, int y, int z, int meta, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
|
||||
if (meta == 2) drops.add(new ItemStack(ConfigItems.itemResource, world.rand.nextInt(5) + 1, 17));
|
||||
else drops.add(new ItemStack(this, 1, 0));
|
||||
public ArrayList<ItemStack> getDrops (final World world, final int x, final int y, final int z, final int meta,
|
||||
final int fortune) {
|
||||
final ArrayList<ItemStack> drops = new ArrayList<>();
|
||||
|
||||
if (meta == 2) {
|
||||
drops.add(new ItemStack(ConfigItems.itemResource, world.rand.nextInt(5) + 1, 17));
|
||||
}
|
||||
else {
|
||||
drops.add(new ItemStack(this, 1, 0));
|
||||
}
|
||||
return drops;
|
||||
}
|
||||
|
||||
public boolean addDestroyEffects (World world, int x, int y, int z, int meta, EffectRenderer ef)
|
||||
{
|
||||
if (meta == 2)
|
||||
{
|
||||
if (world.isRemote) particles(world, x, y, z);
|
||||
@Override
|
||||
public boolean addDestroyEffects (final World world, final int x, final int y, final int z, final int meta,
|
||||
final EffectRenderer ef) {
|
||||
if (meta == 2) {
|
||||
if (world.isRemote) {
|
||||
particles(world, x, y, z);
|
||||
}
|
||||
world.playSound(x + 0.5D, y + 0.5D, z + 0.5D, "thaumcraft:craftfail", 1.0F, 1.0F, false);
|
||||
}
|
||||
return super.addDestroyEffects(world, x, y, z, meta, ef);
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
private void particles (World world, int x, int y, int z)
|
||||
{
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
FXWisp fx = new FXWisp(world, x + 0.5D + (Math.random() - Math.random()) * 0.5D,
|
||||
private void particles (final World world, final int x, final int y, final int z) {
|
||||
for (int i = 0; i < 15; i++) {
|
||||
final FXWisp fx = new FXWisp(world, x + 0.5D + (Math.random() - Math.random()) * 0.5D,
|
||||
y + 0.5D + (Math.random() - Math.random()) * 0.5D, z + 0.5D + (Math.random() - Math.random()) * 0.5D,
|
||||
0.25F + (float) Math.random() * 0.25F, 5);
|
||||
|
||||
@@ -97,23 +101,23 @@ public class BlockWarpwoodLog extends BlockRotatedPillar
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canSustainLeaves (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
@Override
|
||||
public boolean canSustainLeaves (final IBlockAccess world, final int x, final int y, final int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isWood (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
@Override
|
||||
public boolean isWood (final IBlockAccess world, final int x, final int y, final int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getFlammability (IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
{
|
||||
@Override
|
||||
public int getFlammability (final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getFireSpreadSpeed (IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
{
|
||||
@Override
|
||||
public int getFireSpreadSpeed (final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -4,15 +4,14 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
|
||||
public class BlockWarpwoodPlanks extends Block
|
||||
{
|
||||
public BlockWarpwoodPlanks ()
|
||||
{
|
||||
public class BlockWarpwoodPlanks extends Block {
|
||||
|
||||
public BlockWarpwoodPlanks () {
|
||||
super(Material.wood);
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setBlockName("BlockWarpwoodPlanks");
|
||||
this.setBlockTextureName("taintedmagic:BlockWarpwoodPlanks");
|
||||
this.setHardness(0.8F);
|
||||
this.setStepSound(soundTypeWood);
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setBlockName("BlockWarpwoodPlanks");
|
||||
setBlockTextureName("taintedmagic:BlockWarpwoodPlanks");
|
||||
setHardness(0.8F);
|
||||
setStepSound(soundTypeWood);
|
||||
}
|
||||
}
|
||||
@@ -15,55 +15,49 @@ import net.minecraft.world.World;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.world.WorldGenWarpwoodTree;
|
||||
|
||||
public class BlockWarpwoodSapling extends BlockSapling
|
||||
{
|
||||
public BlockWarpwoodSapling ()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setBlockName("BlockWarpwoodSapling");
|
||||
this.setStepSound(soundTypeGrass);
|
||||
public class BlockWarpwoodSapling extends BlockSapling {
|
||||
|
||||
public BlockWarpwoodSapling () {
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setBlockName("BlockWarpwoodSapling");
|
||||
setStepSound(soundTypeGrass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_149878_d (World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
public void func_149878_d (final World world, final int x, final int y, final int z, final Random random) {
|
||||
if (!world.isRemote) {
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
world.setBlockToAir(x, y, z);
|
||||
|
||||
WorldGenWarpwoodTree tree = new WorldGenWarpwoodTree(true, 7, 5);
|
||||
final WorldGenWarpwoodTree tree = new WorldGenWarpwoodTree(true, 7, 5);
|
||||
|
||||
if (!tree.generate(world, random, x, y, z)) world.setBlock(x, y, z, this, meta, 2);
|
||||
if (!tree.generate(world, random, x, y, z)) {
|
||||
world.setBlock(x, y, z, this, meta, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void getSubBlocks (Item item, CreativeTabs tab, List list)
|
||||
{
|
||||
public void getSubBlocks (final Item item, final CreativeTabs tab, final List list) {
|
||||
list.add(new ItemStack(this, 1, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped (int i, Random random, int i2)
|
||||
{
|
||||
public Item getItemDropped (final int i, final Random random, final int i2) {
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister ir)
|
||||
{
|
||||
this.blockIcon = ir.registerIcon("taintedmagic:BlockWarpwoodSapling");
|
||||
public void registerBlockIcons (final IIconRegister ir) {
|
||||
blockIcon = ir.registerIcon("taintedmagic:BlockWarpwoodSapling");
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
return this.blockIcon;
|
||||
public IIcon getIcon (final int side, final int meta) {
|
||||
return blockIcon;
|
||||
}
|
||||
}
|
||||
@@ -15,79 +15,72 @@ import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumcraft.client.fx.particles.FXSparkle;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
|
||||
public class TileLumos extends TileEntity
|
||||
{
|
||||
int ticksExisted;
|
||||
public class TileLumos extends TileEntity {
|
||||
|
||||
public TileLumos ()
|
||||
{
|
||||
public TileLumos () {
|
||||
}
|
||||
|
||||
public boolean canUpdate ()
|
||||
{
|
||||
@Override
|
||||
public boolean canUpdate () {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity ()
|
||||
{
|
||||
ticksExisted++;
|
||||
public void updateEntity () {
|
||||
final Block block = worldObj.getBlock(xCoord, yCoord, zCoord);
|
||||
final int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
|
||||
Block block = worldObj.getBlock(xCoord, yCoord, zCoord);
|
||||
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
if (block instanceof BlockLumos) {
|
||||
final EntityPlayer player = worldObj.getClosestPlayer(xCoord, yCoord, zCoord, 4);
|
||||
|
||||
if (block instanceof BlockLumos)
|
||||
{
|
||||
EntityPlayer player = worldObj.getClosestPlayer(xCoord, yCoord, zCoord, 4);
|
||||
|
||||
if (meta == 0 && worldObj.rand.nextInt(15) == 0)
|
||||
{
|
||||
if (worldObj.isRemote) spawnParticles();
|
||||
if ( (meta == 0 && worldObj.rand.nextInt(15) == 0) && worldObj.isRemote) {
|
||||
spawnParticles();
|
||||
}
|
||||
if ( (meta == 1 || meta == 2) && player == null)
|
||||
{
|
||||
if ( (meta == 1 || meta == 2) && player == null) {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
else if (meta == 1 && player != null)
|
||||
{
|
||||
else if (meta == 1 && player != null) {
|
||||
if (player.getHeldItem() == null
|
||||
|| (player.getHeldItem() != null && ! (player.getHeldItem().getItem() instanceof ItemWandCasting)))
|
||||
|| player.getHeldItem() != null && ! (player.getHeldItem().getItem() instanceof ItemWandCasting)) {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
else if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemWandCasting)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem();
|
||||
ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
}
|
||||
else if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemWandCasting) {
|
||||
final ItemStack stack = player.getHeldItem();
|
||||
final ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
|
||||
if (wand.getFocus(stack) == null
|
||||
|| (wand.getFocus(stack) != null && wand.getFocus(stack) != ItemRegistry.ItemFocusLumos))
|
||||
|| wand.getFocus(stack) != null && wand.getFocus(stack) != ItemRegistry.ItemFocusLumos) {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (meta == 2 && player != null)
|
||||
{
|
||||
IInventory baub = BaublesApi.getBaubles(player);
|
||||
if (baub.getStackInSlot(1) == null && baub.getStackInSlot(2) == null)
|
||||
if (meta == 2 && player != null) {
|
||||
final IInventory baub = BaublesApi.getBaubles(player);
|
||||
if (baub.getStackInSlot(1) == null && baub.getStackInSlot(2) == null) {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
else if ( (baub.getStackInSlot(1) != null && baub.getStackInSlot(2) == null)
|
||||
&& ! (baub.getStackInSlot(1).getItem() instanceof ItemLumosRing))
|
||||
}
|
||||
else if (baub.getStackInSlot(1) != null && baub.getStackInSlot(2) == null
|
||||
&& ! (baub.getStackInSlot(1).getItem() instanceof ItemLumosRing)) {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
else if ( (baub.getStackInSlot(1) == null && baub.getStackInSlot(2) != null)
|
||||
&& ! (baub.getStackInSlot(2).getItem() instanceof ItemLumosRing))
|
||||
}
|
||||
else if (baub.getStackInSlot(1) == null && baub.getStackInSlot(2) != null
|
||||
&& ! (baub.getStackInSlot(2).getItem() instanceof ItemLumosRing)) {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
else if ( (baub.getStackInSlot(1) != null && baub.getStackInSlot(2) != null)
|
||||
&& (! (baub.getStackInSlot(1).getItem() instanceof ItemLumosRing)
|
||||
&& ! (baub.getStackInSlot(2).getItem() instanceof ItemLumosRing)))
|
||||
}
|
||||
else if (baub.getStackInSlot(1) != null && baub.getStackInSlot(2) != null
|
||||
&& ! (baub.getStackInSlot(1).getItem() instanceof ItemLumosRing)
|
||||
&& ! (baub.getStackInSlot(2).getItem() instanceof ItemLumosRing)) {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
void spawnParticles ()
|
||||
{
|
||||
FXSparkle fx = new FXSparkle(worldObj, (double) xCoord + 0.5D + (worldObj.rand.nextGaussian() * 0.1D),
|
||||
(double) yCoord + 0.5D + (worldObj.rand.nextGaussian() * 0.1D),
|
||||
(double) zCoord + 0.5D + (worldObj.rand.nextGaussian() * 0.1D), 1.75F, 6, 3 + worldObj.rand.nextInt(2));
|
||||
void spawnParticles () {
|
||||
final FXSparkle fx = new FXSparkle(worldObj, xCoord + 0.5D + worldObj.rand.nextGaussian() * 0.1D,
|
||||
yCoord + 0.5D + worldObj.rand.nextGaussian() * 0.1D, zCoord + 0.5D + worldObj.rand.nextGaussian() * 0.1D, 1.75F,
|
||||
6, 3 + worldObj.rand.nextInt(2));
|
||||
fx.slowdown = true;
|
||||
fx.setGravity(-0.5F);
|
||||
ParticleEngine.instance.addEffect(worldObj, fx);
|
||||
|
||||
Reference in new issue
Block a user