Java Code Examples for net.minecraft.block.material.Material

The following examples show how to use net.minecraft.block.material.Material. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: ehacks-pro   Source File: Events.java    License: GNU General Public License v3.0 6 votes vote down vote up
@SubscribeEvent
public void onAttack(AttackEntityEvent event) {
    if (!cheatEnabled) {
        return;
    }
    if (!(KillAura.isActive || MobAura.isActive || ProphuntAura.isActive || Forcefield.isActive || TriggerBot.isActive || !Criticals.isActive || Wrapper.INSTANCE.player().isInWater() || Wrapper.INSTANCE.player().isInsideOfMaterial(Material.lava) || Wrapper.INSTANCE.player().isInsideOfMaterial(Material.web) || !Wrapper.INSTANCE.player().onGround || !Wrapper.INSTANCE.mcSettings().keyBindAttack.getIsKeyPressed() || Wrapper.INSTANCE.mc().objectMouseOver == null || Wrapper.INSTANCE.mc().objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY)) {
        event.setCanceled(true);
        Wrapper.INSTANCE.player().motionY = 0.1000000014901161;
        Wrapper.INSTANCE.player().fallDistance = 0.1f;
        Wrapper.INSTANCE.player().onGround = false;
        event.setCanceled(false);
    }
    if (event.target instanceof EntityPlayer) {
        EntityPlayer e = (EntityPlayer) event.target;
        if (SeeHealth.isActive) {
            InteropUtils.log("Health of &e" + e.getCommandSenderName() + "&f: &e" + e.getHealth(), "SeeHealth");
        }
    }
}
 
Example 2
Source Project: TofuCraftReload   Source File: BlockTofuDoor.java    License: MIT License 6 votes vote down vote up
public BlockTofuDoor(Material material,TofuType tofuType){
    super(material);
    this.tofuType = tofuType;
    this.setCreativeTab(CommonProxy.tab);
    if(material== Material.WOOD) {
        this.setSoundType(SoundType.CLOTH);
        if(tofuType == TofuType.kinu){
            this.setHardness(0.6F);
            this.setResistance(2.0F);
        }else {
            this.setHardness(0.4F);
            this.setResistance(1.0F);
        }
    }else {
        if(material== Material.IRON){
            this.setSoundType(SoundType.METAL);
            this.setHardness(5.0F);
            this.setResistance(11.0F);
        }else {
            this.setSoundType(SoundType.STONE);
            this.setHardness(1.8F);
            this.setResistance(9.0F);
        }
    }
}
 
Example 3
Source Project: ehacks-pro   Source File: TriggerBot.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onTicks() {
    try {
        if (Wrapper.INSTANCE.mc().objectMouseOver != null && Wrapper.INSTANCE.mc().objectMouseOver.entityHit != null && this.isValidTarget(Wrapper.INSTANCE.mc().objectMouseOver.entityHit) && TriggerBot.hasReached(150 + rand.nextInt(100))) {
            if (Criticals.isActive && !Wrapper.INSTANCE.player().isInWater() && !Wrapper.INSTANCE.player().isInsideOfMaterial(Material.lava) && !Wrapper.INSTANCE.player().isInsideOfMaterial(Material.web) && Wrapper.INSTANCE.player().onGround) {
                Wrapper.INSTANCE.player().motionY = 0.1;
                Wrapper.INSTANCE.player().fallDistance = 0.1f;
                Wrapper.INSTANCE.player().onGround = false;
            }
            if (AutoBlock.isActive && Wrapper.INSTANCE.player().getCurrentEquippedItem() != null && Wrapper.INSTANCE.player().getCurrentEquippedItem().getItem() instanceof ItemSword) {
                ItemStack lel = Wrapper.INSTANCE.player().getCurrentEquippedItem();
                lel.useItemRightClick(Wrapper.INSTANCE.world(), Wrapper.INSTANCE.player());
            }
            Wrapper.INSTANCE.player().swingItem();
            Wrapper.INSTANCE.mc().playerController.attackEntity(Wrapper.INSTANCE.player(), Wrapper.INSTANCE.mc().objectMouseOver.entityHit);
            this.reset();
        }
    } catch (Exception ex) {
    }
}
 
