Fixed stairs
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.exceptions.MissingDefinition;
|
||||
import appeng.client.render.effects.ChargedOreFX;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.CommonHelper;
|
||||
|
||||
|
||||
public final class ChargedQuartzOreBlock extends QuartzOreBlock
|
||||
{
|
||||
|
||||
public ChargedQuartzOreBlock()
|
||||
{
|
||||
this.setBoostBrightnessLow( 2 );
|
||||
this.setBoostBrightnessHigh( 5 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(
|
||||
IBlockState state,
|
||||
Random rand,
|
||||
int fortune )
|
||||
{
|
||||
for( Item charged : AEApi.instance().definitions().materials().certusQuartzCrystalCharged().maybeItem().asSet() )
|
||||
{
|
||||
return charged;
|
||||
}
|
||||
|
||||
throw new MissingDefinition( "Tried to access charged certus quartz crystal, even though they are disabled" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(
|
||||
IBlockState state )
|
||||
{
|
||||
for ( ItemStack crystalStack : AEApi.instance().definitions().materials().certusQuartzCrystalCharged().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
return crystalStack.getItemDamage();
|
||||
}
|
||||
|
||||
throw new MissingDefinition( "Tried to access charged certus quartz crystal, even though they are disabled" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(
|
||||
World w,
|
||||
BlockPos pos,
|
||||
IBlockState state,
|
||||
Random r )
|
||||
{
|
||||
if ( !AEConfig.instance.enableEffects )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double xOff = ( r.nextFloat() );
|
||||
double yOff = ( r.nextFloat() );
|
||||
double zOff = ( r.nextFloat() );
|
||||
|
||||
switch( r.nextInt( 6 ) )
|
||||
{
|
||||
case 0:
|
||||
xOff = -0.01;
|
||||
break;
|
||||
case 1:
|
||||
yOff = -0.01;
|
||||
break;
|
||||
case 2:
|
||||
xOff = -0.01;
|
||||
break;
|
||||
case 3:
|
||||
zOff = -0.01;
|
||||
break;
|
||||
case 4:
|
||||
xOff = 1.01;
|
||||
break;
|
||||
case 5:
|
||||
yOff = 1.01;
|
||||
break;
|
||||
case 6:
|
||||
zOff = 1.01;
|
||||
break;
|
||||
}
|
||||
|
||||
if( CommonHelper.proxy.shouldAddParticles( r ) )
|
||||
{
|
||||
ChargedOreFX fx = new ChargedOreFX( w, pos.getX() + xOff, pos.getY() + yOff, pos.getZ() + zOff, 0.0f, 0.0f, 0.0f );
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
import appeng.block.AEDecorativeBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
|
||||
|
||||
public final class ChiseledQuartzBlock extends AEDecorativeBlock
|
||||
{
|
||||
public ChiseledQuartzBlock()
|
||||
{
|
||||
super( Material.rock );
|
||||
|
||||
this.setFeature( EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
import appeng.block.AEDecorativeBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
|
||||
|
||||
public final class FluixBlock extends AEDecorativeBlock
|
||||
{
|
||||
public FluixBlock()
|
||||
{
|
||||
super( Material.rock );
|
||||
|
||||
this.setFeature( EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
/**
|
||||
* @author thatsIch
|
||||
* @version rv3 - 29.06.2015
|
||||
* @since rv3 29.06.2015
|
||||
*/
|
||||
public class FluixIdentifier implements Identifier
|
||||
{
|
||||
@Nonnull
|
||||
@Override
|
||||
public String identifier()
|
||||
{
|
||||
return "fluix";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv3 - 29.06.2015
|
||||
* @since rv3 29.06.2015
|
||||
*/
|
||||
public interface Identifier
|
||||
{
|
||||
@Nonnull
|
||||
String identifier();
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
import appeng.block.AEDecorativeBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
|
||||
|
||||
public final class QuartzBlock extends AEDecorativeBlock
|
||||
{
|
||||
public QuartzBlock()
|
||||
{
|
||||
super( Material.rock );
|
||||
|
||||
this.setFeature( EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumWorldBlockLayer;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderQuartzGlass;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
|
||||
|
||||
public class QuartzGlassBlock extends AEBaseBlock
|
||||
{
|
||||
public QuartzGlassBlock()
|
||||
{
|
||||
super( Material.glass );
|
||||
this.setLightOpacity( 0 );
|
||||
this.isOpaque = false;
|
||||
this.setFeature( EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumWorldBlockLayer getBlockLayer()
|
||||
{
|
||||
return EnumWorldBlockLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
return RenderQuartzGlass.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSideBeRendered(
|
||||
IBlockAccess w,
|
||||
BlockPos pos,
|
||||
EnumFacing side )
|
||||
{
|
||||
Material mat = w.getBlockState( pos ).getBlock().getMaterial();
|
||||
if( mat == Material.glass || mat == AEGlassMaterial.INSTANCE )
|
||||
{
|
||||
if( w.getBlockState( pos ).getBlock().getRenderType() == this.getRenderType() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return super.shouldSideBeRendered( w, pos, side );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.client.render.effects.VibrantFX;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.features.AEFeature;
|
||||
|
||||
|
||||
public class QuartzLampBlock extends QuartzGlassBlock
|
||||
{
|
||||
|
||||
public QuartzLampBlock()
|
||||
{
|
||||
this.setLightLevel( 1.0f );
|
||||
this.setBlockTextureName( "BlockQuartzGlass" );
|
||||
this.setFeature( EnumSet.of( AEFeature.DecorativeQuartzBlocks, AEFeature.DecorativeLights ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(
|
||||
World w,
|
||||
BlockPos pos,
|
||||
IBlockState state,
|
||||
Random r )
|
||||
{
|
||||
if( !AEConfig.instance.enableEffects )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( CommonHelper.proxy.shouldAddParticles( r ) )
|
||||
{
|
||||
double d0 = ( r.nextFloat() - 0.5F ) * 0.96D;
|
||||
double d1 = ( r.nextFloat() - 0.5F ) * 0.96D;
|
||||
double d2 = ( r.nextFloat() - 0.5F ) * 0.96D;
|
||||
|
||||
VibrantFX fx = new VibrantFX( w, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0.0D, 0.0D, 0.0D );
|
||||
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumWorldBlockLayer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.exceptions.MissingDefinition;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderQuartzOre;
|
||||
import appeng.core.features.AEFeature;
|
||||
|
||||
|
||||
public class QuartzOreBlock extends AEBaseBlock
|
||||
{
|
||||
private int boostBrightnessLow;
|
||||
private int boostBrightnessHigh;
|
||||
private boolean enhanceBrightness;
|
||||
|
||||
public QuartzOreBlock()
|
||||
{
|
||||
super( Material.rock );
|
||||
this.setHardness( 3.0F );
|
||||
this.setResistance( 5.0F );
|
||||
this.boostBrightnessLow = 0;
|
||||
this.boostBrightnessHigh = 1;
|
||||
this.enhanceBrightness = false;
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumWorldBlockLayer getBlockLayer()
|
||||
{
|
||||
return EnumWorldBlockLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
return RenderQuartzOre.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( this ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMixedBrightnessForBlock(
|
||||
IBlockAccess worldIn,
|
||||
BlockPos pos )
|
||||
{
|
||||
int j1 = super.getMixedBrightnessForBlock( worldIn, pos );
|
||||
if( this.enhanceBrightness )
|
||||
{
|
||||
j1 = Math.max( j1 >> 20, j1 >> 4 );
|
||||
|
||||
if( j1 > 4 )
|
||||
{
|
||||
j1 += this.boostBrightnessHigh;
|
||||
}
|
||||
else
|
||||
{
|
||||
j1 += this.boostBrightnessLow;
|
||||
}
|
||||
|
||||
if( j1 > 15 )
|
||||
{
|
||||
j1 = 15;
|
||||
}
|
||||
return j1 << 20 | j1 << 4;
|
||||
}
|
||||
return j1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped( Random rand )
|
||||
{
|
||||
return 1 + rand.nextInt( 2 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(
|
||||
IBlockState state, /* is null */
|
||||
Random rand,
|
||||
int fortune )
|
||||
{
|
||||
for( Item crystalItem : AEApi.instance().definitions().materials().certusQuartzCrystal().maybeItem().asSet() )
|
||||
{
|
||||
return crystalItem;
|
||||
}
|
||||
|
||||
throw new MissingDefinition( "Tried to access certus quartz crystal, even though they are disabled" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropBlockAsItemWithChance(
|
||||
World w,
|
||||
BlockPos pos,
|
||||
IBlockState state,
|
||||
float chance,
|
||||
int fortune )
|
||||
{
|
||||
super.dropBlockAsItemWithChance( w, pos, state, chance, fortune );
|
||||
|
||||
if( this.getItemDropped( state, w.rand, fortune ) != Item.getItemFromBlock( this ) )
|
||||
{
|
||||
int xp = MathHelper.getRandomIntegerInRange( w.rand, 2, 5 );
|
||||
|
||||
this.dropXpOnBlockBreak( w, pos, xp );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(
|
||||
IBlockState state )
|
||||
{
|
||||
for( ItemStack crystalStack : AEApi.instance().definitions().materials().certusQuartzCrystal().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
return crystalStack.getItemDamage();
|
||||
}
|
||||
|
||||
throw new MissingDefinition( "Tried to access certus quartz crystal, even though they are disabled" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDroppedWithBonus( int fortune, Random rand )
|
||||
{
|
||||
if( fortune > 0 && Item.getItemFromBlock( this ) != this.getItemDropped( null, rand, fortune ) )
|
||||
{
|
||||
int j = rand.nextInt( fortune + 2 ) - 1;
|
||||
|
||||
if( j < 0 )
|
||||
{
|
||||
j = 0;
|
||||
}
|
||||
|
||||
return this.quantityDropped( rand ) * ( j + 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.quantityDropped( rand );
|
||||
}
|
||||
}
|
||||
|
||||
public void setBoostBrightnessLow( int boostBrightnessLow )
|
||||
{
|
||||
this.boostBrightnessLow = boostBrightnessLow;
|
||||
}
|
||||
|
||||
public void setBoostBrightnessHigh( int boostBrightnessHigh )
|
||||
{
|
||||
this.boostBrightnessHigh = boostBrightnessHigh;
|
||||
}
|
||||
|
||||
public void setEnhanceBrightness( boolean enhanceBrightness )
|
||||
{
|
||||
this.enhanceBrightness = enhanceBrightness;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.MetaRotation;
|
||||
|
||||
|
||||
// TODO Quartz Rotation.
|
||||
public class QuartzPillarBlock extends AEBaseBlock implements IOrientableBlock
|
||||
{
|
||||
|
||||
public QuartzPillarBlock()
|
||||
{
|
||||
super( Material.rock );
|
||||
this.setFeature( EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(
|
||||
IBlockState state )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(
|
||||
int meta )
|
||||
{
|
||||
return getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[]{ AXIS_ORIENTATION };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesMetadata()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOrientable getOrientable( final IBlockAccess w,BlockPos pos )
|
||||
{
|
||||
return new MetaRotation( w, pos,false );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class SkyStoneBlock extends AEBaseBlock
|
||||
{
|
||||
private static final float BLOCK_RESISTANCE = 150.0f;
|
||||
private static final double BREAK_SPEAK_SCALAR = 0.1;
|
||||
private static final double BREAK_SPEAK_THRESHOLD = 7.0;
|
||||
private final SkystoneType type;
|
||||
|
||||
public SkyStoneBlock( SkystoneType type )
|
||||
{
|
||||
super( Material.rock, Optional.of( type.name() ) );
|
||||
this.setHardness( 50 );
|
||||
this.hasSubtypes = true;
|
||||
this.blockResistance = BLOCK_RESISTANCE;
|
||||
if( type == SkystoneType.STONE )
|
||||
{
|
||||
this.setHarvestLevel( "pickaxe", 3 );
|
||||
}
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
|
||||
this.type = type;
|
||||
|
||||
MinecraftForge.EVENT_BUS.register( this );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void breakFaster( PlayerEvent.BreakSpeed event )
|
||||
{
|
||||
if( event.state.getBlock() == this && event.entityPlayer != null )
|
||||
{
|
||||
ItemStack is = event.entityPlayer.inventory.getCurrentItem();
|
||||
int level = -1;
|
||||
|
||||
if( is != null && is.getItem() != null )
|
||||
{
|
||||
level = is.getItem().getHarvestLevel( is, "pickaxe" );
|
||||
}
|
||||
|
||||
if( type != SkystoneType.STONE || level >= 3 || event.originalSpeed > BREAK_SPEAK_THRESHOLD )
|
||||
{
|
||||
event.newSpeed /= BREAK_SPEAK_SCALAR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded( World w, BlockPos pos, IBlockState state )
|
||||
{
|
||||
super.onBlockAdded( w, pos, state );
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
WorldData.instance().compassData().service().updateArea( w, pos.getX(), pos.getY(), pos.getZ() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock( World w, BlockPos pos, IBlockState state )
|
||||
{
|
||||
super.breakBlock( w, pos, state );
|
||||
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
WorldData.instance().compassData().service().updateArea( w, pos.getX(), pos.getY(), pos.getZ() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName( ItemStack is )
|
||||
{
|
||||
switch( type )
|
||||
{
|
||||
case BLOCK:
|
||||
return this.getUnlocalizedName() + ".Block";
|
||||
case BRICK:
|
||||
return this.getUnlocalizedName() + ".Brick";
|
||||
case SMALL_BRICK:
|
||||
return this.getUnlocalizedName() + ".SmallBrick";
|
||||
default:
|
||||
return this.getUnlocalizedName();
|
||||
}
|
||||
}
|
||||
|
||||
public enum SkystoneType
|
||||
{
|
||||
STONE, BLOCK, BRICK, SMALL_BRICK
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user