下面列出了net.minecraft.util.MovingObjectPosition#net.minecraft.block.material.Material 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@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");
}
}
}
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);
}
}
}
@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) {
}
}
@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);
}
}
}
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));
}
@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();
}
}
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));
}
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));
}
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;
}
}
@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"));
}
public BlockWalrus(int id)
{
super(id, Material.rock);
setCreativeTab(extracells.Extracells.ModTab);
setUnlocalizedName("block.walrus");
setHardness(2.0F);
setResistance(10.0F);
}
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);
}
/**
* 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);
}
}
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);
}
public Hydroponic() {
super(Material.IRON, "hydroponic");
this.setSoundType(SoundType.METAL);
setDefaultState(
blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(HAS_WATER, false));
}
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);
}
public BlockFarmland()
{
super(Material.GROUND, META_PROPERTY);
this.setCreativeTab(TFCTabs.TFCBuilding);
setSoundType(SoundType.GROUND);
this.setTickRandomly(true);
}
@Override
public boolean handleWaterMovement()
{
if (worldObj.handleMaterialAcceleration(boundingBox, Material.water, this))
{
this.inWater = true;
return true;
}
else
{
this.inWater = false;
return false;
}
}
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);
}
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;
}
@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());
}
public BlockLevelEmitterFluid(int id)
{
super(id, Material.rock);
setCreativeTab(extracells.Extracells.ModTab);
setUnlocalizedName("block.fluid.levelemitter");
setHardness(2.0F);
setResistance(10.0F);
}
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;
}
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);
}
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));
}
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);
}
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();
}
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);
}
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));
}
public BlockSnakestone(String iconPrefix)
{
super(Material.rock);
setHardness(1.5F);
setResistance(10.0F);
setStepSound(Block.soundTypeStone);
setCreativeTab(Chisel.tabChisel);
flipTopTextures = false;
this.iconPrefix = iconPrefix;
}