Example 4
@Override
public void fall(float distance, float damageMultiplier) {
	if (distance > 1.0F) {
		this.playSound(SoundEvents.ENTITY_HORSE_LAND, 0.4F, 1.0F);
	}

	int i = MathHelper.ceil((distance * 0.5F - 3.0F) * damageMultiplier);

	if (i > 0) {
		this.attackEntityFrom(DamageSource.FALL, i);

		if (this.isBeingRidden()) {
			for (Entity entity : this.getRecursivePassengers()) {
				entity.attackEntityFrom(DamageSource.FALL, i);
			}
		}
		BlockPos pos = new BlockPos(this.posX, this.posY - 0.2D - this.prevRotationYaw, this.posZ);
		IBlockState iblockstate = this.world.getBlockState(pos);
		Block block = iblockstate.getBlock();

		if (iblockstate.getMaterial() != Material.AIR && !this.isSilent()) {
			SoundType soundtype = block.getSoundType(block.getDefaultState(), this.world, pos, this);
			this.world.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ, soundtype.getStepSound(), this.getSoundCategory(), soundtype.getVolume() * 0.5F, soundtype.getPitch() * 0.75F);
		}
	}
}
 
Example 5
Source Project: Cyberware   Source File: BlockBlueprintArchive.java    License: MIT License 6 votes vote down vote up
public BlockBlueprintArchive()
{
	super(Material.IRON);
	setHardness(5.0F);
	setResistance(10.0F);
	setSoundType(SoundType.METAL);
	
	String name = "blueprintArchive";
	
	this.setRegistryName(name);
	GameRegistry.register(this);

	ItemBlock ib = new ItemBlockCyberware(this, "cyberware.tooltip.blueprintArchive");
	ib.setRegistryName(name);
	GameRegistry.register(ib);
	
	this.setUnlocalizedName(Cyberware.MODID + "." + name);

	this.setCreativeTab(Cyberware.creativeTab);
	GameRegistry.registerTileEntity(TileEntityBlueprintArchive.class, Cyberware.MODID + ":" + name);
	
	CyberwareContent.blocks.add(this);
	
	this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
}
 
Example 6
@Override
protected void jump()
{

    if (isInsideOfMaterial(Material.water)) // super.jump();
    {
        if (getHasCaughtPrey() || (entityToAttack == null && rand.nextInt(20) != 0)) { return;
        // if (entityToAttack == null)
        }

        motionY = 0.3D;
        if (isSprinting())
        {
            float f = rotationYaw * 0.01745329F;
            motionX -= MathHelper.sin(f) * 0.2F;
            motionZ += MathHelper.cos(f) * 0.2F;
        }
        isAirBorne = true;

    }
    else if (entityToAttack != null || getHasCaughtPrey())
    {
        super.jump();
    }
}
 
Example 7
public BlockTraverseWoodDoor(String name) {
    super(Material.WOOD);
    setRegistryName(new ResourceLocation(TraverseConstants.MOD_ID, name + "_door"));
    setTranslationKey(getRegistryName().toString());
    setCreativeTab(TraverseTab.TAB);
    setSoundType(SoundType.WOOD);
    setHardness(3.0F);
    setHarvestLevel("axe", 0);
    ShootingStar.registerModel(new ModelCompound(TraverseConstants.MOD_ID, this, "door", POWERED));
}
 
Example 8
public BlockCrusherBlade() {
    super(Material.IRON);
    setUnlocalizedName("gt.crusher_blade");
    setCreativeTab(GregTechAPI.TAB_GREGTECH);
    setHarvestLevel("pickaxe", 2);
    setHardness(3.0f);
    setResistance(5.0f);
    setLightOpacity(0);
    setDefaultState(getDefaultState()
        .withProperty(AXIS, Axis.Y)
        .withProperty(ACTIVE, false));
}
 
Example 9
Source Project: TofuCraftReload   Source File: TofuVillageCollection.java    License: MIT License 5 votes vote down vote up
private boolean isWoodDoor(BlockPos doorPos) {
    IBlockState iblockstate = this.world.getBlockState(doorPos);
    Block block = iblockstate.getBlock();

    if (block instanceof BlockDoor) {
        return iblockstate.getMaterial() == Material.WOOD;
    } else {
        return false;
    }
}
 
