@Override public BlockState getBlock(BlockVector3 position) { World world = getWorld(); BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()); IBlockState mcState = world.getBlockState(pos); BlockType blockType = BlockType.REGISTRY.get(Block.REGISTRY.getNameForObject(mcState.getBlock()).toString()); return blockType.getState(adaptProperties(blockType, mcState.getProperties())); }
public static IWikiProvider getWikiFor(Block block) { ResourceLocation mod = Block.REGISTRY.getNameForObject(block); return getWikiFor(mod == null ? "" : mod.getNamespace().toLowerCase()); }
private static boolean isCheatyBlock(World world, BlockPos pos) { Block block = world.getBlockState(pos).getBlock(); return CHEATY_BLOCKS.contains(Block.REGISTRY.getNameForObject(block)); }
private boolean setBlock(ItemStack stack, Block block, int meta) { ItemNBTHelper.setString(stack, TAG_BLOCK_NAME, Block.REGISTRY.getNameForObject(block).toString()); ItemNBTHelper.setInt(stack, TAG_BLOCK_META, meta); return true; }
private void setTargetBlock(ItemStack stack, Block block, int meta) { ItemNBTHelper.setString(stack, TAG_TARGET_BLOCK_NAME, Block.REGISTRY.getNameForObject(block).toString()); ItemNBTHelper.setInt(stack, TAG_TARGET_BLOCK_META, meta); }
private boolean setBlock(ItemStack stack, Block block, int meta) { if(Item.getItemFromBlock(block) != Items.AIR) { ItemNBTHelper.setString(stack, TAG_BLOCK_NAME, Block.REGISTRY.getNameForObject(block).toString()); ItemNBTHelper.setInt(stack, TAG_BLOCK_META, meta); return true; } return false; }
@Override public void writePacketNBT(NBTTagCompound cmp) { if(camoState != null) { cmp.setString(TAG_CAMO, Block.REGISTRY.getNameForObject(camoState.getBlock()).toString()); cmp.setInteger(TAG_CAMO_META, camoState.getBlock().getMetaFromState(camoState)); } }
/** * (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound compound) { compound.setInteger("xTile", this.xTile); compound.setInteger("yTile", this.yTile); compound.setInteger("zTile", this.zTile); ResourceLocation resourcelocation = Block.REGISTRY.getNameForObject(this.inTile); compound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString()); compound.setByte("shake", (byte)this.throwableShake); compound.setByte("inGround", (byte)(this.inGround ? 1 : 0)); if ((this.throwerName == null || this.throwerName.isEmpty()) && this.thrower instanceof EntityPlayer) { this.throwerName = this.thrower.getName(); } compound.setString("ownerName", this.throwerName == null ? "" : this.throwerName); }
private static void registerSlabTop(@Nonnull Block bottom, Block top) { ResourceLocation block = Block.REGISTRY.getNameForObject(bottom); String name = block.getResourcePath() + "_top"; // GameRegistry.registerBlock(top, ItemCarvableSlab.class, name); TODO }
@Override protected @Nonnull ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState state) { Map<IProperty<?>, Comparable<?>> map = Maps.<IProperty<?>, Comparable<?>> newLinkedHashMap(state.getProperties()); return new ModelResourceLocation(Block.REGISTRY.getNameForObject(Blocks.LEVER), this.getPropertyString(map)); }
@Override protected @Nonnull ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState state) { Map<IProperty<?>, Comparable<?>> map = Maps.<IProperty<?>, Comparable<?>> newLinkedHashMap(state.getProperties()); map.remove(BlockColored.COLOR); return new ModelResourceLocation(Block.REGISTRY.getNameForObject(ModObject.blockFusedQuartz.getBlockNN()), this.getPropertyString(map)); }
@Override protected @Nonnull ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState state) { Map<IProperty<?>, Comparable<?>> map = Maps.<IProperty<?>, Comparable<?>> newLinkedHashMap(state.getProperties()); map.remove(BlockConduitBundle.OPAQUE); return new ModelResourceLocation(Block.REGISTRY.getNameForObject(state.getBlock()), this.getPropertyString(map)); }
@Override protected @Nonnull ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState state) { return new ModelResourceLocation(Block.REGISTRY.getNameForObject(Blocks.FIRE), this.getPropertyString(state.getProperties())); }
@Override @Nonnull protected ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState state) { Map <IProperty<?>, Comparable<? >> map = Maps.newLinkedHashMap(state.getProperties()); map.remove(HFCrops.CROPS.property); //Remove the base property for rendering purposes return new ModelResourceLocation(Block.REGISTRY.getNameForObject(state.getBlock()), getPropertyString(map)); }
public static String blockToString(Block block) { ResourceLocation loc = Block.REGISTRY.getNameForObject(block); String name = loc.getPath(); // normally, only write the part after the minecraft: if (!loc.getNamespace().equals("minecraft")) { // Baritone is running on top of forge with mods installed, perhaps? name = loc.toString(); // include the namespace with the colon } return name; }
public void writeToNBT(NBTTagCompound tag) { NBTHelper.writeBlockPos("Location", tag, pos); tag.setString("Block", Block.REGISTRY.getNameForObject(block).toString()); tag.setInteger("Meta", meta); } }
/** * Set the inner blockState. * @param blockState The blockState state. */ public void setInnerBlockState(IBlockState blockState) { this.meta = blockState.getBlock().getMetaFromState(blockState); this.blockName = Block.REGISTRY.getNameForObject(blockState.getBlock()).toString(); }
@Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { String resourceDomain = Block.REGISTRY.getNameForObject(state.getBlock()).getNamespace(); String resourceLocation = "apiculture/alveary_" + type; String propertyString = getPropertyString(state.getProperties()); return new ModelResourceLocation(resourceDomain + ':' + resourceLocation, propertyString); }
ItemNBTHelper.setString(copyLens, TAG_BLOCK_NAME, Block.REGISTRY.getNameForObject(block).toString()); ItemNBTHelper.setInt(copyLens, TAG_META, block.getMetaFromState(state)); NBTTagCompound cmp = new NBTTagCompound();
@Override public void writeToNBT(NBTTagCompound nbt, String name) { final NBTTagCompound tag = new NBTTagCompound(); final Block block = state.getBlock(); final int meta = block.getMetaFromState(state); tag.setByte(TAG_BLOCK_META, (byte)meta); final ResourceLocation blockId = Block.REGISTRY.getNameForObject(block); tag.setString(TAG_BLOCK_ID, blockId.toString()); nbt.setTag(name, tag); }