Java Code Examples for net.minecraft.block.Block#getIdFromBlock()
The following examples show how to use
net.minecraft.block.Block#getIdFromBlock() .
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 File: FastEat.java From ehacks-pro with GNU General Public License v3.0 | 6 votes |
@Override public void onTicks() { if (this.isActive() && Mouse.getEventButton() == 1 && Mouse.isButtonDown(1)) { if (this.mode == 1) { int[] ignoredBlockIds = new int[]{23, 25, 26, 54, 58, 61, 62, 64, 69, 71, 77, 84, 92, 96, 107, 116, 117, 118, 120, 130, 137, 143, 145, 146, 149, 150, 154, 158}; for (int id : ignoredBlockIds) { if (Block.getIdFromBlock(Wrapper.INSTANCE.world().getBlock(Wrapper.INSTANCE.mc().objectMouseOver.blockX, Wrapper.INSTANCE.mc().objectMouseOver.blockY, Wrapper.INSTANCE.mc().objectMouseOver.blockZ)) != id) { continue; } return; } } if (Wrapper.INSTANCE.player().inventory.getCurrentItem() == null) { return; } Item item = Wrapper.INSTANCE.player().inventory.getCurrentItem().getItem(); if (Wrapper.INSTANCE.player().onGround && (item instanceof ItemFood || item instanceof ItemPotion) && (Wrapper.INSTANCE.player().getFoodStats().needFood() || item instanceof ItemPotion || item instanceof ItemAppleGold)) { Wrapper.INSTANCE.player().sendQueue.addToSendQueue(new C09PacketHeldItemChange(Wrapper.INSTANCE.player().inventory.currentItem)); for (int i = 0; i < 1000; ++i) { Wrapper.INSTANCE.player().sendQueue.addToSendQueue(new C03PacketPlayer(false)); } Wrapper.INSTANCE.player().sendQueue.addToSendQueue(new C07PacketPlayerDigging(5, 0, 0, 0, 255)); } } }
Example 2
Source File: SchematicaSchematic.java From litematica with GNU Lesser General Public License v3.0 | 6 votes |
protected void createRegistryBasedPalette() { for (ResourceLocation key : Block.REGISTRY.getKeys()) { Block block = Block.REGISTRY.getObject(key); if (block != null) { int id = Block.getIdFromBlock(block); if (id >= 0 && id < this.palette.length) { this.palette[id] = block; } else { InfoUtils.printErrorMessage("litematica.message.error.schematic_read.registry_palette.missing_block_data", id, key); } } } }
Example 3
Source File: SchematicaSchematic.java From litematica with GNU Lesser General Public License v3.0 | 6 votes |
protected void createPalette() { if (this.palette == null) { this.palette = new Block[4096]; ILitematicaBlockStatePalette litematicaPalette = this.blockContainer.getPalette(); final int numBlocks = litematicaPalette.getPaletteSize(); for (int i = 0; i < numBlocks; ++i) { IBlockState state = litematicaPalette.getBlockState(i); Block block = state.getBlock(); int id = Block.getIdFromBlock(block); if (id >= this.palette.length) { InfoUtils.printErrorMessage("litematica.message.error.schematic_write.schematica.palette.invalid_id", id, state, this.palette.length - 1); continue; } this.palette[id] = block; } } }
Example 4
Source File: MixinBlock.java From LiquidBounce with GNU General Public License v3.0 | 5 votes |
@Inject(method = "isCollidable", at = @At("HEAD"), cancellable = true) private void isCollidable(CallbackInfoReturnable<Boolean> callbackInfoReturnable) { final GhostHand ghostHand = (GhostHand) LiquidBounce.moduleManager.getModule(GhostHand.class); if (ghostHand.getState() && !(ghostHand.getBlockValue().get() == Block.getIdFromBlock((Block) (Object) this))) callbackInfoReturnable.setReturnValue(false); }
Example 5
Source File: MinecraftDomainGenerator.java From burlapcraft with GNU Lesser General Public License v3.0 | 5 votes |
public List<PropositionalFunction> generatePfs(){ List<PropositionalFunction> pfs = new ArrayList<PropositionalFunction>(); pfs.add(new PFAgentOnBlock(HelperNameSpace.PF_AGENT_ON_BLOCK, new String[] {CLASS_AGENT, HelperNameSpace.CLASS_BLOCK})); for(Block b : HelperActions.mineableBlocks) { int id = Block.getIdFromBlock(b); pfs.add(new PFBlockIsType(HelperNameSpace.PF_BLOCK_IS_TYPE +id, new String[]{HelperNameSpace.CLASS_BLOCK}, id)); } return pfs; }
Example 6
Source File: BW_MetaGenerated_Ores.java From bartworks with MIT License | 5 votes |
public static boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean air, Block block, int[] aBlockMeta) { if (!air) { aY = Math.min(aWorld.getActualHeight(), Math.max(aY, 1)); } Block tBlock = aWorld.getBlock(aX, aY, aZ); Block tOreBlock = WerkstoffLoader.BWOres; if (aMetaData < 0 || tBlock == Blocks.air && !air) { return false; } else { if (Block.getIdFromBlock(tBlock) != Block.getIdFromBlock(block)) { return false; } final int aaY = aY; if (Arrays.stream(aBlockMeta).noneMatch(e -> e == aWorld.getBlockMetadata(aX, aaY, aZ))) { return false; } aWorld.setBlock(aX, aY, aZ, tOreBlock, aMetaData, 0); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (tTileEntity instanceof BW_MetaGeneratedOreTE) { ((BW_MetaGeneratedOreTE) tTileEntity).mMetaData = (short) aMetaData; } return true; } }
Example 7
Source File: BW_MetaGenerated_SmallOres.java From bartworks with MIT License | 5 votes |
public static boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean air, Block block, int[] aBlockMeta) { if (!air) { aY = Math.min(aWorld.getActualHeight(), Math.max(aY, 1)); } Block tBlock = aWorld.getBlock(aX, aY, aZ); Block tOreBlock = WerkstoffLoader.BWSmallOres; if (aMetaData < 0 || tBlock == Blocks.air && !air) { return false; } else { if (Block.getIdFromBlock(tBlock) != Block.getIdFromBlock(block)) { return false; } final int aaY = aY; if (Arrays.stream(aBlockMeta).noneMatch(e -> e == aWorld.getBlockMetadata(aX, aaY, aZ))) { return false; } aWorld.setBlock(aX, aY, aZ, tOreBlock, aMetaData, 0); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (tTileEntity instanceof BW_MetaGeneratedOreTE) { ((BW_MetaGeneratedOreTE) tTileEntity).mMetaData = (short) aMetaData; } return true; } }
Example 8
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public int getCombinedId4Data(ExtendedBlockStorage section, int x, int y, int z) { IBlockState ibd = section.getData().get(x & 15, y & 15, z & 15); Block block = ibd.getBlock(); int id = Block.getIdFromBlock(block); if (FaweCache.hasData(id)) { return (id << 4) + block.getMetaFromState(ibd); } else { return id << 4; } }
Example 9
Source File: NoSlowdown.java From ForgeHax with MIT License | 5 votes |
@SubscribeEvent public void onDoApplyBlockMovement(DoBlockCollisionsEvent event) { if (event.getEntity().equals(getLocalPlayer())) { if (Block.getIdFromBlock(event.getState().getBlock()) == 88) { // soul sand event.setCanceled(true); } } }
Example 10
Source File: SpongeQueue_1_12.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public int getCombinedId4Data(ExtendedBlockStorage section, int x, int y, int z) { IBlockState ibd = section.getData().get(x & 15, y & 15, z & 15); Block block = ibd.getBlock(); int id = Block.getIdFromBlock(block); if (FaweCache.hasData(id)) { return (id << 4) + block.getMetaFromState(ibd); } else { return id << 4; } }
Example 11
Source File: SpongeQueue_1_11.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public int getCombinedId4Data(ExtendedBlockStorage section, int x, int y, int z) { IBlockState ibd = section.getData().get(x & 15, y & 15, z & 15); Block block = ibd.getBlock(); int id = Block.getIdFromBlock(block); if (FaweCache.hasData(id)) { return (id << 4) + block.getMetaFromState(ibd); } else { return id << 4; } }
Example 12
Source File: TileEssentiaCompressor.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
private void consumeElements() { if(coordPedestal != null) { if(!checkPedestal(coordPedestal)) { consumeTick = 0; coordPedestal = null; return; } consumeTick++; if(consumeTick <= 400) { PacketAnimationAbsorb absorb = new PacketAnimationAbsorb( xCoord, yCoord + 1, zCoord, coordPedestal.getBlockX(), coordPedestal.getBlockY() + 1, coordPedestal.getBlockZ(), 5, Block.getIdFromBlock(ConfigBlocks.blockCosmeticSolid), 1); makeo.gadomancy.common.network.PacketHandler.INSTANCE.sendToAllAround(absorb, new NetworkRegistry.TargetPoint( getWorldObj().provider.dimensionId, xCoord, yCoord, zCoord, 16)); } else { TilePedestal te = (TilePedestal) worldObj.getTileEntity( coordPedestal.getBlockX(), coordPedestal.getBlockY(), coordPedestal.getBlockZ()); te.setInventorySlotContents(0, null); te.markDirty(); worldObj.markBlockForUpdate( coordPedestal.getBlockX(), coordPedestal.getBlockY(), coordPedestal.getBlockZ()); consumeTick = 0; coordPedestal = null; incSize += 1; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); markDirty(); } } else { for (int xx = -3; xx <= 3; xx++) { for (int zz = -3; zz <= 3; zz++) { Vector3 offset = new Vector3(xCoord + xx, yCoord, zCoord + zz); if(checkPedestal(offset)) { this.coordPedestal = offset; this.consumeTick = 0; return; } } } this.coordPedestal = null; this.consumeTick = 0; } }
Example 13
Source File: XrayModule.java From seppuku with GNU General Public License v3.0 | 4 votes |
public void add(String name) { final int id = Block.getIdFromBlock(Block.getBlockFromName(name)); if(!contains(id)) { this.ids.add(id); } }
Example 14
Source File: MappingRegistry.java From Framez with GNU General Public License v3.0 | 4 votes |
public int blockIdToWorld(int id) throws MappingNotFoundException { Block block = getBlockForId(id); return Block.getIdFromBlock(block); }
Example 15
Source File: SyncableBlock.java From OpenModsLib with MIT License | 4 votes |
@Override public void writeToStream(PacketBuffer stream) { int blockId = Block.getIdFromBlock(block); if (blockId < 0) blockId = 0; stream.writeVarInt(blockId); }
Example 16
Source File: TileEntityWoodProxy.java From GardenCollection with MIT License | 4 votes |
private int getUnifiedProtoData () { return (Block.getIdFromBlock(protoBlock) & 0xFFFF) | ((protoMeta & 0xFFFF) << 16); }
Example 17
Source File: BlockUtils.java From ForgeWurst with GNU General Public License v3.0 | 4 votes |
public static int getId(BlockPos pos) { return Block.getIdFromBlock(getBlock(pos)); }
Example 18
Source File: MultiblockStructureDefinition.java From ForbiddenMagic with Do What The F*ck You Want To Public License | 4 votes |
@Override public int hashCode() { return Block.getIdFromBlock(block); }
Example 19
Source File: WrapperBlock.java From ClientBase with MIT License | 4 votes |
public static int getIdFromBlock(WrapperBlock var0) { return Block.getIdFromBlock(var0.unwrap()); }
Example 20
Source File: BlockMetaPair.java From Framez with GNU General Public License v3.0 | 4 votes |
public BlockMetaPair(Block block, int meta) { this.id = Block.getIdFromBlock(block); this.meta = meta; }