Example 10
Source Project: EnderStorage   Source File: ModContent.java    License: MIT License 5 votes vote down vote up
@SubscribeEvent
public static void onRegisterBlocks(RegistryEvent.Register<Block> event) {
    IForgeRegistry<Block> registry = event.getRegistry();

    Block.Properties properties = Block.Properties.create(Material.ROCK)//
            .hardnessAndResistance(20, 100);
    registry.register(new BlockEnderChest(properties).setRegistryName("ender_chest"));
    registry.register(new BlockEnderTank(properties).setRegistryName("ender_tank"));
}
 
Example 11
Source Project: ExtraCells1   Source File: BlockWalrus.java    License: MIT License 5 votes vote down vote up
public BlockWalrus(int id)
{
	super(id, Material.rock);
	setCreativeTab(extracells.Extracells.ModTab);
	setUnlocalizedName("block.walrus");
	setHardness(2.0F);
setResistance(10.0F);
}
 
Example 12
Source Project: GardenCollection   Source File: BlockHeavyChain.java    License: MIT License 5 votes vote down vote up
public BlockHeavyChain (String blockName) {
    super(Material.iron);

    setBlockName(blockName);
    setHardness(2.5f);
    setResistance(5f);
    setStepSound(Block.soundTypeMetal);
    setBlockBounds(.5f - .125f, 0, .5f - .125f, .5f + .125f, 1, .5f + .125f);
    setBlockTextureName(GardenStuff.MOD_ID + ":chain_heavy");
    setCreativeTab(ModCreativeTabs.tabGardenCore);
}
 
Example 13
Source Project: ForgeHax   Source File: AntiOverlayMod.java    License: MIT License 5 votes vote down vote up
/**
 * Disables water/lava fog
 */
@SubscribeEvent
public void onFogRender(EntityViewRenderEvent.FogDensity event) {
  if (event.getState().getMaterial().equals(Material.WATER)
      || event.getState().getMaterial().equals(Material.LAVA)) {
    event.setDensity(0);
    event.setCanceled(true);
  }
}
 
Example 14
Source Project: EmergingTechnology   Source File: Ladder.java    License: MIT License 5 votes vote down vote up
public Ladder()
{
    super(Material.CIRCUITS);
    this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
    this.setRegistryName(EmergingTechnology.MODID, _name);
    this.setUnlocalizedName(EmergingTechnology.MODID + "." + _name);
    this.setCreativeTab(EmergingTechnology.TECHNOLOGYTAB);
    this.setSoundType(SoundType.STONE);
}
 
Example 15
Source Project: EmergingTechnology   Source File: Hydroponic.java    License: MIT License 5 votes vote down vote up
public Hydroponic() {
    super(Material.IRON, "hydroponic");
    this.setSoundType(SoundType.METAL);

    setDefaultState(
            blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(HAS_WATER, false));
}
 
Example 16
Source Project: Et-Futurum   Source File: BlockBanner.java    License: The Unlicense 5 votes vote down vote up
public BlockBanner() {
	super(Material.wood);
	disableStats();
	setHardness(1.0F);
	setStepSound(soundTypeWood);
	setBlockName(Utils.getUnlocalisedName("banner"));
	setCreativeTab(EtFuturum.enableBanners ? EtFuturum.creativeTab : null);

	float f = 0.25F;
	float f1 = 1.0F;
	setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
}
 
Example 17
Source Project: TFC2   Source File: BlockFarmland.java    License: GNU General Public License v3.0 5 votes vote down vote up
public BlockFarmland()
{
	super(Material.GROUND, META_PROPERTY);
	this.setCreativeTab(TFCTabs.TFCBuilding);
	setSoundType(SoundType.GROUND);
	this.setTickRandomly(true);
}
 
Example 18
Source Project: mocreaturesdev   Source File: MoCEntityEgg.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean handleWaterMovement()
{
    if (worldObj.handleMaterialAcceleration(boundingBox, Material.water, this))
    {
        this.inWater = true;
        return true;
    }
    else
    {
        this.inWater = false;
        return false;
    }
}
 
Example 19
Source Project: Et-Futurum   Source File: PrismarineBlocks.java    License: The Unlicense 5 votes vote down vote up
public PrismarineBlocks() {
	super(Material.rock, "rough", "bricks", "dark");
	setHardness(1.5F);
	setResistance(10.0F);
	setBlockTextureName("prismarine");
	setBlockName(Utils.getUnlocalisedName("prismarine_block"));
	setCreativeTab(EtFuturum.enablePrismarine ? EtFuturum.creativeTab : null);
}
 
Example 20
Source Project: GardenCollection   Source File: BlockThinLogFence.java    License: MIT License 5 votes vote down vote up
public boolean canConnectFenceTo (IBlockAccess world, int x, int y, int z) {
    Block block = world.getBlock(x, y, z);
    if (block != this)
        return (block.getMaterial().isOpaque() && block.renderAsNormalBlock()) ? block.getMaterial() != Material.gourd : false;

    return true;
}
 
Example 21
Source Project: PneumaticCraft   Source File: IC2.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public void preInit(){
    pneumaticGenerator = new BlockPneumaticGenerator(Material.iron).setHardness(3.0F).setResistance(10.0F).setBlockName("pneumaticGenerator");
    electricCompressor = new BlockElectricCompressor(Material.iron).setHardness(3.0F).setResistance(10.0F).setBlockName("electricCompressor");
    Blockss.registerBlock(pneumaticGenerator);
    Blockss.registerBlock(electricCompressor);
    GameRegistry.registerTileEntity(TileEntityPneumaticGenerator.class, "TileEntityPneumaticGenerator");
    GameRegistry.registerTileEntity(TileEntityElectricCompressor.class, "TileEntityElectricCompressor");
    PneumaticRegistry.getInstance().registerBlockTrackEntry(new BlockTrackEntryIC2());
}
 
Example 22
Source Project: ExtraCells1   Source File: BlockLevelEmitterFluid.java    License: MIT License 5 votes vote down vote up
public BlockLevelEmitterFluid(int id)
{
	super(id, Material.rock);
	setCreativeTab(extracells.Extracells.ModTab);
	setUnlocalizedName("block.fluid.levelemitter");
	setHardness(2.0F);
	setResistance(10.0F);
}
 
Example 23
Source Project: TofuCraftReload   Source File: BlockBarrel.java    License: MIT License 5 votes vote down vote up
public boolean isUnderWeight(World world, BlockPos pos) {
    IBlockState weightBlock = world.getBlockState(pos.up());
    IBlockState baseBlock = world.getBlockState(pos.down());

    boolean isWeightValid = weightBlock != null
            && (weightBlock.getMaterial() == Material.ROCK || weightBlock.getMaterial() == Material.IRON);

    float baseHardness = baseBlock.getBlockHardness(world, pos.down());
    boolean isBaseValid = baseBlock.isNormalCube() &&
            (baseBlock.getMaterial() == Material.ROCK || baseBlock.getMaterial() == Material.IRON || baseHardness >= 1.0F || baseHardness < 0.0F);

    return isWeightValid && isBaseValid;
}
 
Example 24
Source Project: ExNihiloAdscensio   Source File: ENBlocks.java    License: MIT License 5 votes vote down vote up
public static void init()
{
       dust = new BlockBaseFalling(SoundType.CLOTH, "blockDust");
       dust.setCreativeTab(ExNihiloAdscensio.tabExNihilo);
       dust.setHardness(0.7F);
       
       netherrackCrushed = new BlockBaseFalling(SoundType.GROUND, "blockNetherrackCrushed");
       netherrackCrushed.setCreativeTab(ExNihiloAdscensio.tabExNihilo);
       netherrackCrushed.setHardness(0.7F);

       endstoneCrushed = new BlockBaseFalling(SoundType.GROUND, "blockEndstoneCrushed");
       endstoneCrushed.setCreativeTab(ExNihiloAdscensio.tabExNihilo);
       endstoneCrushed.setHardness(0.7F);
       
       barrelWood = new BlockBarrel(0, Material.WOOD);
       barrelWood.setCreativeTab(ExNihiloAdscensio.tabExNihilo);
       GameRegistry.registerTileEntity(TileBarrel.class, "blockBarrel0");
       
       barrelStone = new BlockBarrel(1, Material.ROCK);
       barrelStone.setCreativeTab(ExNihiloAdscensio.tabExNihilo);
       GameRegistry.registerTileEntity(TileBarrel.class, "blockBarrel1");
	
	infestedLeaves = new BlockInfestedLeaves();
	GameRegistry.registerTileEntity(TileInfestedLeaves.class, "blockInfestedLeaves");
	infestedLeaves.setCreativeTab(ExNihiloAdscensio.tabExNihilo);
	
	crucible = new BlockCrucible();
	crucible.setCreativeTab(ExNihiloAdscensio.tabExNihilo);
	GameRegistry.registerTileEntity(TileCrucible.class, "blockCrucible");
	
	sieve = new BlockSieve();
	sieve.setCreativeTab(ExNihiloAdscensio.tabExNihilo);
	GameRegistry.registerTileEntity(TileSieve.class, "blockSieve");
	
	fluidWitchwater = new FluidWitchWater();
	blockWitchwater = new BlockFluidWitchwater();
	FluidRegistry.addBucketForFluid(fluidWitchwater);
}
 
Example 25
public BlockConcrete() {
    super(Material.ROCK);
    setUnlocalizedName("concrete");
    setHardness(2.0f);
    setResistance(3.0f);
    setSoundType(SoundType.STONE);
    setHarvestLevel("pickaxe", 1);
    setDefaultState(withVariant(
        ConcreteVariant.LIGHT_CONCRETE,
        ChiselingVariant.NORMAL));
}
 
Example 26
Source Project: Cyberware   Source File: BlockSurgeryChamber.java    License: MIT License 5 votes vote down vote up
public BlockSurgeryChamber()
{
	super(Material.IRON);
	this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(OPEN, Boolean.valueOf(false)).withProperty(HALF, EnumChamberHalf.LOWER));
	
	setHardness(5.0F);
	setResistance(10.0F);
	setSoundType(SoundType.METAL);
	
	String name = "surgeryChamber";
	
	this.setRegistryName(name);
	GameRegistry.register(this);

	ib = new ItemSurgeryChamber(this);
	ib.setRegistryName(name);
	GameRegistry.register(ib);
	
	this.setUnlocalizedName(Cyberware.MODID + "." + name);
	ib.setUnlocalizedName(Cyberware.MODID + "." + name);

	ib.setCreativeTab(Cyberware.creativeTab);
	
	GameRegistry.registerTileEntity(TileEntitySurgeryChamber.class, Cyberware.MODID + ":" + name);
	
	CyberwareContent.items.add(ib);
}
 
Example 27
public BlockEnderUtilities(String name, float hardness, float resistance, int harvestLevel, Material material)
{
    super(material);
    this.setHardness(hardness);
    this.setResistance(resistance);
    this.setHarvestLevel("pickaxe", harvestLevel);
    this.setCreativeTab(CreativeTab.ENDER_UTILITIES_TAB);
    this.setSoundType(SoundType.STONE);
    this.blockName = name;
    this.unlocalizedNames = this.generateUnlocalizedNames();
    this.tooltipNames = this.generateTooltipNames();
}
 
Example 28
public GTBlockBattery(String name, int tier, int transferLimit, int maxCharge) {
	super(Material.GROUND, GTLang.BATTERYBLOCK_LV, 3);
	this.maxCharge = maxCharge;
	this.transferLimit = transferLimit;
	this.tier = tier;
	this.name = name;
	this.setRegistryName(name.toLowerCase());
	this.setResistance(20.0F);
	this.setSoundType(SoundType.METAL);
	this.setCreativeTab(GTMod.creativeTabGT);
	this.setHardness(0.2F);
	this.setSoundType(SoundType.CLOTH);
}
 
Example 29
Source Project: GregTech   Source File: BlockMineral.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
public BlockMineral() {
    super(Material.ROCK);
    setUnlocalizedName("mineral");
    setHardness(3.0f);
    setResistance(6.0f);
    setSoundType(SoundType.STONE);
    setHarvestLevel("pickaxe", 1);
    setDefaultState(withVariant(
        MineralVariant.MARBLE,
        ChiselingVariant.NORMAL));
}
 
Example 30
Source Project: Chisel   Source File: BlockSnakestone.java    License: GNU General Public License v2.0 5 votes vote down vote up
public BlockSnakestone(String iconPrefix)
{
    super(Material.rock);
    setHardness(1.5F);
    setResistance(10.0F);
    setStepSound(Block.soundTypeStone);
    setCreativeTab(Chisel.tabChisel);
    flipTopTextures = false;

    this.iconPrefix = iconPrefix;
}